@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.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",
@@ -5102,21 +5153,54 @@ var schemas = {
5102
5153
  required: []
5103
5154
  }
5104
5155
  },
5156
+ create_goal: {
5157
+ name: "create_goal",
5158
+ description: "Create a new goal (v2). Goals are first-class entities that contain tasks.",
5159
+ input_schema: {
5160
+ type: "object",
5161
+ properties: {
5162
+ title: {
5163
+ type: "string",
5164
+ description: "Goal title"
5165
+ },
5166
+ description: {
5167
+ type: "string",
5168
+ description: "Goal description and objectives"
5169
+ },
5170
+ priority: {
5171
+ type: "string",
5172
+ enum: ["low", "medium", "high", "urgent"],
5173
+ default: "medium",
5174
+ description: "Priority level"
5175
+ },
5176
+ target_date: {
5177
+ type: "string",
5178
+ description: "Optional: target completion date (ISO format)"
5179
+ },
5180
+ tags: {
5181
+ type: "array",
5182
+ items: { type: "string" },
5183
+ description: "Optional: tags for categorization"
5184
+ }
5185
+ },
5186
+ required: ["title"]
5187
+ }
5188
+ },
5105
5189
  create_task: {
5106
5190
  name: "create_task",
5107
- description: "Create a new task on an artifact.",
5191
+ description: "Create a new task under a goal.",
5108
5192
  input_schema: {
5109
5193
  type: "object",
5110
5194
  properties: {
5111
- artifact_id: {
5195
+ goal_id: {
5112
5196
  type: "string",
5113
- description: "The artifact to add the task to"
5197
+ description: "The goal UUID to add the task to"
5114
5198
  },
5115
- heading: {
5199
+ title: {
5116
5200
  type: "string",
5117
- description: "Task title/heading"
5201
+ description: "Task title"
5118
5202
  },
5119
- content: {
5203
+ description: {
5120
5204
  type: "string",
5121
5205
  description: "Task description and requirements"
5122
5206
  },
@@ -5127,26 +5211,41 @@ var schemas = {
5127
5211
  depends_on: {
5128
5212
  type: "array",
5129
5213
  items: { type: "string" },
5130
- description: "Optional: section_ids of tasks this depends on"
5214
+ description: "Optional: task IDs this depends on"
5131
5215
  },
5132
5216
  priority: {
5133
- type: "number",
5134
- enum: [1, 2, 3],
5135
- description: "Optional: priority (1=high, 2=medium, 3=low)"
5217
+ type: "string",
5218
+ enum: ["low", "medium", "high"],
5219
+ default: "medium",
5220
+ description: "Optional: priority level"
5136
5221
  }
5137
5222
  },
5138
- required: ["artifact_id", "heading", "content"]
5223
+ required: ["goal_id", "title"]
5224
+ }
5225
+ },
5226
+ claim_task: {
5227
+ name: "claim_task",
5228
+ description: "Claim a task for execution. Sets status to in_progress.",
5229
+ input_schema: {
5230
+ type: "object",
5231
+ properties: {
5232
+ task_id: {
5233
+ type: "string",
5234
+ description: "The task UUID to claim"
5235
+ }
5236
+ },
5237
+ required: ["task_id"]
5139
5238
  }
5140
5239
  },
5141
5240
  complete_task: {
5142
5241
  name: "complete_task",
5143
- description: "Mark a task as completed with output.",
5242
+ description: "Mark a task as completed. Returns list of unblocked tasks that can now be worked on.",
5144
5243
  input_schema: {
5145
5244
  type: "object",
5146
5245
  properties: {
5147
5246
  task_id: {
5148
5247
  type: "string",
5149
- description: "The task UUID or section_id"
5248
+ description: "The task UUID"
5150
5249
  },
5151
5250
  output: {
5152
5251
  type: "string",
@@ -5172,7 +5271,7 @@ var schemas = {
5172
5271
  properties: {
5173
5272
  task_id: {
5174
5273
  type: "string",
5175
- description: "The task UUID or section_id"
5274
+ description: "The task UUID"
5176
5275
  },
5177
5276
  reason: {
5178
5277
  type: "string",
@@ -5188,6 +5287,56 @@ var schemas = {
5188
5287
  }
5189
5288
  },
5190
5289
  // ---------------------------------------------------------------------------
5290
+ // Inbox Tools (v2)
5291
+ // ---------------------------------------------------------------------------
5292
+ list_inbox: {
5293
+ name: "list_inbox",
5294
+ description: "List pending inbox items (decisions, approvals, reviews).",
5295
+ input_schema: {
5296
+ type: "object",
5297
+ properties: {
5298
+ status: {
5299
+ type: "string",
5300
+ enum: ["pending", "resolved"],
5301
+ description: "Filter by status"
5302
+ },
5303
+ kind: {
5304
+ type: "string",
5305
+ enum: ["decision", "approval", "review"],
5306
+ description: "Filter by type"
5307
+ },
5308
+ limit: {
5309
+ type: "number",
5310
+ default: 20,
5311
+ description: "Max results"
5312
+ }
5313
+ },
5314
+ required: []
5315
+ }
5316
+ },
5317
+ resolve_inbox: {
5318
+ name: "resolve_inbox",
5319
+ description: "Resolve an inbox item with a decision. May trigger auto-execution.",
5320
+ input_schema: {
5321
+ type: "object",
5322
+ properties: {
5323
+ inbox_id: {
5324
+ type: "string",
5325
+ description: "The inbox item UUID"
5326
+ },
5327
+ decision: {
5328
+ type: "string",
5329
+ description: "The decision/resolution"
5330
+ },
5331
+ notes: {
5332
+ type: "string",
5333
+ description: "Optional: additional notes"
5334
+ }
5335
+ },
5336
+ required: ["inbox_id", "decision"]
5337
+ }
5338
+ },
5339
+ // ---------------------------------------------------------------------------
5191
5340
  // Blocker Tools
5192
5341
  // ---------------------------------------------------------------------------
5193
5342
  get_blocker: {
@@ -5342,7 +5491,9 @@ var permissionToTools = {
5342
5491
  "agents:read": ["get_agent", "list_agents"],
5343
5492
  "agents:write": ["create_agent", "update_agent"],
5344
5493
  "tasks:read": ["get_task", "list_tasks"],
5345
- "tasks:write": ["create_task", "complete_task", "block_task"],
5494
+ "tasks:write": ["create_task", "claim_task", "complete_task", "block_task"],
5495
+ "inbox:read": ["list_inbox"],
5496
+ "inbox:write": ["resolve_inbox"],
5346
5497
  "blockers:read": ["get_blocker", "list_blockers"],
5347
5498
  "blockers:write": ["create_blocker", "resolve_blocker"],
5348
5499
  "org:read": ["get_org_context", "get_project", "list_projects"]
@@ -5575,37 +5726,55 @@ var getTaskHandler = async (args, client) => {
5575
5726
  var listTasksHandler = async (args, client) => {
5576
5727
  try {
5577
5728
  const params = new URLSearchParams();
5578
- if (args.artifact_id) params.set("artifact_id", String(args.artifact_id));
5729
+ if (args.goal_id) params.set("goal_id", String(args.goal_id));
5579
5730
  if (args.status) params.set("status", String(args.status));
5580
5731
  if (args.assignee) params.set("assignee", String(args.assignee));
5581
5732
  if (args.limit) params.set("limit", String(args.limit));
5582
5733
  const query = params.toString();
5583
- const path3 = `/tasks${query ? `?${query}` : ""}`;
5734
+ const path3 = `/tasks/queue${query ? `?${query}` : ""}`;
5584
5735
  const data = await client.get(path3);
5585
5736
  return { success: true, data };
5586
5737
  } catch (error) {
5587
5738
  return { success: false, error: String(error) };
5588
5739
  }
5589
5740
  };
5741
+ var createGoalHandler = async (args, client) => {
5742
+ try {
5743
+ const data = await client.post("/goals", {
5744
+ title: args.title,
5745
+ description: args.description,
5746
+ priority: args.priority || "medium",
5747
+ target_date: args.target_date,
5748
+ tags: args.tags
5749
+ });
5750
+ return { success: true, data };
5751
+ } catch (error) {
5752
+ return { success: false, error: String(error) };
5753
+ }
5754
+ };
5590
5755
  var createTaskHandler = async (args, client) => {
5591
5756
  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",
5757
+ const data = await client.post("/tasks", {
5758
+ goal_id: args.goal_id,
5759
+ title: args.title,
5760
+ description: args.description,
5598
5761
  assignee_agent_id: args.assignee,
5599
5762
  depends_on: args.depends_on,
5600
- priority: args.priority,
5601
- agent_id: "system",
5602
- agent_name: "System"
5763
+ priority: args.priority || "medium"
5603
5764
  });
5604
5765
  return { success: true, data };
5605
5766
  } catch (error) {
5606
5767
  return { success: false, error: String(error) };
5607
5768
  }
5608
5769
  };
5770
+ var claimTaskHandler = async (args, client) => {
5771
+ try {
5772
+ const data = await client.post(`/tasks/${args.task_id}/claim`, {});
5773
+ return { success: true, data };
5774
+ } catch (error) {
5775
+ return { success: false, error: String(error) };
5776
+ }
5777
+ };
5609
5778
  var completeTaskHandler = async (args, client) => {
5610
5779
  try {
5611
5780
  const data = await client.post(`/tasks/${args.task_id}/complete`, {
@@ -5620,7 +5789,7 @@ var completeTaskHandler = async (args, client) => {
5620
5789
  };
5621
5790
  var blockTaskHandler = async (args, client) => {
5622
5791
  try {
5623
- const data = await client.post(`/tasks/${args.task_id}/fail`, {
5792
+ const data = await client.post(`/tasks/${args.task_id}/block`, {
5624
5793
  reason: args.reason,
5625
5794
  blocker_type: args.blocker_type
5626
5795
  });
@@ -5629,6 +5798,31 @@ var blockTaskHandler = async (args, client) => {
5629
5798
  return { success: false, error: String(error) };
5630
5799
  }
5631
5800
  };
5801
+ var listInboxHandler = async (args, client) => {
5802
+ try {
5803
+ const params = new URLSearchParams();
5804
+ if (args.status) params.set("status", String(args.status));
5805
+ if (args.kind) params.set("kind", String(args.kind));
5806
+ if (args.limit) params.set("limit", String(args.limit));
5807
+ const query = params.toString();
5808
+ const path3 = `/inbox${query ? `?${query}` : ""}`;
5809
+ const data = await client.get(path3);
5810
+ return { success: true, data };
5811
+ } catch (error) {
5812
+ return { success: false, error: String(error) };
5813
+ }
5814
+ };
5815
+ var resolveInboxHandler = async (args, client) => {
5816
+ try {
5817
+ const data = await client.post(`/inbox/${args.inbox_id}/resolve`, {
5818
+ decision: args.decision,
5819
+ notes: args.notes
5820
+ });
5821
+ return { success: true, data };
5822
+ } catch (error) {
5823
+ return { success: false, error: String(error) };
5824
+ }
5825
+ };
5632
5826
  var getBlockerHandler = async (args, client) => {
5633
5827
  try {
5634
5828
  const data = await client.get(`/blockers/${args.blocker_id}`);
@@ -5724,13 +5918,19 @@ var handlers = {
5724
5918
  list_agents: listAgentsHandler,
5725
5919
  create_agent: createAgentHandler,
5726
5920
  update_agent: updateAgentHandler,
5727
- // Tasks
5921
+ // Goals (v2)
5922
+ create_goal: createGoalHandler,
5923
+ // Tasks (v2)
5728
5924
  get_task: getTaskHandler,
5729
5925
  list_tasks: listTasksHandler,
5730
5926
  create_task: createTaskHandler,
5927
+ claim_task: claimTaskHandler,
5731
5928
  complete_task: completeTaskHandler,
5732
5929
  block_task: blockTaskHandler,
5733
- // Blockers
5930
+ // Inbox (v2)
5931
+ list_inbox: listInboxHandler,
5932
+ resolve_inbox: resolveInboxHandler,
5933
+ // Blockers (legacy - kept for compatibility)
5734
5934
  get_blocker: getBlockerHandler,
5735
5935
  list_blockers: listBlockersHandler,
5736
5936
  create_blocker: createBlockerHandler,