@falai/agent 4.0.0-alpha.20 → 4.0.0-alpha.21
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/dist/cjs/core/Runner.d.ts +8 -3
- package/dist/cjs/core/Runner.d.ts.map +1 -1
- package/dist/cjs/core/Runner.js +40 -15
- package/dist/cjs/core/Runner.js.map +1 -1
- package/dist/cjs/core/Speak.d.ts.map +1 -1
- package/dist/cjs/core/Speak.js +11 -3
- package/dist/cjs/core/Speak.js.map +1 -1
- package/dist/cjs/core/Understand.d.ts +2 -0
- package/dist/cjs/core/Understand.d.ts.map +1 -1
- package/dist/cjs/core/Understand.js +12 -4
- package/dist/cjs/core/Understand.js.map +1 -1
- package/dist/cjs/core/contracts.d.ts +10 -0
- package/dist/cjs/core/contracts.d.ts.map +1 -1
- package/dist/cjs/types/flow.d.ts +4 -3
- package/dist/cjs/types/flow.d.ts.map +1 -1
- package/dist/core/Runner.d.ts +8 -3
- package/dist/core/Runner.d.ts.map +1 -1
- package/dist/core/Runner.js +40 -15
- package/dist/core/Runner.js.map +1 -1
- package/dist/core/Speak.d.ts.map +1 -1
- package/dist/core/Speak.js +11 -3
- package/dist/core/Speak.js.map +1 -1
- package/dist/core/Understand.d.ts +2 -0
- package/dist/core/Understand.d.ts.map +1 -1
- package/dist/core/Understand.js +12 -4
- package/dist/core/Understand.js.map +1 -1
- package/dist/core/contracts.d.ts +10 -0
- package/dist/core/contracts.d.ts.map +1 -1
- package/dist/types/flow.d.ts +4 -3
- package/dist/types/flow.d.ts.map +1 -1
- package/docs/concepts/collection.md +1 -1
- package/docs/concepts/pipeline.md +1 -0
- package/docs/reference/outcomes.md +1 -1
- package/docs/reference/step.md +3 -2
- package/package.json +2 -2
- package/src/core/Runner.ts +40 -14
- package/src/core/Speak.ts +12 -3
- package/src/core/Understand.ts +18 -5
- package/src/core/contracts.ts +10 -0
- package/src/types/flow.ts +4 -3
package/dist/core/contracts.d.ts
CHANGED
|
@@ -50,6 +50,11 @@ export interface Understanding {
|
|
|
50
50
|
branches: Record<string, boolean>;
|
|
51
51
|
/** field → raw value the lead gave, or nothing. */
|
|
52
52
|
fields: Record<string, unknown>;
|
|
53
|
+
/**
|
|
54
|
+
* The lead's message asks something a reply must answer. Judged only while a flow has a fixed
|
|
55
|
+
* `question`: one that would go out now waits for the answer when this is not `false`.
|
|
56
|
+
*/
|
|
57
|
+
asks?: boolean;
|
|
53
58
|
llmCalls: number;
|
|
54
59
|
usage?: TokenUsage;
|
|
55
60
|
}
|
|
@@ -60,6 +65,11 @@ export interface TalkRequest<C = unknown, D = unknown> {
|
|
|
60
65
|
step: StepBase<D> & TalkStep<C, D>;
|
|
61
66
|
/** `step.collect` minus known minus at `maxAsks`, in order. */
|
|
62
67
|
pending: string[];
|
|
68
|
+
/**
|
|
69
|
+
* The step's fixed question, rendered. It goes out word for word right after this reply, so the
|
|
70
|
+
* reply only answers what the lead asked: it asks nothing and reads no field.
|
|
71
|
+
*/
|
|
72
|
+
fixedAfter?: string;
|
|
63
73
|
}
|
|
64
74
|
/** No run holds the floor; the idle speaker answers. */
|
|
65
75
|
export interface IdleRequest<C = unknown, D = unknown> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/core/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAA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AAE,CAAC;CACrB;AAED,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,eAAe,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mGAAmG;AACnG,MAAM,MAAM,YAAY,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAE7G,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC"}
|
package/dist/types/flow.d.ts
CHANGED
|
@@ -181,9 +181,10 @@ export type TalkStep<C = unknown, D = unknown> = ({
|
|
|
181
181
|
/** Per-flow wording for a field; the field's own `ask` is the default. */
|
|
182
182
|
ask?: Partial<Record<keyof D & string, string>>;
|
|
183
183
|
/**
|
|
184
|
-
* A fixed first question, sent word for word
|
|
185
|
-
*
|
|
186
|
-
*
|
|
184
|
+
* A fixed first question, sent word for word when the step first asks: every
|
|
185
|
+
* field it collects is still unknown and none was asked yet. No model call,
|
|
186
|
+
* unless the customer's message asks something: then the step answers first
|
|
187
|
+
* and the question follows. Any later ask is the AI's own wording. Needs `collect`.
|
|
187
188
|
*/
|
|
188
189
|
question?: Template;
|
|
189
190
|
/** Times a field may be asked before it is skipped. Default 3. */
|
package/dist/types/flow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../src/types/flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAIxC,qDAAqD;AACrD,MAAM,MAAM,QAAQ,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;AAE3D,qEAAqE;AACrE,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEhE;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;;GAGG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,GAAG,OAAO,IACxB,MAAM,GACN;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAIxC,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAErE,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAC1D,IAAI,EAAE,CAAC,CAAC;IACR,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CACrC;AAED,yDAAyD;AACzD,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAC/E,mGAAmG;IACnG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CAAC,CAAC,CAAC,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;IACT,6EAA6E;IAC7E,GAAG,EAAE,MAAM,CAAC;IACZ,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,IAAI,CAAC;IACV,mDAAmD;IACnD,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,SAAS,CAAC;IACtB,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC5E;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE/E,oEAAoE;AACpE,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,OAAO;IACnC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACnC,sEAAsE;IACtE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;CACtB;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -78,7 +78,7 @@ export { agenda };
|
|
|
78
78
|
|
|
79
79
|
No step asks for `orcamento`. It is still on the flow's list, so when the customer mentions a budget while this flow holds the conversation, the value is noted. A field on the list that only an answer can fill (`extract: 'asked'`, every boolean by default) and that no step asks can never be filled; `validateFlow` warns about it.
|
|
80
80
|
|
|
81
|
-
Step one asks with fixed text: `question`. Its first ask goes out word for word, with no model call. It goes out only when every field the step collects is still missing. If the customer's first message already gave the name, the step is skipped. A later ask is the model's own wording, so a customer who replies with a question gets an answer.
|
|
81
|
+
Step one asks with fixed text: `question`. Its first ask goes out word for word, with no model call. It goes out only when every field the step collects is still missing. If the customer's first message already gave the name, the step is skipped. If that message asks something instead, the model answers it first and the question follows, word for word. A later ask is the model's own wording, so a customer who replies with a question gets an answer.
|
|
82
82
|
|
|
83
83
|
## Known and pending
|
|
84
84
|
|
|
@@ -147,6 +147,7 @@ Every row but the last is asserted by a scenario in `tests/scenarios/`; the comp
|
|
|
147
147
|
| Each tool round | +1 | one more speak call | S8, S9 |
|
|
148
148
|
| A wake or start that reaches a talk step | 1 | speak only; there is no message to understand | S2, S5, S12 |
|
|
149
149
|
| A step's first ask with a fixed `question` | 0 | the text goes out as written | S14 |
|
|
150
|
+
| The same, when the customer's message asks something | 1 | the answer, then the text as written | S14 |
|
|
150
151
|
| A wake or start that runs only `do`, `wait` and `if` steps | 0 | code only | S5 (the start; its defer test covers the wake) |
|
|
151
152
|
| Any input under `silenced` (a plain reason) | 0 | `do` steps run, nobody speaks; `{ reason, understand: true }` still spends the understand call | S2, S12 |
|
|
152
153
|
| A message with `idle: 'silent'` and no eligible flow | 0 | nothing to judge, nobody speaks | S9 |
|
|
@@ -134,7 +134,7 @@ Grouped by what produced it. `kind` and `status` are given as `kind / status`. A
|
|
|
134
134
|
|---|---|---|---|
|
|
135
135
|
| `prompt` or `collect / ok` | none; `llmCalls` set | The speak call answered. The run is asking if fields are still pending, else it moved. | none. This line never carries `next`, even when the run moves on; the lines that follow show where it went |
|
|
136
136
|
| `collect / skipped` | `already-known` | The step was entered and every field it collects was already known (or at `maxAsks`). No call. | `then` |
|
|
137
|
-
| `collect / ok` | `asked-fixed` | The step's `question` went out word for word as its first ask. No call; the run is asking. | |
|
|
137
|
+
| `collect / ok` | `asked-fixed` | The step's `question` went out word for word as its first ask. No call, unless the customer asked something and the step answered first; the run is asking. | |
|
|
138
138
|
| `collect / ok` | none, no `llmCalls` | An asking step whose remaining fields were all known when the customer's next message resumed it: the understand call filled them in from the message, or an action's `ctx.set()` or a tool's `data` had written them since the step last asked. It moved without speaking. | `then` |
|
|
139
139
|
| `collect / skipped` | `max-asks`, `detail` = the field slug | One line per field still unknown when the step moves on because that field reached `maxAsks` (default 3). | |
|
|
140
140
|
| `prompt` or `collect / ok` | `branch` | A branch of the asking step fired: an `if` branch held, or the model answered `when` with true. | the branch's `then` |
|
package/docs/reference/step.md
CHANGED
|
@@ -57,7 +57,7 @@ type TalkStep<C, D> = ({ prompt: Template; collect?: (keyof D & string)[] } | {
|
|
|
57
57
|
| `prompt` | `Template` | "Collect what is still missing below, in the flow of the conversation, one or two things per message." | The guideline for the reply. Required when there is no `collect`. |
|
|
58
58
|
| `collect` | `(keyof D & string)[]` | none | Fields to ask for now, in this order. The step is done when they are known. The flow's own `collect` lists everything it needs; see [Flow](flow.md). |
|
|
59
59
|
| `ask` | `Partial<Record<slug, string>>` | the field's own `ask` | Per-flow wording for a field. |
|
|
60
|
-
| `question` | `Template` | none | A fixed first question, sent word for word
|
|
60
|
+
| `question` | `Template` | none | A fixed first question, sent word for word. No model call unless the customer's message asks something, which is answered first. Needs `collect`. |
|
|
61
61
|
| `maxAsks` | `number` | `3` | Times a field may be asked before it is skipped (`code: 'max-asks'`, the field in `detail`). |
|
|
62
62
|
| `branches` | `Branch<C, D>[]` | none | Exits judged while the step asks. See [Branches](branches.md). |
|
|
63
63
|
| `tools` | `string[]` | the flow's `tools`, else all | Tools the model may call from this step. |
|
|
@@ -66,7 +66,8 @@ type TalkStep<C, D> = ({ prompt: Template; collect?: (keyof D & string)[] } | {
|
|
|
66
66
|
- Pending fields are `collect` minus the known ones minus those at `maxAsks`, in `collect` order. A step the run enters whose pending list is empty is skipped with no model call (`code: 'already-known'`) and the run follows `then`. When the asking run resumes and the message filled the last field, the same move is logged `ok` with no detail.
|
|
67
67
|
- Reaching a talk step suspends any other run that was asking; this run becomes the asker and holds the floor. It speaks in this turn if the speak call has not happened yet; otherwise it speaks on the next message.
|
|
68
68
|
- The speak call returns the message plus one value per pending field. Values are validated and written; each field still pending is counted as asked once more. With pending fields left the run stays asking. With none left, or with no `collect` at all, the run follows `then` in the same turn.
|
|
69
|
-
- With `question`, the step's first ask is that text, as a `kind: 'verbatim'` message
|
|
69
|
+
- With `question`, the step's first ask is that text, as a `kind: 'verbatim'` message (`code: 'asked-fixed'`). It goes out only when every field in `collect` is still pending and none was asked yet, and never on a run that stays (`onEnd: 'stay'`). Reached after this turn's speak call, it goes out in the same turn, the way a `say` does. It counts as one ask of each field.
|
|
70
|
+
- When the customer's message asks something ("quanto tá o 13?"), the question waits for the answer: the step speaks first, answering with its flow's instructions and tools and asking nothing, and the question goes out word for word right after it. The understand call judges whether the message asks something (`asks`), and only while some flow has a fixed question. A message that only answers or greets gets the question with no speak call. An unjudged message, or the retry of a failed answer, counts as asking. Every later ask is the model's own wording, so a customer who asks something back gets an answer; `maxAsks` still applies. A `{ step, clear }` that clears the step's fields also clears their ask count, so the question goes out again.
|
|
70
71
|
- With `silenced` set, a talk step ends the run with `code: 'silenced'` (`detail` = your reason); a run that was already asking stays asking instead.
|
|
71
72
|
- Outcome kind: `collect` when `collect` is non-empty, else `prompt`.
|
|
72
73
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@falai/agent",
|
|
3
3
|
"packageManager": "bun@1.4.2",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.21",
|
|
5
5
|
"description": "Conversational state engine for TypeScript where the AI understands, but the code is in control",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/cjs/index.js",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"typescript-eslint": "^8.18.2"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@providerkit/core": "^0.
|
|
100
|
+
"@providerkit/core": "^0.13.2",
|
|
101
101
|
"loglevel": "^1.9.2"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
package/src/core/Runner.ts
CHANGED
|
@@ -87,6 +87,8 @@ export interface Turn<C = unknown, D = unknown> {
|
|
|
87
87
|
/** A short `wait` waiting to ride on the next message. */
|
|
88
88
|
afterMs: number;
|
|
89
89
|
talk?: TalkRequest<C, D>;
|
|
90
|
+
/** Understand's judgment that the lead's message asks something; absent when nothing judged it. */
|
|
91
|
+
asks?: boolean;
|
|
90
92
|
/** Speak already happened (or was skipped): a talk step reached now waits for the next message. */
|
|
91
93
|
speakDone: boolean;
|
|
92
94
|
/** Runs still to move this phase; `follow` appends children. */
|
|
@@ -641,6 +643,7 @@ export class Runner<C = unknown, D = unknown> {
|
|
|
641
643
|
if (turn.ignored || turn.what.kind !== "message") return;
|
|
642
644
|
turn.llmCalls += understanding?.llmCalls ?? 0;
|
|
643
645
|
turn.usage = addUsage(turn.usage, understanding?.usage);
|
|
646
|
+
if (understanding?.asks !== undefined) turn.asks = understanding.asks;
|
|
644
647
|
const key = turn.triggerKey;
|
|
645
648
|
const asker = this.asker(turn);
|
|
646
649
|
|
|
@@ -747,24 +750,41 @@ export class Runner<C = unknown, D = unknown> {
|
|
|
747
750
|
await this.drain(turn);
|
|
748
751
|
}
|
|
749
752
|
const speaker = this.speaker(turn);
|
|
750
|
-
if (speaker
|
|
751
|
-
|
|
752
|
-
|
|
753
|
+
if (!speaker || "idle" in speaker || !this.fixedDue(speaker)) return speaker;
|
|
754
|
+
// A question the lead asked gets its answer first: the step speaks, and its fixed question follows in settle.
|
|
755
|
+
// Unjudged counts as asked, and so does the retry of a failed answer: a question sent over the lead's own drops it.
|
|
756
|
+
const answerFirst = turn.what.kind === "message" ? turn.asks !== false : this.retrying(speaker);
|
|
757
|
+
if (answerFirst && speaker.step.question !== undefined) {
|
|
758
|
+
speaker.fixedAfter = render(speaker.step.question, this.scope(turn, speaker.run));
|
|
759
|
+
return speaker;
|
|
753
760
|
}
|
|
754
|
-
|
|
761
|
+
this.askFixed(turn, speaker);
|
|
762
|
+
turn.talk = undefined;
|
|
763
|
+
return null;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/** The step failed at the provider and runs again on its retry wake: deferTalk left `deferred` as its last line. */
|
|
767
|
+
private retrying({ run, step }: TalkRequest<C, D>): boolean {
|
|
768
|
+
const last = run.outcomes.at(-1);
|
|
769
|
+
return last?.status === "deferred" && last.stepId === step.id;
|
|
755
770
|
}
|
|
756
771
|
|
|
757
772
|
/**
|
|
758
|
-
*
|
|
759
|
-
* and the run not staying (a staying run answers the lead).
|
|
760
|
-
* the AI should phrase the ask instead.
|
|
773
|
+
* The step's fixed question is due: this is its first ask, with every field it collects still unknown and none asked
|
|
774
|
+
* yet, and the run is not staying (a staying run answers the lead). Otherwise the AI phrases the ask.
|
|
761
775
|
*/
|
|
762
|
-
private
|
|
776
|
+
private fixedDue({ run, step, pending }: TalkRequest<C, D>): boolean {
|
|
763
777
|
const { question, collect = [] } = step;
|
|
764
778
|
if (question === undefined || run.staying) return false;
|
|
765
|
-
|
|
779
|
+
return pending.length === collect.length && pending.every((field) => (run.asked[field] ?? 0) === 0);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/** Send the step's fixed question when it is due. It counts as one ask of each field. */
|
|
783
|
+
private askFixed(turn: Turn<C, D>, talk: TalkRequest<C, D>): boolean {
|
|
784
|
+
const { run, step, pending } = talk;
|
|
785
|
+
if (!this.fixedDue(talk) || step.question === undefined) return false;
|
|
766
786
|
const key = this.stepKey(run, step);
|
|
767
|
-
turn.messages.push({ text: render(question, this.scope(turn, run)), kind: "verbatim", afterMs: turn.afterMs, key, runId: run.id, stepId: step.id });
|
|
787
|
+
turn.messages.push({ text: render(step.question, this.scope(turn, run)), kind: "verbatim", afterMs: turn.afterMs, key, runId: run.id, stepId: step.id });
|
|
768
788
|
turn.afterMs = 0;
|
|
769
789
|
turn.spokeBy.add(run.id);
|
|
770
790
|
turn.spoke = true;
|
|
@@ -794,9 +814,7 @@ export class Runner<C = unknown, D = unknown> {
|
|
|
794
814
|
const instructions = [...(this.options.instructions ?? []), ...own.instructions].filter((ins) => !ins.if || evaluate(ins.if, ctx, conditions));
|
|
795
815
|
const all = this.options.tools ?? [];
|
|
796
816
|
const allowed = own.tools;
|
|
797
|
-
|
|
798
|
-
const last = "idle" in talk ? undefined : talk.run.outcomes.at(-1);
|
|
799
|
-
const retry = !("idle" in talk) && last?.status === "deferred" && last.stepId === talk.step.id;
|
|
817
|
+
const retry = !("idle" in talk) && this.retrying(talk);
|
|
800
818
|
return {
|
|
801
819
|
talk,
|
|
802
820
|
input: turn.what.kind === "message" ? { kind: turn.kind, text: turn.what.text } : { kind: turn.kind, ...(retry ? { retry } : {}) },
|
|
@@ -1274,7 +1292,15 @@ export class Runner<C = unknown, D = unknown> {
|
|
|
1274
1292
|
this.outcome(turn, run, { kind: talkKind(step), status: "ok", key, llmCalls: spoken.llmCalls, stepId: step.id });
|
|
1275
1293
|
if (!turn.session.runs.includes(run)) return;
|
|
1276
1294
|
const pending = step.collect?.length ? pendingFields(step, turn.session.data, run.asked) : [];
|
|
1277
|
-
|
|
1295
|
+
if (talk.fixedAfter !== undefined) {
|
|
1296
|
+
// The reply only answered the lead; the step's own question goes out after it and counts the ask.
|
|
1297
|
+
if (this.askFixed(turn, { run, flow, step, pending })) {
|
|
1298
|
+
run.status = "asking";
|
|
1299
|
+
return;
|
|
1300
|
+
}
|
|
1301
|
+
} else {
|
|
1302
|
+
for (const field of pending) run.asked[field] = (run.asked[field] ?? 0) + 1;
|
|
1303
|
+
}
|
|
1278
1304
|
if (run.staying) {
|
|
1279
1305
|
// Each answer is a new visit, so a new key, even while a field is still pending; that field's max-asks is reported once, when it gets there.
|
|
1280
1306
|
const maxAsks = step.maxAsks ?? DEFAULT_MAX_ASKS;
|
package/src/core/Speak.ts
CHANGED
|
@@ -97,6 +97,10 @@ const DEFAULT_GUIDELINE =
|
|
|
97
97
|
"Collect what is still missing below, in the flow of the conversation, one or two things per message.";
|
|
98
98
|
/** A step with no prompt and nothing left to collect: the step an `onEnd: 'stay'` run answers from. */
|
|
99
99
|
const ANSWER_GUIDELINE = "Answer the customer's message, in the flow of the conversation.";
|
|
100
|
+
/** The step's fixed question follows this reply (`fixedAfter`): the reply answers the lead and leaves the asking to it. */
|
|
101
|
+
const ANSWER_BEFORE_QUESTION =
|
|
102
|
+
"Answer what the customer's message asks, in the flow of the conversation. Ask nothing yourself: right after your reply, " +
|
|
103
|
+
"this question goes out word for word, so do not ask it or anything like it:";
|
|
100
104
|
const TOOLS_SECTION =
|
|
101
105
|
"## Tools\nCall the tools provided when you need to look something up or act before answering. Once you have what you need, answer the customer.";
|
|
102
106
|
const FINAL_SECTION =
|
|
@@ -158,7 +162,8 @@ export class Speak<C = unknown, D = unknown> {
|
|
|
158
162
|
/** The round loop shared by both entry points: yields deltas, returns the outcome. */
|
|
159
163
|
private async *rounds(req: SpeakRequest<C, D>, streaming: boolean): AsyncGenerator<string, SpeakOutcome> {
|
|
160
164
|
const talk = req.talk;
|
|
161
|
-
|
|
165
|
+
// Fields are read by the fixed question's own answer, never by the reply that precedes it.
|
|
166
|
+
const envelope = buildEnvelope(this.options.fields, "idle" in talk || talk.fixedAfter !== undefined ? [] : talk.pending);
|
|
162
167
|
const { system, turn: prompt } = buildPrompt(this.options, req, envelope);
|
|
163
168
|
const maxLoops = this.options.maxToolLoops ?? DEFAULT_MAX_TOOL_LOOPS;
|
|
164
169
|
const tools = maxLoops > 0 ? req.tools : [];
|
|
@@ -332,8 +337,12 @@ function buildPrompt<C, D>(
|
|
|
332
337
|
? [guideline(talk.idle.prompt)]
|
|
333
338
|
: [
|
|
334
339
|
`## Flow\n${talk.flow.name}${talk.flow.description ? `: ${render(talk.flow.description, scope)}` : ""}`,
|
|
335
|
-
|
|
336
|
-
|
|
340
|
+
...(talk.fixedAfter !== undefined
|
|
341
|
+
? [`${GUIDELINE_HEADING}\n${ANSWER_BEFORE_QUESTION}\n"${talk.fixedAfter}"`]
|
|
342
|
+
: [
|
|
343
|
+
guideline(talk.step.prompt ?? (talk.pending.length ? DEFAULT_GUIDELINE : ANSWER_GUIDELINE)),
|
|
344
|
+
pendingSection(talk.pending, options.fields, talk.step.ask ?? {}, scope),
|
|
345
|
+
]),
|
|
337
346
|
// `Partial<D>` is a mapped type; the guard is how it reaches an index-signature parameter without a cast.
|
|
338
347
|
factsSection(options.fields, isRecord(req.data) ? req.data : {}),
|
|
339
348
|
];
|
package/src/core/Understand.ts
CHANGED
|
@@ -33,10 +33,15 @@ import { Aliases, describeField, factsSection, joinSections, stablePrefix } from
|
|
|
33
33
|
|
|
34
34
|
export const UNDERSTAND_SCHEMA_NAME = "understand";
|
|
35
35
|
|
|
36
|
-
const SECTIONS = ["flows", "mentions", "extract", "branches", "fields"] as const;
|
|
36
|
+
const SECTIONS = ["flows", "mentions", "extract", "branches", "fields", "asks"] as const;
|
|
37
37
|
|
|
38
38
|
export class Understand<C = unknown, D = unknown> {
|
|
39
|
-
|
|
39
|
+
/** Some flow opens a step with a fixed question: whether the lead asked something decides if it waits. */
|
|
40
|
+
private readonly judgesAsks: boolean;
|
|
41
|
+
|
|
42
|
+
constructor(private readonly options: AgentOptions<C, D>) {
|
|
43
|
+
this.judgesAsks = (options.flows ?? []).some((flow) => flow.steps.some((step) => "question" in step && step.question !== undefined));
|
|
44
|
+
}
|
|
40
45
|
|
|
41
46
|
async run(req: UnderstandRequest<C, D>): Promise<Understanding> {
|
|
42
47
|
const candidates = candidateFlows(req);
|
|
@@ -47,7 +52,7 @@ export class Understand<C = unknown, D = unknown> {
|
|
|
47
52
|
if (onlyRouting && candidates.length <= (req.floor ? 1 : 0)) return empty(0);
|
|
48
53
|
|
|
49
54
|
const aliases = new Aliases();
|
|
50
|
-
const jsonSchema = buildEnvelope(req, candidates, aliases);
|
|
55
|
+
const jsonSchema = buildEnvelope(req, candidates, aliases, this.judgesAsks);
|
|
51
56
|
const { system, turn: prompt } = this.buildPrompt(req, candidates, aliases, jsonSchema);
|
|
52
57
|
|
|
53
58
|
// Provider failures propagate: in this phase the turn throws and the host retries the input.
|
|
@@ -115,7 +120,7 @@ function branchKey(branch: { runId: string; stepId: string; index: number }): st
|
|
|
115
120
|
|
|
116
121
|
// ── Envelope ────────────────────────────────────────────────────────────
|
|
117
122
|
|
|
118
|
-
function buildEnvelope<C, D>(req: UnderstandRequest<C, D>, candidates: Flow<C, D>[], aliases: Aliases): StructuredSchema {
|
|
123
|
+
function buildEnvelope<C, D>(req: UnderstandRequest<C, D>, candidates: Flow<C, D>[], aliases: Aliases, judgesAsks: boolean): StructuredSchema {
|
|
119
124
|
const properties: Record<string, StructuredSchema> = {};
|
|
120
125
|
|
|
121
126
|
if (candidates.length) {
|
|
@@ -149,6 +154,9 @@ function buildEnvelope<C, D>(req: UnderstandRequest<C, D>, candidates: Flow<C, D
|
|
|
149
154
|
for (const [slug, def] of Object.entries(req.fields)) defs[aliases.of(slug, "d")] = def;
|
|
150
155
|
properties.fields = toWireSchema(defs, { nullable: true });
|
|
151
156
|
}
|
|
157
|
+
if (judgesAsks) {
|
|
158
|
+
properties.asks = { type: ["boolean", "null"], description: "The message asks something the reply must answer" };
|
|
159
|
+
}
|
|
152
160
|
|
|
153
161
|
return { type: "object", properties, required: Object.keys(properties), additionalProperties: false };
|
|
154
162
|
}
|
|
@@ -283,6 +291,9 @@ const OUTPUT_LINES: Record<Section, string> = {
|
|
|
283
291
|
extract: "- extract: per item id, an object with the values pulled from the message; null values when the item was not brought up",
|
|
284
292
|
branches: "- branches: true or false per question id",
|
|
285
293
|
fields: "- fields: one value per detail, null when the customer did not give it",
|
|
294
|
+
asks:
|
|
295
|
+
"- asks: true when the message asks something the reply has to answer (a question, a request for a price, a photo, " +
|
|
296
|
+
"whether an item is in stock, a store fact); false when it only answers the assistant, greets or confirms",
|
|
286
297
|
};
|
|
287
298
|
|
|
288
299
|
/**
|
|
@@ -290,7 +301,7 @@ const OUTPUT_LINES: Record<Section, string> = {
|
|
|
290
301
|
* null for anything extracted, so a prompt-only model never reads a
|
|
291
302
|
* placeholder as a default value.
|
|
292
303
|
*/
|
|
293
|
-
const PLACEHOLDER: Record<Section, unknown> = { flows: 0, mentions: false, extract: null, branches: false, fields: null };
|
|
304
|
+
const PLACEHOLDER: Record<Section, unknown> = { flows: 0, mentions: false, extract: null, branches: false, fields: null, asks: false };
|
|
294
305
|
|
|
295
306
|
function outputSection(schema: StructuredSchema): string {
|
|
296
307
|
const present = SECTIONS.filter((s) => schema.properties?.[s] !== undefined);
|
|
@@ -357,12 +368,14 @@ function parseReply(reply: Record<string, unknown>, aliases: Aliases): Understan
|
|
|
357
368
|
for (const [key, raw] of entries(reply.extract)) {
|
|
358
369
|
if (isRecord(raw)) extract[aliases.real(key)] = given(raw);
|
|
359
370
|
}
|
|
371
|
+
const asks = coerceField({ type: "boolean" }, reply.asks);
|
|
360
372
|
return {
|
|
361
373
|
flows,
|
|
362
374
|
mentions: booleans(reply.mentions, aliases),
|
|
363
375
|
extract,
|
|
364
376
|
branches: booleans(reply.branches, aliases),
|
|
365
377
|
fields: given(Object.fromEntries(entries(reply.fields).map(([k, v]) => [aliases.real(k), v]))),
|
|
378
|
+
...(asks.ok && typeof asks.value === "boolean" ? { asks: asks.value } : {}),
|
|
366
379
|
llmCalls: 1,
|
|
367
380
|
};
|
|
368
381
|
}
|
package/src/core/contracts.ts
CHANGED
|
@@ -48,6 +48,11 @@ export interface Understanding {
|
|
|
48
48
|
branches: Record<string, boolean>;
|
|
49
49
|
/** field → raw value the lead gave, or nothing. */
|
|
50
50
|
fields: Record<string, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* The lead's message asks something a reply must answer. Judged only while a flow has a fixed
|
|
53
|
+
* `question`: one that would go out now waits for the answer when this is not `false`.
|
|
54
|
+
*/
|
|
55
|
+
asks?: boolean;
|
|
51
56
|
llmCalls: number;
|
|
52
57
|
usage?: TokenUsage;
|
|
53
58
|
}
|
|
@@ -61,6 +66,11 @@ export interface TalkRequest<C = unknown, D = unknown> {
|
|
|
61
66
|
step: StepBase<D> & TalkStep<C, D>;
|
|
62
67
|
/** `step.collect` minus known minus at `maxAsks`, in order. */
|
|
63
68
|
pending: string[];
|
|
69
|
+
/**
|
|
70
|
+
* The step's fixed question, rendered. It goes out word for word right after this reply, so the
|
|
71
|
+
* reply only answers what the lead asked: it asks nothing and reads no field.
|
|
72
|
+
*/
|
|
73
|
+
fixedAfter?: string;
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
/** No run holds the floor; the idle speaker answers. */
|
package/src/types/flow.ts
CHANGED
|
@@ -188,9 +188,10 @@ export type TalkStep<C = unknown, D = unknown> = (
|
|
|
188
188
|
/** Per-flow wording for a field; the field's own `ask` is the default. */
|
|
189
189
|
ask?: Partial<Record<keyof D & string, string>>;
|
|
190
190
|
/**
|
|
191
|
-
* A fixed first question, sent word for word
|
|
192
|
-
*
|
|
193
|
-
*
|
|
191
|
+
* A fixed first question, sent word for word when the step first asks: every
|
|
192
|
+
* field it collects is still unknown and none was asked yet. No model call,
|
|
193
|
+
* unless the customer's message asks something: then the step answers first
|
|
194
|
+
* and the question follows. Any later ask is the AI's own wording. Needs `collect`.
|
|
194
195
|
*/
|
|
195
196
|
question?: Template;
|
|
196
197
|
/** Times a field may be asked before it is skipped. Default 3. */
|