@poe-platform/safe-js 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +206 -0
- package/dist/agent-defs/agents/claude-code.d.ts +2 -0
- package/dist/agent-defs/agents/claude-desktop.d.ts +2 -0
- package/dist/agent-defs/agents/codex.d.ts +2 -0
- package/dist/agent-defs/agents/cursor.d.ts +2 -0
- package/dist/agent-defs/agents/gemini-cli.d.ts +2 -0
- package/dist/agent-defs/agents/goose.d.ts +2 -0
- package/dist/agent-defs/agents/index.d.ts +10 -0
- package/dist/agent-defs/agents/kimi.d.ts +2 -0
- package/dist/agent-defs/agents/opencode.d.ts +2 -0
- package/dist/agent-defs/agents/pi.d.ts +2 -0
- package/dist/agent-defs/agents/poe-agent.d.ts +2 -0
- package/dist/agent-defs/capabilities.d.ts +14 -0
- package/dist/agent-defs/index.d.ts +6 -0
- package/dist/agent-defs/registry.d.ts +3 -0
- package/dist/agent-defs/specifier.d.ts +7 -0
- package/dist/agent-defs/types.d.ts +35 -0
- package/dist/agent-harness-tools/binary-exists.d.ts +10 -0
- package/dist/agent-harness-tools/execution-env.d.ts +108 -0
- package/dist/agent-harness-tools/hooks.d.ts +30 -0
- package/dist/agent-harness-tools/index.d.ts +18 -0
- package/dist/agent-harness-tools/log-stream.d.ts +28 -0
- package/dist/agent-harness-tools/participant.d.ts +10 -0
- package/dist/agent-harness-tools/paths.d.ts +14 -0
- package/dist/agent-harness-tools/plan-readiness.d.ts +7 -0
- package/dist/agent-harness-tools/plans.d.ts +35 -0
- package/dist/agent-harness-tools/poe-command-execution.d.ts +37 -0
- package/dist/agent-harness-tools/run-logs.d.ts +17 -0
- package/dist/agent-harness-tools/run-poe-command.d.ts +33 -0
- package/dist/agent-harness-tools/runner.d.ts +33 -0
- package/dist/agent-harness-tools/select-agent.d.ts +18 -0
- package/dist/agent-harness-tools/sequence.d.ts +7 -0
- package/dist/agent-harness-tools/skill-config.d.ts +1 -0
- package/dist/agent-harness-tools/stage.d.ts +22 -0
- package/dist/agent-harness-tools/workspace-transfer.d.ts +3 -0
- package/dist/agent-spawn/acp/middleware.d.ts +38 -0
- package/dist/agent-spawn/acp/types.d.ts +180 -0
- package/dist/agent-spawn/adapters/claude.d.ts +3 -0
- package/dist/agent-spawn/adapters/codex.d.ts +2 -0
- package/dist/agent-spawn/adapters/cursor.d.ts +2 -0
- package/dist/agent-spawn/adapters/index.d.ts +12 -0
- package/dist/agent-spawn/adapters/kimi.d.ts +2 -0
- package/dist/agent-spawn/adapters/native.d.ts +5 -0
- package/dist/agent-spawn/adapters/opencode.d.ts +2 -0
- package/dist/agent-spawn/adapters/pi.d.ts +2 -0
- package/dist/agent-spawn/environment.d.ts +2 -0
- package/dist/agent-spawn/parallel.d.ts +30 -0
- package/dist/agent-spawn/retry.d.ts +26 -0
- package/dist/agent-spawn/types.d.ts +272 -0
- package/dist/auth-store/create-secret-store.d.ts +2 -0
- package/dist/auth-store/encrypted-file-store.d.ts +47 -0
- package/dist/auth-store/index.d.ts +7 -0
- package/dist/auth-store/keychain-store.d.ts +25 -0
- package/dist/auth-store/provider-store.d.ts +14 -0
- package/dist/auth-store/types.d.ts +22 -0
- package/dist/config-mutations/execution/run-mutations.d.ts +7 -0
- package/dist/config-mutations/fs-utils.d.ts +18 -0
- package/dist/config-mutations/index.d.ts +8 -0
- package/dist/config-mutations/mutations/config-mutation.d.ts +47 -0
- package/dist/config-mutations/mutations/file-mutation.d.ts +62 -0
- package/dist/config-mutations/mutations/template-mutation.d.ts +40 -0
- package/dist/config-mutations/template/render.d.ts +6 -0
- package/dist/config-mutations/types.d.ts +168 -0
- package/dist/poe-code-config/compile/schema-compiler.d.ts +11 -0
- package/dist/poe-code-config/config.d.ts +2 -0
- package/dist/poe-code-config/configured-services.d.ts +29 -0
- package/dist/poe-code-config/index.d.ts +16 -0
- package/dist/poe-code-config/inspect.d.ts +13 -0
- package/dist/poe-code-config/memory.d.ts +14 -0
- package/dist/poe-code-config/merge-callbacks.d.ts +38 -0
- package/dist/poe-code-config/merge.d.ts +2 -0
- package/dist/poe-code-config/plan-scope.d.ts +8 -0
- package/dist/poe-code-config/provider-config.d.ts +16 -0
- package/dist/poe-code-config/resolve.d.ts +2 -0
- package/dist/poe-code-config/runtime.d.ts +114 -0
- package/dist/poe-code-config/schema.d.ts +14 -0
- package/dist/poe-code-config/state/fs.d.ts +24 -0
- package/dist/poe-code-config/state/index.d.ts +12 -0
- package/dist/poe-code-config/state/jobs.d.ts +34 -0
- package/dist/poe-code-config/state/templates.d.ts +18 -0
- package/dist/poe-code-config/store.d.ts +12 -0
- package/dist/poe-code-config/types.d.ts +88 -0
- package/dist/process-runner/docker/build-context.d.ts +5 -0
- package/dist/process-runner/docker/context.d.ts +3 -0
- package/dist/process-runner/docker/docker-execution-env.d.ts +28 -0
- package/dist/process-runner/docker/docker-runner.d.ts +2 -0
- package/dist/process-runner/docker/engine.d.ts +3 -0
- package/dist/process-runner/host/host-execution-env.d.ts +2 -0
- package/dist/process-runner/host/host-runner.d.ts +3 -0
- package/dist/process-runner/index.d.ts +10 -0
- package/dist/process-runner/testing/index.d.ts +2 -0
- package/dist/process-runner/testing/mock-runner.d.ts +3 -0
- package/dist/process-runner/types.d.ts +191 -0
- package/dist/process-runner/workspace-transfer.d.ts +61 -0
- package/dist/providers/auth/api-key.d.ts +5 -0
- package/dist/providers/auth/types.d.ts +14 -0
- package/dist/providers/compatibility.d.ts +4 -0
- package/dist/providers/index.d.ts +8 -0
- package/dist/providers/providers/anthropic.d.ts +1 -0
- package/dist/providers/providers/cloudflare.d.ts +1 -0
- package/dist/providers/providers/generated.d.ts +5 -0
- package/dist/providers/providers/openai.d.ts +1 -0
- package/dist/providers/providers/poe.d.ts +2 -0
- package/dist/providers/registry.d.ts +44 -0
- package/dist/providers/types.d.ts +54 -0
- package/dist/safe-fs/bridge/filesystem.d.ts +88 -0
- package/dist/safe-fs/bridge/index.d.ts +6 -0
- package/dist/safe-fs/bridge/types.d.ts +75 -0
- package/dist/safe-fs/config.d.ts +15 -0
- package/dist/safe-fs/config.node.d.ts +2 -0
- package/dist/safe-fs/contracts/errors.d.ts +50 -0
- package/dist/safe-fs/contracts/filesystem.d.ts +96 -0
- package/dist/safe-fs/contracts/index.d.ts +4 -0
- package/dist/safe-fs/contracts/io.d.ts +8 -0
- package/dist/safe-fs/contracts/path.d.ts +8 -0
- package/dist/safe-fs/contracts/portable-path.d.ts +13 -0
- package/dist/safe-fs/contracts/virtual-path.d.ts +7 -0
- package/dist/safe-fs/core.d.ts +12 -0
- package/dist/safe-fs/fs/memory/index.d.ts +58 -0
- package/dist/safe-fs/fs/mount/comparison.d.ts +19 -0
- package/dist/safe-fs/fs/mount/index.d.ts +44 -0
- package/dist/safe-fs/fs/overlay/index.d.ts +73 -0
- package/dist/safe-fs/fs/readonly/index.d.ts +31 -0
- package/dist/safe-fs/fs/real/index.d.ts +76 -0
- package/dist/safe-fs/fs/s3/filesystem.d.ts +93 -0
- package/dist/safe-fs/fs/s3/http/index.d.ts +2 -0
- package/dist/safe-fs/fs/s3/http/transport.d.ts +3 -0
- package/dist/safe-fs/fs/s3/http/types.d.ts +30 -0
- package/dist/safe-fs/fs/s3/index.d.ts +6 -0
- package/dist/safe-fs/fs/s3/mock.d.ts +48 -0
- package/dist/safe-fs/fs/s3/transport.d.ts +103 -0
- package/dist/safe-fs/fs/webdav/index.d.ts +2 -0
- package/dist/safe-fs/fs/webdav/webdav.d.ts +101 -0
- package/dist/safe-fs/index.d.ts +14 -0
- package/dist/safe-fs/node/filesystem.d.ts +11 -0
- package/dist/safe-fs/node/index.d.ts +2 -0
- package/dist/safe-fs/node-host.d.ts +1 -0
- package/dist/safe-fs/node-unavailable.d.ts +1 -0
- package/dist/safe-fs/platform/browser.d.ts +12 -0
- package/dist/safe-fs/platform/node.d.ts +13 -0
- package/dist/safe-js/browser/chunks/chunk-QGN6DKT5.js +4335 -0
- package/dist/safe-js/browser/chunks/chunk-QGN6DKT5.js.map +7 -0
- package/dist/safe-js/browser/safe-fs-core.js +67 -0
- package/dist/safe-js/browser/safe-fs-core.js.map +7 -0
- package/dist/safe-js/browser/safe-fs.js +67 -0
- package/dist/safe-js/browser/safe-fs.js.map +7 -0
- package/dist/safe-js/chunks/chunk-2QRYPKQQ.js +4315 -0
- package/dist/safe-js/chunks/chunk-2QRYPKQQ.js.map +7 -0
- package/dist/safe-js/chunks/chunk-4YIDX44G.js +40 -0
- package/dist/safe-js/chunks/chunk-4YIDX44G.js.map +7 -0
- package/dist/safe-js/chunks/chunk-7M2SJPSZ.js +2613 -0
- package/dist/safe-js/chunks/chunk-7M2SJPSZ.js.map +7 -0
- package/dist/safe-js/chunks/chunk-DC5B3GYM.js +8248 -0
- package/dist/safe-js/chunks/chunk-DC5B3GYM.js.map +7 -0
- package/dist/safe-js/chunks/chunk-Z3D76J4U.js +30732 -0
- package/dist/safe-js/chunks/chunk-Z3D76J4U.js.map +7 -0
- package/dist/safe-js/cli.d.ts +36 -0
- package/dist/safe-js/cli.js +724 -0
- package/dist/safe-js/cli.js.map +7 -0
- package/dist/safe-js/core.d.ts +6 -0
- package/dist/safe-js/core.js +14 -0
- package/dist/safe-js/core.js.map +7 -0
- package/dist/safe-js/dump.d.ts +2 -0
- package/dist/safe-js/error/format.d.ts +15 -0
- package/dist/safe-js/error/shape.d.ts +28 -0
- package/dist/safe-js/index.d.ts +56 -0
- package/dist/safe-js/index.js +454 -0
- package/dist/safe-js/index.js.map +7 -0
- package/dist/safe-js/interp/arguments.d.ts +10 -0
- package/dist/safe-js/interp/async.d.ts +56 -0
- package/dist/safe-js/interp/budget.d.ts +95 -0
- package/dist/safe-js/interp/exceptions.d.ts +45 -0
- package/dist/safe-js/interp/generator.d.ts +16 -0
- package/dist/safe-js/interp/globals/console-json.d.ts +14 -0
- package/dist/safe-js/interp/host-bridge.d.ts +29 -0
- package/dist/safe-js/interp/host-call.d.ts +130 -0
- package/dist/safe-js/interp/interpreter.d.ts +63 -0
- package/dist/safe-js/interp/promise-replay.d.ts +70 -0
- package/dist/safe-js/interp/regex/compile-guard.d.ts +33 -0
- package/dist/safe-js/interp/regex/parse.d.ts +62 -0
- package/dist/safe-js/interp/scope.d.ts +43 -0
- package/dist/safe-js/interp/values.d.ts +136 -0
- package/dist/safe-js/lint/index.d.ts +38 -0
- package/dist/safe-js/lint/rules/AS-export-import-meta.d.ts +21 -0
- package/dist/safe-js/lint/rules/module-registry.d.ts +33 -0
- package/dist/safe-js/lint.d.ts +1 -0
- package/dist/safe-js/loader/extract-block.d.ts +10 -0
- package/dist/safe-js/loader/find-exported.d.ts +2 -0
- package/dist/safe-js/loader/frontmatter.d.ts +5 -0
- package/dist/safe-js/migrate.d.ts +33 -0
- package/dist/safe-js/migration-file.d.ts +55 -0
- package/dist/safe-js/modules/agent.d.ts +132 -0
- package/dist/safe-js/modules/env.d.ts +14 -0
- package/dist/safe-js/modules/fail.d.ts +6 -0
- package/dist/safe-js/modules/fs-config.d.ts +12 -0
- package/dist/safe-js/modules/fs.d.ts +82 -0
- package/dist/safe-js/modules/harness.d.ts +19 -0
- package/dist/safe-js/modules/log.d.ts +16 -0
- package/dist/safe-js/modules/mcp-transport.d.ts +26 -0
- package/dist/safe-js/modules/mcp.d.ts +63 -0
- package/dist/safe-js/modules/metric.d.ts +4 -0
- package/dist/safe-js/modules/registry.d.ts +16 -0
- package/dist/safe-js/modules/time.d.ts +12 -0
- package/dist/safe-js/observability/otel.d.ts +21 -0
- package/dist/safe-js/output-stream.d.ts +12 -0
- package/dist/safe-js/parse/parse-export.d.ts +36 -0
- package/dist/safe-js/parse/parser.d.ts +356 -0
- package/dist/safe-js/parse/tokenizer.d.ts +26 -0
- package/dist/safe-js/parse.d.ts +4 -0
- package/dist/safe-js/random.d.ts +9 -0
- package/dist/safe-js/restore.d.ts +26 -0
- package/dist/safe-js/run.d.ts +74 -0
- package/dist/safe-js/runner/run-harness.d.ts +32 -0
- package/dist/safe-js/safe-fs-core.js +130 -0
- package/dist/safe-js/safe-fs-core.js.map +7 -0
- package/dist/safe-js/safe-fs-node.js +94 -0
- package/dist/safe-js/safe-fs-node.js.map +7 -0
- package/dist/safe-js/safe-fs.js +94 -0
- package/dist/safe-js/safe-fs.js.map +7 -0
- package/dist/safe-js/snapshot/arguments.d.ts +17 -0
- package/dist/safe-js/snapshot/backend.d.ts +19 -0
- package/dist/safe-js/snapshot/dump-format.d.ts +7 -0
- package/dist/safe-js/snapshot/dump.d.ts +23 -0
- package/dist/safe-js/snapshot/float32array.d.ts +12 -0
- package/dist/safe-js/snapshot/migration.d.ts +35 -0
- package/dist/safe-js/snapshot/policy.d.ts +49 -0
- package/dist/safe-js/snapshot/replay-data.d.ts +71 -0
- package/dist/safe-js/snapshot/validation.d.ts +15 -0
- package/dist/task-list/backends/gh-issues-client.d.ts +19 -0
- package/dist/task-list/backends/gh-issues-sync.d.ts +46 -0
- package/dist/task-list/backends/gh-issues.d.ts +21 -0
- package/dist/task-list/index.d.ts +9 -0
- package/dist/task-list/move.d.ts +2 -0
- package/dist/task-list/open.d.ts +5 -0
- package/dist/task-list/state-machine.d.ts +16 -0
- package/dist/task-list/state.d.ts +29 -0
- package/dist/task-list/types.d.ts +206 -0
- package/dist/tiny-mcp-client/index.d.ts +662 -0
- package/dist/tiny-stdio-mcp-server/content/audio.d.ts +15 -0
- package/dist/tiny-stdio-mcp-server/content/convert.d.ts +16 -0
- package/dist/tiny-stdio-mcp-server/content/file-type.d.ts +11 -0
- package/dist/tiny-stdio-mcp-server/content/file.d.ts +28 -0
- package/dist/tiny-stdio-mcp-server/content/image.d.ts +15 -0
- package/dist/tiny-stdio-mcp-server/content/index.d.ts +7 -0
- package/dist/tiny-stdio-mcp-server/content/mime.d.ts +7 -0
- package/dist/tiny-stdio-mcp-server/content/remote.d.ts +5 -0
- package/dist/tiny-stdio-mcp-server/index.d.ts +9 -0
- package/dist/tiny-stdio-mcp-server/schema.d.ts +20 -0
- package/dist/tiny-stdio-mcp-server/server.d.ts +35 -0
- package/dist/tiny-stdio-mcp-server/types.d.ts +247 -0
- package/dist/toolcraft-design/acp/components.d.ts +19 -0
- package/dist/toolcraft-design/acp/index.d.ts +4 -0
- package/dist/toolcraft-design/acp/writer.d.ts +13 -0
- package/dist/toolcraft-design/components/browser.d.ts +15 -0
- package/dist/toolcraft-design/components/catalog.d.ts +26 -0
- package/dist/toolcraft-design/components/color.d.ts +31 -0
- package/dist/toolcraft-design/components/command-errors.d.ts +18 -0
- package/dist/toolcraft-design/components/detail-card.d.ts +22 -0
- package/dist/toolcraft-design/components/file-changes.d.ts +16 -0
- package/dist/toolcraft-design/components/help-formatter-plain.d.ts +5 -0
- package/dist/toolcraft-design/components/help-formatter.d.ts +50 -0
- package/dist/toolcraft-design/components/inspector-card.d.ts +21 -0
- package/dist/toolcraft-design/components/logger.d.ts +11 -0
- package/dist/toolcraft-design/components/resource-browser.d.ts +21 -0
- package/dist/toolcraft-design/components/symbols.d.ts +12 -0
- package/dist/toolcraft-design/components/table.d.ts +16 -0
- package/dist/toolcraft-design/components/template.d.ts +19 -0
- package/dist/toolcraft-design/components/text.d.ts +16 -0
- package/dist/toolcraft-design/dashboard/buffer.d.ts +25 -0
- package/dist/toolcraft-design/dashboard/components/footer.d.ts +8 -0
- package/dist/toolcraft-design/dashboard/dashboard.d.ts +20 -0
- package/dist/toolcraft-design/dashboard/index.d.ts +8 -0
- package/dist/toolcraft-design/dashboard/should-use-dashboard.d.ts +10 -0
- package/dist/toolcraft-design/dashboard/snapshot.d.ts +10 -0
- package/dist/toolcraft-design/dashboard/terminal.d.ts +37 -0
- package/dist/toolcraft-design/dashboard/types.d.ts +38 -0
- package/dist/toolcraft-design/explorer/events.d.ts +77 -0
- package/dist/toolcraft-design/explorer/index.d.ts +8 -0
- package/dist/toolcraft-design/explorer/keymap.d.ts +31 -0
- package/dist/toolcraft-design/explorer/runtime.d.ts +2 -0
- package/dist/toolcraft-design/explorer/state.d.ts +224 -0
- package/dist/toolcraft-design/index.d.ts +62 -0
- package/dist/toolcraft-design/internal/output-format.d.ts +6 -0
- package/dist/toolcraft-design/internal/strip-ansi.d.ts +1 -0
- package/dist/toolcraft-design/internal/theme-detect.d.ts +12 -0
- package/dist/toolcraft-design/internal/theme-state.d.ts +12 -0
- package/dist/toolcraft-design/prompts/index.d.ts +91 -0
- package/dist/toolcraft-design/prompts/interactive/cancel-symbol.d.ts +2 -0
- package/dist/toolcraft-design/prompts/interactive/select.d.ts +18 -0
- package/dist/toolcraft-design/prompts/primitives/cancel.d.ts +2 -0
- package/dist/toolcraft-design/prompts/primitives/intro.d.ts +1 -0
- package/dist/toolcraft-design/prompts/primitives/log.d.ts +18 -0
- package/dist/toolcraft-design/prompts/primitives/note.d.ts +1 -0
- package/dist/toolcraft-design/prompts/primitives/outro.d.ts +1 -0
- package/dist/toolcraft-design/prompts/primitives/spinner.d.ts +6 -0
- package/dist/toolcraft-design/prompts/theme.d.ts +11 -0
- package/dist/toolcraft-design/screen/screen.d.ts +40 -0
- package/dist/toolcraft-design/screen/style.d.ts +16 -0
- package/dist/toolcraft-design/static/index.d.ts +4 -0
- package/dist/toolcraft-design/static/menu.d.ts +11 -0
- package/dist/toolcraft-design/static/spinner.d.ts +14 -0
- package/dist/toolcraft-design/terminal/driver.d.ts +34 -0
- package/dist/toolcraft-design/terminal/input.d.ts +25 -0
- package/dist/toolcraft-design/terminal-markdown/ast.d.ts +98 -0
- package/dist/toolcraft-design/terminal-markdown/html-renderer.d.ts +7 -0
- package/dist/toolcraft-design/terminal-markdown/index.d.ts +12 -0
- package/dist/toolcraft-design/terminal-markdown/parser.d.ts +5 -0
- package/dist/toolcraft-design/terminal-markdown/plaintext-renderer.d.ts +11 -0
- package/dist/toolcraft-design/terminal-markdown/renderer.d.ts +7 -0
- package/dist/toolcraft-design/tokens/brand.d.ts +5 -0
- package/dist/toolcraft-design/tokens/colors.d.ts +37 -0
- package/dist/toolcraft-design/tokens/index.d.ts +6 -0
- package/dist/toolcraft-design/tokens/spacing.d.ts +6 -0
- package/dist/toolcraft-design/tokens/typography.d.ts +7 -0
- package/dist/toolcraft-design/tokens/widths.d.ts +5 -0
- package/dist/toolcraft-schema/index.d.ts +184 -0
- package/dist/toolcraft-schema/json-schema/index.d.ts +5 -0
- package/dist/toolcraft-schema/json-schema/types.d.ts +33 -0
- package/dist/toolcraft-schema/json-schema-document.d.ts +14 -0
- package/dist/toolcraft-schema/json.d.ts +10 -0
- package/dist/toolcraft-schema/oneof.d.ts +15 -0
- package/dist/toolcraft-schema/record.d.ts +5 -0
- package/dist/toolcraft-schema/union.d.ts +8 -0
- package/dist/toolcraft-schema/validate.d.ts +17 -0
- package/package.json +89 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
export type ConfigPrimitive = string | number | boolean | null;
|
|
2
|
+
export type ConfigValue = ConfigPrimitive | ConfigObject | ConfigArray | Date;
|
|
3
|
+
export interface ConfigObject {
|
|
4
|
+
[key: string]: ConfigValue;
|
|
5
|
+
}
|
|
6
|
+
export type ConfigArray = ConfigValue[];
|
|
7
|
+
export declare function isConfigObject(value: unknown): value is ConfigObject;
|
|
8
|
+
export interface FileSystem {
|
|
9
|
+
readFile(path: string, encoding: "utf8"): Promise<string>;
|
|
10
|
+
writeFile(path: string, content: string, options?: {
|
|
11
|
+
encoding: "utf8";
|
|
12
|
+
flag?: string;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
mkdir(path: string, options?: {
|
|
15
|
+
recursive: boolean;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
18
|
+
unlink(path: string): Promise<void>;
|
|
19
|
+
rm?(path: string, options?: {
|
|
20
|
+
recursive?: boolean;
|
|
21
|
+
force?: boolean;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
stat(path: string): Promise<{
|
|
24
|
+
mode?: number;
|
|
25
|
+
}>;
|
|
26
|
+
lstat(path: string): Promise<{
|
|
27
|
+
isSymbolicLink(): boolean;
|
|
28
|
+
}>;
|
|
29
|
+
readdir(path: string): Promise<string[]>;
|
|
30
|
+
chmod?(path: string, mode: number): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export type TemplateLoader = (templateId: string) => Promise<string>;
|
|
33
|
+
export interface ConfigFormat {
|
|
34
|
+
/** Parse string content into object */
|
|
35
|
+
parse(content: string): ConfigObject;
|
|
36
|
+
/** Serialize object to string (with consistent formatting) */
|
|
37
|
+
serialize(obj: ConfigObject): string;
|
|
38
|
+
/** Serialize an update against original content while preserving comments when possible */
|
|
39
|
+
serializeUpdate?(content: string, current: ConfigObject, next: ConfigObject): string;
|
|
40
|
+
/** Deep merge patch into base, returning new object */
|
|
41
|
+
merge(base: ConfigObject, patch: ConfigObject): ConfigObject;
|
|
42
|
+
/** Remove keys matching shape from object, returning new object */
|
|
43
|
+
prune(obj: ConfigObject, shape: ConfigObject): {
|
|
44
|
+
changed: boolean;
|
|
45
|
+
result: ConfigObject;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface PathMapper {
|
|
49
|
+
/** Map a target directory to a different location (e.g., for isolated configs) */
|
|
50
|
+
mapTargetDirectory(input: {
|
|
51
|
+
targetDirectory: string;
|
|
52
|
+
}): string;
|
|
53
|
+
}
|
|
54
|
+
export interface MutationContext {
|
|
55
|
+
/** Filesystem interface - required */
|
|
56
|
+
fs: FileSystem;
|
|
57
|
+
/** Home directory for ~ expansion - required */
|
|
58
|
+
homeDir: string;
|
|
59
|
+
/** Optional dry-run mode */
|
|
60
|
+
dryRun?: boolean;
|
|
61
|
+
/** Optional observers for logging */
|
|
62
|
+
observers?: MutationObservers;
|
|
63
|
+
/** Required for template mutations */
|
|
64
|
+
templates?: TemplateLoader;
|
|
65
|
+
/** Optional path mapper for redirecting paths (used for isolated configs) */
|
|
66
|
+
pathMapper?: PathMapper;
|
|
67
|
+
}
|
|
68
|
+
export interface MutationOptions {
|
|
69
|
+
[key: string]: unknown;
|
|
70
|
+
}
|
|
71
|
+
export type ValueResolver<T> = T | ((ctx: MutationOptions) => T);
|
|
72
|
+
interface BaseMutation {
|
|
73
|
+
/** Human-readable label for logging */
|
|
74
|
+
label?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface ConfigMergeMutation extends BaseMutation {
|
|
77
|
+
kind: "configMerge";
|
|
78
|
+
target: ValueResolver<string>;
|
|
79
|
+
value: ValueResolver<ConfigObject>;
|
|
80
|
+
format?: "json" | "toml" | "yaml";
|
|
81
|
+
pruneByPrefix?: Record<string, string>;
|
|
82
|
+
}
|
|
83
|
+
export interface ConfigPruneMutation extends BaseMutation {
|
|
84
|
+
kind: "configPrune";
|
|
85
|
+
target: ValueResolver<string>;
|
|
86
|
+
shape: ValueResolver<ConfigObject>;
|
|
87
|
+
format?: "json" | "toml" | "yaml";
|
|
88
|
+
onlyIf?: (doc: ConfigObject, ctx: MutationOptions) => boolean;
|
|
89
|
+
}
|
|
90
|
+
export interface ConfigTransformMutation extends BaseMutation {
|
|
91
|
+
kind: "configTransform";
|
|
92
|
+
target: ValueResolver<string>;
|
|
93
|
+
format?: "json" | "toml" | "yaml";
|
|
94
|
+
transform: (content: ConfigObject, ctx: MutationOptions) => {
|
|
95
|
+
content: ConfigObject | null;
|
|
96
|
+
changed: boolean;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface EnsureDirectoryMutation extends BaseMutation {
|
|
100
|
+
kind: "ensureDirectory";
|
|
101
|
+
path: ValueResolver<string>;
|
|
102
|
+
}
|
|
103
|
+
export interface RemoveDirectoryMutation extends BaseMutation {
|
|
104
|
+
kind: "removeDirectory";
|
|
105
|
+
path: ValueResolver<string>;
|
|
106
|
+
force?: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface RemoveFileMutation extends BaseMutation {
|
|
109
|
+
kind: "removeFile";
|
|
110
|
+
target: ValueResolver<string>;
|
|
111
|
+
whenEmpty?: boolean;
|
|
112
|
+
whenContentMatches?: RegExp;
|
|
113
|
+
}
|
|
114
|
+
export interface ChmodMutation extends BaseMutation {
|
|
115
|
+
kind: "chmod";
|
|
116
|
+
target: ValueResolver<string>;
|
|
117
|
+
mode: number;
|
|
118
|
+
}
|
|
119
|
+
export interface BackupMutation extends BaseMutation {
|
|
120
|
+
kind: "backup";
|
|
121
|
+
target: ValueResolver<string>;
|
|
122
|
+
once?: boolean;
|
|
123
|
+
}
|
|
124
|
+
export interface RestoreBackupMutation extends BaseMutation {
|
|
125
|
+
kind: "restoreBackup";
|
|
126
|
+
target: ValueResolver<string>;
|
|
127
|
+
}
|
|
128
|
+
export interface TemplateWriteMutation extends BaseMutation {
|
|
129
|
+
kind: "templateWrite";
|
|
130
|
+
target: ValueResolver<string>;
|
|
131
|
+
templateId: string;
|
|
132
|
+
context?: ValueResolver<ConfigObject>;
|
|
133
|
+
}
|
|
134
|
+
export interface TemplateMergeTomlMutation extends BaseMutation {
|
|
135
|
+
kind: "templateMergeToml";
|
|
136
|
+
target: ValueResolver<string>;
|
|
137
|
+
templateId: string;
|
|
138
|
+
context?: ValueResolver<ConfigObject>;
|
|
139
|
+
}
|
|
140
|
+
export interface TemplateMergeJsonMutation extends BaseMutation {
|
|
141
|
+
kind: "templateMergeJson";
|
|
142
|
+
target: ValueResolver<string>;
|
|
143
|
+
templateId: string;
|
|
144
|
+
context?: ValueResolver<ConfigObject>;
|
|
145
|
+
}
|
|
146
|
+
export type Mutation = ConfigMergeMutation | ConfigPruneMutation | ConfigTransformMutation | EnsureDirectoryMutation | RemoveDirectoryMutation | RemoveFileMutation | ChmodMutation | BackupMutation | RestoreBackupMutation | TemplateWriteMutation | TemplateMergeTomlMutation | TemplateMergeJsonMutation;
|
|
147
|
+
export type MutationEffect = "none" | "mkdir" | "write" | "delete" | "chmod" | "copy";
|
|
148
|
+
export type MutationDetail = "create" | "update" | "delete" | "noop" | "backup" | "restore";
|
|
149
|
+
export interface MutationOutcome {
|
|
150
|
+
changed: boolean;
|
|
151
|
+
effect: MutationEffect;
|
|
152
|
+
detail?: MutationDetail;
|
|
153
|
+
}
|
|
154
|
+
export interface MutationDetails {
|
|
155
|
+
kind: string;
|
|
156
|
+
label: string;
|
|
157
|
+
targetPath?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface MutationObservers {
|
|
160
|
+
onStart?(details: MutationDetails): void;
|
|
161
|
+
onComplete?(details: MutationDetails, outcome: MutationOutcome): void;
|
|
162
|
+
onError?(details: MutationDetails, error: unknown): void;
|
|
163
|
+
}
|
|
164
|
+
export interface MutationResult {
|
|
165
|
+
changed: boolean;
|
|
166
|
+
effects: MutationOutcome[];
|
|
167
|
+
}
|
|
168
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { JsonSchemaDocument, JsonSchemaDocumentOptions } from "../../toolcraft-schema/index.js";
|
|
2
|
+
interface CompileConfigSchemaOptions {
|
|
3
|
+
entrypoints: readonly string[];
|
|
4
|
+
document?: JsonSchemaDocumentOptions;
|
|
5
|
+
}
|
|
6
|
+
export interface CompileConfigSchemaFromSourceTextsOptions extends CompileConfigSchemaOptions {
|
|
7
|
+
files: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export declare function compileConfigSchemaFromEntrypoints(options: CompileConfigSchemaOptions): JsonSchemaDocument;
|
|
10
|
+
export declare function compileConfigSchemaFromSourceTexts(options: CompileConfigSchemaFromSourceTextsOptions): JsonSchemaDocument;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type FileSystem } from "../config-mutations/index.js";
|
|
2
|
+
import { ProviderRegistry, type ApiShapeId } from "../providers/index.js";
|
|
3
|
+
export interface ConfigStoreOptions {
|
|
4
|
+
fs: FileSystem;
|
|
5
|
+
filePath: string;
|
|
6
|
+
projectFilePath?: string;
|
|
7
|
+
providerRegistry?: Pick<ProviderRegistry, "get">;
|
|
8
|
+
warn?: (message: string) => void;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ConfiguredServiceMetadata {
|
|
12
|
+
provider: string;
|
|
13
|
+
apiShape?: ApiShapeId;
|
|
14
|
+
files: string[];
|
|
15
|
+
model?: string;
|
|
16
|
+
reasoningEffort?: string;
|
|
17
|
+
baseUrl?: string;
|
|
18
|
+
shapeBaseUrl?: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface SaveConfiguredServiceOptions extends ConfigStoreOptions {
|
|
21
|
+
service: string;
|
|
22
|
+
metadata: ConfiguredServiceMetadata;
|
|
23
|
+
}
|
|
24
|
+
export interface UnconfigureServiceOptions extends ConfigStoreOptions {
|
|
25
|
+
service: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function loadConfiguredServices(options: ConfigStoreOptions): Promise<Record<string, ConfiguredServiceMetadata>>;
|
|
28
|
+
export declare function saveConfiguredService(options: SaveConfiguredServiceOptions): Promise<void>;
|
|
29
|
+
export declare function unconfigureService(options: UnconfigureServiceOptions): Promise<boolean>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type { ConfigDocument, ConfigFieldType, ConfigStore, ConfigStoreOptions, BraintrustIntegrationConfig, InferConfig, IntegrationsConfig, MemoryCacheConfig, MemoryConfidenceConfig, MemoryConfig, MemoryMcpConfig, MemoryQueryConfig, ResolvedConfig, SchemaField, ScopeDefinition, ScopedConfig, ScopeSchema, TypeMap } from "./types.js";
|
|
2
|
+
export { defineScope, integrationsConfigScope } from "./schema.js";
|
|
3
|
+
export { compileConfigSchemaFromEntrypoints, compileConfigSchemaFromSourceTexts, type CompileConfigSchemaFromSourceTextsOptions } from "./compile/schema-compiler.js";
|
|
4
|
+
export { parseRunner, parseRuntime, resolveRuntime, runtimeConfigScope, type DockerRuntime, type HostRuntime, type RunnerScope, type RuntimeConfig, type RuntimeMount, type RuntimeResolveResult, type RuntimeRunner } from "./runtime.js";
|
|
5
|
+
export { planConfigScope } from "./plan-scope.js";
|
|
6
|
+
export { createConfigStore } from "./config.js";
|
|
7
|
+
export { deepMergeDocuments } from "./merge.js";
|
|
8
|
+
export { readMergedDocumentReadonly } from "./store.js";
|
|
9
|
+
export { mergeExperimentCallbacks, mergeLoopCallbacks, mergePipelineCallbacks, type ExperimentCallbackFields, type LoopCallbacks, type PipelineCallbackFields } from "./merge-callbacks.js";
|
|
10
|
+
export { cacheEnabled, configuredMemoryRoot, configuredTimeout, defaultQueryBudget, DEFAULT_QUERY_BUDGET_TOKENS, mcpWritesAllowed, resolveAgent, type MemoryConfigOptions } from "./memory.js";
|
|
11
|
+
export { resolveScope } from "./resolve.js";
|
|
12
|
+
export { collectEnvOverrides, initProjectConfig, resolveEditTarget, type EditTargetOptions, type EnvOverrides } from "./inspect.js";
|
|
13
|
+
export { readDocument, readDocumentReadonly, readMergedDocument, resolveConfigPath, resolveServicesConfigPath, resolveProjectConfigPath, writeDocument, writeScope } from "./store.js";
|
|
14
|
+
export { loadProviderShapeBaseUrls, saveProviderShapeBaseUrls, type LoadProviderShapeBaseUrlsOptions, type ProviderConfigStoreOptions, type SaveProviderShapeBaseUrlsOptions } from "./provider-config.js";
|
|
15
|
+
export { loadConfiguredServices, saveConfiguredService, unconfigureService, type ConfiguredServiceMetadata, type SaveConfiguredServiceOptions, type UnconfigureServiceOptions } from "./configured-services.js";
|
|
16
|
+
export { createStateManager, loadStateManager, type JobEntry, type JobListFilter, type JobRegistry, type JobStatus, type StateManager, type TemplateBackend, type TemplateEntry, type TemplateRegistry } from "./state/index.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type FileSystem } from "../config-mutations/index.js";
|
|
2
|
+
import type { ConfigDocument, ScopeDefinition, ScopeSchema } from "./types.js";
|
|
3
|
+
export interface EnvOverrides {
|
|
4
|
+
entries: string[];
|
|
5
|
+
document: ConfigDocument;
|
|
6
|
+
}
|
|
7
|
+
export interface EditTargetOptions {
|
|
8
|
+
global?: boolean;
|
|
9
|
+
project?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function collectEnvOverrides(scopes: ReadonlyArray<ScopeDefinition<ScopeSchema>>, env: Record<string, string | undefined>): EnvOverrides;
|
|
12
|
+
export declare function resolveEditTarget(fs: FileSystem, configPath: string, projectConfigPath: string, options: EditTargetOptions): Promise<string>;
|
|
13
|
+
export declare function initProjectConfig(fs: FileSystem, targetPath: string): Promise<"created" | "already-exists">;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FileSystem } from "../config-mutations/index.js";
|
|
2
|
+
/** Memory context budget used when memory.query.defaultBudgetTokens is unset. */
|
|
3
|
+
export declare const DEFAULT_QUERY_BUDGET_TOKENS = 4096;
|
|
4
|
+
export interface MemoryConfigOptions {
|
|
5
|
+
fs: FileSystem;
|
|
6
|
+
filePath: string;
|
|
7
|
+
projectFilePath?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function configuredMemoryRoot(options: MemoryConfigOptions): Promise<string | undefined>;
|
|
10
|
+
export declare function resolveAgent(options: MemoryConfigOptions, fallbackAgent: string | null): Promise<string | null>;
|
|
11
|
+
export declare function configuredTimeout(options: MemoryConfigOptions): Promise<number>;
|
|
12
|
+
export declare function cacheEnabled(options: MemoryConfigOptions): Promise<boolean>;
|
|
13
|
+
export declare function mcpWritesAllowed(options: MemoryConfigOptions): Promise<boolean>;
|
|
14
|
+
export declare function defaultQueryBudget(options: MemoryConfigOptions): Promise<number>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type BivariantCallback<Args extends unknown[], Return = void> = {
|
|
2
|
+
callback(...args: Args): Return;
|
|
3
|
+
}["callback"];
|
|
4
|
+
export type PipelineCallbackFields = {
|
|
5
|
+
onPlanResolved?: BivariantCallback<[summary: unknown]>;
|
|
6
|
+
onTaskStart?: BivariantCallback<[progress: unknown]>;
|
|
7
|
+
onTaskComplete?: BivariantCallback<[progress: unknown]>;
|
|
8
|
+
};
|
|
9
|
+
export type ExperimentCallbackFields = {
|
|
10
|
+
onExperimentStart?: BivariantCallback<[index: number, agent: string]>;
|
|
11
|
+
onBaselineCollected?: BivariantCallback<[baseline: Record<string, number>]>;
|
|
12
|
+
onMetricResult?: BivariantCallback<[metric: unknown, result: unknown]>;
|
|
13
|
+
onCommit?: BivariantCallback<[commitHash: string]>;
|
|
14
|
+
onReset?: BivariantCallback<[targetHash: string]>;
|
|
15
|
+
onExperimentComplete?: BivariantCallback<[index: number, entry: unknown]>;
|
|
16
|
+
};
|
|
17
|
+
export type LoopCallbacks = {
|
|
18
|
+
runRole?: <T>(role: "builder" | "inspector" | "superintendent" | "owner", name: string | undefined, run: () => Promise<T>) => Promise<T>;
|
|
19
|
+
onBuilderStart?: () => void;
|
|
20
|
+
onBuilderComplete?: BivariantCallback<[result: unknown]>;
|
|
21
|
+
onBuilderFailed?: BivariantCallback<[error: Error]>;
|
|
22
|
+
onInspectorStart?: BivariantCallback<[name: string]>;
|
|
23
|
+
onInspectorComplete?: BivariantCallback<[result: unknown]>;
|
|
24
|
+
onInspectorFailed?: BivariantCallback<[name: string, error: Error]>;
|
|
25
|
+
onSuperintendentStart?: () => void;
|
|
26
|
+
onSuperintendentComplete?: BivariantCallback<[result: unknown]>;
|
|
27
|
+
onOwnerStart?: () => void;
|
|
28
|
+
onOwnerComplete?: BivariantCallback<[result: unknown]>;
|
|
29
|
+
onRoundComplete?: BivariantCallback<[round: number]>;
|
|
30
|
+
onLoopComplete?: BivariantCallback<[state: unknown]>;
|
|
31
|
+
onStateChange?: BivariantCallback<[state: unknown]>;
|
|
32
|
+
shouldPause?: () => boolean;
|
|
33
|
+
shouldStop?: () => boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare function mergePipelineCallbacks(user: PipelineCallbackFields | undefined, added: PipelineCallbackFields | undefined): PipelineCallbackFields | undefined;
|
|
36
|
+
export declare function mergeExperimentCallbacks(user: ExperimentCallbackFields | undefined, added: ExperimentCallbackFields | undefined): ExperimentCallbackFields | undefined;
|
|
37
|
+
export declare function mergeLoopCallbacks(user: LoopCallbacks | undefined, added: LoopCallbacks | undefined): LoopCallbacks | undefined;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const planConfigScope: import("./types.js").ScopeDefinition<{
|
|
2
|
+
readonly plan_directory: {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly default: "docs/plans";
|
|
5
|
+
readonly env: "POE_PLAN_DIRECTORY";
|
|
6
|
+
readonly doc: "Directory where planning documents are stored";
|
|
7
|
+
};
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FileSystem } from "../config-mutations/index.js";
|
|
2
|
+
import type { ApiShapeId } from "../providers/index.js";
|
|
3
|
+
export interface ProviderConfigStoreOptions {
|
|
4
|
+
fs: FileSystem;
|
|
5
|
+
filePath: string;
|
|
6
|
+
}
|
|
7
|
+
export interface LoadProviderShapeBaseUrlsOptions extends ProviderConfigStoreOptions {
|
|
8
|
+
providerId: string;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SaveProviderShapeBaseUrlsOptions extends ProviderConfigStoreOptions {
|
|
12
|
+
providerId: string;
|
|
13
|
+
shapeBaseUrls: Partial<Record<ApiShapeId, string>>;
|
|
14
|
+
}
|
|
15
|
+
export declare function loadProviderShapeBaseUrls(options: LoadProviderShapeBaseUrlsOptions): Promise<Partial<Record<ApiShapeId, string>>>;
|
|
16
|
+
export declare function saveProviderShapeBaseUrls(options: SaveProviderShapeBaseUrlsOptions): Promise<void>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { ResolvedConfig } from "./types.js";
|
|
2
|
+
export interface RuntimeMount {
|
|
3
|
+
source: string;
|
|
4
|
+
target: string;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface RunnerScope {
|
|
8
|
+
detach: boolean;
|
|
9
|
+
upload_max_file_mb: number;
|
|
10
|
+
download_conflict: "refuse" | "overwrite";
|
|
11
|
+
sync: "both" | "upload" | "none";
|
|
12
|
+
workspace?: {
|
|
13
|
+
exclude?: string[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
interface SharedRuntimeFields {
|
|
17
|
+
build_args: Record<string, string>;
|
|
18
|
+
mounts: RuntimeMount[];
|
|
19
|
+
link?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface HostRuntime extends SharedRuntimeFields {
|
|
22
|
+
type: "host";
|
|
23
|
+
}
|
|
24
|
+
export interface DockerRuntime extends SharedRuntimeFields {
|
|
25
|
+
type: "docker";
|
|
26
|
+
image?: string;
|
|
27
|
+
dockerfile?: string;
|
|
28
|
+
build_context?: string;
|
|
29
|
+
engine?: "docker" | "podman";
|
|
30
|
+
network?: string;
|
|
31
|
+
extra_args?: string[];
|
|
32
|
+
}
|
|
33
|
+
export type RuntimeConfig = HostRuntime | DockerRuntime;
|
|
34
|
+
export type RuntimeRunner = RuntimeConfig["type"];
|
|
35
|
+
export interface RuntimeResolveResult {
|
|
36
|
+
runtime: RuntimeConfig;
|
|
37
|
+
runner: RuntimeRunner;
|
|
38
|
+
dockerfilePath: string | null;
|
|
39
|
+
buildContext: string | null;
|
|
40
|
+
}
|
|
41
|
+
export declare const runtimeConfigScope: {
|
|
42
|
+
scope: string;
|
|
43
|
+
schema: {
|
|
44
|
+
type: {
|
|
45
|
+
type: "string";
|
|
46
|
+
default: string;
|
|
47
|
+
doc: string;
|
|
48
|
+
};
|
|
49
|
+
build_args: {
|
|
50
|
+
type: "json";
|
|
51
|
+
default: Record<string, string>;
|
|
52
|
+
parse: typeof parseBuildArgs;
|
|
53
|
+
doc: string;
|
|
54
|
+
};
|
|
55
|
+
mounts: {
|
|
56
|
+
type: "json";
|
|
57
|
+
default: RuntimeMount[];
|
|
58
|
+
parse: typeof parseMounts;
|
|
59
|
+
doc: string;
|
|
60
|
+
};
|
|
61
|
+
runner: {
|
|
62
|
+
type: "json";
|
|
63
|
+
default: RunnerScope;
|
|
64
|
+
parse: typeof parseRunner;
|
|
65
|
+
doc: string;
|
|
66
|
+
};
|
|
67
|
+
link: {
|
|
68
|
+
type: "string";
|
|
69
|
+
default: string;
|
|
70
|
+
doc: string;
|
|
71
|
+
};
|
|
72
|
+
image: {
|
|
73
|
+
type: "string";
|
|
74
|
+
default: string;
|
|
75
|
+
doc: string;
|
|
76
|
+
};
|
|
77
|
+
dockerfile: {
|
|
78
|
+
type: "string";
|
|
79
|
+
default: string;
|
|
80
|
+
doc: string;
|
|
81
|
+
};
|
|
82
|
+
build_context: {
|
|
83
|
+
type: "string";
|
|
84
|
+
default: string;
|
|
85
|
+
doc: string;
|
|
86
|
+
};
|
|
87
|
+
engine: {
|
|
88
|
+
type: "string";
|
|
89
|
+
default: string;
|
|
90
|
+
doc: string;
|
|
91
|
+
};
|
|
92
|
+
network: {
|
|
93
|
+
type: "string";
|
|
94
|
+
default: string;
|
|
95
|
+
doc: string;
|
|
96
|
+
};
|
|
97
|
+
extra_args: {
|
|
98
|
+
type: "json";
|
|
99
|
+
default: string[] | undefined;
|
|
100
|
+
parse: typeof parseOptionalStringArray;
|
|
101
|
+
doc: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export declare function parseRunner(raw: unknown): RunnerScope;
|
|
106
|
+
export declare function parseRuntime(raw: unknown): RuntimeConfig;
|
|
107
|
+
export declare function resolveRuntime({ cwd, config }: {
|
|
108
|
+
cwd: string;
|
|
109
|
+
config: Pick<ResolvedConfig, "runtime">;
|
|
110
|
+
}): RuntimeResolveResult;
|
|
111
|
+
declare function parseBuildArgs(value: unknown): Record<string, string>;
|
|
112
|
+
declare function parseMounts(value: unknown): RuntimeMount[];
|
|
113
|
+
declare function parseOptionalStringArray(value: unknown, key?: string): string[] | undefined;
|
|
114
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BraintrustIntegrationConfig, ScopeDefinition, ScopeSchema } from "./types.js";
|
|
2
|
+
export declare function defineScope<const S extends ScopeSchema>(scope: string, schema: S): ScopeDefinition<S>;
|
|
3
|
+
export declare const integrationsConfigScope: ScopeDefinition<{
|
|
4
|
+
readonly braintrust: {
|
|
5
|
+
readonly type: "json";
|
|
6
|
+
readonly default: {
|
|
7
|
+
enabled: false;
|
|
8
|
+
};
|
|
9
|
+
readonly parse: typeof parseBraintrustIntegrationConfig;
|
|
10
|
+
readonly doc: "Braintrust integration configuration";
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
13
|
+
export { runtimeConfigScope } from "./runtime.js";
|
|
14
|
+
declare function parseBraintrustIntegrationConfig(value: unknown): BraintrustIntegrationConfig;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface StateFileSystem {
|
|
2
|
+
mkdir(path: string, options: {
|
|
3
|
+
recursive: true;
|
|
4
|
+
}): Promise<unknown>;
|
|
5
|
+
readFile(path: string, encoding: BufferEncoding): Promise<string>;
|
|
6
|
+
writeFile(path: string, data: string, options?: BufferEncoding | {
|
|
7
|
+
encoding?: BufferEncoding;
|
|
8
|
+
flag?: string;
|
|
9
|
+
mode?: number;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
12
|
+
readdir(path: string): Promise<string[]>;
|
|
13
|
+
stat(path: string): Promise<{
|
|
14
|
+
isFile(): boolean;
|
|
15
|
+
mtimeMs: number;
|
|
16
|
+
}>;
|
|
17
|
+
lstat?(path: string): Promise<{
|
|
18
|
+
isSymbolicLink(): boolean;
|
|
19
|
+
}>;
|
|
20
|
+
unlink(path: string): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare const defaultStateFs: StateFileSystem;
|
|
23
|
+
export declare function isNotFoundError(error: unknown): boolean;
|
|
24
|
+
export declare function assertPathHasNoSymbolicLinks(fs: StateFileSystem, targetPath: string, message: string): Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type JobRegistry } from "./jobs.js";
|
|
2
|
+
import { type TemplateRegistry } from "./templates.js";
|
|
3
|
+
import type { StateFileSystem } from "./fs.js";
|
|
4
|
+
export interface StateManager {
|
|
5
|
+
templates: TemplateRegistry;
|
|
6
|
+
jobs: JobRegistry;
|
|
7
|
+
}
|
|
8
|
+
export declare function loadStateManager(homeDir?: string): Promise<StateManager>;
|
|
9
|
+
export declare function createStateManager(homeDir: string, fs?: StateFileSystem): StateManager;
|
|
10
|
+
export { createJobRegistry, type JobEntry, type JobListFilter, type JobRegistry, type JobStatus } from "./jobs.js";
|
|
11
|
+
export { createTemplateRegistry, type TemplateBackend, type TemplateEntry, type TemplateRegistry } from "./templates.js";
|
|
12
|
+
export type { StateFileSystem } from "./fs.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type StateFileSystem } from "./fs.js";
|
|
2
|
+
export type JobStatus = "pending" | "running" | "exited" | "killed" | "lost";
|
|
3
|
+
export interface JobEntry {
|
|
4
|
+
id: string;
|
|
5
|
+
env_id: string;
|
|
6
|
+
env_kind: string;
|
|
7
|
+
tool: string;
|
|
8
|
+
argv: string[];
|
|
9
|
+
cwd: string;
|
|
10
|
+
started_at: string;
|
|
11
|
+
status: JobStatus;
|
|
12
|
+
exit_code?: number;
|
|
13
|
+
exited_at?: string;
|
|
14
|
+
log_file?: string;
|
|
15
|
+
reattach_context?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface JobListFilter {
|
|
18
|
+
env_id?: string;
|
|
19
|
+
env_kind?: string;
|
|
20
|
+
tool?: string;
|
|
21
|
+
status?: JobStatus;
|
|
22
|
+
since?: Date;
|
|
23
|
+
limit?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface JobRegistry {
|
|
26
|
+
get(id: string): Promise<JobEntry | null>;
|
|
27
|
+
put(entry: JobEntry): Promise<void>;
|
|
28
|
+
update(id: string, patch: Partial<JobEntry>): Promise<JobEntry | null>;
|
|
29
|
+
/** Newest first, capped by filter.limit when provided. */
|
|
30
|
+
list(filter?: JobListFilter): Promise<JobEntry[]>;
|
|
31
|
+
remove(id: string): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export declare function createJobRegistry(homeDir: string, fs?: StateFileSystem): JobRegistry;
|
|
34
|
+
export type { StateFileSystem } from "./fs.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type StateFileSystem } from "./fs.js";
|
|
2
|
+
export type TemplateBackend = "docker";
|
|
3
|
+
export interface TemplateEntry {
|
|
4
|
+
hash: string;
|
|
5
|
+
template_id?: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
runtime_type: string;
|
|
8
|
+
dockerfile_path: string;
|
|
9
|
+
built_at: string;
|
|
10
|
+
}
|
|
11
|
+
export interface TemplateRegistry {
|
|
12
|
+
get(backend: TemplateBackend, hash: string): Promise<TemplateEntry | null>;
|
|
13
|
+
put(backend: TemplateBackend, entry: TemplateEntry): Promise<void>;
|
|
14
|
+
remove(backend: TemplateBackend, hash: string): Promise<void>;
|
|
15
|
+
list(backend?: TemplateBackend): Promise<TemplateEntry[]>;
|
|
16
|
+
}
|
|
17
|
+
export declare function createTemplateRegistry(homeDir: string, fs?: StateFileSystem): TemplateRegistry;
|
|
18
|
+
export type { StateFileSystem } from "./fs.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type FileSystem } from "../config-mutations/index.js";
|
|
2
|
+
import type { ConfigDocument } from "./types.js";
|
|
3
|
+
export declare function readDocument(fs: FileSystem, filePath: string): Promise<ConfigDocument>;
|
|
4
|
+
export declare function readDocumentReadonly(fs: FileSystem, filePath: string): Promise<ConfigDocument>;
|
|
5
|
+
export declare function writeScope(fs: FileSystem, filePath: string, scope: string, values: Record<string, unknown>): Promise<void>;
|
|
6
|
+
export declare function readMergedDocument(fs: FileSystem, globalPath: string, projectPath?: string): Promise<ConfigDocument>;
|
|
7
|
+
export declare function readMergedDocumentReadonly(fs: FileSystem, globalPath: string, projectPath?: string): Promise<ConfigDocument>;
|
|
8
|
+
export declare function writeDocument(fs: FileSystem, filePath: string, document: ConfigDocument): Promise<void>;
|
|
9
|
+
export declare function assertConfigPathSafe(fs: FileSystem, filePath: string): Promise<void>;
|
|
10
|
+
export declare function resolveConfigPath(homeDir: string): string;
|
|
11
|
+
export declare function resolveServicesConfigPath(homeDir: string): string;
|
|
12
|
+
export declare function resolveProjectConfigPath(cwd: string): string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { FileSystem } from "../config-mutations/index.js";
|
|
2
|
+
import type { RunnerScope, RuntimeConfig } from "./runtime.js";
|
|
3
|
+
export type PrimitiveConfigFieldType = "string" | "number" | "boolean";
|
|
4
|
+
export type ConfigFieldType = PrimitiveConfigFieldType | "json";
|
|
5
|
+
export interface TypeMap {
|
|
6
|
+
string: string;
|
|
7
|
+
number: number;
|
|
8
|
+
boolean: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface PrimitiveSchemaField<T extends PrimitiveConfigFieldType = PrimitiveConfigFieldType> {
|
|
11
|
+
type: T;
|
|
12
|
+
default: TypeMap[T];
|
|
13
|
+
doc: string;
|
|
14
|
+
env?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface JsonSchemaField<T = unknown> {
|
|
17
|
+
type: "json";
|
|
18
|
+
default: T;
|
|
19
|
+
parse: (value: unknown) => T;
|
|
20
|
+
doc: string;
|
|
21
|
+
env?: string;
|
|
22
|
+
}
|
|
23
|
+
export type SchemaField = PrimitiveSchemaField | JsonSchemaField;
|
|
24
|
+
export type InferSchemaField<T extends SchemaField> = T extends PrimitiveSchemaField<infer U> ? TypeMap[U] : T extends JsonSchemaField<infer U> ? U : never;
|
|
25
|
+
export type ScopeSchema = Record<string, SchemaField>;
|
|
26
|
+
export type InferConfig<S extends ScopeSchema> = {
|
|
27
|
+
[K in keyof S]: InferSchemaField<S[K]>;
|
|
28
|
+
};
|
|
29
|
+
export interface ScopeDefinition<S extends ScopeSchema> {
|
|
30
|
+
scope: string;
|
|
31
|
+
schema: S;
|
|
32
|
+
}
|
|
33
|
+
export interface MemoryConfidenceConfig extends Record<string, unknown> {
|
|
34
|
+
rejectUntagged?: boolean;
|
|
35
|
+
minInferredConfidence?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface MemoryCacheConfig extends Record<string, unknown> {
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
maxAgeMs?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface MemoryMcpConfig extends Record<string, unknown> {
|
|
42
|
+
allowWrites?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface MemoryQueryConfig extends Record<string, unknown> {
|
|
45
|
+
defaultBudgetTokens?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface MemoryConfig extends Record<string, unknown> {
|
|
48
|
+
root?: string;
|
|
49
|
+
ingestAgent?: string;
|
|
50
|
+
ingestTimeoutMs?: number;
|
|
51
|
+
maxPageBytes?: number;
|
|
52
|
+
confidence?: MemoryConfidenceConfig;
|
|
53
|
+
cache?: MemoryCacheConfig;
|
|
54
|
+
mcp?: MemoryMcpConfig;
|
|
55
|
+
query?: MemoryQueryConfig;
|
|
56
|
+
}
|
|
57
|
+
export interface BraintrustIntegrationConfig extends Record<string, unknown> {
|
|
58
|
+
enabled: boolean;
|
|
59
|
+
apiKey?: string;
|
|
60
|
+
apiUrl?: string;
|
|
61
|
+
project?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface IntegrationsConfig extends Record<string, unknown> {
|
|
64
|
+
braintrust?: BraintrustIntegrationConfig;
|
|
65
|
+
}
|
|
66
|
+
export interface ScopedConfig<S extends ScopeSchema> {
|
|
67
|
+
get<K extends keyof S & string>(key: K): Promise<InferConfig<S>[K]>;
|
|
68
|
+
getAll(): Promise<InferConfig<S>>;
|
|
69
|
+
set<K extends keyof S & string>(key: K, value: InferConfig<S>[K]): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
export interface ConfigStore {
|
|
72
|
+
scope<S extends ScopeSchema>(definition: ScopeDefinition<S>): ScopedConfig<S>;
|
|
73
|
+
}
|
|
74
|
+
export interface ConfigStoreOptions {
|
|
75
|
+
fs: FileSystem;
|
|
76
|
+
filePath: string;
|
|
77
|
+
projectFilePath?: string;
|
|
78
|
+
env?: Record<string, string | undefined>;
|
|
79
|
+
}
|
|
80
|
+
export type ConfigDocument = Record<string, Record<string, unknown>> & {
|
|
81
|
+
integrations?: IntegrationsConfig;
|
|
82
|
+
memory?: MemoryConfig;
|
|
83
|
+
runtime?: Record<string, unknown>;
|
|
84
|
+
};
|
|
85
|
+
export interface ResolvedConfig {
|
|
86
|
+
runtime: RuntimeConfig;
|
|
87
|
+
runner: RunnerScope;
|
|
88
|
+
}
|