poe-code 3.0.264 → 3.0.265
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/dist/cli/commands/harness.js +9 -3
- package/dist/cli/commands/harness.js.map +1 -1
- package/dist/cli/program.js +1 -1
- package/dist/cli/program.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +329 -313
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/package.json +5 -5
- package/packages/agent-harness/dist/loader/extract-schema.js +1 -1
- package/packages/agent-harness/dist/loader/run.d.ts +1 -1
- package/packages/agent-harness/dist/loader/run.js +1 -1
- package/packages/maestro-tui/dist/run.js +1 -1
- package/packages/{agent-script → safejs}/dist/cli.js +6 -5
- package/packages/safejs/dist/dump.d.ts +2 -0
- package/packages/safejs/dist/dump.js +2 -0
- package/packages/{agent-script → safejs}/dist/interp/globals/collections.js +2 -2
- package/packages/{agent-script → safejs}/dist/interp/interpreter.js +1 -3
- package/packages/{agent-script → safejs}/dist/lint/rules/AS-import-cycle.js +2 -2
- package/packages/{agent-script → safejs}/dist/lint/rules/AS005.js +3 -1
- package/packages/{agent-script → safejs}/dist/lint/rules/AS014.js +2 -2
- package/packages/{agent-script → safejs}/dist/lint/rules/module-registry.d.ts +2 -2
- package/packages/{agent-script → safejs}/dist/lint/rules/module-registry.js +1 -1
- package/packages/{agent-script → safejs}/dist/loader/extract-block.js +20 -12
- package/packages/{agent-script → safejs}/dist/loader/frontmatter.js +2 -2
- package/packages/{agent-script → safejs}/dist/modules/agent.js +16 -15
- package/packages/{agent-script → safejs}/dist/modules/git.js +3 -9
- package/packages/{agent-script → safejs}/dist/modules/mcp.js +2 -6
- package/packages/{agent-script → safejs}/dist/restore.d.ts +2 -2
- package/packages/{agent-script → safejs}/dist/run.d.ts +3 -3
- package/packages/{agent-script → safejs}/dist/runner/run-harness.js +13 -2
- package/packages/{agent-script → safejs}/dist/snapshot/backend.d.ts +2 -2
- package/packages/{agent-script → safejs}/dist/snapshot/backend.js +2 -2
- package/packages/{agent-script → safejs}/dist/snapshot/dump-format.d.ts +1 -1
- package/packages/{agent-script → safejs}/dist/snapshot/dump-format.js +2 -2
- package/packages/{agent-script → safejs}/dist/snapshot/dump.js +3 -3
- package/packages/toolcraft-codemode/dist/execute.d.ts +1 -1
- package/packages/toolcraft-codemode/dist/execute.js +3 -3
- package/packages/agent-script/dist/dump.d.ts +0 -2
- package/packages/agent-script/dist/dump.js +0 -2
- /package/packages/{agent-maestro → maestro}/dist/__test_utils__/event-collector.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/__test_utils__/event-collector.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/__test_utils__/fixtures.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/__test_utils__/fixtures.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/__test_utils__/index.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/__test_utils__/index.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/__test_utils__/mock-spawn.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/__test_utils__/mock-spawn.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/__test_utils__/mock-task-list.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/__test_utils__/mock-task-list.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/agent/runner.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/agent/runner.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/config/load.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/config/load.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/config/schema.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/config/schema.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/config/task-list.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/config/task-list.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/config/validate.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/config/validate.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/experiment.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/experiment.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/harness.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/harness.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/index.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/index.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/kind.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/kind.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/pipeline.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/pipeline.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/ralph.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/ralph.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/registry.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/registry.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/superintendent.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/superintendent.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/types.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/types.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/unsupported.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/drivers/unsupported.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/error-codes.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/error-codes.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/index.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/index.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/prompt/render.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/prompt/render.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/advance.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/advance.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/loop.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/loop.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/phases.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/phases.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/reconcile.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/reconcile.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/retry.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/retry.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/sanitize.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/sanitize.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/state.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/runtime/state.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/state-machine.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/state-machine.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/tick-command.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/tick-command.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/workflow-path.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/workflow-path.js +0 -0
- /package/packages/{agent-maestro → maestro}/dist/workspace/manager.d.ts +0 -0
- /package/packages/{agent-maestro → maestro}/dist/workspace/manager.js +0 -0
- /package/packages/{agent-script → safejs}/dist/cli.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/core.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/core.js +0 -0
- /package/packages/{agent-script → safejs}/dist/error/format.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/error/format.js +0 -0
- /package/packages/{agent-script → safejs}/dist/error/shape.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/error/shape.js +0 -0
- /package/packages/{agent-script → safejs}/dist/error-codes.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/error-codes.js +0 -0
- /package/packages/{agent-script → safejs}/dist/example-runner.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/example-runner.js +0 -0
- /package/packages/{agent-script → safejs}/dist/graph-depth.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/graph-depth.js +0 -0
- /package/packages/{agent-script → safejs}/dist/index.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/index.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/async.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/async.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/budget.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/budget.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/cancel.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/cancel.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/exceptions.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/exceptions.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/generator.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/generator.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/collections.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/console-json.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/console-json.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/error.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/error.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/math.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/math.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/misc.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/misc.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/object-array.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/object-array.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/regex.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/globals/regex.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/host-bridge.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/host-bridge.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/host-call.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/host-call.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/interpreter.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/iteration.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/iteration.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/array.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/array.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/function.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/function.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/generator.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/generator.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/map.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/map.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/number.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/number.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/regex.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/regex.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/set.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/set.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/string.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/methods/string.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/patterns.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/patterns.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/promise-tracker.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/promise-tracker.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/promise.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/promise.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/regex/engine.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/regex/engine.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/regex/parse.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/regex/parse.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/running-state.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/running-state.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/scope.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/scope.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/values.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/values.js +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/var-hoist.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/interp/var-hoist.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/index.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/index.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-async-not-needed.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-async-not-needed.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-await-non-promise.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-await-non-promise.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-destructure-null-default.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-destructure-null-default.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-export-import-meta.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-export-import-meta.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-floating-promise.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-floating-promise.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-frontmatter-field-unused.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-frontmatter-field-unused.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-import-cycle.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-jsdoc-type.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-jsdoc-type.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-large-literal.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-large-literal.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-missing-async.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-missing-async.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-mutating-frozen.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-mutating-frozen.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-needless-template.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-needless-template.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-shadow-global.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-shadow-global.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-unbounded-loop.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-unbounded-loop.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-unreachable.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-unreachable.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-unused-import.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS-unused-import.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS001.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS001.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS002.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS002.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS003.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS003.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS004.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS004.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS005.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS006-007.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS006-007.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS008.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS008.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS009.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS009.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS010.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS010.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS011.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS011.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS012.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS012.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS013.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS013.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS014.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS015.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/AS015.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/known-globals.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/rules/known-globals.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/runtime-modules.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint/runtime-modules.js +0 -0
- /package/packages/{agent-script → safejs}/dist/lint.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/lint.js +0 -0
- /package/packages/{agent-script → safejs}/dist/loader/extract-block.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/loader/find-exported.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/loader/find-exported.js +0 -0
- /package/packages/{agent-script → safejs}/dist/loader/frontmatter.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/agent.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/env.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/env.js +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/fail.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/fail.js +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/git.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/harness.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/harness.js +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/log.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/log.js +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/mcp.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/metric.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/metric.js +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/registry.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/registry.js +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/time.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/modules/time.js +0 -0
- /package/packages/{agent-script → safejs}/dist/observability/otel.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/observability/otel.js +0 -0
- /package/packages/{agent-script → safejs}/dist/output-stream.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/output-stream.js +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/assign-ids.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/assign-ids.js +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/format-error.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/format-error.js +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/hash.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/hash.js +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/parse-export.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/parse-export.js +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/parse-import-meta.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/parse-import-meta.js +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/parser.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/parser.js +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/tokenizer.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/parse/tokenizer.js +0 -0
- /package/packages/{agent-script → safejs}/dist/parse.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/parse.js +0 -0
- /package/packages/{agent-script → safejs}/dist/restore.js +0 -0
- /package/packages/{agent-script → safejs}/dist/run.js +0 -0
- /package/packages/{agent-script → safejs}/dist/runner/run-harness.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/runner/signal-dump.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/runner/signal-dump.js +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/dump.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/policy.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/policy.js +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/restore.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/restore.js +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/scheduler.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/scheduler.js +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/serialize.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/serialize.js +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/validation.d.ts +0 -0
- /package/packages/{agent-script → safejs}/dist/snapshot/validation.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-code",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.265",
|
|
4
4
|
"description": "CLI tool to configure Poe API for developer workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
"packages/agent-traces/dist",
|
|
120
120
|
"packages/agent-hook-config/dist",
|
|
121
121
|
"packages/agent-human-in-loop/dist",
|
|
122
|
-
"packages/
|
|
123
|
-
"packages/
|
|
122
|
+
"packages/maestro/dist",
|
|
123
|
+
"packages/safejs/dist",
|
|
124
124
|
"packages/agent-spawn/dist",
|
|
125
125
|
"packages/auth-store/dist",
|
|
126
126
|
"packages/braintrust/dist",
|
|
@@ -213,9 +213,9 @@
|
|
|
213
213
|
"@poe-code/agent-harness-tools": "*",
|
|
214
214
|
"@poe-code/agent-hook-config": "*",
|
|
215
215
|
"@poe-code/agent-human-in-loop": "*",
|
|
216
|
-
"@poe-code/
|
|
216
|
+
"@poe-code/maestro": "*",
|
|
217
217
|
"@poe-code/agent-mcp-config": "*",
|
|
218
|
-
"@poe-code/
|
|
218
|
+
"@poe-code/safejs": "*",
|
|
219
219
|
"@poe-code/agent-skill-config": "*",
|
|
220
220
|
"@poe-code/agent-spawn": "*",
|
|
221
221
|
"@poe-code/agent-traces": "*",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Budget, deepCopyFromSandbox, findExportedConstInitializer, parseModule, run } from "@poe-code/
|
|
1
|
+
import { Budget, deepCopyFromSandbox, findExportedConstInitializer, parseModule, run } from "@poe-code/safejs";
|
|
2
2
|
import { makeSchemaModule } from "../modules/schema.js";
|
|
3
3
|
const SCHEMA_EXTRACTION_BUDGET = {
|
|
4
4
|
arrayLength: 1_000,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { lint, run, type Diagnostic, type OtelSink, type SnapshotBackend, type SpawnUsageTotal } from "../../../
|
|
1
|
+
import { lint, run, type Diagnostic, type OtelSink, type SnapshotBackend, type SpawnUsageTotal } from "../../../safejs/dist/index.js";
|
|
2
2
|
type LintOptions = NonNullable<Parameters<typeof lint>[1]>;
|
|
3
3
|
export type RunResult = Awaited<ReturnType<typeof run>> & {
|
|
4
4
|
usage: SpawnUsageTotal;
|
|
@@ -3,7 +3,7 @@ import { lstat, mkdir, readFile, rename, unlink, writeFile } from "node:fs/promi
|
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import { dirname, join, parse, resolve, sep } from "node:path";
|
|
5
5
|
import { resolveRunLogDir } from "@poe-code/agent-harness-tools";
|
|
6
|
-
import { lint, FileSnapshotBackend, createSpawnUsageAccumulator, makeTimeModule, run, splitFrontmatter, runWithSpawnUsageAccumulator } from "@poe-code/
|
|
6
|
+
import { lint, FileSnapshotBackend, createSpawnUsageAccumulator, makeTimeModule, run, splitFrontmatter, runWithSpawnUsageAccumulator } from "@poe-code/safejs";
|
|
7
7
|
import { hasOwnErrorCode } from "../error-codes.js";
|
|
8
8
|
import { makeSchemaModule } from "../modules/schema.js";
|
|
9
9
|
import { extractSchema } from "./extract-schema.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { loadWorkflow, resolveConfig, resolveConfiguredTaskListOptions, resolveWorkflowPath } from "@poe-code/
|
|
2
|
+
import { loadWorkflow, resolveConfig, resolveConfiguredTaskListOptions, resolveWorkflowPath } from "@poe-code/maestro";
|
|
3
3
|
import { runExplorer } from "toolcraft-design";
|
|
4
4
|
import { openTaskList } from "@poe-code/task-list";
|
|
5
5
|
import { buildMaestroExplorerConfig } from "./explorer-config.js";
|
|
@@ -190,9 +190,7 @@ async function runScriptFile(filepath, parsed, options) {
|
|
|
190
190
|
if (options.brokenPipe.closed) {
|
|
191
191
|
return 0;
|
|
192
192
|
}
|
|
193
|
-
return lintErrors.some((diagnostic) => diagnostic.code === "AS001")
|
|
194
|
-
? EXIT_PARSE
|
|
195
|
-
: EXIT_RUNTIME;
|
|
193
|
+
return lintErrors.some((diagnostic) => diagnostic.code === "AS001") ? EXIT_PARSE : EXIT_RUNTIME;
|
|
196
194
|
}
|
|
197
195
|
const lintWarnings = diagnostics.filter((diagnostic) => diagnostic.severity === "warning");
|
|
198
196
|
if (lintWarnings.length > 0) {
|
|
@@ -268,7 +266,7 @@ async function runScriptFile(filepath, parsed, options) {
|
|
|
268
266
|
}
|
|
269
267
|
function loadExecutableSource(filepath, rawSource) {
|
|
270
268
|
const source = stripByteOrderMark(rawSource);
|
|
271
|
-
if (extname(filepath)
|
|
269
|
+
if (isRawScriptExtension(extname(filepath))) {
|
|
272
270
|
return {
|
|
273
271
|
blockEndOffset: source.length,
|
|
274
272
|
blockStartOffset: 0,
|
|
@@ -290,6 +288,9 @@ function loadExecutableSource(filepath, rawSource) {
|
|
|
290
288
|
rawSource: source
|
|
291
289
|
};
|
|
292
290
|
}
|
|
291
|
+
function isRawScriptExtension(extension) {
|
|
292
|
+
return extension === ".safejs" || extension === ".ajs";
|
|
293
|
+
}
|
|
293
294
|
function replaceExecutableSource(source, loaded, fixed) {
|
|
294
295
|
const lineOffset = countLeadingLineBreaks(fixed);
|
|
295
296
|
const fixedWithoutLineOffset = lineOffset === 0 ? fixed : fixed.slice(lineOffset);
|
|
@@ -408,7 +409,7 @@ function formatConsoleArgs(args) {
|
|
|
408
409
|
}
|
|
409
410
|
function createUsage() {
|
|
410
411
|
return [
|
|
411
|
-
"Usage: poe-
|
|
412
|
+
"Usage: poe-safejs [options] <script.md|script.safejs|script.ajs>",
|
|
412
413
|
"",
|
|
413
414
|
"Options:",
|
|
414
415
|
" --fix apply lint fixes before running",
|
|
@@ -34,10 +34,10 @@ export function createCollectionGlobals(options) {
|
|
|
34
34
|
return { Map: mapConstructor, Set: setConstructor };
|
|
35
35
|
}
|
|
36
36
|
export function isSandboxMapConstructor(value) {
|
|
37
|
-
return typeof value === "object" && value !== null && mapConstructors.has(value);
|
|
37
|
+
return (typeof value === "object" && value !== null && mapConstructors.has(value));
|
|
38
38
|
}
|
|
39
39
|
export function isSandboxSetConstructor(value) {
|
|
40
|
-
return typeof value === "object" && value !== null && setConstructors.has(value);
|
|
40
|
+
return (typeof value === "object" && value !== null && setConstructors.has(value));
|
|
41
41
|
}
|
|
42
42
|
function getMapEntries(source) {
|
|
43
43
|
if (source === undefined) {
|
|
@@ -350,9 +350,7 @@ async function evaluateTemplateExpressionValues(node, context) {
|
|
|
350
350
|
}
|
|
351
351
|
function createTaggedTemplateStrings(node, context) {
|
|
352
352
|
context.budget.allocateArrayLength(node.quasis.length);
|
|
353
|
-
const strings = node.quasis.map((quasi) => quasi.value.cooked === undefined
|
|
354
|
-
? undefined
|
|
355
|
-
: context.budget.allocateString(quasi.value.cooked));
|
|
353
|
+
const strings = node.quasis.map((quasi) => quasi.value.cooked === undefined ? undefined : context.budget.allocateString(quasi.value.cooked));
|
|
356
354
|
context.budget.allocateArrayLength(node.quasis.length);
|
|
357
355
|
const raw = node.quasis.map((quasi) => context.budget.allocateString(quasi.value.raw));
|
|
358
356
|
Object.defineProperty(strings, "raw", {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ParseError } from "../../parse/format-error.js";
|
|
2
2
|
import { DisallowedSyntaxError } from "../../parse/parser.js";
|
|
3
|
-
import {
|
|
3
|
+
import { collectSafeJSSourceModules, collectImportDeclarations } from "./module-registry.js";
|
|
4
4
|
export function AS_IMPORT_CYCLE(source, options = {}) {
|
|
5
5
|
const filename = options.filename ?? "<input>";
|
|
6
|
-
const sourceModules =
|
|
6
|
+
const sourceModules = collectSafeJSSourceModules(options.modules);
|
|
7
7
|
if (sourceModules.size === 0) {
|
|
8
8
|
return [];
|
|
9
9
|
}
|
|
@@ -15,7 +15,9 @@ export function AS005(source, options = {}) {
|
|
|
15
15
|
if (availableExports.includes(importName)) {
|
|
16
16
|
return [];
|
|
17
17
|
}
|
|
18
|
-
const span = specifier.type === "ImportDefaultSpecifier"
|
|
18
|
+
const span = specifier.type === "ImportDefaultSpecifier"
|
|
19
|
+
? specifier.local.span
|
|
20
|
+
: specifier.imported.span;
|
|
19
21
|
return [
|
|
20
22
|
{
|
|
21
23
|
code: "AS005",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { collectSafeJSSourceModules, collectImportDeclarations } from "./module-registry.js";
|
|
2
2
|
export function AS014(source, options = {}) {
|
|
3
3
|
const filename = options.filename ?? "<input>";
|
|
4
|
-
const sourceModules =
|
|
4
|
+
const sourceModules = collectSafeJSSourceModules(options.modules);
|
|
5
5
|
const currentModule = [...sourceModules.values()].find((module) => module.filename === filename);
|
|
6
6
|
if (currentModule === undefined) {
|
|
7
7
|
return [];
|
|
@@ -18,7 +18,7 @@ export type NormalizedModuleRegistration = {
|
|
|
18
18
|
filename?: string;
|
|
19
19
|
source?: string;
|
|
20
20
|
};
|
|
21
|
-
export type
|
|
21
|
+
export type SafeJSSourceModule = {
|
|
22
22
|
moduleName: string;
|
|
23
23
|
exports: readonly string[];
|
|
24
24
|
filename: string;
|
|
@@ -29,5 +29,5 @@ export declare function createUnknownModuleMessage(moduleName: string, moduleNam
|
|
|
29
29
|
export declare function createUnknownExportMessage(moduleName: string, exportName: string, availableExports: readonly string[]): string;
|
|
30
30
|
export declare function normalizeModules(modules: Modules | undefined): Map<string, string[]>;
|
|
31
31
|
export declare function normalizeModuleRegistrations(modules: Modules | undefined): Map<string, NormalizedModuleRegistration>;
|
|
32
|
-
export declare function
|
|
32
|
+
export declare function collectSafeJSSourceModules(modules: Modules | undefined): Map<string, SafeJSSourceModule>;
|
|
33
33
|
export declare function hasTypedModuleRegistrations(modules: Modules | undefined): boolean;
|
|
@@ -32,7 +32,7 @@ export function normalizeModuleRegistrations(modules) {
|
|
|
32
32
|
}
|
|
33
33
|
return normalized;
|
|
34
34
|
}
|
|
35
|
-
export function
|
|
35
|
+
export function collectSafeJSSourceModules(modules) {
|
|
36
36
|
return new Map([...normalizeModuleRegistrations(modules).entries()].flatMap(([moduleName, registration]) => registration.filename !== undefined && registration.source !== undefined
|
|
37
37
|
? [
|
|
38
38
|
{
|
|
@@ -39,31 +39,38 @@ export function extractBlock(markdown) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function readOpeningFence(line) {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
42
|
+
const fenceStart = readFenceStart(line);
|
|
43
|
+
if (fenceStart === undefined) {
|
|
44
44
|
return undefined;
|
|
45
45
|
}
|
|
46
|
-
let markerEnd = indentLength;
|
|
47
|
-
while (line[markerEnd] ===
|
|
46
|
+
let markerEnd = fenceStart.indentLength;
|
|
47
|
+
while (line[markerEnd] === fenceStart.markerCharacter) {
|
|
48
48
|
markerEnd += 1;
|
|
49
49
|
}
|
|
50
|
-
const marker = line.slice(indentLength, markerEnd);
|
|
50
|
+
const marker = line.slice(fenceStart.indentLength, markerEnd);
|
|
51
51
|
if (marker.length < 3) {
|
|
52
52
|
return undefined;
|
|
53
53
|
}
|
|
54
54
|
const info = line.slice(markerEnd).trimStart();
|
|
55
55
|
return {
|
|
56
|
-
indent: line.slice(0, indentLength),
|
|
56
|
+
indent: line.slice(0, fenceStart.indentLength),
|
|
57
57
|
marker,
|
|
58
|
+
markerCharacter: fenceStart.markerCharacter,
|
|
58
59
|
info
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function readFenceStart(line) {
|
|
62
63
|
let index = 0;
|
|
63
64
|
while (index < line.length && line[index] === " ") {
|
|
64
65
|
index += 1;
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
const markerCharacter = line[index];
|
|
68
|
+
return markerCharacter === "`" || markerCharacter === "~"
|
|
69
|
+
? {
|
|
70
|
+
indentLength: index,
|
|
71
|
+
markerCharacter
|
|
72
|
+
}
|
|
73
|
+
: undefined;
|
|
67
74
|
}
|
|
68
75
|
function matchesScriptInfo(info) {
|
|
69
76
|
const infoWord = readInfoWord(info);
|
|
@@ -130,19 +137,20 @@ function findClosingFence(markdown, searchStart, fence) {
|
|
|
130
137
|
};
|
|
131
138
|
}
|
|
132
139
|
function isClosingFence(line, fence) {
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
140
|
+
const fenceStart = readFenceStart(line);
|
|
141
|
+
if (fenceStart === undefined || fenceStart.markerCharacter !== fence.markerCharacter) {
|
|
135
142
|
return false;
|
|
136
143
|
}
|
|
144
|
+
const { indentLength } = fenceStart;
|
|
137
145
|
if (line.slice(0, indentLength) !== fence.indent) {
|
|
138
146
|
return false;
|
|
139
147
|
}
|
|
140
148
|
let markerEnd = indentLength;
|
|
141
|
-
while (line[markerEnd] ===
|
|
149
|
+
while (line[markerEnd] === fence.markerCharacter) {
|
|
142
150
|
markerEnd += 1;
|
|
143
151
|
}
|
|
144
152
|
const closingMarker = line.slice(indentLength, markerEnd);
|
|
145
|
-
if (closingMarker.length
|
|
153
|
+
if (closingMarker.length < fence.marker.length) {
|
|
146
154
|
return false;
|
|
147
155
|
}
|
|
148
156
|
for (let index = markerEnd; index < line.length; index += 1) {
|
|
@@ -15,12 +15,12 @@ export function splitFrontmatter(markdown) {
|
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
17
17
|
if (error instanceof FrontmatterParseError) {
|
|
18
|
-
throw
|
|
18
|
+
throw toSafeJSFrontmatterError(markdown, error);
|
|
19
19
|
}
|
|
20
20
|
throw error;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function toSafeJSFrontmatterError(markdown, error) {
|
|
24
24
|
if (error.message === "Missing YAML frontmatter end delimiter (---).") {
|
|
25
25
|
return new Error(`Invalid frontmatter at line ${countLines(stripByteOrderMark(markdown))}: missing closing delimiter (---).`);
|
|
26
26
|
}
|
|
@@ -379,14 +379,21 @@ function sanitizeLifecycleText(value, maxLength) {
|
|
|
379
379
|
let sanitized = "";
|
|
380
380
|
for (const character of value) {
|
|
381
381
|
const code = character.charCodeAt(0);
|
|
382
|
-
if (character === "\n" ||
|
|
382
|
+
if (character === "\n" ||
|
|
383
|
+
character === "\r" ||
|
|
384
|
+
character === "\t" ||
|
|
385
|
+
code < 32 ||
|
|
386
|
+
code === 127) {
|
|
383
387
|
sanitized += " ";
|
|
384
388
|
}
|
|
385
389
|
else {
|
|
386
390
|
sanitized += character;
|
|
387
391
|
}
|
|
388
392
|
}
|
|
389
|
-
const compact = sanitized
|
|
393
|
+
const compact = sanitized
|
|
394
|
+
.split(" ")
|
|
395
|
+
.filter((part) => part.length > 0)
|
|
396
|
+
.join(" ");
|
|
390
397
|
return compact.length > maxLength ? `${compact.slice(0, maxLength - 1)}…` : compact;
|
|
391
398
|
}
|
|
392
399
|
function readErrorField(error, field) {
|
|
@@ -516,15 +523,9 @@ function normalizeAgentDefinition(agentDef) {
|
|
|
516
523
|
...(prompt === undefined
|
|
517
524
|
? {}
|
|
518
525
|
: { prompt: readOptionalString(prompt, "Agent definition prompt") }),
|
|
519
|
-
...(model === undefined
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
...(mode === undefined
|
|
523
|
-
? {}
|
|
524
|
-
: { mode: readSpawnMode(mode, "Agent definition mode") }),
|
|
525
|
-
...(cwd === undefined
|
|
526
|
-
? {}
|
|
527
|
-
: { cwd: readOptionalString(cwd, "Agent definition cwd") }),
|
|
526
|
+
...(model === undefined ? {} : { model: readOptionalString(model, "Agent definition model") }),
|
|
527
|
+
...(mode === undefined ? {} : { mode: readSpawnMode(mode, "Agent definition mode") }),
|
|
528
|
+
...(cwd === undefined ? {} : { cwd: readOptionalString(cwd, "Agent definition cwd") }),
|
|
528
529
|
...(mcp === undefined ? {} : { mcp: readMcpConfig(mcp, "Agent definition mcp") })
|
|
529
530
|
});
|
|
530
531
|
}
|
|
@@ -549,9 +550,7 @@ function normalizeSpawnOptions(options) {
|
|
|
549
550
|
? {}
|
|
550
551
|
: { model: readOptionalString(model, "Agent spawn options model") }),
|
|
551
552
|
...(mode === undefined ? {} : { mode: readSpawnMode(mode, "Agent spawn options mode") }),
|
|
552
|
-
...(cwd === undefined
|
|
553
|
-
? {}
|
|
554
|
-
: { cwd: readOptionalString(cwd, "Agent spawn options cwd") }),
|
|
553
|
+
...(cwd === undefined ? {} : { cwd: readOptionalString(cwd, "Agent spawn options cwd") }),
|
|
555
554
|
...(otelSink === undefined ? {} : { otelSink: readOtelSink(otelSink) }),
|
|
556
555
|
...(mcp === undefined ? {} : { mcp: readMcpConfig(mcp, "Agent spawn options mcp") }),
|
|
557
556
|
...(timeoutMs === undefined
|
|
@@ -559,7 +558,9 @@ function normalizeSpawnOptions(options) {
|
|
|
559
558
|
: {
|
|
560
559
|
timeoutMs: readNonNegativeFiniteNumber(timeoutMs, "Agent spawn options timeoutMs")
|
|
561
560
|
}),
|
|
562
|
-
...(signal === undefined
|
|
561
|
+
...(signal === undefined
|
|
562
|
+
? {}
|
|
563
|
+
: { signal: readAbortSignal(signal, "Agent spawn options signal") })
|
|
563
564
|
});
|
|
564
565
|
}
|
|
565
566
|
function toProviderSpawnInput(input) {
|
|
@@ -131,9 +131,7 @@ function normalizeCommitOptions(options) {
|
|
|
131
131
|
const files = getOwnProperty(options, "files");
|
|
132
132
|
return {
|
|
133
133
|
message: readNonEmptyString(getOwnProperty(options, "message"), "Git commit options message"),
|
|
134
|
-
files: files === undefined
|
|
135
|
-
? undefined
|
|
136
|
-
: readNonEmptyStringArray(files, "Git commit options files")
|
|
134
|
+
files: files === undefined ? undefined : readNonEmptyStringArray(files, "Git commit options files")
|
|
137
135
|
};
|
|
138
136
|
}
|
|
139
137
|
function normalizeSavepoint(savepoint) {
|
|
@@ -164,12 +162,8 @@ function normalizeWorktreeCreateOptions(options) {
|
|
|
164
162
|
const base = getOwnProperty(options, "base");
|
|
165
163
|
const path = getOwnProperty(options, "path");
|
|
166
164
|
return {
|
|
167
|
-
base: base === undefined
|
|
168
|
-
|
|
169
|
-
: readNonEmptyString(base, "Git worktree create options base"),
|
|
170
|
-
path: path === undefined
|
|
171
|
-
? undefined
|
|
172
|
-
: readNonEmptyString(path, "Git worktree create options path")
|
|
165
|
+
base: base === undefined ? "HEAD" : readNonEmptyString(base, "Git worktree create options base"),
|
|
166
|
+
path: path === undefined ? undefined : readNonEmptyString(path, "Git worktree create options path")
|
|
173
167
|
};
|
|
174
168
|
}
|
|
175
169
|
function createSavepointRef() {
|
|
@@ -243,12 +243,8 @@ function normalizeToolBatchError(error) {
|
|
|
243
243
|
if (isRecord(error)) {
|
|
244
244
|
const nameValue = getOwnProperty(error, "name");
|
|
245
245
|
const messageValue = getOwnProperty(error, "message");
|
|
246
|
-
const name = typeof nameValue === "string" && nameValue.trim().length > 0
|
|
247
|
-
|
|
248
|
-
: "Error";
|
|
249
|
-
const message = typeof messageValue === "string"
|
|
250
|
-
? messageValue
|
|
251
|
-
: String(error);
|
|
246
|
+
const name = typeof nameValue === "string" && nameValue.trim().length > 0 ? nameValue : "Error";
|
|
247
|
+
const message = typeof messageValue === "string" ? messageValue : String(error);
|
|
252
248
|
return createNullRecord({
|
|
253
249
|
name,
|
|
254
250
|
message
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type SafeJSSnapshot = {
|
|
2
2
|
version?: number;
|
|
3
3
|
sourceHash: string;
|
|
4
4
|
clock?: {
|
|
@@ -18,4 +18,4 @@ export declare class SnapshotMismatchError extends Error {
|
|
|
18
18
|
readonly expectedHash: string;
|
|
19
19
|
constructor(expectedHash: string, actualHash: string);
|
|
20
20
|
}
|
|
21
|
-
export declare function restore<TSnapshot extends
|
|
21
|
+
export declare function restore<TSnapshot extends SafeJSSnapshot>(snapshot: TSnapshot, options: RestoreOptions): TSnapshot;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ErrorSourceSpan } from "./error/shape.js";
|
|
2
2
|
import { type SourceSpan } from "./parse/parser.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type SafeJSSnapshot } from "./restore.js";
|
|
4
4
|
import { Budget } from "./interp/budget.js";
|
|
5
5
|
import { type HostCallRecord, type HostCallResumeProvider } from "./interp/host-call.js";
|
|
6
6
|
import { type ConsoleSink } from "./interp/globals/console-json.js";
|
|
@@ -22,7 +22,7 @@ export type RunOptions = {
|
|
|
22
22
|
randomSeed?: number;
|
|
23
23
|
otelSink?: OtelSink;
|
|
24
24
|
signal?: AbortSignal;
|
|
25
|
-
snapshot?:
|
|
25
|
+
snapshot?: SafeJSSnapshot;
|
|
26
26
|
snapshotBackend?: SnapshotBackend;
|
|
27
27
|
snapshotIntervalMs?: number;
|
|
28
28
|
snapshotPath?: string;
|
|
@@ -32,7 +32,7 @@ export declare class UnhandledRejectionError extends Error {
|
|
|
32
32
|
readonly reason: unknown;
|
|
33
33
|
constructor(reason: unknown, span?: ErrorSourceSpan);
|
|
34
34
|
}
|
|
35
|
-
export type RunSnapshot =
|
|
35
|
+
export type RunSnapshot = SafeJSSnapshot & {
|
|
36
36
|
bindings: InterpreterResult["snapshot"]["bindings"];
|
|
37
37
|
clock?: RunClockSnapshot;
|
|
38
38
|
hostCalls?: HostCallRecord[];
|
|
@@ -7,6 +7,7 @@ import { extractBlock } from "../loader/extract-block.js";
|
|
|
7
7
|
import { splitFrontmatter } from "../loader/frontmatter.js";
|
|
8
8
|
import { lint } from "../lint.js";
|
|
9
9
|
import { createLintModulesFromRuntimeRegistry } from "../lint/runtime-modules.js";
|
|
10
|
+
import { parseModule } from "../parse/parser.js";
|
|
10
11
|
import { run } from "../run.js";
|
|
11
12
|
function getOwnEntry(record, key) {
|
|
12
13
|
return Object.prototype.hasOwnProperty.call(record, key) ? record[key] : undefined;
|
|
@@ -65,6 +66,7 @@ export async function runHarness(filepath, options) {
|
|
|
65
66
|
throw new LintError(lintErrors);
|
|
66
67
|
}
|
|
67
68
|
return runHarnessSource(executableSource, {
|
|
69
|
+
entryPointArgs: hasDefaultExport(executableSource, filepath) ? [] : undefined,
|
|
68
70
|
filename: filepath,
|
|
69
71
|
modules,
|
|
70
72
|
otelSink: options.otelSink,
|
|
@@ -132,7 +134,7 @@ async function readHarnessFile(filepath) {
|
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
136
|
function loadExecutableSource(filepath, source) {
|
|
135
|
-
if (
|
|
137
|
+
if (isRawScriptPath(filepath)) {
|
|
136
138
|
if (source.length === 0) {
|
|
137
139
|
throw new Error(`No code block found in empty harness file: ${filepath}`);
|
|
138
140
|
}
|
|
@@ -157,7 +159,7 @@ function loadExecutableSource(filepath, source) {
|
|
|
157
159
|
function resolveHarnessPair(filepath) {
|
|
158
160
|
const extension = extname(filepath);
|
|
159
161
|
const basename = extension.length === 0 ? filepath : filepath.slice(0, -extension.length);
|
|
160
|
-
if (extension
|
|
162
|
+
if (isRawScriptExtension(extension)) {
|
|
161
163
|
return {
|
|
162
164
|
markdownPath: `${basename}.md`,
|
|
163
165
|
scriptPath: filepath
|
|
@@ -168,6 +170,12 @@ function resolveHarnessPair(filepath) {
|
|
|
168
170
|
scriptPath: `${basename}.ajs`
|
|
169
171
|
};
|
|
170
172
|
}
|
|
173
|
+
function isRawScriptPath(filepath) {
|
|
174
|
+
return isRawScriptExtension(extname(filepath));
|
|
175
|
+
}
|
|
176
|
+
function isRawScriptExtension(extension) {
|
|
177
|
+
return extension === ".safejs" || extension === ".ajs";
|
|
178
|
+
}
|
|
171
179
|
async function runHarnessSource(executableSource, options) {
|
|
172
180
|
try {
|
|
173
181
|
return await run(executableSource, options);
|
|
@@ -195,6 +203,9 @@ function isAbortError(error) {
|
|
|
195
203
|
Object.prototype.hasOwnProperty.call(error, "name") &&
|
|
196
204
|
error.name === "AbortError");
|
|
197
205
|
}
|
|
206
|
+
function hasDefaultExport(source, filename) {
|
|
207
|
+
return parseModule(source, filename).body.some((statement) => statement.type === "ExportDefaultDeclaration");
|
|
208
|
+
}
|
|
198
209
|
function excludeHarnessModule(modules, isRawScript) {
|
|
199
210
|
if (!isRawScript) {
|
|
200
211
|
return modules;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type Snapshot =
|
|
1
|
+
import type { SafeJSSnapshot } from "../restore.js";
|
|
2
|
+
export type Snapshot = SafeJSSnapshot;
|
|
3
3
|
export interface SnapshotBackend {
|
|
4
4
|
read(): Promise<Snapshot | undefined>;
|
|
5
5
|
write(snapshot: Snapshot): Promise<void>;
|
|
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { readFile, rename, stat, unlink, writeFile } from "node:fs/promises";
|
|
3
3
|
import { dirname } from "node:path";
|
|
4
4
|
import { getOwnErrorCode, hasOwnErrorCode } from "../error-codes.js";
|
|
5
|
-
import {
|
|
5
|
+
import { serializeSafeJSSnapshot } from "./dump-format.js";
|
|
6
6
|
const DEFAULT_WRITE_MAX_ATTEMPTS = 3;
|
|
7
7
|
const DEFAULT_WRITE_RETRY_DELAY_MS = 100;
|
|
8
8
|
const LOCKED_FILE_ERROR_CODES = new Set(["EACCES", "EBUSY", "EPERM"]);
|
|
@@ -51,7 +51,7 @@ export class FileSnapshotBackend {
|
|
|
51
51
|
}
|
|
52
52
|
async function writeSnapshotAtomically(snapshotPath, snapshot, options) {
|
|
53
53
|
const parentPath = dirname(snapshotPath);
|
|
54
|
-
const contents =
|
|
54
|
+
const contents = serializeSafeJSSnapshot(snapshot);
|
|
55
55
|
await assertParentDirectoryExists(snapshotPath, parentPath);
|
|
56
56
|
for (let attempt = 1; attempt <= options.maxAttempts; attempt += 1) {
|
|
57
57
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const DUMP_FORMAT_VERSION = 1;
|
|
2
2
|
import { assertSnapshotGraphDepth } from "../graph-depth.js";
|
|
3
|
-
const SKIP_VALUE = Symbol("
|
|
4
|
-
export function
|
|
3
|
+
const SKIP_VALUE = Symbol("SafeJS.skip-dump-value");
|
|
4
|
+
export function serializeSafeJSSnapshot(snapshot) {
|
|
5
5
|
for (const [key, value] of getEnumerableDataEntries(snapshot)) {
|
|
6
6
|
if (key !== "version" && key !== "sourceHash" && key !== "heap") {
|
|
7
7
|
assertSnapshotGraphDepth(value, key);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { serializeSafeJSSnapshot } from "./dump-format.js";
|
|
2
2
|
import { SandboxError } from "../interp/budget.js";
|
|
3
|
-
const RUN_DUMP_CONTROLLER = Symbol("
|
|
3
|
+
const RUN_DUMP_CONTROLLER = Symbol("SafeJS.run-dump-controller");
|
|
4
4
|
export function attachDumpController(result, controller) {
|
|
5
5
|
Object.defineProperty(result, RUN_DUMP_CONTROLLER, {
|
|
6
6
|
configurable: false,
|
|
@@ -157,7 +157,7 @@ export function dumpCurrent(result) {
|
|
|
157
157
|
return dump(result);
|
|
158
158
|
}
|
|
159
159
|
export function serializeRunSnapshot(snapshot) {
|
|
160
|
-
return
|
|
160
|
+
return serializeSafeJSSnapshot(snapshot);
|
|
161
161
|
}
|
|
162
162
|
function hasSnapshot(value) {
|
|
163
163
|
return (typeof value === "object" &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Diagnostic } from "../../
|
|
1
|
+
import { type Diagnostic } from "../../safejs/dist/core.js";
|
|
2
2
|
import { type Group, type Scope } from "../../toolcraft/dist/index.js";
|
|
3
3
|
import type { CommandEntryList } from "./tree.js";
|
|
4
4
|
export type ExecuteBudgetOptions = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Budget, lint, run } from "@poe-code/
|
|
1
|
+
import { Budget, lint, run } from "@poe-code/safejs/core";
|
|
2
2
|
import { defineCommand } from "toolcraft";
|
|
3
3
|
import { S } from "toolcraft-schema";
|
|
4
4
|
import { getOwnErrorCode } from "./error-codes.js";
|
|
5
5
|
import { buildHostModules } from "./host-modules.js";
|
|
6
6
|
const executeParams = S.Object({
|
|
7
|
-
source: S.String({ description: "
|
|
7
|
+
source: S.String({ description: "SafeJS source to execute." })
|
|
8
8
|
});
|
|
9
9
|
function createBudget(options) {
|
|
10
10
|
return new Budget({
|
|
@@ -86,7 +86,7 @@ function toLintResult(error) {
|
|
|
86
86
|
export function makeExecuteCommand({ root, sdk, entries, budget, scope = ["mcp", "sdk"], sink }) {
|
|
87
87
|
return defineCommand({
|
|
88
88
|
name: "execute",
|
|
89
|
-
description: "Execute
|
|
89
|
+
description: "Execute SafeJS source against the available host commands.",
|
|
90
90
|
scope,
|
|
91
91
|
params: executeParams,
|
|
92
92
|
handler: async ({ params }) => {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|