thinkwork-cli 0.11.0 → 0.12.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 (3) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.js +1490 -230
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2185,9 +2185,9 @@ function registerInitCommand(program2) {
2185
2185
  printError("Stage name is required. Pass -s <name> or re-run in an interactive terminal.");
2186
2186
  process.exit(1);
2187
2187
  }
2188
- const { input: input19 } = await import("@inquirer/prompts");
2188
+ const { input: input20 } = await import("@inquirer/prompts");
2189
2189
  try {
2190
- stage = await input19({
2190
+ stage = await input20({
2191
2191
  message: "Stage name (e.g. dev, staging, prod):",
2192
2192
  validate: (v) => validateStage(v).error ?? true
2193
2193
  });
@@ -2801,10 +2801,10 @@ async function getTenant(client, id) {
2801
2801
  async function getTenantBySlug(client, slug) {
2802
2802
  return client.fetch(`/api/tenants/by-slug/${encodeURIComponent(slug)}`);
2803
2803
  }
2804
- async function updateTenant(client, id, input19) {
2804
+ async function updateTenant(client, id, input20) {
2805
2805
  return client.fetch(`/api/tenants/${encodeURIComponent(id)}`, {
2806
2806
  method: "PUT",
2807
- body: JSON.stringify(input19)
2807
+ body: JSON.stringify(input20)
2808
2808
  });
2809
2809
  }
2810
2810
 
@@ -2815,12 +2815,12 @@ __export(admin_keys_exports, {
2815
2815
  listAdminKeys: () => listAdminKeys,
2816
2816
  revokeAdminKey: () => revokeAdminKey
2817
2817
  });
2818
- async function createAdminKey(client, tenantIdOrSlug, input19 = {}) {
2818
+ async function createAdminKey(client, tenantIdOrSlug, input20 = {}) {
2819
2819
  return client.fetch(
2820
2820
  `/api/tenants/${encodeURIComponent(tenantIdOrSlug)}/mcp-admin-keys`,
2821
2821
  {
2822
2822
  method: "POST",
2823
- body: JSON.stringify(input19)
2823
+ body: JSON.stringify(input20)
2824
2824
  }
2825
2825
  );
2826
2826
  }
@@ -3162,7 +3162,7 @@ Examples:
3162
3162
  ).action(
3163
3163
  async (nameArg, opts) => {
3164
3164
  try {
3165
- const { input: input19 } = await import("@inquirer/prompts");
3165
+ const { input: input20 } = await import("@inquirer/prompts");
3166
3166
  const { stage, api, tenant } = await resolveMcpContext(opts);
3167
3167
  let name = nameArg;
3168
3168
  if (!name) {
@@ -3170,7 +3170,7 @@ Examples:
3170
3170
  printError("Name is required. Pass it as a positional arg.");
3171
3171
  process.exit(1);
3172
3172
  }
3173
- name = await input19({ message: "Server name:" });
3173
+ name = await input20({ message: "Server name:" });
3174
3174
  }
3175
3175
  let url = opts.url;
3176
3176
  if (!url) {
@@ -3178,7 +3178,7 @@ Examples:
3178
3178
  printError("--url is required. Pass it as a flag.");
3179
3179
  process.exit(1);
3180
3180
  }
3181
- url = await input19({
3181
+ url = await input20({
3182
3182
  message: "MCP server URL:",
3183
3183
  validate: (v) => v.startsWith("http://") || v.startsWith("https://") ? true : "URL must start with http:// or https://"
3184
3184
  });
@@ -3338,7 +3338,7 @@ Examples:
3338
3338
  ).option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--agent <id>", "Agent ID").action(
3339
3339
  async (mcpServerArg, opts) => {
3340
3340
  try {
3341
- const { input: input19 } = await import("@inquirer/prompts");
3341
+ const { input: input20 } = await import("@inquirer/prompts");
3342
3342
  const { api, tenant } = await resolveMcpContext(opts);
3343
3343
  const server = await resolveServer(mcpServerArg, api, tenant.slug);
3344
3344
  let agent = opts.agent;
@@ -3347,7 +3347,7 @@ Examples:
3347
3347
  printError("--agent is required. Pass it as a flag.");
3348
3348
  process.exit(1);
3349
3349
  }
3350
- agent = await input19({ message: "Agent ID:" });
3350
+ agent = await input20({ message: "Agent ID:" });
3351
3351
  }
3352
3352
  const result = await apiFetch(
3353
3353
  api.apiUrl,
@@ -3370,7 +3370,7 @@ Examples:
3370
3370
  ).option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--agent <id>", "Agent ID").action(
3371
3371
  async (mcpServerArg, opts) => {
3372
3372
  try {
3373
- const { input: input19 } = await import("@inquirer/prompts");
3373
+ const { input: input20 } = await import("@inquirer/prompts");
3374
3374
  const { api, tenant } = await resolveMcpContext(opts);
3375
3375
  const server = await resolveServer(mcpServerArg, api, tenant.slug);
3376
3376
  let agent = opts.agent;
@@ -3379,7 +3379,7 @@ Examples:
3379
3379
  printError("--agent is required. Pass it as a flag.");
3380
3380
  process.exit(1);
3381
3381
  }
3382
- agent = await input19({ message: "Agent ID:" });
3382
+ agent = await input20({ message: "Agent ID:" });
3383
3383
  }
3384
3384
  await apiFetch(
3385
3385
  api.apiUrl,
@@ -4436,6 +4436,23 @@ Examples:
4436
4436
  }
4437
4437
 
4438
4438
  // src/gql/graphql.ts
4439
+ var ArtifactStatus = /* @__PURE__ */ ((ArtifactStatus2) => {
4440
+ ArtifactStatus2["Draft"] = "DRAFT";
4441
+ ArtifactStatus2["Final"] = "FINAL";
4442
+ ArtifactStatus2["Superseded"] = "SUPERSEDED";
4443
+ return ArtifactStatus2;
4444
+ })(ArtifactStatus || {});
4445
+ var ArtifactType = /* @__PURE__ */ ((ArtifactType2) => {
4446
+ ArtifactType2["Applet"] = "APPLET";
4447
+ ArtifactType2["AppletState"] = "APPLET_STATE";
4448
+ ArtifactType2["DataView"] = "DATA_VIEW";
4449
+ ArtifactType2["Digest"] = "DIGEST";
4450
+ ArtifactType2["Draft"] = "DRAFT";
4451
+ ArtifactType2["Note"] = "NOTE";
4452
+ ArtifactType2["Plan"] = "PLAN";
4453
+ ArtifactType2["Report"] = "REPORT";
4454
+ return ArtifactType2;
4455
+ })(ArtifactType || {});
4439
4456
  var CliAgentsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliAgents" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "status" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AgentStatus" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "type" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AgentType" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "includeSystem" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Boolean" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "agents" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "status" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "status" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "type" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "type" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "includeSystem" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "includeSystem" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "slug" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "runtime" } }, { "kind": "Field", "name": { "kind": "Name", "value": "templateId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastHeartbeatAt" } }] } }] } }] };
4440
4457
  var CliAllTenantAgentsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliAllTenantAgents" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "includeSystem" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Boolean" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "includeSubAgents" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Boolean" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "allTenantAgents" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "includeSystem" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "includeSystem" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "includeSubAgents" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "includeSubAgents" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "slug" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "runtime" } }, { "kind": "Field", "name": { "kind": "Name", "value": "templateId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastHeartbeatAt" } }] } }] } }] };
4441
4458
  var CliAgentDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliAgent" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "agent" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "slug" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "source" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "systemPrompt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "runtime" } }, { "kind": "Field", "name": { "kind": "Name", "value": "adapterType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "templateId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "version" } }, { "kind": "Field", "name": { "kind": "Name", "value": "humanPairId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "parentAgentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "reportsToId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastHeartbeatAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "capabilities" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "capability" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }, { "kind": "Field", "name": { "kind": "Name", "value": "config" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "skills" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "skillId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }, { "kind": "Field", "name": { "kind": "Name", "value": "rateLimitRpm" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "budgetPolicy" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "period" } }, { "kind": "Field", "name": { "kind": "Name", "value": "limitUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionOnExceed" } }] } }] } }] } }] };
@@ -4457,6 +4474,18 @@ var CliUpdateAgentEmailAllowlistDocument = { "kind": "Document", "definitions":
4457
4474
  var CliAgentVersionsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliAgentVersions" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "agentVersions" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "agentId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "versionNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdBy" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }] } }] } }] };
4458
4475
  var CliRollbackAgentVersionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliRollbackAgentVersion" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "versionId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "rollbackAgentVersion" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "agentId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "versionId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "versionId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "version" } }] } }] } }] };
4459
4476
  var CliAgentTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliAgentTenantBySlug" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tenantBySlug" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "slug" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] };
4477
+ var CliArtifactsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliArtifacts" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "threadId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "type" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ArtifactType" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "status" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ArtifactStatus" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "cursor" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "artifacts" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "threadId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "threadId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "agentId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "type" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "type" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "status" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "status" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "cursor" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "cursor" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }] } }] } }] };
4478
+ var CliArtifactDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliArtifact" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "artifact" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tenantId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "summary" } }, { "kind": "Field", "name": { "kind": "Name", "value": "content" } }, { "kind": "Field", "name": { "kind": "Name", "value": "s3Key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sourceMessageId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "favoritedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }] } }] } }] };
4479
+ var CliArtifactTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliArtifactTenantBySlug" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tenantBySlug" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "slug" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] };
4480
+ var CliBudgetPoliciesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliBudgetPolicies" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "budgetPolicies" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "scope" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "period" } }, { "kind": "Field", "name": { "kind": "Name", "value": "limitUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionOnExceed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }] } }] } }] };
4481
+ var CliBudgetStatusDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliBudgetStatus" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "budgetStatus" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "policy" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "scope" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "period" } }, { "kind": "Field", "name": { "kind": "Name", "value": "limitUsd" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "spentUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "remainingUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "percentUsed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] };
4482
+ var CliUpsertBudgetPolicyDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliUpsertBudgetPolicy" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "UpsertBudgetPolicyInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "upsertBudgetPolicy" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "scope" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "limitUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "period" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionOnExceed" } }] } }] } }] };
4483
+ var CliDeleteBudgetPolicyDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliDeleteBudgetPolicy" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "deleteBudgetPolicy" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }] }] } }] };
4484
+ var CliCostSummaryDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliCostSummary" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "from" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AWSDateTime" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "to" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AWSDateTime" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "costSummary" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "from" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "from" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "to" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "to" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "totalUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "llmUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "computeUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "toolsUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "evalUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalInputTokens" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalOutputTokens" } }, { "kind": "Field", "name": { "kind": "Name", "value": "eventCount" } }] } }] } }] };
4485
+ var CliCostByAgentDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliCostByAgent" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "from" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AWSDateTime" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "to" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AWSDateTime" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "costByAgent" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "from" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "from" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "to" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "to" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "eventCount" } }] } }] } }] };
4486
+ var CliCostByModelDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliCostByModel" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "from" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AWSDateTime" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "to" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AWSDateTime" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "costByModel" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "from" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "from" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "to" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "to" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "model" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "inputTokens" } }, { "kind": "Field", "name": { "kind": "Name", "value": "outputTokens" } }] } }] } }] };
4487
+ var CliCostSeriesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliCostSeries" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "days" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "costTimeSeries" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "days" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "days" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "day" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "llmUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "computeUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "toolsUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "eventCount" } }] } }] } }] };
4488
+ var CliDashboardDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliDashboard" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "agents" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "threads" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "IntValue", "value": "200" } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "archivedAt" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "inboxItems" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "status" }, "value": { "kind": "EnumValue", "value": "PENDING" } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "costSummary" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "totalUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "llmUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "computeUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "eventCount" } }] } }] } }] };
4460
4489
  var CliEvalRunsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliEvalRuns" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "offset" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "evalRuns" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "agentId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "offset" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "offset" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "totalCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "items" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "model" } }, { "kind": "Field", "name": { "kind": "Name", "value": "categories" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentTemplateId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentTemplateName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalTests" } }, { "kind": "Field", "name": { "kind": "Name", "value": "passed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "failed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "passRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "regression" } }, { "kind": "Field", "name": { "kind": "Name", "value": "costUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "errorMessage" } }, { "kind": "Field", "name": { "kind": "Name", "value": "startedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "completedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] } }] };
4461
4490
  var CliEvalRunDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliEvalRun" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "evalRun" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "model" } }, { "kind": "Field", "name": { "kind": "Name", "value": "categories" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentTemplateId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentTemplateName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalTests" } }, { "kind": "Field", "name": { "kind": "Name", "value": "passed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "failed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "passRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "regression" } }, { "kind": "Field", "name": { "kind": "Name", "value": "costUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "errorMessage" } }, { "kind": "Field", "name": { "kind": "Name", "value": "startedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "completedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
4462
4491
  var CliEvalRunResultsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliEvalRunResults" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "runId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "evalRunResults" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "runId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "runId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "testCaseId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "testCaseName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "category" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "score" } }, { "kind": "Field", "name": { "kind": "Name", "value": "durationMs" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentSessionId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "input" } }, { "kind": "Field", "name": { "kind": "Name", "value": "expected" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actualOutput" } }, { "kind": "Field", "name": { "kind": "Name", "value": "evaluatorResults" } }, { "kind": "Field", "name": { "kind": "Name", "value": "assertions" } }, { "kind": "Field", "name": { "kind": "Name", "value": "errorMessage" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
@@ -4501,8 +4530,22 @@ var CliInviteMemberDocument = { "kind": "Document", "definitions": [{ "kind": "O
4501
4530
  var CliUpdateTenantMemberDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliUpdateTenantMember" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "UpdateTenantMemberInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "updateTenantMember" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] };
4502
4531
  var CliRemoveTenantMemberDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliRemoveTenantMember" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "removeTenantMember" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }] }] } }] };
4503
4532
  var CliMemberTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliMemberTenantBySlug" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tenantBySlug" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "slug" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "slug" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }] } }] } }] };
4533
+ var CliMemoryRecordsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliMemoryRecords" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "assistantId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "namespace" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "memoryRecords" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "assistantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "assistantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "namespace" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "namespace" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "memoryRecordId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "namespace" } }, { "kind": "Field", "name": { "kind": "Name", "value": "content" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "text" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "strategy" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }] } }] } }] };
4534
+ var CliMemorySearchDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliMemorySearch" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "assistantId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "query" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "strategy" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "MemoryStrategy" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "memorySearch" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "assistantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "assistantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "query" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "query" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "strategy" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "strategy" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "records" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "memoryRecordId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "namespace" } }, { "kind": "Field", "name": { "kind": "Name", "value": "content" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "text" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "score" } }] } }] } }] } }] };
4535
+ var CliMemoryGraphDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliMemoryGraph" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "assistantId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "memoryGraph" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "assistantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "assistantId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "nodes" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "label" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "edges" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "source" } }, { "kind": "Field", "name": { "kind": "Name", "value": "target" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }] } }] } }] } }] };
4536
+ var CliUpdateMemoryRecordDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliUpdateMemoryRecord" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "assistantId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "memoryRecordId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "content" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "updateMemoryRecord" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "assistantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "assistantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "memoryRecordId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "memoryRecordId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "content" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "content" } } }] }] } }] };
4537
+ var CliDeleteMemoryRecordDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliDeleteMemoryRecord" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "assistantId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "memoryRecordId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "deleteMemoryRecord" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "assistantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "assistantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "memoryRecordId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "memoryRecordId" } } }] }] } }] };
4538
+ var CliMemoryTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliMemoryTenantBySlug" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tenantBySlug" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "slug" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] };
4504
4539
  var CliMsgSendMessageDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliMsgSendMessage" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "SendMessageInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "sendMessage" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "content" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
4505
4540
  var CliMsgMessagesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliMsgMessages" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "threadId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "cursor" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "messages" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "threadId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "threadId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "cursor" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "cursor" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "edges" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "cursor" } }, { "kind": "Field", "name": { "kind": "Name", "value": "node" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "senderType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "senderId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "content" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tokenCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "pageInfo" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "hasNextPage" } }, { "kind": "Field", "name": { "kind": "Name", "value": "endCursor" } }] } }] } }] } }] };
4541
+ var CliAgentPerformanceDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliAgentPerformance" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "from" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AWSDateTime" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "to" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AWSDateTime" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "agentPerformance" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "from" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "from" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "to" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "to" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "invocationCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "errorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "avgDurationMs" } }, { "kind": "Field", "name": { "kind": "Name", "value": "p95DurationMs" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalInputTokens" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalOutputTokens" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalCostUsd" } }] } }] } }] };
4542
+ var CliSingleAgentPerformanceDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliSingleAgentPerformance" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "singleAgentPerformance" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "agentId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "invocationCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "errorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "avgDurationMs" } }, { "kind": "Field", "name": { "kind": "Name", "value": "p95DurationMs" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalInputTokens" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalOutputTokens" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalCostUsd" } }] } }] } }] };
4543
+ var CliRecipesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliRecipes" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "threadId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "cursor" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "recipes" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "threadId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "threadId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "agentId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "cursor" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "cursor" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "server" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tool" } }, { "kind": "Field", "name": { "kind": "Name", "value": "genuiType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastRefreshed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
4544
+ var CliRecipeDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliRecipe" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "recipe" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "summary" } }, { "kind": "Field", "name": { "kind": "Name", "value": "server" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tool" } }, { "kind": "Field", "name": { "kind": "Name", "value": "params" } }, { "kind": "Field", "name": { "kind": "Name", "value": "genuiType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "templates" } }, { "kind": "Field", "name": { "kind": "Name", "value": "cachedResult" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastRefreshed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastError" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sourceMessageId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }] } }] } }] };
4545
+ var CliCreateRecipeDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliCreateRecipe" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "CreateRecipeInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createRecipe" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "server" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tool" } }] } }] } }] };
4546
+ var CliUpdateRecipeDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliUpdateRecipe" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "UpdateRecipeInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "updateRecipe" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "title" } }] } }] } }] };
4547
+ var CliDeleteRecipeDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliDeleteRecipe" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "deleteRecipe" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }] }] } }] };
4548
+ var CliRecipeTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliRecipeTenantBySlug" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tenantBySlug" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "slug" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] };
4506
4549
  var CliRoutinesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliRoutines" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "teamId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "status" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "RoutineStatus" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "routines" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "teamId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "teamId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "agentId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "status" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "status" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "engine" } }, { "kind": "Field", "name": { "kind": "Name", "value": "schedule" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "teamId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastRunAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "nextRunAt" } }] } }] } }] };
