@dxos/compute 0.9.1-staging.ee54ba693a → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/lib/AgentService.mjs +16 -0
  2. package/dist/lib/AgentService.mjs.map +1 -0
  3. package/dist/lib/StorageService.mjs +59 -0
  4. package/dist/lib/StorageService.mjs.map +1 -0
  5. package/dist/lib/chunk-OperationHandlerSet.mjs +660 -0
  6. package/dist/lib/chunk-OperationHandlerSet.mjs.map +1 -0
  7. package/dist/lib/chunk-definitions.mjs +41 -0
  8. package/dist/lib/chunk-definitions.mjs.map +1 -0
  9. package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
  10. package/dist/lib/index.mjs +1576 -0
  11. package/dist/lib/index.mjs.map +1 -0
  12. package/dist/lib/testing.mjs +43 -0
  13. package/dist/lib/testing.mjs.map +1 -0
  14. package/dist/types/src/AgentIdentity.d.ts +27 -0
  15. package/dist/types/src/AgentIdentity.d.ts.map +1 -0
  16. package/dist/types/src/AgentService.d.ts +10 -2
  17. package/dist/types/src/AgentService.d.ts.map +1 -1
  18. package/dist/types/src/Cancellation.d.ts +19 -0
  19. package/dist/types/src/Cancellation.d.ts.map +1 -0
  20. package/dist/types/src/Credential.d.ts +41 -0
  21. package/dist/types/src/Credential.d.ts.map +1 -1
  22. package/dist/types/src/Operation.d.ts +79 -1
  23. package/dist/types/src/Operation.d.ts.map +1 -1
  24. package/dist/types/src/Process.d.ts +15 -3
  25. package/dist/types/src/Process.d.ts.map +1 -1
  26. package/dist/types/src/Trace.d.ts +55 -3
  27. package/dist/types/src/Trace.d.ts.map +1 -1
  28. package/dist/types/src/Trace.test.d.ts +2 -0
  29. package/dist/types/src/Trace.test.d.ts.map +1 -0
  30. package/dist/types/src/errors.d.ts +35 -1
  31. package/dist/types/src/errors.d.ts.map +1 -1
  32. package/dist/types/src/index.d.ts +3 -6
  33. package/dist/types/src/index.d.ts.map +1 -1
  34. package/dist/types/src/testing/index.d.ts +1 -0
  35. package/dist/types/src/testing/index.d.ts.map +1 -1
  36. package/dist/types/src/testing/operation.d.ts +5 -0
  37. package/dist/types/src/testing/operation.d.ts.map +1 -0
  38. package/dist/types/src/{Instructions.d.ts → types/Instructions.d.ts} +14 -1
  39. package/dist/types/src/types/Instructions.d.ts.map +1 -0
  40. package/dist/types/src/types/Instructions.test.d.ts +2 -0
  41. package/dist/types/src/types/Instructions.test.d.ts.map +1 -0
  42. package/dist/types/src/types/Project.d.ts +53 -0
  43. package/dist/types/src/types/Project.d.ts.map +1 -0
  44. package/dist/types/src/types/Project.test.d.ts +2 -0
  45. package/dist/types/src/types/Project.test.d.ts.map +1 -0
  46. package/dist/types/src/types/Routine.d.ts +42 -0
  47. package/dist/types/src/types/Routine.d.ts.map +1 -0
  48. package/dist/types/src/types/Routine.test.d.ts +2 -0
  49. package/dist/types/src/types/Routine.test.d.ts.map +1 -0
  50. package/dist/types/src/types/Script.d.ts.map +1 -0
  51. package/dist/types/src/{Skill.d.ts → types/Skill.d.ts} +1 -1
  52. package/dist/types/src/types/Skill.d.ts.map +1 -0
  53. package/dist/types/src/{Template.d.ts → types/Template.d.ts} +2 -2
  54. package/dist/types/src/types/Template.d.ts.map +1 -0
  55. package/dist/types/src/types/Template.test.d.ts.map +1 -0
  56. package/dist/types/src/types/Trigger.d.ts +249 -0
  57. package/dist/types/src/types/Trigger.d.ts.map +1 -0
  58. package/dist/types/src/{TriggerEvent.d.ts → types/TriggerEvent.d.ts} +19 -6
  59. package/dist/types/src/types/TriggerEvent.d.ts.map +1 -0
  60. package/dist/types/src/types/index.d.ts +9 -0
  61. package/dist/types/src/types/index.d.ts.map +1 -0
  62. package/dist/types/tsconfig.tsbuildinfo +1 -1
  63. package/package.json +18 -17
  64. package/src/AgentIdentity.ts +35 -0
  65. package/src/AgentService.ts +10 -2
  66. package/src/Cancellation.ts +33 -0
  67. package/src/Credential.ts +52 -0
  68. package/src/Operation.ts +92 -2
  69. package/src/Process.ts +21 -4
  70. package/src/Trace.test.ts +155 -0
  71. package/src/Trace.ts +207 -6
  72. package/src/errors.ts +9 -5
  73. package/src/index.ts +3 -6
  74. package/src/testing/index.ts +1 -0
  75. package/src/testing/operation.ts +21 -0
  76. package/src/types/Instructions.test.ts +18 -0
  77. package/src/{Instructions.ts → types/Instructions.ts} +22 -1
  78. package/src/types/Project.test.ts +52 -0
  79. package/src/types/Project.ts +99 -0
  80. package/src/types/Routine.test.ts +18 -0
  81. package/src/types/Routine.ts +85 -0
  82. package/src/{Skill.ts → types/Skill.ts} +2 -2
  83. package/src/{Template.test.ts → types/Template.test.ts} +2 -2
  84. package/src/{Template.ts → types/Template.ts} +2 -2
  85. package/src/{Trigger.ts → types/Trigger.ts} +126 -8
  86. package/src/{TriggerEvent.ts → types/TriggerEvent.ts} +23 -5
  87. package/src/types/index.ts +12 -0
  88. package/dist/lib/neutral/AgentService.mjs +0 -12
  89. package/dist/lib/neutral/AgentService.mjs.map +0 -7
  90. package/dist/lib/neutral/StorageService.mjs +0 -22
  91. package/dist/lib/neutral/StorageService.mjs.map +0 -7
  92. package/dist/lib/neutral/chunk-2ZN64ZS7.mjs +0 -25
  93. package/dist/lib/neutral/chunk-2ZN64ZS7.mjs.map +0 -7
  94. package/dist/lib/neutral/chunk-5VAXF6AH.mjs +0 -53
  95. package/dist/lib/neutral/chunk-5VAXF6AH.mjs.map +0 -7
  96. package/dist/lib/neutral/chunk-EVROJER7.mjs +0 -285
  97. package/dist/lib/neutral/chunk-EVROJER7.mjs.map +0 -7
  98. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  99. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  100. package/dist/lib/neutral/chunk-PF7XP7XP.mjs +0 -62
  101. package/dist/lib/neutral/chunk-PF7XP7XP.mjs.map +0 -7
  102. package/dist/lib/neutral/chunk-SJ37RWHU.mjs +0 -21
  103. package/dist/lib/neutral/chunk-SJ37RWHU.mjs.map +0 -7
  104. package/dist/lib/neutral/chunk-VSAZPWSJ.mjs +0 -25
  105. package/dist/lib/neutral/chunk-VSAZPWSJ.mjs.map +0 -7
  106. package/dist/lib/neutral/chunk-WEO4FCQY.mjs +0 -17
  107. package/dist/lib/neutral/chunk-WEO4FCQY.mjs.map +0 -7
  108. package/dist/lib/neutral/chunk-Z3Y7FQGN.mjs +0 -174
  109. package/dist/lib/neutral/chunk-Z3Y7FQGN.mjs.map +0 -7
  110. package/dist/lib/neutral/fib-5XIYECL5.mjs +0 -10
  111. package/dist/lib/neutral/fib-5XIYECL5.mjs.map +0 -7
  112. package/dist/lib/neutral/index.mjs +0 -1232
  113. package/dist/lib/neutral/index.mjs.map +0 -7
  114. package/dist/lib/neutral/meta.json +0 -1
  115. package/dist/lib/neutral/reply-GCBRCUVM.mjs +0 -10
  116. package/dist/lib/neutral/reply-GCBRCUVM.mjs.map +0 -7
  117. package/dist/lib/neutral/sleep-XR6CL6W3.mjs +0 -10
  118. package/dist/lib/neutral/sleep-XR6CL6W3.mjs.map +0 -7
  119. package/dist/lib/neutral/testing/index.mjs +0 -32
  120. package/dist/lib/neutral/testing/index.mjs.map +0 -7
  121. package/dist/types/src/Instructions.d.ts.map +0 -1
  122. package/dist/types/src/Script.d.ts.map +0 -1
  123. package/dist/types/src/Skill.d.ts.map +0 -1
  124. package/dist/types/src/Template.d.ts.map +0 -1
  125. package/dist/types/src/Template.test.d.ts.map +0 -1
  126. package/dist/types/src/Trigger.d.ts +0 -157
  127. package/dist/types/src/Trigger.d.ts.map +0 -1
  128. package/dist/types/src/TriggerEvent.d.ts.map +0 -1
  129. /package/dist/types/src/{Script.d.ts → types/Script.d.ts} +0 -0
  130. /package/dist/types/src/{Template.test.d.ts → types/Template.test.d.ts} +0 -0
  131. /package/src/{Script.ts → types/Script.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/McpServer.ts","../../src/types/Template.ts","../../src/Runnable.ts","../../src/types/Trigger.ts","../../src/types/Skill.ts","../../src/types/Instructions.ts","../../src/types/Routine.ts","../../src/types/Project.ts","../../src/types/Script.ts","../../src/types/TriggerEvent.ts","../../src/AgentIdentity.ts","../../src/Cancellation.ts","../../src/Credential.ts","../../src/Header.ts","../../src/LayerSpec.ts","../../src/OperationRegistry.ts","../../src/Trace.ts","../../src/Process.ts","../../src/ServiceResolver.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\n/**\n * MCP server connection spec — the minimal fields needed to dial an MCP server.\n *\n * Used as a value type embedded in skills and passed to runtime session connect logic.\n * The user-facing ECHO object (`@dxos/assistant-toolkit` `McpServer`) composes this struct\n * and adds instance-level fields (`name`, `enabled`) and ECHO annotations.\n */\nexport const McpServer = Schema.Struct({\n name: Schema.String.pipe(Schema.optional).annotations({\n description: 'Human-readable name of the MCP server',\n }),\n\n url: Schema.String.annotations({\n description: 'URL of the MCP server',\n }),\n\n /**\n * Transport protocol. Prefer `'http'` (Streamable HTTP) for new servers; `'sse'` is\n * kept for compatibility with servers that haven't migrated and is deprecated per\n * the MCP SDK. Clients support both during the migration period.\n */\n protocol: Schema.Union(Schema.Literal('http'), Schema.Literal('sse')).annotations({\n description: 'Transport protocol of the MCP server (prefer \"http\"; \"sse\" deprecated)',\n }),\n\n /**\n * Optional API key sent with requests.\n * Persisted in plaintext when stored on a space-replicated ECHO object — see the\n * `@dxos/assistant-toolkit` `McpServer` type for security implications.\n */\n apiKey: Schema.optional(Schema.String).annotations({\n description: 'Optional API key sent with requests',\n }),\n});\n\nexport type McpServer = Schema.Schema.Type<typeof McpServer>;\n","//\n// Copyright 2024 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { Database, DXN, Filter, Ref, Registry } from '@dxos/echo';\nimport type { EntityNotFoundError } from '@dxos/echo/Err';\nimport { assertArgument, invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { Text } from '@dxos/schema';\nimport Handlebars from '@dxos/vendor-kbn-handlebars';\n\nimport { FunctionNotFoundError } from '../errors';\nimport * as Operation from '../Operation';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'operation',\n // 'pass-through',\n // 'retriever',\n // 'query',\n // 'resolver',\n // 'context',\n // 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.Struct({\n name: Schema.String,\n kind: InputKind,\n default: Schema.optional(Schema.Any),\n /**\n * Operation key invoked when `kind === 'operation'`. The referenced operation must accept void input —\n * template inputs have no mechanism for passing arguments.\n */\n operation: Schema.optional(Schema.String),\n});\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Ref.Ref(Text.Text).annotations({ description: 'Markdown + Handlebars template.' }),\n\n /**\n * NOTE: We use an array rather than map so that updating variable names in the template doesn't disconnect existing inputs.\n */\n inputs: Schema.optional(Schema.Array(Input)),\n});\n\nexport type Template = Schema.Schema.Type<typeof Template>;\n\nexport type MakeProps = Partial<{ id: string; source: string; inputs: Input[] }>;\n\nexport const make = ({ id, source, inputs = [] }: MakeProps = {}): Template => ({\n source: Ref.make(Text.make({ id, content: source })),\n inputs,\n});\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, variables: Partial<Options> = {}): string => {\n assertArgument(typeof source === 'string', 'source');\n let section = 0;\n const handlebars = Handlebars.create();\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compileAST(source.trim());\n const output = template(variables);\n return output.trim().replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n\nexport const processTemplate = (\n template: Template,\n): Effect.Effect<string, EntityNotFoundError | FunctionNotFoundError, Registry.Service | Operation.Service> =>\n Effect.gen(function* () {\n const entries = yield* Effect.forEach(template.inputs ?? [], (input) =>\n Effect.gen(function* () {\n switch (input.kind) {\n case 'value': {\n return [input.name, input.default] as const;\n }\n\n case 'operation': {\n invariant(input.operation);\n // Normalize to a full DXN key so Filter.key matches the stored meta key.\n const key = DXN.isDXN(input.operation) ? input.operation : `dxn:${input.operation}`;\n const results = yield* Registry.runQuery(\n Filter.and(Filter.type(Operation.PersistentOperation), Filter.key(key)),\n );\n if (results.length === 0) {\n return yield* Effect.fail(new FunctionNotFoundError(input.operation));\n }\n\n // NOTE: Operations referenced by template inputs must accept void input — see `Input.operation`.\n const fn = Operation.deserialize(results[0]);\n const result = yield* Operation.invoke(fn, undefined as any).pipe(Effect.orDie);\n return [input.name, result] as const;\n }\n\n default: {\n return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);\n }\n }\n }),\n );\n\n const variables = Object.fromEntries(entries);\n\n log('processTemplate', { variables });\n return process((yield* Database.load(template.source)).content, variables);\n });\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Operation from './Operation';\n\n// TODO(wittjosiah): Currently just Operation. Widen to a union (Operation | ComputeGraph | …) once the\n// dispatcher/EDGE can run non-Operation runnables as a Process.\nexport type Runnable = Operation.PersistentOperation;\nexport const Runnable = Operation.PersistentOperation;\n","//\n// Copyright 2023 DXOS.org\n//\n\n// @import-as-namespace\n\nimport type { Atom } from '@effect-atom/atom';\nimport * as Context from 'effect/Context';\nimport type * as Effect from 'effect/Effect';\nimport * as Exit from 'effect/Exit';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { Annotation, DXN, Feed, Obj, type Query, QueryAST, Ref, Type } from '@dxos/echo';\nimport { HiddenAnnotation } from '@dxos/echo/Annotation';\nimport { OptionsAnnotationId } from '@dxos/echo/Format';\n\nimport * as Runnable from '../Runnable';\nimport type * as TriggerEvent from './TriggerEvent';\n\n/**\n * Type discriminator for TriggerType.\n * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport const Kinds = ['email', 'feed', 'direct', 'subscription', 'timer', 'webhook'] as const;\nexport type Kind = (typeof Kinds)[number];\n\nconst kindLiteralAnnotations = { title: 'Kind' };\n\nexport const EmailSpec = Schema.Struct({\n kind: Schema.Literal('email').annotations(kindLiteralAnnotations),\n});\nexport type EmailSpec = Schema.Schema.Type<typeof EmailSpec>;\n\n/**\n * Construct an Email trigger spec.\n */\nexport const specEmail = (): EmailSpec => ({ kind: 'email' });\n\n// TODO(wittjosiah): Remove. Migrate to Subscription triggers once EDGE supports them for feed queries.\nexport const FeedSpec = Schema.Struct({\n kind: Schema.Literal('feed').annotations(kindLiteralAnnotations),\n feed: Schema.optional(Ref.Ref(Feed.Feed).annotations({ title: 'Feed' })),\n});\nexport type FeedSpec = Schema.Schema.Type<typeof FeedSpec>;\n\n/**\n * Construct a Feed trigger spec from a Feed object.\n */\nexport const specFeed = (feed: Feed.Feed): FeedSpec => ({\n kind: 'feed',\n feed: Ref.make(feed),\n});\n\n/**\n * Subscription.\n */\nexport const SubscriptionSpec = Schema.Struct({\n kind: Schema.Literal('subscription').annotations(kindLiteralAnnotations),\n\n // TODO(burdon): Issue.\n query: Schema.Struct({\n raw: Schema.optional(Schema.String.annotations({ title: 'Query' })),\n ast: QueryAST.Query,\n }),\n\n options: Schema.optional(\n Schema.Struct({\n // Watch changes to object (not just creation).\n deep: Schema.optional(Schema.Boolean.annotations({ title: 'Nested' })),\n // Debounce changes (delay in ms).\n delay: Schema.optional(Schema.Number.annotations({ title: 'Delay' })),\n }).annotations({ title: 'Options' }),\n ),\n});\nexport type SubscriptionSpec = Schema.Schema.Type<typeof SubscriptionSpec>;\n\n/**\n * Construct a Subscription trigger spec from a Query object.\n */\nexport const specSubscription = (\n query: Query.Query<any>,\n options?: { deep?: boolean; delay?: number },\n): SubscriptionSpec => ({\n kind: 'subscription',\n query: {\n ast: query.ast,\n },\n options: options\n ? {\n deep: options.deep,\n delay: options.delay,\n }\n : undefined,\n});\n\n/**\n * Direct invocation only; never scheduled by the dispatcher (invoked on demand by a caller).\n */\nexport const DirectSpec = Schema.Struct({\n kind: Schema.Literal('direct').annotations(kindLiteralAnnotations),\n});\nexport type DirectSpec = Schema.Schema.Type<typeof DirectSpec>;\n\n/**\n * Construct a Direct trigger spec.\n */\nexport const specDirect = (): DirectSpec => ({ kind: 'direct' });\n\n/**\n * Cron timer.\n */\nexport const TimerSpec = Schema.Struct({\n kind: Schema.Literal('timer').annotations(kindLiteralAnnotations),\n cron: Schema.String.annotations({\n title: 'Cron',\n [SchemaAST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n});\nexport type TimerSpec = Schema.Schema.Type<typeof TimerSpec>;\n\n/**\n * Construct a Timer trigger spec from a cron string.\n */\nexport const specTimer = (cron: string): TimerSpec => ({ kind: 'timer', cron });\n\n/**\n * Webhook.\n */\nexport const WebhookSpec = Schema.Struct({\n kind: Schema.Literal('webhook').annotations(kindLiteralAnnotations),\n method: Schema.optional(\n Schema.String.annotations({\n title: 'Method',\n [OptionsAnnotationId]: ['GET', 'POST'],\n }),\n ),\n port: Schema.optional(\n Schema.Number.annotations({\n title: 'Port',\n }),\n ),\n});\nexport type WebhookSpec = Schema.Schema.Type<typeof WebhookSpec>;\n\n/**\n * Construct a Webhook trigger spec from a method and port.\n */\nexport const specWebhook = (opts?: { method?: string; port?: number }): WebhookSpec => ({\n kind: 'webhook',\n method: opts?.method,\n port: opts?.port,\n});\n\n/**\n * Trigger schema.\n */\nexport const Spec = Schema.Union(EmailSpec, FeedSpec, DirectSpec, SubscriptionSpec, TimerSpec, WebhookSpec).annotations(\n {\n title: 'Trigger',\n },\n);\nexport type Spec = Schema.Schema.Type<typeof Spec>;\n\n/**\n * Forms the input data passed to the function.\n * Must match the function's input schema.\n *\n * @example\n * {\n * item: '{{event.item}}',\n * instructions: 'Summarize and perform entity-extraction'\n * mailbox: { '/': 'echo://AAA/ZZZ' }\n * }\n */\nexport const InputTemplate = Schema.Record({ key: Schema.String, value: Schema.Any });\n\n/**\n * Function trigger.\n * Runnable is invoked with the `payload` passed as input data.\n * The event that fires the trigger is available in the runnable context.\n */\nexport class Trigger extends Type.makeObject<Trigger>(DXN.make('org.dxos.type.trigger', '0.1.0'))(\n Schema.Struct({\n /**\n * Runnable (operation or workflow) to invoke.\n * Wired programmatically (see plugin-routine's `wireTriggers`); not user-editable, so hidden from forms.\n */\n runnable: Ref.Ref(Runnable.Runnable).pipe(\n Schema.annotations({ title: 'Runnable' }),\n Annotation.FormInputAnnotation.set(false),\n Schema.optional,\n ),\n\n spec: Spec.pipe(Schema.optional),\n\n enabled: Schema.Boolean.pipe(Schema.optional),\n\n /**\n * Runs this trigger on the edge rather than locally.\n * When unset, the trigger runs locally on the client.\n */\n remote: Schema.Boolean.pipe(Schema.annotations({ title: 'Remote' }), Schema.optional),\n\n concurrency: Schema.Number.pipe(\n Schema.annotations({\n title: 'Concurrency',\n default: 1,\n description: 'Maximum number of concurrent invocations of the trigger.',\n }),\n Annotation.FormInputAnnotation.set(false),\n Schema.optional,\n ),\n\n /**\n * Only used for workflowSchema.\n * Specifies the input node in the circuit.\n * @deprecated Remove and enforce a single input node in all compute graphSchema.\n */\n inputNodeId: Schema.String.pipe(\n Schema.annotations({ title: 'Input Node ID' }),\n Annotation.FormInputAnnotation.set(false),\n Schema.optional,\n ),\n\n /**\n * Passed as the input data to the runnable.\n */\n input: InputTemplate.pipe(Annotation.FormInputAnnotation.set(false), Schema.optional),\n }).pipe(Annotation.IconAnnotation.set({ icon: 'ph--lightning--regular', hue: 'yellow' }), HiddenAnnotation.set(true)),\n) {}\n\nexport const make = (props: Obj.MakeProps<typeof Trigger>) => Obj.make(Trigger, props);\n\n/**\n * Checks if a trigger having this spec can be manually invoked (a `direct` or `timer` trigger).\n */\nexport const isManuallyInvokable = (spec?: Spec): boolean => spec?.kind === 'direct' || spec?.kind === 'timer';\n\n/**\n * Runtime state of a trigger.\n */\nexport interface State {\n /**\n * Reference to the trigger object.\n */\n readonly trigger: Ref.Ref<Trigger>;\n\n /**\n * Where is this trigger running.\n */\n readonly environment: 'edge' | 'local';\n\n /**\n * Next scheduled cron execution. Set only for `timer` triggers.\n */\n readonly nextExecution?: Date;\n\n /**\n * Time until which scheduled invocations of this trigger are skipped after a genuine failure.\n * Applies to all trigger kinds. Manual {@link TriggerDispatcher.invokeTrigger} calls bypass it.\n */\n readonly cooldownUntil?: Date;\n\n /**\n * Pending re-invocation requested via {@link Operation.runAgain} ({@link RunAgainError}).\n * Retries are drained at the tail of the invocation queue, ordered by `enqueuedAt`.\n */\n readonly retry?: {\n /**\n * Event to replay on the retry. Re-running is assumed safe with the same input.\n */\n readonly event: TriggerEvent.TriggerEvent;\n\n /**\n * Monotonic sequence number used to order pending retries FIFO at the tail of the queue.\n */\n readonly enqueuedAt: number;\n };\n\n /**\n * Result of the most recent invocation of this trigger.\n */\n readonly lastResult: Exit.Exit<unknown> | null;\n}\n\nexport interface InvokeOptions {\n trigger: Trigger;\n event: TriggerEvent.TriggerEvent;\n}\n\n/**\n * Service for monitoring trigger dispatcher state.\n */\nexport interface Monitor {\n /**\n * Triggers actively registered in the dispatcher.\n * Could contain entries for both local and edge triggers, but only the edge ones are actually running.\n */\n readonly triggers: Atom.Atom<readonly State[]>;\n\n readonly localDispatcherEnabled: boolean;\n\n /**\n * Invoke a trigger.\n * Available only for direct and timer triggers.\n * Invocation respects the trigger's concurrency limit.\n */\n readonly invokeTrigger: (options: InvokeOptions) => Effect.Effect<void>;\n}\n\n/**\n * Service for monitoring trigger executions.\n */\nexport class TriggerMonitorService extends Context.Tag('@dxos/functions/TriggerMonitorService')<\n TriggerMonitorService,\n Monitor\n>() {}\n","//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { ToolId } from '@dxos/ai';\nimport { Annotation, Database, DXN, Filter, Obj, Ref, Registry, Type, URI } from '@dxos/echo';\nimport { BaseError } from '@dxos/errors';\n// Text is referenced in the inferred type of Skill (via Template.Template → Ref.Ref(Text.Text));\n// the import lets TypeScript name it in the emitted .d.ts.\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport { type Text } from '@dxos/schema';\n\nimport * as McpServer from '../McpServer';\nimport * as Operation from '../Operation';\nimport * as Template from './Template';\nimport * as Trigger from './Trigger';\n\n/**\n * Skill schema defines the structure for AI assistant skills.\n * Skills contain instructions, tools, and artifacts that guide the AI's behavior.\n * Skills may use tools to create and read artifacts, which are managed by the assistant.\n *\n * The registry `key` and `version` are stored in the object meta — access them via\n * `Obj.getMeta(skill).key` and `Obj.getMeta(skill).version`.\n */\nexport class Skill extends Type.makeObject<Skill>(DXN.make('org.dxos.type.skill', '0.2.0'))(\n Schema.Struct({\n /**\n * Human-readable name of the skill.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the skill',\n }),\n\n /**\n * Description of the skill's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the skill's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this skill is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this skill is active',\n }),\n\n /**\n * Whether an agent is allowed to auto-enable this skill in a conversation.\n */\n agentCanEnable: Schema.optional(Schema.Boolean).annotations({\n description: 'Whether an agent is allowed to auto-enable this skill in a conversation.',\n }),\n\n /**\n * Array of MCP servers that the AI assistant can use when this skill is active.\n */\n mcpServers: Schema.optional(Schema.Array(McpServer.McpServer)),\n\n /**\n * Hooks triggered automatically at certain points in the agent's lifecycle.\n */\n hooks: Schema.optional(Schema.Array(Schema.suspend(() => Hook))),\n }).pipe(\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--blueprint--regular', hue: 'sky' }),\n ),\n) {}\n\n/**\n * Controls when the hook is triggered.\n */\nexport const HookSpec = Schema.Union(\n /**\n * Triggered when the agent is about to start a request.\n * A request is a series of agent/tool turns that the model drives.\n */\n Schema.TaggedStruct('begin-request', {}),\n /**\n * Triggered when the agent has completed a request.\n * A request is a series of agent/tool turns that the model drives.\n */\n Schema.TaggedStruct('end-request', {}),\n);\n\n/**\n * Allows hooking into the agent's lifecycle.\n * NOTE: Intentionally similar to Trigger, perhaps we should merge them.\n */\nexport const Hook = Schema.Struct({\n /**\n * What to do when the hook is triggered.\n *\n * Can be a Ref to a PersistentOperation.\n */\n function: Schema.optional(Ref.Ref(Obj.Unknown).annotations({ title: 'Function' })),\n\n /**\n * Controls when the hook is triggered.\n */\n spec: HookSpec,\n\n /**\n * Passed as the input data to the function.\n * Must match the function's input schema.\n */\n input: Trigger.InputTemplate.pipe(Annotation.FormInputAnnotation.set(false), Schema.optional),\n});\n\n/**\n * Create a new Skill.\n * The `key` (and optional `version`) are stored in the object meta.\n * `key` must be a valid DXN name (e.g. `org.dxos.skill.mySkill`).\n */\nexport const make: {\n <T extends string>(\n props: {\n key: [DXN.Name<T>] extends [never] ? `Invalid DXN name \"${T}\": final segment must be camelCase (no hyphens)` : T;\n version?: string;\n name: string;\n } & Partial<Skill>,\n ): Skill;\n} = ({ key, version, tools = [], instructions = Template.make(), ...props }) =>\n Obj.make(Skill, {\n [Obj.Meta]: { key, version },\n tools,\n instructions,\n ...props,\n });\n\n/**\n * Get the registry key for a skill.\n */\nexport const getKey = (skill: Skill): string => {\n const key = Obj.getMeta(skill).key;\n if (key === undefined) {\n throw new Error('Skill is missing the meta key.');\n }\n return key;\n};\n\n/**\n * Get the registry version for a skill, if any.\n */\nexport const getVersion = (skill: Skill): string | undefined => Obj.getMeta(skill).version;\n\n/**\n * Util to create tool definitions for a skill.\n */\nexport const toolDefinitions = ({\n tools = [],\n operations = [],\n}: {\n tools?: string[];\n operations?: Operation.Definition.Any[];\n}) => [...operations.map((op) => ToolId.make(DXN.getName(op.meta.key))), ...tools.map((tool) => ToolId.make(tool))];\n\n/**\n * Factory for the skills.\n */\nexport type Definition = {\n key: DXN.Name<string>;\n make: () => Skill;\n};\n\n/**\n * Returns the canonical URI used to reference this skill in the registry.\n * Use this URI with `Ref.fromURI` to bind a skill without cloning it to the DB.\n *\n * TODO(wittjosiah): Should use Obj.getURI instead once it supports options to prefer meta key over EID.\n */\nexport const registryURI = (key: DXN.Name<string>): URI.URI => (DXN.tryMake(`dxn:${key}`) ?? URI.make(key)) as URI.URI;\n\n/**\n * Resolves a skill from the registry by its meta key.\n * Does not check the local database for the skill.\n */\nexport const resolve = (key: string): Effect.Effect<Skill, NotFoundError, Registry.Service> =>\n Effect.gen(function* () {\n const results = yield* Registry.runQuery(Filter.and(Filter.type(Skill), Filter.key(key)));\n const skill = results[0];\n if (!skill) {\n return yield* Effect.fail(new NotFoundError({ context: { key } }));\n }\n return skill;\n });\n\n/**\n * Upserts a skill into the database.\n * If the skill already exists in the database, the local (possibly forked) copy is returned as-is.\n * Otherwise, a fresh copy is cloned from the registry and added.\n * @deprecated Since we're using a registry we no longer need to store skills in the database.\n */\n// TODO(dmaretskyi): Remove.\nexport const upsert = (key: string): Effect.Effect<Skill, NotFoundError, Registry.Service | Database.Service> =>\n Effect.gen(function* () {\n const local = yield* Database.query(Filter.and(Filter.type(Skill), Filter.key(key))).run;\n if (local.length > 0) {\n return local[0];\n }\n return yield* Database.add(Obj.clone(yield* resolve(key), { deep: 'all' }));\n });\n\nexport class NotFoundError extends BaseError.extend('SkillNotFound', 'Skill not found') {}\n","//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Format, JsonSchema, Obj, Ref, Type } from '@dxos/echo';\nimport { Text } from '@dxos/schema';\n\nimport * as Skill from './Skill';\n\n/** A sentinel command the model recognizes in chat (e.g. `$track <text>`). */\nexport const Command = Schema.Struct({\n sentinel: Schema.String.annotations({ description: 'Token that invokes the command (e.g. \"$track\").' }),\n description: Schema.optional(Schema.String),\n prompt: Schema.String.annotations({ description: 'What the model should do when the sentinel appears.' }),\n});\nexport type Command = Schema.Schema.Type<typeof Command>;\n\n/**\n * Prompt-based operation.\n * May reference skills and additional context.\n * Hidden from the navtree and object picker — accessed only through Routines.\n */\nexport class Instructions extends Type.makeObject<Instructions>(DXN.make('org.dxos.type.instructions', '0.1.0'))(\n Schema.Struct({\n name: Schema.optional(Schema.String),\n description: Schema.optional(Schema.String),\n input: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)).annotations({\n description: 'Input schema',\n }),\n output: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)).annotations({\n description: 'Output schema',\n }),\n text: Ref.Ref(Text.Text).pipe(\n Format.FormatAnnotation.set(Format.TypeFormat.Markdown),\n Schema.annotations({ title: 'Instructions', description: 'Describe what the agent should do in each session.' }),\n ),\n skills: Schema.Array(Ref.Ref(Skill.Skill)),\n /**\n * Context objects bound to the agent's session when this routine runs (sibling of `skills`).\n * Generic `Ref.Ref(Obj.Unknown)` so any space object qualifies. Honored on every run path that\n * executes a routine through the agent prompt, not only triggered automations.\n */\n objects: Schema.Array(Ref.Ref(Obj.Unknown)).pipe(Schema.annotations({ title: 'Objects' }), Schema.optional),\n /** Sentinel commands available to chat sessions running with these instructions. */\n commands: Schema.Array(Command).pipe(Schema.annotations({ title: 'Commands' }), Schema.optional),\n }).pipe(\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--scroll--regular', hue: 'sky' }),\n Annotation.HiddenAnnotation.set(true),\n ),\n) {}\n\nexport type MakeProps = {\n name?: string;\n description?: string;\n input?: Schema.Schema.AnyNoContext;\n output?: Schema.Schema.AnyNoContext;\n text?: string;\n skills?: Ref.Ref<Skill.Skill>[];\n objects?: Ref.Ref<Obj.Unknown>[];\n commands?: Command[];\n};\n\n/** Creates an Instructions object with an owned Markdown `text` body (parented so it cascades and deep-clones). */\nexport const make = ({\n name,\n description,\n input,\n output,\n text,\n skills = [],\n objects,\n commands,\n}: MakeProps): Instructions => {\n const body = Text.make({ content: text ?? '' });\n const instructions = Obj.make(Instructions, {\n name,\n description,\n input: JsonSchema.toJsonSchema(input ?? Schema.Void),\n output: JsonSchema.toJsonSchema(output ?? Schema.Void),\n text: Ref.make(body),\n skills,\n objects,\n commands,\n });\n // The body is owned by the instructions: it cascade-deletes with it and is cloned alongside it under\n // `Obj.clone(..., { deep: 'parent' })`.\n Obj.setParent(body, instructions);\n return instructions;\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo/internal';\n\nimport type * as Operation from '../Operation';\nimport * as Runnable from '../Runnable';\nimport * as Instructions from './Instructions';\nimport * as Trigger from './Trigger';\n\nconst Kinds = ['runnable', 'instructions'] as const;\nexport const Kind = Schema.Literal(...Kinds);\nexport type Kind = (typeof Kinds)[number];\n\nconst RunnableSpec = Schema.Struct({\n kind: Schema.Literal('runnable'),\n runnable: Ref.Ref(Runnable.Runnable),\n});\n\nconst InstructionsSpec = Schema.Struct({\n kind: Schema.Literal('instructions'),\n instructions: Ref.Ref(Instructions.Instructions),\n});\n\nconst RoutineSpec = Schema.Union(RunnableSpec, InstructionsSpec);\n\n/**\n * User-facing routine: a thin aggregate of an action (`runnable`) and the triggers that fire it.\n * App-level only — EDGE stays unaware of it (triggers point directly at the runnable).\n */\nexport class Routine extends Type.makeObject<Routine>(DXN.make('org.dxos.type.routine', '0.2.0'))(\n Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n description: Schema.String.pipe(Schema.optional),\n\n /**\n * The action to run: either an Operation (`spec.runnable`, bound directly) or the routine's own owned\n * Instructions (`spec.instructions`). For an Operation action the trigger's `runnable` points at this\n * Operation. For an Instructions action `spec.instructions` is the owned Instructions object (the operation\n * is implicitly the static RunInstructions, so no separate operation ref is stored), and the trigger's\n * `runnable` is RunInstructions with this instructions bound as its input.\n */\n // TODO(burdon): Change to Array? Or handle that case with a ComputeGraph runnable.\n spec: RoutineSpec.pipe(Schema.optional),\n\n /**\n * Explicit membership, bi-directional with `trigger.runnable → runnable`. Required (not derived by query)\n * because the runnable may be a shared registry operation referenced by multiple automations, which would\n * conflate triggers. MVP enforces length <= 1.\n */\n triggers: Schema.Array(Ref.Ref(Trigger.Trigger)),\n }).pipe(\n LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--lightning--regular', hue: 'amber' }),\n ),\n) {}\n\n/** Returns true when value is a Routine object. */\nexport const instanceOf = (value: unknown): value is Routine => Obj.instanceOf(Routine, value);\n\n/**\n * The owned Instructions ref of an instructions-action routine, or undefined for an operation action.\n * Classification is explicit in `spec.kind`, so this needs no `.target` dereference; callers resolve the ref\n * reactively (`useObject`) or asynchronously (`Database.load`) as appropriate.\n */\nexport const instructionsRef = (routine: Pick<Routine, 'spec'>): Ref.Ref<Instructions.Instructions> | undefined =>\n routine.spec?.kind === 'instructions' ? routine.spec.instructions : undefined;\n\n// Return type de-aliased to `Operation.PersistentOperation` (what `Runnable.Runnable` aliases) so this\n// exported symbol's declaration names it directly — the reference that lets `tsc` emit the module's\n// `.d.ts` (avoids TS2742) without keeping an otherwise-unused `Operation` import.\n/** The Operation (runnable) ref of an operation-action routine, or undefined for an instructions action. */\nexport const runnableRef = (routine: Pick<Routine, 'spec'>): Ref.Ref<Operation.PersistentOperation> | undefined =>\n routine.spec?.kind === 'runnable' ? routine.spec.runnable : undefined;\n\n/** Factory wrapper around `Obj.make` for {@link Routine}. Trigger wiring lives in plugin-routine (`makeRoutine`). */\nexport const make = (\n props: Omit<Obj.MakeProps<typeof Routine>, 'triggers'> & { triggers?: ReadonlyArray<Ref.Ref<Trigger.Trigger>> },\n): Routine => Obj.make(Routine, { ...props, triggers: props.triggers ?? [] });\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Collection, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport { FormInlineAnnotation, LabelAnnotation } from '@dxos/echo/Annotation';\nimport { Outline, TaskSet } from '@dxos/types';\n\nimport * as Instructions from './Instructions';\nimport * as Routine from './Routine';\nimport type * as Skill from './Skill';\n\n/** Lightweight inline goal: per-item status and addressability without document ceremony. */\nexport const Goal = Schema.Struct({\n id: Schema.String,\n text: Schema.String,\n status: Schema.optional(Schema.Literal('open', 'met', 'dropped')),\n});\n\nexport type Goal = Schema.Schema.Type<typeof Goal>;\n\n/**\n * A user-facing container for interactive, long-running work: instructions (skills + commands),\n * routines, artifacts, and AI chat sessions in project context. Successor to `Topic`.\n * Chats and agents attach via relations/queries (assistant-toolkit depends on compute, so no typed refs here).\n */\nexport class Project extends Type.makeObject<Project>(DXN.make('org.dxos.type.project', '0.3.0'))(\n Schema.Struct({\n name: Schema.optional(Schema.String),\n description: Schema.optional(Schema.String),\n\n /** Owned agent instructions (created + parented at the plugin layer). */\n instructions: Schema.optional(Ref.Ref(Instructions.Instructions).pipe(FormInlineAnnotation.set(true))),\n\n /** Routines created within the scope of this project. */\n routines: Schema.Array(Ref.Ref(Routine.Routine)),\n\n /** Owned collection of artifacts (documents, outliners, tables, ...) managed by the project. */\n artifacts: Schema.optional(Ref.Ref(Collection.Collection)),\n\n /** What done means for this project. */\n goals: Schema.optional(Schema.Array(Goal)),\n\n /** Ad hoc markdown checklist — the scratch surface; project chats write into it. */\n outline: Schema.optional(Ref.Ref(Outline.Outline)),\n\n /** Owned (or adopted synced) task container; membership is the ECHO parent edge. */\n taskSet: Schema.optional(Ref.Ref(TaskSet.TaskSet)),\n }).pipe(\n Schema.annotations({ title: 'Project' }),\n LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--stack--regular', hue: 'amber' }),\n ),\n) {}\n\n/** Factory wrapper around `Obj.make` for {@link Project}. */\nexport const make = (\n props: Omit<Partial<Obj.MakeProps<typeof Project>>, 'routines'> & {\n routines?: ReadonlyArray<Ref.Ref<Routine.Routine>>;\n } = {},\n): Project => Obj.make(Project, { ...props, routines: props.routines ?? [] });\n\n/** Bindings a chat session should receive when running in a project's context. */\nexport type ContextBindings = {\n skills: Ref.Ref<Skill.Skill>[];\n objects: Ref.Ref<Obj.Unknown>[];\n};\n\n/**\n * Bindings a chat session should receive when running in this project's context: the instructions'\n * skills and context objects. The instructions object itself is NOT bound — its text/commands reach\n * the system prompt through the chat's `instructions` ref, and a bound Instructions object would\n * render as an inert context stub. Requires the instructions ref to be resolved (`.target`);\n * unresolved refs contribute nothing.\n */\nexport const contextBindings = (project: Project): ContextBindings => {\n const instructionsRef = project.instructions;\n // `.target` throws when the ref has neither an inlined target nor a resolver attached\n // (e.g. an unresolved ref outside a database context); guard with `isAvailable` first.\n if (!instructionsRef?.isAvailable) {\n return { skills: [], objects: [] };\n }\n\n const instructions = instructionsRef.target;\n if (!instructions) {\n return { skills: [], objects: [] };\n }\n\n // Refs are kept as-is (never re-wrapped via `Ref.make`): bindings persist to the conversation feed,\n // and re-wrapping would drop the registry DXN of skills that have no space-DB identity.\n return {\n skills: [...instructions.skills],\n objects: [...(instructions.objects ?? [])],\n };\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation } from '@dxos/echo/Annotation';\nimport { Text } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport class Script extends Type.makeObject<Script>(DXN.make('org.dxos.type.script', '0.1.0'))(\n Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n description: Schema.String.pipe(Schema.optional),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: Schema.Boolean.pipe(FormInputAnnotation.set(false), Schema.optional),\n source: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),\n }).pipe(\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--code--regular', hue: 'sky' }),\n ),\n) {}\n\ntype Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & { source?: string };\n\nexport const make = ({ source = '', ...props }: Props = {}): Script =>\n Obj.make(Script, { ...props, source: Ref.make(Text.make({ content: source })) });\n","//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Feed, Obj, Ref } from '@dxos/echo';\n\n// TODO(wittjosiah): Review this type.\n// - Should be discriminated union.\n// - Should be more consistent (e.g. subject vs item).\n// - Should re-use schemas if possible.\n\n// TODO(burdon): Reuse trigger schema from @dxos/functions (TriggerType).\nexport const EmailEvent = Schema.Struct({\n from: Schema.String,\n to: Schema.String,\n subject: Schema.String,\n created: Schema.String,\n body: Schema.String,\n});\nexport type EmailEvent = Schema.Schema.Type<typeof EmailEvent>;\n\nexport const FeedEvent = Schema.Struct({\n feed: Ref.Ref(Feed.Feed),\n item: Schema.Any,\n cursor: Schema.String,\n});\nexport type FeedEvent = Schema.Schema.Type<typeof FeedEvent>;\n\n/**\n * Kind of mutation a subscription trigger observed for its subject.\n */\nexport const SubscriptionMutationType = Schema.Literal('created', 'updated', 'deleted');\nexport type SubscriptionMutationType = Schema.Schema.Type<typeof SubscriptionMutationType>;\n\nexport const SubscriptionEvent = Schema.Struct({\n /**\n * Type of the mutation.\n */\n type: SubscriptionMutationType,\n\n /**\n * Reference to the object that was changed or created. For `deleted`, carries the object's URI;\n * dereferencing may yield `undefined` since the object is gone.\n */\n subject: Ref.Ref(Obj.Unknown),\n\n /**\n * @deprecated Use `subject`.\n */\n changedObjectId: Schema.optional(Schema.String),\n});\nexport type SubscriptionEvent = Schema.Schema.Type<typeof SubscriptionEvent>;\n\nexport const TimerEvent = Schema.Struct({ tick: Schema.Number });\nexport type TimerEvent = Schema.Schema.Type<typeof TimerEvent>;\n\nexport const DirectEvent = Schema.Struct({\n data: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n});\nexport type DirectEvent = Schema.Schema.Type<typeof DirectEvent>;\n\nexport const WebhookEvent = Schema.Struct({\n url: Schema.String,\n method: Schema.Literal('GET', 'POST'),\n headers: Schema.Record({ key: Schema.String, value: Schema.String }),\n bodyText: Schema.String,\n});\nexport type WebhookEvent = Schema.Schema.Type<typeof WebhookEvent>;\n\nexport const TriggerEvent = Schema.Union(\n EmailEvent,\n FeedEvent,\n DirectEvent,\n SubscriptionEvent,\n TimerEvent,\n WebhookEvent,\n);\nexport type TriggerEvent = Schema.Schema.Type<typeof TriggerEvent>;\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\n/**\n * Identity of the actor authoring content within an operation. Today this is an agent (see\n * `assistant-toolkit` `Agent.did`); it attributes content the operation authors — e.g. the\n * `creator` of a suggestion branch — so it reads as its own author, distinct from the human user\n * and from other agents. Provided by the agent runtime for the duration of a tool/operation call.\n */\nexport interface Identity {\n /** Identity DID (e.g. an agent's `did:halo:` DID). */\n readonly did: string;\n /** Optional display name. */\n readonly name?: string;\n /** Optional palette hue. */\n readonly hue?: string;\n}\n\nexport class AgentIdentity extends Context.Tag('@dxos/compute/AgentIdentity')<AgentIdentity, Identity>() {}\n\n/**\n * The current author DID, or `undefined` when no {@link AgentIdentity} is in scope (e.g. a human-\n * initiated invocation). Reads optionally, so an operation that defaults its author from the agent\n * identity does not add a hard service requirement.\n */\nexport const currentDid: Effect.Effect<string | undefined> = Effect.serviceOption(AgentIdentity).pipe(\n Effect.map(Option.match({ onNone: () => undefined, onSome: (identity) => identity.did })),\n);\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\n/**\n * Cooperative cancellation of the current operation run. The runtime that owns execution provides\n * the service and fires the signal when the run is cancelled — the EDGE worker on a client cancel\n * request, the local process runtime on terminate. Operations observe it via {@link signal}.\n */\n// Tags unify by key string: a version-skewed bundle carrying two `@dxos/compute` instances (e.g. an\n// EDGE worker whose provider and handlers resolve different copies) must still share this service,\n// so the key must never change.\nexport class Service extends Context.Tag('@dxos/compute/Cancellation')<Service, { readonly signal: AbortSignal }>() {}\n\n/**\n * The current run's cancellation signal — e.g. for `Pipeline.abortWith` or `fetch`. Never fires when\n * the runtime provided no cancellation channel.\n */\n// A fresh signal per access: a shared never-firing singleton would accumulate listeners across runs.\nexport const signal: Effect.Effect<AbortSignal> = Effect.serviceOption(Service).pipe(\n Effect.map(\n Option.match({\n onNone: () => new AbortController().signal,\n onSome: (service) => service.signal,\n }),\n ),\n);\n","//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Redacted from 'effect/Redacted';\n\nimport { type SpaceId } from '@dxos/keys';\n\nexport type CredentialQuery = {\n service?: string;\n /**\n * Look up one specific `AccessToken` object instead of any credential for a service. Required\n * wherever a space can hold several connections to the same service, since a by-service lookup\n * picks among them arbitrarily.\n */\n accessTokenId?: string;\n};\n\n// TODO(dmaretskyi): Unify with other apis.\n// packages/sdk/schema/src/common/access-token.ts\nexport type ServiceCredential = {\n service: string;\n\n // TODO(dmaretskyi): Build out.\n apiKey?: string;\n\n /** Non-secret secondary identifier carried alongside the credential (e.g. an account id or report id). */\n account?: string;\n};\n\n/**\n * Source for credentials EDGE custodies rather than replicating into the space (those stored as\n * `MANAGED_ACCESS_TOKEN`).\n *\n * An implementation detail of {@link CredentialsService}, not a consumer-facing service: it exists\n * as a tag only because the two surfaces reach EDGE differently — clients over authenticated HTTP,\n * functions over a space-bound service binding. Implementations cache; pass `refresh` to bypass that\n * cache after an authorization failure.\n */\nexport class AccessTokenResolver extends Context.Tag('@dxos/functions/AccessTokenResolver')<\n AccessTokenResolver,\n {\n resolve: (request: { spaceId: SpaceId; accessTokenId: string; refresh?: boolean }) => Promise<string>;\n }\n>() {\n static resolve = (request: {\n spaceId: SpaceId;\n accessTokenId: string;\n refresh?: boolean;\n }): Effect.Effect<string, never, AccessTokenResolver> =>\n Effect.gen(function* () {\n const resolver = yield* AccessTokenResolver;\n return yield* Effect.promise(() => resolver.resolve(request));\n });\n\n /**\n * Fails on every managed token. The default where EDGE is unreachable (tests, offline CLI runs):\n * a managed credential genuinely cannot be resolved there, and failing says so.\n */\n static notAvailable = Layer.succeed(AccessTokenResolver, {\n resolve: async ({ accessTokenId }) => {\n throw new Error(`No access token resolver configured; cannot resolve managed token: ${accessTokenId}`);\n },\n });\n}\n\nexport class CredentialsService extends Context.Tag('@dxos/functions/CredentialsService')<\n CredentialsService,\n {\n /**\n * Query all.\n */\n queryCredentials: (query: CredentialQuery) => Promise<ServiceCredential[]>;\n\n /**\n * Get a single credential.\n * @throws {Error} If no credential is found.\n */\n getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;\n }\n>() {\n static getCredential = (query: CredentialQuery): Effect.Effect<ServiceCredential, never, CredentialsService> =>\n Effect.gen(function* () {\n const credentials = yield* CredentialsService;\n return yield* Effect.promise(() => credentials.getCredential(query));\n });\n\n static getApiKey = (query: CredentialQuery): Effect.Effect<Redacted.Redacted<string>, never, CredentialsService> =>\n Effect.gen(function* () {\n const credential = yield* CredentialsService.getCredential(query);\n if (!credential.apiKey) {\n throw new Error(`API key not found for service: ${query.service}`);\n }\n return Redacted.make(credential.apiKey);\n });\n}\n\n/**\n * The credential's API key as a plain string — what a caller passing it to an HTTP client needs.\n * Resolves a server-custodied value transparently, so callers never branch on where it came from.\n */\nexport const getApiKeyValue = (query: CredentialQuery): Effect.Effect<string, never, CredentialsService> =>\n Effect.map(CredentialsService.getApiKey(query), Redacted.value);\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport * as HttpClientRequest from '@effect/platform/HttpClientRequest';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { BYOK_HEADER } from '@dxos/protocols';\n\nimport * as Credential from './Credential';\n\n/**\n * Wraps an `HttpClient` so outbound requests carry `X-BYOK: <apiKey>` whenever the active space\n * has an `AccessToken` for `providerHost`. Lookup failures pass the request through unchanged.\n */\nexport const byokLayer = (\n providerHost: string,\n): Layer.Layer<HttpClient.HttpClient, never, HttpClient.HttpClient | Credential.CredentialsService> =>\n Layer.effect(\n HttpClient.HttpClient,\n Effect.gen(function* () {\n const client = yield* HttpClient.HttpClient;\n const credentials = yield* Credential.CredentialsService;\n return HttpClient.mapRequestEffect(client, (request) =>\n Effect.gen(function* () {\n const matches = yield* Effect.tryPromise(() => credentials.queryCredentials({ service: providerHost })).pipe(\n Effect.orElseSucceed((): Credential.ServiceCredential[] => []),\n );\n const apiKey = matches.find((credential) => credential.apiKey)?.apiKey;\n return apiKey ? HttpClientRequest.setHeader(request, BYOK_HEADER, apiKey) : request;\n }),\n );\n }),\n );\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Layer from 'effect/Layer';\nimport * as Types from 'effect/Types';\n\nimport { SpaceId, type URI } from '@dxos/keys';\n\nimport type * as Process from './Process';\n\n// @import-as-namespace\n\nexport const TypeId = '~@dxos/functions/LayerSpec' as const;\nexport type TypeId = typeof TypeId;\n\n/**\n * Opaque layer with introspectable tags.\n */\nexport interface LayerSpec {\n readonly [TypeId]: TypeId;\n\n readonly affinity: Affinity;\n readonly requires: readonly Context.Tag<any, any>[];\n readonly provides: readonly Context.Tag<any, any>[];\n\n // opaque service creation function, layer provides the specified services and requires the specified requirements.\n readonly make: (context: LayerContext) => Layer.Layer<unknown, never, unknown>;\n}\n\n/**\n * Affinity defines the lifetime and scope of a service.\n *\n * - `application` - single service instance is available throughout the entire application.\n * - `space` - service is instantiated per space.\n * - `process` - separate service instance is created and destroyed for each process.\n */\nexport type Affinity = 'application' | 'space' | 'process';\n\n/**\n * Provides context for service resolution.\n */\n// TODO(dmaretskyi): Consider making this type dependant on the specified service affinity.\nexport interface LayerContext {\n /**\n * Under which space the process is running.\n * Space affinity and up only.\n */\n readonly space?: SpaceId;\n\n /**\n * URI of the conversation feed the process is running in.\n * Process affinity only.\n */\n readonly conversation?: URI.URI;\n\n /**\n * Under which process the process is running.\n * Process affinity only.\n */\n readonly process?: Process.ID;\n}\n\ninterface MakeOpts {\n readonly affinity: Affinity;\n readonly requires: readonly Context.Tag<any, any>[];\n readonly provides: readonly Context.Tag<any, any>[];\n}\n\n/**\n * Make a service.\n */\nexport const make = <const Opts extends Types.NoExcessProperties<MakeOpts, Opts>>(\n opts: Opts,\n make: (\n context: LayerContext,\n ) => Layer.Layer<\n Context.Tag.Identifier<Opts['provides'][number]>,\n never,\n Context.Tag.Identifier<Opts['requires'][number]>\n >,\n): LayerSpec => {\n return {\n [TypeId]: TypeId,\n affinity: opts.affinity,\n requires: opts.requires,\n provides: opts.provides,\n make: make as any,\n };\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\n\nimport { Database, Filter, Query } from '@dxos/echo';\n\nimport * as Operation from './Operation';\nimport * as OperationHandlerSet from './OperationHandlerSet';\n\nexport interface OperationRegistry {\n /**\n * Resolve an operation by key.\n */\n resolve(key: string): Effect.Effect<Option.Option<Operation.Definition.Any>>;\n}\n\nexport class Service extends Context.Tag('@dxos/operation/OperationRegistry')<Service, OperationRegistry>() {}\n\n/**\n * Resolve an operation by key.\n */\nexport const resolve: (key: string) => Effect.Effect<Option.Option<Operation.Definition.Any>, never, Service> =\n Effect.serviceFunctionEffect(Service, (service) => service.resolve);\n\nexport const layer: Layer.Layer<Service, never, Database.Service | OperationHandlerSet.OperationHandlerProvider> =\n Layer.effect(\n Service,\n Effect.gen(function* () {\n const database = yield* Database.Service;\n const handlerSet = yield* OperationHandlerSet.OperationHandlerProvider;\n return {\n resolve: (key: string) =>\n Database.query(Query.select(Filter.and(Filter.type(Operation.PersistentOperation), Filter.key(key))))\n .first.pipe(\n Effect.flatten,\n Effect.map(Operation.deserialize),\n Effect.catchTag('NoSuchElementException', () => OperationHandlerSet.getHandlerByKey(handlerSet, key)),\n Effect.option,\n )\n .pipe(Effect.provideService(Database.Service, database)),\n };\n }),\n );\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport { EID } from '@dxos/keys';\nimport { log } from '@dxos/log';\n\nimport * as Trigger from './types/Trigger';\n\n/**\n * Writes ephemeral or persistent events to the trace.\n * Exposed to processes and operations to record events to the trace.\n */\nexport interface TraceWriter {\n write<T>(eventType: EventType<T>, payload: NoInfer<T>): void;\n}\n\n/**\n * Service that writes events to the trace.\n * Exposed to processes and operations to record events to the trace.\n */\nexport class TraceService extends Context.Tag('@dxos/functions/TraceService')<TraceService, TraceWriter>() {}\n\n/**\n * Writes an event to the trace.\n */\nexport function write<T>(eventType: EventType<T>, payload: NoInfer<T>): Effect.Effect<void, never, TraceService> {\n return Effect.gen(function* () {\n log('trace write', { key: eventType.key, isEphemeral: eventType.isEphemeral });\n const writer = yield* TraceService;\n writer.write(eventType, payload);\n });\n}\n\n/**\n * Defines an event type for the trace.\n */\nexport interface EventType<T> {\n readonly key: string;\n readonly schema: Schema.Schema<T, any>;\n readonly isEphemeral: boolean;\n}\n\nexport const EventType = <T>(\n key: string,\n opts: { schema: Schema.Schema<T, any>; isEphemeral: boolean },\n): EventType<T> => {\n return {\n key,\n schema: opts.schema,\n isEphemeral: opts.isEphemeral,\n };\n};\n\n/**\n * Extracts the payload type from an event type.\n */\nexport type PayloadType<E extends EventType<any>> = E extends EventType<infer T> ? T : never;\n\nexport const Event = Schema.Struct({\n timestamp: Schema.Number,\n type: Schema.String,\n data: Schema.Unknown, // Type-specific payload;\n});\nexport type Event = Schema.Schema.Type<typeof Event>;\n\n/**\n * Checks if an event is of a given type.\n */\nexport const isOfType = <T, E extends Event>(eventType: EventType<T>, event: E): event is E & { data: T } => {\n return event.type === eventType.key;\n};\n\n/**\n * Extensible name informing which runtime executed the code that produced the event.\n */\nexport const RuntimeName = Schema.String.pipe(Schema.brand('@dxos/compute/Trace/RuntimeName'));\nexport type RuntimeName = Schema.Schema.Type<typeof RuntimeName>;\n\n/**\n * Common runtime names.\n */\nexport const CommonRuntimeName = {\n /**\n * Web app / CLI / Desktop app / Mobile app.\n */\n local: RuntimeName.make('local'),\n edgeIntrinsic: RuntimeName.make('edge-intrinsic'),\n edgeWorkerLoader: RuntimeName.make('edge-worker-loader'),\n edgeWorkerForPlatforms: RuntimeName.make('edge-worker-for-platforms'),\n};\n\n/**\n * Metadata on the context of a trace message.\n */\n// TODO(dmaretskyi): Expand on this: conversation id, tool call id, etc.\nexport const Meta = Schema.Struct({\n pid: Schema.optional(Schema.String), // NOTE: Not Process.ID to avoid circular dependency.\n parentPid: Schema.optional(Schema.String),\n processName: Schema.optional(Schema.String),\n\n /**\n * Space the message was produced in.\n * Stored as a string to avoid circular dependency on `@dxos/keys`.\n */\n space: Schema.optional(Schema.String),\n\n /**\n * Ref to the conversation feed object if present.\n */\n conversation: Ref.Ref(Obj.Unknown).pipe(Schema.optional),\n\n /**\n * Ref to the trigger object if invocation resulted from a trigger.\n */\n trigger: Ref.Ref(Trigger.Trigger).pipe(Schema.optional),\n\n /**\n * ID of the tool call that created the current process.\n */\n toolCallId: Schema.optional(Schema.String),\n\n /**\n * Extensible name informing which runtime executed the code that produced the event.\n */\n runtimeName: Schema.optional(RuntimeName),\n});\nexport type Meta = Schema.Schema.Type<typeof Meta>;\n\n/**\n * Checks if a runtime is an edge runtime.\n */\nexport const isEdgeRuntime = (name: RuntimeName): boolean =>\n name === CommonRuntimeName.edgeIntrinsic ||\n name === CommonRuntimeName.edgeWorkerLoader ||\n name === CommonRuntimeName.edgeWorkerForPlatforms;\n\n/**\n * Envelope for a set of events.\n */\nexport const MessageData = Schema.Struct({\n meta: Meta,\n isEphemeral: Schema.Boolean,\n events: Schema.Array(Event),\n});\nexport type MessageData = Schema.Schema.Type<typeof MessageData>;\n\nexport class Message extends Type.makeObject<Message>(DXN.make('org.dxos.type.traceMessage', '0.1.0'))(\n MessageData.pipe(\n Annotation.IconAnnotation.set({ icon: 'ph--note--regular', hue: 'rose' }),\n Annotation.HiddenAnnotation.set(true),\n ),\n) {}\n\n/**\n * Flattened representation of a signle event in a trace message.\n * Events are stored in batched messages for efficiency, but flat representation is more convenient for consumption.\n */\nexport interface FlatEvent extends Event {\n readonly meta: Meta;\n readonly isEphemeral: boolean;\n}\n\n/**\n * Flattens a trace message into a list of flat events.\n */\nexport const flatten = (message: Message): FlatEvent[] => {\n return message.events.map((event) => ({\n ...event,\n meta: message.meta,\n isEphemeral: message.isEphemeral,\n }));\n};\n\n//\n// Swarm broadcast (DX-1125).\n//\n// Ephemeral trace messages produced on a remote runtime are broadcast over the space swarm and\n// projected into the client's progress UI. The publisher tags each message with a flat key:value list\n// derived from its meta; subscribers register a coarse tag (OR match at the swarm) and re-apply the\n// exact filter (AND) client-side.\n//\n\n/**\n * `google.protobuf.Any` type URL for a trace message broadcast over the swarm.\n */\nexport const TRACE_MESSAGE_TYPE_URL = 'dxos.compute.TraceMessage';\n\n/**\n * Declarative, serializable filter over trace messages. All present fields are ANDed. `type` matches\n * against event types within the message; the rest match against {@link Meta} fields. Refs\n * (`conversation`, `trigger`) are matched by their DXN string.\n */\nexport interface Filter {\n readonly type?: string;\n readonly pid?: string;\n readonly parentPid?: string;\n readonly conversation?: string;\n readonly trigger?: string;\n readonly space?: string;\n readonly runtimeName?: string;\n readonly toolCallId?: string;\n}\n\n/**\n * Derive the flat broadcast tag list for a message (DX-1125). The publisher emits all applicable tags;\n * subscribers match a subset (logical OR).\n */\nexport const messageToTags = (message: Pick<MessageData, 'meta' | 'events'>): string[] => {\n const { meta } = message;\n const tags: string[] = [];\n for (const event of message.events) {\n tags.push(`type:${event.type}`);\n }\n if (meta.pid) {\n tags.push(`pid:${meta.pid}`);\n }\n if (meta.parentPid) {\n tags.push(`parentPid:${meta.parentPid}`);\n }\n if (meta.conversation) {\n tags.push(`conversation:${meta.conversation.uri.toString()}`);\n }\n if (meta.trigger) {\n tags.push(`trigger:${meta.trigger.uri.toString()}`);\n }\n if (meta.space) {\n tags.push(`space:${meta.space}`);\n }\n if (meta.runtimeName) {\n tags.push(`runtime:${meta.runtimeName}`);\n }\n if (meta.toolCallId) {\n tags.push(`toolCall:${meta.toolCallId}`);\n }\n return tags;\n};\n\n/**\n * Pick the coarse subscription tag for a filter (DX-1125). The swarm cuts traffic to a superset of the\n * filter using its most selective present dimension; the client re-applies the exact filter.\n */\nexport const subscriptionTagForFilter = (filter: Filter): string | undefined => {\n if (filter.conversation !== undefined) {\n return `conversation:${filter.conversation}`;\n }\n if (filter.trigger !== undefined) {\n return `trigger:${filter.trigger}`;\n }\n if (filter.parentPid !== undefined) {\n return `parentPid:${filter.parentPid}`;\n }\n if (filter.pid !== undefined) {\n return `pid:${filter.pid}`;\n }\n if (filter.space !== undefined) {\n return `space:${filter.space}`;\n }\n if (filter.type !== undefined) {\n return `type:${filter.type}`;\n }\n return undefined;\n};\n\n/**\n * Exact (AND) filter match applied client-side after the coarse swarm subscription.\n */\nexport const matchesFilter = (message: Pick<MessageData, 'meta' | 'events'>, filter: Filter): boolean => {\n const { meta } = message;\n if (filter.type !== undefined && !message.events.some((event) => event.type === filter.type)) {\n return false;\n }\n if (filter.pid !== undefined && meta.pid !== filter.pid) {\n return false;\n }\n if (filter.parentPid !== undefined && meta.parentPid !== filter.parentPid) {\n return false;\n }\n if (filter.conversation !== undefined && meta.conversation?.uri.toString() !== filter.conversation) {\n return false;\n }\n if (filter.trigger !== undefined && meta.trigger?.uri.toString() !== filter.trigger) {\n return false;\n }\n if (filter.space !== undefined && meta.space !== filter.space) {\n return false;\n }\n if (filter.runtimeName !== undefined && meta.runtimeName !== filter.runtimeName) {\n return false;\n }\n if (filter.toolCallId !== undefined && meta.toolCallId !== filter.toolCallId) {\n return false;\n }\n return true;\n};\n\n/**\n * Wire-safe subset of {@link Meta} for broadcast. Ref fields (`conversation`, `trigger`) are not\n * carried in the payload — they are represented only as envelope tags — so the decoded message never\n * attempts ref resolution on the consumer.\n */\nconst encodeMetaForWire = (meta: Meta): Meta => ({\n pid: meta.pid,\n parentPid: meta.parentPid,\n processName: meta.processName,\n space: meta.space,\n toolCallId: meta.toolCallId,\n runtimeName: meta.runtimeName,\n});\n\n/**\n * Encode a trace message for the broadcast envelope's `google.protobuf.Any.value` (DX-1125).\n * The wire format is UTF-8 JSON of the message data (ref fields dropped — see {@link encodeMetaForWire}).\n */\nexport const encodeTraceMessage = (message: Pick<MessageData, 'meta' | 'isEphemeral' | 'events'>): Uint8Array =>\n new TextEncoder().encode(\n JSON.stringify({\n meta: encodeMetaForWire(message.meta),\n isEphemeral: message.isEphemeral,\n events: message.events,\n }),\n );\n\n/**\n * Decode a broadcast trace message back into a {@link Message} object (DX-1125). The wire payload\n * drops both ref meta fields (see {@link encodeMetaForWire}), so `tags` — the broadcast envelope's\n * tag list — is required to restore them: `trigger` addresses work for cancellation, and\n * `conversation` is what {@link matchesFilter} compares, so a subscription filtered by it matches\n * nothing without this. Restored refs are address-only (`.uri`); they are never resolved.\n */\nexport const decodeTraceMessage = (bytes: Uint8Array, tags?: readonly string[]): Message => {\n const parsed = JSON.parse(new TextDecoder().decode(bytes)) as Partial<MessageData>;\n const meta = parsed.meta ?? {};\n const conversation = meta.conversation ?? refFromTags<Obj.Unknown>(tags, 'conversation:');\n const trigger = meta.trigger ?? refFromTags<Trigger.Trigger>(tags, 'trigger:');\n return Obj.make(Message, {\n meta: {\n ...meta,\n ...(conversation ? { conversation } : {}),\n ...(trigger ? { trigger } : {}),\n },\n isEphemeral: parsed.isEphemeral ?? true,\n events: parsed.events ?? [],\n });\n};\n\n/** The ref carried on a broadcast envelope's `<prefix><uri>` tag, when present and parseable. */\nconst refFromTags = <T>(tags: readonly string[] | undefined, prefix: string): Ref.Ref<T> | undefined => {\n const uri = tags?.find((tag) => tag.startsWith(prefix))?.slice(prefix.length);\n const eid = uri !== undefined ? EID.tryParse(uri) : undefined;\n return eid !== undefined ? Ref.fromURI(eid) : undefined;\n};\n\n/**\n * Sink for complete trace messages.\n */\nexport interface Sink {\n write(message: Message): void;\n}\n\n/**\n * Sink for complete trace messages.\n * The Process Manager forwards trace messages to it.\n */\n// TODO(dmaretskyi): Consider moving sink to the Process Manager.\nexport class TraceSink extends Context.Tag('@dxos/functions/TraceSink')<TraceSink, Sink>() {}\n\nexport const noopWriter: TraceWriter = {\n write: () => {},\n};\n\nexport const writerLayerNoop: Layer.Layer<TraceService> = Layer.succeed(TraceService, noopWriter);\n\nexport const noopSink: Sink = {\n write: () => {},\n};\n\nexport const layerNoop: Layer.Layer<TraceSink> = Layer.succeed(TraceSink, noopSink);\n\nexport const layerConsole: Layer.Layer<TraceSink> = Layer.succeed(TraceSink, {\n write: (message) => {\n console.log(message);\n },\n});\n\n/**\n * Merge a set of sinks into a single sink.\n *\n * Each message is forwarded to every sink in order. Failures in one sink do not\n * prevent downstream sinks from receiving the message.\n */\nexport const mergeSinks = (sinks: readonly Sink[]): Sink => {\n if (sinks.length === 0) {\n return noopSink;\n }\n // Intentionally no singleton fast path: the guarded wrapper is the\n // contract of `mergeSinks`, so a throwing sink is always caught and\n // logged regardless of how many sinks were passed in.\n return {\n write: (message) => {\n for (const sink of sinks) {\n try {\n sink.write(message);\n } catch (err) {\n // Intentional: do not let one sink break the chain.\n // eslint-disable-next-line no-console\n console.error('[trace] sink.write threw', err);\n }\n }\n },\n };\n};\n\n/**\n * Builds a {@link TraceService} layer that wraps each `write` into a fresh {@link Message}\n * and forwards it to the provided {@link TraceSink}. Intended for tests and lightweight\n * fixtures.\n *\n * Options:\n * - `meta`: stamped on every emitted message (defaults to `{}`).\n * - `clock`: timestamp source (defaults to {@link Date.now}). Pass a monotonic counter\n * in tests to make event ordering deterministic when many writes happen in the same\n * millisecond.\n */\nexport const testTraceService = (\n opts: { meta?: Meta; clock?: () => number } = {},\n): Layer.Layer<TraceService, never, TraceSink> =>\n Layer.effect(\n TraceService,\n Effect.gen(function* () {\n const sink = yield* TraceSink;\n const clock = opts.clock ?? Date.now;\n return {\n write: (event, data) => {\n sink.write(\n Obj.make(Message, {\n meta: opts.meta ?? {},\n isEphemeral: event.isEphemeral,\n events: [{ type: event.key, timestamp: clock(), data }],\n }),\n );\n },\n };\n }),\n );\n\n//\n// Operation Trace Events\n//\n\n/**\n * Outcome of an operation invocation.\n */\nexport type OperationOutcome = 'success' | 'failure';\n\n/**\n * Operation invocation started.\n */\nexport const OperationStart = EventType('operation.start', {\n schema: Schema.Struct({\n /** Operation key. */\n key: Schema.String,\n /** Human-readable operation name. */\n name: Schema.optional(Schema.String),\n /** Phosphor icon identifier in `ph--<name>--<variant>` format. */\n icon: Schema.optional(Schema.String),\n }),\n isEphemeral: false,\n});\n\n/**\n * Operation invocation ended.\n */\nexport const OperationEnd = EventType('operation.end', {\n schema: Schema.Struct({\n /** Operation key. */\n key: Schema.String,\n /** Human-readable operation name. */\n name: Schema.optional(Schema.String),\n /** Phosphor icon identifier in `ph--<name>--<variant>` format. */\n icon: Schema.optional(Schema.String),\n /** Outcome of the operation. */\n outcome: Schema.Literal('success', 'failure'),\n /** Error message if the operation failed. */\n error: Schema.optional(Schema.String),\n }),\n isEphemeral: false,\n});\n\n/**\n * Operation input. Emitted as an ephemeral event alongside {@link OperationStart}\n * so subscribers (such as the undo/redo history tracker) can observe the raw\n * input payload without persisting it to long-lived sinks.\n */\nexport const OperationInput = EventType('operation.input', {\n schema: Schema.Struct({\n /** Operation key. */\n key: Schema.String,\n /** Human-readable operation name. */\n name: Schema.optional(Schema.String),\n /** Raw operation input. Shape determined by the operation definition. */\n input: Schema.Unknown,\n }),\n isEphemeral: true,\n});\n\n/**\n * Operation output. Emitted as an ephemeral event just before\n * {@link OperationEnd} for successful invocations so subscribers (such as the\n * undo/redo history tracker) can observe the raw output payload without\n * persisting it to long-lived sinks.\n */\nexport const OperationOutput = EventType('operation.output', {\n schema: Schema.Struct({\n /** Operation key. */\n key: Schema.String,\n /** Human-readable operation name. */\n name: Schema.optional(Schema.String),\n /** Raw operation output. Shape determined by the operation definition. */\n output: Schema.Unknown,\n }),\n isEphemeral: true,\n});\n\n/**\n * Human-readable status update emitted by an agent or operation.\n */\nexport const StatusUpdate = EventType('status.update', {\n schema: Schema.Struct({\n /** Human-readable status message.. */\n message: Schema.optional(Schema.String),\n\n progress: Schema.optional(\n Schema.Struct({\n /** Progress key. See {@link ProgressRegistry.key}. */\n key: Schema.String,\n\n /* Progress current item index. */\n current: Schema.optional(Schema.Number),\n\n /** Progress total item count. */\n total: Schema.optional(Schema.Number),\n\n /** Progress estimate of remaining time (ms). */\n estimate: Schema.optional(Schema.Number),\n }),\n ),\n }),\n isEphemeral: true,\n});\n\n/**\n * Emit the current human-readable execution status to the trace.\n */\nexport const emitStatus: (\n messageOrData: string | PayloadType<typeof StatusUpdate>,\n) => Effect.Effect<void, never, TraceService> = (message) =>\n write(StatusUpdate, typeof message === 'string' ? { message } : message);\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport type { Atom } from '@effect-atom/atom';\nimport * as Rpc from '@effect/rpc/Rpc';\nimport * as RpcGroup from '@effect/rpc/RpcGroup';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport type * as Exit from 'effect/Exit';\nimport * as Option from 'effect/Option';\nimport * as Schema from 'effect/Schema';\nimport * as Scope from 'effect/Scope';\nimport * as Stream from 'effect/Stream';\nimport type * as Types from 'effect/Types';\n\nimport { Annotation } from '@dxos/echo';\nimport { assertArgument } from '@dxos/invariant';\nimport { DXN, URI } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport type { SerializedError } from '@dxos/protocols';\n\nimport * as Operation from './Operation';\nimport * as OperationHandlerSet from './OperationHandlerSet';\nimport * as StorageService from './StorageService';\nimport * as Trace from './Trace';\n\n//\n// Process.\n//\n\n/** Opaque process id (arbitrary string). */\nexport const ID = Schema.String.pipe(Schema.brand('ProcessId'));\nexport type ID = Schema.Schema.Type<typeof ID>;\n\n/**\n * A running process callbacks.\n *\n * Process lifecycle: Initial -> Running <-> Suspended -> Terminated.\n *\n * - onSpawn -> called once when the process is spawned.\n * - onInput -> called for every input submitted to the process.\n * - onAlarm -> called for processes scheduling alarms.\n * - onChildEvent -> called when child process produces output or exits.\n */\nexport interface Callbacks<_Input, _Output, _Requirements, _Rpcs extends Rpc.Any> {\n /**\n * Called when the process is spawned.\n * Not called for processes that are resumed from a previously suspended state.\n *\n * @returns A signal indicating to the runtime whether the process is finished, or should be resumed later.\n * @throws Throwing in the handler will terminate the process with an error.\n *\n * Note: This function should aim to complete in under 5 seconds to avoid exceeding limits in serverless environments.\n */\n onSpawn(): Effect.Effect<void, never, _Requirements | BaseServices>;\n\n /**\n * Called when there's input available to process.\n *\n * The function can be called in parallel.\n *\n * @returns A signal indicating to the runtime whether the process is finished, or should be resumed later.\n * @throws Throwing in the handler will terminate the process with an error.\n *\n * Note: This function should aim to complete in under 5 seconds to avoid exceeding limits in serverless environments.\n */\n onInput(input: _Input): Effect.Effect<void, never, _Requirements | BaseServices>;\n\n /**\n * Called when the process's alarm is triggered.\n *\n * @throws Throwing in the handler will terminate the process with an error.\n */\n onAlarm(): Effect.Effect<void, never, _Requirements | BaseServices>;\n\n /**\n * Called when the process's child process produces output or exits.\n *\n * This allows the parent process to hibernate while a long-running child process is running.\n */\n onChildEvent(event: ChildEvent<unknown>): Effect.Effect<void, never, _Requirements | BaseServices>;\n\n /**\n * Handlers for the RPCs provided by the process.\n */\n rpcHandlers: Context.Context<Rpc.ToHandler<_Rpcs>>;\n}\n\n/**\n * Services that are always available to all processes.\n * Provided unconditionally by the runtime, so handlers may use them without declaring them\n * in {@link MakeProcessOpts.services}.\n */\nexport type BaseServices = Trace.TraceService | StorageService.StorageService;\n\nexport type ChildEvent<T> =\n | {\n readonly _tag: 'output';\n readonly pid: ID;\n readonly data: T;\n }\n | {\n readonly _tag: 'exited';\n readonly pid: ID;\n readonly result: Exit.Exit<void>;\n };\n\nexport interface ProcessContext<I, O> {\n readonly id: ID;\n\n /**\n * Parameters assigned during process creation.\n */\n readonly params: Params;\n\n /**\n * Complete this process with sucessful result.\n * No additional events will be pushed to the process.\n */\n succeed(): void;\n\n /**\n * Complete this process with an error.\n * No additional events will be pushed to the process.\n */\n fail(error: Error): void;\n\n /**\n * Submit output of the process.\n */\n submitOutput(output: O): void;\n\n /**\n * Set an alarm for the process to be woken up later.\n *\n * @param timeout - Optional timeout in milliseconds. If not provided, the process is woken up as soon as possible.\n */\n setAlarm(timeout?: number): void;\n}\n\n/**\n * Generic parameters for a all processes.\n */\nexport interface Params {\n /**\n * Process name for debugging purposes.\n */\n readonly name: string | null;\n\n /**\n * User-defined annotations for the process.\n * Can only be set when the process is spawned.\n */\n readonly annotations: Annotation.Dictionary;\n}\n\n/**\n * Attaches the process to a target object.\n */\nexport const TargetAnnotation = Annotation.make({\n id: 'org.dxos.process.target',\n schema: URI.Schema,\n});\n\n/**\n * Notification descriptor for surfacing process lifecycle events to the user.\n */\nexport const NotifyAnnotation = Annotation.make({\n id: 'org.dxos.process.notify',\n schema: Operation.NotifyOptions,\n});\n\n/**\n * URI of the Instructions object steering the process's conversation. Persisted at spawn (like\n * {@link TargetAnnotation}) so a re-hydrated process recovers its steering without reaching the Chat.\n */\nexport const InstructionsAnnotation = Annotation.make({\n id: 'org.dxos.process.instructions',\n schema: URI.Schema,\n});\n\n/**\n * Marks a process as the harness host for its conversation (discovery substrate).\n */\nexport const HarnessHostAnnotation = Annotation.make({\n id: 'org.dxos.process.harnessHost',\n schema: Schema.Boolean,\n});\n\n//\n// Executable.\n//\n\nexport const ProcessTypeId = '~@dxos/functions/Process' as const;\nexport type ProcessTypeId = typeof ProcessTypeId;\n\n/**\n * A process (factory).\n * Can be instantiated mutlitple times to produce new runtime instance with separate state and callbacks.\n * `create` is used to instantiate a new process.\n * Can store runtime state in scope of `create` function.\n */\nexport interface Process<\n _Input,\n _Output,\n _Requirements = never,\n _Rpcs extends Rpc.Any = never,\n> extends Process.Variance<_Input, _Output, _Requirements, _Rpcs> {\n /**\n * Unique identifier for the executable in the reverse DNS format.\n */\n readonly key: string;\n\n /**\n * Human-readable label from {@link MakeExecutableOpts.name} when provided.\n */\n readonly name?: string;\n\n readonly services: readonly Context.Tag<any, any>[];\n\n // Runtime RPC group, stored as `any`. `RpcGroup`/`RpcClient` are invariant in their type\n // argument (and `Callbacks.rpcHandlers` is contravariant in it), so referencing `_Rpcs` in the\n // structural fields would block `Process<…, never>` from being assignable to `Process.Any`.\n // The precise group is carried by the covariant `Variance` phantom and recovered at `spawn`.\n // See design spec §4.4.\n readonly rpcs: RpcGroup.RpcGroup<any>;\n\n /**\n * Create a new instance of the process.\n */\n create(\n ctx: ProcessContext<_Input, _Output>,\n ): Effect.Effect<Callbacks<_Input, _Output, _Requirements, any>, never, _Requirements | BaseServices | Scope.Scope>;\n}\n\nexport const isProcess = (executable: unknown): executable is Process.Any =>\n typeof executable === 'object' && executable !== null && ProcessTypeId in executable;\n\nexport namespace Process {\n export interface Variance<_Input, _Output, _Requirements, _Rpcs> {\n readonly [ProcessTypeId]: {\n readonly _Input: Types.Contravariant<_Input>;\n readonly _Output: Types.Covariant<_Output>;\n readonly _Requirements: Types.Covariant<_Requirements>;\n\n // Phantom-covariant: lets `never`-RPC processes stay assignable to `Process.Any` while\n // `spawn` still recovers the precise group from this slot. See design spec §4.4.\n readonly _Rpcs: Types.Covariant<_Rpcs>;\n };\n }\n\n export type Any = Process<any, any, any, any>;\n}\n\nexport interface MakeProcessOpts {\n /**\n * Unique identifier for the process in the reverse DNS format.\n */\n readonly key: string;\n\n readonly input: Schema.Schema.AnyNoContext;\n readonly output: Schema.Schema.AnyNoContext;\n readonly services: readonly Context.Tag<any, any>[];\n readonly rpcs?: RpcGroup.RpcGroup<any>;\n}\n\nexport const make = <const Opts extends Types.NoExcessProperties<MakeProcessOpts, Opts>>(\n opts: Opts,\n create: (\n ctx: ProcessContext<Schema.Schema.Type<Opts['input']>, Schema.Schema.Type<Opts['output']>>,\n ) => Effect.Effect<\n Partial<\n Callbacks<\n Schema.Schema.Type<Opts['input']>,\n Schema.Schema.Type<Opts['output']>,\n Context.Tag.Identifier<NonNullable<Opts['services']>[number]>,\n RpcGroup.Rpcs<Opts['rpcs']>\n >\n >,\n never,\n Context.Tag.Identifier<NonNullable<Opts['services']>[number]> | BaseServices | Scope.Scope\n >,\n): Process<\n Schema.Schema.Type<Opts['input']>,\n Schema.Schema.Type<Opts['output']>,\n Context.Tag.Identifier<NonNullable<Opts['services']>[number]>,\n RpcGroup.Rpcs<Opts['rpcs']>\n> => {\n assertArgument(/^[a-z0-9]([a-z0-9.\\-/]*[a-z0-9])?$/i.test(opts.key), 'key', 'Invalid key');\n return {\n [ProcessTypeId]: {} as any,\n ...opts,\n rpcs: opts.rpcs ?? RpcGroup.make(),\n create: (ctx) =>\n create(ctx).pipe(\n Effect.map((partial) => ({\n onSpawn: () => Effect.void,\n onInput: () => Effect.void,\n onAlarm: () => Effect.void,\n onChildEvent: () => Effect.void,\n ...partial,\n rpcHandlers: sanitizeRpcs(opts.rpcs, partial.rpcHandlers),\n })),\n ),\n };\n};\n\n// Returns `Context.Context<any>`: the runtime handler bag is stored untyped because\n// `Callbacks.rpcHandlers` is contravariant in `_Rpcs` (see design spec §4.4); the precise\n// handler contract is enforced by `make`'s `create` parameter, not by this internal helper.\nconst sanitizeRpcs = <Rpcs extends Rpc.Any>(\n defined: RpcGroup.RpcGroup<Rpcs> | undefined,\n provided: Context.Context<Rpc.ToHandler<Rpcs>> | undefined,\n): Context.Context<any> => {\n // Handlers are required only when a non-empty RPC group is declared.\n const needsRpcs = defined !== undefined && defined.requests.size > 0;\n if (!needsRpcs) {\n // `Context.empty()` is `Context<never>`; `Context`'s requirement parameter is contravariant,\n // so the empty (no-handler) context needs widening to the untyped bag.\n return provided ?? (Context.empty() as Context.Context<any>);\n }\n if (!provided) {\n throw new TypeError('Process declared RPCs but did not provide any handlers');\n }\n return provided;\n};\n\n/**\n * Durable marker recording that an operation's input handler has begun executing.\n * Persisted before the handler runs so that, after an interruption (suspend/restart), a\n * re-delivered input can tell that the previous attempt was in-flight. Cleared automatically\n * when the process reaches a terminal state (the runtime clears the process's storage).\n */\nconst OperationStartedCell = StorageService.cell(Schema.parseJson(Schema.Boolean), 'operation/started').pipe(\n StorageService.withDefault(() => false),\n);\n\nexport const fromOperation = <const Op extends Operation.Definition.Any>(\n op: Op,\n handler: OperationHandlerSet.OperationHandlerSet,\n): Process<Operation.Definition.Input<Op>, Operation.Definition.Output<Op>, Operation.Definition.Services<Op>> =>\n make(\n {\n key: DXN.getName(op.meta.key),\n input: op.input,\n output: op.output,\n services: op.services,\n },\n (ctx) =>\n Effect.gen(function* () {\n const semaphore = yield* Effect.makeSemaphore(1);\n // The process runtime assumes handlers are idempotent and always re-delivers an input\n // whose handler was interrupted. Non-idempotent operations opt out of that retry here:\n // a re-delivery that observes the durable \"started\" marker fails instead of repeating\n // side effects. Idempotent operations skip the marker and are simply re-run.\n const idempotent = Operation.isIdempotent(op);\n\n return {\n onInput: (input: Operation.Definition.Input<Op>) =>\n Effect.gen(function* () {\n if (!idempotent) {\n const started = yield* OperationStartedCell.get;\n if (started) {\n return yield* Effect.die(\n new Error(`non-idempotent operation \"${op.meta.key}\" was interrupted; cannot retry safely`),\n );\n }\n yield* OperationStartedCell.set(true);\n }\n\n // Emit operation start event.\n log('operation process invoking', { key: op.meta.key, name: op.meta.name });\n yield* Trace.write(Trace.OperationStart, {\n key: op.meta.key,\n name: op.meta.name,\n icon: op.meta.icon,\n });\n // Emit ephemeral operation input event for live subscribers\n // (history tracker, devtools) without persisting raw input.\n yield* Trace.write(Trace.OperationInput, {\n key: op.meta.key,\n name: op.meta.name,\n input,\n });\n\n const opHandler = yield* OperationHandlerSet.getHandler(handler, op).pipe(Effect.orDie);\n const output = yield* opHandler\n .handler(input)\n .pipe(Effect.orDie, Effect.withSpan(op.meta.key)) as Effect.Effect<\n Operation.Definition.Output<Op>,\n never,\n never\n >;\n\n ctx.submitOutput(output);\n ctx.succeed();\n\n // Emit ephemeral operation output event before the persisted\n // end event so subscribers see output + completion together.\n yield* Trace.write(Trace.OperationOutput, {\n key: op.meta.key,\n name: op.meta.name,\n output,\n });\n // Emit operation end event with success after side-effects complete.\n yield* Trace.write(Trace.OperationEnd, {\n key: op.meta.key,\n name: op.meta.name,\n icon: op.meta.icon,\n outcome: 'success',\n });\n }).pipe(\n Effect.catchAllDefect((defect) =>\n Effect.gen(function* () {\n // Emit operation end event with failure.\n const errorMessage = defect instanceof Error ? defect.message : String(defect);\n yield* Trace.write(Trace.OperationEnd, {\n key: op.meta.key,\n name: op.meta.name,\n icon: op.meta.icon,\n outcome: 'failure',\n error: errorMessage,\n });\n return yield* Effect.die(defect);\n }),\n ),\n semaphore.withPermits(1),\n ),\n };\n }),\n );\n\n/**\n * Runtime state of a process.\n */\nexport enum State {\n // Process is actively running.\n RUNNING = 'RUNNING',\n\n // Process is waiting for a child process to complete or an alarm to trigger.\n HYBERNATING = 'HYBERNATING',\n\n // Process is waiting for input. It will only resume when input is submitted.\n IDLE = 'IDLE',\n\n // Process is terminating and will transition to TERMINATED state.\n // TODO(dmaretskyi): Consider removing.\n TERMINATING = 'TERMINATING',\n\n // Process has been externally terminated.\n TERMINATED = 'TERMINATED',\n\n // Process has completed successfully.\n SUCCEEDED = 'SUCCEEDED',\n\n // Process has failed.\n FAILED = 'FAILED',\n}\n\n/**\n * Read-only view of a process tree\n */\nexport interface Monitor {\n /**\n * Get the current state of the process tree.\n */\n processTree: Effect.Effect<readonly Info[]>;\n\n /**\n * Atom for the process tree.\n */\n processTreeAtom: Atom.Atom<readonly Info[]>;\n\n /**\n * Stream ephemeral trace messages matching `filter` (DX-1125), sourced from local in-process\n * runtimes and remote runtimes broadcasting over the space swarm. Used to drive live progress UI.\n */\n subscribeToTraceMessages(filter: Trace.Filter): Stream.Stream<Trace.Message>;\n}\n\nexport class ProcessMonitorService extends Context.Tag('@dxos/functions/ProcessMonitorService')<\n ProcessMonitorService,\n Monitor\n>() {}\n\nexport interface Info {\n readonly pid: ID;\n readonly parentPid: ID | null;\n\n /**\n * Key of the process.\n *\n * NOTE: There might be multiple running processes with the same key.\n */\n readonly key: string;\n\n /**\n * Parameters of the process.\n */\n readonly params: Params;\n\n /**\n * State of the process.\n */\n readonly state: State;\n\n /**\n * How the process failed as a serializable {@link SerializedError} (its `context` carries any\n * structured detail, e.g. a notify override), or `null` unless it is in FAILED state.\n */\n readonly error: SerializedError | null;\n\n /**\n * UNIX timestamp in milliseconds.\n */\n readonly startedAt: number;\n\n /**\n * UNIX timestamp in milliseconds.\n */\n readonly completedAt: Option.Option<number>;\n\n readonly metrics: {\n /**\n * Total wall time of all handler invocations of the process in milliseconds.\n */\n readonly wallTime: number;\n\n /**\n * Total number of inputs submitted to the process.\n */\n readonly inputCount: number;\n\n /**\n * Total number of outputs submitted to the process.\n */\n readonly outputCount: number;\n };\n}\n\n/**\n * New process is spawned.\n */\nexport const SpawnedEvent = Trace.EventType('process.spawned', {\n schema: Schema.Void,\n isEphemeral: false,\n});\n\n/**\n * Process has reached a terminal state.\n */\nexport const ExitedEvent = Trace.EventType('process.exited', {\n schema: Schema.Struct({\n outcome: Schema.Literal('succeeded', 'failed', 'terminated'),\n }),\n isEphemeral: false,\n});\n\n/**\n * Renders spawned processes as a forest: top-level rows use \"- \", nested rows use ├── / └── / │.\n */\nexport const prettyProcessTree = (tree: readonly Info[]): string => {\n if (tree.length === 0) {\n return '';\n }\n\n const pidSet = new Set(tree.map((node) => node.pid));\n const childrenByParent = new Map<string, Info[]>();\n const roots: Info[] = [];\n\n for (const node of tree) {\n const parent = node.parentPid;\n if (parent === null || !pidSet.has(parent)) {\n roots.push(node);\n continue;\n }\n const key = String(parent);\n const siblings = childrenByParent.get(key) ?? [];\n siblings.push(node);\n childrenByParent.set(key, siblings);\n }\n\n const byPid = (a: Info, b: Info) => String(a.pid).localeCompare(String(b.pid));\n roots.sort(byPid);\n for (const siblings of childrenByParent.values()) {\n siblings.sort(byPid);\n }\n\n const formatLabel = (node: Info): string => {\n const idShort = String(node.pid).slice(0, 6);\n const parts = [idShort, node.state];\n if (node.params.name != null && node.params.name !== '') {\n parts.push(node.params.name);\n }\n if (node.error != null) {\n parts.push(`(${node.error.message ?? node.error.name ?? 'error'})`);\n }\n const { inputCount, outputCount, wallTime } = node.metrics;\n parts.push(`[in:${inputCount} out:${outputCount} wall:${Math.round(wallTime)}ms]`);\n return parts.join(' ');\n };\n\n const lines: string[] = [];\n\n const walk = (node: Info, prefix: string, isLast: boolean, isRoot: boolean): void => {\n if (isRoot) {\n lines.push(`- ${formatLabel(node)}`);\n } else {\n const branch = isLast ? '└── ' : '├── ';\n lines.push(`${prefix}${branch}${formatLabel(node)}`);\n }\n\n const children = childrenByParent.get(String(node.pid)) ?? [];\n const nextPrefix = isRoot ? ' ' : `${prefix}${isLast ? ' ' : '│ '}`;\n children.forEach((child, index) => {\n walk(child, nextPrefix, index === children.length - 1, false);\n });\n };\n\n for (const root of roots) {\n walk(root, '', true, true);\n }\n\n return lines.join('\\n');\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Either from 'effect/Either';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\nimport * as Scope from 'effect/Scope';\n\nimport type { SpaceId, URI } from '@dxos/keys';\n\nimport { ServiceNotAvailableError } from './errors';\nimport * as Process from './Process';\n\nconst ServiceResolverTypeId = '~@dxos/functions/ServiceResolver' as const;\ntype ServiceResolverTypeId = typeof ServiceResolverTypeId;\n\nexport interface ServiceResolver {\n readonly [ServiceResolverTypeId]: ServiceResolverTypeId;\n\n /**\n * Resolve a set of services identified by their tags.\n * Returns a Context containing all requested services, or fails with ServiceNotAvailableError.\n */\n resolve<Tag extends Context.Tag<any, any>>(\n tag: Tag,\n context: ResolutionContext,\n ): Effect.Effect<Context.Tag.Service<Tag>, ServiceNotAvailableError, Scope.Scope>;\n}\n\n/**\n * Tag for the ServiceResolver service.\n */\nexport const ServiceResolver = Context.GenericTag<ServiceResolver>('@dxos/functions/ServiceResolver');\n\nexport const resolve: {\n <Tag extends Context.Tag<any, any>>(\n tag: Tag,\n context: ResolutionContext,\n ): Effect.Effect<Context.Tag.Service<Tag>, ServiceNotAvailableError, Scope.Scope | ServiceResolver>;\n} = Effect.serviceFunctionEffect(ServiceResolver, (_) => _.resolve);\n\nexport const resolveAll = <const Tags extends readonly Context.Tag<any, any>[]>(\n tags: Tags,\n context: ResolutionContext,\n): Effect.Effect<Context.Context<Tags[number]>, ServiceNotAvailableError, Scope.Scope | ServiceResolver> =>\n Effect.gen(function* () {\n const services = yield* Effect.forEach(tags, (tag) =>\n resolve(tag, context).pipe(Effect.map((service) => Context.make(tag, service))),\n );\n return Context.mergeAll(...services);\n });\n\n/**\n * Provides context for service resolution.\n */\nexport interface ResolutionContext {\n /**\n * Under which identity the process is running.\n */\n readonly identity?: string;\n\n /**\n * Under which space the process is running.\n */\n readonly space?: SpaceId;\n\n /**\n * URI of the conversation feed the process is running in. Today always an EID;\n * narrow with `EID.parse` at the point of use.\n */\n readonly conversation?: URI.URI;\n\n /**\n * Under which process the process is running.\n */\n readonly process?: Process.ID;\n}\n\nexport const succeed = <I, S>(\n tag: Context.Tag<I, S>,\n getService: (context: ResolutionContext) => Effect.Effect<S, ServiceNotAvailableError, Scope.Scope>,\n): ServiceResolver => {\n return make((tag1, context) => {\n if (tag1.key !== tag.key) {\n return Effect.fail(new ServiceNotAvailableError(`Service not available: ${String(tag.key ?? tag)}`));\n }\n const service = getService(context);\n return service as any;\n });\n};\n\n/**\n * Create a ServiceResolver from a custom resolution function.\n */\nexport const make = (\n resolveFn: <I, S>(\n tag: Context.Tag<I, S>,\n context: ResolutionContext,\n ) => Effect.Effect<S, ServiceNotAvailableError, Scope.Scope>,\n): ServiceResolver => ({\n [ServiceResolverTypeId]: ServiceResolverTypeId,\n resolve: resolveFn,\n});\n\n/**\n * Create a ServiceResolver backed by a static Context.\n * Tags present in the context are resolved; missing tags fail with ServiceNotAvailableError.\n */\nexport const fromContext = <Services>(ctx: Context.Context<Services>): ServiceResolver =>\n make((tag, context) =>\n Effect.gen(function* () {\n const service = Context.getOption(ctx, tag);\n if (Option.isNone(service)) {\n return yield* Effect.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));\n }\n return service.value;\n }),\n );\n\n/**\n * Create a ServiceResolver that resolves tags from the current Effect context.\n * Only the specified tags are available; requests for other tags fail.\n */\nexport const fromRequirements = <const Tags extends readonly Context.Tag<any, any>[]>(\n ...tags: Tags\n): Effect.Effect<ServiceResolver, never, Context.Tag.Identifier<Tags[number]>> =>\n Effect.contextWith((parentCtx: Context.Context<any>) => {\n const available = new Set(tags.map((tag) => tag.key));\n return make((tag, context) =>\n Effect.gen(function* () {\n let result: Context.Context<never> = Context.empty() as Context.Context<never>;\n if (!available.has(tag.key)) {\n return yield* Effect.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));\n }\n const service = Context.getOption(parentCtx, tag);\n if (Option.isNone(service)) {\n return yield* Effect.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));\n }\n return service.value;\n }),\n );\n });\n\n/**\n * Like {@link fromRequirements} but returns a Layer that provides ServiceResolver.\n */\nexport const layerRequirements = <const Tags extends readonly Context.Tag<any, any>[]>(\n ...tags: Tags\n): Layer.Layer<ServiceResolver, never, Context.Tag.Identifier<Tags[number]>> =>\n Layer.effect(ServiceResolver, fromRequirements(...tags));\n\n/**\n * Build a {@link Layer} that materialises the requested services by calling\n * {@link resolveAll} against the {@link ServiceResolver} currently in context.\n *\n * The returned layer manages its own {@link Scope.Scope} and requires only a\n * {@link ServiceResolver} (typically supplied by the process-manager runtime).\n *\n * @example\n * ```ts\n * processManagerRuntime.runPromise(\n * myEffect.pipe(Effect.provide(ServiceResolver.provide({ space }, Database.Service))),\n * );\n * ```\n */\nexport const provide = <const Tags extends readonly Context.Tag<any, any>[]>(\n context: ResolutionContext,\n ...tags: Tags\n): Layer.Layer<Context.Tag.Identifier<Tags[number]>, ServiceNotAvailableError, ServiceResolver> =>\n Layer.scopedContext(resolveAll(tags, context));\n\n/**\n * Compose multiple resolvers left to right. Earlier resolvers take precedence:\n * the first resolver that can satisfy a tag wins.\n */\nexport const compose = (...resolvers: readonly ServiceResolver[]): ServiceResolver =>\n make((tag, context) =>\n Effect.gen(function* () {\n for (const resolver of resolvers) {\n const single = yield* resolver.resolve(tag, context).pipe(Effect.either);\n if (Either.isRight(single)) {\n return single.right;\n }\n }\n\n return yield* Effect.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));\n }),\n );\n\n/**\n * An empty resolver that fails for any requested service.\n */\nexport const empty: ServiceResolver = make((tag, context) => {\n return Effect.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAa,YAAY,OAAO,OAAO;CACrC,MAAM,OAAO,OAAO,KAAK,OAAO,QAAQ,CAAC,CAAC,YAAY,EACpD,aAAa,wCACf,CAAC;CAED,KAAK,OAAO,OAAO,YAAY,EAC7B,aAAa,wBACf,CAAC;;;;;;CAOD,UAAU,OAAO,MAAM,OAAO,QAAQ,MAAM,GAAG,OAAO,QAAQ,KAAK,CAAC,CAAC,CAAC,YAAY,EAChF,aAAa,6EACf,CAAC;;;;;;CAOD,QAAQ,OAAO,SAAS,OAA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O,GAAG,CAAC,CAAC;AAChF,CAAC,CACH;;;;AAKF,IAAa,QAAyB,MAAM,KAAK,YAAY;CAC3D,OAAO,OAAO,KAAK,IAAI,yBAAyB,OAAO,IAAI,OAAO,GAAG,CAAC,CAAC;AACzE,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import { a as lazy, l as Service, m as withHandler } from "./chunk-OperationHandlerSet.mjs";
3
+ import { n as Reply, r as Sleep, t as Fibonacci } from "./chunk-definitions.mjs";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Layer from "effect/Layer";
6
+ import * as Console from "effect/Console";
7
+ //#region src/testing/fib.ts
8
+ var fib_exports = /* @__PURE__ */ __exportAll({ default: () => fib_default });
9
+ var fib_default = Fibonacci.pipe(withHandler(Effect.fn(function* ({ iterations = 1e5 }) {
10
+ let a = 0n;
11
+ let b = 1n;
12
+ for (let i = 0; i < iterations; i++) {
13
+ a += b;
14
+ b = a - b;
15
+ }
16
+ return { result: a.toString() };
17
+ })));
18
+ //#endregion
19
+ //#region src/testing/reply.ts
20
+ var reply_exports = /* @__PURE__ */ __exportAll({ default: () => reply_default });
21
+ var reply_default = Reply.pipe(withHandler(Effect.fn(function* (input) {
22
+ yield* Console.log("reply", { input });
23
+ return input;
24
+ })));
25
+ //#endregion
26
+ //#region src/testing/sleep.ts
27
+ var sleep_exports = /* @__PURE__ */ __exportAll({ default: () => sleep_default });
28
+ var sleep_default = Sleep.pipe(withHandler(Effect.fn(function* ({ duration = 1e5 }) {
29
+ yield* Effect.sleep(duration);
30
+ })));
31
+ /** Noop `Operation.Service` for tests that must satisfy the type without invoking it. */
32
+ var operationServiceLayerNoop = Layer.succeed(Service, {
33
+ invoke: () => Effect.die("operationServiceLayerNoop: invoke is not implemented."),
34
+ schedule: () => Effect.die("operationServiceLayerNoop: schedule is not implemented."),
35
+ invokePromise: () => Promise.resolve({ error: /* @__PURE__ */ new Error("operationServiceLayerNoop: invokePromise is not implemented.") })
36
+ });
37
+ //#endregion
38
+ //#region src/testing/index.ts
39
+ var ExampleHandlers = lazy(() => Promise.resolve().then(() => fib_exports), () => Promise.resolve().then(() => reply_exports), () => Promise.resolve().then(() => sleep_exports));
40
+ //#endregion
41
+ export { ExampleHandlers, Fibonacci, fib_default as FibonacciHandler, Reply, reply_default as ReplyHandler, Sleep, sleep_default as SleepHandler, operationServiceLayerNoop };
42
+
43
+ //# sourceMappingURL=testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.mjs","names":[],"sources":["../../src/testing/fib.ts","../../src/testing/reply.ts","../../src/testing/sleep.ts","../../src/testing/operation.ts","../../src/testing/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as Operation from '../Operation';\nimport { Fibonacci } from './definitions';\n\nexport default Fibonacci.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ iterations = 100_000 }) {\n let a = 0n;\n let b = 1n;\n for (let i = 0; i < iterations; i++) {\n a += b;\n b = a - b;\n }\n return { result: a.toString() };\n }),\n ),\n);\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Console from 'effect/Console';\nimport * as Effect from 'effect/Effect';\n\nimport * as Operation from '../Operation';\nimport { Reply } from './definitions';\n\nexport default Reply.pipe(\n Operation.withHandler(\n Effect.fn(function* (input) {\n yield* Console.log('reply', { input });\n return input;\n }),\n ),\n);\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as Operation from '../Operation';\nimport { Sleep } from './definitions';\n\nexport default Sleep.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ duration = 100_000 }) {\n yield* Effect.sleep(duration);\n }),\n ),\n);\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport * as Operation from '../Operation';\n\nconst operationServiceStub: Operation.OperationService = {\n invoke: () => Effect.die('operationServiceLayerNoop: invoke is not implemented.'),\n schedule: () => Effect.die('operationServiceLayerNoop: schedule is not implemented.'),\n invokePromise: () =>\n Promise.resolve({ error: new Error('operationServiceLayerNoop: invokePromise is not implemented.') }),\n};\n\n/** Noop `Operation.Service` for tests that must satisfy the type without invoking it. */\nexport const operationServiceLayerNoop: Layer.Layer<Operation.Service> = Layer.succeed(\n Operation.Service,\n operationServiceStub,\n);\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport * as OperationHandlerSet from '../OperationHandlerSet';\n\nexport { Fibonacci, Reply, Sleep } from './definitions';\nexport { default as FibonacciHandler } from './fib';\nexport { default as ReplyHandler } from './reply';\nexport { default as SleepHandler } from './sleep';\nexport * from './operation';\n\nexport const ExampleHandlers = OperationHandlerSet.lazy(\n () => import('./fib'),\n () => import('./reply'),\n () => import('./sleep'),\n);\n"],"mappings":";;;;;;;;AASA,IAAA,cAAe,UAAU,KACvB,YACE,OAAO,GAAG,WAAW,EAAE,aAAa,OAAW;CAC7C,IAAI,IAAI;CACR,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,KAAK;EACnC,KAAK;EACL,IAAI,IAAI;CACV;CACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE;AAChC,CAAC,CACH,CACF;;;;ACXA,IAAA,gBAAe,MAAM,KACnB,YACE,OAAO,GAAG,WAAW,OAAO;CAC1B,OAAO,QAAQ,IAAI,SAAS,EAAE,MAAM,CAAC;CACrC,OAAO;AACT,CAAC,CACH,CACF;;;;ACRA,IAAA,gBAAe,MAAM,KACnB,YACE,OAAO,GAAG,WAAW,EAAE,WAAW,OAAW;CAC3C,OAAO,OAAO,MAAM,QAAQ;AAC9B,CAAC,CACH,CACF;;ACEA,IAAa,4BAA4D,MAAM,QAC7E,SACA;CATA,cAAc,OAAO,IAAI,uDAAuD;CAChF,gBAAgB,OAAO,IAAI,yDAAyD;CACpF,qBACE,QAAQ,QAAQ,EAAE,uBAAO,IAAI,MAAM,8DAA8D,EAAE,CAAC;AAMtG,CACF;;;ACRA,IAAa,kBAAkB,WAAA,QAAA,QAAA,CAAA,CAAA,WAAA,WAAA,SAAA,QAAA,QAAA,CAAA,CAAA,WAAA,aAAA,SAAA,QAAA,QAAA,CAAA,CAAA,WAAA,aAAA,CAI/B"}
@@ -0,0 +1,27 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ /**
4
+ * Identity of the actor authoring content within an operation. Today this is an agent (see
5
+ * `assistant-toolkit` `Agent.did`); it attributes content the operation authors — e.g. the
6
+ * `creator` of a suggestion branch — so it reads as its own author, distinct from the human user
7
+ * and from other agents. Provided by the agent runtime for the duration of a tool/operation call.
8
+ */
9
+ export interface Identity {
10
+ /** Identity DID (e.g. an agent's `did:halo:` DID). */
11
+ readonly did: string;
12
+ /** Optional display name. */
13
+ readonly name?: string;
14
+ /** Optional palette hue. */
15
+ readonly hue?: string;
16
+ }
17
+ declare const AgentIdentity_base: Context.TagClass<AgentIdentity, "@dxos/compute/AgentIdentity", Identity>;
18
+ export declare class AgentIdentity extends AgentIdentity_base {
19
+ }
20
+ /**
21
+ * The current author DID, or `undefined` when no {@link AgentIdentity} is in scope (e.g. a human-
22
+ * initiated invocation). Reads optionally, so an operation that defaults its author from the agent
23
+ * identity does not add a hard service requirement.
24
+ */
25
+ export declare const currentDid: Effect.Effect<string | undefined>;
26
+ export {};
27
+ //# sourceMappingURL=AgentIdentity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentIdentity.d.ts","sourceRoot":"","sources":["../../../src/AgentIdentity.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,sDAAsD;IACtD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;;AAED,qBAAa,aAAc,SAAQ,kBAAqE;CAAG;AAE3G;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAExD,CAAC"}
@@ -3,7 +3,9 @@ import * as Effect from 'effect/Effect';
3
3
  import type * as Stream from 'effect/Stream';
4
4
  import type { Database, Feed, Obj, Ref } from '@dxos/echo';
5
5
  import { DXN } from '@dxos/keys';
6
+ import type { ContentBlock } from '@dxos/types';
6
7
  import type * as Trace from './Trace';
8
+ import { Instructions } from './types';
7
9
  /**
8
10
  * Service interface for the agent session manager.
9
11
  * Implementation lives in @dxos/functions-runtime.
@@ -39,9 +41,9 @@ export interface Session {
39
41
  */
40
42
  addContext: (context: Ref.Ref<Obj.Unknown>[]) => Effect.Effect<void, never, Database.Service>;
41
43
  /**
42
- * Submits a prompt to the agent.
44
+ * Submit a turn: a plain user prompt, or pre-built content blocks (e.g. synthetic context + prompt).
43
45
  */
44
- submitPrompt: (prompt: string) => Effect.Effect<void>;
46
+ submitPrompt: (prompt: string | ContentBlock.Any[]) => Effect.Effect<void>;
45
47
  /**
46
48
  * Wait until agent has completed its work.
47
49
  */
@@ -66,6 +68,12 @@ export interface GetSessionOptions {
66
68
  readonly model?: DXN.DXN;
67
69
  readonly provider?: DXN.DXN;
68
70
  readonly systemPrompt?: string;
71
+ /**
72
+ * Instructions steering the conversation (typically the Chat's `instructions` ref), persisted as a
73
+ * spawn annotation so a re-hydrated process recovers it. Read at spawn only: repointing requires a
74
+ * process restart (same staleness model as `model`/`provider`).
75
+ */
76
+ readonly instructions?: Ref.Ref<Instructions.Instructions>;
69
77
  }
70
78
  export {};
71
79
  //# sourceMappingURL=AgentService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentService.d.ts","sourceRoot":"","sources":["../../../src/AgentService.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,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;CAC5D"}
@@ -0,0 +1,19 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ declare const Service_base: Context.TagClass<Service, "@dxos/compute/Cancellation", {
4
+ readonly signal: AbortSignal;
5
+ }>;
6
+ /**
7
+ * Cooperative cancellation of the current operation run. The runtime that owns execution provides
8
+ * the service and fires the signal when the run is cancelled — the EDGE worker on a client cancel
9
+ * request, the local process runtime on terminate. Operations observe it via {@link signal}.
10
+ */
11
+ export declare class Service extends Service_base {
12
+ }
13
+ /**
14
+ * The current run's cancellation signal — e.g. for `Pipeline.abortWith` or `fetch`. Never fires when
15
+ * the runtime provided no cancellation channel.
16
+ */
17
+ export declare const signal: Effect.Effect<AbortSignal>;
18
+ export {};
19
+ //# sourceMappingURL=Cancellation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cancellation.d.ts","sourceRoot":"","sources":["../../../src/Cancellation.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;qBAW2D,WAAW;;AAR9G;;;;GAIG;AAIH,qBAAa,OAAQ,SAAQ,YAAsF;CAAG;AAEtH;;;GAGG;AAEH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAO7C,CAAC"}
@@ -1,8 +1,16 @@
1
1
  import * as Context from 'effect/Context';
2
2
  import * as Effect from 'effect/Effect';
3
+ import * as Layer from 'effect/Layer';
3
4
  import * as Redacted from 'effect/Redacted';
5
+ import { type SpaceId } from '@dxos/keys';
4
6
  export type CredentialQuery = {
5
7
  service?: string;
8
+ /**
9
+ * Look up one specific `AccessToken` object instead of any credential for a service. Required
10
+ * wherever a space can hold several connections to the same service, since a by-service lookup
11
+ * picks among them arbitrarily.
12
+ */
13
+ accessTokenId?: string;
6
14
  };
7
15
  export type ServiceCredential = {
8
16
  service: string;
@@ -10,6 +18,34 @@ export type ServiceCredential = {
10
18
  /** Non-secret secondary identifier carried alongside the credential (e.g. an account id or report id). */
11
19
  account?: string;
12
20
  };
21
+ declare const AccessTokenResolver_base: Context.TagClass<AccessTokenResolver, "@dxos/functions/AccessTokenResolver", {
22
+ resolve: (request: {
23
+ spaceId: SpaceId;
24
+ accessTokenId: string;
25
+ refresh?: boolean;
26
+ }) => Promise<string>;
27
+ }>;
28
+ /**
29
+ * Source for credentials EDGE custodies rather than replicating into the space (those stored as
30
+ * `MANAGED_ACCESS_TOKEN`).
31
+ *
32
+ * An implementation detail of {@link CredentialsService}, not a consumer-facing service: it exists
33
+ * as a tag only because the two surfaces reach EDGE differently — clients over authenticated HTTP,
34
+ * functions over a space-bound service binding. Implementations cache; pass `refresh` to bypass that
35
+ * cache after an authorization failure.
36
+ */
37
+ export declare class AccessTokenResolver extends AccessTokenResolver_base {
38
+ static resolve: (request: {
39
+ spaceId: SpaceId;
40
+ accessTokenId: string;
41
+ refresh?: boolean;
42
+ }) => Effect.Effect<string, never, AccessTokenResolver>;
43
+ /**
44
+ * Fails on every managed token. The default where EDGE is unreachable (tests, offline CLI runs):
45
+ * a managed credential genuinely cannot be resolved there, and failing says so.
46
+ */
47
+ static notAvailable: Layer.Layer<AccessTokenResolver, never, never>;
48
+ }
13
49
  declare const CredentialsService_base: Context.TagClass<CredentialsService, "@dxos/functions/CredentialsService", {
14
50
  /**
15
51
  * Query all.
@@ -25,5 +61,10 @@ export declare class CredentialsService extends CredentialsService_base {
25
61
  static getCredential: (query: CredentialQuery) => Effect.Effect<ServiceCredential, never, CredentialsService>;
26
62
  static getApiKey: (query: CredentialQuery) => Effect.Effect<Redacted.Redacted<string>, never, CredentialsService>;
27
63
  }
64
+ /**
65
+ * The credential's API key as a plain string — what a caller passing it to an HTTP client needs.
66
+ * Resolves a server-custodied value transparently, so callers never branch on where it came from.
67
+ */
68
+ export declare const getApiKeyValue: (query: CredentialQuery) => Effect.Effect<string, never, CredentialsService>;
28
69
  export {};
29
70
  //# sourceMappingURL=Credential.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Credential.d.ts","sourceRoot":"","sources":["../../../src/Credential.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,0GAA0G;IAC1G,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;;IAKE;;OAEG;sBACe,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE1E;;;OAGG;mBACY,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,CAAC;;AAZzE,qBAAa,kBAAmB,SAAQ,uBAcrC;IACD,MAAM,CAAC,aAAa,UAAW,eAAe,KAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAIvG;IAEL,MAAM,CAAC,SAAS,UAAW,eAAe,KAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAO3G;CACN"}
1
+ {"version":3,"file":"Credential.d.ts","sourceRoot":"","sources":["../../../src/Credential.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,e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