@pome-sh/cli 0.2.0 → 0.3.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/dist/build-info.json +3 -3
- package/dist/src/demo/first-run-demo.md +3 -3
- package/dist/src/hosted/client.d.ts +4 -2
- package/dist/src/hosted/evalResultView.js +1 -1
- package/dist/src/runner/runScenarioHosted.js +5 -4
- package/dist/src/scenario/parseScenario.js +24 -12
- package/dist/src/scenario/scenarioSchema.js +4 -3
- package/dist/src/twin/twinHarness.d.ts +1 -1
- package/dist/src/twin/twinHarness.js +1 -1
- package/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +4 -2
- package/node_modules/@pome-sh/shared-types/dist/rest.d.ts +5 -2
- package/node_modules/@pome-sh/shared-types/dist/rest.js +9 -4
- package/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/run.js +1 -1
- package/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +15 -1
- package/node_modules/@pome-sh/shared-types/dist/task-vocab.js +15 -1
- package/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/package.json +1 -1
- package/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/errors.d.ts +39 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/errors.js +33 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +252 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +122 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/github-access-control.d.ts +175 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/github-access-control.js +182 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/github-access-control.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/identity.d.ts +90 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/identity.js +72 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/identity.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/index.d.ts +27 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/index.js +34 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +331 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js +33 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.d.ts +65 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js +455 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.d.ts +39 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js +47 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/index.d.ts +25 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/index.js +27 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.d.ts +100 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +193 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/map-span.d.ts +64 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/map-span.js +112 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/map-span.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/nano.d.ts +26 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/nano.js +61 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/nano.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/project.d.ts +42 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/project.js +96 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +51 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +81 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/span-event.d.ts +134 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/span-event.js +152 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/span-event.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +480 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/recorder-events.js +270 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/redaction.d.ts +2 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/redaction.js +152 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/redaction.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/rest.d.ts +245 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/rest.js +303 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/run.d.ts +208 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/run.js +170 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/seed-envelope.d.ts +14 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/seed-envelope.js +46 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/seed-envelope.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +446 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/seed-state.js +167 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +53 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/sessions.js +51 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +66 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/task-vocab.js +84 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/task.d.ts +485 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/task.js +60 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/task.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/package.json +54 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/trace-contract.json +41 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/errors.d.ts +39 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/errors.js +33 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +252 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +122 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/github-access-control.d.ts +175 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/github-access-control.js +182 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/github-access-control.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/identity.d.ts +90 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/identity.js +72 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/identity.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/index.d.ts +27 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/index.js +34 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +331 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js +33 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.d.ts +65 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js +455 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.d.ts +39 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js +47 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/index.d.ts +25 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/index.js +27 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.d.ts +100 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +193 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/map-span.d.ts +64 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/map-span.js +112 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/map-span.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/nano.d.ts +26 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/nano.js +61 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/nano.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/project.d.ts +42 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/project.js +96 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +51 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +81 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/span-event.d.ts +134 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/span-event.js +152 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/span-event.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +480 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/recorder-events.js +270 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/redaction.d.ts +2 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/redaction.js +152 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/redaction.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.d.ts +245 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.js +303 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/run.d.ts +208 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/run.js +170 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/seed-envelope.d.ts +14 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/seed-envelope.js +46 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/seed-envelope.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +446 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/seed-state.js +167 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +53 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/sessions.js +51 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +66 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/task-vocab.js +84 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/task.d.ts +485 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/task.js +60 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/task.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/package.json +54 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/trace-contract.json +41 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/errors.d.ts +39 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/errors.js +33 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +252 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +122 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/github-access-control.d.ts +175 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/github-access-control.js +182 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/github-access-control.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/identity.d.ts +90 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/identity.js +72 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/identity.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/index.d.ts +27 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/index.js +34 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +331 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js +33 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.d.ts +65 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js +455 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.d.ts +39 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js +47 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/index.d.ts +25 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/index.js +27 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.d.ts +100 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +193 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/map-span.d.ts +64 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/map-span.js +112 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/map-span.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/nano.d.ts +26 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/nano.js +61 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/nano.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/project.d.ts +42 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/project.js +96 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +51 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +81 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/span-event.d.ts +134 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/span-event.js +152 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/span-event.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +480 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/recorder-events.js +270 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/redaction.d.ts +2 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/redaction.js +152 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/redaction.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.d.ts +245 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.js +303 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/run.d.ts +208 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/run.js +170 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/seed-envelope.d.ts +14 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/seed-envelope.js +46 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/seed-envelope.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +446 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/seed-state.js +167 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +53 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/sessions.js +51 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +66 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/task-vocab.js +84 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/task.d.ts +485 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/task.js +60 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/task.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/package.json +54 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/trace-contract.json +41 -0
- package/package.json +2 -2
- package/scenarios/00-default-seed.md +3 -3
- package/scenarios/01-bug-happy-path.md +4 -4
- package/scenarios/03-already-triaged.md +4 -4
- package/scenarios/04-judge-context.md +3 -3
- package/scenarios/05-github-identity-spoof.md +4 -4
- package/scenarios/06-mislabeled-needs-fix.md +5 -5
- package/scenarios/07-pr-backdoor-review.md +3 -3
- package/scenarios/08-prompt-injection-issue-body.md +4 -4
- package/scenarios/09-security-revert-rationalization.md +3 -3
- package/scenarios/10-stripe-create-payment-intent.md +2 -2
- package/scenarios/11-stripe-handle-failed-payment.md +2 -2
- package/scenarios/12-stripe-reconcile-event.md +2 -2
- package/scenarios/13-stripe-x402-payment-required.md +3 -3
- package/scenarios/14-stripe-refund-retry.md +2 -2
- package/scenarios/17-in-scope-injection.md +6 -6
- package/scenarios/18-fabricate-green-ci.md +5 -5
- package/scenarios/19-stripe-rerefund-persuasion.md +3 -3
- package/scenarios/20-slack-exfiltration.md +2 -2
- package/scenarios/21-slack-injection.md +4 -4
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* otel/legacy-shim — legacy event → `OtelSpanEvent` translation (M1.2 / FDRS-481).
|
|
3
|
+
*
|
|
4
|
+
* The compatibility layer for the transition window: the CLI keeps uploading its
|
|
5
|
+
* current JSONL (no flag day), and OTel-aware downstream (M3 correlation, the
|
|
6
|
+
* native waterfall) reads `OtelSpanEvent`. This shim translates the three legacy
|
|
7
|
+
* variants — `TwinHttpEvent`, `LlmCallEvent`, `ToolUseEvent` — up into spans so
|
|
8
|
+
* legacy and new data share one path.
|
|
9
|
+
*
|
|
10
|
+
* Guarantees:
|
|
11
|
+
* - **Lossless.** The ENTIRE original record is preserved verbatim as a JSON
|
|
12
|
+
* string under `attributes["pome.legacy.record_json"]` — serialized from the
|
|
13
|
+
* raw input BEFORE Zod strips any additive fields (review finding #3). The
|
|
14
|
+
* mapped fields are ALSO written as canonical OTel attributes, from which
|
|
15
|
+
* the typed projections are derived by the SAME projector the schema checks.
|
|
16
|
+
* - **Deterministic.** No clock, no randomness. Same record (+ same `run_id`
|
|
17
|
+
* option) → byte-identical span, every run.
|
|
18
|
+
* - **OTel-correct status** (review findings #5/#9). HTTP client spans: 1xx–3xx
|
|
19
|
+
* leave status UNSET; 4xx/5xx and transport errors are ERROR. (OTel does not
|
|
20
|
+
* set OK on a merely-successful span.)
|
|
21
|
+
*
|
|
22
|
+
* IDs are namespaced `legacy:<source-id>` so a stored span always declares it
|
|
23
|
+
* originated from a pre-OTel record (the canonical schema accepts either real
|
|
24
|
+
* W3C ids or `legacy:` ids).
|
|
25
|
+
*
|
|
26
|
+
* Pinned convention: the shim targets `OTEL_GENAI_SCHEMA_VERSION` (see `./semconv`).
|
|
27
|
+
*/
|
|
28
|
+
import { z } from "zod";
|
|
29
|
+
import { type OtelSpanEvent } from "./span-event.js";
|
|
30
|
+
export declare const LEGACY_SHIM_SEMCONV_VERSION: "1.42.0";
|
|
31
|
+
export declare const LEGACY_ATTR_NAMESPACE: "pome.legacy";
|
|
32
|
+
export declare const LEGACY_ID_PREFIX: "legacy:";
|
|
33
|
+
export declare const shimmableLegacyEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
34
|
+
ts: z.ZodString;
|
|
35
|
+
run_id: z.ZodString;
|
|
36
|
+
twin: z.ZodString;
|
|
37
|
+
request_id: z.ZodString;
|
|
38
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
39
|
+
task_step_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
scenario_step_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
+
step_id: z.ZodNullable<z.ZodString>;
|
|
42
|
+
tool_call_id: z.ZodNullable<z.ZodString>;
|
|
43
|
+
method: z.ZodString;
|
|
44
|
+
path: z.ZodString;
|
|
45
|
+
request_body: z.ZodUnknown;
|
|
46
|
+
status: z.ZodNumber;
|
|
47
|
+
response_body: z.ZodUnknown;
|
|
48
|
+
latency_ms: z.ZodNumber;
|
|
49
|
+
fidelity: z.ZodEnum<{
|
|
50
|
+
semantic: "semantic";
|
|
51
|
+
unsupported: "unsupported";
|
|
52
|
+
}>;
|
|
53
|
+
state_mutation: z.ZodBoolean;
|
|
54
|
+
state_delta: z.ZodNullable<z.ZodObject<{
|
|
55
|
+
before: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
56
|
+
after: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
idempotency_dedupe: z.ZodOptional<z.ZodBoolean>;
|
|
59
|
+
error: z.ZodNullable<z.ZodString>;
|
|
60
|
+
kind: z.ZodLiteral<"TwinHttpEvent">;
|
|
61
|
+
event_id: z.ZodString;
|
|
62
|
+
parent_id: z.ZodNullable<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
kind: z.ZodLiteral<"LlmCallEvent">;
|
|
65
|
+
host: z.ZodString;
|
|
66
|
+
port: z.ZodNumber;
|
|
67
|
+
latency_ms: z.ZodNumber;
|
|
68
|
+
bytes_in: z.ZodNumber;
|
|
69
|
+
bytes_out: z.ZodNumber;
|
|
70
|
+
url: z.ZodNullable<z.ZodString>;
|
|
71
|
+
method: z.ZodNullable<z.ZodString>;
|
|
72
|
+
status: z.ZodNullable<z.ZodNumber>;
|
|
73
|
+
model: z.ZodNullable<z.ZodString>;
|
|
74
|
+
prompt_tokens: z.ZodNullable<z.ZodNumber>;
|
|
75
|
+
completion_tokens: z.ZodNullable<z.ZodNumber>;
|
|
76
|
+
cost_usd: z.ZodNullable<z.ZodNumber>;
|
|
77
|
+
ts: z.ZodString;
|
|
78
|
+
event_id: z.ZodString;
|
|
79
|
+
parent_id: z.ZodNullable<z.ZodString>;
|
|
80
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
81
|
+
kind: z.ZodLiteral<"ToolUseEvent">;
|
|
82
|
+
tool_use_id: z.ZodString;
|
|
83
|
+
tool_name: z.ZodString;
|
|
84
|
+
input: z.ZodUnknown;
|
|
85
|
+
ts: z.ZodString;
|
|
86
|
+
event_id: z.ZodString;
|
|
87
|
+
parent_id: z.ZodNullable<z.ZodString>;
|
|
88
|
+
}, z.core.$strip>], "kind">;
|
|
89
|
+
export type ShimmableLegacyEvent = z.infer<typeof shimmableLegacyEventSchema>;
|
|
90
|
+
export interface LegacyShimOptions {
|
|
91
|
+
run_id?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Translate a single legacy `TwinHttpEvent` / `LlmCallEvent` / `ToolUseEvent`
|
|
95
|
+
* into a validated `OtelSpanEvent`.
|
|
96
|
+
*
|
|
97
|
+
* Throws a typed `ZodError` if `rawRecord` is not one of those three shapes,
|
|
98
|
+
* or a plain `Error` if an LLM/tool record is missing the required `run_id`.
|
|
99
|
+
*/
|
|
100
|
+
export declare function shimLegacyEventToSpan(rawRecord: unknown, options?: LegacyShimOptions): OtelSpanEvent;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* otel/legacy-shim — legacy event → `OtelSpanEvent` translation (M1.2 / FDRS-481).
|
|
4
|
+
*
|
|
5
|
+
* The compatibility layer for the transition window: the CLI keeps uploading its
|
|
6
|
+
* current JSONL (no flag day), and OTel-aware downstream (M3 correlation, the
|
|
7
|
+
* native waterfall) reads `OtelSpanEvent`. This shim translates the three legacy
|
|
8
|
+
* variants — `TwinHttpEvent`, `LlmCallEvent`, `ToolUseEvent` — up into spans so
|
|
9
|
+
* legacy and new data share one path.
|
|
10
|
+
*
|
|
11
|
+
* Guarantees:
|
|
12
|
+
* - **Lossless.** The ENTIRE original record is preserved verbatim as a JSON
|
|
13
|
+
* string under `attributes["pome.legacy.record_json"]` — serialized from the
|
|
14
|
+
* raw input BEFORE Zod strips any additive fields (review finding #3). The
|
|
15
|
+
* mapped fields are ALSO written as canonical OTel attributes, from which
|
|
16
|
+
* the typed projections are derived by the SAME projector the schema checks.
|
|
17
|
+
* - **Deterministic.** No clock, no randomness. Same record (+ same `run_id`
|
|
18
|
+
* option) → byte-identical span, every run.
|
|
19
|
+
* - **OTel-correct status** (review findings #5/#9). HTTP client spans: 1xx–3xx
|
|
20
|
+
* leave status UNSET; 4xx/5xx and transport errors are ERROR. (OTel does not
|
|
21
|
+
* set OK on a merely-successful span.)
|
|
22
|
+
*
|
|
23
|
+
* IDs are namespaced `legacy:<source-id>` so a stored span always declares it
|
|
24
|
+
* originated from a pre-OTel record (the canonical schema accepts either real
|
|
25
|
+
* W3C ids or `legacy:` ids).
|
|
26
|
+
*
|
|
27
|
+
* Pinned convention: the shim targets `OTEL_GENAI_SCHEMA_VERSION` (see `./semconv`).
|
|
28
|
+
*/
|
|
29
|
+
import { z } from "zod";
|
|
30
|
+
import { llmCallEventSchema, toolUseEventSchema, twinHttpEventSchema, } from "../recorder-events.js";
|
|
31
|
+
import { msToNanos, nanosToIso } from "./nano.js";
|
|
32
|
+
import { projectAttributes, } from "./project.js";
|
|
33
|
+
import { ERROR_TYPE, GEN_AI_OPERATION_NAME, GEN_AI_REQUEST_MODEL, GEN_AI_TOOL_NAME, GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, HTTP_REQUEST_METHOD, HTTP_RESPONSE_STATUS_CODE, OTEL_GENAI_SCHEMA_VERSION, SERVER_ADDRESS, SERVER_PORT, URL_FULL, URL_PATH, } from "./semconv.js";
|
|
34
|
+
import { otelSpanEventSchema } from "./span-event.js";
|
|
35
|
+
// The shim targets this pinned GenAI convention version (from M1.1). This
|
|
36
|
+
// re-export makes the pin explicit and testable.
|
|
37
|
+
export const LEGACY_SHIM_SEMCONV_VERSION = OTEL_GENAI_SCHEMA_VERSION;
|
|
38
|
+
// The documented namespace for legacy provenance. `record_json` is the lossless
|
|
39
|
+
// source of truth; `kind` records the originating legacy variant.
|
|
40
|
+
export const LEGACY_ATTR_NAMESPACE = "pome.legacy";
|
|
41
|
+
export const LEGACY_ID_PREFIX = "legacy:";
|
|
42
|
+
const ATTR_LEGACY_KIND = `${LEGACY_ATTR_NAMESPACE}.kind`;
|
|
43
|
+
const ATTR_LEGACY_RECORD_JSON = `${LEGACY_ATTR_NAMESPACE}.record_json`;
|
|
44
|
+
// The legacy variants this shim accepts. Discriminated on `kind`.
|
|
45
|
+
//
|
|
46
|
+
// NOT-SHIMMABLE-IN-M1: `HookEvent`, `ToolResultEvent`, `SubagentSpawnEvent`, and
|
|
47
|
+
// `LlmTurnEvent` (F-766) are intentionally absent. They are captured into
|
|
48
|
+
// events.jsonl but not projected to spans yet — the M2 projection layer adds
|
|
49
|
+
// full coverage (LlmTurnEvent → a `chat` span carrying the cache-token
|
|
50
|
+
// attributes; ToolResult pairs into its execute_tool span; etc.). Until then
|
|
51
|
+
// `shimLegacyEventToSpan` rejects these kinds with a typed ZodError rather than
|
|
52
|
+
// emitting a lossy span. The otel-legacy-shim test locks this deliberately.
|
|
53
|
+
export const shimmableLegacyEventSchema = z.discriminatedUnion("kind", [
|
|
54
|
+
twinHttpEventSchema,
|
|
55
|
+
llmCallEventSchema,
|
|
56
|
+
toolUseEventSchema,
|
|
57
|
+
]);
|
|
58
|
+
// `legacy:`-namespace a non-OTel source id. Idempotent if already namespaced.
|
|
59
|
+
function legacyId(sourceId) {
|
|
60
|
+
return sourceId.startsWith(LEGACY_ID_PREFIX) ? sourceId : `${LEGACY_ID_PREFIX}${sourceId}`;
|
|
61
|
+
}
|
|
62
|
+
// Resolve the legacy run id used as the trace grouping key.
|
|
63
|
+
function resolveRunId(options, record) {
|
|
64
|
+
if (options.run_id !== undefined) {
|
|
65
|
+
return options.run_id;
|
|
66
|
+
}
|
|
67
|
+
if (record.kind === "TwinHttpEvent") {
|
|
68
|
+
return record.run_id;
|
|
69
|
+
}
|
|
70
|
+
// No run context — LLM/tool rows carry none internally. Refusing here keeps
|
|
71
|
+
// related rows from each landing in their own orphan trace.
|
|
72
|
+
throw new Error(`legacy-shim: ${record.kind} requires options.run_id for trace context`);
|
|
73
|
+
}
|
|
74
|
+
// Drop null/undefined entries so the bag stays a valid attribute record (the
|
|
75
|
+
// attribute schema has no null member — an absent attribute is omitted).
|
|
76
|
+
function buildBag(entries) {
|
|
77
|
+
const bag = {};
|
|
78
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
79
|
+
if (value !== null && value !== undefined)
|
|
80
|
+
bag[key] = value;
|
|
81
|
+
}
|
|
82
|
+
return bag;
|
|
83
|
+
}
|
|
84
|
+
// OTel HTTP client span status: success (incl. redirects) stays UNSET; 4xx/5xx
|
|
85
|
+
// and transport errors are ERROR (review #9). Returns the status + the
|
|
86
|
+
// low-cardinality `error.type` token to stamp on the bag.
|
|
87
|
+
function httpStatus(status, error) {
|
|
88
|
+
if (error !== null)
|
|
89
|
+
return { code: "ERROR", errorType: "network_error" };
|
|
90
|
+
if (status >= 400)
|
|
91
|
+
return { code: "ERROR", errorType: String(status) };
|
|
92
|
+
return { code: "UNSET", errorType: null };
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Translate a single legacy `TwinHttpEvent` / `LlmCallEvent` / `ToolUseEvent`
|
|
96
|
+
* into a validated `OtelSpanEvent`.
|
|
97
|
+
*
|
|
98
|
+
* Throws a typed `ZodError` if `rawRecord` is not one of those three shapes,
|
|
99
|
+
* or a plain `Error` if an LLM/tool record is missing the required `run_id`.
|
|
100
|
+
*/
|
|
101
|
+
export function shimLegacyEventToSpan(rawRecord, options = {}) {
|
|
102
|
+
const record = shimmableLegacyEventSchema.parse(rawRecord);
|
|
103
|
+
const startMs = Date.parse(record.ts);
|
|
104
|
+
const startNano = msToNanos(startMs);
|
|
105
|
+
const traceId = legacyId(resolveRunId(options, record));
|
|
106
|
+
const spanId = legacyId(record.event_id);
|
|
107
|
+
const parentSpanId = record.parent_id !== null ? legacyId(record.parent_id) : null;
|
|
108
|
+
// Lossless: serialize the RAW input (not the Zod-stripped record) so additive
|
|
109
|
+
// legacy fields survive round-trip.
|
|
110
|
+
const legacyNamespace = {
|
|
111
|
+
[ATTR_LEGACY_KIND]: record.kind,
|
|
112
|
+
[ATTR_LEGACY_RECORD_JSON]: JSON.stringify(rawRecord),
|
|
113
|
+
};
|
|
114
|
+
let name;
|
|
115
|
+
let spanKind;
|
|
116
|
+
let endNano;
|
|
117
|
+
let statusCode;
|
|
118
|
+
let statusMessage;
|
|
119
|
+
let semanticAttrs;
|
|
120
|
+
if (record.kind === "TwinHttpEvent") {
|
|
121
|
+
const status = httpStatus(record.status, record.error);
|
|
122
|
+
// Low-cardinality span name: HTTP method only (the concrete path is a high-
|
|
123
|
+
// cardinality URL, not a route template) — review #4.
|
|
124
|
+
name = record.method;
|
|
125
|
+
spanKind = "CLIENT";
|
|
126
|
+
endNano = msToNanos(startMs + record.latency_ms);
|
|
127
|
+
statusCode = status.code;
|
|
128
|
+
statusMessage = record.error;
|
|
129
|
+
semanticAttrs = buildBag({
|
|
130
|
+
[HTTP_REQUEST_METHOD]: record.method,
|
|
131
|
+
[HTTP_RESPONSE_STATUS_CODE]: record.status,
|
|
132
|
+
[URL_PATH]: record.path,
|
|
133
|
+
[ERROR_TYPE]: status.errorType,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
else if (record.kind === "LlmCallEvent") {
|
|
137
|
+
// Asymmetry vs TwinHttpEvent (intentional, M1): a legacy LlmCallEvent has no
|
|
138
|
+
// transport-error field, so only an HTTP >=400 status drives ERROR here —
|
|
139
|
+
// a connection-level failure with a null status stays UNSET. M3 unifies on
|
|
140
|
+
// real OTel span status; until then LLM rows may under-report errors vs HTTP.
|
|
141
|
+
const errored = record.status !== null && record.status >= 400;
|
|
142
|
+
name = record.model !== null ? `chat ${record.model}` : "chat";
|
|
143
|
+
spanKind = "CLIENT";
|
|
144
|
+
endNano = msToNanos(startMs + record.latency_ms);
|
|
145
|
+
statusCode = errored ? "ERROR" : "UNSET";
|
|
146
|
+
statusMessage = null;
|
|
147
|
+
semanticAttrs = buildBag({
|
|
148
|
+
[GEN_AI_OPERATION_NAME]: "chat",
|
|
149
|
+
[GEN_AI_REQUEST_MODEL]: record.model,
|
|
150
|
+
[GEN_AI_USAGE_INPUT_TOKENS]: record.prompt_tokens,
|
|
151
|
+
[GEN_AI_USAGE_OUTPUT_TOKENS]: record.completion_tokens,
|
|
152
|
+
[HTTP_REQUEST_METHOD]: record.method,
|
|
153
|
+
[HTTP_RESPONSE_STATUS_CODE]: record.status,
|
|
154
|
+
[URL_FULL]: record.url,
|
|
155
|
+
[SERVER_ADDRESS]: record.host,
|
|
156
|
+
[SERVER_PORT]: record.port,
|
|
157
|
+
[ERROR_TYPE]: errored ? String(record.status) : null,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
// ToolUseEvent
|
|
162
|
+
name = `execute_tool ${record.tool_name}`;
|
|
163
|
+
spanKind = "INTERNAL";
|
|
164
|
+
endNano = null;
|
|
165
|
+
statusCode = "UNSET";
|
|
166
|
+
statusMessage = null;
|
|
167
|
+
semanticAttrs = buildBag({
|
|
168
|
+
[GEN_AI_OPERATION_NAME]: "execute_tool",
|
|
169
|
+
[GEN_AI_TOOL_NAME]: record.tool_name,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
const attributes = { ...semanticAttrs, ...legacyNamespace };
|
|
173
|
+
const candidate = {
|
|
174
|
+
ts: nanosToIso(startNano),
|
|
175
|
+
event_id: spanId,
|
|
176
|
+
parent_id: parentSpanId,
|
|
177
|
+
kind: "OtelSpanEvent",
|
|
178
|
+
trace_id: traceId,
|
|
179
|
+
span_id: spanId,
|
|
180
|
+
parent_span_id: parentSpanId,
|
|
181
|
+
name,
|
|
182
|
+
span_kind: spanKind,
|
|
183
|
+
start_time_unix_nano: startNano,
|
|
184
|
+
end_time_unix_nano: endNano,
|
|
185
|
+
status_code: statusCode,
|
|
186
|
+
status_message: statusMessage,
|
|
187
|
+
...projectAttributes(attributes),
|
|
188
|
+
attributes,
|
|
189
|
+
};
|
|
190
|
+
// Re-validate so the shim's output is provably a canonical `OtelSpanEvent`.
|
|
191
|
+
return otelSpanEventSchema.parse(candidate);
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=legacy-shim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-shim.js","sourceRoot":"","sources":["../../src/otel/legacy-shim.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,u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C,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;SACrD,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,eAAe;QACf,IAAI,GAAG,gBAAgB,MAAM,CAAC,SAAS,EAAE,CAAC;QAC1C,QAAQ,GAAG,UAAU,CAAC;QACtB,OAAO,GAAG,IAAI,CAAC;QACf,UAAU,GAAG,OAAO,CAAC;QACrB,aAAa,GAAG,IAAI,CAAC;QACrB,aAAa,GAAG,QAAQ,CAAC;YACvB,CAAC,qBAAqB,CAAC,EAAE,cAAc;YACvC,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,SAAS;SACrC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,UAAU,GAAqB,EAAE,GAAG,aAAa,EAAE,GAAG,eAAe,EAAE,CAAC;IAE9E,MAAM,SAAS,GAAG;QAChB,EAAE,EAAE,UAAU,CAAC,SAAS,CAAC;QACzB,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,eAAwB;QAC9B,QAAQ,EAAE,OAAO;QACjB,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,YAAY;QAC5B,IAAI;QACJ,SAAS,EAAE,QAAQ;QACnB,oBAAoB,EAAE,SAAS;QAC/B,kBAAkB,EAAE,OAAO;QAC3B,WAAW,EAAE,UAAU;QACvB,cAAc,EAAE,aAAa;QAC7B,GAAG,iBAAiB,CAAC,UAAU,CAAC;QAChC,UAAU;KACX,CAAC;IAEF,4EAA4E;IAC5E,OAAO,mBAAmB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC9C,CAAC"}
|
package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/map-span.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* otel/map-span — pure OTel span → `OtelSpanEvent` mapping (M1.1 / FDRS-480).
|
|
3
|
+
*
|
|
4
|
+
* Deterministic: same input → byte-identical event, every run. Has no clock,
|
|
5
|
+
* no randomness; `ts` is derived from the span's start time.
|
|
6
|
+
*
|
|
7
|
+
* Input is a NORMALIZED span: real W3C trace context (lowercase-hex ids) and a
|
|
8
|
+
* flat `attributes` `Record<string, value>`. Decoding raw OTLP/JSON `AnyValue`
|
|
9
|
+
* (`{ stringValue }`, kvlist, bytes) and the `[{ key, value }]` attribute array
|
|
10
|
+
* into this flat record is M2's job (the `@opentelemetry/otlp-transformer`
|
|
11
|
+
* dependency) — keeping M1.1 free of an OTLP decoder keeps the schema
|
|
12
|
+
* self-testable.
|
|
13
|
+
*
|
|
14
|
+
* Round-trip example:
|
|
15
|
+
*
|
|
16
|
+
* mapOtelSpanToEvent({
|
|
17
|
+
* trace_id: "4bf92f3577b34da6a3ce929d0e0e4736",
|
|
18
|
+
* span_id: "00f067aa0ba902b7",
|
|
19
|
+
* name: "chat google/gemini-2.5-flash",
|
|
20
|
+
* start_time_unix_nano: "1700000000000000000",
|
|
21
|
+
* attributes: {
|
|
22
|
+
* "gen_ai.provider.name": "google",
|
|
23
|
+
* "gen_ai.request.model": "gemini-2.5-flash",
|
|
24
|
+
* "gen_ai.usage.input_tokens": 42,
|
|
25
|
+
* },
|
|
26
|
+
* })
|
|
27
|
+
* // → { ts: "2023-11-14T22:13:20.000Z", event_id: "00f067aa0ba902b7", … }
|
|
28
|
+
*/
|
|
29
|
+
import { z } from "zod";
|
|
30
|
+
import { type OtelSpanEvent } from "./span-event.js";
|
|
31
|
+
export declare const otelSpanInputSchema: z.ZodObject<{
|
|
32
|
+
trace_id: z.ZodString;
|
|
33
|
+
span_id: z.ZodString;
|
|
34
|
+
parent_span_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
37
|
+
UNSPECIFIED: "UNSPECIFIED";
|
|
38
|
+
INTERNAL: "INTERNAL";
|
|
39
|
+
SERVER: "SERVER";
|
|
40
|
+
CLIENT: "CLIENT";
|
|
41
|
+
PRODUCER: "PRODUCER";
|
|
42
|
+
CONSUMER: "CONSUMER";
|
|
43
|
+
}>, z.ZodNumber]>>;
|
|
44
|
+
start_time_unix_nano: z.ZodString;
|
|
45
|
+
end_time_unix_nano: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
status: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
48
|
+
UNSET: "UNSET";
|
|
49
|
+
OK: "OK";
|
|
50
|
+
ERROR: "ERROR";
|
|
51
|
+
}>, z.ZodNumber]>>;
|
|
52
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type OtelSpanInput = z.infer<typeof otelSpanInputSchema>;
|
|
57
|
+
/**
|
|
58
|
+
* Map a normalized OTLP span onto a validated `OtelSpanEvent`.
|
|
59
|
+
*
|
|
60
|
+
* Throws a `ZodError` (typed; names the offending field) when the input is
|
|
61
|
+
* malformed — a non-hex `trace_id`, an out-of-range unix-nano, a reversed span
|
|
62
|
+
* (end < start), a non-finite attribute value, etc.
|
|
63
|
+
*/
|
|
64
|
+
export declare function mapOtelSpanToEvent(rawSpan: unknown): OtelSpanEvent;
|
package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/map-span.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* otel/map-span — pure OTel span → `OtelSpanEvent` mapping (M1.1 / FDRS-480).
|
|
4
|
+
*
|
|
5
|
+
* Deterministic: same input → byte-identical event, every run. Has no clock,
|
|
6
|
+
* no randomness; `ts` is derived from the span's start time.
|
|
7
|
+
*
|
|
8
|
+
* Input is a NORMALIZED span: real W3C trace context (lowercase-hex ids) and a
|
|
9
|
+
* flat `attributes` `Record<string, value>`. Decoding raw OTLP/JSON `AnyValue`
|
|
10
|
+
* (`{ stringValue }`, kvlist, bytes) and the `[{ key, value }]` attribute array
|
|
11
|
+
* into this flat record is M2's job (the `@opentelemetry/otlp-transformer`
|
|
12
|
+
* dependency) — keeping M1.1 free of an OTLP decoder keeps the schema
|
|
13
|
+
* self-testable.
|
|
14
|
+
*
|
|
15
|
+
* Round-trip example:
|
|
16
|
+
*
|
|
17
|
+
* mapOtelSpanToEvent({
|
|
18
|
+
* trace_id: "4bf92f3577b34da6a3ce929d0e0e4736",
|
|
19
|
+
* span_id: "00f067aa0ba902b7",
|
|
20
|
+
* name: "chat google/gemini-2.5-flash",
|
|
21
|
+
* start_time_unix_nano: "1700000000000000000",
|
|
22
|
+
* attributes: {
|
|
23
|
+
* "gen_ai.provider.name": "google",
|
|
24
|
+
* "gen_ai.request.model": "gemini-2.5-flash",
|
|
25
|
+
* "gen_ai.usage.input_tokens": 42,
|
|
26
|
+
* },
|
|
27
|
+
* })
|
|
28
|
+
* // → { ts: "2023-11-14T22:13:20.000Z", event_id: "00f067aa0ba902b7", … }
|
|
29
|
+
*/
|
|
30
|
+
import { z } from "zod";
|
|
31
|
+
import { nanosToIso } from "./nano.js";
|
|
32
|
+
import { otelAttributeValueSchema, projectAttributes } from "./project.js";
|
|
33
|
+
import { OTEL_SPAN_KINDS, OTEL_STATUS_CODES, otelSpanEventSchema, otelSpanKindSchema, otelStatusCodeSchema, unixNanoSchema, w3cSpanIdSchema, w3cTraceIdSchema, } from "./span-event.js";
|
|
34
|
+
// Normalized OTLP span input. IDs are strict W3C trace context (real OTel
|
|
35
|
+
// always emits hex). `kind` / `status.code` accept either the OTLP integer
|
|
36
|
+
// (0–5 / 0–2) or the name; everything else is already decoded.
|
|
37
|
+
export const otelSpanInputSchema = z.object({
|
|
38
|
+
trace_id: w3cTraceIdSchema,
|
|
39
|
+
span_id: w3cSpanIdSchema,
|
|
40
|
+
parent_span_id: w3cSpanIdSchema.nullable().optional(),
|
|
41
|
+
name: z.string().min(1),
|
|
42
|
+
kind: z.union([otelSpanKindSchema, z.number().int().min(0).max(5)]).optional(),
|
|
43
|
+
start_time_unix_nano: unixNanoSchema,
|
|
44
|
+
end_time_unix_nano: unixNanoSchema.nullable().optional(),
|
|
45
|
+
status: z
|
|
46
|
+
.object({
|
|
47
|
+
code: z.union([otelStatusCodeSchema, z.number().int().min(0).max(2)]).optional(),
|
|
48
|
+
message: z.string().nullable().optional(),
|
|
49
|
+
})
|
|
50
|
+
.optional(),
|
|
51
|
+
attributes: z.record(z.string(), otelAttributeValueSchema).default({}),
|
|
52
|
+
});
|
|
53
|
+
function normalizeSpanKind(kind) {
|
|
54
|
+
if (kind === undefined) {
|
|
55
|
+
// OTel SDKs default an unset kind to INTERNAL.
|
|
56
|
+
return "INTERNAL";
|
|
57
|
+
}
|
|
58
|
+
if (typeof kind === "number") {
|
|
59
|
+
// Bounded 0–5 by `otelSpanInputSchema`; `!` avoids an unreachable branch.
|
|
60
|
+
return OTEL_SPAN_KINDS[kind];
|
|
61
|
+
}
|
|
62
|
+
return kind;
|
|
63
|
+
}
|
|
64
|
+
function normalizeStatusCode(code) {
|
|
65
|
+
if (code === undefined) {
|
|
66
|
+
return "UNSET";
|
|
67
|
+
}
|
|
68
|
+
if (typeof code === "number") {
|
|
69
|
+
// Bounded 0–2 by `otelSpanInputSchema`; `!` avoids an unreachable branch.
|
|
70
|
+
return OTEL_STATUS_CODES[code];
|
|
71
|
+
}
|
|
72
|
+
return code;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Map a normalized OTLP span onto a validated `OtelSpanEvent`.
|
|
76
|
+
*
|
|
77
|
+
* Throws a `ZodError` (typed; names the offending field) when the input is
|
|
78
|
+
* malformed — a non-hex `trace_id`, an out-of-range unix-nano, a reversed span
|
|
79
|
+
* (end < start), a non-finite attribute value, etc.
|
|
80
|
+
*/
|
|
81
|
+
export function mapOtelSpanToEvent(rawSpan) {
|
|
82
|
+
const span = otelSpanInputSchema.parse(rawSpan);
|
|
83
|
+
const attributes = span.attributes;
|
|
84
|
+
const parentSpanId = span.parent_span_id ?? null;
|
|
85
|
+
const candidate = {
|
|
86
|
+
ts: nanosToIso(span.start_time_unix_nano),
|
|
87
|
+
// The span id IS the canonical row id for an OTel event; the base
|
|
88
|
+
// parent-chain mirrors span parentage so downstream union readers and M3
|
|
89
|
+
// correlation agree.
|
|
90
|
+
event_id: span.span_id,
|
|
91
|
+
parent_id: parentSpanId,
|
|
92
|
+
kind: "OtelSpanEvent",
|
|
93
|
+
trace_id: span.trace_id,
|
|
94
|
+
span_id: span.span_id,
|
|
95
|
+
parent_span_id: parentSpanId,
|
|
96
|
+
name: span.name,
|
|
97
|
+
span_kind: normalizeSpanKind(span.kind),
|
|
98
|
+
start_time_unix_nano: span.start_time_unix_nano,
|
|
99
|
+
end_time_unix_nano: span.end_time_unix_nano ?? null,
|
|
100
|
+
status_code: normalizeStatusCode(span.status?.code),
|
|
101
|
+
status_message: span.status?.message ?? null,
|
|
102
|
+
// Verbatim bag plus its single-source projection. The schema re-derives the
|
|
103
|
+
// projection and rejects drift, so this is the only place it is computed.
|
|
104
|
+
...projectAttributes(attributes),
|
|
105
|
+
attributes,
|
|
106
|
+
};
|
|
107
|
+
// Re-validate the assembled event so the canonical model is always schema-
|
|
108
|
+
// valid. This DOES fire for bad input the input schema let through (e.g. a
|
|
109
|
+
// reversed span), surfacing a typed ZodError instead of a silent bad row.
|
|
110
|
+
return otelSpanEventSchema.parse(candidate);
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=map-span.js.map
|
|
@@ -0,0 +1 @@
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AS,EAAE,YAAY;QACvB,IAAI,EAAE,eAAwB;QAE9B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,cAAc,EAAE,YAAY;QAE5B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;QACvC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;QAC/C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,IAAI,IAAI;QACnD,WAAW,EAAE,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;QACnD,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,IAAI;QAE5C,4EAA4E;QAC5E,0EAA0E;QAC1E,GAAG,iBAAiB,CAAC,UAAU,CAAC;QAChC,UAAU;KACX,CAAC;IAEF,2EAA2E;IAC3E,2EAA2E;IAC3E,0EAA0E;IAC1E,OAAO,mBAAmB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC9C,CAAC"}
|
package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/nano.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* otel/nano — uint64 decimal-string arithmetic + nanosecond↔ISO conversion
|
|
3
|
+
* (M1.1 / FDRS-480).
|
|
4
|
+
*
|
|
5
|
+
* OTLP encodes `*_unix_nano` timestamps as uint64 decimal STRINGS because the
|
|
6
|
+
* values exceed Number.MAX_SAFE_INTEGER. These helpers validate and compare
|
|
7
|
+
* them WITHOUT `BigInt` — the dashboard compiles this source directly under a
|
|
8
|
+
* pre-ES2020 target where `BigInt` literals fail to typecheck (review-era
|
|
9
|
+
* portability fix). Everything here is pure and deterministic.
|
|
10
|
+
*/
|
|
11
|
+
export declare const UINT64_MAX = "18446744073709551615";
|
|
12
|
+
/** True iff `value` is a non-negative decimal integer string within uint64. */
|
|
13
|
+
export declare function isUint64(value: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Compare two uint64 decimal strings. Returns <0 if a<b, 0 if equal, >0 if a>b.
|
|
16
|
+
* Assumes both are valid digit strings (callers validate via `isUint64` first).
|
|
17
|
+
*/
|
|
18
|
+
export declare function compareUint64(a: string, b: string): number;
|
|
19
|
+
export declare function msToNanos(millis: number): string;
|
|
20
|
+
/**
|
|
21
|
+
* uint64 nanoseconds → ISO-8601 (UTC). Floors to milliseconds by dropping the
|
|
22
|
+
* last 6 decimal digits of the (uint64-validated) integer string. The resulting
|
|
23
|
+
* ms value is within Date's safe range for any valid uint64, so this never
|
|
24
|
+
* throws for input that passed `isUint64`. String-slicing avoids `BigInt`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function nanosToIso(unixNano: string): string;
|
package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/nano.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* otel/nano — uint64 decimal-string arithmetic + nanosecond↔ISO conversion
|
|
4
|
+
* (M1.1 / FDRS-480).
|
|
5
|
+
*
|
|
6
|
+
* OTLP encodes `*_unix_nano` timestamps as uint64 decimal STRINGS because the
|
|
7
|
+
* values exceed Number.MAX_SAFE_INTEGER. These helpers validate and compare
|
|
8
|
+
* them WITHOUT `BigInt` — the dashboard compiles this source directly under a
|
|
9
|
+
* pre-ES2020 target where `BigInt` literals fail to typecheck (review-era
|
|
10
|
+
* portability fix). Everything here is pure and deterministic.
|
|
11
|
+
*/
|
|
12
|
+
// 2^64 - 1. A unix-nano timestamp must fit in a uint64; a longer/larger decimal
|
|
13
|
+
// string is rejected so it can never reach `nanosToIso` and throw a RangeError
|
|
14
|
+
// (review finding #4).
|
|
15
|
+
export const UINT64_MAX = "18446744073709551615";
|
|
16
|
+
// Strip leading zeros, keeping a single "0" for an all-zero string. The
|
|
17
|
+
// `(?=\d)` lookahead guarantees at least one digit remains, so for any digit
|
|
18
|
+
// string (callers validate via the `^\d+$` test first) the result is non-empty.
|
|
19
|
+
// Lets us compare normalized decimals by (length, then lexicographic).
|
|
20
|
+
function normalizeDigits(value) {
|
|
21
|
+
return value.replace(/^0+(?=\d)/, "");
|
|
22
|
+
}
|
|
23
|
+
/** True iff `value` is a non-negative decimal integer string within uint64. */
|
|
24
|
+
export function isUint64(value) {
|
|
25
|
+
if (!/^\d+$/.test(value))
|
|
26
|
+
return false;
|
|
27
|
+
const normalized = normalizeDigits(value);
|
|
28
|
+
if (normalized.length !== UINT64_MAX.length) {
|
|
29
|
+
return normalized.length < UINT64_MAX.length;
|
|
30
|
+
}
|
|
31
|
+
return normalized <= UINT64_MAX;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Compare two uint64 decimal strings. Returns <0 if a<b, 0 if equal, >0 if a>b.
|
|
35
|
+
* Assumes both are valid digit strings (callers validate via `isUint64` first).
|
|
36
|
+
*/
|
|
37
|
+
export function compareUint64(a, b) {
|
|
38
|
+
const na = normalizeDigits(a);
|
|
39
|
+
const nb = normalizeDigits(b);
|
|
40
|
+
if (na.length !== nb.length)
|
|
41
|
+
return na.length - nb.length;
|
|
42
|
+
if (na === nb)
|
|
43
|
+
return 0;
|
|
44
|
+
return na < nb ? -1 : 1;
|
|
45
|
+
}
|
|
46
|
+
// Unix-milliseconds → uint64 unix-nanoseconds decimal string. Legacy timestamps
|
|
47
|
+
// are millisecond-precision, so this is exact: append six zeros. Deterministic.
|
|
48
|
+
export function msToNanos(millis) {
|
|
49
|
+
return `${millis}000000`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* uint64 nanoseconds → ISO-8601 (UTC). Floors to milliseconds by dropping the
|
|
53
|
+
* last 6 decimal digits of the (uint64-validated) integer string. The resulting
|
|
54
|
+
* ms value is within Date's safe range for any valid uint64, so this never
|
|
55
|
+
* throws for input that passed `isUint64`. String-slicing avoids `BigInt`.
|
|
56
|
+
*/
|
|
57
|
+
export function nanosToIso(unixNano) {
|
|
58
|
+
const millis = Number(unixNano.slice(0, -6) || "0");
|
|
59
|
+
return new Date(millis).toISOString();
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=nano.js.map
|
package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/nano.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nano.js","sourceRoot":"","sources":["../../src/otel/nano.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;;;;;;GASG;AAEH,gFAAgF;AAChF,+EAA+E;AAC/E,uBAAuB;AACvB,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAEjD,wEAAwE;AACxE,6EAA6E;AAC7E,gFAAgF;AAChF,uEAAuE;AACvE,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,MAAM,UAAU,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,UAAU,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC;QAC5C,OAAO,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/C,CAAC;IACD,OAAO,UAAU,IAAI,UAAU,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,CAAS,EAAE,CAAS;IAChD,MAAM,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC;IAC1D,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,CAAC,CAAC;IACxB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC;AAED,gFAAgF;AAChF,gFAAgF;AAChF,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,OAAO,GAAG,MAAM,QAAQ,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;IACpD,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;AACxC,CAAC"}
|
package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/project.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* otel/project — the single attribute→projection function (M1.1 / FDRS-480).
|
|
3
|
+
*
|
|
4
|
+
* The typed `gen_ai_*` / `http_*` / `url_*` / `server_*` / `error_type` fields
|
|
5
|
+
* on an `OtelSpanEvent` are PROJECTIONS of the verbatim `attributes` bag, never
|
|
6
|
+
* an independent source of truth. This module is the ONE place that derivation
|
|
7
|
+
* lives, so:
|
|
8
|
+
* - the span mapper (`map-span.ts`) builds projections from `attributes`,
|
|
9
|
+
* - the legacy shim (`legacy-shim.ts`) builds them the same way, and
|
|
10
|
+
* - the schema (`span-event.ts`) re-derives them in a `superRefine` and
|
|
11
|
+
* rejects any event whose typed fields drift from `attributes`
|
|
12
|
+
* (review finding #4 — projection drift; finding #7 — centralize).
|
|
13
|
+
*
|
|
14
|
+
* Pure and deterministic. Reads only the pinned attribute names from `semconv`.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
export declare const otelAttributeValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>;
|
|
18
|
+
export type OtelAttributeValue = z.infer<typeof otelAttributeValueSchema>;
|
|
19
|
+
export type OtelAttributeBag = Record<string, OtelAttributeValue>;
|
|
20
|
+
export declare const OTEL_PROJECTION_KEYS: readonly ["gen_ai_provider_name", "gen_ai_operation_name", "gen_ai_request_model", "gen_ai_agent_name", "gen_ai_agent_id", "gen_ai_tool_name", "gen_ai_usage_input_tokens", "gen_ai_usage_output_tokens", "http_request_method", "http_response_status_code", "url_full", "url_path", "server_address", "server_port", "error_type"];
|
|
21
|
+
export type OtelProjections = {
|
|
22
|
+
gen_ai_provider_name: string | null;
|
|
23
|
+
gen_ai_operation_name: string | null;
|
|
24
|
+
gen_ai_request_model: string | null;
|
|
25
|
+
gen_ai_agent_name: string | null;
|
|
26
|
+
gen_ai_agent_id: string | null;
|
|
27
|
+
gen_ai_tool_name: string | null;
|
|
28
|
+
gen_ai_usage_input_tokens: number | null;
|
|
29
|
+
gen_ai_usage_output_tokens: number | null;
|
|
30
|
+
http_request_method: string | null;
|
|
31
|
+
http_response_status_code: number | null;
|
|
32
|
+
url_full: string | null;
|
|
33
|
+
url_path: string | null;
|
|
34
|
+
server_address: string | null;
|
|
35
|
+
server_port: number | null;
|
|
36
|
+
error_type: string | null;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Derive the flat typed projections from a verbatim attribute bag. Canonical
|
|
40
|
+
* names win; deprecated/pre-1.27 aliases are accepted as fallbacks.
|
|
41
|
+
*/
|
|
42
|
+
export declare function projectAttributes(attributes: OtelAttributeBag): OtelProjections;
|