primitive-admin 1.0.61 → 1.0.63
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 +52 -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 +21 -128
- 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 +115 -26
- 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 +24 -1
- package/dist/src/commands/init.js +1194 -279
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +166 -435
- 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.d.ts +10 -0
- package/dist/src/commands/scripts.js +203 -241
- 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 +1904 -51
- package/dist/src/commands/sync.js +9468 -1790
- 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 +187 -0
- package/dist/src/lib/env-resolver-core.js +325 -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-client-platforms.d.ts +14 -0
- package/dist/src/lib/init-client-platforms.js +71 -0
- package/dist/src/lib/init-client-platforms.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-email-redirect-uris.d.ts +37 -0
- package/dist/src/lib/init-email-redirect-uris.js +46 -0
- package/dist/src/lib/init-email-redirect-uris.js.map +1 -0
- package/dist/src/lib/init-ios-links.d.ts +90 -0
- package/dist/src/lib/init-ios-links.js +218 -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/integration-selector.d.ts +42 -0
- package/dist/src/lib/integration-selector.js +46 -0
- package/dist/src/lib/integration-selector.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/local-test-cases.d.ts +63 -0
- package/dist/src/lib/local-test-cases.js +135 -0
- package/dist/src/lib/local-test-cases.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.d.ts +8 -0
- package/dist/src/lib/project-config.js +30 -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-file-names.d.ts +40 -0
- package/dist/src/lib/test-case-file-names.js +91 -0
- package/dist/src/lib/test-case-file-names.js.map +1 -0
- 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/web-url.d.ts +40 -0
- package/dist/src/lib/web-url.js +76 -0
- package/dist/src/lib/web-url.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,639 @@
|
|
|
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
|
+
// ── Outcome normalizers (documented policy table, behavior 2) ─────────
|
|
44
|
+
/** HTTP status → outcome: `<400` ok, `>=400` error, absent neutral. */
|
|
45
|
+
export function integrationOutcome(httpStatus) {
|
|
46
|
+
if (httpStatus === null || httpStatus === undefined)
|
|
47
|
+
return "neutral";
|
|
48
|
+
return httpStatus < 400 ? "ok" : "error";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Workflow *run* status → outcome:
|
|
52
|
+
* completed → ok; failed/terminated → error;
|
|
53
|
+
* queued/running/apply_pending/apply_claimed → pending;
|
|
54
|
+
* missing → neutral; else neutral.
|
|
55
|
+
*
|
|
56
|
+
* The cases cover the full canonical run-status vocabulary (`lib/run-status.ts`,
|
|
57
|
+
* #2348) — since that change the server reconciles every status surface onto
|
|
58
|
+
* those eight values, so nothing else should reach the default. `missing` (no
|
|
59
|
+
* live instance to report on) stays neutral rather than error: it says the
|
|
60
|
+
* platform lost sight of the run, not that the run failed. That matches the
|
|
61
|
+
* outcome table published in
|
|
62
|
+
* `primitive-docs/guides/latest/AGENT_GUIDE_TO_PRIMITIVE_INSPECTION.template.md`.
|
|
63
|
+
*/
|
|
64
|
+
export function workflowRunOutcome(status) {
|
|
65
|
+
switch (status) {
|
|
66
|
+
case "completed":
|
|
67
|
+
return "ok";
|
|
68
|
+
case "failed":
|
|
69
|
+
case "terminated":
|
|
70
|
+
return "error";
|
|
71
|
+
case "queued":
|
|
72
|
+
case "running":
|
|
73
|
+
case "apply_pending":
|
|
74
|
+
case "apply_claimed":
|
|
75
|
+
return "pending";
|
|
76
|
+
case "missing":
|
|
77
|
+
return "neutral";
|
|
78
|
+
// #2636 — an elided run (its declarative lock was held and the definition
|
|
79
|
+
// declared `onContention: "ignore"`) did not run and did not fail, so it
|
|
80
|
+
// is neutral rather than an error. An operator measuring contention volume
|
|
81
|
+
// lists these; an alerting consumer ignores them.
|
|
82
|
+
case "skipped":
|
|
83
|
+
return "neutral";
|
|
84
|
+
default:
|
|
85
|
+
return "neutral";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Workflow *step* status → outcome:
|
|
90
|
+
* completed → ok; failed/error_captured → error; skipped → neutral.
|
|
91
|
+
*/
|
|
92
|
+
export function workflowStepOutcome(status) {
|
|
93
|
+
switch (status) {
|
|
94
|
+
case "completed":
|
|
95
|
+
return "ok";
|
|
96
|
+
case "failed":
|
|
97
|
+
case "error_captured":
|
|
98
|
+
return "error";
|
|
99
|
+
case "skipped":
|
|
100
|
+
return "neutral";
|
|
101
|
+
default:
|
|
102
|
+
return "neutral";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Webhook event status → outcome. Documented policy table:
|
|
107
|
+
* accepted / duplicate / handshake / workflow_inactive → ok
|
|
108
|
+
* rejected / error → error
|
|
109
|
+
* (anything else) → neutral
|
|
110
|
+
*
|
|
111
|
+
* `workflow_inactive` maps to `ok` on purpose: the event was accepted, it
|
|
112
|
+
* just wasn't dispatched to a live workflow. Treating it as an error would
|
|
113
|
+
* mislead a debugging session into reading a non-dispatch as a failure.
|
|
114
|
+
*/
|
|
115
|
+
export function webhookOutcome(status) {
|
|
116
|
+
switch (status) {
|
|
117
|
+
case "accepted":
|
|
118
|
+
case "duplicate":
|
|
119
|
+
case "handshake":
|
|
120
|
+
case "workflow_inactive":
|
|
121
|
+
return "ok";
|
|
122
|
+
case "rejected":
|
|
123
|
+
case "error":
|
|
124
|
+
return "error";
|
|
125
|
+
default:
|
|
126
|
+
return "neutral";
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// ── Per-source adapters (allowlist projection) ───────────────────────
|
|
130
|
+
/**
|
|
131
|
+
* Drop keys with no value. `null` counts as "no value": the admin routes
|
|
132
|
+
* serialize unset optional fields as `null`, and an allowlist entry that isn't
|
|
133
|
+
* set should be absent from `--json`, not present-and-null.
|
|
134
|
+
*/
|
|
135
|
+
function omitEmpty(obj) {
|
|
136
|
+
const out = {};
|
|
137
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
138
|
+
if (v !== undefined && v !== null)
|
|
139
|
+
out[k] = v;
|
|
140
|
+
}
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
export function toIntegrationInspectionRow(raw) {
|
|
144
|
+
const status = raw.status ?? null;
|
|
145
|
+
return {
|
|
146
|
+
source: "integration",
|
|
147
|
+
timestamp: raw.timestamp ?? null,
|
|
148
|
+
outcome: integrationOutcome(status),
|
|
149
|
+
nativeStatus: status,
|
|
150
|
+
durationMs: raw.durationMs ?? null,
|
|
151
|
+
correlation: omitEmpty({
|
|
152
|
+
runId: raw.runId,
|
|
153
|
+
stepId: raw.stepId,
|
|
154
|
+
traceId: raw.traceId,
|
|
155
|
+
workflowKey: raw.workflowKey,
|
|
156
|
+
integrationKey: raw.integrationKey,
|
|
157
|
+
userId: raw.actorId,
|
|
158
|
+
}),
|
|
159
|
+
detail: omitEmpty({
|
|
160
|
+
method: raw.method,
|
|
161
|
+
path: raw.path,
|
|
162
|
+
callSource: raw.source,
|
|
163
|
+
requestBytes: raw.requestBytes,
|
|
164
|
+
responseBytes: raw.responseBytes,
|
|
165
|
+
errorCode: raw.errorCode,
|
|
166
|
+
actorType: raw.actorType,
|
|
167
|
+
actorEmail: raw.actorEmail,
|
|
168
|
+
}),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export function toWorkflowRunInspectionRow(raw) {
|
|
172
|
+
const status = raw.status ?? null;
|
|
173
|
+
return {
|
|
174
|
+
source: "workflow-run",
|
|
175
|
+
timestamp: raw.startedAt ?? null,
|
|
176
|
+
outcome: workflowRunOutcome(status),
|
|
177
|
+
nativeStatus: status,
|
|
178
|
+
durationMs: null,
|
|
179
|
+
correlation: omitEmpty({
|
|
180
|
+
runId: raw.runId,
|
|
181
|
+
// #2074 — the failed step is the row an operator pivots to next
|
|
182
|
+
// (`runs steps` / `runs error`), so it rides in the correlation block
|
|
183
|
+
// like every other cross-store key.
|
|
184
|
+
stepId: raw.failedStepId,
|
|
185
|
+
workflowId: raw.workflowId,
|
|
186
|
+
workflowKey: raw.workflowKey,
|
|
187
|
+
userId: raw.startedByUserId,
|
|
188
|
+
}),
|
|
189
|
+
detail: omitEmpty({
|
|
190
|
+
workflowKey: raw.workflowKey,
|
|
191
|
+
isPreview: raw.isPreview,
|
|
192
|
+
queueDelayMs: raw.queueDelayMs,
|
|
193
|
+
createCallDurationMs: raw.createCallDurationMs,
|
|
194
|
+
executionStartedAt: raw.executionStartedAt,
|
|
195
|
+
endedAt: raw.endedAt,
|
|
196
|
+
initiatorKind: raw.initiatorKind,
|
|
197
|
+
errorMessage: raw.errorMessage,
|
|
198
|
+
// #2636 — the run-level classification an operator branches on instead of
|
|
199
|
+
// matching the message, and the reason an elided run did not run.
|
|
200
|
+
errorCode: raw.errorCode,
|
|
201
|
+
skipReason: raw.skipReason,
|
|
202
|
+
// #2074 — failure summary. `errorDetails` is deliberately absent: the
|
|
203
|
+
// step-detail policy is the message only, never the stack-bearing field.
|
|
204
|
+
errorTitle: raw.errorTitle,
|
|
205
|
+
failedStepId: raw.failedStepId,
|
|
206
|
+
failedStepKind: raw.failedStepKind,
|
|
207
|
+
failedStepErrorTitle: raw.failedStepErrorTitle,
|
|
208
|
+
}),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* The CLI's single answer to "which step failed this run" (#2074).
|
|
213
|
+
*
|
|
214
|
+
* The server denormalizes the failed step onto the run row using one selector
|
|
215
|
+
* (`src/workflows/failed-step.ts`: lowest `stepIndex` with `status: "failed"`).
|
|
216
|
+
* When that attribution is present, this returns exactly that row, so the STEP
|
|
217
|
+
* column in `runs failures` and the drill-down in `runs error` can never name
|
|
218
|
+
* different steps for the same run. Runs written before that change (or by a
|
|
219
|
+
* launch-time failure that held no step results) carry no `failedStepId`; the
|
|
220
|
+
* fallback applies the same rule locally — lowest `stepIndex` first — instead
|
|
221
|
+
* of trusting whatever order the step-run query returned.
|
|
222
|
+
*/
|
|
223
|
+
export function selectFailedStepRow(steps, failedStepId) {
|
|
224
|
+
if (!steps || steps.length === 0)
|
|
225
|
+
return null;
|
|
226
|
+
if (failedStepId) {
|
|
227
|
+
const named = steps.find((s) => s?.stepId === failedStepId);
|
|
228
|
+
if (named)
|
|
229
|
+
return named;
|
|
230
|
+
}
|
|
231
|
+
let best = null;
|
|
232
|
+
let bestIndex = Number.POSITIVE_INFINITY;
|
|
233
|
+
for (const step of steps) {
|
|
234
|
+
if (!step || step.status !== "failed")
|
|
235
|
+
continue;
|
|
236
|
+
const index = typeof step.stepIndex === "number" && Number.isFinite(step.stepIndex)
|
|
237
|
+
? step.stepIndex
|
|
238
|
+
: Number.POSITIVE_INFINITY;
|
|
239
|
+
if (best === null || index < bestIndex) {
|
|
240
|
+
best = step;
|
|
241
|
+
bestIndex = index;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return best;
|
|
245
|
+
}
|
|
246
|
+
/** Longest ERROR cell the `runs failures` table prints before truncating. */
|
|
247
|
+
export const FAILURE_ERROR_CELL_MAX_LENGTH = 50;
|
|
248
|
+
/**
|
|
249
|
+
* The STEP cell of `workflows runs failures` (#2074). `-` is a routine
|
|
250
|
+
* outcome, not a bug: every launch-time failure (a run that aborted before any
|
|
251
|
+
* step ran, a reclaimed run, an output-schema violation after all steps
|
|
252
|
+
* completed) legitimately has no failed step to name, as do runs written before
|
|
253
|
+
* the attribution shipped.
|
|
254
|
+
*/
|
|
255
|
+
export function formatFailureStepCell(failedStepId) {
|
|
256
|
+
return failedStepId || "-";
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The CODE cell of `workflows runs failures` / `runs error` (#2636). `-` is the
|
|
260
|
+
* routine case: the platform classifies only the failures it owns (a lost
|
|
261
|
+
* declarative-lock race, an exhausted lock wait), so every other failure — and
|
|
262
|
+
* every run written before the codes — reads `-`.
|
|
263
|
+
*/
|
|
264
|
+
export function formatFailureCodeCell(errorCode) {
|
|
265
|
+
return errorCode || "-";
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* The ERROR cell of `workflows runs failures` (#2074). The full untruncated
|
|
269
|
+
* message stays available in `--json` and in `runs error <runId>`; the table
|
|
270
|
+
* truncates so the row still fits a terminal.
|
|
271
|
+
*/
|
|
272
|
+
export function formatFailureErrorCell(errorMessage) {
|
|
273
|
+
if (!errorMessage)
|
|
274
|
+
return "-";
|
|
275
|
+
return errorMessage.length > FAILURE_ERROR_CELL_MAX_LENGTH
|
|
276
|
+
? `${errorMessage.slice(0, FAILURE_ERROR_CELL_MAX_LENGTH - 3)}...`
|
|
277
|
+
: errorMessage;
|
|
278
|
+
}
|
|
279
|
+
export function toWorkflowStepInspectionRow(raw) {
|
|
280
|
+
const status = raw.status ?? null;
|
|
281
|
+
return {
|
|
282
|
+
source: "workflow-step",
|
|
283
|
+
timestamp: raw.startedAt ?? null,
|
|
284
|
+
outcome: workflowStepOutcome(status),
|
|
285
|
+
nativeStatus: status,
|
|
286
|
+
durationMs: raw.durationMs ?? null,
|
|
287
|
+
correlation: omitEmpty({
|
|
288
|
+
runId: raw.runId,
|
|
289
|
+
stepId: raw.stepId,
|
|
290
|
+
// The row's own id: an inspection view keeps the key of the row it
|
|
291
|
+
// prints so a follow-up lookup has something to key on.
|
|
292
|
+
stepRunId: raw.stepRunId,
|
|
293
|
+
}),
|
|
294
|
+
// Deliberate allowlist: `error` is the message only. The stack-bearing
|
|
295
|
+
// error details / cause chain, the rendered/raw step config, the resolved
|
|
296
|
+
// input and output blobs (and their large-payload storage keys), and the
|
|
297
|
+
// per-execution script metrics are all omitted so no stack trace or
|
|
298
|
+
// storage key reaches `--json`.
|
|
299
|
+
detail: omitEmpty({
|
|
300
|
+
stepId: raw.stepId,
|
|
301
|
+
stepIndex: raw.stepIndex,
|
|
302
|
+
stepKind: raw.stepKind,
|
|
303
|
+
inputTokens: raw.inputTokens,
|
|
304
|
+
outputTokens: raw.outputTokens,
|
|
305
|
+
totalTokens: raw.totalTokens,
|
|
306
|
+
error: raw.error,
|
|
307
|
+
}),
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
export function toWebhookInspectionRow(raw) {
|
|
311
|
+
const status = raw.status ?? null;
|
|
312
|
+
return {
|
|
313
|
+
source: "webhook",
|
|
314
|
+
timestamp: raw.createdAt ?? null,
|
|
315
|
+
outcome: webhookOutcome(status),
|
|
316
|
+
nativeStatus: status,
|
|
317
|
+
durationMs: raw.processingDurationMs ?? null,
|
|
318
|
+
correlation: omitEmpty({
|
|
319
|
+
// The row's own id first: the human table prints it as EVENT ID and it
|
|
320
|
+
// is the key an operator uses for the follow-up lookup.
|
|
321
|
+
eventId: raw.eventId,
|
|
322
|
+
webhookId: raw.webhookId,
|
|
323
|
+
workflowRunId: raw.workflowRunId,
|
|
324
|
+
}),
|
|
325
|
+
// Allowlist: `sourceIp`, `headersReceived`, and `payloadHash` are omitted.
|
|
326
|
+
detail: omitEmpty({
|
|
327
|
+
externalEventId: raw.externalEventId,
|
|
328
|
+
dedupKey: raw.dedupKey ?? undefined,
|
|
329
|
+
httpStatus: raw.httpStatus,
|
|
330
|
+
rejectionReason: raw.rejectionReason,
|
|
331
|
+
workflowRunId: raw.workflowRunId,
|
|
332
|
+
payloadSummary: raw.payloadSummary,
|
|
333
|
+
processingDurationMs: raw.processingDurationMs,
|
|
334
|
+
}),
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Activity events have no success/failure status, so `outcome` is `neutral`
|
|
339
|
+
* (never a fabricated `ok`) and `nativeStatus` is null. `detail` is a strict
|
|
340
|
+
* allowlist of the operator-facing fields (what happened, plus the app's own
|
|
341
|
+
* `context_json` and the recorded token counts) — every infrastructure-shaped
|
|
342
|
+
* field present on the wire (`colo`, `connection_id`, `region_code`,
|
|
343
|
+
* `entity_key`, …) is dropped by construction, not enumerated as a denylist.
|
|
344
|
+
*/
|
|
345
|
+
export function toActivityInspectionRow(raw) {
|
|
346
|
+
return {
|
|
347
|
+
source: "activity",
|
|
348
|
+
timestamp: raw.timestamp ?? null,
|
|
349
|
+
outcome: "neutral",
|
|
350
|
+
nativeStatus: null,
|
|
351
|
+
durationMs: raw.duration_ms ?? null,
|
|
352
|
+
correlation: omitEmpty({
|
|
353
|
+
userId: raw.user_ulid,
|
|
354
|
+
}),
|
|
355
|
+
detail: omitEmpty({
|
|
356
|
+
action: raw.action,
|
|
357
|
+
feature: raw.feature,
|
|
358
|
+
route: raw.route,
|
|
359
|
+
country: raw.country,
|
|
360
|
+
// The app's own event context rides through as `unknown` — it is
|
|
361
|
+
// caller-supplied, not an infrastructure field.
|
|
362
|
+
context: raw.context_json,
|
|
363
|
+
inputTokens: raw.input_tokens,
|
|
364
|
+
outputTokens: raw.output_tokens,
|
|
365
|
+
totalTokens: raw.total_tokens,
|
|
366
|
+
}),
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
// ── Unsupported-flag rejection helper ────────────────────────────────
|
|
370
|
+
/** Build the "flag not supported for this source" message (behavior 12). */
|
|
371
|
+
export function unsupportedFlagMessage(flag, source, supported) {
|
|
372
|
+
const list = supported.length > 0 ? supported.join(", ") : "(none)";
|
|
373
|
+
return `--${flag} is not supported for ${source}. Supported filters: ${list}.`;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Reject any provided flag that the source cannot serve, with a clear message
|
|
377
|
+
* listing the supported flags — never a silent no-op. `provided` maps flag
|
|
378
|
+
* names to their (possibly undefined) values; only flags with a defined value
|
|
379
|
+
* are checked. Throws on the first unsupported flag.
|
|
380
|
+
*/
|
|
381
|
+
export function assertSupportedFlags(source, provided, supported) {
|
|
382
|
+
const allowed = new Set(supported);
|
|
383
|
+
for (const [flag, value] of Object.entries(provided)) {
|
|
384
|
+
if (value === undefined || value === null)
|
|
385
|
+
continue;
|
|
386
|
+
if (!allowed.has(flag)) {
|
|
387
|
+
throw new Error(unsupportedFlagMessage(flag, source, supported));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
function paginationOf(page) {
|
|
392
|
+
const nextCursor = page.nextCursor ?? page.cursor ?? null;
|
|
393
|
+
return {
|
|
394
|
+
nextCursor,
|
|
395
|
+
hasMore: page.hasMore ?? !!nextCursor,
|
|
396
|
+
cursor: nextCursor,
|
|
397
|
+
// #2237 — pass through only when the server reported it, so the envelope
|
|
398
|
+
// against an older server is unchanged rather than carrying `scanned: 0`
|
|
399
|
+
// (which would read as "searched nothing").
|
|
400
|
+
...(typeof page.scanned === "number" ? { scanned: page.scanned } : {}),
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
export function buildIntegrationEnvelope(raw) {
|
|
404
|
+
return { items: raw.map(toIntegrationInspectionRow) };
|
|
405
|
+
}
|
|
406
|
+
export function buildWorkflowRunEnvelope(raw, page = {}) {
|
|
407
|
+
return { items: raw.map(toWorkflowRunInspectionRow), ...paginationOf(page) };
|
|
408
|
+
}
|
|
409
|
+
export function buildWorkflowStepEnvelope(raw) {
|
|
410
|
+
return { items: raw.map(toWorkflowStepInspectionRow) };
|
|
411
|
+
}
|
|
412
|
+
export function buildWebhookEnvelope(raw, page = {}) {
|
|
413
|
+
return { items: raw.map(toWebhookInspectionRow), ...paginationOf(page) };
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Normalize the `analytics/events` response into the activity envelope:
|
|
417
|
+
* `{page_size, rows}` → `{pageSize, items}`, `total_rows` → `totalRows`, and
|
|
418
|
+
* every row projected through the activity allowlist so infrastructure-shaped
|
|
419
|
+
* fields (`colo`, `connection_id`, …) are dropped by construction (behavior 9).
|
|
420
|
+
*/
|
|
421
|
+
export function buildActivityEnvelope(resp) {
|
|
422
|
+
return {
|
|
423
|
+
items: (resp.rows ?? []).map((row) => toActivityInspectionRow(row)),
|
|
424
|
+
page: resp.page ?? 0,
|
|
425
|
+
pageSize: resp.page_size ?? 0,
|
|
426
|
+
totalRows: resp.total_rows ?? 0,
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
// ─── #2237: collect-N-failures sweep ────────────────────────────────────────
|
|
430
|
+
/** Server cap on `limit` for the run-list routes. */
|
|
431
|
+
export const RUN_LIST_MAX_LIMIT = 200;
|
|
432
|
+
/**
|
|
433
|
+
* Default ceiling on index rows a single `runs failures` sweep will examine.
|
|
434
|
+
*
|
|
435
|
+
* The ceiling is checked between requests, against the `scanned` the server
|
|
436
|
+
* reports — the server has no public per-request scan-budget parameter, so the
|
|
437
|
+
* CLI cannot bound a request before issuing it. A sweep therefore stops at the
|
|
438
|
+
* first request boundary at or past `--max-scan`, which means it can examine up
|
|
439
|
+
* to one server request's worth of extra rows (the filtered read is bounded at
|
|
440
|
+
* {@link SERVER_SCAN_ROWS_PER_REQUEST}). `--max-scan 100` really examines that
|
|
441
|
+
* many rows, not 100 — so the bound is documented as "to the nearest request"
|
|
442
|
+
* in the help text, the docs page and the agent guide rather than left to
|
|
443
|
+
* surprise the caller (#2237 review; #2280 tracks a real per-request budget
|
|
444
|
+
* parameter). The count the command *reports* is always the true `scanned`, so
|
|
445
|
+
* nothing it prints is wrong — only the flag's granularity is coarse.
|
|
446
|
+
*/
|
|
447
|
+
export const DEFAULT_FAILURE_SWEEP_MAX_SCAN = 5000;
|
|
448
|
+
/**
|
|
449
|
+
* Rows a single filtered server request examines at most
|
|
450
|
+
* (`BOUNDED_SCAN_MAX_SCANNED` in `src/app-api/helpers/bounded-index-scan.ts`).
|
|
451
|
+
* Documented here because it is the granularity of `--max-scan`.
|
|
452
|
+
*/
|
|
453
|
+
export const SERVER_SCAN_ROWS_PER_REQUEST = 1000;
|
|
454
|
+
/**
|
|
455
|
+
* Hard ceiling on requests per sweep. `--max-scan` is the user-facing bound,
|
|
456
|
+
* but it is enforced from the server's `scanned` field — an older server that
|
|
457
|
+
* does not report it would otherwise let the loop run until the index ended.
|
|
458
|
+
*
|
|
459
|
+
* It is independent of `--max-scan`, so a sweep that stops here reports its own
|
|
460
|
+
* stop reason (`"request-ceiling"`): telling a user who already passed
|
|
461
|
+
* `--max-scan 0` to raise `--max-scan` is advice they cannot act on (#2237
|
|
462
|
+
* review).
|
|
463
|
+
*/
|
|
464
|
+
export const FAILURE_SWEEP_MAX_REQUESTS = 200;
|
|
465
|
+
/**
|
|
466
|
+
* Walk the bounded server-side scan until `limit` FAILURES are collected,
|
|
467
|
+
* history is exhausted, or `maxScan` index rows have been examined (#2237).
|
|
468
|
+
*
|
|
469
|
+
* `--limit N` has always been documented as "Number of failures to show", but
|
|
470
|
+
* it was passed straight through as the server's `limit` — and the server's
|
|
471
|
+
* filtered read is bounded, so a workflow with a long success streak answered
|
|
472
|
+
* with an empty page plus a cursor and the CLI printed "No failures found."
|
|
473
|
+
* The bound has to live somewhere: keeping it in the server would either make
|
|
474
|
+
* every filtered request expensive or still lie one streak deeper, so it lives
|
|
475
|
+
* here, where it is explicit (`--max-scan`), tunable and interruptible.
|
|
476
|
+
*
|
|
477
|
+
* Extracted from the command so the loop is unit-testable without a server:
|
|
478
|
+
* the aggregation of `scanned` across resumed pages is exactly the thing a
|
|
479
|
+
* future caller would get wrong, and the repeated-cursor guard (borrowed from
|
|
480
|
+
* `paginateAll`) is what keeps a non-advancing server cursor from hanging the
|
|
481
|
+
* command.
|
|
482
|
+
*/
|
|
483
|
+
export async function collectWorkflowFailures(fetchPage, options) {
|
|
484
|
+
const limit = Math.max(1, options.limit);
|
|
485
|
+
const maxScan = options.maxScan ?? DEFAULT_FAILURE_SWEEP_MAX_SCAN;
|
|
486
|
+
const maxRequests = options.maxRequests ?? FAILURE_SWEEP_MAX_REQUESTS;
|
|
487
|
+
const items = [];
|
|
488
|
+
const seenCursors = new Set();
|
|
489
|
+
let cursor = options.startCursor;
|
|
490
|
+
let scanned = 0;
|
|
491
|
+
let scannedKnown = false;
|
|
492
|
+
let requests = 0;
|
|
493
|
+
// Every other exit is an explicit `break` that sets its own reason, so the
|
|
494
|
+
// initializer is the reason for the one exit that is NOT a break: the `while`
|
|
495
|
+
// condition failing on the request ceiling.
|
|
496
|
+
let stoppedBecause = "request-ceiling";
|
|
497
|
+
while (requests < maxRequests) {
|
|
498
|
+
if (options.shouldStop?.()) {
|
|
499
|
+
stoppedBecause = "interrupted";
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
const page = await fetchPage({
|
|
503
|
+
cursor,
|
|
504
|
+
// The server caps `limit` at 200; ask only for what is still missing so
|
|
505
|
+
// the last request does not over-fetch.
|
|
506
|
+
limit: Math.min(limit - items.length, RUN_LIST_MAX_LIMIT),
|
|
507
|
+
});
|
|
508
|
+
requests++;
|
|
509
|
+
for (const item of page.items ?? []) {
|
|
510
|
+
if (items.length >= limit)
|
|
511
|
+
break;
|
|
512
|
+
items.push(item);
|
|
513
|
+
}
|
|
514
|
+
if (typeof page.scanned === "number") {
|
|
515
|
+
scanned += page.scanned;
|
|
516
|
+
scannedKnown = true;
|
|
517
|
+
}
|
|
518
|
+
options.onProgress?.(scanned, items.length);
|
|
519
|
+
const next = page.nextCursor ?? page.cursor ?? undefined;
|
|
520
|
+
if (!next) {
|
|
521
|
+
cursor = undefined;
|
|
522
|
+
stoppedBecause = "exhausted";
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
if (seenCursors.has(next)) {
|
|
526
|
+
throw new Error(`Pagination cursor did not advance (cursor ${next} repeated); aborting to avoid an infinite loop.`);
|
|
527
|
+
}
|
|
528
|
+
seenCursors.add(next);
|
|
529
|
+
cursor = next;
|
|
530
|
+
if (items.length >= limit) {
|
|
531
|
+
stoppedBecause = "collected";
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
// Checked after the response, because the row budget is only knowable from
|
|
535
|
+
// the server's `scanned` and there is no public parameter to bound a
|
|
536
|
+
// request before issuing it. The overshoot is therefore at most one
|
|
537
|
+
// request's worth of rows — the granularity `--max-scan` is documented
|
|
538
|
+
// with (#2237 review).
|
|
539
|
+
if (maxScan > 0 && scanned >= maxScan) {
|
|
540
|
+
stoppedBecause = "max-scan";
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return {
|
|
545
|
+
items,
|
|
546
|
+
scanned,
|
|
547
|
+
scannedKnown,
|
|
548
|
+
nextCursor: cursor ?? null,
|
|
549
|
+
requests,
|
|
550
|
+
resumed: !!options.startCursor,
|
|
551
|
+
stoppedBecause,
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* The empty-state line for a run-list PAGE (`runs list`) (#2237).
|
|
556
|
+
*
|
|
557
|
+
* `runs list` stays a pager — its `--limit` is a page size and it does not
|
|
558
|
+
* auto-resume (that would make one flag mean two different things depending on
|
|
559
|
+
* whether `--status` was passed). But a filtered page comes from the same
|
|
560
|
+
* bounded index walk, so "No runs found." asserts the same absence it cannot
|
|
561
|
+
* back up. This says how far the read got and how to continue instead.
|
|
562
|
+
*
|
|
563
|
+
* `resumed` is true when the caller passed `--cursor`: the rows this page
|
|
564
|
+
* examined then start at that position rather than at the head of the index, so
|
|
565
|
+
* calling them "the most recent runs" would be false (#2237 review).
|
|
566
|
+
*/
|
|
567
|
+
export function describeEmptyRunPage(page, resumed = false) {
|
|
568
|
+
const nextCursor = page.nextCursor ?? page.cursor ?? null;
|
|
569
|
+
if (nextCursor) {
|
|
570
|
+
const where = typeof page.scanned === "number"
|
|
571
|
+
? resumed
|
|
572
|
+
? ` in ${page.scanned} runs from this position`
|
|
573
|
+
: ` in the ${page.scanned} most recent runs`
|
|
574
|
+
: " so far";
|
|
575
|
+
return `No matching runs${where}. More history remains — re-run with --cursor ${nextCursor}.`;
|
|
576
|
+
}
|
|
577
|
+
if (typeof page.scanned === "number") {
|
|
578
|
+
return resumed
|
|
579
|
+
? `No matching runs in the remaining ${page.scanned} runs from this position.`
|
|
580
|
+
: `No matching runs. Searched all ${page.scanned} runs.`;
|
|
581
|
+
}
|
|
582
|
+
return "No runs found.";
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* The line `runs failures` prints under (or instead of) its table (#2237).
|
|
586
|
+
*
|
|
587
|
+
* The unconditional "No failures found." was the defect the issue named as
|
|
588
|
+
* "the worst possible failure mode for a triage command": a bounded search
|
|
589
|
+
* that stopped early asserted the absence of failures it had never reached.
|
|
590
|
+
* Every form below either states the search was complete or says how far it
|
|
591
|
+
* got and how to continue — and none of them claims absence it cannot back up.
|
|
592
|
+
*
|
|
593
|
+
* Returns `null` when the result speaks for itself (a full set of failures
|
|
594
|
+
* from a completed search).
|
|
595
|
+
*/
|
|
596
|
+
export function describeFailureSweep(result, limit) {
|
|
597
|
+
const found = result.items.length;
|
|
598
|
+
const complete = result.stoppedBecause === "exhausted";
|
|
599
|
+
// Against a server that does not report `scanned` we still say what we know
|
|
600
|
+
// ("more history remains") — we just do not invent a row count. And on a
|
|
601
|
+
// resumed sweep the rows examined start at the supplied cursor, so they are
|
|
602
|
+
// NOT "the most recent runs" (#2237 review).
|
|
603
|
+
const window = !result.scannedKnown
|
|
604
|
+
? "the runs searched"
|
|
605
|
+
: result.resumed
|
|
606
|
+
? `${result.scanned} runs from this position`
|
|
607
|
+
: `the ${result.scanned} most recent runs`;
|
|
608
|
+
// The request ceiling is independent of `--max-scan`, so a sweep that stopped
|
|
609
|
+
// there must not tell the user to raise a flag that cannot move it.
|
|
610
|
+
const ceiling = result.stoppedBecause === "request-ceiling";
|
|
611
|
+
const resume = result.nextCursor
|
|
612
|
+
? ceiling
|
|
613
|
+
? ` re-run with --cursor ${result.nextCursor} to continue.`
|
|
614
|
+
: ` re-run with --cursor ${result.nextCursor} (or raise --max-scan).`
|
|
615
|
+
: ceiling
|
|
616
|
+
? " re-run to continue the search."
|
|
617
|
+
: " raise --max-scan to keep searching.";
|
|
618
|
+
if (complete) {
|
|
619
|
+
if (found > 0)
|
|
620
|
+
return null;
|
|
621
|
+
if (!result.scannedKnown) {
|
|
622
|
+
return result.resumed
|
|
623
|
+
? "No failures in the rest of this workflow's history from this position."
|
|
624
|
+
: "No failures. Searched all of this workflow's history.";
|
|
625
|
+
}
|
|
626
|
+
return result.resumed
|
|
627
|
+
? `No failures in the remaining ${result.scanned} runs from this position.`
|
|
628
|
+
: `No failures. Searched all ${result.scanned} runs.`;
|
|
629
|
+
}
|
|
630
|
+
const interrupted = result.stoppedBecause === "interrupted" ? "Interrupted. " : "";
|
|
631
|
+
if (found === 0) {
|
|
632
|
+
return `${interrupted}No failures in ${window}. More history remains —${resume}`;
|
|
633
|
+
}
|
|
634
|
+
if (found >= limit) {
|
|
635
|
+
return `${interrupted}${found} failures found in ${window}. More history remains —${resume}`;
|
|
636
|
+
}
|
|
637
|
+
return `${interrupted}${found} of ${limit} requested failures found in ${window}. More history remains —${resume}`;
|
|
638
|
+
}
|
|
639
|
+
//# sourceMappingURL=log-inspection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-inspection.js","sourceRoot":"","sources":["../../../src/lib/log-inspection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AA2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AC;IACnF,CAAC;IACD,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;QACnB,OAAO,GAAG,WAAW,GAAG,KAAK,sBAAsB,MAAM,2BAA2B,MAAM,EAAE,CAAC;IAC/F,CAAC;IACD,OAAO,GAAG,WAAW,GAAG,KAAK,OAAO,KAAK,gCAAgC,MAAM,2BAA2B,MAAM,EAAE,CAAC;AACrH,CAAC"}
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* 1. `peekLegacyCredentials()` is non-null (legacy creds file present).
|
|
12
12
|
* 2. `findProjectConfigPath()` is null (no project config in scope).
|
|
13
13
|
* 3. `./config/.primitive-sync.json` exists in CWD (strong signal the
|
|
14
|
-
* user has actually run `primitive
|
|
15
|
-
* risk from #548).
|
|
14
|
+
* user has actually run `primitive config pull` here — the
|
|
15
|
+
* population at risk from #548).
|
|
16
16
|
*
|
|
17
17
|
* Suppression (skip if ANY of):
|
|
18
18
|
* - `PRIMITIVE_NO_MIGRATE_NAG=1`
|