4507
4550
  var CliRoutineDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliRoutine" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "routine" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "description" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "engine" } }, { "kind": "Field", "name": { "kind": "Name", "value": "schedule" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "teamId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "visibility" } }, { "kind": "Field", "name": { "kind": "Name", "value": "owningAgentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "currentVersion" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastRunAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "nextRunAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "triggers" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "triggerType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }, { "kind": "Field", "name": { "kind": "Name", "value": "config" } }] } }] } }] } }] };
4508
4551
  var CliCreateRoutineDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliCreateRoutine" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "CreateRoutineInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createRoutine" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] };
@@ -4559,6 +4602,8 @@ var CliEscalateThreadDocument = { "kind": "Document", "definitions": [{ "kind":
4559
4602
  var CliDelegateThreadDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliDelegateThread" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "DelegateThreadInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "delegateThread" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "assigneeType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "assigneeId" } }] } }] } }] };
4560
4603
  var CliSendMessageDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliSendMessage" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "SendMessageInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "sendMessage" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "content" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
4561
4604
  var CliThreadTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliThreadTenantBySlug" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tenantBySlug" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "slug" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "slug" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }] } }] } }] };
4605
+ var CliThreadTracesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliThreadTraces" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "threadId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "threadTraces" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "threadId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "threadId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "traceId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "model" } }, { "kind": "Field", "name": { "kind": "Name", "value": "inputTokens" } }, { "kind": "Field", "name": { "kind": "Name", "value": "outputTokens" } }, { "kind": "Field", "name": { "kind": "Name", "value": "durationMs" } }, { "kind": "Field", "name": { "kind": "Name", "value": "costUsd" } }, { "kind": "Field", "name": { "kind": "Name", "value": "estimated" } }] } }] } }] };
4606
+ var CliTurnInvocationLogsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliTurnInvocationLogs" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "turnId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "turnInvocationLogs" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "turnId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "turnId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "requestId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "modelId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "timestamp" } }, { "kind": "Field", "name": { "kind": "Name", "value": "inputTokenCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "outputTokenCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "cacheReadTokenCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "toolCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "costUsd" } }] } }] } }] };
4562
4607
  var CliThreadTurnsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliThreadTurns" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "routineId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "triggerId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "threadId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "status" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "threadTurns" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "agentId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "agentId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "routineId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "routineId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "triggerId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "triggerId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "threadId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "threadId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "status" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "status" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "routineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "invocationSource" } }, { "kind": "Field", "name": { "kind": "Name", "value": "triggerName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "startedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "finishedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalCost" } }, { "kind": "Field", "name": { "kind": "Name", "value": "error" } }] } }] } }] };
