primitive-admin 1.1.0-alpha.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +523 -109
- package/assets/skill/skills/primitive-platform/SKILL.md +289 -0
- package/dist/bin/primitive.d.ts +2 -0
- package/dist/bin/primitive.js +372 -21
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.d.ts +2 -0
- package/dist/src/commands/admins.js +136 -30
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/analytics.d.ts +2 -0
- package/dist/src/commands/analytics.js +713 -55
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps.d.ts +2 -0
- package/dist/src/commands/apps.js +65 -100
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-sessions.d.ts +7 -0
- package/dist/src/commands/auth-sessions.js +144 -0
- package/dist/src/commands/auth-sessions.js.map +1 -0
- package/dist/src/commands/auth.d.ts +2 -0
- package/dist/src/commands/auth.js +238 -108
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.d.ts +2 -0
- package/dist/src/commands/blob-buckets.js +331 -0
- package/dist/src/commands/blob-buckets.js.map +1 -0
- package/dist/src/commands/catalog.d.ts +2 -0
- package/dist/src/commands/catalog.js +63 -48
- package/dist/src/commands/catalog.js.map +1 -1
- package/dist/src/commands/collection-type-configs.d.ts +2 -0
- package/dist/src/commands/collection-type-configs.js +85 -0
- package/dist/src/commands/collection-type-configs.js.map +1 -0
- package/dist/src/commands/collections.d.ts +2 -0
- package/dist/src/commands/collections.js +1282 -0
- package/dist/src/commands/collections.js.map +1 -0
- package/dist/src/commands/comparisons.d.ts +2 -0
- package/dist/src/commands/comparisons.js +6 -6
- package/dist/src/commands/comparisons.js.map +1 -1
- package/dist/src/commands/config.d.ts +46 -0
- package/dist/src/commands/config.js +465 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/connections.d.ts +2 -0
- package/dist/src/commands/connections.js +99 -0
- package/dist/src/commands/connections.js.map +1 -0
- package/dist/src/commands/cron-triggers.d.ts +2 -0
- package/dist/src/commands/cron-triggers.js +266 -0
- package/dist/src/commands/cron-triggers.js.map +1 -0
- package/dist/src/commands/database-type-configs.d.ts +2 -0
- package/dist/src/commands/database-type-configs.js +164 -0
- package/dist/src/commands/database-type-configs.js.map +1 -0
- package/dist/src/commands/database-types.d.ts +2 -0
- package/dist/src/commands/database-types.js +471 -0
- package/dist/src/commands/database-types.js.map +1 -0
- package/dist/src/commands/databases.d.ts +65 -0
- package/dist/src/commands/databases.js +1887 -243
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +60 -0
- package/dist/src/commands/documents.js +2888 -22
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.d.ts +2 -0
- package/dist/src/commands/email-templates.js +175 -0
- package/dist/src/commands/email-templates.js.map +1 -0
- package/dist/src/commands/env.d.ts +23 -0
- package/dist/src/commands/env.js +395 -0
- package/dist/src/commands/env.js.map +1 -0
- package/dist/src/commands/feature-flags.d.ts +14 -0
- package/dist/src/commands/feature-flags.js +117 -0
- package/dist/src/commands/feature-flags.js.map +1 -0
- package/dist/src/commands/functions.d.ts +20 -0
- package/dist/src/commands/functions.js +1630 -0
- package/dist/src/commands/functions.js.map +1 -0
- package/dist/src/commands/group-type-configs.d.ts +2 -0
- package/dist/src/commands/group-type-configs.js +87 -0
- package/dist/src/commands/group-type-configs.js.map +1 -0
- package/dist/src/commands/groups.d.ts +2 -0
- package/dist/src/commands/groups.js +65 -113
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.d.ts +223 -0
- package/dist/src/commands/guides.js +627 -69
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/init.d.ts +37 -0
- package/dist/src/commands/init.js +1693 -208
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.d.ts +2 -0
- package/dist/src/commands/integrations.js +428 -187
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/llm.d.ts +2 -0
- package/dist/src/commands/llm.js +4 -2
- package/dist/src/commands/llm.js.map +1 -1
- package/dist/src/commands/locks.d.ts +8 -0
- package/dist/src/commands/locks.js +175 -0
- package/dist/src/commands/locks.js.map +1 -0
- package/dist/src/commands/metadata-category-configs.d.ts +12 -0
- package/dist/src/commands/metadata-category-configs.js +113 -0
- package/dist/src/commands/metadata-category-configs.js.map +1 -0
- package/dist/src/commands/metadata.d.ts +2 -0
- package/dist/src/commands/metadata.js +288 -0
- package/dist/src/commands/metadata.js.map +1 -0
- package/dist/src/commands/prompts.d.ts +2 -0
- package/dist/src/commands/prompts.js +322 -634
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +3 -0
- package/dist/src/commands/rule-sets.js +139 -148
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +30 -0
- package/dist/src/commands/scripts.js +688 -0
- package/dist/src/commands/scripts.js.map +1 -0
- package/dist/src/commands/secrets.d.ts +2 -0
- package/dist/src/commands/secrets.js +109 -0
- package/dist/src/commands/secrets.js.map +1 -0
- package/dist/src/commands/sessions.d.ts +2 -0
- package/dist/src/commands/sessions.js +76 -0
- package/dist/src/commands/sessions.js.map +1 -0
- package/dist/src/commands/skill.d.ts +2 -0
- package/dist/src/commands/skill.js +29 -0
- package/dist/src/commands/skill.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +158 -0
- package/dist/src/commands/sync-app-settings.js +328 -0
- package/dist/src/commands/sync-app-settings.js.map +1 -0
- package/dist/src/commands/sync.d.ts +2670 -0
- package/dist/src/commands/sync.js +17144 -834
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.d.ts +2 -0
- package/dist/src/commands/tokens.js +132 -22
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/users.d.ts +2 -0
- package/dist/src/commands/users.js +542 -24
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.d.ts +8 -0
- package/dist/src/commands/vars.js +97 -0
- package/dist/src/commands/vars.js.map +1 -0
- package/dist/src/commands/waitlist.d.ts +2 -0
- package/dist/src/commands/waitlist.js +12 -11
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/webhooks.d.ts +31 -0
- package/dist/src/commands/webhooks.js +633 -0
- package/dist/src/commands/webhooks.js.map +1 -0
- package/dist/src/commands/workflows.d.ts +88 -0
- package/dist/src/commands/workflows.js +1568 -742
- 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 +2550 -0
- package/dist/src/lib/api-client.js +2503 -160
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +263 -0
- package/dist/src/lib/app-settings-descriptor.js +583 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -0
- package/dist/src/lib/auth-flow.d.ts +8 -0
- package/dist/src/lib/batch.d.ts +26 -0
- package/dist/src/lib/batch.js +32 -0
- package/dist/src/lib/batch.js.map +1 -0
- package/dist/src/lib/block-layout.d.ts +160 -0
- package/dist/src/lib/block-layout.js +451 -0
- package/dist/src/lib/block-layout.js.map +1 -0
- package/dist/src/lib/block-selector.d.ts +58 -0
- package/dist/src/lib/block-selector.js +92 -0
- package/dist/src/lib/block-selector.js.map +1 -0
- 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/channel.d.ts +30 -0
- package/dist/src/lib/channel.js +68 -0
- package/dist/src/lib/channel.js.map +1 -0
- package/dist/src/lib/cli-manifest.d.ts +68 -0
- package/dist/src/lib/cli-manifest.js +71 -0
- package/dist/src/lib/cli-manifest.js.map +1 -0
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +101 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +191 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +38 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +46 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
- package/dist/src/lib/collection-export.d.ts +184 -0
- package/dist/src/lib/collection-export.js +252 -0
- package/dist/src/lib/collection-export.js.map +1 -0
- package/dist/src/lib/config-json-field.d.ts +28 -0
- package/dist/src/lib/config-json-field.js +56 -0
- package/dist/src/lib/config-json-field.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +127 -0
- package/dist/src/lib/config-object-descriptor.js +740 -0
- package/dist/src/lib/config-object-descriptor.js.map +1 -0
- package/dist/src/lib/config-payload.d.ts +92 -0
- package/dist/src/lib/config-payload.js +161 -0
- package/dist/src/lib/config-payload.js.map +1 -0
- package/dist/src/lib/config-surface.d.ts +141 -0
- package/dist/src/lib/config-surface.js +368 -0
- package/dist/src/lib/config-surface.js.map +1 -0
- package/dist/src/lib/config-toml.d.ts +10 -0
- package/dist/src/lib/config-toml.js +42 -0
- package/dist/src/lib/config-toml.js.map +1 -0
- package/dist/src/lib/config.d.ts +71 -0
- package/dist/src/lib/config.js +71 -68
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/confirm-prompt.d.ts +83 -0
- package/dist/src/lib/confirm-prompt.js +110 -0
- package/dist/src/lib/confirm-prompt.js.map +1 -0
- package/dist/src/lib/constants.d.ts +11 -0
- package/dist/src/lib/constants.js +12 -0
- package/dist/src/lib/constants.js.map +1 -0
- package/dist/src/lib/crash-handlers.d.ts +20 -0
- package/dist/src/lib/crash-handlers.js +49 -0
- package/dist/src/lib/crash-handlers.js.map +1 -0
- package/dist/src/lib/credentials-store.d.ts +104 -0
- package/dist/src/lib/credentials-store.js +336 -0
- package/dist/src/lib/credentials-store.js.map +1 -0
- package/dist/src/lib/csv.d.ts +47 -0
- package/dist/src/lib/csv.js +172 -0
- package/dist/src/lib/csv.js.map +1 -0
- 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/dbFingerprint.d.ts +10 -0
- package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
- package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
- package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
- package/dist/src/lib/db-codegen/dbNaming.js +180 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
- package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js +525 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
- package/dist/src/lib/deprecation.d.ts +22 -0
- package/dist/src/lib/deprecation.js +43 -0
- package/dist/src/lib/deprecation.js.map +1 -0
- package/dist/src/lib/document-export-permissions.d.ts +30 -0
- package/dist/src/lib/document-export-permissions.js +54 -0
- package/dist/src/lib/document-export-permissions.js.map +1 -0
- package/dist/src/lib/document-ingest-artifact.d.ts +120 -0
- package/dist/src/lib/document-ingest-artifact.js +505 -0
- package/dist/src/lib/document-ingest-artifact.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +51 -0
- package/dist/src/lib/document-ingest-input.js +132 -0
- package/dist/src/lib/document-ingest-input.js.map +1 -0
- package/dist/src/lib/document-ingest-rows.d.ts +137 -0
- package/dist/src/lib/document-ingest-rows.js +181 -0
- package/dist/src/lib/document-ingest-rows.js.map +1 -0
- package/dist/src/lib/document-ingest.d.ts +101 -0
- package/dist/src/lib/document-ingest.js +384 -0
- package/dist/src/lib/document-ingest.js.map +1 -0
- package/dist/src/lib/env-resolver-core.d.ts +258 -0
- package/dist/src/lib/env-resolver-core.js +447 -0
- package/dist/src/lib/env-resolver-core.js.map +1 -0
- package/dist/src/lib/env-resolver.d.ts +99 -0
- package/dist/src/lib/env-resolver.js +153 -0
- package/dist/src/lib/env-resolver.js.map +1 -0
- package/dist/src/lib/fetch.d.ts +5 -0
- package/dist/src/lib/function-bundle.d.ts +147 -0
- package/dist/src/lib/function-bundle.js +341 -0
- package/dist/src/lib/function-bundle.js.map +1 -0
- package/dist/src/lib/function-collect.d.ts +123 -0
- package/dist/src/lib/function-collect.js +610 -0
- package/dist/src/lib/function-collect.js.map +1 -0
- package/dist/src/lib/function-db-types.d.ts +202 -0
- package/dist/src/lib/function-db-types.js +870 -0
- package/dist/src/lib/function-db-types.js.map +1 -0
- package/dist/src/lib/function-document-types.d.ts +144 -0
- package/dist/src/lib/function-document-types.js +370 -0
- package/dist/src/lib/function-document-types.js.map +1 -0
- package/dist/src/lib/function-grants-preflight.d.ts +64 -0
- package/dist/src/lib/function-grants-preflight.js +105 -0
- package/dist/src/lib/function-grants-preflight.js.map +1 -0
- package/dist/src/lib/function-log-lines.d.ts +76 -0
- package/dist/src/lib/function-log-lines.js +160 -0
- package/dist/src/lib/function-log-lines.js.map +1 -0
- package/dist/src/lib/function-log-row.d.ts +29 -0
- package/dist/src/lib/function-log-row.js +73 -0
- package/dist/src/lib/function-log-row.js.map +1 -0
- package/dist/src/lib/function-log-tail.d.ts +132 -0
- package/dist/src/lib/function-log-tail.js +262 -0
- package/dist/src/lib/function-log-tail.js.map +1 -0
- package/dist/src/lib/function-run.d.ts +289 -0
- package/dist/src/lib/function-run.js +389 -0
- package/dist/src/lib/function-run.js.map +1 -0
- package/dist/src/lib/function-schema-codegen.d.ts +143 -0
- package/dist/src/lib/function-schema-codegen.js +420 -0
- package/dist/src/lib/function-schema-codegen.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +459 -0
- package/dist/src/lib/function-sync.js +1258 -0
- package/dist/src/lib/function-sync.js.map +1 -0
- package/dist/src/lib/function-trigger-listing.d.ts +27 -0
- package/dist/src/lib/function-trigger-listing.js +70 -0
- package/dist/src/lib/function-trigger-listing.js.map +1 -0
- package/dist/src/lib/function-typecheck.d.ts +86 -0
- package/dist/src/lib/function-typecheck.js +370 -0
- package/dist/src/lib/function-typecheck.js.map +1 -0
- package/dist/src/lib/function-versions.d.ts +122 -0
- package/dist/src/lib/function-versions.js +182 -0
- package/dist/src/lib/function-versions.js.map +1 -0
- package/dist/src/lib/generated-allowlist.d.ts +28 -0
- package/dist/src/lib/generated-allowlist.js +281 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +2936 -0
- package/dist/src/lib/generated-config-surfaces.js +10569 -0
- package/dist/src/lib/generated-config-surfaces.js.map +1 -0
- package/dist/src/lib/generated-sdk-types.d.ts +12 -0
- package/dist/src/lib/generated-sdk-types.js +13 -0
- package/dist/src/lib/generated-sdk-types.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 +98 -0
- package/dist/src/lib/init-config.js +186 -0
- package/dist/src/lib/init-config.js.map +1 -0
- 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 +91 -0
- package/dist/src/lib/init-ios-links.js +219 -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 +34 -0
- package/dist/src/lib/init-xcode.js +138 -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/ios-app-id.d.ts +34 -0
- package/dist/src/lib/ios-app-id.js +69 -0
- package/dist/src/lib/ios-app-id.js.map +1 -0
- package/dist/src/lib/list-options.d.ts +68 -0
- package/dist/src/lib/list-options.js +89 -0
- package/dist/src/lib/list-options.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 +136 -0
- package/dist/src/lib/local-test-cases.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +715 -0
- package/dist/src/lib/log-inspection.js +816 -0
- package/dist/src/lib/log-inspection.js.map +1 -0
- package/dist/src/lib/logout-admin-session.d.ts +33 -0
- package/dist/src/lib/logout-admin-session.js +70 -0
- package/dist/src/lib/logout-admin-session.js.map +1 -0
- package/dist/src/lib/migration-nag.d.ts +49 -0
- package/dist/src/lib/migration-nag.js +163 -0
- package/dist/src/lib/migration-nag.js.map +1 -0
- 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 +124 -0
- package/dist/src/lib/output.js +219 -8
- 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 +98 -0
- package/dist/src/lib/paginate.js +112 -0
- package/dist/src/lib/paginate.js.map +1 -0
- package/dist/src/lib/platform-owned.d.ts +63 -0
- package/dist/src/lib/platform-owned.js +85 -0
- package/dist/src/lib/platform-owned.js.map +1 -0
- package/dist/src/lib/project-config.d.ts +122 -0
- package/dist/src/lib/project-config.js +244 -0
- package/dist/src/lib/project-config.js.map +1 -0
- package/dist/src/lib/prompt-cost-format.d.ts +11 -0
- package/dist/src/lib/prompt-cost-format.js +41 -0
- package/dist/src/lib/prompt-cost-format.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +147 -0
- package/dist/src/lib/prompt-schema-codegen.js +462 -0
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -0
- package/dist/src/lib/query-operators.d.ts +43 -0
- package/dist/src/lib/query-operators.js +80 -0
- package/dist/src/lib/query-operators.js.map +1 -0
- 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/refresh-admin-credentials.d.ts +73 -0
- package/dist/src/lib/refresh-admin-credentials.js +123 -0
- package/dist/src/lib/refresh-admin-credentials.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-owner.d.ts +19 -0
- package/dist/src/lib/resolve-owner.js +20 -0
- package/dist/src/lib/resolve-owner.js.map +1 -0
- package/dist/src/lib/resolve-platform.d.ts +74 -0
- package/dist/src/lib/resolve-platform.js +105 -0
- package/dist/src/lib/resolve-platform.js.map +1 -0
- 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.d.ts +71 -0
- package/dist/src/lib/skill-installer.js +441 -0
- package/dist/src/lib/skill-installer.js.map +1 -0
- package/dist/src/lib/snapshot-audit-source.d.ts +45 -0
- package/dist/src/lib/snapshot-audit-source.js +58 -0
- package/dist/src/lib/snapshot-audit-source.js.map +1 -0
- package/dist/src/lib/snapshot-audit-store.d.ts +52 -0
- package/dist/src/lib/snapshot-audit-store.js +196 -0
- package/dist/src/lib/snapshot-audit-store.js.map +1 -0
- package/dist/src/lib/snapshot-audit.d.ts +207 -0
- package/dist/src/lib/snapshot-audit.js +431 -0
- package/dist/src/lib/snapshot-audit.js.map +1 -0
- package/dist/src/lib/snapshot-build-rows.d.ts +60 -0
- package/dist/src/lib/snapshot-build-rows.js +87 -0
- package/dist/src/lib/snapshot-build-rows.js.map +1 -0
- package/dist/src/lib/snapshot-build.d.ts +50 -0
- package/dist/src/lib/snapshot-build.js +111 -0
- package/dist/src/lib/snapshot-build.js.map +1 -0
- package/dist/src/lib/snapshot-manifest-layout.d.ts +61 -0
- package/dist/src/lib/snapshot-manifest-layout.js +70 -0
- package/dist/src/lib/snapshot-manifest-layout.js.map +1 -0
- package/dist/src/lib/snapshots.d.ts +98 -0
- package/dist/src/lib/snapshots.js +294 -0
- package/dist/src/lib/snapshots.js.map +1 -0
- package/dist/src/lib/step-run-table.d.ts +43 -0
- package/dist/src/lib/step-run-table.js +129 -0
- package/dist/src/lib/step-run-table.js.map +1 -0
- package/dist/src/lib/storage-pending-retry.d.ts +26 -0
- package/dist/src/lib/storage-pending-retry.js +42 -0
- package/dist/src/lib/storage-pending-retry.js.map +1 -0
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +42 -0
- package/dist/src/lib/swift-codegen/agentGenerator.js +118 -0
- package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/banners.d.ts +24 -0
- package/dist/src/lib/swift-codegen/banners.js +25 -0
- package/dist/src/lib/swift-codegen/banners.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +113 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +926 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +139 -0
- package/dist/src/lib/swift-codegen/functionGenerator.js +462 -0
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/generator.d.ts +100 -0
- package/dist/src/lib/swift-codegen/generator.js +457 -0
- package/dist/src/lib/swift-codegen/generator.js.map +1 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +87 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js +661 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +94 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js +155 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
- 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 +128 -0
- package/dist/src/lib/sync-paths.js +195 -0
- package/dist/src/lib/sync-paths.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +563 -0
- package/dist/src/lib/sync-resource-types.js +1073 -0
- package/dist/src/lib/sync-resource-types.js.map +1 -0
- package/dist/src/lib/sync-selectors.d.ts +138 -0
- package/dist/src/lib/sync-selectors.js +289 -0
- package/dist/src/lib/sync-selectors.js.map +1 -0
- package/dist/src/lib/template.d.ts +170 -0
- package/dist/src/lib/template.js +484 -68
- 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 +29 -0
- package/dist/src/lib/test-case-variables.js +71 -0
- package/dist/src/lib/test-case-variables.js.map +1 -0
- package/dist/src/lib/token-inject.d.ts +56 -0
- package/dist/src/lib/token-inject.js +204 -0
- package/dist/src/lib/token-inject.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +123 -0
- package/dist/src/lib/toml-database-config.js +544 -0
- package/dist/src/lib/toml-database-config.js.map +1 -0
- package/dist/src/lib/toml-metadata-config.d.ts +151 -0
- package/dist/src/lib/toml-metadata-config.js +476 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -0
- package/dist/src/lib/toml-native-form.d.ts +46 -0
- package/dist/src/lib/toml-native-form.js +78 -0
- package/dist/src/lib/toml-native-form.js.map +1 -0
- package/dist/src/lib/toml-params-validator.d.ts +129 -0
- package/dist/src/lib/toml-params-validator.js +298 -0
- package/dist/src/lib/toml-params-validator.js.map +1 -0
- 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 +35 -0
- package/dist/src/lib/version-check.js +241 -0
- package/dist/src/lib/version-check.js.map +1 -0
- 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/webhook-deliver.d.ts +209 -0
- package/dist/src/lib/webhook-deliver.js +519 -0
- package/dist/src/lib/webhook-deliver.js.map +1 -0
- package/dist/src/lib/workflow-apply.d.ts +110 -0
- package/dist/src/lib/workflow-apply.js +164 -0
- package/dist/src/lib/workflow-apply.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
- package/dist/src/lib/workflow-codegen/generator.js +361 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +94 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js +76 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
- package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
- package/dist/src/lib/workflow-codegen/naming.js +81 -0
- package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
- 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-fragments.d.ts +64 -0
- package/dist/src/lib/workflow-fragments.js +342 -0
- package/dist/src/lib/workflow-fragments.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 +98 -0
- package/dist/src/lib/workflow-payload.js +178 -0
- package/dist/src/lib/workflow-payload.js.map +1 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +211 -0
- package/dist/src/lib/workflow-toml-validator.js +770 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -0
- package/dist/src/lib/workflow-usage.d.ts +196 -0
- package/dist/src/lib/workflow-usage.js +310 -0
- package/dist/src/lib/workflow-usage.js.map +1 -0
- package/dist/src/types/index.d.ts +591 -0
- package/dist/src/validators.d.ts +65 -0
- package/dist/src/validators.js +64 -0
- package/dist/src/validators.js.map +1 -0
- package/package.json +34 -9
|
@@ -0,0 +1,816 @@
|
|
|
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
|
+
import { normalizeCliListEnvelope } from "./paginate.js";
|
|
44
|
+
// ── Outcome normalizers (documented policy table, behavior 2) ─────────
|
|
45
|
+
/** HTTP status → outcome: `<400` ok, `>=400` error, absent neutral. */
|
|
46
|
+
export function integrationOutcome(httpStatus) {
|
|
47
|
+
if (httpStatus === null || httpStatus === undefined)
|
|
48
|
+
return "neutral";
|
|
49
|
+
return httpStatus < 400 ? "ok" : "error";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Workflow *run* status → outcome:
|
|
53
|
+
* completed → ok; failed/terminated → error;
|
|
54
|
+
* queued/running/apply_pending/apply_claimed → pending;
|
|
55
|
+
* missing → neutral; else neutral.
|
|
56
|
+
*
|
|
57
|
+
* The cases cover the full canonical run-status vocabulary (`lib/run-status.ts`,
|
|
58
|
+
* #2348) — since that change the server reconciles every status surface onto
|
|
59
|
+
* those eight values, so nothing else should reach the default. `missing` (no
|
|
60
|
+
* live instance to report on) stays neutral rather than error: it says the
|
|
61
|
+
* platform lost sight of the run, not that the run failed. That matches the
|
|
62
|
+
* outcome table published in
|
|
63
|
+
* `primitive-docs/guides/latest/AGENT_GUIDE_TO_PRIMITIVE_INSPECTION.template.md`.
|
|
64
|
+
*/
|
|
65
|
+
export function workflowRunOutcome(status) {
|
|
66
|
+
switch (status) {
|
|
67
|
+
case "completed":
|
|
68
|
+
return "ok";
|
|
69
|
+
case "failed":
|
|
70
|
+
case "terminated":
|
|
71
|
+
return "error";
|
|
72
|
+
case "queued":
|
|
73
|
+
case "running":
|
|
74
|
+
case "apply_pending":
|
|
75
|
+
case "apply_claimed":
|
|
76
|
+
return "pending";
|
|
77
|
+
case "missing":
|
|
78
|
+
return "neutral";
|
|
79
|
+
// #2636 — an elided run (its declarative lock was held and the definition
|
|
80
|
+
// declared `onContention: "ignore"`) did not run and did not fail, so it
|
|
81
|
+
// is neutral rather than an error. An operator measuring contention volume
|
|
82
|
+
// lists these; an alerting consumer ignores them.
|
|
83
|
+
case "skipped":
|
|
84
|
+
return "neutral";
|
|
85
|
+
default:
|
|
86
|
+
return "neutral";
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Workflow *step* status → outcome:
|
|
91
|
+
* completed → ok; failed/error_captured → error; skipped → neutral.
|
|
92
|
+
*/
|
|
93
|
+
export function workflowStepOutcome(status) {
|
|
94
|
+
switch (status) {
|
|
95
|
+
case "completed":
|
|
96
|
+
return "ok";
|
|
97
|
+
case "failed":
|
|
98
|
+
case "error_captured":
|
|
99
|
+
return "error";
|
|
100
|
+
case "skipped":
|
|
101
|
+
return "neutral";
|
|
102
|
+
default:
|
|
103
|
+
return "neutral";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Webhook event status → outcome. Documented policy table:
|
|
108
|
+
* accepted / duplicate / handshake / workflow_inactive → ok
|
|
109
|
+
* rejected / error → error
|
|
110
|
+
* (anything else) → neutral
|
|
111
|
+
*
|
|
112
|
+
* `workflow_inactive` maps to `ok` on purpose: the event was accepted, it
|
|
113
|
+
* just wasn't dispatched to a live workflow. Treating it as an error would
|
|
114
|
+
* mislead a debugging session into reading a non-dispatch as a failure.
|
|
115
|
+
*/
|
|
116
|
+
export function webhookOutcome(status) {
|
|
117
|
+
switch (status) {
|
|
118
|
+
case "accepted":
|
|
119
|
+
case "duplicate":
|
|
120
|
+
case "handshake":
|
|
121
|
+
case "workflow_inactive":
|
|
122
|
+
return "ok";
|
|
123
|
+
case "rejected":
|
|
124
|
+
case "error":
|
|
125
|
+
return "error";
|
|
126
|
+
default:
|
|
127
|
+
return "neutral";
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// ── Per-source adapters (allowlist projection) ───────────────────────
|
|
131
|
+
/**
|
|
132
|
+
* Drop keys with no value. `null` counts as "no value": the admin routes
|
|
133
|
+
* serialize unset optional fields as `null`, and an allowlist entry that isn't
|
|
134
|
+
* set should be absent from `--json`, not present-and-null.
|
|
135
|
+
*/
|
|
136
|
+
function omitEmpty(obj) {
|
|
137
|
+
const out = {};
|
|
138
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
139
|
+
if (v !== undefined && v !== null)
|
|
140
|
+
out[k] = v;
|
|
141
|
+
}
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
export function toIntegrationInspectionRow(raw) {
|
|
145
|
+
const status = raw.status ?? null;
|
|
146
|
+
return {
|
|
147
|
+
source: "integration",
|
|
148
|
+
timestamp: raw.timestamp ?? null,
|
|
149
|
+
outcome: integrationOutcome(status),
|
|
150
|
+
nativeStatus: status,
|
|
151
|
+
durationMs: raw.durationMs ?? null,
|
|
152
|
+
correlation: omitEmpty({
|
|
153
|
+
// #3691 — a workflow step's run, or a function run's. Both are on the
|
|
154
|
+
// row under the same name, because a call belongs to one run either
|
|
155
|
+
// way; the id the CLI prints is the one the run surfaces take.
|
|
156
|
+
runId: raw.runId,
|
|
157
|
+
stepId: raw.stepId,
|
|
158
|
+
traceId: raw.traceId,
|
|
159
|
+
workflowKey: raw.workflowKey,
|
|
160
|
+
functionId: raw.functionId,
|
|
161
|
+
integrationKey: raw.integrationKey,
|
|
162
|
+
userId: raw.actorId,
|
|
163
|
+
}),
|
|
164
|
+
detail: omitEmpty({
|
|
165
|
+
method: raw.method,
|
|
166
|
+
path: raw.path,
|
|
167
|
+
callSource: raw.source,
|
|
168
|
+
functionKey: raw.functionKey,
|
|
169
|
+
requestBytes: raw.requestBytes,
|
|
170
|
+
responseBytes: raw.responseBytes,
|
|
171
|
+
errorCode: raw.errorCode,
|
|
172
|
+
actorType: raw.actorType,
|
|
173
|
+
actorEmail: raw.actorEmail,
|
|
174
|
+
}),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export function toWorkflowRunInspectionRow(raw) {
|
|
178
|
+
const status = raw.status ?? null;
|
|
179
|
+
return {
|
|
180
|
+
source: "workflow-run",
|
|
181
|
+
timestamp: raw.startedAt ?? null,
|
|
182
|
+
outcome: workflowRunOutcome(status),
|
|
183
|
+
nativeStatus: status,
|
|
184
|
+
durationMs: null,
|
|
185
|
+
correlation: omitEmpty({
|
|
186
|
+
runId: raw.runId,
|
|
187
|
+
// #2074 — the failed step is the row an operator pivots to next
|
|
188
|
+
// (`runs steps` / `runs error`), so it rides in the correlation block
|
|
189
|
+
// like every other cross-store key.
|
|
190
|
+
stepId: raw.failedStepId,
|
|
191
|
+
workflowId: raw.workflowId,
|
|
192
|
+
workflowKey: raw.workflowKey,
|
|
193
|
+
userId: raw.startedByUserId,
|
|
194
|
+
}),
|
|
195
|
+
detail: omitEmpty({
|
|
196
|
+
workflowKey: raw.workflowKey,
|
|
197
|
+
isPreview: raw.isPreview,
|
|
198
|
+
queueDelayMs: raw.queueDelayMs,
|
|
199
|
+
createCallDurationMs: raw.createCallDurationMs,
|
|
200
|
+
executionStartedAt: raw.executionStartedAt,
|
|
201
|
+
endedAt: raw.endedAt,
|
|
202
|
+
initiatorKind: raw.initiatorKind,
|
|
203
|
+
errorMessage: raw.errorMessage,
|
|
204
|
+
// #2636 — the run-level classification an operator branches on instead of
|
|
205
|
+
// matching the message, and the reason an elided run did not run.
|
|
206
|
+
errorCode: raw.errorCode,
|
|
207
|
+
skipReason: raw.skipReason,
|
|
208
|
+
// #2074 — failure summary. `errorDetails` is deliberately absent: the
|
|
209
|
+
// step-detail policy is the message only, never the stack-bearing field.
|
|
210
|
+
errorTitle: raw.errorTitle,
|
|
211
|
+
failedStepId: raw.failedStepId,
|
|
212
|
+
failedStepKind: raw.failedStepKind,
|
|
213
|
+
failedStepErrorTitle: raw.failedStepErrorTitle,
|
|
214
|
+
}),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The CLI's single answer to "which step failed this run" (#2074).
|
|
219
|
+
*
|
|
220
|
+
* The server denormalizes the failed step onto the run row using one selector
|
|
221
|
+
* (`src/workflows/failed-step.ts`: lowest `stepIndex` with `status: "failed"`).
|
|
222
|
+
* When that attribution is present, this returns exactly that row, so the STEP
|
|
223
|
+
* column in `runs failures` and the drill-down in `runs error` can never name
|
|
224
|
+
* different steps for the same run. Runs written before that change (or by a
|
|
225
|
+
* launch-time failure that held no step results) carry no `failedStepId`; the
|
|
226
|
+
* fallback applies the same rule locally — lowest `stepIndex` first — instead
|
|
227
|
+
* of trusting whatever order the step-run query returned.
|
|
228
|
+
*/
|
|
229
|
+
export function selectFailedStepRow(steps, failedStepId) {
|
|
230
|
+
if (!steps || steps.length === 0)
|
|
231
|
+
return null;
|
|
232
|
+
if (failedStepId) {
|
|
233
|
+
const named = steps.find((s) => s?.stepId === failedStepId);
|
|
234
|
+
if (named)
|
|
235
|
+
return named;
|
|
236
|
+
}
|
|
237
|
+
let best = null;
|
|
238
|
+
let bestIndex = Number.POSITIVE_INFINITY;
|
|
239
|
+
for (const step of steps) {
|
|
240
|
+
if (!step || step.status !== "failed")
|
|
241
|
+
continue;
|
|
242
|
+
const index = typeof step.stepIndex === "number" && Number.isFinite(step.stepIndex)
|
|
243
|
+
? step.stepIndex
|
|
244
|
+
: Number.POSITIVE_INFINITY;
|
|
245
|
+
if (best === null || index < bestIndex) {
|
|
246
|
+
best = step;
|
|
247
|
+
bestIndex = index;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return best;
|
|
251
|
+
}
|
|
252
|
+
/** Longest ERROR cell the `runs failures` table prints before truncating. */
|
|
253
|
+
export const FAILURE_ERROR_CELL_MAX_LENGTH = 50;
|
|
254
|
+
/**
|
|
255
|
+
* The STEP cell of `workflows runs failures` (#2074). `-` is a routine
|
|
256
|
+
* outcome, not a bug: every launch-time failure (a run that aborted before any
|
|
257
|
+
* step ran, a reclaimed run, an output-schema violation after all steps
|
|
258
|
+
* completed) legitimately has no failed step to name, as do runs written before
|
|
259
|
+
* the attribution shipped.
|
|
260
|
+
*/
|
|
261
|
+
export function formatFailureStepCell(failedStepId) {
|
|
262
|
+
return failedStepId || "-";
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The CODE cell of `workflows runs failures` / `runs error` (#2636). `-` is the
|
|
266
|
+
* routine case: the platform classifies only the failures it owns (a lost
|
|
267
|
+
* declarative-lock race, an exhausted lock wait), so every other failure — and
|
|
268
|
+
* every run written before the codes — reads `-`.
|
|
269
|
+
*/
|
|
270
|
+
export function formatFailureCodeCell(errorCode) {
|
|
271
|
+
return errorCode || "-";
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* The ERROR cell of `workflows runs failures` (#2074). The full untruncated
|
|
275
|
+
* message stays available in `--json` and in `runs error <runId>`; the table
|
|
276
|
+
* truncates so the row still fits a terminal.
|
|
277
|
+
*/
|
|
278
|
+
export function formatFailureErrorCell(errorMessage) {
|
|
279
|
+
if (!errorMessage)
|
|
280
|
+
return "-";
|
|
281
|
+
return errorMessage.length > FAILURE_ERROR_CELL_MAX_LENGTH
|
|
282
|
+
? `${errorMessage.slice(0, FAILURE_ERROR_CELL_MAX_LENGTH - 3)}...`
|
|
283
|
+
: errorMessage;
|
|
284
|
+
}
|
|
285
|
+
export function toWorkflowStepInspectionRow(raw) {
|
|
286
|
+
const status = raw.status ?? null;
|
|
287
|
+
return {
|
|
288
|
+
source: "workflow-step",
|
|
289
|
+
timestamp: raw.startedAt ?? null,
|
|
290
|
+
outcome: workflowStepOutcome(status),
|
|
291
|
+
nativeStatus: status,
|
|
292
|
+
durationMs: raw.durationMs ?? null,
|
|
293
|
+
correlation: omitEmpty({
|
|
294
|
+
runId: raw.runId,
|
|
295
|
+
stepId: raw.stepId,
|
|
296
|
+
// The row's own id: an inspection view keeps the key of the row it
|
|
297
|
+
// prints so a follow-up lookup has something to key on.
|
|
298
|
+
stepRunId: raw.stepRunId,
|
|
299
|
+
}),
|
|
300
|
+
// Deliberate allowlist: `error` is the message only. The stack-bearing
|
|
301
|
+
// error details / cause chain, the rendered/raw step config, the resolved
|
|
302
|
+
// input and output blobs (and their large-payload storage keys), and the
|
|
303
|
+
// per-execution script metrics are all omitted so no stack trace or
|
|
304
|
+
// storage key reaches `--json`.
|
|
305
|
+
detail: omitEmpty({
|
|
306
|
+
stepId: raw.stepId,
|
|
307
|
+
stepIndex: raw.stepIndex,
|
|
308
|
+
stepKind: raw.stepKind,
|
|
309
|
+
inputTokens: raw.inputTokens,
|
|
310
|
+
outputTokens: raw.outputTokens,
|
|
311
|
+
totalTokens: raw.totalTokens,
|
|
312
|
+
error: raw.error,
|
|
313
|
+
}),
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
export function toWebhookInspectionRow(raw) {
|
|
317
|
+
const status = raw.status ?? null;
|
|
318
|
+
return {
|
|
319
|
+
source: "webhook",
|
|
320
|
+
timestamp: raw.createdAt ?? null,
|
|
321
|
+
outcome: webhookOutcome(status),
|
|
322
|
+
nativeStatus: status,
|
|
323
|
+
durationMs: raw.processingDurationMs ?? null,
|
|
324
|
+
correlation: omitEmpty({
|
|
325
|
+
// The row's own id first: the human table prints it as EVENT ID and it
|
|
326
|
+
// is the key an operator uses for the follow-up lookup.
|
|
327
|
+
eventId: raw.eventId,
|
|
328
|
+
webhookId: raw.webhookId,
|
|
329
|
+
workflowRunId: raw.workflowRunId,
|
|
330
|
+
}),
|
|
331
|
+
// Allowlist: `sourceIp`, `headersReceived`, and `payloadHash` are omitted.
|
|
332
|
+
detail: omitEmpty({
|
|
333
|
+
externalEventId: raw.externalEventId,
|
|
334
|
+
dedupKey: raw.dedupKey ?? undefined,
|
|
335
|
+
httpStatus: raw.httpStatus,
|
|
336
|
+
rejectionReason: raw.rejectionReason,
|
|
337
|
+
workflowRunId: raw.workflowRunId,
|
|
338
|
+
payloadSummary: raw.payloadSummary,
|
|
339
|
+
processingDurationMs: raw.processingDurationMs,
|
|
340
|
+
}),
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Activity events have no success/failure status, so `outcome` is `neutral`
|
|
345
|
+
* (never a fabricated `ok`) and `nativeStatus` is null. `detail` is a strict
|
|
346
|
+
* allowlist of the operator-facing fields (what happened, plus the app's own
|
|
347
|
+
* `context_json` and the recorded token counts) — every infrastructure-shaped
|
|
348
|
+
* field present on the wire (`colo`, `connection_id`, `region_code`,
|
|
349
|
+
* `entity_key`, …) is dropped by construction, not enumerated as a denylist.
|
|
350
|
+
*/
|
|
351
|
+
export function toActivityInspectionRow(raw) {
|
|
352
|
+
const invoke = functionInvokeStatus(raw);
|
|
353
|
+
return {
|
|
354
|
+
source: "activity",
|
|
355
|
+
timestamp: raw.timestamp ?? null,
|
|
356
|
+
// Activity events are counts, and reading one as a success or a failure
|
|
357
|
+
// would be fabricating a signal — with ONE exception (#3287). See
|
|
358
|
+
// `functionInvokeStatus`.
|
|
359
|
+
outcome: activityOutcome(invoke),
|
|
360
|
+
nativeStatus: invoke,
|
|
361
|
+
durationMs: raw.duration_ms ?? null,
|
|
362
|
+
correlation: omitEmpty({
|
|
363
|
+
userId: raw.user_ulid,
|
|
364
|
+
}),
|
|
365
|
+
detail: omitEmpty({
|
|
366
|
+
action: raw.action,
|
|
367
|
+
feature: raw.feature,
|
|
368
|
+
route: raw.route,
|
|
369
|
+
country: raw.country,
|
|
370
|
+
// The app's own event context rides through as `unknown` — it is
|
|
371
|
+
// caller-supplied, not an infrastructure field.
|
|
372
|
+
context: raw.context_json,
|
|
373
|
+
inputTokens: raw.input_tokens,
|
|
374
|
+
outputTokens: raw.output_tokens,
|
|
375
|
+
totalTokens: raw.total_tokens,
|
|
376
|
+
}),
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* An invocation record's status → outcome — #3287.
|
|
381
|
+
*
|
|
382
|
+
* `completed` is the only success. Everything else that names a settled
|
|
383
|
+
* invocation is a failure an operator has to be able to COUNT: the function
|
|
384
|
+
* threw (`failed`), it ran out of wall clock (`timeout`), or the platform
|
|
385
|
+
* refused the dispatch before any code ran and recorded its own code
|
|
386
|
+
* (`FUNCTION_BUNDLE_MISSING` and friends). A status nobody has taught this
|
|
387
|
+
* function is `neutral`, never fabricated as `ok`.
|
|
388
|
+
*/
|
|
389
|
+
export function functionLogOutcome(status) {
|
|
390
|
+
if (!status)
|
|
391
|
+
return "neutral";
|
|
392
|
+
if (status === "completed")
|
|
393
|
+
return "ok";
|
|
394
|
+
if (status === "failed" || status === "timeout")
|
|
395
|
+
return "error";
|
|
396
|
+
// A slice that is still running has printed something and settled nothing.
|
|
397
|
+
if (status === "running")
|
|
398
|
+
return "pending";
|
|
399
|
+
// The platform's own refusal codes are SHOUTED, which is what tells them
|
|
400
|
+
// apart from a settled status without enumerating a list that would go
|
|
401
|
+
// stale the moment a code is added.
|
|
402
|
+
if (/^[A-Z][A-Z0-9_]*$/.test(status))
|
|
403
|
+
return "error";
|
|
404
|
+
return "neutral";
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* One invocation record in the SHARED inspection item shape — #3287,
|
|
408
|
+
* DSO3287-007.
|
|
409
|
+
*
|
|
410
|
+
* The guide requires every log view's JSON and follow output to carry
|
|
411
|
+
* `source`/`timestamp`/`outcome`/`nativeStatus`/`correlation`, so a consumer
|
|
412
|
+
* can classify and pivot without knowing which store answered. Projecting the
|
|
413
|
+
* native record straight out would have left function logs the one view that
|
|
414
|
+
* shared consumers could not read.
|
|
415
|
+
*
|
|
416
|
+
* `detail` is an allowlist, as every other adapter's is: the correlation keys
|
|
417
|
+
* move to `correlation`, and what stays is what the invocation did.
|
|
418
|
+
*/
|
|
419
|
+
/** The run a trigger descriptor names, when the record itself names none. */
|
|
420
|
+
function triggerRunId(raw) {
|
|
421
|
+
const runId = raw.trigger?.runId;
|
|
422
|
+
return typeof runId === "string" && runId.length > 0 ? runId : undefined;
|
|
423
|
+
}
|
|
424
|
+
export function toFunctionLogInspectionRow(raw) {
|
|
425
|
+
const status = raw.status ?? null;
|
|
426
|
+
return {
|
|
427
|
+
source: "function-log",
|
|
428
|
+
timestamp: raw.startedAt ?? null,
|
|
429
|
+
outcome: functionLogOutcome(status),
|
|
430
|
+
nativeStatus: status,
|
|
431
|
+
durationMs: raw.durationMs ?? null,
|
|
432
|
+
correlation: omitEmpty({
|
|
433
|
+
// A trigger fire and a task slice name their run; a request invocation
|
|
434
|
+
// has none, and its own id is its key.
|
|
435
|
+
//
|
|
436
|
+
// The `workflow.call` bridge is the case that needs saying (CR3287-010):
|
|
437
|
+
// its record carries `runId: null` on purpose — the leaf has no run row
|
|
438
|
+
// of its own — and names the PARENT's run inside the trigger. Reading
|
|
439
|
+
// only `raw.runId` there dropped the one correlation that leads a failing
|
|
440
|
+
// leaf back to the run that called it, while keeping the workflow key
|
|
441
|
+
// and the step id beside it.
|
|
442
|
+
runId: raw.runId ?? triggerRunId(raw) ?? undefined,
|
|
443
|
+
workflowRunId: raw.runId ?? triggerRunId(raw) ?? undefined,
|
|
444
|
+
workflowKey: typeof raw.trigger?.workflowKey === "string"
|
|
445
|
+
? raw.trigger.workflowKey
|
|
446
|
+
: undefined,
|
|
447
|
+
stepId: typeof raw.trigger?.stepId === "string"
|
|
448
|
+
? raw.trigger.stepId
|
|
449
|
+
: undefined,
|
|
450
|
+
eventId: raw.invocationId,
|
|
451
|
+
userId: raw.attributionUserId ?? undefined,
|
|
452
|
+
}),
|
|
453
|
+
detail: omitEmpty({
|
|
454
|
+
functionKey: raw.functionKey ?? undefined,
|
|
455
|
+
configId: raw.configId ?? undefined,
|
|
456
|
+
contentHash: raw.contentHash ?? undefined,
|
|
457
|
+
triggerKind: raw.trigger?.kind,
|
|
458
|
+
// #3482 — `triggerKind` says which DOOR fired it; this says whether the
|
|
459
|
+
// platform ran the code inside the request or as a task run. Additive,
|
|
460
|
+
// and absent on a record written before the column.
|
|
461
|
+
runtime: raw.runtime ?? undefined,
|
|
462
|
+
errorCode: raw.errorCode ?? undefined,
|
|
463
|
+
errorMessage: raw.errorMessage ?? undefined,
|
|
464
|
+
errorStack: raw.errorStack ?? undefined,
|
|
465
|
+
stdout: raw.stdout,
|
|
466
|
+
stderr: raw.stderr,
|
|
467
|
+
truncated: raw.truncated,
|
|
468
|
+
logsUnavailable: raw.logsUnavailable,
|
|
469
|
+
// The console and the error fields were dropped because the platform
|
|
470
|
+
// could not load the secrets it redacts against — a record that is
|
|
471
|
+
// deliberately short, not a function that was quiet (CR3287-003).
|
|
472
|
+
contentSuppressed: raw.contentSuppressed,
|
|
473
|
+
}),
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
// ── Unsupported-flag rejection helper ────────────────────────────────
|
|
477
|
+
/**
|
|
478
|
+
* The settled status a `function.invoke` activity row carries — #3287, D-2.
|
|
479
|
+
*
|
|
480
|
+
* The intent keeps the event a COUNT and adds no blob: the emit already puts
|
|
481
|
+
* the settled status in the event's context, so nothing on the write side
|
|
482
|
+
* moves. What moved is this — the shared inspection contract reported a failed
|
|
483
|
+
* invocation as `neutral`, which meant an operator could not count failures at
|
|
484
|
+
* all, and the count was the one thing the event was for.
|
|
485
|
+
*
|
|
486
|
+
* `context_json` arrives as an object or as a JSON STRING depending on the
|
|
487
|
+
* store, and an unparseable one is not a reason to guess: it answers null and
|
|
488
|
+
* the row stays `neutral`, exactly as every other action does.
|
|
489
|
+
*/
|
|
490
|
+
export function functionInvokeStatus(raw) {
|
|
491
|
+
if (raw.action !== "function.invoke")
|
|
492
|
+
return null;
|
|
493
|
+
let context = raw.context_json;
|
|
494
|
+
if (typeof context === "string") {
|
|
495
|
+
try {
|
|
496
|
+
context = JSON.parse(context);
|
|
497
|
+
}
|
|
498
|
+
catch {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
if (!context || typeof context !== "object")
|
|
503
|
+
return null;
|
|
504
|
+
const status = context.status;
|
|
505
|
+
return typeof status === "string" && status.length > 0 ? status : null;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* `function.invoke`'s status → outcome; every other action stays `neutral`.
|
|
509
|
+
*
|
|
510
|
+
* `started` is `pending` on purpose: a task start is in flight when the row is
|
|
511
|
+
* written, and its terminal outcome lives on the run row, which the
|
|
512
|
+
* `workflow-run` source already maps.
|
|
513
|
+
*/
|
|
514
|
+
export function activityOutcome(status) {
|
|
515
|
+
if (!status)
|
|
516
|
+
return "neutral";
|
|
517
|
+
if (status === "completed")
|
|
518
|
+
return "ok";
|
|
519
|
+
if (status === "failed" || status === "timeout")
|
|
520
|
+
return "error";
|
|
521
|
+
if (status === "started")
|
|
522
|
+
return "pending";
|
|
523
|
+
return "neutral";
|
|
524
|
+
}
|
|
525
|
+
/** Build the "flag not supported for this source" message (behavior 12). */
|
|
526
|
+
export function unsupportedFlagMessage(flag, source, supported) {
|
|
527
|
+
const list = supported.length > 0 ? supported.join(", ") : "(none)";
|
|
528
|
+
return `--${flag} is not supported for ${source}. Supported filters: ${list}.`;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Reject any provided flag that the source cannot serve, with a clear message
|
|
532
|
+
* listing the supported flags — never a silent no-op. `provided` maps flag
|
|
533
|
+
* names to their (possibly undefined) values; only flags with a defined value
|
|
534
|
+
* are checked. Throws on the first unsupported flag.
|
|
535
|
+
*/
|
|
536
|
+
export function assertSupportedFlags(source, provided, supported) {
|
|
537
|
+
const allowed = new Set(supported);
|
|
538
|
+
for (const [flag, value] of Object.entries(provided)) {
|
|
539
|
+
if (value === undefined || value === null)
|
|
540
|
+
continue;
|
|
541
|
+
if (!allowed.has(flag)) {
|
|
542
|
+
throw new Error(unsupportedFlagMessage(flag, source, supported));
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
function paginationOf(page) {
|
|
547
|
+
const nextCursor = page.nextCursor ?? page.cursor ?? null;
|
|
548
|
+
return {
|
|
549
|
+
nextCursor,
|
|
550
|
+
hasMore: page.hasMore ?? !!nextCursor,
|
|
551
|
+
cursor: nextCursor,
|
|
552
|
+
// #2237 — pass through only when the server reported it, so the envelope
|
|
553
|
+
// against an older server is unchanged rather than carrying `scanned: 0`
|
|
554
|
+
// (which would read as "searched nothing").
|
|
555
|
+
...(typeof page.scanned === "number" ? { scanned: page.scanned } : {}),
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
export function buildIntegrationEnvelope(raw) {
|
|
559
|
+
return { items: raw.map(toIntegrationInspectionRow) };
|
|
560
|
+
}
|
|
561
|
+
export function buildWorkflowRunEnvelope(raw, page = {}) {
|
|
562
|
+
return { items: raw.map(toWorkflowRunInspectionRow), ...paginationOf(page) };
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* The `workflows runs list --json` envelope (#3646).
|
|
566
|
+
*
|
|
567
|
+
* `runs list` is a `list` verb, so what it prints is the CLI's one list
|
|
568
|
+
* envelope — `{items, hasMore, nextCursor?}`, with `nextCursor` OMITTED on the
|
|
569
|
+
* last page and the deprecated `cursor` alias not re-emitted — rather than the
|
|
570
|
+
* endpoint's #1316 envelope passed through, which is what
|
|
571
|
+
* {@link buildWorkflowRunEnvelope} still does for `runs failures` (a sweep, not
|
|
572
|
+
* a `list`). The rows are the same inspection shape either way, and `scanned`
|
|
573
|
+
* (#2237) survives as a key beside the envelope's three because it describes
|
|
574
|
+
* how far the filtered read got, which is not a pagination claim.
|
|
575
|
+
*/
|
|
576
|
+
export function buildWorkflowRunListEnvelope(raw, page = {}) {
|
|
577
|
+
const envelope = normalizeCliListEnvelope({
|
|
578
|
+
items: raw.map(toWorkflowRunInspectionRow),
|
|
579
|
+
hasMore: page.hasMore,
|
|
580
|
+
nextCursor: page.nextCursor ?? page.cursor,
|
|
581
|
+
});
|
|
582
|
+
return typeof page.scanned === "number"
|
|
583
|
+
? { ...envelope, scanned: page.scanned }
|
|
584
|
+
: envelope;
|
|
585
|
+
}
|
|
586
|
+
export function buildWorkflowStepEnvelope(raw) {
|
|
587
|
+
return { items: raw.map(toWorkflowStepInspectionRow) };
|
|
588
|
+
}
|
|
589
|
+
export function buildWebhookEnvelope(raw, page = {}) {
|
|
590
|
+
return { items: raw.map(toWebhookInspectionRow), ...paginationOf(page) };
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Normalize the `analytics/events` response into the activity envelope:
|
|
594
|
+
* `{page_size, rows}` → `{pageSize, items}`, `total_rows` → `totalRows`, and
|
|
595
|
+
* every row projected through the activity allowlist so infrastructure-shaped
|
|
596
|
+
* fields (`colo`, `connection_id`, …) are dropped by construction (behavior 9).
|
|
597
|
+
*/
|
|
598
|
+
export function buildActivityEnvelope(resp) {
|
|
599
|
+
return {
|
|
600
|
+
items: (resp.rows ?? []).map((row) => toActivityInspectionRow(row)),
|
|
601
|
+
page: resp.page ?? 0,
|
|
602
|
+
pageSize: resp.page_size ?? 0,
|
|
603
|
+
totalRows: resp.total_rows ?? 0,
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
// ─── #2237: collect-N-failures sweep ────────────────────────────────────────
|
|
607
|
+
/** Server cap on `limit` for the run-list routes. */
|
|
608
|
+
export const RUN_LIST_MAX_LIMIT = 200;
|
|
609
|
+
/**
|
|
610
|
+
* Default ceiling on index rows a single `runs failures` sweep will examine.
|
|
611
|
+
*
|
|
612
|
+
* The ceiling is checked between requests, against the `scanned` the server
|
|
613
|
+
* reports — the server has no public per-request scan-budget parameter, so the
|
|
614
|
+
* CLI cannot bound a request before issuing it. A sweep therefore stops at the
|
|
615
|
+
* first request boundary at or past `--max-scan`, which means it can examine up
|
|
616
|
+
* to one server request's worth of extra rows (the filtered read is bounded at
|
|
617
|
+
* {@link SERVER_SCAN_ROWS_PER_REQUEST}). `--max-scan 100` really examines that
|
|
618
|
+
* many rows, not 100 — so the bound is documented as "to the nearest request"
|
|
619
|
+
* in the help text, the docs page and the agent guide rather than left to
|
|
620
|
+
* surprise the caller (#2237 review; #2280 tracks a real per-request budget
|
|
621
|
+
* parameter). The count the command *reports* is always the true `scanned`, so
|
|
622
|
+
* nothing it prints is wrong — only the flag's granularity is coarse.
|
|
623
|
+
*/
|
|
624
|
+
export const DEFAULT_FAILURE_SWEEP_MAX_SCAN = 5000;
|
|
625
|
+
/**
|
|
626
|
+
* Rows a single filtered server request examines at most
|
|
627
|
+
* (`BOUNDED_SCAN_MAX_SCANNED` in `src/app-api/helpers/bounded-index-scan.ts`).
|
|
628
|
+
* Documented here because it is the granularity of `--max-scan`.
|
|
629
|
+
*/
|
|
630
|
+
export const SERVER_SCAN_ROWS_PER_REQUEST = 1000;
|
|
631
|
+
/**
|
|
632
|
+
* Hard ceiling on requests per sweep. `--max-scan` is the user-facing bound,
|
|
633
|
+
* but it is enforced from the server's `scanned` field — an older server that
|
|
634
|
+
* does not report it would otherwise let the loop run until the index ended.
|
|
635
|
+
*
|
|
636
|
+
* It is independent of `--max-scan`, so a sweep that stops here reports its own
|
|
637
|
+
* stop reason (`"request-ceiling"`): telling a user who already passed
|
|
638
|
+
* `--max-scan 0` to raise `--max-scan` is advice they cannot act on (#2237
|
|
639
|
+
* review).
|
|
640
|
+
*/
|
|
641
|
+
export const FAILURE_SWEEP_MAX_REQUESTS = 200;
|
|
642
|
+
/**
|
|
643
|
+
* Walk the bounded server-side scan until `limit` FAILURES are collected,
|
|
644
|
+
* history is exhausted, or `maxScan` index rows have been examined (#2237).
|
|
645
|
+
*
|
|
646
|
+
* `--limit N` has always been documented as "Number of failures to show", but
|
|
647
|
+
* it was passed straight through as the server's `limit` — and the server's
|
|
648
|
+
* filtered read is bounded, so a workflow with a long success streak answered
|
|
649
|
+
* with an empty page plus a cursor and the CLI printed "No failures found."
|
|
650
|
+
* The bound has to live somewhere: keeping it in the server would either make
|
|
651
|
+
* every filtered request expensive or still lie one streak deeper, so it lives
|
|
652
|
+
* here, where it is explicit (`--max-scan`), tunable and interruptible.
|
|
653
|
+
*
|
|
654
|
+
* Extracted from the command so the loop is unit-testable without a server:
|
|
655
|
+
* the aggregation of `scanned` across resumed pages is exactly the thing a
|
|
656
|
+
* future caller would get wrong, and the repeated-cursor guard (borrowed from
|
|
657
|
+
* `paginateAll`) is what keeps a non-advancing server cursor from hanging the
|
|
658
|
+
* command.
|
|
659
|
+
*/
|
|
660
|
+
export async function collectWorkflowFailures(fetchPage, options) {
|
|
661
|
+
const limit = Math.max(1, options.limit);
|
|
662
|
+
const maxScan = options.maxScan ?? DEFAULT_FAILURE_SWEEP_MAX_SCAN;
|
|
663
|
+
const maxRequests = options.maxRequests ?? FAILURE_SWEEP_MAX_REQUESTS;
|
|
664
|
+
const items = [];
|
|
665
|
+
const seenCursors = new Set();
|
|
666
|
+
let cursor = options.startCursor;
|
|
667
|
+
let scanned = 0;
|
|
668
|
+
let scannedKnown = false;
|
|
669
|
+
let requests = 0;
|
|
670
|
+
// Every other exit is an explicit `break` that sets its own reason, so the
|
|
671
|
+
// initializer is the reason for the one exit that is NOT a break: the `while`
|
|
672
|
+
// condition failing on the request ceiling.
|
|
673
|
+
let stoppedBecause = "request-ceiling";
|
|
674
|
+
while (requests < maxRequests) {
|
|
675
|
+
if (options.shouldStop?.()) {
|
|
676
|
+
stoppedBecause = "interrupted";
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
const page = await fetchPage({
|
|
680
|
+
cursor,
|
|
681
|
+
// The server caps `limit` at 200; ask only for what is still missing so
|
|
682
|
+
// the last request does not over-fetch.
|
|
683
|
+
limit: Math.min(limit - items.length, RUN_LIST_MAX_LIMIT),
|
|
684
|
+
});
|
|
685
|
+
requests++;
|
|
686
|
+
for (const item of page.items ?? []) {
|
|
687
|
+
if (items.length >= limit)
|
|
688
|
+
break;
|
|
689
|
+
items.push(item);
|
|
690
|
+
}
|
|
691
|
+
if (typeof page.scanned === "number") {
|
|
692
|
+
scanned += page.scanned;
|
|
693
|
+
scannedKnown = true;
|
|
694
|
+
}
|
|
695
|
+
options.onProgress?.(scanned, items.length);
|
|
696
|
+
const next = page.nextCursor ?? page.cursor ?? undefined;
|
|
697
|
+
if (!next) {
|
|
698
|
+
cursor = undefined;
|
|
699
|
+
stoppedBecause = "exhausted";
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
if (seenCursors.has(next)) {
|
|
703
|
+
throw new Error(`Pagination cursor did not advance (cursor ${next} repeated); aborting to avoid an infinite loop.`);
|
|
704
|
+
}
|
|
705
|
+
seenCursors.add(next);
|
|
706
|
+
cursor = next;
|
|
707
|
+
if (items.length >= limit) {
|
|
708
|
+
stoppedBecause = "collected";
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
711
|
+
// Checked after the response, because the row budget is only knowable from
|
|
712
|
+
// the server's `scanned` and there is no public parameter to bound a
|
|
713
|
+
// request before issuing it. The overshoot is therefore at most one
|
|
714
|
+
// request's worth of rows — the granularity `--max-scan` is documented
|
|
715
|
+
// with (#2237 review).
|
|
716
|
+
if (maxScan > 0 && scanned >= maxScan) {
|
|
717
|
+
stoppedBecause = "max-scan";
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
return {
|
|
722
|
+
items,
|
|
723
|
+
scanned,
|
|
724
|
+
scannedKnown,
|
|
725
|
+
nextCursor: cursor ?? null,
|
|
726
|
+
requests,
|
|
727
|
+
resumed: !!options.startCursor,
|
|
728
|
+
stoppedBecause,
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* The empty-state line for a run-list PAGE (`runs list`) (#2237).
|
|
733
|
+
*
|
|
734
|
+
* `runs list` stays a pager — its `--limit` is a page size and it does not
|
|
735
|
+
* auto-resume (that would make one flag mean two different things depending on
|
|
736
|
+
* whether `--status` was passed). But a filtered page comes from the same
|
|
737
|
+
* bounded index walk, so "No runs found." asserts the same absence it cannot
|
|
738
|
+
* back up. This says how far the read got and how to continue instead.
|
|
739
|
+
*
|
|
740
|
+
* `resumed` is true when the caller passed `--cursor`: the rows this page
|
|
741
|
+
* examined then start at that position rather than at the head of the index, so
|
|
742
|
+
* calling them "the most recent runs" would be false (#2237 review).
|
|
743
|
+
*/
|
|
744
|
+
export function describeEmptyRunPage(page, resumed = false) {
|
|
745
|
+
const nextCursor = page.nextCursor ?? page.cursor ?? null;
|
|
746
|
+
if (nextCursor) {
|
|
747
|
+
const where = typeof page.scanned === "number"
|
|
748
|
+
? resumed
|
|
749
|
+
? ` in ${page.scanned} runs from this position`
|
|
750
|
+
: ` in the ${page.scanned} most recent runs`
|
|
751
|
+
: " so far";
|
|
752
|
+
return `No matching runs${where}. More history remains — re-run with --cursor ${nextCursor}.`;
|
|
753
|
+
}
|
|
754
|
+
if (typeof page.scanned === "number") {
|
|
755
|
+
return resumed
|
|
756
|
+
? `No matching runs in the remaining ${page.scanned} runs from this position.`
|
|
757
|
+
: `No matching runs. Searched all ${page.scanned} runs.`;
|
|
758
|
+
}
|
|
759
|
+
return "No runs found.";
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* The line `runs failures` prints under (or instead of) its table (#2237).
|
|
763
|
+
*
|
|
764
|
+
* The unconditional "No failures found." was the defect the issue named as
|
|
765
|
+
* "the worst possible failure mode for a triage command": a bounded search
|
|
766
|
+
* that stopped early asserted the absence of failures it had never reached.
|
|
767
|
+
* Every form below either states the search was complete or says how far it
|
|
768
|
+
* got and how to continue — and none of them claims absence it cannot back up.
|
|
769
|
+
*
|
|
770
|
+
* Returns `null` when the result speaks for itself (a full set of failures
|
|
771
|
+
* from a completed search).
|
|
772
|
+
*/
|
|
773
|
+
export function describeFailureSweep(result, limit) {
|
|
774
|
+
const found = result.items.length;
|
|
775
|
+
const complete = result.stoppedBecause === "exhausted";
|
|
776
|
+
// Against a server that does not report `scanned` we still say what we know
|
|
777
|
+
// ("more history remains") — we just do not invent a row count. And on a
|
|
778
|
+
// resumed sweep the rows examined start at the supplied cursor, so they are
|
|
779
|
+
// NOT "the most recent runs" (#2237 review).
|
|
780
|
+
const window = !result.scannedKnown
|
|
781
|
+
? "the runs searched"
|
|
782
|
+
: result.resumed
|
|
783
|
+
? `${result.scanned} runs from this position`
|
|
784
|
+
: `the ${result.scanned} most recent runs`;
|
|
785
|
+
// The request ceiling is independent of `--max-scan`, so a sweep that stopped
|
|
786
|
+
// there must not tell the user to raise a flag that cannot move it.
|
|
787
|
+
const ceiling = result.stoppedBecause === "request-ceiling";
|
|
788
|
+
const resume = result.nextCursor
|
|
789
|
+
? ceiling
|
|
790
|
+
? ` re-run with --cursor ${result.nextCursor} to continue.`
|
|
791
|
+
: ` re-run with --cursor ${result.nextCursor} (or raise --max-scan).`
|
|
792
|
+
: ceiling
|
|
793
|
+
? " re-run to continue the search."
|
|
794
|
+
: " raise --max-scan to keep searching.";
|
|
795
|
+
if (complete) {
|
|
796
|
+
if (found > 0)
|
|
797
|
+
return null;
|
|
798
|
+
if (!result.scannedKnown) {
|
|
799
|
+
return result.resumed
|
|
800
|
+
? "No failures in the rest of this workflow's history from this position."
|
|
801
|
+
: "No failures. Searched all of this workflow's history.";
|
|
802
|
+
}
|
|
803
|
+
return result.resumed
|
|
804
|
+
? `No failures in the remaining ${result.scanned} runs from this position.`
|
|
805
|
+
: `No failures. Searched all ${result.scanned} runs.`;
|
|
806
|
+
}
|
|
807
|
+
const interrupted = result.stoppedBecause === "interrupted" ? "Interrupted. " : "";
|
|
808
|
+
if (found === 0) {
|
|
809
|
+
return `${interrupted}No failures in ${window}. More history remains —${resume}`;
|
|
810
|
+
}
|
|
811
|
+
if (found >= limit) {
|
|
812
|
+
return `${interrupted}${found} failures found in ${window}. More history remains —${resume}`;
|
|
813
|
+
}
|
|
814
|
+
return `${interrupted}${found} of ${limit} requested failures found in ${window}. More history remains —${resume}`;
|
|
815
|
+
}
|
|
816
|
+
//# sourceMappingURL=log-inspection.js.map
|