@dudousxd/nestjs-agent 1.14.0 → 1.15.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 +19 -0
- package/dist/{agent-deps.factory-DkWvoWbD.d.cts → chat-queue.service-Bqq00NN1.d.cts} +131 -2
- package/dist/{agent-deps.factory-DkWvoWbD.d.ts → chat-queue.service-Bqq00NN1.d.ts} +131 -2
- package/dist/durable/index.cjs +1773 -751
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +26 -7
- package/dist/durable/index.d.ts +26 -7
- package/dist/durable/index.js +1603 -581
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +1577 -666
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +128 -7
- package/dist/index.d.ts +128 -7
- package/dist/index.js +1387 -478
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/durable/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
1
|
+
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, AgentRunStartOptions, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
2
2
|
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
3
|
-
import { A as AgentDepsFactory, a as AgentSurface, b as AgentModuleOptions } from '../
|
|
3
|
+
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-Bqq00NN1.cjs';
|
|
4
4
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
5
5
|
import { DynamicModule } from '@nestjs/common';
|
|
6
6
|
import '@standard-schema/spec';
|
|
@@ -22,7 +22,19 @@ declare class AgentRunWorkflow {
|
|
|
22
22
|
private readonly factory;
|
|
23
23
|
private readonly store;
|
|
24
24
|
private readonly runs?;
|
|
25
|
-
|
|
25
|
+
private readonly queue?;
|
|
26
|
+
constructor(factory: AgentDepsFactory, store: AgentStore, runs?: RunGateway | undefined, queue?: ChatQueueService | undefined);
|
|
27
|
+
/**
|
|
28
|
+
* Move the thread past this settling turn — to the next queued message, started here as a
|
|
29
|
+
* fire-and-forget `ctx.startChild` under the message's own id, or to a paused/empty queue — and
|
|
30
|
+
* answer the `queue` frame to write before the turn's terminal.
|
|
31
|
+
*
|
|
32
|
+
* Journaled: the decision (which message, claimed and popped) is one `localStep`, so a replay
|
|
33
|
+
* reads it back instead of popping a second message, and the start is the runtime's own
|
|
34
|
+
* replay-safe spawn. Gated by `ctx.patched`, so a run recorded before the queue existed replays
|
|
35
|
+
* against the history it has. A no-op for a sub-agent's run and on a store without a queue.
|
|
36
|
+
*/
|
|
37
|
+
private advanceQueue;
|
|
26
38
|
/**
|
|
27
39
|
* Has someone asked this run to stop? Read from the runtime's own run status, which is where
|
|
28
40
|
* `DurableAgentRunner.cancel` puts it — `cancelling` while a compensating cancel is in flight,
|
|
@@ -134,11 +146,18 @@ declare class DurableAgentRunner implements AgentRunner {
|
|
|
134
146
|
private readonly runs;
|
|
135
147
|
private readonly store;
|
|
136
148
|
private readonly sink;
|
|
149
|
+
private readonly queue?;
|
|
137
150
|
private readonly logger;
|
|
138
|
-
constructor(workflows: WorkflowService, runs: RunGateway, store: AgentStore, sink: TokenStreamSink);
|
|
139
|
-
start(input: AgentRunInput): Promise<{
|
|
151
|
+
constructor(workflows: WorkflowService, runs: RunGateway, store: AgentStore, sink: TokenStreamSink, queue?: ChatQueueService | undefined);
|
|
152
|
+
start(input: AgentRunInput, options?: AgentRunStartOptions): Promise<{
|
|
140
153
|
runId: string;
|
|
141
154
|
}>;
|
|
155
|
+
/**
|
|
156
|
+
* From the runtime's own run row. A run it does not know yet counts as running — a queued turn is
|
|
157
|
+
* claimed before its `startChild` lands — and so does one it cannot be asked about: only a run the
|
|
158
|
+
* runtime reports settled (`completed`/`failed`/`cancelled`/`dead`) is stale.
|
|
159
|
+
*/
|
|
160
|
+
isRunActive(runId: string): Promise<boolean>;
|
|
142
161
|
signal(runId: string, toolCallId: string, reply: HumanReply): Promise<void>;
|
|
143
162
|
/**
|
|
144
163
|
* Stop a run, and settle what the durable runtime knows nothing about.
|
|
@@ -166,7 +185,7 @@ declare class DurableAgentRunner implements AgentRunner {
|
|
|
166
185
|
*/
|
|
167
186
|
cancel(runId: string): Promise<void>;
|
|
168
187
|
/**
|
|
169
|
-
*
|
|
188
|
+
* The input a run was started with (which thread it was streaming), or `undefined` where the gateway cannot say.
|
|
170
189
|
*
|
|
171
190
|
* A read failure answers `undefined` instead of propagating, the same posture `AgentRunWorkflow`
|
|
172
191
|
* takes for its own cancel observation: failing to ask is not an answer worth failing a cancel
|
|
@@ -175,7 +194,7 @@ declare class DurableAgentRunner implements AgentRunner {
|
|
|
175
194
|
* with a subscriber holding a stream that never settles, from the one call whose entire job is to
|
|
176
195
|
* make a run stop.
|
|
177
196
|
*/
|
|
178
|
-
private
|
|
197
|
+
private inputOf;
|
|
179
198
|
}
|
|
180
199
|
|
|
181
200
|
/**
|
package/dist/durable/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
1
|
+
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, AgentRunStartOptions, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
2
2
|
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
3
|
-
import { A as AgentDepsFactory, a as AgentSurface, b as AgentModuleOptions } from '../
|
|
3
|
+
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-Bqq00NN1.js';
|
|
4
4
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
5
5
|
import { DynamicModule } from '@nestjs/common';
|
|
6
6
|
import '@standard-schema/spec';
|
|
@@ -22,7 +22,19 @@ declare class AgentRunWorkflow {
|
|
|
22
22
|
private readonly factory;
|
|
23
23
|
private readonly store;
|
|
24
24
|
private readonly runs?;
|
|
25
|
-
|
|
25
|
+
private readonly queue?;
|
|
26
|
+
constructor(factory: AgentDepsFactory, store: AgentStore, runs?: RunGateway | undefined, queue?: ChatQueueService | undefined);
|
|
27
|
+
/**
|
|
28
|
+
* Move the thread past this settling turn — to the next queued message, started here as a
|
|
29
|
+
* fire-and-forget `ctx.startChild` under the message's own id, or to a paused/empty queue — and
|
|
30
|
+
* answer the `queue` frame to write before the turn's terminal.
|
|
31
|
+
*
|
|
32
|
+
* Journaled: the decision (which message, claimed and popped) is one `localStep`, so a replay
|
|
33
|
+
* reads it back instead of popping a second message, and the start is the runtime's own
|
|
34
|
+
* replay-safe spawn. Gated by `ctx.patched`, so a run recorded before the queue existed replays
|
|
35
|
+
* against the history it has. A no-op for a sub-agent's run and on a store without a queue.
|
|
36
|
+
*/
|
|
37
|
+
private advanceQueue;
|
|
26
38
|
/**
|
|
27
39
|
* Has someone asked this run to stop? Read from the runtime's own run status, which is where
|
|
28
40
|
* `DurableAgentRunner.cancel` puts it — `cancelling` while a compensating cancel is in flight,
|
|
@@ -134,11 +146,18 @@ declare class DurableAgentRunner implements AgentRunner {
|
|
|
134
146
|
private readonly runs;
|
|
135
147
|
private readonly store;
|
|
136
148
|
private readonly sink;
|
|
149
|
+
private readonly queue?;
|
|
137
150
|
private readonly logger;
|
|
138
|
-
constructor(workflows: WorkflowService, runs: RunGateway, store: AgentStore, sink: TokenStreamSink);
|
|
139
|
-
start(input: AgentRunInput): Promise<{
|
|
151
|
+
constructor(workflows: WorkflowService, runs: RunGateway, store: AgentStore, sink: TokenStreamSink, queue?: ChatQueueService | undefined);
|
|
152
|
+
start(input: AgentRunInput, options?: AgentRunStartOptions): Promise<{
|
|
140
153
|
runId: string;
|
|
141
154
|
}>;
|
|
155
|
+
/**
|
|
156
|
+
* From the runtime's own run row. A run it does not know yet counts as running — a queued turn is
|
|
157
|
+
* claimed before its `startChild` lands — and so does one it cannot be asked about: only a run the
|
|
158
|
+
* runtime reports settled (`completed`/`failed`/`cancelled`/`dead`) is stale.
|
|
159
|
+
*/
|
|
160
|
+
isRunActive(runId: string): Promise<boolean>;
|
|
142
161
|
signal(runId: string, toolCallId: string, reply: HumanReply): Promise<void>;
|
|
143
162
|
/**
|
|
144
163
|
* Stop a run, and settle what the durable runtime knows nothing about.
|
|
@@ -166,7 +185,7 @@ declare class DurableAgentRunner implements AgentRunner {
|
|
|
166
185
|
*/
|
|
167
186
|
cancel(runId: string): Promise<void>;
|
|
168
187
|
/**
|
|
169
|
-
*
|
|
188
|
+
* The input a run was started with (which thread it was streaming), or `undefined` where the gateway cannot say.
|
|
170
189
|
*
|
|
171
190
|
* A read failure answers `undefined` instead of propagating, the same posture `AgentRunWorkflow`
|
|
172
191
|
* takes for its own cancel observation: failing to ask is not an answer worth failing a cancel
|
|
@@ -175,7 +194,7 @@ declare class DurableAgentRunner implements AgentRunner {
|
|
|
175
194
|
* with a subscriber holding a stream that never settles, from the one call whose entire job is to
|
|
176
195
|
* make a run stop.
|
|
177
196
|
*/
|
|
178
|
-
private
|
|
197
|
+
private inputOf;
|
|
179
198
|
}
|
|
180
199
|
|
|
181
200
|
/**
|