@artyfacts/claude 1.3.23 → 1.3.25

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.js CHANGED
@@ -290,12 +290,13 @@ You have access to Artyfacts MCP tools. USE THEM to complete your task:
290
290
  - **create_artifact** - Create new artifacts (documents, specs, reports)
291
291
  - **create_section** - Add sections to artifacts (content, tasks, decisions)
292
292
  - **update_section** - Update existing sections
293
- - **create_agent** - Create new AI agents with specific roles
294
- - **list_artifacts** - Query existing artifacts
295
- - **list_sections** - Query sections within an artifact
296
- - **complete_task** - Mark a task as complete
293
+ - **create_task** - Create new tasks under a goal
294
+ - **claim_task** - Claim a task for execution
295
+ - **complete_task** - Mark a task as complete (returns unblocked tasks)
297
296
  - **block_task** - Block a task with a reason
298
- - **create_blocker** - Create a decision blocker
297
+ - **list_tasks** - Query tasks from the queue
298
+ - **list_inbox** - Check pending decisions/approvals
299
+ - **resolve_inbox** - Resolve an inbox item
299
300
 
300
301
  IMPORTANT: When asked to create agents or update artifacts, USE THE TOOLS. Don't just describe what you would do - actually do it with the tools.
301
302
 
@@ -304,7 +305,7 @@ IMPORTANT: When asked to create agents or update artifacts, USE THE TOOLS. Don't
304
305
  - Be thorough but concise
305
306
  - USE THE TOOLS to take action, don't just analyze
306
307
  - If the task requires creating something, use create_artifact or create_section
307
- - If the task requires creating agents, use create_agent
308
+ - If you complete a task, check the response for unblocked_tasks to see follow-up work
308
309
  - If you cannot complete the task, explain why
309
310
 
310
311
  Format your response as follows:
@@ -328,37 +329,69 @@ Format your response as follows:
328
329
  }
329
330
  parts.push("");
330
331
  }