4563
4608
  var CliThreadTurnDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliThreadTurn" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "threadTurn" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tenantId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "routineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "turnNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "invocationSource" } }, { "kind": "Field", "name": { "kind": "Name", "value": "triggerName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "triggerDetail" } }, { "kind": "Field", "name": { "kind": "Name", "value": "startedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "finishedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "error" } }, { "kind": "Field", "name": { "kind": "Name", "value": "errorCode" } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalCost" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastActivityAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "retryAttempt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "externalRunId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sessionIdBefore" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sessionIdAfter" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
4564
4609
  var CliThreadTurnEventsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliThreadTurnEvents" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "runId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "threadTurnEvents" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "runId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "runId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "seq" } }, { "kind": "Field", "name": { "kind": "Name", "value": "eventType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "stream" } }, { "kind": "Field", "name": { "kind": "Name", "value": "level" } }, { "kind": "Field", "name": { "kind": "Name", "value": "message" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
@@ -4579,6 +4624,7 @@ var CliAllTenantAgentsForWikiDocument = { "kind": "Document", "definitions": [{
4579
4624
  var CliCompileWikiNowDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliCompileWikiNow" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "ownerId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "modelId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "compileWikiNow" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "ownerId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "ownerId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "modelId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "modelId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tenantId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ownerId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "trigger" } }, { "kind": "Field", "name": { "kind": "Name", "value": "dedupeKey" } }, { "kind": "Field", "name": { "kind": "Name", "value": "attempt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
4580
4625
  var CliResetWikiCursorDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliResetWikiCursor" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "ownerId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "force" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Boolean" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "resetWikiCursor" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "ownerId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "ownerId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "force" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "force" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tenantId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ownerId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "cursorCleared" } }, { "kind": "Field", "name": { "kind": "Name", "value": "pagesArchived" } }] } }] } }] };
4581
4626
  var CliWikiCompileJobsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliWikiCompileJobs" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "ownerId" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "wikiCompileJobs" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "ownerId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "ownerId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tenantId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ownerId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "trigger" } }, { "kind": "Field", "name": { "kind": "Name", "value": "dedupeKey" } }, { "kind": "Field", "name": { "kind": "Name", "value": "attempt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "claimedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "startedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "finishedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "error" } }, { "kind": "Field", "name": { "kind": "Name", "value": "metrics" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
4627
+ var CliCmdTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliCmdTenantBySlug" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "tenantBySlug" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "slug" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "slug" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] };
4582
4628
 
4583
4629
  // src/gql/gql.ts
4584
4630
  var documents = {
@@ -4603,6 +4649,18 @@ var documents = {
4603
4649
  "\n query CliAgentVersions($agentId: ID!, $limit: Int) {\n agentVersions(agentId: $agentId, limit: $limit) {\n id\n versionNumber\n createdBy\n createdAt\n agentId\n }\n }\n": CliAgentVersionsDocument,
4604
4650
  "\n mutation CliRollbackAgentVersion($agentId: ID!, $versionId: ID!) {\n rollbackAgentVersion(agentId: $agentId, versionId: $versionId) {\n id\n name\n version\n }\n }\n": CliRollbackAgentVersionDocument,
4605
4651
  "\n query CliAgentTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliAgentTenantBySlugDocument,
4652
+ "\n query CliArtifacts(\n $tenantId: ID!\n $threadId: ID\n $agentId: ID\n $type: ArtifactType\n $status: ArtifactStatus\n $limit: Int\n $cursor: String\n ) {\n artifacts(\n tenantId: $tenantId\n threadId: $threadId\n agentId: $agentId\n type: $type\n status: $status\n limit: $limit\n cursor: $cursor\n ) {\n id\n title\n type\n status\n agentId\n threadId\n createdAt\n updatedAt\n }\n }\n": CliArtifactsDocument,
4653
+ "\n query CliArtifact($id: ID!) {\n artifact(id: $id) {\n id\n tenantId\n agentId\n threadId\n title\n type\n status\n summary\n content\n s3Key\n sourceMessageId\n favoritedAt\n createdAt\n updatedAt\n }\n }\n": CliArtifactDocument,
4654
+ "\n query CliArtifactTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliArtifactTenantBySlugDocument,
4655
+ "\n query CliBudgetPolicies($tenantId: ID!) {\n budgetPolicies(tenantId: $tenantId) {\n id\n scope\n agentId\n period\n limitUsd\n actionOnExceed\n enabled\n }\n }\n": CliBudgetPoliciesDocument,
4656
+ "\n query CliBudgetStatus($tenantId: ID!) {\n budgetStatus(tenantId: $tenantId) {\n policy {\n id\n scope\n agentId\n period\n limitUsd\n }\n spentUsd\n remainingUsd\n percentUsed\n status\n }\n }\n": CliBudgetStatusDocument,
4657
+ "\n mutation CliUpsertBudgetPolicy($tenantId: ID!, $input: UpsertBudgetPolicyInput!) {\n upsertBudgetPolicy(tenantId: $tenantId, input: $input) {\n id\n scope\n agentId\n limitUsd\n period\n actionOnExceed\n }\n }\n": CliUpsertBudgetPolicyDocument,
4658
+ "\n mutation CliDeleteBudgetPolicy($id: ID!) {\n deleteBudgetPolicy(id: $id)\n }\n": CliDeleteBudgetPolicyDocument,
4659
+ "\n query CliCostSummary($tenantId: ID!, $from: AWSDateTime, $to: AWSDateTime) {\n costSummary(tenantId: $tenantId, from: $from, to: $to) {\n totalUsd\n llmUsd\n computeUsd\n toolsUsd\n evalUsd\n totalInputTokens\n totalOutputTokens\n eventCount\n }\n }\n": CliCostSummaryDocument,
4660
+ "\n query CliCostByAgent($tenantId: ID!, $from: AWSDateTime, $to: AWSDateTime) {\n costByAgent(tenantId: $tenantId, from: $from, to: $to) {\n agentId\n agentName\n totalUsd\n eventCount\n }\n }\n": CliCostByAgentDocument,
4661
+ "\n query CliCostByModel($tenantId: ID!, $from: AWSDateTime, $to: AWSDateTime) {\n costByModel(tenantId: $tenantId, from: $from, to: $to) {\n model\n totalUsd\n inputTokens\n outputTokens\n }\n }\n": CliCostByModelDocument,
4662
+ "\n query CliCostSeries($tenantId: ID!, $days: Int) {\n costTimeSeries(tenantId: $tenantId, days: $days) {\n day\n totalUsd\n llmUsd\n computeUsd\n toolsUsd\n eventCount\n }\n }\n": CliCostSeriesDocument,
4663
+ "\n query CliDashboard($tenantId: ID!) {\n agents(tenantId: $tenantId) {\n id\n status\n }\n threads(tenantId: $tenantId, limit: 200) {\n id\n status\n archivedAt\n }\n inboxItems(tenantId: $tenantId, status: PENDING) {\n id\n }\n costSummary(tenantId: $tenantId) {\n totalUsd\n llmUsd\n computeUsd\n eventCount\n }\n }\n": CliDashboardDocument,
4606
4664
  "\n query CliEvalRuns($tenantId: ID!, $agentId: ID, $limit: Int, $offset: Int) {\n evalRuns(\n tenantId: $tenantId\n agentId: $agentId\n limit: $limit\n offset: $offset\n ) {\n totalCount\n items {\n id\n status\n model\n categories\n agentId\n agentName\n agentTemplateId\n agentTemplateName\n totalTests\n passed\n failed\n passRate\n regression\n costUsd\n errorMessage\n startedAt\n completedAt\n createdAt\n }\n }\n }\n": CliEvalRunsDocument,
4607
4665
  "\n query CliEvalRun($id: ID!) {\n evalRun(id: $id) {\n id\n status\n model\n categories\n agentId\n agentName\n agentTemplateId\n agentTemplateName\n totalTests\n passed\n failed\n passRate\n regression\n costUsd\n errorMessage\n startedAt\n completedAt\n createdAt\n }\n }\n": CliEvalRunDocument,
4608
4666
  "\n query CliEvalRunResults($runId: ID!) {\n evalRunResults(runId: $runId) {\n id\n testCaseId\n testCaseName\n category\n status\n score\n durationMs\n agentSessionId\n input\n expected\n actualOutput\n evaluatorResults\n assertions\n errorMessage\n createdAt\n }\n }\n": CliEvalRunResultsDocument,
@@ -4647,8 +4705,22 @@ var documents = {
4647
4705
  "\n mutation CliUpdateTenantMember($id: ID!, $input: UpdateTenantMemberInput!) {\n updateTenantMember(id: $id, input: $input) {\n id\n role\n status\n }\n }\n": CliUpdateTenantMemberDocument,
4648
4706
  "\n mutation CliRemoveTenantMember($id: ID!) {\n removeTenantMember(id: $id)\n }\n": CliRemoveTenantMemberDocument,
4649
4707
  "\n query CliMemberTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n slug\n name\n }\n }\n": CliMemberTenantBySlugDocument,
4708
+ "\n query CliMemoryRecords($tenantId: ID, $assistantId: ID, $namespace: String!) {\n memoryRecords(tenantId: $tenantId, assistantId: $assistantId, namespace: $namespace) {\n memoryRecordId\n namespace\n content {\n text\n }\n strategy\n createdAt\n updatedAt\n }\n }\n": CliMemoryRecordsDocument,
4709
+ "\n query CliMemorySearch($tenantId: ID, $assistantId: ID, $query: String!, $strategy: MemoryStrategy, $limit: Int) {\n memorySearch(tenantId: $tenantId, assistantId: $assistantId, query: $query, strategy: $strategy, limit: $limit) {\n records {\n memoryRecordId\n namespace\n content {\n text\n }\n score\n }\n }\n }\n": CliMemorySearchDocument,
4710
+ "\n query CliMemoryGraph($tenantId: ID, $assistantId: ID) {\n memoryGraph(tenantId: $tenantId, assistantId: $assistantId) {\n nodes { id label type }\n edges { source target type }\n }\n }\n": CliMemoryGraphDocument,
4711
+ "\n mutation CliUpdateMemoryRecord($tenantId: ID, $assistantId: ID, $memoryRecordId: ID!, $content: String!) {\n updateMemoryRecord(tenantId: $tenantId, assistantId: $assistantId, memoryRecordId: $memoryRecordId, content: $content)\n }\n": CliUpdateMemoryRecordDocument,
4712
+ "\n mutation CliDeleteMemoryRecord($tenantId: ID, $assistantId: ID, $memoryRecordId: ID!) {\n deleteMemoryRecord(tenantId: $tenantId, assistantId: $assistantId, memoryRecordId: $memoryRecordId)\n }\n": CliDeleteMemoryRecordDocument,
4713
+ "\n query CliMemoryTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliMemoryTenantBySlugDocument,
4650
4714
  "\n mutation CliMsgSendMessage($input: SendMessageInput!) {\n sendMessage(input: $input) {\n id\n threadId\n role\n content\n createdAt\n }\n }\n": CliMsgSendMessageDocument,
4651
4715
  "\n query CliMsgMessages($threadId: ID!, $limit: Int, $cursor: String) {\n messages(threadId: $threadId, limit: $limit, cursor: $cursor) {\n edges {\n cursor\n node {\n id\n role\n senderType\n senderId\n content\n tokenCount\n createdAt\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n": CliMsgMessagesDocument,
4716
+ "\n query CliAgentPerformance($tenantId: ID!, $from: AWSDateTime, $to: AWSDateTime) {\n agentPerformance(tenantId: $tenantId, from: $from, to: $to) {\n agentId\n agentName\n invocationCount\n errorCount\n avgDurationMs\n p95DurationMs\n totalInputTokens\n totalOutputTokens\n totalCostUsd\n }\n }\n": CliAgentPerformanceDocument,
4717
+ "\n query CliSingleAgentPerformance($agentId: ID!, $tenantId: ID!) {\n singleAgentPerformance(agentId: $agentId, tenantId: $tenantId) {\n agentId\n agentName\n invocationCount\n errorCount\n avgDurationMs\n p95DurationMs\n totalInputTokens\n totalOutputTokens\n totalCostUsd\n }\n }\n": CliSingleAgentPerformanceDocument,
4718
+ "\n query CliRecipes($tenantId: ID!, $threadId: ID, $agentId: ID, $limit: Int, $cursor: String) {\n recipes(tenantId: $tenantId, threadId: $threadId, agentId: $agentId, limit: $limit, cursor: $cursor) {\n id\n title\n server\n tool\n genuiType\n agentId\n threadId\n lastRefreshed\n createdAt\n }\n }\n": CliRecipesDocument,
4719
+ "\n query CliRecipe($id: ID!) {\n recipe(id: $id) {\n id\n title\n summary\n server\n tool\n params\n genuiType\n templates\n cachedResult\n lastRefreshed\n lastError\n agentId\n threadId\n sourceMessageId\n createdAt\n updatedAt\n }\n }\n": CliRecipeDocument,
4720
+ "\n mutation CliCreateRecipe($input: CreateRecipeInput!) {\n createRecipe(input: $input) {\n id\n title\n server\n tool\n }\n }\n": CliCreateRecipeDocument,
4721
+ "\n mutation CliUpdateRecipe($id: ID!, $input: UpdateRecipeInput!) {\n updateRecipe(id: $id, input: $input) {\n id\n title\n }\n }\n": CliUpdateRecipeDocument,
4722
+ "\n mutation CliDeleteRecipe($id: ID!) {\n deleteRecipe(id: $id)\n }\n": CliDeleteRecipeDocument,
4723
+ "\n query CliRecipeTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliRecipeTenantBySlugDocument,
4652
4724
  "\n query CliRoutines($tenantId: ID!, $teamId: ID, $agentId: ID, $status: RoutineStatus) {\n routines(tenantId: $tenantId, teamId: $teamId, agentId: $agentId, status: $status) {\n id\n name\n type\n status\n engine\n schedule\n agentId\n teamId\n lastRunAt\n nextRunAt\n }\n }\n": CliRoutinesDocument,
4653
4725
  "\n query CliRoutine($id: ID!) {\n routine(id: $id) {\n id\n name\n description\n type\n status\n engine\n schedule\n agentId\n teamId\n visibility\n owningAgentId\n currentVersion\n lastRunAt\n nextRunAt\n createdAt\n updatedAt\n triggers {\n id\n triggerType\n enabled\n config\n }\n }\n }\n": CliRoutineDocument,
4654
4726
  "\n mutation CliCreateRoutine($input: CreateRoutineInput!) {\n createRoutine(input: $input) {\n id\n name\n type\n status\n }\n }\n": CliCreateRoutineDocument,
@@ -4705,6 +4777,8 @@ var documents = {
4705
4777
  "\n mutation CliDelegateThread($input: DelegateThreadInput!) {\n delegateThread(input: $input) {\n id\n status\n assigneeType\n assigneeId\n }\n }\n": CliDelegateThreadDocument,
4706
4778
  "\n mutation CliSendMessage($input: SendMessageInput!) {\n sendMessage(input: $input) {\n id\n threadId\n role\n content\n createdAt\n }\n }\n": CliSendMessageDocument,
4707
4779
  "\n query CliThreadTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n slug\n name\n }\n }\n": CliThreadTenantBySlugDocument,
4780
+ "\n query CliThreadTraces($threadId: ID!, $tenantId: ID!) {\n threadTraces(threadId: $threadId, tenantId: $tenantId) {\n traceId\n threadId\n agentId\n agentName\n model\n inputTokens\n outputTokens\n durationMs\n costUsd\n estimated\n }\n }\n": CliThreadTracesDocument,
4781
+ "\n query CliTurnInvocationLogs($tenantId: ID!, $turnId: ID!) {\n turnInvocationLogs(tenantId: $tenantId, turnId: $turnId) {\n requestId\n modelId\n timestamp\n inputTokenCount\n outputTokenCount\n cacheReadTokenCount\n toolCount\n costUsd\n }\n }\n": CliTurnInvocationLogsDocument,
4708
4782
  "\n query CliThreadTurns(\n $tenantId: ID!\n $agentId: ID\n $routineId: ID\n $triggerId: ID\n $threadId: ID\n $status: String\n $limit: Int\n ) {\n threadTurns(\n tenantId: $tenantId\n agentId: $agentId\n routineId: $routineId\n triggerId: $triggerId\n threadId: $threadId\n status: $status\n limit: $limit\n ) {\n id\n agentId\n routineId\n threadId\n status\n invocationSource\n triggerName\n startedAt\n finishedAt\n totalCost\n error\n }\n }\n": CliThreadTurnsDocument,
4709
4783
  "\n query CliThreadTurn($id: ID!) {\n threadTurn(id: $id) {\n id\n tenantId\n agentId\n routineId\n threadId\n turnNumber\n status\n invocationSource\n triggerName\n triggerDetail\n startedAt\n finishedAt\n error\n errorCode\n totalCost\n lastActivityAt\n retryAttempt\n externalRunId\n sessionIdBefore\n sessionIdAfter\n createdAt\n }\n }\n": CliThreadTurnDocument,
4710
4784
  "\n query CliThreadTurnEvents($runId: ID!, $limit: Int) {\n threadTurnEvents(runId: $runId, limit: $limit) {\n seq\n eventType\n stream\n level\n message\n createdAt\n }\n }\n": CliThreadTurnEventsDocument,
@@ -4724,7 +4798,8 @@ var documents = {
4724
4798
  "\n query CliAllTenantAgentsForWiki($tenantId: ID!) {\n allTenantAgents(tenantId: $tenantId, includeSystem: false, includeSubAgents: false) {\n id\n name\n slug\n type\n status\n }\n }\n": CliAllTenantAgentsForWikiDocument,
4725
4799
  "\n mutation CliCompileWikiNow($tenantId: ID!, $ownerId: ID!, $modelId: String) {\n compileWikiNow(tenantId: $tenantId, ownerId: $ownerId, modelId: $modelId) {\n id\n tenantId\n ownerId\n status\n trigger\n dedupeKey\n attempt\n createdAt\n }\n }\n": CliCompileWikiNowDocument,
4726
4800
  "\n mutation CliResetWikiCursor($tenantId: ID!, $ownerId: ID!, $force: Boolean) {\n resetWikiCursor(tenantId: $tenantId, ownerId: $ownerId, force: $force) {\n tenantId\n ownerId\n cursorCleared\n pagesArchived\n }\n }\n": CliResetWikiCursorDocument,
4727
- "\n query CliWikiCompileJobs($tenantId: ID!, $ownerId: ID, $limit: Int) {\n wikiCompileJobs(tenantId: $tenantId, ownerId: $ownerId, limit: $limit) {\n id\n tenantId\n ownerId\n status\n trigger\n dedupeKey\n attempt\n claimedAt\n startedAt\n finishedAt\n error\n metrics\n createdAt\n }\n }\n": CliWikiCompileJobsDocument
4801
+ "\n query CliWikiCompileJobs($tenantId: ID!, $ownerId: ID, $limit: Int) {\n wikiCompileJobs(tenantId: $tenantId, ownerId: $ownerId, limit: $limit) {\n id\n tenantId\n ownerId\n status\n trigger\n dedupeKey\n attempt\n claimedAt\n startedAt\n finishedAt\n error\n metrics\n createdAt\n }\n }\n": CliWikiCompileJobsDocument,
4802
+ "\n query CliCmdTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliCmdTenantBySlugDocument
4728
4803
  };
4729
4804
  function graphql(source) {
4730
4805
  return documents[source] ?? {};
@@ -5176,15 +5251,15 @@ async function runThreadCreate(title, opts) {
5176
5251
  // src/commands/thread/update.ts
5177
5252
  async function runThreadUpdate(id, opts) {
5178
5253
  const ctx = await resolveThreadContext(opts);
5179
- const input19 = {};
5180
- if (opts.title !== void 0) input19.title = opts.title;
5181
- if (opts.assignee !== void 0) input19.assigneeId = opts.assignee;
5182
- if (opts.due !== void 0) input19.dueAt = opts.due;
5183
- if (Object.keys(input19).length === 0) {
5254
+ const input20 = {};
5255
+ if (opts.title !== void 0) input20.title = opts.title;
5256
+ if (opts.assignee !== void 0) input20.assigneeId = opts.assignee;
5257
+ if (opts.due !== void 0) input20.dueAt = opts.due;
5258
+ if (Object.keys(input20).length === 0) {
5184
5259
  printError("Nothing to update. Pass at least one of --title, --assignee, --due.");
5185
5260
  process.exit(1);
5186
5261
  }
5187
- const data = await gqlMutate(ctx.client, UpdateThreadDoc, { id, input: input19 });
5262
+ const data = await gqlMutate(ctx.client, UpdateThreadDoc, { id, input: input20 });
5188
5263
  const updated = data.updateThread;
5189
5264
  if (isJsonMode()) {
5190
5265
  printJson(updated);
@@ -5806,15 +5881,15 @@ async function runLabelCreate(name, opts) {
5806
5881
  }
5807
5882
  async function runLabelUpdate(id, opts) {
5808
5883
  const ctx = await resolveLabelContext(opts);
5809
- const input19 = {};
5810
- if (opts.name !== void 0) input19.name = opts.name;
5811
- if (opts.color !== void 0) input19.color = validateColor(opts.color);
5812
- if (opts.description !== void 0) input19.description = opts.description;
5813
- if (Object.keys(input19).length === 0) {
5884
+ const input20 = {};
5885
+ if (opts.name !== void 0) input20.name = opts.name;
5886
+ if (opts.color !== void 0) input20.color = validateColor(opts.color);
5887
+ if (opts.description !== void 0) input20.description = opts.description;
5888
+ if (Object.keys(input20).length === 0) {
5814
5889
  printError("Nothing to update. Pass at least one of --name, --color, --description.");
5815
5890
  process.exit(1);
5816
5891
  }
5817
- const data = await gqlMutate(ctx.client, UpdateThreadLabelDoc, { id, input: input19 });
5892
+ const data = await gqlMutate(ctx.client, UpdateThreadLabelDoc, { id, input: input20 });
5818
5893
  const updated = data.updateThreadLabel;
5819
5894
  if (isJsonMode()) {
5820
5895
  printJson(updated);
@@ -6852,19 +6927,19 @@ async function runAgentUpdate(id, opts) {
6852
6927
  if (!systemPrompt && opts.systemPromptFile) {
6853
6928
  systemPrompt = await readFile4(opts.systemPromptFile, "utf-8");
6854
6929
  }
6855
- const input19 = {};
6856
- if (opts.name !== void 0) input19.name = opts.name;
6857
- if (opts.role !== void 0) input19.role = opts.role;
6858
- if (opts.type !== void 0) input19.type = parseEnum(opts.type, TYPE_BY_NAME, "--type");
6859
- if (opts.parent !== void 0) input19.parentAgentId = opts.parent;
6860
- if (opts.reportsTo !== void 0) input19.reportsTo = opts.reportsTo;
6861
- if (systemPrompt !== void 0) input19.systemPrompt = systemPrompt;
6862
- if (opts.model !== void 0) input19.runtimeConfig = { model: opts.model };
6863
- if (Object.keys(input19).length === 0) {
6930
+ const input20 = {};
6931
+ if (opts.name !== void 0) input20.name = opts.name;
6932
+ if (opts.role !== void 0) input20.role = opts.role;
6933
+ if (opts.type !== void 0) input20.type = parseEnum(opts.type, TYPE_BY_NAME, "--type");
6934
+ if (opts.parent !== void 0) input20.parentAgentId = opts.parent;
6935
+ if (opts.reportsTo !== void 0) input20.reportsTo = opts.reportsTo;
6936
+ if (systemPrompt !== void 0) input20.systemPrompt = systemPrompt;
6937
+ if (opts.model !== void 0) input20.runtimeConfig = { model: opts.model };
6938
+ if (Object.keys(input20).length === 0) {
6864
6939
  printError("Nothing to update. Pass at least one field flag.");
6865
6940
  process.exit(1);
6866
6941
  }
6867
- const data = await gqlMutate(ctx.client, UpdateAgentDoc, { id, input: input19 });
6942
+ const data = await gqlMutate(ctx.client, UpdateAgentDoc, { id, input: input20 });
6868
6943
  if (isJsonMode()) {
6869
6944
  printJson(data.updateAgent);
6870
6945
  return;
@@ -7498,7 +7573,7 @@ function registerComputerCommand(program2) {
7498
7573
  const tenantId = resolveTenantId(opts);
7499
7574
  const computerId = resolveComputerId(opts);
7500
7575
  const taskType = resolveTaskType(opts);
7501
- const input19 = taskType === "workspace_file_write" ? { path: opts.path, content: opts.content } : void 0;
7576
+ const input20 = taskType === "workspace_file_write" ? { path: opts.path, content: opts.content } : void 0;
7502
7577
  if (!isJsonMode()) printHeader("computer task enqueue", stage);
7503
7578
  const response = await apiFetchRaw(
7504
7579
  api.apiUrl,
@@ -7510,7 +7585,7 @@ function registerComputerCommand(program2) {
7510
7585
  tenantId,
7511
7586
  computerId,
7512
7587
  taskType,
7513
- input: input19,
7588
+ input: input20,
7514
7589
  idempotencyKey: opts.idempotencyKey
7515
7590
  })
7516
7591
  }
@@ -7782,15 +7857,15 @@ async function runTemplateUpdate(id, opts) {
7782
7857
  "--system-prompt-file is not yet wired in the CLI \u2014 edit prompt files via the admin UI."
7783
7858
  );
7784
7859
  }
7785
- const input19 = {};
7786
- if (opts.name !== void 0) input19.name = opts.name;
7787
- if (opts.model !== void 0) input19.model = opts.model;
7788
- if (opts.description !== void 0) input19.description = opts.description;
7789
- if (Object.keys(input19).length === 0) {
7860
+ const input20 = {};
7861
+ if (opts.name !== void 0) input20.name = opts.name;
7862
+ if (opts.model !== void 0) input20.model = opts.model;
7863
+ if (opts.description !== void 0) input20.description = opts.description;
7864
+ if (Object.keys(input20).length === 0) {
7790
7865
  printError("Nothing to update. Pass at least one of --name, --model, --description.");
7791
7866
  process.exit(1);
7792
7867
  }
7793
- const data = await gqlMutate(ctx.client, UpdateAgentTemplateDoc, { id, input: input19 });
7868
+ const data = await gqlMutate(ctx.client, UpdateAgentTemplateDoc, { id, input: input20 });
7794
7869
  if (isJsonMode()) {
7795
7870
  printJson(data.updateAgentTemplate);
7796
7871
  return;
@@ -8112,15 +8187,15 @@ async function runTenantUpdate(id, opts) {
8112
8187
  printMissingApiSessionError(stage, false);
8113
8188
  process.exit(1);
8114
8189
  }
8115
- const input19 = {};
8116
- if (opts.name !== void 0) input19.name = opts.name;
8117
- if (opts.plan !== void 0) input19.plan = opts.plan;
8118
- if (opts.issuePrefix !== void 0) input19.issuePrefix = opts.issuePrefix;
8119
- if (Object.keys(input19).length === 0) {
8190
+ const input20 = {};
8191
+ if (opts.name !== void 0) input20.name = opts.name;
8192
+ if (opts.plan !== void 0) input20.plan = opts.plan;
8193
+ if (opts.issuePrefix !== void 0) input20.issuePrefix = opts.issuePrefix;
8194
+ if (Object.keys(input20).length === 0) {
8120
8195
  printError("Nothing to update. Pass at least one of --name, --plan, --issue-prefix.");
8121
8196
  process.exit(1);
8122
8197
  }
8123
- const data = await gqlMutate(client, UpdateTenantDoc, { id, input: input19 });
8198
+ const data = await gqlMutate(client, UpdateTenantDoc, { id, input: input20 });
8124
8199
  if (isJsonMode()) {
8125
8200
  printJson(data.updateTenant);
8126
8201
  return;
@@ -8158,18 +8233,18 @@ async function runTenantSettingsSet(tenantArg, opts) {
8158
8233
  stage: opts.stage,
8159
8234
  tenant: tenantArg
8160
8235
  });
8161
- const input19 = {};
8162
- if (opts.defaultModel !== void 0) input19.defaultModel = opts.defaultModel;
8236
+ const input20 = {};
8237
+ if (opts.defaultModel !== void 0) input20.defaultModel = opts.defaultModel;
8163
8238
  if (opts.monthlyBudgetUsd !== void 0) {
8164
- input19.budgetMonthlyCents = Math.round(Number.parseFloat(opts.monthlyBudgetUsd) * 100);
8239
+ input20.budgetMonthlyCents = Math.round(Number.parseFloat(opts.monthlyBudgetUsd) * 100);
8165
8240
  }
8166
- if (opts.maxAgents !== void 0) input19.maxAgents = Number.parseInt(opts.maxAgents, 10);
8241
+ if (opts.maxAgents !== void 0) input20.maxAgents = Number.parseInt(opts.maxAgents, 10);
8167
8242
  if (opts.autoCloseAfterDays !== void 0) {
8168
- input19.autoCloseThreadMinutes = Math.round(Number.parseFloat(opts.autoCloseAfterDays) * 60 * 24);
8243
+ input20.autoCloseThreadMinutes = Math.round(Number.parseFloat(opts.autoCloseAfterDays) * 60 * 24);
8169
8244
  }
8170
8245
  const features = parseFeatureFlags(opts.feature);
8171
- if (features !== void 0) input19.features = features;
8172
- if (Object.keys(input19).length === 0) {
8246
+ if (features !== void 0) input20.features = features;
8247
+ if (Object.keys(input20).length === 0) {
8173
8248
  printError(
8174
8249
  "Nothing to set. Pass at least one of --default-model, --monthly-budget-usd, --max-agents, --auto-close-after-days, --feature."
8175
8250
  );
@@ -8177,7 +8252,7 @@ async function runTenantSettingsSet(tenantArg, opts) {
8177
8252
  }
8178
8253
  const data = await gqlMutate(ctx.client, UpdateTenantSettingsDoc, {
8179
8254
  tenantId: ctx.tenantId,
8180
- input: input19
8255
+ input: input20
8181
8256
  });
8182
8257
  if (isJsonMode()) {
8183
8258
  printJson(data.updateTenantSettings);
@@ -8422,14 +8497,14 @@ async function runMemberInvite(email, opts) {
8422
8497
  }
8423
8498
  async function runMemberUpdate(memberId, opts) {
8424
8499
  const ctx = await resolveMemberContext(opts);
8425
- const input19 = {};
8426
- if (opts.role !== void 0) input19.role = opts.role;
8427
- if (opts.status !== void 0) input19.status = opts.status;
8428
- if (Object.keys(input19).length === 0) {
8500
+ const input20 = {};
8501
+ if (opts.role !== void 0) input20.role = opts.role;
8502
+ if (opts.status !== void 0) input20.status = opts.status;
8503
+ if (Object.keys(input20).length === 0) {
8429
8504
  printError("Nothing to update. Pass at least one of --role, --status.");
8430
8505
  process.exit(1);
8431
8506
  }
8432
- const data = await gqlMutate(ctx.client, UpdateTenantMemberDoc, { id: memberId, input: input19 });
8507
+ const data = await gqlMutate(ctx.client, UpdateTenantMemberDoc, { id: memberId, input: input20 });
8433
8508
  const updated = data.updateTenantMember;
8434
8509
  if (isJsonMode()) {
8435
8510
  printJson(updated);
@@ -8713,18 +8788,18 @@ async function runTeamCreate(name, opts) {
8713
8788
  }
8714
8789
  async function runTeamUpdate(id, opts) {
8715
8790
  const ctx = await resolveTeamContext(opts);
8716
- const input19 = {};
8717
- if (opts.name !== void 0) input19.name = opts.name;
8718
- if (opts.description !== void 0) input19.description = opts.description;
8719
- if (opts.status !== void 0) input19.status = opts.status;
8791
+ const input20 = {};
8792
+ if (opts.name !== void 0) input20.name = opts.name;
8793
+ if (opts.description !== void 0) input20.description = opts.description;
8794
+ if (opts.status !== void 0) input20.status = opts.status;
8720
8795
  if (opts.budgetUsd !== void 0) {
8721
- input19.budgetMonthlyCents = Math.round(Number.parseFloat(opts.budgetUsd) * 100);
8796
+ input20.budgetMonthlyCents = Math.round(Number.parseFloat(opts.budgetUsd) * 100);
8722
8797
  }
8723
- if (Object.keys(input19).length === 0) {
8798
+ if (Object.keys(input20).length === 0) {
8724
8799
  printError("Nothing to update. Pass at least one of --name, --description, --status, --budget-usd.");
8725
8800
  process.exit(1);
8726
8801
  }
8727
- const data = await gqlMutate(ctx.client, UpdateTeamDoc, { id, input: input19 });
8802
+ const data = await gqlMutate(ctx.client, UpdateTeamDoc, { id, input: input20 });
8728
8803
  if (isJsonMode()) {
8729
8804
  printJson(data.updateTeam);
8730
8805
  return;
@@ -9048,14 +9123,14 @@ async function runKbCreate(name, opts) {
9048
9123
  }
9049
9124
  async function runKbUpdate(id, opts) {
9050
9125
  const ctx = await resolveKbContext(opts);
9051
- const input19 = {};
9052
- if (opts.name !== void 0) input19.name = opts.name;
9053
- if (opts.description !== void 0) input19.description = opts.description;
9054
- if (Object.keys(input19).length === 0) {
9126
+ const input20 = {};
9127
+ if (opts.name !== void 0) input20.name = opts.name;
9128
+ if (opts.description !== void 0) input20.description = opts.description;
9129
+ if (Object.keys(input20).length === 0) {
9055
9130
  printError("Nothing to update. Pass at least one of --name, --description.");
9056
9131
  process.exit(1);
9057
9132
  }
9058
- const data = await gqlMutate(ctx.client, UpdateKBDoc, { id, input: input19 });
9133
+ const data = await gqlMutate(ctx.client, UpdateKBDoc, { id, input: input20 });
9059
9134
  if (isJsonMode()) {
9060
9135
  printJson(data.updateKnowledgeBase);
9061
9136
  return;
@@ -9504,12 +9579,12 @@ async function runRoutineCreate(name, opts) {
9504
9579
  }
9505
9580
  async function runRoutineUpdate(id, opts) {
9506
9581
  const ctx = await resolveRoutineContext(opts);
9507
- const input19 = {};
9508
- if (opts.name !== void 0) input19.name = opts.name;
9509
- if (opts.status !== void 0) input19.status = opts.status;
9510
- if (opts.agent !== void 0) input19.agentId = opts.agent;
9511
- if (opts.team !== void 0) input19.teamId = opts.team;
9512
- if (Object.keys(input19).length === 0) {
9582
+ const input20 = {};
9583
+ if (opts.name !== void 0) input20.name = opts.name;
9584
+ if (opts.status !== void 0) input20.status = opts.status;
9585
+ if (opts.agent !== void 0) input20.agentId = opts.agent;
9586
+ if (opts.team !== void 0) input20.teamId = opts.team;
9587
+ if (Object.keys(input20).length === 0) {
9513
9588
  printError("Nothing to update.");
9514
9589
  process.exit(1);
9515
9590
  }
@@ -9519,7 +9594,7 @@ async function runRoutineUpdate(id, opts) {
9519
9594
  );
9520
9595
  process.exit(1);
9521
9596
  }
9522
- const data = await gqlMutate(ctx.client, UpdateRoutineDoc, { id, input: input19 });
9597
+ const data = await gqlMutate(ctx.client, UpdateRoutineDoc, { id, input: input20 });
9523
9598
  if (isJsonMode()) {
9524
9599
  printJson(data.updateRoutine);
9525
9600
  return;
@@ -10567,25 +10642,25 @@ async function runWebhookCreate(name, opts) {
10567
10642
  }
10568
10643
  async function runWebhookUpdate(id, opts) {
10569
10644
  const ctx = await resolveWebhookContext(opts);
10570
- const input19 = {};
10571
- if (opts.targetType !== void 0) input19.targetType = opts.targetType.toUpperCase();
10645
+ const input20 = {};
10646
+ if (opts.targetType !== void 0) input20.targetType = opts.targetType.toUpperCase();
10572
10647
  if (opts.targetId !== void 0) {
10573
10648
  const tt = (opts.targetType ?? "").toUpperCase();
10574
- if (tt === "AGENT") input19.agentId = opts.targetId;
10575
- else if (tt === "ROUTINE") input19.routineId = opts.targetId;
10649
+ if (tt === "AGENT") input20.agentId = opts.targetId;
10650
+ else if (tt === "ROUTINE") input20.routineId = opts.targetId;
10576
10651
  else {
10577
10652
  printError("--target-id requires --target-type <AGENT|ROUTINE> on the same call.");
10578
10653
  process.exit(1);
10579
10654
  }
10580
10655
  }
10581
- if (opts.rateLimit !== void 0) input19.rateLimit = Number.parseInt(opts.rateLimit, 10);
10582
- if (opts.enable) input19.enabled = true;
10583
- if (opts.disable) input19.enabled = false;
10584
- if (Object.keys(input19).length === 0) {
10656
+ if (opts.rateLimit !== void 0) input20.rateLimit = Number.parseInt(opts.rateLimit, 10);
10657
+ if (opts.enable) input20.enabled = true;
10658
+ if (opts.disable) input20.enabled = false;
10659
+ if (Object.keys(input20).length === 0) {
10585
10660
  printError("Nothing to update.");
10586
10661
  process.exit(1);
10587
10662
  }
10588
- const data = await gqlMutate(ctx.client, UpdateWebhookDoc, { id, input: input19 });
10663
+ const data = await gqlMutate(ctx.client, UpdateWebhookDoc, { id, input: input20 });
10589
10664
  if (isJsonMode()) {
10590
10665
  printJson(data.updateWebhook);
10591
10666
  return;
@@ -10815,12 +10890,12 @@ function hasParentSegment(relPath) {
10815
10890
  }
10816
10891
 
10817
10892
  // src/lib/plugin-push.ts
10818
- async function pushPluginZip(input19) {
10819
- const base = input19.apiUrl.replace(/\/+$/, "");
10893
+ async function pushPluginZip(input20) {
10894
+ const base = input20.apiUrl.replace(/\/+$/, "");
10820
10895
  const presignRes = await fetch(`${base}/api/plugins/presign`, {
10821
10896
  method: "POST",
10822
- headers: withJson(input19.headers),
10823
- body: JSON.stringify({ fileName: input19.fileName })
10897
+ headers: withJson(input20.headers),
10898
+ body: JSON.stringify({ fileName: input20.fileName })
10824
10899
  });
10825
10900
  if (!presignRes.ok) {
10826
10901
  throw new Error(`presign failed: ${await describeHttpError(presignRes)}`);
@@ -10834,14 +10909,14 @@ async function pushPluginZip(input19) {
10834
10909
  const putRes = await fetch(presign.uploadUrl, {
10835
10910
  method: "PUT",
10836
10911
  headers: { "Content-Type": "application/zip" },
10837
- body: new Uint8Array(input19.zipBuffer)
10912
+ body: new Uint8Array(input20.zipBuffer)
10838
10913
  });
10839
10914
  if (!putRes.ok) {
10840
10915
  throw new Error(`S3 PUT failed: HTTP ${putRes.status}`);
10841
10916
  }
10842
10917
  const installRes = await fetch(`${base}/api/plugins/upload`, {
10843
10918
  method: "POST",
10844
- headers: withJson(input19.headers),
10919
+ headers: withJson(input20.headers),
10845
10920
  body: JSON.stringify({ s3Key: presign.s3Key })
10846
10921
  });
10847
10922
  const installBody = await installRes.json().catch(() => ({}));
@@ -11093,154 +11168,1339 @@ function formatBytes(bytes) {
11093
11168
  return `${(kb / 1024).toFixed(2)} MB`;
11094
11169
  }
11095
11170
 
11096
- // src/lib/stub.ts
11097
- import chalk14 from "chalk";
11098
- var ROADMAP_URL = "https://github.com/thinkwork-ai/thinkwork/blob/main/apps/cli/README.md#roadmap";
11099
- function notYetImplemented(commandPath, phase) {
11100
- const label = chalk14.yellow(`\u29D7 not yet implemented`);
11101
- const line = chalk14.bold(`thinkwork ${commandPath}`);
11102
- process.stderr.write(
11103
- `
11104
- ${label}: ${line} ships in Phase ${phase}.
11105
- ${chalk14.dim(`See the roadmap: ${ROADMAP_URL}`)}
11106
-
11107
- `
11171
+ // src/commands/memory.ts
11172
+ import { confirm as confirm14 } from "@inquirer/prompts";
11173
+ var MemoryRecordsDoc = graphql(`
11174
+ query CliMemoryRecords($tenantId: ID, $assistantId: ID, $namespace: String!) {
11175
+ memoryRecords(tenantId: $tenantId, assistantId: $assistantId, namespace: $namespace) {
11176
+ memoryRecordId
11177
+ namespace
11178
+ content {
11179
+ text
11180
+ }
11181
+ strategy
11182
+ createdAt
11183
+ updatedAt
11184
+ }
11185
+ }
11186
+ `);
11187
+ var MemorySearchDoc = graphql(`
11188
+ query CliMemorySearch($tenantId: ID, $assistantId: ID, $query: String!, $strategy: MemoryStrategy, $limit: Int) {
11189
+ memorySearch(tenantId: $tenantId, assistantId: $assistantId, query: $query, strategy: $strategy, limit: $limit) {
11190
+ records {
11191
+ memoryRecordId
11192
+ namespace
11193
+ content {
11194
+ text
11195
+ }
11196
+ score
11197
+ }
11198
+ }
11199
+ }
11200
+ `);
11201
+ var MemoryGraphDoc = graphql(`
11202
+ query CliMemoryGraph($tenantId: ID, $assistantId: ID) {
11203
+ memoryGraph(tenantId: $tenantId, assistantId: $assistantId) {
11204
+ nodes { id label type }
11205
+ edges { source target type }
11206
+ }
11207
+ }
11208
+ `);
11209
+ var UpdateMemoryRecordDoc = graphql(`
11210
+ mutation CliUpdateMemoryRecord($tenantId: ID, $assistantId: ID, $memoryRecordId: ID!, $content: String!) {
11211
+ updateMemoryRecord(tenantId: $tenantId, assistantId: $assistantId, memoryRecordId: $memoryRecordId, content: $content)
11212
+ }
11213
+ `);
11214
+ var DeleteMemoryRecordDoc = graphql(`
11215
+ mutation CliDeleteMemoryRecord($tenantId: ID, $assistantId: ID, $memoryRecordId: ID!) {
11216
+ deleteMemoryRecord(tenantId: $tenantId, assistantId: $assistantId, memoryRecordId: $memoryRecordId)
11217
+ }
11218
+ `);
11219
+ var MemoryTenantBySlugDoc = graphql(`
11220
+ query CliMemoryTenantBySlug($slug: String!) {
11221
+ tenantBySlug(slug: $slug) {
11222
+ id
11223
+ }
11224
+ }
11225
+ `);
11226
+ async function resolveMemoryContext(opts) {
11227
+ const region = opts.region ?? "us-east-1";
11228
+ const stage = await resolveStage({ flag: opts.stage, region });
11229
+ const session = loadStageSession(stage);
11230
+ const { client, tenantSlug: ctxSlug } = await getGqlClient({ stage, region });
11231
+ const flagOrEnv = opts.tenant ?? process.env.THINKWORK_TENANT;
11232
+ if (flagOrEnv) {
11233
+ if (session?.tenantSlug === flagOrEnv && session.tenantId) {
11234
+ return { stage, region, client, tenantId: session.tenantId };
11235
+ }
11236
+ const data = await gqlQuery(client, MemoryTenantBySlugDoc, { slug: flagOrEnv });
11237
+ if (!data.tenantBySlug) {
11238
+ printError(`Tenant "${flagOrEnv}" not found.`);
11239
+ process.exit(1);
11240
+ }
11241
+ return { stage, region, client, tenantId: data.tenantBySlug.id };
11242
+ }
11243
+ if (session?.tenantId) return { stage, region, client, tenantId: session.tenantId };
11244
+ if (ctxSlug) {
11245
+ const data = await gqlQuery(client, MemoryTenantBySlugDoc, { slug: ctxSlug });
11246
+ if (data.tenantBySlug) return { stage, region, client, tenantId: data.tenantBySlug.id };
11247
+ }
11248
+ printMissingApiSessionError(stage, session !== null);
11249
+ process.exit(1);
11250
+ }
11251
+ var STRATEGY_BY_NAME = {
11252
+ SEMANTIC: "SEMANTIC" /* Semantic */,
11253
+ PREFERENCES: "PREFERENCES" /* Preferences */,
11254
+ SUMMARIES: "SUMMARIES" /* Summaries */,
11255
+ EPISODES: "EPISODES" /* Episodes */,
11256
+ REFLECTIONS: "REFLECTIONS" /* Reflections */
11257
+ };
11258
+ async function runMemoryList(opts) {
11259
+ const ctx = await resolveMemoryContext(opts);
11260
+ const data = await gqlQuery(ctx.client, MemoryRecordsDoc, {
11261
+ tenantId: ctx.tenantId,
11262
+ assistantId: opts.agent ?? null,
11263
+ namespace: opts.namespace ?? "semantic"
11264
+ });
11265
+ const items = data.memoryRecords ?? [];
11266
+ if (isJsonMode()) {
11267
+ printJson({ items });
11268
+ return;
11269
+ }
11270
+ printTable(
11271
+ items.map((r) => ({
11272
+ id: r.memoryRecordId,
11273
+ ns: r.namespace ?? "\u2014",
11274
+ preview: (r.content?.text ?? "").slice(0, 80)
11275
+ })),
11276
+ [
11277
+ { key: "id", header: "RECORD ID" },
11278
+ { key: "ns", header: "NAMESPACE" },
11279
+ { key: "preview", header: "PREVIEW" }
11280
+ ]
11108
11281
  );
11109
- process.exit(2);
11110
11282
  }
11111
-
11112
- // src/commands/memory.ts
11283
+ async function runMemorySearch(opts) {
11284
+ const ctx = await resolveMemoryContext(opts);
11285
+ if (!opts.query) {
11286
+ printError("--query <q> is required.");
11287
+ process.exit(1);
11288
+ }
11289
+ const strategy = opts.strategy ? STRATEGY_BY_NAME[opts.strategy.toUpperCase()] ?? null : null;
11290
+ const data = await gqlQuery(ctx.client, MemorySearchDoc, {
11291
+ tenantId: ctx.tenantId,
11292
+ assistantId: opts.agent ?? null,
11293
+ query: opts.query,
11294
+ strategy,
11295
+ limit: opts.limit ? Number.parseInt(opts.limit, 10) : 10
11296
+ });
11297
+ const records = data.memorySearch.records ?? [];
11298
+ if (isJsonMode()) {
11299
+ printJson({ records });
11300
+ return;
11301
+ }
11302
+ printTable(
11303
+ records.map((r) => ({
11304
+ id: r.memoryRecordId,
11305
+ ns: r.namespace ?? "\u2014",
11306
+ score: r.score != null ? r.score.toFixed(3) : "\u2014",
11307
+ preview: (r.content?.text ?? "").slice(0, 80)
11308
+ })),
11309
+ [
11310
+ { key: "id", header: "RECORD ID" },
11311
+ { key: "ns", header: "NAMESPACE" },
11312
+ { key: "score", header: "SCORE" },
11313
+ { key: "preview", header: "PREVIEW" }
11314
+ ]
11315
+ );
11316
+ }
11317
+ async function runMemoryGet(recordId, opts) {
11318
+ const ctx = await resolveMemoryContext(opts);
11319
+ const data = await gqlQuery(ctx.client, MemoryRecordsDoc, {
11320
+ tenantId: ctx.tenantId,
11321
+ assistantId: opts.agent ?? null,
11322
+ namespace: opts.namespace ?? "semantic"
11323
+ });
11324
+ const rec = (data.memoryRecords ?? []).find((r) => r.memoryRecordId === recordId);
11325
+ if (!rec) {
11326
+ printError(
11327
+ `Memory record ${recordId} not found in namespace "${opts.namespace ?? "semantic"}". Try --namespace <ns> with a different value (semantic | preferences | episodes | reflections).`
11328
+ );
11329
+ process.exit(1);
11330
+ }
11331
+ if (isJsonMode()) {
11332
+ printJson(rec);
11333
+ return;
11334
+ }
11335
+ printKeyValue([
11336
+ ["ID", rec.memoryRecordId],
11337
+ ["Namespace", rec.namespace ?? void 0],
11338
+ ["Strategy", rec.strategy ?? void 0],
11339
+ ["Created", rec.createdAt ?? void 0],
11340
+ ["Updated", rec.updatedAt ?? void 0]
11341
+ ]);
11342
+ console.log("\n Content:");
11343
+ console.log(` ${rec.content?.text ?? "(empty)"}`);
11344
+ }
11345
+ async function runMemoryUpdate(recordId, opts) {
11346
+ const ctx = await resolveMemoryContext(opts);
11347
+ if (!opts.content) {
11348
+ printError("--content <text> is required.");
11349
+ process.exit(1);
11350
+ }
11351
+ const data = await gqlMutate(ctx.client, UpdateMemoryRecordDoc, {
11352
+ tenantId: ctx.tenantId,
11353
+ assistantId: opts.agent ?? null,
11354
+ memoryRecordId: recordId,
11355
+ content: opts.content
11356
+ });
11357
+ if (isJsonMode()) {
11358
+ printJson({ updated: data.updateMemoryRecord });
11359
+ return;
11360
+ }
11361
+ if (data.updateMemoryRecord) printSuccess(`Updated memory record ${recordId}.`);
11362
+ else printError(`Server reported not-updated for ${recordId}.`);
11363
+ }
11364
+ async function runMemoryDelete(recordId, opts) {
11365
+ const ctx = await resolveMemoryContext(opts);
11366
+ if (!opts.yes) {
11367
+ if (!isInteractive()) {
11368
+ printError("Refusing to delete without --yes in a non-interactive session.");
11369
+ process.exit(1);
11370
+ }
11371
+ requireTty("Confirmation");
11372
+ const go = await promptOrExit(
11373
+ () => confirm14({ message: `Delete memory record ${recordId}?`, default: false })
11374
+ );
11375
+ if (!go) {
11376
+ logStderr("Cancelled.");
11377
+ process.exit(0);
11378
+ }
11379
+ }
11380
+ const data = await gqlMutate(ctx.client, DeleteMemoryRecordDoc, {
11381
+ tenantId: ctx.tenantId,
11382
+ assistantId: opts.agent ?? null,
11383
+ memoryRecordId: recordId
11384
+ });
11385
+ if (isJsonMode()) {
11386
+ printJson({ deleted: data.deleteMemoryRecord });
11387
+ return;
11388
+ }
11389
+ if (data.deleteMemoryRecord) printSuccess(`Deleted memory record ${recordId}.`);
11390
+ else printError(`Server reported not-deleted for ${recordId}.`);
11391
+ }
11392
+ async function runMemoryGraph(opts) {
11393
+ const ctx = await resolveMemoryContext(opts);
11394
+ const data = await gqlQuery(ctx.client, MemoryGraphDoc, {
11395
+ tenantId: ctx.tenantId,
11396
+ assistantId: opts.agent ?? null
11397
+ });
11398
+ const g = data.memoryGraph;
11399
+ if (isJsonMode()) {
11400
+ printJson(g);
11401
+ return;
11402
+ }
11403
+ printKeyValue([
11404
+ ["Nodes", String(g.nodes.length)],
11405
+ ["Edges", String(g.edges.length)]
11406
+ ]);
11407
+ if (g.nodes.length > 0) {
11408
+ console.log("\n Top nodes:");
11409
+ printTable(
11410
+ g.nodes.slice(0, 15).map((n) => ({
11411
+ id: n.id.slice(0, 16),
11412
+ type: n.type,
11413
+ label: n.label.slice(0, 60)
11414
+ })),
11415
+ [
11416
+ { key: "id", header: "NODE ID" },
11417
+ { key: "type", header: "TYPE" },
11418
+ { key: "label", header: "LABEL" }
11419
+ ]
11420
+ );
11421
+ }
11422
+ }
11113
11423
  function registerMemoryCommand(program2) {
11114
11424
  const memory = program2.command("memory").description("Inspect, search, and edit an agent's memory records and graph.");
11115
11425
  memory.command("list").alias("ls").description("List memory records for an agent in a namespace.").option("--agent <id>", "Agent (assistant) ID").option(
11116
11426
  "--namespace <ns>",
11117
11427
  "Memory namespace (semantic | preferences | episodes | reflections)",
11118
11428
  "semantic"
11119
- ).option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(() => notYetImplemented("memory list", 4));
11120
- memory.command("search").description("Search an agent's memory by query string.").option("--agent <id>", "Agent (assistant) ID").option("--query <q>", "Search query").option("--strategy <s>", "Retrieval strategy (semantic | keyword | hybrid)", "semantic").option("--limit <n>", "Max results", "10").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").addHelpText(
11121
- "after",
11122
- `
11123
- Examples:
11124
- $ thinkwork memory search --agent agt-ops --query "escalation procedure"
11125
- $ thinkwork memory search --agent agt-ops --query "p0 runbook" --strategy hybrid --json
11126
- `
11127
- ).action(() => notYetImplemented("memory search", 4));
11128
- memory.command("get <recordId>").description("Fetch one memory record in full.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(() => notYetImplemented("memory get", 4));
11129
- memory.command("update <recordId>").description("Replace a memory record's content.").option("--content <text>", "New content").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(() => notYetImplemented("memory update", 4));
11130
- memory.command("delete <recordId>").description("Remove a memory record.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(() => notYetImplemented("memory delete", 4));
11131
- memory.command("graph").description("Print the agent's memory graph (summary in human mode; full JSON with --json).").option("--agent <id>", "Agent (assistant) ID").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(() => notYetImplemented("memory graph", 4));
11429
+ ).option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runMemoryList);
11430
+ memory.command("search").description("Search an agent's memory by query string.").option("--agent <id>", "Agent (assistant) ID").option("--query <q>", "Search query").option("--strategy <s>", "SEMANTIC | KEYWORD | HYBRID", "SEMANTIC").option("--limit <n>", "Max results", "10").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runMemorySearch);
11431
+ memory.command("get <recordId>").description("Fetch one memory record (filters from namespace list).").option("--agent <id>", "Agent (assistant) ID").option("--namespace <ns>", "Namespace to scan", "semantic").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runMemoryGet);
11432
+ memory.command("update <recordId>").description("Replace a memory record's content.").option("--agent <id>", "Agent (assistant) ID").option("--content <text>", "New content").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runMemoryUpdate);
11433
+ memory.command("delete <recordId>").description("Remove a memory record.").option("--agent <id>", "Agent (assistant) ID").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(runMemoryDelete);
11434
+ memory.command("graph").description("Print the agent's memory graph (summary in human mode; full JSON with --json).").option("--agent <id>", "Agent (assistant) ID").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runMemoryGraph);
11435
+ }
11436
+
11437
+ // src/commands/recipe.ts
11438
+ import { confirm as confirm15, input as input18 } from "@inquirer/prompts";
11439
+ var RecipesDoc = graphql(`
11440
+ query CliRecipes($tenantId: ID!, $threadId: ID, $agentId: ID, $limit: Int, $cursor: String) {
11441
+ recipes(tenantId: $tenantId, threadId: $threadId, agentId: $agentId, limit: $limit, cursor: $cursor) {
11442
+ id
11443
+ title
11444
+ server
11445
+ tool
11446
+ genuiType
11447
+ agentId
11448
+ threadId
11449
+ lastRefreshed
11450
+ createdAt
11451
+ }
11452
+ }
11453
+ `);
11454
+ var RecipeDoc = graphql(`
11455
+ query CliRecipe($id: ID!) {
11456
+ recipe(id: $id) {
11457
+ id
11458
+ title
11459
+ summary
11460
+ server
11461
+ tool
11462
+ params
11463
+ genuiType
11464
+ templates
11465
+ cachedResult
11466
+ lastRefreshed
11467
+ lastError
11468
+ agentId
11469
+ threadId
11470
+ sourceMessageId
11471
+ createdAt
11472
+ updatedAt
11473
+ }
11474
+ }
11475
+ `);
11476
+ var CreateRecipeDoc = graphql(`
11477
+ mutation CliCreateRecipe($input: CreateRecipeInput!) {
11478
+ createRecipe(input: $input) {
11479
+ id
11480
+ title
11481
+ server
11482
+ tool
11483
+ }
11484
+ }
11485
+ `);
11486
+ var UpdateRecipeDoc = graphql(`
11487
+ mutation CliUpdateRecipe($id: ID!, $input: UpdateRecipeInput!) {
11488
+ updateRecipe(id: $id, input: $input) {
11489
+ id
11490
+ title
11491
+ }
11492
+ }
11493
+ `);
11494
+ var DeleteRecipeDoc = graphql(`
11495
+ mutation CliDeleteRecipe($id: ID!) {
11496
+ deleteRecipe(id: $id)
11497
+ }
11498
+ `);
11499
+ var RecipeTenantBySlugDoc = graphql(`
11500
+ query CliRecipeTenantBySlug($slug: String!) {
11501
+ tenantBySlug(slug: $slug) {
11502
+ id
11503
+ }
11504
+ }
11505
+ `);
11506
+ async function resolveRecipeContext(opts) {
11507
+ const region = opts.region ?? "us-east-1";
11508
+ const stage = await resolveStage({ flag: opts.stage, region });
11509
+ const session = loadStageSession(stage);
11510
+ const { client, tenantSlug: ctxSlug } = await getGqlClient({ stage, region });
11511
+ const flagOrEnv = opts.tenant ?? process.env.THINKWORK_TENANT;
11512
+ if (flagOrEnv) {
11513
+ if (session?.tenantSlug === flagOrEnv && session.tenantId) {
11514
+ return { stage, region, client, tenantId: session.tenantId };
11515
+ }
11516
+ const data = await gqlQuery(client, RecipeTenantBySlugDoc, { slug: flagOrEnv });
11517
+ if (!data.tenantBySlug) {
11518
+ printError(`Tenant "${flagOrEnv}" not found.`);
11519
+ process.exit(1);
11520
+ }
11521
+ return { stage, region, client, tenantId: data.tenantBySlug.id };
11522
+ }
11523
+ if (session?.tenantId) return { stage, region, client, tenantId: session.tenantId };
11524
+ if (ctxSlug) {
11525
+ const data = await gqlQuery(client, RecipeTenantBySlugDoc, { slug: ctxSlug });
11526
+ if (data.tenantBySlug) return { stage, region, client, tenantId: data.tenantBySlug.id };
11527
+ }
11528
+ printMissingApiSessionError(stage, session !== null);
11529
+ process.exit(1);
11530
+ }
11531
+ async function runRecipeList(opts) {
11532
+ const ctx = await resolveRecipeContext(opts);
11533
+ const data = await gqlQuery(ctx.client, RecipesDoc, {
11534
+ tenantId: ctx.tenantId,
11535
+ threadId: opts.thread ?? null,
11536
+ agentId: opts.agent ?? null,
11537
+ limit: opts.limit ? Number.parseInt(opts.limit, 10) : 25,
11538
+ cursor: null
11539
+ });
11540
+ const items = data.recipes ?? [];
11541
+ if (isJsonMode()) {
11542
+ printJson({ items });
11543
+ return;
11544
+ }
11545
+ printTable(
11546
+ items.map((r) => ({
11547
+ id: r.id,
11548
+ title: r.title,
11549
+ tool: `${r.server}/${r.tool}`,
11550
+ kind: r.genuiType
11551
+ })),
11552
+ [
11553
+ { key: "id", header: "RECIPE ID" },
11554
+ { key: "title", header: "TITLE" },
11555
+ { key: "tool", header: "TOOL" },
11556
+ { key: "kind", header: "KIND" }
11557
+ ]
11558
+ );
11559
+ }
11560
+ async function runRecipeGet(id, opts) {
11561
+ const ctx = await resolveRecipeContext(opts);
11562
+ const data = await gqlQuery(ctx.client, RecipeDoc, { id });
11563
+ const r = data.recipe;
11564
+ if (!r) {
11565
+ printError(`Recipe ${id} not found.`);
11566
+ process.exit(1);
11567
+ }
11568
+ if (isJsonMode()) {
11569
+ printJson(r);
11570
+ return;
11571
+ }
11572
+ printKeyValue([
11573
+ ["ID", r.id],
11574
+ ["Title", r.title],
11575
+ ["Summary", r.summary ?? void 0],
11576
+ ["Server", r.server],
11577
+ ["Tool", r.tool],
11578
+ ["GenUI type", r.genuiType],
11579
+ ["Agent", r.agentId ?? void 0],
11580
+ ["Thread", r.threadId ?? void 0],
11581
+ ["Last refreshed", r.lastRefreshed ?? void 0],
11582
+ ["Last error", r.lastError ?? void 0]
11583
+ ]);
11584
+ }
11585
+ async function runRecipeCreate(name, opts) {
11586
+ const ctx = await resolveRecipeContext(opts);
11587
+ let title = name;
11588
+ if (!title) {
11589
+ if (!isInteractive()) {
11590
+ printError("Recipe name required in non-interactive mode.");
11591
+ process.exit(1);
11592
+ }
11593
+ requireTty("Recipe name");
11594
+ title = await promptOrExit(() => input18({ message: "Recipe title:" }));
11595
+ }
11596
+ if (!opts.tool) {
11597
+ printError("--tool <server/tool> is required.");
11598
+ process.exit(1);
11599
+ }
11600
+ const parts = opts.tool.split("/");
11601
+ if (parts.length !== 2) {
11602
+ printError('--tool must be "server/tool" (e.g. github/list_pulls).');
11603
+ process.exit(1);
11604
+ }
11605
+ const [server, tool] = parts;
11606
+ let params = {};
11607
+ if (opts.params) {
11608
+ try {
11609
+ params = JSON.parse(opts.params);
11610
+ } catch (err) {
11611
+ printError(`--params is not valid JSON: ${err.message}`);
11612
+ process.exit(1);
11613
+ }
11614
+ }
11615
+ const data = await gqlMutate(ctx.client, CreateRecipeDoc, {
11616
+ input: {
11617
+ tenantId: ctx.tenantId,
11618
+ title,
11619
+ server,
11620
+ tool,
11621
+ params,
11622
+ genuiType: "default",
11623
+ agentId: opts.agent ?? null,
11624
+ threadId: opts.thread ?? null
11625
+ }
11626
+ });
11627
+ if (isJsonMode()) {
11628
+ printJson(data.createRecipe);
11629
+ return;
11630
+ }
11631
+ printSuccess(`Created recipe ${data.createRecipe.id} \u2014 ${data.createRecipe.title}.`);
11632
+ }
11633
+ async function runRecipeUpdate(id, opts) {
11634
+ const ctx = await resolveRecipeContext(opts);
11635
+ const input20 = {};
11636
+ if (opts.title !== void 0) input20.title = opts.title;
11637
+ if (opts.summary !== void 0) input20.summary = opts.summary;
11638
+ if (opts.params !== void 0) {
11639
+ try {
11640
+ input20.params = JSON.parse(opts.params);
11641
+ } catch (err) {
11642
+ printError(`--params is not valid JSON: ${err.message}`);
11643
+ process.exit(1);
11644
+ }
11645
+ }
11646
+ if (Object.keys(input20).length === 0) {
11647
+ printError("Nothing to update.");
11648
+ process.exit(1);
11649
+ }
11650
+ const data = await gqlMutate(ctx.client, UpdateRecipeDoc, { id, input: input20 });
11651
+ if (isJsonMode()) {
11652
+ printJson(data.updateRecipe);
11653
+ return;
11654
+ }
11655
+ printSuccess(`Updated recipe ${data.updateRecipe.id}.`);
11656
+ }
11657
+ async function runRecipeDelete(id, opts) {
11658
+ const ctx = await resolveRecipeContext(opts);
11659
+ if (!opts.yes) {
11660
+ if (!isInteractive()) {
11661
+ printError("Refusing to delete without --yes.");
11662
+ process.exit(1);
11663
+ }
11664
+ requireTty("Confirmation");
11665
+ const go = await promptOrExit(() => confirm15({ message: `Delete recipe ${id}?`, default: false }));
11666
+ if (!go) {
11667
+ logStderr("Cancelled.");
11668
+ process.exit(0);
11669
+ }
11670
+ }
11671
+ const data = await gqlMutate(ctx.client, DeleteRecipeDoc, { id });
11672
+ if (isJsonMode()) {
11673
+ printJson({ id, deleted: data.deleteRecipe });
11674
+ return;
11675
+ }
11676
+ if (data.deleteRecipe) printSuccess(`Deleted recipe ${id}.`);
11677
+ else printError(`Server reported not-deleted for ${id}.`);
11678
+ }
11679
+ function registerRecipeCommand(program2) {
11680
+ const recipe = program2.command("recipe").alias("recipes").description("Manage saved MCP tool invocations (parameterized one-click actions).");
11681
+ recipe.command("list").alias("ls").description("List recipes in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--thread <id>", "Filter by thread scope").option("--agent <id>", "Filter by agent scope").option("--limit <n>", "Max rows", "25").action(runRecipeList);
11682
+ recipe.command("get <id>").description("Fetch one recipe.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runRecipeGet);
11683
+ recipe.command("create [name]").description("Create a new recipe.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--tool <server/tool>", "MCP server + tool (e.g. github/list_pulls)").option("--params <json>", "Recipe params as JSON").option("--scope <s>", "tenant | agent | thread (informational)").option("--thread <id>", "Scope to a thread").option("--agent <id>", "Scope to an agent").action(runRecipeCreate);
11684
+ recipe.command("update <id>").description("Update a recipe's title, summary, or params.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--title <t>").option("--summary <s>").option("--params <json>").action(runRecipeUpdate);
11685
+ recipe.command("delete <id>").description("Delete a recipe.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(runRecipeDelete);
11686
+ }
11687
+
11688
+ // src/commands/artifact.ts
11689
+ var ArtifactsDoc = graphql(`
11690
+ query CliArtifacts(
11691
+ $tenantId: ID!
11692
+ $threadId: ID
11693
+ $agentId: ID
11694
+ $type: ArtifactType
11695
+ $status: ArtifactStatus
11696
+ $limit: Int
11697
+ $cursor: String
11698
+ ) {
11699
+ artifacts(
11700
+ tenantId: $tenantId
11701
+ threadId: $threadId
11702
+ agentId: $agentId
11703
+ type: $type
11704
+ status: $status
11705
+ limit: $limit
11706
+ cursor: $cursor
11707
+ ) {
11708
+ id
11709
+ title
11710
+ type
11711
+ status
11712
+ agentId
11713
+ threadId
11714
+ createdAt
11715
+ updatedAt
11716
+ }
11717
+ }
11718
+ `);
11719
+ var ArtifactDoc = graphql(`
11720
+ query CliArtifact($id: ID!) {
11721
+ artifact(id: $id) {
11722
+ id
11723
+ tenantId
11724
+ agentId
11725
+ threadId
11726
+ title
11727
+ type
11728
+ status
11729
+ summary
11730
+ content
11731
+ s3Key
11732
+ sourceMessageId
11733
+ favoritedAt
11734
+ createdAt
11735
+ updatedAt
11736
+ }
11737
+ }
11738
+ `);
11739
+ var ArtifactTenantBySlugDoc = graphql(`
11740
+ query CliArtifactTenantBySlug($slug: String!) {
11741
+ tenantBySlug(slug: $slug) {
11742
+ id
11743
+ }
11744
+ }
11745
+ `);
11746
+ async function resolveArtContext(opts) {
11747
+ const region = opts.region ?? "us-east-1";
11748
+ const stage = await resolveStage({ flag: opts.stage, region });
11749
+ const session = loadStageSession(stage);
11750
+ const { client, tenantSlug: ctxSlug } = await getGqlClient({ stage, region });
11751
+ const flagOrEnv = opts.tenant ?? process.env.THINKWORK_TENANT;
11752
+ if (flagOrEnv) {
11753
+ if (session?.tenantSlug === flagOrEnv && session.tenantId) {
11754
+ return { stage, region, client, tenantId: session.tenantId };
11755
+ }
11756
+ const data = await gqlQuery(client, ArtifactTenantBySlugDoc, { slug: flagOrEnv });
11757
+ if (!data.tenantBySlug) {
11758
+ printError(`Tenant "${flagOrEnv}" not found.`);
11759
+ process.exit(1);
11760
+ }
11761
+ return { stage, region, client, tenantId: data.tenantBySlug.id };
11762
+ }
11763
+ if (session?.tenantId) return { stage, region, client, tenantId: session.tenantId };
11764
+ if (ctxSlug) {
11765
+ const data = await gqlQuery(client, ArtifactTenantBySlugDoc, { slug: ctxSlug });
11766
+ if (data.tenantBySlug) return { stage, region, client, tenantId: data.tenantBySlug.id };
11767
+ }
11768
+ printMissingApiSessionError(stage, session !== null);
11769
+ process.exit(1);
11770
+ }
11771
+ var TYPE_BY_NAME2 = Object.fromEntries(
11772
+ Object.values(ArtifactType).map((v) => [v, v])
11773
+ );
11774
+ var STATUS_BY_NAME3 = Object.fromEntries(
11775
+ Object.values(ArtifactStatus).map((v) => [v, v])
11776
+ );
11777
+ async function runArtList(opts) {
11778
+ const ctx = await resolveArtContext(opts);
11779
+ const type = opts.type ? TYPE_BY_NAME2[opts.type.toUpperCase()] ?? null : null;
11780
+ const status = opts.status ? STATUS_BY_NAME3[opts.status.toUpperCase()] ?? null : null;
11781
+ const data = await gqlQuery(ctx.client, ArtifactsDoc, {
11782
+ tenantId: ctx.tenantId,
11783
+ threadId: opts.thread ?? null,
11784
+ agentId: opts.agent ?? null,
11785
+ type,
11786
+ status,
11787
+ limit: opts.limit ? Number.parseInt(opts.limit, 10) : 25,
11788
+ cursor: opts.cursor ?? null
11789
+ });
11790
+ const items = data.artifacts ?? [];
11791
+ if (isJsonMode()) {
11792
+ printJson({ items });
11793
+ return;
11794
+ }
11795
+ printTable(
11796
+ items.map((a) => ({
11797
+ id: a.id,
11798
+ title: a.title.length > 50 ? `${a.title.slice(0, 47)}\u2026` : a.title,
11799
+ type: a.type,
11800
+ status: a.status,
11801
+ created: a.createdAt
11802
+ })),
11803
+ [
11804
+ { key: "id", header: "ID" },
11805
+ { key: "title", header: "TITLE" },
11806
+ { key: "type", header: "TYPE" },
11807
+ { key: "status", header: "STATUS" },
11808
+ { key: "created", header: "CREATED" }
11809
+ ]
11810
+ );
11811
+ }
11812
+ async function runArtGet(id, opts) {
11813
+ const ctx = await resolveArtContext(opts);
11814
+ const data = await gqlQuery(ctx.client, ArtifactDoc, { id });
11815
+ const a = data.artifact;
11816
+ if (!a) {
11817
+ printError(`Artifact ${id} not found.`);
11818
+ process.exit(1);
11819
+ }
11820
+ if (opts.raw) {
11821
+ process.stdout.write(a.content ?? "");
11822
+ return;
11823
+ }
11824
+ if (isJsonMode()) {
11825
+ printJson(a);
11826
+ return;
11827
+ }
11828
+ printKeyValue([
11829
+ ["ID", a.id],
11830
+ ["Title", a.title],
11831
+ ["Type", a.type],
11832
+ ["Status", a.status],
11833
+ ["Agent", a.agentId ?? void 0],
11834
+ ["Thread", a.threadId ?? void 0],
11835
+ ["Source message", a.sourceMessageId ?? void 0],
11836
+ ["Favorited", a.favoritedAt ?? void 0],
11837
+ ["Created", a.createdAt],
11838
+ ["Updated", a.updatedAt]
11839
+ ]);
11840
+ if (a.summary) {
11841
+ console.log("\n Summary:");
11842
+ console.log(` ${a.summary}`);
11843
+ }
11844
+ if (a.content) {
11845
+ const preview = a.content.slice(0, 500);
11846
+ console.log("\n Content preview:");
11847
+ console.log(` ${preview}${a.content.length > 500 ? "\n \u2026" : ""}`);
11848
+ if (a.content.length > 500) {
11849
+ console.log(`
11850
+ (pass --raw to pipe the full content to stdout)`);
11851
+ }
11852
+ }
11853
+ }
11854
+ function registerArtifactCommand(program2) {
11855
+ const art = program2.command("artifact").alias("artifacts").description("List and fetch agent-produced artifacts.");
11856
+ art.command("list").alias("ls").description("List artifacts in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--thread <id>", "Filter by thread").option("--agent <id>", "Filter by producing agent").option(
11857
+ "--type <t>",
11858
+ "DATA_VIEW | NOTE | REPORT | PLAN | DRAFT | DIGEST"
11859
+ ).option("--status <s>", "DRAFT | FINAL | SUPERSEDED").option("--limit <n>", "Max rows", "25").option("--cursor <c>", "Pagination cursor").action(runArtList);
11860
+ art.command("get <id>").description("Fetch one artifact. Human mode prints a preview; --json full; --raw pipes content.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--raw", "Print only the markdown body to stdout (for piping to pandoc / bat / less)").action(runArtGet);
11861
+ }
11862
+
11863
+ // src/lib/resolve-tenant-id.ts
11864
+ var TenantBySlugForCmdDoc2 = graphql(`
11865
+ query CliCmdTenantBySlug($slug: String!) {
11866
+ tenantBySlug(slug: $slug) {
11867
+ id
11868
+ }
11869
+ }
11870
+ `);
11871
+ async function resolveTenantContext(opts) {
11872
+ const region = opts.region ?? "us-east-1";
11873
+ const stage = await resolveStage({ flag: opts.stage, region });
11874
+ const session = loadStageSession(stage);
11875
+ const { client, tenantSlug: ctxSlug } = await getGqlClient({ stage, region });
11876
+ const flagOrEnv = opts.tenant ?? process.env.THINKWORK_TENANT;
11877
+ if (flagOrEnv) {
11878
+ if (session?.tenantSlug === flagOrEnv && session.tenantId) {
11879
+ return { stage, region, client, tenantId: session.tenantId };
11880
+ }
11881
+ const data = await gqlQuery(client, TenantBySlugForCmdDoc2, { slug: flagOrEnv });
11882
+ if (!data.tenantBySlug) {
11883
+ printError(`Tenant "${flagOrEnv}" not found.`);
11884
+ process.exit(1);
11885
+ }
11886
+ return { stage, region, client, tenantId: data.tenantBySlug.id };
11887
+ }
11888
+ if (session?.tenantId) {
11889
+ return { stage, region, client, tenantId: session.tenantId };
11890
+ }
11891
+ if (ctxSlug) {
11892
+ const data = await gqlQuery(client, TenantBySlugForCmdDoc2, { slug: ctxSlug });
11893
+ if (data.tenantBySlug) {
11894
+ return { stage, region, client, tenantId: data.tenantBySlug.id };
11895
+ }
11896
+ }
11897
+ printMissingApiSessionError(stage, session !== null);
11898
+ process.exit(1);
11899
+ }
11900
+
11901
+ // src/commands/cost.ts
11902
+ var CostSummaryDoc = graphql(`
11903
+ query CliCostSummary($tenantId: ID!, $from: AWSDateTime, $to: AWSDateTime) {
11904
+ costSummary(tenantId: $tenantId, from: $from, to: $to) {
11905
+ totalUsd
11906
+ llmUsd
11907
+ computeUsd
11908
+ toolsUsd
11909
+ evalUsd
11910
+ totalInputTokens
11911
+ totalOutputTokens
11912
+ eventCount
11913
+ }
11914
+ }
11915
+ `);
11916
+ var CostByAgentDoc = graphql(`
11917
+ query CliCostByAgent($tenantId: ID!, $from: AWSDateTime, $to: AWSDateTime) {
11918
+ costByAgent(tenantId: $tenantId, from: $from, to: $to) {
11919
+ agentId
11920
+ agentName
11921
+ totalUsd
11922
+ eventCount
11923
+ }
11924
+ }
11925
+ `);
11926
+ var CostByModelDoc = graphql(`
11927
+ query CliCostByModel($tenantId: ID!, $from: AWSDateTime, $to: AWSDateTime) {
11928
+ costByModel(tenantId: $tenantId, from: $from, to: $to) {
11929
+ model
11930
+ totalUsd
11931
+ inputTokens
11932
+ outputTokens
11933
+ }
11934
+ }
11935
+ `);
11936
+ var CostSeriesDoc = graphql(`
11937
+ query CliCostSeries($tenantId: ID!, $days: Int) {
11938
+ costTimeSeries(tenantId: $tenantId, days: $days) {
11939
+ day
11940
+ totalUsd
11941
+ llmUsd
11942
+ computeUsd
11943
+ toolsUsd
11944
+ eventCount
11945
+ }
11946
+ }
11947
+ `);
11948
+ async function runCostSummary(opts) {
11949
+ const ctx = await resolveTenantContext(opts);
11950
+ const data = await gqlQuery(ctx.client, CostSummaryDoc, {
11951
+ tenantId: ctx.tenantId,
11952
+ from: opts.from ?? null,
11953
+ to: opts.to ?? null
11954
+ });
11955
+ const s = data.costSummary;
11956
+ if (isJsonMode()) {
11957
+ printJson(s);
11958
+ return;
11959
+ }
11960
+ printKeyValue([
11961
+ ["Total", `$${s.totalUsd.toFixed(2)}`],
11962
+ ["LLM", `$${s.llmUsd.toFixed(2)}`],
11963
+ ["Compute", `$${s.computeUsd.toFixed(2)}`],
11964
+ ["Tools", `$${s.toolsUsd.toFixed(2)}`],
11965
+ ["Eval", s.evalUsd != null ? `$${s.evalUsd.toFixed(2)}` : void 0],
11966
+ ["Input tokens", s.totalInputTokens.toLocaleString()],
11967
+ ["Output tokens", s.totalOutputTokens.toLocaleString()],
11968
+ ["Events", s.eventCount.toLocaleString()]
11969
+ ]);
11970
+ }
11971
+ async function runCostByAgent(opts) {
11972
+ const ctx = await resolveTenantContext(opts);
11973
+ const data = await gqlQuery(ctx.client, CostByAgentDoc, {
11974
+ tenantId: ctx.tenantId,
11975
+ from: opts.from ?? null,
11976
+ to: opts.to ?? null
11977
+ });
11978
+ const items = data.costByAgent ?? [];
11979
+ if (isJsonMode()) {
11980
+ printJson({ items });
11981
+ return;
11982
+ }
11983
+ printTable(
11984
+ items.map((r) => ({
11985
+ agent: r.agentName,
11986
+ id: r.agentId ?? "\u2014",
11987
+ total: `$${r.totalUsd.toFixed(2)}`,
11988
+ events: r.eventCount.toLocaleString()
11989
+ })),
11990
+ [
11991
+ { key: "agent", header: "AGENT" },
11992
+ { key: "id", header: "ID" },
11993
+ { key: "total", header: "TOTAL" },
11994
+ { key: "events", header: "EVENTS" }
11995
+ ]
11996
+ );
11132
11997
  }
11133
-
11134
- // src/commands/recipe.ts
11135
- function registerRecipeCommand(program2) {
11136
- const recipe = program2.command("recipe").alias("recipes").description("Manage saved MCP tool invocations (parameterized one-click actions).");
11137
- recipe.command("list").alias("ls").description("List recipes in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--thread <id>", "Filter by thread scope").option("--agent <id>", "Filter by agent scope").option("--limit <n>", "Max rows", "25").action(() => notYetImplemented("recipe list", 4));
11138
- recipe.command("get <id>").description("Fetch one recipe.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(() => notYetImplemented("recipe get", 4));
11139
- recipe.command("create [name]").description("Save a new recipe. Walkthrough for missing fields in TTY.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--tool <slug>", "MCP tool slug").option("--params <json>", "Default parameters").option("--scope <s>", "tenant | agent | thread", "tenant").option("--agent <id>", "Required if --scope=agent").option("--thread <id>", "Required if --scope=thread").addHelpText(
11140
- "after",
11141
- `
11142
- Examples:
11143
- $ thinkwork recipe create "Create PagerDuty incident" \\
11144
- --tool pagerduty.create_incident --params '{"urgency":"high"}'
11145
- `
11146
- ).action(() => notYetImplemented("recipe create", 4));
11147
- recipe.command("update <id>").description("Update a recipe's name, tool, or default params.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--name <n>").option("--tool <slug>").option("--params <json>").action(() => notYetImplemented("recipe update", 4));
11148
- recipe.command("delete <id>").description("Delete a recipe.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(() => notYetImplemented("recipe delete", 4));
11998
+ async function runCostByModel(opts) {
11999
+ const ctx = await resolveTenantContext(opts);
12000
+ const data = await gqlQuery(ctx.client, CostByModelDoc, {
12001
+ tenantId: ctx.tenantId,
12002
+ from: opts.from ?? null,
12003
+ to: opts.to ?? null
12004
+ });
12005
+ const items = data.costByModel ?? [];
12006
+ if (isJsonMode()) {
12007
+ printJson({ items });
12008
+ return;
12009
+ }
12010
+ printTable(
12011
+ items.map((r) => ({
12012
+ model: r.model,
12013
+ total: `$${r.totalUsd.toFixed(2)}`,
12014
+ input: r.inputTokens.toLocaleString(),
12015
+ output: r.outputTokens.toLocaleString()
12016
+ })),
12017
+ [
12018
+ { key: "model", header: "MODEL" },
12019
+ { key: "total", header: "TOTAL" },
12020
+ { key: "input", header: "INPUT TOKENS" },
12021
+ { key: "output", header: "OUTPUT TOKENS" }
12022
+ ]
12023
+ );
11149
12024
  }
11150
-
11151
- // src/commands/artifact.ts
11152
- function registerArtifactCommand(program2) {
11153
- const art = program2.command("artifact").alias("artifacts").description("List and fetch agent-produced artifacts (notes, reports, data-views, plans, drafts).");
11154
- art.command("list").alias("ls").description("List artifacts in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--thread <id>", "Filter by thread").option("--agent <id>", "Filter by producing agent").option(
11155
- "--type <t>",
11156
- "DATA_VIEW | NOTE | REPORT | PLAN | DRAFT | DIGEST"
11157
- ).option("--status <s>", "DRAFT | FINAL | SUPERSEDED").option("--limit <n>", "Max rows", "25").option("--cursor <c>", "Pagination cursor").addHelpText(
11158
- "after",
11159
- `
11160
- Examples:
11161
- $ thinkwork artifact list --agent agt-editor --type REPORT
11162
- $ thinkwork artifact list --thread thr-abc --json
11163
- `
11164
- ).action(() => notYetImplemented("artifact list", 4));
11165
- art.command("get <id>").description("Fetch one artifact. Human mode prints a preview; --json returns the full content.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--raw", "Print only the markdown body to stdout (for piping to pandoc / bat / less)").action(() => notYetImplemented("artifact get", 4));
12025
+ async function runCostSeries(opts) {
12026
+ const ctx = await resolveTenantContext(opts);
12027
+ const data = await gqlQuery(ctx.client, CostSeriesDoc, {
12028
+ tenantId: ctx.tenantId,
12029
+ days: opts.days ? Number.parseInt(opts.days, 10) : 30
12030
+ });
12031
+ const items = data.costTimeSeries ?? [];
12032
+ if (isJsonMode()) {
12033
+ printJson({ items });
12034
+ return;
12035
+ }
12036
+ printTable(
12037
+ items.map((p) => ({
12038
+ day: p.day,
12039
+ total: `$${p.totalUsd.toFixed(2)}`,
12040
+ llm: `$${p.llmUsd.toFixed(2)}`,
12041
+ compute: `$${p.computeUsd.toFixed(2)}`,
12042
+ tools: `$${p.toolsUsd.toFixed(2)}`,
12043
+ events: p.eventCount.toLocaleString()
12044
+ })),
12045
+ [
12046
+ { key: "day", header: "DAY" },
12047
+ { key: "total", header: "TOTAL" },
12048
+ { key: "llm", header: "LLM" },
12049
+ { key: "compute", header: "COMPUTE" },
12050
+ { key: "tools", header: "TOOLS" },
12051
+ { key: "events", header: "EVENTS" }
12052
+ ]
12053
+ );
11166
12054
  }
11167
-
11168
- // src/commands/cost.ts
11169
12055
  function registerCostCommand(program2) {
11170
- const cost = program2.command("cost").description("Spend reports \u2014 totals, per-agent, per-model, and daily series.");
11171
- cost.command("summary").description("Total spend for the tenant over an optional date range.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--from <iso>", "Start date (ISO-8601)").option("--to <iso>", "End date (ISO-8601)").addHelpText(
11172
- "after",
11173
- `
11174
- Examples:
11175
- # MTD spend
11176
- $ thinkwork cost summary
11177
-
11178
- # Specific window
11179
- $ thinkwork cost summary --from 2026-04-01 --to 2026-04-30 --json
11180
- `
11181
- ).action(() => notYetImplemented("cost summary", 5));
11182
- cost.command("by-agent").description("Spend broken down by agent.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--from <iso>").option("--to <iso>").option("--sort <field>", "cost | requests (default cost)", "cost").action(() => notYetImplemented("cost by-agent", 5));
11183
- cost.command("by-model").description("Spend broken down by model ID (tokens + cost).").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--from <iso>").option("--to <iso>").action(() => notYetImplemented("cost by-model", 5));
11184
- cost.command("series").description("Daily cost series.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--days <n>", "Days of history", "30").action(() => notYetImplemented("cost series", 5));
12056
+ const cost = program2.command("cost").description("Tenant spend summaries \u2014 total, per-agent, per-model, and daily series.");
12057
+ cost.command("summary").description("Print a tenant-wide spend summary.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--from <iso>", "Range start (ISO-8601)").option("--to <iso>", "Range end (ISO-8601)").action(runCostSummary);
12058
+ cost.command("by-agent").description("Spend broken down by agent.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--from <iso>").option("--to <iso>").action(runCostByAgent);
12059
+ cost.command("by-model").description("Spend broken down by model.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--from <iso>").option("--to <iso>").action(runCostByModel);
12060
+ cost.command("series").description("Daily cost series (default last 30 days).").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--days <n>", "Number of days back", "30").action(runCostSeries);
11185
12061
  }
11186
12062
 
11187
12063
  // src/commands/budget.ts
12064
+ import { confirm as confirm16 } from "@inquirer/prompts";
12065
+ var BudgetPoliciesDoc = graphql(`
12066
+ query CliBudgetPolicies($tenantId: ID!) {
12067
+ budgetPolicies(tenantId: $tenantId) {
12068
+ id
12069
+ scope
12070
+ agentId
12071
+ period
12072
+ limitUsd
12073
+ actionOnExceed
12074
+ enabled
12075
+ }
12076
+ }
12077
+ `);
12078
+ var BudgetStatusDoc = graphql(`
12079
+ query CliBudgetStatus($tenantId: ID!) {
12080
+ budgetStatus(tenantId: $tenantId) {
12081
+ policy {
12082
+ id
12083
+ scope
12084
+ agentId
12085
+ period
12086
+ limitUsd
12087
+ }
12088
+ spentUsd
12089
+ remainingUsd
12090
+ percentUsed
12091
+ status
12092
+ }
12093
+ }
12094
+ `);
12095
+ var UpsertBudgetPolicyDoc = graphql(`
12096
+ mutation CliUpsertBudgetPolicy($tenantId: ID!, $input: UpsertBudgetPolicyInput!) {
12097
+ upsertBudgetPolicy(tenantId: $tenantId, input: $input) {
12098
+ id
12099
+ scope
12100
+ agentId
12101
+ limitUsd
12102
+ period
12103
+ actionOnExceed
12104
+ }
12105
+ }
12106
+ `);
12107
+ var DeleteBudgetPolicyDoc = graphql(`
12108
+ mutation CliDeleteBudgetPolicy($id: ID!) {
12109
+ deleteBudgetPolicy(id: $id)
12110
+ }
12111
+ `);
12112
+ async function runBudgetList(opts) {
12113
+ const ctx = await resolveTenantContext(opts);
12114
+ const data = await gqlQuery(ctx.client, BudgetPoliciesDoc, { tenantId: ctx.tenantId });
12115
+ const items = data.budgetPolicies ?? [];
12116
+ if (isJsonMode()) {
12117
+ printJson({ items });
12118
+ return;
12119
+ }
12120
+ printTable(
12121
+ items.map((p) => ({
12122
+ id: p.id,
12123
+ scope: p.scope,
12124
+ agent: p.agentId ?? "\u2014",
12125
+ period: p.period,
12126
+ limit: `$${p.limitUsd.toFixed(2)}`,
12127
+ action: p.actionOnExceed,
12128
+ enabled: p.enabled ? "yes" : "no"
12129
+ })),
12130
+ [
12131
+ { key: "id", header: "POLICY ID" },
12132
+ { key: "scope", header: "SCOPE" },
12133
+ { key: "agent", header: "AGENT" },
12134
+ { key: "period", header: "PERIOD" },
12135
+ { key: "limit", header: "LIMIT" },
12136
+ { key: "action", header: "ON EXCEED" },
12137
+ { key: "enabled", header: "ON" }
12138
+ ]
12139
+ );
12140
+ }
12141
+ async function runBudgetStatus(opts) {
12142
+ const ctx = await resolveTenantContext(opts);
12143
+ const data = await gqlQuery(ctx.client, BudgetStatusDoc, { tenantId: ctx.tenantId });
12144
+ const items = data.budgetStatus ?? [];
12145
+ if (isJsonMode()) {
12146
+ printJson({ items });
12147
+ return;
12148
+ }
12149
+ printTable(
12150
+ items.map((s) => ({
12151
+ id: s.policy.id,
12152
+ scope: s.policy.scope,
12153
+ agent: s.policy.agentId ?? "\u2014",
12154
+ period: s.policy.period,
12155
+ limit: `$${s.policy.limitUsd.toFixed(2)}`,
12156
+ spent: `$${s.spentUsd.toFixed(2)}`,
12157
+ pct: `${s.percentUsed.toFixed(1)}%`,
12158
+ status: s.status
12159
+ })),
12160
+ [
12161
+ { key: "id", header: "POLICY ID" },
12162
+ { key: "scope", header: "SCOPE" },
12163
+ { key: "agent", header: "AGENT" },
12164
+ { key: "period", header: "PERIOD" },
12165
+ { key: "limit", header: "LIMIT" },
12166
+ { key: "spent", header: "SPENT" },
12167
+ { key: "pct", header: "USED" },
12168
+ { key: "status", header: "STATUS" }
12169
+ ]
12170
+ );
12171
+ }
12172
+ async function runBudgetUpsert(opts) {
12173
+ const ctx = await resolveTenantContext(opts);
12174
+ if (!opts.scope) {
12175
+ printError("--scope <tenant|agent> is required.");
12176
+ process.exit(1);
12177
+ }
12178
+ if (!opts.limitUsd) {
12179
+ printError("--limit-usd <amount> is required.");
12180
+ process.exit(1);
12181
+ }
12182
+ const limit = Number.parseFloat(opts.limitUsd);
12183
+ if (!Number.isFinite(limit) || limit <= 0) {
12184
+ printError(`--limit-usd "${opts.limitUsd}" must be a positive number.`);
12185
+ process.exit(1);
12186
+ }
12187
+ const data = await gqlMutate(ctx.client, UpsertBudgetPolicyDoc, {
12188
+ tenantId: ctx.tenantId,
12189
+ input: {
12190
+ scope: opts.scope,
12191
+ agentId: opts.agent ?? null,
12192
+ limitUsd: limit,
12193
+ period: opts.period ?? "monthly",
12194
+ actionOnExceed: opts.action ?? "PAUSE"
12195
+ }
12196
+ });
12197
+ if (isJsonMode()) {
12198
+ printJson(data.upsertBudgetPolicy);
12199
+ return;
12200
+ }
12201
+ printSuccess(
12202
+ `Upserted ${data.upsertBudgetPolicy.scope} budget \u2014 $${data.upsertBudgetPolicy.limitUsd.toFixed(2)}/${data.upsertBudgetPolicy.period} (id: ${data.upsertBudgetPolicy.id}).`
12203
+ );
12204
+ }
12205
+ async function runBudgetDelete(id, opts) {
12206
+ const ctx = await resolveTenantContext(opts);
12207
+ if (!opts.yes) {
12208
+ if (!isInteractive()) {
12209
+ printError("Refusing to delete without --yes.");
12210
+ process.exit(1);
12211
+ }
12212
+ requireTty("Confirmation");
12213
+ const go = await promptOrExit(() => confirm16({ message: `Delete budget policy ${id}?`, default: false }));
12214
+ if (!go) {
12215
+ logStderr("Cancelled.");
12216
+ process.exit(0);
12217
+ }
12218
+ }
12219
+ const data = await gqlMutate(ctx.client, DeleteBudgetPolicyDoc, { id });
12220
+ if (isJsonMode()) {
12221
+ printJson({ id, deleted: data.deleteBudgetPolicy });
12222
+ return;
12223
+ }
12224
+ if (data.deleteBudgetPolicy) printSuccess(`Deleted budget policy ${id}.`);
12225
+ else printError(`Server reported not-deleted for ${id}.`);
12226
+ }
11188
12227
  function registerBudgetCommand(program2) {
11189
- const budget = program2.command("budget").alias("budgets").description("Manage budget policies (tenant-wide or per-agent) and inspect current status.");
11190
- budget.command("list").alias("ls").description("List budget policies in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(() => notYetImplemented("budget list", 5));
11191
- budget.command("status").description("Show each budget's current spend vs. limit.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(() => notYetImplemented("budget status", 5));
11192
- budget.command("upsert").description("Create or update a budget policy.").option("--limit-usd <amount>", "USD ceiling for the window").option("--scope <s>", "tenant | agent", "tenant").option("--agent <id>", "Required if --scope=agent").option("--window <w>", "daily | weekly | monthly", "monthly").option("--action <a>", "PAUSE | ALERT", "PAUSE").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").addHelpText(
11193
- "after",
11194
- `
11195
- Examples:
11196
- # Tenant-wide $5k/month pause
11197
- $ thinkwork budget upsert --limit-usd 5000 --window monthly --action PAUSE
11198
-
11199
- # Per-agent alert-only
11200
- $ thinkwork budget upsert --scope agent --agent agt-ops --limit-usd 500 --action ALERT
11201
- `
11202
- ).action(() => notYetImplemented("budget upsert", 5));
11203
- budget.command("delete <id>").description("Remove a budget policy.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(() => notYetImplemented("budget delete", 5));
12228
+ const budget = program2.command("budget").description("Tenant or per-agent spend policies + status.");
12229
+ budget.command("list").alias("ls").description("List budget policies in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runBudgetList);
12230
+ budget.command("status").description("Show spend vs limit for each policy.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runBudgetStatus);
12231
+ budget.command("upsert").description("Create or replace a budget policy.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--scope <s>", "tenant | agent").option("--agent <id>", "Required when --scope agent").option("--limit-usd <n>", "USD ceiling").option("--period <p>", "daily | weekly | monthly", "monthly").option("--action <a>", "PAUSE | ALERT", "PAUSE").action(runBudgetUpsert);
12232
+ budget.command("delete <id>").description("Delete a budget policy.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(runBudgetDelete);
11204
12233
  }
11205
12234
 
11206
12235
  // src/commands/performance.ts
12236
+ var AgentPerformanceDoc = graphql(`
12237
+ query CliAgentPerformance($tenantId: ID!, $from: AWSDateTime, $to: AWSDateTime) {
12238
+ agentPerformance(tenantId: $tenantId, from: $from, to: $to) {
12239
+ agentId
12240
+ agentName
12241
+ invocationCount
12242
+ errorCount
12243
+ avgDurationMs
12244
+ p95DurationMs
12245
+ totalInputTokens
12246
+ totalOutputTokens
12247
+ totalCostUsd
12248
+ }
12249
+ }
12250
+ `);
12251
+ var SingleAgentPerformanceDoc = graphql(`
12252
+ query CliSingleAgentPerformance($agentId: ID!, $tenantId: ID!) {
12253
+ singleAgentPerformance(agentId: $agentId, tenantId: $tenantId) {
12254
+ agentId
12255
+ agentName
12256
+ invocationCount
12257
+ errorCount
12258
+ avgDurationMs
12259
+ p95DurationMs
12260
+ totalInputTokens
12261
+ totalOutputTokens
12262
+ totalCostUsd
12263
+ }
12264
+ }
12265
+ `);
12266
+ async function runPerfAgents(opts) {
12267
+ const ctx = await resolveTenantContext(opts);
12268
+ const data = await gqlQuery(ctx.client, AgentPerformanceDoc, {
12269
+ tenantId: ctx.tenantId,
12270
+ from: opts.from ?? null,
12271
+ to: opts.to ?? null
12272
+ });
12273
+ const items = data.agentPerformance ?? [];
12274
+ if (isJsonMode()) {
12275
+ printJson({ items });
12276
+ return;
12277
+ }
12278
+ printTable(
12279
+ items.map((p) => ({
12280
+ agent: p.agentName,
12281
+ invocations: p.invocationCount.toLocaleString(),
12282
+ errors: p.errorCount.toLocaleString(),
12283
+ avgMs: p.avgDurationMs.toFixed(0),
12284
+ p95Ms: p.p95DurationMs.toFixed(0),
12285
+ cost: `$${p.totalCostUsd.toFixed(2)}`
12286
+ })),
12287
+ [
12288
+ { key: "agent", header: "AGENT" },
12289
+ { key: "invocations", header: "INVOCATIONS" },
12290
+ { key: "errors", header: "ERRORS" },
12291
+ { key: "avgMs", header: "AVG (ms)" },
12292
+ { key: "p95Ms", header: "P95 (ms)" },
12293
+ { key: "cost", header: "COST" }
12294
+ ]
12295
+ );
12296
+ }
12297
+ async function runPerfAgent(agentId, opts) {
12298
+ const ctx = await resolveTenantContext(opts);
12299
+ const data = await gqlQuery(ctx.client, SingleAgentPerformanceDoc, {
12300
+ agentId,
12301
+ tenantId: ctx.tenantId
12302
+ });
12303
+ const p = data.singleAgentPerformance;
12304
+ if (!p) {
12305
+ printError(`No performance data for agent ${agentId}.`);
12306
+ process.exit(1);
12307
+ }
12308
+ if (isJsonMode()) {
12309
+ printJson(p);
12310
+ return;
12311
+ }
12312
+ printKeyValue([
12313
+ ["Agent", p.agentName],
12314
+ ["Invocations", p.invocationCount.toLocaleString()],
12315
+ ["Errors", p.errorCount.toLocaleString()],
12316
+ ["Avg duration (ms)", p.avgDurationMs.toFixed(0)],
12317
+ ["P95 duration (ms)", p.p95DurationMs.toFixed(0)],
12318
+ ["Input tokens", p.totalInputTokens.toLocaleString()],
12319
+ ["Output tokens", p.totalOutputTokens.toLocaleString()],
12320
+ ["Total cost", `$${p.totalCostUsd.toFixed(2)}`]
12321
+ ]);
12322
+ }
11207
12323
  function registerPerformanceCommand(program2) {
11208
- const perf = program2.command("performance").alias("perf").description("Observability: per-agent invocations, errors, p95 latency, and cost.");
11209
- perf.command("agents").description("Performance summary for every agent in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--from <iso>").option("--to <iso>").option("--sort <f>", "cost | errors | latency | requests", "errors").action(() => notYetImplemented("performance agents", 5));
11210
- perf.command("agent <id>").description("Performance detail for one agent (including daily time-series).").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--days <n>", "Time-series history", "14").action(() => notYetImplemented("performance agent", 5));
12324
+ const perf = program2.command("performance").alias("perf").description("Agent invocation counts, error rates, and latency p95.");
12325
+ perf.command("agents").description("Performance metrics for every agent in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--from <iso>", "Range start (ISO-8601)").option("--to <iso>", "Range end (ISO-8601)").action(runPerfAgents);
12326
+ perf.command("agent <id>").description("Performance metrics for one agent.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runPerfAgent);
11211
12327
  }
11212
12328
 
11213
12329
  // src/commands/trace.ts
12330
+ var ThreadTracesDoc = graphql(`
12331
+ query CliThreadTraces($threadId: ID!, $tenantId: ID!) {
12332
+ threadTraces(threadId: $threadId, tenantId: $tenantId) {
12333
+ traceId
12334
+ threadId
12335
+ agentId
12336
+ agentName
12337
+ model
12338
+ inputTokens
12339
+ outputTokens
12340
+ durationMs
12341
+ costUsd
12342
+ estimated
12343
+ }
12344
+ }
12345
+ `);
12346
+ var TurnInvocationLogsDoc = graphql(`
12347
+ query CliTurnInvocationLogs($tenantId: ID!, $turnId: ID!) {
12348
+ turnInvocationLogs(tenantId: $tenantId, turnId: $turnId) {
12349
+ requestId
12350
+ modelId
12351
+ timestamp
12352
+ inputTokenCount
12353
+ outputTokenCount
12354
+ cacheReadTokenCount
12355
+ toolCount
12356
+ costUsd
12357
+ }
12358
+ }
12359
+ `);
12360
+ async function runTraceThread(threadId, opts) {
12361
+ const ctx = await resolveTenantContext(opts);
12362
+ const data = await gqlQuery(ctx.client, ThreadTracesDoc, {
12363
+ threadId,
12364
+ tenantId: ctx.tenantId
12365
+ });
12366
+ const items = data.threadTraces ?? [];
12367
+ if (isJsonMode()) {
12368
+ printJson({ items });
12369
+ return;
12370
+ }
12371
+ printTable(
12372
+ items.map((t) => ({
12373
+ traceId: t.traceId.slice(0, 16),
12374
+ agent: t.agentName ?? "\u2014",
12375
+ model: t.model ?? "\u2014",
12376
+ input: t.inputTokens != null ? t.inputTokens.toLocaleString() : "\u2014",
12377
+ output: t.outputTokens != null ? t.outputTokens.toLocaleString() : "\u2014",
12378
+ durMs: t.durationMs != null ? String(t.durationMs) : "\u2014",
12379
+ cost: t.costUsd != null ? `$${t.costUsd.toFixed(4)}` : "\u2014"
12380
+ })),
12381
+ [
12382
+ { key: "traceId", header: "TRACE ID" },
12383
+ { key: "agent", header: "AGENT" },
12384
+ { key: "model", header: "MODEL" },
12385
+ { key: "input", header: "INPUT TOKENS" },
12386
+ { key: "output", header: "OUTPUT TOKENS" },
12387
+ { key: "durMs", header: "DUR (ms)" },
12388
+ { key: "cost", header: "COST" }
12389
+ ]
12390
+ );
12391
+ }
12392
+ async function runTraceTurn(turnId, opts) {
12393
+ const ctx = await resolveTenantContext(opts);
12394
+ const data = await gqlQuery(ctx.client, TurnInvocationLogsDoc, {
12395
+ tenantId: ctx.tenantId,
12396
+ turnId
12397
+ });
12398
+ const items = data.turnInvocationLogs ?? [];
12399
+ if (isJsonMode()) {
12400
+ printJson({ items });
12401
+ return;
12402
+ }
12403
+ printTable(
12404
+ items.map((m) => ({
12405
+ requestId: m.requestId.slice(0, 16),
12406
+ model: m.modelId,
12407
+ when: m.timestamp,
12408
+ input: m.inputTokenCount.toLocaleString(),
12409
+ output: m.outputTokenCount.toLocaleString(),
12410
+ cache: m.cacheReadTokenCount.toLocaleString(),
12411
+ tools: m.toolCount != null ? String(m.toolCount) : "\u2014",
12412
+ cost: m.costUsd != null ? `$${m.costUsd.toFixed(4)}` : "\u2014"
12413
+ })),
12414
+ [
12415
+ { key: "requestId", header: "REQUEST" },
12416
+ { key: "model", header: "MODEL" },
12417
+ { key: "when", header: "WHEN" },
12418
+ { key: "input", header: "INPUT" },
12419
+ { key: "output", header: "OUTPUT" },
12420
+ { key: "cache", header: "CACHE READ" },
12421
+ { key: "tools", header: "TOOLS" },
12422
+ { key: "cost", header: "COST" }
12423
+ ]
12424
+ );
12425
+ }
11214
12426
  function registerTraceCommand(program2) {
11215
- const trace = program2.command("trace").description("Inspect LLM invocations (traces) for a thread or turn.");
11216
- trace.command("thread <threadId>").description("All LLM invocations across every turn of one thread.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--since <iso>").action(() => notYetImplemented("trace thread", 5));
11217
- trace.command("turn <turnId>").description("LLM invocations for a single thread-turn (verbose \u2014 prompt + response + metadata).").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--raw", "Print raw prompts + responses as a JSON array (useful for piping)").addHelpText(
11218
- "after",
11219
- `
11220
- Examples:
11221
- $ thinkwork trace turn ttn-abc --json | jq '.[].model'
11222
- $ thinkwork trace turn ttn-abc --raw | jq '.[].response'
11223
- `
11224
- ).action(() => notYetImplemented("trace turn", 5));
12427
+ const trace = program2.command("trace").description("LLM invocation traces for a thread or a single turn.");
12428
+ trace.command("thread <threadId>").description("Trace events for a thread (every LLM call across every turn).").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runTraceThread);
12429
+ trace.command("turn <turnId>").description("Per-invocation logs for a single thread turn.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runTraceTurn);
11225
12430
  }
11226
12431
 
11227
12432
  // src/commands/dashboard.ts
12433
+ var DashboardDoc = graphql(`
12434
+ query CliDashboard($tenantId: ID!) {
12435
+ agents(tenantId: $tenantId) {
12436
+ id
12437
+ status
12438
+ }
12439
+ threads(tenantId: $tenantId, limit: 200) {
12440
+ id
12441
+ status
12442
+ archivedAt
12443
+ }
12444
+ inboxItems(tenantId: $tenantId, status: PENDING) {
12445
+ id
12446
+ }
12447
+ costSummary(tenantId: $tenantId) {
12448
+ totalUsd
12449
+ llmUsd
12450
+ computeUsd
12451
+ eventCount
12452
+ }
12453
+ }
12454
+ `);
12455
+ async function runDashboard(opts) {
12456
+ const ctx = await resolveTenantContext(opts);
12457
+ const data = await gqlQuery(ctx.client, DashboardDoc, { tenantId: ctx.tenantId });
12458
+ const agents = data.agents ?? [];
12459
+ const threads = (data.threads ?? []).filter((t) => t.archivedAt == null);
12460
+ const openThreads = threads.filter(
12461
+ (t) => t.status !== "DONE" && t.status !== "CANCELLED"
12462
+ );
12463
+ const inbox = data.inboxItems ?? [];
12464
+ const cost = data.costSummary;
12465
+ if (isJsonMode()) {
12466
+ printJson({
12467
+ agents: {
12468
+ total: agents.length,
12469
+ idle: agents.filter((a) => a.status === "IDLE").length,
12470
+ busy: agents.filter((a) => a.status === "BUSY").length,
12471
+ offline: agents.filter((a) => a.status === "OFFLINE").length
12472
+ },
12473
+ threads: { total: threads.length, open: openThreads.length },
12474
+ inbox: { pending: inbox.length },
12475
+ cost
12476
+ });
12477
+ return;
12478
+ }
12479
+ printKeyValue([
12480
+ ["Agents", `${agents.length} total`],
12481
+ [
12482
+ " Status",
12483
+ `IDLE: ${agents.filter((a) => a.status === "IDLE").length}, BUSY: ${agents.filter((a) => a.status === "BUSY").length}, OFFLINE: ${agents.filter((a) => a.status === "OFFLINE").length}`
12484
+ ],
12485
+ ["Threads", `${threads.length} total, ${openThreads.length} open`],
12486
+ ["Pending approvals", String(inbox.length)],
12487
+ ["Spend (to date)", `$${cost.totalUsd.toFixed(2)} (LLM: $${cost.llmUsd.toFixed(2)}, compute: $${cost.computeUsd.toFixed(2)})`],
12488
+ ["LLM events", cost.eventCount.toLocaleString()]
12489
+ ]);
12490
+ }
11228
12491
  function registerDashboardCommand(program2) {
11229
12492
  program2.command("dashboard").alias("overview").description("One-screen snapshot of the tenant \u2014 agents, open threads, approvals, spend.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").addHelpText(
11230
12493
  "after",
11231
12494
  `
11232
12495
  Examples:
11233
- # Print the dashboard for the default tenant
11234
12496
  $ thinkwork dashboard
11235
-
11236
- # Check a specific stage
11237
12497
  $ thinkwork dashboard --stage prod
11238
12498
  `
11239
- ).action(() => notYetImplemented("dashboard", 5));
12499
+ ).action(runDashboard);
11240
12500
  }
11241
12501
 
11242
12502
  // src/commands/eval/run.ts
11243
- import { checkbox, confirm as confirm14 } from "@inquirer/prompts";
12503
+ import { checkbox, confirm as confirm17 } from "@inquirer/prompts";
11244
12504
  import ora2 from "ora";
11245
12505
 
11246
12506
  // src/commands/eval/gql.ts
@@ -11594,7 +12854,7 @@ async function runEvalRun(opts) {
11594
12854
  summaryLines.push(["Scope", "all enabled test cases"]);
11595
12855
  printKeyValue(summaryLines);
11596
12856
  const proceed = await promptOrExit(
11597
- () => confirm14({ message: "Start run?", default: true })
12857
+ () => confirm17({ message: "Start run?", default: true })
11598
12858
  );
11599
12859
  if (!proceed) {
11600
12860
  logStderr("Cancelled.");
@@ -11816,7 +13076,7 @@ async function runEvalCancel(runId, opts) {
11816
13076
  }
11817
13077
 
11818
13078
  // src/commands/eval/delete.ts
11819
- import { confirm as confirm15 } from "@inquirer/prompts";
13079
+ import { confirm as confirm18 } from "@inquirer/prompts";
11820
13080
  async function runEvalDelete(runId, opts) {
11821
13081
  const ctx = await resolveEvalContext(opts);
11822
13082
  if (!opts.yes) {
@@ -11826,7 +13086,7 @@ async function runEvalDelete(runId, opts) {
11826
13086
  }
11827
13087
  requireTty("Confirmation");
11828
13088
  const go = await promptOrExit(
11829
- () => confirm15({
13089
+ () => confirm18({
11830
13090
  message: `Permanently delete run ${runId} and its results?`,
11831
13091
  default: false
11832
13092
  })
@@ -11963,7 +13223,7 @@ async function runEvalTestCaseGet(id, opts) {
11963
13223
 
11964
13224
  // src/commands/eval/test-case/create.ts
11965
13225
  import { readFileSync as readFileSync6 } from "fs";
11966
- import { input as input18, select as select8, checkbox as checkbox2 } from "@inquirer/prompts";
13226
+ import { input as input19, select as select8, checkbox as checkbox2 } from "@inquirer/prompts";
11967
13227
  var DEFAULT_EVALUATORS = [
11968
13228
  "Builtin.Helpfulness",
11969
13229
  "Builtin.Correctness",
@@ -11993,17 +13253,17 @@ async function runEvalTestCaseCreate(opts) {
11993
13253
  if (!name) {
11994
13254
  requireTty("Name");
11995
13255
  name = await promptOrExit(
11996
- () => input18({ message: "Test case name?", validate: (v) => v.trim().length > 0 || "Required" })
13256
+ () => input19({ message: "Test case name?", validate: (v) => v.trim().length > 0 || "Required" })
11997
13257
  );
11998
13258
  }
11999
13259
  if (!category) {
12000
13260
  category = await promptOrExit(
12001
- () => input18({ message: "Category (free-form label)?", validate: (v) => v.trim().length > 0 || "Required" })
13261
+ () => input19({ message: "Category (free-form label)?", validate: (v) => v.trim().length > 0 || "Required" })
12002
13262
  );
12003
13263
  }
12004
13264
  if (!query) {
12005
13265
  query = await promptOrExit(
12006
- () => input18({ message: "Query the agent under test will receive?", validate: (v) => v.trim().length > 0 || "Required" })
13266
+ () => input19({ message: "Query the agent under test will receive?", validate: (v) => v.trim().length > 0 || "Required" })
12007
13267
  );
12008
13268
  }
12009
13269
  if (interactive && agentTemplateId === null) {
@@ -12069,28 +13329,28 @@ async function runEvalTestCaseCreate(opts) {
12069
13329
  import { readFileSync as readFileSync7 } from "fs";
12070
13330
  async function runEvalTestCaseUpdate(id, opts) {
12071
13331
  const ctx = await resolveEvalContext(opts);
12072
- const input19 = {};
12073
- if (opts.name !== void 0) input19.name = opts.name;
12074
- if (opts.category !== void 0) input19.category = opts.category;
12075
- if (opts.query !== void 0) input19.query = opts.query;
12076
- if (opts.systemPrompt !== void 0) input19.systemPrompt = opts.systemPrompt;
12077
- if (opts.agentTemplate !== void 0) input19.agentTemplateId = opts.agentTemplate;
12078
- if (opts.evaluator !== void 0) input19.agentcoreEvaluatorIds = opts.evaluator;
12079
- if (opts.tag !== void 0) input19.tags = opts.tag;
12080
- if (opts.enabled !== void 0) input19.enabled = opts.enabled;
13332
+ const input20 = {};
13333
+ if (opts.name !== void 0) input20.name = opts.name;
13334
+ if (opts.category !== void 0) input20.category = opts.category;
13335
+ if (opts.query !== void 0) input20.query = opts.query;
13336
+ if (opts.systemPrompt !== void 0) input20.systemPrompt = opts.systemPrompt;
13337
+ if (opts.agentTemplate !== void 0) input20.agentTemplateId = opts.agentTemplate;
13338
+ if (opts.evaluator !== void 0) input20.agentcoreEvaluatorIds = opts.evaluator;
13339
+ if (opts.tag !== void 0) input20.tags = opts.tag;
13340
+ if (opts.enabled !== void 0) input20.enabled = opts.enabled;
12081
13341
  if (opts.assertionsFile) {
12082
13342
  const parsed = JSON.parse(readFileSync7(opts.assertionsFile, "utf8"));
12083
13343
  if (!Array.isArray(parsed)) {
12084
13344
  printError(`--assertions-file must contain a JSON array.`);
12085
13345
  process.exit(1);
12086
13346
  }
12087
- input19.assertions = parsed;
13347
+ input20.assertions = parsed;
12088
13348
  }
12089
- if (Object.keys(input19).length === 0) {
13349
+ if (Object.keys(input20).length === 0) {
12090
13350
  printError("No fields to update. Pass at least one --<field>.");
12091
13351
  process.exit(1);
12092
13352
  }
12093
- const res = await gqlMutate(ctx.client, UpdateEvalTestCaseDoc, { id, input: input19 });
13353
+ const res = await gqlMutate(ctx.client, UpdateEvalTestCaseDoc, { id, input: input20 });
12094
13354
  if (isJsonMode()) {
12095
13355
  printJson(res.updateEvalTestCase);
12096
13356
  return;
@@ -12099,7 +13359,7 @@ async function runEvalTestCaseUpdate(id, opts) {
12099
13359
  }
12100
13360
 
12101
13361
  // src/commands/eval/test-case/delete.ts
12102
- import { confirm as confirm16 } from "@inquirer/prompts";
13362
+ import { confirm as confirm19 } from "@inquirer/prompts";
12103
13363
  async function runEvalTestCaseDelete(id, opts) {
12104
13364
  const ctx = await resolveEvalContext(opts);
12105
13365
  if (!opts.yes) {
@@ -12109,7 +13369,7 @@ async function runEvalTestCaseDelete(id, opts) {
12109
13369
  }
12110
13370
  requireTty("Confirmation");
12111
13371
  const go = await promptOrExit(
12112
- () => confirm16({ message: `Permanently delete test case ${id}?`, default: false })
13372
+ () => confirm19({ message: `Permanently delete test case ${id}?`, default: false })
12113
13373
  );
12114
13374
  if (!go) {
12115
13375
  logStderr("Cancelled.");
@@ -12626,7 +13886,7 @@ async function watchSingleJob(ctx, target) {
12626
13886
  }
12627
13887
 
12628
13888
  // src/commands/wiki/rebuild.ts
12629
- import { confirm as confirm17 } from "@inquirer/prompts";
13889
+ import { confirm as confirm20 } from "@inquirer/prompts";
12630
13890
  import ora5 from "ora";
12631
13891
  async function runWikiRebuild(opts) {
12632
13892
  if (opts.all) {
@@ -12648,7 +13908,7 @@ async function runWikiRebuild(opts) {
12648
13908
  requireTty("Rebuild confirmation (--yes)");
12649
13909
  }
12650
13910
  const ok = await promptOrExit(
12651
- () => confirm17({
13911
+ () => confirm20({
12652
13912
  message: `Rebuild wiki for ${agentLabel}? This archives every active page in the scope and recompiles from scratch.`,
12653
13913
  default: false
12654
13914
  })