{"modulePath":"github.com/mirrorstack-ai/app-module-sdk","version":"v0.4.22","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package invocation\n\nPackage invocation exposes the platform-authored context for one module request. The SDK installs a Context only after authenticating the platform transport; module code must never decode X-MS-Invocation itself.\n\n## Constants\n\n```go\nconst (\n\t// Version is the first canonical module-invocation contract.\n\tVersion = 1\n\n\t// CookieCapabilityLegacyLogicalRead permits the platform to present an\n\t// unprefixed cookie only during the fixed compatibility window.\n\tCookieCapabilityLegacyLogicalRead = \"legacy-logical-read\"\n\t// CookieCapabilityPhysicalNamesV1 identifies the app-and-module-scoped\n\t// physical cookie namespace used for all current writes.\n\tCookieCapabilityPhysicalNamesV1 = \"physical-names-v1\"\n\n\t// IdentityKindMember identifies an end-user member assertion with no app\n\t// operator role.\n\tIdentityKindMember = \"member\"\n\t// IdentityKindPlatform identifies a platform user carrying an app role.\n\tIdentityKindPlatform = \"platform\"\n\n\t// TrustSourceDirect means API Platform received the request directly.\n\tTrustSourceDirect = \"direct\"\n\t// TrustSourceEdge means the trusted platform edge forwarded the request.\n\tTrustSourceEdge = \"edge\"\n)\n```\n\n## Types\n\n```go\ntype App struct {\n\tID     string `json:\"id\"`\n\tSchema string `json:\"schema\"`\n}\n```\nApp is the authoritative application scope.\n\n```go\ntype Audit struct {\n\tProvenance string `json:\"provenance\"`\n}\n```\nAudit carries opaque occurrence-bound provenance. The SDK preserves it; the platform audit ingress owns signature verification.\n\n```go\ntype Context struct {\n\tVersion  int      `json:\"v\"`\n\tApp      App      `json:\"app\"`\n\tModule   Module   `json:\"module\"`\n\tIdentity Identity `json:\"identity\"`\n\tRoutes   Routes   `json:\"routes\"`\n\tRequest  Request  `json:\"request\"`\n\tTrust    Trust    `json:\"trust\"`\n\tCookies  Cookies  `json:\"cookies\"`\n\tAudit    Audit    `json:\"audit\"`\n}\n```\nContext is the transport-neutral, platform-authored context for one concrete request occurrence. Slices are defensively copied when stored in or loaded from a context.Context.\n\n```go\nfunc FromContext(ctx context.Context) (Context, bool)\n```\nFromContext returns a defensive copy of the trusted invocation, if present.\n\n```go\ntype Cookies struct {\n\tNamespace       string    `json:\"namespace\"`\n\tPhysicalPrefix  string    `json:\"physicalPrefix\"`\n\tCapabilities    []string  `json:\"capabilities\"`\n\tLegacyReadUntil time.Time `json:\"legacyReadUntil\"`\n}\n```\nCookies describes the platform-owned physical cookie namespace.\n\n```go\ntype Identity struct {\n\tKind            string `json:\"kind,omitempty\"`\n\tUserID          string `json:\"userId,omitempty\"`\n\tAppRole         string `json:\"appRole,omitempty\"`\n\tActorDelegation string `json:\"actorDelegation,omitempty\"`\n}\n```\nIdentity is the verified end-user namespace and platform role. Empty fields represent an actorless request.\n\n```go\ntype Module struct {\n\tID   string `json:\"id\"`\n\tSlug string `json:\"slug\"`\n}\n```\nModule is the authoritative callee scope.\n\n```go\ntype Request struct {\n\tID         string    `json:\"id\"`\n\tMethod     string    `json:\"method\"`\n\tPath       string    `json:\"path\"`\n\tBodySHA256 string    `json:\"bodySha256\"`\n\tOccurredAt time.Time `json:\"occurredAt\"`\n}\n```\nRequest binds the context to one HTTP occurrence.\n\n```go\ntype Routes struct {\n\tOrigin       string   `json:\"origin\"`\n\tModule       string   `json:\"module\"`\n\tPublic       string   `json:\"public\"`\n\tPlatform     string   `json:\"platform\"`\n\tCurrentLocal string   `json:\"currentLocal\"`\n\tRedirects    []string `json:\"redirects\"`\n}\n```\nRoutes contains the canonical browser-facing routes for this installation.\n\n```go\ntype Trust struct {\n\tSource   string `json:\"source\"`\n\tClientIP string `json:\"clientIp,omitempty\"`\n\tHost     string `json:\"host\"`\n\tScheme   string `json:\"scheme\"`\n\tOrigin   string `json:\"origin\"`\n}\n```\nTrust records connection facts derived by the platform edge.\n\n","path":"github.com/mirrorstack-ai/app-module-sdk/invocation","name":"invocation","synopsis":"Package invocation exposes the platform-authored context for one module request.","isRedistributable":true}