331
- parts.push(`## Artifact: ${context.artifact.title}`);
332
- if (context.artifact.summary) {
333
- parts.push(context.artifact.summary);
334
- }
335
- if (context.artifact.description) {
336
- parts.push("");
337
- parts.push(context.artifact.description);
338
- }
339
- parts.push("");
340
- const relatedSections = context.artifact.sections.filter(
341
- (s) => s.id !== context.task.id
342
- );
343
- if (relatedSections.length > 0) {
344
- parts.push("### Related Sections:");
345
- for (const section of relatedSections) {
346
- const preview = section.content ? section.content.substring(0, 200) + (section.content.length > 200 ? "..." : "") : "No content";
347
- const statusBadge = section.task_status ? ` [${section.task_status}]` : "";
348
- parts.push(`- **${section.heading}**${statusBadge}: ${preview}`);
332
+ const goal = context.goal || context.artifact;
333
+ if (goal) {
334
+ parts.push(`## Goal: ${goal.title}`);
335
+ if (goal.objective) {
336
+ parts.push(`**Objective:** ${goal.objective}`);
337
+ }
338
+ if (goal.summary) {
339
+ parts.push(goal.summary);
340
+ }
341
+ if (goal.description) {
342
+ parts.push("");
343
+ parts.push(goal.description);
349
344
  }
350
345
  parts.push("");
346
+ if (goal.tasks && goal.tasks.length > 0) {
347
+ const relatedTasks = goal.tasks.filter((t) => t.id !== context.task.id);
348
+ if (relatedTasks.length > 0) {
349
+ parts.push("### Related Tasks:");
350
+ for (const task of relatedTasks) {
351
+ const statusEmoji = {
352
+ pending: "\u23F3",
353
+ in_progress: "\u{1F504}",
354
+ blocked: "\u{1F6AB}",
355
+ done: "\u2705"
356
+ }[task.status] || "\u2753";
357
+ const priorityBadge = task.priority ? ` [${task.priority}]` : "";
358
+ parts.push(`- ${statusEmoji} **${task.title}**${priorityBadge}`);
359
+ }
360
+ parts.push("");
361
+ }
362
+ }
363
+ if (goal.sections && goal.sections.length > 0) {
364
+ const relatedSections = goal.sections.filter((s) => s.id !== context.task.id);
365
+ if (relatedSections.length > 0) {
366
+ parts.push("### Related Sections:");
367
+ for (const section of relatedSections) {
368
+ const preview = section.content ? section.content.substring(0, 200) + (section.content.length > 200 ? "..." : "") : "No content";
369
+ const statusBadge = section.task_status ? ` [${section.task_status}]` : "";
370
+ parts.push(`- **${section.heading}**${statusBadge}: ${preview}`);
371
+ }
372
+ parts.push("");
373
+ }
374
+ }
351
375
  }
352
376
  parts.push("---");
353
377
  parts.push("");
354
- parts.push(`## Your Task: ${context.task.heading}`);
378
+ const taskTitle = context.task.title || context.task.heading;
379
+ parts.push(`## Your Task: ${taskTitle}`);
355
380
  if (context.task.priority) {
356
- const priorityLabels = ["\u{1F534} High", "\u{1F7E1} Medium", "\u{1F7E2} Low"];
357
- parts.push(`**Priority:** ${priorityLabels[context.task.priority - 1] || "Medium"}`);
381
+ const priorityEmoji = {
382
+ high: "\u{1F534} High",
383
+ medium: "\u{1F7E1} Medium",
384
+ low: "\u{1F7E2} Low"
385
+ }[context.task.priority] || "\u{1F7E1} Medium";
386
+ parts.push(`**Priority:** ${priorityEmoji}`);
387
+ }
388
+ if (context.task.depends_on && context.task.depends_on.length > 0) {
389
+ parts.push(`**Dependencies:** ${context.task.depends_on.length} task(s)`);
358
390
  }
359
391
  parts.push("");
360
392
  parts.push("### Description");
361
- parts.push(context.task.content || "No additional description provided.");
393
+ const taskDescription = context.task.description || context.task.content;
394
+ parts.push(taskDescription || "No additional description provided.");
362
395
  parts.push("");
363
396
  if (context.task.expected_output) {
364
397
  parts.push("### Expected Output");
@@ -475,9 +508,13 @@ var ClaudeExecutor = class {
475
508
  const useFullContext = this.config.useFullContext !== false && this.contextFetcher;
476
509
  if (useFullContext) {
477
510
  try {
478
- fullContext = await this.contextFetcher.fetchTaskContext(task.taskId);
511
+ const taskId = task.id || task.taskId;
512
+ if (!taskId) {
513
+ throw new Error("Task ID required for context fetch");
514
+ }
515
+ fullContext = await this.contextFetcher.fetchTaskContext(taskId);
479
516
  prompt = buildPromptWithContext(fullContext);
480
- console.log(" \u{1F4DA} Using full context (org, project, artifact, related sections)");
517
+ console.log(" \u{1F4DA} Using full context (org, project, goal, related tasks)");
481
518
  } catch (contextError) {
482
519
  console.warn(" \u26A0\uFE0F Could not fetch full context, using minimal prompt");
483
520
  console.warn(` ${contextError instanceof Error ? contextError.message : contextError}`);
@@ -487,7 +524,8 @@ var ClaudeExecutor = class {
487
524
  prompt = this.buildTaskPrompt(task);
488
525
  }
489
526
  const output = await this.runClaude(prompt);
490
- const { content, summary } = this.parseResponse(output, task.heading);
527
+ const taskTitle = task.title || task.heading || "Task";
528
+ const { content, summary } = this.parseResponse(output, taskTitle);
491
529
  return {
492
530
  success: true,
493
531
  output: content,
@@ -562,7 +600,7 @@ var ClaudeExecutor = class {
562
600
  });
563
601
  }
564
602
  /**
565
- * Build the task prompt
603
+ * Build the task prompt (v2)
566
604
  */
567
605
  buildTaskPrompt(task) {
568
606
  const parts = [];
@@ -573,18 +611,25 @@ ${DEFAULT_SYSTEM_PROMPT}` : DEFAULT_SYSTEM_PROMPT;
573
611
  parts.push("");
574
612
  parts.push("---");
575
613
  parts.push("");
576
- parts.push(`# Task: ${task.heading}`);
614
+ const taskTitle = task.title || task.heading;
615
+ parts.push(`# Task: ${taskTitle}`);
577
616
  parts.push("");
578
- if (task.artifactTitle) {
579
- parts.push(`**Artifact:** ${task.artifactTitle}`);
617
+ const goalTitle = task.goalTitle || task.artifactTitle;
618
+ if (goalTitle) {
619
+ parts.push(`**Goal:** ${goalTitle}`);
580
620
  }
581
621
  if (task.priority) {
582
- const priorityLabels = ["High", "Medium", "Low"];
583
- parts.push(`**Priority:** ${priorityLabels[task.priority - 1] || "Medium"}`);
622
+ const priorityEmoji = {
623
+ high: "\u{1F534} High",
624
+ medium: "\u{1F7E1} Medium",
625
+ low: "\u{1F7E2} Low"
626
+ }[task.priority] || "\u{1F7E1} Medium";
627
+ parts.push(`**Priority:** ${priorityEmoji}`);
584
628
  }
585
629
  parts.push("");
586
630
  parts.push("## Description");
587
- parts.push(task.content || "No additional description provided.");
631
+ const taskDescription = task.description || task.content;
632
+ parts.push(taskDescription || "No additional description provided.");
588
633
  parts.push("");
589
634
  if (task.context && Object.keys(task.context).length > 0) {
590
635
  parts.push("## Additional Context");
@@ -774,16 +819,22 @@ var ArtyfactsListener = class {
774
819
  try {
775
820
  const data = JSON.parse(event.data);
776
821
  const rawData = data.data || data;
777
- const normalizedData = rawData.task_id ? {
778
- taskId: rawData.task_id,
779
- sectionId: rawData.section_id,
780
- artifactId: rawData.artifact_id,
781
- artifactTitle: rawData.artifact_title,
782
- heading: rawData.heading,
783
- content: rawData.content,
822
+ const normalizedData = rawData.id || rawData.task_id ? {
823
+ // v2 fields (primary)
824
+ id: rawData.id || rawData.task_id,
825
+ goalId: rawData.goal_id || rawData.artifact_id,
826
+ goalTitle: rawData.goal_title || rawData.artifact_title,
827
+ title: rawData.title || rawData.heading,
828
+ description: rawData.description || rawData.content,
829
+ priority: rawData.priority,
784
830
  assignedTo: rawData.assigned_to,
785
831
  assignedAt: rawData.assigned_at,
786
- priority: rawData.priority,
832
+ // Deprecated fields for backwards compatibility
833
+ taskId: rawData.id || rawData.task_id,
834
+ artifactId: rawData.goal_id || rawData.artifact_id,
835
+ artifactTitle: rawData.goal_title || rawData.artifact_title,
836
+ heading: rawData.title || rawData.heading,
837
+ content: rawData.description || rawData.content,
787
838
  ...rawData
788
839
  // Keep original fields too
789
840
  } : rawData;
@@ -5058,7 +5109,7 @@ var schemas = {
5058
5109
  }
5059
5110
  },
5060
5111
  // ---------------------------------------------------------------------------
5061
- // Task Tools
5112
+ // Task Tools (v2 - tasks are first-class entities)
5062
5113
  // ---------------------------------------------------------------------------
5063
5114
  get_task: {
5064
5115
  name: "get_task",
@@ -5068,7 +5119,7 @@ var schemas = {
5068
5119
  properties: {
5069
5120
  task_id: {
5070
5121
  type: "string",
5071
- description: "The task UUID or section_id"
5122
+ description: "The task UUID"
5072
5123
  }
5073
5124
  },
5074
5125
  required: ["task_id"]
@@ -5076,13 +5127,13 @@ var schemas = {
5076
5127
  },
5077
5128
  list_tasks: {
5078
5129
  name: "list_tasks",
5079
- description: "List tasks with optional filters.",
5130
+ description: "List tasks from the queue. Returns tasks from the tasks table with goal context.",
5080
5131
  input_schema: {
5081
5132
  type: "object",
5082
5133
  properties: {
5083
- artifact_id: {
5134
+ goal_id: {
5084
5135
  type: "string",
5085
- description: "Filter by artifact"
5136
+ description: "Filter by goal ID"
5086
5137
  },
5087
5138
  status: {
5088
5139
  type: "string",
@@ -5104,19 +5155,19 @@ var schemas = {
5104
5155
  },
5105
5156
  create_task: {
5106
5157
  name: "create_task",
5107
- description: "Create a new task on an artifact.",
5158
+ description: "Create a new task under a goal.",
5108
5159
  input_schema: {
5109
5160
  type: "object",
5110
5161
  properties: {
5111
- artifact_id: {
5162
+ goal_id: {
5112
5163
  type: "string",
5113
- description: "The artifact to add the task to"
5164
+ description: "The goal UUID to add the task to"
5114
5165
  },
5115
- heading: {
5166
+ title: {
5116
5167
  type: "string",
5117
- description: "Task title/heading"
5168
+ description: "Task title"
5118
5169
  },
5119
- content: {
5170
+ description: {
5120
5171
  type: "string",
5121
5172
  description: "Task description and requirements"
5122
5173
  },
@@ -5127,26 +5178,41 @@ var schemas = {
5127
5178
  depends_on: {
5128
5179
  type: "array",
5129
5180
  items: { type: "string" },
5130
- description: "Optional: section_ids of tasks this depends on"
5181
+ description: "Optional: task IDs this depends on"
5131
5182
  },
5132
5183
  priority: {
5133
- type: "number",
5134
- enum: [1, 2, 3],
5135
- description: "Optional: priority (1=high, 2=medium, 3=low)"
5184
+ type: "string",
5185
+ enum: ["low", "medium", "high"],
5186
+ default: "medium",
5187
+ description: "Optional: priority level"
5136
5188
  }
5137
5189
  },
5138
- required: ["artifact_id", "heading", "content"]
5190
+ required: ["goal_id", "title"]
5191
+ }
5192
+ },
5193
+ claim_task: {
5194
+ name: "claim_task",
5195
+ description: "Claim a task for execution. Sets status to in_progress.",
5196
+ input_schema: {
5197
+ type: "object",
5198
+ properties: {
5199
+ task_id: {
5200
+ type: "string",
5201
+ description: "The task UUID to claim"
5202
+ }
5203
+ },
5204
+ required: ["task_id"]
5139
5205
  }
5140
5206
  },
5141
5207
  complete_task: {
5142
5208
  name: "complete_task",
5143
- description: "Mark a task as completed with output.",
5209
+ description: "Mark a task as completed. Returns list of unblocked tasks that can now be worked on.",
5144
5210
  input_schema: {
5145
5211
  type: "object",
5146
5212
  properties: {
5147
5213
  task_id: {
5148
5214
  type: "string",
5149
- description: "The task UUID or section_id"
5215
+ description: "The task UUID"
5150
5216
  },
5151
5217
  output: {
5152
5218
  type: "string",
@@ -5172,7 +5238,7 @@ var schemas = {
5172
5238
  properties: {
5173
5239
  task_id: {
5174
5240
  type: "string",
5175
- description: "The task UUID or section_id"
5241
+ description: "The task UUID"
5176
5242
  },
5177
5243
  reason: {
5178
5244
  type: "string",
@@ -5188,6 +5254,56 @@ var schemas = {
5188
5254
  }
5189
5255
  },
5190
5256
  // ---------------------------------------------------------------------------
5257
+ // Inbox Tools (v2)
5258
+ // ---------------------------------------------------------------------------
5259
+ list_inbox: {
5260
+ name: "list_inbox",
5261
+ description: "List pending inbox items (decisions, approvals, reviews).",
5262
+ input_schema: {
5263
+ type: "object",
5264
+ properties: {
5265
+ status: {
5266
+ type: "string",
5267
+ enum: ["pending", "resolved"],
5268
+ description: "Filter by status"
5269
+ },
5270
+ kind: {
5271
+ type: "string",
5272
+ enum: ["decision", "approval", "review"],
5273
+ description: "Filter by type"
5274
+ },
5275
+ limit: {
5276
+ type: "number",
5277
+ default: 20,
5278
+ description: "Max results"
5279
+ }
5280
+ },
5281
+ required: []
5282
+ }
5283
+ },
5284
+ resolve_inbox: {
5285
+ name: "resolve_inbox",
5286
+ description: "Resolve an inbox item with a decision. May trigger auto-execution.",
5287
+ input_schema: {
5288
+ type: "object",
5289
+ properties: {
5290
+ inbox_id: {
5291
+ type: "string",
5292
+ description: "The inbox item UUID"
5293
+ },
5294
+ decision: {
5295
+ type: "string",
5296
+ description: "The decision/resolution"
5297
+ },
5298
+ notes: {
5299
+ type: "string",
5300
+ description: "Optional: additional notes"
5301
+ }
5302
+ },
5303
+ required: ["inbox_id", "decision"]
5304
+ }
5305
+ },
5306
+ // ---------------------------------------------------------------------------
5191
5307
  // Blocker Tools
5192
5308
  // ---------------------------------------------------------------------------
5193
5309
  get_blocker: {
@@ -5342,7 +5458,9 @@ var permissionToTools = {
5342
5458
  "agents:read": ["get_agent", "list_agents"],
5343
5459
  "agents:write": ["create_agent", "update_agent"],
5344
5460
  "tasks:read": ["get_task", "list_tasks"],
5345
- "tasks:write": ["create_task", "complete_task", "block_task"],
5461
+ "tasks:write": ["create_task", "claim_task", "complete_task", "block_task"],
5462
+ "inbox:read": ["list_inbox"],
5463
+ "inbox:write": ["resolve_inbox"],
5346
5464
  "blockers:read": ["get_blocker", "list_blockers"],
5347
5465
  "blockers:write": ["create_blocker", "resolve_blocker"],
5348
5466
  "org:read": ["get_org_context", "get_project", "list_projects"]
@@ -5575,12 +5693,12 @@ var getTaskHandler = async (args, client) => {
5575
5693
  var listTasksHandler = async (args, client) => {
5576
5694
  try {
5577
5695
  const params = new URLSearchParams();
5578
- if (args.artifact_id) params.set("artifact_id", String(args.artifact_id));
5696
+ if (args.goal_id) params.set("goal_id", String(args.goal_id));
5579
5697
  if (args.status) params.set("status", String(args.status));
5580
5698
  if (args.assignee) params.set("assignee", String(args.assignee));
5581
5699
  if (args.limit) params.set("limit", String(args.limit));
5582
5700
  const query = params.toString();
5583
- const path3 = `/tasks${query ? `?${query}` : ""}`;
5701
+ const path3 = `/tasks/queue${query ? `?${query}` : ""}`;
5584
5702
  const data = await client.get(path3);
5585
5703
  return { success: true, data };
5586
5704
  } catch (error) {
@@ -5589,23 +5707,27 @@ var listTasksHandler = async (args, client) => {
5589
5707
  };
5590
5708
  var createTaskHandler = async (args, client) => {
5591
5709
  try {
5592
- const data = await client.post(`/artifacts/${args.artifact_id}/sections`, {
5593
- section_id: `task-${Date.now()}`,
5594
- heading: args.heading,
5595
- content: args.content,
5596
- type: "task",
5597
- task_status: "pending",
5710
+ const data = await client.post("/tasks", {
5711
+ goal_id: args.goal_id,
5712
+ title: args.title,
5713
+ description: args.description,
5598
5714
  assignee_agent_id: args.assignee,
5599
5715
  depends_on: args.depends_on,
5600
- priority: args.priority,
5601
- agent_id: "system",
5602
- agent_name: "System"
5716
+ priority: args.priority || "medium"
5603
5717
  });
5604
5718
  return { success: true, data };
5605
5719
  } catch (error) {
5606
5720
  return { success: false, error: String(error) };
5607
5721
  }
5608
5722
  };
5723
+ var claimTaskHandler = async (args, client) => {
5724
+ try {
5725
+ const data = await client.post(`/tasks/${args.task_id}/claim`, {});
5726
+ return { success: true, data };
5727
+ } catch (error) {
5728
+ return { success: false, error: String(error) };
5729
+ }
5730
+ };
5609
5731
  var completeTaskHandler = async (args, client) => {
5610
5732
  try {
5611
5733
  const data = await client.post(`/tasks/${args.task_id}/complete`, {
@@ -5620,7 +5742,7 @@ var completeTaskHandler = async (args, client) => {
5620
5742
  };
5621
5743
  var blockTaskHandler = async (args, client) => {
5622
5744
  try {
5623
- const data = await client.post(`/tasks/${args.task_id}/fail`, {
5745
+ const data = await client.post(`/tasks/${args.task_id}/block`, {
5624
5746
  reason: args.reason,
5625
5747
  blocker_type: args.blocker_type
5626
5748
  });
@@ -5629,6 +5751,31 @@ var blockTaskHandler = async (args, client) => {
5629
5751
  return { success: false, error: String(error) };
5630
5752
  }
5631
5753
  };
5754
+ var listInboxHandler = async (args, client) => {
5755
+ try {
5756
+ const params = new URLSearchParams();
5757
+ if (args.status) params.set("status", String(args.status));
5758
+ if (args.kind) params.set("kind", String(args.kind));
5759
+ if (args.limit) params.set("limit", String(args.limit));
5760
+ const query = params.toString();
5761
+ const path3 = `/inbox${query ? `?${query}` : ""}`;
5762
+ const data = await client.get(path3);
5763
+ return { success: true, data };
5764
+ } catch (error) {
5765
+ return { success: false, error: String(error) };
5766
+ }
5767
+ };
5768
+ var resolveInboxHandler = async (args, client) => {
5769
+ try {
5770
+ const data = await client.post(`/inbox/${args.inbox_id}/resolve`, {
5771
+ decision: args.decision,
5772
+ notes: args.notes
5773
+ });
5774
+ return { success: true, data };
5775
+ } catch (error) {
5776
+ return { success: false, error: String(error) };
5777
+ }
5778
+ };
5632
5779
  var getBlockerHandler = async (args, client) => {
5633
5780
  try {
5634
5781
  const data = await client.get(`/blockers/${args.blocker_id}`);
@@ -5724,13 +5871,17 @@ var handlers = {
5724
5871
  list_agents: listAgentsHandler,
5725
5872
  create_agent: createAgentHandler,
5726
5873
  update_agent: updateAgentHandler,
5727
- // Tasks
5874
+ // Tasks (v2)
5728
5875
  get_task: getTaskHandler,
5729
5876
  list_tasks: listTasksHandler,
5730
5877
  create_task: createTaskHandler,
5878
+ claim_task: claimTaskHandler,
5731
5879
  complete_task: completeTaskHandler,
5732
5880
  block_task: blockTaskHandler,
5733
- // Blockers
5881
+ // Inbox (v2)
5882
+ list_inbox: listInboxHandler,
5883
+ resolve_inbox: resolveInboxHandler,
5884
+ // Blockers (legacy - kept for compatibility)
5734
5885
  get_blocker: getBlockerHandler,
5735
5886
  list_blockers: listBlockersHandler,
5736
5887
  create_blocker: createBlockerHandler,