primitive-admin 1.2.0-alpha.1 → 1.2.0-alpha.11
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 +105 -134
- package/assets/skill/skills/primitive-platform/SKILL.md +37 -4
- package/dist/bin/primitive.js +30 -35
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/agent-sessions.d.ts +133 -0
- package/dist/src/commands/agent-sessions.js +792 -0
- package/dist/src/commands/agent-sessions.js.map +1 -0
- package/dist/src/commands/analytics.js +0 -148
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps-children.d.ts +54 -0
- package/dist/src/commands/apps-children.js +631 -0
- package/dist/src/commands/apps-children.js.map +1 -0
- package/dist/src/commands/apps.d.ts +6 -0
- package/dist/src/commands/apps.js +131 -9
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-sessions.d.ts +3 -3
- package/dist/src/commands/auth-sessions.js +117 -23
- package/dist/src/commands/auth-sessions.js.map +1 -1
- package/dist/src/commands/auth.js +460 -36
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/collections.js +316 -256
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/config.d.ts +1 -1
- package/dist/src/commands/config.js +60 -28
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/connections.js +11 -12
- package/dist/src/commands/connections.js.map +1 -1
- package/dist/src/commands/database-type-configs.js +2 -76
- package/dist/src/commands/database-type-configs.js.map +1 -1
- package/dist/src/commands/databases.d.ts +9 -0
- package/dist/src/commands/databases.js +221 -457
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/db3-types.d.ts +15 -0
- package/dist/src/commands/db3-types.js +157 -0
- package/dist/src/commands/db3-types.js.map +1 -0
- package/dist/src/commands/db3.d.ts +12 -0
- package/dist/src/commands/db3.js +1052 -0
- package/dist/src/commands/db3.js.map +1 -0
- package/dist/src/commands/documents.d.ts +121 -2
- package/dist/src/commands/documents.js +1601 -1251
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/env.d.ts +9 -1
- package/dist/src/commands/env.js +164 -49
- package/dist/src/commands/env.js.map +1 -1
- package/dist/src/commands/function-trigger-commands.d.ts +28 -0
- package/dist/src/commands/function-trigger-commands.js +341 -0
- package/dist/src/commands/function-trigger-commands.js.map +1 -0
- package/dist/src/commands/functions.js +297 -24
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/groups.js +150 -49
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.js +5 -5
- package/dist/src/commands/init.d.ts +7 -0
- package/dist/src/commands/init.js +23 -5
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +14 -8
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.d.ts +2 -2
- package/dist/src/commands/metadata-category-configs.js +2 -2
- package/dist/src/commands/prompts.d.ts +7 -0
- package/dist/src/commands/prompts.js +48 -5
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +9 -17
- package/dist/src/commands/scripts.js +24 -479
- package/dist/src/commands/scripts.js.map +1 -1
- package/dist/src/commands/sync-app-settings.d.ts +36 -8
- package/dist/src/commands/sync-app-settings.js +109 -23
- package/dist/src/commands/sync-app-settings.js.map +1 -1
- package/dist/src/commands/sync.d.ts +360 -610
- package/dist/src/commands/sync.js +3151 -6697
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.js +3 -3
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/users.js +77 -2
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +5 -83
- package/dist/src/commands/workflows.js +57 -2282
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/aggregate-output.d.ts +25 -0
- package/dist/src/lib/aggregate-output.js +53 -0
- package/dist/src/lib/aggregate-output.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +681 -551
- package/dist/src/lib/api-client.js +880 -814
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +47 -1
- package/dist/src/lib/app-settings-descriptor.js +114 -10
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/auth-fixtures.d.ts +44 -0
- package/dist/src/lib/auth-fixtures.js +61 -0
- package/dist/src/lib/auth-fixtures.js.map +1 -0
- package/dist/src/lib/auth-flow.d.ts +41 -1
- package/dist/src/lib/auth-flow.js +70 -16
- package/dist/src/lib/auth-flow.js.map +1 -1
- package/dist/src/lib/block-layout.d.ts +12 -23
- package/dist/src/lib/block-layout.js +26 -92
- package/dist/src/lib/block-layout.js.map +1 -1
- package/dist/src/lib/block-selector.d.ts +2 -2
- package/dist/src/lib/block-selector.js +2 -2
- package/dist/src/lib/child-apps-local.d.ts +164 -0
- package/dist/src/lib/child-apps-local.js +258 -0
- package/dist/src/lib/child-apps-local.js.map +1 -0
- package/dist/src/lib/ci-session-request.d.ts +22 -0
- package/dist/src/lib/ci-session-request.js +51 -0
- package/dist/src/lib/ci-session-request.js.map +1 -0
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +10 -8
- package/dist/src/lib/codegen-shared/generatedFiles.js +21 -15
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +1 -1
- package/dist/src/lib/codegen-shared/prettierStable.js +1 -1
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +2 -2
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +2 -2
- package/dist/src/lib/collection-export.d.ts +76 -15
- package/dist/src/lib/collection-export.js +116 -23
- package/dist/src/lib/collection-export.js.map +1 -1
- package/dist/src/lib/collection-principal.d.ts +22 -0
- package/dist/src/lib/collection-principal.js +35 -0
- package/dist/src/lib/collection-principal.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +3 -22
- package/dist/src/lib/config-object-descriptor.js +56 -290
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/config-payload.js +2 -3
- package/dist/src/lib/config-payload.js.map +1 -1
- package/dist/src/lib/config-surface.d.ts +5 -7
- package/dist/src/lib/config-surface.js +18 -40
- package/dist/src/lib/config-surface.js.map +1 -1
- package/dist/src/lib/connections-list.d.ts +10 -0
- package/dist/src/lib/connections-list.js +18 -0
- package/dist/src/lib/connections-list.js.map +1 -0
- package/dist/src/lib/credentials-home.d.ts +58 -0
- package/dist/src/lib/credentials-home.js +204 -0
- package/dist/src/lib/credentials-home.js.map +1 -0
- package/dist/src/lib/credentials-lock.d.ts +88 -0
- package/dist/src/lib/credentials-lock.js +302 -0
- package/dist/src/lib/credentials-lock.js.map +1 -0
- package/dist/src/lib/credentials-store.d.ts +179 -24
- package/dist/src/lib/credentials-store.js +712 -77
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/csv.d.ts +8 -9
- package/dist/src/lib/csv.js +3 -4
- package/dist/src/lib/csv.js.map +1 -1
- package/dist/src/lib/custodian.d.ts +8 -0
- package/dist/src/lib/custodian.js +18 -0
- package/dist/src/lib/custodian.js.map +1 -0
- package/dist/src/lib/db-codegen/dbGenerator.js +5 -16
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +5 -13
- package/dist/src/lib/db-codegen/dbNaming.js +5 -17
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +7 -56
- package/dist/src/lib/db-codegen/dbTemplates.js +25 -125
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +2 -2
- package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +67 -2
- package/dist/src/lib/db-codegen/dbTypeIR.js +13 -2
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db3-export.d.ts +231 -0
- package/dist/src/lib/db3-export.js +510 -0
- package/dist/src/lib/db3-export.js.map +1 -0
- package/dist/src/lib/db3-index-output.d.ts +27 -0
- package/dist/src/lib/db3-index-output.js +49 -0
- package/dist/src/lib/db3-index-output.js.map +1 -0
- package/dist/src/lib/document-export-lookups.d.ts +31 -0
- package/dist/src/lib/document-export-lookups.js +53 -0
- package/dist/src/lib/document-export-lookups.js.map +1 -0
- package/dist/src/lib/document-export-permissions.d.ts +7 -5
- package/dist/src/lib/document-export-permissions.js +7 -5
- package/dist/src/lib/document-export-permissions.js.map +1 -1
- package/dist/src/lib/document-export-record-log.d.ts +57 -0
- package/dist/src/lib/document-export-record-log.js +215 -0
- package/dist/src/lib/document-export-record-log.js.map +1 -0
- package/dist/src/lib/document-ingest-artifact.d.ts +26 -2
- package/dist/src/lib/document-ingest-artifact.js +42 -8
- package/dist/src/lib/document-ingest-artifact.js.map +1 -1
- package/dist/src/lib/document-ingest-format2.d.ts +36 -0
- package/dist/src/lib/document-ingest-format2.js +78 -0
- package/dist/src/lib/document-ingest-format2.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +9 -0
- package/dist/src/lib/document-ingest-input.js +28 -1
- package/dist/src/lib/document-ingest-input.js.map +1 -1
- package/dist/src/lib/document-ingest-rows.d.ts +16 -0
- package/dist/src/lib/document-ingest-rows.js +17 -0
- package/dist/src/lib/document-ingest-rows.js.map +1 -1
- package/dist/src/lib/document-ingest.d.ts +33 -1
- package/dist/src/lib/document-ingest.js +49 -0
- package/dist/src/lib/document-ingest.js.map +1 -1
- package/dist/src/lib/document-schema-rows.d.ts +42 -0
- package/dist/src/lib/document-schema-rows.js +53 -0
- package/dist/src/lib/document-schema-rows.js.map +1 -0
- package/dist/src/lib/env-resolver-core.d.ts +70 -2
- package/dist/src/lib/env-resolver-core.js +137 -20
- package/dist/src/lib/env-resolver-core.js.map +1 -1
- package/dist/src/lib/env-resolver.d.ts +14 -2
- package/dist/src/lib/env-resolver.js +32 -10
- package/dist/src/lib/env-resolver.js.map +1 -1
- package/dist/src/lib/function-authorize-check.d.ts +142 -0
- package/dist/src/lib/function-authorize-check.js +310 -0
- package/dist/src/lib/function-authorize-check.js.map +1 -0
- package/dist/src/lib/function-authorize-view.d.ts +15 -0
- package/dist/src/lib/function-authorize-view.js +50 -0
- package/dist/src/lib/function-authorize-view.js.map +1 -0
- package/dist/src/lib/function-bundle.d.ts +38 -18
- package/dist/src/lib/function-bundle.js +96 -35
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +75 -12
- package/dist/src/lib/function-collect.js +427 -12
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +29 -0
- package/dist/src/lib/function-db-types.js +117 -7
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-document-types.d.ts +5 -3
- package/dist/src/lib/function-document-types.js +10 -14
- package/dist/src/lib/function-document-types.js.map +1 -1
- package/dist/src/lib/function-lint.d.ts +34 -0
- package/dist/src/lib/function-lint.js +112 -0
- package/dist/src/lib/function-lint.js.map +1 -0
- package/dist/src/lib/function-log-row.js +21 -2
- package/dist/src/lib/function-log-row.js.map +1 -1
- package/dist/src/lib/function-run.d.ts +16 -21
- package/dist/src/lib/function-run.js +37 -30
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +1 -1
- package/dist/src/lib/function-schema-codegen.js +5 -5
- package/dist/src/lib/function-schema-codegen.js.map +1 -1
- package/dist/src/lib/function-source-roots.d.ts +67 -0
- package/dist/src/lib/function-source-roots.js +148 -0
- package/dist/src/lib/function-source-roots.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +108 -22
- package/dist/src/lib/function-sync.js +127 -39
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-trigger-listing.d.ts +11 -6
- package/dist/src/lib/function-trigger-listing.js +32 -11
- package/dist/src/lib/function-trigger-listing.js.map +1 -1
- package/dist/src/lib/function-typecheck.d.ts +37 -2
- package/dist/src/lib/function-typecheck.js +210 -28
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/function-versions.d.ts +2 -0
- package/dist/src/lib/function-versions.js +1 -0
- package/dist/src/lib/function-versions.js.map +1 -1
- package/dist/src/lib/generated-allowlist.js +0 -20
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +703 -203
- package/dist/src/lib/generated-config-surfaces.js +2270 -2014
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/init-adopt.js +12 -3
- package/dist/src/lib/init-adopt.js.map +1 -1
- package/dist/src/lib/init-login-note.d.ts +13 -0
- package/dist/src/lib/init-login-note.js +22 -0
- package/dist/src/lib/init-login-note.js.map +1 -0
- package/dist/src/lib/json-value.d.ts +6 -0
- package/dist/src/lib/json-value.js +13 -0
- package/dist/src/lib/json-value.js.map +1 -0
- package/dist/src/lib/load-routes.d.ts +33 -0
- package/dist/src/lib/load-routes.js +35 -0
- package/dist/src/lib/load-routes.js.map +1 -0
- package/dist/src/lib/local-state.d.ts +38 -7
- package/dist/src/lib/local-state.js +172 -49
- package/dist/src/lib/local-state.js.map +1 -1
- package/dist/src/lib/local-test-cases.d.ts +5 -2
- package/dist/src/lib/local-test-cases.js +7 -4
- package/dist/src/lib/local-test-cases.js.map +1 -1
- package/dist/src/lib/log-inspection.d.ts +42 -4
- package/dist/src/lib/log-inspection.js +37 -5
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/login-exchange-check.d.ts +18 -0
- package/dist/src/lib/login-exchange-check.js +27 -0
- package/dist/src/lib/login-exchange-check.js.map +1 -0
- package/dist/src/lib/login-scope-lines.d.ts +25 -0
- package/dist/src/lib/login-scope-lines.js +45 -0
- package/dist/src/lib/login-scope-lines.js.map +1 -0
- package/dist/src/lib/logout-admin-session.d.ts +2 -1
- package/dist/src/lib/logout-admin-session.js +7 -1
- package/dist/src/lib/logout-admin-session.js.map +1 -1
- package/dist/src/lib/object-status-filter.d.ts +9 -1
- package/dist/src/lib/object-status-filter.js +9 -1
- package/dist/src/lib/object-status-filter.js.map +1 -1
- package/dist/src/lib/output.js +2 -0
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/paginate.d.ts +0 -5
- package/dist/src/lib/paginate.js +0 -5
- package/dist/src/lib/paginate.js.map +1 -1
- package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
- package/dist/src/lib/pin-refusal-hint.js +35 -0
- package/dist/src/lib/pin-refusal-hint.js.map +1 -0
- package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
- package/dist/src/lib/primitive-env-plugin.js +408 -0
- package/dist/src/lib/primitive-env-plugin.js.map +1 -0
- package/dist/src/lib/project-config.d.ts +7 -0
- package/dist/src/lib/project-config.js +22 -1
- package/dist/src/lib/project-config.js.map +1 -1
- package/dist/src/lib/project-login-apps.d.ts +8 -0
- package/dist/src/lib/project-login-apps.js +27 -0
- package/dist/src/lib/project-login-apps.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +10 -3
- package/dist/src/lib/prompt-schema-codegen.js +52 -11
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
- package/dist/src/lib/pull-write.d.ts +31 -0
- package/dist/src/lib/pull-write.js +49 -0
- package/dist/src/lib/pull-write.js.map +1 -0
- package/dist/src/lib/push-failure-report.d.ts +45 -0
- package/dist/src/lib/push-failure-report.js +57 -0
- package/dist/src/lib/push-failure-report.js.map +1 -0
- package/dist/src/lib/records-verbs.d.ts +69 -0
- package/dist/src/lib/records-verbs.js +40 -0
- package/dist/src/lib/records-verbs.js.map +1 -0
- package/dist/src/lib/refresh-admin-credentials.d.ts +7 -0
- package/dist/src/lib/refresh-admin-credentials.js +16 -4
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
- package/dist/src/lib/root-import-decision.d.ts +65 -0
- package/dist/src/lib/root-import-decision.js +109 -0
- package/dist/src/lib/root-import-decision.js.map +1 -0
- package/dist/src/lib/run-status.d.ts +1 -1
- package/dist/src/lib/run-status.generated.d.ts +2 -2
- package/dist/src/lib/run-status.generated.js +3 -1
- package/dist/src/lib/run-status.generated.js.map +1 -1
- package/dist/src/lib/run-status.js +1 -1
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +269 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
- package/dist/src/lib/schema-codegen/naming.js +83 -0
- package/dist/src/lib/schema-codegen/naming.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaToTs.d.ts +82 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js +305 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/scope-request.d.ts +84 -0
- package/dist/src/lib/scope-request.js +235 -0
- package/dist/src/lib/scope-request.js.map +1 -0
- package/dist/src/lib/session-id.d.ts +9 -0
- package/dist/src/lib/session-id.js +28 -0
- package/dist/src/lib/session-id.js.map +1 -0
- package/dist/src/lib/snapshot-build-rows.d.ts +21 -0
- package/dist/src/lib/snapshot-build-rows.js +22 -0
- package/dist/src/lib/snapshot-build-rows.js.map +1 -1
- package/dist/src/lib/snapshot-build.js +8 -3
- package/dist/src/lib/snapshot-build.js.map +1 -1
- package/dist/src/lib/snapshots.d.ts +17 -1
- package/dist/src/lib/snapshots.js +50 -2
- package/dist/src/lib/snapshots.js.map +1 -1
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +6 -2
- package/dist/src/lib/swift-codegen/agentGenerator.js +57 -5
- package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/banners.d.ts +34 -7
- package/dist/src/lib/swift-codegen/banners.js +37 -7
- package/dist/src/lib/swift-codegen/banners.js.map +1 -1
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +4 -3
- package/dist/src/lib/swift-codegen/dbGenerator.js +14 -117
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +3 -3
- package/dist/src/lib/swift-codegen/functionGenerator.js +23 -18
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/generator.d.ts +5 -5
- package/dist/src/lib/swift-codegen/generator.js +35 -40
- package/dist/src/lib/swift-codegen/generator.js.map +1 -1
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +3 -3
- package/dist/src/lib/swift-codegen/schemaToSwift.js +4 -4
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
- package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
- package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
- package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
- package/dist/src/lib/sync-paths.d.ts +35 -0
- package/dist/src/lib/sync-paths.js +57 -5
- package/dist/src/lib/sync-paths.js.map +1 -1
- package/dist/src/lib/sync-resource-types.d.ts +26 -26
- package/dist/src/lib/sync-resource-types.js +61 -189
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +5 -1
- package/dist/src/lib/sync-selectors.js +23 -13
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/dist/src/lib/test-case-file-names.d.ts +3 -5
- package/dist/src/lib/test-case-file-names.js +3 -5
- package/dist/src/lib/test-case-file-names.js.map +1 -1
- package/dist/src/lib/toml-database-config.d.ts +15 -75
- package/dist/src/lib/toml-database-config.js +17 -306
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/transient-retry.d.ts +43 -0
- package/dist/src/lib/transient-retry.js +94 -0
- package/dist/src/lib/transient-retry.js.map +1 -0
- package/dist/src/lib/vars-override.d.ts +105 -0
- package/dist/src/lib/vars-override.js +143 -0
- package/dist/src/lib/vars-override.js.map +1 -0
- package/dist/src/lib/webhook-capture.d.ts +43 -0
- package/dist/src/lib/webhook-capture.js +91 -0
- package/dist/src/lib/webhook-capture.js.map +1 -0
- package/dist/src/lib/webhook-deliver.d.ts +18 -20
- package/dist/src/lib/webhook-deliver.js +34 -89
- package/dist/src/lib/webhook-deliver.js.map +1 -1
- package/dist/src/lib/webhook-test-run.d.ts +32 -0
- package/dist/src/lib/webhook-test-run.js +108 -0
- package/dist/src/lib/webhook-test-run.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +7 -7
- package/dist/src/lib/workflow-codegen/generator.js +16 -23
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +6 -12
- package/dist/src/lib/workflow-codegen/invokerIR.js +4 -5
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
- package/dist/src/lib/workflow-toml-validator.d.ts +2 -0
- package/dist/src/lib/workflow-toml-validator.js +28 -1
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/dist/src/types/index.d.ts +30 -37
- package/dist/src/validators.d.ts +7 -55
- package/dist/src/validators.js +7 -53
- package/dist/src/validators.js.map +1 -1
- package/dist/src/vite.d.ts +17 -0
- package/dist/src/vite.js +18 -0
- package/dist/src/vite.js.map +1 -0
- package/package.json +20 -12
|
@@ -15,11 +15,21 @@
|
|
|
15
15
|
* trip is therefore loud-and-lossy — push omits what it does not know, so
|
|
16
16
|
* the server keeps its stored values — never silently destructive.
|
|
17
17
|
*/
|
|
18
|
-
import { GENERATED_CONFIG_MODEL_FIELDS, acceptedTomlKeys, findUnknownGroupedTomlKeys, tomlGroupsOf, retiredConfigKey, findMisshapenTomlTables, findUnknownTomlDocumentKeys, getConfigSurface, getConfigTable, recognizedResponseKeys, } from "./generated-config-surfaces.js";
|
|
18
|
+
import { GENERATED_CONFIG_MODEL_FIELDS, acceptedTomlKeys, findUnknownGroupedTomlKeys, tomlGroupsOf, retiredConfigKey, retiredTomlKey, retiredDocumentKey, deprecatedConfigKey, findMisshapenTomlTables, findUnknownTomlDocumentKeys, getConfigSurface, getConfigTable, recognizedResponseKeys, } from "./generated-config-surfaces.js";
|
|
19
19
|
// #2645/#2803 — the guidance for a key a definition deliberately RETIRED. Its
|
|
20
20
|
// text is vendored with the definitions so `config push` and the server's
|
|
21
21
|
// create/update handlers say the same thing about the same key.
|
|
22
22
|
export { retiredConfigKey };
|
|
23
|
+
// #3642 — the same guidance for `config push`, widened to spellings retired
|
|
24
|
+
// from TOML only (the flat chat keys under `[[configs]]`), which the request
|
|
25
|
+
// side must never see.
|
|
26
|
+
export { retiredTomlKey };
|
|
27
|
+
// #4872 — the dated sentence for a key a definition DEPRECATED: still
|
|
28
|
+
// accepted and ignored, and named once per file by `config push`.
|
|
29
|
+
export { deprecatedConfigKey };
|
|
30
|
+
// #3189 — the same guidance for a top-level TABLE a file type retired
|
|
31
|
+
// (`[[operations]]`, `[[subscriptions]]` in a database type file).
|
|
32
|
+
export { retiredDocumentKey };
|
|
23
33
|
// #3626 — keys inside a `[configs.<group>]` block that no field declares
|
|
24
34
|
// under it. Re-exported beside `findUnknownTomlKeys` so a caller checking a
|
|
25
35
|
// table's keys needs one import for both halves of the same question.
|
|
@@ -42,9 +52,7 @@ export function requireConfigTable(label, tomlPath) {
|
|
|
42
52
|
}
|
|
43
53
|
return table;
|
|
44
54
|
}
|
|
45
|
-
|
|
46
|
-
export const WORKFLOW_TABLE = requireConfigTable("workflow", ["workflow"]);
|
|
47
|
-
// The six flat per-entity objects (#2644 phase 2). Resolved once, at module
|
|
55
|
+
// The flat per-entity objects (#2644 phase 2). Resolved once, at module
|
|
48
56
|
// load, so a missing or misspelled definition fails immediately and loudly
|
|
49
57
|
// rather than at the moment someone runs a pull.
|
|
50
58
|
export const PROMPT_TABLE = requireConfigTable("prompt", ["prompt"]);
|
|
@@ -52,10 +60,6 @@ export const PROMPT_CONFIG_TABLE = requireConfigTable("prompt", ["configs"]);
|
|
|
52
60
|
export const INTEGRATION_TABLE = requireConfigTable("integration", [
|
|
53
61
|
"integration",
|
|
54
62
|
]);
|
|
55
|
-
export const WEBHOOK_TABLE = requireConfigTable("webhook", ["webhook"]);
|
|
56
|
-
export const CRON_TRIGGER_TABLE = requireConfigTable("cron-trigger", [
|
|
57
|
-
"cronTrigger",
|
|
58
|
-
]);
|
|
59
63
|
export const BLOB_BUCKET_TABLE = requireConfigTable("blob-bucket", ["bucket"]);
|
|
60
64
|
export const EMAIL_TEMPLATE_TABLE = requireConfigTable("email-template", [
|
|
61
65
|
"template",
|
|
@@ -66,15 +70,14 @@ export const EMAIL_TEMPLATE_TABLE = requireConfigTable("email-template", [
|
|
|
66
70
|
export const SERVER_FUNCTION_TABLE = requireConfigTable("function", [
|
|
67
71
|
"function",
|
|
68
72
|
]);
|
|
69
|
-
// The
|
|
73
|
+
// The structured objects (#2644 phase 3; the group and collection type
|
|
74
|
+
// configs retired with #4731). Their authored sub-trees —
|
|
70
75
|
// `[rules]`, `[models.*]`, `[triggers]`, the `[metadata]` manifest — keep the
|
|
71
76
|
// validators that already own them; these tables are the scalar surface.
|
|
72
77
|
export const DATABASE_TYPE_TABLE = requireConfigTable("database-type-config", ["type"]);
|
|
78
|
+
// #4802 — a db3 type file's `[type]` table: the database type's, named by `name`.
|
|
79
|
+
export const DB3_TYPE_TABLE = requireConfigTable("db3-type", ["type"]);
|
|
73
80
|
export const RULE_SET_TABLE = requireConfigTable("rule-set", ["ruleSet"]);
|
|
74
|
-
export const GROUP_TYPE_CONFIG_TABLE = requireConfigTable("group-type-config", [
|
|
75
|
-
"groupTypeConfig",
|
|
76
|
-
]);
|
|
77
|
-
export const COLLECTION_TYPE_CONFIG_TABLE = requireConfigTable("collection-type-config", ["collectionTypeConfig"]);
|
|
78
81
|
export const METADATA_CATEGORY_CONFIG_TABLE = requireConfigTable("metadata-category-config", ["metadataCategoryConfig"]);
|
|
79
82
|
/**
|
|
80
83
|
* The `[test]` table of a `<key>.tests/*.toml` sidecar (#2644 phase 3).
|
|
@@ -186,16 +189,6 @@ function readTomlTable(value) {
|
|
|
186
189
|
? value
|
|
187
190
|
: undefined;
|
|
188
191
|
}
|
|
189
|
-
/**
|
|
190
|
-
* Is `key` a spelling this table still accepts but has superseded (#3626)?
|
|
191
|
-
*
|
|
192
|
-
* The nine flat chat keys are the first: declared in `tomlOnlyKeys` with
|
|
193
|
-
* `kind: "deprecated"` so an unmigrated prompt file keeps pushing, while the
|
|
194
|
-
* field itself is authored inside `[configs.chat]`.
|
|
195
|
-
*/
|
|
196
|
-
function isDeprecatedTomlKey(table, key) {
|
|
197
|
-
return table.tomlOnlyKeys?.[key]?.kind === "deprecated";
|
|
198
|
-
}
|
|
199
192
|
/**
|
|
200
193
|
* Every value in `tomlData` whose spelling does not match the type its field
|
|
201
194
|
* declares (#2880 criterion 5).
|
|
@@ -232,25 +225,10 @@ export function configDeclaredTypeErrors(filePath, tomlData, table) {
|
|
|
232
225
|
// mistyped `[configs.agent].temperature` names `agent`.
|
|
233
226
|
const groups = tomlGroupsOf(field);
|
|
234
227
|
const groupName = groups.find((name) => readTomlTable(entry.value[name])?.[field.tomlKey] !== undefined) ?? groups[0];
|
|
235
|
-
|
|
228
|
+
const container = readTomlTable(groupName
|
|
236
229
|
? entry.value[groupName]
|
|
237
230
|
: entry.value);
|
|
238
|
-
|
|
239
|
-
// #3626, CR3626-003 — a grouped key whose FLAT spelling the table still
|
|
240
|
-
// accepts as DEPRECATED is read where the file actually wrote it. The
|
|
241
|
-
// grouping moved the reader into the sub-table, which silently took the
|
|
242
|
-
// declared-type check away from every unmigrated file: a flat
|
|
243
|
-
// `temperature = "hot"` passed the preflight it used to fail and was
|
|
244
|
-
// hoisted into the payload unread. Accepting the old spelling has to mean
|
|
245
|
-
// accepting it on the same terms, so the root value is checked — and
|
|
246
|
-
// labelled at the root, because that is the line the author has to fix.
|
|
247
|
-
if (groupName &&
|
|
248
|
-
container?.[field.tomlKey] === undefined &&
|
|
249
|
-
isDeprecatedTomlKey(table, field.tomlKey) &&
|
|
250
|
-
entry.value[field.tomlKey] !== undefined) {
|
|
251
|
-
container = entry.value;
|
|
252
|
-
label = entry.label;
|
|
253
|
-
}
|
|
231
|
+
const label = groupName ? `${entry.label}.${groupName}` : entry.label;
|
|
254
232
|
if (!container)
|
|
255
233
|
continue;
|
|
256
234
|
const value = container[field.tomlKey];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-surface.js","sourceRoot":"","sources":["../../../src/lib/config-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,EAChB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,sBAAsB,GAIvB,MAAM,gCAAgC,CAAC;AAExC,8EAA8E;AAC9E,0EAA0E;AAC1E,gEAAgE;AAChE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,yEAAyE;AACzE,4EAA4E;AAC5E,sEAAsE;AACtE,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC,uEAAuE;AACvE,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,sCAAsC,KAAK,KAAK;YAC9C,iDAAiD,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,kBAAkB,CAChC,KAAa,EACb,QAA2B;IAE3B,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,sCAAsC,KAAK,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK;YACtE,iDAAiD,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"config-surface.js","sourceRoot":"","sources":["../../../src/lib/config-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,EAChB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,sBAAsB,GAIvB,MAAM,gCAAgC,CAAC;AAExC,8EAA8E;AAC9E,0EAA0E;AAC1E,gEAAgE;AAChE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,4EAA4E;AAC5E,6EAA6E;AAC7E,uBAAuB;AACvB,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,sEAAsE;AACtE,kEAAkE;AAClE,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,sEAAsE;AACtE,mEAAmE;AACnE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,yEAAyE;AACzE,4EAA4E;AAC5E,sEAAsE;AACtE,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC,uEAAuE;AACvE,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,sCAAsC,KAAK,KAAK;YAC9C,iDAAiD,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,kBA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AC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnD,OAAO,CACL,GAAG,IAAI,iCAAiC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI;QACxE,GAAG,KAAK,kEAAkE;QAC1E,0DAA0D,CAC3D,CAAC;AACJ,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,qBAAqB,CACnC,IAAY,EACZ,GAAW,EACX,QAAqC;IAErC,OAAO,QAAQ,KAAK,iBAAiB;QACnC,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,6CAA6C,GAAG,QAAQ;YACvE,uBAAuB;QAC3B,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,iCAAiC,GAAG,cAAc;YACjE,kBAAkB,CAAC;AAC3B,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,2BAA2B,CACzC,IAAY,EACZ,QAA2B,EAC3B,IAAuB;IAEvB,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,OAAO,CACL,GAAG,IAAI,qBAAqB,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM;QAC9D,IAAI,MAAM,MAAM,KAAK,YAAY,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,MAAM;QACxE,uDAAuD,CACxD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lines `primitive connections list` prints for a page with no rows.
|
|
3
|
+
*
|
|
4
|
+
* The listing drops legacy rows (a retired database subscription's mapping,
|
|
5
|
+
* #3189) after it reads a page, so a page can answer no items AND a cursor:
|
|
6
|
+
* the connections are on a later page. Saying "none found" there would end
|
|
7
|
+
* the search where it should continue, so the cursor hint is printed
|
|
8
|
+
* whenever there is one.
|
|
9
|
+
*/
|
|
10
|
+
export declare function emptyConnectionsPageLines(nextCursor: string | null | undefined): string[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lines `primitive connections list` prints for a page with no rows.
|
|
3
|
+
*
|
|
4
|
+
* The listing drops legacy rows (a retired database subscription's mapping,
|
|
5
|
+
* #3189) after it reads a page, so a page can answer no items AND a cursor:
|
|
6
|
+
* the connections are on a later page. Saying "none found" there would end
|
|
7
|
+
* the search where it should continue, so the cursor hint is printed
|
|
8
|
+
* whenever there is one.
|
|
9
|
+
*/
|
|
10
|
+
export function emptyConnectionsPageLines(nextCursor) {
|
|
11
|
+
if (!nextCursor)
|
|
12
|
+
return ["No live connections found."];
|
|
13
|
+
return [
|
|
14
|
+
"No live connections on this page.",
|
|
15
|
+
`More results available. Re-run with --cursor ${nextCursor}`,
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=connections-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connections-list.js","sourceRoot":"","sources":["../../../src/lib/connections-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAqC;IAC7E,IAAI,CAAC,UAAU;QAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACvD,OAAO;QACL,mCAAmC;QACnC,gDAAgD,UAAU,EAAE;KAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a project's login lives (#4492).
|
|
3
|
+
*
|
|
4
|
+
* A project's credentials file is `<projectRoot>/.primitive/credentials.json`,
|
|
5
|
+
* except in a linked git worktree: there it is the main worktree's file for
|
|
6
|
+
* the same project, so a new worktree of a logged-in project is logged in.
|
|
7
|
+
* Every worktree reads and writes that one file; everything else under
|
|
8
|
+
* `.primitive/` (the selection, machine-local environments, sync state,
|
|
9
|
+
* backups) stays per worktree.
|
|
10
|
+
*
|
|
11
|
+
* The answer is the project root itself whenever there is no main checkout to
|
|
12
|
+
* share with: outside a git repository, without a git that knows
|
|
13
|
+
* `--path-format` (2.31), in the main worktree, in a bare repository's
|
|
14
|
+
* worktrees, and in a linked worktree whose main checkout does not hold the
|
|
15
|
+
* project. Nothing here throws.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The project root whose `.primitive/credentials.json` holds `projectRoot`'s
|
|
19
|
+
* login: the same project in the main worktree when `projectRoot` is in a
|
|
20
|
+
* linked git worktree and the main worktree holds the project, otherwise
|
|
21
|
+
* `projectRoot` itself. Cached per process per project root.
|
|
22
|
+
*/
|
|
23
|
+
export declare function credentialsRootFor(projectRoot: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Forget every cached {@link credentialsRootFor} answer. One invocation
|
|
26
|
+
* resolves one project, so nothing in the CLI calls this; it exists for tests.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resetCredentialsHomeCache(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the nearest `.git` above `projectRoot` is a file, which is how a
|
|
31
|
+
* linked worktree is marked. Read without running git.
|
|
32
|
+
*/
|
|
33
|
+
export declare function linkedWorktreeMarker(projectRoot: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Why a linked worktree is not using the main checkout's login, when that is
|
|
36
|
+
* git's doing: git could not answer and the project sits in a linked
|
|
37
|
+
* worktree. Null otherwise.
|
|
38
|
+
*/
|
|
39
|
+
export declare function oldGitHint(projectRoot: string): string | null;
|
|
40
|
+
/**
|
|
41
|
+
* The linked worktree's own `.primitive/credentials.json` when it exists but
|
|
42
|
+
* the main worktree's is the one used, or null. It is never read or changed.
|
|
43
|
+
*/
|
|
44
|
+
export declare function ignoredLocalCredentialsFile(projectRoot: string): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* How many worktrees of `projectRoot`'s repository hold the project and share
|
|
47
|
+
* its login: the worktrees `git worktree list` names, except a bare entry,
|
|
48
|
+
* whose copy of the project resolves to the same credentials home. At least
|
|
49
|
+
* 1; 1 on any git failure.
|
|
50
|
+
*/
|
|
51
|
+
export declare function sharedWorktreeCount(projectRoot: string): number;
|
|
52
|
+
/**
|
|
53
|
+
* The other copies of `projectRoot`'s project that share its credentials file
|
|
54
|
+
* (#4512): the project in every other worktree whose login is the same file.
|
|
55
|
+
* Empty outside a git checkout; null when git cannot answer inside one, so a
|
|
56
|
+
* caller never takes "no other worktree" for an answer it did not get.
|
|
57
|
+
*/
|
|
58
|
+
export declare function otherSharingProjectRoots(projectRoot: string): string[] | null;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a project's login lives (#4492).
|
|
3
|
+
*
|
|
4
|
+
* A project's credentials file is `<projectRoot>/.primitive/credentials.json`,
|
|
5
|
+
* except in a linked git worktree: there it is the main worktree's file for
|
|
6
|
+
* the same project, so a new worktree of a logged-in project is logged in.
|
|
7
|
+
* Every worktree reads and writes that one file; everything else under
|
|
8
|
+
* `.primitive/` (the selection, machine-local environments, sync state,
|
|
9
|
+
* backups) stays per worktree.
|
|
10
|
+
*
|
|
11
|
+
* The answer is the project root itself whenever there is no main checkout to
|
|
12
|
+
* share with: outside a git repository, without a git that knows
|
|
13
|
+
* `--path-format` (2.31), in the main worktree, in a bare repository's
|
|
14
|
+
* worktrees, and in a linked worktree whose main checkout does not hold the
|
|
15
|
+
* project. Nothing here throws.
|
|
16
|
+
*/
|
|
17
|
+
import { execFileSync } from "child_process";
|
|
18
|
+
import { existsSync, realpathSync, statSync } from "fs";
|
|
19
|
+
import { basename, dirname, isAbsolute, join, relative } from "path";
|
|
20
|
+
import { PROJECT_CONFIG_FILENAME, PROJECT_LOCAL_STATE_DIR, PROJECT_TREE_DIR, } from "./env-resolver-core.js";
|
|
21
|
+
const resolutions = new Map();
|
|
22
|
+
function git(cwd, args) {
|
|
23
|
+
return execFileSync("git", args, {
|
|
24
|
+
cwd,
|
|
25
|
+
encoding: "utf-8",
|
|
26
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
27
|
+
}).trim();
|
|
28
|
+
}
|
|
29
|
+
/** The project root's path relative to its worktree's top level, or null. */
|
|
30
|
+
function relativeToTopLevel(topLevel, projectRoot) {
|
|
31
|
+
const rel = relative(realpathSync(topLevel), realpathSync(projectRoot));
|
|
32
|
+
return rel.startsWith("..") || isAbsolute(rel) ? null : rel;
|
|
33
|
+
}
|
|
34
|
+
function holdsProject(projectRoot) {
|
|
35
|
+
return existsSync(join(projectRoot, PROJECT_TREE_DIR, PROJECT_CONFIG_FILENAME));
|
|
36
|
+
}
|
|
37
|
+
function resolve(projectRoot) {
|
|
38
|
+
const own = { root: projectRoot, gitFailed: false };
|
|
39
|
+
let gitDir;
|
|
40
|
+
let commonDir;
|
|
41
|
+
let topLevel;
|
|
42
|
+
try {
|
|
43
|
+
[gitDir, commonDir, topLevel] = git(projectRoot, [
|
|
44
|
+
"rev-parse",
|
|
45
|
+
"--path-format=absolute",
|
|
46
|
+
"--git-dir",
|
|
47
|
+
"--git-common-dir",
|
|
48
|
+
"--show-toplevel",
|
|
49
|
+
]).split("\n");
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return { root: projectRoot, gitFailed: true };
|
|
53
|
+
}
|
|
54
|
+
if (!gitDir || !commonDir || !topLevel)
|
|
55
|
+
return own;
|
|
56
|
+
if (gitDir === commonDir)
|
|
57
|
+
return own; // the main worktree
|
|
58
|
+
if (basename(commonDir) !== ".git")
|
|
59
|
+
return own; // a bare repository's worktree
|
|
60
|
+
try {
|
|
61
|
+
const rel = relativeToTopLevel(topLevel, projectRoot);
|
|
62
|
+
if (rel === null)
|
|
63
|
+
return own;
|
|
64
|
+
const candidate = join(dirname(commonDir), rel);
|
|
65
|
+
return holdsProject(candidate) ? { root: candidate, gitFailed: false } : own;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return own;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function resolutionFor(projectRoot) {
|
|
72
|
+
let resolution = resolutions.get(projectRoot);
|
|
73
|
+
if (!resolution) {
|
|
74
|
+
resolution = resolve(projectRoot);
|
|
75
|
+
resolutions.set(projectRoot, resolution);
|
|
76
|
+
}
|
|
77
|
+
return resolution;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The project root whose `.primitive/credentials.json` holds `projectRoot`'s
|
|
81
|
+
* login: the same project in the main worktree when `projectRoot` is in a
|
|
82
|
+
* linked git worktree and the main worktree holds the project, otherwise
|
|
83
|
+
* `projectRoot` itself. Cached per process per project root.
|
|
84
|
+
*/
|
|
85
|
+
export function credentialsRootFor(projectRoot) {
|
|
86
|
+
return resolutionFor(projectRoot).root;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Forget every cached {@link credentialsRootFor} answer. One invocation
|
|
90
|
+
* resolves one project, so nothing in the CLI calls this; it exists for tests.
|
|
91
|
+
*/
|
|
92
|
+
export function resetCredentialsHomeCache() {
|
|
93
|
+
resolutions.clear();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Whether the nearest `.git` above `projectRoot` is a file, which is how a
|
|
97
|
+
* linked worktree is marked. Read without running git.
|
|
98
|
+
*/
|
|
99
|
+
export function linkedWorktreeMarker(projectRoot) {
|
|
100
|
+
for (let dir = projectRoot;; dir = dirname(dir)) {
|
|
101
|
+
const marker = join(dir, ".git");
|
|
102
|
+
try {
|
|
103
|
+
if (existsSync(marker))
|
|
104
|
+
return statSync(marker).isFile();
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (dirname(dir) === dir)
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Why a linked worktree is not using the main checkout's login, when that is
|
|
115
|
+
* git's doing: git could not answer and the project sits in a linked
|
|
116
|
+
* worktree. Null otherwise.
|
|
117
|
+
*/
|
|
118
|
+
export function oldGitHint(projectRoot) {
|
|
119
|
+
return resolutionFor(projectRoot).gitFailed && linkedWorktreeMarker(projectRoot)
|
|
120
|
+
? "This looks like a linked git worktree; sharing the main checkout's login needs git 2.31 or newer."
|
|
121
|
+
: null;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The linked worktree's own `.primitive/credentials.json` when it exists but
|
|
125
|
+
* the main worktree's is the one used, or null. It is never read or changed.
|
|
126
|
+
*/
|
|
127
|
+
export function ignoredLocalCredentialsFile(projectRoot) {
|
|
128
|
+
if (credentialsRootFor(projectRoot) === projectRoot)
|
|
129
|
+
return null;
|
|
130
|
+
const own = join(projectRoot, PROJECT_LOCAL_STATE_DIR, "credentials.json");
|
|
131
|
+
return existsSync(own) ? own : null;
|
|
132
|
+
}
|
|
133
|
+
function samePath(a, b) {
|
|
134
|
+
try {
|
|
135
|
+
return realpathSync(a) === realpathSync(b);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
return a === b;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The copies of `projectRoot`'s project that share its login: in each
|
|
143
|
+
* worktree `git worktree list` names, except a bare entry, the project at the
|
|
144
|
+
* same path when it resolves to the same credentials home. Null on any git
|
|
145
|
+
* failure.
|
|
146
|
+
*/
|
|
147
|
+
function sharingProjectRoots(projectRoot) {
|
|
148
|
+
try {
|
|
149
|
+
const rel = relativeToTopLevel(git(projectRoot, ["rev-parse", "--show-toplevel"]), projectRoot);
|
|
150
|
+
if (rel === null)
|
|
151
|
+
return null;
|
|
152
|
+
const home = credentialsRootFor(projectRoot);
|
|
153
|
+
const roots = [];
|
|
154
|
+
for (const entry of git(projectRoot, ["worktree", "list", "--porcelain"]).split(/\n\s*\n/)) {
|
|
155
|
+
const lines = entry.split("\n");
|
|
156
|
+
const worktree = lines.find((line) => line.startsWith("worktree "))?.slice("worktree ".length);
|
|
157
|
+
if (!worktree || lines.includes("bare"))
|
|
158
|
+
continue;
|
|
159
|
+
const candidate = join(worktree, rel);
|
|
160
|
+
if (holdsProject(candidate) && samePath(credentialsRootFor(candidate), home))
|
|
161
|
+
roots.push(candidate);
|
|
162
|
+
}
|
|
163
|
+
return roots;
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* How many worktrees of `projectRoot`'s repository hold the project and share
|
|
171
|
+
* its login: the worktrees `git worktree list` names, except a bare entry,
|
|
172
|
+
* whose copy of the project resolves to the same credentials home. At least
|
|
173
|
+
* 1; 1 on any git failure.
|
|
174
|
+
*/
|
|
175
|
+
export function sharedWorktreeCount(projectRoot) {
|
|
176
|
+
return Math.max(sharingProjectRoots(projectRoot)?.length ?? 1, 1);
|
|
177
|
+
}
|
|
178
|
+
/** Whether a `.git` file or directory sits at or above `dir`. Read without running git. */
|
|
179
|
+
function insideGitCheckout(dir) {
|
|
180
|
+
for (;; dir = dirname(dir)) {
|
|
181
|
+
try {
|
|
182
|
+
if (existsSync(join(dir, ".git")))
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
if (dirname(dir) === dir)
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The other copies of `projectRoot`'s project that share its credentials file
|
|
194
|
+
* (#4512): the project in every other worktree whose login is the same file.
|
|
195
|
+
* Empty outside a git checkout; null when git cannot answer inside one, so a
|
|
196
|
+
* caller never takes "no other worktree" for an answer it did not get.
|
|
197
|
+
*/
|
|
198
|
+
export function otherSharingProjectRoots(projectRoot) {
|
|
199
|
+
const roots = sharingProjectRoots(projectRoot);
|
|
200
|
+
if (!roots)
|
|
201
|
+
return insideGitCheckout(projectRoot) ? null : [];
|
|
202
|
+
return roots.filter((root) => !samePath(root, projectRoot));
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=credentials-home.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials-home.js","sourceRoot":"","sources":["../../../src/lib/credentials-home.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACrE,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAUhC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAC;AAElD,SAAS,GAAG,CAAC,GAAW,EAAE,IAAc;IACtC,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE;QAC/B,GAAG;QACH,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;KACpC,CAAC,CAAC,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,6EAA6E;AAC7E,SAAS,kBAAkB,CAAC,QAAgB,EAAE,WAAmB;IAC/D,MAAM,GAAG,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC;IACxE,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;AAC9D,CAAC;AAED,SAAS,YAAY,CAAC,WAAmB;IACvC,OAA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,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cross-process lock and atomic replace every project-mode credentials
|
|
3
|
+
* write goes through (#4492).
|
|
4
|
+
*
|
|
5
|
+
* Several CLI processes write one credentials file — one agent per git
|
|
6
|
+
* worktree, all sharing the main worktree's login — so a write is a locked
|
|
7
|
+
* read-modify-write, and the file is replaced by a rename, never rewritten in
|
|
8
|
+
* place: a reader never sees a partial file.
|
|
9
|
+
*
|
|
10
|
+
* The lock is `credentials.json.lock`, created exclusively and holding its
|
|
11
|
+
* owner's token (`<pid>:<random>`). A lock older than {@link LOCK_STALE_MS}
|
|
12
|
+
* was left by a crashed process; a contender reclaims it only while holding
|
|
13
|
+
* the reclaim guard (`credentials.json.lock.reclaim`), re-reading the lock's
|
|
14
|
+
* age and token under the guard from one open file, so a reclaimer never moves
|
|
15
|
+
* a lock another contender has just taken. The reclaim renames the lock to a
|
|
16
|
+
* name of its own and removes it only if it still holds the token it read —
|
|
17
|
+
* otherwise a live lock was moved (by a reclaimer without the guard), and it
|
|
18
|
+
* is put back unless another writer took the lock meanwhile. A holder proves,
|
|
19
|
+
* immediately before it commits, that it still owns the lock and that the file
|
|
20
|
+
* is still the version it read — a holder whose lock was moved away and put
|
|
21
|
+
* back may have missed another writer's commit in between — and releases only
|
|
22
|
+
* its own lock.
|
|
23
|
+
*
|
|
24
|
+
* Node has no advisory file lock, so one window remains: between a holder's
|
|
25
|
+
* checks and its rename, a contender that just misreclaimed that lock could
|
|
26
|
+
* let a third writer in. Every other interleaving ends in a failed write,
|
|
27
|
+
* never a lost update.
|
|
28
|
+
*/
|
|
29
|
+
/** A lock untouched for this long was left by a crashed process. */
|
|
30
|
+
export declare const LOCK_STALE_MS = 10000;
|
|
31
|
+
/** How long a writer waits for a held lock before it fails. */
|
|
32
|
+
export declare const LOCK_WAIT_MS = 5000;
|
|
33
|
+
/** The lock on a credentials directory, held by this process. */
|
|
34
|
+
export interface CredentialsLock {
|
|
35
|
+
/** The lock file. */
|
|
36
|
+
readonly path: string;
|
|
37
|
+
/** This holder's token, the lock file's content while it holds it. */
|
|
38
|
+
readonly token: string;
|
|
39
|
+
/** Whether the lock file still holds this holder's token. */
|
|
40
|
+
ownsLock(): boolean;
|
|
41
|
+
/** Remove the lock if, and only if, this holder still owns it. Never throws. */
|
|
42
|
+
release(): void;
|
|
43
|
+
}
|
|
44
|
+
/** A write that could not take, or lost, the lock on a credentials file. */
|
|
45
|
+
export declare class CredentialsLockedError extends Error {
|
|
46
|
+
constructor(lockPath: string);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Reclaim the stale lock at `lockPath`, whose content was `seen` when it was
|
|
50
|
+
* judged stale. Only the contender holding the reclaim guard
|
|
51
|
+
* (`<lock>.reclaim`) reclaims, and it inspects the lock again under the guard:
|
|
52
|
+
* no other reclaimer can move the lock meanwhile, and no writer can create one
|
|
53
|
+
* while it exists, so the lock it inspects is the lock it removes. Without the
|
|
54
|
+
* guard, a contender that judged the old lock stale could move away the fresh
|
|
55
|
+
* lock another contender had just taken, and a third writer could take the
|
|
56
|
+
* lock before it was put back. A contender that does not get the guard returns
|
|
57
|
+
* and retries. Gone already is not an error: another contender won.
|
|
58
|
+
*/
|
|
59
|
+
export declare function reclaimStaleLock(lockPath: string, token: string, seen: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Put a live lock that a reclaimer moved to `moved` back at `lockPath` — but
|
|
62
|
+
* only if no other writer has taken the lock since, which a rename would
|
|
63
|
+
* silently replace. When one has, the displaced holder has lost the lock and
|
|
64
|
+
* fails its ownership check. The caller removes `moved` either way.
|
|
65
|
+
*/
|
|
66
|
+
export declare function restoreDisplacedLock(moved: string, lockPath: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* The version of the file at `path` as a writer read it: what an atomic
|
|
69
|
+
* replace changes (the inode) and what an in-place write changes (size and
|
|
70
|
+
* times). `"absent"` when there is no file.
|
|
71
|
+
*/
|
|
72
|
+
export declare function fileVersion(path: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Take the lock on the credentials file in `dir`, waiting up to
|
|
75
|
+
* {@link LOCK_WAIT_MS} for another writer and reclaiming a stale lock. Throws
|
|
76
|
+
* {@link CredentialsLockedError} naming the lock when it stays held.
|
|
77
|
+
*/
|
|
78
|
+
export declare function acquireCredentialsLock(dir: string): CredentialsLock;
|
|
79
|
+
/**
|
|
80
|
+
* Replace `path` with `content` while `lock` is held: write a private
|
|
81
|
+
* temporary file beside it, check the lock is still this holder's and, when
|
|
82
|
+
* `readVersion` is given, that `path` is still the {@link fileVersion} the
|
|
83
|
+
* holder read under the lock, then rename the temporary file over `path`. A
|
|
84
|
+
* holder that lost the lock, or whose read another writer's commit has
|
|
85
|
+
* overtaken, removes its temporary file and throws
|
|
86
|
+
* {@link CredentialsLockedError}, leaving `path` as it was.
|
|
87
|
+
*/
|
|
88
|
+
export declare function replaceFileUnderLock(lock: CredentialsLock, path: string, content: string, readVersion?: string): void;
|