@pome-sh/cli 0.1.1 → 0.2.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/README.md +5 -6
- package/dist/build-info.json +3 -3
- package/dist/src/cli/eval.js +26 -8
- package/dist/src/cli/init-sdk.d.ts +0 -3
- package/dist/src/cli/init-sdk.js +117 -24
- package/dist/src/cli/main.js +23 -69
- package/dist/src/cli/register.d.ts +9 -0
- package/dist/src/cli/register.js +51 -5
- package/dist/src/cli/session.d.ts +7 -1
- package/dist/src/cli/session.js +87 -27
- package/dist/src/demo/runDemo.js +3 -2
- package/dist/src/hosted/client.d.ts +41 -5
- package/dist/src/hosted/client.js +333 -19
- package/dist/src/hosted/errors.d.ts +11 -1
- package/dist/src/hosted/errors.js +8 -1
- package/dist/src/hosted/evalResultView.d.ts +2 -0
- package/dist/src/hosted/evalResultView.js +22 -0
- package/dist/src/hosted/uploadAndFinalize.d.ts +18 -1
- package/dist/src/hosted/uploadAndFinalize.js +51 -3
- package/dist/src/recorder/inspect.js +20 -2
- package/dist/src/runner/mergeAdapterSignals.js +2 -2
- package/dist/src/runner/ports.js +3 -0
- package/dist/src/runner/runScenario.d.ts +79 -2
- package/dist/src/runner/runScenario.js +94 -36
- package/dist/src/runner/runScenarioHosted.d.ts +37 -0
- package/dist/src/runner/runScenarioHosted.js +257 -58
- package/dist/src/runner/runTrialGroup.d.ts +1 -3
- package/dist/src/runner/runTrialGroup.js +1 -3
- package/dist/src/scenario/parseScenario.d.ts +5 -0
- package/dist/src/scenario/parseScenario.js +135 -8
- package/dist/src/scenario/scenarioSchema.d.ts +200 -3
- package/dist/src/scenario/scenarioSchema.js +12 -1
- package/dist/src/twin/twinHarness.d.ts +10 -0
- package/dist/src/twin/twinHarness.js +6 -2
- package/dist/src/twin/twinStart.d.ts +19 -0
- package/dist/src/twin/twinStart.js +156 -0
- package/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +121 -0
- package/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +204 -0
- package/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +1 -0
- package/node_modules/@pome-sh/sdk/dist/parity.d.ts +55 -0
- package/node_modules/@pome-sh/sdk/dist/parity.js +112 -0
- package/node_modules/@pome-sh/sdk/dist/parity.js.map +1 -0
- package/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +15 -0
- package/node_modules/@pome-sh/sdk/dist/server-helpers.js +96 -0
- package/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +1 -1
- package/node_modules/@pome-sh/sdk/dist/server.d.ts +1 -1
- package/node_modules/@pome-sh/sdk/dist/server.js +9 -7
- package/node_modules/@pome-sh/sdk/dist/server.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/errors.d.ts +39 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/errors.js +33 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/evaluator-hooks.d.ts +13 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/evaluator-hooks.js +6 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/evaluator-hooks.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +215 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +83 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/github-access-control.d.ts +175 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/github-access-control.js +182 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/github-access-control.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/identity.d.ts +90 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/identity.js +72 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/identity.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/index.d.ts +27 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/index.js +34 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +286 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js +33 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.d.ts +65 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js +455 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.d.ts +39 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js +47 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/index.d.ts +25 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/index.js +27 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/index.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.d.ts +100 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +185 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/map-span.d.ts +64 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/map-span.js +112 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/map-span.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/nano.d.ts +26 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/nano.js +61 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/nano.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/project.d.ts +42 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/project.js +96 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +51 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +74 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/span-event.d.ts +134 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/span-event.js +152 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/span-event.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +418 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/recorder-events.js +234 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/redaction.d.ts +2 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/redaction.js +152 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/redaction.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/rest.d.ts +198 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/rest.js +225 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/run.d.ts +201 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/run.js +166 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +446 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-state.js +167 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +53 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/sessions.js +51 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +66 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task-vocab.js +84 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task.d.ts +483 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task.js +60 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/package.json +54 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/trace-contract.json +41 -0
- package/node_modules/@pome-sh/sdk/package.json +6 -2
- package/node_modules/@pome-sh/shared-types/dist/errors.d.ts +39 -0
- package/node_modules/@pome-sh/shared-types/dist/errors.js +33 -0
- package/node_modules/@pome-sh/shared-types/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +252 -0
- package/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +122 -0
- package/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/identity.d.ts +90 -0
- package/node_modules/@pome-sh/shared-types/dist/identity.js +72 -0
- package/node_modules/@pome-sh/shared-types/dist/identity.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/index.d.ts +13 -1353
- package/node_modules/@pome-sh/shared-types/dist/index.js +14 -568
- package/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +45 -0
- package/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +8 -0
- package/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +7 -0
- package/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +62 -0
- package/node_modules/@pome-sh/shared-types/dist/recorder-events.js +36 -0
- package/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/rest.d.ts +245 -0
- package/node_modules/@pome-sh/shared-types/dist/rest.js +303 -0
- package/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/run.d.ts +7 -0
- package/node_modules/@pome-sh/shared-types/dist/run.js +4 -0
- package/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/seed-envelope.d.ts +14 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-envelope.js +46 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-envelope.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +446 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-state.js +167 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +53 -0
- package/node_modules/@pome-sh/shared-types/dist/sessions.js +51 -0
- package/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/task.d.ts +485 -0
- package/node_modules/@pome-sh/shared-types/dist/task.js +60 -0
- package/node_modules/@pome-sh/shared-types/dist/task.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/package.json +2 -1
- package/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
- package/node_modules/@pome-sh/twin-github/FIDELITY.md +127 -67
- package/node_modules/@pome-sh/twin-github/README.md +3 -7
- package/node_modules/@pome-sh/twin-github/dist/examples/claude-github-agent.js +4 -20
- package/node_modules/@pome-sh/twin-github/dist/examples/claude-github-agent.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/access-control.d.ts +3 -3
- package/node_modules/@pome-sh/twin-github/dist/src/domain.d.ts +141 -3
- package/node_modules/@pome-sh/twin-github/dist/src/domain.js +0 -0
- package/node_modules/@pome-sh/twin-github/dist/src/domain.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/routes.js +2 -0
- package/node_modules/@pome-sh/twin-github/dist/src/routes.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/seed.d.ts +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/serializers.d.ts +2 -2
- package/node_modules/@pome-sh/twin-github/dist/src/server.js +7 -6
- package/node_modules/@pome-sh/twin-github/dist/src/server.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/tools.d.ts +168 -18
- package/node_modules/@pome-sh/twin-github/dist/src/tools.js +23 -0
- package/node_modules/@pome-sh/twin-github/dist/src/tools.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/fidelity.inventory.json +773 -0
- package/node_modules/@pome-sh/twin-github/package.json +5 -4
- package/node_modules/@pome-sh/twin-slack/FIDELITY.md +121 -35
- package/node_modules/@pome-sh/twin-slack/README.md +2 -6
- package/node_modules/@pome-sh/twin-slack/dist/scripts/fidelity-parity.d.ts +1 -0
- package/node_modules/@pome-sh/twin-slack/dist/scripts/fidelity-parity.js +92 -0
- package/node_modules/@pome-sh/twin-slack/dist/scripts/fidelity-parity.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/dist/scripts/smoke.js +3 -3
- package/node_modules/@pome-sh/twin-slack/dist/scripts/smoke.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/dist/scripts/validate-mcp.js +1 -1
- package/node_modules/@pome-sh/twin-slack/dist/scripts/validate-mcp.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/dist/src/server.js +7 -6
- package/node_modules/@pome-sh/twin-slack/dist/src/server.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/dist/src/tools.d.ts +30 -4
- package/node_modules/@pome-sh/twin-slack/dist/src/tools.js +48 -1
- package/node_modules/@pome-sh/twin-slack/dist/src/tools.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/fidelity.inventory.json +377 -0
- package/node_modules/@pome-sh/twin-slack/package.json +5 -4
- package/node_modules/@pome-sh/twin-stripe/FIDELITY.md +151 -50
- package/node_modules/@pome-sh/twin-stripe/README.md +42 -45
- package/node_modules/@pome-sh/twin-stripe/dist/scripts/fidelity-parity.d.ts +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/scripts/fidelity-parity.js +186 -0
- package/node_modules/@pome-sh/twin-stripe/dist/scripts/fidelity-parity.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/scripts/smoke.js +8 -4
- package/node_modules/@pome-sh/twin-stripe/dist/scripts/smoke.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/db.js +26 -2
- package/node_modules/@pome-sh/twin-stripe/dist/src/db.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/billing.d.ts +101 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/billing.js +195 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/billing.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/charges.d.ts +15 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/charges.js +17 -5
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/charges.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/customers.d.ts +47 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/customers.js +103 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/customers.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/events.d.ts +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/events.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/index.d.ts +6 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/index.js +3 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/index.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-intents.d.ts +61 -2
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-intents.js +214 -52
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-intents.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-methods.d.ts +45 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-methods.js +159 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-methods.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/refunds.d.ts +6 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/refunds.js +16 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/refunds.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/schema.d.ts +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/schema.js +144 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/schema.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/stripe-domain.d.ts +420 -43
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/stripe-domain.js +442 -13
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/stripe-domain.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/errors.d.ts +19 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/errors.js +15 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/errors.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/ids.d.ts +2 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/ids.js +2 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/ids.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/_helpers.d.ts +8 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/_helpers.js +105 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/_helpers.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/billing.d.ts +4 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/billing.js +117 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/billing.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/customers.d.ts +4 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/customers.js +47 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/customers.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/index.js +6 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/index.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-intents.js +28 -102
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-intents.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-methods.d.ts +4 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-methods.js +33 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-methods.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/seed.d.ts +10 -8
- package/node_modules/@pome-sh/twin-stripe/dist/src/seed.js +3 -2
- package/node_modules/@pome-sh/twin-stripe/dist/src/seed.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/serializers.d.ts +181 -21
- package/node_modules/@pome-sh/twin-stripe/dist/src/serializers.js +257 -34
- package/node_modules/@pome-sh/twin-stripe/dist/src/serializers.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/server.js +7 -6
- package/node_modules/@pome-sh/twin-stripe/dist/src/server.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/tools.d.ts +107 -5
- package/node_modules/@pome-sh/twin-stripe/dist/src/tools.js +139 -6
- package/node_modules/@pome-sh/twin-stripe/dist/src/tools.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/types.d.ts +73 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/upstream-types.d.ts +8 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/x402.js +6 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/x402.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/fidelity.inventory.json +425 -0
- package/node_modules/@pome-sh/twin-stripe/package.json +5 -4
- package/package.json +8 -8
- package/skills/pome-setup/SKILL.md +1 -1
|
@@ -61,11 +61,13 @@ export function computeTraceHealth(input) {
|
|
|
61
61
|
};
|
|
62
62
|
// CAS adapter layer — only active when the agent is wired through
|
|
63
63
|
// `@pome-sh/claude-agent-sdk`. Heuristic: any of ToolUse/ToolResult/
|
|
64
|
-
// SubagentSpawn/Hook indicates adapter is live.
|
|
64
|
+
// SubagentSpawn/Hook/LlmTurn indicates adapter is live. LlmTurnEvent (F-766)
|
|
65
|
+
// is adapter-emitted like its siblings, so it counts toward this layer.
|
|
65
66
|
const casCount = counts.ToolUseEvent +
|
|
66
67
|
counts.ToolResultEvent +
|
|
67
68
|
counts.SubagentSpawnEvent +
|
|
68
|
-
counts.HookEvent
|
|
69
|
+
counts.HookEvent +
|
|
70
|
+
counts.LlmTurnEvent;
|
|
69
71
|
const casExpected = input.scenarioExpectsCas ? 1 : casCount > 0 ? 1 : 0;
|
|
70
72
|
const cas = {
|
|
71
73
|
name: "CAS adapter",
|
|
@@ -91,6 +93,7 @@ function emptyCounts() {
|
|
|
91
93
|
ToolResultEvent: 0,
|
|
92
94
|
SubagentSpawnEvent: 0,
|
|
93
95
|
HookEvent: 0,
|
|
96
|
+
LlmTurnEvent: 0,
|
|
94
97
|
};
|
|
95
98
|
}
|
|
96
99
|
function countByKind(events) {
|
|
@@ -139,6 +142,8 @@ function renderEventLines(event) {
|
|
|
139
142
|
return renderSubagentSpawn(event);
|
|
140
143
|
case "HookEvent":
|
|
141
144
|
return renderHook(event);
|
|
145
|
+
case "LlmTurnEvent":
|
|
146
|
+
return renderLlmTurn(event);
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
149
|
function renderTwinHttp(event) {
|
|
@@ -175,3 +180,16 @@ function renderHook(event) {
|
|
|
175
180
|
const tool = event.tool_name ? ` tool=${event.tool_name}` : "";
|
|
176
181
|
return [`- HookEvent ${event.hook_name}${tool}`];
|
|
177
182
|
}
|
|
183
|
+
function renderLlmTurn(event) {
|
|
184
|
+
const model = event.model ?? "unknown";
|
|
185
|
+
const tokens = `${event.input_tokens ?? "?"}/${event.output_tokens ?? "?"}`;
|
|
186
|
+
const cache = `${event.cache_read_input_tokens ?? "?"}/${event.cache_creation_input_tokens ?? "?"}`;
|
|
187
|
+
const est = event.latency_ms_estimated ? "~" : "";
|
|
188
|
+
const finish = event.finish_reasons && event.finish_reasons.length > 0
|
|
189
|
+
? ` finish=${event.finish_reasons.join(",")}`
|
|
190
|
+
: "";
|
|
191
|
+
return [
|
|
192
|
+
`- LlmTurnEvent turn ${event.turn_index} model=${model} tokens=${tokens} (${est}${event.latency_ms}ms)`,
|
|
193
|
+
` cache read/create=${cache}${finish}`,
|
|
194
|
+
];
|
|
195
|
+
}
|
|
@@ -12,8 +12,8 @@ import { redactEvent } from "../recorder/redaction.js";
|
|
|
12
12
|
// 2. The trace writer then appends `TwinHttpEvent` rows from the in-process
|
|
13
13
|
// twin recorder (FDRS-415).
|
|
14
14
|
// 3. This helper reads `signals.jsonl` (HookEvent / ToolUseEvent /
|
|
15
|
-
// ToolResultEvent / SubagentSpawnEvent rows written by the
|
|
16
|
-
// subprocess via `POME_ADAPTER_SIGNALS_PATH`), validates each line
|
|
15
|
+
// ToolResultEvent / SubagentSpawnEvent / LlmTurnEvent rows written by the
|
|
16
|
+
// agent subprocess via `POME_ADAPTER_SIGNALS_PATH`), validates each line
|
|
17
17
|
// against the M0 unified `eventSchema`, then **interleaves** the signal
|
|
18
18
|
// rows with the existing events.jsonl rows by ts ascending and rewrites
|
|
19
19
|
// the file. The merged file is the canonical view for `pome inspect`
|
package/dist/src/runner/ports.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
import { createServer } from "node:net";
|
|
3
|
+
// NOTE: allocate-then-close hands back a port that is free at close time; a
|
|
4
|
+
// caller that rebinds it races any other process that grabs it in the gap.
|
|
5
|
+
// Pre-existing and acceptable for local dev twins (loopback, short-lived).
|
|
3
6
|
export async function getAvailablePort() {
|
|
4
7
|
return new Promise((resolve, reject) => {
|
|
5
8
|
const server = createServer();
|
|
@@ -23,6 +23,7 @@ export declare function runScenario(options: RunScenarioOptions): Promise<{
|
|
|
23
23
|
criteria: {
|
|
24
24
|
type: "model" | "code";
|
|
25
25
|
text: string;
|
|
26
|
+
twin?: string | undefined;
|
|
26
27
|
}[];
|
|
27
28
|
config: {
|
|
28
29
|
twins: string[];
|
|
@@ -74,7 +75,7 @@ export declare function runScenario(options: RunScenarioOptions): Promise<{
|
|
|
74
75
|
}[];
|
|
75
76
|
statuses: {
|
|
76
77
|
context: string;
|
|
77
|
-
state: "error" | "
|
|
78
|
+
state: "error" | "failure" | "pending" | "success";
|
|
78
79
|
description: string;
|
|
79
80
|
}[];
|
|
80
81
|
number?: number | undefined;
|
|
@@ -106,7 +107,83 @@ export declare function runScenario(options: RunScenarioOptions): Promise<{
|
|
|
106
107
|
users: Record<string, unknown>[];
|
|
107
108
|
channels: Record<string, unknown>[];
|
|
108
109
|
team?: Record<string, unknown> | undefined;
|
|
109
|
-
}
|
|
110
|
+
} | Record<string, {
|
|
111
|
+
users: {
|
|
112
|
+
login: string;
|
|
113
|
+
type: "User" | "Organization";
|
|
114
|
+
name: string;
|
|
115
|
+
}[];
|
|
116
|
+
repositories: {
|
|
117
|
+
owner: string;
|
|
118
|
+
name: string;
|
|
119
|
+
description: string;
|
|
120
|
+
private: boolean;
|
|
121
|
+
default_branch: string;
|
|
122
|
+
collaborators: string[];
|
|
123
|
+
labels: {
|
|
124
|
+
name: string;
|
|
125
|
+
color: string;
|
|
126
|
+
description: string;
|
|
127
|
+
}[];
|
|
128
|
+
files: {
|
|
129
|
+
path: string;
|
|
130
|
+
content: string;
|
|
131
|
+
branch?: string | undefined;
|
|
132
|
+
}[];
|
|
133
|
+
issues: {
|
|
134
|
+
title: string;
|
|
135
|
+
body: string;
|
|
136
|
+
state: "open" | "closed";
|
|
137
|
+
labels: string[];
|
|
138
|
+
assignees: string[];
|
|
139
|
+
number?: number | undefined;
|
|
140
|
+
}[];
|
|
141
|
+
pull_requests: {
|
|
142
|
+
title: string;
|
|
143
|
+
body: string;
|
|
144
|
+
head: string;
|
|
145
|
+
base: string;
|
|
146
|
+
state: "open" | "closed";
|
|
147
|
+
reviews: {
|
|
148
|
+
author: string;
|
|
149
|
+
state: "APPROVED" | "CHANGES_REQUESTED" | "COMMENTED";
|
|
150
|
+
body: string;
|
|
151
|
+
}[];
|
|
152
|
+
statuses: {
|
|
153
|
+
context: string;
|
|
154
|
+
state: "error" | "failure" | "pending" | "success";
|
|
155
|
+
description: string;
|
|
156
|
+
}[];
|
|
157
|
+
number?: number | undefined;
|
|
158
|
+
author?: string | undefined;
|
|
159
|
+
}[];
|
|
160
|
+
}[];
|
|
161
|
+
} | {
|
|
162
|
+
api_keys: {
|
|
163
|
+
key: string;
|
|
164
|
+
sid: string;
|
|
165
|
+
account_id?: string | undefined;
|
|
166
|
+
}[];
|
|
167
|
+
customers: Record<string, unknown>[];
|
|
168
|
+
products: Record<string, unknown>[];
|
|
169
|
+
prices: Record<string, unknown>[];
|
|
170
|
+
payment_intents: Record<string, unknown>[];
|
|
171
|
+
charges: Record<string, unknown>[];
|
|
172
|
+
events: Record<string, unknown>[];
|
|
173
|
+
balances: Record<string, unknown>[];
|
|
174
|
+
failure_injection: {
|
|
175
|
+
method: string;
|
|
176
|
+
path: string;
|
|
177
|
+
attempt: number;
|
|
178
|
+
mode: "before_handler" | "after_handler";
|
|
179
|
+
status: number;
|
|
180
|
+
body: unknown;
|
|
181
|
+
}[];
|
|
182
|
+
} | {
|
|
183
|
+
users: Record<string, unknown>[];
|
|
184
|
+
channels: Record<string, unknown>[];
|
|
185
|
+
team?: Record<string, unknown> | undefined;
|
|
186
|
+
}>;
|
|
110
187
|
};
|
|
111
188
|
runId: string;
|
|
112
189
|
artifacts: import("../recorder/artifacts.js").RunArtifacts;
|
|
@@ -4,14 +4,23 @@ import { randomBytes, randomUUID } from "node:crypto";
|
|
|
4
4
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
5
5
|
import { join, resolve as resolvePath, sep as pathSep } from "node:path";
|
|
6
6
|
import { sign } from "hono/jwt";
|
|
7
|
-
import { parseScenarioFile } from "../scenario/parseScenario.js";
|
|
7
|
+
import { parseScenarioFile, seedStateForTwin } from "../scenario/parseScenario.js";
|
|
8
8
|
import { bootTwin } from "../twin/twinHarness.js";
|
|
9
|
+
import { createRecorder } from "../recorder/recorder.js";
|
|
10
|
+
import { redactSecrets } from "../recorder/redaction.js";
|
|
9
11
|
import { getAvailablePort } from "./ports.js";
|
|
10
12
|
import { runAgentCommand } from "./agentRunner.js";
|
|
11
13
|
import { egressArgs, spawnCaptureServerChild } from "./captureServerChild.js";
|
|
12
14
|
import { buildEgressAllowlist, readBlockedEgress } from "../capture-server/egress.js";
|
|
13
15
|
import { mergeAdapterSignalsIntoEvents } from "./mergeAdapterSignals.js";
|
|
14
16
|
import { writeRunNoScore } from "./runScenarioCore.js";
|
|
17
|
+
// Promisify a Hono/node server `close()` so teardown can await in-flight
|
|
18
|
+
// handlers draining before the twin's DB handle is released.
|
|
19
|
+
function closeServer(server) {
|
|
20
|
+
return new Promise((resolvePromise, reject) => {
|
|
21
|
+
server.close((err) => (err ? reject(err) : resolvePromise()));
|
|
22
|
+
});
|
|
23
|
+
}
|
|
15
24
|
export async function runScenario(options) {
|
|
16
25
|
const scenario = await parseScenarioFile(options.scenarioPath);
|
|
17
26
|
const runId = `run_${randomUUID()}`;
|
|
@@ -81,23 +90,50 @@ export async function runScenario(options) {
|
|
|
81
90
|
await captureServer.shutdown();
|
|
82
91
|
return readBlockedEgress(egressJsonlPath);
|
|
83
92
|
};
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
// F-698: stream twin HTTP events into the same events.jsonl the
|
|
88
|
-
// capture-server appends to. Durable store writes TwinHttpEvent rows;
|
|
89
|
-
// finalize dedupes against disk so upload shape stays one row per event.
|
|
90
|
-
const harness = await bootTwin({
|
|
91
|
-
twin: twinName,
|
|
92
|
-
seedState: scenario.seedState,
|
|
93
|
-
runId,
|
|
94
|
-
twinBaseUrl: baseUrl,
|
|
95
|
-
eventsPath: eventsJsonlPath,
|
|
96
|
-
});
|
|
97
|
-
const stateInitial = await harness.exportState();
|
|
93
|
+
const twins = scenario.config.twins.length ? scenario.config.twins : ["github"];
|
|
94
|
+
const primaryTwin = twins[0];
|
|
95
|
+
const isMultiTwin = twins.length > 1;
|
|
98
96
|
const sid = runId;
|
|
99
97
|
const authSecret = process.env.TWIN_AUTH_SECRET ?? randomBytes(32).toString("hex");
|
|
100
98
|
process.env.TWIN_AUTH_SECRET = authSecret;
|
|
99
|
+
// Multi-twin (M3): all twins in one local run share ONE recorder so their
|
|
100
|
+
// HTTP events stream into a single events.jsonl (the same file the
|
|
101
|
+
// capture-server appends to). The runner owns the recorder's lifecycle here;
|
|
102
|
+
// each harness's `close()` releases only its own DB handle. For single-twin
|
|
103
|
+
// this is behaviorally identical to the old bootTwin-internal recorder.
|
|
104
|
+
// The durable store writes TwinHttpEvent rows; finalize dedupes against disk
|
|
105
|
+
// so upload shape stays one row per event.
|
|
106
|
+
const recorder = createRecorder({ eventsPath: eventsJsonlPath });
|
|
107
|
+
// Boot one twin harness per config twin, each on its own localhost port.
|
|
108
|
+
// Merge every twin's POME_<envName>_{REST,MCP}_URL and its extra JWT claims;
|
|
109
|
+
// one token carries the union of claims (e.g. Stripe's account_id).
|
|
110
|
+
const booted = [];
|
|
111
|
+
const twinEnv = {};
|
|
112
|
+
const stateInitialByTwin = {};
|
|
113
|
+
let mergedClaims = {};
|
|
114
|
+
for (const twin of twins) {
|
|
115
|
+
const port = await getAvailablePort();
|
|
116
|
+
const baseUrl = `http://127.0.0.1:${port}`;
|
|
117
|
+
const harness = await bootTwin({
|
|
118
|
+
twin,
|
|
119
|
+
seedState: seedStateForTwin(scenario, twin),
|
|
120
|
+
runId,
|
|
121
|
+
twinBaseUrl: baseUrl,
|
|
122
|
+
recorder,
|
|
123
|
+
});
|
|
124
|
+
stateInitialByTwin[twin] = await harness.exportState();
|
|
125
|
+
const sessionBase = `${baseUrl}/s/${sid}`;
|
|
126
|
+
// Twin-agnostic URL contract: the agent reads `POME_<TWIN>_{REST,MCP}_URL`.
|
|
127
|
+
// For github this resolves to the historical `POME_GITHUB_{REST,MCP}_URL`;
|
|
128
|
+
// slack/stripe get their own prefixes (the mcp-loop scaffold's
|
|
129
|
+
// `resolveMcpUrl` already keys off `POME_<TWIN>_MCP_URL`).
|
|
130
|
+
twinEnv[`POME_${harness.envName}_REST_URL`] = sessionBase;
|
|
131
|
+
twinEnv[`POME_${harness.envName}_MCP_URL`] = `${sessionBase}/mcp`;
|
|
132
|
+
mergedClaims = { ...mergedClaims, ...(harness.extraClaims ?? {}) };
|
|
133
|
+
const server = serve({ fetch: harness.app.fetch, port, hostname: "127.0.0.1" });
|
|
134
|
+
booted.push({ twin, harness, server });
|
|
135
|
+
}
|
|
136
|
+
const stateInitial = stateInitialByTwin[primaryTwin];
|
|
101
137
|
const token = await sign({
|
|
102
138
|
sid,
|
|
103
139
|
team_id: "tm_local",
|
|
@@ -108,12 +144,11 @@ export async function runScenario(options) {
|
|
|
108
144
|
// was invisible until a scripted REST agent needed to merge.
|
|
109
145
|
login: "pome-agent",
|
|
110
146
|
// Twin-supplied claims (e.g. Stripe's `account_id`, so the token resolves
|
|
111
|
-
// to the account the seed data lives in)
|
|
112
|
-
|
|
147
|
+
// to the account the seed data lives in) — merged across all twins.
|
|
148
|
+
// github/slack supply none.
|
|
149
|
+
...mergedClaims,
|
|
113
150
|
exp: Math.floor(Date.now() / 1000) + Math.max(scenario.config.timeout * 2, 600),
|
|
114
151
|
}, authSecret);
|
|
115
|
-
const sessionBase = `${baseUrl}/s/${sid}`;
|
|
116
|
-
const server = serve({ fetch: harness.app.fetch, port, hostname: "127.0.0.1" });
|
|
117
152
|
const proxyEnv = captureServer
|
|
118
153
|
? {
|
|
119
154
|
// FDRS-399 — agent's outbound traffic flows through the capture-server.
|
|
@@ -127,13 +162,8 @@ export async function runScenario(options) {
|
|
|
127
162
|
: {};
|
|
128
163
|
const env = {
|
|
129
164
|
POME_TASK: scenario.prompt,
|
|
130
|
-
POME_TWIN_NAMES:
|
|
131
|
-
|
|
132
|
-
// For github this resolves to the historical `POME_GITHUB_{REST,MCP}_URL`;
|
|
133
|
-
// slack/stripe get their own prefixes (the mcp-loop scaffold's
|
|
134
|
-
// `resolveMcpUrl` already keys off `POME_<TWIN>_MCP_URL`).
|
|
135
|
-
[`POME_${harness.envName}_REST_URL`]: sessionBase,
|
|
136
|
-
[`POME_${harness.envName}_MCP_URL`]: `${sessionBase}/mcp`,
|
|
165
|
+
POME_TWIN_NAMES: twins.join(","),
|
|
166
|
+
...twinEnv,
|
|
137
167
|
POME_AUTH_TOKEN: token,
|
|
138
168
|
POME_RUN_ID: runId,
|
|
139
169
|
POME_ARTIFACTS_DIR: runDir,
|
|
@@ -141,6 +171,28 @@ export async function runScenario(options) {
|
|
|
141
171
|
...(options.extraAgentEnv ?? {}),
|
|
142
172
|
...proxyEnv,
|
|
143
173
|
};
|
|
174
|
+
// Capture each twin's final state: the primary is the legacy `stateFinal`
|
|
175
|
+
// (state_final.json); every other twin is written alongside as
|
|
176
|
+
// `state_final.<twin>.json`. Best-effort disk writes for the extras.
|
|
177
|
+
const captureFinalStates = async () => {
|
|
178
|
+
const finals = {};
|
|
179
|
+
for (const { twin, harness } of booted) {
|
|
180
|
+
finals[twin] = await harness.exportState();
|
|
181
|
+
}
|
|
182
|
+
if (isMultiTwin) {
|
|
183
|
+
for (const { twin } of booted) {
|
|
184
|
+
if (twin === primaryTwin)
|
|
185
|
+
continue;
|
|
186
|
+
try {
|
|
187
|
+
await writeFile(join(runDir, `state_final.${twin}.json`), `${JSON.stringify(redactSecrets(finals[twin]), null, 2)}\n`);
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
// best-effort — the primary state_final.json is what writeRun persists
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return finals[primaryTwin];
|
|
195
|
+
};
|
|
144
196
|
try {
|
|
145
197
|
const preflight = await runAgentCommand({
|
|
146
198
|
command: options.agentCommand,
|
|
@@ -153,8 +205,8 @@ export async function runScenario(options) {
|
|
|
153
205
|
if (preflight.exitCode !== 0) {
|
|
154
206
|
// Flush durable twin rows before finalize/merge so pending TwinHttpEvent
|
|
155
207
|
// lines are on disk before events.jsonl is rewritten (not only in finally).
|
|
156
|
-
await
|
|
157
|
-
const stateFinal = await
|
|
208
|
+
await recorder.flush?.();
|
|
209
|
+
const stateFinal = await captureFinalStates();
|
|
158
210
|
const { artifacts, exitCode } = await writeRun({
|
|
159
211
|
artifactsDir,
|
|
160
212
|
runId,
|
|
@@ -165,7 +217,7 @@ export async function runScenario(options) {
|
|
|
165
217
|
agentStderr: preflight.stderr,
|
|
166
218
|
agentExitCode: preflight.exitCode,
|
|
167
219
|
agentTimedOut: preflight.timedOut ?? false,
|
|
168
|
-
events:
|
|
220
|
+
events: recorder.events(),
|
|
169
221
|
stateInitial,
|
|
170
222
|
stateFinal
|
|
171
223
|
});
|
|
@@ -180,8 +232,8 @@ export async function runScenario(options) {
|
|
|
180
232
|
env,
|
|
181
233
|
timeoutSeconds: scenario.config.timeout
|
|
182
234
|
});
|
|
183
|
-
await
|
|
184
|
-
const stateFinal = await
|
|
235
|
+
await recorder.flush?.();
|
|
236
|
+
const stateFinal = await captureFinalStates();
|
|
185
237
|
const { artifacts, exitCode } = await writeRun({
|
|
186
238
|
artifactsDir,
|
|
187
239
|
runId,
|
|
@@ -192,7 +244,7 @@ export async function runScenario(options) {
|
|
|
192
244
|
agentStderr: agent.stderr,
|
|
193
245
|
agentExitCode: agent.exitCode,
|
|
194
246
|
agentTimedOut: agent.timedOut ?? false,
|
|
195
|
-
events:
|
|
247
|
+
events: recorder.events(),
|
|
196
248
|
stateInitial,
|
|
197
249
|
stateFinal
|
|
198
250
|
});
|
|
@@ -202,11 +254,17 @@ export async function runScenario(options) {
|
|
|
202
254
|
}
|
|
203
255
|
finally {
|
|
204
256
|
// Drain capture-server first so any in-flight LlmCallEvent rows land
|
|
205
|
-
// in events.jsonl before we move on; THEN close
|
|
206
|
-
// the
|
|
257
|
+
// in events.jsonl before we move on; THEN close each twin (releasing its
|
|
258
|
+
// DB handle) and finally the shared recorder (flush + close).
|
|
207
259
|
if (captureServer)
|
|
208
260
|
await captureServer.shutdown();
|
|
209
|
-
server
|
|
210
|
-
|
|
261
|
+
// Await each twin's HTTP server close (letting in-flight handlers drain)
|
|
262
|
+
// BEFORE releasing that twin's DB handle, so a late handler can't run
|
|
263
|
+
// against a closed DB (teardown errors / lost final recorder writes).
|
|
264
|
+
await Promise.all(booted.map(async ({ server, harness }) => {
|
|
265
|
+
await closeServer(server);
|
|
266
|
+
await harness.close();
|
|
267
|
+
}));
|
|
268
|
+
await recorder.close?.();
|
|
211
269
|
}
|
|
212
270
|
}
|
|
@@ -47,4 +47,41 @@ export interface RunScenarioHostedResult {
|
|
|
47
47
|
* row's duration. */
|
|
48
48
|
durationMs: number;
|
|
49
49
|
}
|
|
50
|
+
/** Build the agent subprocess env for a hosted run.
|
|
51
|
+
*
|
|
52
|
+
* Two layers, in this order:
|
|
53
|
+
*
|
|
54
|
+
* 1. The LEGACY block (origin/main parity). Every hosted run — regardless of
|
|
55
|
+
* which twins the session mounts — ALWAYS injected github + stripe vars
|
|
56
|
+
* pointing at the primary/bare `twin_url`, plus POME_TWIN_BASE_URL and the
|
|
57
|
+
* OTEL/task/run scaffolding. Byte-identical single-twin env is the bar, so
|
|
58
|
+
* this block reproduces main's exact keys, values, AND insertion order.
|
|
59
|
+
*
|
|
60
|
+
* 2. The per-twin fan-out OVERLAY (M3). For each twin actually in the session,
|
|
61
|
+
* set POME_<T>_REST_URL / POME_<T>_MCP_URL from `per_twin[T]` (distinct URLs
|
|
62
|
+
* per twin) plus its provider bearer. For github/stripe this overwrites the
|
|
63
|
+
* legacy values IN PLACE (same key → insertion order preserved); other twins
|
|
64
|
+
* append new keys.
|
|
65
|
+
*
|
|
66
|
+
* MCP URL rule (regression guard): only trust `per_twin[T].mcp_url` when the
|
|
67
|
+
* cloud ACTUALLY RETURNED `per_twin` (`perTwinFromCloud`). A single-twin OLD
|
|
68
|
+
* cloud returns no `per_twin`; the schema synthesizes one whose `mcp_url`
|
|
69
|
+
* host-rewrites api.pome.sh→mcp.pome.sh with NO `/mcp` suffix. Trusting it would
|
|
70
|
+
* drift POME_*_MCP_URL off main's `${twin_url}/mcp`. So for a synthesized entry
|
|
71
|
+
* we construct `${api_url}/mcp`; only a cloud-returned value gets ensureMcpSuffix
|
|
72
|
+
* (the same normalization `pome session create` applies). */
|
|
73
|
+
export declare function buildAgentEnv(params: {
|
|
74
|
+
session: CreateSessionResponse;
|
|
75
|
+
twins: string[];
|
|
76
|
+
/** True iff the cloud's create-session body carried a `per_twin` key. */
|
|
77
|
+
perTwinFromCloud: boolean;
|
|
78
|
+
prompt: string;
|
|
79
|
+
otlpEndpoint: string;
|
|
80
|
+
apiKey: string;
|
|
81
|
+
agentId?: string;
|
|
82
|
+
runId: string;
|
|
83
|
+
artifactsDir: string;
|
|
84
|
+
slug: string;
|
|
85
|
+
signalsPath: string;
|
|
86
|
+
}): Record<string, string>;
|
|
50
87
|
export declare function runScenarioHosted(options: RunScenarioHostedOptions): Promise<RunScenarioHostedResult>;
|