@ouispec/agent-worker 0.17.0 → 0.18.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 +15 -0
- package/dist/approvals/continuation.d.ts.map +1 -1
- package/dist/approvals/continuation.js +1 -0
- package/dist/approvals/continuation.js.map +1 -1
- package/dist/approvals/requirement.d.ts +29 -1
- package/dist/approvals/requirement.d.ts.map +1 -1
- package/dist/approvals/requirement.js +29 -1
- package/dist/approvals/requirement.js.map +1 -1
- package/dist/conversations/client.d.ts +44 -0
- package/dist/conversations/client.d.ts.map +1 -0
- package/dist/conversations/client.js +49 -0
- package/dist/conversations/client.js.map +1 -0
- package/dist/history.d.ts +10 -1
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +20 -6
- package/dist/history.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/live-call/handler.d.ts +12 -2
- package/dist/live-call/handler.d.ts.map +1 -1
- package/dist/live-call/handler.js +31 -3
- package/dist/live-call/handler.js.map +1 -1
- package/dist/live-call/protocol.d.ts +5 -2
- package/dist/live-call/protocol.d.ts.map +1 -1
- package/dist/live-call/protocol.js.map +1 -1
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +85 -11
- package/dist/orchestrator.js.map +1 -1
- package/dist/runtime/turn-info.d.ts +22 -2
- package/dist/runtime/turn-info.d.ts.map +1 -1
- package/dist/runtime/turn-info.js +6 -11
- package/dist/runtime/turn-info.js.map +1 -1
- package/dist/runtime/turn-runner.d.ts +15 -2
- package/dist/runtime/turn-runner.d.ts.map +1 -1
- package/dist/runtime/turn-runner.js +38 -8
- package/dist/runtime/turn-runner.js.map +1 -1
- package/dist/runtime/types.d.ts +16 -2
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/stop/partial.d.ts +3 -1
- package/dist/stop/partial.d.ts.map +1 -1
- package/dist/stop/partial.js +10 -5
- package/dist/stop/partial.js.map +1 -1
- package/dist/stop/turn-stop.d.ts +9 -4
- package/dist/stop/turn-stop.d.ts.map +1 -1
- package/dist/stop/turn-stop.js +14 -9
- package/dist/stop/turn-stop.js.map +1 -1
- package/dist/testing/cassette.d.ts +44 -0
- package/dist/testing/cassette.d.ts.map +1 -0
- package/dist/testing/cassette.js +72 -0
- package/dist/testing/cassette.js.map +1 -0
- package/dist/testing/index.d.ts +7 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +5 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/scripted.d.ts +64 -0
- package/dist/testing/scripted.d.ts.map +1 -0
- package/dist/testing/scripted.js +89 -0
- package/dist/testing/scripted.js.map +1 -0
- package/dist/types.d.ts +21 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -126,6 +126,20 @@ Two hooks give you a say before an approval is asked for. Both are told the turn
|
|
|
126
126
|
|
|
127
127
|
Of the calls in one response, only the first that needs approval is asked for. While its check and preview are written, a call that arrives waits for the outcome: if the first is refused, the next is checked as if it had come first.
|
|
128
128
|
|
|
129
|
+
**On a conversation channel** there is no card. Give the turn payload `channel: 'chat' | 'sms' | 'voice' | 'phone'` (default `ui`); a live call's turns are `voice`, or `phone` when your `resolveTurn` sets `channel: 'phone'`. The model is then told that calling the tool sends the customer a readback of exactly its arguments, and the readback, word for word (on a voice, your preview's `spokenReadback` when you wrote one), is the turn's last words: emitted as `agent:token` with `readback: true` and stored as an assistant message, so your channel's adapter sends or speaks it like the rest of the reply. A live call sends it once, as its `readback` event. When your classifier reads the customer's next message as confirming it, decide for them (`ApprovalStoreClient.decide`, or `POST /internal/approvals/:id/decide`, with the channel) and send the continuation turn with the token, as the card would. Your hooks see the channel as `AgentTurnInfo.approvalChannel`.
|
|
130
|
+
|
|
131
|
+
**An action on the person's page is approved only by its card, on every channel.** The page runs it only on its own grant, from the person's click, so on a conversation channel the model is told the card is on their screen, nothing is read back, and the store refuses a conversation channel's approve of it (`channel`).
|
|
132
|
+
|
|
133
|
+
## A person takes the conversation over
|
|
134
|
+
|
|
135
|
+
A person on your staff can take a conversation from the agent, answer the customer as themselves, and hand it back. The hold is kept by the realtime server; your API takes and releases it after its own permission check, with `createHttpConversationClient({ url, apiKey })` (`takeOver`, `handBack`, `announce`, `hold`).
|
|
136
|
+
|
|
137
|
+
- **The agent does not answer a held conversation.** The turn's stop watch asks for its conversation's hold too: a turn running when the conversation is taken over stops at a safe point, keeps what it had produced marked `taken_over`, and its tab is told `agent:turn_complete` with `stopReason: 'taken_over'`; a turn that arrives while it is held makes no model call and stores nothing (`persistMessages` is called with no messages and the `taken_over` marker, so you can settle its row). `runner.reply` does not answer a held conversation either.
|
|
138
|
+
- **On a live call** the handler answers a turn of a held conversation with `done { stopReason: 'taken_over' }` and no words, so the call service keeps the character quiet; a turn speaking when it is taken over ends the same way. Quiet the call service's own session too, and store what the person says in the call as `staff` messages.
|
|
139
|
+
- **Approvals waiting at the take-over are withdrawn** by the realtime server (`taken_over`); the next turn records each as withdrawn, and none runs or gets a receipt.
|
|
140
|
+
- **The staff's words are in the history.** Store a person's message with `role: 'staff'` and its `speaker` (`{ userId, displayName, role? }`), and the take-over and hand-back as `staff` entries with `takeover: 'taken_over' | 'handed_back'` and no content. `getHistory` returns them as `{ role: 'staff', content, speaker, takeover? }`; the model reads them as the business's side of the conversation, under the person's name, never as its own words or the customer's. After the hand-back the agent answers from the whole exchange.
|
|
141
|
+
- `historyOf(messages)` maps the messages a turn stored back to the history form, for a host that keeps them as given.
|
|
142
|
+
|
|
129
143
|
## Stopping a turn
|
|
130
144
|
|
|
131
145
|
A turn can be stopped by the person, or superseded by their next message. The request is kept by the realtime server (`@ouispec/agent-realtime`, "Stopping a turn"), and the turn asks for it there for as long as it runs. Nothing needs configuring: the runtime uses the realtime server you already gave it. `stops.graceMs` (default 2 s) is how long an answer already on its way is still waited for.
|
|
@@ -379,4 +393,5 @@ Header parameters are never model input: `actAs` supplies them, and a call fails
|
|
|
379
393
|
- `pnpm test` includes the fixture turn. It runs on both adapters and on two providers, replaying recorded responses through each provider's real `ai` package, against the SDK realtime server on Redis.
|
|
380
394
|
- `pnpm record:fixture-turn` re-records the Bedrock responses from a live model.
|
|
381
395
|
- `pnpm eval:live` runs the live operating-rules eval.
|
|
396
|
+
- `@ouispec/agent-worker/testing` has what a product's own tests use: `recordingFetch` and `replayingFetch` (recorded model responses through a provider's real package), `scriptedChatCompletions` (a model whose every answer a test states), `conversationOf` (a request's conversation without the step's tail), and the Desk fixture API.
|
|
382
397
|
- Both of those live commands need Bedrock credentials in the environment.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"continuation.d.ts","sourceRoot":"","sources":["../../src/approvals/continuation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAyB,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC7H,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,MAAM,mBAAmB;AAC7B,qGAAqG;AACnG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AACvD;;;;GAIG;GACD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;CAAE,CAAC;AAEnF,iDAAiD;AACjD,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAElE;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,eAAe,CAAC;IACzB,iGAAiG;IACjG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IAC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,CAC1B,OAAO,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACtG,WAAW,EAAE,CAmBf;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAmBxG;AAED,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,mBAAmB,GAAG,SAAS,EACtC,YAAY,EAAE,oBAAoB,EAClC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAC/C,OAAO,CAAC,mBAAmB,CAAC,CA+B9B"}
|
|
@@ -19,6 +19,7 @@ export function approvedExpiredMarker(now = new Date()) {
|
|
|
19
19
|
const WITHDRAWN_BECAUSE = {
|
|
20
20
|
superseded: 'the user sent a new message',
|
|
21
21
|
stopped: 'the user stopped the turn that asked for it',
|
|
22
|
+
taken_over: 'a person on the staff took the conversation over',
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
24
25
|
* An approval that was withdrawn before it was used: said as what happened,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"continuation.js","sourceRoot":"","sources":["../../src/approvals/continuation.ts"],"names":[],"mappings":"AAiDA,MAAM,OAAO,GAAG;IACd,WAAW,EAAE,0DAA0D;IACvE,cAAc,EAAE,gEAAgE;IAChF,QAAQ,EAAE,4DAA4D;IACtE,OAAO,EAAE,0DAA0D;IACnE,eAAe,EAAE,oGAAoG;CAC7G,CAAC;AAEX,MAAM,UAAU,cAAc,CAAC,OAAwB,EAAE,GAAY,EAAE,MAAY,IAAI,IAAI,EAAE;IAC3F,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,CAAC;gBACtI,CAAC,CAAC,YAAY,CAAC,4BAA4B,IAAI,sBAAsB,CAAC;SAC3E,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC;IACb,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,8FAA8F,CAAC,EAAE,CAAC;IAC9I,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,YAAY,CAAC,6DAA6D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;YAC5G,wHAAwH;YACxH,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,SAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1E,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC1G,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a tool's declaration says about approval, for every
|
|
3
|
+
* kind of tool the worker runs: a UI action from the client's surfaces, a
|
|
4
|
+
* generated API tool (its effect from the operation's `x-agent`), a host tool.
|
|
5
|
+
* The rule itself is OUI's `requiresApproval` (through oui-bindings), which the browser applies too; a host's
|
|
6
|
+
* policy may require approval of more, never of less.
|
|
7
|
+
*/
|
|
8
|
+
import { type ApprovalChannel } from '@ouispec/agent-core';
|
|
1
9
|
import type { RegisteredTool, ToolEffect } from '../tools/types.js';
|
|
2
10
|
export interface ApprovalRequirement {
|
|
3
11
|
effect: ToolEffect | undefined;
|
|
@@ -10,6 +18,26 @@ export interface ApprovalRequirement {
|
|
|
10
18
|
ttlMs: number;
|
|
11
19
|
}
|
|
12
20
|
export declare function approvalRequirement(tool: RegisteredTool): ApprovalRequirement;
|
|
13
|
-
/** What the model reads on a tool whose calls need approval, in place of any "confirm first" instruction. */
|
|
21
|
+
/** What the model reads on a tool whose calls need approval, in place of any "confirm first" instruction: in a UI, the card. */
|
|
14
22
|
export declare const APPROVAL_TOOL_NOTE: string;
|
|
23
|
+
/**
|
|
24
|
+
* The same on a conversation channel (chat, SMS, voice, phone), where there is
|
|
25
|
+
* no card: the customer is sent the readback, verbatim, and their next message
|
|
26
|
+
* confirms it or not.
|
|
27
|
+
*/
|
|
28
|
+
export declare const READBACK_APPROVAL_TOOL_NOTE: string;
|
|
29
|
+
/**
|
|
30
|
+
* A UI action on a conversation channel: the person's page runs it only on its
|
|
31
|
+
* own grant, from a click on its card, so it is approved there and nowhere
|
|
32
|
+
* else. A yes said or sent in the conversation does not approve it.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SCREEN_APPROVAL_TOOL_NOTE: string;
|
|
35
|
+
/** The conversation channels a voice reads the readback out on: it says the host's `spokenReadback` when there is one. */
|
|
36
|
+
export declare const VOICE_APPROVAL_CHANNELS: ReadonlySet<ApprovalChannel>;
|
|
37
|
+
/**
|
|
38
|
+
* What the model reads on a tool whose calls need approval, for the turn's
|
|
39
|
+
* channel: the card in a UI; the readback on a conversation channel; and, for
|
|
40
|
+
* a UI action on a conversation channel, the card on the person's screen.
|
|
41
|
+
*/
|
|
42
|
+
export declare function approvalToolNote(channel?: ApprovalChannel, toolKind?: RegisteredTool['kind']): string;
|
|
15
43
|
//# sourceMappingURL=requirement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requirement.d.ts","sourceRoot":"","sources":["../../src/approvals/requirement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"requirement.d.ts","sourceRoot":"","sources":["../../src/approvals/requirement.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAgD,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEzG,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,+EAA+E;IAC/E,QAAQ,EAAE,OAAO,CAAC;IAClB,0GAA0G;IAC1G,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,mBAAmB,CAW7E;AAED,gIAAgI;AAChI,eAAO,MAAM,kBAAkB,QAGX,CAAC;AAErB;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,QAGkE,CAAC;AAE3G;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,QAGwB,CAAC;AAE/D,0HAA0H;AAC1H,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,eAAe,CAAgD,CAAC;AAElH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,eAAsB,EAAE,QAAQ,GAAE,cAAc,CAAC,MAAM,CAAa,GAAG,MAAM,CAGtH"}
|
|
@@ -19,8 +19,36 @@ export function approvalRequirement(tool) {
|
|
|
19
19
|
ttlMs: minutes ? Math.min(minutes * 60_000, MAX_APPROVAL_TTL_MS) : DEFAULT_APPROVAL_TTL_MS,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
/** What the model reads on a tool whose calls need approval, in place of any "confirm first" instruction. */
|
|
22
|
+
/** What the model reads on a tool whose calls need approval, in place of any "confirm first" instruction: in a UI, the card. */
|
|
23
23
|
export const APPROVAL_TOOL_NOTE = "Needs the user's approval: calling it shows them an approval card with exactly these arguments, and it runs only when " +
|
|
24
24
|
'they approve it there. Call it directly when they ask for it. Do not ask for a yes in chat first, and never treat a typed ' +
|
|
25
25
|
'yes as approval.';
|
|
26
|
+
/**
|
|
27
|
+
* The same on a conversation channel (chat, SMS, voice, phone), where there is
|
|
28
|
+
* no card: the customer is sent the readback, verbatim, and their next message
|
|
29
|
+
* confirms it or not.
|
|
30
|
+
*/
|
|
31
|
+
export const READBACK_APPROVAL_TOOL_NOTE = "Needs the customer's confirmation: calling it sends them a readback of exactly these arguments, word for word, and it runs " +
|
|
32
|
+
'only if they confirm that readback in their next message. Call it directly when they ask for it. Do not read the details ' +
|
|
33
|
+
'back or ask for a yes yourself first, and never treat a yes given before the readback as confirmation.';
|
|
34
|
+
/**
|
|
35
|
+
* A UI action on a conversation channel: the person's page runs it only on its
|
|
36
|
+
* own grant, from a click on its card, so it is approved there and nowhere
|
|
37
|
+
* else. A yes said or sent in the conversation does not approve it.
|
|
38
|
+
*/
|
|
39
|
+
export const SCREEN_APPROVAL_TOOL_NOTE = "Needs the user's approval on their screen: calling it shows them an approval card with exactly these arguments, and it runs " +
|
|
40
|
+
'only when they approve it there. Call it directly when they ask for it, and tell them the card is on their screen. A yes ' +
|
|
41
|
+
'they say or send in this conversation does not approve it.';
|
|
42
|
+
/** The conversation channels a voice reads the readback out on: it says the host's `spokenReadback` when there is one. */
|
|
43
|
+
export const VOICE_APPROVAL_CHANNELS = new Set(['voice', 'phone']);
|
|
44
|
+
/**
|
|
45
|
+
* What the model reads on a tool whose calls need approval, for the turn's
|
|
46
|
+
* channel: the card in a UI; the readback on a conversation channel; and, for
|
|
47
|
+
* a UI action on a conversation channel, the card on the person's screen.
|
|
48
|
+
*/
|
|
49
|
+
export function approvalToolNote(channel = 'ui', toolKind = 'backend') {
|
|
50
|
+
if (channel === 'ui')
|
|
51
|
+
return APPROVAL_TOOL_NOTE;
|
|
52
|
+
return toolKind === 'ui' ? SCREEN_APPROVAL_TOOL_NOTE : READBACK_APPROVAL_TOOL_NOTE;
|
|
53
|
+
}
|
|
26
54
|
//# sourceMappingURL=requirement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requirement.js","sourceRoot":"","sources":["../../src/approvals/requirement.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"requirement.js","sourceRoot":"","sources":["../../src/approvals/requirement.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAwB,MAAM,qBAAqB,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAcjE,MAAM,UAAU,mBAAmB,CAAC,IAAoB;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC;IAC9C,MAAM,OAAO,GAAG,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3H,OAAO;QACL,MAAM;QACN,WAAW;QACX,QAAQ,EAAE,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC;QAC/C,UAAU,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;QAC/D,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,uBAAuB;KAC3F,CAAC;AACJ,CAAC;AAED,gIAAgI;AAChI,MAAM,CAAC,MAAM,kBAAkB,GAC7B,wHAAwH;IACxH,4HAA4H;IAC5H,kBAAkB,CAAC;AAErB;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACtC,6HAA6H;IAC7H,2HAA2H;IAC3H,wGAAwG,CAAC;AAE3G;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GACpC,8HAA8H;IAC9H,2HAA2H;IAC3H,4DAA4D,CAAC;AAE/D,0HAA0H;AAC1H,MAAM,CAAC,MAAM,uBAAuB,GAAiC,IAAI,GAAG,CAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAElH;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAA2B,IAAI,EAAE,WAAmC,SAAS;IAC5G,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,kBAAkB,CAAC;IAChD,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,2BAA2B,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The product API's side of a conversation's hold: take a
|
|
3
|
+
* conversation over, hand it back, announce a stored message, ask who holds
|
|
4
|
+
* it. The realtime server keeps the hold and enforces it; the product calls
|
|
5
|
+
* these from its own routes, after its own check that this person may.
|
|
6
|
+
*
|
|
7
|
+
* It ships beside the clients of the approval store and the stop record,
|
|
8
|
+
* which the worker uses; a product's API imports it from here.
|
|
9
|
+
*/
|
|
10
|
+
import type { AnnounceMessageRequest, AnnounceMessageResult, ConversationHold, HandBackRequest, HandBackResult, TakeOverRequest, TakeOverResult } from '@ouispec/agent-core';
|
|
11
|
+
export interface ConversationClient {
|
|
12
|
+
/** Who holds the conversation, or null when the agent answers it. */
|
|
13
|
+
hold(conversationId: string): Promise<ConversationHold | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Take it over for `request.holder`: `taken_over` (the rooms are told, its
|
|
16
|
+
* running turn stops, and every approval of it still waiting, or approved
|
|
17
|
+
* and not yet used, is withdrawn: their ids are `withdrawn`), `already`
|
|
18
|
+
* (this holder had it), or refused with who holds it. Call it after the
|
|
19
|
+
* product's own permission check.
|
|
20
|
+
*/
|
|
21
|
+
takeOver(conversationId: string, request: TakeOverRequest): Promise<TakeOverResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Hand it back: with `userId`, as that holder; without it, on the product's
|
|
24
|
+
* own authority (an idle policy, a manager). Refused when `userId` does not
|
|
25
|
+
* hold it.
|
|
26
|
+
*/
|
|
27
|
+
handBack(conversationId: string, request: HandBackRequest): Promise<HandBackResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Announce a message the product has stored, to the people watching the
|
|
30
|
+
* conversation. A `staff` message is refused unless its speaker holds it.
|
|
31
|
+
*/
|
|
32
|
+
announce(conversationId: string, request: AnnounceMessageRequest): Promise<AnnounceMessageResult>;
|
|
33
|
+
}
|
|
34
|
+
export interface HttpConversationClientConfig {
|
|
35
|
+
/** The realtime server's base URL. */
|
|
36
|
+
url: string;
|
|
37
|
+
/** Its internal key. */
|
|
38
|
+
apiKey: string;
|
|
39
|
+
/** Per request. Default 5 s. */
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}
|
|
42
|
+
/** The conversation routes over the realtime server's internal HTTP API. Throws on anything but an answer. */
|
|
43
|
+
export declare function createHttpConversationClient(config: HttpConversationClientConfig): ConversationClient;
|
|
44
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/conversations/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACf,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC/D;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACpF;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACpF;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACnG;AAED,MAAM,WAAW,4BAA4B;IAC3C,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,8GAA8G;AAC9G,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,4BAA4B,GAAG,kBAAkB,CA6CrG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { requireRealtime } from '../emit/http-adapter.js';
|
|
2
|
+
/** The conversation routes over the realtime server's internal HTTP API. Throws on anything but an answer. */
|
|
3
|
+
export function createHttpConversationClient(config) {
|
|
4
|
+
const { url, apiKey } = config;
|
|
5
|
+
requireRealtime(url, apiKey);
|
|
6
|
+
const timeoutMs = config.timeoutMs ?? 5_000;
|
|
7
|
+
const call = async (conversationId, path, body) => {
|
|
8
|
+
const res = await fetch(`${url}/internal/conversations/${encodeURIComponent(conversationId)}${path}`, {
|
|
9
|
+
method: body === undefined ? 'GET' : 'POST',
|
|
10
|
+
headers: { 'Content-Type': 'application/json', 'X-Api-Key': apiKey },
|
|
11
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
12
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
13
|
+
});
|
|
14
|
+
const text = await res.text();
|
|
15
|
+
let json = null;
|
|
16
|
+
try {
|
|
17
|
+
json = text ? JSON.parse(text) : null;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// A non-JSON answer is reported by status below.
|
|
21
|
+
}
|
|
22
|
+
return { status: res.status, json };
|
|
23
|
+
};
|
|
24
|
+
/** A 200 or a 409 is the server's answer; anything else is a failure to ask. */
|
|
25
|
+
const answer = (what, conversationId, { status, json }) => {
|
|
26
|
+
if (status === 200 || status === 409)
|
|
27
|
+
return json;
|
|
28
|
+
const error = json && typeof json === 'object' && 'error' in json ? String(json.error) : '';
|
|
29
|
+
throw new Error(`[agent-sdk] The realtime server could not ${what} conversation ${conversationId}: HTTP ${status} ${error}`.trim());
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
async hold(conversationId) {
|
|
33
|
+
const res = await call(conversationId, '/hold');
|
|
34
|
+
if (res.status === 204)
|
|
35
|
+
return null;
|
|
36
|
+
return answer('read the hold of', conversationId, res);
|
|
37
|
+
},
|
|
38
|
+
async takeOver(conversationId, request) {
|
|
39
|
+
return answer('take over', conversationId, await call(conversationId, '/hold', request));
|
|
40
|
+
},
|
|
41
|
+
async handBack(conversationId, request) {
|
|
42
|
+
return answer('hand back', conversationId, await call(conversationId, '/hold/release', request));
|
|
43
|
+
},
|
|
44
|
+
async announce(conversationId, request) {
|
|
45
|
+
return answer('announce a message of', conversationId, await call(conversationId, '/messages', request));
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/conversations/client.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAmC1D,8GAA8G;AAC9G,MAAM,UAAU,4BAA4B,CAAC,MAAoC;IAC/E,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC/B,eAAe,CAAC,GAAG,EA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AAK,QAAQ,IAAI,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAE,IAA2B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACpH,MAAM,IAAI,KAAK,CAAC,6CAA6C,IAAI,iBAAiB,cAAc,UAAU,MAAM,IAAI,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IACtI,CAAC,CAAC;IAEF,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,cAAc;YACvB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;gBAAE,OAAO,IAAI,CAAC;YACpC,OAAO,MAAM,CAAmB,kBAAkB,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;QAC3E,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO;YACpC,OAAO,MAAM,CAAiB,WAAW,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3G,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO;YACpC,OAAO,MAAM,CAAiB,WAAW,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;QACnH,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO;YACpC,OAAO,MAAM,CAAwB,uBAAuB,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;QAClI,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/history.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* For a host that fits its stored history before a turn
|
|
2
|
+
* For a host that fits its stored history before a turn, or hands back the
|
|
3
|
+
* messages a turn stored (`@ouispec/agent-worker/history`).
|
|
3
4
|
*
|
|
4
5
|
* A module of its own, with nothing the turn runtime needs: a host's history
|
|
5
6
|
* code, and its tests, load this without loading the model SDK. It also answers
|
|
6
7
|
* a CommonJS resolver (`default`), which the package's other entries do not.
|
|
7
8
|
*/
|
|
9
|
+
import type { TurnHistoryMessage, TurnMessage } from './types.js';
|
|
8
10
|
export { answerWithoutState, STATE_AT_END } from './ui/page-state-at-end.js';
|
|
11
|
+
/**
|
|
12
|
+
* What a host hands back as history for the messages a turn stored: the
|
|
13
|
+
* worker's own `TurnMessage`s, in the `TurnHistoryMessage` form `getHistory`
|
|
14
|
+
* returns. A host that keeps the turn's messages as they were given needs
|
|
15
|
+
* nothing else; one that stores them in its own shape maps them the same way.
|
|
16
|
+
*/
|
|
17
|
+
export declare function historyOf(messages: readonly TurnMessage[]): TurnHistoryMessage[];
|
|
9
18
|
//# sourceMappingURL=history.d.ts.map
|
package/dist/history.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAElE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE7E;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,GAAG,kBAAkB,EAAE,CAchF"}
|
package/dist/history.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
export { answerWithoutState, STATE_AT_END } from './ui/page-state-at-end.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* A
|
|
5
|
-
*
|
|
6
|
-
* a CommonJS resolver (`default`), which the package's other entries do not.
|
|
3
|
+
* What a host hands back as history for the messages a turn stored: the
|
|
4
|
+
* worker's own `TurnMessage`s, in the `TurnHistoryMessage` form `getHistory`
|
|
5
|
+
* returns. A host that keeps the turn's messages as they were given needs
|
|
6
|
+
* nothing else; one that stores them in its own shape maps them the same way.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export function historyOf(messages) {
|
|
9
|
+
return messages.map((m) => {
|
|
10
|
+
if (m.role === 'assistant') {
|
|
11
|
+
return {
|
|
12
|
+
role: 'assistant',
|
|
13
|
+
content: m.content,
|
|
14
|
+
...(m.toolCalls?.length
|
|
15
|
+
? { tool_calls: m.toolCalls.map((c) => ({ id: c.id, type: 'function', function: { name: c.name, arguments: JSON.stringify(c.arguments) } })) }
|
|
16
|
+
: {}),
|
|
17
|
+
...(m.stopped ? { stopped: m.stopped } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return { role: 'tool', content: m.content ?? '', tool_call_id: m.toolCallId ?? '', ...(m.name ? { name: m.name } : {}) };
|
|
21
|
+
});
|
|
22
|
+
}
|
|
9
23
|
//# sourceMappingURL=history.js.map
|
package/dist/history.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgC;IACxD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAsB,EAAE;QAC5C,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC3B,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,MAAM;oBACrB,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE;oBAC9I,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC7C,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC,UAAU,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IAC3H,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* retries and timeouts, on Lambda + SQS or in a container.
|
|
8
8
|
*/
|
|
9
9
|
export type { AgentWorkerConfig, AgentTurnInput, AgentTurnResult, TurnMessage, TurnHistoryMessage, ToolCallRef, SystemPromptContext } from './types.js';
|
|
10
|
+
export { historyOf } from './history.js';
|
|
10
11
|
export type { RealtimeEmitAdapter } from './emit/types.js';
|
|
11
12
|
export { filterEmitAdapter } from './emit/filter.js';
|
|
12
13
|
export type { TurnEventFilter } from './emit/filter.js';
|
|
@@ -30,7 +31,7 @@ export type { ToolPolicy, ToolPolicyContext, ToolPolicyDecision } from './authz/
|
|
|
30
31
|
export { defaultToolPolicy, evaluateToolPolicySafe } from './authz/tool-policy.js';
|
|
31
32
|
export { createHttpApprovalStoreClient } from './approvals/client.js';
|
|
32
33
|
export type { ApprovalStoreClient, HttpApprovalStoreClientConfig } from './approvals/client.js';
|
|
33
|
-
export { approvalRequirement, APPROVAL_TOOL_NOTE } from './approvals/requirement.js';
|
|
34
|
+
export { approvalRequirement, approvalToolNote, APPROVAL_TOOL_NOTE, READBACK_APPROVAL_TOOL_NOTE, SCREEN_APPROVAL_TOOL_NOTE, VOICE_APPROVAL_CHANNELS, } from './approvals/requirement.js';
|
|
34
35
|
export type { ApprovalRequirement } from './approvals/requirement.js';
|
|
35
36
|
export { buildApprovalPreview } from './approvals/preview.js';
|
|
36
37
|
export { readHostPreview, readValidation, MAX_VALIDATION_ERROR_CHARS } from './approvals/hooks.js';
|
|
@@ -38,6 +39,8 @@ export type { ApprovalHookContext, ApprovalPreviewContext, ApprovalPreviewHook,
|
|
|
38
39
|
export { createHttpTurnStopClient, watchTurnStop, withLocalStop, stopOf, TurnStopped, DEFAULT_STOP_GRACE_MS } from './stop/turn-stop.js';
|
|
39
40
|
export type { TurnStopClient, HttpTurnStopClientConfig, TurnStopWatch, TurnStopState } from './stop/turn-stop.js';
|
|
40
41
|
export { stoppedTurnMessages } from './stop/partial.js';
|
|
42
|
+
export { createHttpConversationClient } from './conversations/client.js';
|
|
43
|
+
export type { ConversationClient, HttpConversationClientConfig } from './conversations/client.js';
|
|
41
44
|
export type { AttachmentStore, AttachmentStoreCallOptions, AttachmentOwner, AttachmentLoadAs, AttachmentContent, AttachmentWorkerConfig } from './attachments/store.js';
|
|
42
45
|
export { AttachmentGuard, type AttachmentUsage, type GuardedPart, type AttachmentCap } from './attachments/guard.js';
|
|
43
46
|
export { attachmentTools, ATTACHMENT_TOOLS, ATTACHMENT_TOOL_CLASS } from './attachments/tools.js';
|
|
@@ -66,7 +69,7 @@ export { createHttpEmitAdapter } from './emit/http-adapter.js';
|
|
|
66
69
|
export type { HttpEmitAdapterConfig } from './emit/http-adapter.js';
|
|
67
70
|
export { teeEmitAdapter } from './emit/tee.js';
|
|
68
71
|
export type { TurnEventObserver } from './emit/tee.js';
|
|
69
|
-
export { createAgentTurnRunner, categorizeError, payloadRefusal, TURN_DEADLINE_EXCEEDED } from './runtime/turn-runner.js';
|
|
72
|
+
export { createAgentTurnRunner, categorizeError, hostSystemPrompt, payloadRefusal, TURN_DEADLINE_EXCEEDED } from './runtime/turn-runner.js';
|
|
70
73
|
export type { AgentTurnRunner, TurnHost, TurnOutcome, CategorizedError } from './runtime/turn-runner.js';
|
|
71
74
|
export { assertAgentRuntimeConfig } from './runtime/config.js';
|
|
72
75
|
export { turnInfoOf, DEFAULT_TURN_CHANNEL } from './runtime/turn-info.js';
|
|
@@ -75,8 +78,8 @@ export type { AgentRuntimeConfig, LambdaAgentConfig, AgentTurnPayload, HistoryRe
|
|
|
75
78
|
export { createLambdaAgentHandler } from './lambda/handler.js';
|
|
76
79
|
export { startContainerAgentWorker, DEFAULT_LIVE_CALL_PATH } from './container/server.js';
|
|
77
80
|
export type { ContainerAgentConfig, ContainerAgentWorker, ContainerLiveCallRoute } from './container/server.js';
|
|
78
|
-
export { createLiveCallTurnHandler, LIVE_CALL_SPEECH, LIVE_CALL_CHANNEL } from './live-call/handler.js';
|
|
79
|
-
export type { LiveCallSpeech, LiveCallTurnHandler, LiveCallTurnHandlerConfig, LiveCallTurnOptions, LiveCallTurnTarget, LiveCallTurnCallContext, } from './live-call/handler.js';
|
|
81
|
+
export { createLiveCallTurnHandler, LIVE_CALL_SPEECH, LIVE_CALL_CHANNEL, LIVE_CALL_APPROVAL_CHANNELS } from './live-call/handler.js';
|
|
82
|
+
export type { LiveCallSpeech, LiveCallApprovalChannel, LiveCallTurnHandler, LiveCallTurnHandlerConfig, LiveCallTurnOptions, LiveCallTurnTarget, LiveCallTurnCallContext, } from './live-call/handler.js';
|
|
80
83
|
export { readLiveCallTurnRequest, liveCallError, LIVE_CALL_TURN_KINDS, LIVE_CALL_OPENING_MESSAGE, liveCallOpeningMessage, LIVE_CALL_TYPED_INPUT_MODE, LIVE_CALL_LIMITS, LIVE_CALL_ERROR_MESSAGES, } from './live-call/protocol.js';
|
|
81
84
|
export type { LiveCallTurnKind, LiveCallTurnRequest, LiveCallStreamEvents, LiveCallStreamEventName, LiveCallRequestReading, } from './live-call/protocol.js';
|
|
82
85
|
export { DEFAULT_KEEP_ALIVE_MS as LIVE_CALL_KEEP_ALIVE_MS } from './live-call/event-stream.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACxJ,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAClI,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACzE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,MAA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EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* The worker handles: the multi-round tool loop, UI actions, streaming,
|
|
7
7
|
* retries and timeouts, on Lambda + SQS or in a container.
|
|
8
8
|
*/
|
|
9
|
+
export { historyOf } from './history.js';
|
|
9
10
|
export { filterEmitAdapter } from './emit/filter.js';
|
|
10
11
|
export { createToolRegistry } from './tools/types.js';
|
|
11
12
|
export { loadToolsFromSchema } from './tools/schema-loader.js';
|
|
@@ -23,7 +24,7 @@ export { defaultToolPolicy, evaluateToolPolicySafe } from './authz/tool-policy.j
|
|
|
23
24
|
// Approvals: an irreversible action runs only on an approval the
|
|
24
25
|
// user gave, bound to the call, kept by the realtime server's approval store.
|
|
25
26
|
export { createHttpApprovalStoreClient } from './approvals/client.js';
|
|
26
|
-
export { approvalRequirement, APPROVAL_TOOL_NOTE } from './approvals/requirement.js';
|
|
27
|
+
export { approvalRequirement, approvalToolNote, APPROVAL_TOOL_NOTE, READBACK_APPROVAL_TOOL_NOTE, SCREEN_APPROVAL_TOOL_NOTE, VOICE_APPROVAL_CHANNELS, } from './approvals/requirement.js';
|
|
27
28
|
export { buildApprovalPreview } from './approvals/preview.js';
|
|
28
29
|
// The host's say before an approval is asked for: a check, and the display copy.
|
|
29
30
|
export { readHostPreview, readValidation, MAX_VALIDATION_ERROR_CHARS } from './approvals/hooks.js';
|
|
@@ -32,6 +33,9 @@ export { readHostPreview, readValidation, MAX_VALIDATION_ERROR_CHARS } from './a
|
|
|
32
33
|
// turn. What the turn had produced is stored, then announced.
|
|
33
34
|
export { createHttpTurnStopClient, watchTurnStop, withLocalStop, stopOf, TurnStopped, DEFAULT_STOP_GRACE_MS } from './stop/turn-stop.js';
|
|
34
35
|
export { stoppedTurnMessages } from './stop/partial.js';
|
|
36
|
+
// A person takes a conversation over and hands it back: the product API's client for the
|
|
37
|
+
// realtime server's conversation routes.
|
|
38
|
+
export { createHttpConversationClient } from './conversations/client.js';
|
|
35
39
|
export { AttachmentGuard } from './attachments/guard.js';
|
|
36
40
|
export { attachmentTools, ATTACHMENT_TOOLS, ATTACHMENT_TOOL_CLASS } from './attachments/tools.js';
|
|
37
41
|
export { VIEW_TOOL as ATTACHMENT_VIEW_TOOL, READ_TOOL as ATTACHMENT_READ_TOOL, LIST_TOOL as ATTACHMENT_LIST_TOOL, ATTACHMENT_DATA_NOTE, escapeAttachmentText, } from './attachments/content.js';
|
|
@@ -53,14 +57,14 @@ export { defaultTurnPolicy } from './turn-policy.js';
|
|
|
53
57
|
export { createHttpEmitAdapter } from './emit/http-adapter.js';
|
|
54
58
|
export { teeEmitAdapter } from './emit/tee.js';
|
|
55
59
|
// The runtime: one core, two host adapters (Lambda + SQS, container)
|
|
56
|
-
export { createAgentTurnRunner, categorizeError, payloadRefusal, TURN_DEADLINE_EXCEEDED } from './runtime/turn-runner.js';
|
|
60
|
+
export { createAgentTurnRunner, categorizeError, hostSystemPrompt, payloadRefusal, TURN_DEADLINE_EXCEEDED } from './runtime/turn-runner.js';
|
|
57
61
|
export { assertAgentRuntimeConfig } from './runtime/config.js';
|
|
58
62
|
export { turnInfoOf, DEFAULT_TURN_CHANNEL } from './runtime/turn-info.js';
|
|
59
63
|
export { createLambdaAgentHandler } from './lambda/handler.js';
|
|
60
64
|
export { startContainerAgentWorker, DEFAULT_LIVE_CALL_PATH } from './container/server.js';
|
|
61
65
|
// Live calls: the call service's turns, answered by the product's own agent as
|
|
62
66
|
// a server-sent event stream, while the turn streams to its room as any turn does.
|
|
63
|
-
export { createLiveCallTurnHandler, LIVE_CALL_SPEECH, LIVE_CALL_CHANNEL } from './live-call/handler.js';
|
|
67
|
+
export { createLiveCallTurnHandler, LIVE_CALL_SPEECH, LIVE_CALL_CHANNEL, LIVE_CALL_APPROVAL_CHANNELS } from './live-call/handler.js';
|
|
64
68
|
export { readLiveCallTurnRequest, liveCallError, LIVE_CALL_TURN_KINDS, LIVE_CALL_OPENING_MESSAGE, liveCallOpeningMessage, LIVE_CALL_TYPED_INPUT_MODE, LIVE_CALL_LIMITS, LIVE_CALL_ERROR_MESSAGES, } from './live-call/protocol.js';
|
|
65
69
|
export { DEFAULT_KEEP_ALIVE_MS as LIVE_CALL_KEEP_ALIVE_MS } from './live-call/event-stream.js';
|
|
66
70
|
// Prompt Framework
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,oDAAoD;AACpD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,oEAAoE;AACpE,iEAAiE;AACjE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAkB/F,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEnF,iEAAiE;AACjE,8EAA8E;AAC9E,OAAO,E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AgB,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAUrI,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,0BAA0B,EAC1B,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAE,qBAAqB,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE/F,mBAAmB;AACnB,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAU3D,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -31,12 +31,22 @@ export interface LiveCallTurnTarget {
|
|
|
31
31
|
/**
|
|
32
32
|
* The decision on an approval the agent read back, when the host takes this
|
|
33
33
|
* message as the answer to it: the host classified the person's words, and
|
|
34
|
-
* decided as the user (`ApprovalStoreClient.decide` with
|
|
35
|
-
* channel). With `approve`, its `token`: the turn redeems it and runs
|
|
34
|
+
* decided as the user (`ApprovalStoreClient.decide` with the target's
|
|
35
|
+
* `channel`). With `approve`, its `token`: the turn redeems it and runs
|
|
36
36
|
* exactly the stored call.
|
|
37
37
|
*/
|
|
38
38
|
approval?: ApprovalContinuation;
|
|
39
|
+
/**
|
|
40
|
+
* The conversation channel the call is, for approvals: `voice` (the
|
|
41
|
+
* default: a call in the product's page) or `phone` (a call through a
|
|
42
|
+
* carrier). Either way a call that needs approval is read back and the
|
|
43
|
+
* person's next words confirm it; decide on it with this channel.
|
|
44
|
+
*/
|
|
45
|
+
channel?: LiveCallApprovalChannel;
|
|
39
46
|
}
|
|
47
|
+
/** The approval channels a live call can be: it is always spoken. */
|
|
48
|
+
export declare const LIVE_CALL_APPROVAL_CHANNELS: readonly ["voice", "phone"];
|
|
49
|
+
export type LiveCallApprovalChannel = (typeof LIVE_CALL_APPROVAL_CHANNELS)[number];
|
|
40
50
|
/** What the host's callbacks are told beside the request. */
|
|
41
51
|
export interface LiveCallTurnCallContext {
|
|
42
52
|
/** Aborts when the call service closes the connection: the person spoke again. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/live-call/handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/live-call/handler.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAKL,KAAK,oBAAoB,EAE1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAkB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEnG,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAI3E,OAAO,EAA6F,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpJ,yGAAyG;AACzG,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,cAAc,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,kHAAkH;IAClH,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,uBAAuB,CAAC;CACnC;AAED,qEAAqE;AACrE,eAAO,MAAM,2BAA2B,6BAAmE,CAAC;AAE5G,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,2BA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