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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- THINK-585 U6 (KTD3): per-agent AgentCore Runtime dispatch flag.
|
|
2
|
+
-- When true AND the stage kill-switch (AGENTCORE_RUNTIME_DISPATCH_ENABLED
|
|
3
|
+
-- runtime-config key) is on, chat turns dispatch through the
|
|
4
|
+
-- agentcore-runtime-dispatch Lambda to the Bedrock AgentCore Runtime with a
|
|
5
|
+
-- per-thread session instead of the Pi Lambda. Additive + default false —
|
|
6
|
+
-- safe to apply ahead of code deploy.
|
|
7
|
+
--
|
|
8
|
+
-- Hand-rolled (drizzle meta journal is not in use for this change);
|
|
9
|
+
-- apply with: psql "$DATABASE_URL" -f drizzle/0283_agents_agentcore_runtime_dispatch.sql
|
|
10
|
+
-- creates-column: public.agents.agentcore_runtime_dispatch
|
|
11
|
+
|
|
12
|
+
ALTER TABLE public.agents
|
|
13
|
+
ADD COLUMN IF NOT EXISTS agentcore_runtime_dispatch boolean NOT NULL DEFAULT false;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
-- User brain claims (THINK-625): per-(tenant, user) Company Brain
|
|
2
|
+
-- authorization, the write side of the user-claims/v1 manifest published to
|
|
3
|
+
-- `user-claims/<tenantId>/latest.json` in the brain-artifacts bucket.
|
|
4
|
+
--
|
|
5
|
+
-- Ships three things that must land together, because the publisher is
|
|
6
|
+
-- useless without the safety interlock and the audit row cannot be written
|
|
7
|
+
-- without the widened event-type constraint:
|
|
8
|
+
-- 1. the user_brain_claims table,
|
|
9
|
+
-- 2. tenant_settings.brain_user_claims_enabled (default false),
|
|
10
|
+
-- 3. the tenant_policy_events event_type CHECK widened to accept
|
|
11
|
+
-- 'user_brain_claims' (renamed to _v2 so drift is detectable).
|
|
12
|
+
--
|
|
13
|
+
-- Hand-rolled (partial-index-free but with a NULL-vs-empty array column the
|
|
14
|
+
-- generator flattens; mirrors the 0274/0281/0282 convention). Not registered
|
|
15
|
+
-- in meta/_journal.json.
|
|
16
|
+
-- Apply via: psql "$DATABASE_URL" -f drizzle/0284_user_brain_claims.sql
|
|
17
|
+
-- creates: public.user_brain_claims
|
|
18
|
+
-- creates: public.uq_user_brain_claims_tenant_user
|
|
19
|
+
-- creates: public.idx_user_brain_claims_tenant
|
|
20
|
+
-- creates-column: public.tenant_settings.brain_user_claims_enabled
|
|
21
|
+
-- creates-constraint: public.tenant_policy_events.tenant_policy_events_event_type_allowed_v2
|
|
22
|
+
|
|
23
|
+
CREATE TABLE IF NOT EXISTS public.user_brain_claims (
|
|
24
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
25
|
+
tenant_id uuid NOT NULL REFERENCES public.tenants(id) ON DELETE CASCADE,
|
|
26
|
+
user_id uuid NOT NULL REFERENCES public.users(id) ON DELETE CASCADE,
|
|
27
|
+
-- '[]' = PUBLIC graph only; ARRAY['*'] = every group.
|
|
28
|
+
security_groups text[] NOT NULL DEFAULT ARRAY[]::text[],
|
|
29
|
+
-- KB is grant-only: '[]' = no KB at all; ARRAY['*'] = every collection.
|
|
30
|
+
kb_collections text[] NOT NULL DEFAULT ARRAY[]::text[],
|
|
31
|
+
kb_bundles jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
32
|
+
default_kb_bundle text,
|
|
33
|
+
-- NULL is DISTINCT from '{}': NULL = the Brain surface default applies,
|
|
34
|
+
-- '{}' = no tools at all. Never coalesce one into the other.
|
|
35
|
+
tool_allowlist text[],
|
|
36
|
+
is_operator boolean NOT NULL DEFAULT false,
|
|
37
|
+
kb_trace boolean NOT NULL DEFAULT false,
|
|
38
|
+
-- false still publishes an entry (disabled: true) so the Brain fails
|
|
39
|
+
-- closed rather than falling back to legacy group grants.
|
|
40
|
+
enabled boolean NOT NULL DEFAULT true,
|
|
41
|
+
notes text,
|
|
42
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
43
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
44
|
+
updated_by_user_id uuid
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_user_brain_claims_tenant_user
|
|
48
|
+
ON public.user_brain_claims (tenant_id, user_id);
|
|
49
|
+
|
|
50
|
+
CREATE INDEX IF NOT EXISTS idx_user_brain_claims_tenant
|
|
51
|
+
ON public.user_brain_claims (tenant_id);
|
|
52
|
+
|
|
53
|
+
-- Per-tenant enable flag. Default false everywhere: claims rows are
|
|
54
|
+
-- editable with no publish until an operator flips this on.
|
|
55
|
+
ALTER TABLE public.tenant_settings
|
|
56
|
+
ADD COLUMN IF NOT EXISTS brain_user_claims_enabled boolean NOT NULL DEFAULT false;
|
|
57
|
+
|
|
58
|
+
-- Widen the audited event types. The old constraint is dropped and a
|
|
59
|
+
-- freshly-named one created so `pnpm db:migrate-manual` can prove the
|
|
60
|
+
-- widened version is actually present in the target database.
|
|
61
|
+
ALTER TABLE public.tenant_policy_events
|
|
62
|
+
DROP CONSTRAINT IF EXISTS tenant_policy_events_event_type_allowed;
|
|
63
|
+
|
|
64
|
+
ALTER TABLE public.tenant_policy_events
|
|
65
|
+
DROP CONSTRAINT IF EXISTS tenant_policy_events_event_type_allowed_v2;
|
|
66
|
+
|
|
67
|
+
ALTER TABLE public.tenant_policy_events
|
|
68
|
+
ADD CONSTRAINT tenant_policy_events_event_type_allowed_v2
|
|
69
|
+
CHECK (event_type IN ('sandbox_enabled','compliance_tier','user_brain_claims'));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
-- Trusted-subsystem marker on tenant_mcp_twin_keys (THINK-626) — the write
|
|
2
|
+
-- side of the `trustedSubsystem` field in key manifest v2
|
|
3
|
+
-- (twin-mcp-keys/v2; reader is company-brain brain-mcp/src/auth.ts).
|
|
4
|
+
--
|
|
5
|
+
-- true lets the key assert `on_behalf_of` per tools/call — running the call
|
|
6
|
+
-- under the named signed-in human's user-claims entry instead of under the
|
|
7
|
+
-- key's own grants. It is NOT a grant and it can never widen anyone: the
|
|
8
|
+
-- asserted user's grants come from the user-claims manifest, and a tenant
|
|
9
|
+
-- that publishes none refuses the assertion. It belongs only on keys the
|
|
10
|
+
-- platform itself holds (the Pi runtime's provisioned "default" connector
|
|
11
|
+
-- key), never on one handed to a customer's client — hence default false
|
|
12
|
+
-- and no backfill for user-minted rows.
|
|
13
|
+
--
|
|
14
|
+
-- Hand-rolled (mirrors the 0274/0281/0282 convention; not registered in
|
|
15
|
+
-- meta/_journal.json).
|
|
16
|
+
-- Apply via: psql "$DATABASE_URL" -f drizzle/0285_tenant_mcp_twin_keys_trusted_subsystem.sql
|
|
17
|
+
-- creates-column: public.tenant_mcp_twin_keys.trusted_subsystem
|
|
18
|
+
|
|
19
|
+
ALTER TABLE public.tenant_mcp_twin_keys
|
|
20
|
+
ADD COLUMN IF NOT EXISTS trusted_subsystem boolean NOT NULL DEFAULT false;
|
|
21
|
+
|
|
22
|
+
-- The platform-provisioned connector key ("default") is the ThinkWork Pi
|
|
23
|
+
-- runtime's own key — the one and only principal that may speak for a
|
|
24
|
+
-- signed-in human. Grandfather every active one; re-provisioning would set
|
|
25
|
+
-- the same flag anyway. User-minted keys stay false.
|
|
26
|
+
UPDATE public.tenant_mcp_twin_keys
|
|
27
|
+
SET trusted_subsystem = true
|
|
28
|
+
WHERE name = 'default'
|
|
29
|
+
AND revoked_at IS NULL
|
|
30
|
+
AND trusted_subsystem = false;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
-- Analytics-channel visibility flag on Brain principals (THINK-656 D4) —
|
|
2
|
+
-- the write side of the `analyticsKey` field in both published manifests:
|
|
3
|
+
-- user-claims/v1 (per-user entries) and twin-mcp-keys/v2 (key entries).
|
|
4
|
+
-- Reader is company-brain brain-mcp/src/auth.ts, which parses literal true
|
|
5
|
+
-- only: `analyticsKey: true` lets the principal's brain_ask loop consult
|
|
6
|
+
-- the mart_analytics briefing tools. Tool VISIBILITY only, never a data
|
|
7
|
+
-- grant — the marts hold the tenant's own data and every query still runs
|
|
8
|
+
-- under the account's env gates (ANALYTICS_ENABLED et al.).
|
|
9
|
+
--
|
|
10
|
+
-- Default TRUE by decision (Eric, 2026-08-08): every user and key gets the
|
|
11
|
+
-- analytics channel unless an operator turns it off per row. There is no
|
|
12
|
+
-- console UI for the flag yet; the column is the future toggle. The NOT
|
|
13
|
+
-- NULL DEFAULT true also backfills every existing row, which matches the
|
|
14
|
+
-- 2026-08-07 go-live hand-edits this migration makes durable.
|
|
15
|
+
--
|
|
16
|
+
-- Hand-rolled (mirrors the 0274/0281/0282/0284/0285 convention; not
|
|
17
|
+
-- registered in meta/_journal.json).
|
|
18
|
+
-- Apply via: psql "$DATABASE_URL" -f drizzle/0286_brain_analytics_key.sql
|
|
19
|
+
-- creates-column: public.tenant_mcp_twin_keys.analytics_key
|
|
20
|
+
-- creates-column: public.user_brain_claims.analytics_key
|
|
21
|
+
|
|
22
|
+
ALTER TABLE public.tenant_mcp_twin_keys
|
|
23
|
+
ADD COLUMN IF NOT EXISTS analytics_key boolean NOT NULL DEFAULT true;
|
|
24
|
+
|
|
25
|
+
ALTER TABLE public.user_brain_claims
|
|
26
|
+
ADD COLUMN IF NOT EXISTS analytics_key boolean NOT NULL DEFAULT true;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- Brain-pool subject on Brain principals (THINK-625 backfill gap) — the
|
|
2
|
+
-- write side of the `subject` field in user-claims/v1.
|
|
3
|
+
--
|
|
4
|
+
-- The manifest published `users.cognito_sub` as `subject`, but that column
|
|
5
|
+
-- is the user's sub in THIS product's Cognito pool. The Brain MCP has its
|
|
6
|
+
-- OWN end-user pool, and a federated (Google/Microsoft) sign-in there mints
|
|
7
|
+
-- a DIFFERENT sub — so the published subject never matched the Brain access
|
|
8
|
+
-- token, claims resolution fell closed to emptyGrants(), and an HR user's
|
|
9
|
+
-- payroll ask was refused (TEI, 2026-08-12). Access tokens carry no email
|
|
10
|
+
-- claim, so the reader's email fallback cannot save the mismatch.
|
|
11
|
+
--
|
|
12
|
+
-- This column holds the sub the user's Brain tokens actually carry. It is
|
|
13
|
+
-- captured at the ONE place the product ever sees a Brain token: the
|
|
14
|
+
-- mcp-oauth callback (skills.ts), which decodes the access token it just
|
|
15
|
+
-- exchanged and republishes the manifest. The manifest publisher prefers
|
|
16
|
+
-- brain_subject over users.cognito_sub; NULL (never captured) keeps
|
|
17
|
+
-- today's fallback byte-identical.
|
|
18
|
+
--
|
|
19
|
+
-- Hand-rolled (mirrors the 0274/0281/0282/0284/0285/0286 convention; not
|
|
20
|
+
-- registered in meta/_journal.json).
|
|
21
|
+
-- Apply via: psql "$DATABASE_URL" -f drizzle/0287_brain_subject.sql
|
|
22
|
+
-- creates-column: public.user_brain_claims.brain_subject
|
|
23
|
+
|
|
24
|
+
ALTER TABLE public.user_brain_claims
|
|
25
|
+
ADD COLUMN IF NOT EXISTS brain_subject text;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- Multi-lane identity enrollment (Eric 2026-08-15: "I need all three" —
|
|
2
|
+
-- email, Google AND Microsoft sign-in for one person).
|
|
3
|
+
--
|
|
4
|
+
-- uq_user_auth_identities_cognito_sub allowed ONE enrollment per Cognito
|
|
5
|
+
-- subject, total. But a Cognito user with linked providers carries one sub
|
|
6
|
+
-- across lanes (password + Microsoft on the same sub), so whichever lane
|
|
7
|
+
-- enrolled first consumed the slot and every other lane admitted to
|
|
8
|
+
-- "No tenant assigned". Admission already matches per-connection
|
|
9
|
+
-- (auth-admission.ts: identity.authProviderResourceId === route.connectionId);
|
|
10
|
+
-- the index was the only thing forcing one lane per person.
|
|
11
|
+
--
|
|
12
|
+
-- One row per (subject, connection) from now on. The invariant that one
|
|
13
|
+
-- Cognito subject maps to ONE product user is no longer carried by this
|
|
14
|
+
-- index — the writers enforce it (cross-user guard in auto-link, enrollment
|
|
15
|
+
-- consume, and invite).
|
|
16
|
+
--
|
|
17
|
+
-- Hand-rolled (mirrors the 0274..0287 convention; not registered in
|
|
18
|
+
-- meta/_journal.json).
|
|
19
|
+
-- Apply via: psql "$DATABASE_URL" -f drizzle/0288_multi_lane_identities.sql
|
|
20
|
+
-- drops: public.uq_user_auth_identities_cognito_sub
|
|
21
|
+
-- creates: public.uq_user_auth_identities_sub_connection
|
|
22
|
+
|
|
23
|
+
DROP INDEX IF EXISTS public.uq_user_auth_identities_cognito_sub;
|
|
24
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_user_auth_identities_sub_connection
|
|
25
|
+
ON public.user_auth_identities (cognito_issuer, cognito_sub, auth_provider_resource_id);
|