Repository navigation
GOL-1268: Teach ctx.caller in the docs, skills and templates - #4691
Open
Aditya1404Sal wants to merge 21 commits into
Open
Aditya1404Sal wants to merge 21 commits into
Aditya1404Sal wants to merge 21 commits into
Conversation
…API provider's anonymous caller
✅ Deploy Preview for golemcloud canceled.
|
|
📖 Docs preview: https://docs-cn4wj1mmm-golem-cloud.vercel.app Built from commit |
…e default snapshot
…and the init context principal in the docs guard
…error for signatures
Aditya1404Sal
marked this pull request as ready for review
November 29, 2026 21:24
This branch has not been deployed
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.
Part of GOL-1268: the docs, skills, templates and SDK readmes. The home page snippets follow in a second PR.
On a request to add HTTP auth to a TypeScript agent, a coding agent that loads the skill
golem-add-http-auth-tswas told to read the caller withs.principal()andthis.getPrincipal(). The 2.0 SDKs have neither, so the code did not build, and no docs page or skill showedctx.caller.What changes
Every page, skill and template that a user or a coding agent reads now teaches the 2.0 API: a handler reads
ctx.callerin the form of its SDK, and storesctx.caller.original.ref, aPrincipalRef, when it must remember who called. The forms come from each SDK's own build error for a principal in a signature.Two rules were also wrong, not only the names:
Principalparameter: one shared cache entry andCache-Control: public". The executor keys every read-only result on the full caller, and an authenticated request always gets aprivateresponse. The pages now say so, and a read-only handler readsctx.callerlike any other handler.{version: 1, principal, state}. 2.0 writes{version: 2, state}and drops the principal of a 1.6 envelope on read.Files
docs/src/content/next/: 8 hand-written pages (authentication, custom APIs, read-only methods, CLI invocation, snapshotting, reflection, artifacts, router semantics).golem-skills/skills/: 54 skills, and the 54 how-to pages generated from them withcargo make generate-docs-skills. The Rust and Scala auth skills had no section on the caller; they now have one.cli/golem-cli/templates/ts/common/AGENTS.md(copied into every new TypeScript app) and its two copies intest-components/fault-matrix-tsandsdks/effect/integration-test/cross-sdk.getPrincipalis no longer a reserved state field), the EffectAGENTS.mdand the Scala snapshot doc..agents/skills/migrate-ts-decorator-sdkandtest-data/snapshot-multipart/README.md.Tests
docs/snippets/removed-caller-apis.test.ts(new) fails whendocs/src/content/next/,golem-skills/skills/orcli/golem-cli/templates/shows a removed 1.6 API:getPrincipal,s.principal(),PrincipalSchema,Principal.Principal, a principal parameter or field,uses_principal, "per-principal" caching. A second test checks the patterns against 1.6 and 2.0 lines.docs/snippets/public-examples.test.tsnow type-checks the TypeScript and Effect samples ofauthentication.mdxandread-only-methods.mdxagainst the in-tree SDKs. A wrong new sample, for examplectx.caller()in TypeScript (a property, not a method), fails there.Checks
Local, on macOS. The first two checks ran at
3cbd8ceeab, the merge of main663d3034c7. The sample checks below them ran at earlier commits of this PR, and the sample code has not changed since:bun run build:checkindocs/(lint, format,tsc, link check, tooling tests): green.cargo make check-docs-skills: the how-to pages match the skills.golem-rust(cargo test --no-runwithexport_golem_agentic). APrincipalparameter put in their place fails with the SDK's build error.go vetforwasip1againstsdks/go/golem.Note: those older sample checks ran against the SDKs of their time. Main has since changed the SDKs, but not in the caller APIs that the samples use.
🤖 Generated with Claude Code