thinkwork-cli 0.13.1 → 1.0.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 +3 -14
- package/dist/{api-client-4DZ266J5.js → api-client-4P4JZOBX.js} +3 -1
- package/dist/bowser-6Z6JFAIR.js +2822 -0
- package/dist/{chunk-Y2WHJECR.js → chunk-4OMDWYZQ.js} +5 -44
- package/dist/chunk-AD2NIWB5.js +6516 -0
- package/dist/chunk-DV3MRBR5.js +43 -0
- package/dist/chunk-EI5ZX7CN.js +522 -0
- package/dist/chunk-EUJ7X6YD.js +126 -0
- package/dist/chunk-GG5WKBOX.js +436 -0
- package/dist/chunk-I64EZSU5.js +358 -0
- package/dist/chunk-KMIJ5KGT.js +128 -0
- package/dist/chunk-MWQ7RO76.js +137 -0
- package/dist/chunk-OCPHU34C.js +996 -0
- package/dist/chunk-OLUQ4U2Z.js +1728 -0
- package/dist/chunk-XYM7PE2A.js +2264 -0
- package/dist/chunk-YQCYD6NE.js +3299 -0
- package/dist/cli.js +49156 -31257
- package/dist/commands/enterprise/templates/deploy-repo/scripts/apply-release.mjs +0 -1
- package/dist/commands/enterprise/templates/deploy-repo/scripts/smoke.mjs +0 -1
- package/dist/commands/enterprise/templates/deploy-repo/terraform/main.tf +0 -14
- package/dist/dist-es-2OTNTL4N.js +315 -0
- package/dist/dist-es-2XVAH4BQ.js +14726 -0
- package/dist/dist-es-3DPDUJAH.js +2000 -0
- package/dist/dist-es-BNZTBBVC.js +176 -0
- package/dist/dist-es-CD2RBDAC.js +88 -0
- package/dist/dist-es-I4FW57PS.js +88 -0
- package/dist/dist-es-KL7Y5NB2.js +377 -0
- package/dist/dist-es-KVFWJNDY.js +318 -0
- package/dist/dist-es-PS73DWNL.js +70 -0
- package/dist/dist-es-S3NZQFGT.js +170 -0
- package/dist/dist-es-SGCA4P32.js +48 -0
- package/dist/dist-es-WBM6J4RA.js +70 -0
- package/dist/dist-es-ZGVADYIF.js +485 -0
- package/dist/dist-es-ZKC2QKD2.js +377 -0
- package/dist/drizzle/0076_scheduled_jobs_marco_backfill.sql +2 -1
- package/dist/drizzle/0079_seed_tenant_customize_catalog.sql +1 -0
- package/dist/drizzle/0090_brain_schema_extraction.sql +10 -0
- package/dist/drizzle/0132_drop_computer_tables.sql +3 -0
- package/dist/drizzle/0160_compliance_event_types_plugins.sql +2 -0
- package/dist/drizzle/0214_think137_drop_judge_evidence_roi.sql +1 -0
- package/dist/drizzle/0216_drop_agent_loop_versions_goal_worker_policy.sql +1 -0
- package/dist/drizzle/0227_analyst_reader_role.sql +17 -20
- package/dist/drizzle/0230_analyst_rls.sql +28 -36
- package/dist/drizzle/0250_kg_schema_extraction.sql +27 -0
- package/dist/drizzle/0251_brain_stragglers.sql +21 -0
- package/dist/drizzle/0253_drop_brain_substrate.sql +2 -0
- package/dist/drizzle/0257_agents_runtime_allow_harness.sql +24 -0
- package/dist/drizzle/0261_native_auth_control_plane.sql +332 -0
- package/dist/drizzle/0262_auth_subscription_tickets.sql +59 -0
- package/dist/drizzle/0263_agentcore_runtime_identifier.sql +69 -0
- package/dist/drizzle/0263_drop_workos_auth_runtime.sql +236 -0
- package/dist/drizzle/0264_auth_enrollment_attempt_limits.sql +15 -0
- package/dist/drizzle/0265_eval_runs_requester_identity.sql +28 -0
- package/dist/drizzle/0265_require_fully_valid_auth_publication.sql +27 -0
- package/dist/drizzle/0266_auth_identity_recovery_grants.sql +9 -0
- package/dist/drizzle/0266_eval_profiles_runtime_type.sql +12 -0
- package/dist/drizzle/0267_ontology_candidate_rejections.sql +53 -0
- package/dist/drizzle/0268_identity_crosswalk_routing.sql +182 -0
- package/dist/drizzle/0269_ontology_system_map.sql +31 -0
- package/dist/drizzle/0270_tool_execution_ledger.sql +115 -0
- package/dist/drizzle/0271_ontology_twin_declarations.sql +47 -0
- package/dist/drizzle/0272_identity_graph_projection_cursor.sql +23 -0
- package/dist/drizzle/0273_twin_materialization_suggestions.sql +29 -0
- package/dist/drizzle/0274_tenant_mcp_twin_keys.sql +59 -0
- package/dist/drizzle/0275_identity_bulk_rebuild_fence.sql +30 -0
- package/dist/drizzle/0276_tool_execution_ledger_allow_cascade_delete.sql +18 -0
- package/dist/drizzle/0277_knowledge_base_sources.sql +107 -0
- package/dist/drizzle/0278_kb_page_transcription.sql +55 -0
- package/dist/drizzle/0279_mcp_servers_off_plugin_provenance.sql +93 -0
- package/dist/drizzle/0280_work_item_external_refs_drop_plane_provider.sql +46 -0
- package/dist/drizzle/0281_tenant_mcp_twin_keys_expiry_suffix.sql +9 -0
- package/dist/drizzle/0282_tenant_mcp_twin_keys_grants.sql +24 -0
- package/dist/drizzle/0283_agents_agentcore_runtime_dispatch.sql +13 -0
- package/dist/drizzle/0284_user_brain_claims.sql +69 -0
- package/dist/drizzle/0285_tenant_mcp_twin_keys_trusted_subsystem.sql +30 -0
- package/dist/drizzle/0286_brain_analytics_key.sql +26 -0
- package/dist/drizzle/0287_brain_subject.sql +25 -0
- package/dist/drizzle/0288_multi_lane_identities.sql +25 -0
- package/dist/event-streams-7JNLJEEL.js +894 -0
- package/dist/event-streams-KDF5RWR6.js +1515 -0
- package/dist/loadSso-ETCXTR4I.js +576 -0
- package/dist/loadSso-UBD7KUHE.js +583 -0
- package/dist/plugins/README.md +2 -2
- package/dist/plugins/catalog/package.json +1 -5
- package/dist/plugins/catalog/src/__tests__/build-catalog.test.ts +6 -4
- package/dist/plugins/catalog/src/__tests__/catalog.test.ts +21 -21
- package/dist/plugins/catalog/src/__tests__/contracts.test.ts +102 -94
- package/dist/plugins/catalog/src/__tests__/plugin-package.test.ts +7 -8
- package/dist/plugins/catalog/src/__tests__/plugin-registry.test.ts +0 -20
- package/dist/plugins/catalog/src/contracts.ts +17 -179
- package/dist/plugins/catalog/src/registry/generated-first-party.ts +0 -24
- package/dist/plugins/n8n/test/integrated-app-contract.test.ts +1 -1
- package/dist/plugins/twenty/package.json +2 -1
- package/dist/plugins/twenty/scripts/LAMBDA_DEPLOY.md +114 -0
- package/dist/plugins/twenty/scripts/build-lambda.sh +29 -0
- package/dist/plugins/twenty/scripts/configure-product-views.ts +195 -0
- package/dist/plugins/twenty/scripts/lambda-handler.ts +49 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/load-attachments.test.ts +38 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/load-records.test.ts +145 -2
- package/dist/plugins/twenty/scripts/lib/__tests__/mappers.test.ts +397 -151
- package/dist/plugins/twenty/scripts/lib/__tests__/members-ensure.test.ts +28 -129
- package/dist/plugins/twenty/scripts/lib/__tests__/provision-members-db.test.ts +10 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/schema-ensure.test.ts +13 -8
- package/dist/plugins/twenty/scripts/lib/lastmile-reader.ts +222 -2
- package/dist/plugins/twenty/scripts/lib/load-attachments.ts +29 -0
- package/dist/plugins/twenty/scripts/lib/load-records.ts +160 -43
- package/dist/plugins/twenty/scripts/lib/mappers.ts +368 -152
- package/dist/plugins/twenty/scripts/lib/members-ensure.ts +43 -268
- package/dist/plugins/twenty/scripts/lib/provision-members-db.ts +57 -0
- package/dist/plugins/twenty/scripts/lib/schema-ensure.ts +136 -31
- package/dist/plugins/twenty/scripts/migrate-lastmile.ts +254 -152
- package/dist/plugins/twenty/scripts/provision-twenty-members.ts +44 -1
- package/dist/plugins/twenty/scripts/purge-lastmile-import.ts +178 -0
- package/dist/plugins/twenty/scripts/restructure-products.ts +312 -0
- package/dist/plugins/twenty/scripts/retag-stage-values.ts +362 -0
- package/dist/plugins/twenty/test/manifest.test.ts +2 -4
- package/dist/scripts/post-deploy.sh +79 -1
- package/dist/signin-5QZNRSOO.js +821 -0
- package/dist/sso-oidc-XK673P54.js +837 -0
- package/dist/sts-OXI2UALF.js +1113 -0
- package/dist/sts-SQW4NBK3.js +1117 -0
- package/dist/terraform/examples/greenfield/main.tf +391 -176
- package/dist/terraform/examples/greenfield/terraform.tfvars.example +26 -8
- package/dist/terraform/modules/app/agentcore-admin/main.tf +47 -0
- package/dist/terraform/modules/app/agentcore-code-interpreter/README.md +39 -47
- package/dist/terraform/modules/app/agentcore-code-interpreter/main.tf +13 -66
- package/dist/terraform/modules/app/agentcore-identity/main.tf +253 -0
- package/dist/terraform/modules/app/agentcore-identity/outputs.tf +51 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/bootstrap_twenty_oauth_client.sh +239 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/delete_identity.sh +22 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/delete_twenty_identity.sh +16 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/delete_workload_identity.sh +19 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/ensure_workload_identity.sh +29 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/read_identity.sh +55 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/reconcile_identity.sh +73 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/reconcile_twenty_identity.sh +45 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/reconcile_twenty_provider.mjs +123 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/after.tf +15 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/before.tf +7 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/identity-after.tf +8 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/identity-before.tf +9 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/thinkwork-after.tf +3 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/thinkwork-before.tf +3 -0
- package/dist/terraform/modules/app/agentcore-identity/variables.tf +60 -0
- package/dist/terraform/modules/app/agentcore-memory/README.md +46 -9
- package/dist/terraform/modules/app/agentcore-memory/main.tf +27 -10
- package/dist/terraform/modules/app/agentcore-memory/scripts/create_or_find_memory.sh +156 -24
- package/dist/terraform/modules/app/agentcore-pi/README.md +1 -3
- package/dist/terraform/modules/app/agentcore-pi/main.tf +42 -52
- package/dist/terraform/modules/app/agentcore-pi/outputs.tf +3 -3
- package/dist/terraform/modules/app/agentcore-pi/scripts/reconcile_pi_runtime.mjs +175 -0
- package/dist/terraform/modules/app/agentcore-pi/variables.tf +35 -28
- package/dist/terraform/modules/app/agentcore-platform/main.tf +68 -0
- package/dist/terraform/modules/app/agentcore-runtime/main.tf +4 -20
- package/dist/terraform/modules/app/appsync-subscriptions/main.tf +127 -21
- package/dist/terraform/modules/app/appsync-subscriptions/outputs.tf +0 -6
- package/dist/terraform/modules/app/appsync-subscriptions/variables.tf +5 -0
- package/dist/terraform/modules/app/capability-broker/main.tf +2 -2
- package/dist/terraform/modules/app/capability-broker/variables.tf +11 -0
- package/dist/terraform/modules/app/deployment-control-plane/README.md +264 -0
- package/dist/terraform/modules/app/deployment-control-plane/buildspec.yml +4 -1
- package/dist/terraform/modules/app/deployment-control-plane/main.tf +94 -0
- package/dist/terraform/modules/app/deployment-control-plane/outputs.tf +5 -0
- package/dist/terraform/modules/app/deployment-control-plane/runner.py +3689 -233
- package/dist/terraform/modules/app/deployment-control-plane/test_runner_bundle.py +2579 -140
- package/dist/terraform/modules/app/deployment-control-plane/variables.tf +33 -0
- package/dist/terraform/modules/app/lambda-api/auth-state.tf +72 -0
- package/dist/terraform/modules/app/lambda-api/chat-latency-observability.tf +466 -0
- package/dist/terraform/modules/app/lambda-api/dispatch-dlq.tf +55 -0
- package/dist/terraform/modules/app/lambda-api/handlers.tf +531 -619
- package/dist/terraform/modules/app/lambda-api/iam-grouped.tf +350 -241
- package/dist/terraform/modules/app/lambda-api/main.tf +75 -13
- package/dist/terraform/modules/app/lambda-api/memory-alarms.tf +3 -28
- package/dist/terraform/modules/app/lambda-api/oauth-secrets.tf +1 -2
- package/dist/terraform/modules/app/lambda-api/outputs.tf +17 -10
- package/dist/terraform/modules/app/lambda-api/runtime-config.tf +3 -21
- package/dist/terraform/modules/app/lambda-api/turn-assertion.tf +45 -0
- package/dist/terraform/modules/app/lambda-api/variables.tf +307 -121
- package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/README.md +1 -1
- package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/main.tf +18 -18
- package/dist/terraform/modules/app/sandbox-log-scrubber/README.md +11 -10
- package/dist/terraform/modules/app/sandbox-log-scrubber/main.tf +5 -5
- package/dist/terraform/modules/app/static-site/main.tf +1 -1
- package/dist/terraform/modules/app/www-dns/main.tf +9 -27
- package/dist/terraform/modules/app/www-dns/variables.tf +4 -10
- package/dist/terraform/modules/data/aurora-postgres/README.md +34 -0
- package/dist/terraform/modules/data/aurora-postgres/alarms.tf +82 -0
- package/dist/terraform/modules/data/aurora-postgres/main.tf +27 -57
- package/dist/terraform/modules/data/aurora-postgres/outputs.tf +0 -9
- package/dist/terraform/modules/data/aurora-postgres/variables.tf +41 -0
- package/dist/terraform/modules/data/s3-buckets/main.tf +5 -6
- package/dist/terraform/modules/foundation/cognito/main.tf +367 -72
- package/dist/terraform/modules/foundation/cognito/outputs.tf +47 -0
- package/dist/terraform/modules/foundation/cognito/variables.tf +131 -9
- package/dist/terraform/modules/thinkwork/README.md +5 -1
- package/dist/terraform/modules/thinkwork/main.tf +459 -234
- package/dist/terraform/modules/thinkwork/outputs.tf +44 -62
- package/dist/terraform/modules/thinkwork/variables.tf +353 -89
- package/dist/terraform/schema.graphql +69 -36
- package/dist/workspace-defaults/files/INSTRUCTIONS.md +9 -11
- package/dist/workspace-defaults/files/MEMORY_GUIDE.md +38 -35
- package/dist/workspace-defaults/files/ROUTER.md +1 -1
- package/dist/workspace-defaults/files/TOOLS.md +9 -39
- package/dist/workspace-defaults/files/USER.md +1 -0
- package/dist/workspace-defaults/files/agents/analyst/INSTRUCTIONS.md +6 -3
- package/dist/workspace-defaults/files/catalog-skills/brain-brief-builder/SKILL.md +165 -0
- package/dist/workspace-defaults/files/catalog-skills/n8n-workflow-operator/SKILL.md +75 -0
- package/dist/workspace-defaults/files/catalog-skills/n8n-workflow-operator/references/mcp-tooling.md +40 -0
- package/dist/workspace-defaults/files/catalog-skills/n8n-workflow-operator/references/validation-and-handoff.md +40 -0
- package/dist/workspace-defaults/files/catalog-skills/n8n-workflow-operator/references/workflow-authoring.md +46 -0
- package/dist/workspace-defaults/files/skills/artifact-builder/references/crm-dashboard.md +1 -1
- package/dist/workspace-defaults/files/skills/document-composer/SKILL.md +22 -3
- package/package.json +3 -2
- package/dist/drizzle/0261_thread_turns_origin_turn_index.sql +0 -11
- package/dist/plugins/company-data/README.md +0 -49
- package/dist/plugins/company-data/package.json +0 -21
- package/dist/plugins/company-data/src/index.ts +0 -30
- package/dist/plugins/company-data/src/manifest.ts +0 -26
- package/dist/plugins/company-data/test/manifest.test.ts +0 -116
- package/dist/plugins/company-data/tsconfig.json +0 -8
- package/dist/plugins/company-etl/README.md +0 -46
- package/dist/plugins/company-etl/package.json +0 -21
- package/dist/plugins/company-etl/src/index.ts +0 -29
- package/dist/plugins/company-etl/src/manifest.ts +0 -26
- package/dist/plugins/company-etl/test/manifest.test.ts +0 -108
- package/dist/plugins/company-etl/tsconfig.json +0 -8
- package/dist/plugins/lastmile/README.md +0 -50
- package/dist/plugins/lastmile/package.json +0 -23
- package/dist/plugins/lastmile/smoke/lastmile-plugin-smoke.mjs +0 -661
- package/dist/plugins/lastmile/src/api/tasks-adapter.ts +0 -572
- package/dist/plugins/lastmile/src/discovery.fixture.ts +0 -64
- package/dist/plugins/lastmile/src/index.ts +0 -46
- package/dist/plugins/lastmile/src/manifest.ts +0 -139
- package/dist/plugins/lastmile/test/api/tasks-adapter.test.ts +0 -266
- package/dist/plugins/lastmile/test/discovery.test.ts +0 -88
- package/dist/plugins/lastmile/tsconfig.json +0 -8
- package/dist/plugins/n8n/smoke/n8n-managed-app-smoke.mjs +0 -409
- package/dist/plugins/twenty/smoke/twenty-managed-app-smoke.mjs +0 -359
- package/dist/plugins/workos-auth/package.json +0 -22
- package/dist/plugins/workos-auth/src/index.ts +0 -30
- package/dist/plugins/workos-auth/src/manifest.ts +0 -40
- package/dist/plugins/workos-auth/src/provider-contract.ts +0 -39
- package/dist/plugins/workos-auth/test/manifest.test.ts +0 -94
- package/dist/plugins/workos-auth/tsconfig.json +0 -8
- package/dist/terraform/modules/app/agentcore-code-interpreter/Dockerfile.sandbox-base +0 -61
- package/dist/terraform/modules/app/agentcore-code-interpreter/sandbox/sitecustomize.py +0 -227
- package/dist/terraform/modules/app/agentcore-code-interpreter/sandbox/test_sitecustomize.py +0 -277
- package/dist/terraform/modules/app/agentcore-code-interpreter/scripts/build_and_push_sandbox_base.sh +0 -70
- package/dist/terraform/modules/app/agentcore-harness/main.tf +0 -101
- package/dist/terraform/modules/app/agentcore-harness/outputs.tf +0 -9
- package/dist/terraform/modules/app/agentcore-harness/variables.tf +0 -25
- package/dist/terraform/modules/app/hindsight-memory/README.md +0 -89
- package/dist/terraform/modules/app/hindsight-memory/main.tf +0 -411
- package/dist/terraform/modules/data/bedrock-knowledge-base/main.tf +0 -102
- /package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/outputs.tf +0 -0
- /package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/scripts/sync-database.py +0 -0
- /package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/scripts/test_sync_database.py +0 -0
- /package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/variables.tf +0 -0
- /package/dist/{plugins/twenty/terraform → terraform/modules/app}/twenty/README.md +0 -0
- /package/dist/{plugins/twenty/terraform → terraform/modules/app}/twenty/main.tf +0 -0
- /package/dist/{plugins/twenty/terraform → terraform/modules/app}/twenty/outputs.tf +0 -0
- /package/dist/{plugins/twenty/terraform → terraform/modules/app}/twenty/variables.tf +0 -0
|
@@ -43,6 +43,27 @@
|
|
|
43
43
|
--
|
|
44
44
|
-- Markers (consumed by scripts/db-migrate-manual.sh):
|
|
45
45
|
--
|
|
46
|
+
-- moves-owner: public.brain_dream_runs -> brain.dream_runs
|
|
47
|
+
-- moves-owner: public.brain_dream_actions -> brain.dream_actions
|
|
48
|
+
-- moves-owner: public.memory_retain_attempts -> brain.retain_attempts
|
|
49
|
+
-- drops: public.brain_dream_runs_dedupe_key_uidx
|
|
50
|
+
-- drops: public.brain_dream_runs_tenant_bank_idx
|
|
51
|
+
-- drops: public.brain_dream_runs_tenant_status_idx
|
|
52
|
+
-- drops: public.brain_dream_actions_run_ordinal_uidx
|
|
53
|
+
-- drops: public.brain_dream_actions_run_status_idx
|
|
54
|
+
-- drops: public.memory_retain_attempts_source_event_uidx
|
|
55
|
+
-- drops: public.memory_retain_attempts_due_idx
|
|
56
|
+
-- drops: public.memory_retain_attempts_tenant_status_idx
|
|
57
|
+
-- drops: public.memory_retain_attempts_thread_idx
|
|
58
|
+
-- drops: public.memory_retain_attempts_user_idx
|
|
59
|
+
-- drops: public.memory_retain_attempts_space_idx
|
|
60
|
+
-- drops: public.memory_retain_attempts_turn_idx
|
|
61
|
+
-- drops-constraint: public.brain_dream_runs.brain_dream_runs_status_check
|
|
62
|
+
-- drops-constraint: public.brain_dream_actions.brain_dream_actions_type_check
|
|
63
|
+
-- drops-constraint: public.brain_dream_actions.brain_dream_actions_status_check
|
|
64
|
+
-- drops-constraint: public.memory_retain_attempts.memory_retain_attempts_status_allowed
|
|
65
|
+
-- drops-constraint: public.memory_retain_attempts.memory_retain_attempts_attempt_count_nonnegative
|
|
66
|
+
-- drops-constraint: public.memory_retain_attempts.memory_retain_attempts_max_attempts_positive
|
|
46
67
|
-- creates: brain.dream_runs
|
|
47
68
|
-- creates: brain.dream_actions
|
|
48
69
|
-- creates: brain.retain_attempts
|
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
-- drops-column: brain.artifact_manifests.migration_id
|
|
43
43
|
-- drops-constraint: brain.artifact_manifests.artifact_manifests_substrate_id_fk
|
|
44
44
|
-- drops-constraint: brain.artifact_manifests.artifact_manifests_migration_id_fk
|
|
45
|
+
-- drops: brain.brain_artifact_manifests_substrate_kind_idx
|
|
46
|
+
-- drops: brain.brain_artifact_manifests_migration_idx
|
|
45
47
|
|
|
46
48
|
\set ON_ERROR_STOP on
|
|
47
49
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- THINK-311 (AgentCore trial): loosen the agents.runtime CHECK constraint
|
|
2
|
+
-- so the Agent-configuration Runtime dropdown can persist the internal
|
|
3
|
+
-- 'harness' value (surfaced to users as "AgentCore"). Without this, the
|
|
4
|
+
-- updateTenantAgent mutation dies on agents_runtime_check and the UI
|
|
5
|
+
-- shows "[GraphQL] Unexpected error.".
|
|
6
|
+
--
|
|
7
|
+
-- Hand-rolled (NOT registered in meta/_journal.json) — apply via psql:
|
|
8
|
+
-- psql "$DATABASE_URL" -f packages/database-pg/drizzle/0257_agents_runtime_allow_harness.sql
|
|
9
|
+
-- Already applied to dev via RDS Data API on 2026-07-16.
|
|
10
|
+
--
|
|
11
|
+
-- agent_templates.runtime intentionally untouched: the AgentCore trial is
|
|
12
|
+
-- scoped to the ONE platform agent per tenant; no template carries it.
|
|
13
|
+
--
|
|
14
|
+
-- Marker for the db:migrate-manual drift-reporter:
|
|
15
|
+
-- creates-constraint: public.agents.agents_runtime_check
|
|
16
|
+
|
|
17
|
+
\echo '== THINK-311: allow harness in agents_runtime_check =='
|
|
18
|
+
|
|
19
|
+
ALTER TABLE agents
|
|
20
|
+
DROP CONSTRAINT IF EXISTS agents_runtime_check;
|
|
21
|
+
|
|
22
|
+
ALTER TABLE agents
|
|
23
|
+
ADD CONSTRAINT agents_runtime_check
|
|
24
|
+
CHECK (runtime IN ('strands', 'flue', 'pi', 'harness'));
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
-- Provider-neutral authentication control plane (plan 2026-07-18-001 U11).
|
|
2
|
+
-- creates-column: public.auth_provider_resources.connection_key
|
|
3
|
+
-- creates-column: public.auth_provider_resources.provider_kind
|
|
4
|
+
-- creates-column: public.auth_provider_resources.lifecycle_state
|
|
5
|
+
-- creates-column: public.auth_provider_resources.resource_arn
|
|
6
|
+
-- creates-column: public.auth_provider_resources.aws_account_id
|
|
7
|
+
-- creates-column: public.auth_provider_resources.aws_region
|
|
8
|
+
-- creates-column: public.auth_provider_resources.desired_revision
|
|
9
|
+
-- creates-column: public.tenant_auth_provider_references.desired_revision
|
|
10
|
+
-- creates: public.uq_auth_provider_resources_connection_key
|
|
11
|
+
-- creates: public.uq_tenant_auth_provider_references_tenant_resource
|
|
12
|
+
-- creates: public.tenant_auth_policies
|
|
13
|
+
-- creates: public.uq_tenant_auth_policies_tenant
|
|
14
|
+
-- creates-function: public.ensure_default_tenant_auth_policy
|
|
15
|
+
-- creates-trigger: public.tenants.trg_tenants_default_auth_policy
|
|
16
|
+
-- creates: public.tenant_auth_hosts
|
|
17
|
+
-- creates: public.uq_tenant_auth_hosts_hostname
|
|
18
|
+
-- creates: public.idx_tenant_auth_hosts_tenant_status
|
|
19
|
+
-- creates: public.auth_route_clients
|
|
20
|
+
-- creates: public.uq_auth_route_clients_route_family
|
|
21
|
+
-- creates: public.uq_auth_route_clients_app_client
|
|
22
|
+
-- creates: public.idx_auth_route_clients_lifecycle_status
|
|
23
|
+
-- creates: public.user_auth_identities
|
|
24
|
+
-- creates: public.uq_user_auth_identities_sub_connection
|
|
25
|
+
-- creates: public.uq_user_auth_identities_provider_subject
|
|
26
|
+
-- creates: public.idx_user_auth_identities_user_status
|
|
27
|
+
-- creates: public.idx_user_auth_identities_tenant_status
|
|
28
|
+
-- creates: public.auth_identity_enrollments
|
|
29
|
+
-- creates: public.uq_auth_identity_enrollments_nonce
|
|
30
|
+
-- creates: public.uq_auth_identity_enrollments_challenge
|
|
31
|
+
-- creates: public.idx_auth_identity_enrollments_pending
|
|
32
|
+
-- creates: public.auth_reconciliation_sets
|
|
33
|
+
-- creates: public.uq_auth_reconciliation_sets_stage_revision
|
|
34
|
+
-- creates: public.uq_auth_reconciliation_sets_idempotency
|
|
35
|
+
-- creates: public.auth_cutover_runs
|
|
36
|
+
-- creates: public.uq_auth_cutover_runs_stage_inventory
|
|
37
|
+
-- creates: public.idx_auth_cutover_runs_status
|
|
38
|
+
-- creates: public.auth_identity_proofs
|
|
39
|
+
-- creates: public.uq_auth_identity_proofs_digest
|
|
40
|
+
-- creates: public.idx_auth_identity_proofs_identity
|
|
41
|
+
-- drops: public.uq_tenant_auth_provider_references_install_resource
|
|
42
|
+
|
|
43
|
+
ALTER TABLE public.auth_provider_resources
|
|
44
|
+
ADD COLUMN IF NOT EXISTS connection_key text,
|
|
45
|
+
ADD COLUMN IF NOT EXISTS provider_kind text,
|
|
46
|
+
ADD COLUMN IF NOT EXISTS lifecycle_state text,
|
|
47
|
+
ADD COLUMN IF NOT EXISTS resource_arn text,
|
|
48
|
+
ADD COLUMN IF NOT EXISTS aws_account_id text,
|
|
49
|
+
ADD COLUMN IF NOT EXISTS aws_region text,
|
|
50
|
+
ADD COLUMN IF NOT EXISTS desired_revision integer;
|
|
51
|
+
|
|
52
|
+
UPDATE public.auth_provider_resources
|
|
53
|
+
SET connection_key = COALESCE(connection_key, provider_key || ':' || id::text),
|
|
54
|
+
provider_kind = COALESCE(provider_kind, CASE WHEN provider_key = 'workos' THEN 'legacy_workos' ELSE provider_key END),
|
|
55
|
+
lifecycle_state = COALESCE(lifecycle_state, 'coexistence'),
|
|
56
|
+
desired_revision = COALESCE(desired_revision, 1);
|
|
57
|
+
|
|
58
|
+
ALTER TABLE public.auth_provider_resources
|
|
59
|
+
ALTER COLUMN connection_key SET DEFAULT 'legacy',
|
|
60
|
+
ALTER COLUMN connection_key SET NOT NULL,
|
|
61
|
+
ALTER COLUMN provider_kind SET DEFAULT 'legacy_workos',
|
|
62
|
+
ALTER COLUMN provider_kind SET NOT NULL,
|
|
63
|
+
ALTER COLUMN lifecycle_state SET DEFAULT 'coexistence',
|
|
64
|
+
ALTER COLUMN lifecycle_state SET NOT NULL,
|
|
65
|
+
ALTER COLUMN desired_revision SET DEFAULT 1,
|
|
66
|
+
ALTER COLUMN desired_revision SET NOT NULL,
|
|
67
|
+
ALTER COLUMN issuer_url DROP NOT NULL,
|
|
68
|
+
ALTER COLUMN client_id DROP NOT NULL,
|
|
69
|
+
ALTER COLUMN client_secret_ref DROP NOT NULL;
|
|
70
|
+
|
|
71
|
+
ALTER TABLE public.auth_provider_resources
|
|
72
|
+
DROP CONSTRAINT IF EXISTS auth_provider_resources_no_public_without_valid,
|
|
73
|
+
DROP CONSTRAINT IF EXISTS auth_provider_resources_lifecycle_state_allowed,
|
|
74
|
+
ADD CONSTRAINT auth_provider_resources_lifecycle_state_allowed
|
|
75
|
+
CHECK (lifecycle_state IN ('coexistence', 'native', 'denied')),
|
|
76
|
+
ADD CONSTRAINT auth_provider_resources_no_public_without_valid
|
|
77
|
+
CHECK (
|
|
78
|
+
public_options_published = false OR
|
|
79
|
+
(validation_status IN ('valid', 'partially_valid') AND lifecycle_state <> 'denied')
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_auth_provider_resources_connection_key
|
|
83
|
+
ON public.auth_provider_resources (cognito_user_pool_id, connection_key);
|
|
84
|
+
|
|
85
|
+
ALTER TABLE public.tenant_auth_provider_references
|
|
86
|
+
ADD COLUMN IF NOT EXISTS desired_revision integer;
|
|
87
|
+
|
|
88
|
+
UPDATE public.tenant_auth_provider_references
|
|
89
|
+
SET desired_revision = COALESCE(desired_revision, 1);
|
|
90
|
+
|
|
91
|
+
ALTER TABLE public.tenant_auth_provider_references
|
|
92
|
+
ALTER COLUMN desired_revision SET DEFAULT 1,
|
|
93
|
+
ALTER COLUMN desired_revision SET NOT NULL,
|
|
94
|
+
ALTER COLUMN plugin_install_id DROP NOT NULL,
|
|
95
|
+
DROP CONSTRAINT IF EXISTS tenant_auth_provider_references_tenant_id_fkey,
|
|
96
|
+
DROP CONSTRAINT IF EXISTS tenant_auth_provider_references_plugin_install_id_fkey,
|
|
97
|
+
DROP CONSTRAINT IF EXISTS tenant_auth_provider_references_auth_provider_resource_id_fkey,
|
|
98
|
+
ADD CONSTRAINT tenant_auth_provider_references_tenant_id_fkey
|
|
99
|
+
FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE RESTRICT,
|
|
100
|
+
ADD CONSTRAINT tenant_auth_provider_references_plugin_install_id_fkey
|
|
101
|
+
FOREIGN KEY (plugin_install_id) REFERENCES public.plugin_installs(id) ON DELETE SET NULL,
|
|
102
|
+
ADD CONSTRAINT tenant_auth_provider_references_auth_provider_resource_id_fkey
|
|
103
|
+
FOREIGN KEY (auth_provider_resource_id) REFERENCES public.auth_provider_resources(id) ON DELETE RESTRICT;
|
|
104
|
+
|
|
105
|
+
DROP INDEX IF EXISTS public.uq_tenant_auth_provider_references_install_resource;
|
|
106
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_tenant_auth_provider_references_tenant_resource
|
|
107
|
+
ON public.tenant_auth_provider_references (tenant_id, auth_provider_resource_id);
|
|
108
|
+
|
|
109
|
+
CREATE TABLE IF NOT EXISTS public.tenant_auth_policies (
|
|
110
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
111
|
+
tenant_id uuid NOT NULL REFERENCES public.tenants(id) ON DELETE RESTRICT,
|
|
112
|
+
local_password_enabled boolean NOT NULL DEFAULT true,
|
|
113
|
+
status text NOT NULL DEFAULT 'draft',
|
|
114
|
+
revision integer NOT NULL DEFAULT 1,
|
|
115
|
+
catalog_revision text,
|
|
116
|
+
updated_by uuid REFERENCES public.users(id) ON DELETE SET NULL,
|
|
117
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
118
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
119
|
+
CONSTRAINT tenant_auth_policies_status_allowed
|
|
120
|
+
CHECK (status IN ('draft', 'active', 'disabled'))
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_tenant_auth_policies_tenant
|
|
124
|
+
ON public.tenant_auth_policies (tenant_id);
|
|
125
|
+
|
|
126
|
+
-- Preserve the pre-native-auth behavior for existing tenants explicitly:
|
|
127
|
+
-- local password is enabled and validated global Google/Microsoft routes are
|
|
128
|
+
-- permitted by an active policy. Tenant-specific Entra references can then
|
|
129
|
+
-- replace general Microsoft without leaving older tenants policy-less.
|
|
130
|
+
INSERT INTO public.tenant_auth_policies (
|
|
131
|
+
tenant_id,
|
|
132
|
+
local_password_enabled,
|
|
133
|
+
status,
|
|
134
|
+
revision,
|
|
135
|
+
created_at,
|
|
136
|
+
updated_at
|
|
137
|
+
)
|
|
138
|
+
SELECT id, true, 'active', 1, now(), now()
|
|
139
|
+
FROM public.tenants
|
|
140
|
+
ON CONFLICT (tenant_id) DO NOTHING;
|
|
141
|
+
|
|
142
|
+
CREATE OR REPLACE FUNCTION public.ensure_default_tenant_auth_policy()
|
|
143
|
+
RETURNS trigger
|
|
144
|
+
LANGUAGE plpgsql
|
|
145
|
+
AS $$
|
|
146
|
+
BEGIN
|
|
147
|
+
INSERT INTO public.tenant_auth_policies (
|
|
148
|
+
tenant_id,
|
|
149
|
+
local_password_enabled,
|
|
150
|
+
status,
|
|
151
|
+
revision,
|
|
152
|
+
created_at,
|
|
153
|
+
updated_at
|
|
154
|
+
) VALUES (NEW.id, true, 'active', 1, now(), now())
|
|
155
|
+
ON CONFLICT (tenant_id) DO NOTHING;
|
|
156
|
+
RETURN NEW;
|
|
157
|
+
END;
|
|
158
|
+
$$;
|
|
159
|
+
|
|
160
|
+
DROP TRIGGER IF EXISTS trg_tenants_default_auth_policy ON public.tenants;
|
|
161
|
+
CREATE TRIGGER trg_tenants_default_auth_policy
|
|
162
|
+
AFTER INSERT ON public.tenants
|
|
163
|
+
FOR EACH ROW
|
|
164
|
+
EXECUTE FUNCTION public.ensure_default_tenant_auth_policy();
|
|
165
|
+
|
|
166
|
+
CREATE TABLE IF NOT EXISTS public.tenant_auth_hosts (
|
|
167
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
168
|
+
tenant_id uuid NOT NULL REFERENCES public.tenants(id) ON DELETE RESTRICT,
|
|
169
|
+
hostname text NOT NULL,
|
|
170
|
+
status text NOT NULL DEFAULT 'pending',
|
|
171
|
+
verified_at timestamptz,
|
|
172
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
173
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
174
|
+
CONSTRAINT tenant_auth_hosts_status_allowed
|
|
175
|
+
CHECK (status IN ('pending', 'verified', 'disabled'))
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_tenant_auth_hosts_hostname
|
|
179
|
+
ON public.tenant_auth_hosts (hostname);
|
|
180
|
+
CREATE INDEX IF NOT EXISTS idx_tenant_auth_hosts_tenant_status
|
|
181
|
+
ON public.tenant_auth_hosts (tenant_id, status);
|
|
182
|
+
|
|
183
|
+
CREATE TABLE IF NOT EXISTS public.auth_route_clients (
|
|
184
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
185
|
+
route_key text NOT NULL,
|
|
186
|
+
client_family text NOT NULL,
|
|
187
|
+
cognito_user_pool_id text NOT NULL,
|
|
188
|
+
cognito_app_client_id text NOT NULL,
|
|
189
|
+
provider_names jsonb NOT NULL DEFAULT '[]'::jsonb,
|
|
190
|
+
explicit_auth_flows jsonb NOT NULL DEFAULT '[]'::jsonb,
|
|
191
|
+
redirect_uris jsonb NOT NULL DEFAULT '[]'::jsonb,
|
|
192
|
+
logout_uris jsonb NOT NULL DEFAULT '[]'::jsonb,
|
|
193
|
+
lifecycle_state text NOT NULL DEFAULT 'native',
|
|
194
|
+
validation_status text NOT NULL DEFAULT 'unconfigured',
|
|
195
|
+
desired_revision integer NOT NULL DEFAULT 1,
|
|
196
|
+
resource_arn text,
|
|
197
|
+
diagnostics jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
198
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
199
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
200
|
+
CONSTRAINT auth_route_clients_lifecycle_allowed
|
|
201
|
+
CHECK (lifecycle_state IN ('coexistence', 'native', 'denied')),
|
|
202
|
+
CONSTRAINT auth_route_clients_validation_allowed
|
|
203
|
+
CHECK (validation_status IN ('unconfigured', 'validating', 'valid', 'partially_valid', 'invalid', 'rotating_secret', 'disabled'))
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_auth_route_clients_route_family
|
|
207
|
+
ON public.auth_route_clients (route_key, client_family);
|
|
208
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_auth_route_clients_app_client
|
|
209
|
+
ON public.auth_route_clients (cognito_app_client_id);
|
|
210
|
+
CREATE INDEX IF NOT EXISTS idx_auth_route_clients_lifecycle_status
|
|
211
|
+
ON public.auth_route_clients (lifecycle_state, validation_status);
|
|
212
|
+
|
|
213
|
+
CREATE TABLE IF NOT EXISTS public.user_auth_identities (
|
|
214
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
215
|
+
tenant_id uuid NOT NULL REFERENCES public.tenants(id) ON DELETE RESTRICT,
|
|
216
|
+
user_id uuid NOT NULL REFERENCES public.users(id) ON DELETE RESTRICT,
|
|
217
|
+
auth_provider_resource_id uuid REFERENCES public.auth_provider_resources(id) ON DELETE RESTRICT,
|
|
218
|
+
cognito_issuer text NOT NULL,
|
|
219
|
+
cognito_sub text NOT NULL,
|
|
220
|
+
provider_issuer text NOT NULL,
|
|
221
|
+
provider_subject text NOT NULL,
|
|
222
|
+
status text NOT NULL DEFAULT 'pending_proof',
|
|
223
|
+
proof_kind text NOT NULL,
|
|
224
|
+
evidence jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
225
|
+
activated_at timestamptz,
|
|
226
|
+
quarantined_at timestamptz,
|
|
227
|
+
revoked_at timestamptz,
|
|
228
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
229
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
230
|
+
CONSTRAINT user_auth_identities_status_allowed
|
|
231
|
+
CHECK (status IN ('pending_proof', 'active', 'quarantined', 'revoked')),
|
|
232
|
+
CONSTRAINT user_auth_identities_active_has_resource
|
|
233
|
+
CHECK (status = 'quarantined' OR auth_provider_resource_id IS NOT NULL)
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
-- 0288 SUPERSEDED the one-per-subject index: enrollment is one lane per
|
|
237
|
+
-- (subject, connection) now. This file is replayed as desired state on
|
|
238
|
+
-- every deploy (deploy.yml native-auth loop), so it must describe the
|
|
239
|
+
-- CURRENT index — recreating the old one fails on any multi-lane DB.
|
|
240
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_user_auth_identities_sub_connection
|
|
241
|
+
ON public.user_auth_identities (cognito_issuer, cognito_sub, auth_provider_resource_id);
|
|
242
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_user_auth_identities_provider_subject
|
|
243
|
+
ON public.user_auth_identities (auth_provider_resource_id, provider_issuer, provider_subject);
|
|
244
|
+
CREATE INDEX IF NOT EXISTS idx_user_auth_identities_user_status
|
|
245
|
+
ON public.user_auth_identities (user_id, status);
|
|
246
|
+
CREATE INDEX IF NOT EXISTS idx_user_auth_identities_tenant_status
|
|
247
|
+
ON public.user_auth_identities (tenant_id, status);
|
|
248
|
+
|
|
249
|
+
CREATE TABLE IF NOT EXISTS public.auth_identity_enrollments (
|
|
250
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
251
|
+
tenant_id uuid NOT NULL REFERENCES public.tenants(id) ON DELETE RESTRICT,
|
|
252
|
+
intended_user_id uuid REFERENCES public.users(id) ON DELETE RESTRICT,
|
|
253
|
+
recipient_grant_kind text NOT NULL,
|
|
254
|
+
recipient_grant_id uuid NOT NULL,
|
|
255
|
+
auth_provider_resource_id uuid NOT NULL REFERENCES public.auth_provider_resources(id) ON DELETE RESTRICT,
|
|
256
|
+
auth_route_client_id uuid NOT NULL REFERENCES public.auth_route_clients(id) ON DELETE RESTRICT,
|
|
257
|
+
redirect_uri text NOT NULL,
|
|
258
|
+
nonce_digest text NOT NULL,
|
|
259
|
+
recipient_challenge_digest text NOT NULL,
|
|
260
|
+
status text NOT NULL DEFAULT 'pending',
|
|
261
|
+
expires_at timestamptz NOT NULL,
|
|
262
|
+
consumed_at timestamptz,
|
|
263
|
+
proof jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
264
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
265
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
266
|
+
CONSTRAINT auth_identity_enrollments_status_allowed
|
|
267
|
+
CHECK (status IN ('pending', 'consumed', 'expired', 'revoked')),
|
|
268
|
+
CONSTRAINT auth_identity_enrollments_grant_kind_allowed
|
|
269
|
+
CHECK (recipient_grant_kind IN ('membership', 'pending_owner'))
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_auth_identity_enrollments_nonce
|
|
273
|
+
ON public.auth_identity_enrollments (nonce_digest);
|
|
274
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_auth_identity_enrollments_challenge
|
|
275
|
+
ON public.auth_identity_enrollments (recipient_challenge_digest);
|
|
276
|
+
CREATE INDEX IF NOT EXISTS idx_auth_identity_enrollments_pending
|
|
277
|
+
ON public.auth_identity_enrollments (tenant_id, status, expires_at);
|
|
278
|
+
|
|
279
|
+
CREATE TABLE IF NOT EXISTS public.auth_reconciliation_sets (
|
|
280
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
281
|
+
stage text NOT NULL,
|
|
282
|
+
revision integer NOT NULL,
|
|
283
|
+
idempotency_key text NOT NULL,
|
|
284
|
+
manifest_fingerprint text NOT NULL,
|
|
285
|
+
desired_connections jsonb NOT NULL,
|
|
286
|
+
status text NOT NULL DEFAULT 'pending',
|
|
287
|
+
applied_at timestamptz,
|
|
288
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
289
|
+
CONSTRAINT auth_reconciliation_sets_status_allowed
|
|
290
|
+
CHECK (status IN ('pending', 'applied', 'rejected'))
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_auth_reconciliation_sets_stage_revision
|
|
294
|
+
ON public.auth_reconciliation_sets (stage, revision);
|
|
295
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_auth_reconciliation_sets_idempotency
|
|
296
|
+
ON public.auth_reconciliation_sets (idempotency_key);
|
|
297
|
+
|
|
298
|
+
CREATE TABLE IF NOT EXISTS public.auth_cutover_runs (
|
|
299
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
300
|
+
stage text NOT NULL,
|
|
301
|
+
tenant_id uuid,
|
|
302
|
+
inventory_fingerprint text NOT NULL,
|
|
303
|
+
status text NOT NULL DEFAULT 'inventory',
|
|
304
|
+
terminal_dispositions jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
305
|
+
client_shutdown_evidence jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
306
|
+
drain_evidence jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
307
|
+
started_at timestamptz NOT NULL DEFAULT now(),
|
|
308
|
+
completed_at timestamptz,
|
|
309
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
310
|
+
CONSTRAINT auth_cutover_runs_status_allowed
|
|
311
|
+
CHECK (status IN ('inventory', 'ready', 'cutting_over', 'soaking', 'rollback_required', 'complete', 'failed'))
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_auth_cutover_runs_stage_inventory
|
|
315
|
+
ON public.auth_cutover_runs (stage, inventory_fingerprint);
|
|
316
|
+
CREATE INDEX IF NOT EXISTS idx_auth_cutover_runs_status
|
|
317
|
+
ON public.auth_cutover_runs (stage, status);
|
|
318
|
+
|
|
319
|
+
CREATE TABLE IF NOT EXISTS public.auth_identity_proofs (
|
|
320
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
321
|
+
user_auth_identity_id uuid NOT NULL REFERENCES public.user_auth_identities(id) ON DELETE RESTRICT,
|
|
322
|
+
proof_digest text NOT NULL,
|
|
323
|
+
proof_kind text NOT NULL,
|
|
324
|
+
evidence jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
325
|
+
observed_at timestamptz NOT NULL DEFAULT now(),
|
|
326
|
+
created_at timestamptz NOT NULL DEFAULT now()
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_auth_identity_proofs_digest
|
|
330
|
+
ON public.auth_identity_proofs (proof_digest);
|
|
331
|
+
CREATE INDEX IF NOT EXISTS idx_auth_identity_proofs_identity
|
|
332
|
+
ON public.auth_identity_proofs (user_auth_identity_id);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
-- One-use AppSync authorization tickets and durable revocation invalidations.
|
|
2
|
+
-- creates: public.auth_subscription_tickets
|
|
3
|
+
-- creates: public.auth_subscription_invalidations
|
|
4
|
+
|
|
5
|
+
CREATE TABLE IF NOT EXISTS "auth_subscription_tickets" (
|
|
6
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
7
|
+
"nonce_digest" text NOT NULL,
|
|
8
|
+
"kind" text NOT NULL,
|
|
9
|
+
"status" text DEFAULT 'issued' NOT NULL,
|
|
10
|
+
"stage" text NOT NULL,
|
|
11
|
+
"appsync_api_id" text NOT NULL,
|
|
12
|
+
"key_id" text NOT NULL,
|
|
13
|
+
"cognito_issuer" text NOT NULL,
|
|
14
|
+
"cognito_sub" text NOT NULL,
|
|
15
|
+
"user_id" uuid NOT NULL REFERENCES "users"("id") ON DELETE restrict,
|
|
16
|
+
"tenant_id" uuid NOT NULL REFERENCES "tenants"("id") ON DELETE restrict,
|
|
17
|
+
"auth_route_client_id" uuid NOT NULL REFERENCES "auth_route_clients"("id") ON DELETE restrict,
|
|
18
|
+
"operation_name" text,
|
|
19
|
+
"operation_hash" text,
|
|
20
|
+
"resource_kind" text,
|
|
21
|
+
"resource_id" text,
|
|
22
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
23
|
+
"consumed_at" timestamp with time zone,
|
|
24
|
+
"revoked_at" timestamp with time zone,
|
|
25
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
26
|
+
CONSTRAINT "auth_subscription_tickets_kind_allowed"
|
|
27
|
+
CHECK ("kind" IN ('connect', 'registration')),
|
|
28
|
+
CONSTRAINT "auth_subscription_tickets_status_allowed"
|
|
29
|
+
CHECK ("status" IN ('issued', 'consumed', 'expired', 'revoked')),
|
|
30
|
+
CONSTRAINT "auth_subscription_tickets_operation_shape"
|
|
31
|
+
CHECK (("kind" = 'connect' AND "operation_name" IS NULL AND "operation_hash" IS NULL)
|
|
32
|
+
OR ("kind" = 'registration' AND "operation_name" IS NOT NULL AND "operation_hash" IS NOT NULL))
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "uq_auth_subscription_tickets_nonce"
|
|
36
|
+
ON "auth_subscription_tickets" ("nonce_digest");
|
|
37
|
+
CREATE INDEX IF NOT EXISTS "idx_auth_subscription_tickets_principal"
|
|
38
|
+
ON "auth_subscription_tickets" ("cognito_issuer", "cognito_sub", "status");
|
|
39
|
+
CREATE INDEX IF NOT EXISTS "idx_auth_subscription_tickets_expiry"
|
|
40
|
+
ON "auth_subscription_tickets" ("status", "expires_at");
|
|
41
|
+
|
|
42
|
+
CREATE TABLE IF NOT EXISTS "auth_subscription_invalidations" (
|
|
43
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
44
|
+
"tenant_id" uuid NOT NULL REFERENCES "tenants"("id") ON DELETE restrict,
|
|
45
|
+
"user_id" uuid REFERENCES "users"("id") ON DELETE restrict,
|
|
46
|
+
"resource_kind" text NOT NULL,
|
|
47
|
+
"resource_id" text,
|
|
48
|
+
"reason" text NOT NULL,
|
|
49
|
+
"status" text DEFAULT 'pending' NOT NULL,
|
|
50
|
+
"attempts" integer DEFAULT 0 NOT NULL,
|
|
51
|
+
"available_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
52
|
+
"processed_at" timestamp with time zone,
|
|
53
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
54
|
+
CONSTRAINT "auth_subscription_invalidations_status_allowed"
|
|
55
|
+
CHECK ("status" IN ('pending', 'processing', 'complete', 'failed'))
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
CREATE INDEX IF NOT EXISTS "idx_auth_subscription_invalidations_pending"
|
|
59
|
+
ON "auth_subscription_invalidations" ("status", "available_at");
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
-- creates-constraint: public.agents.agents_runtime_check
|
|
2
|
+
-- Canonicalize the application runtime identifier from the proof-era
|
|
3
|
+
-- `harness` token to `agentcore`. AWS resource names, OAuth scopes, and
|
|
4
|
+
-- diagnostics may still use Harness terminology; persisted runtime routing
|
|
5
|
+
-- state must not.
|
|
6
|
+
--
|
|
7
|
+
-- Hand-rolled (NOT registered in meta/_journal.json) — apply via psql:
|
|
8
|
+
-- psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f packages/database-pg/drizzle/0263_agentcore_runtime_identifier.sql
|
|
9
|
+
|
|
10
|
+
BEGIN;
|
|
11
|
+
|
|
12
|
+
UPDATE public.agents
|
|
13
|
+
SET runtime = 'agentcore'
|
|
14
|
+
WHERE lower(runtime) = 'harness';
|
|
15
|
+
|
|
16
|
+
UPDATE public.agents
|
|
17
|
+
SET runtime_config = jsonb_set(
|
|
18
|
+
runtime_config,
|
|
19
|
+
'{defaultThreadRuntime}',
|
|
20
|
+
'"agentcore"'::jsonb,
|
|
21
|
+
true
|
|
22
|
+
)
|
|
23
|
+
WHERE jsonb_typeof(runtime_config) = 'object'
|
|
24
|
+
AND lower(runtime_config ->> 'defaultThreadRuntime') = 'harness';
|
|
25
|
+
|
|
26
|
+
UPDATE public.threads
|
|
27
|
+
SET metadata = jsonb_set(
|
|
28
|
+
metadata,
|
|
29
|
+
'{requestedRuntime}',
|
|
30
|
+
'"agentcore"'::jsonb,
|
|
31
|
+
true
|
|
32
|
+
)
|
|
33
|
+
WHERE jsonb_typeof(metadata) = 'object'
|
|
34
|
+
AND lower(metadata ->> 'requestedRuntime') = 'harness';
|
|
35
|
+
|
|
36
|
+
UPDATE public.messages
|
|
37
|
+
SET metadata = jsonb_set(
|
|
38
|
+
metadata,
|
|
39
|
+
'{requestedRuntime}',
|
|
40
|
+
'"agentcore"'::jsonb,
|
|
41
|
+
true
|
|
42
|
+
)
|
|
43
|
+
WHERE jsonb_typeof(metadata) = 'object'
|
|
44
|
+
AND lower(metadata ->> 'requestedRuntime') = 'harness';
|
|
45
|
+
|
|
46
|
+
UPDATE public.thread_turns
|
|
47
|
+
SET runtime_type = 'agentcore'
|
|
48
|
+
WHERE lower(runtime_type) = 'harness';
|
|
49
|
+
|
|
50
|
+
UPDATE public.cost_events
|
|
51
|
+
SET runtime_type = 'agentcore'
|
|
52
|
+
WHERE lower(runtime_type) = 'harness';
|
|
53
|
+
|
|
54
|
+
UPDATE public.trace_runs
|
|
55
|
+
SET runtime_type = 'agentcore'
|
|
56
|
+
WHERE lower(runtime_type) = 'harness';
|
|
57
|
+
|
|
58
|
+
UPDATE public.harness_managed_thread_enrollments
|
|
59
|
+
SET prior_runtime = 'agentcore'
|
|
60
|
+
WHERE lower(prior_runtime) = 'harness';
|
|
61
|
+
|
|
62
|
+
ALTER TABLE public.agents
|
|
63
|
+
DROP CONSTRAINT IF EXISTS agents_runtime_check;
|
|
64
|
+
|
|
65
|
+
ALTER TABLE public.agents
|
|
66
|
+
ADD CONSTRAINT agents_runtime_check
|
|
67
|
+
CHECK (runtime IN ('strands', 'flue', 'pi', 'agentcore'));
|
|
68
|
+
|
|
69
|
+
COMMIT;
|