@autonome-research/thread-phase 3.3.0 → 4.0.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/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/parse-json.d.ts +12 -0
- package/dist/agent/parse-json.d.ts.map +1 -1
- package/dist/agent/parse-json.js +24 -7
- package/dist/agent/parse-json.js.map +1 -1
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +16 -12
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent-runner.d.ts +1 -1
- package/dist/agent-runner.d.ts.map +1 -1
- package/dist/agent-runner.js +1 -1
- package/dist/agent-runner.js.map +1 -1
- package/dist/agents/authoring/index.d.ts +49 -0
- package/dist/agents/authoring/index.d.ts.map +1 -0
- package/dist/agents/authoring/index.js +56 -0
- package/dist/agents/authoring/index.js.map +1 -0
- package/dist/agents/event-bus.d.ts +0 -2
- package/dist/agents/event-bus.d.ts.map +1 -1
- package/dist/agents/event-bus.js +0 -2
- package/dist/agents/event-bus.js.map +1 -1
- package/dist/agents/index.d.ts +19 -9
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +25 -15
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/inference-adapter.d.ts +0 -3
- package/dist/agents/inference-adapter.d.ts.map +1 -1
- package/dist/agents/inference-adapter.js +0 -2
- package/dist/agents/inference-adapter.js.map +1 -1
- package/dist/agents/job-store-bridge.d.ts +0 -3
- package/dist/agents/job-store-bridge.d.ts.map +1 -1
- package/dist/agents/job-store-bridge.js +0 -2
- package/dist/agents/job-store-bridge.js.map +1 -1
- package/dist/agents/memory.d.ts +0 -3
- package/dist/agents/memory.d.ts.map +1 -1
- package/dist/agents/memory.js +0 -1
- package/dist/agents/memory.js.map +1 -1
- package/dist/agents/protocol.d.ts +0 -15
- package/dist/agents/protocol.d.ts.map +1 -1
- package/dist/agents/protocol.js +0 -3
- package/dist/agents/protocol.js.map +1 -1
- package/dist/agents/structured-output.d.ts +16 -5
- package/dist/agents/structured-output.d.ts.map +1 -1
- package/dist/agents/structured-output.js +16 -3
- package/dist/agents/structured-output.js.map +1 -1
- package/dist/agents/thread.d.ts +0 -7
- package/dist/agents/thread.d.ts.map +1 -1
- package/dist/agents/thread.js +0 -6
- package/dist/agents/thread.js.map +1 -1
- package/dist/agents/with-memory.d.ts +0 -3
- package/dist/agents/with-memory.d.ts.map +1 -1
- package/dist/agents/with-memory.js +0 -2
- package/dist/agents/with-memory.js.map +1 -1
- package/dist/agents/with-thread.d.ts +0 -3
- package/dist/agents/with-thread.d.ts.map +1 -1
- package/dist/agents/with-thread.js +0 -2
- package/dist/agents/with-thread.js.map +1 -1
- package/dist/helpers/hook.d.ts +34 -2
- package/dist/helpers/hook.d.ts.map +1 -1
- package/dist/helpers/hook.js +72 -5
- package/dist/helpers/hook.js.map +1 -1
- package/dist/helpers/index.d.ts +11 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +11 -1
- package/dist/helpers/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/error-message.d.ts +20 -0
- package/dist/internal/error-message.d.ts.map +1 -0
- package/dist/internal/error-message.js +57 -0
- package/dist/internal/error-message.js.map +1 -0
- package/dist/messages.d.ts +11 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/orchestrator.d.ts +1 -1
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +14 -1
- package/dist/orchestrator.js.map +1 -1
- package/dist/patterns/bounded-fanout-of.d.ts +2 -6
- package/dist/patterns/bounded-fanout-of.d.ts.map +1 -1
- package/dist/patterns/bounded-fanout-of.js +1 -4
- package/dist/patterns/bounded-fanout-of.js.map +1 -1
- package/dist/patterns/index.d.ts +22 -0
- package/dist/patterns/index.d.ts.map +1 -1
- package/dist/patterns/index.js +22 -0
- package/dist/patterns/index.js.map +1 -1
- package/dist/phase.d.ts +3 -0
- package/dist/phase.d.ts.map +1 -1
- package/dist/phase.js.map +1 -1
- package/dist/session/sse.d.ts +5 -1
- package/dist/session/sse.d.ts.map +1 -1
- package/dist/session/sse.js +56 -16
- package/dist/session/sse.js.map +1 -1
- package/dist/tools/registry.d.ts +6 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +2 -2
- package/dist/tools/registry.js.map +1 -1
- package/package.json +2 -1
package/dist/agent/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* is intentionally NOT a configured package subpath).
|
|
21
21
|
*/
|
|
22
22
|
export { runAgentWithTools } from './runner.js';
|
|
23
|
-
export { parseJSON } from './parse-json.js';
|
|
23
|
+
export { parseJSON, parseJSONStrict } from './parse-json.js';
|
|
24
24
|
export type { AgentConfig, ActivityEntry, AgentRunResult, AgentRunnerOptions, AgentStreamEvent, FinishReason, UsageInfo, } from './types.js';
|
|
25
25
|
export { toOpenAIMessages, toOpenAITools } from './openai-adapter.js';
|
|
26
26
|
export { consumeStream, looksLikeToolCallText, normalizeFinishReason, type AccumulatedRound, } from './stream-consumer.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE7D,YAAY,EACV,WAAW,EACX,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,SAAS,GACV,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,gBAAgB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/agent/index.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* is intentionally NOT a configured package subpath).
|
|
21
21
|
*/
|
|
22
22
|
export { runAgentWithTools } from './runner.js';
|
|
23
|
-
export { parseJSON } from './parse-json.js';
|
|
23
|
+
export { parseJSON, parseJSONStrict } from './parse-json.js';
|
|
24
24
|
// @internal — see file header. Lower-level pieces for advanced callers.
|
|
25
25
|
export { toOpenAIMessages, toOpenAITools } from './openai-adapter.js';
|
|
26
26
|
export { consumeStream, looksLikeToolCallText, normalizeFinishReason, } from './stream-consumer.js';
|
package/dist/agent/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAY7D,wEAAwE;AACxE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,qBAAqB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -13,4 +13,16 @@
|
|
|
13
13
|
* the parsed value — otherwise truncation is invisible.
|
|
14
14
|
*/
|
|
15
15
|
export declare function parseJSON<T>(text: string, fallback: T, onError?: (preview: string, err: Error) => void): T;
|
|
16
|
+
/**
|
|
17
|
+
* Strict counterpart to `parseJSON`: same extraction logic (markdown
|
|
18
|
+
* fences, embedded `{...}`, depth guard) but throws on failure instead
|
|
19
|
+
* of returning a fallback. Use this when the caller has already checked
|
|
20
|
+
* `AgentRunResult.finishReason` and KNOWS the response should be valid
|
|
21
|
+
* JSON — surfacing the parse error is more useful than a silent default.
|
|
22
|
+
*
|
|
23
|
+
* Throws `SyntaxError` for malformed JSON; throws `RangeError` if input
|
|
24
|
+
* nesting exceeds MAX_PARSE_DEPTH (mirroring the V8 safeguard in the
|
|
25
|
+
* tolerant variant).
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseJSONStrict<T>(text: string): T;
|
|
16
28
|
//# sourceMappingURL=parse-json.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-json.d.ts","sourceRoot":"","sources":["../../src/agent/parse-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,wBAAgB,SAAS,CAAC,CAAC,EACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,EACX,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,KAAK,IAAI,GAC9C,CAAC,
|
|
1
|
+
{"version":3,"file":"parse-json.d.ts","sourceRoot":"","sources":["../../src/agent/parse-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,wBAAgB,SAAS,CAAC,CAAC,EACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,EACX,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,KAAK,IAAI,GAC9C,CAAC,CAOH;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAElD"}
|
package/dist/agent/parse-json.js
CHANGED
|
@@ -23,19 +23,36 @@
|
|
|
23
23
|
const MAX_PARSE_DEPTH = 1000;
|
|
24
24
|
export function parseJSON(text, fallback, onError) {
|
|
25
25
|
try {
|
|
26
|
-
|
|
27
|
-
const braced = text.match(/(\{[\s\S]*\})/);
|
|
28
|
-
const jsonStr = (fenced ? fenced[1] : braced ? braced[1] : text).trim();
|
|
29
|
-
if (exceedsMaxDepth(jsonStr, MAX_PARSE_DEPTH)) {
|
|
30
|
-
return report(text, new RangeError(`parseJSON: input nesting exceeds MAX_PARSE_DEPTH=${MAX_PARSE_DEPTH}`), fallback, onError);
|
|
31
|
-
}
|
|
32
|
-
return JSON.parse(jsonStr);
|
|
26
|
+
return parseCandidate(text);
|
|
33
27
|
}
|
|
34
28
|
catch (err) {
|
|
35
29
|
const errObj = err instanceof Error ? err : new Error(String(err));
|
|
36
30
|
return report(text, errObj, fallback, onError);
|
|
37
31
|
}
|
|
38
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Strict counterpart to `parseJSON`: same extraction logic (markdown
|
|
35
|
+
* fences, embedded `{...}`, depth guard) but throws on failure instead
|
|
36
|
+
* of returning a fallback. Use this when the caller has already checked
|
|
37
|
+
* `AgentRunResult.finishReason` and KNOWS the response should be valid
|
|
38
|
+
* JSON — surfacing the parse error is more useful than a silent default.
|
|
39
|
+
*
|
|
40
|
+
* Throws `SyntaxError` for malformed JSON; throws `RangeError` if input
|
|
41
|
+
* nesting exceeds MAX_PARSE_DEPTH (mirroring the V8 safeguard in the
|
|
42
|
+
* tolerant variant).
|
|
43
|
+
*/
|
|
44
|
+
export function parseJSONStrict(text) {
|
|
45
|
+
return parseCandidate(text);
|
|
46
|
+
}
|
|
47
|
+
function parseCandidate(text) {
|
|
48
|
+
const fenced = text.match(/```(?:json)?\s*([\s\S]*?)```/);
|
|
49
|
+
const braced = text.match(/(\{[\s\S]*\})/);
|
|
50
|
+
const jsonStr = (fenced ? fenced[1] : braced ? braced[1] : text).trim();
|
|
51
|
+
if (exceedsMaxDepth(jsonStr, MAX_PARSE_DEPTH)) {
|
|
52
|
+
throw new RangeError(`parseJSON: input nesting exceeds MAX_PARSE_DEPTH=${MAX_PARSE_DEPTH}`);
|
|
53
|
+
}
|
|
54
|
+
return JSON.parse(jsonStr);
|
|
55
|
+
}
|
|
39
56
|
function report(text, err, fallback, onError) {
|
|
40
57
|
const preview = text.slice(0, 200);
|
|
41
58
|
if (onError) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-json.js","sourceRoot":"","sources":["../../src/agent/parse-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,MAAM,UAAU,SAAS,CACvB,IAAY,EACZ,QAAW,EACX,OAA+C;IAE/C,IAAI,CAAC;QACH,
|
|
1
|
+
{"version":3,"file":"parse-json.js","sourceRoot":"","sources":["../../src/agent/parse-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,MAAM,UAAU,SAAS,CACvB,IAAY,EACZ,QAAW,EACX,OAA+C;IAE/C,IAAI,CAAC;QACH,OAAO,cAAc,CAAI,IAAI,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC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AGR,MAAM,gBAAgB,CAAC;AAaxB,OAAO,KAAK,EAEV,WAAW,EACX,kBAAkB,EAClB,cAAc,EAGf,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agent/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,OAAO,KAAK,EACV,OAAO,EAGR,MAAM,gBAAgB,CAAC;AAaxB,OAAO,KAAK,EAEV,WAAW,EACX,kBAAkB,EAClB,cAAc,EAGf,MAAM,YAAY,CAAC;AAMpB,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,OAAO,EAAE,EAC1B,OAAO,EAAE,kBAAkB,EAC3B,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,CAAC,CAuSzB"}
|
package/dist/agent/runner.js
CHANGED
|
@@ -25,6 +25,7 @@ import { DeterministicCompressor, AggressiveCompressor, sanitizeToolPairs, } fro
|
|
|
25
25
|
import { toOpenAIMessages, toOpenAITools } from './openai-adapter.js';
|
|
26
26
|
import { consumeStream, looksLikeToolCallText } from './stream-consumer.js';
|
|
27
27
|
import { isRetryableError, isAbortError } from './retry.js';
|
|
28
|
+
import { toErrorMessage } from '../internal/error-message.js';
|
|
28
29
|
export async function runAgentWithTools(config, initialMessages, options, agentLabel) {
|
|
29
30
|
const label = agentLabel ?? config.name;
|
|
30
31
|
const activity = [];
|
|
@@ -57,15 +58,15 @@ export async function runAgentWithTools(config, initialMessages, options, agentL
|
|
|
57
58
|
result = verified;
|
|
58
59
|
}
|
|
59
60
|
catch (err) {
|
|
60
|
-
const
|
|
61
|
+
const message = toErrorMessage(err);
|
|
61
62
|
activity.push({
|
|
62
63
|
agent: label,
|
|
63
64
|
action: 'verify_failed',
|
|
64
|
-
detail:
|
|
65
|
+
detail: message.slice(0, 200),
|
|
65
66
|
});
|
|
66
67
|
return {
|
|
67
68
|
...result,
|
|
68
|
-
text: JSON.stringify({ _error: true, message:
|
|
69
|
+
text: JSON.stringify({ _error: true, message: message || 'verifyResult threw' }),
|
|
69
70
|
finishReason: 'error',
|
|
70
71
|
};
|
|
71
72
|
}
|
|
@@ -207,8 +208,11 @@ export async function runAgentWithTools(config, initialMessages, options, agentL
|
|
|
207
208
|
});
|
|
208
209
|
emit?.({ type: 'tool_call_started', agent: label, toolCall: tc });
|
|
209
210
|
}
|
|
210
|
-
// Execute tools in parallel.
|
|
211
|
-
|
|
211
|
+
// Execute tools in parallel. Forward the run's AbortSignal so
|
|
212
|
+
// long-running tool implementations can cancel cooperatively
|
|
213
|
+
// rather than running to completion before the next round's
|
|
214
|
+
// between-round abort check fires.
|
|
215
|
+
const results = await Promise.all(assistantMsg.toolCalls.map((tc) => options.toolExecutor.execute(tc.name, tc.id, tc.input, options.signal)));
|
|
212
216
|
// --- Layer 1: cap each tool result ---
|
|
213
217
|
for (let i = 0; i < results.length; i++) {
|
|
214
218
|
const r = results[i];
|
|
@@ -242,27 +246,27 @@ export async function runAgentWithTools(config, initialMessages, options, agentL
|
|
|
242
246
|
return finalize(lastAssistant?.content ?? '{}', 'length');
|
|
243
247
|
}
|
|
244
248
|
catch (err) {
|
|
245
|
-
const
|
|
249
|
+
const message = toErrorMessage(err);
|
|
246
250
|
if (isAbortError(err)) {
|
|
247
|
-
activity.push({ agent: label, action: 'aborted', detail:
|
|
251
|
+
activity.push({ agent: label, action: 'aborted', detail: message.slice(0, 120) });
|
|
248
252
|
return finalize('', 'error');
|
|
249
253
|
}
|
|
250
|
-
activity.push({ agent: label, action: 'error', detail:
|
|
254
|
+
activity.push({ agent: label, action: 'error', detail: message.slice(0, 120) });
|
|
251
255
|
if (attempt < maxRetries && isRetryableError(err)) {
|
|
252
256
|
const delay = 2000 + Math.random() * 3000;
|
|
253
257
|
activity.push({
|
|
254
258
|
agent: label,
|
|
255
259
|
action: 'retry',
|
|
256
|
-
detail: `Retrying after ${
|
|
260
|
+
detail: `Retrying after ${message.slice(0, 60)}`,
|
|
257
261
|
});
|
|
258
262
|
// eslint-disable-next-line no-console
|
|
259
|
-
console.warn(`[${label}] retryable error, waiting ${Math.round(delay)}ms: ${
|
|
263
|
+
console.warn(`[${label}] retryable error, waiting ${Math.round(delay)}ms: ${message.slice(0, 100)}`);
|
|
260
264
|
await new Promise((r) => setTimeout(r, delay));
|
|
261
265
|
continue;
|
|
262
266
|
}
|
|
263
267
|
// eslint-disable-next-line no-console
|
|
264
|
-
console.error(`[${label}] agent failed (attempt ${attempt + 1}):`,
|
|
265
|
-
return finalize(JSON.stringify({ _error: true, message
|
|
268
|
+
console.error(`[${label}] agent failed (attempt ${attempt + 1}):`, message);
|
|
269
|
+
return finalize(JSON.stringify({ _error: true, message }), 'error');
|
|
266
270
|
}
|
|
267
271
|
}
|
|
268
272
|
return finalize('{}', 'error');
|
package/dist/agent/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/agent/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAWH,OAAO,EACL,kBAAkB,EAClB,YAAY,GAEb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAUlC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/agent/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAWH,OAAO,EACL,kBAAkB,EAClB,YAAY,GAEb,M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C,KAAK,CAAC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CACvF,CAAC;gBACF,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;gBAC/C,SAAS;YACX,CAAC;YAED,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,2BAA2B,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC5E,OAAO,QAAQ,CACb,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EACzC,OAAO,CACR,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACjC,CAAC"}
|
package/dist/agent-runner.d.ts
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* For new code, import from `thread-phase` (or directly from `./agent/*`)
|
|
7
7
|
* rather than this path.
|
|
8
8
|
*/
|
|
9
|
-
export { runAgentWithTools, parseJSON, type AgentConfig, type ActivityEntry, type AgentRunResult, type AgentRunnerOptions, type AgentStreamEvent, type FinishReason, type UsageInfo, } from './agent/index.js';
|
|
9
|
+
export { runAgentWithTools, parseJSON, parseJSONStrict, type AgentConfig, type ActivityEntry, type AgentRunResult, type AgentRunnerOptions, type AgentStreamEvent, type FinishReason, type UsageInfo, } from './agent/index.js';
|
|
10
10
|
//# sourceMappingURL=agent-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runner.d.ts","sourceRoot":"","sources":["../src/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"agent-runner.d.ts","sourceRoot":"","sources":["../src/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,kBAAkB,CAAC"}
|
package/dist/agent-runner.js
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* For new code, import from `thread-phase` (or directly from `./agent/*`)
|
|
7
7
|
* rather than this path.
|
|
8
8
|
*/
|
|
9
|
-
export { runAgentWithTools, parseJSON, } from './agent/index.js';
|
|
9
|
+
export { runAgentWithTools, parseJSON, parseJSONStrict, } from './agent/index.js';
|
|
10
10
|
//# sourceMappingURL=agent-runner.js.map
|
package/dist/agent-runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../src/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,iBAAiB,EACjB,SAAS,
|
|
1
|
+
{"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../src/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,eAAe,GAQhB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter-author helpers — Tier B, UNSTABLE surface.
|
|
3
|
+
*
|
|
4
|
+
* # Stability policy
|
|
5
|
+
*
|
|
6
|
+
* Everything exported from this subpath is for AUTHORS writing new
|
|
7
|
+
* AgentAdapter implementations — not for consumers using pre-built
|
|
8
|
+
* adapters. These helpers may change shape in any minor release.
|
|
9
|
+
*
|
|
10
|
+
* If you are writing application code that USES an adapter (e.g.
|
|
11
|
+
* `claudeCodeAgent`, `codexAgent`), you want `thread-phase/agents`
|
|
12
|
+
* (Tier A, stable) — not this subpath.
|
|
13
|
+
*
|
|
14
|
+
* If you are writing a new adapter from scratch, this is the right
|
|
15
|
+
* place. Treat every import from here as a churn risk and pin to the
|
|
16
|
+
* exact version of `@autonome-research/thread-phase` you tested
|
|
17
|
+
* against.
|
|
18
|
+
*
|
|
19
|
+
* See STABILITY.md at the repo root for the full tier policy.
|
|
20
|
+
*
|
|
21
|
+
* # What lives here
|
|
22
|
+
*
|
|
23
|
+
* - run-helpers: composeAbort, createEventQueue, lazyEvents — the
|
|
24
|
+
* three implementation primitives every concrete adapter in
|
|
25
|
+
* `thread-phase-agents` consumes.
|
|
26
|
+
* - TurnAccumulator: helper for runtimes whose wire-format emits
|
|
27
|
+
* turn boundaries before tool calls (used by codex, anthropic).
|
|
28
|
+
* - serializeError: cross-process-safe error normalization. Used by
|
|
29
|
+
* adapters when emitting AgentEvent error frames.
|
|
30
|
+
* - parseStructuredFromText / extractResponseBlock /
|
|
31
|
+
* applyStructuredOutputPrompt / parseStructured: prompted
|
|
32
|
+
* structured-output helpers. The TYPE exports
|
|
33
|
+
* (StructuredOutputConfig, StructuredOutputParseError) live in
|
|
34
|
+
* the consumer barrel — only the runtime helpers are author-only.
|
|
35
|
+
* - capability: AgentCapabilityError + requireCapability for static
|
|
36
|
+
* adapter-capability validation. Zero importers in the bundled
|
|
37
|
+
* adapters today; kept here for protocol completeness.
|
|
38
|
+
* TODO(v5): re-evaluate for removal if still unused.
|
|
39
|
+
* - parseStructuredFromText is the closest to a Tier A candidate —
|
|
40
|
+
* six bundled adapters consume it. If consumer-facing re-parse
|
|
41
|
+
* ever becomes a documented use case, promote with a stable
|
|
42
|
+
* wrapper.
|
|
43
|
+
*/
|
|
44
|
+
export { composeAbort, createEventQueue, lazyEvents, type CompositeAbort, type EventQueue, } from '../run-helpers.js';
|
|
45
|
+
export { TurnAccumulator } from '../turn-accumulator.js';
|
|
46
|
+
export { serializeError } from '../serialize-error.js';
|
|
47
|
+
export { applyStructuredOutputPrompt, extractResponseBlock, parseStructured, parseStructuredFromText, } from '../structured-output.js';
|
|
48
|
+
export { AgentCapabilityError, requireCapability } from '../capability.js';
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/authoring/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAGH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter-author helpers — Tier B, UNSTABLE surface.
|
|
3
|
+
*
|
|
4
|
+
* # Stability policy
|
|
5
|
+
*
|
|
6
|
+
* Everything exported from this subpath is for AUTHORS writing new
|
|
7
|
+
* AgentAdapter implementations — not for consumers using pre-built
|
|
8
|
+
* adapters. These helpers may change shape in any minor release.
|
|
9
|
+
*
|
|
10
|
+
* If you are writing application code that USES an adapter (e.g.
|
|
11
|
+
* `claudeCodeAgent`, `codexAgent`), you want `thread-phase/agents`
|
|
12
|
+
* (Tier A, stable) — not this subpath.
|
|
13
|
+
*
|
|
14
|
+
* If you are writing a new adapter from scratch, this is the right
|
|
15
|
+
* place. Treat every import from here as a churn risk and pin to the
|
|
16
|
+
* exact version of `@autonome-research/thread-phase` you tested
|
|
17
|
+
* against.
|
|
18
|
+
*
|
|
19
|
+
* See STABILITY.md at the repo root for the full tier policy.
|
|
20
|
+
*
|
|
21
|
+
* # What lives here
|
|
22
|
+
*
|
|
23
|
+
* - run-helpers: composeAbort, createEventQueue, lazyEvents — the
|
|
24
|
+
* three implementation primitives every concrete adapter in
|
|
25
|
+
* `thread-phase-agents` consumes.
|
|
26
|
+
* - TurnAccumulator: helper for runtimes whose wire-format emits
|
|
27
|
+
* turn boundaries before tool calls (used by codex, anthropic).
|
|
28
|
+
* - serializeError: cross-process-safe error normalization. Used by
|
|
29
|
+
* adapters when emitting AgentEvent error frames.
|
|
30
|
+
* - parseStructuredFromText / extractResponseBlock /
|
|
31
|
+
* applyStructuredOutputPrompt / parseStructured: prompted
|
|
32
|
+
* structured-output helpers. The TYPE exports
|
|
33
|
+
* (StructuredOutputConfig, StructuredOutputParseError) live in
|
|
34
|
+
* the consumer barrel — only the runtime helpers are author-only.
|
|
35
|
+
* - capability: AgentCapabilityError + requireCapability for static
|
|
36
|
+
* adapter-capability validation. Zero importers in the bundled
|
|
37
|
+
* adapters today; kept here for protocol completeness.
|
|
38
|
+
* TODO(v5): re-evaluate for removal if still unused.
|
|
39
|
+
* - parseStructuredFromText is the closest to a Tier A candidate —
|
|
40
|
+
* six bundled adapters consume it. If consumer-facing re-parse
|
|
41
|
+
* ever becomes a documented use case, promote with a stable
|
|
42
|
+
* wrapper.
|
|
43
|
+
*/
|
|
44
|
+
// run-helpers — composition primitives for adapter implementations.
|
|
45
|
+
export { composeAbort, createEventQueue, lazyEvents, } from '../run-helpers.js';
|
|
46
|
+
// Turn boundaries for runtimes that emit turn frames before tool calls.
|
|
47
|
+
export { TurnAccumulator } from '../turn-accumulator.js';
|
|
48
|
+
// Error normalization for adapters emitting error AgentEvents.
|
|
49
|
+
export { serializeError } from '../serialize-error.js';
|
|
50
|
+
// Prompted structured-output runtime helpers. The TYPES
|
|
51
|
+
// (StructuredOutputConfig, StructuredOutputParseError) live in the
|
|
52
|
+
// Tier A barrel and are not re-exported here to avoid double-naming.
|
|
53
|
+
export { applyStructuredOutputPrompt, extractResponseBlock, parseStructured, parseStructuredFromText, } from '../structured-output.js';
|
|
54
|
+
// Capability assertions for adapter authors.
|
|
55
|
+
export { AgentCapabilityError, requireCapability } from '../capability.js';
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/authoring/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,oEAAoE;AACpE,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,UAAU,GAGX,MAAM,mBAAmB,CAAC;AAE3B,wEAAwE;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,+DAA+D;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,wDAAwD;AACxD,mEAAmE;AACnE,qEAAqE;AACrE,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAEjC,6CAA6C;AAC7C,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -7,14 +7,12 @@
|
|
|
7
7
|
* are fire-and-forget (no awaiting); use the bus for observation, not for
|
|
8
8
|
* sequencing.
|
|
9
9
|
*
|
|
10
|
-
* @internal
|
|
11
10
|
*/
|
|
12
11
|
import type { AgentEventBus } from './protocol.js';
|
|
13
12
|
/**
|
|
14
13
|
* Construct a new event bus. Each adapter that receives one via
|
|
15
14
|
* `AgentRunOptions.eventBus` mirrors its event stream into it.
|
|
16
15
|
*
|
|
17
|
-
* @internal
|
|
18
16
|
*/
|
|
19
17
|
export declare function createEventBus(): AgentEventBus;
|
|
20
18
|
//# sourceMappingURL=event-bus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../src/agents/event-bus.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../src/agents/event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,eAAe,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,aAAa,CAoB9C"}
|
package/dist/agents/event-bus.js
CHANGED
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
* are fire-and-forget (no awaiting); use the bus for observation, not for
|
|
8
8
|
* sequencing.
|
|
9
9
|
*
|
|
10
|
-
* @internal
|
|
11
10
|
*/
|
|
12
11
|
/**
|
|
13
12
|
* Construct a new event bus. Each adapter that receives one via
|
|
14
13
|
* `AgentRunOptions.eventBus` mirrors its event stream into it.
|
|
15
14
|
*
|
|
16
|
-
* @internal
|
|
17
15
|
*/
|
|
18
16
|
export function createEventBus() {
|
|
19
17
|
const handlers = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../src/agents/event-bus.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../src/agents/event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA+C,CAAC;IACxE,OAAO;QACL,IAAI,CAAC,KAAK;YACR,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;gBACzB,IAAI,CAAC;oBACH,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC;gBAAC,MAAM,CAAC;oBACP,mEAAmE;oBACnE,qEAAqE;gBACvE,CAAC;YACH,CAAC;QACH,CAAC;QACD,EAAE,CAAC,OAAO;YACR,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,GAAG,EAAE;gBACV,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Public entry point for the AgentAdapter protocol.
|
|
2
|
+
* Public entry point for the AgentAdapter protocol — Tier A, STABLE surface.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* # Stability commitment (from v4.0.0)
|
|
5
|
+
*
|
|
6
|
+
* Every export from this subpath is covered by semver:
|
|
7
|
+
* - patch (4.0.x): bug fixes, no API changes
|
|
8
|
+
* - minor (4.x.0): additive — new exports, new optional fields
|
|
9
|
+
* - major (x.0.0): breaking changes (always with a migration note)
|
|
10
|
+
*
|
|
11
|
+
* Anyone building application code that uses or composes pre-built
|
|
12
|
+
* adapters (`claudeCodeAgent`, `codexAgent`, `hermesAgent`, …) imports
|
|
13
|
+
* from here.
|
|
14
|
+
*
|
|
15
|
+
* Helpers for AUTHORING new adapters — `composeAbort`, `createEventQueue`,
|
|
16
|
+
* `lazyEvents`, `TurnAccumulator`, `serializeError`, the prompted
|
|
17
|
+
* structured-output helpers, `requireCapability` — live in
|
|
18
|
+
* `thread-phase/agents/authoring` and remain unstable.
|
|
19
|
+
*
|
|
20
|
+
* See STABILITY.md at the repo root for the full tier policy.
|
|
7
21
|
*
|
|
8
22
|
* Subpath: `thread-phase/agents`.
|
|
9
23
|
*/
|
|
10
24
|
export { defineAgentAdapter, isSteerable, type AgentAdapter, type AgentAdapterMeta, type AgentCapabilities, type AgentEvent, type AgentEventBus, type AgentFinishReason, type AgentRun, type AgentRunOptions, type AgentRunResult, type ResumeToken, type SerializableError, type SteerableAgentRun, } from './protocol.js';
|
|
11
25
|
export { createEventBus } from './event-bus.js';
|
|
12
|
-
export { AgentCapabilityError, requireCapability } from './capability.js';
|
|
13
|
-
export { serializeError } from './serialize-error.js';
|
|
14
26
|
export { appendEvent, createThread, resumeTokenFor, setResumeToken, threadToMessages, type Thread, } from './thread.js';
|
|
15
27
|
export type { MemoryProvider, MemoryScope } from './memory.js';
|
|
16
|
-
export {
|
|
28
|
+
export { StructuredOutputParseError, type StructuredOutputConfig, } from './structured-output.js';
|
|
17
29
|
export { inferenceAgent, type InferenceAgentConfig, } from './inference-adapter.js';
|
|
18
|
-
export { TurnAccumulator } from './turn-accumulator.js';
|
|
19
|
-
export { composeAbort, createEventQueue, lazyEvents, type CompositeAbort, type EventQueue, } from './run-helpers.js';
|
|
20
30
|
export { withMemory, type WithMemoryOptions } from './with-memory.js';
|
|
21
31
|
export { withThread, type WithThreadOptions } from './with-thread.js';
|
|
22
32
|
export { pipeAgentEventsToJobStore, type PipeAgentEventsOptions, } from './job-store-bridge.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,KAAK,MAAM,GACZ,MAAM,aAAa,CAAC;AAGrB,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM/D,OAAO,EACL,0BAA0B,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,GAC1B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGtE,OAAO,EACL,yBAAyB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC"}
|
package/dist/agents/index.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Public entry point for the AgentAdapter protocol.
|
|
2
|
+
* Public entry point for the AgentAdapter protocol — Tier A, STABLE surface.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* # Stability commitment (from v4.0.0)
|
|
5
|
+
*
|
|
6
|
+
* Every export from this subpath is covered by semver:
|
|
7
|
+
* - patch (4.0.x): bug fixes, no API changes
|
|
8
|
+
* - minor (4.x.0): additive — new exports, new optional fields
|
|
9
|
+
* - major (x.0.0): breaking changes (always with a migration note)
|
|
10
|
+
*
|
|
11
|
+
* Anyone building application code that uses or composes pre-built
|
|
12
|
+
* adapters (`claudeCodeAgent`, `codexAgent`, `hermesAgent`, …) imports
|
|
13
|
+
* from here.
|
|
14
|
+
*
|
|
15
|
+
* Helpers for AUTHORING new adapters — `composeAbort`, `createEventQueue`,
|
|
16
|
+
* `lazyEvents`, `TurnAccumulator`, `serializeError`, the prompted
|
|
17
|
+
* structured-output helpers, `requireCapability` — live in
|
|
18
|
+
* `thread-phase/agents/authoring` and remain unstable.
|
|
19
|
+
*
|
|
20
|
+
* See STABILITY.md at the repo root for the full tier policy.
|
|
7
21
|
*
|
|
8
22
|
* Subpath: `thread-phase/agents`.
|
|
9
23
|
*/
|
|
@@ -11,20 +25,16 @@
|
|
|
11
25
|
export { defineAgentAdapter, isSteerable, } from './protocol.js';
|
|
12
26
|
// Event bus.
|
|
13
27
|
export { createEventBus } from './event-bus.js';
|
|
14
|
-
// Capability assertions.
|
|
15
|
-
export { AgentCapabilityError, requireCapability } from './capability.js';
|
|
16
|
-
// Error serialization helper.
|
|
17
|
-
export { serializeError } from './serialize-error.js';
|
|
18
28
|
// Thread primitive.
|
|
19
29
|
export { appendEvent, createThread, resumeTokenFor, setResumeToken, threadToMessages, } from './thread.js';
|
|
20
|
-
// Structured-output
|
|
21
|
-
|
|
22
|
-
//
|
|
30
|
+
// Structured-output TYPES live in the stable barrel. The corresponding
|
|
31
|
+
// runtime helpers (parseStructuredFromText, extractResponseBlock,
|
|
32
|
+
// applyStructuredOutputPrompt, parseStructured) are author-only and
|
|
33
|
+
// live in `thread-phase/agents/authoring`.
|
|
34
|
+
export { StructuredOutputParseError, } from './structured-output.js';
|
|
35
|
+
// Reference adapter — wraps runAgentWithTools. inferenceAgent is shipped
|
|
36
|
+
// as both a working adapter and the canonical example for adapter authors.
|
|
23
37
|
export { inferenceAgent, } from './inference-adapter.js';
|
|
24
|
-
// Helper for adapters whose runtime emits turn boundaries before tool calls.
|
|
25
|
-
export { TurnAccumulator } from './turn-accumulator.js';
|
|
26
|
-
// Helpers for adapter authors: composite abort, single-consumer event queue, lazy-start wrapper.
|
|
27
|
-
export { composeAbort, createEventQueue, lazyEvents, } from './run-helpers.js';
|
|
28
38
|
// Adapter decorators: auto-handle memory and Thread wiring.
|
|
29
39
|
export { withMemory } from './with-memory.js';
|
|
30
40
|
export { withThread } from './with-thread.js';
|
package/dist/agents/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,kBAAkB;AAClB,OAAO,EACL,kBAAkB,EAClB,WAAW,GAaZ,MAAM,eAAe,CAAC;AAEvB,aAAa;AACb,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,oBAAoB;AACpB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,GAEjB,MAAM,aAAa,CAAC;AAKrB,uEAAuE;AACvE,kEAAkE;AAClE,oEAAoE;AACpE,2CAA2C;AAC3C,OAAO,EACL,0BAA0B,GAE3B,MAAM,wBAAwB,CAAC;AAEhC,yEAAyE;AACzE,2EAA2E;AAC3E,OAAO,EACL,cAAc,GAEf,MAAM,wBAAwB,CAAC;AAEhC,4DAA4D;AAC5D,OAAO,EAAE,UAAU,EAA0B,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,UAAU,EAA0B,MAAM,kBAAkB,CAAC;AAEtE,iDAAiD;AACjD,OAAO,EACL,yBAAyB,GAE1B,MAAM,uBAAuB,CAAC"}
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
* first. Translation rules from runner stream events → canonical
|
|
17
17
|
* `AgentEvent`s are documented inline on the `onStreamEvent` callback.
|
|
18
18
|
*
|
|
19
|
-
* @internal
|
|
20
19
|
*/
|
|
21
20
|
import { type AgentConfig, type AgentRunnerOptions } from '../agent/index.js';
|
|
22
21
|
import type { Message } from '../messages.js';
|
|
@@ -26,7 +25,6 @@ import { type StructuredOutputConfig } from './structured-output.js';
|
|
|
26
25
|
* Configuration for the in-tree inference adapter. Wraps the same inputs
|
|
27
26
|
* `runAgentWithTools` already takes plus an optional structured-output spec.
|
|
28
27
|
*
|
|
29
|
-
* @internal
|
|
30
28
|
*/
|
|
31
29
|
export interface InferenceAgentConfig {
|
|
32
30
|
/** Agent config passed to `runAgentWithTools`. */
|
|
@@ -45,7 +43,6 @@ export interface InferenceAgentConfig {
|
|
|
45
43
|
/**
|
|
46
44
|
* The adapter metadata, suitable for registration alongside future siblings.
|
|
47
45
|
*
|
|
48
|
-
* @internal
|
|
49
46
|
*/
|
|
50
47
|
export declare const inferenceAgent: AgentAdapterMeta<InferenceAgentConfig>;
|
|
51
48
|
export type { AgentEventBus };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference-adapter.d.ts","sourceRoot":"","sources":["../../src/agents/inference-adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"inference-adapter.d.ts","sourceRoot":"","sources":["../../src/agents/inference-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,kBAAkB,EAExB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAInB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAKhC;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,MAAM,EAAE,WAAW,CAAC;IACpB,kEAAkE;IAClE,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB;;;;OAIG;IACH,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC;IACpE,uDAAuD;IACvD,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,gBAAgB,CAAC,oBAAoB,CAShE,CAAC;AA6LH,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
* first. Translation rules from runner stream events → canonical
|
|
17
17
|
* `AgentEvent`s are documented inline on the `onStreamEvent` callback.
|
|
18
18
|
*
|
|
19
|
-
* @internal
|
|
20
19
|
*/
|
|
21
20
|
import { runAgentWithTools, } from '../agent/index.js';
|
|
22
21
|
import { defineAgentAdapter, } from './protocol.js';
|
|
@@ -28,7 +27,6 @@ const ADAPTER_ID = 'inference';
|
|
|
28
27
|
/**
|
|
29
28
|
* The adapter metadata, suitable for registration alongside future siblings.
|
|
30
29
|
*
|
|
31
|
-
* @internal
|
|
32
30
|
*/
|
|
33
31
|
export const inferenceAgent = defineAgentAdapter({
|
|
34
32
|
id: ADAPTER_ID,
|