thinkwork-cli 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +1738 -217
- 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:
|
|
2188
|
+
const { input: input19 } = await import("@inquirer/prompts");
|
|
2189
2189
|
try {
|
|
2190
|
-
stage = await
|
|
2190
|
+
stage = await input19({
|
|
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,
|
|
2804
|
+
async function updateTenant(client, id, input19) {
|
|
2805
2805
|
return client.fetch(`/api/tenants/${encodeURIComponent(id)}`, {
|
|
2806
2806
|
method: "PUT",
|
|
2807
|
-
body: JSON.stringify(
|
|
2807
|
+
body: JSON.stringify(input19)
|
|
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,
|
|
2818
|
+
async function createAdminKey(client, tenantIdOrSlug, input19 = {}) {
|
|
2819
2819
|
return client.fetch(
|
|
2820
2820
|
`/api/tenants/${encodeURIComponent(tenantIdOrSlug)}/mcp-admin-keys`,
|
|
2821
2821
|
{
|
|
2822
2822
|
method: "POST",
|
|
2823
|
-
body: JSON.stringify(
|
|
2823
|
+
body: JSON.stringify(input19)
|
|
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:
|
|
3165
|
+
const { input: input19 } = 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
|
|
3173
|
+
name = await input19({ 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
|
|
3181
|
+
url = await input19({
|
|
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:
|
|
3341
|
+
const { input: input19 } = 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
|
|
3350
|
+
agent = await input19({ 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:
|
|
3373
|
+
const { input: input19 } = 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
|
|
3382
|
+
agent = await input19({ message: "Agent ID:" });
|
|
3383
3383
|
}
|
|
3384
3384
|
await apiFetch(
|
|
3385
3385
|
api.apiUrl,
|
|
@@ -4503,6 +4503,23 @@ var CliRemoveTenantMemberDocument = { "kind": "Document", "definitions": [{ "kin
|
|
|
4503
4503
|
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" } }] } }] } }] };
|
|
4504
4504
|
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
4505
|
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" } }] } }] } }] } }] };
|
|
4506
|
+
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
|
+
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
|
+
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" } }] } }] } }] };
|
|
4509
|
+
var CliUpdateRoutineDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliUpdateRoutine" }, "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": "UpdateRoutineInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "updateRoutine" }, "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": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] };
|
|
4510
|
+
var CliDeleteRoutineDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliDeleteRoutine" }, "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": "deleteRoutine" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }] }] } }] };
|
|
4511
|
+
var CliTriggerRoutineRunDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliTriggerRoutineRun" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "routineId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "AWSJSON" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "triggerRoutineRun" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "routineId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "routineId" } } }, { "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": "startedAt" } }] } }] } }] };
|
|
4512
|
+
var CliRoutineExecutionsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliRoutineExecutions" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "routineId" } }, "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": "RoutineExecutionStatus" } } }, { "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": "routineExecutions" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "routineId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "routineId" } } }, { "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": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "startedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "finishedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "errorMessage" } }] } }] } }] };
|
|
4513
|
+
var CliRoutineExecutionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliRoutineExecution" }, "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": "routineExecution" }, "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": "routineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "startedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "finishedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "errorMessage" } }, { "kind": "Field", "name": { "kind": "Name", "value": "inputJson" } }, { "kind": "Field", "name": { "kind": "Name", "value": "outputJson" } }] } }] } }] };
|
|
4514
|
+
var CliSetRoutineTriggerDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliSetRoutineTrigger" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "routineId" } }, "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": "RoutineTriggerInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "setRoutineTrigger" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "routineId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "routineId" } } }, { "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": "triggerType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }] } }] } }] };
|
|
4515
|
+
var CliDeleteRoutineTriggerDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliDeleteRoutineTrigger" }, "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": "deleteRoutineTrigger" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }] }] } }] };
|
|
4516
|
+
var CliRoutineTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliRoutineTenantBySlug" }, "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" } }] } }] } }] };
|
|
4517
|
+
var CliScheduledJobsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliScheduledJobs" }, "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": "triggerType" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "enabled" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Boolean" } } }, { "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": "scheduledJobs" }, "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": "triggerType" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "triggerType" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "enabled" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "enabled" } } }, { "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": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "description" } }, { "kind": "Field", "name": { "kind": "Name", "value": "triggerType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "routineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "scheduleType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "scheduleExpression" } }, { "kind": "Field", "name": { "kind": "Name", "value": "timezone" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastRunAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "nextRunAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
|
|
4518
|
+
var CliScheduledJobDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliScheduledJob" }, "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": "scheduledJob" }, "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": "triggerType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "routineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "prompt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "scheduleType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "scheduleExpression" } }, { "kind": "Field", "name": { "kind": "Name", "value": "timezone" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ebScheduleName" } }, { "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" } }] } }] } }] };
|
|
4519
|
+
var CliCreateScheduledJobDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliCreateScheduledJob" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "CreateScheduledJobInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createScheduledJob" }, "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": "enabled" } }, { "kind": "Field", "name": { "kind": "Name", "value": "scheduleExpression" } }, { "kind": "Field", "name": { "kind": "Name", "value": "timezone" } }] } }] } }] };
|
|
4520
|
+
var CliSchedJobTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliSchedJobTenantBySlug" }, "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" } }] } }] } }] };
|
|
4521
|
+
var CliSkillCatalogDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliSkillCatalog" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "skillCatalog" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "skillId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "displayName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "description" } }, { "kind": "Field", "name": { "kind": "Name", "value": "category" } }, { "kind": "Field", "name": { "kind": "Name", "value": "icon" } }, { "kind": "Field", "name": { "kind": "Name", "value": "source" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }] } }] } }] };
|
|
4522
|
+
var CliSkillTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliSkillTenantBySlug" }, "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
4523
|
var CliTeamsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliTeams" }, "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": "teams" }, "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": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "slug" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "budgetMonthlyCents" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
|
|
4507
4524
|
var CliTeamDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliTeam" }, "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": "team" }, "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": "description" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "budgetMonthlyCents" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agents" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "joinedAt" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "users" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "userId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "joinedAt" } }] } }] } }] } }] };
|
|
4508
4525
|
var CliCreateTeamDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliCreateTeam" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "CreateTeamInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createTeam" }, "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" } }] } }] } }] };
|
|
@@ -4542,6 +4559,21 @@ var CliEscalateThreadDocument = { "kind": "Document", "definitions": [{ "kind":
|
|
|
4542
4559
|
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" } }] } }] } }] };
|
|
4543
4560
|
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" } }] } }] } }] };
|
|
4544
4561
|
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" } }] } }] } }] };
|
|
4562
|
+
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
|
+
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
|
+
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" } }] } }] } }] };
|
|
4565
|
+
var CliCancelThreadTurnDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliCancelThreadTurn" }, "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": "cancelThreadTurn" }, "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": "finishedAt" } }] } }] } }] };
|
|
4566
|
+
var CliTurnTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliTurnTenantBySlug" }, "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" } }] } }] } }] };
|
|
4567
|
+
var CliQueuedWakeupsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliQueuedWakeups" }, "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": "queuedWakeups" }, "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": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "source" } }, { "kind": "Field", "name": { "kind": "Name", "value": "triggerDetail" } }, { "kind": "Field", "name": { "kind": "Name", "value": "reason" } }, { "kind": "Field", "name": { "kind": "Name", "value": "coalescedCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "requestedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "claimedAt" } }] } }] } }] };
|
|
4568
|
+
var CliCreateWakeupDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliCreateWakeup" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "CreateWakeupRequestInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createWakeupRequest" }, "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": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "requestedAt" } }] } }] } }] };
|
|
4569
|
+
var CliWakeupTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliWakeupTenantBySlug" }, "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" } }] } }] } }] };
|
|
4570
|
+
var CliWebhooksDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliWebhooks" }, "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": "targetType" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "enabled" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Boolean" } } }, { "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": "webhooks" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "tenantId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "tenantId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "targetType" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "targetType" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "enabled" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "enabled" } } }, { "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": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "targetType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "routineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }, { "kind": "Field", "name": { "kind": "Name", "value": "rateLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "invocationCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastInvokedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
|
|
4571
|
+
var CliWebhookDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliWebhook" }, "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": "webhook" }, "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": "token" } }, { "kind": "Field", "name": { "kind": "Name", "value": "targetType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "routineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "prompt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }, { "kind": "Field", "name": { "kind": "Name", "value": "rateLimit" } }, { "kind": "Field", "name": { "kind": "Name", "value": "invocationCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastInvokedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }] } }] } }] };
|
|
4572
|
+
var CliCreateWebhookDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliCreateWebhook" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "CreateWebhookInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createWebhook" }, "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": "token" } }, { "kind": "Field", "name": { "kind": "Name", "value": "targetType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }] } }] } }] };
|
|
4573
|
+
var CliUpdateWebhookDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliUpdateWebhook" }, "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": "UpdateWebhookInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "updateWebhook" }, "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": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "targetType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "enabled" } }, { "kind": "Field", "name": { "kind": "Name", "value": "rateLimit" } }] } }] } }] };
|
|
4574
|
+
var CliDeleteWebhookDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliDeleteWebhook" }, "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": "deleteWebhook" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }] }] } }] };
|
|
4575
|
+
var CliRegenerateWebhookTokenDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CliRegenerateWebhookToken" }, "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": "regenerateWebhookToken" }, "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": "token" } }] } }] } }] };
|
|
4576
|
+
var CliWebhookTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliWebhookTenantBySlug" }, "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" } }] } }] } }] };
|
|
4545
4577
|
var CliWikiTenantBySlugDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliWikiTenantBySlug" }, "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" } }] } }] } }] };
|
|
4546
4578
|
var CliAllTenantAgentsForWikiDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "CliAllTenantAgentsForWiki" }, "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": "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": "BooleanValue", "value": false } }, { "kind": "Argument", "name": { "kind": "Name", "value": "includeSubAgents" }, "value": { "kind": "BooleanValue", "value": false } }], "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": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] };
|
|
4547
4579
|
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" } }] } }] } }] };
|
|
@@ -4617,6 +4649,23 @@ var documents = {
|
|
|
4617
4649
|
"\n query CliMemberTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n slug\n name\n }\n }\n": CliMemberTenantBySlugDocument,
|
|
4618
4650
|
"\n mutation CliMsgSendMessage($input: SendMessageInput!) {\n sendMessage(input: $input) {\n id\n threadId\n role\n content\n createdAt\n }\n }\n": CliMsgSendMessageDocument,
|
|
4619
4651
|
"\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,
|
|
4652
|
+
"\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
|
+
"\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
|
+
"\n mutation CliCreateRoutine($input: CreateRoutineInput!) {\n createRoutine(input: $input) {\n id\n name\n type\n status\n }\n }\n": CliCreateRoutineDocument,
|
|
4655
|
+
"\n mutation CliUpdateRoutine($id: ID!, $input: UpdateRoutineInput!) {\n updateRoutine(id: $id, input: $input) {\n id\n name\n status\n }\n }\n": CliUpdateRoutineDocument,
|
|
4656
|
+
"\n mutation CliDeleteRoutine($id: ID!) {\n deleteRoutine(id: $id)\n }\n": CliDeleteRoutineDocument,
|
|
4657
|
+
"\n mutation CliTriggerRoutineRun($routineId: ID!, $input: AWSJSON) {\n triggerRoutineRun(routineId: $routineId, input: $input) {\n id\n status\n startedAt\n }\n }\n": CliTriggerRoutineRunDocument,
|
|
4658
|
+
"\n query CliRoutineExecutions($routineId: ID!, $status: RoutineExecutionStatus, $limit: Int, $cursor: String) {\n routineExecutions(routineId: $routineId, status: $status, limit: $limit, cursor: $cursor) {\n id\n status\n startedAt\n finishedAt\n errorMessage\n }\n }\n": CliRoutineExecutionsDocument,
|
|
4659
|
+
"\n query CliRoutineExecution($id: ID!) {\n routineExecution(id: $id) {\n id\n routineId\n status\n startedAt\n finishedAt\n errorMessage\n inputJson\n outputJson\n }\n }\n": CliRoutineExecutionDocument,
|
|
4660
|
+
"\n mutation CliSetRoutineTrigger($routineId: ID!, $input: RoutineTriggerInput!) {\n setRoutineTrigger(routineId: $routineId, input: $input) {\n id\n triggerType\n enabled\n }\n }\n": CliSetRoutineTriggerDocument,
|
|
4661
|
+
"\n mutation CliDeleteRoutineTrigger($id: ID!) {\n deleteRoutineTrigger(id: $id)\n }\n": CliDeleteRoutineTriggerDocument,
|
|
4662
|
+
"\n query CliRoutineTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliRoutineTenantBySlugDocument,
|
|
4663
|
+
"\n query CliScheduledJobs(\n $tenantId: ID!\n $agentId: ID\n $routineId: ID\n $triggerType: String\n $enabled: Boolean\n $limit: Int\n ) {\n scheduledJobs(\n tenantId: $tenantId\n agentId: $agentId\n routineId: $routineId\n triggerType: $triggerType\n enabled: $enabled\n limit: $limit\n ) {\n id\n name\n description\n triggerType\n agentId\n routineId\n scheduleType\n scheduleExpression\n timezone\n enabled\n lastRunAt\n nextRunAt\n createdAt\n }\n }\n": CliScheduledJobsDocument,
|
|
4664
|
+
"\n query CliScheduledJob($id: ID!) {\n scheduledJob(id: $id) {\n id\n name\n description\n triggerType\n agentId\n routineId\n prompt\n scheduleType\n scheduleExpression\n timezone\n enabled\n ebScheduleName\n lastRunAt\n nextRunAt\n createdAt\n updatedAt\n }\n }\n": CliScheduledJobDocument,
|
|
4665
|
+
"\n mutation CliCreateScheduledJob($input: CreateScheduledJobInput!) {\n createScheduledJob(input: $input) {\n id\n name\n enabled\n scheduleExpression\n timezone\n }\n }\n": CliCreateScheduledJobDocument,
|
|
4666
|
+
"\n query CliSchedJobTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliSchedJobTenantBySlugDocument,
|
|
4667
|
+
"\n query CliSkillCatalog {\n skillCatalog {\n id\n skillId\n displayName\n description\n category\n icon\n source\n enabled\n }\n }\n": CliSkillCatalogDocument,
|
|
4668
|
+
"\n query CliSkillTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliSkillTenantBySlugDocument,
|
|
4620
4669
|
"\n query CliTeams($tenantId: ID!) {\n teams(tenantId: $tenantId) {\n id\n name\n slug\n type\n status\n budgetMonthlyCents\n createdAt\n }\n }\n": CliTeamsDocument,
|
|
4621
4670
|
"\n query CliTeam($id: ID!) {\n team(id: $id) {\n id\n name\n slug\n description\n type\n status\n budgetMonthlyCents\n createdAt\n updatedAt\n agents {\n id\n agentId\n role\n joinedAt\n }\n users {\n id\n userId\n role\n joinedAt\n }\n }\n }\n": CliTeamDocument,
|
|
4622
4671
|
"\n mutation CliCreateTeam($input: CreateTeamInput!) {\n createTeam(input: $input) {\n id\n name\n type\n status\n }\n }\n": CliCreateTeamDocument,
|
|
@@ -4656,6 +4705,21 @@ var documents = {
|
|
|
4656
4705
|
"\n mutation CliDelegateThread($input: DelegateThreadInput!) {\n delegateThread(input: $input) {\n id\n status\n assigneeType\n assigneeId\n }\n }\n": CliDelegateThreadDocument,
|
|
4657
4706
|
"\n mutation CliSendMessage($input: SendMessageInput!) {\n sendMessage(input: $input) {\n id\n threadId\n role\n content\n createdAt\n }\n }\n": CliSendMessageDocument,
|
|
4658
4707
|
"\n query CliThreadTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n slug\n name\n }\n }\n": CliThreadTenantBySlugDocument,
|
|
4708
|
+
"\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
|
+
"\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
|
+
"\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,
|
|
4711
|
+
"\n mutation CliCancelThreadTurn($id: ID!) {\n cancelThreadTurn(id: $id) {\n id\n status\n finishedAt\n }\n }\n": CliCancelThreadTurnDocument,
|
|
4712
|
+
"\n query CliTurnTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliTurnTenantBySlugDocument,
|
|
4713
|
+
"\n query CliQueuedWakeups($tenantId: ID!) {\n queuedWakeups(tenantId: $tenantId) {\n id\n agentId\n status\n source\n triggerDetail\n reason\n coalescedCount\n requestedAt\n claimedAt\n }\n }\n": CliQueuedWakeupsDocument,
|
|
4714
|
+
"\n mutation CliCreateWakeup($input: CreateWakeupRequestInput!) {\n createWakeupRequest(input: $input) {\n id\n agentId\n status\n requestedAt\n }\n }\n": CliCreateWakeupDocument,
|
|
4715
|
+
"\n query CliWakeupTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliWakeupTenantBySlugDocument,
|
|
4716
|
+
"\n query CliWebhooks($tenantId: ID!, $targetType: String, $enabled: Boolean, $limit: Int) {\n webhooks(tenantId: $tenantId, targetType: $targetType, enabled: $enabled, limit: $limit) {\n id\n name\n targetType\n agentId\n routineId\n enabled\n rateLimit\n invocationCount\n lastInvokedAt\n createdAt\n }\n }\n": CliWebhooksDocument,
|
|
4717
|
+
"\n query CliWebhook($id: ID!) {\n webhook(id: $id) {\n id\n name\n description\n token\n targetType\n agentId\n routineId\n prompt\n enabled\n rateLimit\n invocationCount\n lastInvokedAt\n createdAt\n updatedAt\n }\n }\n": CliWebhookDocument,
|
|
4718
|
+
"\n mutation CliCreateWebhook($input: CreateWebhookInput!) {\n createWebhook(input: $input) {\n id\n name\n token\n targetType\n enabled\n }\n }\n": CliCreateWebhookDocument,
|
|
4719
|
+
"\n mutation CliUpdateWebhook($id: ID!, $input: UpdateWebhookInput!) {\n updateWebhook(id: $id, input: $input) {\n id\n name\n targetType\n enabled\n rateLimit\n }\n }\n": CliUpdateWebhookDocument,
|
|
4720
|
+
"\n mutation CliDeleteWebhook($id: ID!) {\n deleteWebhook(id: $id)\n }\n": CliDeleteWebhookDocument,
|
|
4721
|
+
"\n mutation CliRegenerateWebhookToken($id: ID!) {\n regenerateWebhookToken(id: $id) {\n id\n token\n }\n }\n": CliRegenerateWebhookTokenDocument,
|
|
4722
|
+
"\n query CliWebhookTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n }\n }\n": CliWebhookTenantBySlugDocument,
|
|
4659
4723
|
"\n query CliWikiTenantBySlug($slug: String!) {\n tenantBySlug(slug: $slug) {\n id\n slug\n name\n }\n }\n": CliWikiTenantBySlugDocument,
|
|
4660
4724
|
"\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,
|
|
4661
4725
|
"\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,
|
|
@@ -5112,15 +5176,15 @@ async function runThreadCreate(title, opts) {
|
|
|
5112
5176
|
// src/commands/thread/update.ts
|
|
5113
5177
|
async function runThreadUpdate(id, opts) {
|
|
5114
5178
|
const ctx = await resolveThreadContext(opts);
|
|
5115
|
-
const
|
|
5116
|
-
if (opts.title !== void 0)
|
|
5117
|
-
if (opts.assignee !== void 0)
|
|
5118
|
-
if (opts.due !== void 0)
|
|
5119
|
-
if (Object.keys(
|
|
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) {
|
|
5120
5184
|
printError("Nothing to update. Pass at least one of --title, --assignee, --due.");
|
|
5121
5185
|
process.exit(1);
|
|
5122
5186
|
}
|
|
5123
|
-
const data = await gqlMutate(ctx.client, UpdateThreadDoc, { id, input:
|
|
5187
|
+
const data = await gqlMutate(ctx.client, UpdateThreadDoc, { id, input: input19 });
|
|
5124
5188
|
const updated = data.updateThread;
|
|
5125
5189
|
if (isJsonMode()) {
|
|
5126
5190
|
printJson(updated);
|
|
@@ -5742,15 +5806,15 @@ async function runLabelCreate(name, opts) {
|
|
|
5742
5806
|
}
|
|
5743
5807
|
async function runLabelUpdate(id, opts) {
|
|
5744
5808
|
const ctx = await resolveLabelContext(opts);
|
|
5745
|
-
const
|
|
5746
|
-
if (opts.name !== void 0)
|
|
5747
|
-
if (opts.color !== void 0)
|
|
5748
|
-
if (opts.description !== void 0)
|
|
5749
|
-
if (Object.keys(
|
|
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) {
|
|
5750
5814
|
printError("Nothing to update. Pass at least one of --name, --color, --description.");
|
|
5751
5815
|
process.exit(1);
|
|
5752
5816
|
}
|
|
5753
|
-
const data = await gqlMutate(ctx.client, UpdateThreadLabelDoc, { id, input:
|
|
5817
|
+
const data = await gqlMutate(ctx.client, UpdateThreadLabelDoc, { id, input: input19 });
|
|
5754
5818
|
const updated = data.updateThreadLabel;
|
|
5755
5819
|
if (isJsonMode()) {
|
|
5756
5820
|
printJson(updated);
|
|
@@ -6788,19 +6852,19 @@ async function runAgentUpdate(id, opts) {
|
|
|
6788
6852
|
if (!systemPrompt && opts.systemPromptFile) {
|
|
6789
6853
|
systemPrompt = await readFile4(opts.systemPromptFile, "utf-8");
|
|
6790
6854
|
}
|
|
6791
|
-
const
|
|
6792
|
-
if (opts.name !== void 0)
|
|
6793
|
-
if (opts.role !== void 0)
|
|
6794
|
-
if (opts.type !== void 0)
|
|
6795
|
-
if (opts.parent !== void 0)
|
|
6796
|
-
if (opts.reportsTo !== void 0)
|
|
6797
|
-
if (systemPrompt !== void 0)
|
|
6798
|
-
if (opts.model !== void 0)
|
|
6799
|
-
if (Object.keys(
|
|
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) {
|
|
6800
6864
|
printError("Nothing to update. Pass at least one field flag.");
|
|
6801
6865
|
process.exit(1);
|
|
6802
6866
|
}
|
|
6803
|
-
const data = await gqlMutate(ctx.client, UpdateAgentDoc, { id, input:
|
|
6867
|
+
const data = await gqlMutate(ctx.client, UpdateAgentDoc, { id, input: input19 });
|
|
6804
6868
|
if (isJsonMode()) {
|
|
6805
6869
|
printJson(data.updateAgent);
|
|
6806
6870
|
return;
|
|
@@ -7434,7 +7498,7 @@ function registerComputerCommand(program2) {
|
|
|
7434
7498
|
const tenantId = resolveTenantId(opts);
|
|
7435
7499
|
const computerId = resolveComputerId(opts);
|
|
7436
7500
|
const taskType = resolveTaskType(opts);
|
|
7437
|
-
const
|
|
7501
|
+
const input19 = taskType === "workspace_file_write" ? { path: opts.path, content: opts.content } : void 0;
|
|
7438
7502
|
if (!isJsonMode()) printHeader("computer task enqueue", stage);
|
|
7439
7503
|
const response = await apiFetchRaw(
|
|
7440
7504
|
api.apiUrl,
|
|
@@ -7446,7 +7510,7 @@ function registerComputerCommand(program2) {
|
|
|
7446
7510
|
tenantId,
|
|
7447
7511
|
computerId,
|
|
7448
7512
|
taskType,
|
|
7449
|
-
input:
|
|
7513
|
+
input: input19,
|
|
7450
7514
|
idempotencyKey: opts.idempotencyKey
|
|
7451
7515
|
})
|
|
7452
7516
|
}
|
|
@@ -7718,15 +7782,15 @@ async function runTemplateUpdate(id, opts) {
|
|
|
7718
7782
|
"--system-prompt-file is not yet wired in the CLI \u2014 edit prompt files via the admin UI."
|
|
7719
7783
|
);
|
|
7720
7784
|
}
|
|
7721
|
-
const
|
|
7722
|
-
if (opts.name !== void 0)
|
|
7723
|
-
if (opts.model !== void 0)
|
|
7724
|
-
if (opts.description !== void 0)
|
|
7725
|
-
if (Object.keys(
|
|
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) {
|
|
7726
7790
|
printError("Nothing to update. Pass at least one of --name, --model, --description.");
|
|
7727
7791
|
process.exit(1);
|
|
7728
7792
|
}
|
|
7729
|
-
const data = await gqlMutate(ctx.client, UpdateAgentTemplateDoc, { id, input:
|
|
7793
|
+
const data = await gqlMutate(ctx.client, UpdateAgentTemplateDoc, { id, input: input19 });
|
|
7730
7794
|
if (isJsonMode()) {
|
|
7731
7795
|
printJson(data.updateAgentTemplate);
|
|
7732
7796
|
return;
|
|
@@ -8048,15 +8112,15 @@ async function runTenantUpdate(id, opts) {
|
|
|
8048
8112
|
printMissingApiSessionError(stage, false);
|
|
8049
8113
|
process.exit(1);
|
|
8050
8114
|
}
|
|
8051
|
-
const
|
|
8052
|
-
if (opts.name !== void 0)
|
|
8053
|
-
if (opts.plan !== void 0)
|
|
8054
|
-
if (opts.issuePrefix !== void 0)
|
|
8055
|
-
if (Object.keys(
|
|
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) {
|
|
8056
8120
|
printError("Nothing to update. Pass at least one of --name, --plan, --issue-prefix.");
|
|
8057
8121
|
process.exit(1);
|
|
8058
8122
|
}
|
|
8059
|
-
const data = await gqlMutate(client, UpdateTenantDoc, { id, input:
|
|
8123
|
+
const data = await gqlMutate(client, UpdateTenantDoc, { id, input: input19 });
|
|
8060
8124
|
if (isJsonMode()) {
|
|
8061
8125
|
printJson(data.updateTenant);
|
|
8062
8126
|
return;
|
|
@@ -8094,18 +8158,18 @@ async function runTenantSettingsSet(tenantArg, opts) {
|
|
|
8094
8158
|
stage: opts.stage,
|
|
8095
8159
|
tenant: tenantArg
|
|
8096
8160
|
});
|
|
8097
|
-
const
|
|
8098
|
-
if (opts.defaultModel !== void 0)
|
|
8161
|
+
const input19 = {};
|
|
8162
|
+
if (opts.defaultModel !== void 0) input19.defaultModel = opts.defaultModel;
|
|
8099
8163
|
if (opts.monthlyBudgetUsd !== void 0) {
|
|
8100
|
-
|
|
8164
|
+
input19.budgetMonthlyCents = Math.round(Number.parseFloat(opts.monthlyBudgetUsd) * 100);
|
|
8101
8165
|
}
|
|
8102
|
-
if (opts.maxAgents !== void 0)
|
|
8166
|
+
if (opts.maxAgents !== void 0) input19.maxAgents = Number.parseInt(opts.maxAgents, 10);
|
|
8103
8167
|
if (opts.autoCloseAfterDays !== void 0) {
|
|
8104
|
-
|
|
8168
|
+
input19.autoCloseThreadMinutes = Math.round(Number.parseFloat(opts.autoCloseAfterDays) * 60 * 24);
|
|
8105
8169
|
}
|
|
8106
8170
|
const features = parseFeatureFlags(opts.feature);
|
|
8107
|
-
if (features !== void 0)
|
|
8108
|
-
if (Object.keys(
|
|
8171
|
+
if (features !== void 0) input19.features = features;
|
|
8172
|
+
if (Object.keys(input19).length === 0) {
|
|
8109
8173
|
printError(
|
|
8110
8174
|
"Nothing to set. Pass at least one of --default-model, --monthly-budget-usd, --max-agents, --auto-close-after-days, --feature."
|
|
8111
8175
|
);
|
|
@@ -8113,7 +8177,7 @@ async function runTenantSettingsSet(tenantArg, opts) {
|
|
|
8113
8177
|
}
|
|
8114
8178
|
const data = await gqlMutate(ctx.client, UpdateTenantSettingsDoc, {
|
|
8115
8179
|
tenantId: ctx.tenantId,
|
|
8116
|
-
input:
|
|
8180
|
+
input: input19
|
|
8117
8181
|
});
|
|
8118
8182
|
if (isJsonMode()) {
|
|
8119
8183
|
printJson(data.updateTenantSettings);
|
|
@@ -8358,14 +8422,14 @@ async function runMemberInvite(email, opts) {
|
|
|
8358
8422
|
}
|
|
8359
8423
|
async function runMemberUpdate(memberId, opts) {
|
|
8360
8424
|
const ctx = await resolveMemberContext(opts);
|
|
8361
|
-
const
|
|
8362
|
-
if (opts.role !== void 0)
|
|
8363
|
-
if (opts.status !== void 0)
|
|
8364
|
-
if (Object.keys(
|
|
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) {
|
|
8365
8429
|
printError("Nothing to update. Pass at least one of --role, --status.");
|
|
8366
8430
|
process.exit(1);
|
|
8367
8431
|
}
|
|
8368
|
-
const data = await gqlMutate(ctx.client, UpdateTenantMemberDoc, { id: memberId, input:
|
|
8432
|
+
const data = await gqlMutate(ctx.client, UpdateTenantMemberDoc, { id: memberId, input: input19 });
|
|
8369
8433
|
const updated = data.updateTenantMember;
|
|
8370
8434
|
if (isJsonMode()) {
|
|
8371
8435
|
printJson(updated);
|
|
@@ -8649,18 +8713,18 @@ async function runTeamCreate(name, opts) {
|
|
|
8649
8713
|
}
|
|
8650
8714
|
async function runTeamUpdate(id, opts) {
|
|
8651
8715
|
const ctx = await resolveTeamContext(opts);
|
|
8652
|
-
const
|
|
8653
|
-
if (opts.name !== void 0)
|
|
8654
|
-
if (opts.description !== void 0)
|
|
8655
|
-
if (opts.status !== void 0)
|
|
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;
|
|
8656
8720
|
if (opts.budgetUsd !== void 0) {
|
|
8657
|
-
|
|
8721
|
+
input19.budgetMonthlyCents = Math.round(Number.parseFloat(opts.budgetUsd) * 100);
|
|
8658
8722
|
}
|
|
8659
|
-
if (Object.keys(
|
|
8723
|
+
if (Object.keys(input19).length === 0) {
|
|
8660
8724
|
printError("Nothing to update. Pass at least one of --name, --description, --status, --budget-usd.");
|
|
8661
8725
|
process.exit(1);
|
|
8662
8726
|
}
|
|
8663
|
-
const data = await gqlMutate(ctx.client, UpdateTeamDoc, { id, input:
|
|
8727
|
+
const data = await gqlMutate(ctx.client, UpdateTeamDoc, { id, input: input19 });
|
|
8664
8728
|
if (isJsonMode()) {
|
|
8665
8729
|
printJson(data.updateTeam);
|
|
8666
8730
|
return;
|
|
@@ -8984,14 +9048,14 @@ async function runKbCreate(name, opts) {
|
|
|
8984
9048
|
}
|
|
8985
9049
|
async function runKbUpdate(id, opts) {
|
|
8986
9050
|
const ctx = await resolveKbContext(opts);
|
|
8987
|
-
const
|
|
8988
|
-
if (opts.name !== void 0)
|
|
8989
|
-
if (opts.description !== void 0)
|
|
8990
|
-
if (Object.keys(
|
|
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) {
|
|
8991
9055
|
printError("Nothing to update. Pass at least one of --name, --description.");
|
|
8992
9056
|
process.exit(1);
|
|
8993
9057
|
}
|
|
8994
|
-
const data = await gqlMutate(ctx.client, UpdateKBDoc, { id, input:
|
|
9058
|
+
const data = await gqlMutate(ctx.client, UpdateKBDoc, { id, input: input19 });
|
|
8995
9059
|
if (isJsonMode()) {
|
|
8996
9060
|
printJson(data.updateKnowledgeBase);
|
|
8997
9061
|
return;
|
|
@@ -9133,126 +9197,1482 @@ Examples:
|
|
|
9133
9197
|
kb.command("detach <kbId>").description("Detach a knowledge base from an agent.").option("--agent <id>", "Agent ID").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runKbDetach);
|
|
9134
9198
|
}
|
|
9135
9199
|
|
|
9136
|
-
// src/
|
|
9137
|
-
import
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9200
|
+
// src/commands/routine.ts
|
|
9201
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
9202
|
+
import { confirm as confirm11, input as input15 } from "@inquirer/prompts";
|
|
9203
|
+
var RoutinesDoc = graphql(`
|
|
9204
|
+
query CliRoutines($tenantId: ID!, $teamId: ID, $agentId: ID, $status: RoutineStatus) {
|
|
9205
|
+
routines(tenantId: $tenantId, teamId: $teamId, agentId: $agentId, status: $status) {
|
|
9206
|
+
id
|
|
9207
|
+
name
|
|
9208
|
+
type
|
|
9209
|
+
status
|
|
9210
|
+
engine
|
|
9211
|
+
schedule
|
|
9212
|
+
agentId
|
|
9213
|
+
teamId
|
|
9214
|
+
lastRunAt
|
|
9215
|
+
nextRunAt
|
|
9216
|
+
}
|
|
9217
|
+
}
|
|
9218
|
+
`);
|
|
9219
|
+
var RoutineDoc = graphql(`
|
|
9220
|
+
query CliRoutine($id: ID!) {
|
|
9221
|
+
routine(id: $id) {
|
|
9222
|
+
id
|
|
9223
|
+
name
|
|
9224
|
+
description
|
|
9225
|
+
type
|
|
9226
|
+
status
|
|
9227
|
+
engine
|
|
9228
|
+
schedule
|
|
9229
|
+
agentId
|
|
9230
|
+
teamId
|
|
9231
|
+
visibility
|
|
9232
|
+
owningAgentId
|
|
9233
|
+
currentVersion
|
|
9234
|
+
lastRunAt
|
|
9235
|
+
nextRunAt
|
|
9236
|
+
createdAt
|
|
9237
|
+
updatedAt
|
|
9238
|
+
triggers {
|
|
9239
|
+
id
|
|
9240
|
+
triggerType
|
|
9241
|
+
enabled
|
|
9242
|
+
config
|
|
9243
|
+
}
|
|
9244
|
+
}
|
|
9245
|
+
}
|
|
9246
|
+
`);
|
|
9247
|
+
var CreateRoutineDoc = graphql(`
|
|
9248
|
+
mutation CliCreateRoutine($input: CreateRoutineInput!) {
|
|
9249
|
+
createRoutine(input: $input) {
|
|
9250
|
+
id
|
|
9251
|
+
name
|
|
9252
|
+
type
|
|
9253
|
+
status
|
|
9254
|
+
}
|
|
9255
|
+
}
|
|
9256
|
+
`);
|
|
9257
|
+
var UpdateRoutineDoc = graphql(`
|
|
9258
|
+
mutation CliUpdateRoutine($id: ID!, $input: UpdateRoutineInput!) {
|
|
9259
|
+
updateRoutine(id: $id, input: $input) {
|
|
9260
|
+
id
|
|
9261
|
+
name
|
|
9262
|
+
status
|
|
9263
|
+
}
|
|
9264
|
+
}
|
|
9265
|
+
`);
|
|
9266
|
+
var DeleteRoutineDoc = graphql(`
|
|
9267
|
+
mutation CliDeleteRoutine($id: ID!) {
|
|
9268
|
+
deleteRoutine(id: $id)
|
|
9269
|
+
}
|
|
9270
|
+
`);
|
|
9271
|
+
var TriggerRoutineRunDoc = graphql(`
|
|
9272
|
+
mutation CliTriggerRoutineRun($routineId: ID!, $input: AWSJSON) {
|
|
9273
|
+
triggerRoutineRun(routineId: $routineId, input: $input) {
|
|
9274
|
+
id
|
|
9275
|
+
status
|
|
9276
|
+
startedAt
|
|
9277
|
+
}
|
|
9278
|
+
}
|
|
9279
|
+
`);
|
|
9280
|
+
var RoutineExecutionsDoc = graphql(`
|
|
9281
|
+
query CliRoutineExecutions($routineId: ID!, $status: RoutineExecutionStatus, $limit: Int, $cursor: String) {
|
|
9282
|
+
routineExecutions(routineId: $routineId, status: $status, limit: $limit, cursor: $cursor) {
|
|
9283
|
+
id
|
|
9284
|
+
status
|
|
9285
|
+
startedAt
|
|
9286
|
+
finishedAt
|
|
9287
|
+
errorMessage
|
|
9288
|
+
}
|
|
9289
|
+
}
|
|
9290
|
+
`);
|
|
9291
|
+
var RoutineExecutionDoc = graphql(`
|
|
9292
|
+
query CliRoutineExecution($id: ID!) {
|
|
9293
|
+
routineExecution(id: $id) {
|
|
9294
|
+
id
|
|
9295
|
+
routineId
|
|
9296
|
+
status
|
|
9297
|
+
startedAt
|
|
9298
|
+
finishedAt
|
|
9299
|
+
errorMessage
|
|
9300
|
+
inputJson
|
|
9301
|
+
outputJson
|
|
9302
|
+
}
|
|
9303
|
+
}
|
|
9304
|
+
`);
|
|
9305
|
+
var SetRoutineTriggerDoc = graphql(`
|
|
9306
|
+
mutation CliSetRoutineTrigger($routineId: ID!, $input: RoutineTriggerInput!) {
|
|
9307
|
+
setRoutineTrigger(routineId: $routineId, input: $input) {
|
|
9308
|
+
id
|
|
9309
|
+
triggerType
|
|
9310
|
+
enabled
|
|
9311
|
+
}
|
|
9312
|
+
}
|
|
9313
|
+
`);
|
|
9314
|
+
var DeleteRoutineTriggerDoc = graphql(`
|
|
9315
|
+
mutation CliDeleteRoutineTrigger($id: ID!) {
|
|
9316
|
+
deleteRoutineTrigger(id: $id)
|
|
9317
|
+
}
|
|
9318
|
+
`);
|
|
9319
|
+
var RoutineTenantBySlugDoc = graphql(`
|
|
9320
|
+
query CliRoutineTenantBySlug($slug: String!) {
|
|
9321
|
+
tenantBySlug(slug: $slug) {
|
|
9322
|
+
id
|
|
9323
|
+
}
|
|
9324
|
+
}
|
|
9325
|
+
`);
|
|
9326
|
+
async function resolveRoutineContext(opts) {
|
|
9327
|
+
const region = opts.region ?? "us-east-1";
|
|
9328
|
+
const stage = await resolveStage({ flag: opts.stage, region });
|
|
9329
|
+
const session = loadStageSession(stage);
|
|
9330
|
+
const { client, tenantSlug: ctxSlug } = await getGqlClient({ stage, region });
|
|
9331
|
+
const flagOrEnv = opts.tenant ?? process.env.THINKWORK_TENANT;
|
|
9332
|
+
if (flagOrEnv) {
|
|
9333
|
+
if (session?.tenantSlug === flagOrEnv && session.tenantId) {
|
|
9334
|
+
return { stage, region, client, tenantId: session.tenantId };
|
|
9335
|
+
}
|
|
9336
|
+
const data = await gqlQuery(client, RoutineTenantBySlugDoc, { slug: flagOrEnv });
|
|
9337
|
+
if (!data.tenantBySlug) {
|
|
9338
|
+
printError(`Tenant "${flagOrEnv}" not found.`);
|
|
9339
|
+
process.exit(1);
|
|
9340
|
+
}
|
|
9341
|
+
return { stage, region, client, tenantId: data.tenantBySlug.id };
|
|
9342
|
+
}
|
|
9343
|
+
if (session?.tenantId) return { stage, region, client, tenantId: session.tenantId };
|
|
9344
|
+
if (ctxSlug) {
|
|
9345
|
+
const data = await gqlQuery(client, RoutineTenantBySlugDoc, { slug: ctxSlug });
|
|
9346
|
+
if (data.tenantBySlug) return { stage, region, client, tenantId: data.tenantBySlug.id };
|
|
9347
|
+
}
|
|
9348
|
+
printMissingApiSessionError(stage, session !== null);
|
|
9349
|
+
process.exit(1);
|
|
9350
|
+
}
|
|
9351
|
+
function fmtIso7(iso) {
|
|
9352
|
+
if (!iso) return "\u2014";
|
|
9353
|
+
const d = new Date(iso);
|
|
9354
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
9355
|
+
return d.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
9356
|
+
}
|
|
9357
|
+
var ROUTINE_STATUS_BY_NAME = {
|
|
9358
|
+
ACTIVE: "ACTIVE" /* Active */,
|
|
9359
|
+
PAUSED: "PAUSED" /* Paused */,
|
|
9360
|
+
ARCHIVED: "ARCHIVED" /* Archived */
|
|
9361
|
+
};
|
|
9362
|
+
var ROUTINE_EXEC_STATUS_BY_NAME = {
|
|
9363
|
+
AWAITING_APPROVAL: "AWAITING_APPROVAL" /* AwaitingApproval */,
|
|
9364
|
+
CANCELLED: "CANCELLED" /* Cancelled */,
|
|
9365
|
+
FAILED: "FAILED" /* Failed */,
|
|
9366
|
+
RUNNING: "RUNNING" /* Running */,
|
|
9367
|
+
SUCCEEDED: "SUCCEEDED" /* Succeeded */
|
|
9368
|
+
};
|
|
9369
|
+
function parseStatus2(raw, table, label) {
|
|
9370
|
+
if (!raw) return null;
|
|
9371
|
+
const v = table[raw.toUpperCase()];
|
|
9372
|
+
if (!v) {
|
|
9373
|
+
printError(`Invalid ${label} "${raw}". Expected one of: ${Object.keys(table).join(", ")}.`);
|
|
9374
|
+
process.exit(1);
|
|
9375
|
+
}
|
|
9376
|
+
return v;
|
|
9377
|
+
}
|
|
9378
|
+
async function runRoutineList(opts) {
|
|
9379
|
+
const ctx = await resolveRoutineContext(opts);
|
|
9380
|
+
const data = await gqlQuery(ctx.client, RoutinesDoc, {
|
|
9381
|
+
tenantId: ctx.tenantId,
|
|
9382
|
+
teamId: opts.team ?? null,
|
|
9383
|
+
agentId: opts.agent ?? null,
|
|
9384
|
+
status: parseStatus2(opts.status, ROUTINE_STATUS_BY_NAME, "--status")
|
|
9385
|
+
});
|
|
9386
|
+
const items = data.routines ?? [];
|
|
9387
|
+
if (isJsonMode()) {
|
|
9388
|
+
printJson({ items });
|
|
9389
|
+
return;
|
|
9390
|
+
}
|
|
9391
|
+
printTable(
|
|
9392
|
+
items.map((r) => ({
|
|
9393
|
+
id: r.id,
|
|
9394
|
+
name: r.name,
|
|
9395
|
+
type: r.type,
|
|
9396
|
+
status: r.status,
|
|
9397
|
+
engine: r.engine,
|
|
9398
|
+
schedule: r.schedule ?? "\u2014",
|
|
9399
|
+
lastRun: fmtIso7(r.lastRunAt)
|
|
9400
|
+
})),
|
|
9401
|
+
[
|
|
9402
|
+
{ key: "id", header: "ID" },
|
|
9403
|
+
{ key: "name", header: "NAME" },
|
|
9404
|
+
{ key: "type", header: "TYPE" },
|
|
9405
|
+
{ key: "status", header: "STATUS" },
|
|
9406
|
+
{ key: "engine", header: "ENGINE" },
|
|
9407
|
+
{ key: "schedule", header: "SCHEDULE" },
|
|
9408
|
+
{ key: "lastRun", header: "LAST RUN" }
|
|
9409
|
+
]
|
|
9410
|
+
);
|
|
9411
|
+
}
|
|
9412
|
+
async function runRoutineGet(id, opts) {
|
|
9413
|
+
const ctx = await resolveRoutineContext(opts);
|
|
9414
|
+
const data = await gqlQuery(ctx.client, RoutineDoc, { id });
|
|
9415
|
+
const r = data.routine;
|
|
9416
|
+
if (!r) {
|
|
9417
|
+
printError(`Routine ${id} not found.`);
|
|
9418
|
+
process.exit(1);
|
|
9419
|
+
}
|
|
9420
|
+
if (isJsonMode()) {
|
|
9421
|
+
printJson(r);
|
|
9422
|
+
return;
|
|
9423
|
+
}
|
|
9424
|
+
printKeyValue([
|
|
9425
|
+
["ID", r.id],
|
|
9426
|
+
["Name", r.name],
|
|
9427
|
+
["Description", r.description ?? void 0],
|
|
9428
|
+
["Type", r.type],
|
|
9429
|
+
["Status", r.status],
|
|
9430
|
+
["Engine", r.engine],
|
|
9431
|
+
["Visibility", r.visibility],
|
|
9432
|
+
["Owning agent", r.owningAgentId ?? void 0],
|
|
9433
|
+
["Agent", r.agentId ?? void 0],
|
|
9434
|
+
["Team", r.teamId ?? void 0],
|
|
9435
|
+
["Schedule", r.schedule ?? void 0],
|
|
9436
|
+
["Current version", r.currentVersion ?? void 0],
|
|
9437
|
+
["Last run", fmtIso7(r.lastRunAt)],
|
|
9438
|
+
["Next run", fmtIso7(r.nextRunAt)],
|
|
9439
|
+
["Created", fmtIso7(r.createdAt)]
|
|
9440
|
+
]);
|
|
9441
|
+
if (r.triggers && r.triggers.length > 0) {
|
|
9442
|
+
console.log("\n Triggers:");
|
|
9443
|
+
printTable(
|
|
9444
|
+
r.triggers.map((t) => ({
|
|
9445
|
+
id: t.id,
|
|
9446
|
+
type: t.triggerType,
|
|
9447
|
+
enabled: t.enabled ? "yes" : "no",
|
|
9448
|
+
config: t.config ? JSON.stringify(t.config).slice(0, 50) : "\u2014"
|
|
9449
|
+
})),
|
|
9450
|
+
[
|
|
9451
|
+
{ key: "id", header: "TRIGGER ID" },
|
|
9452
|
+
{ key: "type", header: "TYPE" },
|
|
9453
|
+
{ key: "enabled", header: "ON" },
|
|
9454
|
+
{ key: "config", header: "CONFIG" }
|
|
9455
|
+
]
|
|
9456
|
+
);
|
|
9457
|
+
}
|
|
9458
|
+
}
|
|
9459
|
+
async function runRoutineCreate(name, opts) {
|
|
9460
|
+
const ctx = await resolveRoutineContext(opts);
|
|
9461
|
+
let resolvedName = name;
|
|
9462
|
+
if (!resolvedName) {
|
|
9463
|
+
if (!isInteractive()) {
|
|
9464
|
+
printError("Routine name required in non-interactive mode.");
|
|
9465
|
+
process.exit(1);
|
|
9466
|
+
}
|
|
9467
|
+
requireTty("Routine name");
|
|
9468
|
+
resolvedName = await promptOrExit(() => input15({ message: "Routine name:" }));
|
|
9469
|
+
}
|
|
9470
|
+
let aslJson = null;
|
|
9471
|
+
if (opts.config) {
|
|
9472
|
+
try {
|
|
9473
|
+
aslJson = JSON.parse(opts.config);
|
|
9474
|
+
} catch (err) {
|
|
9475
|
+
printError(`--config is not valid JSON: ${err.message}`);
|
|
9476
|
+
process.exit(1);
|
|
9477
|
+
}
|
|
9478
|
+
} else if (opts.configFile) {
|
|
9479
|
+
const txt = await readFile5(opts.configFile, "utf-8");
|
|
9480
|
+
try {
|
|
9481
|
+
aslJson = JSON.parse(txt);
|
|
9482
|
+
} catch (err) {
|
|
9483
|
+
printError(`--config-file does not parse as JSON: ${err.message}`);
|
|
9484
|
+
process.exit(1);
|
|
9485
|
+
}
|
|
9486
|
+
}
|
|
9487
|
+
const data = await gqlMutate(ctx.client, CreateRoutineDoc, {
|
|
9488
|
+
input: {
|
|
9489
|
+
tenantId: ctx.tenantId,
|
|
9490
|
+
name: resolvedName,
|
|
9491
|
+
description: opts.description ?? null,
|
|
9492
|
+
agentId: opts.agent ?? null,
|
|
9493
|
+
teamId: opts.team ?? null,
|
|
9494
|
+
asl: aslJson
|
|
9495
|
+
}
|
|
9496
|
+
});
|
|
9497
|
+
if (isJsonMode()) {
|
|
9498
|
+
printJson(data.createRoutine);
|
|
9499
|
+
return;
|
|
9500
|
+
}
|
|
9501
|
+
printSuccess(
|
|
9502
|
+
`Created routine ${data.createRoutine.id} \u2014 ${data.createRoutine.name} (type: ${data.createRoutine.type}, status: ${data.createRoutine.status}).`
|
|
9503
|
+
);
|
|
9504
|
+
}
|
|
9505
|
+
async function runRoutineUpdate(id, opts) {
|
|
9506
|
+
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) {
|
|
9513
|
+
printError("Nothing to update.");
|
|
9514
|
+
process.exit(1);
|
|
9515
|
+
}
|
|
9516
|
+
if (opts.configFile) {
|
|
9517
|
+
printError(
|
|
9518
|
+
"--config-file is not honored on update \u2014 ASL changes go through publishRoutineVersion. Use the admin UI for ASL edits."
|
|
9519
|
+
);
|
|
9520
|
+
process.exit(1);
|
|
9521
|
+
}
|
|
9522
|
+
const data = await gqlMutate(ctx.client, UpdateRoutineDoc, { id, input: input19 });
|
|
9523
|
+
if (isJsonMode()) {
|
|
9524
|
+
printJson(data.updateRoutine);
|
|
9525
|
+
return;
|
|
9526
|
+
}
|
|
9527
|
+
printSuccess(`Updated routine ${data.updateRoutine.id}.`);
|
|
9528
|
+
}
|
|
9529
|
+
async function runRoutineDelete(id, opts) {
|
|
9530
|
+
const ctx = await resolveRoutineContext(opts);
|
|
9531
|
+
if (!opts.yes) {
|
|
9532
|
+
if (!isInteractive()) {
|
|
9533
|
+
printError("Refusing to delete without --yes in a non-interactive session.");
|
|
9534
|
+
process.exit(1);
|
|
9535
|
+
}
|
|
9536
|
+
requireTty("Confirmation");
|
|
9537
|
+
const go = await promptOrExit(
|
|
9538
|
+
() => confirm11({ message: `Delete routine ${id}? Past runs + triggers are removed.`, default: false })
|
|
9539
|
+
);
|
|
9540
|
+
if (!go) {
|
|
9541
|
+
logStderr("Cancelled.");
|
|
9542
|
+
process.exit(0);
|
|
9543
|
+
}
|
|
9544
|
+
}
|
|
9545
|
+
const data = await gqlMutate(ctx.client, DeleteRoutineDoc, { id });
|
|
9546
|
+
if (isJsonMode()) {
|
|
9547
|
+
printJson({ id, deleted: data.deleteRoutine });
|
|
9548
|
+
return;
|
|
9549
|
+
}
|
|
9550
|
+
if (data.deleteRoutine) printSuccess(`Deleted routine ${id}.`);
|
|
9551
|
+
else printError(`Server reported not-deleted for ${id}.`);
|
|
9552
|
+
}
|
|
9553
|
+
async function runRoutineTrigger(id, opts) {
|
|
9554
|
+
const ctx = await resolveRoutineContext(opts);
|
|
9555
|
+
let payload = null;
|
|
9556
|
+
if (opts.input) {
|
|
9557
|
+
try {
|
|
9558
|
+
payload = JSON.parse(opts.input);
|
|
9559
|
+
} catch (err) {
|
|
9560
|
+
printError(`--input is not valid JSON: ${err.message}`);
|
|
9561
|
+
process.exit(1);
|
|
9562
|
+
}
|
|
9563
|
+
}
|
|
9564
|
+
const data = await gqlMutate(ctx.client, TriggerRoutineRunDoc, {
|
|
9565
|
+
routineId: id,
|
|
9566
|
+
input: payload
|
|
9567
|
+
});
|
|
9568
|
+
if (isJsonMode()) {
|
|
9569
|
+
printJson(data.triggerRoutineRun);
|
|
9570
|
+
return;
|
|
9571
|
+
}
|
|
9572
|
+
printSuccess(
|
|
9573
|
+
`Triggered routine ${id} \u2014 execution ${data.triggerRoutineRun.id} (status: ${data.triggerRoutineRun.status}).`
|
|
9574
|
+
);
|
|
9575
|
+
if (opts.wait) {
|
|
9576
|
+
console.log(" (--wait is not yet implemented; poll `routine run get` until status is terminal.)");
|
|
9577
|
+
}
|
|
9578
|
+
}
|
|
9579
|
+
async function runRoutineRunList(routineId, opts) {
|
|
9580
|
+
const ctx = await resolveRoutineContext(opts);
|
|
9581
|
+
const data = await gqlQuery(ctx.client, RoutineExecutionsDoc, {
|
|
9582
|
+
routineId,
|
|
9583
|
+
status: parseStatus2(opts.status, ROUTINE_EXEC_STATUS_BY_NAME, "--status"),
|
|
9584
|
+
limit: opts.limit ? Number.parseInt(opts.limit, 10) : 25,
|
|
9585
|
+
cursor: opts.cursor ?? null
|
|
9586
|
+
});
|
|
9587
|
+
const items = data.routineExecutions ?? [];
|
|
9588
|
+
if (isJsonMode()) {
|
|
9589
|
+
printJson({ items });
|
|
9590
|
+
return;
|
|
9591
|
+
}
|
|
9592
|
+
printTable(
|
|
9593
|
+
items.map((e) => ({
|
|
9594
|
+
id: e.id,
|
|
9595
|
+
status: e.status,
|
|
9596
|
+
started: fmtIso7(e.startedAt),
|
|
9597
|
+
finished: fmtIso7(e.finishedAt),
|
|
9598
|
+
errorMessage: e.errorMessage ? e.errorMessage.slice(0, 40) : "\u2014"
|
|
9599
|
+
})),
|
|
9600
|
+
[
|
|
9601
|
+
{ key: "id", header: "RUN ID" },
|
|
9602
|
+
{ key: "status", header: "STATUS" },
|
|
9603
|
+
{ key: "started", header: "STARTED" },
|
|
9604
|
+
{ key: "finished", header: "FINISHED" },
|
|
9605
|
+
{ key: "errorMessage", header: "ERROR" }
|
|
9606
|
+
]
|
|
9607
|
+
);
|
|
9608
|
+
}
|
|
9609
|
+
async function runRoutineRunGet(runId, opts) {
|
|
9610
|
+
const ctx = await resolveRoutineContext(opts);
|
|
9611
|
+
const data = await gqlQuery(ctx.client, RoutineExecutionDoc, { id: runId });
|
|
9612
|
+
const e = data.routineExecution;
|
|
9613
|
+
if (!e) {
|
|
9614
|
+
printError(`Routine execution ${runId} not found.`);
|
|
9615
|
+
process.exit(1);
|
|
9616
|
+
}
|
|
9617
|
+
if (isJsonMode()) {
|
|
9618
|
+
printJson(e);
|
|
9619
|
+
return;
|
|
9620
|
+
}
|
|
9621
|
+
printKeyValue([
|
|
9622
|
+
["ID", e.id],
|
|
9623
|
+
["Routine", e.routineId],
|
|
9624
|
+
["Status", e.status],
|
|
9625
|
+
["Started", fmtIso7(e.startedAt)],
|
|
9626
|
+
["Finished", fmtIso7(e.finishedAt)],
|
|
9627
|
+
["Error", e.errorMessage ?? void 0]
|
|
9628
|
+
]);
|
|
9629
|
+
}
|
|
9630
|
+
async function runRoutineTriggerConfigSet(routineId, opts) {
|
|
9631
|
+
const ctx = await resolveRoutineContext(opts);
|
|
9632
|
+
if (!opts.type) {
|
|
9633
|
+
printError("--type <CRON|WEBHOOK|EVENT> is required.");
|
|
9634
|
+
process.exit(1);
|
|
9635
|
+
}
|
|
9636
|
+
const config = {};
|
|
9637
|
+
if (opts.schedule) config.cronExpression = opts.schedule;
|
|
9638
|
+
if (opts.event) config.eventName = opts.event;
|
|
9639
|
+
const data = await gqlMutate(ctx.client, SetRoutineTriggerDoc, {
|
|
9640
|
+
routineId,
|
|
9641
|
+
input: {
|
|
9642
|
+
triggerType: opts.type,
|
|
9643
|
+
config: Object.keys(config).length > 0 ? config : null,
|
|
9644
|
+
enabled: true
|
|
9645
|
+
}
|
|
9646
|
+
});
|
|
9647
|
+
if (isJsonMode()) {
|
|
9648
|
+
printJson(data.setRoutineTrigger);
|
|
9649
|
+
return;
|
|
9650
|
+
}
|
|
9651
|
+
printSuccess(
|
|
9652
|
+
`Set ${data.setRoutineTrigger.triggerType} trigger on routine ${routineId} (id: ${data.setRoutineTrigger.id}, enabled: ${data.setRoutineTrigger.enabled}).`
|
|
9653
|
+
);
|
|
9654
|
+
}
|
|
9655
|
+
async function runRoutineTriggerConfigDelete(triggerId, opts) {
|
|
9656
|
+
const ctx = await resolveRoutineContext(opts);
|
|
9657
|
+
if (!opts.yes) {
|
|
9658
|
+
if (!isInteractive()) {
|
|
9659
|
+
printError("Refusing to delete without --yes in a non-interactive session.");
|
|
9660
|
+
process.exit(1);
|
|
9661
|
+
}
|
|
9662
|
+
requireTty("Confirmation");
|
|
9663
|
+
const go = await promptOrExit(
|
|
9664
|
+
() => confirm11({ message: `Delete trigger ${triggerId}?`, default: false })
|
|
9665
|
+
);
|
|
9666
|
+
if (!go) {
|
|
9667
|
+
logStderr("Cancelled.");
|
|
9668
|
+
process.exit(0);
|
|
9669
|
+
}
|
|
9670
|
+
}
|
|
9671
|
+
const data = await gqlMutate(ctx.client, DeleteRoutineTriggerDoc, { id: triggerId });
|
|
9672
|
+
if (isJsonMode()) {
|
|
9673
|
+
printJson({ id: triggerId, deleted: data.deleteRoutineTrigger });
|
|
9674
|
+
return;
|
|
9675
|
+
}
|
|
9676
|
+
if (data.deleteRoutineTrigger) printSuccess(`Deleted trigger ${triggerId}.`);
|
|
9677
|
+
else printError(`Server reported not-deleted for ${triggerId}.`);
|
|
9678
|
+
}
|
|
9679
|
+
function registerRoutineCommand(program2) {
|
|
9680
|
+
const routine = program2.command("routine").alias("routines").description("Manage routines \u2014 saved workflows, their triggers, and past runs.");
|
|
9681
|
+
routine.command("list").alias("ls").description("List routines in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--agent <id>", "Filter by agent").option("--team <id>", "Filter by team").option("--status <s>", "ACTIVE | PAUSED | ARCHIVED").action(runRoutineList);
|
|
9682
|
+
routine.command("get <id>").description("Fetch one routine with its triggers.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runRoutineGet);
|
|
9683
|
+
routine.command("create [name]").description("Create a new routine. Walkthrough for missing fields in TTY.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--agent <id>", "Agent that runs the routine").option("--team <id>", "Team to route runs to (instead of a single agent)").option("--description <text>").option("--config <json>", "Inline ASL JSON").option("--config-file <path>", "Load ASL JSON from a file").addHelpText(
|
|
9684
|
+
"after",
|
|
9143
9685
|
`
|
|
9144
|
-
|
|
9145
|
-
$
|
|
9146
|
-
|
|
9686
|
+
Examples:
|
|
9687
|
+
$ thinkwork routine create "Nightly digest" --agent agt-editor --config-file routines/digest.json
|
|
9147
9688
|
`
|
|
9689
|
+
).action(runRoutineCreate);
|
|
9690
|
+
routine.command("update <id>").description("Update routine metadata (name/status/assignment). ASL changes go through publish.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--name <n>").option("--status <s>", "ACTIVE | PAUSED | ARCHIVED").option("--agent <id>").option("--team <id>").option("--config-file <path>", "(not supported \u2014 ASL is published separately)").action(runRoutineUpdate);
|
|
9691
|
+
routine.command("delete <id>").description("Delete a routine. Past runs and triggers are removed.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(runRoutineDelete);
|
|
9692
|
+
routine.command("trigger <id>").description("Trigger a routine run now (ad-hoc).").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--wait", "(not yet implemented) block until the run finishes").option("--input <json>", "Optional input payload").action(runRoutineTrigger);
|
|
9693
|
+
const run2 = routine.command("run").description("Inspect routine run history.");
|
|
9694
|
+
run2.command("list <routineId>").alias("ls").description("List recent runs of a routine.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--limit <n>", "Max rows", "25").option("--cursor <c>", "Pagination cursor").option("--status <s>", "Filter by execution status").action(runRoutineRunList);
|
|
9695
|
+
run2.command("get <runId>").description("Fetch one run.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runRoutineRunGet);
|
|
9696
|
+
const trigger = routine.command("trigger-config").description("Manage a routine's triggers (cron, webhook, event).");
|
|
9697
|
+
trigger.command("set <routineId>").description("Set or replace a trigger for a routine.").option("--type <t>", "CRON | WEBHOOK | EVENT").option("--schedule <cron>", "Cron expression (for CRON triggers)").option("--event <name>", "Event name (for EVENT triggers)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").addHelpText(
|
|
9698
|
+
"after",
|
|
9699
|
+
`
|
|
9700
|
+
Examples:
|
|
9701
|
+
$ thinkwork routine trigger-config set rtn-digest --type CRON --schedule "0 9 * * *"
|
|
9702
|
+
`
|
|
9703
|
+
).action(runRoutineTriggerConfigSet);
|
|
9704
|
+
trigger.command("delete <triggerId>").description("Remove a trigger.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(runRoutineTriggerConfigDelete);
|
|
9705
|
+
}
|
|
9706
|
+
|
|
9707
|
+
// src/commands/scheduled-job.ts
|
|
9708
|
+
import { input as input16 } from "@inquirer/prompts";
|
|
9709
|
+
var ScheduledJobsDoc = graphql(`
|
|
9710
|
+
query CliScheduledJobs(
|
|
9711
|
+
$tenantId: ID!
|
|
9712
|
+
$agentId: ID
|
|
9713
|
+
$routineId: ID
|
|
9714
|
+
$triggerType: String
|
|
9715
|
+
$enabled: Boolean
|
|
9716
|
+
$limit: Int
|
|
9717
|
+
) {
|
|
9718
|
+
scheduledJobs(
|
|
9719
|
+
tenantId: $tenantId
|
|
9720
|
+
agentId: $agentId
|
|
9721
|
+
routineId: $routineId
|
|
9722
|
+
triggerType: $triggerType
|
|
9723
|
+
enabled: $enabled
|
|
9724
|
+
limit: $limit
|
|
9725
|
+
) {
|
|
9726
|
+
id
|
|
9727
|
+
name
|
|
9728
|
+
description
|
|
9729
|
+
triggerType
|
|
9730
|
+
agentId
|
|
9731
|
+
routineId
|
|
9732
|
+
scheduleType
|
|
9733
|
+
scheduleExpression
|
|
9734
|
+
timezone
|
|
9735
|
+
enabled
|
|
9736
|
+
lastRunAt
|
|
9737
|
+
nextRunAt
|
|
9738
|
+
createdAt
|
|
9739
|
+
}
|
|
9740
|
+
}
|
|
9741
|
+
`);
|
|
9742
|
+
var ScheduledJobDoc = graphql(`
|
|
9743
|
+
query CliScheduledJob($id: ID!) {
|
|
9744
|
+
scheduledJob(id: $id) {
|
|
9745
|
+
id
|
|
9746
|
+
name
|
|
9747
|
+
description
|
|
9748
|
+
triggerType
|
|
9749
|
+
agentId
|
|
9750
|
+
routineId
|
|
9751
|
+
prompt
|
|
9752
|
+
scheduleType
|
|
9753
|
+
scheduleExpression
|
|
9754
|
+
timezone
|
|
9755
|
+
enabled
|
|
9756
|
+
ebScheduleName
|
|
9757
|
+
lastRunAt
|
|
9758
|
+
nextRunAt
|
|
9759
|
+
createdAt
|
|
9760
|
+
updatedAt
|
|
9761
|
+
}
|
|
9762
|
+
}
|
|
9763
|
+
`);
|
|
9764
|
+
var CreateScheduledJobDoc = graphql(`
|
|
9765
|
+
mutation CliCreateScheduledJob($input: CreateScheduledJobInput!) {
|
|
9766
|
+
createScheduledJob(input: $input) {
|
|
9767
|
+
id
|
|
9768
|
+
name
|
|
9769
|
+
enabled
|
|
9770
|
+
scheduleExpression
|
|
9771
|
+
timezone
|
|
9772
|
+
}
|
|
9773
|
+
}
|
|
9774
|
+
`);
|
|
9775
|
+
var SchedJobTenantBySlugDoc = graphql(`
|
|
9776
|
+
query CliSchedJobTenantBySlug($slug: String!) {
|
|
9777
|
+
tenantBySlug(slug: $slug) {
|
|
9778
|
+
id
|
|
9779
|
+
}
|
|
9780
|
+
}
|
|
9781
|
+
`);
|
|
9782
|
+
async function resolveSchedContext(opts) {
|
|
9783
|
+
const region = opts.region ?? "us-east-1";
|
|
9784
|
+
const stage = await resolveStage({ flag: opts.stage, region });
|
|
9785
|
+
const session = loadStageSession(stage);
|
|
9786
|
+
const { client, tenantSlug: ctxSlug } = await getGqlClient({ stage, region });
|
|
9787
|
+
const flagOrEnv = opts.tenant ?? process.env.THINKWORK_TENANT;
|
|
9788
|
+
if (flagOrEnv) {
|
|
9789
|
+
if (session?.tenantSlug === flagOrEnv && session.tenantId) {
|
|
9790
|
+
return { stage, region, client, tenantId: session.tenantId };
|
|
9791
|
+
}
|
|
9792
|
+
const data = await gqlQuery(client, SchedJobTenantBySlugDoc, { slug: flagOrEnv });
|
|
9793
|
+
if (!data.tenantBySlug) {
|
|
9794
|
+
printError(`Tenant "${flagOrEnv}" not found.`);
|
|
9795
|
+
process.exit(1);
|
|
9796
|
+
}
|
|
9797
|
+
return { stage, region, client, tenantId: data.tenantBySlug.id };
|
|
9798
|
+
}
|
|
9799
|
+
if (session?.tenantId) return { stage, region, client, tenantId: session.tenantId };
|
|
9800
|
+
if (ctxSlug) {
|
|
9801
|
+
const data = await gqlQuery(client, SchedJobTenantBySlugDoc, { slug: ctxSlug });
|
|
9802
|
+
if (data.tenantBySlug) return { stage, region, client, tenantId: data.tenantBySlug.id };
|
|
9803
|
+
}
|
|
9804
|
+
printMissingApiSessionError(stage, session !== null);
|
|
9805
|
+
process.exit(1);
|
|
9806
|
+
}
|
|
9807
|
+
function fmtIso8(iso) {
|
|
9808
|
+
if (!iso) return "\u2014";
|
|
9809
|
+
const d = new Date(iso);
|
|
9810
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
9811
|
+
return d.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
9812
|
+
}
|
|
9813
|
+
async function runSchedList(opts) {
|
|
9814
|
+
const ctx = await resolveSchedContext(opts);
|
|
9815
|
+
const enabled = opts.enabled === void 0 ? null : opts.enabled === "true";
|
|
9816
|
+
const data = await gqlQuery(ctx.client, ScheduledJobsDoc, {
|
|
9817
|
+
tenantId: ctx.tenantId,
|
|
9818
|
+
agentId: opts.agent ?? null,
|
|
9819
|
+
routineId: opts.routine ?? null,
|
|
9820
|
+
triggerType: null,
|
|
9821
|
+
enabled,
|
|
9822
|
+
limit: 100
|
|
9823
|
+
});
|
|
9824
|
+
const items = data.scheduledJobs ?? [];
|
|
9825
|
+
if (isJsonMode()) {
|
|
9826
|
+
printJson({ items });
|
|
9827
|
+
return;
|
|
9828
|
+
}
|
|
9829
|
+
printTable(
|
|
9830
|
+
items.map((j) => ({
|
|
9831
|
+
id: j.id,
|
|
9832
|
+
name: j.name,
|
|
9833
|
+
type: j.triggerType,
|
|
9834
|
+
target: j.agentId ?? j.routineId ?? "\u2014",
|
|
9835
|
+
schedule: j.scheduleExpression ?? "\u2014",
|
|
9836
|
+
enabled: j.enabled ? "yes" : "no",
|
|
9837
|
+
next: fmtIso8(j.nextRunAt)
|
|
9838
|
+
})),
|
|
9839
|
+
[
|
|
9840
|
+
{ key: "id", header: "ID" },
|
|
9841
|
+
{ key: "name", header: "NAME" },
|
|
9842
|
+
{ key: "type", header: "TYPE" },
|
|
9843
|
+
{ key: "target", header: "TARGET" },
|
|
9844
|
+
{ key: "schedule", header: "SCHEDULE" },
|
|
9845
|
+
{ key: "enabled", header: "ON" },
|
|
9846
|
+
{ key: "next", header: "NEXT RUN" }
|
|
9847
|
+
]
|
|
9148
9848
|
);
|
|
9149
|
-
process.exit(2);
|
|
9150
9849
|
}
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
const
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
"
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
)
|
|
9179
|
-
|
|
9850
|
+
async function runSchedGet(id, opts) {
|
|
9851
|
+
const ctx = await resolveSchedContext(opts);
|
|
9852
|
+
const data = await gqlQuery(ctx.client, ScheduledJobDoc, { id });
|
|
9853
|
+
const j = data.scheduledJob;
|
|
9854
|
+
if (!j) {
|
|
9855
|
+
printError(`Scheduled job ${id} not found.`);
|
|
9856
|
+
process.exit(1);
|
|
9857
|
+
}
|
|
9858
|
+
if (isJsonMode()) {
|
|
9859
|
+
printJson(j);
|
|
9860
|
+
return;
|
|
9861
|
+
}
|
|
9862
|
+
printKeyValue([
|
|
9863
|
+
["ID", j.id],
|
|
9864
|
+
["Name", j.name],
|
|
9865
|
+
["Description", j.description ?? void 0],
|
|
9866
|
+
["Trigger type", j.triggerType],
|
|
9867
|
+
["Agent", j.agentId ?? void 0],
|
|
9868
|
+
["Routine", j.routineId ?? void 0],
|
|
9869
|
+
["Schedule", j.scheduleExpression ?? void 0],
|
|
9870
|
+
["Timezone", j.timezone],
|
|
9871
|
+
["Enabled", j.enabled ? "yes" : "no"],
|
|
9872
|
+
["EB rule", j.ebScheduleName ?? void 0],
|
|
9873
|
+
["Last run", fmtIso8(j.lastRunAt)],
|
|
9874
|
+
["Next run", fmtIso8(j.nextRunAt)],
|
|
9875
|
+
["Created", fmtIso8(j.createdAt)],
|
|
9876
|
+
["Updated", fmtIso8(j.updatedAt)]
|
|
9877
|
+
]);
|
|
9878
|
+
if (j.prompt) {
|
|
9879
|
+
console.log("\n Prompt:");
|
|
9880
|
+
console.log(` ${j.prompt.slice(0, 300)}${j.prompt.length > 300 ? "\u2026" : ""}`);
|
|
9881
|
+
}
|
|
9882
|
+
}
|
|
9883
|
+
async function runSchedCreate(name, opts) {
|
|
9884
|
+
const ctx = await resolveSchedContext(opts);
|
|
9885
|
+
let resolvedName = name;
|
|
9886
|
+
if (!resolvedName) {
|
|
9887
|
+
if (!isInteractive()) {
|
|
9888
|
+
printError("Job name required in non-interactive mode.");
|
|
9889
|
+
process.exit(1);
|
|
9890
|
+
}
|
|
9891
|
+
requireTty("Job name");
|
|
9892
|
+
resolvedName = await promptOrExit(() => input16({ message: "Job name:" }));
|
|
9893
|
+
}
|
|
9894
|
+
if (!opts.schedule) {
|
|
9895
|
+
printError('--schedule <expr> is required (e.g. "cron(0 9 * * ? *)" or "rate(1 hour)").');
|
|
9896
|
+
process.exit(1);
|
|
9897
|
+
}
|
|
9898
|
+
if (!opts.agent && !opts.routine) {
|
|
9899
|
+
printError("Either --agent <id> or --routine <id> is required.");
|
|
9900
|
+
process.exit(1);
|
|
9901
|
+
}
|
|
9902
|
+
let config = null;
|
|
9903
|
+
if (opts.payload) {
|
|
9904
|
+
try {
|
|
9905
|
+
config = JSON.parse(opts.payload);
|
|
9906
|
+
} catch (err) {
|
|
9907
|
+
printError(`--payload is not valid JSON: ${err.message}`);
|
|
9908
|
+
process.exit(1);
|
|
9909
|
+
}
|
|
9910
|
+
}
|
|
9911
|
+
const isCron = opts.schedule.trim().startsWith("cron(");
|
|
9912
|
+
const data = await gqlMutate(ctx.client, CreateScheduledJobDoc, {
|
|
9913
|
+
input: {
|
|
9914
|
+
tenantId: ctx.tenantId,
|
|
9915
|
+
triggerType: opts.routine ? "routine" : "agent",
|
|
9916
|
+
agentId: opts.agent ?? null,
|
|
9917
|
+
routineId: opts.routine ?? null,
|
|
9918
|
+
name: resolvedName,
|
|
9919
|
+
description: null,
|
|
9920
|
+
prompt: null,
|
|
9921
|
+
config,
|
|
9922
|
+
scheduleType: isCron ? "cron" : "rate",
|
|
9923
|
+
scheduleExpression: opts.schedule,
|
|
9924
|
+
timezone: opts.timezone ?? "UTC"
|
|
9925
|
+
}
|
|
9926
|
+
});
|
|
9927
|
+
if (isJsonMode()) {
|
|
9928
|
+
printJson(data.createScheduledJob);
|
|
9929
|
+
return;
|
|
9930
|
+
}
|
|
9931
|
+
printSuccess(
|
|
9932
|
+
`Created scheduled job ${data.createScheduledJob.id} \u2014 ${data.createScheduledJob.name} (${data.createScheduledJob.scheduleExpression}, ${data.createScheduledJob.timezone}).`
|
|
9933
|
+
);
|
|
9934
|
+
}
|
|
9935
|
+
function notYetImplementedAtApi(verb) {
|
|
9936
|
+
printError(
|
|
9937
|
+
`\`scheduled-job ${verb}\` is not yet implemented at the GraphQL API.
|
|
9938
|
+
The server only exposes scheduledJobs / scheduledJob / createScheduledJob today.
|
|
9939
|
+
Use the admin UI for update/delete/run operations; CLI parity is tracked as a Phase-3 follow-up.`
|
|
9940
|
+
);
|
|
9941
|
+
process.exit(2);
|
|
9180
9942
|
}
|
|
9181
|
-
|
|
9182
|
-
// src/commands/scheduled-job.ts
|
|
9183
9943
|
function registerScheduledJobCommand(program2) {
|
|
9184
9944
|
const job = program2.command("scheduled-job").alias("cron").description("Manage AWS-Scheduler-backed recurring agent jobs (wakeups on a cadence).");
|
|
9185
|
-
job.command("list").alias("ls").description("List scheduled jobs for the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--agent <id>", "Filter by agent").option("--routine <id>", "Filter by routine").option("--enabled <bool>", "true | false").action(
|
|
9186
|
-
job.command("get <id>").description("Fetch one scheduled job.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(
|
|
9187
|
-
job.command("create [name]").description("Create a new scheduled job. Supports cron() or rate() schedules.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--agent <id>", "Agent to wake up").option("--routine <id>", "Or: routine to trigger").option("--schedule <expr>", "EventBridge schedule (cron(\u2026) or rate(\u2026))").option("--timezone <tz>", "IANA timezone (default: UTC)", "UTC").option("--payload <json>", "Payload to pass to the agent/routine").option("--disabled", "Create in disabled state (
|
|
9945
|
+
job.command("list").alias("ls").description("List scheduled jobs for the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--agent <id>", "Filter by agent").option("--routine <id>", "Filter by routine").option("--enabled <bool>", "true | false").action(runSchedList);
|
|
9946
|
+
job.command("get <id>").description("Fetch one scheduled job.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runSchedGet);
|
|
9947
|
+
job.command("create [name]").description("Create a new scheduled job. Supports cron() or rate() schedules.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--agent <id>", "Agent to wake up").option("--routine <id>", "Or: routine to trigger").option("--schedule <expr>", "EventBridge schedule (cron(\u2026) or rate(\u2026))").option("--timezone <tz>", "IANA timezone (default: UTC)", "UTC").option("--payload <json>", "Payload to pass to the agent/routine (becomes the job's config)").option("--disabled", "Create in disabled state (currently honored at the resolver level only)").addHelpText(
|
|
9188
9948
|
"after",
|
|
9189
9949
|
`
|
|
9190
9950
|
Examples:
|
|
9191
9951
|
$ thinkwork scheduled-job create "Daily ops digest" \\
|
|
9192
9952
|
--agent agt-editor --schedule "cron(0 9 * * ? *)" --timezone America/New_York
|
|
9193
9953
|
|
|
9194
|
-
# rate() \u2014
|
|
9954
|
+
# rate() \u2014 "every N time from creation", NOT wall-clock.
|
|
9195
9955
|
$ thinkwork scheduled-job create "Hourly check" --agent agt-check --schedule "rate(1 hour)"
|
|
9196
9956
|
`
|
|
9197
|
-
).action(
|
|
9198
|
-
job.command("update <id>").description("Update a scheduled job
|
|
9199
|
-
job.command("delete <id>").description("Delete a scheduled job.
|
|
9200
|
-
job.command("run <id>").description("Trigger a scheduled job immediately (
|
|
9957
|
+
).action(runSchedCreate);
|
|
9958
|
+
job.command("update <id>").description("Update a scheduled job. (API surface pending \u2014 currently a no-op.)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--schedule <expr>").option("--timezone <tz>").option("--payload <json>").option("--enable").option("--disable").action(() => notYetImplementedAtApi("update"));
|
|
9959
|
+
job.command("delete <id>").description("Delete a scheduled job. (API surface pending.)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(() => notYetImplementedAtApi("delete"));
|
|
9960
|
+
job.command("run <id>").description("Trigger a scheduled job immediately. (API surface pending.)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--wait", "Block until the run completes").action(() => notYetImplementedAtApi("run"));
|
|
9201
9961
|
}
|
|
9202
9962
|
|
|
9203
9963
|
// src/commands/turn.ts
|
|
9964
|
+
import { confirm as confirm12 } from "@inquirer/prompts";
|
|
9965
|
+
var ThreadTurnsDoc = graphql(`
|
|
9966
|
+
query CliThreadTurns(
|
|
9967
|
+
$tenantId: ID!
|
|
9968
|
+
$agentId: ID
|
|
9969
|
+
$routineId: ID
|
|
9970
|
+
$triggerId: ID
|
|
9971
|
+
$threadId: ID
|
|
9972
|
+
$status: String
|
|
9973
|
+
$limit: Int
|
|
9974
|
+
) {
|
|
9975
|
+
threadTurns(
|
|
9976
|
+
tenantId: $tenantId
|
|
9977
|
+
agentId: $agentId
|
|
9978
|
+
routineId: $routineId
|
|
9979
|
+
triggerId: $triggerId
|
|
9980
|
+
threadId: $threadId
|
|
9981
|
+
status: $status
|
|
9982
|
+
limit: $limit
|
|
9983
|
+
) {
|
|
9984
|
+
id
|
|
9985
|
+
agentId
|
|
9986
|
+
routineId
|
|
9987
|
+
threadId
|
|
9988
|
+
status
|
|
9989
|
+
invocationSource
|
|
9990
|
+
triggerName
|
|
9991
|
+
startedAt
|
|
9992
|
+
finishedAt
|
|
9993
|
+
totalCost
|
|
9994
|
+
error
|
|
9995
|
+
}
|
|
9996
|
+
}
|
|
9997
|
+
`);
|
|
9998
|
+
var ThreadTurnDoc = graphql(`
|
|
9999
|
+
query CliThreadTurn($id: ID!) {
|
|
10000
|
+
threadTurn(id: $id) {
|
|
10001
|
+
id
|
|
10002
|
+
tenantId
|
|
10003
|
+
agentId
|
|
10004
|
+
routineId
|
|
10005
|
+
threadId
|
|
10006
|
+
turnNumber
|
|
10007
|
+
status
|
|
10008
|
+
invocationSource
|
|
10009
|
+
triggerName
|
|
10010
|
+
triggerDetail
|
|
10011
|
+
startedAt
|
|
10012
|
+
finishedAt
|
|
10013
|
+
error
|
|
10014
|
+
errorCode
|
|
10015
|
+
totalCost
|
|
10016
|
+
lastActivityAt
|
|
10017
|
+
retryAttempt
|
|
10018
|
+
externalRunId
|
|
10019
|
+
sessionIdBefore
|
|
10020
|
+
sessionIdAfter
|
|
10021
|
+
createdAt
|
|
10022
|
+
}
|
|
10023
|
+
}
|
|
10024
|
+
`);
|
|
10025
|
+
var ThreadTurnEventsDoc = graphql(`
|
|
10026
|
+
query CliThreadTurnEvents($runId: ID!, $limit: Int) {
|
|
10027
|
+
threadTurnEvents(runId: $runId, limit: $limit) {
|
|
10028
|
+
seq
|
|
10029
|
+
eventType
|
|
10030
|
+
stream
|
|
10031
|
+
level
|
|
10032
|
+
message
|
|
10033
|
+
createdAt
|
|
10034
|
+
}
|
|
10035
|
+
}
|
|
10036
|
+
`);
|
|
10037
|
+
var CancelThreadTurnDoc = graphql(`
|
|
10038
|
+
mutation CliCancelThreadTurn($id: ID!) {
|
|
10039
|
+
cancelThreadTurn(id: $id) {
|
|
10040
|
+
id
|
|
10041
|
+
status
|
|
10042
|
+
finishedAt
|
|
10043
|
+
}
|
|
10044
|
+
}
|
|
10045
|
+
`);
|
|
10046
|
+
var TurnTenantBySlugDoc = graphql(`
|
|
10047
|
+
query CliTurnTenantBySlug($slug: String!) {
|
|
10048
|
+
tenantBySlug(slug: $slug) {
|
|
10049
|
+
id
|
|
10050
|
+
}
|
|
10051
|
+
}
|
|
10052
|
+
`);
|
|
10053
|
+
async function resolveTurnContext(opts) {
|
|
10054
|
+
const region = opts.region ?? "us-east-1";
|
|
10055
|
+
const stage = await resolveStage({ flag: opts.stage, region });
|
|
10056
|
+
const session = loadStageSession(stage);
|
|
10057
|
+
const { client, tenantSlug: ctxSlug } = await getGqlClient({ stage, region });
|
|
10058
|
+
const flagOrEnv = opts.tenant ?? process.env.THINKWORK_TENANT;
|
|
10059
|
+
if (flagOrEnv) {
|
|
10060
|
+
if (session?.tenantSlug === flagOrEnv && session.tenantId) {
|
|
10061
|
+
return { stage, region, client, tenantId: session.tenantId };
|
|
10062
|
+
}
|
|
10063
|
+
const data = await gqlQuery(client, TurnTenantBySlugDoc, { slug: flagOrEnv });
|
|
10064
|
+
if (!data.tenantBySlug) {
|
|
10065
|
+
printError(`Tenant "${flagOrEnv}" not found.`);
|
|
10066
|
+
process.exit(1);
|
|
10067
|
+
}
|
|
10068
|
+
return { stage, region, client, tenantId: data.tenantBySlug.id };
|
|
10069
|
+
}
|
|
10070
|
+
if (session?.tenantId) return { stage, region, client, tenantId: session.tenantId };
|
|
10071
|
+
if (ctxSlug) {
|
|
10072
|
+
const data = await gqlQuery(client, TurnTenantBySlugDoc, { slug: ctxSlug });
|
|
10073
|
+
if (data.tenantBySlug) return { stage, region, client, tenantId: data.tenantBySlug.id };
|
|
10074
|
+
}
|
|
10075
|
+
printMissingApiSessionError(stage, session !== null);
|
|
10076
|
+
process.exit(1);
|
|
10077
|
+
}
|
|
10078
|
+
function fmtIso9(iso) {
|
|
10079
|
+
if (!iso) return "\u2014";
|
|
10080
|
+
const d = new Date(iso);
|
|
10081
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
10082
|
+
return d.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
10083
|
+
}
|
|
10084
|
+
async function runTurnList(opts) {
|
|
10085
|
+
const ctx = await resolveTurnContext(opts);
|
|
10086
|
+
const data = await gqlQuery(ctx.client, ThreadTurnsDoc, {
|
|
10087
|
+
tenantId: ctx.tenantId,
|
|
10088
|
+
agentId: opts.agent ?? null,
|
|
10089
|
+
routineId: opts.routine ?? null,
|
|
10090
|
+
triggerId: opts.trigger ?? null,
|
|
10091
|
+
threadId: opts.thread ?? null,
|
|
10092
|
+
status: opts.status ?? null,
|
|
10093
|
+
limit: opts.limit ? Number.parseInt(opts.limit, 10) : 50
|
|
10094
|
+
});
|
|
10095
|
+
const items = data.threadTurns ?? [];
|
|
10096
|
+
if (isJsonMode()) {
|
|
10097
|
+
printJson({ items });
|
|
10098
|
+
return;
|
|
10099
|
+
}
|
|
10100
|
+
printTable(
|
|
10101
|
+
items.map((t) => ({
|
|
10102
|
+
id: t.id,
|
|
10103
|
+
status: t.status,
|
|
10104
|
+
agent: t.agentId ?? "\u2014",
|
|
10105
|
+
source: t.invocationSource,
|
|
10106
|
+
trigger: t.triggerName ?? "\u2014",
|
|
10107
|
+
started: fmtIso9(t.startedAt),
|
|
10108
|
+
cost: t.totalCost != null ? `$${t.totalCost.toFixed(4)}` : "\u2014"
|
|
10109
|
+
})),
|
|
10110
|
+
[
|
|
10111
|
+
{ key: "id", header: "TURN ID" },
|
|
10112
|
+
{ key: "status", header: "STATUS" },
|
|
10113
|
+
{ key: "agent", header: "AGENT" },
|
|
10114
|
+
{ key: "source", header: "SOURCE" },
|
|
10115
|
+
{ key: "trigger", header: "TRIGGER" },
|
|
10116
|
+
{ key: "started", header: "STARTED" },
|
|
10117
|
+
{ key: "cost", header: "COST" }
|
|
10118
|
+
]
|
|
10119
|
+
);
|
|
10120
|
+
}
|
|
10121
|
+
async function runTurnGet(id, opts) {
|
|
10122
|
+
const ctx = await resolveTurnContext(opts);
|
|
10123
|
+
const data = await gqlQuery(ctx.client, ThreadTurnDoc, { id });
|
|
10124
|
+
const t = data.threadTurn;
|
|
10125
|
+
if (!t) {
|
|
10126
|
+
printError(`Thread turn ${id} not found.`);
|
|
10127
|
+
process.exit(1);
|
|
10128
|
+
}
|
|
10129
|
+
const ev = await gqlQuery(ctx.client, ThreadTurnEventsDoc, { runId: id, limit: 50 });
|
|
10130
|
+
if (isJsonMode()) {
|
|
10131
|
+
printJson({ turn: t, events: ev.threadTurnEvents ?? [] });
|
|
10132
|
+
return;
|
|
10133
|
+
}
|
|
10134
|
+
printKeyValue([
|
|
10135
|
+
["ID", t.id],
|
|
10136
|
+
["Status", t.status],
|
|
10137
|
+
["Agent", t.agentId ?? void 0],
|
|
10138
|
+
["Routine", t.routineId ?? void 0],
|
|
10139
|
+
["Thread", t.threadId ?? void 0],
|
|
10140
|
+
["Turn number", t.turnNumber ?? void 0],
|
|
10141
|
+
["Source", t.invocationSource],
|
|
10142
|
+
["Trigger", t.triggerName ?? void 0],
|
|
10143
|
+
["Started", fmtIso9(t.startedAt)],
|
|
10144
|
+
["Finished", fmtIso9(t.finishedAt)],
|
|
10145
|
+
["Total cost", t.totalCost != null ? `$${t.totalCost.toFixed(4)}` : void 0],
|
|
10146
|
+
["Retries", t.retryAttempt ?? void 0],
|
|
10147
|
+
["Error", t.error ?? void 0],
|
|
10148
|
+
["Error code", t.errorCode ?? void 0]
|
|
10149
|
+
]);
|
|
10150
|
+
const events = ev.threadTurnEvents ?? [];
|
|
10151
|
+
if (events.length > 0) {
|
|
10152
|
+
console.log("\n Events:");
|
|
10153
|
+
printTable(
|
|
10154
|
+
events.slice(0, 20).map((e) => ({
|
|
10155
|
+
seq: String(e.seq),
|
|
10156
|
+
type: e.eventType,
|
|
10157
|
+
level: e.level ?? "\u2014",
|
|
10158
|
+
message: (e.message ?? "").slice(0, 80)
|
|
10159
|
+
})),
|
|
10160
|
+
[
|
|
10161
|
+
{ key: "seq", header: "SEQ" },
|
|
10162
|
+
{ key: "type", header: "TYPE" },
|
|
10163
|
+
{ key: "level", header: "LEVEL" },
|
|
10164
|
+
{ key: "message", header: "MESSAGE" }
|
|
10165
|
+
]
|
|
10166
|
+
);
|
|
10167
|
+
}
|
|
10168
|
+
}
|
|
10169
|
+
async function runTurnCancel(id, opts) {
|
|
10170
|
+
const ctx = await resolveTurnContext(opts);
|
|
10171
|
+
if (!opts.yes) {
|
|
10172
|
+
if (!isInteractive()) {
|
|
10173
|
+
printError("Refusing to cancel without --yes in a non-interactive session.");
|
|
10174
|
+
process.exit(1);
|
|
10175
|
+
}
|
|
10176
|
+
requireTty("Confirmation");
|
|
10177
|
+
const go = await promptOrExit(
|
|
10178
|
+
() => confirm12({ message: `Cancel thread turn ${id}?`, default: false })
|
|
10179
|
+
);
|
|
10180
|
+
if (!go) {
|
|
10181
|
+
logStderr("Cancelled.");
|
|
10182
|
+
process.exit(0);
|
|
10183
|
+
}
|
|
10184
|
+
}
|
|
10185
|
+
const data = await gqlMutate(ctx.client, CancelThreadTurnDoc, { id });
|
|
10186
|
+
if (isJsonMode()) {
|
|
10187
|
+
printJson(data.cancelThreadTurn);
|
|
10188
|
+
return;
|
|
10189
|
+
}
|
|
10190
|
+
printSuccess(`Cancelled turn ${data.cancelThreadTurn.id} (status: ${data.cancelThreadTurn.status}).`);
|
|
10191
|
+
}
|
|
9204
10192
|
function registerTurnCommand(program2) {
|
|
9205
10193
|
const turn = program2.command("turn").alias("turns").description("Inspect and cancel agent invocations (thread turns).");
|
|
9206
10194
|
turn.command("list").alias("ls").description("List recent thread turns across the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--agent <id>", "Filter by agent").option("--routine <id>", "Filter by routine").option("--trigger <id>", "Filter by trigger ID").option("--thread <id>", "Filter by thread").option("--status <s>", "QUEUED | RUNNING | SUCCEEDED | FAILED | CANCELLED").option("--limit <n>", "Max rows", "50").addHelpText(
|
|
9207
10195
|
"after",
|
|
9208
10196
|
`
|
|
9209
10197
|
Examples:
|
|
9210
|
-
# What's running right now?
|
|
9211
10198
|
$ thinkwork turn list --status RUNNING
|
|
9212
|
-
|
|
9213
|
-
# Recent failures for one agent
|
|
9214
10199
|
$ thinkwork turn list --agent agt-ops --status FAILED --limit 20
|
|
9215
10200
|
`
|
|
9216
|
-
).action(
|
|
9217
|
-
turn.command("get <id>").description("Fetch one thread turn with its event stream.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(
|
|
9218
|
-
turn.command("cancel <id>").description("Cancel an in-progress thread turn. No-op if already finished.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(
|
|
10201
|
+
).action(runTurnList);
|
|
10202
|
+
turn.command("get <id>").description("Fetch one thread turn with its event stream.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runTurnGet);
|
|
10203
|
+
turn.command("cancel <id>").description("Cancel an in-progress thread turn. No-op if already finished.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(runTurnCancel);
|
|
10204
|
+
}
|
|
10205
|
+
|
|
10206
|
+
// src/commands/wakeup.ts
|
|
10207
|
+
var QueuedWakeupsDoc = graphql(`
|
|
10208
|
+
query CliQueuedWakeups($tenantId: ID!) {
|
|
10209
|
+
queuedWakeups(tenantId: $tenantId) {
|
|
10210
|
+
id
|
|
10211
|
+
agentId
|
|
10212
|
+
status
|
|
10213
|
+
source
|
|
10214
|
+
triggerDetail
|
|
10215
|
+
reason
|
|
10216
|
+
coalescedCount
|
|
10217
|
+
requestedAt
|
|
10218
|
+
claimedAt
|
|
10219
|
+
}
|
|
10220
|
+
}
|
|
10221
|
+
`);
|
|
10222
|
+
var CreateWakeupDoc = graphql(`
|
|
10223
|
+
mutation CliCreateWakeup($input: CreateWakeupRequestInput!) {
|
|
10224
|
+
createWakeupRequest(input: $input) {
|
|
10225
|
+
id
|
|
10226
|
+
agentId
|
|
10227
|
+
status
|
|
10228
|
+
requestedAt
|
|
10229
|
+
}
|
|
10230
|
+
}
|
|
10231
|
+
`);
|
|
10232
|
+
var WakeupTenantBySlugDoc = graphql(`
|
|
10233
|
+
query CliWakeupTenantBySlug($slug: String!) {
|
|
10234
|
+
tenantBySlug(slug: $slug) {
|
|
10235
|
+
id
|
|
10236
|
+
}
|
|
10237
|
+
}
|
|
10238
|
+
`);
|
|
10239
|
+
async function resolveWakeupContext(opts) {
|
|
10240
|
+
const region = opts.region ?? "us-east-1";
|
|
10241
|
+
const stage = await resolveStage({ flag: opts.stage, region });
|
|
10242
|
+
const session = loadStageSession(stage);
|
|
10243
|
+
const { client, tenantSlug: ctxSlug } = await getGqlClient({ stage, region });
|
|
10244
|
+
const flagOrEnv = opts.tenant ?? process.env.THINKWORK_TENANT;
|
|
10245
|
+
if (flagOrEnv) {
|
|
10246
|
+
if (session?.tenantSlug === flagOrEnv && session.tenantId) {
|
|
10247
|
+
return { stage, region, client, tenantId: session.tenantId };
|
|
10248
|
+
}
|
|
10249
|
+
const data = await gqlQuery(client, WakeupTenantBySlugDoc, { slug: flagOrEnv });
|
|
10250
|
+
if (!data.tenantBySlug) {
|
|
10251
|
+
printError(`Tenant "${flagOrEnv}" not found.`);
|
|
10252
|
+
process.exit(1);
|
|
10253
|
+
}
|
|
10254
|
+
return { stage, region, client, tenantId: data.tenantBySlug.id };
|
|
10255
|
+
}
|
|
10256
|
+
if (session?.tenantId) return { stage, region, client, tenantId: session.tenantId };
|
|
10257
|
+
if (ctxSlug) {
|
|
10258
|
+
const data = await gqlQuery(client, WakeupTenantBySlugDoc, { slug: ctxSlug });
|
|
10259
|
+
if (data.tenantBySlug) return { stage, region, client, tenantId: data.tenantBySlug.id };
|
|
10260
|
+
}
|
|
10261
|
+
printMissingApiSessionError(stage, session !== null);
|
|
10262
|
+
process.exit(1);
|
|
10263
|
+
}
|
|
10264
|
+
function fmtIso10(iso) {
|
|
10265
|
+
if (!iso) return "\u2014";
|
|
10266
|
+
const d = new Date(iso);
|
|
10267
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
10268
|
+
return d.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
10269
|
+
}
|
|
10270
|
+
async function runWakeupList(opts) {
|
|
10271
|
+
const ctx = await resolveWakeupContext(opts);
|
|
10272
|
+
const data = await gqlQuery(ctx.client, QueuedWakeupsDoc, { tenantId: ctx.tenantId });
|
|
10273
|
+
const items = data.queuedWakeups ?? [];
|
|
10274
|
+
if (isJsonMode()) {
|
|
10275
|
+
printJson({ items });
|
|
10276
|
+
return;
|
|
10277
|
+
}
|
|
10278
|
+
printTable(
|
|
10279
|
+
items.map((w) => ({
|
|
10280
|
+
id: w.id,
|
|
10281
|
+
agent: w.agentId,
|
|
10282
|
+
status: w.status,
|
|
10283
|
+
source: w.source,
|
|
10284
|
+
coalesced: String(w.coalescedCount),
|
|
10285
|
+
requested: fmtIso10(w.requestedAt)
|
|
10286
|
+
})),
|
|
10287
|
+
[
|
|
10288
|
+
{ key: "id", header: "WAKEUP ID" },
|
|
10289
|
+
{ key: "agent", header: "AGENT" },
|
|
10290
|
+
{ key: "status", header: "STATUS" },
|
|
10291
|
+
{ key: "source", header: "SOURCE" },
|
|
10292
|
+
{ key: "coalesced", header: "COALESCED" },
|
|
10293
|
+
{ key: "requested", header: "REQUESTED" }
|
|
10294
|
+
]
|
|
10295
|
+
);
|
|
10296
|
+
}
|
|
10297
|
+
async function runWakeupCreate(opts) {
|
|
10298
|
+
const ctx = await resolveWakeupContext(opts);
|
|
10299
|
+
if (!opts.agent) {
|
|
10300
|
+
printError("--agent <id> is required.");
|
|
10301
|
+
process.exit(1);
|
|
10302
|
+
}
|
|
10303
|
+
let payload = null;
|
|
10304
|
+
if (opts.payload) {
|
|
10305
|
+
try {
|
|
10306
|
+
payload = JSON.parse(opts.payload);
|
|
10307
|
+
} catch (err) {
|
|
10308
|
+
printError(`--payload is not valid JSON: ${err.message}`);
|
|
10309
|
+
process.exit(1);
|
|
10310
|
+
}
|
|
10311
|
+
}
|
|
10312
|
+
if (opts.delaySeconds && opts.delaySeconds !== "0") {
|
|
10313
|
+
printWarning(
|
|
10314
|
+
"--delay-seconds is not currently honored by the API (no delay field on CreateWakeupRequestInput). The wakeup will fire immediately."
|
|
10315
|
+
);
|
|
10316
|
+
}
|
|
10317
|
+
const data = await gqlMutate(ctx.client, CreateWakeupDoc, {
|
|
10318
|
+
input: {
|
|
10319
|
+
tenantId: ctx.tenantId,
|
|
10320
|
+
agentId: opts.agent,
|
|
10321
|
+
source: "cli",
|
|
10322
|
+
triggerDetail: opts.thread ?? null,
|
|
10323
|
+
payload
|
|
10324
|
+
}
|
|
10325
|
+
});
|
|
10326
|
+
if (isJsonMode()) {
|
|
10327
|
+
printJson(data.createWakeupRequest);
|
|
10328
|
+
return;
|
|
10329
|
+
}
|
|
10330
|
+
printSuccess(
|
|
10331
|
+
`Queued wakeup ${data.createWakeupRequest.id} for agent ${data.createWakeupRequest.agentId} (status: ${data.createWakeupRequest.status}).`
|
|
10332
|
+
);
|
|
9219
10333
|
}
|
|
9220
|
-
|
|
9221
|
-
// src/commands/wakeup.ts
|
|
9222
10334
|
function registerWakeupCommand(program2) {
|
|
9223
10335
|
const wake = program2.command("wakeup").alias("wakeups").description("View and create agent wakeup requests (deferred/enqueued invocations).");
|
|
9224
|
-
wake.command("list").alias("ls").description("List queued wakeups in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(
|
|
9225
|
-
wake.command("create").description("Queue a wakeup for an agent
|
|
10336
|
+
wake.command("list").alias("ls").description("List queued wakeups in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runWakeupList);
|
|
10337
|
+
wake.command("create").description("Queue a wakeup for an agent.").option("--agent <id>", "Target agent").option("--thread <id>", "Thread to operate on (optional)").option("--delay-seconds <n>", "Currently a no-op; the API has no delay field", "0").option("--payload <json>", "Optional input payload").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").addHelpText(
|
|
9226
10338
|
"after",
|
|
9227
10339
|
`
|
|
9228
10340
|
Examples:
|
|
9229
10341
|
$ thinkwork wakeup create --agent agt-ops --thread thr-abc
|
|
9230
|
-
$ thinkwork wakeup create --agent agt-ops --
|
|
10342
|
+
$ thinkwork wakeup create --agent agt-ops --payload '{"task":"summarize"}'
|
|
9231
10343
|
`
|
|
9232
|
-
).action(
|
|
10344
|
+
).action(runWakeupCreate);
|
|
9233
10345
|
}
|
|
9234
10346
|
|
|
9235
10347
|
// src/commands/webhook.ts
|
|
10348
|
+
import { confirm as confirm13, input as input17 } from "@inquirer/prompts";
|
|
10349
|
+
var WebhooksDoc = graphql(`
|
|
10350
|
+
query CliWebhooks($tenantId: ID!, $targetType: String, $enabled: Boolean, $limit: Int) {
|
|
10351
|
+
webhooks(tenantId: $tenantId, targetType: $targetType, enabled: $enabled, limit: $limit) {
|
|
10352
|
+
id
|
|
10353
|
+
name
|
|
10354
|
+
targetType
|
|
10355
|
+
agentId
|
|
10356
|
+
routineId
|
|
10357
|
+
enabled
|
|
10358
|
+
rateLimit
|
|
10359
|
+
invocationCount
|
|
10360
|
+
lastInvokedAt
|
|
10361
|
+
createdAt
|
|
10362
|
+
}
|
|
10363
|
+
}
|
|
10364
|
+
`);
|
|
10365
|
+
var WebhookDoc = graphql(`
|
|
10366
|
+
query CliWebhook($id: ID!) {
|
|
10367
|
+
webhook(id: $id) {
|
|
10368
|
+
id
|
|
10369
|
+
name
|
|
10370
|
+
description
|
|
10371
|
+
token
|
|
10372
|
+
targetType
|
|
10373
|
+
agentId
|
|
10374
|
+
routineId
|
|
10375
|
+
prompt
|
|
10376
|
+
enabled
|
|
10377
|
+
rateLimit
|
|
10378
|
+
invocationCount
|
|
10379
|
+
lastInvokedAt
|
|
10380
|
+
createdAt
|
|
10381
|
+
updatedAt
|
|
10382
|
+
}
|
|
10383
|
+
}
|
|
10384
|
+
`);
|
|
10385
|
+
var CreateWebhookDoc = graphql(`
|
|
10386
|
+
mutation CliCreateWebhook($input: CreateWebhookInput!) {
|
|
10387
|
+
createWebhook(input: $input) {
|
|
10388
|
+
id
|
|
10389
|
+
name
|
|
10390
|
+
token
|
|
10391
|
+
targetType
|
|
10392
|
+
enabled
|
|
10393
|
+
}
|
|
10394
|
+
}
|
|
10395
|
+
`);
|
|
10396
|
+
var UpdateWebhookDoc = graphql(`
|
|
10397
|
+
mutation CliUpdateWebhook($id: ID!, $input: UpdateWebhookInput!) {
|
|
10398
|
+
updateWebhook(id: $id, input: $input) {
|
|
10399
|
+
id
|
|
10400
|
+
name
|
|
10401
|
+
targetType
|
|
10402
|
+
enabled
|
|
10403
|
+
rateLimit
|
|
10404
|
+
}
|
|
10405
|
+
}
|
|
10406
|
+
`);
|
|
10407
|
+
var DeleteWebhookDoc = graphql(`
|
|
10408
|
+
mutation CliDeleteWebhook($id: ID!) {
|
|
10409
|
+
deleteWebhook(id: $id)
|
|
10410
|
+
}
|
|
10411
|
+
`);
|
|
10412
|
+
var RegenerateWebhookTokenDoc = graphql(`
|
|
10413
|
+
mutation CliRegenerateWebhookToken($id: ID!) {
|
|
10414
|
+
regenerateWebhookToken(id: $id) {
|
|
10415
|
+
id
|
|
10416
|
+
token
|
|
10417
|
+
}
|
|
10418
|
+
}
|
|
10419
|
+
`);
|
|
10420
|
+
var WebhookTenantBySlugDoc = graphql(`
|
|
10421
|
+
query CliWebhookTenantBySlug($slug: String!) {
|
|
10422
|
+
tenantBySlug(slug: $slug) {
|
|
10423
|
+
id
|
|
10424
|
+
}
|
|
10425
|
+
}
|
|
10426
|
+
`);
|
|
10427
|
+
async function resolveWebhookContext(opts) {
|
|
10428
|
+
const region = opts.region ?? "us-east-1";
|
|
10429
|
+
const stage = await resolveStage({ flag: opts.stage, region });
|
|
10430
|
+
const session = loadStageSession(stage);
|
|
10431
|
+
const { client, tenantSlug: ctxSlug } = await getGqlClient({ stage, region });
|
|
10432
|
+
const flagOrEnv = opts.tenant ?? process.env.THINKWORK_TENANT;
|
|
10433
|
+
if (flagOrEnv) {
|
|
10434
|
+
if (session?.tenantSlug === flagOrEnv && session.tenantId) {
|
|
10435
|
+
return { stage, region, client, tenantId: session.tenantId };
|
|
10436
|
+
}
|
|
10437
|
+
const data = await gqlQuery(client, WebhookTenantBySlugDoc, { slug: flagOrEnv });
|
|
10438
|
+
if (!data.tenantBySlug) {
|
|
10439
|
+
printError(`Tenant "${flagOrEnv}" not found.`);
|
|
10440
|
+
process.exit(1);
|
|
10441
|
+
}
|
|
10442
|
+
return { stage, region, client, tenantId: data.tenantBySlug.id };
|
|
10443
|
+
}
|
|
10444
|
+
if (session?.tenantId) return { stage, region, client, tenantId: session.tenantId };
|
|
10445
|
+
if (ctxSlug) {
|
|
10446
|
+
const data = await gqlQuery(client, WebhookTenantBySlugDoc, { slug: ctxSlug });
|
|
10447
|
+
if (data.tenantBySlug) return { stage, region, client, tenantId: data.tenantBySlug.id };
|
|
10448
|
+
}
|
|
10449
|
+
printMissingApiSessionError(stage, session !== null);
|
|
10450
|
+
process.exit(1);
|
|
10451
|
+
}
|
|
10452
|
+
function fmtIso11(iso) {
|
|
10453
|
+
if (!iso) return "\u2014";
|
|
10454
|
+
const d = new Date(iso);
|
|
10455
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
10456
|
+
return d.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
10457
|
+
}
|
|
10458
|
+
async function runWebhookList(opts) {
|
|
10459
|
+
const ctx = await resolveWebhookContext(opts);
|
|
10460
|
+
const enabled = opts.enabled === void 0 ? null : opts.enabled === "true";
|
|
10461
|
+
const data = await gqlQuery(ctx.client, WebhooksDoc, {
|
|
10462
|
+
tenantId: ctx.tenantId,
|
|
10463
|
+
targetType: opts.targetType ?? null,
|
|
10464
|
+
enabled,
|
|
10465
|
+
limit: 100
|
|
10466
|
+
});
|
|
10467
|
+
const items = data.webhooks ?? [];
|
|
10468
|
+
if (isJsonMode()) {
|
|
10469
|
+
printJson({ items });
|
|
10470
|
+
return;
|
|
10471
|
+
}
|
|
10472
|
+
printTable(
|
|
10473
|
+
items.map((w) => ({
|
|
10474
|
+
id: w.id,
|
|
10475
|
+
name: w.name,
|
|
10476
|
+
target: `${w.targetType}:${(w.agentId ?? w.routineId ?? "\u2014").slice(0, 8)}`,
|
|
10477
|
+
enabled: w.enabled ? "yes" : "no",
|
|
10478
|
+
rateLimit: w.rateLimit != null ? `${w.rateLimit}/min` : "\u2014",
|
|
10479
|
+
invocations: String(w.invocationCount),
|
|
10480
|
+
lastInvoked: fmtIso11(w.lastInvokedAt)
|
|
10481
|
+
})),
|
|
10482
|
+
[
|
|
10483
|
+
{ key: "id", header: "ID" },
|
|
10484
|
+
{ key: "name", header: "NAME" },
|
|
10485
|
+
{ key: "target", header: "TARGET" },
|
|
10486
|
+
{ key: "enabled", header: "ON" },
|
|
10487
|
+
{ key: "rateLimit", header: "LIMIT" },
|
|
10488
|
+
{ key: "invocations", header: "CALLS" },
|
|
10489
|
+
{ key: "lastInvoked", header: "LAST" }
|
|
10490
|
+
]
|
|
10491
|
+
);
|
|
10492
|
+
}
|
|
10493
|
+
async function runWebhookGet(id, opts) {
|
|
10494
|
+
const ctx = await resolveWebhookContext(opts);
|
|
10495
|
+
const data = await gqlQuery(ctx.client, WebhookDoc, { id });
|
|
10496
|
+
const w = data.webhook;
|
|
10497
|
+
if (!w) {
|
|
10498
|
+
printError(`Webhook ${id} not found.`);
|
|
10499
|
+
process.exit(1);
|
|
10500
|
+
}
|
|
10501
|
+
if (isJsonMode()) {
|
|
10502
|
+
printJson(w);
|
|
10503
|
+
return;
|
|
10504
|
+
}
|
|
10505
|
+
printKeyValue([
|
|
10506
|
+
["ID", w.id],
|
|
10507
|
+
["Name", w.name],
|
|
10508
|
+
["Description", w.description ?? void 0],
|
|
10509
|
+
["Token (prefix)", `${w.token.slice(0, 12)}\u2026`],
|
|
10510
|
+
["Target type", w.targetType],
|
|
10511
|
+
["Target ID", w.agentId ?? w.routineId ?? void 0],
|
|
10512
|
+
["Enabled", w.enabled ? "yes" : "no"],
|
|
10513
|
+
["Rate limit", w.rateLimit != null ? `${w.rateLimit}/min` : void 0],
|
|
10514
|
+
["Invocations", String(w.invocationCount)],
|
|
10515
|
+
["Last invoked", fmtIso11(w.lastInvokedAt)],
|
|
10516
|
+
["Created", fmtIso11(w.createdAt)],
|
|
10517
|
+
["Updated", fmtIso11(w.updatedAt)]
|
|
10518
|
+
]);
|
|
10519
|
+
if (w.prompt) {
|
|
10520
|
+
console.log("\n Prompt:");
|
|
10521
|
+
console.log(` ${w.prompt.slice(0, 200)}${w.prompt.length > 200 ? "\u2026" : ""}`);
|
|
10522
|
+
}
|
|
10523
|
+
}
|
|
10524
|
+
async function runWebhookCreate(name, opts) {
|
|
10525
|
+
const ctx = await resolveWebhookContext(opts);
|
|
10526
|
+
let resolvedName = name;
|
|
10527
|
+
if (!resolvedName) {
|
|
10528
|
+
if (!isInteractive()) {
|
|
10529
|
+
printError("Webhook name required in non-interactive mode.");
|
|
10530
|
+
process.exit(1);
|
|
10531
|
+
}
|
|
10532
|
+
requireTty("Webhook name");
|
|
10533
|
+
resolvedName = await promptOrExit(() => input17({ message: "Webhook name:" }));
|
|
10534
|
+
}
|
|
10535
|
+
if (!opts.targetType) {
|
|
10536
|
+
printError("--target-type <AGENT|ROUTINE> is required.");
|
|
10537
|
+
process.exit(1);
|
|
10538
|
+
}
|
|
10539
|
+
if (!opts.targetId) {
|
|
10540
|
+
printError("--target-id <id> is required.");
|
|
10541
|
+
process.exit(1);
|
|
10542
|
+
}
|
|
10543
|
+
const targetType = opts.targetType.toUpperCase();
|
|
10544
|
+
if (!["AGENT", "ROUTINE"].includes(targetType)) {
|
|
10545
|
+
printError(`--target-type "${opts.targetType}" must be AGENT or ROUTINE.`);
|
|
10546
|
+
process.exit(1);
|
|
10547
|
+
}
|
|
10548
|
+
const data = await gqlMutate(ctx.client, CreateWebhookDoc, {
|
|
10549
|
+
input: {
|
|
10550
|
+
tenantId: ctx.tenantId,
|
|
10551
|
+
name: resolvedName,
|
|
10552
|
+
targetType,
|
|
10553
|
+
agentId: targetType === "AGENT" ? opts.targetId : null,
|
|
10554
|
+
routineId: targetType === "ROUTINE" ? opts.targetId : null,
|
|
10555
|
+
rateLimit: opts.rateLimit ? Number.parseInt(opts.rateLimit, 10) : null
|
|
10556
|
+
}
|
|
10557
|
+
});
|
|
10558
|
+
const wh = data.createWebhook;
|
|
10559
|
+
if (isJsonMode()) {
|
|
10560
|
+
printJson(wh);
|
|
10561
|
+
return;
|
|
10562
|
+
}
|
|
10563
|
+
printSuccess(`Created webhook ${wh.id} \u2014 ${wh.name}.`);
|
|
10564
|
+
console.log("");
|
|
10565
|
+
console.log(" Token (SAVE THIS \u2014 used in the inbound URL):");
|
|
10566
|
+
console.log(` ${wh.token}`);
|
|
10567
|
+
}
|
|
10568
|
+
async function runWebhookUpdate(id, opts) {
|
|
10569
|
+
const ctx = await resolveWebhookContext(opts);
|
|
10570
|
+
const input19 = {};
|
|
10571
|
+
if (opts.targetType !== void 0) input19.targetType = opts.targetType.toUpperCase();
|
|
10572
|
+
if (opts.targetId !== void 0) {
|
|
10573
|
+
const tt = (opts.targetType ?? "").toUpperCase();
|
|
10574
|
+
if (tt === "AGENT") input19.agentId = opts.targetId;
|
|
10575
|
+
else if (tt === "ROUTINE") input19.routineId = opts.targetId;
|
|
10576
|
+
else {
|
|
10577
|
+
printError("--target-id requires --target-type <AGENT|ROUTINE> on the same call.");
|
|
10578
|
+
process.exit(1);
|
|
10579
|
+
}
|
|
10580
|
+
}
|
|
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) {
|
|
10585
|
+
printError("Nothing to update.");
|
|
10586
|
+
process.exit(1);
|
|
10587
|
+
}
|
|
10588
|
+
const data = await gqlMutate(ctx.client, UpdateWebhookDoc, { id, input: input19 });
|
|
10589
|
+
if (isJsonMode()) {
|
|
10590
|
+
printJson(data.updateWebhook);
|
|
10591
|
+
return;
|
|
10592
|
+
}
|
|
10593
|
+
printSuccess(`Updated webhook ${data.updateWebhook.id}.`);
|
|
10594
|
+
}
|
|
10595
|
+
async function runWebhookDelete(id, opts) {
|
|
10596
|
+
const ctx = await resolveWebhookContext(opts);
|
|
10597
|
+
if (!opts.yes) {
|
|
10598
|
+
if (!isInteractive()) {
|
|
10599
|
+
printError("Refusing to delete without --yes in a non-interactive session.");
|
|
10600
|
+
process.exit(1);
|
|
10601
|
+
}
|
|
10602
|
+
requireTty("Confirmation");
|
|
10603
|
+
const go = await promptOrExit(
|
|
10604
|
+
() => confirm13({ message: `Delete webhook ${id}? Its URL stops working immediately.`, default: false })
|
|
10605
|
+
);
|
|
10606
|
+
if (!go) {
|
|
10607
|
+
logStderr("Cancelled.");
|
|
10608
|
+
process.exit(0);
|
|
10609
|
+
}
|
|
10610
|
+
}
|
|
10611
|
+
const data = await gqlMutate(ctx.client, DeleteWebhookDoc, { id });
|
|
10612
|
+
if (isJsonMode()) {
|
|
10613
|
+
printJson({ id, deleted: data.deleteWebhook });
|
|
10614
|
+
return;
|
|
10615
|
+
}
|
|
10616
|
+
if (data.deleteWebhook) printSuccess(`Deleted webhook ${id}.`);
|
|
10617
|
+
else printError(`Server reported not-deleted for ${id}.`);
|
|
10618
|
+
}
|
|
10619
|
+
async function runWebhookRotate(id, opts) {
|
|
10620
|
+
const ctx = await resolveWebhookContext(opts);
|
|
10621
|
+
if (!opts.yes) {
|
|
10622
|
+
if (!isInteractive()) {
|
|
10623
|
+
printError("Refusing to rotate without --yes in a non-interactive session.");
|
|
10624
|
+
process.exit(1);
|
|
10625
|
+
}
|
|
10626
|
+
requireTty("Confirmation");
|
|
10627
|
+
const go = await promptOrExit(
|
|
10628
|
+
() => confirm13({
|
|
10629
|
+
message: `Rotate token on webhook ${id}? The old token stops working immediately.`,
|
|
10630
|
+
default: false
|
|
10631
|
+
})
|
|
10632
|
+
);
|
|
10633
|
+
if (!go) {
|
|
10634
|
+
logStderr("Cancelled.");
|
|
10635
|
+
process.exit(0);
|
|
10636
|
+
}
|
|
10637
|
+
}
|
|
10638
|
+
const data = await gqlMutate(ctx.client, RegenerateWebhookTokenDoc, { id });
|
|
10639
|
+
const wh = data.regenerateWebhookToken;
|
|
10640
|
+
if (!wh) {
|
|
10641
|
+
printError("Server returned no webhook (already deleted?).");
|
|
10642
|
+
process.exit(1);
|
|
10643
|
+
}
|
|
10644
|
+
if (isJsonMode()) {
|
|
10645
|
+
printJson(wh);
|
|
10646
|
+
return;
|
|
10647
|
+
}
|
|
10648
|
+
printSuccess(`Rotated token on webhook ${wh.id}.`);
|
|
10649
|
+
console.log("");
|
|
10650
|
+
console.log(" New token (SAVE THIS):");
|
|
10651
|
+
console.log(` ${wh.token}`);
|
|
10652
|
+
}
|
|
10653
|
+
function notYetImplementedAtApi2(verb) {
|
|
10654
|
+
printError(
|
|
10655
|
+
`\`webhook ${verb}\` is not yet implemented at the GraphQL API.
|
|
10656
|
+
Use admin UI for now; CLI parity is tracked as a Phase-3 follow-up.`
|
|
10657
|
+
);
|
|
10658
|
+
process.exit(2);
|
|
10659
|
+
}
|
|
9236
10660
|
function registerWebhookCommand(program2) {
|
|
9237
10661
|
const wh = program2.command("webhook").alias("webhooks").description("Manage inbound webhooks that dispatch to agents or routines.");
|
|
9238
|
-
wh.command("list").alias("ls").description("List webhooks in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--enabled <bool>", "true | false").option("--target-type <t>", "AGENT | ROUTINE").action(
|
|
9239
|
-
wh.command("get <id>").description("Fetch one webhook including its
|
|
9240
|
-
wh.command("create [name]").description("Create a new webhook. The
|
|
10662
|
+
wh.command("list").alias("ls").description("List webhooks in the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--enabled <bool>", "true | false").option("--target-type <t>", "AGENT | ROUTINE").action(runWebhookList);
|
|
10663
|
+
wh.command("get <id>").description("Fetch one webhook including its token prefix + rate limit.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(runWebhookGet);
|
|
10664
|
+
wh.command("create [name]").description("Create a new webhook. The token is printed once.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--target-type <t>", "AGENT | ROUTINE").option("--target-id <id>", "ID of the agent or routine").option("--rate-limit <rpm>", "Max requests per minute").option("--allowed-ips <csv>", "Restrict to a CIDR list (not yet honored server-side)").option("--disabled", "Create in disabled state").addHelpText(
|
|
9241
10665
|
"after",
|
|
9242
10666
|
`
|
|
9243
10667
|
Examples:
|
|
9244
|
-
$ thinkwork webhook create "GitHub PR opened"
|
|
9245
|
-
--target-type AGENT --target-id agt-reviewer --rate-limit 30
|
|
9246
|
-
|
|
9247
|
-
# CI use \u2014 capture the secret on create
|
|
9248
|
-
$ thinkwork webhook create "CI" --target-type ROUTINE --target-id rtn-ci --json | jq -r .secret
|
|
10668
|
+
$ thinkwork webhook create "GitHub PR opened" --target-type AGENT --target-id agt-reviewer --rate-limit 30
|
|
9249
10669
|
`
|
|
9250
|
-
).action(
|
|
9251
|
-
wh.command("update <id>").description("Update a webhook's target, rate limit, or enabled state.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--target-type <t>").option("--target-id <id>").option("--rate-limit <rpm>").option("--allowed-ips <csv>").option("--enable").option("--disable").action(
|
|
9252
|
-
wh.command("delete <id>").description("Delete a webhook (its URL stops working immediately).").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(
|
|
9253
|
-
wh.command("test <id>").description("Send a synthetic payload to the webhook
|
|
9254
|
-
wh.command("rotate <id>").description("Generate a new
|
|
9255
|
-
wh.command("deliveries <id>").description("Show recent delivery attempts (
|
|
10670
|
+
).action(runWebhookCreate);
|
|
10671
|
+
wh.command("update <id>").description("Update a webhook's target, rate limit, or enabled state.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--target-type <t>").option("--target-id <id>").option("--rate-limit <rpm>").option("--allowed-ips <csv>").option("--enable").option("--disable").action(runWebhookUpdate);
|
|
10672
|
+
wh.command("delete <id>").description("Delete a webhook (its URL stops working immediately).").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(runWebhookDelete);
|
|
10673
|
+
wh.command("test <id>").description("Send a synthetic payload to the webhook. (API surface pending.)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--payload <json>").action(() => notYetImplementedAtApi2("test"));
|
|
10674
|
+
wh.command("rotate <id>").description("Generate a new token for an existing webhook.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(runWebhookRotate);
|
|
10675
|
+
wh.command("deliveries <id>").description("Show recent delivery attempts. (API surface pending.)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--limit <n>", "Max rows", "25").action(() => notYetImplementedAtApi2("deliveries"));
|
|
9256
10676
|
}
|
|
9257
10677
|
|
|
9258
10678
|
// src/lib/plugin-zip.ts
|
|
@@ -9395,12 +10815,12 @@ function hasParentSegment(relPath) {
|
|
|
9395
10815
|
}
|
|
9396
10816
|
|
|
9397
10817
|
// src/lib/plugin-push.ts
|
|
9398
|
-
async function pushPluginZip(
|
|
9399
|
-
const base =
|
|
10818
|
+
async function pushPluginZip(input19) {
|
|
10819
|
+
const base = input19.apiUrl.replace(/\/+$/, "");
|
|
9400
10820
|
const presignRes = await fetch(`${base}/api/plugins/presign`, {
|
|
9401
10821
|
method: "POST",
|
|
9402
|
-
headers: withJson(
|
|
9403
|
-
body: JSON.stringify({ fileName:
|
|
10822
|
+
headers: withJson(input19.headers),
|
|
10823
|
+
body: JSON.stringify({ fileName: input19.fileName })
|
|
9404
10824
|
});
|
|
9405
10825
|
if (!presignRes.ok) {
|
|
9406
10826
|
throw new Error(`presign failed: ${await describeHttpError(presignRes)}`);
|
|
@@ -9414,14 +10834,14 @@ async function pushPluginZip(input16) {
|
|
|
9414
10834
|
const putRes = await fetch(presign.uploadUrl, {
|
|
9415
10835
|
method: "PUT",
|
|
9416
10836
|
headers: { "Content-Type": "application/zip" },
|
|
9417
|
-
body: new Uint8Array(
|
|
10837
|
+
body: new Uint8Array(input19.zipBuffer)
|
|
9418
10838
|
});
|
|
9419
10839
|
if (!putRes.ok) {
|
|
9420
10840
|
throw new Error(`S3 PUT failed: HTTP ${putRes.status}`);
|
|
9421
10841
|
}
|
|
9422
10842
|
const installRes = await fetch(`${base}/api/plugins/upload`, {
|
|
9423
10843
|
method: "POST",
|
|
9424
|
-
headers: withJson(
|
|
10844
|
+
headers: withJson(input19.headers),
|
|
9425
10845
|
body: JSON.stringify({ s3Key: presign.s3Key })
|
|
9426
10846
|
});
|
|
9427
10847
|
const installBody = await installRes.json().catch(() => ({}));
|
|
@@ -9463,35 +10883,120 @@ async function describeHttpError(res) {
|
|
|
9463
10883
|
}
|
|
9464
10884
|
|
|
9465
10885
|
// src/commands/skill.ts
|
|
10886
|
+
var SkillCatalogDoc = graphql(`
|
|
10887
|
+
query CliSkillCatalog {
|
|
10888
|
+
skillCatalog {
|
|
10889
|
+
id
|
|
10890
|
+
skillId
|
|
10891
|
+
displayName
|
|
10892
|
+
description
|
|
10893
|
+
category
|
|
10894
|
+
icon
|
|
10895
|
+
source
|
|
10896
|
+
enabled
|
|
10897
|
+
}
|
|
10898
|
+
}
|
|
10899
|
+
`);
|
|
10900
|
+
var SkillTenantBySlugDoc = graphql(`
|
|
10901
|
+
query CliSkillTenantBySlug($slug: String!) {
|
|
10902
|
+
tenantBySlug(slug: $slug) {
|
|
10903
|
+
id
|
|
10904
|
+
}
|
|
10905
|
+
}
|
|
10906
|
+
`);
|
|
10907
|
+
async function resolveSkillContext(opts) {
|
|
10908
|
+
const region = opts.region ?? "us-east-1";
|
|
10909
|
+
const stage = await resolveStage({ flag: opts.stage, region });
|
|
10910
|
+
const session = loadStageSession(stage);
|
|
10911
|
+
const { client } = await getGqlClient({ stage, region });
|
|
10912
|
+
if (!session) {
|
|
10913
|
+
}
|
|
10914
|
+
return { stage, region, client };
|
|
10915
|
+
}
|
|
10916
|
+
async function runSkillCatalog(opts) {
|
|
10917
|
+
const ctx = await resolveSkillContext(opts);
|
|
10918
|
+
const data = await gqlQuery(ctx.client, SkillCatalogDoc, {});
|
|
10919
|
+
let items = data.skillCatalog ?? [];
|
|
10920
|
+
if (opts.search) {
|
|
10921
|
+
const q = opts.search.toLowerCase();
|
|
10922
|
+
items = items.filter(
|
|
10923
|
+
(s) => s.displayName.toLowerCase().includes(q) || s.skillId.toLowerCase().includes(q) || (s.description ?? "").toLowerCase().includes(q)
|
|
10924
|
+
);
|
|
10925
|
+
}
|
|
10926
|
+
if (opts.tag) {
|
|
10927
|
+
const tag = opts.tag.toLowerCase();
|
|
10928
|
+
items = items.filter((s) => (s.category ?? "").toLowerCase() === tag);
|
|
10929
|
+
}
|
|
10930
|
+
if (isJsonMode()) {
|
|
10931
|
+
printJson({ items });
|
|
10932
|
+
return;
|
|
10933
|
+
}
|
|
10934
|
+
printTable(
|
|
10935
|
+
items.map((s) => ({
|
|
10936
|
+
skillId: s.skillId,
|
|
10937
|
+
name: s.displayName,
|
|
10938
|
+
category: s.category ?? "\u2014",
|
|
10939
|
+
source: s.source,
|
|
10940
|
+
enabled: s.enabled ? "yes" : "no"
|
|
10941
|
+
})),
|
|
10942
|
+
[
|
|
10943
|
+
{ key: "skillId", header: "SKILL ID" },
|
|
10944
|
+
{ key: "name", header: "NAME" },
|
|
10945
|
+
{ key: "category", header: "CATEGORY" },
|
|
10946
|
+
{ key: "source", header: "SOURCE" },
|
|
10947
|
+
{ key: "enabled", header: "ENABLED" }
|
|
10948
|
+
]
|
|
10949
|
+
);
|
|
10950
|
+
}
|
|
10951
|
+
async function runSkillList(opts) {
|
|
10952
|
+
const ctx = await resolveSkillContext(opts);
|
|
10953
|
+
const data = await gqlQuery(ctx.client, SkillCatalogDoc, {});
|
|
10954
|
+
let items = data.skillCatalog ?? [];
|
|
10955
|
+
if (opts.customOnly) {
|
|
10956
|
+
items = items.filter((s) => (s.source ?? "").toLowerCase() === "tenant");
|
|
10957
|
+
}
|
|
10958
|
+
if (isJsonMode()) {
|
|
10959
|
+
printJson({ items });
|
|
10960
|
+
return;
|
|
10961
|
+
}
|
|
10962
|
+
printTable(
|
|
10963
|
+
items.map((s) => ({
|
|
10964
|
+
skillId: s.skillId,
|
|
10965
|
+
name: s.displayName,
|
|
10966
|
+
category: s.category ?? "\u2014",
|
|
10967
|
+
source: s.source,
|
|
10968
|
+
enabled: s.enabled ? "yes" : "no"
|
|
10969
|
+
})),
|
|
10970
|
+
[
|
|
10971
|
+
{ key: "skillId", header: "SKILL ID" },
|
|
10972
|
+
{ key: "name", header: "NAME" },
|
|
10973
|
+
{ key: "category", header: "CATEGORY" },
|
|
10974
|
+
{ key: "source", header: "SOURCE" },
|
|
10975
|
+
{ key: "enabled", header: "ENABLED" }
|
|
10976
|
+
]
|
|
10977
|
+
);
|
|
10978
|
+
}
|
|
10979
|
+
function notYetImplementedAtApi3(verb) {
|
|
10980
|
+
printError(
|
|
10981
|
+
`\`skill ${verb}\` is not yet implemented at the GraphQL API.
|
|
10982
|
+
The current schema exposes skillCatalog (read), per-computer enableSkill/disableSkill,
|
|
10983
|
+
and the REST \`skill push\` upload path. Tenant-scoped install/upgrade/create/update/delete
|
|
10984
|
+
is tracked as a Phase-3 follow-up. Use \`thinkwork skill push <folder>\` to upload custom
|
|
10985
|
+
plugins; toggle catalog skills per-agent via \`thinkwork agent skills set\` for now.`
|
|
10986
|
+
);
|
|
10987
|
+
process.exit(2);
|
|
10988
|
+
}
|
|
9466
10989
|
function registerSkillCommand(program2) {
|
|
9467
10990
|
const skill = program2.command("skill").alias("skills").description(
|
|
9468
|
-
"Browse the catalog
|
|
10991
|
+
"Browse the skill catalog and push custom skill plugins."
|
|
9469
10992
|
);
|
|
9470
|
-
skill.command("catalog").description("Browse the
|
|
9471
|
-
skill.command("list").alias("ls").description("List skills
|
|
9472
|
-
skill.command("install <slug>").description("Install a public skill
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
$ thinkwork skill install pagerduty --version 1.4.2
|
|
9478
|
-
`
|
|
9479
|
-
).action(() => notYetImplemented("skill install", 3));
|
|
9480
|
-
skill.command("upgrade <slug>").description("Upgrade an installed skill to the latest catalog version.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(() => notYetImplemented("skill upgrade", 3));
|
|
9481
|
-
skill.command("create [slug]").description(
|
|
9482
|
-
"Publish a custom tenant-scoped skill (walkthrough for missing fields in TTY)."
|
|
9483
|
-
).option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--name <n>").option("--description <text>").option("--manifest-file <path>", "Path to the MCP server manifest JSON").option("--endpoint <url>", "MCP server HTTP/SSE endpoint").addHelpText(
|
|
9484
|
-
"after",
|
|
9485
|
-
`
|
|
9486
|
-
Examples:
|
|
9487
|
-
$ thinkwork skill create my-skill --manifest-file ./skills/my-skill.json
|
|
9488
|
-
$ thinkwork skill create # interactive
|
|
9489
|
-
`
|
|
9490
|
-
).action(() => notYetImplemented("skill create", 3));
|
|
9491
|
-
skill.command("update <slug>").description("Update a custom skill's manifest, endpoint, or description.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--name <n>").option("--description <text>").option("--manifest-file <path>").option("--endpoint <url>").action(() => notYetImplemented("skill update", 3));
|
|
9492
|
-
skill.command("delete <slug>").description(
|
|
9493
|
-
"Delete a custom skill. Public catalog skills are uninstalled via this too."
|
|
9494
|
-
).option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(() => notYetImplemented("skill delete", 3));
|
|
10993
|
+
skill.command("catalog").description("Browse the skill catalog. Client-side filters --search and --tag are applied locally.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--search <q>", "Filter by keyword").option("--tag <t>", "Filter by category").action(runSkillCatalog);
|
|
10994
|
+
skill.command("list").alias("ls").description("List skills available to the tenant.").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--custom-only", "Only show tenant-owned custom skills (source=tenant)").action(runSkillList);
|
|
10995
|
+
skill.command("install <slug>").description("Install a public skill. (API surface pending \u2014 toggle per-agent via `agent skills set`.)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--version <v>", "Pin to a specific version").action(() => notYetImplementedAtApi3("install"));
|
|
10996
|
+
skill.command("upgrade <slug>").description("Upgrade an installed skill. (API surface pending.)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").action(() => notYetImplementedAtApi3("upgrade"));
|
|
10997
|
+
skill.command("create [slug]").description("Publish a custom tenant-scoped skill. (Use `skill push <folder>` for now.)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--name <n>").option("--description <text>").option("--manifest-file <path>", "Path to the MCP server manifest JSON").option("--endpoint <url>", "MCP server HTTP/SSE endpoint").action(() => notYetImplementedAtApi3("create"));
|
|
10998
|
+
skill.command("update <slug>").description("Update a custom skill. (API surface pending.)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("--name <n>").option("--description <text>").option("--manifest-file <path>").option("--endpoint <url>").action(() => notYetImplementedAtApi3("update"));
|
|
10999
|
+
skill.command("delete <slug>").description("Delete a custom skill. (API surface pending.)").option("-s, --stage <name>", "Deployment stage").option("-t, --tenant <slug>", "Tenant slug").option("-y, --yes", "Skip confirmation").action(() => notYetImplementedAtApi3("delete"));
|
|
9495
11000
|
skill.command("push <folder>").description(
|
|
9496
11001
|
"Zip a local plugin folder and upload it to the tenant as a pending plugin."
|
|
9497
11002
|
).option("-s, --stage <name>", "Deployment stage").option("--region <name>", "AWS region", "us-east-1").addHelpText(
|
|
@@ -9502,8 +11007,8 @@ Examples:
|
|
|
9502
11007
|
$ thinkwork skill push ./my-plugin --stage dev
|
|
9503
11008
|
|
|
9504
11009
|
The folder must contain a plugin.json manifest. MCP servers shipped
|
|
9505
|
-
inside the plugin
|
|
9506
|
-
|
|
11010
|
+
inside the plugin land as 'pending' and need admin approval under
|
|
11011
|
+
Capabilities \u2192 MCP Servers before agents can invoke them.
|
|
9507
11012
|
`
|
|
9508
11013
|
).action(
|
|
9509
11014
|
async (folder, opts) => {
|
|
@@ -9588,6 +11093,22 @@ function formatBytes(bytes) {
|
|
|
9588
11093
|
return `${(kb / 1024).toFixed(2)} MB`;
|
|
9589
11094
|
}
|
|
9590
11095
|
|
|
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
|
+
`
|
|
11108
|
+
);
|
|
11109
|
+
process.exit(2);
|
|
11110
|
+
}
|
|
11111
|
+
|
|
9591
11112
|
// src/commands/memory.ts
|
|
9592
11113
|
function registerMemoryCommand(program2) {
|
|
9593
11114
|
const memory = program2.command("memory").description("Inspect, search, and edit an agent's memory records and graph.");
|
|
@@ -9719,7 +11240,7 @@ Examples:
|
|
|
9719
11240
|
}
|
|
9720
11241
|
|
|
9721
11242
|
// src/commands/eval/run.ts
|
|
9722
|
-
import { checkbox, confirm as
|
|
11243
|
+
import { checkbox, confirm as confirm14 } from "@inquirer/prompts";
|
|
9723
11244
|
import ora2 from "ora";
|
|
9724
11245
|
|
|
9725
11246
|
// src/commands/eval/gql.ts
|
|
@@ -9979,7 +11500,7 @@ async function resolveEvalContext(opts) {
|
|
|
9979
11500
|
printMissingApiSessionError(stage, session !== null);
|
|
9980
11501
|
process.exit(1);
|
|
9981
11502
|
}
|
|
9982
|
-
function
|
|
11503
|
+
function fmtIso12(iso) {
|
|
9983
11504
|
if (!iso) return "\u2014";
|
|
9984
11505
|
const d = new Date(iso);
|
|
9985
11506
|
if (Number.isNaN(d.getTime())) return iso;
|
|
@@ -10073,7 +11594,7 @@ async function runEvalRun(opts) {
|
|
|
10073
11594
|
summaryLines.push(["Scope", "all enabled test cases"]);
|
|
10074
11595
|
printKeyValue(summaryLines);
|
|
10075
11596
|
const proceed = await promptOrExit(
|
|
10076
|
-
() =>
|
|
11597
|
+
() => confirm14({ message: "Start run?", default: true })
|
|
10077
11598
|
);
|
|
10078
11599
|
if (!proceed) {
|
|
10079
11600
|
logStderr("Cancelled.");
|
|
@@ -10168,7 +11689,7 @@ async function runEvalList(opts) {
|
|
|
10168
11689
|
tests: `${r.passed}/${r.totalTests}`,
|
|
10169
11690
|
passRate: fmtPercent(r.passRate),
|
|
10170
11691
|
cost: fmtUsd2(r.costUsd),
|
|
10171
|
-
started:
|
|
11692
|
+
started: fmtIso12(r.startedAt)
|
|
10172
11693
|
}));
|
|
10173
11694
|
if (isJsonMode()) {
|
|
10174
11695
|
printJson({ totalCount: data.evalRuns.totalCount, items: data.evalRuns.items });
|
|
@@ -10212,8 +11733,8 @@ async function runEvalGet(runId, opts) {
|
|
|
10212
11733
|
["Regression", run2.regression ? "YES" : "no"],
|
|
10213
11734
|
["Cost", fmtUsd2(run2.costUsd)],
|
|
10214
11735
|
["Error", run2.errorMessage ?? "\u2014"],
|
|
10215
|
-
["Started",
|
|
10216
|
-
["Completed",
|
|
11736
|
+
["Started", fmtIso12(run2.startedAt)],
|
|
11737
|
+
["Completed", fmtIso12(run2.completedAt)]
|
|
10217
11738
|
]);
|
|
10218
11739
|
if (opts.results !== false && results.length > 0) {
|
|
10219
11740
|
console.log("");
|
|
@@ -10295,7 +11816,7 @@ async function runEvalCancel(runId, opts) {
|
|
|
10295
11816
|
}
|
|
10296
11817
|
|
|
10297
11818
|
// src/commands/eval/delete.ts
|
|
10298
|
-
import { confirm as
|
|
11819
|
+
import { confirm as confirm15 } from "@inquirer/prompts";
|
|
10299
11820
|
async function runEvalDelete(runId, opts) {
|
|
10300
11821
|
const ctx = await resolveEvalContext(opts);
|
|
10301
11822
|
if (!opts.yes) {
|
|
@@ -10305,7 +11826,7 @@ async function runEvalDelete(runId, opts) {
|
|
|
10305
11826
|
}
|
|
10306
11827
|
requireTty("Confirmation");
|
|
10307
11828
|
const go = await promptOrExit(
|
|
10308
|
-
() =>
|
|
11829
|
+
() => confirm15({
|
|
10309
11830
|
message: `Permanently delete run ${runId} and its results?`,
|
|
10310
11831
|
default: false
|
|
10311
11832
|
})
|
|
@@ -10380,7 +11901,7 @@ async function runEvalTestCaseList(opts) {
|
|
|
10380
11901
|
template: tc.agentTemplateName ?? "\u2014",
|
|
10381
11902
|
evaluators: (tc.agentcoreEvaluatorIds ?? []).join(", ") || "\u2014",
|
|
10382
11903
|
enabled: tc.enabled ? "yes" : "no",
|
|
10383
|
-
updated:
|
|
11904
|
+
updated: fmtIso12(tc.updatedAt)
|
|
10384
11905
|
}));
|
|
10385
11906
|
if (isJsonMode()) {
|
|
10386
11907
|
printJson(data.evalTestCases ?? []);
|
|
@@ -10419,8 +11940,8 @@ async function runEvalTestCaseGet(id, opts) {
|
|
|
10419
11940
|
["Enabled", tc.enabled ? "yes" : "no"],
|
|
10420
11941
|
["Evaluators", (tc.agentcoreEvaluatorIds ?? []).join(", ") || "\u2014"],
|
|
10421
11942
|
["Tags", (tc.tags ?? []).join(", ") || "\u2014"],
|
|
10422
|
-
["Created",
|
|
10423
|
-
["Updated",
|
|
11943
|
+
["Created", fmtIso12(tc.createdAt)],
|
|
11944
|
+
["Updated", fmtIso12(tc.updatedAt)]
|
|
10424
11945
|
]);
|
|
10425
11946
|
console.log("");
|
|
10426
11947
|
console.log(" QUERY");
|
|
@@ -10442,7 +11963,7 @@ async function runEvalTestCaseGet(id, opts) {
|
|
|
10442
11963
|
|
|
10443
11964
|
// src/commands/eval/test-case/create.ts
|
|
10444
11965
|
import { readFileSync as readFileSync6 } from "fs";
|
|
10445
|
-
import { input as
|
|
11966
|
+
import { input as input18, select as select8, checkbox as checkbox2 } from "@inquirer/prompts";
|
|
10446
11967
|
var DEFAULT_EVALUATORS = [
|
|
10447
11968
|
"Builtin.Helpfulness",
|
|
10448
11969
|
"Builtin.Correctness",
|
|
@@ -10472,17 +11993,17 @@ async function runEvalTestCaseCreate(opts) {
|
|
|
10472
11993
|
if (!name) {
|
|
10473
11994
|
requireTty("Name");
|
|
10474
11995
|
name = await promptOrExit(
|
|
10475
|
-
() =>
|
|
11996
|
+
() => input18({ message: "Test case name?", validate: (v) => v.trim().length > 0 || "Required" })
|
|
10476
11997
|
);
|
|
10477
11998
|
}
|
|
10478
11999
|
if (!category) {
|
|
10479
12000
|
category = await promptOrExit(
|
|
10480
|
-
() =>
|
|
12001
|
+
() => input18({ message: "Category (free-form label)?", validate: (v) => v.trim().length > 0 || "Required" })
|
|
10481
12002
|
);
|
|
10482
12003
|
}
|
|
10483
12004
|
if (!query) {
|
|
10484
12005
|
query = await promptOrExit(
|
|
10485
|
-
() =>
|
|
12006
|
+
() => input18({ message: "Query the agent under test will receive?", validate: (v) => v.trim().length > 0 || "Required" })
|
|
10486
12007
|
);
|
|
10487
12008
|
}
|
|
10488
12009
|
if (interactive && agentTemplateId === null) {
|
|
@@ -10548,28 +12069,28 @@ async function runEvalTestCaseCreate(opts) {
|
|
|
10548
12069
|
import { readFileSync as readFileSync7 } from "fs";
|
|
10549
12070
|
async function runEvalTestCaseUpdate(id, opts) {
|
|
10550
12071
|
const ctx = await resolveEvalContext(opts);
|
|
10551
|
-
const
|
|
10552
|
-
if (opts.name !== void 0)
|
|
10553
|
-
if (opts.category !== void 0)
|
|
10554
|
-
if (opts.query !== void 0)
|
|
10555
|
-
if (opts.systemPrompt !== void 0)
|
|
10556
|
-
if (opts.agentTemplate !== void 0)
|
|
10557
|
-
if (opts.evaluator !== void 0)
|
|
10558
|
-
if (opts.tag !== void 0)
|
|
10559
|
-
if (opts.enabled !== void 0)
|
|
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;
|
|
10560
12081
|
if (opts.assertionsFile) {
|
|
10561
12082
|
const parsed = JSON.parse(readFileSync7(opts.assertionsFile, "utf8"));
|
|
10562
12083
|
if (!Array.isArray(parsed)) {
|
|
10563
12084
|
printError(`--assertions-file must contain a JSON array.`);
|
|
10564
12085
|
process.exit(1);
|
|
10565
12086
|
}
|
|
10566
|
-
|
|
12087
|
+
input19.assertions = parsed;
|
|
10567
12088
|
}
|
|
10568
|
-
if (Object.keys(
|
|
12089
|
+
if (Object.keys(input19).length === 0) {
|
|
10569
12090
|
printError("No fields to update. Pass at least one --<field>.");
|
|
10570
12091
|
process.exit(1);
|
|
10571
12092
|
}
|
|
10572
|
-
const res = await gqlMutate(ctx.client, UpdateEvalTestCaseDoc, { id, input:
|
|
12093
|
+
const res = await gqlMutate(ctx.client, UpdateEvalTestCaseDoc, { id, input: input19 });
|
|
10573
12094
|
if (isJsonMode()) {
|
|
10574
12095
|
printJson(res.updateEvalTestCase);
|
|
10575
12096
|
return;
|
|
@@ -10578,7 +12099,7 @@ async function runEvalTestCaseUpdate(id, opts) {
|
|
|
10578
12099
|
}
|
|
10579
12100
|
|
|
10580
12101
|
// src/commands/eval/test-case/delete.ts
|
|
10581
|
-
import { confirm as
|
|
12102
|
+
import { confirm as confirm16 } from "@inquirer/prompts";
|
|
10582
12103
|
async function runEvalTestCaseDelete(id, opts) {
|
|
10583
12104
|
const ctx = await resolveEvalContext(opts);
|
|
10584
12105
|
if (!opts.yes) {
|
|
@@ -10588,7 +12109,7 @@ async function runEvalTestCaseDelete(id, opts) {
|
|
|
10588
12109
|
}
|
|
10589
12110
|
requireTty("Confirmation");
|
|
10590
12111
|
const go = await promptOrExit(
|
|
10591
|
-
() =>
|
|
12112
|
+
() => confirm16({ message: `Permanently delete test case ${id}?`, default: false })
|
|
10592
12113
|
);
|
|
10593
12114
|
if (!go) {
|
|
10594
12115
|
logStderr("Cancelled.");
|
|
@@ -11105,7 +12626,7 @@ async function watchSingleJob(ctx, target) {
|
|
|
11105
12626
|
}
|
|
11106
12627
|
|
|
11107
12628
|
// src/commands/wiki/rebuild.ts
|
|
11108
|
-
import { confirm as
|
|
12629
|
+
import { confirm as confirm17 } from "@inquirer/prompts";
|
|
11109
12630
|
import ora5 from "ora";
|
|
11110
12631
|
async function runWikiRebuild(opts) {
|
|
11111
12632
|
if (opts.all) {
|
|
@@ -11127,7 +12648,7 @@ async function runWikiRebuild(opts) {
|
|
|
11127
12648
|
requireTty("Rebuild confirmation (--yes)");
|
|
11128
12649
|
}
|
|
11129
12650
|
const ok = await promptOrExit(
|
|
11130
|
-
() =>
|
|
12651
|
+
() => confirm17({
|
|
11131
12652
|
message: `Rebuild wiki for ${agentLabel}? This archives every active page in the scope and recompiles from scratch.`,
|
|
11132
12653
|
default: false
|
|
11133
12654
|
})
|
|
@@ -11407,7 +12928,7 @@ async function renderJobs(jobs, args) {
|
|
|
11407
12928
|
duration: fmtDuration(j.startedAt, j.finishedAt),
|
|
11408
12929
|
records: extractMetric(j.metrics, "records_read"),
|
|
11409
12930
|
pages: extractMetric(j.metrics, "pages_upserted"),
|
|
11410
|
-
started:
|
|
12931
|
+
started: fmtIso13(j.startedAt ?? j.createdAt)
|
|
11411
12932
|
}));
|
|
11412
12933
|
const columns = [
|
|
11413
12934
|
{ key: "id", header: "JOB" }
|
|
@@ -11429,7 +12950,7 @@ function toInt(v, fallback) {
|
|
|
11429
12950
|
const n = typeof v === "number" ? v : Number.parseInt(v, 10);
|
|
11430
12951
|
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
11431
12952
|
}
|
|
11432
|
-
function
|
|
12953
|
+
function fmtIso13(iso) {
|
|
11433
12954
|
if (!iso) return "\u2014";
|
|
11434
12955
|
const d = new Date(iso);
|
|
11435
12956
|
if (Number.isNaN(d.getTime())) return iso;
|