thinkwork-cli 0.12.16 → 0.13.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.
Files changed (149) hide show
  1. package/dist/cli.js +517 -10403
  2. package/dist/commands/enterprise/templates/deploy-repo/docs/runbook.md +3 -8
  3. package/dist/commands/enterprise/templates/deploy-repo/terraform/main.tf +1 -184
  4. package/dist/drizzle/0050_brain_v0_entity_subtype.sql +2 -2
  5. package/dist/drizzle/0051_brain_v0_tenant_entity_pages.sql +6 -6
  6. package/dist/drizzle/0052_brain_v0_external_refs.sql +2 -2
  7. package/dist/drizzle/0053_brain_v0_unresolved_mentions_subtype.sql +2 -2
  8. package/dist/drizzle/0145_knowledge_graph_thread_ingest.sql +14 -14
  9. package/dist/drizzle/0146_knowledge_graph_source_scope.sql +1 -1
  10. package/dist/drizzle/0157_knowledge_graph_observations_source.sql +2 -2
  11. package/dist/drizzle/0158_wiki_tenant_scope.sql +1 -1
  12. package/dist/drizzle/0165_plugin_premium_entitlements.sql +2 -2
  13. package/dist/drizzle/{0166_company_brain_substrate_contract.sql → 0166_brain_substrate_contract.sql} +9 -9
  14. package/dist/drizzle/{0167_company_brain_artifact_manifest_runtime.sql → 0167_brain_artifact_manifest_runtime.sql} +5 -5
  15. package/dist/drizzle/0168_eval_skill_gate.sql +1 -1
  16. package/dist/drizzle/0183_okf_artifact_manifests.sql +1 -1
  17. package/dist/drizzle/0200_eval_results_execution_tier.sql +40 -0
  18. package/dist/drizzle/0201_brain_dream_runs.sql +72 -0
  19. package/dist/drizzle/0202_backfill_thread_participants_from_senders.sql +110 -0
  20. package/dist/drizzle/0203_threads_mode_override.sql +61 -0
  21. package/dist/drizzle/0204_thread_turns_triggering_message_id.sql +48 -0
  22. package/dist/drizzle/0205_routines_git_python.sql +185 -0
  23. package/dist/drizzle/0206_agent_loop_versions_routine_actions.sql +40 -0
  24. package/dist/drizzle/0207_tenant_credentials_github_repo_kind.sql +52 -0
  25. package/dist/drizzle/0208_knowledge_graph_neutral_identifiers.sql +253 -0
  26. package/dist/drizzle/0209_living_artifacts_schema.sql +109 -0
  27. package/dist/drizzle/0210_think137_automations_additive_schema.sql +113 -0
  28. package/dist/drizzle/0211_backfill_agent_loop_versions_target_spec.sql +120 -0
  29. package/dist/drizzle/0212_fold_webhooks_into_automations.sql +312 -0
  30. package/dist/drizzle/0213_agent_loop_versions_judge_evidence_nullable.sql +63 -0
  31. package/dist/drizzle/0214_think137_drop_judge_evidence_roi.sql +99 -0
  32. package/dist/drizzle/0215_agent_loop_versions_goal_worker_policy_nullable.sql +70 -0
  33. package/dist/drizzle/0216_drop_agent_loop_versions_goal_worker_policy.sql +81 -0
  34. package/dist/drizzle/0217_agents_capability_folder_dispatch.sql +12 -0
  35. package/dist/drizzle/0218_document_plates.sql +30 -0
  36. package/dist/drizzle/0219_document_section_waivers.sql +29 -0
  37. package/dist/drizzle/0220_artifacts_created_by_user.sql +21 -0
  38. package/dist/drizzle/0221_artifact_shares.sql +29 -0
  39. package/dist/drizzle/0221_workflow_interpreter_thin_slice.sql +71 -0
  40. package/dist/drizzle/0222_compliance_drainer_select_audit_events.sql +21 -0
  41. package/dist/drizzle/0223_document_conformance_reports.sql +38 -0
  42. package/dist/drizzle/0224_artifact_refresh_state.sql +11 -0
  43. package/dist/drizzle/0225_think216_agent_loop_convergence.sql +21 -0
  44. package/dist/drizzle/0226_drop_n8n_agent_step_runs.sql +6 -0
  45. package/dist/drizzle/0227_analyst_reader_role.sql +1055 -0
  46. package/dist/drizzle/0228_tenant_credentials_rds_iam_kind.sql +62 -0
  47. package/dist/drizzle/0229_analyst_reader_rds_iam_grant.sql +79 -0
  48. package/dist/drizzle/0230_analyst_rls.sql +1613 -0
  49. package/dist/drizzle/0231_cost_events_cache_write_enforcement_exempt.sql +11 -0
  50. package/dist/plugins/catalog/package.json +0 -1
  51. package/dist/plugins/catalog/src/__tests__/build-catalog.test.ts +0 -1
  52. package/dist/plugins/catalog/src/__tests__/catalog.test.ts +16 -8
  53. package/dist/plugins/catalog/src/__tests__/contracts.test.ts +56 -0
  54. package/dist/plugins/catalog/src/__tests__/plugin-package.test.ts +0 -2
  55. package/dist/plugins/catalog/src/__tests__/plugin-registry.test.ts +0 -5
  56. package/dist/plugins/catalog/src/contracts.ts +112 -0
  57. package/dist/plugins/catalog/src/registry/generated-first-party.ts +0 -6
  58. package/dist/plugins/n8n/README.md +4 -36
  59. package/dist/plugins/n8n/src/deployment/managed-app.ts +0 -17
  60. package/dist/plugins/n8n/src/manifest.ts +0 -5
  61. package/dist/plugins/n8n/terraform/n8n/main.tf +0 -26
  62. package/dist/plugins/n8n/terraform/n8n/outputs.tf +0 -5
  63. package/dist/plugins/n8n/terraform/n8n/variables.tf +0 -6
  64. package/dist/plugins/n8n/test/manifest.test.ts +0 -1
  65. package/dist/plugins/twenty/package.json +5 -0
  66. package/dist/plugins/twenty/scripts/lib/__tests__/load-records.test.ts +232 -0
  67. package/dist/plugins/twenty/scripts/lib/__tests__/mappers.test.ts +489 -0
  68. package/dist/plugins/twenty/scripts/lib/__tests__/members-ensure.test.ts +199 -0
  69. package/dist/plugins/twenty/scripts/lib/__tests__/provision-members-db.test.ts +43 -0
  70. package/dist/plugins/twenty/scripts/lib/__tests__/schema-ensure.test.ts +230 -0
  71. package/dist/plugins/twenty/scripts/lib/__tests__/twenty-client.test.ts +207 -0
  72. package/dist/plugins/twenty/scripts/lib/lastmile-reader.ts +282 -0
  73. package/dist/plugins/twenty/scripts/lib/load-attachments.ts +220 -0
  74. package/dist/plugins/twenty/scripts/lib/load-records.ts +680 -0
  75. package/dist/plugins/twenty/scripts/lib/mappers.ts +559 -0
  76. package/dist/plugins/twenty/scripts/lib/members-ensure.ts +381 -0
  77. package/dist/plugins/twenty/scripts/lib/provision-members-db.ts +191 -0
  78. package/dist/plugins/twenty/scripts/lib/schema-ensure.ts +425 -0
  79. package/dist/plugins/twenty/scripts/lib/twenty-client.ts +246 -0
  80. package/dist/plugins/twenty/scripts/migrate-lastmile.ts +610 -0
  81. package/dist/plugins/twenty/scripts/provision-twenty-members.ts +214 -0
  82. package/dist/plugins/twenty/src/manifest.ts +99 -0
  83. package/dist/plugins/twenty/terraform/twenty/README.md +1 -1
  84. package/dist/plugins/twenty/test/manifest.test.ts +12 -2
  85. package/dist/terraform/examples/greenfield/main.tf +90 -380
  86. package/dist/terraform/examples/greenfield/terraform.tfvars.example +0 -1
  87. package/dist/terraform/modules/app/agentcore-pi/README.md +1 -3
  88. package/dist/terraform/modules/app/agentcore-pi/main.tf +29 -38
  89. package/dist/terraform/modules/app/agentcore-pi/variables.tf +23 -15
  90. package/dist/terraform/modules/app/agentcore-runtime/main.tf +3 -3
  91. package/dist/terraform/modules/app/customer-domain/main.tf +16 -2
  92. package/dist/terraform/modules/app/deployment-control-plane/main.tf +5 -0
  93. package/dist/terraform/modules/app/deployment-control-plane/runner.py +85 -207
  94. package/dist/terraform/modules/app/deployment-control-plane/test_runner_bundle.py +56 -2
  95. package/dist/terraform/modules/app/hindsight-memory/main.tf +52 -4
  96. package/dist/terraform/modules/app/lambda-api/eval-fanout.tf +7 -0
  97. package/dist/terraform/modules/app/lambda-api/handlers.tf +493 -89
  98. package/dist/terraform/modules/app/lambda-api/iam-grouped.tf +215 -96
  99. package/dist/terraform/modules/app/lambda-api/main.tf +24 -5
  100. package/dist/terraform/modules/app/lambda-api/outputs.tf +19 -11
  101. package/dist/terraform/modules/app/lambda-api/variables.tf +94 -67
  102. package/dist/terraform/modules/app/ses-email/main.tf +14 -2
  103. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/main.tf +493 -0
  104. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/outputs.tf +34 -0
  105. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/variables.tf +32 -0
  106. package/dist/terraform/modules/data/aurora-postgres/main.tf +55 -0
  107. package/dist/terraform/modules/data/aurora-postgres/outputs.tf +15 -0
  108. package/dist/terraform/modules/data/s3-buckets/main.tf +26 -0
  109. package/dist/terraform/modules/thinkwork/README.md +0 -1
  110. package/dist/terraform/modules/thinkwork/main.tf +167 -446
  111. package/dist/terraform/modules/thinkwork/outputs.tf +2 -142
  112. package/dist/terraform/modules/thinkwork/variables.tf +55 -309
  113. package/dist/terraform/schema.graphql +4 -0
  114. package/dist/workspace-defaults/files/AGENTS.md +45 -31
  115. package/dist/workspace-defaults/files/CONTEXT.md +48 -4
  116. package/dist/workspace-defaults/files/GUARDRAILS.md +18 -0
  117. package/dist/workspace-defaults/files/MEMORY_GUIDE.md +32 -4
  118. package/dist/workspace-defaults/files/SPACE.md +34 -19
  119. package/dist/workspace-defaults/files/TOOLS.md +30 -0
  120. package/dist/workspace-defaults/files/skills/document-composer/SKILL.md +154 -0
  121. package/dist/workspace-defaults/files/skills/document-composer/references/authoring-rules.md +101 -0
  122. package/package.json +1 -1
  123. package/dist/plugins/company-brain/README.md +0 -37
  124. package/dist/plugins/company-brain/package.json +0 -33
  125. package/dist/plugins/company-brain/runtime/cognee/Dockerfile +0 -11
  126. package/dist/plugins/company-brain/smoke/cognee-managed-app-smoke.mjs +0 -458
  127. package/dist/plugins/company-brain/smoke/cognee-memory-cutover-smoke.mjs +0 -539
  128. package/dist/plugins/company-brain/smoke/company-brain-context-engine-smoke.mjs +0 -312
  129. package/dist/plugins/company-brain/smoke/company-brain-operations-smoke.mjs +0 -449
  130. package/dist/plugins/company-brain/smoke/company-brain-plugin-smoke.mjs +0 -655
  131. package/dist/plugins/company-brain/smoke/hindsight-memory-isolation-smoke.mjs +0 -474
  132. package/dist/plugins/company-brain/src/api/cognee-client.ts +0 -896
  133. package/dist/plugins/company-brain/src/api/cognee-cluster-identity.ts +0 -49
  134. package/dist/plugins/company-brain/src/api/cognee-memory-scope.ts +0 -84
  135. package/dist/plugins/company-brain/src/api/context-engine-provider.ts +0 -888
  136. package/dist/plugins/company-brain/src/api/migration.ts +0 -665
  137. package/dist/plugins/company-brain/src/deployment/cognee-managed-app.ts +0 -396
  138. package/dist/plugins/company-brain/src/index.ts +0 -62
  139. package/dist/plugins/company-brain/src/manifest.ts +0 -112
  140. package/dist/plugins/company-brain/terraform/cognee/README.md +0 -263
  141. package/dist/plugins/company-brain/terraform/cognee/main.tf +0 -766
  142. package/dist/plugins/company-brain/terraform/cognee/outputs.tf +0 -144
  143. package/dist/plugins/company-brain/terraform/cognee/variables.tf +0 -402
  144. package/dist/plugins/company-brain/test/api/cognee-client.test.ts +0 -562
  145. package/dist/plugins/company-brain/test/api/cognee-memory-scope.test.ts +0 -74
  146. package/dist/plugins/company-brain/test/api/context-engine-provider.test.ts +0 -447
  147. package/dist/plugins/company-brain/test/api/migration.test.ts +0 -465
  148. package/dist/plugins/company-brain/test/manifest.test.ts +0 -95
  149. package/dist/plugins/company-brain/tsconfig.json +0 -8
