@signalwire/sdk 3.7.2 → 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 +201 -0
- package/README.md +1 -0
- package/dist/AgentBase.d.ts +107 -2
- package/dist/AgentBase.js +259 -13
- package/dist/AgentBase.js.map +1 -1
- package/dist/AiEvents.d.ts +70 -0
- package/dist/AiEvents.js +94 -0
- package/dist/AiEvents.js.map +1 -0
- package/dist/ContextBuilder.d.ts +215 -14
- package/dist/ContextBuilder.js +441 -14
- package/dist/ContextBuilder.js.map +1 -1
- package/dist/FunctionResult.d.ts +146 -1
- package/dist/FunctionResult.js +188 -2
- package/dist/FunctionResult.js.map +1 -1
- package/dist/PostPrompt.d.ts +19 -0
- package/dist/PostPrompt.js +43 -0
- package/dist/PostPrompt.js.map +1 -1
- package/dist/SWMLService.d.ts +97 -1
- package/dist/SWMLService.js +129 -2
- package/dist/SWMLService.js.map +1 -1
- package/dist/SemanticGate.d.ts +61 -1
- package/dist/SemanticGate.js +108 -15
- package/dist/SemanticGate.js.map +1 -1
- package/dist/SwaigFunction.d.ts +85 -9
- package/dist/SwaigFunction.js +214 -58
- package/dist/SwaigFunction.js.map +1 -1
- package/dist/ToolMiddleware.d.ts +82 -0
- package/dist/ToolMiddleware.js +131 -0
- package/dist/ToolMiddleware.js.map +1 -0
- package/dist/TypeInference.d.ts +1 -1
- package/dist/TypeInference.js.map +1 -1
- package/dist/cli/tsdocs/api-index.json +1 -1
- package/dist/cli/tsdocs/topics.js +24 -4
- package/dist/cli/tsdocs/topics.js.map +1 -1
- package/dist/index.d.ts +22 -8
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/llms.txt +1 -0
- package/dist/patterns/Proposal.d.ts +148 -0
- package/dist/patterns/Proposal.js +214 -0
- package/dist/patterns/Proposal.js.map +1 -0
- package/dist/patterns/RequestList.d.ts +138 -0
- package/dist/patterns/RequestList.js +171 -0
- package/dist/patterns/RequestList.js.map +1 -0
- package/dist/skills/SkillBase.d.ts +24 -1
- package/dist/skills/SkillBase.js +12 -1
- package/dist/skills/SkillBase.js.map +1 -1
- package/dist/speech/numbers.d.ts +66 -0
- package/dist/speech/numbers.js +281 -0
- package/dist/speech/numbers.js.map +1 -0
- package/dist/speech/spelling.d.ts +71 -0
- package/dist/speech/spelling.js +294 -0
- package/dist/speech/spelling.js.map +1 -0
- package/dist/testing/CallSimulator.d.ts +391 -0
- package/dist/testing/CallSimulator.js +966 -0
- package/dist/testing/CallSimulator.js.map +1 -0
- package/docs/agent-guide.md +2 -2
- package/docs/api-reference.md +279 -22
- package/docs/architecture.md +8 -4
- package/docs/cli-guide.md +2 -0
- package/docs/contexts-guide.md +75 -4
- package/docs/conversation_patterns.md +257 -0
- package/docs/mcp_integration.md +1 -1
- package/docs/pgi_agent_guide.md +5 -0
- package/docs/programmatically_governed_inference.md +2 -2
- package/docs/swaig-reference.md +98 -6
- package/package.json +1 -1
package/dist/ContextBuilder.d.ts
CHANGED
|
@@ -4,6 +4,31 @@
|
|
|
4
4
|
* Contexts contain ordered Steps, each with prompt text/POM sections,
|
|
5
5
|
* completion criteria, function restrictions, and navigation rules.
|
|
6
6
|
*/
|
|
7
|
+
/** The most digits an expected answer can name. */
|
|
8
|
+
export declare const MAX_EXPECTED_DIGITS = 64;
|
|
9
|
+
/**
|
|
10
|
+
* An `expected_answer` as the platform reads it: an exact count of digits, or
|
|
11
|
+
* a range. {@link expectedAnswer} builds one.
|
|
12
|
+
*/
|
|
13
|
+
export type ExpectedAnswer = {
|
|
14
|
+
digits: number;
|
|
15
|
+
} | {
|
|
16
|
+
min_digits: number;
|
|
17
|
+
max_digits: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* An `expected_answer` as the platform reads it: `{ digits: N }`, or
|
|
21
|
+
* `{ min_digits: a, max_digits: b }` with a at most b, each count from 1 to
|
|
22
|
+
* 64. The platform logs and ignores any other shape.
|
|
23
|
+
* @param digits - The exact number of digits.
|
|
24
|
+
* @param opts - Or, without `digits`, the fewest and most digits.
|
|
25
|
+
* @returns The expected answer.
|
|
26
|
+
* @throws {Error} For a shape or count the platform would ignore.
|
|
27
|
+
*/
|
|
28
|
+
export declare function expectedAnswer(digits?: number, opts?: {
|
|
29
|
+
minDigits?: number;
|
|
30
|
+
maxDigits?: number;
|
|
31
|
+
}): ExpectedAnswer;
|
|
7
32
|
/**
|
|
8
33
|
* Valid values for a step's or context's `history` visibility mode.
|
|
9
34
|
*
|
|
@@ -17,8 +42,12 @@
|
|
|
17
42
|
* - `isolate`: like `hide`, but only while the agent is in this step: the
|
|
18
43
|
* earlier dialogue returns when the step is left, and the earlier step
|
|
19
44
|
* instructions stay cleared.
|
|
45
|
+
* - `spoken`: prior instructions hidden, and every earlier tool call, tool
|
|
46
|
+
* result and turn-scoped system note (tool prompts and the like) pulled out
|
|
47
|
+
* for the rest of the call; every spoken turn, the caller's and the
|
|
48
|
+
* agent's, stays.
|
|
20
49
|
*/
|
|
21
|
-
export declare const HISTORY_MODES: readonly ["keep", "default", "hide", "isolate"];
|
|
50
|
+
export declare const HISTORY_MODES: readonly ["keep", "default", "hide", "isolate", "spoken"];
|
|
22
51
|
/** One of the valid `history` visibility modes. */
|
|
23
52
|
export type HistoryMode = (typeof HISTORY_MODES)[number];
|
|
24
53
|
/**
|
|
@@ -73,6 +102,8 @@ export interface StepDict {
|
|
|
73
102
|
skip_to_next_step?: boolean;
|
|
74
103
|
/** Optional history visibility mode; present only when explicitly set. */
|
|
75
104
|
history?: HistoryMode;
|
|
105
|
+
/** Optional number of digits the caller's answer has, for the recognizer. */
|
|
106
|
+
expected_answer?: ExpectedAnswer;
|
|
76
107
|
/** Optional prompt-reset directives for this step. */
|
|
77
108
|
reset?: {
|
|
78
109
|
system_prompt?: string;
|
|
@@ -138,9 +169,15 @@ export declare class GatherQuestion {
|
|
|
138
169
|
* unset — it is emitted to SWML so it can override an isolated gather.
|
|
139
170
|
*/
|
|
140
171
|
isolated?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* The number of digits the answer has, for the recognizer: while this
|
|
174
|
+
* question is asked, it replaces the step's expected answer.
|
|
175
|
+
*/
|
|
176
|
+
expectedAnswer?: ExpectedAnswer;
|
|
141
177
|
/**
|
|
142
178
|
* Creates a new GatherQuestion.
|
|
143
|
-
* @param opts - Question configuration including key, question text, and optional type/confirm/prompt/functions/isolated.
|
|
179
|
+
* @param opts - Question configuration including key, question text, and optional type/confirm/prompt/functions/isolated/expectedAnswer.
|
|
180
|
+
* @throws {Error} For an `expectedAnswer` the platform would ignore.
|
|
144
181
|
*/
|
|
145
182
|
constructor(opts: {
|
|
146
183
|
key: string;
|
|
@@ -150,6 +187,7 @@ export declare class GatherQuestion {
|
|
|
150
187
|
prompt?: string;
|
|
151
188
|
functions?: string[];
|
|
152
189
|
isolated?: boolean;
|
|
190
|
+
expectedAnswer?: ExpectedAnswer;
|
|
153
191
|
});
|
|
154
192
|
/**
|
|
155
193
|
* Serializes this question to a plain object for SWML output.
|
|
@@ -192,6 +230,7 @@ export declare class GatherInfo {
|
|
|
192
230
|
prompt?: string;
|
|
193
231
|
functions?: string[];
|
|
194
232
|
isolated?: boolean;
|
|
233
|
+
expectedAnswer?: ExpectedAnswer;
|
|
195
234
|
}): this;
|
|
196
235
|
/**
|
|
197
236
|
* Returns all questions in this gather operation.
|
|
@@ -230,6 +269,8 @@ export declare class Step {
|
|
|
230
269
|
private text;
|
|
231
270
|
private stepCriteria;
|
|
232
271
|
private functions;
|
|
272
|
+
/** The recognizer's hint for a number the caller is asked for. */
|
|
273
|
+
private _expectedAnswer;
|
|
233
274
|
private validSteps;
|
|
234
275
|
private validContexts;
|
|
235
276
|
private sections;
|
|
@@ -249,6 +290,13 @@ export declare class Step {
|
|
|
249
290
|
constructor(name: string);
|
|
250
291
|
/**
|
|
251
292
|
* Sets raw text content for this step, mutually exclusive with POM sections.
|
|
293
|
+
*
|
|
294
|
+
* The platform expands its variables, such as `${global_data.order_total}`,
|
|
295
|
+
* when the step is entered, and current releases expand it again before a
|
|
296
|
+
* request whenever a value it reads has changed. Earlier releases, and a
|
|
297
|
+
* realtime model, keep the values from entry: there, return
|
|
298
|
+
* `FunctionResult.refreshStep(name)` after a later `updateGlobalData()` to
|
|
299
|
+
* enter the step again with the new values.
|
|
252
300
|
* @param text - The raw prompt text.
|
|
253
301
|
* @returns This step for chaining.
|
|
254
302
|
*/
|
|
@@ -402,6 +450,13 @@ export declare class Step {
|
|
|
402
450
|
prompt?: string;
|
|
403
451
|
functions?: string[];
|
|
404
452
|
isolated?: boolean;
|
|
453
|
+
/**
|
|
454
|
+
* The number of digits the answer has, for the recognizer, as
|
|
455
|
+
* {@link expectedAnswer} builds it: `{ digits: 5 }` or
|
|
456
|
+
* `{ min_digits: 4, max_digits: 6 }`. While this question is asked, it
|
|
457
|
+
* replaces the step's.
|
|
458
|
+
*/
|
|
459
|
+
expectedAnswer?: ExpectedAnswer;
|
|
405
460
|
}): this;
|
|
406
461
|
/**
|
|
407
462
|
* Returns the gather info for this step, if any.
|
|
@@ -418,6 +473,47 @@ export declare class Step {
|
|
|
418
473
|
* @internal
|
|
419
474
|
*/
|
|
420
475
|
getStepValidContexts(): string[] | null;
|
|
476
|
+
/**
|
|
477
|
+
* Tell the recognizer how many digits the caller's answer in this step has,
|
|
478
|
+
* such as a ZIP code or a PIN.
|
|
479
|
+
*
|
|
480
|
+
* The recognizer ends its wait for a number once the caller has said that
|
|
481
|
+
* many digits. A gather question's own expected answer replaces this while
|
|
482
|
+
* that question is asked. Pass `digits` for an exact count, or `minDigits`
|
|
483
|
+
* and `maxDigits` for a range, each from 1 to 64. Sent as `expected_answer`;
|
|
484
|
+
* it needs a platform release that has it.
|
|
485
|
+
* @param digits - The exact number of digits.
|
|
486
|
+
* @param opts - Or, without `digits`, the fewest and most digits.
|
|
487
|
+
* @returns This step for chaining.
|
|
488
|
+
* @throws {Error} For a count or combination the platform would ignore.
|
|
489
|
+
*/
|
|
490
|
+
setExpectedAnswer(digits?: number, opts?: {
|
|
491
|
+
minDigits?: number;
|
|
492
|
+
maxDigits?: number;
|
|
493
|
+
}): this;
|
|
494
|
+
/**
|
|
495
|
+
* Whether this step sets its own function list (an array or a string
|
|
496
|
+
* sentinel such as `'none'`), rather than keeping the one before it.
|
|
497
|
+
* @internal
|
|
498
|
+
*/
|
|
499
|
+
_hasFunctionList(): boolean;
|
|
500
|
+
/**
|
|
501
|
+
* The step's own function list: null when it inherits the list before it,
|
|
502
|
+
* empty for `'none'`.
|
|
503
|
+
* @internal
|
|
504
|
+
*/
|
|
505
|
+
_offeredFunctions(): string[] | null;
|
|
506
|
+
/**
|
|
507
|
+
* Whether the step has a reset, which makes it terminal.
|
|
508
|
+
* @internal
|
|
509
|
+
*/
|
|
510
|
+
_hasReset(): boolean;
|
|
511
|
+
/**
|
|
512
|
+
* What the model reads in this step, as `[where, text, tools also offered
|
|
513
|
+
* there]`: its text, its criteria, and its gather questions.
|
|
514
|
+
* @internal
|
|
515
|
+
*/
|
|
516
|
+
_modelTexts(): Array<[string, string, string[]]>;
|
|
421
517
|
/**
|
|
422
518
|
* Returns this step's function whitelist as an array of tool NAMES to
|
|
423
519
|
* validate, or null when there is nothing to validate. A string value
|
|
@@ -432,25 +528,42 @@ export declare class Step {
|
|
|
432
528
|
*/
|
|
433
529
|
clearSections(): this;
|
|
434
530
|
/**
|
|
435
|
-
*
|
|
531
|
+
* Set the system prompt this step's reset loads.
|
|
532
|
+
*
|
|
533
|
+
* A step with any reset setting is terminal: when the call enters it, the
|
|
534
|
+
* platform runs the reset in place of the step's text, and step mode ends
|
|
535
|
+
* there. Use it for a step that hands the call over to a new prompt.
|
|
436
536
|
* @param systemPrompt - The replacement system prompt text.
|
|
437
537
|
* @returns This step for chaining.
|
|
438
538
|
*/
|
|
439
539
|
setResetSystemPrompt(systemPrompt: string): this;
|
|
440
540
|
/**
|
|
441
|
-
*
|
|
541
|
+
* Set the user message this step's reset adds.
|
|
542
|
+
*
|
|
543
|
+
* A step with any reset setting is terminal: when the call enters it, the
|
|
544
|
+
* platform runs the reset in place of the step's text, and step mode ends
|
|
545
|
+
* there. Use it for a step that hands the call over to a new prompt.
|
|
442
546
|
* @param userPrompt - The replacement user prompt text.
|
|
443
547
|
* @returns This step for chaining.
|
|
444
548
|
*/
|
|
445
549
|
setResetUserPrompt(userPrompt: string): this;
|
|
446
550
|
/**
|
|
447
|
-
*
|
|
551
|
+
* Set whether this step's reset consolidates the conversation into a summary.
|
|
552
|
+
*
|
|
553
|
+
* A step with any reset setting is terminal: when the call enters it, the
|
|
554
|
+
* platform runs the reset in place of the step's text, and step mode ends
|
|
555
|
+
* there. Use it for a step that hands the call over to a new prompt.
|
|
448
556
|
* @param consolidate - Whether to consolidate.
|
|
449
557
|
* @returns This step for chaining.
|
|
450
558
|
*/
|
|
451
559
|
setResetConsolidate(consolidate: boolean): this;
|
|
452
560
|
/**
|
|
453
|
-
*
|
|
561
|
+
* Set whether this step's reset replaces the system prompt, seeded with the
|
|
562
|
+
* consolidated summary, rather than adding to it.
|
|
563
|
+
*
|
|
564
|
+
* A step with any reset setting is terminal: when the call enters it, the
|
|
565
|
+
* platform runs the reset in place of the step's text, and step mode ends
|
|
566
|
+
* there. Use it for a step that hands the call over to a new prompt.
|
|
454
567
|
* @param fullReset - Whether to fully reset.
|
|
455
568
|
* @returns This step for chaining.
|
|
456
569
|
*/
|
|
@@ -458,9 +571,16 @@ export declare class Step {
|
|
|
458
571
|
/**
|
|
459
572
|
* Control what the model still sees when this step is entered.
|
|
460
573
|
*
|
|
461
|
-
* The mode applies
|
|
462
|
-
*
|
|
463
|
-
*
|
|
574
|
+
* The mode applies when the step's instructions are injected, before the
|
|
575
|
+
* next request to the model, and governs everything before it. The exchange
|
|
576
|
+
* that entered the step stays under `"hide"`, `"isolate"` and `"spoken"`, as
|
|
577
|
+
* the step's start: the call whose action changed the step, its result,
|
|
578
|
+
* notes and say. A post_process action's change, which runs after the
|
|
579
|
+
* model's reply, keeps its call and everything stored from it on, the reply
|
|
580
|
+
* included. A change by next_step keeps nothing. Platform releases before
|
|
581
|
+
* this keep nothing under `"hide"` and `"isolate"`. An end step, or one with
|
|
582
|
+
* a reset, takes no history pass. The mode doesn't affect this step's own turns, which
|
|
583
|
+
* accumulate fresh. Nothing is deleted from the call log.
|
|
464
584
|
*
|
|
465
585
|
* @param history - One of:
|
|
466
586
|
* - `"keep"`: clear nothing. Every prior step's instructions and
|
|
@@ -478,6 +598,16 @@ export declare class Step {
|
|
|
478
598
|
* hid stays hidden. Entering the step again isolates it again. Use it
|
|
479
599
|
* for a step that must see nothing else, such as one that reads back a
|
|
480
600
|
* confirmation. A platform without isolate treats it as `"default"`.
|
|
601
|
+
* - `"spoken"`: keep the conversation, drop the work. Earlier step
|
|
602
|
+
* instructions are cleared, and every earlier tool call, tool result and
|
|
603
|
+
* turn-scoped system note (tool prompts, ai-msg injections, a gather's
|
|
604
|
+
* preamble) leaves the model's context for the rest of the call. Every
|
|
605
|
+
* spoken turn stays: the caller's, the agent's replies and `say`
|
|
606
|
+
* actions. An assistant turn that spoke and called a tool keeps its
|
|
607
|
+
* words. Use it at a stage boundary where the caller's earlier requests
|
|
608
|
+
* must stay but the finished stage's tool results shouldn't. A platform
|
|
609
|
+
* without spoken treats it as `"default"`, which keeps the tool
|
|
610
|
+
* exchanges.
|
|
481
611
|
* @returns This step for chaining.
|
|
482
612
|
* @throws {Error} If `history` is not one of these modes.
|
|
483
613
|
*/
|
|
@@ -608,8 +738,9 @@ export declare class Context {
|
|
|
608
738
|
* Mark this context as isolated — entering it wipes conversation history.
|
|
609
739
|
*
|
|
610
740
|
* When `isolated=true` and the context is entered via change_context, the
|
|
611
|
-
* runtime
|
|
612
|
-
* the
|
|
741
|
+
* runtime calls ai_conversation_restart(), which drops every conversation
|
|
742
|
+
* entry but the first, the base system prompt. The model starts fresh with
|
|
743
|
+
* the base prompt and the new context's step instructions, with no memory of
|
|
613
744
|
* prior turns.
|
|
614
745
|
*
|
|
615
746
|
* EXCEPTION — `reset` overrides the wipe:
|
|
@@ -695,7 +826,8 @@ export declare class Context {
|
|
|
695
826
|
* A step's own `setHistory()` overrides this. See {@link Step.setHistory}
|
|
696
827
|
* for what each mode does.
|
|
697
828
|
*
|
|
698
|
-
* @param history - One of `"keep"`, `"default"`, `"hide"`,
|
|
829
|
+
* @param history - One of `"keep"`, `"default"`, `"hide"`, `"isolate"`, or
|
|
830
|
+
* `"spoken"`.
|
|
699
831
|
* @returns This context for chaining.
|
|
700
832
|
* @throws {Error} If `history` is not one of these modes.
|
|
701
833
|
*/
|
|
@@ -710,6 +842,17 @@ export declare class Context {
|
|
|
710
842
|
getValidContexts(): string[] | null;
|
|
711
843
|
private renderPrompt;
|
|
712
844
|
private renderSystemPrompt;
|
|
845
|
+
/**
|
|
846
|
+
* The context's prompt, which goes before every step's text.
|
|
847
|
+
* @internal
|
|
848
|
+
*/
|
|
849
|
+
_modelPrompt(): string | null;
|
|
850
|
+
/**
|
|
851
|
+
* The reset settings that do nothing because the context has no system
|
|
852
|
+
* prompt: the platform runs a context's reset only with one.
|
|
853
|
+
* @internal
|
|
854
|
+
*/
|
|
855
|
+
_inertResetSettings(): string[];
|
|
713
856
|
private renderSections;
|
|
714
857
|
/**
|
|
715
858
|
* Serializes this context and all its steps to a plain object for SWML output.
|
|
@@ -739,8 +882,8 @@ export declare class Context {
|
|
|
739
882
|
* - `next_step(step: enum)` — present when validSteps is set
|
|
740
883
|
* - `change_context(context: enum)` — present when validContexts is set
|
|
741
884
|
*
|
|
742
|
-
* Their `enum` schemas are rewritten
|
|
743
|
-
* validSteps / validContexts apply to
|
|
885
|
+
* Their `enum` schemas are rewritten when a step loads, to match whatever
|
|
886
|
+
* validSteps / validContexts apply to that step. You do NOT need
|
|
744
887
|
* to define these tools yourself; they appear automatically.
|
|
745
888
|
*
|
|
746
889
|
* A third native tool — `gather_submit` — is injected during gather_info
|
|
@@ -800,6 +943,12 @@ export declare class Context {
|
|
|
800
943
|
export declare class ContextBuilder {
|
|
801
944
|
private contexts;
|
|
802
945
|
private contextOrder;
|
|
946
|
+
/**
|
|
947
|
+
* Tools already reported as offered by no step, so a render on every request
|
|
948
|
+
* doesn't repeat it. The agent shares its own set, so its per-request copies
|
|
949
|
+
* don't repeat it either.
|
|
950
|
+
*/
|
|
951
|
+
private unofferedWarned;
|
|
803
952
|
private agent;
|
|
804
953
|
/**
|
|
805
954
|
* Attach an agent reference so validate() can check user tool names
|
|
@@ -808,6 +957,12 @@ export declare class ContextBuilder {
|
|
|
808
957
|
* @internal
|
|
809
958
|
*/
|
|
810
959
|
attachAgent(agent: unknown): this;
|
|
960
|
+
/**
|
|
961
|
+
* Record the tools reported as offered by no step in `warned`, a set the
|
|
962
|
+
* agent keeps for itself and its per-request copies.
|
|
963
|
+
* @internal
|
|
964
|
+
*/
|
|
965
|
+
_shareUnofferedWarnings(warned: Set<string>): this;
|
|
811
966
|
/**
|
|
812
967
|
* Removes all contexts, returning the builder to its initial state.
|
|
813
968
|
* Use this in a dynamic config callback when you need to rebuild
|
|
@@ -836,6 +991,40 @@ export declare class ContextBuilder {
|
|
|
836
991
|
* @throws Error if validation fails.
|
|
837
992
|
*/
|
|
838
993
|
validate(): void;
|
|
994
|
+
/**
|
|
995
|
+
* The steps whose function list offers `functionName`, as
|
|
996
|
+
* `[context, step]` pairs in order, including a gather question's functions.
|
|
997
|
+
*
|
|
998
|
+
* A step without `setFunctions()` keeps whatever was active before it, so it
|
|
999
|
+
* isn't counted: what it offers depends on the step the call came from. The
|
|
1000
|
+
* platform's reply to a call of a tool the current step doesn't offer names
|
|
1001
|
+
* the same steps.
|
|
1002
|
+
* @param functionName - The function's name.
|
|
1003
|
+
* @returns The `[context name, step name]` pairs, empty when no step lists it.
|
|
1004
|
+
*/
|
|
1005
|
+
stepsOffering(functionName: string): Array<[string, string]>;
|
|
1006
|
+
/**
|
|
1007
|
+
* Log, once each, reset settings that don't do what they read as: a step
|
|
1008
|
+
* with a reset is terminal, so its text never runs; and a context's
|
|
1009
|
+
* consolidate, full_reset and user_prompt act only with a system prompt,
|
|
1010
|
+
* whose presence runs the context's reset.
|
|
1011
|
+
*/
|
|
1012
|
+
private warnInertResets;
|
|
1013
|
+
/**
|
|
1014
|
+
* Log, once each, a registered tool named where the step doesn't offer it:
|
|
1015
|
+
* in its text, its criteria, its context's prompt (which goes before every
|
|
1016
|
+
* step's text), a gather question, or a gate's output on one of its tools.
|
|
1017
|
+
* The model reads the name and may call a tool it doesn't have. A step
|
|
1018
|
+
* without a function list is skipped: what it offers depends on the step
|
|
1019
|
+
* before it.
|
|
1020
|
+
*/
|
|
1021
|
+
private warnToolMentions;
|
|
1022
|
+
/**
|
|
1023
|
+
* Log, once per tool, a tool no step can offer: when every step lists its
|
|
1024
|
+
* functions and none lists it, the model never gets it, unless a function
|
|
1025
|
+
* result turns it on.
|
|
1026
|
+
*/
|
|
1027
|
+
private warnUnofferedTools;
|
|
839
1028
|
/**
|
|
840
1029
|
* Validates and serializes all contexts to a plain object for SWML output.
|
|
841
1030
|
* @returns A dictionary mapping context names to their serialized representations.
|
|
@@ -853,4 +1042,16 @@ export declare class ContextBuilder {
|
|
|
853
1042
|
* @returns A new Context instance.
|
|
854
1043
|
*/
|
|
855
1044
|
export declare function createSimpleContext(name?: string): Context;
|
|
1045
|
+
/**
|
|
1046
|
+
* The tool names `text` names.
|
|
1047
|
+
*
|
|
1048
|
+
* A name with an underscore, such as `place_order`, counts as a whole word
|
|
1049
|
+
* anywhere. A one-word name, such as `help`, counts only in backticks or before
|
|
1050
|
+
* "(", since it's also an ordinary word.
|
|
1051
|
+
*
|
|
1052
|
+
* @param text - The text: a step's, a prompt's or a tool result's.
|
|
1053
|
+
* @param tools - The tool names to look for.
|
|
1054
|
+
* @returns The names it finds.
|
|
1055
|
+
*/
|
|
1056
|
+
export declare function namedTools(text: string | null | undefined, tools: Iterable<string>): Set<string>;
|
|
856
1057
|
export {};
|