thinkwork-cli 0.12.15 → 0.12.17

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 (152) hide show
  1. package/dist/{api-client-4VT3FWOH.js → api-client-JUBCQQDF.js} +1 -1
  2. package/dist/{chunk-H7AB42ES.js → chunk-STY44FQO.js} +13 -0
  3. package/dist/cli.js +1107 -10225
  4. package/dist/commands/enterprise/templates/deploy-repo/docs/runbook.md +3 -8
  5. package/dist/commands/enterprise/templates/deploy-repo/terraform/main.tf +1 -184
  6. package/dist/drizzle/0050_brain_v0_entity_subtype.sql +2 -2
  7. package/dist/drizzle/0051_brain_v0_tenant_entity_pages.sql +6 -6
  8. package/dist/drizzle/0052_brain_v0_external_refs.sql +2 -2
  9. package/dist/drizzle/0053_brain_v0_unresolved_mentions_subtype.sql +2 -2
  10. package/dist/drizzle/0145_knowledge_graph_thread_ingest.sql +14 -14
  11. package/dist/drizzle/0146_knowledge_graph_source_scope.sql +1 -1
  12. package/dist/drizzle/0157_knowledge_graph_observations_source.sql +2 -2
  13. package/dist/drizzle/0158_wiki_tenant_scope.sql +1 -1
  14. package/dist/drizzle/0165_plugin_premium_entitlements.sql +2 -2
  15. package/dist/drizzle/{0166_company_brain_substrate_contract.sql → 0166_brain_substrate_contract.sql} +9 -9
  16. package/dist/drizzle/{0167_company_brain_artifact_manifest_runtime.sql → 0167_brain_artifact_manifest_runtime.sql} +5 -5
  17. package/dist/drizzle/0168_eval_skill_gate.sql +1 -1
  18. package/dist/drizzle/0183_okf_artifact_manifests.sql +1 -1
  19. package/dist/drizzle/0197_rcm_context_columns.sql +28 -0
  20. package/dist/drizzle/0200_eval_results_execution_tier.sql +40 -0
  21. package/dist/drizzle/0201_brain_dream_runs.sql +72 -0
  22. package/dist/drizzle/0202_backfill_thread_participants_from_senders.sql +110 -0
  23. package/dist/drizzle/0203_threads_mode_override.sql +61 -0
  24. package/dist/drizzle/0204_thread_turns_triggering_message_id.sql +48 -0
  25. package/dist/drizzle/0205_routines_git_python.sql +185 -0
  26. package/dist/drizzle/0206_agent_loop_versions_routine_actions.sql +40 -0
  27. package/dist/drizzle/0207_tenant_credentials_github_repo_kind.sql +52 -0
  28. package/dist/drizzle/0208_knowledge_graph_neutral_identifiers.sql +253 -0
  29. package/dist/drizzle/0209_living_artifacts_schema.sql +109 -0
  30. package/dist/drizzle/0210_think137_automations_additive_schema.sql +113 -0
  31. package/dist/drizzle/0211_backfill_agent_loop_versions_target_spec.sql +120 -0
  32. package/dist/drizzle/0212_fold_webhooks_into_automations.sql +312 -0
  33. package/dist/drizzle/0213_agent_loop_versions_judge_evidence_nullable.sql +63 -0
  34. package/dist/drizzle/0214_think137_drop_judge_evidence_roi.sql +99 -0
  35. package/dist/drizzle/0215_agent_loop_versions_goal_worker_policy_nullable.sql +70 -0
  36. package/dist/drizzle/0216_drop_agent_loop_versions_goal_worker_policy.sql +81 -0
  37. package/dist/drizzle/0217_agents_capability_folder_dispatch.sql +12 -0
  38. package/dist/drizzle/0218_document_plates.sql +30 -0
  39. package/dist/drizzle/0219_document_section_waivers.sql +29 -0
  40. package/dist/drizzle/0220_artifacts_created_by_user.sql +21 -0
  41. package/dist/drizzle/0221_artifact_shares.sql +29 -0
  42. package/dist/drizzle/0221_workflow_interpreter_thin_slice.sql +71 -0
  43. package/dist/drizzle/0222_compliance_drainer_select_audit_events.sql +21 -0
  44. package/dist/drizzle/0223_document_conformance_reports.sql +38 -0
  45. package/dist/drizzle/0224_artifact_refresh_state.sql +11 -0
  46. package/dist/drizzle/0225_think216_agent_loop_convergence.sql +21 -0
  47. package/dist/drizzle/0226_drop_n8n_agent_step_runs.sql +6 -0
  48. package/dist/drizzle/0227_analyst_reader_role.sql +1055 -0
  49. package/dist/drizzle/0228_tenant_credentials_rds_iam_kind.sql +62 -0
  50. package/dist/drizzle/0229_analyst_reader_rds_iam_grant.sql +79 -0
  51. package/dist/drizzle/0230_analyst_rls.sql +1613 -0
  52. package/dist/drizzle/0231_cost_events_cache_write_enforcement_exempt.sql +11 -0
  53. package/dist/plugins/catalog/package.json +0 -1
  54. package/dist/plugins/catalog/src/__tests__/build-catalog.test.ts +0 -1
  55. package/dist/plugins/catalog/src/__tests__/catalog.test.ts +16 -8
  56. package/dist/plugins/catalog/src/__tests__/contracts.test.ts +56 -0
  57. package/dist/plugins/catalog/src/__tests__/plugin-package.test.ts +0 -2
  58. package/dist/plugins/catalog/src/__tests__/plugin-registry.test.ts +0 -5
  59. package/dist/plugins/catalog/src/contracts.ts +112 -0
  60. package/dist/plugins/catalog/src/registry/generated-first-party.ts +0 -6
  61. package/dist/plugins/n8n/README.md +4 -36
  62. package/dist/plugins/n8n/src/deployment/managed-app.ts +0 -17
  63. package/dist/plugins/n8n/src/manifest.ts +0 -5
  64. package/dist/plugins/n8n/terraform/n8n/main.tf +0 -26
  65. package/dist/plugins/n8n/terraform/n8n/outputs.tf +0 -5
  66. package/dist/plugins/n8n/terraform/n8n/variables.tf +0 -6
  67. package/dist/plugins/n8n/test/manifest.test.ts +0 -1
  68. package/dist/plugins/twenty/package.json +5 -0
  69. package/dist/plugins/twenty/scripts/lib/__tests__/load-records.test.ts +232 -0
  70. package/dist/plugins/twenty/scripts/lib/__tests__/mappers.test.ts +489 -0
  71. package/dist/plugins/twenty/scripts/lib/__tests__/members-ensure.test.ts +199 -0
  72. package/dist/plugins/twenty/scripts/lib/__tests__/provision-members-db.test.ts +43 -0
  73. package/dist/plugins/twenty/scripts/lib/__tests__/schema-ensure.test.ts +230 -0
  74. package/dist/plugins/twenty/scripts/lib/__tests__/twenty-client.test.ts +207 -0
  75. package/dist/plugins/twenty/scripts/lib/lastmile-reader.ts +282 -0
  76. package/dist/plugins/twenty/scripts/lib/load-attachments.ts +220 -0
  77. package/dist/plugins/twenty/scripts/lib/load-records.ts +680 -0
  78. package/dist/plugins/twenty/scripts/lib/mappers.ts +559 -0
  79. package/dist/plugins/twenty/scripts/lib/members-ensure.ts +381 -0
  80. package/dist/plugins/twenty/scripts/lib/provision-members-db.ts +191 -0
  81. package/dist/plugins/twenty/scripts/lib/schema-ensure.ts +425 -0
  82. package/dist/plugins/twenty/scripts/lib/twenty-client.ts +246 -0
  83. package/dist/plugins/twenty/scripts/migrate-lastmile.ts +610 -0
  84. package/dist/plugins/twenty/scripts/provision-twenty-members.ts +214 -0
  85. package/dist/plugins/twenty/src/manifest.ts +99 -0
  86. package/dist/plugins/twenty/terraform/twenty/README.md +1 -1
  87. package/dist/plugins/twenty/test/manifest.test.ts +12 -2
  88. package/dist/terraform/examples/greenfield/main.tf +90 -380
  89. package/dist/terraform/examples/greenfield/terraform.tfvars.example +0 -1
  90. package/dist/terraform/modules/app/agentcore-pi/README.md +1 -3
  91. package/dist/terraform/modules/app/agentcore-pi/main.tf +36 -32
  92. package/dist/terraform/modules/app/agentcore-pi/variables.tf +23 -15
  93. package/dist/terraform/modules/app/agentcore-runtime/main.tf +3 -3
  94. package/dist/terraform/modules/app/customer-domain/main.tf +16 -2
  95. package/dist/terraform/modules/app/deployment-control-plane/main.tf +5 -0
  96. package/dist/terraform/modules/app/deployment-control-plane/runner.py +85 -207
  97. package/dist/terraform/modules/app/deployment-control-plane/test_runner_bundle.py +56 -2
  98. package/dist/terraform/modules/app/hindsight-memory/main.tf +52 -4
  99. package/dist/terraform/modules/app/lambda-api/eval-fanout.tf +7 -0
  100. package/dist/terraform/modules/app/lambda-api/handlers.tf +493 -89
  101. package/dist/terraform/modules/app/lambda-api/iam-grouped.tf +215 -96
  102. package/dist/terraform/modules/app/lambda-api/main.tf +24 -5
  103. package/dist/terraform/modules/app/lambda-api/outputs.tf +19 -11
  104. package/dist/terraform/modules/app/lambda-api/variables.tf +94 -67
  105. package/dist/terraform/modules/app/ses-email/main.tf +14 -2
  106. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/main.tf +493 -0
  107. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/outputs.tf +34 -0
  108. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/variables.tf +32 -0
  109. package/dist/terraform/modules/data/aurora-postgres/main.tf +55 -0
  110. package/dist/terraform/modules/data/aurora-postgres/outputs.tf +15 -0
  111. package/dist/terraform/modules/data/s3-buckets/main.tf +26 -0
  112. package/dist/terraform/modules/thinkwork/README.md +0 -1
  113. package/dist/terraform/modules/thinkwork/main.tf +167 -446
  114. package/dist/terraform/modules/thinkwork/outputs.tf +2 -142
  115. package/dist/terraform/modules/thinkwork/variables.tf +55 -309
  116. package/dist/terraform/schema.graphql +4 -0
  117. package/dist/workspace-defaults/files/AGENTS.md +45 -31
  118. package/dist/workspace-defaults/files/CONTEXT.md +48 -4
  119. package/dist/workspace-defaults/files/GUARDRAILS.md +18 -0
  120. package/dist/workspace-defaults/files/MEMORY_GUIDE.md +32 -4
  121. package/dist/workspace-defaults/files/SPACE.md +34 -19
  122. package/dist/workspace-defaults/files/TOOLS.md +30 -0
  123. package/dist/workspace-defaults/files/skills/document-composer/SKILL.md +154 -0
  124. package/dist/workspace-defaults/files/skills/document-composer/references/authoring-rules.md +101 -0
  125. package/package.json +2 -1
  126. package/dist/plugins/company-brain/README.md +0 -37
  127. package/dist/plugins/company-brain/package.json +0 -33
  128. package/dist/plugins/company-brain/runtime/cognee/Dockerfile +0 -11
  129. package/dist/plugins/company-brain/smoke/cognee-managed-app-smoke.mjs +0 -458
  130. package/dist/plugins/company-brain/smoke/cognee-memory-cutover-smoke.mjs +0 -539
  131. package/dist/plugins/company-brain/smoke/company-brain-context-engine-smoke.mjs +0 -312
  132. package/dist/plugins/company-brain/smoke/company-brain-operations-smoke.mjs +0 -449
  133. package/dist/plugins/company-brain/smoke/company-brain-plugin-smoke.mjs +0 -655
  134. package/dist/plugins/company-brain/smoke/hindsight-memory-isolation-smoke.mjs +0 -474
  135. package/dist/plugins/company-brain/src/api/cognee-client.ts +0 -896
  136. package/dist/plugins/company-brain/src/api/cognee-cluster-identity.ts +0 -49
  137. package/dist/plugins/company-brain/src/api/cognee-memory-scope.ts +0 -84
  138. package/dist/plugins/company-brain/src/api/context-engine-provider.ts +0 -888
  139. package/dist/plugins/company-brain/src/api/migration.ts +0 -665
  140. package/dist/plugins/company-brain/src/deployment/cognee-managed-app.ts +0 -396
  141. package/dist/plugins/company-brain/src/index.ts +0 -62
  142. package/dist/plugins/company-brain/src/manifest.ts +0 -112
  143. package/dist/plugins/company-brain/terraform/cognee/README.md +0 -263
  144. package/dist/plugins/company-brain/terraform/cognee/main.tf +0 -766
  145. package/dist/plugins/company-brain/terraform/cognee/outputs.tf +0 -144
  146. package/dist/plugins/company-brain/terraform/cognee/variables.tf +0 -402
  147. package/dist/plugins/company-brain/test/api/cognee-client.test.ts +0 -562
  148. package/dist/plugins/company-brain/test/api/cognee-memory-scope.test.ts +0 -74
  149. package/dist/plugins/company-brain/test/api/context-engine-provider.test.ts +0 -447
  150. package/dist/plugins/company-brain/test/api/migration.test.ts +0 -465
  151. package/dist/plugins/company-brain/test/manifest.test.ts +0 -95
  152. package/dist/plugins/company-brain/tsconfig.json +0 -8
