primitive-admin 1.0.61 → 1.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -69
- package/assets/skill/skills/primitive-platform/SKILL.md +336 -37
- package/dist/bin/primitive.js +25 -14
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/analytics.js +36 -16
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps.js +49 -188
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +13 -153
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/collection-type-configs.js +14 -100
- package/dist/src/commands/collection-type-configs.js.map +1 -1
- package/dist/src/commands/collections.js +47 -8
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/config.d.ts +46 -0
- package/dist/src/commands/config.js +479 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/connections.js +12 -7
- package/dist/src/commands/connections.js.map +1 -1
- package/dist/src/commands/cron-triggers.js +84 -176
- package/dist/src/commands/cron-triggers.js.map +1 -1
- package/dist/src/commands/database-type-configs.d.ts +2 -0
- package/dist/src/commands/database-type-configs.js +171 -0
- package/dist/src/commands/database-type-configs.js.map +1 -0
- package/dist/src/commands/database-types.js +4 -4
- package/dist/src/commands/database-types.js.map +1 -1
- package/dist/src/commands/databases.d.ts +63 -0
- package/dist/src/commands/databases.js +649 -87
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.js +869 -12
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.js +18 -125
- package/dist/src/commands/email-templates.js.map +1 -1
- package/dist/src/commands/env.d.ts +12 -1
- package/dist/src/commands/env.js +98 -25
- package/dist/src/commands/env.js.map +1 -1
- package/dist/src/commands/feature-flags.d.ts +14 -0
- package/dist/src/commands/feature-flags.js +116 -0
- package/dist/src/commands/feature-flags.js.map +1 -0
- package/dist/src/commands/group-type-configs.js +14 -109
- package/dist/src/commands/group-type-configs.js.map +1 -1
- package/dist/src/commands/init.d.ts +9 -1
- package/dist/src/commands/init.js +1056 -277
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +136 -421
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.d.ts +12 -0
- package/dist/src/commands/metadata-category-configs.js +112 -0
- package/dist/src/commands/metadata-category-configs.js.map +1 -0
- package/dist/src/commands/metadata.js +33 -141
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/prompts.js +206 -563
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +1 -1
- package/dist/src/commands/rule-sets.js +16 -132
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/scripts.js +67 -234
- package/dist/src/commands/scripts.js.map +1 -1
- package/dist/src/commands/sessions.js +17 -5
- package/dist/src/commands/sessions.js.map +1 -1
- package/dist/src/commands/sync-app-settings.d.ts +113 -70
- package/dist/src/commands/sync-app-settings.js +193 -242
- package/dist/src/commands/sync-app-settings.js.map +1 -1
- package/dist/src/commands/sync.d.ts +1932 -49
- package/dist/src/commands/sync.js +9521 -1769
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.js +8 -2
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/users.js +92 -1
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.js +44 -58
- package/dist/src/commands/vars.js.map +1 -1
- package/dist/src/commands/webhooks.js +318 -156
- package/dist/src/commands/webhooks.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +49 -12
- package/dist/src/commands/workflows.js +652 -1086
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/access-rule-display.d.ts +21 -0
- package/dist/src/lib/access-rule-display.js +34 -0
- package/dist/src/lib/access-rule-display.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +541 -61
- package/dist/src/lib/api-client.js +559 -102
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +180 -25
- package/dist/src/lib/app-settings-descriptor.js +403 -82
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/canonical-json.d.ts +12 -0
- package/dist/src/lib/canonical-json.js +35 -0
- package/dist/src/lib/canonical-json.js.map +1 -0
- package/dist/src/lib/cli-manifest.d.ts +8 -0
- package/dist/src/lib/cli-manifest.js +1 -0
- package/dist/src/lib/cli-manifest.js.map +1 -1
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +6 -2
- package/dist/src/lib/codegen-shared/generatedFiles.js +9 -2
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +6 -6
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +8 -8
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -1
- package/dist/src/lib/config-object-descriptor.d.ts +127 -0
- package/dist/src/lib/config-object-descriptor.js +658 -0
- package/dist/src/lib/config-object-descriptor.js.map +1 -0
- package/dist/src/lib/config-payload.d.ts +85 -0
- package/dist/src/lib/config-payload.js +116 -0
- package/dist/src/lib/config-payload.js.map +1 -0
- package/dist/src/lib/config-surface.d.ts +130 -0
- package/dist/src/lib/config-surface.js +300 -0
- package/dist/src/lib/config-surface.js.map +1 -0
- package/dist/src/lib/credentials-store.d.ts +10 -0
- package/dist/src/lib/credentials-store.js +23 -0
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/data-input.d.ts +23 -0
- package/dist/src/lib/data-input.js +50 -0
- package/dist/src/lib/data-input.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTemplates.js +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +1 -1
- package/dist/src/lib/env-resolver-core.d.ts +147 -0
- package/dist/src/lib/env-resolver-core.js +265 -0
- package/dist/src/lib/env-resolver-core.js.map +1 -0
- package/dist/src/lib/env-resolver.d.ts +28 -6
- package/dist/src/lib/env-resolver.js +44 -32
- package/dist/src/lib/env-resolver.js.map +1 -1
- package/dist/src/lib/generated-allowlist.js +12 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +682 -0
- package/dist/src/lib/generated-config-surfaces.js +4058 -0
- package/dist/src/lib/generated-config-surfaces.js.map +1 -0
- package/dist/src/lib/generated-template-lint.d.ts +212 -0
- package/dist/src/lib/generated-template-lint.js +624 -0
- package/dist/src/lib/generated-template-lint.js.map +1 -0
- package/dist/src/lib/init-adopt.d.ts +16 -0
- package/dist/src/lib/init-adopt.js +34 -0
- package/dist/src/lib/init-adopt.js.map +1 -0
- package/dist/src/lib/init-assets.d.ts +39 -0
- package/dist/src/lib/init-assets.js +97 -0
- package/dist/src/lib/init-assets.js.map +1 -0
- package/dist/src/lib/init-config.d.ts +44 -5
- package/dist/src/lib/init-config.js +80 -7
- package/dist/src/lib/init-config.js.map +1 -1
- package/dist/src/lib/init-ios-links.d.ts +50 -0
- package/dist/src/lib/init-ios-links.js +153 -0
- package/dist/src/lib/init-ios-links.js.map +1 -0
- package/dist/src/lib/init-plan.d.ts +80 -0
- package/dist/src/lib/init-plan.js +95 -0
- package/dist/src/lib/init-plan.js.map +1 -0
- package/dist/src/lib/init-production-env.d.ts +48 -0
- package/dist/src/lib/init-production-env.js +59 -0
- package/dist/src/lib/init-production-env.js.map +1 -0
- package/dist/src/lib/init-schema.d.ts +74 -0
- package/dist/src/lib/init-schema.js +358 -0
- package/dist/src/lib/init-schema.js.map +1 -0
- package/dist/src/lib/init-xcode.d.ts +33 -0
- package/dist/src/lib/init-xcode.js +114 -0
- package/dist/src/lib/init-xcode.js.map +1 -0
- package/dist/src/lib/integration-request-config.d.ts +30 -0
- package/dist/src/lib/integration-request-config.js +145 -0
- package/dist/src/lib/integration-request-config.js.map +1 -0
- package/dist/src/lib/local-state.d.ts +55 -0
- package/dist/src/lib/local-state.js +167 -0
- package/dist/src/lib/local-state.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +568 -0
- package/dist/src/lib/log-inspection.js +639 -0
- package/dist/src/lib/log-inspection.js.map +1 -0
- package/dist/src/lib/migration-nag.d.ts +2 -2
- package/dist/src/lib/migration-nag.js +3 -3
- package/dist/src/lib/object-status-filter.d.ts +22 -0
- package/dist/src/lib/object-status-filter.js +45 -0
- package/dist/src/lib/object-status-filter.js.map +1 -0
- package/dist/src/lib/output.d.ts +24 -1
- package/dist/src/lib/output.js +42 -1
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/package-manager.d.ts +140 -0
- package/dist/src/lib/package-manager.js +305 -0
- package/dist/src/lib/package-manager.js.map +1 -0
- package/dist/src/lib/paginate.d.ts +50 -0
- package/dist/src/lib/paginate.js +53 -0
- package/dist/src/lib/paginate.js.map +1 -1
- package/dist/src/lib/platform-owned.d.ts +29 -3
- package/dist/src/lib/platform-owned.js +42 -3
- package/dist/src/lib/platform-owned.js.map +1 -1
- package/dist/src/lib/project-config.js +13 -5
- package/dist/src/lib/project-config.js.map +1 -1
- package/dist/src/lib/query-operators.d.ts +1 -1
- package/dist/src/lib/query-operators.js +1 -1
- package/dist/src/lib/record-filter.d.ts +18 -0
- package/dist/src/lib/record-filter.js +55 -0
- package/dist/src/lib/record-filter.js.map +1 -0
- package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
- package/dist/src/lib/resolve-init-dev-port.js +55 -0
- package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
- package/dist/src/lib/resolve-init-server.d.ts +64 -0
- package/dist/src/lib/resolve-init-server.js +77 -0
- package/dist/src/lib/resolve-init-server.js.map +1 -0
- package/dist/src/lib/resolve-platform.d.ts +43 -14
- package/dist/src/lib/resolve-platform.js +74 -12
- package/dist/src/lib/resolve-platform.js.map +1 -1
- package/dist/src/lib/run-status.d.ts +19 -0
- package/dist/src/lib/run-status.generated.d.ts +39 -0
- package/dist/src/lib/run-status.generated.js +66 -0
- package/dist/src/lib/run-status.generated.js.map +1 -0
- package/dist/src/lib/run-status.js +19 -0
- package/dist/src/lib/run-status.js.map +1 -0
- package/dist/src/lib/server-text-normalization.d.ts +51 -0
- package/dist/src/lib/server-text-normalization.js +90 -0
- package/dist/src/lib/server-text-normalization.js.map +1 -0
- package/dist/src/lib/server-url.d.ts +22 -0
- package/dist/src/lib/server-url.js +33 -0
- package/dist/src/lib/server-url.js.map +1 -0
- package/dist/src/lib/signing-secret-status.d.ts +81 -0
- package/dist/src/lib/signing-secret-status.js +116 -0
- package/dist/src/lib/signing-secret-status.js.map +1 -0
- package/dist/src/lib/skill-installer.js +6 -3
- package/dist/src/lib/skill-installer.js.map +1 -1
- package/dist/src/lib/snapshots.d.ts +2 -2
- package/dist/src/lib/snapshots.js +2 -2
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +15 -2
- package/dist/src/lib/swift-codegen/dbGenerator.js +250 -18
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/generator.d.ts +11 -2
- package/dist/src/lib/swift-codegen/generator.js +181 -7
- package/dist/src/lib/swift-codegen/generator.js.map +1 -1
- package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +7 -3
- package/dist/src/lib/swift-codegen/siblingSymbols.js +4 -1
- package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -1
- package/dist/src/lib/sync-dir-selector.d.ts +21 -0
- package/dist/src/lib/sync-dir-selector.js +30 -0
- package/dist/src/lib/sync-dir-selector.js.map +1 -0
- package/dist/src/lib/sync-paths.d.ts +39 -0
- package/dist/src/lib/sync-paths.js +70 -2
- package/dist/src/lib/sync-paths.js.map +1 -1
- package/dist/src/lib/sync-resource-types.d.ts +138 -31
- package/dist/src/lib/sync-resource-types.js +241 -47
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +95 -0
- package/dist/src/lib/sync-selectors.js +228 -0
- package/dist/src/lib/sync-selectors.js.map +1 -0
- package/dist/src/lib/template.d.ts +62 -4
- package/dist/src/lib/template.js +147 -39
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/test-case-keys.d.ts +29 -0
- package/dist/src/lib/test-case-keys.js +55 -0
- package/dist/src/lib/test-case-keys.js.map +1 -0
- package/dist/src/lib/test-case-variables.d.ts +15 -0
- package/dist/src/lib/test-case-variables.js +29 -0
- package/dist/src/lib/test-case-variables.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +4 -4
- package/dist/src/lib/toml-database-config.js +27 -34
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-metadata-config.d.ts +9 -5
- package/dist/src/lib/toml-metadata-config.js +40 -45
- package/dist/src/lib/toml-metadata-config.js.map +1 -1
- package/dist/src/lib/toml-native-form.d.ts +1 -1
- package/dist/src/lib/toml-native-form.js +1 -1
- package/dist/src/lib/toml-params-validator.d.ts +1 -1
- package/dist/src/lib/toml-params-validator.js +1 -1
- package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
- package/dist/src/lib/toml-scalar-edit.js +283 -0
- package/dist/src/lib/toml-scalar-edit.js.map +1 -0
- package/dist/src/lib/user-selector.d.ts +24 -0
- package/dist/src/lib/user-selector.js +33 -0
- package/dist/src/lib/user-selector.js.map +1 -0
- package/dist/src/lib/version-check.d.ts +25 -0
- package/dist/src/lib/version-check.js +77 -8
- package/dist/src/lib/version-check.js.map +1 -1
- package/dist/src/lib/watch.d.ts +121 -0
- package/dist/src/lib/watch.js +169 -0
- package/dist/src/lib/watch.js.map +1 -0
- package/dist/src/lib/workflow-apply.d.ts +69 -45
- package/dist/src/lib/workflow-apply.js +99 -72
- package/dist/src/lib/workflow-apply.js.map +1 -1
- package/dist/src/lib/workflow-codegen/generator.js +4 -4
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +11 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js +5 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
- package/dist/src/lib/workflow-config-apply.d.ts +70 -0
- package/dist/src/lib/workflow-config-apply.js +137 -0
- package/dist/src/lib/workflow-config-apply.js.map +1 -0
- package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
- package/dist/src/lib/workflow-config-sidecar.js +96 -0
- package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
- package/dist/src/lib/workflow-defaults.d.ts +29 -0
- package/dist/src/lib/workflow-defaults.js +41 -0
- package/dist/src/lib/workflow-defaults.js.map +1 -0
- package/dist/src/lib/workflow-include-preserve.d.ts +76 -0
- package/dist/src/lib/workflow-include-preserve.js +286 -0
- package/dist/src/lib/workflow-include-preserve.js.map +1 -0
- package/dist/src/lib/workflow-payload.d.ts +31 -20
- package/dist/src/lib/workflow-payload.js +100 -110
- package/dist/src/lib/workflow-payload.js.map +1 -1
- package/dist/src/lib/workflow-toml-validator.d.ts +37 -16
- package/dist/src/lib/workflow-toml-validator.js +141 -16
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/dist/src/types/index.d.ts +78 -22
- package/dist/src/validators.d.ts +7 -7
- package/dist/src/validators.js +6 -6
- package/package.json +11 -6
- package/dist/src/commands/settings.d.ts +0 -15
- package/dist/src/commands/settings.js +0 -102
- package/dist/src/commands/settings.js.map +0 -1
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared inspection-output library for the CLI's log/event commands
|
|
3
|
+
* (issue #1967, Phase A1).
|
|
4
|
+
*
|
|
5
|
+
* The platform keeps "what happened in my app" in four disconnected stores —
|
|
6
|
+
* integration invocations, workflow runs, workflow step runs, webhook events,
|
|
7
|
+
* and activity events. Each has its own CLI command with its own ad-hoc output
|
|
8
|
+
* shape. This module gives all of them one consistent, platform-vocabulary
|
|
9
|
+
* inspection model:
|
|
10
|
+
*
|
|
11
|
+
* 1. A **source-keyed discriminated union** (`LogEntry`) with a common
|
|
12
|
+
* envelope `{ source, timestamp, outcome, nativeStatus, correlation }`
|
|
13
|
+
* plus a typed, per-source `detail`. Workflow runs and workflow steps are
|
|
14
|
+
* **separate variants** (`workflow-run` / `workflow-step`) — there is no
|
|
15
|
+
* `kind` sub-discriminator.
|
|
16
|
+
* 2. An **outcome normalizer** that maps each source's native status onto a
|
|
17
|
+
* small platform vocabulary (`ok` / `error` / `pending` / `neutral`) via a
|
|
18
|
+
* documented policy, while preserving the raw value verbatim in
|
|
19
|
+
* `nativeStatus`.
|
|
20
|
+
* 3. CLI-owned **per-source adapters** (`toIntegrationInspectionRow`, …) that
|
|
21
|
+
* project each source record into its `LogEntry` variant. `detail` is a
|
|
22
|
+
* deliberate **allowlist** projection — never the whole native record — so
|
|
23
|
+
* stack-bearing error details, large-payload storage keys, step config/IO,
|
|
24
|
+
* and infrastructure-internal activity fields never leak into `--json` by
|
|
25
|
+
* default.
|
|
26
|
+
* 4. `--json` **envelope builders** per source, so every log view emits the
|
|
27
|
+
* normalized item shape inside its endpoint's own pagination envelope —
|
|
28
|
+
* never a bare array. This normalization is `--json`-only: the human
|
|
29
|
+
* tables stay per-source, because each carries columns the generic shape
|
|
30
|
+
* has no room for (a run's queue delay, a step's inter-step gap and token
|
|
31
|
+
* counts, a webhook event's id). All four already share one definition of
|
|
32
|
+
* time/duration/status formatting — `cli/src/lib/output.ts` — so there is
|
|
33
|
+
* no second copy to reconcile, and no server-side projection
|
|
34
|
+
* (`BlockRunSummary`, `IntegrationProxy.LogEntry`) is moved or imported
|
|
35
|
+
* here.
|
|
36
|
+
* 5. A small **unsupported-flag rejection helper** so a filter a command
|
|
37
|
+
* cannot serve fails with a clear message instead of being silently
|
|
38
|
+
* ignored.
|
|
39
|
+
*
|
|
40
|
+
* Nothing here reaches the network; adapters are pure functions over records
|
|
41
|
+
* the caller already fetched (one upstream call per command invocation).
|
|
42
|
+
*/
|
|
43
|
+
/** The log store an entry came from. Workflow runs and steps are distinct. */
|
|
44
|
+
export type LogSource = "integration" | "workflow-run" | "workflow-step" | "webhook" | "activity";
|
|
45
|
+
/**
|
|
46
|
+
* Normalized outcome vocabulary (platform terms only):
|
|
47
|
+
* - `ok` — completed / accepted successfully
|
|
48
|
+
* - `error` — failed / rejected
|
|
49
|
+
* - `pending` — still in flight (queued, running, apply-pending, …)
|
|
50
|
+
* - `neutral` — no meaningful success/failure signal (skipped steps, activity
|
|
51
|
+
* events, or an absent status). Never fabricated as `ok`.
|
|
52
|
+
*/
|
|
53
|
+
export type Outcome = "ok" | "error" | "pending" | "neutral";
|
|
54
|
+
/**
|
|
55
|
+
* Cross-source pivot keys an operator follows between stores. Every field is
|
|
56
|
+
* optional — each source populates only the keys it actually carries.
|
|
57
|
+
*/
|
|
58
|
+
export interface Correlation {
|
|
59
|
+
runId?: string;
|
|
60
|
+
stepId?: string;
|
|
61
|
+
/** The step run's own row id — the key for a follow-up lookup. */
|
|
62
|
+
stepRunId?: string;
|
|
63
|
+
/** The webhook event's own row id — the key for a follow-up lookup. */
|
|
64
|
+
eventId?: string;
|
|
65
|
+
traceId?: string;
|
|
66
|
+
workflowId?: string;
|
|
67
|
+
workflowKey?: string;
|
|
68
|
+
integrationKey?: string;
|
|
69
|
+
webhookId?: string;
|
|
70
|
+
workflowRunId?: string;
|
|
71
|
+
/** The acting user, where the source records one (workflow, activity). */
|
|
72
|
+
userId?: string;
|
|
73
|
+
}
|
|
74
|
+
/** Common envelope shared by every variant. */
|
|
75
|
+
interface BaseLogEntry {
|
|
76
|
+
source: LogSource;
|
|
77
|
+
/** ISO timestamp of the source event, or null when the record has none. */
|
|
78
|
+
timestamp: string | null;
|
|
79
|
+
outcome: Outcome;
|
|
80
|
+
/** The source's raw status value, preserved verbatim (never remapped). */
|
|
81
|
+
nativeStatus: string | number | null;
|
|
82
|
+
correlation: Correlation;
|
|
83
|
+
/** Duration in ms where the source records one, else null/absent. */
|
|
84
|
+
durationMs?: number | null;
|
|
85
|
+
}
|
|
86
|
+
export interface IntegrationDetail {
|
|
87
|
+
method?: string;
|
|
88
|
+
path?: string;
|
|
89
|
+
/** The call source: user | admin | test | workflow. */
|
|
90
|
+
callSource?: string;
|
|
91
|
+
requestBytes?: number;
|
|
92
|
+
responseBytes?: number;
|
|
93
|
+
errorCode?: string;
|
|
94
|
+
actorType?: string;
|
|
95
|
+
actorEmail?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface WorkflowRunDetail {
|
|
98
|
+
workflowKey?: string;
|
|
99
|
+
isPreview?: boolean;
|
|
100
|
+
queueDelayMs?: number;
|
|
101
|
+
createCallDurationMs?: number;
|
|
102
|
+
executionStartedAt?: string;
|
|
103
|
+
endedAt?: string;
|
|
104
|
+
initiatorKind?: string;
|
|
105
|
+
errorMessage?: string;
|
|
106
|
+
/**
|
|
107
|
+
* #2074 — the run's failure summary. `errorTitle` is the normalized form of
|
|
108
|
+
* `errorMessage` and matches the `normalized_title` of the corresponding
|
|
109
|
+
* `analytics errors-groups` row, so the two commands compose. The failed-step
|
|
110
|
+
* fields are the run's own denormalized attribution — the step's `id`/`kind`
|
|
111
|
+
* and the normalized title of its error, never the stack-bearing
|
|
112
|
+
* `errorDetails` (which stays behind `runs error`).
|
|
113
|
+
*/
|
|
114
|
+
errorTitle?: string;
|
|
115
|
+
failedStepId?: string;
|
|
116
|
+
failedStepKind?: string;
|
|
117
|
+
failedStepErrorTitle?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface WorkflowStepDetail {
|
|
120
|
+
stepId?: string;
|
|
121
|
+
stepIndex?: number;
|
|
122
|
+
stepKind?: string;
|
|
123
|
+
inputTokens?: number;
|
|
124
|
+
outputTokens?: number;
|
|
125
|
+
totalTokens?: number;
|
|
126
|
+
/** The error *message* only — never the stack-bearing `errorDetails`. */
|
|
127
|
+
error?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface WebhookDetail {
|
|
130
|
+
externalEventId?: string;
|
|
131
|
+
/**
|
|
132
|
+
* The signature-derived replay-suppression key. Present on `accepted`
|
|
133
|
+
* deliveries only; the `duplicate` row a later replay produces carries none,
|
|
134
|
+
* so this key identifies the accepted delivery a duplicate collapsed into.
|
|
135
|
+
*
|
|
136
|
+
* It always begins with a reserved tag naming which domain it came from:
|
|
137
|
+
* `sha256:` a digest the platform computed over the signed payload, `id:` an
|
|
138
|
+
* identifier the delivery itself carried, `cap:` the rehash of a key too long
|
|
139
|
+
* for the index. The tags keep the domains from overlapping, so a carried id
|
|
140
|
+
* can never name a platform digest.
|
|
141
|
+
*/
|
|
142
|
+
dedupKey?: string;
|
|
143
|
+
httpStatus?: number;
|
|
144
|
+
rejectionReason?: string;
|
|
145
|
+
workflowRunId?: string;
|
|
146
|
+
payloadSummary?: string;
|
|
147
|
+
processingDurationMs?: number;
|
|
148
|
+
}
|
|
149
|
+
export interface ActivityDetail {
|
|
150
|
+
action?: string;
|
|
151
|
+
feature?: string;
|
|
152
|
+
route?: string;
|
|
153
|
+
country?: string;
|
|
154
|
+
/**
|
|
155
|
+
* The caller-supplied event context. Genuinely open (an app writes whatever
|
|
156
|
+
* it logs), so it rides as `unknown` rather than being flattened or typed.
|
|
157
|
+
*/
|
|
158
|
+
context?: unknown;
|
|
159
|
+
inputTokens?: number;
|
|
160
|
+
outputTokens?: number;
|
|
161
|
+
totalTokens?: number;
|
|
162
|
+
}
|
|
163
|
+
export interface IntegrationLogEntry extends BaseLogEntry {
|
|
164
|
+
source: "integration";
|
|
165
|
+
/** HTTP status code from the upstream call. */
|
|
166
|
+
nativeStatus: number | null;
|
|
167
|
+
detail: IntegrationDetail;
|
|
168
|
+
}
|
|
169
|
+
export interface WorkflowRunLogEntry extends BaseLogEntry {
|
|
170
|
+
source: "workflow-run";
|
|
171
|
+
nativeStatus: string | null;
|
|
172
|
+
detail: WorkflowRunDetail;
|
|
173
|
+
}
|
|
174
|
+
export interface WorkflowStepLogEntry extends BaseLogEntry {
|
|
175
|
+
source: "workflow-step";
|
|
176
|
+
nativeStatus: string | null;
|
|
177
|
+
detail: WorkflowStepDetail;
|
|
178
|
+
}
|
|
179
|
+
export interface WebhookLogEntry extends BaseLogEntry {
|
|
180
|
+
source: "webhook";
|
|
181
|
+
nativeStatus: string | null;
|
|
182
|
+
detail: WebhookDetail;
|
|
183
|
+
}
|
|
184
|
+
export interface ActivityLogEntry extends BaseLogEntry {
|
|
185
|
+
source: "activity";
|
|
186
|
+
/** Activity events carry no success/failure status. */
|
|
187
|
+
nativeStatus: null;
|
|
188
|
+
detail: ActivityDetail;
|
|
189
|
+
}
|
|
190
|
+
export type LogEntry = IntegrationLogEntry | WorkflowRunLogEntry | WorkflowStepLogEntry | WebhookLogEntry | ActivityLogEntry;
|
|
191
|
+
export interface RawIntegrationLog {
|
|
192
|
+
timestamp?: string;
|
|
193
|
+
status?: number;
|
|
194
|
+
method?: string;
|
|
195
|
+
path?: string;
|
|
196
|
+
durationMs?: number;
|
|
197
|
+
source?: string;
|
|
198
|
+
requestBytes?: number;
|
|
199
|
+
responseBytes?: number;
|
|
200
|
+
errorCode?: string;
|
|
201
|
+
actorType?: string;
|
|
202
|
+
actorId?: string;
|
|
203
|
+
actorEmail?: string;
|
|
204
|
+
traceId?: string;
|
|
205
|
+
integrationKey?: string;
|
|
206
|
+
workflowKey?: string;
|
|
207
|
+
runId?: string;
|
|
208
|
+
stepId?: string;
|
|
209
|
+
}
|
|
210
|
+
export interface RawWorkflowRun {
|
|
211
|
+
runId?: string;
|
|
212
|
+
status?: string;
|
|
213
|
+
startedAt?: string;
|
|
214
|
+
executionStartedAt?: string | null;
|
|
215
|
+
endedAt?: string | null;
|
|
216
|
+
queueDelayMs?: number | null;
|
|
217
|
+
createCallDurationMs?: number | null;
|
|
218
|
+
isPreview?: boolean;
|
|
219
|
+
workflowId?: string;
|
|
220
|
+
workflowKey?: string;
|
|
221
|
+
startedByUserId?: string | null;
|
|
222
|
+
initiatorKind?: string | null;
|
|
223
|
+
errorMessage?: string | null;
|
|
224
|
+
errorCode?: string | null;
|
|
225
|
+
skipReason?: string | null;
|
|
226
|
+
errorTitle?: string | null;
|
|
227
|
+
failedStepId?: string | null;
|
|
228
|
+
failedStepKind?: string | null;
|
|
229
|
+
failedStepErrorTitle?: string | null;
|
|
230
|
+
}
|
|
231
|
+
export interface RawWorkflowStepRun {
|
|
232
|
+
stepRunId?: string;
|
|
233
|
+
runId?: string;
|
|
234
|
+
stepId?: string;
|
|
235
|
+
stepIndex?: number;
|
|
236
|
+
stepKind?: string;
|
|
237
|
+
status?: string;
|
|
238
|
+
startedAt?: string;
|
|
239
|
+
endedAt?: string;
|
|
240
|
+
durationMs?: number;
|
|
241
|
+
inputTokens?: number;
|
|
242
|
+
outputTokens?: number;
|
|
243
|
+
totalTokens?: number;
|
|
244
|
+
error?: string;
|
|
245
|
+
}
|
|
246
|
+
export interface RawWebhookEvent {
|
|
247
|
+
eventId?: string;
|
|
248
|
+
webhookId?: string;
|
|
249
|
+
externalEventId?: string;
|
|
250
|
+
dedupKey?: string | null;
|
|
251
|
+
status?: string;
|
|
252
|
+
httpStatus?: number;
|
|
253
|
+
rejectionReason?: string;
|
|
254
|
+
workflowRunId?: string;
|
|
255
|
+
payloadSummary?: string;
|
|
256
|
+
processingDurationMs?: number;
|
|
257
|
+
createdAt?: string;
|
|
258
|
+
}
|
|
259
|
+
export interface RawActivityRow {
|
|
260
|
+
timestamp?: string;
|
|
261
|
+
user_ulid?: string;
|
|
262
|
+
action?: string;
|
|
263
|
+
feature?: string;
|
|
264
|
+
route?: string;
|
|
265
|
+
country?: string;
|
|
266
|
+
context_json?: unknown;
|
|
267
|
+
duration_ms?: number;
|
|
268
|
+
input_tokens?: number;
|
|
269
|
+
output_tokens?: number;
|
|
270
|
+
total_tokens?: number;
|
|
271
|
+
[key: string]: unknown;
|
|
272
|
+
}
|
|
273
|
+
/** HTTP status → outcome: `<400` ok, `>=400` error, absent neutral. */
|
|
274
|
+
export declare function integrationOutcome(httpStatus: number | null | undefined): Outcome;
|
|
275
|
+
/**
|
|
276
|
+
* Workflow *run* status → outcome:
|
|
277
|
+
* completed → ok; failed/terminated → error;
|
|
278
|
+
* queued/running/apply_pending/apply_claimed → pending;
|
|
279
|
+
* missing → neutral; else neutral.
|
|
280
|
+
*
|
|
281
|
+
* The cases cover the full canonical run-status vocabulary (`lib/run-status.ts`,
|
|
282
|
+
* #2348) — since that change the server reconciles every status surface onto
|
|
283
|
+
* those eight values, so nothing else should reach the default. `missing` (no
|
|
284
|
+
* live instance to report on) stays neutral rather than error: it says the
|
|
285
|
+
* platform lost sight of the run, not that the run failed. That matches the
|
|
286
|
+
* outcome table published in
|
|
287
|
+
* `primitive-docs/guides/latest/AGENT_GUIDE_TO_PRIMITIVE_INSPECTION.template.md`.
|
|
288
|
+
*/
|
|
289
|
+
export declare function workflowRunOutcome(status: string | null | undefined): Outcome;
|
|
290
|
+
/**
|
|
291
|
+
* Workflow *step* status → outcome:
|
|
292
|
+
* completed → ok; failed/error_captured → error; skipped → neutral.
|
|
293
|
+
*/
|
|
294
|
+
export declare function workflowStepOutcome(status: string | null | undefined): Outcome;
|
|
295
|
+
/**
|
|
296
|
+
* Webhook event status → outcome. Documented policy table:
|
|
297
|
+
* accepted / duplicate / handshake / workflow_inactive → ok
|
|
298
|
+
* rejected / error → error
|
|
299
|
+
* (anything else) → neutral
|
|
300
|
+
*
|
|
301
|
+
* `workflow_inactive` maps to `ok` on purpose: the event was accepted, it
|
|
302
|
+
* just wasn't dispatched to a live workflow. Treating it as an error would
|
|
303
|
+
* mislead a debugging session into reading a non-dispatch as a failure.
|
|
304
|
+
*/
|
|
305
|
+
export declare function webhookOutcome(status: string | null | undefined): Outcome;
|
|
306
|
+
export declare function toIntegrationInspectionRow(raw: RawIntegrationLog): IntegrationLogEntry;
|
|
307
|
+
export declare function toWorkflowRunInspectionRow(raw: RawWorkflowRun): WorkflowRunLogEntry;
|
|
308
|
+
/**
|
|
309
|
+
* The CLI's single answer to "which step failed this run" (#2074).
|
|
310
|
+
*
|
|
311
|
+
* The server denormalizes the failed step onto the run row using one selector
|
|
312
|
+
* (`src/workflows/failed-step.ts`: lowest `stepIndex` with `status: "failed"`).
|
|
313
|
+
* When that attribution is present, this returns exactly that row, so the STEP
|
|
314
|
+
* column in `runs failures` and the drill-down in `runs error` can never name
|
|
315
|
+
* different steps for the same run. Runs written before that change (or by a
|
|
316
|
+
* launch-time failure that held no step results) carry no `failedStepId`; the
|
|
317
|
+
* fallback applies the same rule locally — lowest `stepIndex` first — instead
|
|
318
|
+
* of trusting whatever order the step-run query returned.
|
|
319
|
+
*/
|
|
320
|
+
export declare function selectFailedStepRow<T extends {
|
|
321
|
+
stepId?: string;
|
|
322
|
+
status?: string;
|
|
323
|
+
stepIndex?: number;
|
|
324
|
+
}>(steps: readonly T[] | null | undefined, failedStepId?: string | null): T | null;
|
|
325
|
+
/** Longest ERROR cell the `runs failures` table prints before truncating. */
|
|
326
|
+
export declare const FAILURE_ERROR_CELL_MAX_LENGTH = 50;
|
|
327
|
+
/**
|
|
328
|
+
* The STEP cell of `workflows runs failures` (#2074). `-` is a routine
|
|
329
|
+
* outcome, not a bug: every launch-time failure (a run that aborted before any
|
|
330
|
+
* step ran, a reclaimed run, an output-schema violation after all steps
|
|
331
|
+
* completed) legitimately has no failed step to name, as do runs written before
|
|
332
|
+
* the attribution shipped.
|
|
333
|
+
*/
|
|
334
|
+
export declare function formatFailureStepCell(failedStepId?: string | null): string;
|
|
335
|
+
/**
|
|
336
|
+
* The CODE cell of `workflows runs failures` / `runs error` (#2636). `-` is the
|
|
337
|
+
* routine case: the platform classifies only the failures it owns (a lost
|
|
338
|
+
* declarative-lock race, an exhausted lock wait), so every other failure — and
|
|
339
|
+
* every run written before the codes — reads `-`.
|
|
340
|
+
*/
|
|
341
|
+
export declare function formatFailureCodeCell(errorCode?: string | null): string;
|
|
342
|
+
/**
|
|
343
|
+
* The ERROR cell of `workflows runs failures` (#2074). The full untruncated
|
|
344
|
+
* message stays available in `--json` and in `runs error <runId>`; the table
|
|
345
|
+
* truncates so the row still fits a terminal.
|
|
346
|
+
*/
|
|
347
|
+
export declare function formatFailureErrorCell(errorMessage?: string | null): string;
|
|
348
|
+
export declare function toWorkflowStepInspectionRow(raw: RawWorkflowStepRun): WorkflowStepLogEntry;
|
|
349
|
+
export declare function toWebhookInspectionRow(raw: RawWebhookEvent): WebhookLogEntry;
|
|
350
|
+
/**
|
|
351
|
+
* Activity events have no success/failure status, so `outcome` is `neutral`
|
|
352
|
+
* (never a fabricated `ok`) and `nativeStatus` is null. `detail` is a strict
|
|
353
|
+
* allowlist of the operator-facing fields (what happened, plus the app's own
|
|
354
|
+
* `context_json` and the recorded token counts) — every infrastructure-shaped
|
|
355
|
+
* field present on the wire (`colo`, `connection_id`, `region_code`,
|
|
356
|
+
* `entity_key`, …) is dropped by construction, not enumerated as a denylist.
|
|
357
|
+
*/
|
|
358
|
+
export declare function toActivityInspectionRow(raw: RawActivityRow): ActivityLogEntry;
|
|
359
|
+
/** Build the "flag not supported for this source" message (behavior 12). */
|
|
360
|
+
export declare function unsupportedFlagMessage(flag: string, source: string, supported: string[]): string;
|
|
361
|
+
/**
|
|
362
|
+
* Reject any provided flag that the source cannot serve, with a clear message
|
|
363
|
+
* listing the supported flags — never a silent no-op. `provided` maps flag
|
|
364
|
+
* names to their (possibly undefined) values; only flags with a defined value
|
|
365
|
+
* are checked. Throws on the first unsupported flag.
|
|
366
|
+
*/
|
|
367
|
+
export declare function assertSupportedFlags(source: string, provided: Record<string, unknown>, supported: string[]): void;
|
|
368
|
+
/** Unpaginated envelope: a source whose endpoint returns a bounded item list. */
|
|
369
|
+
export interface UnpaginatedEnvelope<T extends LogEntry> {
|
|
370
|
+
items: T[];
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Paginated envelope (#1316): workflow runs and webhook events. `cursor` is a
|
|
374
|
+
* deprecated dual-emit alias of `nextCursor`, passed through verbatim so a
|
|
375
|
+
* caller reading either key keeps working.
|
|
376
|
+
*/
|
|
377
|
+
export interface PaginatedEnvelope<T extends LogEntry> {
|
|
378
|
+
items: T[];
|
|
379
|
+
nextCursor: string | null;
|
|
380
|
+
hasMore: boolean;
|
|
381
|
+
/** @deprecated #1316 alias of `nextCursor`. */
|
|
382
|
+
cursor: string | null;
|
|
383
|
+
/**
|
|
384
|
+
* Index rows the server examined (#2237). Present only for filtered reads
|
|
385
|
+
* that walk the index, and only against a server new enough to report it.
|
|
386
|
+
* On a multi-request sweep this is the sum across every resumed page.
|
|
387
|
+
*/
|
|
388
|
+
scanned?: number;
|
|
389
|
+
}
|
|
390
|
+
/** Activity envelope: WAE is offset-paged, not cursor-paged. */
|
|
391
|
+
export interface ActivityEnvelope {
|
|
392
|
+
items: ActivityLogEntry[];
|
|
393
|
+
page: number;
|
|
394
|
+
pageSize: number;
|
|
395
|
+
totalRows: number;
|
|
396
|
+
}
|
|
397
|
+
/** The raw #1316 pagination fields a list endpoint returns (all optional). */
|
|
398
|
+
export interface RawPage {
|
|
399
|
+
nextCursor?: string | null;
|
|
400
|
+
hasMore?: boolean;
|
|
401
|
+
/** @deprecated alias of `nextCursor`. */
|
|
402
|
+
cursor?: string | null;
|
|
403
|
+
/** Index rows examined by this request (#2237); filtered reads only. */
|
|
404
|
+
scanned?: number;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* The raw `analytics/events` response shape (offset-paged, snake_case). `rows`
|
|
408
|
+
* is `unknown[]` because the WAE row is dynamic per source and carries
|
|
409
|
+
* infrastructure-shaped fields the adapter deliberately drops — each row is
|
|
410
|
+
* narrowed to `RawActivityRow` inside the builder before the allowlist runs.
|
|
411
|
+
*/
|
|
412
|
+
export interface RawActivityResponse {
|
|
413
|
+
rows?: unknown[];
|
|
414
|
+
page?: number;
|
|
415
|
+
page_size?: number;
|
|
416
|
+
total_rows?: number;
|
|
417
|
+
}
|
|
418
|
+
export declare function buildIntegrationEnvelope(raw: RawIntegrationLog[]): UnpaginatedEnvelope<IntegrationLogEntry>;
|
|
419
|
+
export declare function buildWorkflowRunEnvelope(raw: RawWorkflowRun[], page?: RawPage): PaginatedEnvelope<WorkflowRunLogEntry>;
|
|
420
|
+
export declare function buildWorkflowStepEnvelope(raw: RawWorkflowStepRun[]): UnpaginatedEnvelope<WorkflowStepLogEntry>;
|
|
421
|
+
export declare function buildWebhookEnvelope(raw: RawWebhookEvent[], page?: RawPage): PaginatedEnvelope<WebhookLogEntry>;
|
|
422
|
+
/**
|
|
423
|
+
* Normalize the `analytics/events` response into the activity envelope:
|
|
424
|
+
* `{page_size, rows}` → `{pageSize, items}`, `total_rows` → `totalRows`, and
|
|
425
|
+
* every row projected through the activity allowlist so infrastructure-shaped
|
|
426
|
+
* fields (`colo`, `connection_id`, …) are dropped by construction (behavior 9).
|
|
427
|
+
*/
|
|
428
|
+
export declare function buildActivityEnvelope(resp: RawActivityResponse): ActivityEnvelope;
|
|
429
|
+
/** Server cap on `limit` for the run-list routes. */
|
|
430
|
+
export declare const RUN_LIST_MAX_LIMIT = 200;
|
|
431
|
+
/**
|
|
432
|
+
* Default ceiling on index rows a single `runs failures` sweep will examine.
|
|
433
|
+
*
|
|
434
|
+
* The ceiling is checked between requests, against the `scanned` the server
|
|
435
|
+
* reports — the server has no public per-request scan-budget parameter, so the
|
|
436
|
+
* CLI cannot bound a request before issuing it. A sweep therefore stops at the
|
|
437
|
+
* first request boundary at or past `--max-scan`, which means it can examine up
|
|
438
|
+
* to one server request's worth of extra rows (the filtered read is bounded at
|
|
439
|
+
* {@link SERVER_SCAN_ROWS_PER_REQUEST}). `--max-scan 100` really examines that
|
|
440
|
+
* many rows, not 100 — so the bound is documented as "to the nearest request"
|
|
441
|
+
* in the help text, the docs page and the agent guide rather than left to
|
|
442
|
+
* surprise the caller (#2237 review; #2280 tracks a real per-request budget
|
|
443
|
+
* parameter). The count the command *reports* is always the true `scanned`, so
|
|
444
|
+
* nothing it prints is wrong — only the flag's granularity is coarse.
|
|
445
|
+
*/
|
|
446
|
+
export declare const DEFAULT_FAILURE_SWEEP_MAX_SCAN = 5000;
|
|
447
|
+
/**
|
|
448
|
+
* Rows a single filtered server request examines at most
|
|
449
|
+
* (`BOUNDED_SCAN_MAX_SCANNED` in `src/app-api/helpers/bounded-index-scan.ts`).
|
|
450
|
+
* Documented here because it is the granularity of `--max-scan`.
|
|
451
|
+
*/
|
|
452
|
+
export declare const SERVER_SCAN_ROWS_PER_REQUEST = 1000;
|
|
453
|
+
/**
|
|
454
|
+
* Hard ceiling on requests per sweep. `--max-scan` is the user-facing bound,
|
|
455
|
+
* but it is enforced from the server's `scanned` field — an older server that
|
|
456
|
+
* does not report it would otherwise let the loop run until the index ended.
|
|
457
|
+
*
|
|
458
|
+
* It is independent of `--max-scan`, so a sweep that stops here reports its own
|
|
459
|
+
* stop reason (`"request-ceiling"`): telling a user who already passed
|
|
460
|
+
* `--max-scan 0` to raise `--max-scan` is advice they cannot act on (#2237
|
|
461
|
+
* review).
|
|
462
|
+
*/
|
|
463
|
+
export declare const FAILURE_SWEEP_MAX_REQUESTS = 200;
|
|
464
|
+
/** Why a sweep stopped. Determines which of the honest messages is printed. */
|
|
465
|
+
export type FailureSweepStop =
|
|
466
|
+
/** Collected the requested number of failures. */
|
|
467
|
+
"collected"
|
|
468
|
+
/** Reached the true end of history — the answer is complete. */
|
|
469
|
+
| "exhausted"
|
|
470
|
+
/** Hit `--max-scan` with history left. */
|
|
471
|
+
| "max-scan"
|
|
472
|
+
/**
|
|
473
|
+
* Hit `FAILURE_SWEEP_MAX_REQUESTS` with history left. Only `--cursor` can
|
|
474
|
+
* continue from here — raising `--max-scan` does not move this ceiling.
|
|
475
|
+
*/
|
|
476
|
+
| "request-ceiling"
|
|
477
|
+
/** Ctrl-C. Partial result, still honest about it. */
|
|
478
|
+
| "interrupted";
|
|
479
|
+
export interface FailureSweepPage extends RawPage {
|
|
480
|
+
items?: RawWorkflowRun[];
|
|
481
|
+
}
|
|
482
|
+
export interface FailureSweepRequest {
|
|
483
|
+
cursor?: string;
|
|
484
|
+
limit: number;
|
|
485
|
+
}
|
|
486
|
+
export interface FailureSweepOptions {
|
|
487
|
+
/** How many FAILURES to collect (not how many runs to look at). */
|
|
488
|
+
limit: number;
|
|
489
|
+
/** Ceiling on index rows examined across the whole sweep; `0` = uncapped. */
|
|
490
|
+
maxScan?: number;
|
|
491
|
+
/** Resume position from `--cursor`. */
|
|
492
|
+
startCursor?: string;
|
|
493
|
+
/** Called after each request with the running row count, for a TTY line. */
|
|
494
|
+
onProgress?: (scanned: number, collected: number) => void;
|
|
495
|
+
/** Cooperative cancellation (Ctrl-C): checked between requests. */
|
|
496
|
+
shouldStop?: () => boolean;
|
|
497
|
+
/** Test hook; defaults to `FAILURE_SWEEP_MAX_REQUESTS`. */
|
|
498
|
+
maxRequests?: number;
|
|
499
|
+
}
|
|
500
|
+
export interface FailureSweepResult {
|
|
501
|
+
items: RawWorkflowRun[];
|
|
502
|
+
/** Summed `scanned` across every request in the sweep. */
|
|
503
|
+
scanned: number;
|
|
504
|
+
/**
|
|
505
|
+
* False when the server never reported `scanned` (an older server). The
|
|
506
|
+
* caller must then omit row counts from its messaging rather than print `0`
|
|
507
|
+
* or `NaN` runs searched.
|
|
508
|
+
*/
|
|
509
|
+
scannedKnown: boolean;
|
|
510
|
+
/** Resume position, or `null` when history is exhausted. */
|
|
511
|
+
nextCursor: string | null;
|
|
512
|
+
/** Requests issued. */
|
|
513
|
+
requests: number;
|
|
514
|
+
/**
|
|
515
|
+
* True when the sweep started from a caller-supplied `--cursor`. `scanned`
|
|
516
|
+
* then counts rows from THAT position, not from the head of the index, so
|
|
517
|
+
* the messaging must not call them "the most recent runs" (#2237 review).
|
|
518
|
+
*/
|
|
519
|
+
resumed: boolean;
|
|
520
|
+
stoppedBecause: FailureSweepStop;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Walk the bounded server-side scan until `limit` FAILURES are collected,
|
|
524
|
+
* history is exhausted, or `maxScan` index rows have been examined (#2237).
|
|
525
|
+
*
|
|
526
|
+
* `--limit N` has always been documented as "Number of failures to show", but
|
|
527
|
+
* it was passed straight through as the server's `limit` — and the server's
|
|
528
|
+
* filtered read is bounded, so a workflow with a long success streak answered
|
|
529
|
+
* with an empty page plus a cursor and the CLI printed "No failures found."
|
|
530
|
+
* The bound has to live somewhere: keeping it in the server would either make
|
|
531
|
+
* every filtered request expensive or still lie one streak deeper, so it lives
|
|
532
|
+
* here, where it is explicit (`--max-scan`), tunable and interruptible.
|
|
533
|
+
*
|
|
534
|
+
* Extracted from the command so the loop is unit-testable without a server:
|
|
535
|
+
* the aggregation of `scanned` across resumed pages is exactly the thing a
|
|
536
|
+
* future caller would get wrong, and the repeated-cursor guard (borrowed from
|
|
537
|
+
* `paginateAll`) is what keeps a non-advancing server cursor from hanging the
|
|
538
|
+
* command.
|
|
539
|
+
*/
|
|
540
|
+
export declare function collectWorkflowFailures(fetchPage: (req: FailureSweepRequest) => Promise<FailureSweepPage>, options: FailureSweepOptions): Promise<FailureSweepResult>;
|
|
541
|
+
/**
|
|
542
|
+
* The empty-state line for a run-list PAGE (`runs list`) (#2237).
|
|
543
|
+
*
|
|
544
|
+
* `runs list` stays a pager — its `--limit` is a page size and it does not
|
|
545
|
+
* auto-resume (that would make one flag mean two different things depending on
|
|
546
|
+
* whether `--status` was passed). But a filtered page comes from the same
|
|
547
|
+
* bounded index walk, so "No runs found." asserts the same absence it cannot
|
|
548
|
+
* back up. This says how far the read got and how to continue instead.
|
|
549
|
+
*
|
|
550
|
+
* `resumed` is true when the caller passed `--cursor`: the rows this page
|
|
551
|
+
* examined then start at that position rather than at the head of the index, so
|
|
552
|
+
* calling them "the most recent runs" would be false (#2237 review).
|
|
553
|
+
*/
|
|
554
|
+
export declare function describeEmptyRunPage(page: RawPage, resumed?: boolean): string;
|
|
555
|
+
/**
|
|
556
|
+
* The line `runs failures` prints under (or instead of) its table (#2237).
|
|
557
|
+
*
|
|
558
|
+
* The unconditional "No failures found." was the defect the issue named as
|
|
559
|
+
* "the worst possible failure mode for a triage command": a bounded search
|
|
560
|
+
* that stopped early asserted the absence of failures it had never reached.
|
|
561
|
+
* Every form below either states the search was complete or says how far it
|
|
562
|
+
* got and how to continue — and none of them claims absence it cannot back up.
|
|
563
|
+
*
|
|
564
|
+
* Returns `null` when the result speaks for itself (a full set of failures
|
|
565
|
+
* from a completed search).
|
|
566
|
+
*/
|
|
567
|
+
export declare function describeFailureSweep(result: FailureSweepResult, limit: number): string | null;
|
|
568
|
+
export {};
|