@aexhq/sdk 0.46.4-canary → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +38 -0
- package/README.md +23 -31
- package/dist/client/aex.d.ts +33 -0
- package/dist/client/aex.js +98 -0
- package/dist/client/aex.js.map +1 -0
- package/dist/client/credentials.d.ts +25 -0
- package/dist/client/credentials.js +97 -0
- package/dist/client/credentials.js.map +1 -0
- package/dist/client/routing.d.ts +7 -0
- package/dist/client/routing.js +29 -0
- package/dist/client/routing.js.map +1 -0
- package/dist/downloads/download.d.ts +25 -0
- package/dist/downloads/download.js +53 -0
- package/dist/downloads/download.js.map +1 -0
- package/dist/generated/errors.d.ts +12 -0
- package/dist/generated/errors.js +81 -0
- package/dist/generated/errors.js.map +1 -0
- package/dist/generated/resources.d.ts +730 -0
- package/dist/generated/resources.js +606 -0
- package/dist/generated/resources.js.map +1 -0
- package/dist/generated/routes.d.ts +42 -0
- package/dist/generated/routes.js +2101 -0
- package/dist/generated/routes.js.map +1 -0
- package/dist/index.d.ts +20 -50
- package/dist/index.js +11 -62
- package/dist/index.js.map +1 -1
- package/dist/observations/stream.d.ts +1 -0
- package/dist/observations/stream.js +18 -0
- package/dist/observations/stream.js.map +1 -0
- package/dist/transport/errors.d.ts +60 -0
- package/dist/transport/errors.js +107 -0
- package/dist/transport/errors.js.map +1 -0
- package/dist/transport/pagination.d.ts +8 -0
- package/dist/transport/pagination.js +34 -0
- package/dist/transport/pagination.js.map +1 -0
- package/dist/transport/retry.d.ts +21 -0
- package/dist/transport/retry.js +37 -0
- package/dist/transport/retry.js.map +1 -0
- package/dist/transport/transport.d.ts +25 -0
- package/dist/transport/transport.js +28 -0
- package/dist/transport/transport.js.map +1 -0
- package/package.json +63 -30
- package/dist/_contracts/account-operations.d.ts +0 -101
- package/dist/_contracts/account-operations.js +0 -242
- package/dist/_contracts/account-types.d.ts +0 -461
- package/dist/_contracts/account-types.js +0 -1
- package/dist/_contracts/api-key.d.ts +0 -61
- package/dist/_contracts/api-key.js +0 -101
- package/dist/_contracts/api-routes.d.ts +0 -20
- package/dist/_contracts/api-routes.js +0 -109
- package/dist/_contracts/archive-limits.d.ts +0 -3
- package/dist/_contracts/archive-limits.js +0 -23
- package/dist/_contracts/asset-authoring.d.ts +0 -22
- package/dist/_contracts/asset-authoring.js +0 -106
- package/dist/_contracts/asset-bundle.d.ts +0 -64
- package/dist/_contracts/asset-bundle.js +0 -263
- package/dist/_contracts/asset-upload-helper.d.ts +0 -31
- package/dist/_contracts/asset-upload-helper.js +0 -84
- package/dist/_contracts/billing-admission.d.ts +0 -29
- package/dist/_contracts/billing-admission.js +0 -28
- package/dist/_contracts/bundle-manifest.d.ts +0 -89
- package/dist/_contracts/bundle-manifest.js +0 -158
- package/dist/_contracts/canonical-sha256.d.ts +0 -8
- package/dist/_contracts/canonical-sha256.js +0 -8
- package/dist/_contracts/connection-ticket.d.ts +0 -22
- package/dist/_contracts/connection-ticket.js +0 -54
- package/dist/_contracts/continuation-event.d.ts +0 -31
- package/dist/_contracts/continuation-event.js +0 -6
- package/dist/_contracts/contract-parse-error.d.ts +0 -12
- package/dist/_contracts/contract-parse-error.js +0 -51
- package/dist/_contracts/error-codes.d.ts +0 -26
- package/dist/_contracts/error-codes.js +0 -116
- package/dist/_contracts/error-factory.d.ts +0 -32
- package/dist/_contracts/error-factory.js +0 -174
- package/dist/_contracts/event-envelope.d.ts +0 -471
- package/dist/_contracts/event-envelope.js +0 -501
- package/dist/_contracts/event-stream-client.d.ts +0 -122
- package/dist/_contracts/event-stream-client.js +0 -445
- package/dist/_contracts/event-view.d.ts +0 -44
- package/dist/_contracts/event-view.js +0 -69
- package/dist/_contracts/failure-class.d.ts +0 -29
- package/dist/_contracts/failure-class.js +0 -73
- package/dist/_contracts/http.d.ts +0 -135
- package/dist/_contracts/http.js +0 -434
- package/dist/_contracts/ids.d.ts +0 -66
- package/dist/_contracts/ids.js +0 -119
- package/dist/_contracts/index.d.ts +0 -42
- package/dist/_contracts/index.js +0 -52
- package/dist/_contracts/internal.d.ts +0 -55
- package/dist/_contracts/internal.js +0 -113
- package/dist/_contracts/models.d.ts +0 -30
- package/dist/_contracts/models.js +0 -28
- package/dist/_contracts/operation-core.d.ts +0 -36
- package/dist/_contracts/operation-core.js +0 -70
- package/dist/_contracts/operations.d.ts +0 -218
- package/dist/_contracts/operations.js +0 -1496
- package/dist/_contracts/otlp-projection.d.ts +0 -78
- package/dist/_contracts/otlp-projection.js +0 -171
- package/dist/_contracts/post-hook.d.ts +0 -31
- package/dist/_contracts/post-hook.js +0 -61
- package/dist/_contracts/provider-fault.d.ts +0 -34
- package/dist/_contracts/provider-fault.js +0 -68
- package/dist/_contracts/retry-core.d.ts +0 -29
- package/dist/_contracts/retry-core.js +0 -79
- package/dist/_contracts/runner-event.d.ts +0 -117
- package/dist/_contracts/runner-event.js +0 -172
- package/dist/_contracts/runtime-kind.d.ts +0 -60
- package/dist/_contracts/runtime-kind.js +0 -70
- package/dist/_contracts/runtime-manifest.d.ts +0 -121
- package/dist/_contracts/runtime-manifest.js +0 -83
- package/dist/_contracts/runtime-security-profile.d.ts +0 -26
- package/dist/_contracts/runtime-security-profile.js +0 -73
- package/dist/_contracts/runtime-sizes.d.ts +0 -104
- package/dist/_contracts/runtime-sizes.js +0 -111
- package/dist/_contracts/runtime-types.d.ts +0 -618
- package/dist/_contracts/runtime-types.js +0 -58
- package/dist/_contracts/schemas/asset-bundle.d.ts +0 -70
- package/dist/_contracts/schemas/asset-bundle.js +0 -107
- package/dist/_contracts/schemas/asset-ref.d.ts +0 -61
- package/dist/_contracts/schemas/asset-ref.js +0 -118
- package/dist/_contracts/schemas/bundle-manifest.d.ts +0 -66
- package/dist/_contracts/schemas/bundle-manifest.js +0 -77
- package/dist/_contracts/schemas/index.d.ts +0 -32
- package/dist/_contracts/schemas/index.js +0 -30
- package/dist/_contracts/schemas/mcp-server.d.ts +0 -99
- package/dist/_contracts/schemas/mcp-server.js +0 -209
- package/dist/_contracts/schemas/models.d.ts +0 -29
- package/dist/_contracts/schemas/models.js +0 -51
- package/dist/_contracts/schemas/numeric.d.ts +0 -18
- package/dist/_contracts/schemas/numeric.js +0 -28
- package/dist/_contracts/schemas/post-hook.d.ts +0 -45
- package/dist/_contracts/schemas/post-hook.js +0 -68
- package/dist/_contracts/schemas/response-assets.d.ts +0 -75
- package/dist/_contracts/schemas/response-assets.js +0 -81
- package/dist/_contracts/schemas/response-billing.d.ts +0 -208
- package/dist/_contracts/schemas/response-billing.js +0 -139
- package/dist/_contracts/schemas/response-common.d.ts +0 -132
- package/dist/_contracts/schemas/response-common.js +0 -162
- package/dist/_contracts/schemas/response-identity.d.ts +0 -648
- package/dist/_contracts/schemas/response-identity.js +0 -131
- package/dist/_contracts/schemas/response-mcp-servers.d.ts +0 -51
- package/dist/_contracts/schemas/response-mcp-servers.js +0 -32
- package/dist/_contracts/schemas/response-secrets.d.ts +0 -50
- package/dist/_contracts/schemas/response-secrets.js +0 -32
- package/dist/_contracts/schemas/response-sessions-internal.d.ts +0 -200
- package/dist/_contracts/schemas/response-sessions-internal.js +0 -142
- package/dist/_contracts/schemas/response-sessions.d.ts +0 -1598
- package/dist/_contracts/schemas/response-sessions.js +0 -377
- package/dist/_contracts/schemas/response-webhooks.d.ts +0 -76
- package/dist/_contracts/schemas/response-webhooks.js +0 -42
- package/dist/_contracts/schemas/response-workspace.d.ts +0 -225
- package/dist/_contracts/schemas/response-workspace.js +0 -99
- package/dist/_contracts/schemas/runtime-kind.d.ts +0 -31
- package/dist/_contracts/schemas/runtime-kind.js +0 -29
- package/dist/_contracts/schemas/runtime-security-profile.d.ts +0 -28
- package/dist/_contracts/schemas/runtime-security-profile.js +0 -26
- package/dist/_contracts/schemas/runtime-sizes.d.ts +0 -70
- package/dist/_contracts/schemas/runtime-sizes.js +0 -127
- package/dist/_contracts/schemas/session-limits.d.ts +0 -34
- package/dist/_contracts/schemas/session-limits.js +0 -39
- package/dist/_contracts/schemas/session-machine.d.ts +0 -23
- package/dist/_contracts/schemas/session-machine.js +0 -24
- package/dist/_contracts/schemas/session-request-config.d.ts +0 -58
- package/dist/_contracts/schemas/session-request-config.js +0 -134
- package/dist/_contracts/schemas/session-webhook.d.ts +0 -11
- package/dist/_contracts/schemas/session-webhook.js +0 -38
- package/dist/_contracts/schemas/side-effect-audit.d.ts +0 -98
- package/dist/_contracts/schemas/side-effect-audit.js +0 -102
- package/dist/_contracts/schemas/submission-assets.d.ts +0 -117
- package/dist/_contracts/schemas/submission-assets.js +0 -147
- package/dist/_contracts/schemas/submission-body.d.ts +0 -251
- package/dist/_contracts/schemas/submission-body.js +0 -378
- package/dist/_contracts/schemas/submission-environment.d.ts +0 -79
- package/dist/_contracts/schemas/submission-environment.js +0 -179
- package/dist/_contracts/schemas/submission-request.d.ts +0 -158
- package/dist/_contracts/schemas/submission-request.js +0 -49
- package/dist/_contracts/schemas/submission-secrets.d.ts +0 -47
- package/dist/_contracts/schemas/submission-secrets.js +0 -108
- package/dist/_contracts/schemas/wire.d.ts +0 -118
- package/dist/_contracts/schemas/wire.js +0 -171
- package/dist/_contracts/schemas/workspace-resources.d.ts +0 -50
- package/dist/_contracts/schemas/workspace-resources.js +0 -87
- package/dist/_contracts/sdk-errors.d.ts +0 -212
- package/dist/_contracts/sdk-errors.js +0 -313
- package/dist/_contracts/sdk-secrets.d.ts +0 -67
- package/dist/_contracts/sdk-secrets.js +0 -427
- package/dist/_contracts/session-archive.d.ts +0 -16
- package/dist/_contracts/session-archive.js +0 -92
- package/dist/_contracts/session-artifacts.d.ts +0 -189
- package/dist/_contracts/session-artifacts.js +0 -264
- package/dist/_contracts/session-config.d.ts +0 -373
- package/dist/_contracts/session-config.js +0 -562
- package/dist/_contracts/session-cost-types.d.ts +0 -211
- package/dist/_contracts/session-cost-types.js +0 -69
- package/dist/_contracts/session-cost.d.ts +0 -8
- package/dist/_contracts/session-cost.js +0 -582
- package/dist/_contracts/session-custody.d.ts +0 -165
- package/dist/_contracts/session-custody.js +0 -345
- package/dist/_contracts/session-file-query.d.ts +0 -14
- package/dist/_contracts/session-file-query.js +0 -178
- package/dist/_contracts/session-record.d.ts +0 -112
- package/dist/_contracts/session-record.js +0 -165
- package/dist/_contracts/session-retention.d.ts +0 -201
- package/dist/_contracts/session-retention.js +0 -450
- package/dist/_contracts/side-effect-audit.d.ts +0 -126
- package/dist/_contracts/side-effect-audit.js +0 -520
- package/dist/_contracts/sse.d.ts +0 -74
- package/dist/_contracts/sse.js +0 -227
- package/dist/_contracts/stable.d.ts +0 -45
- package/dist/_contracts/stable.js +0 -62
- package/dist/_contracts/status.d.ts +0 -25
- package/dist/_contracts/status.js +0 -57
- package/dist/_contracts/submission-limits.d.ts +0 -61
- package/dist/_contracts/submission-limits.js +0 -60
- package/dist/_contracts/submission.d.ts +0 -547
- package/dist/_contracts/submission.js +0 -812
- package/dist/_contracts/suggest.d.ts +0 -15
- package/dist/_contracts/suggest.js +0 -53
- package/dist/_contracts/testing/response-bindings.d.ts +0 -45
- package/dist/_contracts/testing/response-bindings.js +0 -256
- package/dist/_contracts/testing/wire-conformance-entry.d.ts +0 -10
- package/dist/_contracts/testing/wire-conformance-entry.js +0 -8
- package/dist/_contracts/testing/wire-conformance.d.ts +0 -169
- package/dist/_contracts/testing/wire-conformance.js +0 -276
- package/dist/_contracts/turn-trace.d.ts +0 -28
- package/dist/_contracts/turn-trace.js +0 -1
- package/dist/_contracts/unknown-field-error.d.ts +0 -13
- package/dist/_contracts/unknown-field-error.js +0 -21
- package/dist/_contracts/value-guards.d.ts +0 -20
- package/dist/_contracts/value-guards.js +0 -34
- package/dist/_contracts/webhook-verify.d.ts +0 -34
- package/dist/_contracts/webhook-verify.js +0 -93
- package/dist/_contracts/wire-observer.d.ts +0 -49
- package/dist/_contracts/wire-observer.js +0 -34
- package/dist/_contracts/workflow-status.d.ts +0 -7
- package/dist/_contracts/workflow-status.js +0 -43
- package/dist/_contracts/workspace-resources.d.ts +0 -98
- package/dist/_contracts/workspace-resources.js +0 -39
- package/dist/archive-limits.d.ts +0 -1
- package/dist/archive-limits.js +0 -2
- package/dist/archive-limits.js.map +0 -1
- package/dist/asset-upload.d.ts +0 -47
- package/dist/asset-upload.js +0 -269
- package/dist/asset-upload.js.map +0 -1
- package/dist/bundle.d.ts +0 -9
- package/dist/bundle.js +0 -20
- package/dist/bundle.js.map +0 -1
- package/dist/canonical-zip.d.ts +0 -68
- package/dist/canonical-zip.js +0 -355
- package/dist/canonical-zip.js.map +0 -1
- package/dist/cli.mjs +0 -12048
- package/dist/cli.mjs.sha256 +0 -1
- package/dist/client-types.d.ts +0 -192
- package/dist/client-types.js +0 -2
- package/dist/client-types.js.map +0 -1
- package/dist/client.d.ts +0 -464
- package/dist/client.js +0 -1207
- package/dist/client.js.map +0 -1
- package/dist/event-projection.d.ts +0 -22
- package/dist/event-projection.js +0 -380
- package/dist/event-projection.js.map +0 -1
- package/dist/fetch-archive.d.ts +0 -16
- package/dist/fetch-archive.js +0 -252
- package/dist/fetch-archive.js.map +0 -1
- package/dist/file.d.ts +0 -96
- package/dist/file.js +0 -272
- package/dist/file.js.map +0 -1
- package/dist/instructions.d.ts +0 -20
- package/dist/instructions.js +0 -40
- package/dist/instructions.js.map +0 -1
- package/dist/legacy-session-provider-fault.d.ts +0 -7
- package/dist/legacy-session-provider-fault.js +0 -38
- package/dist/legacy-session-provider-fault.js.map +0 -1
- package/dist/mcp-server.d.ts +0 -84
- package/dist/mcp-server.js +0 -117
- package/dist/mcp-server.js.map +0 -1
- package/dist/node-fs.d.ts +0 -29
- package/dist/node-fs.js +0 -19
- package/dist/node-fs.js.map +0 -1
- package/dist/node-walk.d.ts +0 -69
- package/dist/node-walk.js +0 -151
- package/dist/node-walk.js.map +0 -1
- package/dist/path-basename.d.ts +0 -5
- package/dist/path-basename.js +0 -9
- package/dist/path-basename.js.map +0 -1
- package/dist/retry.d.ts +0 -70
- package/dist/retry.js +0 -155
- package/dist/retry.js.map +0 -1
- package/dist/secret.d.ts +0 -65
- package/dist/secret.js +0 -110
- package/dist/secret.js.map +0 -1
- package/dist/session-validate.d.ts +0 -100
- package/dist/session-validate.js +0 -303
- package/dist/session-validate.js.map +0 -1
- package/dist/skill.d.ts +0 -99
- package/dist/skill.js +0 -169
- package/dist/skill.js.map +0 -1
- package/dist/submission-wire.d.ts +0 -13
- package/dist/submission-wire.js +0 -69
- package/dist/submission-wire.js.map +0 -1
- package/dist/tool.d.ts +0 -41
- package/dist/tool.js +0 -76
- package/dist/tool.js.map +0 -1
- package/dist/version.d.ts +0 -9
- package/dist/version.js +0 -10
- package/dist/version.js.map +0 -1
- package/docs/authentication.md +0 -125
- package/docs/billing.md +0 -164
- package/docs/cleanup.md +0 -27
- package/docs/concepts/agent-tools.md +0 -47
- package/docs/concepts/composition.md +0 -60
- package/docs/concepts/providers-and-runtimes.md +0 -121
- package/docs/concepts/sessions.md +0 -51
- package/docs/concepts/subagents.md +0 -35
- package/docs/credentials.md +0 -116
- package/docs/defaults.md +0 -51
- package/docs/errors.md +0 -258
- package/docs/events.md +0 -143
- package/docs/files.md +0 -130
- package/docs/limits-and-quotas.md +0 -114
- package/docs/limits.md +0 -51
- package/docs/mcp.md +0 -47
- package/docs/networking.md +0 -114
- package/docs/provider-runtime-capabilities.md +0 -32
- package/docs/public-surface.json +0 -73
- package/docs/quickstart.md +0 -135
- package/docs/release.md +0 -44
- package/docs/retries.md +0 -108
- package/docs/secrets.md +0 -141
- package/docs/session-config.md +0 -51
- package/docs/session-record.md +0 -58
- package/docs/skills.md +0 -65
- package/docs/telemetry.md +0 -66
- package/docs/testing.md +0 -35
- package/docs/vision-skills.md +0 -94
- package/docs/webhooks.md +0 -143
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Response schemas for the `sessions.*` family.
|
|
3
|
-
*
|
|
4
|
-
* **These describe the WIRE, not the client types.** `Session` in
|
|
5
|
-
* `runtime-types.ts` is a POST-NORMALISATION shape: `operations.ts` folds the
|
|
6
|
-
* flat `runtimeKind` / `runtimeSize` the server sends into a grouped
|
|
7
|
-
* `runtime: { kind, size }` before a caller sees it. The C4 harness observes the
|
|
8
|
-
* bytes BEFORE that fold (`HttpClient` reports from inside `request()`), so a
|
|
9
|
-
* schema built from `Session` verbatim would reject every real response. The
|
|
10
|
-
* shapes here are the server's, and every place they and the declared type
|
|
11
|
-
* disagree is called out at the field.
|
|
12
|
-
*/
|
|
13
|
-
import * as z from "zod/mini";
|
|
14
|
-
import { SESSION_LIFECYCLE_STATUSES, SESSION_TERMINAL_OUTCOMES } from "../status.js";
|
|
15
|
-
import { SESSION_RUN_PHASES } from "../runtime-types.js";
|
|
16
|
-
import { PROVIDER_FAULT_KINDS } from "../provider-fault.js";
|
|
17
|
-
import { AEX_EVENT_CHANNELS, AEX_LOG_LEVELS } from "../event-envelope.js";
|
|
18
|
-
import { RUNTIME_KINDS } from "./runtime-kind.js";
|
|
19
|
-
import { RUNTIME_SIZES } from "./runtime-sizes.js";
|
|
20
|
-
import { describeResponse, responseObject, wireBoolean, wireEnum, wireInteger, wireLiteral, wireNonEmptyString, wireNonNegativeInteger, wireNonNegativeNumber, wireNumber, wirePositiveInteger, wireString, wireTimestamp } from "./response-common.js";
|
|
21
|
-
const optional = z.optional;
|
|
22
|
-
/** An open JSON payload: an object whose members this contract does not fix. */
|
|
23
|
-
const openObject = z.record(wireString, z.unknown());
|
|
24
|
-
// ===========================================================================
|
|
25
|
-
// Building blocks
|
|
26
|
-
// ===========================================================================
|
|
27
|
-
/** Public identity of one immutable session-files checkpoint. */
|
|
28
|
-
export const CheckpointRevisionSchema = describeResponse("CheckpointRevision", "Identity of one complete, immutable session-files checkpoint.", responseObject({
|
|
29
|
-
checkpointId: wireNonEmptyString,
|
|
30
|
-
runId: wireNonEmptyString,
|
|
31
|
-
turnSeq: wirePositiveInteger,
|
|
32
|
-
committedAt: wireTimestamp,
|
|
33
|
-
throughSeq: wireNonNegativeInteger
|
|
34
|
-
}));
|
|
35
|
-
/**
|
|
36
|
-
* Redaction-safe provider detail for the most recent failed run.
|
|
37
|
-
*
|
|
38
|
-
* `kind` is deliberately an open token rather than the closed
|
|
39
|
-
* {@link PROVIDER_FAULT_KINDS} set: `parseProviderFault` accepts a syntactically
|
|
40
|
-
* valid future kind on purpose (forward compatibility), so the schema must too
|
|
41
|
-
* or C4 would fail on the very case the parser was written to survive.
|
|
42
|
-
*/
|
|
43
|
-
export const ProviderFaultSchema = describeResponse("ProviderFault", `Terminal upstream-provider fault. Known kinds: ${PROVIDER_FAULT_KINDS.join(", ")}; ` +
|
|
44
|
-
"an unknown but syntactically valid token is accepted for forward compatibility.", responseObject({
|
|
45
|
-
kind: wireNonEmptyString,
|
|
46
|
-
provider: optional(wireNonEmptyString),
|
|
47
|
-
status: optional(wireInteger),
|
|
48
|
-
retryAfterMs: optional(wireNonNegativeInteger),
|
|
49
|
-
message: optional(wireNonEmptyString)
|
|
50
|
-
}));
|
|
51
|
-
const CostBasisSchema = responseObject({
|
|
52
|
-
currency: wireLiteral("USD"),
|
|
53
|
-
status: wireEnum(["estimated", "reconciled"])
|
|
54
|
-
});
|
|
55
|
-
const ProviderUsageSchema = responseObject({
|
|
56
|
-
// Optional because the BUILDER makes it optional: `providerUsageFromManifestUsage`
|
|
57
|
-
// spreads `...(provider ? { provider } : {})`, so an entry with no provider is
|
|
58
|
-
// constructible and reaches the wire. Requiring it here would fail C4 on a real
|
|
59
|
-
// response — the schema describes what the server sends, not what we wish it sent.
|
|
60
|
-
provider: optional(wireNonEmptyString),
|
|
61
|
-
model: optional(wireString),
|
|
62
|
-
inputTokens: optional(wireNonNegativeNumber),
|
|
63
|
-
outputTokens: optional(wireNonNegativeNumber),
|
|
64
|
-
cacheReadInputTokens: optional(wireNonNegativeNumber),
|
|
65
|
-
cacheCreationInputTokens: optional(wireNonNegativeNumber),
|
|
66
|
-
totalTokens: optional(wireNonNegativeNumber),
|
|
67
|
-
sourceEventId: optional(wireString),
|
|
68
|
-
sourceSampleIds: optional(z.array(wireString))
|
|
69
|
-
});
|
|
70
|
-
/**
|
|
71
|
-
* Cost/usage telemetry attached to a settled session.
|
|
72
|
-
*
|
|
73
|
-
* The KEY SET is the union of two disagreeing statements: `SessionCostTelemetry`
|
|
74
|
-
* in `session-cost.ts` (our declared type) and the object `settle.ts` actually
|
|
75
|
-
* writes. The declared type does not carry `basis`, `durationMs`, `turnSeq`,
|
|
76
|
-
* `runtimeSize`, `runtimeKind`, `model`, `usage`, `byteCounts`, `childCostUsd`,
|
|
77
|
-
* `childSessionCount` or `childProviderUsage`; settle writes all of them. Both
|
|
78
|
-
* are declared here so the strict check is true against reality, and the
|
|
79
|
-
* divergence is reported rather than papered over.
|
|
80
|
-
*
|
|
81
|
-
* `usage` and `byteCounts` are the one place this family stops at "is an
|
|
82
|
-
* object": their members are assembled from provider manifests and were not
|
|
83
|
-
* verified against a real response, and asserting a shape we have not seen would
|
|
84
|
-
* be worse than saying so.
|
|
85
|
-
*/
|
|
86
|
-
export const CostTelemetrySchema = describeResponse("CostTelemetry", "Showback cost and usage telemetry for a settled session or turn.", responseObject({
|
|
87
|
-
schemaVersion: wireLiteral(1),
|
|
88
|
-
sessionId: optional(wireString),
|
|
89
|
-
provider: optional(wireString),
|
|
90
|
-
model: optional(wireString),
|
|
91
|
-
recordedAt: optional(wireString),
|
|
92
|
-
status: optional(wireEnum(["pending", "partial", "complete", "unavailable", "not_applicable"])),
|
|
93
|
-
basis: optional(wireString),
|
|
94
|
-
durationMs: optional(wireNonNegativeNumber),
|
|
95
|
-
turnSeq: optional(wireNonNegativeInteger),
|
|
96
|
-
// Written by `telemetryFromManifest` whenever the runner manifest carries
|
|
97
|
-
// one, and served on the CHILD session read via `finalizeChildSession`.
|
|
98
|
-
// Undeclared here until now, which would have failed C4 on the first child
|
|
99
|
-
// session settled from such a manifest — a strict schema is only as good as
|
|
100
|
-
// its agreement with what the server actually writes.
|
|
101
|
-
throughSeq: optional(wireNonNegativeInteger),
|
|
102
|
-
runtimeSize: optional(wireString),
|
|
103
|
-
runtimeKind: optional(wireString),
|
|
104
|
-
billedCostUsd: optional(wireNonNegativeNumber),
|
|
105
|
-
costBasis: optional(CostBasisSchema),
|
|
106
|
-
usage: optional(openObject),
|
|
107
|
-
byteCounts: optional(openObject),
|
|
108
|
-
providerUsage: optional(z.array(ProviderUsageSchema)),
|
|
109
|
-
childProviderUsage: optional(z.array(ProviderUsageSchema)),
|
|
110
|
-
childCostUsd: optional(wireNonNegativeNumber),
|
|
111
|
-
childSessionCount: optional(wireNonNegativeInteger),
|
|
112
|
-
sourceSummary: optional(responseObject({
|
|
113
|
-
sampleCount: wireNonNegativeNumber,
|
|
114
|
-
metrics: optional(z.array(wireString)),
|
|
115
|
-
sourceTypes: optional(z.array(wireString)),
|
|
116
|
-
sourceSampleIds: optional(z.array(wireString))
|
|
117
|
-
})),
|
|
118
|
-
durations: optional(responseObject({
|
|
119
|
-
queuedMs: optional(wireNonNegativeNumber),
|
|
120
|
-
runtimeMs: optional(wireNonNegativeNumber),
|
|
121
|
-
fileCaptureMs: optional(wireNonNegativeNumber),
|
|
122
|
-
cleanupMs: optional(wireNonNegativeNumber),
|
|
123
|
-
totalMs: optional(wireNonNegativeNumber)
|
|
124
|
-
})),
|
|
125
|
-
files: optional(responseObject({
|
|
126
|
-
discoveredFiles: optional(wireNonNegativeNumber),
|
|
127
|
-
capturedFiles: optional(wireNonNegativeNumber),
|
|
128
|
-
failedFiles: optional(wireNonNegativeNumber),
|
|
129
|
-
capturedBytes: optional(wireNonNegativeNumber)
|
|
130
|
-
})),
|
|
131
|
-
retries: optional(responseObject({
|
|
132
|
-
runtimeAttempts: optional(wireNonNegativeNumber),
|
|
133
|
-
providerPollRetries: optional(wireNonNegativeNumber),
|
|
134
|
-
fileCaptureRetries: optional(wireNonNegativeNumber),
|
|
135
|
-
fileUploadRetries: optional(wireNonNegativeNumber)
|
|
136
|
-
})),
|
|
137
|
-
capture: optional(responseObject({
|
|
138
|
-
attempted: wireBoolean,
|
|
139
|
-
uploadedFiles: optional(wireNonNegativeNumber),
|
|
140
|
-
failedFiles: optional(wireNonNegativeNumber),
|
|
141
|
-
totalBytes: optional(wireNonNegativeNumber),
|
|
142
|
-
failureReasons: optional(z.array(wireString))
|
|
143
|
-
})),
|
|
144
|
-
storage: optional(responseObject({
|
|
145
|
-
storedBytes: optional(wireNonNegativeNumber),
|
|
146
|
-
storedFiles: optional(wireNonNegativeNumber),
|
|
147
|
-
byteMilliseconds: optional(wireNonNegativeNumber)
|
|
148
|
-
})),
|
|
149
|
-
proxy: optional(responseObject({
|
|
150
|
-
calls: optional(wireNonNegativeNumber),
|
|
151
|
-
failedCalls: optional(wireNonNegativeNumber),
|
|
152
|
-
requestBytes: optional(wireNonNegativeNumber),
|
|
153
|
-
responseBytes: optional(wireNonNegativeNumber),
|
|
154
|
-
durationMs: optional(wireNonNegativeNumber)
|
|
155
|
-
}))
|
|
156
|
-
}));
|
|
157
|
-
/**
|
|
158
|
-
* One run of a session.
|
|
159
|
-
*
|
|
160
|
-
* `eventCursor` rides only on the run returned by `sendMessage`; the
|
|
161
|
-
* `currentRun` / `lastRun` projections never carry it. One schema covers both
|
|
162
|
-
* because the field is optional in the declared type and a stricter split would
|
|
163
|
-
* assert an absence the server has no obligation to keep.
|
|
164
|
-
*/
|
|
165
|
-
export const SessionRunSchema = describeResponse("SessionRun", "One run (turn) of a session. `phase` is the live position; `outcome` is the terminal verdict.", responseObject({
|
|
166
|
-
sessionId: wireNonEmptyString,
|
|
167
|
-
turnSeq: wirePositiveInteger,
|
|
168
|
-
runId: wireNonEmptyString,
|
|
169
|
-
phase: wireEnum(SESSION_RUN_PHASES),
|
|
170
|
-
outcome: optional(wireEnum(SESSION_TERMINAL_OUTCOMES)),
|
|
171
|
-
startedAt: optional(wireString),
|
|
172
|
-
finishedAt: optional(wireString),
|
|
173
|
-
checkpoint: optional(CheckpointRevisionSchema),
|
|
174
|
-
eventCursor: optional(wireNonNegativeInteger)
|
|
175
|
-
}));
|
|
176
|
-
/**
|
|
177
|
-
* The session projection every `{ session }` envelope carries.
|
|
178
|
-
*
|
|
179
|
-
* This schema is the SOURCE of the `SessionWire` type in `runtime-types.ts`
|
|
180
|
-
* (`z.infer`), and `Session` — the client shape — is pinned to it by a key-set
|
|
181
|
-
* assertion in that module. The one deliberate difference between them:
|
|
182
|
-
*
|
|
183
|
-
* - **`runtime` is absent here.** The wire carries flat `runtimeKind` +
|
|
184
|
-
* `runtimeSize`; `runtime: { kind, size }` is built client-side by
|
|
185
|
-
* `normalizeSessionRuntime`.
|
|
186
|
-
*
|
|
187
|
-
* `usage` and `runtimeManifest` USED to be declared on both sides and are
|
|
188
|
-
* emitted by neither `publicSessionFromItem` nor anything downstream of it.
|
|
189
|
-
* They were kept "because our own published type declares them"; the type no
|
|
190
|
-
* longer does (token counts live under `costTelemetry.providerUsage`), so the
|
|
191
|
-
* justification went with it and both are gone from here too.
|
|
192
|
-
*/
|
|
193
|
-
export const SessionWireSchema = describeResponse("Session", "A session as the data plane serves it — flat `runtimeKind`/`runtimeSize`, " +
|
|
194
|
-
"before the SDK folds them into the grouped `runtime` client shape.", responseObject({
|
|
195
|
-
id: wireNonEmptyString,
|
|
196
|
-
status: wireEnum(SESSION_LIFECYCLE_STATUSES),
|
|
197
|
-
acceptsMessages: wireBoolean,
|
|
198
|
-
currentRun: optional(SessionRunSchema),
|
|
199
|
-
lastRun: optional(SessionRunSchema),
|
|
200
|
-
providerFault: optional(ProviderFaultSchema),
|
|
201
|
-
idleTtl: optional(wireString),
|
|
202
|
-
idleTtlMs: optional(wireNonNegativeNumber),
|
|
203
|
-
runtimeSize: wireEnum(RUNTIME_SIZES),
|
|
204
|
-
runtimeKind: wireEnum(RUNTIME_KINDS),
|
|
205
|
-
workspaceId: optional(wireNonEmptyString),
|
|
206
|
-
createdAt: optional(wireTimestamp),
|
|
207
|
-
updatedAt: optional(wireTimestamp),
|
|
208
|
-
idleAt: optional(z.nullable(wireString)),
|
|
209
|
-
suspendedAt: optional(z.nullable(wireString)),
|
|
210
|
-
activeDurationMs: optional(wireNonNegativeNumber),
|
|
211
|
-
provider: optional(wireString),
|
|
212
|
-
model: optional(wireString),
|
|
213
|
-
retainedStorageBytes: optional(wireNonNegativeNumber),
|
|
214
|
-
costUsd: optional(wireNonNegativeNumber),
|
|
215
|
-
costTelemetry: optional(CostTelemetrySchema),
|
|
216
|
-
errorMessage: optional(z.nullable(wireString)),
|
|
217
|
-
failureClass: optional(z.nullable(wireString)),
|
|
218
|
-
dataState: wireEnum(["active", "metadata_only"]),
|
|
219
|
-
contentPurgedAt: optional(wireString),
|
|
220
|
-
contentDeletedBy: optional(wireEnum(["retention", "user"]))
|
|
221
|
-
}));
|
|
222
|
-
/** One captured session file, as `publicFileFromObject` projects it. */
|
|
223
|
-
export const SessionFileSchema = describeResponse("SessionFile", "One file pinned to a committed checkpoint. `filename` is the workspace-relative path.", responseObject({
|
|
224
|
-
id: wireNonEmptyString,
|
|
225
|
-
checkpointId: wireNonEmptyString,
|
|
226
|
-
filename: wireString,
|
|
227
|
-
sizeBytes: wireNonNegativeInteger,
|
|
228
|
-
contentType: wireString,
|
|
229
|
-
createdAt: wireString,
|
|
230
|
-
sha256: wireString
|
|
231
|
-
}));
|
|
232
|
-
// ===========================================================================
|
|
233
|
-
// Route responses
|
|
234
|
-
// ===========================================================================
|
|
235
|
-
/**
|
|
236
|
-
* `POST /sessions`, `GET /sessions/{id}`, and every state-change route.
|
|
237
|
-
*
|
|
238
|
-
* ONE key. `run` and `eventCursor` were declared optional here because
|
|
239
|
-
* `SessionStateChangeAccepted` declared them; no handler on any of these eight
|
|
240
|
-
* routes emits either — each answers `json(200, { session })` — and the client
|
|
241
|
-
* type no longer claims otherwise. The run-bearing envelope is
|
|
242
|
-
* {@link SessionMessageAcceptedResponseSchema}, a different route.
|
|
243
|
-
*/
|
|
244
|
-
export const SessionEnvelopeResponseSchema = describeResponse("SessionEnvelopeResponse", "A single session, and nothing else.", responseObject({ session: SessionWireSchema }));
|
|
245
|
-
export const SessionListResponseSchema = describeResponse("SessionListResponse", "One page of sessions, newest first. `nextCursor` is omitted on the last page.", responseObject({
|
|
246
|
-
sessions: z.array(SessionWireSchema),
|
|
247
|
-
nextCursor: optional(wireNonEmptyString)
|
|
248
|
-
}));
|
|
249
|
-
export const SessionMessageAcceptedResponseSchema = describeResponse("SessionMessageAcceptedResponse", "HTTP 202 for an accepted turn. `eventCursor` is unconditional on a fresh " +
|
|
250
|
-
"accept and conditional on an idempotent replay.", responseObject({
|
|
251
|
-
session: SessionWireSchema,
|
|
252
|
-
run: SessionRunSchema,
|
|
253
|
-
eventCursor: optional(wireNonNegativeInteger)
|
|
254
|
-
}));
|
|
255
|
-
/**
|
|
256
|
-
* `DELETE /sessions/{id}` — a 200 with a body, not a 204.
|
|
257
|
-
*
|
|
258
|
-
* `purgedSessionFileObjects` and `cleanupComplete` are on the wire.
|
|
259
|
-
* `deleteSession()` used to declare it returned `SessionStateChangeAccepted |
|
|
260
|
-
* void`, which carries neither and made the body look optional; it now returns
|
|
261
|
-
* `SessionDeleteAccepted`, pinned to this schema by a key-set assertion.
|
|
262
|
-
*/
|
|
263
|
-
export const SessionDeleteResponseSchema = describeResponse("SessionDeleteResponse", "The deleted session plus the footprint-cleanup counters.", responseObject({
|
|
264
|
-
session: SessionWireSchema,
|
|
265
|
-
purgedSessionFileObjects: wireNonNegativeInteger,
|
|
266
|
-
cleanupComplete: wireBoolean
|
|
267
|
-
}));
|
|
268
|
-
export const SessionMessagesPageResponseSchema = describeResponse("SessionMessagesPageResponse", "One page of the projected transcript.", responseObject({
|
|
269
|
-
messages: z.array(responseObject({
|
|
270
|
-
id: wireNonEmptyString,
|
|
271
|
-
sender: wireEnum(["user", "assistant"]),
|
|
272
|
-
text: wireString,
|
|
273
|
-
timestamp: wireString,
|
|
274
|
-
sequence: wireNonNegativeInteger,
|
|
275
|
-
content: z.array(z.unknown()),
|
|
276
|
-
turnSeq: optional(wireNonNegativeInteger),
|
|
277
|
-
messageId: optional(wireString)
|
|
278
|
-
})),
|
|
279
|
-
nextCursor: optional(wireNonEmptyString)
|
|
280
|
-
}));
|
|
281
|
-
/**
|
|
282
|
-
* One durable event.
|
|
283
|
-
*
|
|
284
|
-
* `type` and `source` are open vocabularies by declaration — `AexEventType` is
|
|
285
|
-
* `(typeof AEX_EVENT_TYPES)[number] | string` — so pinning them here would be
|
|
286
|
-
* stricter than the type it mirrors.
|
|
287
|
-
*/
|
|
288
|
-
export const AexEventSchema = describeResponse("AexEvent", "A durable, replayable session event in the CloudEvents-shaped aex envelope.", responseObject({
|
|
289
|
-
specversion: wireLiteral("1.0"),
|
|
290
|
-
id: wireNonEmptyString,
|
|
291
|
-
source: wireNonEmptyString,
|
|
292
|
-
type: wireNonEmptyString,
|
|
293
|
-
subject: wireNonEmptyString,
|
|
294
|
-
threadId: wireNonEmptyString,
|
|
295
|
-
runId: wireNonEmptyString,
|
|
296
|
-
time: wireString,
|
|
297
|
-
sequence: wireNonNegativeInteger,
|
|
298
|
-
data: openObject,
|
|
299
|
-
traceId: optional(wireString),
|
|
300
|
-
spanId: optional(wireString),
|
|
301
|
-
parentSpanId: optional(wireString),
|
|
302
|
-
channel: optional(wireEnum(AEX_EVENT_CHANNELS)),
|
|
303
|
-
sourceSeq: optional(wireNonNegativeInteger),
|
|
304
|
-
emittedAt: optional(wireNumber),
|
|
305
|
-
receivedAt: optional(wireNumber),
|
|
306
|
-
level: optional(wireEnum(AEX_LOG_LEVELS)),
|
|
307
|
-
message: optional(wireString),
|
|
308
|
-
dedup: optional(responseObject({ source: wireString, sourceSeq: wireNumber })),
|
|
309
|
-
ephemeral: optional(wireBoolean),
|
|
310
|
-
replayable: optional(wireBoolean)
|
|
311
|
-
}));
|
|
312
|
-
export const SessionEventsPageResponseSchema = describeResponse("SessionEventsPageResponse", "One page of durable session events.", responseObject({
|
|
313
|
-
events: z.array(AexEventSchema),
|
|
314
|
-
nextCursor: optional(wireNonEmptyString)
|
|
315
|
-
}));
|
|
316
|
-
/**
|
|
317
|
-
* `POST /sessions/{id}/events/ticket`.
|
|
318
|
-
*
|
|
319
|
-
* `ok` and `region` are on the wire. The declared `CoordinatorTicket` interface
|
|
320
|
-
* in `operations.ts` used to stop at `wsUrl` / `ticket` / `expiresAtMs`, hiding
|
|
321
|
-
* the region the grant is only valid against; it now carries all five.
|
|
322
|
-
*/
|
|
323
|
-
export const CoordinatorTicketResponseSchema = describeResponse("CoordinatorTicketResponse", "A short-lived grant for the coordinator WebSocket upgrade.", responseObject({
|
|
324
|
-
ok: wireLiteral(true),
|
|
325
|
-
wsUrl: wireNonEmptyString,
|
|
326
|
-
ticket: wireNonEmptyString,
|
|
327
|
-
expiresAtMs: wireNonNegativeInteger,
|
|
328
|
-
region: wireNonEmptyString
|
|
329
|
-
}));
|
|
330
|
-
export const SessionChildrenResponseSchema = describeResponse("SessionChildrenResponse", "A session's subagent child sessions. `createdAt`/`updatedAt` are empty strings " +
|
|
331
|
-
"when the record carries none, so they are NOT validated as timestamps.", responseObject({
|
|
332
|
-
children: z.array(responseObject({
|
|
333
|
-
id: wireNonEmptyString,
|
|
334
|
-
parentSessionId: wireNonEmptyString,
|
|
335
|
-
status: wireEnum(SESSION_LIFECYCLE_STATUSES),
|
|
336
|
-
createdAt: wireString,
|
|
337
|
-
updatedAt: wireString,
|
|
338
|
-
depth: optional(wireNonNegativeInteger),
|
|
339
|
-
costUsd: optional(wireNonNegativeNumber),
|
|
340
|
-
terminalAt: optional(z.nullable(wireString)),
|
|
341
|
-
lastRun: optional(SessionRunSchema)
|
|
342
|
-
}))
|
|
343
|
-
}));
|
|
344
|
-
export const SessionFilesResponseSchema = describeResponse("SessionFilesResponse", "The complete file listing for one immutable checkpoint.", responseObject({
|
|
345
|
-
revision: CheckpointRevisionSchema,
|
|
346
|
-
files: z.array(SessionFileSchema)
|
|
347
|
-
}));
|
|
348
|
-
/**
|
|
349
|
-
* `POST /sessions/{id}/files/{fileId}/link`.
|
|
350
|
-
*
|
|
351
|
-
* The declared `SessionFileLink` also carries `expiresAt`; the server does not
|
|
352
|
-
* send one — `sessionFileLink()` synthesises it client-side from the mint time.
|
|
353
|
-
*/
|
|
354
|
-
export const SessionFileLinkResponseSchema = describeResponse("SessionFileLinkResponse", "A presigned direct-download URL for one checkpointed file.", responseObject({
|
|
355
|
-
url: wireNonEmptyString,
|
|
356
|
-
expiresInSeconds: wirePositiveInteger,
|
|
357
|
-
file: SessionFileSchema
|
|
358
|
-
}));
|
|
359
|
-
export const EventArchiveLinkResponseSchema = describeResponse("EventArchiveLinkResponse", "A presigned URL for the generated event archive. No `file`, unlike the file link.", responseObject({
|
|
360
|
-
url: wireNonEmptyString,
|
|
361
|
-
expiresInSeconds: wirePositiveInteger
|
|
362
|
-
}));
|
|
363
|
-
/** One run-terminal webhook delivery row, session-scoped view. */
|
|
364
|
-
export const SessionWebhookDeliverySchema = describeResponse("SessionWebhookDelivery", "One run-scoped webhook delivery attempt ledger row.", responseObject({
|
|
365
|
-
id: wireNonEmptyString,
|
|
366
|
-
runId: wireNonEmptyString,
|
|
367
|
-
turnSeq: wirePositiveInteger,
|
|
368
|
-
eventType: wireEnum(["run.finished", "run.error"]),
|
|
369
|
-
status: wireEnum(["pending", "delivering", "retrying", "delivered", "exhausted", "invalid"]),
|
|
370
|
-
attemptCount: wireNonNegativeInteger,
|
|
371
|
-
createdAt: wireString,
|
|
372
|
-
lastStatusCode: optional(wireInteger),
|
|
373
|
-
lastError: optional(wireString)
|
|
374
|
-
}));
|
|
375
|
-
export const SessionWebhookDeliveriesResponseSchema = describeResponse("SessionWebhookDeliveriesResponse", "Every run-terminal webhook delivery for one session.", responseObject({ deliveries: z.array(SessionWebhookDeliverySchema) }));
|
|
376
|
-
/** `POST .../redeliver` — HTTP 202 `{ ok: true }`. */
|
|
377
|
-
export const AcknowledgedResponseSchema = describeResponse("AcknowledgedResponse", "A bare acknowledgement. The only key is `ok`.", responseObject({ ok: wireLiteral(true) }));
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Response schemas for the workspace-scoped `webhook.*` routes.
|
|
3
|
-
*
|
|
4
|
-
* The session-scoped delivery ledger lives in `response-sessions.ts`; this
|
|
5
|
-
* module covers the two routes that are workspace-scoped rather than
|
|
6
|
-
* session-scoped. They are not the same shape: the workspace view appends
|
|
7
|
-
* `sessionId` and `callbackUrl` to each row, which the declared
|
|
8
|
-
* `SessionWebhookDelivery` interface does not carry. The workspace view had no
|
|
9
|
-
* declared client type at all; `WorkspaceWebhookDelivery` in `runtime-types.ts`
|
|
10
|
-
* is now `z.infer`red from the schema below.
|
|
11
|
-
*/
|
|
12
|
-
import * as z from "zod/mini";
|
|
13
|
-
import { SessionWebhookDeliverySchema } from "./response-sessions.js";
|
|
14
|
-
/**
|
|
15
|
-
* `POST /webhook/signing-secret`.
|
|
16
|
-
*
|
|
17
|
-
* One key. The reveal creates the secret on first use and never rotates it, so
|
|
18
|
-
* a second call returns the same value — which is why a strict object matters
|
|
19
|
-
* here: an extra `rotatedAt` or `previous` key would be a semantic change
|
|
20
|
-
* arriving silently.
|
|
21
|
-
*/
|
|
22
|
-
export declare const WebhookSigningSecretResponseSchema: z.ZodMiniObject<{
|
|
23
|
-
whsec: z.ZodMiniString<string>;
|
|
24
|
-
}, z.core.$strict>;
|
|
25
|
-
/** One delivery row in the WORKSPACE view: the session row plus its addressing. */
|
|
26
|
-
export declare const WorkspaceWebhookDeliverySchema: z.ZodMiniObject<{
|
|
27
|
-
id: z.ZodMiniString<string>;
|
|
28
|
-
runId: z.ZodMiniString<string>;
|
|
29
|
-
turnSeq: z.ZodMiniNumberFormat;
|
|
30
|
-
eventType: z.ZodMiniEnum<{
|
|
31
|
-
"run.finished": "run.finished";
|
|
32
|
-
"run.error": "run.error";
|
|
33
|
-
}>;
|
|
34
|
-
status: z.ZodMiniEnum<{
|
|
35
|
-
pending: "pending";
|
|
36
|
-
delivering: "delivering";
|
|
37
|
-
retrying: "retrying";
|
|
38
|
-
delivered: "delivered";
|
|
39
|
-
exhausted: "exhausted";
|
|
40
|
-
invalid: "invalid";
|
|
41
|
-
}>;
|
|
42
|
-
attemptCount: z.ZodMiniNumberFormat;
|
|
43
|
-
createdAt: z.ZodMiniString<string>;
|
|
44
|
-
lastStatusCode: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
|
|
45
|
-
lastError: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
46
|
-
sessionId: z.ZodMiniString<string>;
|
|
47
|
-
callbackUrl: z.ZodMiniString<string>;
|
|
48
|
-
}, z.core.$strict>;
|
|
49
|
-
export declare const WorkspaceWebhookDeliveriesResponseSchema: z.ZodMiniObject<{
|
|
50
|
-
deliveries: z.ZodMiniArray<z.ZodMiniObject<{
|
|
51
|
-
id: z.ZodMiniString<string>;
|
|
52
|
-
runId: z.ZodMiniString<string>;
|
|
53
|
-
turnSeq: z.ZodMiniNumberFormat;
|
|
54
|
-
eventType: z.ZodMiniEnum<{
|
|
55
|
-
"run.finished": "run.finished";
|
|
56
|
-
"run.error": "run.error";
|
|
57
|
-
}>;
|
|
58
|
-
status: z.ZodMiniEnum<{
|
|
59
|
-
pending: "pending";
|
|
60
|
-
delivering: "delivering";
|
|
61
|
-
retrying: "retrying";
|
|
62
|
-
delivered: "delivered";
|
|
63
|
-
exhausted: "exhausted";
|
|
64
|
-
invalid: "invalid";
|
|
65
|
-
}>;
|
|
66
|
-
attemptCount: z.ZodMiniNumberFormat;
|
|
67
|
-
createdAt: z.ZodMiniString<string>;
|
|
68
|
-
lastStatusCode: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
|
|
69
|
-
lastError: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
70
|
-
sessionId: z.ZodMiniString<string>;
|
|
71
|
-
callbackUrl: z.ZodMiniString<string>;
|
|
72
|
-
}, z.core.$strict>>;
|
|
73
|
-
}, z.core.$strict>;
|
|
74
|
-
export type WorkspaceWebhookDelivery = z.infer<typeof WorkspaceWebhookDeliverySchema>;
|
|
75
|
-
/** Re-exported so a reader comparing the two views has both names in one place. */
|
|
76
|
-
export { SessionWebhookDeliverySchema };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Response schemas for the workspace-scoped `webhook.*` routes.
|
|
3
|
-
*
|
|
4
|
-
* The session-scoped delivery ledger lives in `response-sessions.ts`; this
|
|
5
|
-
* module covers the two routes that are workspace-scoped rather than
|
|
6
|
-
* session-scoped. They are not the same shape: the workspace view appends
|
|
7
|
-
* `sessionId` and `callbackUrl` to each row, which the declared
|
|
8
|
-
* `SessionWebhookDelivery` interface does not carry. The workspace view had no
|
|
9
|
-
* declared client type at all; `WorkspaceWebhookDelivery` in `runtime-types.ts`
|
|
10
|
-
* is now `z.infer`red from the schema below.
|
|
11
|
-
*/
|
|
12
|
-
import * as z from "zod/mini";
|
|
13
|
-
import { SessionWebhookDeliverySchema } from "./response-sessions.js";
|
|
14
|
-
import { describeResponse, responseObject, wireEnum, wireInteger, wireNonEmptyString, wireNonNegativeInteger, wirePositiveInteger, wireString } from "./response-common.js";
|
|
15
|
-
const optional = z.optional;
|
|
16
|
-
/**
|
|
17
|
-
* `POST /webhook/signing-secret`.
|
|
18
|
-
*
|
|
19
|
-
* One key. The reveal creates the secret on first use and never rotates it, so
|
|
20
|
-
* a second call returns the same value — which is why a strict object matters
|
|
21
|
-
* here: an extra `rotatedAt` or `previous` key would be a semantic change
|
|
22
|
-
* arriving silently.
|
|
23
|
-
*/
|
|
24
|
-
export const WebhookSigningSecretResponseSchema = describeResponse("WebhookSigningSecretResponse", "The workspace webhook signing secret (`whsec_<base64>`), revealed not rotated.", responseObject({ whsec: wireNonEmptyString }));
|
|
25
|
-
/** One delivery row in the WORKSPACE view: the session row plus its addressing. */
|
|
26
|
-
export const WorkspaceWebhookDeliverySchema = describeResponse("WorkspaceWebhookDelivery", "One webhook delivery row with the session and callback it belongs to.", responseObject({
|
|
27
|
-
id: wireNonEmptyString,
|
|
28
|
-
runId: wireNonEmptyString,
|
|
29
|
-
turnSeq: wirePositiveInteger,
|
|
30
|
-
eventType: wireEnum(["run.finished", "run.error"]),
|
|
31
|
-
status: wireEnum(["pending", "delivering", "retrying", "delivered", "exhausted", "invalid"]),
|
|
32
|
-
attemptCount: wireNonNegativeInteger,
|
|
33
|
-
createdAt: wireString,
|
|
34
|
-
lastStatusCode: optional(wireInteger),
|
|
35
|
-
lastError: optional(wireString),
|
|
36
|
-
sessionId: wireNonEmptyString,
|
|
37
|
-
callbackUrl: wireNonEmptyString
|
|
38
|
-
}));
|
|
39
|
-
export const WorkspaceWebhookDeliveriesResponseSchema = describeResponse("WorkspaceWebhookDeliveriesResponse", "The workspace's 100 most recent webhook deliveries, newest first. " +
|
|
40
|
-
"Server-capped: no `limit`, no cursor.", responseObject({ deliveries: z.array(WorkspaceWebhookDeliverySchema) }));
|
|
41
|
-
/** Re-exported so a reader comparing the two views has both names in one place. */
|
|
42
|
-
export { SessionWebhookDeliverySchema };
|