@dxos/compute 0.9.0 → 0.9.1-staging.ee54ba693a

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 (89) hide show
  1. package/README.md +4 -4
  2. package/dist/lib/neutral/AgentService.mjs +12 -0
  3. package/dist/lib/neutral/StorageService.mjs +3 -3
  4. package/dist/lib/neutral/{chunk-AFBNVFAY.mjs → chunk-2ZN64ZS7.mjs} +3 -3
  5. package/dist/lib/neutral/{chunk-JAU4E4EK.mjs → chunk-5VAXF6AH.mjs} +2 -2
  6. package/dist/lib/neutral/{chunk-QZS4G6PE.mjs → chunk-EVROJER7.mjs} +70 -25
  7. package/dist/lib/neutral/chunk-EVROJER7.mjs.map +7 -0
  8. package/dist/lib/neutral/{chunk-XEVFBI6S.mjs → chunk-PF7XP7XP.mjs} +13 -13
  9. package/dist/lib/neutral/{chunk-XEVFBI6S.mjs.map → chunk-PF7XP7XP.mjs.map} +3 -3
  10. package/dist/lib/neutral/{chunk-MEPE4HHX.mjs → chunk-SJ37RWHU.mjs} +3 -3
  11. package/dist/lib/neutral/chunk-VSAZPWSJ.mjs +25 -0
  12. package/dist/lib/neutral/chunk-VSAZPWSJ.mjs.map +7 -0
  13. package/dist/lib/neutral/{chunk-2B2KSJT6.mjs → chunk-WEO4FCQY.mjs} +3 -3
  14. package/dist/lib/neutral/fib-5XIYECL5.mjs +10 -0
  15. package/dist/lib/neutral/index.mjs +448 -399
  16. package/dist/lib/neutral/index.mjs.map +4 -4
  17. package/dist/lib/neutral/meta.json +1 -1
  18. package/dist/lib/neutral/reply-GCBRCUVM.mjs +10 -0
  19. package/dist/lib/neutral/sleep-XR6CL6W3.mjs +10 -0
  20. package/dist/lib/neutral/sleep-XR6CL6W3.mjs.map +7 -0
  21. package/dist/lib/neutral/testing/index.mjs +6 -6
  22. package/dist/types/src/AgentService.d.ts +71 -0
  23. package/dist/types/src/AgentService.d.ts.map +1 -0
  24. package/dist/types/src/Credential.d.ts +2 -0
  25. package/dist/types/src/Credential.d.ts.map +1 -1
  26. package/dist/types/src/Instructions.d.ts +33 -0
  27. package/dist/types/src/Instructions.d.ts.map +1 -0
  28. package/dist/types/src/McpServer.d.ts +1 -1
  29. package/dist/types/src/Operation.d.ts +92 -27
  30. package/dist/types/src/Operation.d.ts.map +1 -1
  31. package/dist/types/src/Operation.test.d.ts +2 -0
  32. package/dist/types/src/Operation.test.d.ts.map +1 -0
  33. package/dist/types/src/Process.d.ts +55 -21
  34. package/dist/types/src/Process.d.ts.map +1 -1
  35. package/dist/types/src/Runnable.d.ts +4 -0
  36. package/dist/types/src/Runnable.d.ts.map +1 -0
  37. package/dist/types/src/Script.d.ts +9 -11
  38. package/dist/types/src/Script.d.ts.map +1 -1
  39. package/dist/types/src/ServiceResolver.d.ts +1 -1
  40. package/dist/types/src/Skill.d.ts +157 -0
  41. package/dist/types/src/Skill.d.ts.map +1 -0
  42. package/dist/types/src/StorageService.d.ts +8 -8
  43. package/dist/types/src/StorageService.d.ts.map +1 -1
  44. package/dist/types/src/Template.d.ts +2 -4
  45. package/dist/types/src/Template.d.ts.map +1 -1
  46. package/dist/types/src/Trace.d.ts +16 -14
  47. package/dist/types/src/Trace.d.ts.map +1 -1
  48. package/dist/types/src/Trigger.d.ts +26 -61
  49. package/dist/types/src/Trigger.d.ts.map +1 -1
  50. package/dist/types/src/TriggerEvent.d.ts +3 -11
  51. package/dist/types/src/TriggerEvent.d.ts.map +1 -1
  52. package/dist/types/src/index.d.ts +5 -3
  53. package/dist/types/src/index.d.ts.map +1 -1
  54. package/dist/types/tsconfig.tsbuildinfo +1 -1
  55. package/package.json +22 -16
  56. package/src/AgentService.ts +90 -0
  57. package/src/Credential.ts +3 -0
  58. package/src/Instructions.ts +73 -0
  59. package/src/McpServer.ts +1 -1
  60. package/src/Operation.test.ts +39 -0
  61. package/src/Operation.ts +130 -54
  62. package/src/Process.ts +96 -26
  63. package/src/Runnable.ts +12 -0
  64. package/src/Script.ts +14 -14
  65. package/src/ServiceResolver.ts +1 -1
  66. package/src/Skill.ts +218 -0
  67. package/src/StorageService.ts +15 -12
  68. package/src/Template.ts +2 -1
  69. package/src/Trace.ts +13 -11
  70. package/src/Trigger.ts +57 -52
  71. package/src/index.ts +5 -3
  72. package/src/umbrella.test.ts +8 -6
  73. package/dist/lib/neutral/chunk-QZS4G6PE.mjs.map +0 -7
  74. package/dist/lib/neutral/fib-HBDUGQW7.mjs +0 -10
  75. package/dist/lib/neutral/reply-RJIAJ6FV.mjs +0 -10
  76. package/dist/lib/neutral/sleep-3T2CZ7RE.mjs +0 -10
  77. package/dist/types/src/Blueprint.d.ts +0 -182
  78. package/dist/types/src/Blueprint.d.ts.map +0 -1
  79. package/dist/types/src/Routine.d.ts +0 -54
  80. package/dist/types/src/Routine.d.ts.map +0 -1
  81. package/src/Blueprint.ts +0 -224
  82. package/src/Routine.ts +0 -68
  83. /package/dist/lib/neutral/{fib-HBDUGQW7.mjs.map → AgentService.mjs.map} +0 -0
  84. /package/dist/lib/neutral/{chunk-AFBNVFAY.mjs.map → chunk-2ZN64ZS7.mjs.map} +0 -0
  85. /package/dist/lib/neutral/{chunk-JAU4E4EK.mjs.map → chunk-5VAXF6AH.mjs.map} +0 -0
  86. /package/dist/lib/neutral/{chunk-MEPE4HHX.mjs.map → chunk-SJ37RWHU.mjs.map} +0 -0
  87. /package/dist/lib/neutral/{chunk-2B2KSJT6.mjs.map → chunk-WEO4FCQY.mjs.map} +0 -0
  88. /package/dist/lib/neutral/{reply-RJIAJ6FV.mjs.map → fib-5XIYECL5.mjs.map} +0 -0
  89. /package/dist/lib/neutral/{sleep-3T2CZ7RE.mjs.map → reply-GCBRCUVM.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/Blueprint.ts", "../../../src/McpServer.ts", "../../../src/Template.ts", "../../../src/Credential.ts", "../../../src/Header.ts", "../../../src/LayerSpec.ts", "../../../src/OperationRegistry.ts", "../../../src/Process.ts", "../../../src/Trace.ts", "../../../src/Routine.ts", "../../../src/Script.ts", "../../../src/ServiceResolver.ts", "../../../src/Trigger.ts", "../../../src/TriggerEvent.ts"],
4
- "sourcesContent": ["//\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 { DXN, Annotation, Database, Filter, Migration, Obj, Registry, Type, URI } from '@dxos/echo';\nimport { BaseError } from '@dxos/errors';\n\nimport * as McpServer from './McpServer';\nimport * as Operation from './Operation';\nimport * as Template from './Template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints 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(blueprint).key` and `Obj.getMeta(blueprint).version`.\n */\n// TODO(burdon): Rename Skill?\nexport const Blueprint = Schema.Struct({\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint'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 blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n\n /**\n * Whether an agent is allowed to auto-enable this blueprint in a conversation.\n */\n agentCanEnable: Schema.optional(Schema.Boolean).annotations({\n description: 'Whether an agent is allowed to auto-enable this blueprint in a conversation.',\n }),\n\n /**\n * Array of MCP servers that the AI assistant can use when this blueprint is active.\n */\n mcpServers: Schema.optional(Schema.Array(McpServer.McpServer)),\n}).pipe(\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--blueprint--regular', hue: 'sky' }),\n Type.makeObject(DXN.make('org.dxos.type.blueprint', '0.2.0')),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport type Blueprint = Type.InstanceType<typeof Blueprint>;\n\ntype MakeProps = { key: string; version?: string; name: string } & Partial<Blueprint>;\n\n/**\n * Create a new Blueprint.\n * The `key` (and optional `version`) are stored in the object meta.\n */\nexport const make = ({ key, version, tools = [], instructions = Template.make(), ...props }: MakeProps) =>\n Obj.make(Blueprint, {\n [Obj.Meta]: { key, version },\n tools,\n instructions,\n ...props,\n });\n\n/**\n * Get the registry key for a blueprint.\n */\nexport const getKey = (blueprint: Blueprint): string => {\n const key = Obj.getMeta(blueprint).key;\n if (key === undefined) {\n throw new Error('Blueprint is missing the meta key.');\n }\n return key;\n};\n\n/**\n * Get the registry version for a blueprint, if any.\n */\nexport const getVersion = (blueprint: Blueprint): string | undefined => Obj.getMeta(blueprint).version;\n\n/**\n * Util to create tool definitions for a blueprint.\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 blueprints.\n */\nexport type Definition = {\n key: string;\n make: () => Blueprint;\n};\n\n/**\n * Returns the canonical URI used to reference this blueprint in the registry.\n * Valid DXN keys produce `dxn:<key>`; other keys use the raw key as a URI.\n * Use this URI with `Ref.fromURI` to bind a blueprint 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: string): URI.URI => (DXN.tryMake(`dxn:${key}`) ?? URI.make(key)) as URI.URI;\n\n/**\n * Resolves a blueprint from the registry by its meta key.\n * Does not check the local database for the blueprint.\n */\nexport const resolve = (key: string): Effect.Effect<Blueprint, NotFoundError, Registry.Service> =>\n Effect.gen(function* () {\n const results = yield* Registry.runQuery(Filter.and(Filter.type(Blueprint), Filter.key(key)));\n const blueprint = results[0];\n if (!blueprint) {\n return yield* Effect.fail(new NotFoundError({ context: { key } }));\n }\n return blueprint;\n });\n\n/**\n * Upserts a blueprint into the database.\n * If the blueprint 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 blueprints in the database.\n */\n// TODO(dmaretskyi): Remove.\nexport const upsert = (key: string): Effect.Effect<Blueprint, NotFoundError, Registry.Service | Database.Service> =>\n Effect.gen(function* () {\n const local = yield* Database.query(Filter.and(Filter.type(Blueprint), 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: true }));\n });\n\nexport class NotFoundError extends BaseError.extend('BlueprintNotFound', 'Blueprint not found') {}\n\n//\n// Legacy schemas and migrations.\n//\n\n/**\n * Blueprint schema v0.1.0 — `key` is stored as a data property.\n * @deprecated Use {@link Blueprint} (v0.2.0) instead; the `key` and `version` now live in the object meta.\n */\nexport const Blueprint_v0_1_0 = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n description: Schema.optional(Schema.String),\n\n instructions: Template.Template,\n\n tools: Schema.Array(ToolId),\n\n agentCanEnable: Schema.optional(Schema.Boolean),\n\n mcpServers: Schema.optional(Schema.Array(McpServer.McpServer)),\n}).pipe(Type.makeObject(DXN.make('org.dxos.type.blueprint', '0.1.0')));\n\nexport type Blueprint_v0_1_0 = Type.InstanceType<typeof Blueprint_v0_1_0>;\n/**\n * Migration from {@link Blueprint_v0_1_0} (v0.1.0) to {@link Blueprint} (v0.2.0).\n * Moves `key` from the data section into the object meta.\n */\nconst _migration = Migration.define({\n from: Blueprint_v0_1_0,\n to: Blueprint,\n transform: async (from) => ({\n [Obj.Meta]: { key: from.key, version: '0.1.0' },\n name: from.name,\n description: from.description,\n instructions: from.instructions,\n tools: from.tools,\n agentCanEnable: from.agentCanEnable,\n mcpServers: from.mcpServers,\n }),\n});\n\n/**\n * Schema migrations exported by this module.\n * Exported as an array for extensibility — append future versions here.\n */\nexport const migrations = [_migration];\n", "//\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 blueprints 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>;\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 const fn = Operation.deserialize(results[0]);\n\n // NOTE: Operations referenced by template inputs must accept void input — see `Input.operation`.\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 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Redacted from 'effect/Redacted';\n\nexport type CredentialQuery = {\n service?: 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\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// 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 type { Atom } from '@effect-atom/atom';\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 type * as Types from 'effect/Types';\n\nimport { assertArgument } from '@dxos/invariant';\nimport { DXN, type URI } from '@dxos/keys';\nimport { log } from '@dxos/log';\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<I, O, R> {\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, R | 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: I): Effect.Effect<void, never, R | 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, R | 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, R | BaseServices>;\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 * URI of the target this process is assigned to.\n */\n readonly target: URI.URI | null;\n\n /**\n * User-facing notifications requested for this process's lifecycle phases.\n * Surfaced on {@link Info} so a notification tracker can subscribe to the process monitor.\n */\n readonly notify?: Operation.NotifyOptions;\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<I, O, R> extends Process.Variance<I, O, R> {\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 /**\n * Create a new instance of the process.\n */\n create(ctx: ProcessContext<I, O>): Effect.Effect<Callbacks<I, O, R>, never, R | 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<I, O, R> {\n readonly [ProcessTypeId]: {\n readonly _Input: Types.Contravariant<I>;\n readonly _Output: Types.Covariant<O>;\n readonly _Requirements: Types.Covariant<R>;\n };\n }\n\n export type Any = Process<any, any, never>;\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}\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 >\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> => {\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 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 })),\n ),\n };\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 OperationStartedKey = StorageService.key(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* OperationStartedKey.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* OperationStartedKey.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\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 * Error of the process.\n * Only for process in FAILED state.\n */\n readonly error: string | 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})`);\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 Layer from 'effect/Layer';\nimport * as Schema from 'effect/Schema';\n\nimport { DXN, Annotation, Obj, Type } from '@dxos/echo';\nimport { log } from '@dxos/log';\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 * 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 * ID of the conversation feed object if present.\n */\n conversationId: Schema.optional(Obj.ID),\n\n /**\n * ID of the trigger object if invocation resulted from a trigger.\n */\n triggerId: Schema.optional(Obj.ID),\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 * 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\n isEphemeral: Schema.Boolean,\n events: Schema.Array(Event),\n});\nexport type MessageData = Schema.Schema.Type<typeof MessageData>;\nexport const Message = MessageData.pipe(\n Annotation.IconAnnotation.set({ icon: 'ph--note--regular', hue: 'rose' }),\n Annotation.HiddenAnnotation.set(true),\n Type.makeObject(DXN.make('org.dxos.type.traceMessage', '0.1.0')),\n);\nexport type Message = Type.InstanceType<typeof Message>;\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 * 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.String,\n }),\n isEphemeral: true,\n});\n\n/**\n * Emit the current human-readable execution status to the trace.\n */\nexport const emitStatus: (message: string) => Effect.Effect<void, never, TraceService> = (message) =>\n write(StatusUpdate, { message });\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { DXN, Annotation, JsonSchema, Obj, Ref, Type, Format } from '@dxos/echo';\nimport { Text } from '@dxos/schema';\n\nimport * as Blueprint from './Blueprint';\n\n/**\n * Prompt-based operation.\n * May reference blueprints and additional context.\n */\nexport const Routine = 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 instructions: Ref.Ref(Text.Text).pipe(\n Format.FormatAnnotation.set(Format.TypeFormat.Markdown),\n Schema.annotations({ title: 'Instructions', description: 'Agent instructions' }),\n ),\n blueprints: Schema.Array(Ref.Ref(Blueprint.Blueprint)),\n context: Schema.Array(Schema.Any).pipe(Annotation.FormInputAnnotation.set(false)),\n}).pipe(\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--scroll--regular', hue: 'sky' }),\n Type.makeObject(DXN.make('org.dxos.type.routine', '0.1.0')),\n);\n\nexport type Routine = Type.InstanceType<typeof Routine>;\n\nexport type MakeProps = {\n name?: string;\n description?: string;\n input?: Schema.Schema.AnyNoContext;\n output?: Schema.Schema.AnyNoContext;\n instructions?: string;\n blueprints?: Ref.Ref<Blueprint.Blueprint>[];\n context?: any[];\n};\n\nexport const make = ({\n name,\n description,\n input,\n output,\n instructions,\n blueprints = [],\n context = [],\n}: MakeProps): Routine =>\n Obj.make(Routine, {\n name,\n description,\n input: JsonSchema.toJsonSchema(input ?? Schema.Void),\n output: JsonSchema.toJsonSchema(output ?? Schema.Void),\n instructions: Ref.make(Text.make({ content: instructions ?? '' })),\n blueprints,\n context,\n });\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { DXN, Annotation, Obj, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation } from '@dxos/echo/Annotation';\nimport { Text } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport const Script = 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 Type.makeObject(DXN.make('org.dxos.type.script', '0.1.0')),\n);\n\nexport type Script = Type.InstanceType<typeof Script>;\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 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, Feed.FeedService))),\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", "//\n// Copyright 2023 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { DXN, Annotation, Feed, Obj, QueryAST, Ref, Type, type Query } from '@dxos/echo';\nimport { HiddenAnnotation } from '@dxos/echo/Annotation';\nimport { OptionsAnnotationId } from '@dxos/echo/Format';\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', '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 query: Schema.Struct({\n raw: Schema.optional(Schema.String.annotations({ title: 'Query' })),\n ast: QueryAST.Query,\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 * 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, SubscriptionSpec, TimerSpec, WebhookSpec).annotations({\n title: 'Trigger',\n});\nexport type Spec = Schema.Schema.Type<typeof Spec>;\n\n/**\n * Function trigger.\n * Function is invoked with the `payload` passed as input data.\n * The event that triggers the function is available in the function context.\n */\nconst TriggerSchema = Schema.Struct({\n /**\n * Function or workflow to invoke.\n */\n // TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).\n function: Schema.optional(Ref.Ref(Obj.Unknown).annotations({ title: 'Function' })),\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.optional(Schema.String.annotations({ title: 'Input Node ID' })),\n\n // TODO(burdon): NO BOOLEAN PROPERTIES (enabld/disabled/paused, etc.)\n // Need lint rule; or agent rule to require PR review for \"boolean\" key word.\n enabled: Schema.optional(Schema.Boolean.annotations({ title: 'Enabled' })),\n\n spec: Schema.optional(Spec),\n\n concurrency: Schema.optional(\n Schema.Number.annotations({\n title: 'Concurrency',\n default: 1,\n description:\n 'Maximum number of concurrent invocations of the trigger. For Feed triggers, this will process Feed items in parallel.',\n }),\n ),\n\n /**\n * Passed as the input data 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 */\n input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n}).pipe(\n Annotation.IconAnnotation.set({ icon: 'ph--lightning--regular', hue: 'yellow' }),\n HiddenAnnotation.set(true),\n Type.makeObject(DXN.make('org.dxos.type.trigger', '0.1.0')),\n);\n\nexport type Trigger = Type.InstanceType<typeof TriggerSchema>;\nexport const Trigger: Type.Obj<Trigger> = TriggerSchema as any;\n\nexport const make = (props: Obj.MakeProps<typeof Trigger>) => Obj.make(Trigger, props);\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\nexport const SubscriptionEvent = Schema.Struct({\n /**\n * Type of the mutation.\n */\n // TODO(dmaretskyi): Specify enum.\n type: Schema.String,\n\n /**\n * Reference to the object that was changed or created.\n */\n subject: Ref.Ref(Obj.Unknown),\n\n /**\n * @deprecated\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 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(EmailEvent, FeedEvent, SubscriptionEvent, TimerEvent, WebhookEvent);\nexport type TriggerEvent = Schema.Schema.Type<typeof TriggerEvent>;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;cAAAA;EAAA;;;;;;AAMA,YAAYC,aAAY;AACxB,YAAYC,aAAY;AAExB,SAASC,cAAc;AACvB,SAASC,OAAAA,MAAKC,YAAYC,YAAAA,WAAUC,UAAAA,SAAQC,WAAWC,KAAKC,YAAAA,WAAUC,MAAMC,WAAW;AACvF,SAASC,iBAAiB;;;ACX1B;;;;AAMA,YAAYC,YAAY;AASjB,IAAMC,YAAmBC,cAAO;EACrCC,MAAaC,cAAOC,KAAYC,eAAQ,EAAEC,YAAY;IACpDC,aAAa;EACf,CAAA;EAEAC,KAAYL,cAAOG,YAAY;IAC7BC,aAAa;EACf,CAAA;;;;;;EAOAE,UAAiBC,aAAaC,eAAQ,MAAA,GAAgBA,eAAQ,KAAA,CAAA,EAAQL,YAAY;IAChFC,aAAa;EACf,CAAA;;;;;;EAOAK,QAAeP,gBAAgBF,aAAM,EAAEG,YAAY;IACjDC,aAAa;EACf,CAAA;AACF,CAAA;;;ACzCA;;;;;;;;;AAMA,YAAYM,YAAY;AACxB,YAAYC,aAAY;AAExB,SAASC,UAAUC,KAAKC,QAAQC,KAAKC,gBAAgB;AAEr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,CAAA;AAGO,IAAM2B,eAAsBC,cAAM/B,YAAYQ,WAAWK,mBAAmBK,YAAYG,YAAAA;",
6
- "names": ["make", "Effect", "Schema", "ToolId", "DXN", "Annotation", "Database", "Filter", "Migration", "Obj", "Registry", "Type", "URI", "BaseError", "Schema", "McpServer", "Struct", "name", "String", "pipe", "optional", "annotations", "description", "url", "protocol", "Union", "Literal", "apiKey", "Effect", "Schema", "Database", "DXN", "Filter", "Ref", "Registry", "assertArgument", "invariant", "log", "Text", "Handlebars", "InputKind", "default", "Schema", "description", "inputs", "id", "content", "source", "section", "handlebars", "Handlebars", "create", "registerHelper", "template", "compileAST", "output", "variables", "trim", "processTemplate", "Effect", "kind", "input", "key", "isDXN", "operation", "results", "length", "FunctionNotFoundError", "Operation", "deserialize", "result", "invoke", "fn", "undefined", "Blueprint", "Struct", "name", "String", "annotations", "description", "optional", "instructions", "Template", "tools", "Array", "ToolId", "agentCanEnable", "Boolean", "mcpServers", "McpServer", "pipe", "Annotation", "LabelAnnotation", "set", "IconAnnotation", "icon", "hue", "Type", "makeObject", "DXN", "make", "key", "version", "props", "Obj", "Meta", "getKey", "blueprint", "getMeta", "undefined", "Error", "getVersion", "toolDefinitions", "operations", "map", "op", "getName", "meta", "tool", "registryURI", "tryMake", "URI", "resolve", "gen", "results", "Registry", "runQuery", "Filter", "and", "type", "fail", "NotFoundError", "context", "upsert", "local", "Database", "query", "run", "length", "add", "clone", "deep", "BaseError", "extend", "Blueprint_v0_1_0", "_migration", "Migration", "define", "from", "to", "transform", "migrations", "Context", "Effect", "Redacted", "CredentialsService", "Tag", "getCredential", "query", "gen", "credentials", "promise", "getApiKey", "credential", "apiKey", "Error", "service", "make", "HttpClient", "HttpClientRequest", "Effect", "Layer", "BYOK_HEADER", "byokLayer", "providerHost", "effect", "HttpClient", "gen", "client", "credentials", "CredentialsService", "mapRequestEffect", "request", "matches", "tryPromise", "queryCredentials", "service", "pipe", "orElseSucceed", "apiKey", "find", "credential", "setHeader", "BYOK_HEADER", "make", "TypeId", "opts", "affinity", "requires", "provides", "resolve", "Context", "Effect", "Layer", "Database", "Filter", "Query", "Service", "Tag", "resolve", "serviceFunctionEffect", "service", "layer", "effect", "gen", "database", "Database", "handlerSet", "OperationHandlerProvider", "key", "query", "Query", "select", "Filter", "and", "type", "PersistentOperation", "first", "pipe", "flatten", "map", "deserialize", "catchTag", "getHandlerByKey", "option", "provideService", "make", "Context", "Effect", "Schema", "assertArgument", "DXN", "log", "flatten", "Context", "Effect", "Layer", "Schema", "DXN", "Annotation", "Obj", "Type", "log", "__dxlog_file", "eventType", "isEphemeral", "TraceService", "writer", "payload", "key", "schema", "type", "data", "Unknown", "edgeWorkerLoader", "RuntimeName", "make", "edgeWorkerForPlatforms", "parentPid", "optional", "processName", "events", "Message", "MessageData", "hue", "event", "message", "meta", "noopWriter", "writerLayerNoop", "write", "layerNoop", "console", "noopSink", "sink", "clock", "Date", "opts", "String", "outcome", "Literal", "__dxlog_file", "make", "create", "assertArgument", "ProcessTypeId", "opts", "ctx", "onInput", "Effect", "onAlarm", "void", "onChildEvent", "partial", "key", "input", "output", "op", "services", "semaphore", "gen", "started", "OperationStartedKey", "set", "log", "name", "Trace", "write", "meta", "icon", "submitOutput", "succeed", "outcome", "catchAllDefect", "errorMessage", "defect", "Error", "message", "error", "State", "isEphemeral", "Schema", "pidSet", "roots", "parent", "node", "siblings", "push", "childrenByParent", "b", "String", "a", "localeCompare", "sort", "formatLabel", "idShort", "params", "inputCount", "outputCount", "parts", "lines", "isRoot", "branch", "isLast", "children", "get", "pid", "index", "walk", "nextPrefix", "length", "join", "make", "Schema", "DXN", "Annotation", "JsonSchema", "Obj", "Ref", "Type", "Format", "Text", "Routine", "Struct", "name", "optional", "String", "description", "input", "JsonSchema", "pipe", "Annotation", "FormInputAnnotation", "set", "annotations", "output", "instructions", "Ref", "Text", "Format", "FormatAnnotation", "TypeFormat", "Markdown", "title", "blueprints", "Array", "Blueprint", "context", "Any", "LabelAnnotation", "IconAnnotation", "icon", "hue", "Type", "makeObject", "DXN", "make", "Obj", "toJsonSchema", "Void", "content", "make", "Schema", "DXN", "Annotation", "Obj", "Ref", "Type", "FormInputAnnotation", "Text", "Script", "Struct", "name", "String", "pipe", "optional", "description", "changed", "Boolean", "set", "source", "LabelAnnotation", "IconAnnotation", "icon", "hue", "makeObject", "props", "content", "empty", "make", "resolve", "succeed", "Context", "Effect", "Either", "Layer", "Option", "ServiceResolverTypeId", "ServiceResolver", "GenericTag", "resolve", "serviceFunctionEffect", "_", "resolveAll", "tags", "context", "gen", "services", "forEach", "tag", "pipe", "map", "service", "make", "mergeAll", "succeed", "getService", "tag1", "key", "fail", "ServiceNotAvailableError", "String", "resolveFn", "fromContext", "ctx", "getOption", "isNone", "value", "fromRequirements", "contextWith", "parentCtx", "available", "Set", "result", "empty", "has", "layerRequirements", "effect", "provide", "scopedContext", "compose", "resolvers", "resolver", "single", "either", "isRight", "right", "make", "Schema", "SchemaAST", "DXN", "Annotation", "Feed", "Obj", "QueryAST", "Ref", "Type", "HiddenAnnotation", "OptionsAnnotationId", "Kinds", "kindLiteralAnnotations", "title", "EmailSpec", "Struct", "kind", "Literal", "annotations", "specEmail", "FeedSpec", "feed", "optional", "specFeed", "SubscriptionSpec", "query", "raw", "String", "ast", "Query", "options", "deep", "Boolean", "delay", "Number", "specSubscription", "undefined", "TimerSpec", "cron", "ExamplesAnnotationId", "specTimer", "WebhookSpec", "method", "port", "specWebhook", "opts", "Spec", "Union", "TriggerSchema", "function", "Unknown", "inputNodeId", "enabled", "spec", "concurrency", "default", "description", "input", "Record", "key", "value", "Any", "pipe", "IconAnnotation", "set", "icon", "hue", "makeObject", "Trigger", "props", "Schema", "Feed", "Obj", "Ref", "EmailEvent", "Struct", "from", "String", "to", "subject", "created", "body", "FeedEvent", "feed", "item", "Any", "cursor", "SubscriptionEvent", "type", "Unknown", "changedObjectId", "optional", "TimerEvent", "tick", "Number", "WebhookEvent", "url", "method", "Literal", "headers", "Record", "key", "value", "bodyText", "TriggerEvent", "Union"]
3
+ "sources": ["../../../src/Skill.ts", "../../../src/McpServer.ts", "../../../src/Template.ts", "../../../src/Trigger.ts", "../../../src/Runnable.ts", "../../../src/Credential.ts", "../../../src/Header.ts", "../../../src/Instructions.ts", "../../../src/LayerSpec.ts", "../../../src/OperationRegistry.ts", "../../../src/Process.ts", "../../../src/Trace.ts", "../../../src/Script.ts", "../../../src/ServiceResolver.ts", "../../../src/TriggerEvent.ts"],
4
+ "sourcesContent": ["//\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\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 2023 DXOS.org\n//\n\n// @import-as-namespace\n\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';\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', '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 * 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, SubscriptionSpec, TimerSpec, WebhookSpec).annotations({\n title: 'Trigger',\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 */\n runnable: Schema.optional(Ref.Ref(Runnable.Runnable).annotations({ title: 'Runnable' })),\n spec: Schema.optional(Spec),\n enabled: Schema.optional(Schema.Boolean),\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// 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 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Redacted from 'effect/Redacted';\n\nexport type CredentialQuery = {\n service?: 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\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// 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 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/**\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 }).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};\n\n/** Creates an Instructions object with an owned Markdown `text` body (parented so it cascades and deep-clones). */\nexport const make = ({ name, description, input, output, text, skills = [], objects }: 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 });\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\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 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 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';\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 * 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\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 * Error of the process.\n * Only for process in FAILED state.\n */\n readonly error: string | 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})`);\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 Layer from 'effect/Layer';\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport { log } from '@dxos/log';\n\nimport * as Trigger from './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 * 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 * 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\n isEphemeral: Schema.Boolean,\n events: Schema.Array(Event),\n});\nexport type MessageData = Schema.Schema.Type<typeof MessageData>;\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 * 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 * 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.String,\n }),\n isEphemeral: true,\n});\n\n/**\n * Emit the current human-readable execution status to the trace.\n */\nexport const emitStatus: (message: string) => Effect.Effect<void, never, TraceService> = (message) =>\n write(StatusUpdate, { message });\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 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", "//\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\nexport const SubscriptionEvent = Schema.Struct({\n /**\n * Type of the mutation.\n */\n // TODO(dmaretskyi): Specify enum.\n type: Schema.String,\n\n /**\n * Reference to the object that was changed or created.\n */\n subject: Ref.Ref(Obj.Unknown),\n\n /**\n * @deprecated\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 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(EmailEvent, FeedEvent, SubscriptionEvent, TimerEvent, WebhookEvent);\nexport type TriggerEvent = Schema.Schema.Type<typeof TriggerEvent>;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;cAAAA;EAAA;;;;;AAMA,YAAYC,aAAY;AACxB,YAAYC,aAAY;AAExB,SAASC,cAAc;AACvB,SAASC,cAAAA,aAAYC,YAAAA,WAAUC,OAAAA,MAAKC,UAAAA,SAAQC,OAAAA,MAAKC,OAAAA,MAAKC,YAAAA,WAAUC,QAAAA,OAAMC,WAAW;AACjF,SAASC,iBAAiB;;;ACX1B;;;;AAMA,YAAYC,YAAY;AASjB,IAAMC,YAAmBC,cAAO;EACrCC,MAAaC,cAAOC,KAAYC,eAAQ,EAAEC,YAAY;IACpDC,aAAa;EACf,CAAA;EAEAC,KAAYL,cAAOG,YAAY;IAC7BC,aAAa;EACf,CAAA;;;;;;EAOAE,UAAiBC,aAAaC,eAAQ,MAAA,GAAgBA,eAAQ,KAAA,CAAA,EAAQL,YAAY;IAChFC,aAAa;EACf,CAAA;;;;;;EAOAK,QAAeP,gBAAgBF,aAAM,EAAEG,YAAY;IACjDC,aAAa;EACf,CAAA;AACF,CAAA;;;ACzCA;;;;;;;;;AAMA,YAAYM,YAAY;AACxB,YAAYC,aAAY;AAExB,SAASC,UAAUC,KAAKC,QAAQC,KAAKC,gBAAgB;AAErD,SAASC,gBAAgBC,iBAAiB;AAC1C,SAASC,WAAW;AACpB,SAASC,YAAY;AACrB,OAAOC,gBAAgB;AAKvB,IAAA,eAAA;;AAsBQC,IAAAA,QAAAA,eAAAA;EACNC,MAASC;EACT,MAAA;;;;;;EASF,WAAA,iBAAA,cAAA;;AAI2CC,IAAAA,WAAa,eAAA;EAAkC,QAAA,IAAA,IAAA,KAAA,IAAA,EA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Ba,MAAaC;EACbC,QAAeT;AACjB,CAAA;AAGO,IAAMU,oBAA2BZ,eAAO;;;;;EAK7Ca,MAAaX;;;;EAKbE,SAASN,KAAIA,IAAID,KAAIiB,OAAO;;;;EAK5BC,iBAAwBC,iBAAgBd,cAAM;AAChD,CAAA;AAGO,IAAMe,aAAoBjB,eAAO;EAAEkB,MAAaC;AAAO,CAAA;AAGvD,IAAMC,eAAsBpB,eAAO;EACxCqB,KAAYnB;EACZoB,QAAeC,gBAAQ,OAAO,MAAA;EAC9BC,SAAgBC,eAAO;IAAEC,KAAYxB;IAAQyB,OAAczB;EAAO,CAAA;EAClE0B,UAAiB1B;AACnB,CAAA;AAGO,IAAM2B,eAAsBC,cAAM/B,YAAYQ,WAAWK,mBAAmBK,YAAYG,YAAAA;",
6
+ "names": ["make", "Effect", "Schema", "ToolId", "Annotation", "Database", "DXN", "Filter", "Obj", "Ref", "Registry", "Type", "URI", "BaseError", "Schema", "McpServer", "Struct", "name", "String", "pipe", "optional", "annotations", "description", "url", "protocol", "Union", "Literal", "apiKey", "Effect", "Schema", "Database", "DXN", "Filter", "Ref", "Registry", "assertArgument", "invariant", "log", "Text", "Handlebars", "InputKind", "default", "Schema", "description", "inputs", "id", "content", "source", "section", "handlebars", "Handlebars", "create", "registerHelper", "template", "compileAST", "output", "variables", "trim", "processTemplate", "Effect", "kind", "input", "key", "isDXN", "operation", "results", "length", "FunctionNotFoundError", "result", "make", "Schema", "SchemaAST", "Annotation", "DXN", "Feed", "Obj", "QueryAST", "Ref", "Type", "HiddenAnnotation", "OptionsAnnotationId", "Runnable", "PersistentOperation", "Kinds", "kindLiteralAnnotations", "title", "EmailSpec", "Struct", "kind", "Literal", "annotations", "specEmail", "FeedSpec", "feed", "optional", "Ref", "Feed", "specFeed", "make", "SubscriptionSpec", "query", "raw", "String", "ast", "QueryAST", "Query", "options", "deep", "Boolean", "delay", "Number", "specSubscription", "undefined", "TimerSpec", "cron", "ExamplesAnnotationId", "specTimer", "WebhookSpec", "method", "OptionsAnnotationId", "port", "specWebhook", "opts", "Spec", "Union", "InputTemplate", "Record", "key", "value", "Any", "Trigger", "Type", "makeObject", "DXN", "runnable", "Runnable", "spec", "enabled", "concurrency", "pipe", "default", "description", "Annotation", "FormInputAnnotation", "set", "inputNodeId", "input", "IconAnnotation", "icon", "hue", "HiddenAnnotation", "props", "Obj", "Skill", "Type", "makeObject", "DXN", "make", "Struct", "name", "String", "annotations", "description", "optional", "instructions", "Template", "tools", "Array", "ToolId", "agentCanEnable", "Boolean", "mcpServers", "McpServer", "hooks", "suspend", "Hook", "pipe", "Annotation", "LabelAnnotation", "set", "IconAnnotation", "icon", "hue", "HookSpec", "Union", "TaggedStruct", "function", "Ref", "Obj", "Unknown", "title", "spec", "input", "InputTemplate", "FormInputAnnotation", "key", "version", "props", "Meta", "getKey", "skill", "getMeta", "undefined", "Error", "getVersion", "toolDefinitions", "operations", "map", "op", "getName", "meta", "tool", "registryURI", "tryMake", "URI", "resolve", "gen", "results", "Registry", "runQuery", "Filter", "and", "type", "fail", "NotFoundError", "context", "upsert", "local", "Database", "query", "run", "length", "add", "clone", "deep", "BaseError", "extend", "Context", "Effect", "Redacted", "CredentialsService", "Tag", "getCredential", "query", "gen", "credentials", "promise", "getApiKey", "credential", "apiKey", "Error", "service", "make", "HttpClient", "HttpClientRequest", "Effect", "Layer", "BYOK_HEADER", "byokLayer", "providerHost", "effect", "HttpClient", "gen", "client", "credentials", "CredentialsService", "mapRequestEffect", "request", "matches", "tryPromise", "queryCredentials", "service", "pipe", "orElseSucceed", "apiKey", "find", "credential", "setHeader", "BYOK_HEADER", "make", "Schema", "Annotation", "DXN", "Format", "JsonSchema", "Obj", "Ref", "Type", "Text", "Instructions", "Type", "makeObject", "DXN", "make", "Struct", "name", "optional", "String", "description", "input", "JsonSchema", "pipe", "Annotation", "FormInputAnnotation", "set", "annotations", "output", "text", "Ref", "Text", "Format", "FormatAnnotation", "TypeFormat", "Markdown", "title", "skills", "Array", "Skill", "objects", "Obj", "Unknown", "LabelAnnotation", "IconAnnotation", "icon", "hue", "HiddenAnnotation", "body", "content", "instructions", "toJsonSchema", "Void", "setParent", "make", "TypeId", "opts", "affinity", "requires", "provides", "resolve", "Context", "Effect", "Layer", "Database", "Filter", "Query", "Service", "Tag", "resolve", "serviceFunctionEffect", "service", "layer", "effect", "gen", "database", "Database", "handlerSet", "OperationHandlerProvider", "key", "query", "Query", "select", "Filter", "and", "type", "PersistentOperation", "first", "pipe", "flatten", "map", "deserialize", "catchTag", "getHandlerByKey", "option", "provideService", "make", "RpcGroup", "Context", "Effect", "Schema", "Annotation", "assertArgument", "DXN", "URI", "log", "flatten", "Context", "Effect", "Layer", "Schema", "Annotation", "DXN", "Obj", "Ref", "Type", "log", "__dxlog_file", "log", "eventType", "isEphemeral", "TraceService", "writer", "payload", "key", "schema", "type", "Schema", "data", "Unknown", "edgeWorkerLoader", "RuntimeName", "make", "edgeWorkerForPlatforms", "parentPid", "optional", "processName", "events", "Message", "Type", "hue", "DXN", "Annotation", "event", "message", "meta", "noopWriter", "writerLayerNoop", "write", "layerNoop", "console", "noopSink", "sink", "clock", "Date", "opts", "String", "outcome", "Literal", "__dxlog_file", "schema", "Schema", "Annotation", "URI", "Operation", "make", "create", "assertArgument", "ProcessTypeId", "opts", "rpcs", "Effect", "void", "onInput", "onAlarm", "onChildEvent", "partial", "rpcHandlers", "sanitizeRpcs", "needsRpcs", "defined", "undefined", "provided", "key", "input", "output", "op", "services", "ctx", "semaphore", "gen", "started", "OperationStartedCell", "set", "log", "name", "Trace", "write", "meta", "icon", "submitOutput", "succeed", "outcome", "catchAllDefect", "errorMessage", "defect", "Error", "message", "error", "State", "isEphemeral", "pidSet", "roots", "parent", "node", "siblings", "push", "childrenByParent", "b", "String", "a", "localeCompare", "sort", "formatLabel", "idShort", "params", "inputCount", "outputCount", "parts", "lines", "isRoot", "branch", "isLast", "children", "get", "pid", "index", "walk", "nextPrefix", "length", "join", "make", "Schema", "Annotation", "DXN", "Obj", "Ref", "Type", "FormInputAnnotation", "Text", "Script", "makeObject", "Struct", "name", "String", "pipe", "optional", "description", "changed", "Boolean", "set", "source", "LabelAnnotation", "IconAnnotation", "icon", "hue", "props", "content", "empty", "make", "resolve", "succeed", "Context", "Effect", "Either", "Layer", "Option", "ServiceResolverTypeId", "ServiceResolver", "GenericTag", "resolve", "serviceFunctionEffect", "_", "resolveAll", "tags", "context", "gen", "services", "forEach", "tag", "pipe", "map", "service", "make", "mergeAll", "succeed", "getService", "tag1", "key", "fail", "ServiceNotAvailableError", "String", "resolveFn", "fromContext", "ctx", "getOption", "isNone", "value", "fromRequirements", "contextWith", "parentCtx", "available", "Set", "result", "empty", "has", "layerRequirements", "effect", "provide", "scopedContext", "compose", "resolvers", "resolver", "single", "either", "isRight", "right", "Schema", "Feed", "Obj", "Ref", "EmailEvent", "Struct", "from", "String", "to", "subject", "created", "body", "FeedEvent", "feed", "item", "Any", "cursor", "SubscriptionEvent", "type", "Unknown", "changedObjectId", "optional", "TimerEvent", "tick", "Number", "WebhookEvent", "url", "method", "Literal", "headers", "Record", "key", "value", "bodyText", "TriggerEvent", "Union"]
7
7
  }