@dudousxd/nestjs-agent 1.19.2 → 1.20.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 +2 -0
- package/dist/{chat-queue.service-CKZkjlMK.d.cts → chat-queue.service-C0hr7dqx.d.cts} +41 -2
- package/dist/{chat-queue.service-CKZkjlMK.d.ts → chat-queue.service-C0hr7dqx.d.ts} +41 -2
- package/dist/durable/index.cjs +424 -32
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +41 -5
- package/dist/durable/index.d.ts +41 -5
- package/dist/durable/index.js +482 -90
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +274 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -4
- package/dist/index.d.ts +50 -4
- package/dist/index.js +327 -68
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/durable/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, AgentRunStartOptions, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
2
|
-
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
3
|
-
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-CKZkjlMK.cjs';
|
|
4
2
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
3
|
+
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
4
|
+
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-C0hr7dqx.cjs';
|
|
5
5
|
import { DynamicModule } from '@nestjs/common';
|
|
6
6
|
import '@standard-schema/spec';
|
|
7
7
|
|
|
@@ -23,8 +23,30 @@ declare class AgentRunWorkflow {
|
|
|
23
23
|
private readonly store;
|
|
24
24
|
private readonly runs?;
|
|
25
25
|
private readonly queue?;
|
|
26
|
+
private readonly workflows?;
|
|
26
27
|
private readonly logger;
|
|
27
|
-
constructor(factory: AgentDepsFactory, store: AgentStore, runs?: RunGateway | undefined, queue?: ChatQueueService | undefined);
|
|
28
|
+
constructor(factory: AgentDepsFactory, store: AgentStore, runs?: RunGateway | undefined, queue?: ChatQueueService | undefined, workflows?: WorkflowService | undefined);
|
|
29
|
+
/**
|
|
30
|
+
* Start a detached delegation as a TOP-LEVEL run, under an id derived from this run and the call.
|
|
31
|
+
*
|
|
32
|
+
* Not `ctx.startChild`, because the runtime treats a `spawn:` child as part of its parent: a Stop
|
|
33
|
+
* on the parent cascades to every run it spawned. A detached run is exactly the one the person did
|
|
34
|
+
* NOT ask to stop — they stopped the turn they were watching, and the work it handed off is meant
|
|
35
|
+
* to outlive that turn (it is meant to outlive it finishing, after all). Cascaded, it died parked
|
|
36
|
+
* on its approval, where its body never runs again, so nothing settled the delegation and the card
|
|
37
|
+
* said "started" for ever. The agent-level edge stays: the child's input still carries
|
|
38
|
+
* `parentRunId`, which is what the run rows record.
|
|
39
|
+
*
|
|
40
|
+
* Journaled as one `detach:<toolCallId>` localStep whose body runs outside the ambient workflow
|
|
41
|
+
* ctx (so the start goes to the engine and writes no position in this run). Its recorded result
|
|
42
|
+
* keeps a replay from starting it again, and a body re-run after a crash between the start and
|
|
43
|
+
* the checkpoint asks for the same id, which the runtime answers with the run it already has.
|
|
44
|
+
* The child is stamped with this run's namespace, as `ctx.startChild` would have stamped it, so an
|
|
45
|
+
* operator re-driving a tenant's turn does not move its delegate off that tenant's workers.
|
|
46
|
+
*/
|
|
47
|
+
private startDetached;
|
|
48
|
+
/** The namespace this run is stamped with, where the runtime can say. */
|
|
49
|
+
private namespaceOf;
|
|
28
50
|
/**
|
|
29
51
|
* Move the thread past this settling turn — to the next queued message, started here as a
|
|
30
52
|
* fire-and-forget `ctx.startChild` under the message's own id, or to a paused/empty queue — and
|
|
@@ -188,7 +210,21 @@ declare class DurableAgentRunner implements AgentRunner {
|
|
|
188
210
|
*/
|
|
189
211
|
cancel(runId: string): Promise<void>;
|
|
190
212
|
/**
|
|
191
|
-
*
|
|
213
|
+
* Settle the delegation a DETACHED run was started for, once it has been stopped. A run parked on
|
|
214
|
+
* a human never runs its body again — the runtime settles it from outside — so the body's own
|
|
215
|
+
* `deliver:detached:unsettled` is not reached, and without this the card in the calling thread says
|
|
216
|
+
* "started" for ever. Settles once (see `settleUnsettledDelegation`), so a body that did observe
|
|
217
|
+
* the Stop and a run that had already answered are both left as they are. A no-op for any run
|
|
218
|
+
* that does not deliver into another thread.
|
|
219
|
+
*/
|
|
220
|
+
private settleCancelledDelegation;
|
|
221
|
+
/**
|
|
222
|
+
* A detached child the runtime cancelled along with its parent (a `spawn:` journaled before
|
|
223
|
+
* detached runs were started on their own): end it the way a Stop on its own id would have.
|
|
224
|
+
*/
|
|
225
|
+
private settleCascadedDetached;
|
|
226
|
+
/**
|
|
227
|
+
* What the runtime recorded for a run — the input it was started with (which thread it was streaming), its status and the runs it spawned — or `undefined` where the gateway cannot say.
|
|
192
228
|
*
|
|
193
229
|
* A read failure answers `undefined` instead of propagating, the same posture `AgentRunWorkflow`
|
|
194
230
|
* takes for its own cancel observation: failing to ask is not an answer worth failing a cancel
|
|
@@ -197,7 +233,7 @@ declare class DurableAgentRunner implements AgentRunner {
|
|
|
197
233
|
* with a subscriber holding a stream that never settles, from the one call whose entire job is to
|
|
198
234
|
* make a run stop.
|
|
199
235
|
*/
|
|
200
|
-
private
|
|
236
|
+
private detailOf;
|
|
201
237
|
}
|
|
202
238
|
|
|
203
239
|
/**
|
package/dist/durable/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, AgentRunStartOptions, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
2
|
-
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
3
|
-
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-CKZkjlMK.js';
|
|
4
2
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
3
|
+
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
4
|
+
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-C0hr7dqx.js';
|
|
5
5
|
import { DynamicModule } from '@nestjs/common';
|
|
6
6
|
import '@standard-schema/spec';
|
|
7
7
|
|
|
@@ -23,8 +23,30 @@ declare class AgentRunWorkflow {
|
|
|
23
23
|
private readonly store;
|
|
24
24
|
private readonly runs?;
|
|
25
25
|
private readonly queue?;
|
|
26
|
+
private readonly workflows?;
|
|
26
27
|
private readonly logger;
|
|
27
|
-
constructor(factory: AgentDepsFactory, store: AgentStore, runs?: RunGateway | undefined, queue?: ChatQueueService | undefined);
|
|
28
|
+
constructor(factory: AgentDepsFactory, store: AgentStore, runs?: RunGateway | undefined, queue?: ChatQueueService | undefined, workflows?: WorkflowService | undefined);
|
|
29
|
+
/**
|
|
30
|
+
* Start a detached delegation as a TOP-LEVEL run, under an id derived from this run and the call.
|
|
31
|
+
*
|
|
32
|
+
* Not `ctx.startChild`, because the runtime treats a `spawn:` child as part of its parent: a Stop
|
|
33
|
+
* on the parent cascades to every run it spawned. A detached run is exactly the one the person did
|
|
34
|
+
* NOT ask to stop — they stopped the turn they were watching, and the work it handed off is meant
|
|
35
|
+
* to outlive that turn (it is meant to outlive it finishing, after all). Cascaded, it died parked
|
|
36
|
+
* on its approval, where its body never runs again, so nothing settled the delegation and the card
|
|
37
|
+
* said "started" for ever. The agent-level edge stays: the child's input still carries
|
|
38
|
+
* `parentRunId`, which is what the run rows record.
|
|
39
|
+
*
|
|
40
|
+
* Journaled as one `detach:<toolCallId>` localStep whose body runs outside the ambient workflow
|
|
41
|
+
* ctx (so the start goes to the engine and writes no position in this run). Its recorded result
|
|
42
|
+
* keeps a replay from starting it again, and a body re-run after a crash between the start and
|
|
43
|
+
* the checkpoint asks for the same id, which the runtime answers with the run it already has.
|
|
44
|
+
* The child is stamped with this run's namespace, as `ctx.startChild` would have stamped it, so an
|
|
45
|
+
* operator re-driving a tenant's turn does not move its delegate off that tenant's workers.
|
|
46
|
+
*/
|
|
47
|
+
private startDetached;
|
|
48
|
+
/** The namespace this run is stamped with, where the runtime can say. */
|
|
49
|
+
private namespaceOf;
|
|
28
50
|
/**
|
|
29
51
|
* Move the thread past this settling turn — to the next queued message, started here as a
|
|
30
52
|
* fire-and-forget `ctx.startChild` under the message's own id, or to a paused/empty queue — and
|
|
@@ -188,7 +210,21 @@ declare class DurableAgentRunner implements AgentRunner {
|
|
|
188
210
|
*/
|
|
189
211
|
cancel(runId: string): Promise<void>;
|
|
190
212
|
/**
|
|
191
|
-
*
|
|
213
|
+
* Settle the delegation a DETACHED run was started for, once it has been stopped. A run parked on
|
|
214
|
+
* a human never runs its body again — the runtime settles it from outside — so the body's own
|
|
215
|
+
* `deliver:detached:unsettled` is not reached, and without this the card in the calling thread says
|
|
216
|
+
* "started" for ever. Settles once (see `settleUnsettledDelegation`), so a body that did observe
|
|
217
|
+
* the Stop and a run that had already answered are both left as they are. A no-op for any run
|
|
218
|
+
* that does not deliver into another thread.
|
|
219
|
+
*/
|
|
220
|
+
private settleCancelledDelegation;
|
|
221
|
+
/**
|
|
222
|
+
* A detached child the runtime cancelled along with its parent (a `spawn:` journaled before
|
|
223
|
+
* detached runs were started on their own): end it the way a Stop on its own id would have.
|
|
224
|
+
*/
|
|
225
|
+
private settleCascadedDetached;
|
|
226
|
+
/**
|
|
227
|
+
* What the runtime recorded for a run — the input it was started with (which thread it was streaming), its status and the runs it spawned — or `undefined` where the gateway cannot say.
|
|
192
228
|
*
|
|
193
229
|
* A read failure answers `undefined` instead of propagating, the same posture `AgentRunWorkflow`
|
|
194
230
|
* takes for its own cancel observation: failing to ask is not an answer worth failing a cancel
|
|
@@ -197,7 +233,7 @@ declare class DurableAgentRunner implements AgentRunner {
|
|
|
197
233
|
* with a subscriber holding a stream that never settles, from the one call whose entire job is to
|
|
198
234
|
* make a run stop.
|
|
199
235
|
*/
|
|
200
|
-
private
|
|
236
|
+
private detailOf;
|
|
201
237
|
}
|
|
202
238
|
|
|
203
239
|
/**
|