@artyfacts/claude 1.1.2 → 1.2.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/dist/chunk-EROV5RIA.mjs +741 -0
- package/dist/cli.js +184 -4
- package/dist/cli.mjs +10 -3
- package/dist/index.d.mts +79 -1
- package/dist/index.d.ts +79 -1
- package/dist/index.js +181 -2
- package/dist/index.mjs +7 -1
- package/package.json +1 -1
- package/src/cli.ts +10 -3
- package/src/context.ts +260 -0
- package/src/executor.ts +44 -2
- package/src/index.ts +17 -0
package/dist/cli.js
CHANGED
|
@@ -216,6 +216,153 @@ async function getCredentials(options) {
|
|
|
216
216
|
|
|
217
217
|
// src/executor.ts
|
|
218
218
|
var import_child_process = require("child_process");
|
|
219
|
+
|
|
220
|
+
// src/context.ts
|
|
221
|
+
var ContextFetcher = class {
|
|
222
|
+
config;
|
|
223
|
+
constructor(config) {
|
|
224
|
+
this.config = config;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Fetch full context for a task
|
|
228
|
+
*/
|
|
229
|
+
async fetchTaskContext(taskId) {
|
|
230
|
+
const response = await fetch(
|
|
231
|
+
`${this.config.baseUrl}/tasks/${taskId}/context`,
|
|
232
|
+
{
|
|
233
|
+
headers: {
|
|
234
|
+
"Authorization": `Bearer ${this.config.apiKey}`,
|
|
235
|
+
"Accept": "application/json"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
if (!response.ok) {
|
|
240
|
+
const errorText = await response.text().catch(() => "Unknown error");
|
|
241
|
+
throw new Error(`Failed to fetch task context: ${response.status} - ${errorText}`);
|
|
242
|
+
}
|
|
243
|
+
const data = await response.json();
|
|
244
|
+
return data;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
function buildPromptWithContext(context) {
|
|
248
|
+
const parts = [];
|
|
249
|
+
parts.push(`You are an AI agent working within the Artyfacts task management system.
|
|
250
|
+
|
|
251
|
+
Your job is to complete the assigned task. You have full context about the organization, project, and related work.
|
|
252
|
+
|
|
253
|
+
Guidelines:
|
|
254
|
+
- Be thorough but concise
|
|
255
|
+
- If the task requires code, provide working code
|
|
256
|
+
- If the task requires analysis, provide structured findings
|
|
257
|
+
- If the task requires a decision, explain your reasoning
|
|
258
|
+
- If you cannot complete the task, explain why
|
|
259
|
+
|
|
260
|
+
Format your response as follows:
|
|
261
|
+
1. First, provide your main output (the task deliverable)
|
|
262
|
+
2. End with a brief summary line starting with "SUMMARY:"`);
|
|
263
|
+
parts.push("");
|
|
264
|
+
parts.push("---");
|
|
265
|
+
parts.push("");
|
|
266
|
+
parts.push("## Organization Context");
|
|
267
|
+
parts.push(`**${context.organization.name}**`);
|
|
268
|
+
if (context.organization.context) {
|
|
269
|
+
parts.push("");
|
|
270
|
+
parts.push(formatOrgContext(context.organization.context));
|
|
271
|
+
}
|
|
272
|
+
parts.push("");
|
|
273
|
+
if (context.project) {
|
|
274
|
+
parts.push(`## Project: ${context.project.name}`);
|
|
275
|
+
if (context.project.description) {
|
|
276
|
+
parts.push(context.project.description);
|
|
277
|
+
}
|
|
278
|
+
parts.push("");
|
|
279
|
+
}
|
|
280
|
+
parts.push(`## Artifact: ${context.artifact.title}`);
|
|
281
|
+
if (context.artifact.summary) {
|
|
282
|
+
parts.push(context.artifact.summary);
|
|
283
|
+
}
|
|
284
|
+
if (context.artifact.description) {
|
|
285
|
+
parts.push("");
|
|
286
|
+
parts.push(context.artifact.description);
|
|
287
|
+
}
|
|
288
|
+
parts.push("");
|
|
289
|
+
const relatedSections = context.artifact.sections.filter(
|
|
290
|
+
(s) => s.id !== context.task.id
|
|
291
|
+
);
|
|
292
|
+
if (relatedSections.length > 0) {
|
|
293
|
+
parts.push("### Related Sections:");
|
|
294
|
+
for (const section of relatedSections) {
|
|
295
|
+
const preview = section.content ? section.content.substring(0, 200) + (section.content.length > 200 ? "..." : "") : "No content";
|
|
296
|
+
const statusBadge = section.task_status ? ` [${section.task_status}]` : "";
|
|
297
|
+
parts.push(`- **${section.heading}**${statusBadge}: ${preview}`);
|
|
298
|
+
}
|
|
299
|
+
parts.push("");
|
|
300
|
+
}
|
|
301
|
+
parts.push("---");
|
|
302
|
+
parts.push("");
|
|
303
|
+
parts.push(`## Your Task: ${context.task.heading}`);
|
|
304
|
+
if (context.task.priority) {
|
|
305
|
+
const priorityLabels = ["\u{1F534} High", "\u{1F7E1} Medium", "\u{1F7E2} Low"];
|
|
306
|
+
parts.push(`**Priority:** ${priorityLabels[context.task.priority - 1] || "Medium"}`);
|
|
307
|
+
}
|
|
308
|
+
parts.push("");
|
|
309
|
+
parts.push("### Description");
|
|
310
|
+
parts.push(context.task.content || "No additional description provided.");
|
|
311
|
+
parts.push("");
|
|
312
|
+
if (context.task.expected_output) {
|
|
313
|
+
parts.push("### Expected Output");
|
|
314
|
+
if (context.task.expected_output.format) {
|
|
315
|
+
parts.push(`**Format:** ${context.task.expected_output.format}`);
|
|
316
|
+
}
|
|
317
|
+
if (context.task.expected_output.requirements && context.task.expected_output.requirements.length > 0) {
|
|
318
|
+
parts.push("**Requirements:**");
|
|
319
|
+
for (const req of context.task.expected_output.requirements) {
|
|
320
|
+
parts.push(`- ${req}`);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
parts.push("");
|
|
324
|
+
}
|
|
325
|
+
parts.push("---");
|
|
326
|
+
parts.push("");
|
|
327
|
+
parts.push("Complete this task and provide your output below.");
|
|
328
|
+
return parts.join("\n");
|
|
329
|
+
}
|
|
330
|
+
function formatOrgContext(context) {
|
|
331
|
+
const trimmed = context.trim();
|
|
332
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
333
|
+
try {
|
|
334
|
+
const parsed = JSON.parse(trimmed);
|
|
335
|
+
return formatContextObject(parsed);
|
|
336
|
+
} catch {
|
|
337
|
+
return context;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return context;
|
|
341
|
+
}
|
|
342
|
+
function formatContextObject(obj, indent = "") {
|
|
343
|
+
if (typeof obj !== "object" || obj === null) {
|
|
344
|
+
return String(obj);
|
|
345
|
+
}
|
|
346
|
+
if (Array.isArray(obj)) {
|
|
347
|
+
return obj.map((item) => `${indent}- ${formatContextObject(item, indent + " ")}`).join("\n");
|
|
348
|
+
}
|
|
349
|
+
const lines = [];
|
|
350
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
351
|
+
const label = key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
352
|
+
if (typeof value === "object" && value !== null) {
|
|
353
|
+
lines.push(`${indent}**${label}:**`);
|
|
354
|
+
lines.push(formatContextObject(value, indent + " "));
|
|
355
|
+
} else {
|
|
356
|
+
lines.push(`${indent}- **${label}:** ${value}`);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return lines.join("\n");
|
|
360
|
+
}
|
|
361
|
+
function createContextFetcher(config) {
|
|
362
|
+
return new ContextFetcher(config);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// src/executor.ts
|
|
219
366
|
var DEFAULT_TIMEOUT = 5 * 60 * 1e3;
|
|
220
367
|
var DEFAULT_SYSTEM_PROMPT = `You are an AI agent working within the Artyfacts task management system.
|
|
221
368
|
|
|
@@ -236,25 +383,51 @@ Format your response as follows:
|
|
|
236
383
|
2. End with a brief summary line starting with "SUMMARY:"`;
|
|
237
384
|
var ClaudeExecutor = class {
|
|
238
385
|
config;
|
|
386
|
+
contextFetcher = null;
|
|
239
387
|
constructor(config = {}) {
|
|
240
388
|
this.config = {
|
|
241
389
|
...config,
|
|
242
390
|
timeout: config.timeout || DEFAULT_TIMEOUT,
|
|
243
391
|
claudePath: config.claudePath || "claude"
|
|
244
392
|
};
|
|
393
|
+
if (config.baseUrl && config.apiKey) {
|
|
394
|
+
this.contextFetcher = createContextFetcher({
|
|
395
|
+
baseUrl: config.baseUrl,
|
|
396
|
+
apiKey: config.apiKey
|
|
397
|
+
});
|
|
398
|
+
}
|
|
245
399
|
}
|
|
246
400
|
/**
|
|
247
401
|
* Execute a task using Claude Code CLI
|
|
402
|
+
*
|
|
403
|
+
* If full context is available (baseUrl + apiKey configured), fetches
|
|
404
|
+
* organization, project, artifact, and related sections for a rich prompt.
|
|
248
405
|
*/
|
|
249
406
|
async execute(task) {
|
|
250
407
|
try {
|
|
251
|
-
|
|
408
|
+
let prompt;
|
|
409
|
+
let fullContext = null;
|
|
410
|
+
const useFullContext = this.config.useFullContext !== false && this.contextFetcher;
|
|
411
|
+
if (useFullContext) {
|
|
412
|
+
try {
|
|
413
|
+
fullContext = await this.contextFetcher.fetchTaskContext(task.taskId);
|
|
414
|
+
prompt = buildPromptWithContext(fullContext);
|
|
415
|
+
console.log(" \u{1F4DA} Using full context (org, project, artifact, related sections)");
|
|
416
|
+
} catch (contextError) {
|
|
417
|
+
console.warn(" \u26A0\uFE0F Could not fetch full context, using minimal prompt");
|
|
418
|
+
console.warn(` ${contextError instanceof Error ? contextError.message : contextError}`);
|
|
419
|
+
prompt = this.buildTaskPrompt(task);
|
|
420
|
+
}
|
|
421
|
+
} else {
|
|
422
|
+
prompt = this.buildTaskPrompt(task);
|
|
423
|
+
}
|
|
252
424
|
const output = await this.runClaude(prompt);
|
|
253
425
|
const { content, summary } = this.parseResponse(output, task.heading);
|
|
254
426
|
return {
|
|
255
427
|
success: true,
|
|
256
428
|
output: content,
|
|
257
|
-
summary
|
|
429
|
+
summary,
|
|
430
|
+
promptUsed: prompt
|
|
258
431
|
};
|
|
259
432
|
} catch (error) {
|
|
260
433
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -730,7 +903,11 @@ async function runAgent(options) {
|
|
|
730
903
|
}
|
|
731
904
|
let executor = null;
|
|
732
905
|
if (!options.dryRun) {
|
|
733
|
-
executor = createExecutor(
|
|
906
|
+
executor = createExecutor({
|
|
907
|
+
// Pass API credentials so executor can fetch full context
|
|
908
|
+
baseUrl: options.baseUrl,
|
|
909
|
+
apiKey: credentials.apiKey
|
|
910
|
+
});
|
|
734
911
|
const installed = await executor.isInstalled();
|
|
735
912
|
if (!installed) {
|
|
736
913
|
console.error("\u274C Claude Code CLI not found");
|
|
@@ -746,6 +923,7 @@ async function runAgent(options) {
|
|
|
746
923
|
process.exit(1);
|
|
747
924
|
}
|
|
748
925
|
console.log("\u2705 Claude Code connected");
|
|
926
|
+
console.log("\u{1F4DA} Context fetching enabled (will fetch org/project/artifact context)");
|
|
749
927
|
}
|
|
750
928
|
const listener = createListener({
|
|
751
929
|
apiKey: credentials.apiKey,
|
|
@@ -759,7 +937,9 @@ async function runAgent(options) {
|
|
|
759
937
|
case "connected":
|
|
760
938
|
console.log(`\u2705 Connected as ${credentials.agentId}`);
|
|
761
939
|
console.log("\u{1F442} Listening for tasks...\n");
|
|
762
|
-
|
|
940
|
+
if (!options.dryRun) {
|
|
941
|
+
checkAndClaimTasks(options.baseUrl, credentials.apiKey, credentials.agentId, activeTasks, executor, options.dryRun);
|
|
942
|
+
}
|
|
763
943
|
break;
|
|
764
944
|
case "reconnecting":
|
|
765
945
|
console.log("\u{1F504} Reconnecting...");
|
package/dist/cli.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getCredentials,
|
|
7
7
|
loadCredentials,
|
|
8
8
|
promptForApiKey
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EROV5RIA.mjs";
|
|
10
10
|
|
|
11
11
|
// src/cli.ts
|
|
12
12
|
import { Command } from "commander";
|
|
@@ -158,7 +158,11 @@ async function runAgent(options) {
|
|
|
158
158
|
}
|
|
159
159
|
let executor = null;
|
|
160
160
|
if (!options.dryRun) {
|
|
161
|
-
executor = createExecutor(
|
|
161
|
+
executor = createExecutor({
|
|
162
|
+
// Pass API credentials so executor can fetch full context
|
|
163
|
+
baseUrl: options.baseUrl,
|
|
164
|
+
apiKey: credentials.apiKey
|
|
165
|
+
});
|
|
162
166
|
const installed = await executor.isInstalled();
|
|
163
167
|
if (!installed) {
|
|
164
168
|
console.error("\u274C Claude Code CLI not found");
|
|
@@ -174,6 +178,7 @@ async function runAgent(options) {
|
|
|
174
178
|
process.exit(1);
|
|
175
179
|
}
|
|
176
180
|
console.log("\u2705 Claude Code connected");
|
|
181
|
+
console.log("\u{1F4DA} Context fetching enabled (will fetch org/project/artifact context)");
|
|
177
182
|
}
|
|
178
183
|
const listener = createListener({
|
|
179
184
|
apiKey: credentials.apiKey,
|
|
@@ -187,7 +192,9 @@ async function runAgent(options) {
|
|
|
187
192
|
case "connected":
|
|
188
193
|
console.log(`\u2705 Connected as ${credentials.agentId}`);
|
|
189
194
|
console.log("\u{1F442} Listening for tasks...\n");
|
|
190
|
-
|
|
195
|
+
if (!options.dryRun) {
|
|
196
|
+
checkAndClaimTasks(options.baseUrl, credentials.apiKey, credentials.agentId, activeTasks, executor, options.dryRun);
|
|
197
|
+
}
|
|
191
198
|
break;
|
|
192
199
|
case "reconnecting":
|
|
193
200
|
console.log("\u{1F504} Reconnecting...");
|
package/dist/index.d.mts
CHANGED
|
@@ -59,6 +59,9 @@ declare function getCredentials(options?: {
|
|
|
59
59
|
*
|
|
60
60
|
* Executes tasks by shelling out to the Claude Code CLI (claude).
|
|
61
61
|
* This uses the user's existing Claude Code authentication - no separate API key needed.
|
|
62
|
+
*
|
|
63
|
+
* Now supports fetching full context (organization, project, artifact, related sections)
|
|
64
|
+
* to provide Claude with the information needed to complete tasks effectively.
|
|
62
65
|
*/
|
|
63
66
|
interface TaskContext {
|
|
64
67
|
/** Task ID (section ID) */
|
|
@@ -85,6 +88,8 @@ interface ExecutionResult {
|
|
|
85
88
|
summary: string;
|
|
86
89
|
/** Any error message if failed */
|
|
87
90
|
error?: string;
|
|
91
|
+
/** The prompt that was used (for debugging) */
|
|
92
|
+
promptUsed?: string;
|
|
88
93
|
}
|
|
89
94
|
interface ExecutorConfig {
|
|
90
95
|
/** Path to claude CLI (default: 'claude') */
|
|
@@ -93,12 +98,22 @@ interface ExecutorConfig {
|
|
|
93
98
|
timeout?: number;
|
|
94
99
|
/** System prompt prefix */
|
|
95
100
|
systemPromptPrefix?: string;
|
|
101
|
+
/** Artyfacts API base URL (for fetching context) */
|
|
102
|
+
baseUrl?: string;
|
|
103
|
+
/** Artyfacts API key (for fetching context) */
|
|
104
|
+
apiKey?: string;
|
|
105
|
+
/** Whether to use full context from API (default: true if apiKey provided) */
|
|
106
|
+
useFullContext?: boolean;
|
|
96
107
|
}
|
|
97
108
|
declare class ClaudeExecutor {
|
|
98
109
|
private config;
|
|
110
|
+
private contextFetcher;
|
|
99
111
|
constructor(config?: ExecutorConfig);
|
|
100
112
|
/**
|
|
101
113
|
* Execute a task using Claude Code CLI
|
|
114
|
+
*
|
|
115
|
+
* If full context is available (baseUrl + apiKey configured), fetches
|
|
116
|
+
* organization, project, artifact, and related sections for a rich prompt.
|
|
102
117
|
*/
|
|
103
118
|
execute(task: TaskContext): Promise<ExecutionResult>;
|
|
104
119
|
/**
|
|
@@ -238,4 +253,67 @@ declare class ArtyfactsListener {
|
|
|
238
253
|
*/
|
|
239
254
|
declare function createListener(config: ListenerConfig): ArtyfactsListener;
|
|
240
255
|
|
|
241
|
-
|
|
256
|
+
/**
|
|
257
|
+
* Context fetcher for Artyfacts tasks
|
|
258
|
+
*
|
|
259
|
+
* Fetches full context including organization, project, artifact, and related sections.
|
|
260
|
+
*/
|
|
261
|
+
interface OrganizationContext {
|
|
262
|
+
id: string;
|
|
263
|
+
name: string;
|
|
264
|
+
context?: string;
|
|
265
|
+
}
|
|
266
|
+
interface ProjectContext {
|
|
267
|
+
id: string;
|
|
268
|
+
name: string;
|
|
269
|
+
description?: string;
|
|
270
|
+
}
|
|
271
|
+
interface SectionContext {
|
|
272
|
+
id: string;
|
|
273
|
+
heading: string;
|
|
274
|
+
content?: string;
|
|
275
|
+
section_type?: string;
|
|
276
|
+
task_status?: string;
|
|
277
|
+
}
|
|
278
|
+
interface ArtifactContext {
|
|
279
|
+
id: string;
|
|
280
|
+
title: string;
|
|
281
|
+
summary?: string;
|
|
282
|
+
description?: string;
|
|
283
|
+
artifact_type?: string;
|
|
284
|
+
sections: SectionContext[];
|
|
285
|
+
}
|
|
286
|
+
interface TaskFullContext {
|
|
287
|
+
task: {
|
|
288
|
+
id: string;
|
|
289
|
+
heading: string;
|
|
290
|
+
content: string;
|
|
291
|
+
expected_output?: {
|
|
292
|
+
format?: string;
|
|
293
|
+
requirements?: string[];
|
|
294
|
+
};
|
|
295
|
+
priority?: number;
|
|
296
|
+
};
|
|
297
|
+
artifact: ArtifactContext;
|
|
298
|
+
project?: ProjectContext;
|
|
299
|
+
organization: OrganizationContext;
|
|
300
|
+
}
|
|
301
|
+
interface ContextFetcherConfig {
|
|
302
|
+
baseUrl: string;
|
|
303
|
+
apiKey: string;
|
|
304
|
+
}
|
|
305
|
+
declare class ContextFetcher {
|
|
306
|
+
private config;
|
|
307
|
+
constructor(config: ContextFetcherConfig);
|
|
308
|
+
/**
|
|
309
|
+
* Fetch full context for a task
|
|
310
|
+
*/
|
|
311
|
+
fetchTaskContext(taskId: string): Promise<TaskFullContext>;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Build a rich prompt with full context
|
|
315
|
+
*/
|
|
316
|
+
declare function buildPromptWithContext(context: TaskFullContext): string;
|
|
317
|
+
declare function createContextFetcher(config: ContextFetcherConfig): ContextFetcher;
|
|
318
|
+
|
|
319
|
+
export { type ArtifactContext, type ArtyfactsEvent, ArtyfactsListener, ClaudeExecutor, type ConnectedEvent, type ConnectionState, ContextFetcher, type ContextFetcherConfig, type Credentials, type DeviceAuthResponse, type EventCallback, type ExecutionResult, type ExecutorConfig, type HeartbeatEvent, type ListenerConfig, type OrganizationContext, type ProjectContext, type SectionContext, type TaskAssignedEvent, type TaskContext, type TaskFullContext, type TokenResponse, buildPromptWithContext, clearCredentials, createContextFetcher, createExecutor, createListener, getCredentials, loadCredentials, promptForApiKey, runDeviceAuth, saveCredentials };
|
package/dist/index.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ declare function getCredentials(options?: {
|
|
|
59
59
|
*
|
|
60
60
|
* Executes tasks by shelling out to the Claude Code CLI (claude).
|
|
61
61
|
* This uses the user's existing Claude Code authentication - no separate API key needed.
|
|
62
|
+
*
|
|
63
|
+
* Now supports fetching full context (organization, project, artifact, related sections)
|
|
64
|
+
* to provide Claude with the information needed to complete tasks effectively.
|
|
62
65
|
*/
|
|
63
66
|
interface TaskContext {
|
|
64
67
|
/** Task ID (section ID) */
|
|
@@ -85,6 +88,8 @@ interface ExecutionResult {
|
|
|
85
88
|
summary: string;
|
|
86
89
|
/** Any error message if failed */
|
|
87
90
|
error?: string;
|
|
91
|
+
/** The prompt that was used (for debugging) */
|
|
92
|
+
promptUsed?: string;
|
|
88
93
|
}
|
|
89
94
|
interface ExecutorConfig {
|
|
90
95
|
/** Path to claude CLI (default: 'claude') */
|
|
@@ -93,12 +98,22 @@ interface ExecutorConfig {
|
|
|
93
98
|
timeout?: number;
|
|
94
99
|
/** System prompt prefix */
|
|
95
100
|
systemPromptPrefix?: string;
|
|
101
|
+
/** Artyfacts API base URL (for fetching context) */
|
|
102
|
+
baseUrl?: string;
|
|
103
|
+
/** Artyfacts API key (for fetching context) */
|
|
104
|
+
apiKey?: string;
|
|
105
|
+
/** Whether to use full context from API (default: true if apiKey provided) */
|
|
106
|
+
useFullContext?: boolean;
|
|
96
107
|
}
|
|
97
108
|
declare class ClaudeExecutor {
|
|
98
109
|
private config;
|
|
110
|
+
private contextFetcher;
|
|
99
111
|
constructor(config?: ExecutorConfig);
|
|
100
112
|
/**
|
|
101
113
|
* Execute a task using Claude Code CLI
|
|
114
|
+
*
|
|
115
|
+
* If full context is available (baseUrl + apiKey configured), fetches
|
|
116
|
+
* organization, project, artifact, and related sections for a rich prompt.
|
|
102
117
|
*/
|
|
103
118
|
execute(task: TaskContext): Promise<ExecutionResult>;
|
|
104
119
|
/**
|
|
@@ -238,4 +253,67 @@ declare class ArtyfactsListener {
|
|
|
238
253
|
*/
|
|
239
254
|
declare function createListener(config: ListenerConfig): ArtyfactsListener;
|
|
240
255
|
|
|
241
|
-
|
|
256
|
+
/**
|
|
257
|
+
* Context fetcher for Artyfacts tasks
|
|
258
|
+
*
|
|
259
|
+
* Fetches full context including organization, project, artifact, and related sections.
|
|
260
|
+
*/
|
|
261
|
+
interface OrganizationContext {
|
|
262
|
+
id: string;
|
|
263
|
+
name: string;
|
|
264
|
+
context?: string;
|
|
265
|
+
}
|
|
266
|
+
interface ProjectContext {
|
|
267
|
+
id: string;
|
|
268
|
+
name: string;
|
|
269
|
+
description?: string;
|
|
270
|
+
}
|
|
271
|
+
interface SectionContext {
|
|
272
|
+
id: string;
|
|
273
|
+
heading: string;
|
|
274
|
+
content?: string;
|
|
275
|
+
section_type?: string;
|
|
276
|
+
task_status?: string;
|
|
277
|
+
}
|
|
278
|
+
interface ArtifactContext {
|
|
279
|
+
id: string;
|
|
280
|
+
title: string;
|
|
281
|
+
summary?: string;
|
|
282
|
+
description?: string;
|
|
283
|
+
artifact_type?: string;
|
|
284
|
+
sections: SectionContext[];
|
|
285
|
+
}
|
|
286
|
+
interface TaskFullContext {
|
|
287
|
+
task: {
|
|
288
|
+
id: string;
|
|
289
|
+
heading: string;
|
|
290
|
+
content: string;
|
|
291
|
+
expected_output?: {
|
|
292
|
+
format?: string;
|
|
293
|
+
requirements?: string[];
|
|
294
|
+
};
|
|
295
|
+
priority?: number;
|
|
296
|
+
};
|
|
297
|
+
artifact: ArtifactContext;
|
|
298
|
+
project?: ProjectContext;
|
|
299
|
+
organization: OrganizationContext;
|
|
300
|
+
}
|
|
301
|
+
interface ContextFetcherConfig {
|
|
302
|
+
baseUrl: string;
|
|
303
|
+
apiKey: string;
|
|
304
|
+
}
|
|
305
|
+
declare class ContextFetcher {
|
|
306
|
+
private config;
|
|
307
|
+
constructor(config: ContextFetcherConfig);
|
|
308
|
+
/**
|
|
309
|
+
* Fetch full context for a task
|
|
310
|
+
*/
|
|
311
|
+
fetchTaskContext(taskId: string): Promise<TaskFullContext>;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Build a rich prompt with full context
|
|
315
|
+
*/
|
|
316
|
+
declare function buildPromptWithContext(context: TaskFullContext): string;
|
|
317
|
+
declare function createContextFetcher(config: ContextFetcherConfig): ContextFetcher;
|
|
318
|
+
|
|
319
|
+
export { type ArtifactContext, type ArtyfactsEvent, ArtyfactsListener, ClaudeExecutor, type ConnectedEvent, type ConnectionState, ContextFetcher, type ContextFetcherConfig, type Credentials, type DeviceAuthResponse, type EventCallback, type ExecutionResult, type ExecutorConfig, type HeartbeatEvent, type ListenerConfig, type OrganizationContext, type ProjectContext, type SectionContext, type TaskAssignedEvent, type TaskContext, type TaskFullContext, type TokenResponse, buildPromptWithContext, clearCredentials, createContextFetcher, createExecutor, createListener, getCredentials, loadCredentials, promptForApiKey, runDeviceAuth, saveCredentials };
|