@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,184 @@
|
|
|
1
|
+
import { Json } from "./json.js";
|
|
2
|
+
import { OneOf } from "./oneof.js";
|
|
3
|
+
import { Record as RecordBuilder } from "./record.js";
|
|
4
|
+
import { Union } from "./union.js";
|
|
5
|
+
import { validate } from "./validate.js";
|
|
6
|
+
import type { JsonValue, JsonValueSchema } from "./json.js";
|
|
7
|
+
import type { JsonSchemaDocument, JsonSchemaDocumentOptions } from "./json-schema-document.js";
|
|
8
|
+
import type { OneOfSchema } from "./oneof.js";
|
|
9
|
+
import type { RecordSchema } from "./record.js";
|
|
10
|
+
import type { UnionSchema } from "./union.js";
|
|
11
|
+
import type { ValidationIssue, ValidationResult } from "./validate.js";
|
|
12
|
+
type JsonSchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object";
|
|
13
|
+
type SchemaKind = "string" | "number" | "boolean" | "enum" | "array" | "object" | "optional" | "oneOf" | "union" | "record" | "json";
|
|
14
|
+
type EnumValue = string | number | boolean;
|
|
15
|
+
type JsonSchemaEnumValue = EnumValue | null;
|
|
16
|
+
type NumberJsonType = "number" | "integer";
|
|
17
|
+
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
18
|
+
type ObjectShape = Record<string, AnySchema>;
|
|
19
|
+
type EmptyOptions = Record<never, never>;
|
|
20
|
+
type SchemaScope = "cli" | "mcp" | "sdk";
|
|
21
|
+
export type CliOutputMode = "rich" | "md" | "json";
|
|
22
|
+
export interface CliMissingParameterChoice<TValue> {
|
|
23
|
+
label: string;
|
|
24
|
+
value: TValue;
|
|
25
|
+
}
|
|
26
|
+
export interface CliMissingParameterContext {
|
|
27
|
+
commandPath: string;
|
|
28
|
+
params: Readonly<Record<string, unknown>>;
|
|
29
|
+
output: CliOutputMode;
|
|
30
|
+
stdinTTY: boolean;
|
|
31
|
+
stdoutTTY: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface CliMissingParameterResolution<TValue> {
|
|
34
|
+
choices: readonly CliMissingParameterChoice<TValue>[];
|
|
35
|
+
message?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface CliSchemaOptions<TValue> {
|
|
38
|
+
resolveMissing?: (context: CliMissingParameterContext) => CliMissingParameterResolution<TValue> | undefined | Promise<CliMissingParameterResolution<TValue> | undefined>;
|
|
39
|
+
}
|
|
40
|
+
type StringMetadata = {
|
|
41
|
+
format?: string;
|
|
42
|
+
maxLength?: number;
|
|
43
|
+
minLength?: number;
|
|
44
|
+
pattern?: string;
|
|
45
|
+
secret?: boolean;
|
|
46
|
+
};
|
|
47
|
+
type NumberMetadata = {
|
|
48
|
+
maximum?: number;
|
|
49
|
+
minimum?: number;
|
|
50
|
+
secret?: boolean;
|
|
51
|
+
};
|
|
52
|
+
type ArrayMetadata = {
|
|
53
|
+
maxItems?: number;
|
|
54
|
+
minItems?: number;
|
|
55
|
+
};
|
|
56
|
+
type ObjectMetadata = {
|
|
57
|
+
additionalProperties?: boolean;
|
|
58
|
+
};
|
|
59
|
+
type OptionalKeys<TShape extends ObjectShape> = {
|
|
60
|
+
[TKey in keyof TShape]: TShape[TKey] extends OptionalSchema<any> ? TKey : never;
|
|
61
|
+
}[keyof TShape];
|
|
62
|
+
type RequiredKeys<TShape extends ObjectShape> = Exclude<keyof TShape, OptionalKeys<TShape>>;
|
|
63
|
+
type PropertyStatic<TSchema extends AnySchema> = TSchema extends OptionalSchema<infer TInner> ? Static<TInner> : Static<TSchema>;
|
|
64
|
+
type InferObject<TShape extends ObjectShape> = {
|
|
65
|
+
[TKey in RequiredKeys<TShape>]: PropertyStatic<TShape[TKey]>;
|
|
66
|
+
} & {
|
|
67
|
+
[TKey in OptionalKeys<TShape>]?: PropertyStatic<TShape[TKey]>;
|
|
68
|
+
};
|
|
69
|
+
type SchemaOptions<TDefault> = {
|
|
70
|
+
cli?: CliSchemaOptions<TDefault>;
|
|
71
|
+
description?: string;
|
|
72
|
+
cliDescription?: string;
|
|
73
|
+
cliAliases?: readonly string[];
|
|
74
|
+
default?: TDefault;
|
|
75
|
+
nullable?: boolean;
|
|
76
|
+
requiredScopes?: readonly SchemaScope[];
|
|
77
|
+
short?: string;
|
|
78
|
+
scope?: readonly SchemaScope[];
|
|
79
|
+
global?: boolean;
|
|
80
|
+
};
|
|
81
|
+
type WithNullable<TSchema extends AnySchema, TOptions extends {
|
|
82
|
+
nullable?: boolean;
|
|
83
|
+
}> = TOptions extends {
|
|
84
|
+
readonly nullable: true;
|
|
85
|
+
} ? TSchema & {
|
|
86
|
+
readonly nullable: true;
|
|
87
|
+
} : TSchema;
|
|
88
|
+
export interface SchemaBase<TKind extends SchemaKind, TStatic> {
|
|
89
|
+
readonly kind: TKind;
|
|
90
|
+
readonly cli?: CliSchemaOptions<TStatic>;
|
|
91
|
+
readonly description?: string;
|
|
92
|
+
readonly cliDescription?: string;
|
|
93
|
+
readonly cliAliases?: readonly string[];
|
|
94
|
+
readonly default?: TStatic;
|
|
95
|
+
readonly nullable?: boolean;
|
|
96
|
+
readonly requiredScopes?: readonly SchemaScope[];
|
|
97
|
+
readonly short?: string;
|
|
98
|
+
readonly scope?: readonly SchemaScope[];
|
|
99
|
+
readonly global?: boolean;
|
|
100
|
+
readonly __static?: TStatic;
|
|
101
|
+
}
|
|
102
|
+
export interface JsonSchema {
|
|
103
|
+
additionalProperties?: boolean | JsonSchema;
|
|
104
|
+
type?: JsonSchemaType;
|
|
105
|
+
description?: string;
|
|
106
|
+
default?: unknown;
|
|
107
|
+
enum?: ReadonlyArray<JsonSchemaEnumValue>;
|
|
108
|
+
format?: string;
|
|
109
|
+
items?: JsonSchema;
|
|
110
|
+
maxItems?: number;
|
|
111
|
+
maximum?: number;
|
|
112
|
+
maxLength?: number;
|
|
113
|
+
minItems?: number;
|
|
114
|
+
minimum?: number;
|
|
115
|
+
minLength?: number;
|
|
116
|
+
nullable?: boolean;
|
|
117
|
+
oneOf?: JsonSchema[];
|
|
118
|
+
pattern?: string;
|
|
119
|
+
properties?: Record<string, JsonSchema>;
|
|
120
|
+
required?: string[];
|
|
121
|
+
}
|
|
122
|
+
export interface StringSchema extends SchemaBase<"string", string>, StringMetadata {
|
|
123
|
+
}
|
|
124
|
+
export interface NumberSchema extends SchemaBase<"number", number>, NumberMetadata {
|
|
125
|
+
readonly jsonType?: NumberJsonType;
|
|
126
|
+
}
|
|
127
|
+
export type BooleanSchema = SchemaBase<"boolean", boolean>;
|
|
128
|
+
export interface EnumSchema<TValues extends NonEmptyReadonlyArray<EnumValue>> extends SchemaBase<"enum", TValues[number]> {
|
|
129
|
+
readonly values: TValues;
|
|
130
|
+
readonly jsonType?: "integer";
|
|
131
|
+
readonly labels?: Partial<Record<string, string>>;
|
|
132
|
+
readonly loadOptions?: (() => Array<{
|
|
133
|
+
label: string;
|
|
134
|
+
value: string;
|
|
135
|
+
}>) | (() => Promise<Array<{
|
|
136
|
+
label: string;
|
|
137
|
+
value: string;
|
|
138
|
+
}>>);
|
|
139
|
+
}
|
|
140
|
+
export interface ArraySchema<TItem extends AnySchema> extends SchemaBase<"array", Array<Static<TItem>>>, ArrayMetadata {
|
|
141
|
+
readonly item: TItem;
|
|
142
|
+
}
|
|
143
|
+
export interface ObjectSchema<TShape extends ObjectShape> extends SchemaBase<"object", InferObject<TShape>>, ObjectMetadata {
|
|
144
|
+
readonly shape: TShape;
|
|
145
|
+
}
|
|
146
|
+
export interface OptionalSchema<TInner extends AnySchema> extends SchemaBase<"optional", Static<TInner> | undefined> {
|
|
147
|
+
readonly inner: TInner;
|
|
148
|
+
}
|
|
149
|
+
export type AnySchema = StringSchema | NumberSchema | BooleanSchema | EnumSchema<NonEmptyReadonlyArray<EnumValue>> | ArraySchema<AnySchema> | ObjectSchema<ObjectShape> | OptionalSchema<AnySchema> | OneOfSchema<Record<string, ObjectSchema<any>>, string> | UnionSchema<readonly ObjectSchema<any>[]> | RecordSchema<AnySchema> | JsonValueSchema;
|
|
150
|
+
export type Static<TSchema extends AnySchema> = TSchema extends {
|
|
151
|
+
readonly nullable: true;
|
|
152
|
+
} ? TSchema extends SchemaBase<any, infer TStatic> ? TStatic | null : never : TSchema extends SchemaBase<any, infer TStatic> ? TStatic : never;
|
|
153
|
+
export declare const S: {
|
|
154
|
+
readonly String: <const TOptions extends SchemaOptions<string> & StringMetadata = EmptyOptions>(options?: TOptions) => WithNullable<StringSchema, TOptions>;
|
|
155
|
+
readonly Number: <const TOptions extends SchemaOptions<number> & NumberMetadata & {
|
|
156
|
+
jsonType?: NumberJsonType;
|
|
157
|
+
} = EmptyOptions>(options?: TOptions) => WithNullable<NumberSchema, TOptions>;
|
|
158
|
+
readonly Boolean: <const TOptions extends SchemaOptions<boolean> = EmptyOptions>(options?: TOptions) => WithNullable<BooleanSchema, TOptions>;
|
|
159
|
+
readonly Enum: <const TValues extends NonEmptyReadonlyArray<EnumValue>, const TOptions extends SchemaOptions<TValues[number]> & {
|
|
160
|
+
jsonType?: "integer";
|
|
161
|
+
labels?: Partial<Record<string, string>>;
|
|
162
|
+
loadOptions?: (() => Array<{
|
|
163
|
+
label: string;
|
|
164
|
+
value: string;
|
|
165
|
+
}>) | (() => Promise<Array<{
|
|
166
|
+
label: string;
|
|
167
|
+
value: string;
|
|
168
|
+
}>>);
|
|
169
|
+
} = EmptyOptions>(values: TValues, options?: TOptions) => WithNullable<EnumSchema<TValues>, TOptions>;
|
|
170
|
+
readonly Array: <TItem extends AnySchema, const TOptions extends SchemaOptions<Array<Static<TItem>>> & ArrayMetadata = EmptyOptions>(item: TItem, options?: TOptions) => WithNullable<ArraySchema<TItem>, TOptions>;
|
|
171
|
+
readonly Object: <const TShape extends ObjectShape, const TOptions extends SchemaOptions<InferObject<TShape>> & ObjectMetadata = EmptyOptions>(shape: TShape, options?: TOptions) => WithNullable<ObjectSchema<TShape>, TOptions>;
|
|
172
|
+
readonly Optional: <TInner extends AnySchema>(inner: TInner) => OptionalSchema<TInner>;
|
|
173
|
+
readonly OneOf: typeof OneOf;
|
|
174
|
+
readonly Union: typeof Union;
|
|
175
|
+
readonly Record: typeof RecordBuilder;
|
|
176
|
+
readonly Json: typeof Json;
|
|
177
|
+
};
|
|
178
|
+
export declare function toJsonSchema(schema: AnySchema): JsonSchema;
|
|
179
|
+
export declare function toJsonSchemaDocument(schema: AnySchema, options?: JsonSchemaDocumentOptions): JsonSchemaDocument;
|
|
180
|
+
export { Json, OneOf, RecordBuilder as Record, Union, validate };
|
|
181
|
+
export { compileJsonSchema, formatIssues } from "./json-schema/index.js";
|
|
182
|
+
export type { CompileJsonSchemaOptions, CompiledJsonSchema } from "./json-schema/index.js";
|
|
183
|
+
export type { JsonSchemaDocument, JsonSchemaDocumentOptions } from "./json-schema-document.js";
|
|
184
|
+
export type { JsonValue, JsonValueSchema, OneOfSchema, RecordSchema, UnionSchema, ValidationIssue, ValidationResult };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ValidationIssue } from "../validate.js";
|
|
2
|
+
import type { CompileJsonSchemaOptions, CompiledJsonSchema } from "./types.js";
|
|
3
|
+
export type { CompileJsonSchemaOptions, CompiledJsonSchema } from "./types.js";
|
|
4
|
+
export declare function compileJsonSchema(schema: unknown, options?: CompileJsonSchemaOptions): CompiledJsonSchema;
|
|
5
|
+
export declare function formatIssues(issues: readonly ValidationIssue[]): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ValidationIssue, ValidationResult } from "../validate.js";
|
|
2
|
+
export type JsonSchemaRegistry = Record<string, unknown>;
|
|
3
|
+
export interface CompileJsonSchemaOptions {
|
|
4
|
+
registry?: JsonSchemaRegistry;
|
|
5
|
+
}
|
|
6
|
+
export interface CompiledJsonSchema {
|
|
7
|
+
validate(value: unknown): ValidationResult<unknown>;
|
|
8
|
+
}
|
|
9
|
+
export type Dialect = "draft7" | "draft2020-12";
|
|
10
|
+
export type SchemaObject = Record<string, unknown>;
|
|
11
|
+
export type JsonSchema = boolean | SchemaObject;
|
|
12
|
+
export interface SchemaNode {
|
|
13
|
+
schema: JsonSchema;
|
|
14
|
+
documentId: string;
|
|
15
|
+
dialect: Dialect;
|
|
16
|
+
baseUri: string;
|
|
17
|
+
resourceUri: string;
|
|
18
|
+
resourceRoot: SchemaNode;
|
|
19
|
+
pointer: string;
|
|
20
|
+
validationVocabulary: boolean;
|
|
21
|
+
children: Map<string, SchemaNode>;
|
|
22
|
+
}
|
|
23
|
+
export interface EvaluationResult {
|
|
24
|
+
valid: boolean;
|
|
25
|
+
issues: ValidationIssue[];
|
|
26
|
+
evaluatedProperties: Set<string>;
|
|
27
|
+
evaluatedItems: Set<number>;
|
|
28
|
+
}
|
|
29
|
+
export interface EvaluationContext {
|
|
30
|
+
instancePath: readonly string[];
|
|
31
|
+
dynamicScope: readonly SchemaNode[];
|
|
32
|
+
activePairs: Map<SchemaNode, Set<unknown>>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JsonSchema } from "./index.js";
|
|
2
|
+
export interface JsonSchemaDocumentOptions {
|
|
3
|
+
id?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
schema?: string;
|
|
7
|
+
}
|
|
8
|
+
export type JsonSchemaDocument = JsonSchema & {
|
|
9
|
+
$schema: string;
|
|
10
|
+
$id?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function createJsonSchemaDocument(jsonSchema: JsonSchema, options?: JsonSchemaDocumentOptions): JsonSchemaDocument;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SchemaBase } from "./index.js";
|
|
2
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JsonValue = JsonPrimitive | {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
} | JsonValue[];
|
|
6
|
+
export interface JsonValueSchema extends SchemaBase<"json", JsonValue> {
|
|
7
|
+
readonly kind: "json";
|
|
8
|
+
}
|
|
9
|
+
export declare function Json(): JsonValueSchema;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ObjectSchema, SchemaBase, Static } from "./index.js";
|
|
2
|
+
type OneOfStatic<TBranches extends Record<string, ObjectSchema<any>>, TDiscriminator extends string> = {
|
|
3
|
+
[TBranchName in keyof TBranches & string]: Omit<Static<TBranches[TBranchName]>, TDiscriminator> & {
|
|
4
|
+
[TFieldName in TDiscriminator]: TBranchName;
|
|
5
|
+
};
|
|
6
|
+
}[keyof TBranches & string];
|
|
7
|
+
export interface OneOfSchema<TBranches extends Record<string, ObjectSchema<any>>, TDiscriminator extends string = string> extends SchemaBase<"oneOf", OneOfStatic<TBranches, TDiscriminator>> {
|
|
8
|
+
readonly discriminator: TDiscriminator;
|
|
9
|
+
readonly branches: TBranches;
|
|
10
|
+
}
|
|
11
|
+
export declare function OneOf<TDiscriminator extends string, TBranches extends Record<string, ObjectSchema<any>>>(config: {
|
|
12
|
+
discriminator: TDiscriminator;
|
|
13
|
+
branches: TBranches;
|
|
14
|
+
}): OneOfSchema<TBranches, TDiscriminator>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AnySchema, SchemaBase, Static } from "./index.js";
|
|
2
|
+
export interface RecordSchema<TValue extends AnySchema> extends SchemaBase<"record", Record<string, Static<TValue>>> {
|
|
3
|
+
readonly value: TValue;
|
|
4
|
+
}
|
|
5
|
+
export declare function Record<TValue extends AnySchema>(value: TValue): RecordSchema<TValue>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ObjectSchema, SchemaBase, Static } from "./index.js";
|
|
2
|
+
type UnionStatic<TBranches extends readonly ObjectSchema<any>[]> = Static<TBranches[number]>;
|
|
3
|
+
export interface UnionSchema<TBranches extends readonly ObjectSchema<any>[]> extends SchemaBase<"union", UnionStatic<TBranches>> {
|
|
4
|
+
readonly branches: TBranches;
|
|
5
|
+
}
|
|
6
|
+
export declare function getRequiredKeyFingerprint(schema: ObjectSchema<any>): string;
|
|
7
|
+
export declare function Union<const TBranches extends readonly ObjectSchema<any>[]>(branches: TBranches): UnionSchema<TBranches>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AnySchema, Static } from "./index.js";
|
|
2
|
+
export type SchemaDescriptor = AnySchema;
|
|
3
|
+
export type ValidationIssue = {
|
|
4
|
+
path: readonly string[];
|
|
5
|
+
expected: string;
|
|
6
|
+
received: string;
|
|
7
|
+
message: string;
|
|
8
|
+
keyword?: string;
|
|
9
|
+
};
|
|
10
|
+
export type ValidationResult<T> = {
|
|
11
|
+
ok: true;
|
|
12
|
+
value: T;
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
issues: readonly ValidationIssue[];
|
|
16
|
+
};
|
|
17
|
+
export declare function validate<S extends SchemaDescriptor>(schema: S, value: unknown): ValidationResult<Static<S>>;
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@poe-platform/safe-js",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Budgeted JavaScript interpreter with explicit host capabilities and resumable execution",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18.18"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
"./fs": {
|
|
15
|
+
"types": {
|
|
16
|
+
"browser": "./dist/safe-fs/core.d.ts",
|
|
17
|
+
"default": "./dist/safe-fs/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"browser": "./dist/safe-js/browser/safe-fs.js",
|
|
20
|
+
"import": "./dist/safe-js/safe-fs.js"
|
|
21
|
+
},
|
|
22
|
+
"./fs/core": {
|
|
23
|
+
"types": {
|
|
24
|
+
"browser": "./dist/safe-fs/core.d.ts",
|
|
25
|
+
"default": "./dist/safe-fs/core.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"browser": "./dist/safe-js/browser/safe-fs-core.js",
|
|
28
|
+
"import": "./dist/safe-js/safe-fs-core.js"
|
|
29
|
+
},
|
|
30
|
+
"./fs/node": {
|
|
31
|
+
"types": {
|
|
32
|
+
"browser": "./dist/safe-fs/node-unavailable.d.ts",
|
|
33
|
+
"default": "./dist/safe-fs/node-host.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"browser": null,
|
|
36
|
+
"import": "./dist/safe-js/safe-fs-node.js"
|
|
37
|
+
},
|
|
38
|
+
".": {
|
|
39
|
+
"types": {
|
|
40
|
+
"browser": "./dist/safe-fs/node-unavailable.d.ts",
|
|
41
|
+
"default": "./dist/safe-js/index.d.ts"
|
|
42
|
+
},
|
|
43
|
+
"browser": null,
|
|
44
|
+
"import": "./dist/safe-js/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./core": {
|
|
47
|
+
"types": {
|
|
48
|
+
"browser": "./dist/safe-fs/node-unavailable.d.ts",
|
|
49
|
+
"default": "./dist/safe-js/core.d.ts"
|
|
50
|
+
},
|
|
51
|
+
"browser": null,
|
|
52
|
+
"import": "./dist/safe-js/core.js"
|
|
53
|
+
},
|
|
54
|
+
"./cli": {
|
|
55
|
+
"types": {
|
|
56
|
+
"browser": "./dist/safe-fs/node-unavailable.d.ts",
|
|
57
|
+
"default": "./dist/safe-js/cli.d.ts"
|
|
58
|
+
},
|
|
59
|
+
"browser": null,
|
|
60
|
+
"import": "./dist/safe-js/cli.js"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "git+https://github.com/poe-platform/poe-code.git",
|
|
66
|
+
"directory": "packages/safe-js"
|
|
67
|
+
},
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"yaml": "^2.8.2",
|
|
73
|
+
"jose": "^6.1.3",
|
|
74
|
+
"@types/node": "^25.2.2"
|
|
75
|
+
},
|
|
76
|
+
"imports": {
|
|
77
|
+
"#safe-fs-platform": {
|
|
78
|
+
"types": {
|
|
79
|
+
"browser": "./dist/safe-fs/platform/browser.d.ts",
|
|
80
|
+
"default": "./dist/safe-fs/platform/node.d.ts"
|
|
81
|
+
},
|
|
82
|
+
"default": null
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"bin": {
|
|
86
|
+
"poe-safejs": "./dist/safe-js/cli.js",
|
|
87
|
+
"poe-safe-js": "./dist/safe-js/cli.js"
|
|
88
|
+
}
|
|
89
|
+
}
|