thinkwork-cli 0.12.16 → 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.
- package/dist/cli.js +517 -10403
- package/dist/commands/enterprise/templates/deploy-repo/docs/runbook.md +3 -8
- package/dist/commands/enterprise/templates/deploy-repo/terraform/main.tf +1 -184
- package/dist/drizzle/0050_brain_v0_entity_subtype.sql +2 -2
- package/dist/drizzle/0051_brain_v0_tenant_entity_pages.sql +6 -6
- package/dist/drizzle/0052_brain_v0_external_refs.sql +2 -2
- package/dist/drizzle/0053_brain_v0_unresolved_mentions_subtype.sql +2 -2
- package/dist/drizzle/0145_knowledge_graph_thread_ingest.sql +14 -14
- package/dist/drizzle/0146_knowledge_graph_source_scope.sql +1 -1
- package/dist/drizzle/0157_knowledge_graph_observations_source.sql +2 -2
- package/dist/drizzle/0158_wiki_tenant_scope.sql +1 -1
- package/dist/drizzle/0165_plugin_premium_entitlements.sql +2 -2
- package/dist/drizzle/{0166_company_brain_substrate_contract.sql → 0166_brain_substrate_contract.sql} +9 -9
- package/dist/drizzle/{0167_company_brain_artifact_manifest_runtime.sql → 0167_brain_artifact_manifest_runtime.sql} +5 -5
- package/dist/drizzle/0168_eval_skill_gate.sql +1 -1
- package/dist/drizzle/0183_okf_artifact_manifests.sql +1 -1
- package/dist/drizzle/0200_eval_results_execution_tier.sql +40 -0
- package/dist/drizzle/0201_brain_dream_runs.sql +72 -0
- package/dist/drizzle/0202_backfill_thread_participants_from_senders.sql +110 -0
- package/dist/drizzle/0203_threads_mode_override.sql +61 -0
- package/dist/drizzle/0204_thread_turns_triggering_message_id.sql +48 -0
- package/dist/drizzle/0205_routines_git_python.sql +185 -0
- package/dist/drizzle/0206_agent_loop_versions_routine_actions.sql +40 -0
- package/dist/drizzle/0207_tenant_credentials_github_repo_kind.sql +52 -0
- package/dist/drizzle/0208_knowledge_graph_neutral_identifiers.sql +253 -0
- package/dist/drizzle/0209_living_artifacts_schema.sql +109 -0
- package/dist/drizzle/0210_think137_automations_additive_schema.sql +113 -0
- package/dist/drizzle/0211_backfill_agent_loop_versions_target_spec.sql +120 -0
- package/dist/drizzle/0212_fold_webhooks_into_automations.sql +312 -0
- package/dist/drizzle/0213_agent_loop_versions_judge_evidence_nullable.sql +63 -0
- package/dist/drizzle/0214_think137_drop_judge_evidence_roi.sql +99 -0
- package/dist/drizzle/0215_agent_loop_versions_goal_worker_policy_nullable.sql +70 -0
- package/dist/drizzle/0216_drop_agent_loop_versions_goal_worker_policy.sql +81 -0
- package/dist/drizzle/0217_agents_capability_folder_dispatch.sql +12 -0
- package/dist/drizzle/0218_document_plates.sql +30 -0
- package/dist/drizzle/0219_document_section_waivers.sql +29 -0
- package/dist/drizzle/0220_artifacts_created_by_user.sql +21 -0
- package/dist/drizzle/0221_artifact_shares.sql +29 -0
- package/dist/drizzle/0221_workflow_interpreter_thin_slice.sql +71 -0
- package/dist/drizzle/0222_compliance_drainer_select_audit_events.sql +21 -0
- package/dist/drizzle/0223_document_conformance_reports.sql +38 -0
- package/dist/drizzle/0224_artifact_refresh_state.sql +11 -0
- package/dist/drizzle/0225_think216_agent_loop_convergence.sql +21 -0
- package/dist/drizzle/0226_drop_n8n_agent_step_runs.sql +6 -0
- package/dist/drizzle/0227_analyst_reader_role.sql +1055 -0
- package/dist/drizzle/0228_tenant_credentials_rds_iam_kind.sql +62 -0
- package/dist/drizzle/0229_analyst_reader_rds_iam_grant.sql +79 -0
- package/dist/drizzle/0230_analyst_rls.sql +1613 -0
- package/dist/drizzle/0231_cost_events_cache_write_enforcement_exempt.sql +11 -0
- package/dist/plugins/catalog/package.json +0 -1
- package/dist/plugins/catalog/src/__tests__/build-catalog.test.ts +0 -1
- package/dist/plugins/catalog/src/__tests__/catalog.test.ts +16 -8
- package/dist/plugins/catalog/src/__tests__/contracts.test.ts +56 -0
- package/dist/plugins/catalog/src/__tests__/plugin-package.test.ts +0 -2
- package/dist/plugins/catalog/src/__tests__/plugin-registry.test.ts +0 -5
- package/dist/plugins/catalog/src/contracts.ts +112 -0
- package/dist/plugins/catalog/src/registry/generated-first-party.ts +0 -6
- package/dist/plugins/n8n/README.md +4 -36
- package/dist/plugins/n8n/src/deployment/managed-app.ts +0 -17
- package/dist/plugins/n8n/src/manifest.ts +0 -5
- package/dist/plugins/n8n/terraform/n8n/main.tf +0 -26
- package/dist/plugins/n8n/terraform/n8n/outputs.tf +0 -5
- package/dist/plugins/n8n/terraform/n8n/variables.tf +0 -6
- package/dist/plugins/n8n/test/manifest.test.ts +0 -1
- package/dist/plugins/twenty/package.json +5 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/load-records.test.ts +232 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/mappers.test.ts +489 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/members-ensure.test.ts +199 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/provision-members-db.test.ts +43 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/schema-ensure.test.ts +230 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/twenty-client.test.ts +207 -0
- package/dist/plugins/twenty/scripts/lib/lastmile-reader.ts +282 -0
- package/dist/plugins/twenty/scripts/lib/load-attachments.ts +220 -0
- package/dist/plugins/twenty/scripts/lib/load-records.ts +680 -0
- package/dist/plugins/twenty/scripts/lib/mappers.ts +559 -0
- package/dist/plugins/twenty/scripts/lib/members-ensure.ts +381 -0
- package/dist/plugins/twenty/scripts/lib/provision-members-db.ts +191 -0
- package/dist/plugins/twenty/scripts/lib/schema-ensure.ts +425 -0
- package/dist/plugins/twenty/scripts/lib/twenty-client.ts +246 -0
- package/dist/plugins/twenty/scripts/migrate-lastmile.ts +610 -0
- package/dist/plugins/twenty/scripts/provision-twenty-members.ts +214 -0
- package/dist/plugins/twenty/src/manifest.ts +99 -0
- package/dist/plugins/twenty/terraform/twenty/README.md +1 -1
- package/dist/plugins/twenty/test/manifest.test.ts +12 -2
- package/dist/terraform/examples/greenfield/main.tf +90 -380
- package/dist/terraform/examples/greenfield/terraform.tfvars.example +0 -1
- package/dist/terraform/modules/app/agentcore-pi/README.md +1 -3
- package/dist/terraform/modules/app/agentcore-pi/main.tf +29 -38
- package/dist/terraform/modules/app/agentcore-pi/variables.tf +23 -15
- package/dist/terraform/modules/app/agentcore-runtime/main.tf +3 -3
- package/dist/terraform/modules/app/customer-domain/main.tf +16 -2
- package/dist/terraform/modules/app/deployment-control-plane/main.tf +5 -0
- package/dist/terraform/modules/app/deployment-control-plane/runner.py +85 -207
- package/dist/terraform/modules/app/deployment-control-plane/test_runner_bundle.py +56 -2
- package/dist/terraform/modules/app/hindsight-memory/main.tf +52 -4
- package/dist/terraform/modules/app/lambda-api/eval-fanout.tf +7 -0
- package/dist/terraform/modules/app/lambda-api/handlers.tf +493 -89
- package/dist/terraform/modules/app/lambda-api/iam-grouped.tf +215 -96
- package/dist/terraform/modules/app/lambda-api/main.tf +24 -5
- package/dist/terraform/modules/app/lambda-api/outputs.tf +19 -11
- package/dist/terraform/modules/app/lambda-api/variables.tf +94 -67
- package/dist/terraform/modules/app/ses-email/main.tf +14 -2
- package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/main.tf +493 -0
- package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/outputs.tf +34 -0
- package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/variables.tf +32 -0
- package/dist/terraform/modules/data/aurora-postgres/main.tf +55 -0
- package/dist/terraform/modules/data/aurora-postgres/outputs.tf +15 -0
- package/dist/terraform/modules/data/s3-buckets/main.tf +26 -0
- package/dist/terraform/modules/thinkwork/README.md +0 -1
- package/dist/terraform/modules/thinkwork/main.tf +167 -446
- package/dist/terraform/modules/thinkwork/outputs.tf +2 -142
- package/dist/terraform/modules/thinkwork/variables.tf +55 -309
- package/dist/terraform/schema.graphql +4 -0
- package/dist/workspace-defaults/files/AGENTS.md +45 -31
- package/dist/workspace-defaults/files/CONTEXT.md +48 -4
- package/dist/workspace-defaults/files/GUARDRAILS.md +18 -0
- package/dist/workspace-defaults/files/MEMORY_GUIDE.md +32 -4
- package/dist/workspace-defaults/files/SPACE.md +34 -19
- package/dist/workspace-defaults/files/TOOLS.md +30 -0
- package/dist/workspace-defaults/files/skills/document-composer/SKILL.md +154 -0
- package/dist/workspace-defaults/files/skills/document-composer/references/authoring-rules.md +101 -0
- package/package.json +1 -1
- package/dist/plugins/company-brain/README.md +0 -37
- package/dist/plugins/company-brain/package.json +0 -33
- package/dist/plugins/company-brain/runtime/cognee/Dockerfile +0 -11
- package/dist/plugins/company-brain/smoke/cognee-managed-app-smoke.mjs +0 -458
- package/dist/plugins/company-brain/smoke/cognee-memory-cutover-smoke.mjs +0 -539
- package/dist/plugins/company-brain/smoke/company-brain-context-engine-smoke.mjs +0 -312
- package/dist/plugins/company-brain/smoke/company-brain-operations-smoke.mjs +0 -449
- package/dist/plugins/company-brain/smoke/company-brain-plugin-smoke.mjs +0 -655
- package/dist/plugins/company-brain/smoke/hindsight-memory-isolation-smoke.mjs +0 -474
- package/dist/plugins/company-brain/src/api/cognee-client.ts +0 -896
- package/dist/plugins/company-brain/src/api/cognee-cluster-identity.ts +0 -49
- package/dist/plugins/company-brain/src/api/cognee-memory-scope.ts +0 -84
- package/dist/plugins/company-brain/src/api/context-engine-provider.ts +0 -888
- package/dist/plugins/company-brain/src/api/migration.ts +0 -665
- package/dist/plugins/company-brain/src/deployment/cognee-managed-app.ts +0 -396
- package/dist/plugins/company-brain/src/index.ts +0 -62
- package/dist/plugins/company-brain/src/manifest.ts +0 -112
- package/dist/plugins/company-brain/terraform/cognee/README.md +0 -263
- package/dist/plugins/company-brain/terraform/cognee/main.tf +0 -766
- package/dist/plugins/company-brain/terraform/cognee/outputs.tf +0 -144
- package/dist/plugins/company-brain/terraform/cognee/variables.tf +0 -402
- package/dist/plugins/company-brain/test/api/cognee-client.test.ts +0 -562
- package/dist/plugins/company-brain/test/api/cognee-memory-scope.test.ts +0 -74
- package/dist/plugins/company-brain/test/api/context-engine-provider.test.ts +0 -447
- package/dist/plugins/company-brain/test/api/migration.test.ts +0 -465
- package/dist/plugins/company-brain/test/manifest.test.ts +0 -95
- package/dist/plugins/company-brain/tsconfig.json +0 -8
|
@@ -1,449 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Company Brain operations GraphQL smoke (THNK-6 U7).
|
|
4
|
-
*
|
|
5
|
-
* Dry-run is the default. Set SMOKE_ENABLE_COMPANY_BRAIN_OPERATIONS=1 to run
|
|
6
|
-
* live against a deployed stage. Live mode is read-only unless
|
|
7
|
-
* SMOKE_ENABLE_COMPANY_BRAIN_OPERATIONS_MUTATION=1 is also set.
|
|
8
|
-
*
|
|
9
|
-
* Live env:
|
|
10
|
-
* VITE_GRAPHQL_HTTP_URL or GRAPHQL_HTTP_URL or API_GRAPHQL_URL
|
|
11
|
-
* API_AUTH_SECRET or THINKWORK_API_SECRET
|
|
12
|
-
* SMOKE_TENANT_ID=<tenant uuid>
|
|
13
|
-
* SMOKE_ADMIN_USER_ID=<users.id with owner/admin tenant role>
|
|
14
|
-
*
|
|
15
|
-
* Optional:
|
|
16
|
-
* SMOKE_MEMBER_USER_ID=<non-admin tenant member id for redaction check>
|
|
17
|
-
* SMOKE_EXPECT_OPERATOR_EVIDENCE=1
|
|
18
|
-
* SMOKE_ENABLE_COMPANY_BRAIN_OPERATIONS_MUTATION=1
|
|
19
|
-
* SMOKE_COMPANY_BRAIN_ALLOW_EMPTY_SOURCE_SET=1
|
|
20
|
-
* SMOKE_COMPANY_BRAIN_EMPTY_SOURCE_REASON="dogfood smoke"
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import fs from "node:fs";
|
|
24
|
-
import path from "node:path";
|
|
25
|
-
import process from "node:process";
|
|
26
|
-
import { attachSmokeEvidence } from "../../../scripts/smoke/deployment-evidence.mjs";
|
|
27
|
-
|
|
28
|
-
const LIVE_ENABLED = process.env.SMOKE_ENABLE_COMPANY_BRAIN_OPERATIONS === "1";
|
|
29
|
-
const MUTATION_ENABLED =
|
|
30
|
-
process.env.SMOKE_ENABLE_COMPANY_BRAIN_OPERATIONS_MUTATION === "1";
|
|
31
|
-
const EXPECT_OPERATOR_EVIDENCE =
|
|
32
|
-
process.env.SMOKE_EXPECT_OPERATOR_EVIDENCE === "1";
|
|
33
|
-
const TIMEOUT_MS = Number(process.env.SMOKE_TIMEOUT_MS || 20_000);
|
|
34
|
-
|
|
35
|
-
const env = { ...loadEnvFile(), ...process.env };
|
|
36
|
-
const graphqlUrl = first(
|
|
37
|
-
env.VITE_GRAPHQL_HTTP_URL,
|
|
38
|
-
env.GRAPHQL_HTTP_URL,
|
|
39
|
-
env.API_GRAPHQL_URL,
|
|
40
|
-
);
|
|
41
|
-
const apiSecret = first(env.API_AUTH_SECRET, env.THINKWORK_API_SECRET);
|
|
42
|
-
const tenantId = first(env.SMOKE_TENANT_ID, env.TENANT_ID);
|
|
43
|
-
const adminUserId = first(env.SMOKE_ADMIN_USER_ID);
|
|
44
|
-
const memberUserId = first(env.SMOKE_MEMBER_USER_ID);
|
|
45
|
-
const checks = [];
|
|
46
|
-
|
|
47
|
-
if (!LIVE_ENABLED) {
|
|
48
|
-
console.log(
|
|
49
|
-
JSON.stringify(
|
|
50
|
-
await attachSmokeEvidence(
|
|
51
|
-
"company-brain-operations",
|
|
52
|
-
{
|
|
53
|
-
ok: true,
|
|
54
|
-
skippedLive: true,
|
|
55
|
-
reason:
|
|
56
|
-
"set SMOKE_ENABLE_COMPANY_BRAIN_OPERATIONS=1 to run the deployed Company Brain operations smoke",
|
|
57
|
-
dryRun: {
|
|
58
|
-
requiredWhenRunning: [
|
|
59
|
-
"VITE_GRAPHQL_HTTP_URL or GRAPHQL_HTTP_URL or API_GRAPHQL_URL",
|
|
60
|
-
"API_AUTH_SECRET or THINKWORK_API_SECRET",
|
|
61
|
-
"SMOKE_TENANT_ID",
|
|
62
|
-
"SMOKE_ADMIN_USER_ID (owner/admin tenant role)",
|
|
63
|
-
],
|
|
64
|
-
optionalReadOnlyChecks: [
|
|
65
|
-
"SMOKE_MEMBER_USER_ID verifies tenant-safe redaction",
|
|
66
|
-
"SMOKE_EXPECT_OPERATOR_EVIDENCE=1 requires operator evidence to be populated",
|
|
67
|
-
],
|
|
68
|
-
optionalMutation:
|
|
69
|
-
"SMOKE_ENABLE_COMPANY_BRAIN_OPERATIONS_MUTATION=1 requests a production migration only when the tenant is ready on the default tier with no active migration",
|
|
70
|
-
verifies: [
|
|
71
|
-
"companyBrainStatus returns storage tier, active backend, health, counters, launch/optional capabilities, and migration status",
|
|
72
|
-
"default vs production tier posture is visible without direct backend controls",
|
|
73
|
-
"operator evidence is explicit and can be required for operational stages",
|
|
74
|
-
"member redaction hides Cognee endpoints, S3 roots, Neptune ids/endpoints, and EFS ids",
|
|
75
|
-
"requestCompanyBrainProductionMigration is never called unless the explicit mutation flag is set",
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
env,
|
|
80
|
-
),
|
|
81
|
-
null,
|
|
82
|
-
2,
|
|
83
|
-
),
|
|
84
|
-
);
|
|
85
|
-
process.exit(0);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
await runLiveSmoke();
|
|
90
|
-
const failed = checks.filter((check) => !check.ok);
|
|
91
|
-
console.log(
|
|
92
|
-
JSON.stringify(
|
|
93
|
-
await attachSmokeEvidence(
|
|
94
|
-
"company-brain-operations",
|
|
95
|
-
{
|
|
96
|
-
ok: failed.length === 0,
|
|
97
|
-
mutationEnabled: MUTATION_ENABLED,
|
|
98
|
-
checks,
|
|
99
|
-
},
|
|
100
|
-
env,
|
|
101
|
-
),
|
|
102
|
-
null,
|
|
103
|
-
2,
|
|
104
|
-
),
|
|
105
|
-
);
|
|
106
|
-
process.exit(failed.length === 0 ? 0 : 1);
|
|
107
|
-
} catch (error) {
|
|
108
|
-
console.error(
|
|
109
|
-
JSON.stringify(
|
|
110
|
-
await attachSmokeEvidence(
|
|
111
|
-
"company-brain-operations",
|
|
112
|
-
{
|
|
113
|
-
ok: false,
|
|
114
|
-
mutationEnabled: MUTATION_ENABLED,
|
|
115
|
-
error: error instanceof Error ? error.message : String(error),
|
|
116
|
-
checks,
|
|
117
|
-
},
|
|
118
|
-
env,
|
|
119
|
-
),
|
|
120
|
-
null,
|
|
121
|
-
2,
|
|
122
|
-
),
|
|
123
|
-
);
|
|
124
|
-
process.exit(1);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
async function runLiveSmoke() {
|
|
128
|
-
requireEnv("VITE_GRAPHQL_HTTP_URL or GRAPHQL_HTTP_URL", graphqlUrl);
|
|
129
|
-
requireEnv("API_AUTH_SECRET or THINKWORK_API_SECRET", apiSecret);
|
|
130
|
-
requireEnv("SMOKE_TENANT_ID", tenantId);
|
|
131
|
-
requireEnv("SMOKE_ADMIN_USER_ID", adminUserId);
|
|
132
|
-
|
|
133
|
-
const adminStatus = await readStatus(adminUserId);
|
|
134
|
-
assertStatusShape(adminStatus, "operator");
|
|
135
|
-
assertOperatorEvidence(adminStatus);
|
|
136
|
-
|
|
137
|
-
if (memberUserId) {
|
|
138
|
-
const memberStatus = await readStatus(memberUserId);
|
|
139
|
-
assertStatusShape(memberStatus, "member");
|
|
140
|
-
assert(
|
|
141
|
-
"member status redacts operator evidence",
|
|
142
|
-
memberStatus.evidence === null,
|
|
143
|
-
{ evidence: memberStatus.evidence },
|
|
144
|
-
);
|
|
145
|
-
assert(
|
|
146
|
-
"member status does not leak backend identifiers",
|
|
147
|
-
!containsSensitiveBackendIdentifier(memberStatus),
|
|
148
|
-
{},
|
|
149
|
-
);
|
|
150
|
-
} else {
|
|
151
|
-
skip(
|
|
152
|
-
"member redaction check",
|
|
153
|
-
"set SMOKE_MEMBER_USER_ID to verify tenant-safe redaction",
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (!MUTATION_ENABLED) {
|
|
158
|
-
skip(
|
|
159
|
-
"production migration request mutation",
|
|
160
|
-
"set SMOKE_ENABLE_COMPANY_BRAIN_OPERATIONS_MUTATION=1 to request migration when eligible",
|
|
161
|
-
);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
await maybeRequestProductionMigration(adminStatus);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
async function maybeRequestProductionMigration(status) {
|
|
169
|
-
const migration = status.migration;
|
|
170
|
-
const hasActiveMigration =
|
|
171
|
-
Boolean(migration?.id) &&
|
|
172
|
-
(migration.status === "requested" || migration.status === "running");
|
|
173
|
-
const eligible =
|
|
174
|
-
status.status === "ready" &&
|
|
175
|
-
status.storageTier === "default" &&
|
|
176
|
-
status.activeBackend === "default" &&
|
|
177
|
-
!hasActiveMigration;
|
|
178
|
-
|
|
179
|
-
if (!eligible) {
|
|
180
|
-
skip("production migration request mutation", {
|
|
181
|
-
reason:
|
|
182
|
-
"tenant is not ready on default tier with no active migration; no mutation sent",
|
|
183
|
-
status: status.status,
|
|
184
|
-
storageTier: status.storageTier,
|
|
185
|
-
activeBackend: status.activeBackend,
|
|
186
|
-
migrationStatus: migration?.status ?? null,
|
|
187
|
-
});
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const input = {
|
|
192
|
-
allowEmptySourceSet:
|
|
193
|
-
env.SMOKE_COMPANY_BRAIN_ALLOW_EMPTY_SOURCE_SET === "1" || undefined,
|
|
194
|
-
emptySourceReason: first(env.SMOKE_COMPANY_BRAIN_EMPTY_SOURCE_REASON),
|
|
195
|
-
operatorEvidence: {
|
|
196
|
-
source: "company-brain-operations-smoke",
|
|
197
|
-
requestedAt: new Date().toISOString(),
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
const result = await gql(
|
|
201
|
-
`mutation RequestCompanyBrainProductionMigration($input: RequestCompanyBrainProductionMigrationInput!) {
|
|
202
|
-
requestCompanyBrainProductionMigration(input: $input) {
|
|
203
|
-
id
|
|
204
|
-
phase
|
|
205
|
-
status
|
|
206
|
-
fromStorageTier
|
|
207
|
-
toStorageTier
|
|
208
|
-
requestedAt
|
|
209
|
-
validationSummary
|
|
210
|
-
}
|
|
211
|
-
}`,
|
|
212
|
-
{
|
|
213
|
-
input: Object.fromEntries(
|
|
214
|
-
Object.entries(input).filter(([, value]) => value !== undefined),
|
|
215
|
-
),
|
|
216
|
-
},
|
|
217
|
-
adminUserId,
|
|
218
|
-
);
|
|
219
|
-
const migrationResult = result.requestCompanyBrainProductionMigration;
|
|
220
|
-
assert("production migration request returned a migration id", {
|
|
221
|
-
ok: Boolean(migrationResult?.id),
|
|
222
|
-
migration: migrationResult,
|
|
223
|
-
});
|
|
224
|
-
assert(
|
|
225
|
-
"production migration request keeps default as the source tier",
|
|
226
|
-
migrationResult?.fromStorageTier === "default",
|
|
227
|
-
{ migration: migrationResult },
|
|
228
|
-
);
|
|
229
|
-
assert(
|
|
230
|
-
"production migration request targets production tier",
|
|
231
|
-
migrationResult?.toStorageTier === "production",
|
|
232
|
-
{ migration: migrationResult },
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
async function readStatus(principalId) {
|
|
237
|
-
const data = await gql(
|
|
238
|
-
`query CompanyBrainOperationsStatus {
|
|
239
|
-
companyBrainStatus {
|
|
240
|
-
tenantId
|
|
241
|
-
storageTier
|
|
242
|
-
activeBackend
|
|
243
|
-
status
|
|
244
|
-
healthStatus
|
|
245
|
-
counters {
|
|
246
|
-
ingestionQueueDepth
|
|
247
|
-
failedIngestCount
|
|
248
|
-
graphEntityCount
|
|
249
|
-
graphEdgeCount
|
|
250
|
-
sourceArtifactCount
|
|
251
|
-
vaultProjectionCount
|
|
252
|
-
latestIngestAt
|
|
253
|
-
latestProjectionAt
|
|
254
|
-
ontologyVersion
|
|
255
|
-
}
|
|
256
|
-
capabilities {
|
|
257
|
-
launch { key status message source }
|
|
258
|
-
optional { key status message source }
|
|
259
|
-
}
|
|
260
|
-
migration {
|
|
261
|
-
id
|
|
262
|
-
phase
|
|
263
|
-
status
|
|
264
|
-
fromStorageTier
|
|
265
|
-
toStorageTier
|
|
266
|
-
requestedAt
|
|
267
|
-
startedAt
|
|
268
|
-
completedAt
|
|
269
|
-
rollbackWindowClosesAt
|
|
270
|
-
errorMessage
|
|
271
|
-
validationSummary
|
|
272
|
-
}
|
|
273
|
-
evidence {
|
|
274
|
-
managedApplicationId
|
|
275
|
-
latestDeploymentJobId
|
|
276
|
-
backendMode
|
|
277
|
-
graphProvider
|
|
278
|
-
vectorProvider
|
|
279
|
-
embeddingModel
|
|
280
|
-
vectorDimension
|
|
281
|
-
cogneeVersion
|
|
282
|
-
cogneeEndpoint
|
|
283
|
-
s3ArtifactRoot
|
|
284
|
-
s3ManifestRoot
|
|
285
|
-
s3VaultProjectionRoot
|
|
286
|
-
neptuneGraphId
|
|
287
|
-
neptuneEndpoint
|
|
288
|
-
efsFileSystemId
|
|
289
|
-
productionPosture
|
|
290
|
-
operatorEvidence
|
|
291
|
-
migrationEvidence
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}`,
|
|
295
|
-
{},
|
|
296
|
-
principalId,
|
|
297
|
-
);
|
|
298
|
-
return data.companyBrainStatus;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
function assertStatusShape(status, audience) {
|
|
302
|
-
assert(`${audience} status returns a tenant id`, Boolean(status.tenantId), {
|
|
303
|
-
tenantId: status.tenantId,
|
|
304
|
-
});
|
|
305
|
-
assert(
|
|
306
|
-
`${audience} status reports default or production storage tier`,
|
|
307
|
-
["default", "production"].includes(status.storageTier),
|
|
308
|
-
{ storageTier: status.storageTier },
|
|
309
|
-
);
|
|
310
|
-
assert(
|
|
311
|
-
`${audience} status reports default or production active backend`,
|
|
312
|
-
["default", "production"].includes(status.activeBackend),
|
|
313
|
-
{ activeBackend: status.activeBackend },
|
|
314
|
-
);
|
|
315
|
-
assert(
|
|
316
|
-
`${audience} status reports operational health`,
|
|
317
|
-
typeof status.healthStatus === "string" && status.healthStatus.length > 0,
|
|
318
|
-
{ healthStatus: status.healthStatus },
|
|
319
|
-
);
|
|
320
|
-
assert(
|
|
321
|
-
`${audience} status includes launch capabilities`,
|
|
322
|
-
Array.isArray(status.capabilities?.launch),
|
|
323
|
-
{ launch: status.capabilities?.launch },
|
|
324
|
-
);
|
|
325
|
-
assert(
|
|
326
|
-
`${audience} status includes migration posture`,
|
|
327
|
-
typeof status.migration?.phase === "string" &&
|
|
328
|
-
typeof status.migration?.status === "string",
|
|
329
|
-
{ migration: status.migration },
|
|
330
|
-
);
|
|
331
|
-
assert(
|
|
332
|
-
`${audience} counters include ingestion queue depth`,
|
|
333
|
-
Number.isInteger(status.counters?.ingestionQueueDepth),
|
|
334
|
-
{ counters: status.counters },
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function assertOperatorEvidence(status) {
|
|
339
|
-
if (!status.evidence) {
|
|
340
|
-
if (EXPECT_OPERATOR_EVIDENCE) {
|
|
341
|
-
assert("operator evidence is populated", false, { evidence: null });
|
|
342
|
-
} else {
|
|
343
|
-
skip(
|
|
344
|
-
"operator evidence is populated",
|
|
345
|
-
"operator evidence was redacted or unavailable; set SMOKE_EXPECT_OPERATOR_EVIDENCE=1 to require it",
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
assert("operator evidence reports backend mode", true, {
|
|
351
|
-
backendMode: status.evidence.backendMode ?? null,
|
|
352
|
-
});
|
|
353
|
-
assert("operator evidence reports production posture", true, {
|
|
354
|
-
productionPosture: status.evidence.productionPosture ?? null,
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
async function gql(query, variables, principalId) {
|
|
359
|
-
const response = await fetchWithTimeout(graphqlUrl, {
|
|
360
|
-
method: "POST",
|
|
361
|
-
headers: {
|
|
362
|
-
"content-type": "application/json",
|
|
363
|
-
authorization: `Bearer ${apiSecret}`,
|
|
364
|
-
"x-tenant-id": tenantId,
|
|
365
|
-
...(principalId ? { "x-principal-id": principalId } : {}),
|
|
366
|
-
},
|
|
367
|
-
body: JSON.stringify({ query, variables }),
|
|
368
|
-
});
|
|
369
|
-
const text = await response.text();
|
|
370
|
-
if (!response.ok) {
|
|
371
|
-
throw new Error(`GraphQL HTTP ${response.status}: ${text.slice(0, 500)}`);
|
|
372
|
-
}
|
|
373
|
-
const body = JSON.parse(text);
|
|
374
|
-
if (body.errors?.length) {
|
|
375
|
-
throw new Error(`GraphQL errors: ${JSON.stringify(body.errors)}`);
|
|
376
|
-
}
|
|
377
|
-
return body.data;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
async function fetchWithTimeout(url, options = {}) {
|
|
381
|
-
const controller = new AbortController();
|
|
382
|
-
const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
383
|
-
try {
|
|
384
|
-
return await fetch(url, { ...options, signal: controller.signal });
|
|
385
|
-
} finally {
|
|
386
|
-
clearTimeout(timer);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
function assert(name, okOrDetails, details = {}) {
|
|
391
|
-
const ok =
|
|
392
|
-
typeof okOrDetails === "object" && okOrDetails !== null
|
|
393
|
-
? Boolean(okOrDetails.ok)
|
|
394
|
-
: Boolean(okOrDetails);
|
|
395
|
-
const mergedDetails =
|
|
396
|
-
typeof okOrDetails === "object" && okOrDetails !== null
|
|
397
|
-
? { ...okOrDetails }
|
|
398
|
-
: details;
|
|
399
|
-
delete mergedDetails.ok;
|
|
400
|
-
checks.push({ name, ok, ...mergedDetails });
|
|
401
|
-
if (!ok) throw new Error(`${name} failed`);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function skip(name, details) {
|
|
405
|
-
checks.push({
|
|
406
|
-
name,
|
|
407
|
-
ok: true,
|
|
408
|
-
skipped: true,
|
|
409
|
-
...(typeof details === "string" ? { reason: details } : details),
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
function requireEnv(name, value) {
|
|
414
|
-
if (!value) throw new Error(`${name} is required`);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
function containsSensitiveBackendIdentifier(status) {
|
|
418
|
-
const text = JSON.stringify(status).toLowerCase();
|
|
419
|
-
return (
|
|
420
|
-
text.includes("s3://") ||
|
|
421
|
-
text.includes("cognee.internal") ||
|
|
422
|
-
text.includes("neptune") ||
|
|
423
|
-
text.includes("efsfilesystemid") ||
|
|
424
|
-
text.includes("filesystemid")
|
|
425
|
-
);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
function first(...values) {
|
|
429
|
-
return values
|
|
430
|
-
.find((value) => typeof value === "string" && value.trim())
|
|
431
|
-
?.trim();
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
function loadEnvFile() {
|
|
435
|
-
const candidates = [
|
|
436
|
-
path.resolve("apps/web/.env"),
|
|
437
|
-
path.resolve("terraform/examples/greenfield/.env"),
|
|
438
|
-
];
|
|
439
|
-
const output = {};
|
|
440
|
-
for (const file of candidates) {
|
|
441
|
-
if (!fs.existsSync(file)) continue;
|
|
442
|
-
for (const line of fs.readFileSync(file, "utf8").split(/\r?\n/)) {
|
|
443
|
-
const match = line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/);
|
|
444
|
-
if (!match) continue;
|
|
445
|
-
output[match[1]] = match[2].replace(/^['"]|['"]$/g, "");
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
return output;
|
|
449
|
-
}
|