@@ -1569,6 +1569,62 @@ def test_unrelated_managed_app_overrides_preserve_existing_n8n_guardrails() -> N
1569
1569
  assert overrides["n8n_custom_package_specs"] == ["luxon@3.7.2"]
1570
1570
 
1571
1571
 
1572
+ def test_managed_app_overrides_ignore_retired_graph_substrate_state() -> None:
1573
+ runner = load_runner()
1574
+ retired_prefix = "co" + "gnee"
1575
+ old_guardrail_name = retired_prefix + "_configuration_guardrails"
1576
+ old_output_name = retired_prefix + "_url"
1577
+ state = {
1578
+ "resources": [
1579
+ {
1580
+ "type": "terraform_data",
1581
+ "name": old_guardrail_name,
1582
+ "instances": [
1583
+ {
1584
+ "attributes": {
1585
+ "input": {
1586
+ "value": {
1587
+ "enabled": True,
1588
+ "endpoint": "https://old-graph.example.test",
1589
+ }
1590
+ }
1591
+ }
1592
+ }
1593
+ ],
1594
+ }
1595
+ ]
1596
+ }
1597
+
1598
+ overrides = runner.managed_app_terraform_overrides(
1599
+ {
1600
+ "appKey": "twenty",
1601
+ "operation": "UPGRADE",
1602
+ "desiredConfig": {
1603
+ "certificateArn": "arn:aws:acm:us-east-1:487219502366:certificate/twenty",
1604
+ "publicUrl": "https://twenty.thinkwork.ai",
1605
+ },
1606
+ "manifestImages": {
1607
+ "twenty": "487219502366.dkr.ecr.us-east-1.amazonaws.com/thinkwork/twenty"
1608
+ "@sha256:"
1609
+ "5555555555555555555555555555555555555555555555555555555555555555"
1610
+ },
1611
+ },
1612
+ "dev",
1613
+ "487219502366",
1614
+ {
1615
+ old_output_name: {"value": "https://old-graph.example.test"},
1616
+ "n8n_provisioned": {"value": True},
1617
+ "n8n_runtime_enabled": {"value": True},
1618
+ },
1619
+ state,
1620
+ )
1621
+
1622
+ assert overrides["n8n_provisioned"] is True
1623
+ assert overrides["n8n_runtime_enabled"] is True
1624
+ assert overrides["twenty_provisioned"] is True
1625
+ assert all(retired_prefix not in key for key in overrides)
1626
+
1627
+
1572
1628
  def test_n8n_destroy_normalizes_legacy_binary_database_guardrail() -> None:
