@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,136 @@
|
|
|
1
|
+
import type { Budget, CompileTicket } from "./budget.js";
|
|
2
|
+
import { CompileScope } from "./regex/compile-guard.js";
|
|
3
|
+
import type { GeneratorChannel } from "./generator.js";
|
|
4
|
+
import { type RegexPattern } from "./regex/parse.js";
|
|
5
|
+
export { createSandboxArguments, isSandboxArguments } from "./arguments.js";
|
|
6
|
+
declare const sandboxClosureBrand: unique symbol;
|
|
7
|
+
declare const sandboxGeneratorBrand: unique symbol;
|
|
8
|
+
declare const sandboxMapBrand: unique symbol;
|
|
9
|
+
declare const sandboxPromiseBrand: unique symbol;
|
|
10
|
+
declare const sandboxRegexBrand: unique symbol;
|
|
11
|
+
declare const sandboxRegexPattern: unique symbol;
|
|
12
|
+
declare const sandboxSetBrand: unique symbol;
|
|
13
|
+
declare const sandboxRetainedValues: unique symbol;
|
|
14
|
+
export type SandboxPrimitive = string | number | boolean | null | undefined;
|
|
15
|
+
export type SandboxValue = SandboxPrimitive | Float32Array | SandboxObject | SandboxArray | SandboxClosure | SandboxGenerator | SandboxMap | SandboxSet | SandboxPromise | SandboxRegex;
|
|
16
|
+
export type SandboxObject = {
|
|
17
|
+
[key: string]: SandboxValue;
|
|
18
|
+
};
|
|
19
|
+
export type SandboxArray = SandboxValue[];
|
|
20
|
+
export type SandboxMap = {
|
|
21
|
+
readonly kind: "map";
|
|
22
|
+
readonly entries: Map<SandboxValue, SandboxValue>;
|
|
23
|
+
readonly [sandboxMapBrand]: true;
|
|
24
|
+
};
|
|
25
|
+
export type SandboxSet = {
|
|
26
|
+
readonly kind: "set";
|
|
27
|
+
readonly values: Set<SandboxValue>;
|
|
28
|
+
readonly [sandboxSetBrand]: true;
|
|
29
|
+
};
|
|
30
|
+
export type SandboxRegex = {
|
|
31
|
+
readonly kind: "regex";
|
|
32
|
+
readonly source: string;
|
|
33
|
+
readonly flags: string;
|
|
34
|
+
lastIndex: number;
|
|
35
|
+
readonly [sandboxRegexBrand]: true;
|
|
36
|
+
readonly [sandboxRegexPattern]: RegexPattern;
|
|
37
|
+
};
|
|
38
|
+
export type SandboxCallContext = {
|
|
39
|
+
readonly compilation?: CompileScope;
|
|
40
|
+
readonly span?: {
|
|
41
|
+
readonly end: {
|
|
42
|
+
readonly column: number;
|
|
43
|
+
readonly line: number;
|
|
44
|
+
readonly offset: number;
|
|
45
|
+
};
|
|
46
|
+
readonly start: {
|
|
47
|
+
readonly column: number;
|
|
48
|
+
readonly line: number;
|
|
49
|
+
readonly offset: number;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
readonly stack: readonly string[];
|
|
53
|
+
readonly thisValue: SandboxValue;
|
|
54
|
+
readonly invokeClosure?: (closure: SandboxClosure, args: readonly SandboxValue[], thisValue: SandboxValue) => Promise<SandboxValue>;
|
|
55
|
+
};
|
|
56
|
+
export type SandboxClosure = {
|
|
57
|
+
readonly async?: true;
|
|
58
|
+
readonly sandbox?: true;
|
|
59
|
+
readonly boundTarget?: SandboxClosure;
|
|
60
|
+
readonly cancellationSignal?: AbortSignal;
|
|
61
|
+
readonly kind: "fn";
|
|
62
|
+
readonly length?: number;
|
|
63
|
+
readonly name?: string;
|
|
64
|
+
readonly properties?: SandboxObject;
|
|
65
|
+
readonly call: (args: readonly SandboxValue[], context?: SandboxCallContext) => SandboxValue | Promise<SandboxValue>;
|
|
66
|
+
readonly construct?: (args: readonly SandboxValue[], context?: SandboxCallContext) => SandboxValue | Promise<SandboxValue>;
|
|
67
|
+
readonly [sandboxClosureBrand]: true;
|
|
68
|
+
readonly [sandboxRetainedValues]?: () => Iterable<SandboxValue>;
|
|
69
|
+
};
|
|
70
|
+
export type SandboxPromise = {
|
|
71
|
+
readonly kind: "promise";
|
|
72
|
+
readonly synchronousPrefix?: Promise<void>;
|
|
73
|
+
readonly promise: Promise<SandboxValue>;
|
|
74
|
+
readonly hostCall?: import("./host-call.js").HostCallRecord;
|
|
75
|
+
readonly hostCallJournal?: import("./host-call.js").HostCallJournal;
|
|
76
|
+
readonly span?: SandboxCallContext["span"];
|
|
77
|
+
readonly [sandboxPromiseBrand]: true;
|
|
78
|
+
};
|
|
79
|
+
export type SandboxGenerator = {
|
|
80
|
+
readonly kind: "generator";
|
|
81
|
+
state: "start" | "running" | "suspended" | "done";
|
|
82
|
+
readonly channel: GeneratorChannel;
|
|
83
|
+
readonly astNodeId?: number;
|
|
84
|
+
readonly capturedScopeId?: number | string;
|
|
85
|
+
readonly [sandboxGeneratorBrand]: true;
|
|
86
|
+
};
|
|
87
|
+
type CopyFromSandboxOptions = {
|
|
88
|
+
wrapClosure?: (value: SandboxClosure) => unknown;
|
|
89
|
+
compilation?: CompileScope;
|
|
90
|
+
};
|
|
91
|
+
export declare function createSandboxClosure(input: {
|
|
92
|
+
async?: boolean;
|
|
93
|
+
sandbox?: boolean;
|
|
94
|
+
boundTarget?: SandboxClosure;
|
|
95
|
+
cancellationSignal?: AbortSignal;
|
|
96
|
+
call: (args: readonly SandboxValue[], context?: SandboxCallContext) => SandboxValue | Promise<SandboxValue>;
|
|
97
|
+
construct?: (args: readonly SandboxValue[], context?: SandboxCallContext) => SandboxValue | Promise<SandboxValue>;
|
|
98
|
+
name?: string;
|
|
99
|
+
length?: number;
|
|
100
|
+
properties?: SandboxObject | ((closure: SandboxClosure) => SandboxObject);
|
|
101
|
+
retainedValues?: () => Iterable<SandboxValue>;
|
|
102
|
+
}): SandboxClosure;
|
|
103
|
+
export declare function createSandboxPromise(promise: Promise<SandboxValue>, metadata?: {
|
|
104
|
+
trackReplay?: boolean;
|
|
105
|
+
synchronousPrefix?: Promise<void>;
|
|
106
|
+
hostCall?: import("./host-call.js").HostCallRecord;
|
|
107
|
+
hostCallJournal?: import("./host-call.js").HostCallJournal;
|
|
108
|
+
span?: SandboxCallContext["span"];
|
|
109
|
+
}): SandboxPromise;
|
|
110
|
+
export declare function createSandboxGenerator(channel: GeneratorChannel, metadata?: {
|
|
111
|
+
astNodeId: number;
|
|
112
|
+
capturedScopeId: number | string;
|
|
113
|
+
} | undefined): SandboxGenerator;
|
|
114
|
+
export declare function createSandboxMap(entries?: Iterable<readonly [SandboxValue, SandboxValue]>): SandboxMap;
|
|
115
|
+
export declare function createSandboxSet(values?: Iterable<SandboxValue>): SandboxSet;
|
|
116
|
+
export declare function createSandboxRegex(source: string, flags?: string, lastIndex?: number, compilation?: CompileScope): SandboxRegex;
|
|
117
|
+
export declare function getSandboxRegexPattern(regex: SandboxRegex): RegexPattern;
|
|
118
|
+
export declare function isSandboxClosure(value: unknown): value is SandboxClosure;
|
|
119
|
+
export declare function isSandboxMap(value: unknown): value is SandboxMap;
|
|
120
|
+
export declare function isSandboxPromise(value: unknown): value is SandboxPromise;
|
|
121
|
+
export declare function isSandboxSet(value: unknown): value is SandboxSet;
|
|
122
|
+
export declare function isSandboxGenerator(value: unknown): value is SandboxGenerator;
|
|
123
|
+
export declare function isSandboxRegex(value: unknown): value is SandboxRegex;
|
|
124
|
+
export declare function deepCopyToSandbox(value: unknown): SandboxValue;
|
|
125
|
+
export declare function cloneSandboxValue(value: SandboxValue): SandboxValue;
|
|
126
|
+
export declare function allocateProducedSandboxValue(value: SandboxValue, budget: Budget): SandboxValue;
|
|
127
|
+
export declare function measureSandboxData(values: Iterable<unknown>, options?: {
|
|
128
|
+
ignoreClosures?: boolean;
|
|
129
|
+
ignoreClosureCaptures?: boolean;
|
|
130
|
+
compileTickets?: Set<CompileTicket>;
|
|
131
|
+
}): number;
|
|
132
|
+
export declare function reconcileCompiledValues(budget: Budget, values: Iterable<unknown>, compilation?: CompileScope, parent?: CompileScope, escaping?: Iterable<unknown>): void;
|
|
133
|
+
export declare function deepCopyFromSandbox(value: SandboxPromise, options?: CopyFromSandboxOptions): Promise<unknown>;
|
|
134
|
+
export declare function deepCopyFromSandbox(value: SandboxValue, options?: CopyFromSandboxOptions): unknown;
|
|
135
|
+
export declare function defineOwnDataProperty(target: object, key: string, value: unknown): void;
|
|
136
|
+
export declare function isArrayIndexKey(value: string): boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DefaultExportSignature } from "./rules/AS-export-import-meta.js";
|
|
2
|
+
import { type SourceSpan } from "../parse/parser.js";
|
|
3
|
+
import type { Modules } from "./rules/module-registry.js";
|
|
4
|
+
export type Diagnostic = {
|
|
5
|
+
code: string;
|
|
6
|
+
severity: "error" | "info" | "warning";
|
|
7
|
+
message: string;
|
|
8
|
+
filename: string;
|
|
9
|
+
line: number;
|
|
10
|
+
column: number;
|
|
11
|
+
span: SourceSpan;
|
|
12
|
+
fix?: Fix;
|
|
13
|
+
hint?: string;
|
|
14
|
+
};
|
|
15
|
+
export type Fix = {
|
|
16
|
+
range: readonly [number, number];
|
|
17
|
+
replacement: string;
|
|
18
|
+
};
|
|
19
|
+
export type LintOptions = {
|
|
20
|
+
allowedExportNames?: readonly string[];
|
|
21
|
+
allowedGlobals?: readonly string[];
|
|
22
|
+
defaultExport?: DefaultExportSignature;
|
|
23
|
+
fix?: boolean;
|
|
24
|
+
fixRanges?: readonly Fix["range"][];
|
|
25
|
+
filename?: string;
|
|
26
|
+
largeLiteralThreshold?: number;
|
|
27
|
+
frontmatterFields?: readonly string[];
|
|
28
|
+
modules?: Modules;
|
|
29
|
+
};
|
|
30
|
+
export type LintFixResult = {
|
|
31
|
+
diagnostics: Diagnostic[];
|
|
32
|
+
fixed: string;
|
|
33
|
+
fixes: Fix[];
|
|
34
|
+
};
|
|
35
|
+
export declare function lint(source: string, options: LintOptions & {
|
|
36
|
+
fix: true;
|
|
37
|
+
}): LintFixResult;
|
|
38
|
+
export declare function lint(source: string, options?: LintOptions): Diagnostic[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type SourceSpan } from "../../parse/parser.js";
|
|
2
|
+
type DiagnosticCode = "AS-EXPORT-DEFAULT-MISSING" | "AS-EXPORT-DEFAULT-MULTIPLE" | "AS-EXPORT-DEFAULT-NOT-ARROW" | "AS-EXPORT-DEFAULT-SIGNATURE" | "AS-EXPORT-UNKNOWN" | "AS-IMPORT-META-ASSIGN" | "AS-RETURN-AT-TOP";
|
|
3
|
+
export type Diagnostic = {
|
|
4
|
+
code: DiagnosticCode;
|
|
5
|
+
severity: "error" | "warning";
|
|
6
|
+
message: string;
|
|
7
|
+
filename: string;
|
|
8
|
+
line: number;
|
|
9
|
+
column: number;
|
|
10
|
+
span: SourceSpan;
|
|
11
|
+
};
|
|
12
|
+
export type DefaultExportSignature = {
|
|
13
|
+
parameters?: readonly string[];
|
|
14
|
+
required?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function AS_EXPORT_IMPORT_META(source: string, options?: {
|
|
17
|
+
allowedExportNames?: readonly string[];
|
|
18
|
+
defaultExport?: DefaultExportSignature;
|
|
19
|
+
filename?: string;
|
|
20
|
+
}): Diagnostic[];
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ImportDeclaration } from "../../parse/parser.js";
|
|
2
|
+
export type ModuleRegistration = readonly string[] | {
|
|
3
|
+
exports?: readonly string[] | LintModuleExports;
|
|
4
|
+
filename?: string;
|
|
5
|
+
source?: string;
|
|
6
|
+
};
|
|
7
|
+
export type Modules = ReadonlyMap<string, ModuleRegistration> | Record<string, ModuleRegistration>;
|
|
8
|
+
export type LintModuleExport = string | {
|
|
9
|
+
async?: boolean;
|
|
10
|
+
type?: string;
|
|
11
|
+
};
|
|
12
|
+
export type LintModuleExports = ReadonlyMap<string, LintModuleExport> | Record<string, LintModuleExport>;
|
|
13
|
+
export type ModuleExportTypes = LintModuleExports;
|
|
14
|
+
export type NormalizedModuleRegistration = {
|
|
15
|
+
asyncExports: ReadonlySet<string>;
|
|
16
|
+
exports: string[];
|
|
17
|
+
exportTypes: ReadonlyMap<string, string>;
|
|
18
|
+
filename?: string;
|
|
19
|
+
source?: string;
|
|
20
|
+
};
|
|
21
|
+
export type SafeJSSourceModule = {
|
|
22
|
+
moduleName: string;
|
|
23
|
+
exports: readonly string[];
|
|
24
|
+
filename: string;
|
|
25
|
+
source: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function collectImportDeclarations(source: string, filename: string): ImportDeclaration[];
|
|
28
|
+
export declare function createUnknownModuleMessage(moduleName: string, moduleNames: readonly string[]): string;
|
|
29
|
+
export declare function createUnknownExportMessage(moduleName: string, exportName: string, availableExports: readonly string[]): string;
|
|
30
|
+
export declare function normalizeModules(modules: Modules | undefined): Map<string, string[]>;
|
|
31
|
+
export declare function normalizeModuleRegistrations(modules: Modules | undefined): Map<string, NormalizedModuleRegistration>;
|
|
32
|
+
export declare function collectSafeJSSourceModules(modules: Modules | undefined): Map<string, SafeJSSourceModule>;
|
|
33
|
+
export declare function hasTypedModuleRegistrations(modules: Modules | undefined): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { lint, type Diagnostic, type Fix, type LintFixResult, type LintOptions } from "./lint/index.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ExtractBlockResult {
|
|
2
|
+
endOffset: number;
|
|
3
|
+
source: string;
|
|
4
|
+
lineOffset: number;
|
|
5
|
+
startOffset: number;
|
|
6
|
+
ranges: readonly (readonly [number, number])[];
|
|
7
|
+
}
|
|
8
|
+
export declare function extractBlock(markdown: string, startLine?: number): ExtractBlockResult;
|
|
9
|
+
export declare function maskSource(source: string): string;
|
|
10
|
+
export declare function countLineBreaks(markdown: string, start?: number, end?: number): number;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SafeJSSnapshot } from "./restore.js";
|
|
2
|
+
import { type SnapshotMigration, type SnapshotMigrationReconciliation } from "./snapshot/migration.js";
|
|
3
|
+
export type { SnapshotMigration, SnapshotMigrationReconciliation, SnapshotMigrationResolution } from "./snapshot/migration.js";
|
|
4
|
+
export type SnapshotMigrationOptions = {
|
|
5
|
+
source: string;
|
|
6
|
+
targetSource: string;
|
|
7
|
+
state: unknown;
|
|
8
|
+
reconciliation: SnapshotMigrationReconciliation;
|
|
9
|
+
};
|
|
10
|
+
export declare function inspectSnapshotMigration(snapshot: SafeJSSnapshot, options: {
|
|
11
|
+
source: string;
|
|
12
|
+
}): {
|
|
13
|
+
checkpointDigest: string;
|
|
14
|
+
sourceHash: string;
|
|
15
|
+
executionSemantics: string;
|
|
16
|
+
calls: (Omit<import("./index.js").HostCallRecord, "outcome" | "asynchronous"> & {
|
|
17
|
+
asynchronous: boolean;
|
|
18
|
+
outcome?: {
|
|
19
|
+
status: "fulfilled" | "rejected";
|
|
20
|
+
data: import("./snapshot/replay-data.js").ReplayData;
|
|
21
|
+
};
|
|
22
|
+
})[];
|
|
23
|
+
unresolvedCalls: (Omit<import("./index.js").HostCallRecord, "outcome" | "asynchronous"> & {
|
|
24
|
+
asynchronous: boolean;
|
|
25
|
+
outcome?: {
|
|
26
|
+
status: "fulfilled" | "rejected";
|
|
27
|
+
data: import("./snapshot/replay-data.js").ReplayData;
|
|
28
|
+
};
|
|
29
|
+
})[];
|
|
30
|
+
};
|
|
31
|
+
export declare function migrateSnapshot(snapshot: SafeJSSnapshot, options: SnapshotMigrationOptions): SafeJSSnapshot & {
|
|
32
|
+
migration: SnapshotMigration;
|
|
33
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type SnapshotMigrationFileOptions = {
|
|
2
|
+
snapshotPath: string;
|
|
3
|
+
sourcePath: string;
|
|
4
|
+
targetSourcePath?: string;
|
|
5
|
+
planPath?: string;
|
|
6
|
+
outputPath?: string;
|
|
7
|
+
inspect?: boolean;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function migrateSnapshotFile(options: SnapshotMigrationFileOptions): Promise<{
|
|
12
|
+
inspection: {
|
|
13
|
+
checkpointDigest: string;
|
|
14
|
+
sourceHash: string;
|
|
15
|
+
executionSemantics: string;
|
|
16
|
+
calls: (Omit<import("./index.js").HostCallRecord, "outcome" | "asynchronous"> & {
|
|
17
|
+
asynchronous: boolean;
|
|
18
|
+
outcome?: {
|
|
19
|
+
status: "fulfilled" | "rejected";
|
|
20
|
+
data: import("./snapshot/replay-data.js").ReplayData;
|
|
21
|
+
};
|
|
22
|
+
})[];
|
|
23
|
+
unresolvedCalls: (Omit<import("./index.js").HostCallRecord, "outcome" | "asynchronous"> & {
|
|
24
|
+
asynchronous: boolean;
|
|
25
|
+
outcome?: {
|
|
26
|
+
status: "fulfilled" | "rejected";
|
|
27
|
+
data: import("./snapshot/replay-data.js").ReplayData;
|
|
28
|
+
};
|
|
29
|
+
})[];
|
|
30
|
+
};
|
|
31
|
+
outputPath?: undefined;
|
|
32
|
+
dryRun?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
inspection: {
|
|
35
|
+
checkpointDigest: string;
|
|
36
|
+
sourceHash: string;
|
|
37
|
+
executionSemantics: string;
|
|
38
|
+
calls: (Omit<import("./index.js").HostCallRecord, "outcome" | "asynchronous"> & {
|
|
39
|
+
asynchronous: boolean;
|
|
40
|
+
outcome?: {
|
|
41
|
+
status: "fulfilled" | "rejected";
|
|
42
|
+
data: import("./snapshot/replay-data.js").ReplayData;
|
|
43
|
+
};
|
|
44
|
+
})[];
|
|
45
|
+
unresolvedCalls: (Omit<import("./index.js").HostCallRecord, "outcome" | "asynchronous"> & {
|
|
46
|
+
asynchronous: boolean;
|
|
47
|
+
outcome?: {
|
|
48
|
+
status: "fulfilled" | "rejected";
|
|
49
|
+
data: import("./snapshot/replay-data.js").ReplayData;
|
|
50
|
+
};
|
|
51
|
+
})[];
|
|
52
|
+
};
|
|
53
|
+
outputPath: string | undefined;
|
|
54
|
+
dryRun: boolean;
|
|
55
|
+
}>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { type SpawnParallelOptions } from "../../agent-spawn/parallel.js";
|
|
2
|
+
import { type SpawnUsage } from "../../agent-spawn/types.js";
|
|
3
|
+
import { type OtelSink } from "../observability/otel.js";
|
|
4
|
+
export type AgentSpawnMode = "read" | "edit" | "auto" | "yolo";
|
|
5
|
+
export type AgentModuleMcpServer = {
|
|
6
|
+
command: string;
|
|
7
|
+
args?: string[];
|
|
8
|
+
env?: Record<string, string>;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
};
|
|
11
|
+
export type AgentModuleMcpConfig = Record<string, AgentModuleMcpServer>;
|
|
12
|
+
export type AgentModuleDefinition = string | {
|
|
13
|
+
agent: string;
|
|
14
|
+
prompt?: string;
|
|
15
|
+
model?: string;
|
|
16
|
+
mode?: AgentSpawnMode;
|
|
17
|
+
cwd?: string;
|
|
18
|
+
mcp?: AgentModuleMcpConfig;
|
|
19
|
+
};
|
|
20
|
+
export type AgentModuleSpawnOptions = {
|
|
21
|
+
prompt: string;
|
|
22
|
+
check?: boolean;
|
|
23
|
+
label?: string;
|
|
24
|
+
mcp?: AgentModuleMcpConfig;
|
|
25
|
+
model?: string;
|
|
26
|
+
mode?: AgentSpawnMode;
|
|
27
|
+
cwd?: string;
|
|
28
|
+
otelSink?: OtelSink;
|
|
29
|
+
timeoutMs?: number;
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
};
|
|
32
|
+
export type SpawnAgentInput = Omit<AgentModuleSpawnOptions, "label" | "check"> & {
|
|
33
|
+
agent: string;
|
|
34
|
+
};
|
|
35
|
+
export type SpawnAgentResult = {
|
|
36
|
+
exitCode: number;
|
|
37
|
+
stdout: string;
|
|
38
|
+
stderr: string;
|
|
39
|
+
summary: string;
|
|
40
|
+
durationMs: number;
|
|
41
|
+
usage?: SpawnUsage;
|
|
42
|
+
};
|
|
43
|
+
export type SpawnAgent = (input: SpawnAgentInput) => Promise<SpawnAgentResult>;
|
|
44
|
+
export declare class AgentSpawnError extends Error {
|
|
45
|
+
readonly result: SpawnAgentResult;
|
|
46
|
+
constructor(result: SpawnAgentResult);
|
|
47
|
+
}
|
|
48
|
+
export type AgentModuleOptions = {
|
|
49
|
+
defaultRetry?: AgentModuleRetryOptions;
|
|
50
|
+
onEvent?: (event: AgentSpawnEvent) => void | Promise<void>;
|
|
51
|
+
otelSink?: OtelSink;
|
|
52
|
+
};
|
|
53
|
+
export type AgentSpawnEvent = {
|
|
54
|
+
type: "spawn.started";
|
|
55
|
+
spawnId: number;
|
|
56
|
+
agent: string;
|
|
57
|
+
task: string;
|
|
58
|
+
attempt: number;
|
|
59
|
+
maxAttempts: number;
|
|
60
|
+
} | {
|
|
61
|
+
type: "spawn.retry";
|
|
62
|
+
spawnId: number;
|
|
63
|
+
agent: string;
|
|
64
|
+
task: string;
|
|
65
|
+
attempt: number;
|
|
66
|
+
maxAttempts: number;
|
|
67
|
+
delayMs: number;
|
|
68
|
+
error: string;
|
|
69
|
+
} | {
|
|
70
|
+
type: "spawn.succeeded";
|
|
71
|
+
spawnId: number;
|
|
72
|
+
agent: string;
|
|
73
|
+
task: string;
|
|
74
|
+
attempt: number;
|
|
75
|
+
maxAttempts: number;
|
|
76
|
+
durationMs: number;
|
|
77
|
+
} | {
|
|
78
|
+
type: "spawn.failed";
|
|
79
|
+
checked: boolean;
|
|
80
|
+
spawnId: number;
|
|
81
|
+
agent: string;
|
|
82
|
+
task: string;
|
|
83
|
+
attempt: number;
|
|
84
|
+
maxAttempts: number;
|
|
85
|
+
durationMs: number;
|
|
86
|
+
error: string;
|
|
87
|
+
} | {
|
|
88
|
+
type: "spawn.cancelled";
|
|
89
|
+
spawnId: number;
|
|
90
|
+
agent: string;
|
|
91
|
+
task: string;
|
|
92
|
+
attempt: number;
|
|
93
|
+
maxAttempts: number;
|
|
94
|
+
durationMs: number;
|
|
95
|
+
reason: string;
|
|
96
|
+
};
|
|
97
|
+
export type SpawnUsageTotal = {
|
|
98
|
+
inputTokens: number;
|
|
99
|
+
outputTokens: number;
|
|
100
|
+
cachedTokens: number;
|
|
101
|
+
costUsd?: number;
|
|
102
|
+
spawnCount: number;
|
|
103
|
+
attemptCount?: number;
|
|
104
|
+
};
|
|
105
|
+
export type SpawnUsageAccumulator = {
|
|
106
|
+
beginAttempt?(): void;
|
|
107
|
+
beginSpawn?(): void;
|
|
108
|
+
record(usage: SpawnUsage | undefined): void;
|
|
109
|
+
reset(): void;
|
|
110
|
+
snapshot(): SpawnUsageTotal;
|
|
111
|
+
};
|
|
112
|
+
export declare function createSpawnUsageAccumulator(): SpawnUsageAccumulator;
|
|
113
|
+
export declare function runWithSpawnUsageAccumulator<TResult>(accumulator: SpawnUsageAccumulator, operation: () => Promise<TResult>): Promise<TResult>;
|
|
114
|
+
export type AgentModuleRetryOptions = {
|
|
115
|
+
maxAttempts: number;
|
|
116
|
+
backoffMs: number;
|
|
117
|
+
isErrorRetryable?: (error: unknown) => boolean;
|
|
118
|
+
isRetryable?: (result: SpawnAgentResult) => boolean;
|
|
119
|
+
};
|
|
120
|
+
export type AgentModuleParallelCall = readonly [agentDef: AgentModuleDefinition, options: AgentModuleSpawnOptions] | ((signal?: AbortSignal) => {
|
|
121
|
+
events: AsyncIterable<never>;
|
|
122
|
+
result: Promise<SpawnAgentResult>;
|
|
123
|
+
});
|
|
124
|
+
type AgentModuleSpawn = {
|
|
125
|
+
(agentDef: AgentModuleDefinition, options: AgentModuleSpawnOptions): Promise<SpawnAgentResult>;
|
|
126
|
+
retry(agentDef: AgentModuleDefinition, options: AgentModuleSpawnOptions, retryOptions: AgentModuleRetryOptions): Promise<SpawnAgentResult>;
|
|
127
|
+
parallel(calls: AgentModuleParallelCall[], options?: SpawnParallelOptions): Promise<SpawnAgentResult[]>;
|
|
128
|
+
};
|
|
129
|
+
export declare function makeAgentModule(spawnAgent: SpawnAgent, moduleOptions?: AgentModuleOptions): {
|
|
130
|
+
spawn: AgentModuleSpawn;
|
|
131
|
+
};
|
|
132
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type EnvModuleOptions = {
|
|
2
|
+
allow: readonly string[];
|
|
3
|
+
values?: Readonly<Record<string, string | undefined>>;
|
|
4
|
+
};
|
|
5
|
+
export type EnvModule = {
|
|
6
|
+
get(name: string): string | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare class EnvAccessError extends Error {
|
|
9
|
+
readonly code = "ENV_ACCESS_DENIED";
|
|
10
|
+
readonly variable: string;
|
|
11
|
+
constructor(variable: string);
|
|
12
|
+
}
|
|
13
|
+
export declare function makeEnvModule(input: readonly string[] | EnvModuleOptions): EnvModule;
|
|
14
|
+
export declare function parseEnvConfig(json: string): EnvModuleOptions;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type FileSystemAdapterRegistry, type FileSystemConfig } from "../../safe-fs/index.js";
|
|
2
|
+
import type { FsModuleOptions } from "./fs.js";
|
|
3
|
+
export type FsConfig = {
|
|
4
|
+
readonly adapter: FileSystemConfig;
|
|
5
|
+
readonly root?: string;
|
|
6
|
+
readonly cwd?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ResolveFsConfigOptions = {
|
|
9
|
+
readonly registry?: FileSystemAdapterRegistry;
|
|
10
|
+
};
|
|
11
|
+
export declare function parseFsConfig(json: string): FsConfig;
|
|
12
|
+
export declare function resolveFsConfig(config: FsConfig, options?: ResolveFsConfigOptions): Promise<Required<Pick<FsModuleOptions, "adapter">> & Pick<FsModuleOptions, "root" | "cwd">>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type PathLike } from "node:fs";
|
|
2
|
+
import * as nodeFsPromises from "node:fs/promises";
|
|
3
|
+
import { type FileSystem } from "../../safe-fs/index.js";
|
|
4
|
+
type FsOperationName = "access" | "appendFile" | "chmod" | "copyFile" | "cp" | "link" | "lstat" | "mkdir" | "mkdtemp" | "readFile" | "readdir" | "readlink" | "realpath" | "rename" | "rm" | "rmdir" | "stat" | "symlink" | "truncate" | "utimes" | "writeFile";
|
|
5
|
+
type FsPassthroughName = Exclude<FsOperationName, "lstat" | "mkdtemp" | "readFile" | "readdir" | "readlink" | "realpath" | "stat">;
|
|
6
|
+
declare const REFUSED_OPTION_REASONS: {
|
|
7
|
+
readonly signal: "the sandbox has no AbortController, and cancelling a run is the host's to request rather than the script's";
|
|
8
|
+
readonly throwIfNoEntry: "only node's synchronous stat reads it and fs/promises rejects a missing path whatever it says, so catch the ENOENT rejection instead";
|
|
9
|
+
readonly filter: "a closure is dropped from the digest that identifies a host call across a snapshot, so a resumed run could reconcile against a copy that took a different set of files, and under a root it would read the rewritten host paths rather than the ones the script wrote — walk the tree with readdir and copy the entries you want instead";
|
|
10
|
+
};
|
|
11
|
+
type FsOptionSurface = {
|
|
12
|
+
readonly argument: number;
|
|
13
|
+
readonly honoured: readonly string[];
|
|
14
|
+
readonly refused: readonly (keyof typeof REFUSED_OPTION_REASONS)[];
|
|
15
|
+
};
|
|
16
|
+
export declare const FS_OPTION_SURFACE: Record<"appendFile" | "cp" | "lstat" | "mkdir" | "mkdtemp" | "readFile" | "readdir" | "readlink" | "realpath" | "rm" | "rmdir" | "stat" | "writeFile", FsOptionSurface>;
|
|
17
|
+
declare const STAT_NUMBER_FIELDS: readonly ["dev", "mode", "nlink", "uid", "gid", "rdev", "blksize", "ino", "size", "blocks", "atimeMs", "mtimeMs", "ctimeMs", "birthtimeMs"];
|
|
18
|
+
declare const FILE_TYPE_PREDICATES: readonly ["isFile", "isDirectory", "isSymbolicLink", "isBlockDevice", "isCharacterDevice", "isFIFO", "isSocket"];
|
|
19
|
+
export type FsImplementation = Pick<typeof nodeFsPromises, FsOperationName>;
|
|
20
|
+
type FileTypePredicates = {
|
|
21
|
+
readonly [Name in (typeof FILE_TYPE_PREDICATES)[number]]: () => boolean;
|
|
22
|
+
};
|
|
23
|
+
export type SandboxStats = {
|
|
24
|
+
readonly [Name in (typeof STAT_NUMBER_FIELDS)[number]]: number;
|
|
25
|
+
} & FileTypePredicates;
|
|
26
|
+
export type SandboxDirent = {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly parentPath: string;
|
|
29
|
+
} & FileTypePredicates;
|
|
30
|
+
type StringEncoding = NodeJS.BufferEncoding;
|
|
31
|
+
type EncodingOptions = StringEncoding | {
|
|
32
|
+
encoding: StringEncoding;
|
|
33
|
+
};
|
|
34
|
+
type ReadFileOptions = StringEncoding | {
|
|
35
|
+
encoding: StringEncoding;
|
|
36
|
+
flag?: string;
|
|
37
|
+
};
|
|
38
|
+
type ReaddirOptions = {
|
|
39
|
+
encoding?: StringEncoding;
|
|
40
|
+
recursive?: boolean;
|
|
41
|
+
};
|
|
42
|
+
type StatOptions = {
|
|
43
|
+
bigint?: false;
|
|
44
|
+
};
|
|
45
|
+
export type FsModuleOptions = {
|
|
46
|
+
root?: string;
|
|
47
|
+
fs?: FsImplementation;
|
|
48
|
+
adapter?: never;
|
|
49
|
+
cwd?: never;
|
|
50
|
+
signal?: never;
|
|
51
|
+
} | {
|
|
52
|
+
adapter: FileSystem;
|
|
53
|
+
root?: string;
|
|
54
|
+
cwd?: string;
|
|
55
|
+
signal?: AbortSignal;
|
|
56
|
+
fs?: never;
|
|
57
|
+
};
|
|
58
|
+
export type FsModule = Pick<FsImplementation, FsPassthroughName> & {
|
|
59
|
+
readFile(path: PathLike, options: ReadFileOptions): Promise<string>;
|
|
60
|
+
readlink(path: PathLike, options?: EncodingOptions): Promise<string>;
|
|
61
|
+
realpath(path: PathLike, options?: EncodingOptions): Promise<string>;
|
|
62
|
+
mkdtemp(prefix: string, options?: EncodingOptions): Promise<string>;
|
|
63
|
+
readdir: {
|
|
64
|
+
(path: PathLike, options: ReaddirOptions & {
|
|
65
|
+
withFileTypes: true;
|
|
66
|
+
}): Promise<SandboxDirent[]>;
|
|
67
|
+
(path: PathLike, options?: StringEncoding | (ReaddirOptions & {
|
|
68
|
+
withFileTypes?: false;
|
|
69
|
+
})): Promise<string[]>;
|
|
70
|
+
};
|
|
71
|
+
stat(path: PathLike, options?: StatOptions): Promise<SandboxStats>;
|
|
72
|
+
lstat(path: PathLike, options?: StatOptions): Promise<SandboxStats>;
|
|
73
|
+
constants: {
|
|
74
|
+
F_OK: number;
|
|
75
|
+
R_OK: number;
|
|
76
|
+
W_OK: number;
|
|
77
|
+
X_OK: number;
|
|
78
|
+
COPYFILE_EXCL: number;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export declare function makeFsModule(options?: FsModuleOptions): FsModule;
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type SandboxValue } from "../interp/values.js";
|
|
2
|
+
export type HarnessFrontmatter = Record<string, SandboxValue>;
|
|
3
|
+
export type HarnessModuleMeta = {
|
|
4
|
+
kind: SandboxValue;
|
|
5
|
+
version: SandboxValue;
|
|
6
|
+
filepath: string;
|
|
7
|
+
frontmatter: HarnessFrontmatter;
|
|
8
|
+
};
|
|
9
|
+
export type HarnessModule = {
|
|
10
|
+
tasks: SandboxValue;
|
|
11
|
+
agents: SandboxValue;
|
|
12
|
+
meta: HarnessModuleMeta;
|
|
13
|
+
applyConstraints: (prompt: string) => string;
|
|
14
|
+
};
|
|
15
|
+
export declare function makeHarnessModule(frontmatter: Record<string, unknown>, meta: {
|
|
16
|
+
kind: unknown;
|
|
17
|
+
version: unknown;
|
|
18
|
+
filepath: string;
|
|
19
|
+
}): HarnessModule;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type LogModuleEntry = {
|
|
2
|
+
ts: string;
|
|
3
|
+
type: "info" | "error";
|
|
4
|
+
args: unknown[];
|
|
5
|
+
} | {
|
|
6
|
+
ts: string;
|
|
7
|
+
type: "event";
|
|
8
|
+
name: string;
|
|
9
|
+
payload: unknown;
|
|
10
|
+
};
|
|
11
|
+
export type LogModuleSink = (entry: LogModuleEntry) => void;
|
|
12
|
+
export declare function makeLogModule(sink?: LogModuleSink): {
|
|
13
|
+
info: (...args: unknown[]) => void;
|
|
14
|
+
error: (...args: unknown[]) => void;
|
|
15
|
+
event: (name: string, payload: unknown) => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { McpClient, type HttpTransportFetch, type StdioSpawn } from "../../tiny-mcp-client/index.js";
|
|
2
|
+
export type McpServerConfig = {
|
|
3
|
+
command: string;
|
|
4
|
+
args?: string[];
|
|
5
|
+
cwd?: string;
|
|
6
|
+
env?: Record<string, string>;
|
|
7
|
+
} | {
|
|
8
|
+
url: string;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
export type McpModuleOptions = {
|
|
12
|
+
servers: Record<string, McpServerConfig>;
|
|
13
|
+
requestTimeoutMs?: number;
|
|
14
|
+
closeTimeoutMs?: number;
|
|
15
|
+
maxToolPages?: number;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
fetch?: HttpTransportFetch;
|
|
18
|
+
spawn?: StdioSpawn;
|
|
19
|
+
};
|
|
20
|
+
export type ManagedMcpConnection = {
|
|
21
|
+
ready: Promise<McpClient>;
|
|
22
|
+
close(): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
export declare function parseMcpConfig(source: string, directory: string): McpModuleOptions;
|
|
25
|
+
export declare function normalizeMcpOptions(value: unknown, keys?: string[]): McpModuleOptions;
|
|
26
|
+
export declare function connectMcpTransport(server: McpServerConfig, options: McpModuleOptions, signal?: AbortSignal): ManagedMcpConnection;
|