@@ -0,0 +1,62 @@
1
+ -- Purpose: admit 'rds_iam' in the tenant_credentials kind CHECK
2
+ -- (THINK-229 U1 / R2 — analyst connection hardening,
3
+ -- docs/plans/2026-07-08-002-feat-analyst-connection-hardening-plan.md).
4
+ --
5
+ -- rds_iam is the metadata-only credential kind for Thinkwork-owned Aurora:
6
+ -- the row records cluster endpoint, port, database, DB user, and cluster
7
+ -- resource ID in metadata_json; secret_ref is an empty sentinel because no
8
+ -- long-lived secret exists — 15-minute RDS IAM auth tokens are minted
9
+ -- per-connect in the trusted analyst-query-broker Lambda.
10
+ --
11
+ -- The constraint is RENAMED to *_v2 (0160 precedent), not re-added under
12
+ -- the same name: the drift reporter probes constraints by name presence
13
+ -- only, and a same-named constraint with the OLD definition exists on
14
+ -- every stage — a same-name rewrite would read APPLIED everywhere even
15
+ -- when this file never ran, and the first rds_iam insert would then hit
16
+ -- the old CHECK. The rename makes the probe meaningful.
17
+ --
18
+ -- Hand-rolled per convention (drizzle snapshot frozen; precedent
19
+ -- 0160/0207). Guarded so re-runs are no-ops once the v2 definition is in
20
+ -- place.
21
+ --
22
+ -- Apply manually (verification pass before merge):
23
+ -- psql "$DATABASE_URL" -v ON_ERROR_STOP=1 --single-transaction \
24
+ -- -f packages/database-pg/drizzle/0228_tenant_credentials_rds_iam_kind.sql
25
+ --
26
+ -- drops-constraint: public.tenant_credentials.tenant_credentials_kind_enum
27
+ -- creates-constraint: public.tenant_credentials.tenant_credentials_kind_enum_v2
28
+
29
+ \set ON_ERROR_STOP on
30
+
31
+ BEGIN;
32
+
33
+ SELECT pg_advisory_xact_lock(hashtext('tenant_credentials_rds_iam_0228'));
34
+
35
+ SET LOCAL lock_timeout = '5s';
36
+ SET LOCAL statement_timeout = '60s';
37
+
38
+ DO $$
39
+ BEGIN
40
+ IF EXISTS (
41
+ SELECT 1
42
+ FROM pg_constraint
43
+ WHERE conname = 'tenant_credentials_kind_enum'
44
+ AND conrelid = 'public.tenant_credentials'::regclass
45
+ ) THEN
46
+ ALTER TABLE public.tenant_credentials
47
+ DROP CONSTRAINT tenant_credentials_kind_enum;
48
+ END IF;
49
+
50
+ IF NOT EXISTS (
51
+ SELECT 1
52
+ FROM pg_constraint
53
+ WHERE conname = 'tenant_credentials_kind_enum_v2'
54
+ AND conrelid = 'public.tenant_credentials'::regclass
55
+ ) THEN
56
+ ALTER TABLE public.tenant_credentials
57
+ ADD CONSTRAINT tenant_credentials_kind_enum_v2
58
+ CHECK (kind IN ('api_key','bearer_token','basic_auth','soap_partner','webhook_signing_secret','json','github_repo','rds_iam'));
59
+ END IF;
60
+ END $$;
61
+
62
+ COMMIT;
@@ -0,0 +1,79 @@
1
+ -- 0229_analyst_reader_rds_iam_grant.sql
2
+ --
3
+ -- THINK-229 U1 (R1, KTD2): switch analyst_reader to RDS IAM authentication.
4
+ --
5
+ -- `GRANT rds_iam TO analyst_reader` flips the role to IAM-token login:
6
+ -- AWS-documented semantics are that password authentication STOPS WORKING
7
+ -- for the role the moment this membership exists. Apply ordering therefore
8
+ -- matters (KTD2 dual-path):
9
+ --
10
+ -- 1. Broker code with IAM-first-with-password-fallback deploys first
11
+ -- (packages/lambda/analyst-reader-db.ts) and the Terraform env/IAM
12
+ -- wiring (ANALYST_DB_CLUSTER_ENDPOINT + rds-db:connect grant +
13
+ -- iam_database_authentication_enabled on the cluster) is live.
14
+ -- 2. THEN this migration applies to dev via psql (before its PR merges,
15
+ -- per the drift-gate convention). Pre-grant, IAM connect fails and
16
+ -- the password carries; post-grant, password fails and IAM carries.
17
+ -- No coordinated flip, no outage window.
18
+ --
19
+ -- Pre-apply gate (run first — do NOT apply while the cluster flag is
20
+ -- pending, or password auth dies while IAM auth is still refused):
21
+ -- aws rds describe-db-clusters --db-cluster-identifier thinkwork-<stage>-db \
22
+ -- --query 'DBClusters[0].[IAMDatabaseAuthenticationEnabled, PendingModifiedValues]'
23
+ -- → must show `true` and no pending IAM-auth modification.
24
+ --
25
+ -- Rollback: REVOKE rds_iam FROM analyst_reader (restores password login;
26
+ -- the fallback path in the broker picks it up on the next reconnect).
27
+ --
28
+ -- The rds_iam role is provided by RDS/Aurora Postgres on every cluster —
29
+ -- guarded anyway so a non-RDS local Postgres apply fails loudly with a
30
+ -- clear message instead of a bare undefined-role error.
31
+ --
32
+ -- This membership is the single allowlisted exception to 0227's
33
+ -- zero-membership assertion (SET ROLE escalation surface): rds_iam is a
34
+ -- marker role carrying no privileges to inherit (and analyst_reader is
35
+ -- NOINHERIT besides).
36
+ --
37
+ -- Apply manually (hand-rolled — NOT in meta/_journal.json):
38
+ -- psql "$DATABASE_URL" -v ON_ERROR_STOP=1 --single-transaction \
39
+ -- -f packages/database-pg/drizzle/0229_analyst_reader_rds_iam_grant.sql
40
+ --
41
+ -- creates-role-membership: rds_iam:analyst_reader
42
+
43
+ \set ON_ERROR_STOP on
44
+
45
+ BEGIN;
46
+
47
+ SET LOCAL lock_timeout = '5s';
48
+ SET LOCAL statement_timeout = '60s';
49
+
50
+ DO $$
51
+ BEGIN
52
+ IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'rds_iam') THEN
53
+ RAISE EXCEPTION 'role rds_iam does not exist — this migration targets RDS/Aurora Postgres only';
54
+ END IF;
55
+ IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'analyst_reader') THEN
56
+ RAISE EXCEPTION 'role analyst_reader does not exist — apply drizzle/0227_analyst_reader_role.sql first';
57
+ END IF;
58
+ END $$;
59
+
60
+ GRANT rds_iam TO analyst_reader;
61
+
62
+ -- Assert the membership surface is EXACTLY {rds_iam} — the same posture as
63
+ -- 0227's assert, with the single deliberate exception.
64
+ DO $$
65
+ DECLARE
66
+ unexpected text;
67
+ BEGIN
68
+ SELECT string_agg(r.rolname, ', ') INTO unexpected
69
+ FROM pg_auth_members m
70
+ JOIN pg_roles r ON r.oid = m.roleid
71
+ JOIN pg_roles member ON member.oid = m.member
72
+ WHERE member.rolname = 'analyst_reader'
73
+ AND r.rolname <> 'rds_iam';
74
+ IF unexpected IS NOT NULL THEN
75
+ RAISE EXCEPTION 'analyst_reader holds memberships beyond rds_iam: %', unexpected;
76
+ END IF;
77
+ END $$;
78
+
79
+ COMMIT;