1573
1629
  runner = load_runner()
1574
1630
  state = {
@@ -2574,7 +2630,6 @@ def test_controller_input_summary_redacts_to_deployment_contract() -> None:
2574
2630
  },
2575
2631
  "features": {
2576
2632
  "baseInstall": {
2577
- "cognee": False,
2578
2633
  "slack": False,
2579
2634
  "stripe": False,
2580
2635
  "twenty": False,
@@ -2588,7 +2643,6 @@ def test_controller_input_summary_redacts_to_deployment_contract() -> None:
2588
2643
  assert summary["customer"]["environmentName"] == "tei-e2e"
2589
2644
  assert summary["release"]["manifestSha256"] == "a" * 64
2590
2645
  assert summary["features"]["baseInstall"] == {
2591
- "cognee": False,
2592
2646
  "slack": False,
2593
2647
  "stripe": False,
2594
2648
  "twenty": False,
@@ -33,10 +33,34 @@ variable "database_url" {
33
33
  sensitive = true
34
34
  }
35
35
 
36
+ variable "database_name" {
37
+ description = <<-EOT
38
+ Dedicated Hindsight database name (THINK-220). Empty (default) keeps the
39
+ legacy layout: Hindsight lives in the `hindsight` schema of the primary
40
+ database named in database_url. Set (e.g. "thinkwork_hindsight") to point
41
+ the service at that database on the same cluster with schema `public` —
42
+ the vanilla upstream configuration, which its maintenance-loop discovery
43
+ queries require. The database must already exist (bootstrap SQL; Terraform
44
+ cannot CREATE DATABASE inside the cluster).
45
+ EOT
46
+ type = string
47
+ default = ""
48
+ }
49
+
50
+ locals {
51
+ # database_url with its path segment swapped for var.database_name.
52
+ # Matches "...host:port/<db>" with an optional "?query" tail.
53
+ hindsight_database_url = (
54
+ var.database_name == ""
55
+ ? var.database_url
56
+ : replace(var.database_url, "/(/[^/?]+)([?].*)?$/", "/${var.database_name}$2")
57
+ )
58
+ }
59
+
36
60
  variable "image_tag" {
37
61
  description = "Hindsight Docker image tag (ghcr.io/vectorize-io/hindsight:<tag>)"
38
62
  type = string
39
- default = "0.5.0"
63
+ default = "0.8.4"
40
64
  }
41
65
 
42
66
  variable "enable_auto_consolidation" {
@@ -51,6 +75,12 @@ variable "consolidation_dedup_threshold" {
51
75
  default = "0.97"
52
76
  }
53
77
 
78
+ variable "retain_llm_model" {
79
+ description = "Bedrock model id for Hindsight's retain/extraction pass. Default = Haiku 4.5, validated on image 0.8.4 (THINK-201, 2026-07-06): 12.9% dangling-referent rate vs ~38% for gpt-oss-20b, best usefulness of any measured config, zero Anthropic tool-schema errors (the 0.5.0 incompatibility that caused the THINK-198 incident is fixed upstream). Evidence: docs/solutions/tooling-decisions/hindsight-084-upgrade-validation-2026-07-06.md. Requires image >= 0.8.x for anthropic.* models."
80
+ type = string
81
+ default = "us.anthropic.claude-haiku-4-5-20251001-v1:0"
82
+ }
83
+
54
84
  variable "observations_mission" {
55
85
  description = "Service-level default observations mission steering what consolidation synthesizes. Empty string omits the env var so the image default applies. Per-bank overrides apply on top."
56
86
  type = string
@@ -194,6 +224,13 @@ resource "aws_lb" "hindsight" {
194
224
  security_groups = [aws_security_group.alb.id]
195
225
  subnets = var.subnet_ids
196
226
 
227
+ # Synchronous retain runs LLM extraction + auto-consolidation and routinely
228
+ # exceeds the 60s ALB default, which returned 504s to the retain Lambda
229
+ # while Hindsight was still working (every dead-lettered retain attempt on
230
+ # dev showed ~60.1-60.5s backend latency). Must stay above the retain
231
+ # Lambda's HINDSIGHT_TIMEOUT_MS so the client, not the ALB, owns timeouts.
232
+ idle_timeout = 300
233
+
197
234
  tags = { Name = "thinkwork-${var.stage}-hindsight-alb" }
198
235
  }
199
236
 
@@ -253,6 +290,15 @@ resource "aws_ecs_task_definition" "hindsight" {
253
290
  execution_role_arn = aws_iam_role.ecs_execution.arn
254
291
  task_role_arn = aws_iam_role.ecs_task.arn
255
292
 
293
+ lifecycle {
294
+ precondition {
295
+ # A dedicated Hindsight database that is actually the primary database
296
+ # would put Hindsight's `public` schema on top of the thinkwork tables.
297
+ condition = var.database_name == "" || !endswith(split("?", var.database_url)[0], "/${var.database_name}")
298
+ error_message = "database_name must be distinct from the primary database in database_url (THINK-220)."
299
+ }
300
+ }
301
+
256
302
  runtime_platform {
257
303
  operating_system_family = "LINUX"
258
304
  cpu_architecture = "ARM64"
@@ -269,8 +315,10 @@ resource "aws_ecs_task_definition" "hindsight" {
269
315
  }]
270
316
 
271
317
  environment = concat([
272
- { name = "HINDSIGHT_API_DATABASE_URL", value = var.database_url },
273
- { name = "HINDSIGHT_API_DATABASE_SCHEMA", value = "hindsight" },
318
+ { name = "HINDSIGHT_API_DATABASE_URL", value = local.hindsight_database_url },
319
+ # `public` on a dedicated database is upstream's vanilla layout — the
320
+ # maintenance-loop discovery queries only work there (THINK-220).
321
+ { name = "HINDSIGHT_API_DATABASE_SCHEMA", value = var.database_name == "" ? "hindsight" : "public" },
274
322
  { name = "HINDSIGHT_API_VECTOR_EXTENSION", value = "pgvector" },
275
323
  { name = "HINDSIGHT_API_TEXT_SEARCH_EXTENSION", value = "native" },
276
324
  { name = "HINDSIGHT_API_RUN_MIGRATIONS_ON_STARTUP", value = "true" },
@@ -279,7 +327,7 @@ resource "aws_ecs_task_definition" "hindsight" {
279
327
  { name = "AWS_REGION_NAME", value = data.aws_region.current.name },
280
328
  { name = "AWS_DEFAULT_REGION", value = data.aws_region.current.name },
281
329
  { name = "HINDSIGHT_API_RETAIN_LLM_PROVIDER", value = "bedrock" },
282
- { name = "HINDSIGHT_API_RETAIN_LLM_MODEL", value = "openai.gpt-oss-20b-1:0" },
330
+ { name = "HINDSIGHT_API_RETAIN_LLM_MODEL", value = var.retain_llm_model },
283
331
  { name = "HINDSIGHT_API_REFLECT_LLM_PROVIDER", value = "bedrock" },
284
332
  { name = "HINDSIGHT_API_REFLECT_LLM_MODEL", value = "openai.gpt-oss-120b-1:0" },
285
333
  { name = "HINDSIGHT_API_EMBEDDINGS_PROVIDER", value = "local" },
@@ -62,6 +62,13 @@ resource "aws_lambda_event_source_mapping" "eval_fanout" {
62
62
  function_response_types = ["ReportBatchItemFailures"]
63
63
 
64
64
  scaling_config {
65
+ # Effective concurrency = min(FIFO lanes, maximum_concurrency);
66
+ # lanes (EVAL_DIRECT_AGENTCORE_MESSAGE_SHARDS, handlers.tf) and the
67
+ # function's reserved concurrency sit at 40 as headroom. This knob
68
+ # is the deliberate ceiling: at 40 the agent-tier AgentCore turns
69
+ # saturate the Bedrock TPM quota and blow the 180s response budget
70
+ # (benchmark run 62c6de45: 47 timeout errors vs 0 at 20). Raise only
71
+ # after a Bedrock quota bump, and this knob alone is enough.
65
72
  maximum_concurrency = 20
66
73
  }
67
74
  }