@dudousxd/nestjs-agent 1.24.1 → 1.25.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/README.md +7 -5
- package/dist/durable/index.cjs +67 -10
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.js +68 -11
- package/dist/durable/index.js.map +1 -1
- package/dist/genui/index.cjs.map +1 -1
- package/dist/genui/index.d.cts +16 -3
- package/dist/genui/index.d.ts +16 -3
- package/dist/genui/index.js.map +1 -1
- package/dist/index.cjs +48 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -11
- package/dist/index.d.ts +27 -11
- package/dist/index.js +48 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { DynamicModule, Type, OnApplicationBootstrap, OnModuleInit, ConflictExce
|
|
|
2
2
|
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter, e as AgentSkillsOptions } from './chat-queue.service-Crf9uwum.cjs';
|
|
3
3
|
export { f as AGENT_TOOL_BRAND, g as AgentAttachmentsOptions, h as AgentDeps, i as AgentEngine, j as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QueuePlan, k as QueueSettleOutcome, l as QueuedTurn, m as QueuedTurnStarter, n as QuotaLimits, o as QuotaWindowLimits, p as defineTool, q as delegateToolName, r as provideAgentTool, s as provideAgentTools, u as utcDay } from './chat-queue.service-Crf9uwum.cjs';
|
|
4
4
|
import * as _dudousxd_nestjs_agent_core from '@dudousxd/nestjs-agent-core';
|
|
5
|
-
import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode,
|
|
5
|
+
import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalView, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode, MessageAttachment, QuotaReport, ModelCatalogView, AgentHostContext, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver, AgentApprovalPort, AgentClientConfig, ToolSpec, ToolPresentation, AgentHistoryWindow, AgentIntake, Persona, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, AgentRunStartOptions, TokenStreamSink, SinkWriter, ActionProposal } from '@dudousxd/nestjs-agent-core';
|
|
6
6
|
export * from '@dudousxd/nestjs-agent-core';
|
|
7
7
|
export { FunctionalToolDefinition } from '@dudousxd/nestjs-agent-core';
|
|
8
8
|
import { Request, Response } from 'express';
|
|
@@ -37,17 +37,21 @@ declare class ActionProposalService {
|
|
|
37
37
|
/** The words a text decision is made of, and what the agent answers — English unless configured. */
|
|
38
38
|
private readonly vocabulary;
|
|
39
39
|
private readonly replies;
|
|
40
|
+
private hasCapability;
|
|
40
41
|
private capability;
|
|
41
42
|
private scope;
|
|
42
43
|
private mayDecide;
|
|
44
|
+
/**
|
|
45
|
+
* One page of a thread's proposals this actor may see. A store without the proposal capability
|
|
46
|
+
* can only run blocking approvals, so a thread there has no proposals: an empty, final page rather
|
|
47
|
+
* than `501` — a client that lists by default (React's `useAgentChat`) needs no flag. Deciding one
|
|
48
|
+
* still answers `501`.
|
|
49
|
+
*/
|
|
43
50
|
listPage(threadId: string, actor: Actor, query?: Pick<ListActionProposals, 'after'>): Promise<{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
id: string;
|
|
47
|
-
};
|
|
48
|
-
items: _dudousxd_nestjs_agent_core.ActionProposalView[];
|
|
51
|
+
items: ActionProposalView[];
|
|
52
|
+
next?: NonNullable<ListActionProposals['after']>;
|
|
49
53
|
}>;
|
|
50
|
-
list(threadId: string, actor: Actor): Promise<
|
|
54
|
+
list(threadId: string, actor: Actor): Promise<ActionProposalView[]>;
|
|
51
55
|
decide(threadId: string, proposalId: string, actor: Actor, command: {
|
|
52
56
|
decision: 'approved' | 'rejected';
|
|
53
57
|
remember?: boolean;
|
|
@@ -221,8 +225,9 @@ declare class AgentService {
|
|
|
221
225
|
actionProposalReply(result: Pick<ActionProposalMutationView, 'status' | 'proposal'>, decision: 'approved' | 'rejected'): string;
|
|
222
226
|
/**
|
|
223
227
|
* The proposals of a thread this actor may see — the thread's own actor, or one the policy lets
|
|
224
|
-
* decide them; what `GET <base>/threads/:threadId/action-proposals` serves (its first page).
|
|
225
|
-
*
|
|
228
|
+
* decide them; what `GET <base>/threads/:threadId/action-proposals` serves (its first page).
|
|
229
|
+
* Without independent approvals (the default blocking mode) there are none, so the read answers an
|
|
230
|
+
* empty list rather than refusing; deciding one still refuses.
|
|
226
231
|
*/
|
|
227
232
|
listActionProposals(actor: Actor, threadId: string): Promise<ActionProposalView[]>;
|
|
228
233
|
/**
|
|
@@ -1248,6 +1253,11 @@ declare class InlineAgentRunner implements AgentRunner {
|
|
|
1248
1253
|
* running it. A cancelled id is dropped once the run settles, so the set tracks live runs only.
|
|
1249
1254
|
*/
|
|
1250
1255
|
private readonly cancelled;
|
|
1256
|
+
/**
|
|
1257
|
+
* Aborted by {@link cancel}: what cuts short the model call or tool a stopped run is in (the
|
|
1258
|
+
* loop's `abortSignal` hook). Keyed like {@link cancelled}, and dropped with it.
|
|
1259
|
+
*/
|
|
1260
|
+
private readonly aborts;
|
|
1251
1261
|
/** Top-level runs this process is running now — what {@link isRunActive} answers from. */
|
|
1252
1262
|
private readonly live;
|
|
1253
1263
|
constructor(factory: AgentDepsFactory, store: AgentStore, queue?: ChatQueueService | undefined);
|
|
@@ -1264,8 +1274,10 @@ declare class InlineAgentRunner implements AgentRunner {
|
|
|
1264
1274
|
* Ask a run to stop, and settle whatever it was parked on.
|
|
1265
1275
|
*
|
|
1266
1276
|
* The loop observes the request at its next safe point (between steps, before the turn's tools) and
|
|
1267
|
-
* unwinds from there
|
|
1268
|
-
*
|
|
1277
|
+
* unwinds from there. What the run is in right now is aborted (its `abortSignal`): the model call
|
|
1278
|
+
* streaming the answer ends at once and the step it was writing is not persisted, and a tool that
|
|
1279
|
+
* passes `ctx.abortSignal` on is cut short and recorded failed; a tool that ignores the signal is
|
|
1280
|
+
* left to finish, and its result is recorded exactly as it would have been. What this cannot wait for is a turn parked on a human: that wait
|
|
1269
1281
|
* is a promise nobody is going to resolve, so it is REJECTED here with the same
|
|
1270
1282
|
* {@link RunCancelledError} the loop would have thrown, and the run unwinds through the identical
|
|
1271
1283
|
* path.
|
|
@@ -1275,6 +1287,10 @@ declare class InlineAgentRunner implements AgentRunner {
|
|
|
1275
1287
|
* each and can never both write.
|
|
1276
1288
|
*/
|
|
1277
1289
|
cancel(runId: string): Promise<void>;
|
|
1290
|
+
/** The signal {@link cancel} aborts for `runId` — one per run, shared by its awaited delegates. */
|
|
1291
|
+
private abortSignalFor;
|
|
1292
|
+
/** Drop a settled run's Stop: its flag and its abort controller. */
|
|
1293
|
+
private forgetCancel;
|
|
1278
1294
|
/**
|
|
1279
1295
|
* The single place a cancelled run's state is settled: recorded as its own terminal (never
|
|
1280
1296
|
* `failed` — a user pressing Stop must not land in someone's error rate), the thread released, and
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { DynamicModule, Type, OnApplicationBootstrap, OnModuleInit, ConflictExce
|
|
|
2
2
|
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter, e as AgentSkillsOptions } from './chat-queue.service-ZQkqb1Yw.js';
|
|
3
3
|
export { f as AGENT_TOOL_BRAND, g as AgentAttachmentsOptions, h as AgentDeps, i as AgentEngine, j as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QueuePlan, k as QueueSettleOutcome, l as QueuedTurn, m as QueuedTurnStarter, n as QuotaLimits, o as QuotaWindowLimits, p as defineTool, q as delegateToolName, r as provideAgentTool, s as provideAgentTools, u as utcDay } from './chat-queue.service-ZQkqb1Yw.js';
|
|
4
4
|
import * as _dudousxd_nestjs_agent_core from '@dudousxd/nestjs-agent-core';
|
|
5
|
-
import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode,
|
|
5
|
+
import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalView, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode, MessageAttachment, QuotaReport, ModelCatalogView, AgentHostContext, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver, AgentApprovalPort, AgentClientConfig, ToolSpec, ToolPresentation, AgentHistoryWindow, AgentIntake, Persona, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, AgentRunStartOptions, TokenStreamSink, SinkWriter, ActionProposal } from '@dudousxd/nestjs-agent-core';
|
|
6
6
|
export * from '@dudousxd/nestjs-agent-core';
|
|
7
7
|
export { FunctionalToolDefinition } from '@dudousxd/nestjs-agent-core';
|
|
8
8
|
import { Request, Response } from 'express';
|
|
@@ -37,17 +37,21 @@ declare class ActionProposalService {
|
|
|
37
37
|
/** The words a text decision is made of, and what the agent answers — English unless configured. */
|
|
38
38
|
private readonly vocabulary;
|
|
39
39
|
private readonly replies;
|
|
40
|
+
private hasCapability;
|
|
40
41
|
private capability;
|
|
41
42
|
private scope;
|
|
42
43
|
private mayDecide;
|
|
44
|
+
/**
|
|
45
|
+
* One page of a thread's proposals this actor may see. A store without the proposal capability
|
|
46
|
+
* can only run blocking approvals, so a thread there has no proposals: an empty, final page rather
|
|
47
|
+
* than `501` — a client that lists by default (React's `useAgentChat`) needs no flag. Deciding one
|
|
48
|
+
* still answers `501`.
|
|
49
|
+
*/
|
|
43
50
|
listPage(threadId: string, actor: Actor, query?: Pick<ListActionProposals, 'after'>): Promise<{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
id: string;
|
|
47
|
-
};
|
|
48
|
-
items: _dudousxd_nestjs_agent_core.ActionProposalView[];
|
|
51
|
+
items: ActionProposalView[];
|
|
52
|
+
next?: NonNullable<ListActionProposals['after']>;
|
|
49
53
|
}>;
|
|
50
|
-
list(threadId: string, actor: Actor): Promise<
|
|
54
|
+
list(threadId: string, actor: Actor): Promise<ActionProposalView[]>;
|
|
51
55
|
decide(threadId: string, proposalId: string, actor: Actor, command: {
|
|
52
56
|
decision: 'approved' | 'rejected';
|
|
53
57
|
remember?: boolean;
|
|
@@ -221,8 +225,9 @@ declare class AgentService {
|
|
|
221
225
|
actionProposalReply(result: Pick<ActionProposalMutationView, 'status' | 'proposal'>, decision: 'approved' | 'rejected'): string;
|
|
222
226
|
/**
|
|
223
227
|
* The proposals of a thread this actor may see — the thread's own actor, or one the policy lets
|
|
224
|
-
* decide them; what `GET <base>/threads/:threadId/action-proposals` serves (its first page).
|
|
225
|
-
*
|
|
228
|
+
* decide them; what `GET <base>/threads/:threadId/action-proposals` serves (its first page).
|
|
229
|
+
* Without independent approvals (the default blocking mode) there are none, so the read answers an
|
|
230
|
+
* empty list rather than refusing; deciding one still refuses.
|
|
226
231
|
*/
|
|
227
232
|
listActionProposals(actor: Actor, threadId: string): Promise<ActionProposalView[]>;
|
|
228
233
|
/**
|
|
@@ -1248,6 +1253,11 @@ declare class InlineAgentRunner implements AgentRunner {
|
|
|
1248
1253
|
* running it. A cancelled id is dropped once the run settles, so the set tracks live runs only.
|
|
1249
1254
|
*/
|
|
1250
1255
|
private readonly cancelled;
|
|
1256
|
+
/**
|
|
1257
|
+
* Aborted by {@link cancel}: what cuts short the model call or tool a stopped run is in (the
|
|
1258
|
+
* loop's `abortSignal` hook). Keyed like {@link cancelled}, and dropped with it.
|
|
1259
|
+
*/
|
|
1260
|
+
private readonly aborts;
|
|
1251
1261
|
/** Top-level runs this process is running now — what {@link isRunActive} answers from. */
|
|
1252
1262
|
private readonly live;
|
|
1253
1263
|
constructor(factory: AgentDepsFactory, store: AgentStore, queue?: ChatQueueService | undefined);
|
|
@@ -1264,8 +1274,10 @@ declare class InlineAgentRunner implements AgentRunner {
|
|
|
1264
1274
|
* Ask a run to stop, and settle whatever it was parked on.
|
|
1265
1275
|
*
|
|
1266
1276
|
* The loop observes the request at its next safe point (between steps, before the turn's tools) and
|
|
1267
|
-
* unwinds from there
|
|
1268
|
-
*
|
|
1277
|
+
* unwinds from there. What the run is in right now is aborted (its `abortSignal`): the model call
|
|
1278
|
+
* streaming the answer ends at once and the step it was writing is not persisted, and a tool that
|
|
1279
|
+
* passes `ctx.abortSignal` on is cut short and recorded failed; a tool that ignores the signal is
|
|
1280
|
+
* left to finish, and its result is recorded exactly as it would have been. What this cannot wait for is a turn parked on a human: that wait
|
|
1269
1281
|
* is a promise nobody is going to resolve, so it is REJECTED here with the same
|
|
1270
1282
|
* {@link RunCancelledError} the loop would have thrown, and the run unwinds through the identical
|
|
1271
1283
|
* path.
|
|
@@ -1275,6 +1287,10 @@ declare class InlineAgentRunner implements AgentRunner {
|
|
|
1275
1287
|
* each and can never both write.
|
|
1276
1288
|
*/
|
|
1277
1289
|
cancel(runId: string): Promise<void>;
|
|
1290
|
+
/** The signal {@link cancel} aborts for `runId` — one per run, shared by its awaited delegates. */
|
|
1291
|
+
private abortSignalFor;
|
|
1292
|
+
/** Drop a settled run's Stop: its flag and its abort controller. */
|
|
1293
|
+
private forgetCancel;
|
|
1278
1294
|
/**
|
|
1279
1295
|
* The single place a cancelled run's state is settled: recorded as its own terminal (never
|
|
1280
1296
|
* `failed` — a user pressing Stop must not land in someone's error rate), the thread released, and
|
package/dist/index.js
CHANGED
|
@@ -666,9 +666,13 @@ var ActionProposalService = class {
|
|
|
666
666
|
/** The words a text decision is made of, and what the agent answers — English unless configured. */
|
|
667
667
|
vocabulary;
|
|
668
668
|
replies;
|
|
669
|
+
hasCapability() {
|
|
670
|
+
const store = this.store;
|
|
671
|
+
return typeof store.getThreadActionProposalScope === "function" && typeof store.listActionProposals === "function";
|
|
672
|
+
}
|
|
669
673
|
capability() {
|
|
670
674
|
const store = this.store;
|
|
671
|
-
if (
|
|
675
|
+
if (!this.hasCapability()) throw new NotImplementedException("Action proposals are unavailable");
|
|
672
676
|
return store;
|
|
673
677
|
}
|
|
674
678
|
async scope(threadId, actor) {
|
|
@@ -684,7 +688,16 @@ var ActionProposalService = class {
|
|
|
684
688
|
requesterRef: proposal.actorRef
|
|
685
689
|
});
|
|
686
690
|
}
|
|
691
|
+
/**
|
|
692
|
+
* One page of a thread's proposals this actor may see. A store without the proposal capability
|
|
693
|
+
* can only run blocking approvals, so a thread there has no proposals: an empty, final page rather
|
|
694
|
+
* than `501` — a client that lists by default (React's `useAgentChat`) needs no flag. Deciding one
|
|
695
|
+
* still answers `501`.
|
|
696
|
+
*/
|
|
687
697
|
async listPage(threadId, actor, query = {}) {
|
|
698
|
+
if (!this.hasCapability()) return {
|
|
699
|
+
items: []
|
|
700
|
+
};
|
|
688
701
|
const scope = await this.scope(threadId, actor);
|
|
689
702
|
const rows = await this.capability().listActionProposals(scope, {
|
|
690
703
|
limit: 1e3,
|
|
@@ -1418,12 +1431,13 @@ var AgentService = class {
|
|
|
1418
1431
|
}
|
|
1419
1432
|
/**
|
|
1420
1433
|
* The proposals of a thread this actor may see — the thread's own actor, or one the policy lets
|
|
1421
|
-
* decide them; what `GET <base>/threads/:threadId/action-proposals` serves (its first page).
|
|
1422
|
-
*
|
|
1434
|
+
* decide them; what `GET <base>/threads/:threadId/action-proposals` serves (its first page).
|
|
1435
|
+
* Without independent approvals (the default blocking mode) there are none, so the read answers an
|
|
1436
|
+
* empty list rather than refusing; deciding one still refuses.
|
|
1423
1437
|
*/
|
|
1424
1438
|
async listActionProposals(actor, threadId) {
|
|
1425
1439
|
if (this.options?.actionApprovalMode !== "independent" || !this.proposals) {
|
|
1426
|
-
|
|
1440
|
+
return [];
|
|
1427
1441
|
}
|
|
1428
1442
|
return this.proposals.list(threadId, actor);
|
|
1429
1443
|
}
|
|
@@ -5417,6 +5431,11 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5417
5431
|
* running it. A cancelled id is dropped once the run settles, so the set tracks live runs only.
|
|
5418
5432
|
*/
|
|
5419
5433
|
cancelled = /* @__PURE__ */ new Set();
|
|
5434
|
+
/**
|
|
5435
|
+
* Aborted by {@link cancel}: what cuts short the model call or tool a stopped run is in (the
|
|
5436
|
+
* loop's `abortSignal` hook). Keyed like {@link cancelled}, and dropped with it.
|
|
5437
|
+
*/
|
|
5438
|
+
aborts = /* @__PURE__ */ new Map();
|
|
5420
5439
|
/** Top-level runs this process is running now — what {@link isRunActive} answers from. */
|
|
5421
5440
|
live = /* @__PURE__ */ new Set();
|
|
5422
5441
|
constructor(factory, store, queue) {
|
|
@@ -5486,7 +5505,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5486
5505
|
await releaseThreadRun(this.store, input.threadId, runId);
|
|
5487
5506
|
await writer.fail(streamFailure2(error));
|
|
5488
5507
|
}).finally(() => {
|
|
5489
|
-
this.
|
|
5508
|
+
this.forgetCancel(runId);
|
|
5490
5509
|
this.live.delete(runId);
|
|
5491
5510
|
});
|
|
5492
5511
|
return {
|
|
@@ -5505,8 +5524,10 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5505
5524
|
* Ask a run to stop, and settle whatever it was parked on.
|
|
5506
5525
|
*
|
|
5507
5526
|
* The loop observes the request at its next safe point (between steps, before the turn's tools) and
|
|
5508
|
-
* unwinds from there
|
|
5509
|
-
*
|
|
5527
|
+
* unwinds from there. What the run is in right now is aborted (its `abortSignal`): the model call
|
|
5528
|
+
* streaming the answer ends at once and the step it was writing is not persisted, and a tool that
|
|
5529
|
+
* passes `ctx.abortSignal` on is cut short and recorded failed; a tool that ignores the signal is
|
|
5530
|
+
* left to finish, and its result is recorded exactly as it would have been. What this cannot wait for is a turn parked on a human: that wait
|
|
5510
5531
|
* is a promise nobody is going to resolve, so it is REJECTED here with the same
|
|
5511
5532
|
* {@link RunCancelledError} the loop would have thrown, and the run unwinds through the identical
|
|
5512
5533
|
* path.
|
|
@@ -5517,6 +5538,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5517
5538
|
*/
|
|
5518
5539
|
async cancel(runId) {
|
|
5519
5540
|
this.cancelled.add(runId);
|
|
5541
|
+
this.aborts.get(runId)?.abort(new RunCancelledError());
|
|
5520
5542
|
for (const [key, waiter] of this.pending) {
|
|
5521
5543
|
if (key.startsWith(`${runId}:`)) {
|
|
5522
5544
|
this.pending.delete(key);
|
|
@@ -5525,6 +5547,20 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5525
5547
|
}
|
|
5526
5548
|
await Promise.resolve();
|
|
5527
5549
|
}
|
|
5550
|
+
/** The signal {@link cancel} aborts for `runId` — one per run, shared by its awaited delegates. */
|
|
5551
|
+
abortSignalFor(runId) {
|
|
5552
|
+
let controller = this.aborts.get(runId);
|
|
5553
|
+
if (controller === void 0) {
|
|
5554
|
+
controller = new AbortController();
|
|
5555
|
+
this.aborts.set(runId, controller);
|
|
5556
|
+
}
|
|
5557
|
+
return controller.signal;
|
|
5558
|
+
}
|
|
5559
|
+
/** Drop a settled run's Stop: its flag and its abort controller. */
|
|
5560
|
+
forgetCancel(runId) {
|
|
5561
|
+
this.cancelled.delete(runId);
|
|
5562
|
+
this.aborts.delete(runId);
|
|
5563
|
+
}
|
|
5528
5564
|
/**
|
|
5529
5565
|
* The single place a cancelled run's state is settled: recorded as its own terminal (never
|
|
5530
5566
|
* `failed` — a user pressing Stop must not land in someone's error rate), the thread released, and
|
|
@@ -5644,6 +5680,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5644
5680
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
5645
5681
|
parallel: settleAll,
|
|
5646
5682
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId), "cancelled"),
|
|
5683
|
+
abortSignal: this.abortSignalFor(runId),
|
|
5647
5684
|
runAgent: /* @__PURE__ */ __name((agentName, task) => this.runNested({
|
|
5648
5685
|
agentName,
|
|
5649
5686
|
task,
|
|
@@ -5695,6 +5732,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5695
5732
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
5696
5733
|
parallel: settleAll,
|
|
5697
5734
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId), "cancelled"),
|
|
5735
|
+
abortSignal: this.abortSignalFor(runId),
|
|
5698
5736
|
runAgent: /* @__PURE__ */ __name((childName, childTask) => this.runNested({
|
|
5699
5737
|
agentName: childName,
|
|
5700
5738
|
task: childTask,
|
|
@@ -5770,7 +5808,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5770
5808
|
}
|
|
5771
5809
|
});
|
|
5772
5810
|
}).finally(async () => {
|
|
5773
|
-
this.
|
|
5811
|
+
this.forgetCancel(runId);
|
|
5774
5812
|
await this.store.setActiveStream(subThread.id, null);
|
|
5775
5813
|
});
|
|
5776
5814
|
return {
|
|
@@ -5802,6 +5840,8 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5802
5840
|
// A child stops when it is cancelled OR when the run a human is actually watching is: the
|
|
5803
5841
|
// canceller names the top-level run, which is the only id that ever left the server.
|
|
5804
5842
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId) || this.cancelled.has(sinkRunId), "cancelled"),
|
|
5843
|
+
// Aborted by a Stop on the run the human is watching, which is the id a canceller names.
|
|
5844
|
+
abortSignal: this.abortSignalFor(sinkRunId),
|
|
5805
5845
|
runAgent: /* @__PURE__ */ __name((childName, childTask) => this.runNested({
|
|
5806
5846
|
agentName: childName,
|
|
5807
5847
|
task: childTask,
|