@cuylabs/agent-core 3.1.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/{chunk-CGUASKOH.js → chunk-2BQI4M6X.js} +4 -2
- package/dist/{chunk-QVQKQZUN.js → chunk-BJC46FIF.js} +1 -1
- package/dist/{chunk-P2SPTUH5.js → chunk-FY6UGSFM.js} +2 -2
- package/dist/{chunk-BMLWNXIP.js → chunk-H3GRHFFG.js} +81 -1
- package/dist/{chunk-Y7SMKIJT.js → chunk-HSUPTXNV.js} +1 -1
- package/dist/{chunk-ZKEC7MFQ.js → chunk-MWPU2EVV.js} +1 -1
- package/dist/{chunk-MLTJHUVG.js → chunk-T33MQXUP.js} +32 -7
- package/dist/{chunk-WR6KIGJQ.js → chunk-Y3TRGGUG.js} +2 -2
- package/dist/dispatch/index.d.ts +2 -2
- package/dist/dispatch/index.js +2 -2
- package/dist/execution/index.d.ts +3 -3
- package/dist/execution/index.js +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +27 -18
- package/dist/inference/index.d.ts +3 -3
- package/dist/inference/index.js +3 -3
- package/dist/{instance-7RluLpIT.d.ts → instance-DtCDz9SL.d.ts} +112 -37
- package/dist/middleware/index.d.ts +2 -2
- package/dist/middleware/index.js +2 -2
- package/dist/{model-messages-CvIEjaIJ.d.ts → model-messages-COIqIS5e.d.ts} +1 -1
- package/dist/plugin/index.d.ts +1 -1
- package/dist/profiles/index.d.ts +1 -1
- package/dist/prompt/index.d.ts +2 -2
- package/dist/safety/index.d.ts +2 -2
- package/dist/safety/index.js +1 -1
- package/dist/skill/index.d.ts +2 -2
- package/dist/storage/index.d.ts +17 -3
- package/dist/storage/index.js +5 -1
- package/dist/subagents/index.d.ts +1 -1
- package/dist/subagents/index.js +3 -3
- package/dist/team/index.d.ts +2 -2
- package/dist/tool/index.d.ts +2 -2
- package/dist/tool/index.js +2 -2
- package/dist/turn-tools/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
createApprovalCorrection,
|
|
12
12
|
createApprovalHandler,
|
|
13
13
|
formatApprovalDeniedReason
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-T33MQXUP.js";
|
|
15
15
|
import {
|
|
16
16
|
silentLogger
|
|
17
17
|
} from "./chunk-S6AKEPAX.js";
|
|
@@ -291,7 +291,9 @@ function approvalMiddleware(config = {}) {
|
|
|
291
291
|
args,
|
|
292
292
|
config.customRisks,
|
|
293
293
|
ctx.toolCapabilities,
|
|
294
|
-
ctx.permissionPatterns
|
|
294
|
+
ctx.permissionPatterns,
|
|
295
|
+
[],
|
|
296
|
+
ctx.emitEvent ? { emitEvent: ctx.emitEvent } : {}
|
|
295
297
|
);
|
|
296
298
|
return { action: "allow" };
|
|
297
299
|
} catch (err) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Inference,
|
|
3
3
|
buildModelCallContext
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Y3TRGGUG.js";
|
|
5
5
|
import {
|
|
6
6
|
currentScope,
|
|
7
7
|
executeAgentToolCall,
|
|
8
8
|
snapshotScope,
|
|
9
9
|
streamWithinScope,
|
|
10
10
|
withinScope
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MWPU2EVV.js";
|
|
12
12
|
import {
|
|
13
13
|
LLMError
|
|
14
14
|
} from "./chunk-STDJYXYK.js";
|
|
@@ -230,6 +230,62 @@ ${entry.summary}`,
|
|
|
230
230
|
}
|
|
231
231
|
return messages;
|
|
232
232
|
}
|
|
233
|
+
function buildRecentMessagesFromEntries(entries, options = {}) {
|
|
234
|
+
const targetLeaf = options.leafId ?? getLeafId(entries);
|
|
235
|
+
if (!targetLeaf) {
|
|
236
|
+
return [];
|
|
237
|
+
}
|
|
238
|
+
const byId = /* @__PURE__ */ new Map();
|
|
239
|
+
for (const entry of entries) {
|
|
240
|
+
if (entry.type !== "header") {
|
|
241
|
+
byId.set(entry.id, entry);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return buildRecentMessagesFromEntryMap(byId, targetLeaf, options);
|
|
245
|
+
}
|
|
246
|
+
function buildRecentMessagesFromEntryMap(entriesById, leafId, options = {}) {
|
|
247
|
+
const limit = normalizeRecentMessagesLimit(options.limit);
|
|
248
|
+
if (limit === 0 || !leafId) {
|
|
249
|
+
return [];
|
|
250
|
+
}
|
|
251
|
+
const roles = options.roles ? new Set(options.roles) : void 0;
|
|
252
|
+
const recent = [];
|
|
253
|
+
let currentId = leafId;
|
|
254
|
+
while (currentId && recent.length < limit) {
|
|
255
|
+
const entry = entriesById.get(currentId);
|
|
256
|
+
if (!entry) {
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
if (entry.type === "message") {
|
|
260
|
+
const message = deserializeMessage(entry.message);
|
|
261
|
+
if (!roles || roles.has(message.role)) {
|
|
262
|
+
recent.push(message);
|
|
263
|
+
}
|
|
264
|
+
} else if (entry.type === "compaction") {
|
|
265
|
+
recent.push({
|
|
266
|
+
id: entry.id,
|
|
267
|
+
role: "system",
|
|
268
|
+
content: `## Previous Conversation Summary
|
|
269
|
+
|
|
270
|
+
${entry.summary}`,
|
|
271
|
+
createdAt: new Date(entry.timestamp)
|
|
272
|
+
});
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
currentId = entry.parentId;
|
|
276
|
+
}
|
|
277
|
+
recent.reverse();
|
|
278
|
+
return recent;
|
|
279
|
+
}
|
|
280
|
+
function normalizeRecentMessagesLimit(limit) {
|
|
281
|
+
if (limit === void 0) {
|
|
282
|
+
return Number.MAX_SAFE_INTEGER;
|
|
283
|
+
}
|
|
284
|
+
if (!Number.isFinite(limit) || limit < 0) {
|
|
285
|
+
throw new Error("limit must be a non-negative finite number");
|
|
286
|
+
}
|
|
287
|
+
return Math.floor(limit);
|
|
288
|
+
}
|
|
233
289
|
|
|
234
290
|
// src/storage/memory.ts
|
|
235
291
|
var MemoryStorage = class {
|
|
@@ -627,6 +683,7 @@ var SessionManager = class {
|
|
|
627
683
|
currentLeafId = null;
|
|
628
684
|
entriesCache = [];
|
|
629
685
|
idsCache = /* @__PURE__ */ new Set();
|
|
686
|
+
entriesByIdCache = /* @__PURE__ */ new Map();
|
|
630
687
|
constructor(storage) {
|
|
631
688
|
this.storage = storage ?? new MemoryStorage();
|
|
632
689
|
}
|
|
@@ -646,6 +703,7 @@ var SessionManager = class {
|
|
|
646
703
|
this.currentLeafId = null;
|
|
647
704
|
this.entriesCache = [header];
|
|
648
705
|
this.idsCache.clear();
|
|
706
|
+
this.entriesByIdCache.clear();
|
|
649
707
|
return id;
|
|
650
708
|
}
|
|
651
709
|
async load(sessionId) {
|
|
@@ -657,9 +715,12 @@ var SessionManager = class {
|
|
|
657
715
|
this.entriesCache = entries;
|
|
658
716
|
this.currentLeafId = getLeafId(entries);
|
|
659
717
|
this.idsCache.clear();
|
|
718
|
+
this.entriesByIdCache.clear();
|
|
660
719
|
for (const entry of entries) {
|
|
661
720
|
if (entry.type !== "header") {
|
|
662
|
-
|
|
721
|
+
const sessionEntry = entry;
|
|
722
|
+
this.idsCache.add(sessionEntry.id);
|
|
723
|
+
this.entriesByIdCache.set(sessionEntry.id, sessionEntry);
|
|
663
724
|
}
|
|
664
725
|
}
|
|
665
726
|
}
|
|
@@ -681,6 +742,7 @@ var SessionManager = class {
|
|
|
681
742
|
await this.storage.append(this.currentSessionId, entry);
|
|
682
743
|
this.entriesCache.push(entry);
|
|
683
744
|
this.idsCache.add(entry.id);
|
|
745
|
+
this.entriesByIdCache.set(entry.id, entry);
|
|
684
746
|
this.currentLeafId = entry.id;
|
|
685
747
|
return entry.id;
|
|
686
748
|
}
|
|
@@ -697,6 +759,7 @@ var SessionManager = class {
|
|
|
697
759
|
const entry = createMessageEntry(message, parentId, this.idsCache);
|
|
698
760
|
entries.push(entry);
|
|
699
761
|
this.idsCache.add(entry.id);
|
|
762
|
+
this.entriesByIdCache.set(entry.id, entry);
|
|
700
763
|
parentId = entry.id;
|
|
701
764
|
}
|
|
702
765
|
await this.storage.appendBatch(this.currentSessionId, entries);
|
|
@@ -710,6 +773,13 @@ var SessionManager = class {
|
|
|
710
773
|
leafId ?? this.currentLeafId ?? void 0
|
|
711
774
|
);
|
|
712
775
|
}
|
|
776
|
+
getRecentMessages(options = {}) {
|
|
777
|
+
return buildRecentMessagesFromEntryMap(
|
|
778
|
+
this.entriesByIdCache,
|
|
779
|
+
options.leafId ?? this.currentLeafId ?? void 0,
|
|
780
|
+
options
|
|
781
|
+
);
|
|
782
|
+
}
|
|
713
783
|
async addCompaction(options) {
|
|
714
784
|
if (!this.currentSessionId) {
|
|
715
785
|
throw new Error("No session loaded");
|
|
@@ -724,6 +794,7 @@ var SessionManager = class {
|
|
|
724
794
|
await this.storage.append(this.currentSessionId, entry);
|
|
725
795
|
this.entriesCache.push(entry);
|
|
726
796
|
this.idsCache.add(entry.id);
|
|
797
|
+
this.entriesByIdCache.set(entry.id, entry);
|
|
727
798
|
this.currentLeafId = entry.id;
|
|
728
799
|
return entry.id;
|
|
729
800
|
}
|
|
@@ -758,6 +829,10 @@ var SessionManager = class {
|
|
|
758
829
|
...messageEntries
|
|
759
830
|
]);
|
|
760
831
|
this.entriesCache.push(compactionEntry, ...messageEntries);
|
|
832
|
+
this.entriesByIdCache.set(compactionEntry.id, compactionEntry);
|
|
833
|
+
for (const entry of messageEntries) {
|
|
834
|
+
this.entriesByIdCache.set(entry.id, entry);
|
|
835
|
+
}
|
|
761
836
|
this.currentLeafId = messageEntries[messageEntries.length - 1]?.id ?? compactionEntry.id;
|
|
762
837
|
return compactionEntry.id;
|
|
763
838
|
}
|
|
@@ -779,6 +854,7 @@ var SessionManager = class {
|
|
|
779
854
|
await this.storage.append(this.currentSessionId, entry);
|
|
780
855
|
this.entriesCache.push(entry);
|
|
781
856
|
this.idsCache.add(entry.id);
|
|
857
|
+
this.entriesByIdCache.set(entry.id, entry);
|
|
782
858
|
this.currentLeafId = entry.id;
|
|
783
859
|
return entry.id;
|
|
784
860
|
}
|
|
@@ -800,6 +876,7 @@ var SessionManager = class {
|
|
|
800
876
|
await this.storage.append(this.currentSessionId, entry);
|
|
801
877
|
this.entriesCache.push(entry);
|
|
802
878
|
this.idsCache.add(entry.id);
|
|
879
|
+
this.entriesByIdCache.set(entry.id, entry);
|
|
803
880
|
this.currentLeafId = entry.id;
|
|
804
881
|
}
|
|
805
882
|
getContext() {
|
|
@@ -844,6 +921,7 @@ var SessionManager = class {
|
|
|
844
921
|
this.currentLeafId = null;
|
|
845
922
|
this.entriesCache = [];
|
|
846
923
|
this.idsCache.clear();
|
|
924
|
+
this.entriesByIdCache.clear();
|
|
847
925
|
}
|
|
848
926
|
return result;
|
|
849
927
|
}
|
|
@@ -882,6 +960,8 @@ export {
|
|
|
882
960
|
getLeafId,
|
|
883
961
|
buildEntryPath,
|
|
884
962
|
buildMessagesFromEntries,
|
|
963
|
+
buildRecentMessagesFromEntries,
|
|
964
|
+
buildRecentMessagesFromEntryMap,
|
|
885
965
|
MemoryStorage,
|
|
886
966
|
FileStorage,
|
|
887
967
|
LocalSessionTurnLock,
|
|
@@ -251,6 +251,9 @@ function normalizeApprovalDecision(value) {
|
|
|
251
251
|
}
|
|
252
252
|
return value;
|
|
253
253
|
}
|
|
254
|
+
async function emitApprovalEvent(context, event) {
|
|
255
|
+
await context.emitEvent?.(event);
|
|
256
|
+
}
|
|
254
257
|
function createApprovalHandler(config = {}) {
|
|
255
258
|
const {
|
|
256
259
|
defaultAction = "ask",
|
|
@@ -264,7 +267,7 @@ function createApprovalHandler(config = {}) {
|
|
|
264
267
|
const initialRuleCount = config.rules?.length ?? 0;
|
|
265
268
|
const rules = [...config.rules ?? []];
|
|
266
269
|
const activeRequests = /* @__PURE__ */ new Set();
|
|
267
|
-
async function request(sessionId, tool, args, customRisks, capabilities, patternExtractor, extraRules = []) {
|
|
270
|
+
async function request(sessionId, tool, args, customRisks, capabilities, patternExtractor, extraRules = [], eventContext = {}) {
|
|
268
271
|
const evaluation = evaluate(
|
|
269
272
|
sessionId,
|
|
270
273
|
tool,
|
|
@@ -298,7 +301,17 @@ function createApprovalHandler(config = {}) {
|
|
|
298
301
|
const ac = new AbortController();
|
|
299
302
|
activeRequests.add(ac);
|
|
300
303
|
let timeoutId;
|
|
304
|
+
let emittedRequest = false;
|
|
301
305
|
try {
|
|
306
|
+
await emitApprovalEvent(eventContext, {
|
|
307
|
+
type: "status",
|
|
308
|
+
status: "waiting-approval"
|
|
309
|
+
});
|
|
310
|
+
await emitApprovalEvent(eventContext, {
|
|
311
|
+
type: "approval-request",
|
|
312
|
+
request: evaluation.request
|
|
313
|
+
});
|
|
314
|
+
emittedRequest = true;
|
|
302
315
|
const resolution = normalizeApprovalDecision(
|
|
303
316
|
await Promise.race([
|
|
304
317
|
onRequest(evaluation.request),
|
|
@@ -317,19 +330,25 @@ function createApprovalHandler(config = {}) {
|
|
|
317
330
|
})
|
|
318
331
|
])
|
|
319
332
|
);
|
|
333
|
+
const selectedRememberScope = resolution.action === "remember" ? selectRememberScope(resolution, evaluation.request, rememberScope) : void 0;
|
|
334
|
+
await emitApprovalEvent(eventContext, {
|
|
335
|
+
type: "approval-resolved",
|
|
336
|
+
id: evaluation.request.id,
|
|
337
|
+
action: resolution.action,
|
|
338
|
+
...resolution.feedback ? { feedback: resolution.feedback } : {},
|
|
339
|
+
...selectedRememberScope ? { rememberScope: selectedRememberScope } : {}
|
|
340
|
+
});
|
|
320
341
|
switch (resolution.action) {
|
|
321
342
|
case "allow":
|
|
322
343
|
return;
|
|
323
344
|
case "deny":
|
|
324
345
|
throw new ApprovalDeniedError(tool, args, resolution.feedback);
|
|
325
346
|
case "remember": {
|
|
326
|
-
const scope = selectRememberScope(
|
|
327
|
-
resolution,
|
|
328
|
-
evaluation.request,
|
|
329
|
-
rememberScope
|
|
330
|
-
);
|
|
331
347
|
rules.push(
|
|
332
|
-
...createRememberedApprovalRules(
|
|
348
|
+
...createRememberedApprovalRules(
|
|
349
|
+
evaluation.request,
|
|
350
|
+
selectedRememberScope
|
|
351
|
+
)
|
|
333
352
|
);
|
|
334
353
|
return;
|
|
335
354
|
}
|
|
@@ -337,6 +356,12 @@ function createApprovalHandler(config = {}) {
|
|
|
337
356
|
} finally {
|
|
338
357
|
clearTimeout(timeoutId);
|
|
339
358
|
activeRequests.delete(ac);
|
|
359
|
+
if (emittedRequest) {
|
|
360
|
+
await emitApprovalEvent(eventContext, {
|
|
361
|
+
type: "status",
|
|
362
|
+
status: "processing"
|
|
363
|
+
});
|
|
364
|
+
}
|
|
340
365
|
}
|
|
341
366
|
}
|
|
342
367
|
function evaluate(sessionId, tool, args, customRisks, capabilities, patternExtractor, extraRules = []) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeAgentToolCall,
|
|
3
3
|
snapshotScope
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MWPU2EVV.js";
|
|
5
5
|
import {
|
|
6
6
|
LLMError,
|
|
7
7
|
isRetryable
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-CJI7PVS2.js";
|
|
18
18
|
import {
|
|
19
19
|
formatApprovalDeniedReason
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-T33MQXUP.js";
|
|
21
21
|
|
|
22
22
|
// src/inference/toolset.ts
|
|
23
23
|
import { tool, zodSchema } from "ai";
|
package/dist/dispatch/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { bz as LocalDispatchRuntimeOptions, a$ as DispatchRuntime, T as Tool, d9 as TaskExecutorInput, d8 as TaskExecutor, aY as DispatchRecord, b3 as DispatchTargetInspection, b2 as DispatchTarget, dr as TeamTask, bF as MemberRuntime, b5 as DispatchTargetStartResult, b6 as DispatchTargetSummary, be as ExternalTaskControl } from '../instance-DtCDz9SL.js';
|
|
2
|
+
export { aP as DEFAULT_DISPATCH_TOOL_IDS, aQ as DEFAULT_LOCAL_DISPATCH_CONCURRENCY, aR as DEFAULT_LOCAL_DISPATCH_DEPTH, aS as DEFAULT_LOCAL_DISPATCH_TITLE_PREFIX, aV as DISPATCH_STATES, aW as DispatchCheckOptions, aX as DispatchListOptions, aZ as DispatchResult, a_ as DispatchRole, b0 as DispatchStartInput, b1 as DispatchState, b4 as DispatchTargetStartInput, b7 as DispatchUsage } from '../instance-DtCDz9SL.js';
|
|
3
3
|
import '../types-C_LCeYNg.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../types-RSCv7nQ4.js';
|
package/dist/dispatch/index.js
CHANGED
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
DISPATCH_STATES,
|
|
16
16
|
createDispatchTools,
|
|
17
17
|
createLocalDispatchRuntime
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-HSUPTXNV.js";
|
|
19
19
|
import "../chunk-SZ2XBPTW.js";
|
|
20
20
|
import "../chunk-Q742PSH3.js";
|
|
21
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-H3GRHFFG.js";
|
|
22
22
|
export {
|
|
23
23
|
DEFAULT_DISPATCH_TOOL_IDS,
|
|
24
24
|
DEFAULT_LOCAL_DISPATCH_CONCURRENCY,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { e as AnyInferenceResult,
|
|
2
|
-
export { V as AgentTurnActiveToolCall, Y as AgentTurnBoundaryMetadata, Z as AgentTurnBoundarySnapshot, _ as AgentTurnCommitApplier, a0 as AgentTurnCommitOptions, a1 as AgentTurnEngine, a2 as AgentTurnEngineOptions, a3 as AgentTurnPhase, a4 as AgentTurnResolvedToolCall,
|
|
1
|
+
import { e as AnyInferenceResult, cO as StepProcessingOptions, cP as StepProcessingOutput, a9 as AgentTurnStepCommitSnapshot, aM as CreateAgentTurnStepCommitBatchOptions, $ as AgentTurnCommitBatch, c8 as PrepareModelStepOptions, c9 as PreparedAgentModelStep, cm as RunModelStepOptions, A as AgentEvent, cn as RunToolBatchOptions, co as RunToolBatchResult, aC as CommitOutputOptions, aD as CommitStepOptions, du as TokenUsage, x as ScopeSnapshot, a7 as AgentTurnState, dB as ToolMetadata, ab as AgentTurnStepCommitToolResult, aa as AgentTurnStepCommitToolCall, M as Message, dI as UserMessage, ay as AssistantMessage, dA as ToolMessage, cZ as SystemMessage } from '../instance-DtCDz9SL.js';
|
|
2
|
+
export { V as AgentTurnActiveToolCall, Y as AgentTurnBoundaryMetadata, Z as AgentTurnBoundarySnapshot, _ as AgentTurnCommitApplier, a0 as AgentTurnCommitOptions, a1 as AgentTurnEngine, a2 as AgentTurnEngineOptions, a3 as AgentTurnPhase, a4 as AgentTurnResolvedToolCall, a8 as AgentTurnStateAdvanceOptions, ac as AgentTurnStepRuntimeConfig, aL as CreateAgentTurnStateOptions, dL as advanceAgentTurnState, dP as createAgentTurnEngine, dQ as createAgentTurnState, dX as failAgentTurnState } from '../instance-DtCDz9SL.js';
|
|
3
3
|
import { L as Logger } from '../types-RSCv7nQ4.js';
|
|
4
|
-
export { c as convertAgentMessagesToModelMessages } from '../model-messages-
|
|
4
|
+
export { c as convertAgentMessagesToModelMessages } from '../model-messages-COIqIS5e.js';
|
|
5
5
|
import '../types-C_LCeYNg.js';
|
|
6
6
|
import 'ai';
|
|
7
7
|
import 'zod';
|
package/dist/execution/index.js
CHANGED
|
@@ -31,16 +31,16 @@ import {
|
|
|
31
31
|
runToolBatch,
|
|
32
32
|
snapshotAgentWorkflowMessage,
|
|
33
33
|
snapshotAgentWorkflowMessages
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-FY6UGSFM.js";
|
|
35
35
|
import {
|
|
36
36
|
convertAgentMessagesToModelMessages
|
|
37
|
-
} from "../chunk-
|
|
38
|
-
import "../chunk-
|
|
37
|
+
} from "../chunk-Y3TRGGUG.js";
|
|
38
|
+
import "../chunk-MWPU2EVV.js";
|
|
39
39
|
import "../chunk-STDJYXYK.js";
|
|
40
40
|
import "../chunk-GJFP5L2V.js";
|
|
41
41
|
import "../chunk-CJI7PVS2.js";
|
|
42
42
|
import "../chunk-I6PKJ7XQ.js";
|
|
43
|
-
import "../chunk-
|
|
43
|
+
import "../chunk-T33MQXUP.js";
|
|
44
44
|
import "../chunk-FII65CN7.js";
|
|
45
45
|
import "../chunk-S6AKEPAX.js";
|
|
46
46
|
export {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HumanInputController, p as HumanInputConfig, T as Tool, M as Message, S as SessionManager, E as EffectiveAgentConfig, q as TurnChangeTracker, r as InterventionController, b as MiddlewareRunner, P as PromptBuilder, t as AgentTurnToolProvider, c as ToolExecutionMode, A as AgentEvent, u as StreamProvider, v as Scope, x as ScopeSnapshot, y as ScopeOptions, F as FileOperationMeta, z as AgentSignal, B as TypedHandler, U as Unsubscribe, W as WildcardHandler } from './instance-
|
|
2
|
-
export { C as Agent, G as AgentConfig, J as AgentDefaults, K as AgentDefaultsContext, L as AgentDefaultsProvider, N as AgentMiddleware, O as AgentModelHooks, Q as AgentStatus, V as AgentTurnActiveToolCall, X as AgentTurnBoundaryKind, Y as AgentTurnBoundaryMetadata, Z as AgentTurnBoundarySnapshot, _ as AgentTurnCommitApplier, $ as AgentTurnCommitBatch, a0 as AgentTurnCommitOptions, a1 as AgentTurnEngine, a2 as AgentTurnEngineOptions, a3 as AgentTurnPhase, a4 as AgentTurnResolvedToolCall, a5 as
|
|
1
|
+
import { H as HumanInputController, p as HumanInputConfig, T as Tool, M as Message, S as SessionManager, E as EffectiveAgentConfig, q as TurnChangeTracker, r as InterventionController, b as MiddlewareRunner, P as PromptBuilder, t as AgentTurnToolProvider, c as ToolExecutionMode, A as AgentEvent, u as StreamProvider, v as Scope, x as ScopeSnapshot, y as ScopeOptions, F as FileOperationMeta, z as AgentSignal, B as TypedHandler, U as Unsubscribe, W as WildcardHandler } from './instance-DtCDz9SL.js';
|
|
2
|
+
export { C as Agent, G as AgentConfig, J as AgentDefaults, K as AgentDefaultsContext, L as AgentDefaultsProvider, N as AgentMiddleware, O as AgentModelHooks, Q as AgentStatus, V as AgentTurnActiveToolCall, X as AgentTurnBoundaryKind, Y as AgentTurnBoundaryMetadata, Z as AgentTurnBoundarySnapshot, _ as AgentTurnCommitApplier, $ as AgentTurnCommitBatch, a0 as AgentTurnCommitOptions, a1 as AgentTurnEngine, a2 as AgentTurnEngineOptions, a3 as AgentTurnPhase, a4 as AgentTurnResolvedToolCall, a5 as AgentTurnSource, a6 as AgentTurnSourceChatOptions, a7 as AgentTurnState, a8 as AgentTurnStateAdvanceOptions, a9 as AgentTurnStepCommitSnapshot, aa as AgentTurnStepCommitToolCall, ab as AgentTurnStepCommitToolResult, ac as AgentTurnStepRuntimeConfig, ad as AgentTurnToolContext, ae as AgentTurnToolProviderResult, e as AnyInferenceResult, af as AppliedProfile, ag as ApprovalAction, ah as ApprovalAgentMiddleware, ai as ApprovalCascadeMode, aj as ApprovalCascadePolicy, ak as ApprovalConfig, al as ApprovalCorrection, am as ApprovalDecision, an as ApprovalEvaluation, ao as ApprovalEvent, ap as ApprovalEventContext, aq as ApprovalHandler, ar as ApprovalLifecycleEvent, as as ApprovalMiddlewareConfig, at as ApprovalRememberScope, au as ApprovalRequest, av as ApprovalResolution, aw as ApprovalRule, ax as ApprovalRuleContext, ay as AssistantMessage, az as BlockedModelCall, aA as BranchEntry, aB as ChatLifecycleContext, aC as CommitOutputOptions, aD as CommitStepOptions, aE as CompactionConfig, aF as CompactionEntry, aG as CompatibleSchema, aH as ConfigChangeEntry, aI as CoordinatorNotification, aJ as CoordinatorNotificationKind, aK as CoordinatorRoundEvent, aL as CreateAgentTurnStateOptions, aM as CreateAgentTurnStepCommitBatchOptions, aN as CreateSessionOptions, aO as DEFAULT_AGENT_NAME, aP as DEFAULT_DISPATCH_TOOL_IDS, aQ as DEFAULT_LOCAL_DISPATCH_CONCURRENCY, aR as DEFAULT_LOCAL_DISPATCH_DEPTH, aS as DEFAULT_LOCAL_DISPATCH_TITLE_PREFIX, D as DEFAULT_MAX_OUTPUT_TOKENS, aT as DEFAULT_MAX_STEPS, D as DEFAULT_MAX_TOKENS, f as DEFAULT_RETRY_CONFIG, aU as DEFAULT_SYSTEM_PROMPT, aV as DISPATCH_STATES, aW as DispatchCheckOptions, aX as DispatchListOptions, aY as DispatchRecord, aZ as DispatchResult, a_ as DispatchRole, a$ as DispatchRuntime, b0 as DispatchStartInput, b1 as DispatchState, b2 as DispatchTarget, b3 as DispatchTargetInspection, b4 as DispatchTargetStartInput, b5 as DispatchTargetStartResult, b6 as DispatchTargetSummary, b7 as DispatchUsage, b8 as DoomLoopAction, b9 as DoomLoopHandler, ba as DoomLoopRequest, bb as EnhancedTools, bc as EntryBase, bd as EnvironmentInfo, be as ExternalTaskControl, bf as FileEntry, bg as GuidancePayload, bh as HistoryAccessor, bi as HumanInputEventContext, bj as HumanInputOption, bk as HumanInputRequest, bl as HumanInputRequestKind, bm as HumanInputRequestListOptions, bn as HumanInputRequestRecord, bo as HumanInputRequestStatus, bp as HumanInputResponse, bq as HumanInputTimeoutError, br as HumanInputToolArgs, bs as HumanInputUnavailableError, bt as IdleNotificationPayload, bu as InMemoryMailboxStore, bv as InMemoryTaskBoardStore, bw as InferSchemaOutput, g as InferenceCustomResult, h as InferenceStepInfo, I as InferenceStreamInput, i as InferenceStreamResult, bx as InputCheckResult, by as InstructionFile, bz as LocalDispatchRuntimeOptions, bA as LocalSessionTurnLock, bB as Mailbox, bC as MailboxStore, bD as MailboxSubscriber, bE as MemberRegisteredEvent, bF as MemberRuntime, bG as MemberStats, bH as MemberStatus, bI as MemberStatusChangedEvent, bJ as MessageBase, bK as MessageEntry, bL as MessageError, bM as MessageInput, bN as MessageKind, bO as MessageListFilter, bP as MessagePayload, bQ as MessageRole, bR as MessageSentEvent, bS as MetadataEntry, d as ModelCallContext, bT as ModelCallInput, bU as ModelCallOutput, bV as ModelFamily, bW as NormalizedToolReplayPolicy, bX as NotificationPriority, bY as OnFollowUpQueued, bZ as OnInterventionApplied, b_ as OtelMiddlewareConfig, b$ as PRUNE_PROTECTED_TOOLS, c0 as PendingIntervention, c1 as PermissionForwardedEvent, c2 as PermissionHandler, c3 as PermissionRequestPayload, c4 as PermissionResolvedEvent, c5 as PermissionResponsePayload, c6 as PlanCreatedEvent, c7 as PlannedTask, c8 as PrepareModelStepOptions, c9 as PreparedAgentModelStep, ca as PreparedExternalTask, cb as Profile, cc as PromptBuildContext, cd as PromptConfig, ce as PromptSection, cf as QueueTaskInput, cg as RecentMessagesOptions, ch as ReleaseSessionTurnLock, ci as RemoteSkillEntry, cj as RemoteSkillIndex, R as RetryConfig, j as RetryHandlerOptions, k as RetryState, ck as RiskLevel, cl as RuleSource, cm as RunModelStepOptions, cn as RunToolBatchOptions, co as RunToolBatchResult, cp as STORAGE_VERSION, cq as SerializedMessage, cr as Session, cs as SessionContext, ct as SessionEntry, cu as SessionHeader, cv as SessionInfo, cw as SessionStorage, cx as SessionTurnLock, cy as SessionTurnLockAcquireOptions, cz as ShutdownRequestPayload, cA as ShutdownRequestedEvent, cB as ShutdownResolvedEvent, cC as ShutdownResponsePayload, cD as SkillConfig, cE as SkillContent, cF as SkillDiscoveryError, cG as SkillDiscoveryResult, cH as SkillMetadata, cI as SkillRegistry, cJ as SkillResource, cK as SkillResourceType, cL as SkillScope, cM as SkillSource, cN as SkillSourceType, cO as StepProcessingOptions, cP as StepProcessingOutput, cQ as StepProcessingResult, cR as StreamChunk, cS as StreamInput, cT as StreamProviderConfig, cU as StreamProviderFactory, cV as StreamProviderInput, cW as StreamProviderResult, cX as SynthesisCompleteEvent, cY as SynthesisResult, cZ as SystemMessage, c_ as TERMINAL_STATUSES, c$ as TaskAbortedEvent, d0 as TaskBoard, d1 as TaskBoardStore, d2 as TaskCompletedEvent, d3 as TaskCompletion, d4 as TaskConflictError, d5 as TaskCreateInput, d6 as TaskCreatedEvent, d7 as TaskDispatchMode, d8 as TaskExecutor, d9 as TaskExecutorInput, da as TaskFailedEvent, db as TaskListFilter, dc as TaskResult, dd as TaskStatus, de as TaskTransition, df as TaskTransitionEvent, dg as TaskTransitionReason, dh as TeamCoordinatorConfig, di as TeamEvent, dj as TeamMember, dk as TeamMessage, dl as TeamNotificationEvent, dm as TeamPlan, dn as TeamSnapshot, dp as TeamStartedEvent, dq as TeamStoppedEvent, dr as TeamTask, ds as TelemetryConfig, dt as TelemetryConfigResult, du as TokenUsage, dv as ToolCallDecision, dw as ToolCallOutput, dx as ToolCapabilities, dy as ToolContext, dz as ToolHostRequirements, dA as ToolMessage, dB as ToolMetadata, dC as ToolReplayMode, dD as ToolReplayPolicy, dE as ToolResult, dF as ToolSideEffectLevel, dG as TracingConfig, a as TurnTrackerContext, dH as UndoResult, dI as UserMessage, dJ as WorkerReportPayload, dK as accumulateUsage, dL as advanceAgentTurnState, dM as approvalMiddleware, dN as buildCoordinatorNotificationEvent, l as calculateDelay, dO as createAgent, dP as createAgentTurnEngine, dQ as createAgentTurnState, dR as createApprovalHandler, dS as createHumanInputController, dT as createPromptBuilder, m as createRetryHandler, n as createRetryState, dU as createSkillRegistry, dV as createTurnTracker, dW as emptySkillRegistry, dX as failAgentTurnState, dY as getRequiredToolHost, dZ as isApprovalMiddleware, d_ as isBlockedModelCall, d$ as isHumanInputController, e0 as requiresToolHost, e1 as resolveAgentDefaults, e2 as resolveCapability, e3 as sandboxDefaultsProvider, s as shouldRetry, w as withRetry } from './instance-DtCDz9SL.js';
|
|
3
3
|
import { LanguageModel, ModelMessage, Tool as Tool$1, TelemetryOptions } from 'ai';
|
|
4
4
|
import { T as ToolHost } from './types-C_LCeYNg.js';
|
|
5
5
|
export { D as DirEntry, E as ExecOptions, a as ExecResult, F as FileStat } from './types-C_LCeYNg.js';
|
|
@@ -14,13 +14,13 @@ export { C as CapabilitySource, D as DEFAULT_RESOLVER_OPTIONS, I as InputModalit
|
|
|
14
14
|
export { H as HttpTransportConfig, M as MCPConfig, a as MCPManager, b as MCPPromptInfo, c as MCPResourceInfo, d as MCPResourceTemplateInfo, e as MCPServerConfig, f as MCPServerStatus, R as RemoteTransportConfig, S as SseTransportConfig, g as StdioTransportConfig } from './types-DMjoFKKv.js';
|
|
15
15
|
export { ClientCredentialsOptions, ClientCredentialsProvider, createMCPManager, httpServer, serviceAccountServer, sseServer, stdioServer } from './mcp/index.js';
|
|
16
16
|
export { AgentTaskChatAdapter, AgentTaskCheckpointReason, AgentTaskCheckpointStrategy, AgentTaskCheckpointStrategyInput, AgentTaskExecutionCheckpoint, AgentTaskExecutionContext, AgentTaskExecutionRun, AgentTaskExecutionSnapshot, AgentTaskObserver, AgentTaskPayload, AgentTaskResult, AgentTaskResumeSnapshot, AgentTaskRunner, AgentTaskRunnerOptions, AgentWorkflowAssistantMessageSnapshot, AgentWorkflowCommitResult, AgentWorkflowInputCommitPlan, AgentWorkflowInterventionSnapshot, AgentWorkflowMessageSnapshot, AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult, AgentWorkflowOperationPlan, AgentWorkflowOutputCommitPlan, AgentWorkflowReplayDecision, AgentWorkflowStepCommitPlan, AgentWorkflowSystemMessageSnapshot, AgentWorkflowToolBatchPlan, AgentWorkflowToolBatchResult, AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult, AgentWorkflowToolCallSnapshot, AgentWorkflowToolMessageSnapshot, AgentWorkflowTurnPhase, AgentWorkflowTurnState, AgentWorkflowUserMessageSnapshot, ContextOverflowError, CreateAgentWorkflowTurnStateOptions, DoomLoopError, applyAgentWorkflowCommitResult, applyAgentWorkflowModelStepResult, applyAgentWorkflowToolBatchResult, applyAgentWorkflowToolCallResult, applyWorkflowInterventions, cloneAgentWorkflowTurnState, commitOutput, commitStep, createAgentTaskRunner, createAgentTurnStepCommitBatch, createAgentWorkflowTurnState, defaultAgentTaskCheckpointStrategy, drainWorkflowInterventions, failAgentWorkflowTurnState, planNextAgentWorkflowOperation, prepareModelStep, processStepStream, queueWorkflowFollowUps, recordAgentWorkflowReplayDecision, restoreAgentWorkflowMessage, restoreAgentWorkflowMessages, runModelStep, runToolBatch, snapshotAgentWorkflowMessage, snapshotAgentWorkflowMessages } from './execution/index.js';
|
|
17
|
-
export { c as convertAgentMessagesToModelMessages } from './model-messages-
|
|
17
|
+
export { c as convertAgentMessagesToModelMessages } from './model-messages-COIqIS5e.js';
|
|
18
18
|
export { CacheTTL, PromptCacheConfig, createTelemetryConfig, otelMiddleware, promptCacheMiddleware } from './middleware/index.js';
|
|
19
19
|
export { DEFAULT_INSTRUCTION_PATTERNS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_FILE_SIZE, PRIORITY_BASE, PRIORITY_CUSTOM, PRIORITY_ENVIRONMENT, PRIORITY_INSTRUCTIONS, PRIORITY_OVERRIDE, PRIORITY_SKILLS, detectModelFamily, discoverInstructions, formatEnvironment, formatInstructions, gatherEnvironment, getAvailableFamilies, getTemplate, loadGlobalInstructions, summarizeEnvironment } from './prompt/index.js';
|
|
20
20
|
export { Profiles, applyProfile, careful, code, createProfile, explore, filterTools, mergeProfiles, plan, quick, review, watch } from './profiles/index.js';
|
|
21
21
|
export { SandboxPreview, SandboxProvider, SandboxSession, SandboxSessionMetadata, SandboxSnapshotResult } from './sandbox/index.js';
|
|
22
22
|
export { Inference, buildModelCallContext, buildToolSet, stream, streamOnce, streamStep } from './inference/index.js';
|
|
23
|
-
export { FileStorage, FileStorageOptions, MemoryStorage, buildEntryPath, buildMessagesFromEntries, configureDefaultSessionManager, createMessageEntry, createMetadataEntry, deserializeMessage, extractSessionInfo, generateEntryId, getDataDir, getDefaultSessionManager, getGitRootHash, getLeafId, getProjectId, getProjectSessionsDir, getSessionsDir, parseJSONL, serializeMessage, toJSONL, toJSONLBatch } from './storage/index.js';
|
|
23
|
+
export { BuildRecentMessagesOptions, FileStorage, FileStorageOptions, MemoryStorage, buildEntryPath, buildMessagesFromEntries, buildRecentMessagesFromEntries, buildRecentMessagesFromEntryMap, configureDefaultSessionManager, createMessageEntry, createMetadataEntry, deserializeMessage, extractSessionInfo, generateEntryId, getDataDir, getDefaultSessionManager, getGitRootHash, getLeafId, getProjectId, getProjectSessionsDir, getSessionsDir, parseJSONL, serializeMessage, toJSONL, toJSONLBatch } from './storage/index.js';
|
|
24
24
|
export { ApprovalDeniedError, ApprovalPolicyPresetName, ApprovalPolicyPresetOptions, ApprovalRuleCondition, ApprovalTimeoutError, RiskTierApprovalPolicyOptions, ThresholdApprovalRuleOptions, TrustedSessionApprovalPolicyOptions, allApprovalConditions, anyApprovalConditions, approvalRequestsOverlap, buildApprovalRuleContext, createApprovalCorrection, createApprovalPolicyPreset, createConditionalApprovalRule, createDangerouslyAllowAllApprovalPolicy, createHeadlessDenyApprovalPolicy, createInteractiveApprovalPolicy, createRememberedApprovalRules, createRiskTierApprovalPolicy, createThresholdApprovalRule, createTrustedSessionApprovalPolicy, describeApprovalOperation, extractApprovalPatterns, formatApprovalDeniedReason, getToolRisk, matchApprovalArgValue, matchApprovalNumericArg, matchApprovalPattern, matchApprovalRisks, matchApprovalSessions, matchApprovalStringPrefixes, normalizeApprovalCascadePolicy, normalizeRememberScopes, selectRememberScope, shouldCascadeApprovalDecision } from './safety/index.js';
|
|
25
25
|
export { E as ErrorCategory, L as LLMError, a as LLMErrorOptions, R as ResponseHeaders } from './llm-error-D93FNNLY.js';
|
|
26
26
|
export { getErrorCategory, getRetryDelay, isRetryable, isRetryableCategory, parseRetryDelay } from './inference/errors/index.js';
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
parseSubAgentRoleFrontmatter,
|
|
35
35
|
parseSubAgentToolSpec,
|
|
36
36
|
toSubAgentRole
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-BJC46FIF.js";
|
|
38
38
|
import {
|
|
39
39
|
InMemoryMailboxStore,
|
|
40
40
|
InMemoryTaskBoardStore,
|
|
@@ -161,7 +161,7 @@ import {
|
|
|
161
161
|
ensureSessionLoaded,
|
|
162
162
|
getVisibleSessionMessages,
|
|
163
163
|
repairOrphanedToolCalls
|
|
164
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-HSUPTXNV.js";
|
|
165
165
|
import {
|
|
166
166
|
sleep
|
|
167
167
|
} from "./chunk-SZ2XBPTW.js";
|
|
@@ -180,6 +180,8 @@ import {
|
|
|
180
180
|
SessionManager,
|
|
181
181
|
buildEntryPath,
|
|
182
182
|
buildMessagesFromEntries,
|
|
183
|
+
buildRecentMessagesFromEntries,
|
|
184
|
+
buildRecentMessagesFromEntryMap,
|
|
183
185
|
configureDefaultSessionManager,
|
|
184
186
|
createMessageEntry,
|
|
185
187
|
createMetadataEntry,
|
|
@@ -197,10 +199,7 @@ import {
|
|
|
197
199
|
serializeMessage,
|
|
198
200
|
toJSONL,
|
|
199
201
|
toJSONLBatch
|
|
200
|
-
} from "./chunk-
|
|
201
|
-
import {
|
|
202
|
-
createEventBus
|
|
203
|
-
} from "./chunk-2TTOLHBT.js";
|
|
202
|
+
} from "./chunk-H3GRHFFG.js";
|
|
204
203
|
import {
|
|
205
204
|
AgentTurnEngine,
|
|
206
205
|
ContextManager,
|
|
@@ -243,7 +242,7 @@ import {
|
|
|
243
242
|
runToolBatch,
|
|
244
243
|
snapshotAgentWorkflowMessage,
|
|
245
244
|
snapshotAgentWorkflowMessages
|
|
246
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-FY6UGSFM.js";
|
|
247
246
|
import {
|
|
248
247
|
DEFAULT_RETRY_CONFIG,
|
|
249
248
|
Inference,
|
|
@@ -258,7 +257,7 @@ import {
|
|
|
258
257
|
streamOnce,
|
|
259
258
|
streamStep,
|
|
260
259
|
withRetry
|
|
261
|
-
} from "./chunk-
|
|
260
|
+
} from "./chunk-Y3TRGGUG.js";
|
|
262
261
|
import {
|
|
263
262
|
currentScope,
|
|
264
263
|
executeAgentToolCall,
|
|
@@ -268,7 +267,7 @@ import {
|
|
|
268
267
|
snapshotScope,
|
|
269
268
|
streamWithinScope,
|
|
270
269
|
withinScope
|
|
271
|
-
} from "./chunk-
|
|
270
|
+
} from "./chunk-MWPU2EVV.js";
|
|
272
271
|
import {
|
|
273
272
|
LLMError,
|
|
274
273
|
getErrorCategory,
|
|
@@ -308,6 +307,9 @@ import {
|
|
|
308
307
|
supportsReasoning,
|
|
309
308
|
supportsReasoningSync
|
|
310
309
|
} from "./chunk-GJFP5L2V.js";
|
|
310
|
+
import {
|
|
311
|
+
createEventBus
|
|
312
|
+
} from "./chunk-2TTOLHBT.js";
|
|
311
313
|
import "./chunk-SPBFQXOT.js";
|
|
312
314
|
import {
|
|
313
315
|
ClientCredentialsProvider,
|
|
@@ -324,7 +326,7 @@ import {
|
|
|
324
326
|
isApprovalMiddleware,
|
|
325
327
|
otelMiddleware,
|
|
326
328
|
promptCacheMiddleware
|
|
327
|
-
} from "./chunk-
|
|
329
|
+
} from "./chunk-2BQI4M6X.js";
|
|
328
330
|
import {
|
|
329
331
|
DEFAULT_AGENT_NAME,
|
|
330
332
|
DEFAULT_MAX_STEPS,
|
|
@@ -376,7 +378,7 @@ import {
|
|
|
376
378
|
normalizeRememberScopes,
|
|
377
379
|
selectRememberScope,
|
|
378
380
|
shouldCascadeApprovalDecision
|
|
379
|
-
} from "./chunk-
|
|
381
|
+
} from "./chunk-T33MQXUP.js";
|
|
380
382
|
import {
|
|
381
383
|
describeApprovalOperation,
|
|
382
384
|
extractApprovalPatterns,
|
|
@@ -1211,6 +1213,13 @@ async function* runChatLoop(deps) {
|
|
|
1211
1213
|
let chatOutput;
|
|
1212
1214
|
let chatEndError;
|
|
1213
1215
|
let rethrowError;
|
|
1216
|
+
const lifecycleContext = {
|
|
1217
|
+
sessionId,
|
|
1218
|
+
turnId,
|
|
1219
|
+
history: {
|
|
1220
|
+
getRecentMessages: (options) => sessions.getRecentMessages(options)
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1214
1223
|
try {
|
|
1215
1224
|
const isPlanMode = deps.toolExecutionMode === "plan";
|
|
1216
1225
|
const turnEngine = createAgentTurnEngine({
|
|
@@ -1233,10 +1242,11 @@ async function* runChatLoop(deps) {
|
|
|
1233
1242
|
setIsStreaming(true);
|
|
1234
1243
|
streamingStateStarted = true;
|
|
1235
1244
|
if (middlewareRunner.hasMiddleware) {
|
|
1236
|
-
await middlewareRunner.runChatStart(
|
|
1245
|
+
await middlewareRunner.runChatStart(
|
|
1237
1246
|
sessionId,
|
|
1238
|
-
|
|
1239
|
-
|
|
1247
|
+
message,
|
|
1248
|
+
lifecycleContext
|
|
1249
|
+
);
|
|
1240
1250
|
}
|
|
1241
1251
|
let step = 1;
|
|
1242
1252
|
let finalStepText = "";
|
|
@@ -1404,10 +1414,7 @@ async function* runChatLoop(deps) {
|
|
|
1404
1414
|
error: chatError,
|
|
1405
1415
|
output: chatOutput
|
|
1406
1416
|
},
|
|
1407
|
-
|
|
1408
|
-
sessionId,
|
|
1409
|
-
turnId
|
|
1410
|
-
}
|
|
1417
|
+
lifecycleContext
|
|
1411
1418
|
);
|
|
1412
1419
|
} catch (error) {
|
|
1413
1420
|
chatEndError = error;
|
|
@@ -3450,6 +3457,8 @@ export {
|
|
|
3450
3457
|
buildOpenRouterOptions,
|
|
3451
3458
|
buildReasoningOptions,
|
|
3452
3459
|
buildReasoningOptionsSync,
|
|
3460
|
+
buildRecentMessagesFromEntries,
|
|
3461
|
+
buildRecentMessagesFromEntryMap,
|
|
3453
3462
|
buildToolSet,
|
|
3454
3463
|
buildXAIOptions,
|
|
3455
3464
|
calculateDelay,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ToolSet } from 'ai';
|
|
2
|
-
import { T as Tool, a as TurnTrackerContext, H as HumanInputController, b as MiddlewareRunner, A as AgentEvent, c as ToolExecutionMode, I as InferenceStreamInput, d as ModelCallContext, e as AnyInferenceResult } from '../instance-
|
|
3
|
-
export { D as DEFAULT_MAX_OUTPUT_TOKENS, f as DEFAULT_RETRY_CONFIG, g as InferenceCustomResult, h as InferenceStepInfo, i as InferenceStreamResult, R as RetryConfig, j as RetryHandlerOptions, k as RetryState, l as calculateDelay, m as createRetryHandler, n as createRetryState, s as shouldRetry, o as sleep, w as withRetry } from '../instance-
|
|
2
|
+
import { T as Tool, a as TurnTrackerContext, H as HumanInputController, b as MiddlewareRunner, A as AgentEvent, c as ToolExecutionMode, I as InferenceStreamInput, d as ModelCallContext, e as AnyInferenceResult } from '../instance-DtCDz9SL.js';
|
|
3
|
+
export { D as DEFAULT_MAX_OUTPUT_TOKENS, f as DEFAULT_RETRY_CONFIG, g as InferenceCustomResult, h as InferenceStepInfo, i as InferenceStreamResult, R as RetryConfig, j as RetryHandlerOptions, k as RetryState, l as calculateDelay, m as createRetryHandler, n as createRetryState, s as shouldRetry, o as sleep, w as withRetry } from '../instance-DtCDz9SL.js';
|
|
4
4
|
import { T as ToolHost } from '../types-C_LCeYNg.js';
|
|
5
|
-
export { c as convertAgentMessagesToModelMessages } from '../model-messages-
|
|
5
|
+
export { c as convertAgentMessagesToModelMessages } from '../model-messages-COIqIS5e.js';
|
|
6
6
|
export { E as ErrorCategory, L as LLMError, a as LLMErrorOptions, R as ResponseHeaders } from '../llm-error-D93FNNLY.js';
|
|
7
7
|
export { getErrorCategory, getRetryDelay, isRetryable, isRetryableCategory, parseRetryDelay } from './errors/index.js';
|
|
8
8
|
import '../types-RSCv7nQ4.js';
|
package/dist/inference/index.js
CHANGED
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
streamOnce,
|
|
14
14
|
streamStep,
|
|
15
15
|
withRetry
|
|
16
|
-
} from "../chunk-
|
|
17
|
-
import "../chunk-
|
|
16
|
+
} from "../chunk-Y3TRGGUG.js";
|
|
17
|
+
import "../chunk-MWPU2EVV.js";
|
|
18
18
|
import {
|
|
19
19
|
LLMError,
|
|
20
20
|
getErrorCategory,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
DEFAULT_MAX_TOKENS
|
|
29
29
|
} from "../chunk-CJI7PVS2.js";
|
|
30
30
|
import "../chunk-I6PKJ7XQ.js";
|
|
31
|
-
import "../chunk-
|
|
31
|
+
import "../chunk-T33MQXUP.js";
|
|
32
32
|
import "../chunk-FII65CN7.js";
|
|
33
33
|
import "../chunk-S6AKEPAX.js";
|
|
34
34
|
export {
|
|
@@ -275,6 +275,22 @@ interface ApprovalDecision {
|
|
|
275
275
|
* Callers may return either the simple string action or the structured object.
|
|
276
276
|
*/
|
|
277
277
|
type ApprovalResolution = ApprovalAction | ApprovalDecision;
|
|
278
|
+
type ApprovalLifecycleEvent = {
|
|
279
|
+
type: "status";
|
|
280
|
+
status: "waiting-approval" | "processing";
|
|
281
|
+
} | {
|
|
282
|
+
type: "approval-request";
|
|
283
|
+
request: ApprovalRequest;
|
|
284
|
+
} | {
|
|
285
|
+
type: "approval-resolved";
|
|
286
|
+
id: string;
|
|
287
|
+
action: ApprovalDecision["action"];
|
|
288
|
+
feedback?: string;
|
|
289
|
+
rememberScope?: ApprovalRememberScope;
|
|
290
|
+
};
|
|
291
|
+
interface ApprovalEventContext {
|
|
292
|
+
emitEvent?: (event: ApprovalLifecycleEvent) => void | Promise<void>;
|
|
293
|
+
}
|
|
278
294
|
/**
|
|
279
295
|
* Where a rule came from — used for debugging and selective clearing.
|
|
280
296
|
*
|
|
@@ -1241,6 +1257,47 @@ interface PromptConfig {
|
|
|
1241
1257
|
skills?: SkillConfig;
|
|
1242
1258
|
}
|
|
1243
1259
|
|
|
1260
|
+
/**
|
|
1261
|
+
* Options for creating a new session.
|
|
1262
|
+
*/
|
|
1263
|
+
interface CreateSessionOptions {
|
|
1264
|
+
/** Custom session ID (auto-generated if not provided) */
|
|
1265
|
+
id?: string;
|
|
1266
|
+
/** Working directory */
|
|
1267
|
+
cwd: string;
|
|
1268
|
+
/** Session title */
|
|
1269
|
+
title?: string;
|
|
1270
|
+
/** Parent session ID (if forking) */
|
|
1271
|
+
parentSessionId?: string;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Session context for LLM calls.
|
|
1275
|
+
*/
|
|
1276
|
+
interface SessionContext {
|
|
1277
|
+
/** Messages for LLM context */
|
|
1278
|
+
messages: Message[];
|
|
1279
|
+
/** Current leaf entry ID */
|
|
1280
|
+
leafId: string | null;
|
|
1281
|
+
/** Session metadata */
|
|
1282
|
+
metadata: {
|
|
1283
|
+
id: string;
|
|
1284
|
+
cwd: string;
|
|
1285
|
+
title?: string;
|
|
1286
|
+
name?: string;
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Options for reading a bounded slice of recent visible session messages.
|
|
1291
|
+
*/
|
|
1292
|
+
interface RecentMessagesOptions$1 {
|
|
1293
|
+
/** Maximum number of messages to return. Defaults to all visible messages. */
|
|
1294
|
+
limit?: number;
|
|
1295
|
+
/** Restrict returned messages to these roles. Defaults to all roles. */
|
|
1296
|
+
roles?: readonly MessageRole[];
|
|
1297
|
+
/** Optional leaf entry ID. Defaults to the manager's active leaf. */
|
|
1298
|
+
leafId?: string;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1244
1301
|
/**
|
|
1245
1302
|
* Stream types for @cuylabs/agent-core
|
|
1246
1303
|
*
|
|
@@ -1832,6 +1889,20 @@ interface ModelCallOutput {
|
|
|
1832
1889
|
interface ChatLifecycleContext {
|
|
1833
1890
|
sessionId: string;
|
|
1834
1891
|
turnId?: string;
|
|
1892
|
+
history?: HistoryAccessor;
|
|
1893
|
+
}
|
|
1894
|
+
/**
|
|
1895
|
+
* Options for reading a bounded slice of recent visible chat messages.
|
|
1896
|
+
*/
|
|
1897
|
+
type RecentMessagesOptions = Pick<RecentMessagesOptions$1, "limit" | "roles">;
|
|
1898
|
+
/**
|
|
1899
|
+
* Lazy chat-history accessor exposed to lifecycle middleware.
|
|
1900
|
+
*
|
|
1901
|
+
* The chat loop passes this accessor by reference; messages are only read and
|
|
1902
|
+
* deserialized if middleware calls it.
|
|
1903
|
+
*/
|
|
1904
|
+
interface HistoryAccessor {
|
|
1905
|
+
getRecentMessages(options?: RecentMessagesOptions): Message[];
|
|
1835
1906
|
}
|
|
1836
1907
|
/**
|
|
1837
1908
|
* Extended tool result returned by `afterToolCall` middleware.
|
|
@@ -3667,6 +3738,41 @@ interface ToolMetadata {
|
|
|
3667
3738
|
[key: string]: unknown;
|
|
3668
3739
|
}
|
|
3669
3740
|
|
|
3741
|
+
/**
|
|
3742
|
+
* Options accepted by the canonical chat-turn source contract.
|
|
3743
|
+
*
|
|
3744
|
+
* This type is intentionally small and transport-neutral. Additive optional
|
|
3745
|
+
* fields are safe; renaming, removing, or narrowing fields is a breaking
|
|
3746
|
+
* change for every channel adapter and runtime source.
|
|
3747
|
+
*
|
|
3748
|
+
* @public
|
|
3749
|
+
* @stable
|
|
3750
|
+
*/
|
|
3751
|
+
interface AgentTurnSourceChatOptions {
|
|
3752
|
+
/** Aborts the turn when the signal fires. */
|
|
3753
|
+
abort?: AbortSignal;
|
|
3754
|
+
/** Per-turn system prompt override. */
|
|
3755
|
+
system?: string;
|
|
3756
|
+
}
|
|
3757
|
+
/**
|
|
3758
|
+
* Canonical chat-turn source for the @cuylabs agent platform.
|
|
3759
|
+
*
|
|
3760
|
+
* Any object that can run a chat turn and yield `AgentEvent`s satisfies this
|
|
3761
|
+
* shape. It is consumed by `Agent`, `agent-server` adapters, channel adapters
|
|
3762
|
+
* such as M365 and Slack, custom runtimes, and test stubs.
|
|
3763
|
+
*
|
|
3764
|
+
* Breaking changes to this interface require coordinated major releases of
|
|
3765
|
+
* `@cuylabs/agent-core`, `@cuylabs/agent-server`, and every published channel
|
|
3766
|
+
* adapter. Additive optional fields on `AgentTurnSourceChatOptions` are
|
|
3767
|
+
* non-breaking but should be called out in the changeset.
|
|
3768
|
+
*
|
|
3769
|
+
* @public
|
|
3770
|
+
* @stable
|
|
3771
|
+
*/
|
|
3772
|
+
interface AgentTurnSource {
|
|
3773
|
+
chat(sessionId: string, message: string, options?: AgentTurnSourceChatOptions): AsyncGenerator<AgentEvent>;
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3670
3776
|
/**
|
|
3671
3777
|
* Tools whose outputs should never be pruned automatically.
|
|
3672
3778
|
*/
|
|
@@ -3753,36 +3859,6 @@ declare class LocalSessionTurnLock implements SessionTurnLock {
|
|
|
3753
3859
|
clear(sessionId: string): void;
|
|
3754
3860
|
}
|
|
3755
3861
|
|
|
3756
|
-
/**
|
|
3757
|
-
* Options for creating a new session.
|
|
3758
|
-
*/
|
|
3759
|
-
interface CreateSessionOptions {
|
|
3760
|
-
/** Custom session ID (auto-generated if not provided) */
|
|
3761
|
-
id?: string;
|
|
3762
|
-
/** Working directory */
|
|
3763
|
-
cwd: string;
|
|
3764
|
-
/** Session title */
|
|
3765
|
-
title?: string;
|
|
3766
|
-
/** Parent session ID (if forking) */
|
|
3767
|
-
parentSessionId?: string;
|
|
3768
|
-
}
|
|
3769
|
-
/**
|
|
3770
|
-
* Session context for LLM calls.
|
|
3771
|
-
*/
|
|
3772
|
-
interface SessionContext {
|
|
3773
|
-
/** Messages for LLM context */
|
|
3774
|
-
messages: Message[];
|
|
3775
|
-
/** Current leaf entry ID */
|
|
3776
|
-
leafId: string | null;
|
|
3777
|
-
/** Session metadata */
|
|
3778
|
-
metadata: {
|
|
3779
|
-
id: string;
|
|
3780
|
-
cwd: string;
|
|
3781
|
-
title?: string;
|
|
3782
|
-
name?: string;
|
|
3783
|
-
};
|
|
3784
|
-
}
|
|
3785
|
-
|
|
3786
3862
|
/**
|
|
3787
3863
|
* Manages session lifecycle with tree-structured entries.
|
|
3788
3864
|
*/
|
|
@@ -3792,6 +3868,7 @@ declare class SessionManager {
|
|
|
3792
3868
|
private currentLeafId;
|
|
3793
3869
|
private entriesCache;
|
|
3794
3870
|
private idsCache;
|
|
3871
|
+
private entriesByIdCache;
|
|
3795
3872
|
constructor(storage?: SessionStorage);
|
|
3796
3873
|
create(options: CreateSessionOptions): Promise<string>;
|
|
3797
3874
|
load(sessionId: string): Promise<void>;
|
|
@@ -3800,6 +3877,7 @@ declare class SessionManager {
|
|
|
3800
3877
|
addMessage(message: Message): Promise<string>;
|
|
3801
3878
|
addMessages(messages: Message[]): Promise<string[]>;
|
|
3802
3879
|
getMessages(leafId?: string): Message[];
|
|
3880
|
+
getRecentMessages(options?: RecentMessagesOptions$1): Message[];
|
|
3803
3881
|
addCompaction(options: {
|
|
3804
3882
|
summary: string;
|
|
3805
3883
|
firstKeptEntryId: string;
|
|
@@ -4256,7 +4334,7 @@ declare class InterventionController {
|
|
|
4256
4334
|
*/
|
|
4257
4335
|
declare function createApprovalHandler(config?: ApprovalConfig): {
|
|
4258
4336
|
evaluate: (sessionId: string, tool: string, args: unknown, customRisks?: Record<string, RiskLevel>, capabilities?: ToolCapabilities, patternExtractor?: (input: unknown) => string[], extraRules?: ApprovalRule[]) => ApprovalEvaluation;
|
|
4259
|
-
request: (sessionId: string, tool: string, args: unknown, customRisks?: Record<string, RiskLevel>, capabilities?: ToolCapabilities, patternExtractor?: (input: unknown) => string[], extraRules?: ApprovalRule[]) => Promise<void>;
|
|
4337
|
+
request: (sessionId: string, tool: string, args: unknown, customRisks?: Record<string, RiskLevel>, capabilities?: ToolCapabilities, patternExtractor?: (input: unknown) => string[], extraRules?: ApprovalRule[], eventContext?: ApprovalEventContext) => Promise<void>;
|
|
4260
4338
|
cancelAll: (_reason?: string) => void;
|
|
4261
4339
|
addRule: (rule: ApprovalRule) => void;
|
|
4262
4340
|
getRules: () => readonly ApprovalRule[];
|
|
@@ -5339,7 +5417,7 @@ declare function createAgent(config: AgentConstructionOptions): Agent;
|
|
|
5339
5417
|
* console.log(result.response);
|
|
5340
5418
|
* ```
|
|
5341
5419
|
*/
|
|
5342
|
-
declare class Agent {
|
|
5420
|
+
declare class Agent implements AgentTurnSource {
|
|
5343
5421
|
private config;
|
|
5344
5422
|
private tools;
|
|
5345
5423
|
private sessions;
|
|
@@ -5474,10 +5552,7 @@ declare class Agent {
|
|
|
5474
5552
|
* @param options - Abort signal, system prompt override, and approval handler
|
|
5475
5553
|
* @yields {AgentEvent} Events as they occur during processing
|
|
5476
5554
|
*/
|
|
5477
|
-
chat(sessionId: string, message: string, options?:
|
|
5478
|
-
abort?: AbortSignal;
|
|
5479
|
-
system?: string;
|
|
5480
|
-
}): AsyncGenerator<AgentEvent>;
|
|
5555
|
+
chat(sessionId: string, message: string, options?: AgentTurnSourceChatOptions): AsyncGenerator<AgentEvent>;
|
|
5481
5556
|
/**
|
|
5482
5557
|
* Send a message and wait for the complete response (non-streaming).
|
|
5483
5558
|
*
|
|
@@ -5902,4 +5977,4 @@ declare class Agent {
|
|
|
5902
5977
|
close(): Promise<void>;
|
|
5903
5978
|
}
|
|
5904
5979
|
|
|
5905
|
-
export { type AgentTurnCommitBatch as $, type AgentEvent as A, type TypedHandler as B, Agent as C, DEFAULT_MAX_TOKENS as D, type EffectiveAgentConfig as E, type FileOperationMeta as F, type AgentConfig as G, type HumanInputController as H, type InferenceStreamInput as I, type AgentDefaults as J, type AgentDefaultsContext as K, type AgentDefaultsProvider as L, type Message as M, type AgentMiddleware as N, type AgentModelHooks as O, PromptBuilder as P, type AgentStatus as Q, type RetryConfig as R, SessionManager as S, Tool as T, type Unsubscribe as U, type AgentTurnActiveToolCall as V, type WildcardHandler as W, type AgentTurnBoundaryKind as X, type AgentTurnBoundaryMetadata as Y, type AgentTurnBoundarySnapshot as Z, type AgentTurnCommitApplier as _, type TurnTrackerContext as a, type
|
|
5980
|
+
export { type AgentTurnCommitBatch as $, type AgentEvent as A, type TypedHandler as B, Agent as C, DEFAULT_MAX_TOKENS as D, type EffectiveAgentConfig as E, type FileOperationMeta as F, type AgentConfig as G, type HumanInputController as H, type InferenceStreamInput as I, type AgentDefaults as J, type AgentDefaultsContext as K, type AgentDefaultsProvider as L, type Message as M, type AgentMiddleware as N, type AgentModelHooks as O, PromptBuilder as P, type AgentStatus as Q, type RetryConfig as R, SessionManager as S, Tool as T, type Unsubscribe as U, type AgentTurnActiveToolCall as V, type WildcardHandler as W, type AgentTurnBoundaryKind as X, type AgentTurnBoundaryMetadata as Y, type AgentTurnBoundarySnapshot as Z, type AgentTurnCommitApplier as _, type TurnTrackerContext as a, type DispatchRuntime as a$, type AgentTurnCommitOptions as a0, AgentTurnEngine as a1, type AgentTurnEngineOptions as a2, type AgentTurnPhase as a3, type AgentTurnResolvedToolCall as a4, type AgentTurnSource as a5, type AgentTurnSourceChatOptions as a6, type AgentTurnState as a7, type AgentTurnStateAdvanceOptions as a8, type AgentTurnStepCommitSnapshot as a9, type BranchEntry as aA, type ChatLifecycleContext as aB, type CommitOutputOptions as aC, type CommitStepOptions as aD, type CompactionConfig as aE, type CompactionEntry as aF, type CompatibleSchema as aG, type ConfigChangeEntry as aH, type CoordinatorNotification as aI, type CoordinatorNotificationKind as aJ, type CoordinatorRoundEvent as aK, type CreateAgentTurnStateOptions as aL, type CreateAgentTurnStepCommitBatchOptions as aM, type CreateSessionOptions as aN, DEFAULT_AGENT_NAME as aO, DEFAULT_DISPATCH_TOOL_IDS as aP, DEFAULT_LOCAL_DISPATCH_CONCURRENCY as aQ, DEFAULT_LOCAL_DISPATCH_DEPTH as aR, DEFAULT_LOCAL_DISPATCH_TITLE_PREFIX as aS, DEFAULT_MAX_STEPS as aT, DEFAULT_SYSTEM_PROMPT as aU, DISPATCH_STATES as aV, type DispatchCheckOptions as aW, type DispatchListOptions as aX, type DispatchRecord as aY, type DispatchResult as aZ, type DispatchRole as a_, type AgentTurnStepCommitToolCall as aa, type AgentTurnStepCommitToolResult as ab, type AgentTurnStepRuntimeConfig as ac, type AgentTurnToolContext as ad, type AgentTurnToolProviderResult as ae, type AppliedProfile as af, type ApprovalAction as ag, type ApprovalAgentMiddleware as ah, type ApprovalCascadeMode as ai, type ApprovalCascadePolicy as aj, type ApprovalConfig as ak, type ApprovalCorrection as al, type ApprovalDecision as am, type ApprovalEvaluation as an, type ApprovalEvent as ao, type ApprovalEventContext as ap, type ApprovalHandler as aq, type ApprovalLifecycleEvent as ar, type ApprovalMiddlewareConfig as as, type ApprovalRememberScope as at, type ApprovalRequest as au, type ApprovalResolution as av, type ApprovalRule as aw, type ApprovalRuleContext as ax, type AssistantMessage as ay, type BlockedModelCall as az, MiddlewareRunner as b, PRUNE_PROTECTED_TOOLS as b$, type DispatchStartInput as b0, type DispatchState as b1, type DispatchTarget as b2, type DispatchTargetInspection as b3, type DispatchTargetStartInput as b4, type DispatchTargetStartResult as b5, type DispatchTargetSummary as b6, type DispatchUsage as b7, type DoomLoopAction as b8, type DoomLoopHandler as b9, LocalSessionTurnLock as bA, Mailbox as bB, type MailboxStore as bC, type MailboxSubscriber as bD, type MemberRegisteredEvent as bE, type MemberRuntime as bF, type MemberStats as bG, type MemberStatus as bH, type MemberStatusChangedEvent as bI, type MessageBase as bJ, type MessageEntry as bK, type MessageError as bL, type MessageInput as bM, type MessageKind as bN, type MessageListFilter as bO, type MessagePayload as bP, type MessageRole as bQ, type MessageSentEvent as bR, type MetadataEntry as bS, type ModelCallInput as bT, type ModelCallOutput as bU, type ModelFamily as bV, type NormalizedToolReplayPolicy as bW, type NotificationPriority as bX, type OnFollowUpQueued as bY, type OnInterventionApplied as bZ, type OtelMiddlewareConfig as b_, type DoomLoopRequest as ba, type EnhancedTools as bb, type EntryBase as bc, type EnvironmentInfo as bd, type ExternalTaskControl as be, type FileEntry as bf, type GuidancePayload as bg, type HistoryAccessor as bh, type HumanInputEventContext as bi, type HumanInputOption as bj, type HumanInputRequest as bk, type HumanInputRequestKind as bl, type HumanInputRequestListOptions as bm, type HumanInputRequestRecord as bn, type HumanInputRequestStatus as bo, type HumanInputResponse as bp, HumanInputTimeoutError as bq, type HumanInputToolArgs as br, HumanInputUnavailableError as bs, type IdleNotificationPayload as bt, InMemoryMailboxStore as bu, InMemoryTaskBoardStore as bv, type InferSchemaOutput as bw, type InputCheckResult as bx, type InstructionFile as by, type LocalDispatchRuntimeOptions as bz, type ToolExecutionMode as c, type TaskAbortedEvent as c$, type PendingIntervention as c0, type PermissionForwardedEvent as c1, type PermissionHandler as c2, type PermissionRequestPayload as c3, type PermissionResolvedEvent as c4, type PermissionResponsePayload as c5, type PlanCreatedEvent as c6, type PlannedTask as c7, type PrepareModelStepOptions as c8, type PreparedAgentModelStep as c9, type ShutdownRequestedEvent as cA, type ShutdownResolvedEvent as cB, type ShutdownResponsePayload as cC, type SkillConfig as cD, type SkillContent as cE, type SkillDiscoveryError as cF, type SkillDiscoveryResult as cG, type SkillMetadata as cH, SkillRegistry as cI, type SkillResource as cJ, type SkillResourceType as cK, type SkillScope as cL, type SkillSource as cM, type SkillSourceType as cN, type StepProcessingOptions as cO, type StepProcessingOutput as cP, type StepProcessingResult as cQ, type StreamChunk as cR, type StreamInput as cS, type StreamProviderConfig as cT, type StreamProviderFactory as cU, type StreamProviderInput as cV, type StreamProviderResult as cW, type SynthesisCompleteEvent as cX, type SynthesisResult as cY, type SystemMessage as cZ, TERMINAL_STATUSES as c_, type PreparedExternalTask as ca, type Profile as cb, type PromptBuildContext as cc, type PromptConfig as cd, type PromptSection as ce, type QueueTaskInput as cf, type RecentMessagesOptions$1 as cg, type ReleaseSessionTurnLock as ch, type RemoteSkillEntry as ci, type RemoteSkillIndex as cj, type RiskLevel as ck, type RuleSource as cl, type RunModelStepOptions as cm, type RunToolBatchOptions as cn, type RunToolBatchResult as co, STORAGE_VERSION as cp, type SerializedMessage as cq, type Session as cr, type SessionContext as cs, type SessionEntry as ct, type SessionHeader as cu, type SessionInfo as cv, type SessionStorage as cw, type SessionTurnLock as cx, type SessionTurnLockAcquireOptions as cy, type ShutdownRequestPayload as cz, type ModelCallContext as d, isHumanInputController as d$, TaskBoard as d0, type TaskBoardStore as d1, type TaskCompletedEvent as d2, type TaskCompletion as d3, TaskConflictError as d4, type TaskCreateInput as d5, type TaskCreatedEvent as d6, type TaskDispatchMode as d7, type TaskExecutor as d8, type TaskExecutorInput as d9, type ToolMessage as dA, type ToolMetadata as dB, type ToolReplayMode as dC, type ToolReplayPolicy as dD, type ToolResult as dE, type ToolSideEffectLevel as dF, type TracingConfig as dG, type UndoResult as dH, type UserMessage as dI, type WorkerReportPayload as dJ, accumulateUsage as dK, advanceAgentTurnState as dL, approvalMiddleware as dM, buildCoordinatorNotificationEvent as dN, createAgent as dO, createAgentTurnEngine as dP, createAgentTurnState as dQ, createApprovalHandler as dR, createHumanInputController as dS, createPromptBuilder as dT, createSkillRegistry as dU, createTurnTracker as dV, emptySkillRegistry as dW, failAgentTurnState as dX, getRequiredToolHost as dY, isApprovalMiddleware as dZ, isBlockedModelCall as d_, type TaskFailedEvent as da, type TaskListFilter as db, type TaskResult as dc, type TaskStatus as dd, type TaskTransition as de, type TaskTransitionEvent as df, type TaskTransitionReason as dg, type TeamCoordinatorConfig as dh, type TeamEvent as di, type TeamMember as dj, type TeamMessage as dk, type TeamNotificationEvent as dl, type TeamPlan as dm, type TeamSnapshot as dn, type TeamStartedEvent as dp, type TeamStoppedEvent as dq, type TeamTask as dr, type TelemetryConfig as ds, type TelemetryConfigResult as dt, type TokenUsage as du, type ToolCallDecision as dv, type ToolCallOutput as dw, type ToolCapabilities as dx, type ToolContext as dy, type ToolHostRequirements as dz, type AnyInferenceResult as e, requiresToolHost as e0, resolveAgentDefaults as e1, resolveCapability as e2, sandboxDefaultsProvider as e3, type CoordinatorCtx as e4, DEFAULT_RETRY_CONFIG as f, type InferenceCustomResult as g, type InferenceStepInfo as h, type InferenceStreamResult as i, type RetryHandlerOptions as j, type RetryState as k, calculateDelay as l, createRetryHandler as m, createRetryState as n, sleep as o, type HumanInputConfig as p, TurnChangeTracker as q, InterventionController as r, shouldRetry as s, type AgentTurnToolProvider as t, type StreamProvider as u, type Scope as v, withRetry as w, type ScopeSnapshot as x, type ScopeOptions as y, type AgentSignal as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { O as AgentModelHooks,
|
|
1
|
+
import { b_ as OtelMiddlewareConfig, N as AgentMiddleware, ds as TelemetryConfig, dt as TelemetryConfigResult } from '../instance-DtCDz9SL.js';
|
|
2
|
+
export { O as AgentModelHooks, ah as ApprovalAgentMiddleware, as as ApprovalMiddlewareConfig, az as BlockedModelCall, aB as ChatLifecycleContext, bh as HistoryAccessor, b as MiddlewareRunner, d as ModelCallContext, bT as ModelCallInput, bU as ModelCallOutput, dv as ToolCallDecision, dw as ToolCallOutput, dM as approvalMiddleware, dZ as isApprovalMiddleware, d_ as isBlockedModelCall } from '../instance-DtCDz9SL.js';
|
|
3
3
|
import '../types-C_LCeYNg.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../types-RSCv7nQ4.js';
|
package/dist/middleware/index.js
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
isApprovalMiddleware,
|
|
6
6
|
otelMiddleware,
|
|
7
7
|
promptCacheMiddleware
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-2BQI4M6X.js";
|
|
9
9
|
import {
|
|
10
10
|
isBlockedModelCall
|
|
11
11
|
} from "../chunk-CJI7PVS2.js";
|
|
12
12
|
import "../chunk-I6PKJ7XQ.js";
|
|
13
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-T33MQXUP.js";
|
|
14
14
|
import "../chunk-FII65CN7.js";
|
|
15
15
|
import "../chunk-S6AKEPAX.js";
|
|
16
16
|
export {
|
package/dist/plugin/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as Tool, N as AgentMiddleware,
|
|
1
|
+
import { T as Tool, N as AgentMiddleware, ce as PromptSection } from '../instance-DtCDz9SL.js';
|
|
2
2
|
import { ZodType } from 'zod';
|
|
3
3
|
import { Jiti } from 'jiti';
|
|
4
4
|
import '../types-C_LCeYNg.js';
|
package/dist/profiles/index.d.ts
CHANGED
package/dist/prompt/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { bV as ModelFamily, bd as EnvironmentInfo, by as InstructionFile } from '../instance-DtCDz9SL.js';
|
|
2
|
+
export { cc as PromptBuildContext, P as PromptBuilder, cd as PromptConfig, ce as PromptSection, cD as SkillConfig, dT as createPromptBuilder } from '../instance-DtCDz9SL.js';
|
|
3
3
|
import { LanguageModel } from 'ai';
|
|
4
4
|
import '../types-C_LCeYNg.js';
|
|
5
5
|
import '../types-RSCv7nQ4.js';
|
package/dist/safety/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { ck as RiskLevel, aw as ApprovalRule, au as ApprovalRequest, ax as ApprovalRuleContext, cl as RuleSource, aj as ApprovalCascadePolicy, at as ApprovalRememberScope, am as ApprovalDecision, ak as ApprovalConfig } from '../instance-DtCDz9SL.js';
|
|
2
|
+
export { ag as ApprovalAction, ai as ApprovalCascadeMode, al as ApprovalCorrection, an as ApprovalEvaluation, ap as ApprovalEventContext, aq as ApprovalHandler, ar as ApprovalLifecycleEvent, av as ApprovalResolution, dR as createApprovalHandler } from '../instance-DtCDz9SL.js';
|
|
3
3
|
import '../types-C_LCeYNg.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../types-RSCv7nQ4.js';
|
package/dist/safety/index.js
CHANGED
package/dist/skill/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { cL as SkillScope, cM as SkillSource, cH as SkillMetadata, cK as SkillResourceType, cJ as SkillResource, cE as SkillContent, cD as SkillConfig, cG as SkillDiscoveryResult, cI as SkillRegistry, T as Tool } from '../instance-DtCDz9SL.js';
|
|
2
|
+
export { ci as RemoteSkillEntry, cj as RemoteSkillIndex, cF as SkillDiscoveryError, cN as SkillSourceType, dU as createSkillRegistry, dW as emptySkillRegistry } from '../instance-DtCDz9SL.js';
|
|
3
3
|
import '../types-C_LCeYNg.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../types-RSCv7nQ4.js';
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { bQ as MessageRole, bf as FileEntry, ct as SessionEntry, M as Message, bK as MessageEntry, bS as MetadataEntry, cq as SerializedMessage, cv as SessionInfo, cw as SessionStorage, cu as SessionHeader, S as SessionManager } from '../instance-DtCDz9SL.js';
|
|
2
|
+
export { aA as BranchEntry, aF as CompactionEntry, aH as ConfigChangeEntry, aN as CreateSessionOptions, bc as EntryBase, bA as LocalSessionTurnLock, cg as RecentMessagesOptions, ch as ReleaseSessionTurnLock, cp as STORAGE_VERSION, cs as SessionContext, cx as SessionTurnLock, cy as SessionTurnLockAcquireOptions } from '../instance-DtCDz9SL.js';
|
|
3
3
|
import { L as Logger } from '../types-RSCv7nQ4.js';
|
|
4
4
|
import '../types-C_LCeYNg.js';
|
|
5
5
|
import 'ai';
|
|
@@ -72,6 +72,20 @@ declare function buildEntryPath(entries: FileEntry[], targetId: string): Session
|
|
|
72
72
|
* Handles compaction summaries
|
|
73
73
|
*/
|
|
74
74
|
declare function buildMessagesFromEntries(entries: FileEntry[], leafId?: string): Message[];
|
|
75
|
+
interface BuildRecentMessagesOptions {
|
|
76
|
+
leafId?: string;
|
|
77
|
+
limit?: number;
|
|
78
|
+
roles?: readonly MessageRole[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Build the last N visible messages from a session path without materializing
|
|
82
|
+
* the full message list when only a bounded suffix is needed.
|
|
83
|
+
*/
|
|
84
|
+
declare function buildRecentMessagesFromEntries(entries: FileEntry[], options?: BuildRecentMessagesOptions): Message[];
|
|
85
|
+
/**
|
|
86
|
+
* Build the last N visible messages from an existing entry index.
|
|
87
|
+
*/
|
|
88
|
+
declare function buildRecentMessagesFromEntryMap(entriesById: ReadonlyMap<string, SessionEntry>, leafId: string | undefined, options?: Omit<BuildRecentMessagesOptions, "leafId">): Message[];
|
|
75
89
|
|
|
76
90
|
/**
|
|
77
91
|
* Memory Session Storage
|
|
@@ -174,4 +188,4 @@ declare function getDefaultSessionManager(): SessionManager;
|
|
|
174
188
|
*/
|
|
175
189
|
declare function configureDefaultSessionManager(storage: SessionStorage): SessionManager;
|
|
176
190
|
|
|
177
|
-
export { FileEntry, FileStorage, type FileStorageOptions, MemoryStorage, MessageEntry, MetadataEntry, SerializedMessage, SessionEntry, SessionHeader, SessionInfo, SessionManager, SessionStorage, buildEntryPath, buildMessagesFromEntries, configureDefaultSessionManager, createMessageEntry, createMetadataEntry, deserializeMessage, extractSessionInfo, generateEntryId, getDataDir, getDefaultSessionManager, getGitRootHash, getLeafId, getProjectId, getProjectSessionsDir, getSessionsDir, parseJSONL, serializeMessage, toJSONL, toJSONLBatch };
|
|
191
|
+
export { type BuildRecentMessagesOptions, FileEntry, FileStorage, type FileStorageOptions, MemoryStorage, MessageEntry, MetadataEntry, SerializedMessage, SessionEntry, SessionHeader, SessionInfo, SessionManager, SessionStorage, buildEntryPath, buildMessagesFromEntries, buildRecentMessagesFromEntries, buildRecentMessagesFromEntryMap, configureDefaultSessionManager, createMessageEntry, createMetadataEntry, deserializeMessage, extractSessionInfo, generateEntryId, getDataDir, getDefaultSessionManager, getGitRootHash, getLeafId, getProjectId, getProjectSessionsDir, getSessionsDir, parseJSONL, serializeMessage, toJSONL, toJSONLBatch };
|
package/dist/storage/index.js
CHANGED
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
SessionManager,
|
|
7
7
|
buildEntryPath,
|
|
8
8
|
buildMessagesFromEntries,
|
|
9
|
+
buildRecentMessagesFromEntries,
|
|
10
|
+
buildRecentMessagesFromEntryMap,
|
|
9
11
|
configureDefaultSessionManager,
|
|
10
12
|
createMessageEntry,
|
|
11
13
|
createMetadataEntry,
|
|
@@ -23,7 +25,7 @@ import {
|
|
|
23
25
|
serializeMessage,
|
|
24
26
|
toJSONL,
|
|
25
27
|
toJSONLBatch
|
|
26
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-H3GRHFFG.js";
|
|
27
29
|
export {
|
|
28
30
|
FileStorage,
|
|
29
31
|
LocalSessionTurnLock,
|
|
@@ -32,6 +34,8 @@ export {
|
|
|
32
34
|
SessionManager,
|
|
33
35
|
buildEntryPath,
|
|
34
36
|
buildMessagesFromEntries,
|
|
37
|
+
buildRecentMessagesFromEntries,
|
|
38
|
+
buildRecentMessagesFromEntryMap,
|
|
35
39
|
configureDefaultSessionManager,
|
|
36
40
|
createMessageEntry,
|
|
37
41
|
createMetadataEntry,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a_ as DispatchRole, aZ as DispatchResult, bz as LocalDispatchRuntimeOptions, C as Agent, T as Tool, a$ as DispatchRuntime, cb as Profile } from '../instance-DtCDz9SL.js';
|
|
2
2
|
import '../types-C_LCeYNg.js';
|
|
3
3
|
import 'ai';
|
|
4
4
|
import '../types-RSCv7nQ4.js';
|
package/dist/subagents/index.js
CHANGED
|
@@ -34,11 +34,11 @@ import {
|
|
|
34
34
|
parseSubAgentRoleFrontmatter,
|
|
35
35
|
parseSubAgentToolSpec,
|
|
36
36
|
toSubAgentRole
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-BJC46FIF.js";
|
|
38
38
|
import "../chunk-TPZ37IWI.js";
|
|
39
|
-
import "../chunk-
|
|
39
|
+
import "../chunk-HSUPTXNV.js";
|
|
40
40
|
import "../chunk-Q742PSH3.js";
|
|
41
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-H3GRHFFG.js";
|
|
42
42
|
export {
|
|
43
43
|
DEFAULT_SUBAGENT_CONCURRENCY,
|
|
44
44
|
DEFAULT_SUBAGENT_DEPTH,
|
package/dist/team/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { aI as CoordinatorNotification, d3 as TaskCompletion, du as TokenUsage, A as AgentEvent, e4 as CoordinatorCtx, C as Agent, bF as MemberRuntime, d0 as TaskBoard, bB as Mailbox, d7 as TaskDispatchMode, c2 as PermissionHandler, dh as TeamCoordinatorConfig, d8 as TaskExecutor, di as TeamEvent, dj as TeamMember, cf as QueueTaskInput, dr as TeamTask, dk as TeamMessage, dm as TeamPlan, cY as SynthesisResult, dn as TeamSnapshot, db as TaskListFilter, bO as MessageListFilter, ca as PreparedExternalTask, dc as TaskResult, de as TaskTransition, bG as MemberStats, bH as MemberStatus, N as AgentMiddleware, dv as ToolCallDecision } from '../instance-DtCDz9SL.js';
|
|
2
|
+
export { aJ as CoordinatorNotificationKind, aK as CoordinatorRoundEvent, be as ExternalTaskControl, bg as GuidancePayload, bt as IdleNotificationPayload, bu as InMemoryMailboxStore, bv as InMemoryTaskBoardStore, bC as MailboxStore, bD as MailboxSubscriber, bE as MemberRegisteredEvent, bI as MemberStatusChangedEvent, bM as MessageInput, bN as MessageKind, bP as MessagePayload, bR as MessageSentEvent, bX as NotificationPriority, c1 as PermissionForwardedEvent, c3 as PermissionRequestPayload, c4 as PermissionResolvedEvent, c5 as PermissionResponsePayload, c6 as PlanCreatedEvent, c7 as PlannedTask, cz as ShutdownRequestPayload, cA as ShutdownRequestedEvent, cB as ShutdownResolvedEvent, cC as ShutdownResponsePayload, cX as SynthesisCompleteEvent, c_ as TERMINAL_STATUSES, c$ as TaskAbortedEvent, d1 as TaskBoardStore, d2 as TaskCompletedEvent, d4 as TaskConflictError, d5 as TaskCreateInput, d6 as TaskCreatedEvent, d9 as TaskExecutorInput, da as TaskFailedEvent, dd as TaskStatus, df as TaskTransitionEvent, dg as TaskTransitionReason, dl as TeamNotificationEvent, dp as TeamStartedEvent, dq as TeamStoppedEvent, dJ as WorkerReportPayload, dN as buildCoordinatorNotificationEvent } from '../instance-DtCDz9SL.js';
|
|
3
3
|
import { R as ReasoningLevel } from '../types-CQaXbRsS.js';
|
|
4
4
|
import '../types-C_LCeYNg.js';
|
|
5
5
|
import 'ai';
|
package/dist/tool/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { dD as ToolReplayPolicy, F as FileOperationMeta, bW as NormalizedToolReplayPolicy, T as Tool, H as HumanInputController, a as TurnTrackerContext, b as MiddlewareRunner, A as AgentEvent, dB as ToolMetadata, dx as ToolCapabilities } from '../instance-DtCDz9SL.js';
|
|
2
|
+
export { aG as CompatibleSchema, bw as InferSchemaOutput, bx as InputCheckResult, dY as getRequiredToolHost, e2 as resolveCapability } from '../instance-DtCDz9SL.js';
|
|
3
3
|
import { T as ToolHost } from '../types-C_LCeYNg.js';
|
|
4
4
|
export { D as DirEntry, E as ExecOptions, a as ExecResult, F as FileStat } from '../types-C_LCeYNg.js';
|
|
5
5
|
export { ToolHostProvider, ToolHostProviderSummary, ToolHostRegistry, defaultToolHostRegistry, localHost } from './host/index.js';
|
package/dist/tool/index.js
CHANGED
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
} from "../chunk-Q742PSH3.js";
|
|
18
18
|
import {
|
|
19
19
|
executeAgentToolCall
|
|
20
|
-
} from "../chunk-
|
|
21
|
-
import "../chunk-
|
|
20
|
+
} from "../chunk-MWPU2EVV.js";
|
|
21
|
+
import "../chunk-T33MQXUP.js";
|
|
22
22
|
import {
|
|
23
23
|
getRequiredToolHost,
|
|
24
24
|
resolveCapability
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'ai';
|
|
2
|
-
export {
|
|
2
|
+
export { ad as AgentTurnToolContext, t as AgentTurnToolProvider, ae as AgentTurnToolProviderResult } from '../instance-DtCDz9SL.js';
|
|
3
3
|
import '../types-C_LCeYNg.js';
|
|
4
4
|
import '../types-RSCv7nQ4.js';
|
|
5
5
|
import 'zod';
|