docs: update examples with ecosystem integration#25
Merged
khaliqgant merged 5 commits intomainfrom Mar 29, 2026
Merged
Conversation
docker/seed.sh
Outdated
Comment on lines
+16
to
+31
| curl -sS -X PUT "$RELAYFILE/v1/workspaces/$WS/fs/file?path=/docs/welcome.md" \ | ||
| -H "Authorization: Bearer $TOKEN" \ | ||
| -H "Content-Type: application/octet-stream" \ | ||
| -d '# Welcome | ||
| Your relayfile workspace is running. | ||
| Write files here and agents will see them instantly.' | ||
|
|
||
| curl -sS -X PUT "$RELAYFILE/v1/workspaces/$WS/fs/file?path=/github/repos/demo/pulls/1/metadata.json" \ | ||
| -H "Authorization: Bearer $TOKEN" \ | ||
| -H "Content-Type: application/octet-stream" \ | ||
| -d '{"number":1,"title":"Add quickstart","state":"open","author":"dev"}' | ||
|
|
||
| curl -sS -X PUT "$RELAYFILE/v1/workspaces/$WS/fs/file?path=/config/agents.json" \ | ||
| -H "Authorization: Bearer $TOKEN" \ | ||
| -H "Content-Type: application/octet-stream" \ | ||
| -d '{"agents":[{"name":"dev-agent","scopes":["fs:read","fs:write"]}]}' |
Contributor
There was a problem hiding this comment.
🔴 seed.sh curl requests don't match the server's API contract — no files get seeded
The three curl -X PUT commands in seed.sh fail silently because they violate three requirements of the PUT /v1/workspaces/{id}/fs/file endpoint:
- Missing
X-Correlation-Idheader — the server rejects requests without this header with 400 (internal/httpapi/server.go:232-235). - Missing
If-Matchheader — the write handler requires it (internal/httpapi/server.go:1455-1459), returning 412 without it. The SDK sends"If-Match": input.baseRevision(e.g."*"for create-or-overwrite) atpackages/sdk/typescript/src/client.ts:321. - Wrong body format — the handler expects a JSON body with
{"contentType":…, "content":…, "encoding":…, "semantics":…}(internal/httpapi/server.go:1476-1483), but the script sends raw content withContent-Type: application/octet-stream.
Since curl returns exit code 0 for HTTP 4xx errors (no --fail flag), set -e doesn't catch the failures. The script prints a token and appears to succeed, but ws_demo contains no files. Every curl example in docker/README.md will get 404s.
Example fix for one of the PUT requests
curl -sS -X PUT "$RELAYFILE/v1/workspaces/$WS/fs/file?path=/docs/welcome.md" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "X-Correlation-Id: seed-welcome" \
-H "If-Match: *" \
-d '{"contentType":"text/markdown","content":"# Welcome\nYour relayfile workspace is running."}'
Suggested change
| curl -sS -X PUT "$RELAYFILE/v1/workspaces/$WS/fs/file?path=/docs/welcome.md" \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "Content-Type: application/octet-stream" \ | |
| -d '# Welcome | |
| Your relayfile workspace is running. | |
| Write files here and agents will see them instantly.' | |
| curl -sS -X PUT "$RELAYFILE/v1/workspaces/$WS/fs/file?path=/github/repos/demo/pulls/1/metadata.json" \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "Content-Type: application/octet-stream" \ | |
| -d '{"number":1,"title":"Add quickstart","state":"open","author":"dev"}' | |
| curl -sS -X PUT "$RELAYFILE/v1/workspaces/$WS/fs/file?path=/config/agents.json" \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "Content-Type: application/octet-stream" \ | |
| -d '{"agents":[{"name":"dev-agent","scopes":["fs:read","fs:write"]}]}' | |
| curl -sS -X PUT "$RELAYFILE/v1/workspaces/$WS/fs/file?path=/docs/welcome.md" \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -H "X-Correlation-Id: seed-welcome" \ | |
| -H "If-Match: *" \ | |
| -d '{"contentType":"text/markdown","content":"# Welcome\nYour relayfile workspace is running.\nWrite files here and agents will see them instantly."}' | |
| curl -sS -X PUT "$RELAYFILE/v1/workspaces/$WS/fs/file?path=/github/repos/demo/pulls/1/metadata.json" \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -H "X-Correlation-Id: seed-pr" \ | |
| -H "If-Match: *" \ | |
| -d '{"contentType":"application/json","content":"{\"number\":1,\"title\":\"Add quickstart\",\"state\":\"open\",\"author\":\"dev\"}"}' | |
| curl -sS -X PUT "$RELAYFILE/v1/workspaces/$WS/fs/file?path=/config/agents.json" \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -H "X-Correlation-Id: seed-config" \ | |
| -H "If-Match: *" \ | |
| -d '{"contentType":"application/json","content":"{\"agents\":[{\"name\":\"dev-agent\",\"scopes\":[\"fs:read\",\"fs:write\"]}]}"}' |
Was this helpful? React with 👍 or 👎 to provide feedback.
Five runnable TypeScript examples covering the core relayfile SDK: - 01: read files (listTree, readFile, queryFiles) - 02: write files (writeFile, bulkWrite, optimistic locking) - 03: webhook ingestion (ingestWebhook, computeCanonicalPath) - 04: realtime events (getEvents polling with cursors) - 05: scoped agent permissions (path-restricted tokens, 403 handling) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ation IDs in seed.sh
1155bf2 to
fdcfd3d
Compare
This was referenced Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds example 06 (WritebackConsumer), docker prereqs, shared type imports.