@bastani/atomic 0.9.44 → 0.9.45-alpha.1
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.
- package/CHANGELOG.md +17 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +11 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/durable/journal/internal.d.ts +6 -37
- package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +2 -0
- package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +5 -4
- package/dist/builtin/workflows/src/durable/journal/types.d.ts +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +40393 -40289
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +55675 -55570
- package/dist/builtin/workflows/src/index.js +126 -22
- package/dist/builtin/workflows/src/local-worker-entry.mjs +55675 -55570
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +1 -1
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/storage/provider.d.ts +6 -3
- package/dist/core/storage/provider.d.ts.map +1 -1
- package/dist/core/storage/provider.js +7 -5
- package/dist/core/storage/provider.js.map +1 -1
- package/dist/core/storage/run-journal.d.ts +34 -0
- package/dist/core/storage/run-journal.d.ts.map +1 -1
- package/dist/core/storage/run-journal.js.map +1 -1
- package/docs/settings.md +1 -1
- package/docs/storage.md +3 -1
- package/docs/workflows/api-reference.md +8 -1
- package/docs/workflows/operations.md +1 -1
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
- package/schemas/settings.schema.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-schema.d.ts","sourceRoot":"","sources":["../../src/core/settings-schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAu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,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;AACvE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAC/D,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC;AACtF,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC;AAC1E,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC;IACrG,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
|
@@ -253,7 +253,7 @@ const WorkflowsSettingsSchema = Type.Union([
|
|
|
253
253
|
startupTimeoutMs: Type.Optional(Type.Integer({
|
|
254
254
|
minimum: 1,
|
|
255
255
|
maximum: 2_147_483_647,
|
|
256
|
-
description: "Milliseconds each worker process may take to become ready. Default: 30000.",
|
|
256
|
+
description: "Milliseconds each worker process may take to become ready. Default: 30000, scaled up when workers plus load exceed CPU cores (at most 600000).",
|
|
257
257
|
})),
|
|
258
258
|
leaseMs: Type.Optional(Type.Integer({
|
|
259
259
|
minimum: 2000,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-schema.js","sourceRoot":"","sources":["../../src/core/settings-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAoC,IAAI,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,SAAS,sBAAsB,CAAC,OAAO,GAA+C,EAAE;IACvF,OAAO,IAAI,CAAC,OAAO,C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AAC;QACd,WAAW,EACV,oIAAoI;KACrI,CAAC,CACF;IACD,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAC9B,cAAc,CAAC;QACd,WAAW,EACV,4IAA4I;KAC7I,CAAC,CACF;IACD,SAAS,EAAE,IAAI,CAAC,QAAQ,CACvB,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,EAAE;QAChE,WAAW,EAAE,0CAA0C;QACvD,UAAU,EAAE,IAAI;KAChB,CAAC,CACF;IACD,UAAU,EAAE,IAAI,CAAC,QAAQ,CACxB,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CACxF;CACD,EACD,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAC9B,CAAC","sourcesContent":["import { ModelThinkingLevelSchema } from \"@bastani/pi-ai/providers/model-schema\";\nimport { type Static, type TSchemaOptions, Type } from \"typebox\";\nimport { SETTINGS_DEFAULTS } from \"./settings-defaults.ts\";\n\nfunction nonNegativeSafeInteger(options: { default?: number; description?: string } = {}) {\n\treturn Type.Integer({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER, ...options });\n}\n\nfunction caseInsensitive(word: string): string {\n\treturn [...word].map((letter) => `[${letter.toLowerCase()}${letter.toUpperCase()}]`).join(\"\");\n}\n\n/** Mirrors `parseHttpIdleTimeoutMs`: milliseconds, `disabled`, or a duration such as `30s`, `5m`, `1h`. */\nconst TIMEOUT_STRING_PATTERN = `^(?:${caseInsensitive(\"disabled\")}|[0-9]+(?:${caseInsensitive(\"ms\")}|[smhSMH])?)$`;\n\nfunction timeoutSetting(options?: TSchemaOptions) {\n\treturn Type.Union([Type.Number({ minimum: 0 }), Type.String({ pattern: TIMEOUT_STRING_PATTERN })], options);\n}\n\nconst CompactionModelOverrideSchema = Type.Object({\n\treserveTokens: Type.Optional(nonNegativeSafeInteger()),\n\tpreserve_recent: Type.Optional(nonNegativeSafeInteger()),\n});\n\nconst CompactionSettingsSchema = Type.Object({\n\tenabled: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.compaction.enabled })),\n\treserveTokens: Type.Optional(\n\t\tnonNegativeSafeInteger({\n\t\t\tdescription: \"Free context tokens below which automatic compaction starts.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.compaction.reserveTokens,\n\t\t}),\n\t),\n\tcompression_ratio: Type.Optional(\n\t\tType.Number({\n\t\t\texclusiveMinimum: 0,\n\t\t\texclusiveMaximum: 1,\n\t\t\tdescription: \"Fraction of compactable transcript lines to keep.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.compaction.compression_ratio,\n\t\t}),\n\t),\n\tpreserve_recent: Type.Optional(\n\t\tnonNegativeSafeInteger({\n\t\t\tdescription: \"Exact number of newest context-visible messages kept outside the compactable region.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.compaction.preserve_recent,\n\t\t}),\n\t),\n\tquery: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Relevance focus for selecting older lines to retain. Defaults to the last user message when omitted.\",\n\t\t}),\n\t),\n\tmodelOverrides: Type.Optional(\n\t\tType.Record(Type.String(), CompactionModelOverrideSchema, {\n\t\t\tdescription: 'Per-model overrides keyed by exact \"provider/modelId\" strings.',\n\t\t}),\n\t),\n});\n\nconst BranchSummarySettingsSchema = Type.Object({\n\treserveTokens: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Tokens reserved when selecting branch history; the provider sizes summary output.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.branchSummary.reserveTokens,\n\t\t}),\n\t),\n\tskipPrompt: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: 'When true, skips the \"Summarize branch?\" prompt and defaults to no summary.',\n\t\t\tdefault: SETTINGS_DEFAULTS.branchSummary.skipPrompt,\n\t\t}),\n\t),\n});\n\nconst SessionSummarySettingsSchema = Type.Object({\n\tenabled: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Generate a one-line resume-picker summary once the agent goes idle.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.sessionSummary.enabled,\n\t\t}),\n\t),\n});\n\nconst ProviderRetrySettingsSchema = Type.Object({\n\ttimeoutMs: Type.Optional(Type.Number({ description: \"SDK or provider request timeout in milliseconds.\" })),\n\tmaxRetries: Type.Optional(Type.Number({ description: \"SDK or provider retry attempts.\" })),\n\tmaxRetryDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Maximum server-requested delay before failing.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.retry.provider.maxRetryDelayMs,\n\t\t}),\n\t),\n});\n\nconst RetrySettingsSchema = Type.Object({\n\tenabled: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.retry.enabled })),\n\tmaxRetries: Type.Optional(Type.Number({ default: SETTINGS_DEFAULTS.retry.maxRetries })),\n\tbaseDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Exponential backoff base delay in milliseconds: 2s, 4s, 8s.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.retry.baseDelayMs,\n\t\t}),\n\t),\n\tmaxAgentDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Maximum agent-level backoff delay in milliseconds. 0 retries immediately.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.retry.maxAgentDelayMs,\n\t\t}),\n\t),\n\tprovider: Type.Optional(ProviderRetrySettingsSchema),\n\tmaxDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Legacy retry delay setting. Use provider.maxRetryDelayMs instead.\",\n\t\t\tdeprecated: true,\n\t\t}),\n\t),\n});\n\nconst TerminalSettingsSchema = Type.Object({\n\tshowImages: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Show images when the terminal supports them.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.showImages,\n\t\t}),\n\t),\n\timageWidthCells: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Preferred inline image width in terminal cells.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.imageWidthCells,\n\t\t}),\n\t),\n\tclearOnShrink: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Clear empty rows when content shrinks.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.clearOnShrink,\n\t\t}),\n\t),\n\tshowTerminalProgress: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Show OSC 9;4 terminal progress indicators.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.showTerminalProgress,\n\t\t}),\n\t),\n\thyperlinks: Type.Optional(\n\t\tType.Union([Type.Boolean(), Type.Literal(\"auto\")], {\n\t\t\tdescription: 'Hyperlink capability override. \"auto\" and invalid values keep terminal detection.',\n\t\t}),\n\t),\n\timages: Type.Optional(\n\t\tType.Union([Type.Literal(\"kitty\"), Type.Literal(\"iterm2\"), Type.Literal(\"auto\"), Type.Literal(false)], {\n\t\t\tdescription: 'Inline-image protocol override. false disables images; \"auto\" keeps terminal detection.',\n\t\t}),\n\t),\n\ttrueColor: Type.Optional(\n\t\tType.Union([Type.Boolean(), Type.Literal(\"auto\")], {\n\t\t\tdescription: 'Truecolor capability override. \"auto\" and invalid values keep terminal detection.',\n\t\t}),\n\t),\n});\n\nconst ImageSettingsSchema = Type.Object({\n\tautoResize: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Resize images to 2000x2000 maximum for better model compatibility.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.images.autoResize,\n\t\t}),\n\t),\n\tblockImages: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"When true, prevents all images from being sent to LLM providers.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.images.blockImages,\n\t\t}),\n\t),\n});\n\nconst SearchSettingsSchema = Type.Object({\n\tcontextBefore: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Number of context lines before each search match.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.search.contextBefore,\n\t\t}),\n\t),\n\tcontextAfter: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Number of context lines after each search match.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.search.contextAfter,\n\t\t}),\n\t),\n});\n\nconst BashInterceptorSettingsSchema = Type.Object({\n\tenabled: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription:\n\t\t\t\t\"When true, block shell commands that have dedicated tools and offer remaining bash tool calls to user_bash extension handlers before local execution.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.bashInterceptor.enabled,\n\t\t}),\n\t),\n});\n\nconst HerdrSettingsSchema = Type.Object({\n\tenabled: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Enable the built-in reporter in an eligible Herdr pane.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.herdr.enabled,\n\t\t}),\n\t),\n});\n\nconst ModelRoutingSettingsSchema = Type.Object(\n\t{\n\t\tallowedProviders: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"When nonempty, only models from these provider IDs are routing candidates.\",\n\t\t\t}),\n\t\t),\n\t\texcludedProviders: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"Provider IDs that are never routing candidates. Applied after allowedProviders.\",\n\t\t\t}),\n\t\t),\n\t\tallowedModels: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"When nonempty, only models matching these full-ID or glob patterns, as in enabledModels, are routing candidates.\",\n\t\t\t}),\n\t\t),\n\t\texcludedModels: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Models matching these full-ID or glob patterns are never routing candidates. Applied after allowedModels.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t'Provider and model filters for the candidates model \"auto\" may route to. Does not affect routerModel.',\n\t},\n);\n\nfunction thinkingBudgetsSettings(options?: TSchemaOptions) {\n\treturn Type.Object(\n\t\t{\n\t\t\tminimal: Type.Optional(Type.Number()),\n\t\t\tlow: Type.Optional(Type.Number()),\n\t\t\tmedium: Type.Optional(Type.Number()),\n\t\t\thigh: Type.Optional(Type.Number()),\n\t\t},\n\t\toptions,\n\t);\n}\n\nconst ThinkingBudgetsSettingsSchema = thinkingBudgetsSettings();\n\nconst MarkdownSettingsSchema = Type.Object({\n\tcodeBlockIndent: Type.Optional(Type.String({ default: SETTINGS_DEFAULTS.markdown.codeBlockIndent })),\n\tmermaid: Type.Optional(\n\t\tType.Union([Type.Literal(\"off\"), Type.Literal(\"final\"), Type.Literal(\"streaming\")], {\n\t\t\tdefault: SETTINGS_DEFAULTS.markdown.mermaid,\n\t\t}),\n\t),\n\tlatex: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Render LaTeX expressions as terminal-friendly Unicode math.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.markdown.latex,\n\t\t}),\n\t),\n});\n\nconst WarningSettingsSchema = Type.Object({\n\tanthropicExtraUsage: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.warnings.anthropicExtraUsage })),\n});\n\nfunction codemodeMode(options?: TSchemaOptions) {\n\treturn Type.Union([Type.Literal(\"on\"), Type.Literal(\"only\")], options);\n}\n\nconst CodemodeModeSchema = codemodeMode();\n\nconst CodemodeSettingsSchema = Type.Object({\n\tmode: Type.Optional(\n\t\tcodemodeMode({\n\t\t\tdescription:\n\t\t\t\t'How codemode presents tools. \"on\" keeps direct tool declarations visible with script-call information; \"only\" hides ordinary direct callable declarations so the model uses scripts. Model-only tools remain directly available.',\n\t\t\tdefault: SETTINGS_DEFAULTS.codemode.mode,\n\t\t}),\n\t),\n\tinlineBudget: Type.Optional(\n\t\tType.Number({\n\t\t\tminimum: 0,\n\t\t\tdescription: \"Estimated tokens available for inline codemode tool declarations.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.codemode.inlineBudget,\n\t\t}),\n\t),\n});\n\nconst PackageSourceSchema = Type.Union(\n\t[\n\t\tType.String({ description: \"Load all resources from the package.\" }),\n\t\tType.Object({\n\t\t\tsource: Type.String(),\n\t\t\tautoload: Type.Optional(\n\t\t\t\tType.Boolean({ description: \"When false, start empty and only apply explicit resource patterns.\" }),\n\t\t\t),\n\t\t\textensions: Type.Optional(Type.Array(Type.String())),\n\t\t\tskills: Type.Optional(Type.Array(Type.String())),\n\t\t\tprompts: Type.Optional(Type.Array(Type.String())),\n\t\t\tthemes: Type.Optional(Type.Array(Type.String())),\n\t\t\tworkflows: Type.Optional(Type.Array(Type.String())),\n\t\t\tmcpServers: Type.Optional(Type.Array(Type.String())),\n\t\t}),\n\t],\n\t{\n\t\tdescription:\n\t\t\t\"Package source for npm or git packages. Use the string form to load all resources or the object form to filter resources.\",\n\t},\n);\n\nconst StringArraySchema = Type.Array(Type.String());\n\nconst SkillsInputSchema = Type.Union(\n\t[\n\t\tStringArraySchema,\n\t\tType.Object(\n\t\t\t{\n\t\t\t\tenableSkillCommands: Type.Optional(Type.Boolean()),\n\t\t\t\tcustomDirectories: Type.Optional(StringArraySchema),\n\t\t\t},\n\t\t\t{ deprecated: true },\n\t\t),\n\t],\n\t{ description: \"Local skill file paths or directories.\" },\n);\n\nexport const StorageSelectionSchema = Type.Union([\n\tType.Object(\n\t\t{\n\t\t\tpath: Type.Optional(Type.String({ description: \"Database path relative to the Atomic home directory.\" })),\n\t\t\tmemory: Type.Optional(Type.Boolean({ description: \"Explicitly select ephemeral storage.\" })),\n\t\t\tprefix: Type.Optional(Type.String()),\n\t\t},\n\t\t{\n\t\t\tadditionalProperties: false,\n\t\t\tnot: { required: [\"path\", \"memory\"], properties: { path: { minLength: 1 }, memory: { const: true } } },\n\t\t},\n\t),\n\tType.Object(\n\t\t{\n\t\t\tadapter: Type.String({ minLength: 1, description: \"User-installed storage adapter module specifier.\" }),\n\t\t\toptions: Type.Optional(\n\t\t\t\tType.Record(Type.String(), Type.Union([Type.String(), Type.Number(), Type.Boolean(), Type.Null()])),\n\t\t\t),\n\t\t\tsecrets: Type.Optional(\n\t\t\t\tType.Record(\n\t\t\t\t\tType.String(),\n\t\t\t\t\tType.Union([\n\t\t\t\t\t\tType.Object({ env: Type.String() }, { additionalProperties: false }),\n\t\t\t\t\t\tType.Object({ file: Type.String() }, { additionalProperties: false }),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t),\n\t\t\tprefix: Type.Optional(Type.String()),\n\t\t},\n\t\t{ additionalProperties: false },\n\t),\n]);\n\nexport const SessionStorageSelectionSchema = Type.Union([\n\tStorageSelectionSchema,\n\tType.Object({ dir: Type.String() }, { additionalProperties: false }),\n]);\n\nconst ResourceLimitsSchema = Type.Object(\n\t{\n\t\tsession: Type.Optional(Type.Integer({ minimum: 1 })),\n\t\tprocess: Type.Optional(Type.Integer({ minimum: 1 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst WorkflowsSettingsSchema = Type.Union(\n\t[\n\t\tStringArraySchema,\n\t\tType.Object({\n\t\t\tpaths: Type.Optional(Type.Array(Type.String(), { description: \"Workflow resource paths.\" })),\n\t\t\tjournal: Type.Optional(StorageSelectionSchema),\n\t\t\tlocalWorkers: Type.Optional(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tcount: Type.Integer({ minimum: 1, description: \"Number of local worker processes.\" }),\n\t\t\t\t\t\tdefinitions: Type.Array(\n\t\t\t\t\t\t\tType.Object({ path: Type.String(), exportName: Type.String() }, { additionalProperties: false }),\n\t\t\t\t\t\t\t{ description: \"Importable child workflow definitions workers may run.\" },\n\t\t\t\t\t\t),\n\t\t\t\t\t\tstartupTimeoutMs: Type.Optional(\n\t\t\t\t\t\t\tType.Integer({\n\t\t\t\t\t\t\t\tminimum: 1,\n\t\t\t\t\t\t\t\tmaximum: 2_147_483_647,\n\t\t\t\t\t\t\t\tdescription: \"Milliseconds each worker process may take to become ready. Default: 30000.\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tleaseMs: Type.Optional(\n\t\t\t\t\t\t\tType.Integer({\n\t\t\t\t\t\t\t\tminimum: 2000,\n\t\t\t\t\t\t\t\tmaximum: 2_147_483_647,\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\"Milliseconds a live worker that has stopped responding keeps its child before the child is replayed elsewhere. Default: 30000.\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t),\n\t\t\tadmission: Type.Optional(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tlimits: Type.Optional(ResourceLimitsSchema),\n\t\t\t\t\t\tuserLimits: Type.Optional(ResourceLimitsSchema),\n\t\t\t\t\t\tuserDatabase: Type.Optional(Type.String()),\n\t\t\t\t\t\thost: Type.Optional(\n\t\t\t\t\t\t\tType.Object(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmaxLoadPerCpu: Type.Optional(Type.Number({ minimum: 0 })),\n\t\t\t\t\t\t\t\t\tminFreeMemoryBytes: Type.Optional(Type.Number({ minimum: 0 })),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t),\n\t\t}),\n\t],\n\t{\n\t\tdescription:\n\t\t\t'Local workflow paths, or an object with \"paths\", \"journal\" storage, \"localWorkers\" and \"admission\" settings.',\n\t},\n);\n\nexport const SettingsSchema = Type.Object(\n\t{\n\t\t$schema: Type.Optional(Type.String({ description: \"JSON Schema reference.\" })),\n\t\tstorage: Type.Optional(StorageSelectionSchema),\n\t\tsessions: Type.Optional(Type.Object({ storage: Type.Optional(SessionStorageSelectionSchema) })),\n\t\tlastChangelogVersion: Type.Optional(Type.String()),\n\t\tfirstRunOnboardingStartedVersion: Type.Optional(\n\t\t\tType.String({ description: \"Managed onboarding state; leave unchanged.\" }),\n\t\t),\n\t\tonboardedVersion: Type.Optional(\n\t\t\tType.String({ description: \"Managed onboarding completion state; leave unchanged.\" }),\n\t\t),\n\t\tdefaultProvider: Type.Optional(Type.String()),\n\t\tdefaultModel: Type.Optional(Type.String()),\n\t\trouterModel: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t'Inference model for workflow-stage and subagent model: \"auto\" selection only. An exact provider/model selects a registered chat or classifier model; \"auto\" and an empty string use the current chat model.',\n\t\t\t\tdefault: SETTINGS_DEFAULTS.routerModel,\n\t\t\t}),\n\t\t),\n\t\tcompactionModel: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t'Compaction model: \"auto\" or an empty string uses the session model, and an exact provider/model selects a registered chat model, classifier, or compactor.',\n\t\t\t}),\n\t\t),\n\t\tmodelRouting: Type.Optional(ModelRoutingSettingsSchema),\n\t\tdefaultThinkingLevel: Type.Optional(ModelThinkingLevelSchema),\n\t\tmodelThinkingLevels: Type.Optional(\n\t\t\tType.Record(Type.String(), ModelThinkingLevelSchema, {\n\t\t\t\tdescription: 'Per-model default thinking level overrides keyed by \"provider/modelId\".',\n\t\t\t}),\n\t\t),\n\t\tfallbackModels: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t'Ordered main-chat fallback models, written as \"provider/model\" with an optional thinking-level suffix such as \":high\".',\n\t\t\t}),\n\t\t),\n\t\ttransport: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[Type.Literal(\"auto\"), Type.Literal(\"sse\"), Type.Literal(\"websocket\"), Type.Literal(\"websocket-cached\")],\n\t\t\t\t{ default: SETTINGS_DEFAULTS.transport },\n\t\t\t),\n\t\t),\n\t\tsteeringMode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"all\"), Type.Literal(\"one-at-a-time\")], {\n\t\t\t\tdefault: SETTINGS_DEFAULTS.steeringMode,\n\t\t\t}),\n\t\t),\n\t\tfollowUpMode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"all\"), Type.Literal(\"one-at-a-time\")], {\n\t\t\t\tdefault: SETTINGS_DEFAULTS.followUpMode,\n\t\t\t}),\n\t\t),\n\t\ttheme: Type.Optional(Type.String()),\n\t\tenableAnalytics: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Opt in to analytics data sharing. Storage only; Atomic does not transmit analytics.\",\n\t\t\t}),\n\t\t),\n\t\ttrackingId: Type.Optional(\n\t\t\tType.String({ description: \"Analytics tracking identifier, generated when analytics is enabled.\" }),\n\t\t),\n\t\tdeviceId: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Stable installation UUID, generated when authentication first needs it. Global only.\",\n\t\t\t}),\n\t\t),\n\t\tshowCacheMissNotices: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Show cache cost and provider recovery notices.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.showCacheMissNotices,\n\t\t\t}),\n\t\t),\n\t\tcompaction: Type.Optional(CompactionSettingsSchema),\n\t\tbranchSummary: Type.Optional(BranchSummarySettingsSchema),\n\t\tsessionSummary: Type.Optional(SessionSummarySettingsSchema),\n\t\tretry: Type.Optional(RetrySettingsSchema),\n\t\thideThinkingBlock: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.hideThinkingBlock })),\n\t\texternalEditor: Type.Optional(\n\t\t\tType.String({ description: \"Command for Ctrl+G external editor; takes precedence over VISUAL and EDITOR.\" }),\n\t\t),\n\t\tshellPath: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Custom shell path, for example for Cygwin on Windows, with support for leading ~ expansion.\",\n\t\t\t}),\n\t\t),\n\t\tquietStartup: Type.Optional(\n\t\t\tType.Union([Type.Boolean(), Type.Literal(\"header\")], {\n\t\t\t\tdescription: 'When true, hide all startup output. When \"header\", keep only the startup header.',\n\t\t\t\tdefault: SETTINGS_DEFAULTS.quietStartup,\n\t\t\t}),\n\t\t),\n\t\tdefaultProjectTrust: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"ask\"), Type.Literal(\"always\"), Type.Literal(\"never\")], {\n\t\t\t\tdescription: \"Global setting only.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.defaultProjectTrust,\n\t\t\t}),\n\t\t),\n\t\tshellCommandPrefix: Type.Optional(\n\t\t\tType.String({ description: \"Prefix prepended to every bash command, for example to enable shell aliases.\" }),\n\t\t),\n\t\tbashInterceptor: Type.Optional(BashInterceptorSettingsSchema),\n\t\tsearch: Type.Optional(SearchSettingsSchema),\n\t\tnpmCommand: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t'Command used for npm package lookup and installation, in argv form such as [\"mise\", \"exec\", \"node@20\", \"--\", \"npm\"].',\n\t\t\t}),\n\t\t),\n\t\tcollapseChangelog: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Show the condensed changelog after update; use /changelog for the full changelog.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.collapseChangelog,\n\t\t\t}),\n\t\t),\n\t\tenableInstallTelemetry: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Send an anonymous version-adoption ping on eligible interactive launches.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.enableInstallTelemetry,\n\t\t\t}),\n\t\t),\n\t\tpackages: Type.Optional(\n\t\t\tType.Array(PackageSourceSchema, {\n\t\t\t\tdescription: \"npm or git package sources, as strings or objects with resource filtering.\",\n\t\t\t}),\n\t\t),\n\t\textensions: Type.Optional(\n\t\t\tType.Array(Type.String(), { description: \"Local extension file paths or directories.\" }),\n\t\t),\n\t\tskills: Type.Optional(SkillsInputSchema),\n\t\tprompts: Type.Optional(\n\t\t\tType.Array(Type.String(), { description: \"Local prompt template file paths or directories.\" }),\n\t\t),\n\t\tthemes: Type.Optional(Type.Array(Type.String(), { description: \"Local theme file paths or directories.\" })),\n\t\tworkflows: Type.Optional(WorkflowsSettingsSchema),\n\t\tenableSkillCommands: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Register skills as /skill:name commands.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.enableSkillCommands,\n\t\t\t}),\n\t\t),\n\t\tterminal: Type.Optional(TerminalSettingsSchema),\n\t\therdr: Type.Optional(HerdrSettingsSchema),\n\t\timages: Type.Optional(ImageSettingsSchema),\n\t\tenabledModels: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"Model patterns for cycling, in the same format as the --models CLI flag.\",\n\t\t\t}),\n\t\t),\n\t\tdefaultTools: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Initial tool selection. Plain names replace the inherited selection; +name and -name entries add or remove tools.\",\n\t\t\t}),\n\t\t),\n\t\tdoubleEscapeAction: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"fork\"), Type.Literal(\"tree\"), Type.Literal(\"none\")], {\n\t\t\t\tdescription: \"Action for double-escape with an empty editor.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.doubleEscapeAction,\n\t\t\t}),\n\t\t),\n\t\ttreeFilterMode: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[\n\t\t\t\t\tType.Literal(\"default\"),\n\t\t\t\t\tType.Literal(\"no-tools\"),\n\t\t\t\t\tType.Literal(\"user-only\"),\n\t\t\t\t\tType.Literal(\"labeled-only\"),\n\t\t\t\t\tType.Literal(\"all\"),\n\t\t\t\t],\n\t\t\t\t{\n\t\t\t\t\tdescription: \"Default filter when opening /tree.\",\n\t\t\t\t\tdefault: SETTINGS_DEFAULTS.treeFilterMode,\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t\tthinkingBudgets: Type.Optional(\n\t\t\tthinkingBudgetsSettings({\n\t\t\t\tdescription: \"Custom token budgets for thinking levels.\",\n\t\t\t}),\n\t\t),\n\t\teditorPaddingX: Type.Optional(\n\t\t\tType.Number({\n\t\t\t\tdescription: \"Horizontal padding for the input editor (0-3).\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.editorPaddingX,\n\t\t\t}),\n\t\t),\n\t\toutputPad: Type.Optional(\n\t\t\tType.Union([Type.Literal(0), Type.Literal(1)], {\n\t\t\t\tdescription: \"Horizontal padding for transcript content.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.outputPad,\n\t\t\t}),\n\t\t),\n\t\tautocompleteMaxVisible: Type.Optional(\n\t\t\tType.Number({\n\t\t\t\tdescription: \"Maximum visible items in the autocomplete dropdown (3-20).\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.autocompleteMaxVisible,\n\t\t\t}),\n\t\t),\n\t\tshowHardwareCursor: Type.Optional(\n\t\t\tType.Boolean({ description: \"Show the terminal cursor while still positioning it for IME.\" }),\n\t\t),\n\t\tfullscreenScrollbar: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"auto\"), Type.Literal(\"always\"), Type.Literal(\"hidden\")], {\n\t\t\t\tdescription: \"Fullscreen transcript scrollbar visibility.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenScrollbar,\n\t\t\t}),\n\t\t),\n\t\tfullscreenExitOutput: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"transcript\"), Type.Literal(\"resume-hint\")], {\n\t\t\t\tdescription:\n\t\t\t\t\t\"What the terminal keeps when a fullscreen session exits: the final transcript with a resume hint, or only the resume hint.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenExitOutput,\n\t\t\t}),\n\t\t),\n\t\tfullscreenCopyOnSelect: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Copy fullscreen text selections automatically on mouse release.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenCopyOnSelect,\n\t\t\t}),\n\t\t),\n\t\tfullscreenWheelScrollLines: Type.Optional(\n\t\t\tType.Union([Type.Number(), Type.Literal(\"auto\")], {\n\t\t\t\tdescription: \"Lines scrolled per wheel event in fullscreen mode; numeric values are clamped from 1 to 100.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenWheelScrollLines,\n\t\t\t}),\n\t\t),\n\t\tcodemode: Type.Optional(CodemodeSettingsSchema),\n\t\tmarkdown: Type.Optional(MarkdownSettingsSchema),\n\t\twarnings: Type.Optional(WarningSettingsSchema),\n\t\thttpProxy: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Proxy URL applied as HTTP_PROXY and HTTPS_PROXY for Atomic-managed HTTP clients. Global only.\",\n\t\t\t}),\n\t\t),\n\t\thttpIdleTimeoutMs: Type.Optional(\n\t\t\ttimeoutSetting({\n\t\t\t\tdescription:\n\t\t\t\t\t'HTTP idle timeout as milliseconds, a duration such as \"30s\", \"5m\", or \"1h\", or \"disabled\"; 0 or \"disabled\" disables it.',\n\t\t\t\tdefault: SETTINGS_DEFAULTS.httpIdleTimeoutMs,\n\t\t\t}),\n\t\t),\n\t\tcacheWarming: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"off\"), Type.Literal(\"streaming\"), Type.Literal(\"idle\")], {\n\t\t\t\tdescription:\n\t\t\t\t\t'Cache-warming profile. \"idle\" also warms between agent runs. Global only because each refresh costs money.',\n\t\t\t\tdefault: SETTINGS_DEFAULTS.cacheWarming,\n\t\t\t}),\n\t\t),\n\t\twebsocketConnectTimeoutMs: Type.Optional(\n\t\t\ttimeoutSetting({\n\t\t\t\tdescription:\n\t\t\t\t\t'WebSocket connect or open handshake timeout as milliseconds, a duration such as \"30s\", or \"disabled\"; 0 or \"disabled\" disables it.',\n\t\t\t}),\n\t\t),\n\t\tstreamDeadlineMs: Type.Optional(\n\t\t\ttimeoutSetting({\n\t\t\t\tdescription:\n\t\t\t\t\t'Maximum idle gap between two provider stream events as milliseconds, a duration such as \"30s\", or \"disabled\"; 0 or \"disabled\" disables it.',\n\t\t\t}),\n\t\t),\n\t\tqueueMode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"all\"), Type.Literal(\"one-at-a-time\")], {\n\t\t\t\tdescription: \"Legacy setting migrated to steeringMode.\",\n\t\t\t\tdeprecated: true,\n\t\t\t}),\n\t\t),\n\t\twebsockets: Type.Optional(\n\t\t\tType.Boolean({ description: \"Legacy setting migrated to transport.\", deprecated: true }),\n\t\t),\n\t},\n\t{ additionalProperties: true },\n);\n\ntype SettingsInput = Static<typeof SettingsSchema>;\n\nexport interface CompactionModelOverride extends Static<typeof CompactionModelOverrideSchema> {}\nexport interface CompactionSettings extends Static<typeof CompactionSettingsSchema> {}\nexport interface BranchSummarySettings extends Static<typeof BranchSummarySettingsSchema> {}\nexport interface SessionSummarySettings extends Static<typeof SessionSummarySettingsSchema> {}\nexport interface ProviderRetrySettings extends Static<typeof ProviderRetrySettingsSchema> {}\nexport interface RetrySettings extends Omit<Static<typeof RetrySettingsSchema>, \"maxDelayMs\"> {}\nexport interface TerminalSettings extends Static<typeof TerminalSettingsSchema> {}\nexport interface ImageSettings extends Static<typeof ImageSettingsSchema> {}\nexport interface SearchSettings extends Static<typeof SearchSettingsSchema> {}\nexport interface BashInterceptorSettings extends Static<typeof BashInterceptorSettingsSchema> {}\nexport interface ModelRoutingSettings extends Static<typeof ModelRoutingSettingsSchema> {}\nexport interface ThinkingBudgetsSettings extends Static<typeof ThinkingBudgetsSettingsSchema> {}\nexport type MermaidRenderingMode = NonNullable<Static<typeof MarkdownSettingsSchema>[\"mermaid\"]>;\nexport interface MarkdownSettings extends Static<typeof MarkdownSettingsSchema> {}\nexport interface WarningSettings extends Static<typeof WarningSettingsSchema> {}\nexport type CodemodeMode = Static<typeof CodemodeModeSchema>;\nexport interface CodemodeSettings extends Static<typeof CodemodeSettingsSchema> {}\nexport type DefaultProjectTrust = NonNullable<SettingsInput[\"defaultProjectTrust\"]>;\nexport type QuietStartup = NonNullable<SettingsInput[\"quietStartup\"]>;\nexport type TransportSetting = NonNullable<SettingsInput[\"transport\"]>;\nexport type PackageSource = Static<typeof PackageSourceSchema>;\nexport type FullscreenExitOutput = NonNullable<SettingsInput[\"fullscreenExitOutput\"]>;\nexport type CacheWarmingMode = NonNullable<SettingsInput[\"cacheWarming\"]>;\nexport interface Settings extends Omit<SettingsInput, \"queueMode\" | \"retry\" | \"skills\" | \"websockets\"> {\n\tretry?: RetrySettings;\n\tskills?: string[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"settings-schema.js","sourceRoot":"","sources":["../../src/core/settings-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAoC,IAAI,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,SAAS,sBAAsB,CAAC,OAAO,GAA+C,EAAE;IACvF,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,gBAAgB,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACpC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/F,CAAC;AAED,2GAA2G;AAC3G,MAAM,sBAAsB,GAAG,OAAO,eAAe,CAAC,UAAU,CAAC,aAAa,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC;AAEnH,SAAS,cAAc,CAAC,OAAwB;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC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ingLevelSchema } from \"@bastani/pi-ai/providers/model-schema\";\nimport { type Static, type TSchemaOptions, Type } from \"typebox\";\nimport { SETTINGS_DEFAULTS } from \"./settings-defaults.ts\";\n\nfunction nonNegativeSafeInteger(options: { default?: number; description?: string } = {}) {\n\treturn Type.Integer({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER, ...options });\n}\n\nfunction caseInsensitive(word: string): string {\n\treturn [...word].map((letter) => `[${letter.toLowerCase()}${letter.toUpperCase()}]`).join(\"\");\n}\n\n/** Mirrors `parseHttpIdleTimeoutMs`: milliseconds, `disabled`, or a duration such as `30s`, `5m`, `1h`. */\nconst TIMEOUT_STRING_PATTERN = `^(?:${caseInsensitive(\"disabled\")}|[0-9]+(?:${caseInsensitive(\"ms\")}|[smhSMH])?)$`;\n\nfunction timeoutSetting(options?: TSchemaOptions) {\n\treturn Type.Union([Type.Number({ minimum: 0 }), Type.String({ pattern: TIMEOUT_STRING_PATTERN })], options);\n}\n\nconst CompactionModelOverrideSchema = Type.Object({\n\treserveTokens: Type.Optional(nonNegativeSafeInteger()),\n\tpreserve_recent: Type.Optional(nonNegativeSafeInteger()),\n});\n\nconst CompactionSettingsSchema = Type.Object({\n\tenabled: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.compaction.enabled })),\n\treserveTokens: Type.Optional(\n\t\tnonNegativeSafeInteger({\n\t\t\tdescription: \"Free context tokens below which automatic compaction starts.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.compaction.reserveTokens,\n\t\t}),\n\t),\n\tcompression_ratio: Type.Optional(\n\t\tType.Number({\n\t\t\texclusiveMinimum: 0,\n\t\t\texclusiveMaximum: 1,\n\t\t\tdescription: \"Fraction of compactable transcript lines to keep.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.compaction.compression_ratio,\n\t\t}),\n\t),\n\tpreserve_recent: Type.Optional(\n\t\tnonNegativeSafeInteger({\n\t\t\tdescription: \"Exact number of newest context-visible messages kept outside the compactable region.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.compaction.preserve_recent,\n\t\t}),\n\t),\n\tquery: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Relevance focus for selecting older lines to retain. Defaults to the last user message when omitted.\",\n\t\t}),\n\t),\n\tmodelOverrides: Type.Optional(\n\t\tType.Record(Type.String(), CompactionModelOverrideSchema, {\n\t\t\tdescription: 'Per-model overrides keyed by exact \"provider/modelId\" strings.',\n\t\t}),\n\t),\n});\n\nconst BranchSummarySettingsSchema = Type.Object({\n\treserveTokens: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Tokens reserved when selecting branch history; the provider sizes summary output.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.branchSummary.reserveTokens,\n\t\t}),\n\t),\n\tskipPrompt: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: 'When true, skips the \"Summarize branch?\" prompt and defaults to no summary.',\n\t\t\tdefault: SETTINGS_DEFAULTS.branchSummary.skipPrompt,\n\t\t}),\n\t),\n});\n\nconst SessionSummarySettingsSchema = Type.Object({\n\tenabled: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Generate a one-line resume-picker summary once the agent goes idle.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.sessionSummary.enabled,\n\t\t}),\n\t),\n});\n\nconst ProviderRetrySettingsSchema = Type.Object({\n\ttimeoutMs: Type.Optional(Type.Number({ description: \"SDK or provider request timeout in milliseconds.\" })),\n\tmaxRetries: Type.Optional(Type.Number({ description: \"SDK or provider retry attempts.\" })),\n\tmaxRetryDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Maximum server-requested delay before failing.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.retry.provider.maxRetryDelayMs,\n\t\t}),\n\t),\n});\n\nconst RetrySettingsSchema = Type.Object({\n\tenabled: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.retry.enabled })),\n\tmaxRetries: Type.Optional(Type.Number({ default: SETTINGS_DEFAULTS.retry.maxRetries })),\n\tbaseDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Exponential backoff base delay in milliseconds: 2s, 4s, 8s.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.retry.baseDelayMs,\n\t\t}),\n\t),\n\tmaxAgentDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Maximum agent-level backoff delay in milliseconds. 0 retries immediately.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.retry.maxAgentDelayMs,\n\t\t}),\n\t),\n\tprovider: Type.Optional(ProviderRetrySettingsSchema),\n\tmaxDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Legacy retry delay setting. Use provider.maxRetryDelayMs instead.\",\n\t\t\tdeprecated: true,\n\t\t}),\n\t),\n});\n\nconst TerminalSettingsSchema = Type.Object({\n\tshowImages: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Show images when the terminal supports them.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.showImages,\n\t\t}),\n\t),\n\timageWidthCells: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Preferred inline image width in terminal cells.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.imageWidthCells,\n\t\t}),\n\t),\n\tclearOnShrink: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Clear empty rows when content shrinks.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.clearOnShrink,\n\t\t}),\n\t),\n\tshowTerminalProgress: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Show OSC 9;4 terminal progress indicators.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.showTerminalProgress,\n\t\t}),\n\t),\n\thyperlinks: Type.Optional(\n\t\tType.Union([Type.Boolean(), Type.Literal(\"auto\")], {\n\t\t\tdescription: 'Hyperlink capability override. \"auto\" and invalid values keep terminal detection.',\n\t\t}),\n\t),\n\timages: Type.Optional(\n\t\tType.Union([Type.Literal(\"kitty\"), Type.Literal(\"iterm2\"), Type.Literal(\"auto\"), Type.Literal(false)], {\n\t\t\tdescription: 'Inline-image protocol override. false disables images; \"auto\" keeps terminal detection.',\n\t\t}),\n\t),\n\ttrueColor: Type.Optional(\n\t\tType.Union([Type.Boolean(), Type.Literal(\"auto\")], {\n\t\t\tdescription: 'Truecolor capability override. \"auto\" and invalid values keep terminal detection.',\n\t\t}),\n\t),\n});\n\nconst ImageSettingsSchema = Type.Object({\n\tautoResize: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Resize images to 2000x2000 maximum for better model compatibility.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.images.autoResize,\n\t\t}),\n\t),\n\tblockImages: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"When true, prevents all images from being sent to LLM providers.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.images.blockImages,\n\t\t}),\n\t),\n});\n\nconst SearchSettingsSchema = Type.Object({\n\tcontextBefore: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Number of context lines before each search match.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.search.contextBefore,\n\t\t}),\n\t),\n\tcontextAfter: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Number of context lines after each search match.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.search.contextAfter,\n\t\t}),\n\t),\n});\n\nconst BashInterceptorSettingsSchema = Type.Object({\n\tenabled: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription:\n\t\t\t\t\"When true, block shell commands that have dedicated tools and offer remaining bash tool calls to user_bash extension handlers before local execution.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.bashInterceptor.enabled,\n\t\t}),\n\t),\n});\n\nconst HerdrSettingsSchema = Type.Object({\n\tenabled: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Enable the built-in reporter in an eligible Herdr pane.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.herdr.enabled,\n\t\t}),\n\t),\n});\n\nconst ModelRoutingSettingsSchema = Type.Object(\n\t{\n\t\tallowedProviders: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"When nonempty, only models from these provider IDs are routing candidates.\",\n\t\t\t}),\n\t\t),\n\t\texcludedProviders: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"Provider IDs that are never routing candidates. Applied after allowedProviders.\",\n\t\t\t}),\n\t\t),\n\t\tallowedModels: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"When nonempty, only models matching these full-ID or glob patterns, as in enabledModels, are routing candidates.\",\n\t\t\t}),\n\t\t),\n\t\texcludedModels: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Models matching these full-ID or glob patterns are never routing candidates. Applied after allowedModels.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t'Provider and model filters for the candidates model \"auto\" may route to. Does not affect routerModel.',\n\t},\n);\n\nfunction thinkingBudgetsSettings(options?: TSchemaOptions) {\n\treturn Type.Object(\n\t\t{\n\t\t\tminimal: Type.Optional(Type.Number()),\n\t\t\tlow: Type.Optional(Type.Number()),\n\t\t\tmedium: Type.Optional(Type.Number()),\n\t\t\thigh: Type.Optional(Type.Number()),\n\t\t},\n\t\toptions,\n\t);\n}\n\nconst ThinkingBudgetsSettingsSchema = thinkingBudgetsSettings();\n\nconst MarkdownSettingsSchema = Type.Object({\n\tcodeBlockIndent: Type.Optional(Type.String({ default: SETTINGS_DEFAULTS.markdown.codeBlockIndent })),\n\tmermaid: Type.Optional(\n\t\tType.Union([Type.Literal(\"off\"), Type.Literal(\"final\"), Type.Literal(\"streaming\")], {\n\t\t\tdefault: SETTINGS_DEFAULTS.markdown.mermaid,\n\t\t}),\n\t),\n\tlatex: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Render LaTeX expressions as terminal-friendly Unicode math.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.markdown.latex,\n\t\t}),\n\t),\n});\n\nconst WarningSettingsSchema = Type.Object({\n\tanthropicExtraUsage: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.warnings.anthropicExtraUsage })),\n});\n\nfunction codemodeMode(options?: TSchemaOptions) {\n\treturn Type.Union([Type.Literal(\"on\"), Type.Literal(\"only\")], options);\n}\n\nconst CodemodeModeSchema = codemodeMode();\n\nconst CodemodeSettingsSchema = Type.Object({\n\tmode: Type.Optional(\n\t\tcodemodeMode({\n\t\t\tdescription:\n\t\t\t\t'How codemode presents tools. \"on\" keeps direct tool declarations visible with script-call information; \"only\" hides ordinary direct callable declarations so the model uses scripts. Model-only tools remain directly available.',\n\t\t\tdefault: SETTINGS_DEFAULTS.codemode.mode,\n\t\t}),\n\t),\n\tinlineBudget: Type.Optional(\n\t\tType.Number({\n\t\t\tminimum: 0,\n\t\t\tdescription: \"Estimated tokens available for inline codemode tool declarations.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.codemode.inlineBudget,\n\t\t}),\n\t),\n});\n\nconst PackageSourceSchema = Type.Union(\n\t[\n\t\tType.String({ description: \"Load all resources from the package.\" }),\n\t\tType.Object({\n\t\t\tsource: Type.String(),\n\t\t\tautoload: Type.Optional(\n\t\t\t\tType.Boolean({ description: \"When false, start empty and only apply explicit resource patterns.\" }),\n\t\t\t),\n\t\t\textensions: Type.Optional(Type.Array(Type.String())),\n\t\t\tskills: Type.Optional(Type.Array(Type.String())),\n\t\t\tprompts: Type.Optional(Type.Array(Type.String())),\n\t\t\tthemes: Type.Optional(Type.Array(Type.String())),\n\t\t\tworkflows: Type.Optional(Type.Array(Type.String())),\n\t\t\tmcpServers: Type.Optional(Type.Array(Type.String())),\n\t\t}),\n\t],\n\t{\n\t\tdescription:\n\t\t\t\"Package source for npm or git packages. Use the string form to load all resources or the object form to filter resources.\",\n\t},\n);\n\nconst StringArraySchema = Type.Array(Type.String());\n\nconst SkillsInputSchema = Type.Union(\n\t[\n\t\tStringArraySchema,\n\t\tType.Object(\n\t\t\t{\n\t\t\t\tenableSkillCommands: Type.Optional(Type.Boolean()),\n\t\t\t\tcustomDirectories: Type.Optional(StringArraySchema),\n\t\t\t},\n\t\t\t{ deprecated: true },\n\t\t),\n\t],\n\t{ description: \"Local skill file paths or directories.\" },\n);\n\nexport const StorageSelectionSchema = Type.Union([\n\tType.Object(\n\t\t{\n\t\t\tpath: Type.Optional(Type.String({ description: \"Database path relative to the Atomic home directory.\" })),\n\t\t\tmemory: Type.Optional(Type.Boolean({ description: \"Explicitly select ephemeral storage.\" })),\n\t\t\tprefix: Type.Optional(Type.String()),\n\t\t},\n\t\t{\n\t\t\tadditionalProperties: false,\n\t\t\tnot: { required: [\"path\", \"memory\"], properties: { path: { minLength: 1 }, memory: { const: true } } },\n\t\t},\n\t),\n\tType.Object(\n\t\t{\n\t\t\tadapter: Type.String({ minLength: 1, description: \"User-installed storage adapter module specifier.\" }),\n\t\t\toptions: Type.Optional(\n\t\t\t\tType.Record(Type.String(), Type.Union([Type.String(), Type.Number(), Type.Boolean(), Type.Null()])),\n\t\t\t),\n\t\t\tsecrets: Type.Optional(\n\t\t\t\tType.Record(\n\t\t\t\t\tType.String(),\n\t\t\t\t\tType.Union([\n\t\t\t\t\t\tType.Object({ env: Type.String() }, { additionalProperties: false }),\n\t\t\t\t\t\tType.Object({ file: Type.String() }, { additionalProperties: false }),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t),\n\t\t\tprefix: Type.Optional(Type.String()),\n\t\t},\n\t\t{ additionalProperties: false },\n\t),\n]);\n\nexport const SessionStorageSelectionSchema = Type.Union([\n\tStorageSelectionSchema,\n\tType.Object({ dir: Type.String() }, { additionalProperties: false }),\n]);\n\nconst ResourceLimitsSchema = Type.Object(\n\t{\n\t\tsession: Type.Optional(Type.Integer({ minimum: 1 })),\n\t\tprocess: Type.Optional(Type.Integer({ minimum: 1 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst WorkflowsSettingsSchema = Type.Union(\n\t[\n\t\tStringArraySchema,\n\t\tType.Object({\n\t\t\tpaths: Type.Optional(Type.Array(Type.String(), { description: \"Workflow resource paths.\" })),\n\t\t\tjournal: Type.Optional(StorageSelectionSchema),\n\t\t\tlocalWorkers: Type.Optional(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tcount: Type.Integer({ minimum: 1, description: \"Number of local worker processes.\" }),\n\t\t\t\t\t\tdefinitions: Type.Array(\n\t\t\t\t\t\t\tType.Object({ path: Type.String(), exportName: Type.String() }, { additionalProperties: false }),\n\t\t\t\t\t\t\t{ description: \"Importable child workflow definitions workers may run.\" },\n\t\t\t\t\t\t),\n\t\t\t\t\t\tstartupTimeoutMs: Type.Optional(\n\t\t\t\t\t\t\tType.Integer({\n\t\t\t\t\t\t\t\tminimum: 1,\n\t\t\t\t\t\t\t\tmaximum: 2_147_483_647,\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\"Milliseconds each worker process may take to become ready. Default: 30000, scaled up when workers plus load exceed CPU cores (at most 600000).\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tleaseMs: Type.Optional(\n\t\t\t\t\t\t\tType.Integer({\n\t\t\t\t\t\t\t\tminimum: 2000,\n\t\t\t\t\t\t\t\tmaximum: 2_147_483_647,\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\"Milliseconds a live worker that has stopped responding keeps its child before the child is replayed elsewhere. Default: 30000.\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t),\n\t\t\tadmission: Type.Optional(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tlimits: Type.Optional(ResourceLimitsSchema),\n\t\t\t\t\t\tuserLimits: Type.Optional(ResourceLimitsSchema),\n\t\t\t\t\t\tuserDatabase: Type.Optional(Type.String()),\n\t\t\t\t\t\thost: Type.Optional(\n\t\t\t\t\t\t\tType.Object(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmaxLoadPerCpu: Type.Optional(Type.Number({ minimum: 0 })),\n\t\t\t\t\t\t\t\t\tminFreeMemoryBytes: Type.Optional(Type.Number({ minimum: 0 })),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t),\n\t\t}),\n\t],\n\t{\n\t\tdescription:\n\t\t\t'Local workflow paths, or an object with \"paths\", \"journal\" storage, \"localWorkers\" and \"admission\" settings.',\n\t},\n);\n\nexport const SettingsSchema = Type.Object(\n\t{\n\t\t$schema: Type.Optional(Type.String({ description: \"JSON Schema reference.\" })),\n\t\tstorage: Type.Optional(StorageSelectionSchema),\n\t\tsessions: Type.Optional(Type.Object({ storage: Type.Optional(SessionStorageSelectionSchema) })),\n\t\tlastChangelogVersion: Type.Optional(Type.String()),\n\t\tfirstRunOnboardingStartedVersion: Type.Optional(\n\t\t\tType.String({ description: \"Managed onboarding state; leave unchanged.\" }),\n\t\t),\n\t\tonboardedVersion: Type.Optional(\n\t\t\tType.String({ description: \"Managed onboarding completion state; leave unchanged.\" }),\n\t\t),\n\t\tdefaultProvider: Type.Optional(Type.String()),\n\t\tdefaultModel: Type.Optional(Type.String()),\n\t\trouterModel: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t'Inference model for workflow-stage and subagent model: \"auto\" selection only. An exact provider/model selects a registered chat or classifier model; \"auto\" and an empty string use the current chat model.',\n\t\t\t\tdefault: SETTINGS_DEFAULTS.routerModel,\n\t\t\t}),\n\t\t),\n\t\tcompactionModel: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t'Compaction model: \"auto\" or an empty string uses the session model, and an exact provider/model selects a registered chat model, classifier, or compactor.',\n\t\t\t}),\n\t\t),\n\t\tmodelRouting: Type.Optional(ModelRoutingSettingsSchema),\n\t\tdefaultThinkingLevel: Type.Optional(ModelThinkingLevelSchema),\n\t\tmodelThinkingLevels: Type.Optional(\n\t\t\tType.Record(Type.String(), ModelThinkingLevelSchema, {\n\t\t\t\tdescription: 'Per-model default thinking level overrides keyed by \"provider/modelId\".',\n\t\t\t}),\n\t\t),\n\t\tfallbackModels: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t'Ordered main-chat fallback models, written as \"provider/model\" with an optional thinking-level suffix such as \":high\".',\n\t\t\t}),\n\t\t),\n\t\ttransport: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[Type.Literal(\"auto\"), Type.Literal(\"sse\"), Type.Literal(\"websocket\"), Type.Literal(\"websocket-cached\")],\n\t\t\t\t{ default: SETTINGS_DEFAULTS.transport },\n\t\t\t),\n\t\t),\n\t\tsteeringMode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"all\"), Type.Literal(\"one-at-a-time\")], {\n\t\t\t\tdefault: SETTINGS_DEFAULTS.steeringMode,\n\t\t\t}),\n\t\t),\n\t\tfollowUpMode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"all\"), Type.Literal(\"one-at-a-time\")], {\n\t\t\t\tdefault: SETTINGS_DEFAULTS.followUpMode,\n\t\t\t}),\n\t\t),\n\t\ttheme: Type.Optional(Type.String()),\n\t\tenableAnalytics: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Opt in to analytics data sharing. Storage only; Atomic does not transmit analytics.\",\n\t\t\t}),\n\t\t),\n\t\ttrackingId: Type.Optional(\n\t\t\tType.String({ description: \"Analytics tracking identifier, generated when analytics is enabled.\" }),\n\t\t),\n\t\tdeviceId: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Stable installation UUID, generated when authentication first needs it. Global only.\",\n\t\t\t}),\n\t\t),\n\t\tshowCacheMissNotices: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Show cache cost and provider recovery notices.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.showCacheMissNotices,\n\t\t\t}),\n\t\t),\n\t\tcompaction: Type.Optional(CompactionSettingsSchema),\n\t\tbranchSummary: Type.Optional(BranchSummarySettingsSchema),\n\t\tsessionSummary: Type.Optional(SessionSummarySettingsSchema),\n\t\tretry: Type.Optional(RetrySettingsSchema),\n\t\thideThinkingBlock: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.hideThinkingBlock })),\n\t\texternalEditor: Type.Optional(\n\t\t\tType.String({ description: \"Command for Ctrl+G external editor; takes precedence over VISUAL and EDITOR.\" }),\n\t\t),\n\t\tshellPath: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Custom shell path, for example for Cygwin on Windows, with support for leading ~ expansion.\",\n\t\t\t}),\n\t\t),\n\t\tquietStartup: Type.Optional(\n\t\t\tType.Union([Type.Boolean(), Type.Literal(\"header\")], {\n\t\t\t\tdescription: 'When true, hide all startup output. When \"header\", keep only the startup header.',\n\t\t\t\tdefault: SETTINGS_DEFAULTS.quietStartup,\n\t\t\t}),\n\t\t),\n\t\tdefaultProjectTrust: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"ask\"), Type.Literal(\"always\"), Type.Literal(\"never\")], {\n\t\t\t\tdescription: \"Global setting only.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.defaultProjectTrust,\n\t\t\t}),\n\t\t),\n\t\tshellCommandPrefix: Type.Optional(\n\t\t\tType.String({ description: \"Prefix prepended to every bash command, for example to enable shell aliases.\" }),\n\t\t),\n\t\tbashInterceptor: Type.Optional(BashInterceptorSettingsSchema),\n\t\tsearch: Type.Optional(SearchSettingsSchema),\n\t\tnpmCommand: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t'Command used for npm package lookup and installation, in argv form such as [\"mise\", \"exec\", \"node@20\", \"--\", \"npm\"].',\n\t\t\t}),\n\t\t),\n\t\tcollapseChangelog: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Show the condensed changelog after update; use /changelog for the full changelog.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.collapseChangelog,\n\t\t\t}),\n\t\t),\n\t\tenableInstallTelemetry: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Send an anonymous version-adoption ping on eligible interactive launches.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.enableInstallTelemetry,\n\t\t\t}),\n\t\t),\n\t\tpackages: Type.Optional(\n\t\t\tType.Array(PackageSourceSchema, {\n\t\t\t\tdescription: \"npm or git package sources, as strings or objects with resource filtering.\",\n\t\t\t}),\n\t\t),\n\t\textensions: Type.Optional(\n\t\t\tType.Array(Type.String(), { description: \"Local extension file paths or directories.\" }),\n\t\t),\n\t\tskills: Type.Optional(SkillsInputSchema),\n\t\tprompts: Type.Optional(\n\t\t\tType.Array(Type.String(), { description: \"Local prompt template file paths or directories.\" }),\n\t\t),\n\t\tthemes: Type.Optional(Type.Array(Type.String(), { description: \"Local theme file paths or directories.\" })),\n\t\tworkflows: Type.Optional(WorkflowsSettingsSchema),\n\t\tenableSkillCommands: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Register skills as /skill:name commands.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.enableSkillCommands,\n\t\t\t}),\n\t\t),\n\t\tterminal: Type.Optional(TerminalSettingsSchema),\n\t\therdr: Type.Optional(HerdrSettingsSchema),\n\t\timages: Type.Optional(ImageSettingsSchema),\n\t\tenabledModels: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"Model patterns for cycling, in the same format as the --models CLI flag.\",\n\t\t\t}),\n\t\t),\n\t\tdefaultTools: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Initial tool selection. Plain names replace the inherited selection; +name and -name entries add or remove tools.\",\n\t\t\t}),\n\t\t),\n\t\tdoubleEscapeAction: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"fork\"), Type.Literal(\"tree\"), Type.Literal(\"none\")], {\n\t\t\t\tdescription: \"Action for double-escape with an empty editor.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.doubleEscapeAction,\n\t\t\t}),\n\t\t),\n\t\ttreeFilterMode: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[\n\t\t\t\t\tType.Literal(\"default\"),\n\t\t\t\t\tType.Literal(\"no-tools\"),\n\t\t\t\t\tType.Literal(\"user-only\"),\n\t\t\t\t\tType.Literal(\"labeled-only\"),\n\t\t\t\t\tType.Literal(\"all\"),\n\t\t\t\t],\n\t\t\t\t{\n\t\t\t\t\tdescription: \"Default filter when opening /tree.\",\n\t\t\t\t\tdefault: SETTINGS_DEFAULTS.treeFilterMode,\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t\tthinkingBudgets: Type.Optional(\n\t\t\tthinkingBudgetsSettings({\n\t\t\t\tdescription: \"Custom token budgets for thinking levels.\",\n\t\t\t}),\n\t\t),\n\t\teditorPaddingX: Type.Optional(\n\t\t\tType.Number({\n\t\t\t\tdescription: \"Horizontal padding for the input editor (0-3).\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.editorPaddingX,\n\t\t\t}),\n\t\t),\n\t\toutputPad: Type.Optional(\n\t\t\tType.Union([Type.Literal(0), Type.Literal(1)], {\n\t\t\t\tdescription: \"Horizontal padding for transcript content.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.outputPad,\n\t\t\t}),\n\t\t),\n\t\tautocompleteMaxVisible: Type.Optional(\n\t\t\tType.Number({\n\t\t\t\tdescription: \"Maximum visible items in the autocomplete dropdown (3-20).\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.autocompleteMaxVisible,\n\t\t\t}),\n\t\t),\n\t\tshowHardwareCursor: Type.Optional(\n\t\t\tType.Boolean({ description: \"Show the terminal cursor while still positioning it for IME.\" }),\n\t\t),\n\t\tfullscreenScrollbar: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"auto\"), Type.Literal(\"always\"), Type.Literal(\"hidden\")], {\n\t\t\t\tdescription: \"Fullscreen transcript scrollbar visibility.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenScrollbar,\n\t\t\t}),\n\t\t),\n\t\tfullscreenExitOutput: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"transcript\"), Type.Literal(\"resume-hint\")], {\n\t\t\t\tdescription:\n\t\t\t\t\t\"What the terminal keeps when a fullscreen session exits: the final transcript with a resume hint, or only the resume hint.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenExitOutput,\n\t\t\t}),\n\t\t),\n\t\tfullscreenCopyOnSelect: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Copy fullscreen text selections automatically on mouse release.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenCopyOnSelect,\n\t\t\t}),\n\t\t),\n\t\tfullscreenWheelScrollLines: Type.Optional(\n\t\t\tType.Union([Type.Number(), Type.Literal(\"auto\")], {\n\t\t\t\tdescription: \"Lines scrolled per wheel event in fullscreen mode; numeric values are clamped from 1 to 100.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenWheelScrollLines,\n\t\t\t}),\n\t\t),\n\t\tcodemode: Type.Optional(CodemodeSettingsSchema),\n\t\tmarkdown: Type.Optional(MarkdownSettingsSchema),\n\t\twarnings: Type.Optional(WarningSettingsSchema),\n\t\thttpProxy: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Proxy URL applied as HTTP_PROXY and HTTPS_PROXY for Atomic-managed HTTP clients. Global only.\",\n\t\t\t}),\n\t\t),\n\t\thttpIdleTimeoutMs: Type.Optional(\n\t\t\ttimeoutSetting({\n\t\t\t\tdescription:\n\t\t\t\t\t'HTTP idle timeout as milliseconds, a duration such as \"30s\", \"5m\", or \"1h\", or \"disabled\"; 0 or \"disabled\" disables it.',\n\t\t\t\tdefault: SETTINGS_DEFAULTS.httpIdleTimeoutMs,\n\t\t\t}),\n\t\t),\n\t\tcacheWarming: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"off\"), Type.Literal(\"streaming\"), Type.Literal(\"idle\")], {\n\t\t\t\tdescription:\n\t\t\t\t\t'Cache-warming profile. \"idle\" also warms between agent runs. Global only because each refresh costs money.',\n\t\t\t\tdefault: SETTINGS_DEFAULTS.cacheWarming,\n\t\t\t}),\n\t\t),\n\t\twebsocketConnectTimeoutMs: Type.Optional(\n\t\t\ttimeoutSetting({\n\t\t\t\tdescription:\n\t\t\t\t\t'WebSocket connect or open handshake timeout as milliseconds, a duration such as \"30s\", or \"disabled\"; 0 or \"disabled\" disables it.',\n\t\t\t}),\n\t\t),\n\t\tstreamDeadlineMs: Type.Optional(\n\t\t\ttimeoutSetting({\n\t\t\t\tdescription:\n\t\t\t\t\t'Maximum idle gap between two provider stream events as milliseconds, a duration such as \"30s\", or \"disabled\"; 0 or \"disabled\" disables it.',\n\t\t\t}),\n\t\t),\n\t\tqueueMode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"all\"), Type.Literal(\"one-at-a-time\")], {\n\t\t\t\tdescription: \"Legacy setting migrated to steeringMode.\",\n\t\t\t\tdeprecated: true,\n\t\t\t}),\n\t\t),\n\t\twebsockets: Type.Optional(\n\t\t\tType.Boolean({ description: \"Legacy setting migrated to transport.\", deprecated: true }),\n\t\t),\n\t},\n\t{ additionalProperties: true },\n);\n\ntype SettingsInput = Static<typeof SettingsSchema>;\n\nexport interface CompactionModelOverride extends Static<typeof CompactionModelOverrideSchema> {}\nexport interface CompactionSettings extends Static<typeof CompactionSettingsSchema> {}\nexport interface BranchSummarySettings extends Static<typeof BranchSummarySettingsSchema> {}\nexport interface SessionSummarySettings extends Static<typeof SessionSummarySettingsSchema> {}\nexport interface ProviderRetrySettings extends Static<typeof ProviderRetrySettingsSchema> {}\nexport interface RetrySettings extends Omit<Static<typeof RetrySettingsSchema>, \"maxDelayMs\"> {}\nexport interface TerminalSettings extends Static<typeof TerminalSettingsSchema> {}\nexport interface ImageSettings extends Static<typeof ImageSettingsSchema> {}\nexport interface SearchSettings extends Static<typeof SearchSettingsSchema> {}\nexport interface BashInterceptorSettings extends Static<typeof BashInterceptorSettingsSchema> {}\nexport interface ModelRoutingSettings extends Static<typeof ModelRoutingSettingsSchema> {}\nexport interface ThinkingBudgetsSettings extends Static<typeof ThinkingBudgetsSettingsSchema> {}\nexport type MermaidRenderingMode = NonNullable<Static<typeof MarkdownSettingsSchema>[\"mermaid\"]>;\nexport interface MarkdownSettings extends Static<typeof MarkdownSettingsSchema> {}\nexport interface WarningSettings extends Static<typeof WarningSettingsSchema> {}\nexport type CodemodeMode = Static<typeof CodemodeModeSchema>;\nexport interface CodemodeSettings extends Static<typeof CodemodeSettingsSchema> {}\nexport type DefaultProjectTrust = NonNullable<SettingsInput[\"defaultProjectTrust\"]>;\nexport type QuietStartup = NonNullable<SettingsInput[\"quietStartup\"]>;\nexport type TransportSetting = NonNullable<SettingsInput[\"transport\"]>;\nexport type PackageSource = Static<typeof PackageSourceSchema>;\nexport type FullscreenExitOutput = NonNullable<SettingsInput[\"fullscreenExitOutput\"]>;\nexport type CacheWarmingMode = NonNullable<SettingsInput[\"cacheWarming\"]>;\nexport interface Settings extends Omit<SettingsInput, \"queueMode\" | \"retry\" | \"skills\" | \"websockets\"> {\n\tretry?: RetrySettings;\n\tskills?: string[];\n}\n"]}
|
|
@@ -62,15 +62,18 @@ export interface JournalFactories {
|
|
|
62
62
|
sql(database: SqliteDatabase, options: {
|
|
63
63
|
readonly prefix?: string;
|
|
64
64
|
}): Promise<RunJournal>;
|
|
65
|
+
/** Live modules a journal adapter imports by specifier, such as the running `@bastani/atomic/workflows`. */
|
|
66
|
+
readonly hostModules?: Readonly<Record<string, object>>;
|
|
65
67
|
}
|
|
66
68
|
export declare function storageSelectionKey(selection: StorageSelection, agentDir?: string): string;
|
|
67
69
|
/**
|
|
68
70
|
* Loads an adapter module the way the extension loader loads extensions: `@bastani/atomic/storage` (and
|
|
69
71
|
* `@bastani/atomic`) resolve to this host's own modules, so adapters need no installed copy of Atomic and share its
|
|
70
|
-
* error classes.
|
|
71
|
-
* package
|
|
72
|
+
* error classes. `hostModules` adds live modules by specifier; run journals pass the running
|
|
73
|
+
* `@bastani/atomic/workflows`. A package name selects an adapter listed by an installed Atomic package; other
|
|
74
|
+
* specifiers, and package names no installed package lists, resolve from the agent directory.
|
|
72
75
|
*/
|
|
73
|
-
export declare function loadStorageAdapter(module: string, context: StorageOpenContext): Promise<StorageAdapterModule>;
|
|
76
|
+
export declare function loadStorageAdapter(module: string, context: StorageOpenContext, hostModules?: Readonly<Record<string, object>>): Promise<StorageAdapterModule>;
|
|
74
77
|
/** The adapter's options with every `secrets` reference resolved, as the provider passes them to its hooks. */
|
|
75
78
|
export declare function resolveAdapterOptions(selection: Extract<StorageSelection, {
|
|
76
79
|
kind: "adapter";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/core/storage/provider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAUpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAA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E,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1F,4GAA4G;IAC5G,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACxD;AAeD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAqB1F;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,kBAAkB,EAC3B,WAAW,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAChD,OAAO,CAAC,oBAAoB,CAAC,CAqC/B;AAED,+GAA+G;AAC/G,wBAAsB,qBAAqB,CAC1C,SAAS,EAAE,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,EACzD,OAAO,EAAE,kBAAkB,GACzB,OAAO,CAAC,cAAc,CAAC,CAuBzB;AAyBD,MAAM,WAAW,eAAe;IAC/B,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAClG,cAAc,CAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC9F;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,QAAQ,CAAC,EAAE,gBAAgB,KAAK,eAiKlE,CAAC"}
|
|
@@ -44,17 +44,18 @@ export function storageSelectionKey(selection, agentDir) {
|
|
|
44
44
|
/**
|
|
45
45
|
* Loads an adapter module the way the extension loader loads extensions: `@bastani/atomic/storage` (and
|
|
46
46
|
* `@bastani/atomic`) resolve to this host's own modules, so adapters need no installed copy of Atomic and share its
|
|
47
|
-
* error classes.
|
|
48
|
-
* package
|
|
47
|
+
* error classes. `hostModules` adds live modules by specifier; run journals pass the running
|
|
48
|
+
* `@bastani/atomic/workflows`. A package name selects an adapter listed by an installed Atomic package; other
|
|
49
|
+
* specifiers, and package names no installed package lists, resolve from the agent directory.
|
|
49
50
|
*/
|
|
50
|
-
export async function loadStorageAdapter(module, context) {
|
|
51
|
+
export async function loadStorageAdapter(module, context, hostModules = {}) {
|
|
51
52
|
try {
|
|
52
53
|
const [{ createHostModuleJiti }, { getStorageAdapterHostModules }, { resolvePackageStorageAdapter }] = await Promise.all([
|
|
53
54
|
import("../extensions/loader-virtual-modules.js"),
|
|
54
55
|
import("../extensions/loader-host-modules.js"),
|
|
55
56
|
import("../package-manager-storage-adapters.js"),
|
|
56
57
|
]);
|
|
57
|
-
const loader = await createHostModuleJiti(pathToFileURL(join(context.agentDir, "storage-adapter.js")).href, await getStorageAdapterHostModules(),
|
|
58
|
+
const loader = await createHostModuleJiti(pathToFileURL(join(context.agentDir, "storage-adapter.js")).href, { ...(await getStorageAdapterHostModules()), ...hostModules },
|
|
58
59
|
// JS adapters must also pass through virtual host modules, not native-import a second host copy.
|
|
59
60
|
{ interopDefault: true, tryNative: false });
|
|
60
61
|
const specifier = (await resolvePackageStorageAdapter(module, context.agentDir)) ?? module;
|
|
@@ -143,6 +144,7 @@ export const StorageProvider = class {
|
|
|
143
144
|
throw new StorageConfigError("sdk", "journal", "adapter-domain-unsupported");
|
|
144
145
|
return this.open(selection, context, {
|
|
145
146
|
memory: () => journals.memory({ adapter: "memory", location: ":memory:" }),
|
|
147
|
+
hostModules: journals.hostModules,
|
|
146
148
|
direct: (adapter, options, storage) => adapter.openRunJournal?.(options, context, storage),
|
|
147
149
|
sql: async (database, options) => {
|
|
148
150
|
const journal = await journals.sql(database, options);
|
|
@@ -187,7 +189,7 @@ export const StorageProvider = class {
|
|
|
187
189
|
validateStoragePrefix(selection.prefix);
|
|
188
190
|
let openDatabase;
|
|
189
191
|
if (selection.kind === "adapter") {
|
|
190
|
-
const adapter = await loadStorageAdapter(selection.module, context);
|
|
192
|
+
const adapter = await loadStorageAdapter(selection.module, context, factories.hostModules);
|
|
191
193
|
const options = await resolveAdapterOptions(selection, context);
|
|
192
194
|
try {
|
|
193
195
|
const direct = factories.direct(adapter, options, { prefix: selection.prefix });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/core/storage/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EACN,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,EAEZ,uBAAuB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAgD/C,MAAM,WAAW,GAAG,IAAI,OAAO,EAA0B,CAAC;AAC1D,IAAI,cAAc,GAAG,CAAC,CAAC;AAEvB,SAAS,gBAAgB,CACxB,KAA4B;IAE5B,IAAI,KAAK,YAAY,UAAU;QAAE,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,C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EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjG,MAAM,YAAY,CAAC;YACpB,CAAC;YACD,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;CACD,CAAC","sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { createSessionCwdMatcher } from \"../../utils/canonical-path.ts\";\nimport type { SqliteDatabase, SqliteValue, StorageDescriptor } from \"./database.js\";\nimport {\n\tStorageAdapterLoadError,\n\tStorageConfigError,\n\tStorageError,\n\ttype StorageFailureCause,\n\tStorageUnavailableError,\n} from \"./errors.js\";\nimport { openNodeSqliteDatabase } from \"./node-sqlite.js\";\nimport { validateStoragePrefix } from \"./prefix.js\";\nimport type { RunJournal } from \"./run-journal.js\";\nimport { selectStorage } from \"./selection.js\";\nimport type { SessionStore } from \"./session/types.js\";\n\nexport type SecretRef = { readonly env: string } | { readonly file: string };\nexport type AdapterOptions = Readonly<Record<string, SqliteValue | boolean>>;\nexport type RunJournalOption =\n\t| { path: string; prefix?: string }\n\t| { database: SqliteDatabase; prefix?: string }\n\t| { memory: true }\n\t| { adapter: string; options?: AdapterOptions; secrets?: Readonly<Record<string, SecretRef>>; prefix?: string }\n\t| RunJournal;\nexport type StorageSelection =\n\t| { readonly kind: \"memory\" }\n\t| { readonly kind: \"jsonl\"; readonly dir: string }\n\t| { readonly kind: \"sqlite\"; readonly path: string; readonly prefix?: string }\n\t| { readonly kind: \"database\"; readonly database: SqliteDatabase; readonly prefix?: string }\n\t| {\n\t\t\treadonly kind: \"adapter\";\n\t\t\treadonly module: string;\n\t\t\treadonly options?: AdapterOptions;\n\t\t\treadonly secrets?: Readonly<Record<string, SecretRef>>;\n\t\t\treadonly prefix?: string;\n\t };\nexport interface StorageOpenContext {\n\treadonly agentDir: string;\n\t/** `intercom`: the shared Intercom broker state that multi-node brokers open on the top-level selection. */\n\treadonly domain: \"sessions\" | \"journal\" | \"intercom\";\n\treadonly signal?: AbortSignal;\n}\nexport interface StorageAdapterModule {\n\treadonly atomicStorageAdapter: 1;\n\topenDatabase?(options: AdapterOptions, context: StorageOpenContext): Promise<SqliteDatabase>;\n\topenSessionStore?(\n\t\toptions: AdapterOptions,\n\t\tcontext: StorageOpenContext,\n\t\tstorage: { readonly prefix?: string },\n\t): Promise<SessionStore>;\n\topenRunJournal?(\n\t\toptions: AdapterOptions,\n\t\tcontext: StorageOpenContext,\n\t\tstorage: { readonly prefix?: string },\n\t): Promise<RunJournal>;\n}\nexport interface JournalFactories {\n\tmemory(descriptor: StorageDescriptor): RunJournal;\n\tsql(database: SqliteDatabase, options: { readonly prefix?: string }): Promise<RunJournal>;\n}\n\nconst databaseIds = new WeakMap<SqliteDatabase, number>();\nlet nextDatabaseId = 0;\n\nfunction storageOptionKey(\n\tvalue: SqliteValue | boolean,\n): readonly [string, string | boolean | readonly number[] | null] {\n\tif (value instanceof Uint8Array) return [\"bytes\", Array.from(value)];\n\tif (value === null) return [\"null\", null];\n\tif (typeof value === \"number\") return [\"number\", Object.is(value, -0) ? \"-0\" : String(value)];\n\tif (typeof value === \"bigint\") return [\"bigint\", String(value)];\n\treturn [typeof value, value];\n}\n\nexport function storageSelectionKey(selection: StorageSelection, agentDir?: string): string {\n\tif (selection.kind === \"database\") {\n\t\tlet id = databaseIds.get(selection.database);\n\t\tif (id === undefined) {\n\t\t\tid = ++nextDatabaseId;\n\t\t\tdatabaseIds.set(selection.database, id);\n\t\t}\n\t\treturn JSON.stringify([\"database\", id, selection.prefix ?? \"\"]);\n\t}\n\tif (selection.kind === \"sqlite\") {\n\t\tconst path = selection.path === \"\" || selection.path === \":memory:\" ? selection.path : resolve(selection.path);\n\t\treturn JSON.stringify([\"sqlite\", path, selection.prefix ?? \"\"]);\n\t}\n\tif (selection.kind === \"adapter\") {\n\t\tconst options = Object.entries(selection.options ?? {})\n\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t.map(([name, value]) => [name, storageOptionKey(value)]);\n\t\tconst secrets = Object.entries(selection.secrets ?? {}).sort(([a], [b]) => a.localeCompare(b));\n\t\treturn JSON.stringify([\"adapter\", agentDir, selection.module, options, secrets, selection.prefix ?? \"\"]);\n\t}\n\treturn JSON.stringify(selection);\n}\n\n/**\n * Loads an adapter module the way the extension loader loads extensions: `@bastani/atomic/storage` (and\n * `@bastani/atomic`) resolve to this host's own modules, so adapters need no installed copy of Atomic and share its\n * error classes. A package name selects an adapter listed by an installed Atomic package; other specifiers, and\n * package names no installed package lists, resolve from the agent directory.\n */\nexport async function loadStorageAdapter(module: string, context: StorageOpenContext): Promise<StorageAdapterModule> {\n\ttry {\n\t\tconst [{ createHostModuleJiti }, { getStorageAdapterHostModules }, { resolvePackageStorageAdapter }] =\n\t\t\tawait Promise.all([\n\t\t\t\timport(\"../extensions/loader-virtual-modules.js\"),\n\t\t\t\timport(\"../extensions/loader-host-modules.js\"),\n\t\t\t\timport(\"../package-manager-storage-adapters.js\"),\n\t\t\t]);\n\t\tconst loader = await createHostModuleJiti(\n\t\t\tpathToFileURL(join(context.agentDir, \"storage-adapter.js\")).href,\n\t\t\tawait getStorageAdapterHostModules(),\n\t\t\t// JS adapters must also pass through virtual host modules, not native-import a second host copy.\n\t\t\t{ interopDefault: true, tryNative: false },\n\t\t);\n\t\tconst specifier = (await resolvePackageStorageAdapter(module, context.agentDir)) ?? module;\n\t\tconst location = loader.esmResolve(specifier);\n\t\tconst filename = location.startsWith(\"file:\") ? fileURLToPath(location) : location;\n\t\t// jiti's async JS fast path uses native import even with tryNative:false. Force only JS entrypoints\n\t\t// through its transform so their host imports use the live virtual modules, just like TS adapters.\n\t\tconst loaded = /\\.[cm]?js$/.test(filename)\n\t\t\t? await loader.evalModule(await readFile(filename, \"utf8\"), { filename, async: true, forceTranspile: true })\n\t\t\t: await loader.import<StorageAdapterModule>(specifier, { default: true });\n\t\tconst adapter = ((loaded as { default?: StorageAdapterModule })?.default ?? loaded) as StorageAdapterModule;\n\t\tif (\n\t\t\tadapter === null ||\n\t\t\ttypeof adapter !== \"object\" ||\n\t\t\tadapter.atomicStorageAdapter !== 1 ||\n\t\t\t[adapter.openDatabase, adapter.openSessionStore, adapter.openRunJournal].some(\n\t\t\t\t(hook) => hook !== undefined && typeof hook !== \"function\",\n\t\t\t)\n\t\t) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"adapter\", \"invalid-module-contract\");\n\t\t}\n\t\treturn adapter;\n\t} catch (cause) {\n\t\tthrow new StorageAdapterLoadError(module, cause as StorageFailureCause);\n\t}\n}\n\n/** The adapter's options with every `secrets` reference resolved, as the provider passes them to its hooks. */\nexport async function resolveAdapterOptions(\n\tselection: Extract<StorageSelection, { kind: \"adapter\" }>,\n\tcontext: StorageOpenContext,\n): Promise<AdapterOptions> {\n\tconst options = { ...selection.options };\n\tfor (const [name, ref] of Object.entries(selection.secrets ?? {})) {\n\t\tlet value: string;\n\t\tif (\"env\" in ref) {\n\t\t\tconst environment = process.env[ref.env];\n\t\t\tif (environment === undefined) throw new StorageConfigError(\"sdk\", `secrets.${name}`, \"secret-env-missing\");\n\t\t\tvalue = environment;\n\t\t} else {\n\t\t\tlet text: string;\n\t\t\ttry {\n\t\t\t\ttext = await readFile(isAbsolute(ref.file) ? ref.file : join(dirname(context.agentDir), ref.file), \"utf8\");\n\t\t\t} catch (cause) {\n\t\t\t\tthrow new StorageUnavailableError(\n\t\t\t\t\t{ adapter: selection.module, location: ref.file },\n\t\t\t\t\tcause as StorageFailureCause,\n\t\t\t\t);\n\t\t\t}\n\t\t\tvalue = text.endsWith(\"\\r\\n\") ? text.slice(0, -2) : text.endsWith(\"\\n\") ? text.slice(0, -1) : text;\n\t\t}\n\t\tObject.defineProperty(options, name, { value, enumerable: true, writable: true, configurable: true });\n\t}\n\treturn options;\n}\n\nfunction withIdempotentClose<T extends { close(): Promise<void> }>(store: T, release?: () => Promise<void>): T {\n\tconst close = store.close.bind(store);\n\tlet closing: Promise<void> | undefined;\n\tstore.close = () => {\n\t\tclosing ??= (async () => {\n\t\t\ttry {\n\t\t\t\tawait close();\n\t\t\t} finally {\n\t\t\t\tawait release?.();\n\t\t\t}\n\t\t})();\n\t\treturn closing;\n\t};\n\treturn store;\n}\n\ninterface SharedDatabase {\n\treadonly ready: Promise<SqliteDatabase>;\n\treferences: number;\n}\n\nconst sharedDatabases = new Map<string, SharedDatabase>();\n\nexport interface StorageProvider {\n\topenSessionStore(selection: StorageSelection, context: StorageOpenContext): Promise<SessionStore>;\n\topenRunJournal(selection: StorageSelection, context: StorageOpenContext): Promise<RunJournal>;\n}\n\nexport const StorageProvider: new (journals?: JournalFactories) => StorageProvider = class {\n\tprivate readonly journals?: JournalFactories;\n\tprivate readonly databases = sharedDatabases;\n\n\tconstructor(journals?: JournalFactories) {\n\t\tthis.journals = journals;\n\t}\n\n\tasync openSessionStore(selection: StorageSelection, context: StorageOpenContext): Promise<SessionStore> {\n\t\treturn this.open<SessionStore>(selection, context, {\n\t\t\tmemory: async () =>\n\t\t\t\tnew (await import(\"./session/memory-session-store.js\")).MemorySessionStore(createSessionCwdMatcher),\n\t\t\tjsonl: async (dir) =>\n\t\t\t\t(await import(\"./session/jsonl-session-store.js\")).JsonlSessionStore.open(dir, { exactDirectory: true }),\n\t\t\tdirect: (adapter, options, storage) => adapter.openSessionStore?.(options, context, storage),\n\t\t\tsql: async (database, options) =>\n\t\t\t\t(await import(\"./session/sql-session-store.js\")).SqlSessionStore.open(database, {\n\t\t\t\t\t...options,\n\t\t\t\t\tcwdMatcher: createSessionCwdMatcher,\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tasync openRunJournal(selection: StorageSelection, context: StorageOpenContext): Promise<RunJournal> {\n\t\tconst journals = this.journals;\n\t\tif (!journals) throw new StorageConfigError(\"sdk\", \"journal\", \"adapter-domain-unsupported\");\n\t\treturn this.open<RunJournal>(selection, context, {\n\t\t\tmemory: () => journals.memory({ adapter: \"memory\", location: \":memory:\" }),\n\t\t\tdirect: (adapter, options, storage) => adapter.openRunJournal?.(options, context, storage),\n\t\t\tsql: async (database, options) => {\n\t\t\t\tconst journal = await journals.sql(database, options);\n\t\t\t\tconst createRun = journal.createRun.bind(journal);\n\t\t\t\tjournal.createRun = (header) => createRun({ ...header, storage: { ...database.descriptor } });\n\t\t\t\treturn journal;\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate async open<T extends { close(): Promise<void> }>(\n\t\tselection: StorageSelection,\n\t\tcontext: StorageOpenContext,\n\t\tfactories: {\n\t\t\tmemory(): T | Promise<T>;\n\t\t\tjsonl?(dir: string): Promise<T>;\n\t\t\tdirect(\n\t\t\t\tadapter: StorageAdapterModule,\n\t\t\t\toptions: AdapterOptions,\n\t\t\t\tstorage: { readonly prefix?: string },\n\t\t\t): Promise<T> | undefined;\n\t\t\tsql(database: SqliteDatabase, options: { readonly prefix?: string }): Promise<T>;\n\t\t},\n\t): Promise<T> {\n\t\tif (selection === null || typeof selection !== \"object\" || Array.isArray(selection)) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"selection-object-required\");\n\t\t}\n\t\tif (![\"memory\", \"jsonl\", \"sqlite\", \"database\", \"adapter\"].includes(selection.kind)) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"invalid-kind\");\n\t\t}\n\t\tconst selector = { memory: undefined, jsonl: \"dir\", sqlite: \"path\", database: \"database\", adapter: \"module\" }[\n\t\t\tselection.kind\n\t\t];\n\t\tif (\n\t\t\t[\"path\", \"dir\", \"database\", \"module\", \"memory\", \"adapter\"].some((key) => key in selection && key !== selector)\n\t\t) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"multiple-selection-forms\");\n\t\t}\n\t\tif (selection.kind === \"sqlite\" && typeof selection.path !== \"string\") {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"invalid-path\");\n\t\t}\n\t\tif (selection.kind === \"adapter\" && (typeof selection.module !== \"string\" || selection.module.length === 0)) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"invalid-adapter\");\n\t\t}\n\t\tif (selection.kind === \"database\" && !(\"database\" in selection)) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"async-database-required\");\n\t\t}\n\t\tif (selection.kind === \"sqlite\" || selection.kind === \"database\" || selection.kind === \"adapter\") {\n\t\t\tselectStorage(\n\t\t\t\tselection.kind === \"adapter\" ? { ...selection, adapter: selection.module } : selection,\n\t\t\t\t\"sdk\",\n\t\t\t\t\"storage\",\n\t\t\t\t\"\",\n\t\t\t);\n\t\t}\n\t\tif (selection.kind === \"memory\") return withIdempotentClose(await factories.memory());\n\t\tif (selection.kind === \"jsonl\") {\n\t\t\tif (typeof selection.dir !== \"string\") throw new StorageConfigError(\"sdk\", \"dir\", \"invalid-dir\");\n\t\t\tif (factories.jsonl) return withIdempotentClose(await factories.jsonl(selection.dir));\n\t\t\tthrow new StorageConfigError(\"sdk\", \"dir\", \"adapter-domain-unsupported\");\n\t\t}\n\t\tvalidateStoragePrefix(selection.prefix);\n\t\tlet openDatabase: () => Promise<SqliteDatabase>;\n\t\tif (selection.kind === \"adapter\") {\n\t\t\tconst adapter = await loadStorageAdapter(selection.module, context);\n\t\t\tconst options = await resolveAdapterOptions(selection, context);\n\t\t\ttry {\n\t\t\t\tconst direct = factories.direct(adapter, options, { prefix: selection.prefix });\n\t\t\t\tif (direct !== undefined) return withIdempotentClose(await direct);\n\t\t\t} catch (cause) {\n\t\t\t\tif (cause instanceof StorageError) throw cause;\n\t\t\t\tthrow new StorageUnavailableError(\n\t\t\t\t\t{ adapter: selection.module, location: selection.module },\n\t\t\t\t\tcause as StorageFailureCause,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!adapter.openDatabase) throw new StorageConfigError(\"sdk\", \"adapter\", \"adapter-domain-unsupported\");\n\t\t\tconst hook = adapter.openDatabase.bind(adapter);\n\t\t\topenDatabase = async () => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await hook(options, context);\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tif (cause instanceof StorageError) throw cause;\n\t\t\t\t\tthrow new StorageUnavailableError(\n\t\t\t\t\t\t{ adapter: selection.module, location: selection.module },\n\t\t\t\t\t\tcause as StorageFailureCause,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t};\n\t\t} else if (selection.kind === \"database\") {\n\t\t\treturn withIdempotentClose(await factories.sql(selection.database, { prefix: selection.prefix }));\n\t\t} else {\n\t\t\topenDatabase = () => openNodeSqliteDatabase(selection.path);\n\t\t}\n\t\tconst key = storageSelectionKey({ ...selection, prefix: undefined }, context.agentDir);\n\t\tlet shared = this.databases.get(key);\n\t\tif (!shared) {\n\t\t\tshared = { ready: openDatabase(), references: 0 };\n\t\t\tthis.databases.set(key, shared);\n\t\t}\n\t\tshared.references++;\n\t\tconst entry = shared;\n\t\tlet database: SqliteDatabase;\n\t\ttry {\n\t\t\tdatabase = await entry.ready;\n\t\t} catch (cause) {\n\t\t\tif (this.databases.get(key) === entry) this.databases.delete(key);\n\t\t\tthrow cause;\n\t\t}\n\t\tconst release = async () => {\n\t\t\tif (--entry.references === 0) {\n\t\t\t\tif (this.databases.get(key) === entry) this.databases.delete(key);\n\t\t\t\tawait database.close();\n\t\t\t}\n\t\t};\n\t\ttry {\n\t\t\treturn withIdempotentClose(await factories.sql(database, { prefix: selection.prefix }), release);\n\t\t} catch (cause) {\n\t\t\ttry {\n\t\t\t\tawait release();\n\t\t\t} catch (cleanupCause) {\n\t\t\t\tconst openingError =\n\t\t\t\t\tcause instanceof Error\n\t\t\t\t\t\t? cause\n\t\t\t\t\t\t: new StorageUnavailableError(database.descriptor, cause as StorageFailureCause);\n\t\t\t\tObject.defineProperty(openingError, \"cleanupCause\", { value: cleanupCause, configurable: true });\n\t\t\t\tthrow openingError;\n\t\t\t}\n\t\t\tthrow cause;\n\t\t}\n\t}\n};\n"]}
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/core/storage/provider.ts"],"names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ACb,CAAC;IACF,CAAC;CACD,CAAC","sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { createSessionCwdMatcher } from \"../../utils/canonical-path.ts\";\nimport type { SqliteDatabase, SqliteValue, StorageDescriptor } from \"./database.js\";\nimport {\n\tStorageAdapterLoadError,\n\tStorageConfigError,\n\tStorageError,\n\ttype StorageFailureCause,\n\tStorageUnavailableError,\n} from \"./errors.js\";\nimport { openNodeSqliteDatabase } from \"./node-sqlite.js\";\nimport { validateStoragePrefix } from \"./prefix.js\";\nimport type { RunJournal } from \"./run-journal.js\";\nimport { selectStorage } from \"./selection.js\";\nimport type { SessionStore } from \"./session/types.js\";\n\nexport type SecretRef = { readonly env: string } | { readonly file: string };\nexport type AdapterOptions = Readonly<Record<string, SqliteValue | boolean>>;\nexport type RunJournalOption =\n\t| { path: string; prefix?: string }\n\t| { database: SqliteDatabase; prefix?: string }\n\t| { memory: true }\n\t| { adapter: string; options?: AdapterOptions; secrets?: Readonly<Record<string, SecretRef>>; prefix?: string }\n\t| RunJournal;\nexport type StorageSelection =\n\t| { readonly kind: \"memory\" }\n\t| { readonly kind: \"jsonl\"; readonly dir: string }\n\t| { readonly kind: \"sqlite\"; readonly path: string; readonly prefix?: string }\n\t| { readonly kind: \"database\"; readonly database: SqliteDatabase; readonly prefix?: string }\n\t| {\n\t\t\treadonly kind: \"adapter\";\n\t\t\treadonly module: string;\n\t\t\treadonly options?: AdapterOptions;\n\t\t\treadonly secrets?: Readonly<Record<string, SecretRef>>;\n\t\t\treadonly prefix?: string;\n\t };\nexport interface StorageOpenContext {\n\treadonly agentDir: string;\n\t/** `intercom`: the shared Intercom broker state that multi-node brokers open on the top-level selection. */\n\treadonly domain: \"sessions\" | \"journal\" | \"intercom\";\n\treadonly signal?: AbortSignal;\n}\nexport interface StorageAdapterModule {\n\treadonly atomicStorageAdapter: 1;\n\topenDatabase?(options: AdapterOptions, context: StorageOpenContext): Promise<SqliteDatabase>;\n\topenSessionStore?(\n\t\toptions: AdapterOptions,\n\t\tcontext: StorageOpenContext,\n\t\tstorage: { readonly prefix?: string },\n\t): Promise<SessionStore>;\n\topenRunJournal?(\n\t\toptions: AdapterOptions,\n\t\tcontext: StorageOpenContext,\n\t\tstorage: { readonly prefix?: string },\n\t): Promise<RunJournal>;\n}\nexport interface JournalFactories {\n\tmemory(descriptor: StorageDescriptor): RunJournal;\n\tsql(database: SqliteDatabase, options: { readonly prefix?: string }): Promise<RunJournal>;\n\t/** Live modules a journal adapter imports by specifier, such as the running `@bastani/atomic/workflows`. */\n\treadonly hostModules?: Readonly<Record<string, object>>;\n}\n\nconst databaseIds = new WeakMap<SqliteDatabase, number>();\nlet nextDatabaseId = 0;\n\nfunction storageOptionKey(\n\tvalue: SqliteValue | boolean,\n): readonly [string, string | boolean | readonly number[] | null] {\n\tif (value instanceof Uint8Array) return [\"bytes\", Array.from(value)];\n\tif (value === null) return [\"null\", null];\n\tif (typeof value === \"number\") return [\"number\", Object.is(value, -0) ? \"-0\" : String(value)];\n\tif (typeof value === \"bigint\") return [\"bigint\", String(value)];\n\treturn [typeof value, value];\n}\n\nexport function storageSelectionKey(selection: StorageSelection, agentDir?: string): string {\n\tif (selection.kind === \"database\") {\n\t\tlet id = databaseIds.get(selection.database);\n\t\tif (id === undefined) {\n\t\t\tid = ++nextDatabaseId;\n\t\t\tdatabaseIds.set(selection.database, id);\n\t\t}\n\t\treturn JSON.stringify([\"database\", id, selection.prefix ?? \"\"]);\n\t}\n\tif (selection.kind === \"sqlite\") {\n\t\tconst path = selection.path === \"\" || selection.path === \":memory:\" ? selection.path : resolve(selection.path);\n\t\treturn JSON.stringify([\"sqlite\", path, selection.prefix ?? \"\"]);\n\t}\n\tif (selection.kind === \"adapter\") {\n\t\tconst options = Object.entries(selection.options ?? {})\n\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t.map(([name, value]) => [name, storageOptionKey(value)]);\n\t\tconst secrets = Object.entries(selection.secrets ?? {}).sort(([a], [b]) => a.localeCompare(b));\n\t\treturn JSON.stringify([\"adapter\", agentDir, selection.module, options, secrets, selection.prefix ?? \"\"]);\n\t}\n\treturn JSON.stringify(selection);\n}\n\n/**\n * Loads an adapter module the way the extension loader loads extensions: `@bastani/atomic/storage` (and\n * `@bastani/atomic`) resolve to this host's own modules, so adapters need no installed copy of Atomic and share its\n * error classes. `hostModules` adds live modules by specifier; run journals pass the running\n * `@bastani/atomic/workflows`. A package name selects an adapter listed by an installed Atomic package; other\n * specifiers, and package names no installed package lists, resolve from the agent directory.\n */\nexport async function loadStorageAdapter(\n\tmodule: string,\n\tcontext: StorageOpenContext,\n\thostModules: Readonly<Record<string, object>> = {},\n): Promise<StorageAdapterModule> {\n\ttry {\n\t\tconst [{ createHostModuleJiti }, { getStorageAdapterHostModules }, { resolvePackageStorageAdapter }] =\n\t\t\tawait Promise.all([\n\t\t\t\timport(\"../extensions/loader-virtual-modules.js\"),\n\t\t\t\timport(\"../extensions/loader-host-modules.js\"),\n\t\t\t\timport(\"../package-manager-storage-adapters.js\"),\n\t\t\t]);\n\t\tconst loader = await createHostModuleJiti(\n\t\t\tpathToFileURL(join(context.agentDir, \"storage-adapter.js\")).href,\n\t\t\t{ ...(await getStorageAdapterHostModules()), ...hostModules },\n\t\t\t// JS adapters must also pass through virtual host modules, not native-import a second host copy.\n\t\t\t{ interopDefault: true, tryNative: false },\n\t\t);\n\t\tconst specifier = (await resolvePackageStorageAdapter(module, context.agentDir)) ?? module;\n\t\tconst location = loader.esmResolve(specifier);\n\t\tconst filename = location.startsWith(\"file:\") ? fileURLToPath(location) : location;\n\t\t// jiti's async JS fast path uses native import even with tryNative:false. Force only JS entrypoints\n\t\t// through its transform so their host imports use the live virtual modules, just like TS adapters.\n\t\tconst loaded = /\\.[cm]?js$/.test(filename)\n\t\t\t? await loader.evalModule(await readFile(filename, \"utf8\"), { filename, async: true, forceTranspile: true })\n\t\t\t: await loader.import<StorageAdapterModule>(specifier, { default: true });\n\t\tconst adapter = ((loaded as { default?: StorageAdapterModule })?.default ?? loaded) as StorageAdapterModule;\n\t\tif (\n\t\t\tadapter === null ||\n\t\t\ttypeof adapter !== \"object\" ||\n\t\t\tadapter.atomicStorageAdapter !== 1 ||\n\t\t\t[adapter.openDatabase, adapter.openSessionStore, adapter.openRunJournal].some(\n\t\t\t\t(hook) => hook !== undefined && typeof hook !== \"function\",\n\t\t\t)\n\t\t) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"adapter\", \"invalid-module-contract\");\n\t\t}\n\t\treturn adapter;\n\t} catch (cause) {\n\t\tthrow new StorageAdapterLoadError(module, cause as StorageFailureCause);\n\t}\n}\n\n/** The adapter's options with every `secrets` reference resolved, as the provider passes them to its hooks. */\nexport async function resolveAdapterOptions(\n\tselection: Extract<StorageSelection, { kind: \"adapter\" }>,\n\tcontext: StorageOpenContext,\n): Promise<AdapterOptions> {\n\tconst options = { ...selection.options };\n\tfor (const [name, ref] of Object.entries(selection.secrets ?? {})) {\n\t\tlet value: string;\n\t\tif (\"env\" in ref) {\n\t\t\tconst environment = process.env[ref.env];\n\t\t\tif (environment === undefined) throw new StorageConfigError(\"sdk\", `secrets.${name}`, \"secret-env-missing\");\n\t\t\tvalue = environment;\n\t\t} else {\n\t\t\tlet text: string;\n\t\t\ttry {\n\t\t\t\ttext = await readFile(isAbsolute(ref.file) ? ref.file : join(dirname(context.agentDir), ref.file), \"utf8\");\n\t\t\t} catch (cause) {\n\t\t\t\tthrow new StorageUnavailableError(\n\t\t\t\t\t{ adapter: selection.module, location: ref.file },\n\t\t\t\t\tcause as StorageFailureCause,\n\t\t\t\t);\n\t\t\t}\n\t\t\tvalue = text.endsWith(\"\\r\\n\") ? text.slice(0, -2) : text.endsWith(\"\\n\") ? text.slice(0, -1) : text;\n\t\t}\n\t\tObject.defineProperty(options, name, { value, enumerable: true, writable: true, configurable: true });\n\t}\n\treturn options;\n}\n\nfunction withIdempotentClose<T extends { close(): Promise<void> }>(store: T, release?: () => Promise<void>): T {\n\tconst close = store.close.bind(store);\n\tlet closing: Promise<void> | undefined;\n\tstore.close = () => {\n\t\tclosing ??= (async () => {\n\t\t\ttry {\n\t\t\t\tawait close();\n\t\t\t} finally {\n\t\t\t\tawait release?.();\n\t\t\t}\n\t\t})();\n\t\treturn closing;\n\t};\n\treturn store;\n}\n\ninterface SharedDatabase {\n\treadonly ready: Promise<SqliteDatabase>;\n\treferences: number;\n}\n\nconst sharedDatabases = new Map<string, SharedDatabase>();\n\nexport interface StorageProvider {\n\topenSessionStore(selection: StorageSelection, context: StorageOpenContext): Promise<SessionStore>;\n\topenRunJournal(selection: StorageSelection, context: StorageOpenContext): Promise<RunJournal>;\n}\n\nexport const StorageProvider: new (journals?: JournalFactories) => StorageProvider = class {\n\tprivate readonly journals?: JournalFactories;\n\tprivate readonly databases = sharedDatabases;\n\n\tconstructor(journals?: JournalFactories) {\n\t\tthis.journals = journals;\n\t}\n\n\tasync openSessionStore(selection: StorageSelection, context: StorageOpenContext): Promise<SessionStore> {\n\t\treturn this.open<SessionStore>(selection, context, {\n\t\t\tmemory: async () =>\n\t\t\t\tnew (await import(\"./session/memory-session-store.js\")).MemorySessionStore(createSessionCwdMatcher),\n\t\t\tjsonl: async (dir) =>\n\t\t\t\t(await import(\"./session/jsonl-session-store.js\")).JsonlSessionStore.open(dir, { exactDirectory: true }),\n\t\t\tdirect: (adapter, options, storage) => adapter.openSessionStore?.(options, context, storage),\n\t\t\tsql: async (database, options) =>\n\t\t\t\t(await import(\"./session/sql-session-store.js\")).SqlSessionStore.open(database, {\n\t\t\t\t\t...options,\n\t\t\t\t\tcwdMatcher: createSessionCwdMatcher,\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tasync openRunJournal(selection: StorageSelection, context: StorageOpenContext): Promise<RunJournal> {\n\t\tconst journals = this.journals;\n\t\tif (!journals) throw new StorageConfigError(\"sdk\", \"journal\", \"adapter-domain-unsupported\");\n\t\treturn this.open<RunJournal>(selection, context, {\n\t\t\tmemory: () => journals.memory({ adapter: \"memory\", location: \":memory:\" }),\n\t\t\thostModules: journals.hostModules,\n\t\t\tdirect: (adapter, options, storage) => adapter.openRunJournal?.(options, context, storage),\n\t\t\tsql: async (database, options) => {\n\t\t\t\tconst journal = await journals.sql(database, options);\n\t\t\t\tconst createRun = journal.createRun.bind(journal);\n\t\t\t\tjournal.createRun = (header) => createRun({ ...header, storage: { ...database.descriptor } });\n\t\t\t\treturn journal;\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate async open<T extends { close(): Promise<void> }>(\n\t\tselection: StorageSelection,\n\t\tcontext: StorageOpenContext,\n\t\tfactories: {\n\t\t\tmemory(): T | Promise<T>;\n\t\t\tjsonl?(dir: string): Promise<T>;\n\t\t\tdirect(\n\t\t\t\tadapter: StorageAdapterModule,\n\t\t\t\toptions: AdapterOptions,\n\t\t\t\tstorage: { readonly prefix?: string },\n\t\t\t): Promise<T> | undefined;\n\t\t\thostModules?: Readonly<Record<string, object>>;\n\t\t\tsql(database: SqliteDatabase, options: { readonly prefix?: string }): Promise<T>;\n\t\t},\n\t): Promise<T> {\n\t\tif (selection === null || typeof selection !== \"object\" || Array.isArray(selection)) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"selection-object-required\");\n\t\t}\n\t\tif (![\"memory\", \"jsonl\", \"sqlite\", \"database\", \"adapter\"].includes(selection.kind)) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"invalid-kind\");\n\t\t}\n\t\tconst selector = { memory: undefined, jsonl: \"dir\", sqlite: \"path\", database: \"database\", adapter: \"module\" }[\n\t\t\tselection.kind\n\t\t];\n\t\tif (\n\t\t\t[\"path\", \"dir\", \"database\", \"module\", \"memory\", \"adapter\"].some((key) => key in selection && key !== selector)\n\t\t) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"multiple-selection-forms\");\n\t\t}\n\t\tif (selection.kind === \"sqlite\" && typeof selection.path !== \"string\") {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"invalid-path\");\n\t\t}\n\t\tif (selection.kind === \"adapter\" && (typeof selection.module !== \"string\" || selection.module.length === 0)) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"invalid-adapter\");\n\t\t}\n\t\tif (selection.kind === \"database\" && !(\"database\" in selection)) {\n\t\t\tthrow new StorageConfigError(\"sdk\", \"storage\", \"async-database-required\");\n\t\t}\n\t\tif (selection.kind === \"sqlite\" || selection.kind === \"database\" || selection.kind === \"adapter\") {\n\t\t\tselectStorage(\n\t\t\t\tselection.kind === \"adapter\" ? { ...selection, adapter: selection.module } : selection,\n\t\t\t\t\"sdk\",\n\t\t\t\t\"storage\",\n\t\t\t\t\"\",\n\t\t\t);\n\t\t}\n\t\tif (selection.kind === \"memory\") return withIdempotentClose(await factories.memory());\n\t\tif (selection.kind === \"jsonl\") {\n\t\t\tif (typeof selection.dir !== \"string\") throw new StorageConfigError(\"sdk\", \"dir\", \"invalid-dir\");\n\t\t\tif (factories.jsonl) return withIdempotentClose(await factories.jsonl(selection.dir));\n\t\t\tthrow new StorageConfigError(\"sdk\", \"dir\", \"adapter-domain-unsupported\");\n\t\t}\n\t\tvalidateStoragePrefix(selection.prefix);\n\t\tlet openDatabase: () => Promise<SqliteDatabase>;\n\t\tif (selection.kind === \"adapter\") {\n\t\t\tconst adapter = await loadStorageAdapter(selection.module, context, factories.hostModules);\n\t\t\tconst options = await resolveAdapterOptions(selection, context);\n\t\t\ttry {\n\t\t\t\tconst direct = factories.direct(adapter, options, { prefix: selection.prefix });\n\t\t\t\tif (direct !== undefined) return withIdempotentClose(await direct);\n\t\t\t} catch (cause) {\n\t\t\t\tif (cause instanceof StorageError) throw cause;\n\t\t\t\tthrow new StorageUnavailableError(\n\t\t\t\t\t{ adapter: selection.module, location: selection.module },\n\t\t\t\t\tcause as StorageFailureCause,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!adapter.openDatabase) throw new StorageConfigError(\"sdk\", \"adapter\", \"adapter-domain-unsupported\");\n\t\t\tconst hook = adapter.openDatabase.bind(adapter);\n\t\t\topenDatabase = async () => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await hook(options, context);\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tif (cause instanceof StorageError) throw cause;\n\t\t\t\t\tthrow new StorageUnavailableError(\n\t\t\t\t\t\t{ adapter: selection.module, location: selection.module },\n\t\t\t\t\t\tcause as StorageFailureCause,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t};\n\t\t} else if (selection.kind === \"database\") {\n\t\t\treturn withIdempotentClose(await factories.sql(selection.database, { prefix: selection.prefix }));\n\t\t} else {\n\t\t\topenDatabase = () => openNodeSqliteDatabase(selection.path);\n\t\t}\n\t\tconst key = storageSelectionKey({ ...selection, prefix: undefined }, context.agentDir);\n\t\tlet shared = this.databases.get(key);\n\t\tif (!shared) {\n\t\t\tshared = { ready: openDatabase(), references: 0 };\n\t\t\tthis.databases.set(key, shared);\n\t\t}\n\t\tshared.references++;\n\t\tconst entry = shared;\n\t\tlet database: SqliteDatabase;\n\t\ttry {\n\t\t\tdatabase = await entry.ready;\n\t\t} catch (cause) {\n\t\t\tif (this.databases.get(key) === entry) this.databases.delete(key);\n\t\t\tthrow cause;\n\t\t}\n\t\tconst release = async () => {\n\t\t\tif (--entry.references === 0) {\n\t\t\t\tif (this.databases.get(key) === entry) this.databases.delete(key);\n\t\t\t\tawait database.close();\n\t\t\t}\n\t\t};\n\t\ttry {\n\t\t\treturn withIdempotentClose(await factories.sql(database, { prefix: selection.prefix }), release);\n\t\t} catch (cause) {\n\t\t\ttry {\n\t\t\t\tawait release();\n\t\t\t} catch (cleanupCause) {\n\t\t\t\tconst openingError =\n\t\t\t\t\tcause instanceof Error\n\t\t\t\t\t\t? cause\n\t\t\t\t\t\t: new StorageUnavailableError(database.descriptor, cause as StorageFailureCause);\n\t\t\t\tObject.defineProperty(openingError, \"cleanupCause\", { value: cleanupCause, configurable: true });\n\t\t\t\tthrow openingError;\n\t\t\t}\n\t\t\tthrow cause;\n\t\t}\n\t}\n};\n"]}
|
|
@@ -67,6 +67,29 @@ export type AppendOutcome = {
|
|
|
67
67
|
readonly status: "appended" | "exists";
|
|
68
68
|
readonly entry: JournalEntry;
|
|
69
69
|
};
|
|
70
|
+
/** A run's latest event. A run whose history was deleted and recorded again ends with a different event. */
|
|
71
|
+
export interface RunVersion {
|
|
72
|
+
readonly seq: number;
|
|
73
|
+
readonly at: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A run's latest snapshot event (one carrying the run's handle) and the checkpoints recorded after it: enough to
|
|
77
|
+
* list the run in a catalog without reading its history.
|
|
78
|
+
*/
|
|
79
|
+
export interface RunSnapshotTail {
|
|
80
|
+
/** The run's latest event of any type. */
|
|
81
|
+
readonly version: RunVersion;
|
|
82
|
+
readonly snapshot: JournalEntry;
|
|
83
|
+
readonly laterCheckpoints: number;
|
|
84
|
+
/** `completedAt` of the last of `laterCheckpoints`. */
|
|
85
|
+
readonly lastCheckpointAt?: number;
|
|
86
|
+
}
|
|
87
|
+
/** One append of a batch. `context` runs a function in the async context the append was issued from. */
|
|
88
|
+
export interface RunJournalBatchAppend {
|
|
89
|
+
readonly event: RunEvent;
|
|
90
|
+
readonly key?: string;
|
|
91
|
+
readonly context: <R>(action: () => R) => R;
|
|
92
|
+
}
|
|
70
93
|
export interface RunJournal {
|
|
71
94
|
createRun(header: RunHeader): Promise<"created" | "exists">;
|
|
72
95
|
getRun(runId: string): Promise<RunSummary | undefined>;
|
|
@@ -88,6 +111,17 @@ export interface RunJournal {
|
|
|
88
111
|
deleteOwnedRun(lease: Lease, expectSeq?: number): Promise<void>;
|
|
89
112
|
deleteRun(runId: string): Promise<void>;
|
|
90
113
|
close(): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Optional change tracking, used only when `changeToken`, `runVersions` and `snapshotTail` are all present. The
|
|
116
|
+
* token moves whenever any connection, in this process or another, commits a change to the journal's store.
|
|
117
|
+
*/
|
|
118
|
+
changeToken?(): Promise<string>;
|
|
119
|
+
/** Every listed run with its latest event; a run with no events has version `{ seq: 0, at: 0 }`. */
|
|
120
|
+
runVersions?(): Promise<ReadonlyMap<string, RunVersion>>;
|
|
121
|
+
/** Undefined for a run with no snapshot event. */
|
|
122
|
+
snapshotTail?(runId: string): Promise<RunSnapshotTail | undefined>;
|
|
123
|
+
/** Optional batched appends to one run in one transaction; each append is settled on its own, in order. */
|
|
124
|
+
appendMany?(lease: Lease, appends: readonly RunJournalBatchAppend[]): Promise<readonly PromiseSettledResult<AppendOutcome>[]>;
|
|
91
125
|
}
|
|
92
126
|
export {};
|
|
93
127
|
//# sourceMappingURL=run-journal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-journal.d.ts","sourceRoot":"","sources":["../../../src/core/storage/run-journal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,eAAO,MAAM,eAAe;aAC3B,UAAU,EAAE,YAAY;aACxB,WAAW,EAAE,aAAa;aAC1B,aAAa,EAAE,eAAe;aAC9B,kBAAkB,EAAE,oBAAoB;aACxC,WAAW,EAAE,aAAa;aAC1B,cAAc,EAAE,gBAAgB;aAChC,gBAAgB,EAAE,kBAAkB;aACpC,aAAa,EAAE,eAAe;aAC9B,gBAAgB,EAAE,kBAAkB;aACpC,cAAc,EAAE,gBAAgB;aAChC,cAAc,EAAE,gBAAgB;aAChC,eAAe,EAAE,iBAAiB;CACzB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAElF,MAAM,MAAM,wBAAwB,GACjC,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,wBAAwB,EAAE,GACnC;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,wBAAwB,GAAG,S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