feat(core): API-managed per-session context entries (#34941)
This commit is contained in:
parent
4045041554
commit
7843f8fb38
18 changed files with 783 additions and 146 deletions
20
packages/schema/src/session-context-entry.ts
Normal file
20
packages/schema/src/session-context-entry.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
export * as SessionContextEntry from "./session-context-entry.js"
|
||||
|
||||
import { Schema } from "effect"
|
||||
|
||||
/**
|
||||
* Slash-free client-facing key for one API-managed context entry. The server
|
||||
* derives the namespaced SystemContext key as `api/<key>`, keeping the
|
||||
* `api/*` namespace enforced by construction.
|
||||
*/
|
||||
export const Key = Schema.String.check(Schema.isPattern(/^[a-z0-9][a-z0-9._-]*$/)).annotate({
|
||||
identifier: "SessionContextEntry.Key",
|
||||
description: "Context entry key (lowercase alphanumerics plus . _ -)",
|
||||
})
|
||||
export type Key = typeof Key.Type
|
||||
|
||||
export const Info = Schema.Struct({
|
||||
key: Key,
|
||||
value: Schema.Json.annotate({ description: "JSON value attached to the session's system context" }),
|
||||
}).annotate({ identifier: "SessionContextEntry.Info" })
|
||||
export interface Info extends Schema.Schema.Type<typeof Info> {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue