@signalwire/sdk 3.9.0 → 3.10.3
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/CHANGELOG.md +47 -0
- package/dist/ContextBuilder.d.ts +34 -5
- package/dist/ContextBuilder.js +34 -5
- package/dist/ContextBuilder.js.map +1 -1
- package/dist/FunctionResult.d.ts +25 -9
- package/dist/FunctionResult.js +26 -10
- package/dist/FunctionResult.js.map +1 -1
- package/dist/cli/tsdocs/api-index.json +1 -1
- package/dist/patterns/Proposal.d.ts +3 -1
- package/dist/patterns/Proposal.js +3 -1
- package/dist/patterns/Proposal.js.map +1 -1
- package/dist/patterns/RequestList.d.ts +5 -3
- package/dist/patterns/RequestList.js +5 -3
- package/dist/patterns/RequestList.js.map +1 -1
- package/dist/testing/CallSimulator.d.ts +116 -6
- package/dist/testing/CallSimulator.js +321 -21
- package/dist/testing/CallSimulator.js.map +1 -1
- package/docs/api-reference.md +2 -2
- package/docs/contexts-guide.md +31 -2
- package/docs/conversation_patterns.md +2 -2
- package/docs/pgi_agent_guide.md +5 -0
- package/docs/programmatically_governed_inference.md +1 -1
- package/docs/swaig-reference.md +5 -5
- package/package.json +1 -1
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This is the platform's confirm pattern. A function proposes the change: it
|
|
5
5
|
* reads it back and records it in `semantic_state`, in one action object, so
|
|
6
|
-
* the proposal's dialogue starts with the read-back
|
|
6
|
+
* the proposal's dialogue starts with the read-back on any platform release,
|
|
7
|
+
* including those that date a proposal from its own action object rather than
|
|
8
|
+
* the result's action list. The confirm tool's
|
|
7
9
|
* semantic gates, judged on that dialogue (`dialogue: 'proposal'`), check three
|
|
8
10
|
* things: that the caller's latest turn is an answer, that the answer is a yes,
|
|
9
11
|
* and that what they answered was a read-back of this change. The gates'
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This is the platform's confirm pattern. A function proposes the change: it
|
|
5
5
|
* reads it back and records it in `semantic_state`, in one action object, so
|
|
6
|
-
* the proposal's dialogue starts with the read-back
|
|
6
|
+
* the proposal's dialogue starts with the read-back on any platform release,
|
|
7
|
+
* including those that date a proposal from its own action object rather than
|
|
8
|
+
* the result's action list. The confirm tool's
|
|
7
9
|
* semantic gates, judged on that dialogue (`dialogue: 'proposal'`), check three
|
|
8
10
|
* things: that the caller's latest turn is an answer, that the answer is a yes,
|
|
9
11
|
* and that what they answered was a read-back of this change. The gates'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Proposal.js","sourceRoot":"","sources":["../../src/patterns/Proposal.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Proposal.js","sourceRoot":"","sources":["../../src/patterns/Proposal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAA4B,MAAM,oBAAoB,CAAC;AAE5E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AAgCvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,OAAO,QAAQ;IACnB,4CAA4C;IAC5C,WAAW,CAAS;IACpB,kDAAkD;IAClD,WAAW,CAAU;IACrB,6BAA6B;IAC7B,SAAS,CAAS;IAClB,4CAA4C;IAC5C,OAAO,CAAU;IAEjB;;;OAGG;IACH,YAAY,WAAmB,EAAE,OAAwB,EAAE;QACzD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,OAAO,CA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AAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACjE,CAAC;AAED,SAAS,UAAU,CAAC,OAAmD;IACrE,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IAChD,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -59,9 +59,11 @@ export interface RequestListOptions {
|
|
|
59
59
|
* ctx.addStep('take_order').setText("Take the caller's order.\n\n${global_data.later_text}");
|
|
60
60
|
* ```
|
|
61
61
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
62
|
+
* The model hears of each new request in the tool result. Current platform
|
|
63
|
+
* releases expand the step's text again when the list changes, so it shows at
|
|
64
|
+
* the next request. Earlier releases, and a realtime model, keep the list from
|
|
65
|
+
* the step's entry: return `refreshStep()` with the note there to show it at
|
|
66
|
+
* once.
|
|
65
67
|
*/
|
|
66
68
|
export declare class RequestList {
|
|
67
69
|
/** The `global_data` key the list is kept under. */
|
|
@@ -41,9 +41,11 @@ import { FunctionResult } from '../FunctionResult.js';
|
|
|
41
41
|
* ctx.addStep('take_order').setText("Take the caller's order.\n\n${global_data.later_text}");
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* The model hears of each new request in the tool result. Current platform
|
|
45
|
+
* releases expand the step's text again when the list changes, so it shows at
|
|
46
|
+
* the next request. Earlier releases, and a realtime model, keep the list from
|
|
47
|
+
* the step's entry: return `refreshStep()` with the note there to show it at
|
|
48
|
+
* once.
|
|
47
49
|
*/
|
|
48
50
|
export class RequestList {
|
|
49
51
|
/** The `global_data` key the list is kept under. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestList.js","sourceRoot":"","sources":["../../src/patterns/RequestList.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAsBtD
|
|
1
|
+
{"version":3,"file":"RequestList.js","sourceRoot":"","sources":["../../src/patterns/RequestList.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAsBtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,WAAW;IACtB,oDAAoD;IACpD,SAAS,CAAS;IAClB,sFAAsF;IACtF,OAAO,CAAS;IAChB,gDAAgD;IAChD,OAAO,CAAyB;IAChC,yCAAyC;IACzC,OAAO,CAAS;IAEhB;;;;OAIG;IACH,YAAY,SAAiB,EAAE,OAA2B,EAAE;QAC1D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,GAAG,SAAS,OAAO,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,6BAA6B,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,OAAmD;QACzD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YA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MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,2FAA2F;SAC5F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAEO,KAAK,CAAC,MAAsB,EAAE,QAAwB;QAC5D,OAAO,MAAM,CAAC,gBAAgB,CAAC;YAC7B,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ;YAC1B,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;SACtC,CAAC,CAAC;IACL,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
* are on, `say`, and the end of the call.
|
|
12
12
|
*
|
|
13
13
|
* It's an approximation of the platform, for testing your code's decisions. It
|
|
14
|
-
* doesn't run a model, DataMap tools (give a stub), gather questions,
|
|
15
|
-
* gates' decision model (give a
|
|
14
|
+
* doesn't run a model, DataMap tools (give a stub), gather questions,
|
|
15
|
+
* consolidation, the sliding window, or the gates' decision model (give a
|
|
16
|
+
* callback). {@link CallSimulator.modelView} shows what the model gets after
|
|
17
|
+
* the steps' history modes, and {@link CallSimulator.gateConversation} the
|
|
18
|
+
* dialogue a gate judges. It renders and runs tools on the
|
|
16
19
|
* agent itself: a dynamic config callback's per-request copy isn't made.
|
|
17
20
|
*
|
|
18
21
|
* {@link RequestRecorder} records real tool requests for
|
|
@@ -129,8 +132,9 @@ export declare class CallSimulator {
|
|
|
129
132
|
/** Every tool call so far. */
|
|
130
133
|
calls: SimulatedCall[];
|
|
131
134
|
/**
|
|
132
|
-
* The semantic gate marks set, by name: the
|
|
133
|
-
*
|
|
135
|
+
* The semantic gate marks set, by name: the call log position where the
|
|
136
|
+
* action list that set each began, so `callLog.slice(marks.get(name))` is
|
|
137
|
+
* since it.
|
|
134
138
|
*/
|
|
135
139
|
marks: Map<string, number>;
|
|
136
140
|
/** The current context, null without contexts. */
|
|
@@ -144,6 +148,20 @@ export declare class CallSimulator {
|
|
|
144
148
|
private readonly toggled;
|
|
145
149
|
private toolCalls;
|
|
146
150
|
private stepFunctions;
|
|
151
|
+
private readonly kinds;
|
|
152
|
+
private readonly hidden;
|
|
153
|
+
private readonly isolatedEntries;
|
|
154
|
+
private readonly cleared;
|
|
155
|
+
private readonly says;
|
|
156
|
+
private injectPending;
|
|
157
|
+
private callStart;
|
|
158
|
+
private enteredAt;
|
|
159
|
+
private deferred;
|
|
160
|
+
private instruction;
|
|
161
|
+
private readonly shown;
|
|
162
|
+
private proposalAt;
|
|
163
|
+
private actionStart;
|
|
164
|
+
private resetStep;
|
|
147
165
|
/**
|
|
148
166
|
* @param agent - The agent.
|
|
149
167
|
* @param opts - `callId`, `gates`, `stubs` and `globalData`.
|
|
@@ -156,7 +174,8 @@ export declare class CallSimulator {
|
|
|
156
174
|
*/
|
|
157
175
|
caller(text: string): this;
|
|
158
176
|
/**
|
|
159
|
-
* The agent says `text`, as the model's reply.
|
|
177
|
+
* The agent says `text`, as the model's reply. The actions of a
|
|
178
|
+
* `post_process` result waiting for it run after it.
|
|
160
179
|
* @param text - What it says.
|
|
161
180
|
* @returns This simulator, for chaining.
|
|
162
181
|
*/
|
|
@@ -177,7 +196,9 @@ export declare class CallSimulator {
|
|
|
177
196
|
* gets the platform's reply naming the tools it has. A gated tool runs only
|
|
178
197
|
* when every gate passes. Otherwise the tool runs as the `/swaig` route runs
|
|
179
198
|
* it, with a request like the platform's, and its result's actions change
|
|
180
|
-
* the call.
|
|
199
|
+
* the call. A result with `post_process` runs its actions after the model's
|
|
200
|
+
* reply to it, as the platform does: give the reply with {@link agentSays}. A
|
|
201
|
+
* newer such result replaces actions still waiting.
|
|
181
202
|
*
|
|
182
203
|
* @param name - The tool.
|
|
183
204
|
* @param args - Its arguments.
|
|
@@ -208,6 +229,7 @@ export declare class CallSimulator {
|
|
|
208
229
|
private navigate;
|
|
209
230
|
private request;
|
|
210
231
|
private apply;
|
|
232
|
+
private runActions;
|
|
211
233
|
private applyOne;
|
|
212
234
|
private enterContext;
|
|
213
235
|
private enterStep;
|
|
@@ -222,6 +244,94 @@ export declare class CallSimulator {
|
|
|
222
244
|
/** The platform's reply to a call of a tool it won't run now. */
|
|
223
245
|
private unavailable;
|
|
224
246
|
private log;
|
|
247
|
+
/**
|
|
248
|
+
* The current step's history mode: its own, its context's, or "default".
|
|
249
|
+
* @returns The mode.
|
|
250
|
+
*/
|
|
251
|
+
historyMode(): string;
|
|
252
|
+
/**
|
|
253
|
+
* The conversation entries the model gets now, oldest first, after the
|
|
254
|
+
* history modes of the steps entered so far.
|
|
255
|
+
*
|
|
256
|
+
* At each step's injection, the platform first restores what an isolate
|
|
257
|
+
* step hid, then applies the new step's mode to everything before it:
|
|
258
|
+
*
|
|
259
|
+
* - `keep`: nothing leaves.
|
|
260
|
+
* - `default`: earlier step instructions leave.
|
|
261
|
+
* - `hide`: earlier instructions, and every earlier spoken turn, tool call,
|
|
262
|
+
* tool result and system note, leave for the rest of the call.
|
|
263
|
+
* - `isolate`: as `hide`, until the call leaves the step.
|
|
264
|
+
* - `spoken`: earlier instructions, and every earlier tool call, tool result
|
|
265
|
+
* and system note, leave for the rest of the call; every spoken turn stays.
|
|
266
|
+
*
|
|
267
|
+
* `hide`, `isolate` and `spoken` keep the exchange that entered the step, as
|
|
268
|
+
* its start: the call whose action changed it, its result, notes and say,
|
|
269
|
+
* and caller words stored before the step was injected. For a `post_process`
|
|
270
|
+
* action's change, which runs after the model's reply, that's the call and
|
|
271
|
+
* everything stored from it on, the reply included. A change by `next_step`
|
|
272
|
+
* keeps nothing. After that they're ordinary entries, which each later
|
|
273
|
+
* step's mode treats like the rest.
|
|
274
|
+
*
|
|
275
|
+
* It's the view for the model's next request: a step entered by a `say` or
|
|
276
|
+
* another action outside a tool call is injected before it, as the platform
|
|
277
|
+
* injects a step before the next request. A result's `say` is the agent's
|
|
278
|
+
* turn after the call's result and notes: the platform holds it until the
|
|
279
|
+
* next caller or agent turn, past system entries such as a step's
|
|
280
|
+
* instructions, or to the end. The current step's instructions are its text
|
|
281
|
+
* expanded with the global data now, as the platform expands it again when a
|
|
282
|
+
* value it reads changes; `callLog` keeps the text as it went in. An end
|
|
283
|
+
* step keeps the text it went in with. An end step takes no pass: steps end
|
|
284
|
+
* there, so what an `isolate` step hid is back, and earlier instructions
|
|
285
|
+
* stay. The base prompt isn't included.
|
|
286
|
+
*
|
|
287
|
+
* @returns The entries, without their timestamps.
|
|
288
|
+
* @throws Error once the call has entered a step with a reset, which starts a
|
|
289
|
+
* new context or consolidates the conversation in place of the step's
|
|
290
|
+
* text: the simulation doesn't follow it.
|
|
291
|
+
*/
|
|
292
|
+
modelView(): Json[];
|
|
293
|
+
/**
|
|
294
|
+
* The dialogue a semantic gate judges now, as `"role: text"` lines, oldest
|
|
295
|
+
* first: the spoken turns the model sees ({@link modelView}), chosen as the
|
|
296
|
+
* platform chooses them.
|
|
297
|
+
*
|
|
298
|
+
* With the gate's `since` mark set, the turns from the agent's first turn at
|
|
299
|
+
* or after the mark. Otherwise, with `dialogue` "proposal" (the gate's, or
|
|
300
|
+
* the agent's `semantic_gate_dialogue`) and a proposal marked, the turns
|
|
301
|
+
* from the agent's first turn after `semantic_state` last changed. Otherwise
|
|
302
|
+
* the window. Then at most `history` of the newest (the gate's, the agent's
|
|
303
|
+
* `semantic_gate_history`, or 20).
|
|
304
|
+
*
|
|
305
|
+
* Give it to a gate callback: `gates: (gate, sim) =>
|
|
306
|
+
* judge(gate['question'], sim.gateConversation(gate))`.
|
|
307
|
+
*
|
|
308
|
+
* @param gate - The gate, as rendered; default none.
|
|
309
|
+
* @returns The lines.
|
|
310
|
+
* @throws Error once the call has entered a step with a reset, as for
|
|
311
|
+
* {@link modelView}.
|
|
312
|
+
*/
|
|
313
|
+
gateConversation(gate?: Json): string[];
|
|
314
|
+
/**
|
|
315
|
+
* Before a request to the model: inject the current step's instructions,
|
|
316
|
+
* applying its history mode to what came before, once a step change is
|
|
317
|
+
* pending; otherwise expand the current step's text again.
|
|
318
|
+
*/
|
|
319
|
+
private inject;
|
|
320
|
+
/**
|
|
321
|
+
* A semantic_state being set: `{}` leaves no proposal, and any other state
|
|
322
|
+
* that differs from the current one, compared as serialized as the engine
|
|
323
|
+
* compares it (so a reordered state is a change), starts one.
|
|
324
|
+
*/
|
|
325
|
+
private noteState;
|
|
326
|
+
/** The current step's history mode, applied to everything before its start. */
|
|
327
|
+
private historyPass;
|
|
328
|
+
/** Throw for a view the simulator can't give: after a reset step. */
|
|
329
|
+
private checkModelled;
|
|
330
|
+
/**
|
|
331
|
+
* The platform rewrites the step's instruction entry in place when its
|
|
332
|
+
* expansion changes; the call log keeps the text as it went in.
|
|
333
|
+
*/
|
|
334
|
+
private refresh;
|
|
225
335
|
}
|
|
226
336
|
/** Options for a {@link RequestRecorder}. */
|
|
227
337
|
export interface RequestRecorderOptions {
|