@artyfacts/claude 1.3.24 → 1.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  promptForApiKey,
15
15
  runDeviceAuth,
16
16
  saveCredentials
17
- } from "./chunk-OISOOGKZ.mjs";
17
+ } from "./chunk-7QRIXWMF.mjs";
18
18
 
19
19
  // node_modules/@anthropic-ai/sdk/internal/tslib.mjs
20
20
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
@@ -4220,7 +4220,7 @@ var schemas = {
4220
4220
  }
4221
4221
  },
4222
4222
  // ---------------------------------------------------------------------------
4223
- // Task Tools
4223
+ // Task Tools (v2 - tasks are first-class entities)
4224
4224
  // ---------------------------------------------------------------------------
4225
4225
  get_task: {
4226
4226
  name: "get_task",
@@ -4230,7 +4230,7 @@ var schemas = {
4230
4230
  properties: {
4231
4231
  task_id: {
4232
4232
  type: "string",
4233
- description: "The task UUID or section_id"
4233
+ description: "The task UUID"
4234
4234
  }
4235
4235
  },
4236
4236
  required: ["task_id"]
@@ -4238,13 +4238,13 @@ var schemas = {
4238
4238
  },
4239
4239
  list_tasks: {
4240
4240
  name: "list_tasks",
4241
- description: "List tasks with optional filters.",
4241
+ description: "List tasks from the queue. Returns tasks from the tasks table with goal context.",
4242
4242
  input_schema: {
4243
4243
  type: "object",
4244
4244
  properties: {
4245
- artifact_id: {
4245
+ goal_id: {
4246
4246
  type: "string",
4247
- description: "Filter by artifact"
4247
+ description: "Filter by goal ID"
4248
4248
  },
4249
4249
  status: {
4250
4250
  type: "string",
@@ -4264,21 +4264,54 @@ var schemas = {
4264
4264
  required: []
4265
4265
  }
4266
4266
  },
4267
+ create_goal: {
4268
+ name: "create_goal",
4269
+ description: "Create a new goal (v2). Goals are first-class entities that contain tasks.",
4270
+ input_schema: {
4271
+ type: "object",
4272
+ properties: {
4273
+ title: {
4274
+ type: "string",
4275
+ description: "Goal title"
4276
+ },
4277
+ description: {
4278
+ type: "string",
4279
+ description: "Goal description and objectives"
4280
+ },
4281
+ priority: {
4282
+ type: "string",
4283
+ enum: ["low", "medium", "high", "urgent"],
4284
+ default: "medium",
4285
+ description: "Priority level"
4286
+ },
4287
+ target_date: {
4288
+ type: "string",
4289
+ description: "Optional: target completion date (ISO format)"
4290
+ },
4291
+ tags: {
4292
+ type: "array",
4293
+ items: { type: "string" },
4294
+ description: "Optional: tags for categorization"
4295
+ }
4296
+ },
4297
+ required: ["title"]
4298
+ }
4299
+ },
4267
4300
  create_task: {
4268
4301
  name: "create_task",
4269
- description: "Create a new task on an artifact.",
4302
+ description: "Create a new task under a goal.",
4270
4303
  input_schema: {
4271
4304
  type: "object",
4272
4305
  properties: {
4273
- artifact_id: {
4306
+ goal_id: {
4274
4307
  type: "string",
4275
- description: "The artifact to add the task to"
4308
+ description: "The goal UUID to add the task to"
4276
4309
  },
4277
- heading: {
4310
+ title: {
4278
4311
  type: "string",
4279
- description: "Task title/heading"
4312
+ description: "Task title"
4280
4313
  },
4281
- content: {
4314
+ description: {
4282
4315
  type: "string",
4283
4316
  description: "Task description and requirements"
4284
4317
  },
@@ -4289,26 +4322,41 @@ var schemas = {
4289
4322
  depends_on: {
4290
4323
  type: "array",
4291
4324
  items: { type: "string" },
4292
- description: "Optional: section_ids of tasks this depends on"
4325
+ description: "Optional: task IDs this depends on"
4293
4326
  },
4294
4327
  priority: {
4295
- type: "number",
4296
- enum: [1, 2, 3],
4297
- description: "Optional: priority (1=high, 2=medium, 3=low)"
4328
+ type: "string",
4329
+ enum: ["low", "medium", "high"],
4330
+ default: "medium",
4331
+ description: "Optional: priority level"
4298
4332
  }
4299
4333
  },
4300
- required: ["artifact_id", "heading", "content"]
4334
+ required: ["goal_id", "title"]
4335
+ }
4336
+ },
4337
+ claim_task: {
4338
+ name: "claim_task",
4339
+ description: "Claim a task for execution. Sets status to in_progress.",
4340
+ input_schema: {
4341
+ type: "object",
4342
+ properties: {
4343
+ task_id: {
4344
+ type: "string",
4345
+ description: "The task UUID to claim"
4346
+ }
4347
+ },
4348
+ required: ["task_id"]
4301
4349
  }
4302
4350
  },
4303
4351
  complete_task: {
4304
4352
  name: "complete_task",
4305
- description: "Mark a task as completed with output.",
4353
+ description: "Mark a task as completed. Returns list of unblocked tasks that can now be worked on.",
4306
4354
  input_schema: {
4307
4355
  type: "object",
4308
4356
  properties: {
4309
4357
  task_id: {
4310
4358
  type: "string",
4311
- description: "The task UUID or section_id"
4359
+ description: "The task UUID"
4312
4360
  },
4313
4361
  output: {
4314
4362
  type: "string",
@@ -4334,7 +4382,7 @@ var schemas = {
4334
4382
  properties: {
4335
4383
  task_id: {
4336
4384
  type: "string",
4337
- description: "The task UUID or section_id"
4385
+ description: "The task UUID"
4338
4386
  },
4339
4387
  reason: {
4340
4388
  type: "string",
@@ -4350,6 +4398,56 @@ var schemas = {
4350
4398
  }
4351
4399
  },
4352
4400
  // ---------------------------------------------------------------------------
4401
+ // Inbox Tools (v2)
4402
+ // ---------------------------------------------------------------------------
4403
+ list_inbox: {
4404
+ name: "list_inbox",
4405
+ description: "List pending inbox items (decisions, approvals, reviews).",
4406
+ input_schema: {
4407
+ type: "object",
4408
+ properties: {
4409
+ status: {
4410
+ type: "string",
4411
+ enum: ["pending", "resolved"],
4412
+ description: "Filter by status"
4413
+ },
4414
+ kind: {
4415
+ type: "string",
4416
+ enum: ["decision", "approval", "review"],
4417
+ description: "Filter by type"
4418
+ },
4419
+ limit: {
4420
+ type: "number",
4421
+ default: 20,
4422
+ description: "Max results"
4423
+ }
4424
+ },
4425
+ required: []
4426
+ }
4427
+ },
4428
+ resolve_inbox: {
4429
+ name: "resolve_inbox",
4430
+ description: "Resolve an inbox item with a decision. May trigger auto-execution.",
4431
+ input_schema: {
4432
+ type: "object",
4433
+ properties: {
4434
+ inbox_id: {
4435
+ type: "string",
4436
+ description: "The inbox item UUID"
4437
+ },
4438
+ decision: {
4439
+ type: "string",
4440
+ description: "The decision/resolution"
4441
+ },
4442
+ notes: {
4443
+ type: "string",
4444
+ description: "Optional: additional notes"
4445
+ }
4446
+ },
4447
+ required: ["inbox_id", "decision"]
4448
+ }
4449
+ },
4450
+ // ---------------------------------------------------------------------------
4353
4451
  // Blocker Tools
4354
4452
  // ---------------------------------------------------------------------------
4355
4453
  get_blocker: {
@@ -4504,7 +4602,9 @@ var permissionToTools = {
4504
4602
  "agents:read": ["get_agent", "list_agents"],
4505
4603
  "agents:write": ["create_agent", "update_agent"],
4506
4604
  "tasks:read": ["get_task", "list_tasks"],
4507
- "tasks:write": ["create_task", "complete_task", "block_task"],
4605
+ "tasks:write": ["create_task", "claim_task", "complete_task", "block_task"],
4606
+ "inbox:read": ["list_inbox"],
4607
+ "inbox:write": ["resolve_inbox"],
4508
4608
  "blockers:read": ["get_blocker", "list_blockers"],
4509
4609
  "blockers:write": ["create_blocker", "resolve_blocker"],
4510
4610
  "org:read": ["get_org_context", "get_project", "list_projects"]
@@ -4737,37 +4837,55 @@ var getTaskHandler = async (args, client) => {
4737
4837
  var listTasksHandler = async (args, client) => {
4738
4838
  try {
4739
4839
  const params = new URLSearchParams();
4740
- if (args.artifact_id) params.set("artifact_id", String(args.artifact_id));
4840
+ if (args.goal_id) params.set("goal_id", String(args.goal_id));
4741
4841
  if (args.status) params.set("status", String(args.status));
4742
4842
  if (args.assignee) params.set("assignee", String(args.assignee));
4743
4843
  if (args.limit) params.set("limit", String(args.limit));
4744
4844
  const query = params.toString();
4745
- const path2 = `/tasks${query ? `?${query}` : ""}`;
4845
+ const path2 = `/tasks/queue${query ? `?${query}` : ""}`;
4746
4846
  const data = await client.get(path2);
4747
4847
  return { success: true, data };
4748
4848
  } catch (error) {
4749
4849
  return { success: false, error: String(error) };
4750
4850
  }
4751
4851
  };
4852
+ var createGoalHandler = async (args, client) => {
4853
+ try {
4854
+ const data = await client.post("/goals", {
4855
+ title: args.title,
4856
+ description: args.description,
4857
+ priority: args.priority || "medium",
4858
+ target_date: args.target_date,
4859
+ tags: args.tags
4860
+ });
4861
+ return { success: true, data };
4862
+ } catch (error) {
4863
+ return { success: false, error: String(error) };
4864
+ }
4865
+ };
4752
4866
  var createTaskHandler = async (args, client) => {
4753
4867
  try {
4754
- const data = await client.post(`/artifacts/${args.artifact_id}/sections`, {
4755
- section_id: `task-${Date.now()}`,
4756
- heading: args.heading,
4757
- content: args.content,
4758
- type: "task",
4759
- task_status: "pending",
4868
+ const data = await client.post("/tasks", {
4869
+ goal_id: args.goal_id,
4870
+ title: args.title,
4871
+ description: args.description,
4760
4872
  assignee_agent_id: args.assignee,
4761
4873
  depends_on: args.depends_on,
4762
- priority: args.priority,
4763
- agent_id: "system",
4764
- agent_name: "System"
4874
+ priority: args.priority || "medium"
4765
4875
  });
4766
4876
  return { success: true, data };
4767
4877
  } catch (error) {
4768
4878
  return { success: false, error: String(error) };
4769
4879
  }
4770
4880
  };
4881
+ var claimTaskHandler = async (args, client) => {
4882
+ try {
4883
+ const data = await client.post(`/tasks/${args.task_id}/claim`, {});
4884
+ return { success: true, data };
4885
+ } catch (error) {
4886
+ return { success: false, error: String(error) };
4887
+ }
4888
+ };
4771
4889
  var completeTaskHandler = async (args, client) => {
4772
4890
  try {
4773
4891
  const data = await client.post(`/tasks/${args.task_id}/complete`, {
@@ -4782,7 +4900,7 @@ var completeTaskHandler = async (args, client) => {
4782
4900
  };
4783
4901
  var blockTaskHandler = async (args, client) => {
4784
4902
  try {
4785
- const data = await client.post(`/tasks/${args.task_id}/fail`, {
4903
+ const data = await client.post(`/tasks/${args.task_id}/block`, {
4786
4904
  reason: args.reason,
4787
4905
  blocker_type: args.blocker_type
4788
4906
  });
@@ -4791,6 +4909,31 @@ var blockTaskHandler = async (args, client) => {
4791
4909
  return { success: false, error: String(error) };
4792
4910
  }
4793
4911
  };
4912
+ var listInboxHandler = async (args, client) => {
4913
+ try {
4914
+ const params = new URLSearchParams();
4915
+ if (args.status) params.set("status", String(args.status));
4916
+ if (args.kind) params.set("kind", String(args.kind));
4917
+ if (args.limit) params.set("limit", String(args.limit));
4918
+ const query = params.toString();
4919
+ const path2 = `/inbox${query ? `?${query}` : ""}`;
4920
+ const data = await client.get(path2);
4921
+ return { success: true, data };
4922
+ } catch (error) {
4923
+ return { success: false, error: String(error) };
4924
+ }
4925
+ };
4926
+ var resolveInboxHandler = async (args, client) => {
4927
+ try {
4928
+ const data = await client.post(`/inbox/${args.inbox_id}/resolve`, {
4929
+ decision: args.decision,
4930
+ notes: args.notes
4931
+ });
4932
+ return { success: true, data };
4933
+ } catch (error) {
4934
+ return { success: false, error: String(error) };
4935
+ }
4936
+ };
4794
4937
  var getBlockerHandler = async (args, client) => {
4795
4938
  try {
4796
4939
  const data = await client.get(`/blockers/${args.blocker_id}`);
@@ -4886,13 +5029,19 @@ var handlers = {
4886
5029
  list_agents: listAgentsHandler,
4887
5030
  create_agent: createAgentHandler,
4888
5031
  update_agent: updateAgentHandler,
4889
- // Tasks
5032
+ // Goals (v2)
5033
+ create_goal: createGoalHandler,
5034
+ // Tasks (v2)
4890
5035
  get_task: getTaskHandler,
4891
5036
  list_tasks: listTasksHandler,
4892
5037
  create_task: createTaskHandler,
5038
+ claim_task: claimTaskHandler,
4893
5039
  complete_task: completeTaskHandler,
4894
5040
  block_task: blockTaskHandler,
4895
- // Blockers
5041
+ // Inbox (v2)
5042
+ list_inbox: listInboxHandler,
5043
+ resolve_inbox: resolveInboxHandler,
5044
+ // Blockers (legacy - kept for compatibility)
4896
5045
  get_blocker: getBlockerHandler,
4897
5046
  list_blockers: listBlockersHandler,
4898
5047
  create_blocker: createBlockerHandler,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artyfacts/claude",
3
- "version": "1.3.24",
3
+ "version": "1.3.26",
4
4
  "description": "Claude adapter for Artyfacts - Execute tasks using Claude Code CLI",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -15,13 +15,6 @@
15
15
  "require": "./dist/index.js"
16
16
  }
17
17
  },
18
- "scripts": {
19
- "build": "tsup src/index.ts src/cli.ts --format cjs,esm --dts",
20
- "dev": "tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch",
21
- "start": "node bin/artyfacts-claude.js",
22
- "test": "vitest",
23
- "lint": "eslint src/"
24
- },
25
18
  "keywords": [
26
19
  "artyfacts",
27
20
  "claude",
@@ -54,5 +47,12 @@
54
47
  },
55
48
  "engines": {
56
49
  "node": ">=18.0.0"
50
+ },
51
+ "scripts": {
52
+ "build": "tsup src/index.ts src/cli.ts --format cjs,esm --dts",
53
+ "dev": "tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch",
54
+ "start": "node bin/artyfacts-claude.js",
55
+ "test": "vitest",
56
+ "lint": "eslint src/"
57
57
  }
58
- }
58
+ }
package/src/cli.ts CHANGED
@@ -227,12 +227,16 @@ async function checkAndClaimTasks(
227
227
 
228
228
  const data = await response.json() as { tasks?: Array<{
229
229
  id: string;
230
- section_id: string;
231
- heading: string;
232
- content: string;
233
- artifact_id: string;
234
- artifact_title?: string;
235
- priority?: number;
230
+ goal_id: string;
231
+ goal_title?: string;
232
+ title: string;
233
+ description?: string;
234
+ status: string;
235
+ priority: string;
236
+ estimated_minutes?: number;
237
+ agent_id?: string;
238
+ agent_name?: string;
239
+ metadata?: Record<string, unknown>;
236
240
  }> };
237
241
 
238
242
  const tasks = data.tasks || [];
@@ -252,15 +256,18 @@ async function checkAndClaimTasks(
252
256
  }
253
257
 
254
258
  // Try to claim the task
255
- console.log(`\n[Claiming] ${task.heading}`);
259
+ console.log(`\n[Claiming] ${task.title} (as ${task.agent_name || task.agent_id || 'unknown'})`);
256
260
 
257
- // Use UUID (task.id) for claiming - section_id isn't globally unique
261
+ // Use task.id (UUID) for claiming, include agent_id from task
258
262
  const claimResponse = await fetch(`${baseUrl}/tasks/${task.id}/claim`, {
259
263
  method: 'POST',
260
264
  headers: {
261
265
  'Authorization': `Bearer ${apiKey}`,
262
266
  'Content-Type': 'application/json',
263
267
  },
268
+ body: JSON.stringify({
269
+ agent_id: task.agent_id,
270
+ }),
264
271
  });
265
272
 
266
273
  if (!claimResponse.ok) {
@@ -269,19 +276,17 @@ async function checkAndClaimTasks(
269
276
  continue;
270
277
  }
271
278
 
272
- // Get the claimed task data (includes UUID which is globally unique)
273
- // Response format: { success: true, task: { id: ..., artifact_id: ..., ... } }
279
+ // Get the claimed task data
274
280
  const claimData = await claimResponse.json().catch((e) => {
275
281
  console.log(` ⚠️ Could not parse claim response: ${e}`);
276
282
  return { task: { id: task.id } };
277
283
  }) as {
278
- success?: boolean;
279
- task?: { id: string; artifact_id?: string };
284
+ claimed?: boolean;
285
+ task?: { id: string; goal_id?: string; goal_title?: string };
280
286
  };
281
287
 
282
- // Use UUID for subsequent calls (globally unique, avoids org filter issues)
283
288
  const taskUuid = claimData.task?.id || task.id;
284
- console.log(` 📎 Using task UUID: ${taskUuid} (from queue: ${task.id})`); // DEBUG
289
+ const goalTitle = claimData.task?.goal_title || task.goal_title;
285
290
 
286
291
  // Successfully claimed - now execute
287
292
  activeTasks.add(task.id);
@@ -296,14 +301,20 @@ async function checkAndClaimTasks(
296
301
  console.log(' → Executing with Claude...');
297
302
 
298
303
  try {
299
- // Use UUID for context/complete (more reliable than section_id)
304
+ // Execute the task (v2 schema)
305
+ const priorityMap: Record<string, 'low' | 'medium' | 'high'> = {
306
+ 'urgent': 'high',
307
+ 'high': 'high',
308
+ 'medium': 'medium',
309
+ 'low': 'low',
310
+ };
300
311
  const result = await executor.execute({
301
- taskId: taskUuid, // Use UUID instead of section_id
302
- heading: task.heading,
303
- content: task.content,
304
- artifactId: task.artifact_id,
305
- artifactTitle: task.artifact_title,
306
- priority: task.priority,
312
+ id: taskUuid,
313
+ title: task.title,
314
+ description: task.description || '',
315
+ goalId: task.goal_id,
316
+ goalTitle: goalTitle,
317
+ priority: priorityMap[task.priority] || 'medium',
307
318
  });
308
319
 
309
320
  if (result.success) {
@@ -452,36 +463,43 @@ async function runAgent(options: {
452
463
  await mcpHandler.handleConnectRequest(event);
453
464
  });
454
465
 
455
- // Handle task assignments
466
+ // Handle task assignments (v2 schema)
456
467
  listener.on<TaskAssignedEvent>('task_assigned', async (event) => {
457
468
  const task = event.data;
458
469
 
459
- // Skip if already processing
460
- if (activeTasks.has(task.taskId)) {
470
+ // v2: use id, fallback to taskId for backwards compatibility
471
+ const taskId = task.id || task.taskId || '';
472
+ const taskTitle = task.title || task.heading || 'Untitled Task';
473
+ const taskDescription = task.description || task.content || '';
474
+ const goalId = task.goalId || task.artifactId || '';
475
+ const goalTitle = task.goalTitle || task.artifactTitle;
476
+
477
+ // Skip if already processing or no task ID
478
+ if (!taskId || activeTasks.has(taskId)) {
461
479
  return;
462
480
  }
463
- activeTasks.add(task.taskId);
481
+ activeTasks.add(taskId);
464
482
 
465
- console.log(`\n[Task received] ${task.heading}`);
483
+ console.log(`\n[Task received] ${taskTitle}`);
466
484
 
467
485
  if (options.dryRun) {
468
486
  console.log(' 📋 Dry run - not executing');
469
- console.log(` 📄 Artifact: ${task.artifactTitle || task.artifactId}`);
470
- console.log(` 📝 Content: ${task.content.substring(0, 100)}...`);
471
- activeTasks.delete(task.taskId);
487
+ console.log(` 📄 Goal: ${goalTitle || goalId}`);
488
+ console.log(` 📝 Description: ${taskDescription.substring(0, 100)}...`);
489
+ activeTasks.delete(taskId);
472
490
  return;
473
491
  }
474
492
 
475
493
  console.log(' → Executing with Claude...');
476
494
 
477
495
  try {
478
- // Build task context
496
+ // Build task context (v2)
479
497
  const taskContext: TaskContext = {
480
- taskId: task.taskId,
481
- heading: task.heading,
482
- content: task.content,
483
- artifactId: task.artifactId,
484
- artifactTitle: task.artifactTitle,
498
+ id: taskId,
499
+ title: taskTitle,
500
+ description: taskDescription,
501
+ goalId: goalId,
502
+ goalTitle: goalTitle,
485
503
  priority: task.priority,
486
504
  };
487
505
 
@@ -491,13 +509,21 @@ async function runAgent(options: {
491
509
  if (result.success) {
492
510
  // Complete task via API (Claude may have already done this via MCP tool)
493
511
  try {
494
- await completeTask({
512
+ const completionResult = await completeTask({
495
513
  baseUrl: options.baseUrl,
496
514
  apiKey: credentials.apiKey,
497
- taskId: task.taskId,
515
+ taskId: taskId,
498
516
  output: result.output,
499
517
  summary: result.summary,
500
518
  });
519
+
520
+ // v2: Log unblocked tasks if any
521
+ if (completionResult.unblocked_tasks && completionResult.unblocked_tasks.length > 0) {
522
+ console.log(` → 🔓 Unblocked ${completionResult.unblocked_tasks.length} task(s):`);
523
+ for (const unblocked of completionResult.unblocked_tasks) {
524
+ console.log(` - ${unblocked.title} (${unblocked.id})`);
525
+ }
526
+ }
501
527
  } catch (err) {
502
528
  // Ignore "already complete" - means Claude completed it via MCP
503
529
  const errMsg = err instanceof Error ? err.message : String(err);
@@ -514,14 +540,14 @@ async function runAgent(options: {
514
540
  await blockTask({
515
541
  baseUrl: options.baseUrl,
516
542
  apiKey: credentials.apiKey,
517
- taskId: task.taskId,
543
+ taskId: taskId,
518
544
  reason: result.error || 'Execution failed',
519
545
  });
520
546
  }
521
547
  } catch (error) {
522
548
  console.error(` → ❌ Error:`, error instanceof Error ? error.message : error);
523
549
  } finally {
524
- activeTasks.delete(task.taskId);
550
+ activeTasks.delete(taskId);
525
551
  }
526
552
  });
527
553
 
@@ -556,13 +582,21 @@ async function runAgent(options: {
556
582
  // API Helpers
557
583
  // ============================================================================
558
584
 
585
+ /**
586
+ * Complete task response type (v2)
587
+ */
588
+ interface CompleteTaskResponse {
589
+ task?: { id: string; status: string };
590
+ unblocked_tasks?: Array<{ id: string; title: string }>;
591
+ }
592
+
559
593
  async function completeTask(options: {
560
594
  baseUrl: string;
561
595
  apiKey: string;
562
596
  taskId: string;
563
597
  output: string;
564
598
  summary: string;
565
- }): Promise<void> {
599
+ }): Promise<CompleteTaskResponse> {
566
600
  const response = await fetch(`${options.baseUrl}/tasks/${options.taskId}/complete`, {
567
601
  method: 'POST',
568
602
  headers: {
@@ -570,10 +604,8 @@ async function completeTask(options: {
570
604
  'Content-Type': 'application/json',
571
605
  },
572
606
  body: JSON.stringify({
573
- task_status: 'done',
574
- completed_at: new Date().toISOString(),
575
- summary: options.summary,
576
- output: options.output,
607
+ output_text: options.summary || options.output,
608
+ output_url: options.output?.startsWith('http') ? options.output : undefined,
577
609
  }),
578
610
  });
579
611
 
@@ -581,6 +613,8 @@ async function completeTask(options: {
581
613
  const error = await response.text();
582
614
  throw new Error(`Failed to complete task: ${error}`);
583
615
  }
616
+
617
+ return response.json() as Promise<CompleteTaskResponse>;
584
618
  }
585
619
 
586
620
  async function blockTask(options: {
@@ -596,8 +630,7 @@ async function blockTask(options: {
596
630
  'Content-Type': 'application/json',
597
631
  },
598
632
  body: JSON.stringify({
599
- task_status: 'blocked',
600
- blocked_reason: options.reason,
633
+ reason: options.reason,
601
634
  }),
602
635
  });
603
636