@pouchy_ai/companion-sdk 0.50.1 → 0.51.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/CHANGELOG.md +33 -0
- package/README.md +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +32 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +1 -0
- package/dist/protocol.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/protocol.ts +33 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,39 @@ for backwards-compatible fixes and additions. The wire protocol has its own
|
|
|
10
10
|
version (`PROTOCOL_VERSION`, currently `1`) guarded by `protocol.drift.test.ts`;
|
|
11
11
|
a protocol bump is always called out explicitly here.
|
|
12
12
|
|
|
13
|
+
## [0.51.0]
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **`companion.skill_card` — a skill's own card, delivered to the host.** When
|
|
18
|
+
the companion runs a tool of an installed skill whose author declared a
|
|
19
|
+
`card_template`, the rendered card now arrives on the event stream as
|
|
20
|
+
`{ skill, tool, markdown }`. Subscribe with
|
|
21
|
+
`client.on('companion.skill_card', …)`; the payload type is exported as
|
|
22
|
+
`SkillCardPayload`.
|
|
23
|
+
|
|
24
|
+
This closes a gap where the manifest field was parsed, safety-reviewed and
|
|
25
|
+
rendered on the first-party client while reaching the platform plane nowhere
|
|
26
|
+
at all — so a skill author's card passed every install gate and then did
|
|
27
|
+
nothing, with no error, for every embed consumer. Integrators had been
|
|
28
|
+
teaching the model to emit a text marker and regexing it back out of the
|
|
29
|
+
reply; this replaces that with a shape the skill's author declared.
|
|
30
|
+
|
|
31
|
+
It is deliberately **not** an open payload channel: the bytes are bounded by
|
|
32
|
+
the author's template and the install review, substituted against that
|
|
33
|
+
skill's own HTTP response. The model chooses whether a tool runs, never the
|
|
34
|
+
shape of what is delivered.
|
|
35
|
+
|
|
36
|
+
`markdown` is TEXT, not HTML — a host handed HTML tends to `innerHTML` it,
|
|
37
|
+
and the non-web SDKs cannot use it. Placeholders the response did not fill
|
|
38
|
+
are stripped. Requires the `skills.execute` scope (the same scope that let
|
|
39
|
+
the call happen); a handler that never fires means the skill ships no
|
|
40
|
+
template, not that the call failed.
|
|
41
|
+
|
|
42
|
+
Additive and backwards compatible: existing handlers, sessions and skills are
|
|
43
|
+
unaffected, and an SDK build that does not know the type keeps it as a raw
|
|
44
|
+
envelope.
|
|
45
|
+
|
|
13
46
|
## [0.50.1]
|
|
14
47
|
|
|
15
48
|
- **A representative session's offline queue is now scoped to its visitor.** The
|
package/README.md
CHANGED
|
@@ -154,6 +154,7 @@ type-checks without a cast; `'*'` keeps the untyped envelope:
|
|
|
154
154
|
| `onVoiceInject(fn)` | `companion.voice_inject` | `fn({text, speak})` — a `voiceRelevant` world-state line to say aloud during a live call; route `text` to your voice session when `speak` |
|
|
155
155
|
| `onTyping(fn)` | `companion.typing` | activity indicator — `fn({active})` fires `true` when a turn starts working and `false` when it finishes / pauses, spanning the tool-loop / thinking phase before the first text delta. Drive a "typing…" state |
|
|
156
156
|
| `on('companion.data_activity', fn)` | `companion.data_activity` | metadata-only Data-plane activity (0.44.0) — the agent read a View or settled an Action: `{ kind, capability, outcome, ms, actionId? }`. Never rows or intent values; an action `outcome: "unknown"` means pending verification — never render it as success or failure. Requires the `data.activity` scope (granted from the agent's Data flag) |
|
|
157
|
+
| `on('companion.skill_card', fn)` | `companion.skill_card` | a skill's own card, rendered (0.51.0) — the companion ran a tool of an installed skill whose author declared a `card_template`: `{ skill, tool, markdown }`. The shape comes from the skill's manifest and its install review, not from the model, so this is a declared shape delivered to you rather than prose to parse. `markdown` is TEXT, not HTML; unfilled placeholders are already stripped. Requires the `skills.execute` scope; a handler that never fires means the skill ships no template, not that the call failed |
|
|
157
158
|
| `on('control.call_ready', fn)` | `control.call_ready` | a voice call is ready — the stream echo of `startCall`'s accept. Deliberately **secret-free** (`{ provider, agentId/model, voice, … }` — the actual WebRTC credentials only ride the `startCall` HTTP response); useful for UI state on surfaces that didn't initiate the call |
|
|
158
159
|
| `onUsage(fn)` | `control.usage` | per-token metering echo. _(reserved — not emitted yet)_ |
|
|
159
160
|
| `onError(fn)` | `control.error` | agent / stream errors — `agent_error` (server-side turn failed after accept; safe to re-send), `call_mint_failed` (voice-credential mint failed — retry later or fall back to text) or the SDK-synthesized `stream_unauthorized` (stream 401 exhausted the `onAuthError` refresh retries, or the stream got a 403 — immediately terminal, commonly a token missing the `events.subscribe` scope; refresh/fix the token, `start()` again). Since 0.30.0 the vocabulary is EXPORTED TYPED: `CONTROL_ERROR_CODES` (runtime list, drift-tested against the server) + the `ControlErrorCodeValue` union `fn`'s `err.code` now carries — `switch` on it with autocomplete |
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type { CompanionCall, CompanionCallOptions, VoiceToolBridge } from './cal
|
|
|
8
8
|
export { VOICE_TOOL_VARIABLE, VOICE_TOOL_VARIABLE_PLAIN, VOICE_TOOL_HEADER_PLAIN } from './voice-tool.js';
|
|
9
9
|
export { COMPANION_SCOPES, COMPANION_MODALITIES, SENSITIVE_SCOPES, REPRESENT_SCOPES, DEFAULT_SCOPES, DEFAULT_MODALITIES, isSensitiveScope, isRepresentScope, hasScope, grantsScope } from './scopes.js';
|
|
10
10
|
export type { CompanionScope, CompanionModality } from './scopes.js';
|
|
11
|
-
export type { CompanionEnvelope, OutboundType, InboundType, WorldStateEvent, RenderInterfacePayload, InterfaceUpdatePayload, SocialMessagePayload, DataActivityPayload, ConfirmRequestPayload, PendingConfirm, PendingToolCall, ToolCallPayload, AudioClipPayload, ExpressionPayload, TypingPayload, VoiceInjectPayload, UsagePayload, MessagePayload, ControlErrorPayload, HelloAckPayload, CallReadyPayload, OutboundPayloadMap } from './protocol.js';
|
|
11
|
+
export type { CompanionEnvelope, OutboundType, InboundType, WorldStateEvent, RenderInterfacePayload, InterfaceUpdatePayload, SocialMessagePayload, DataActivityPayload, SkillCardPayload, ConfirmRequestPayload, PendingConfirm, PendingToolCall, ToolCallPayload, AudioClipPayload, ExpressionPayload, TypingPayload, VoiceInjectPayload, UsagePayload, MessagePayload, ControlErrorPayload, HelloAckPayload, CallReadyPayload, OutboundPayloadMap } from './protocol.js';
|
|
12
12
|
export { PROTOCOL_VERSION, INBOUND_TYPES, OUTBOUND_TYPES, COMPANION_ERROR_CODES, CONTROL_ERROR_CODES } from './protocol.js';
|
|
13
13
|
export type { CompanionErrorCode, ControlErrorCode } from './protocol.js';
|
|
14
14
|
export { toA2UI, fromA2UI, INSTANT_UI_NODE_TYPES } from './a2ui.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAExE,OAAO,EACN,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,0BAA0B,EAC1B,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC/E,YAAY,EACX,sBAAsB,EACtB,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,WAAW,EACX,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,eA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eAAe,CAE7E"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAExE,OAAO,EACN,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,0BAA0B,EAC1B,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC/E,YAAY,EACX,sBAAsB,EACtB,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,WAAW,EACX,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAInF,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvG,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClE,YAAY,EACX,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,MAAM,YAAY,CAAC;AAKpB,OAAO,EACN,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMvE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AACjE,YAAY,EACX,WAAW,EACX,aAAa,EACb,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,MAAM,QAAQ,CAAC;AAMhB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EACX,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,MAAM,gBAAgB,CAAC;AAExB,iCAAiC;AACjC,wBAAgB,eAAe,CAAC,IAAI,EAAE,sBAAsB,GAAG,eAAe,CAE7E"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,yEAAyE;AACzE,sDAAsD;AACtD,EAAE;AACF,0DAA0D;AAC1D,6EAA6E;AAC7E,uBAAuB;AACvB,8CAA8C;AAC9C,eAAe;AACf,8EAA8E;AAC9E,2CAA2C;AAE3C,OAAO,EAAE,eAAe,EAA+B,MAAM,UAAU,CAAC;AAExE,OAAO,EACN,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,0BAA0B,EAC1B,MAAM,UAAU,CAAC;AAsBlB,OAAO,E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E,gEAAgE;AAChE,OAAO,EACN,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,YAAY,CAAC;AAGpB,+EAA+E;AAC/E,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAWjE,6EAA6E;AAC7E,6EAA6E;AAC7E,0EAA0E;AAC1E,+BAA+B;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAQrD,iCAAiC;AACjC,MAAM,UAAU,eAAe,CAAC,IAA4B;IAC3D,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type InboundType = (typeof INBOUND_TYPES)[number];
|
|
|
9
9
|
* that depends on them today. (companion.audio → non-call reply TTS;
|
|
10
10
|
* companion.expression → avatar viseme/expression cues; control.usage →
|
|
11
11
|
* per-turn usage-metering echo.) */
|
|
12
|
-
export declare const OUTBOUND_TYPES: readonly ["hello.ack", "companion.message", "companion.audio", "companion.tool_call", "companion.ui_action", "companion.ui_update", "companion.expression", "companion.voice_inject", "companion.confirm_request", "companion.social_message", "companion.typing", "companion.data_activity", "control.call_ready", "control.error", "control.usage"];
|
|
12
|
+
export declare const OUTBOUND_TYPES: readonly ["hello.ack", "companion.message", "companion.audio", "companion.tool_call", "companion.ui_action", "companion.ui_update", "companion.expression", "companion.voice_inject", "companion.confirm_request", "companion.social_message", "companion.typing", "companion.data_activity", "companion.skill_card", "control.call_ready", "control.error", "control.usage"];
|
|
13
13
|
export type OutboundType = (typeof OUTBOUND_TYPES)[number];
|
|
14
14
|
export type MessageType = InboundType | OutboundType;
|
|
15
15
|
/** `control.error` STREAM-plane code vocabulary (0.30.0) — a separate, smaller
|
|
@@ -290,6 +290,7 @@ export interface OutboundPayloadMap extends Record<OutboundType, unknown> {
|
|
|
290
290
|
'companion.social_message': SocialMessagePayload;
|
|
291
291
|
'companion.typing': TypingPayload;
|
|
292
292
|
'companion.data_activity': DataActivityPayload;
|
|
293
|
+
'companion.skill_card': SkillCardPayload;
|
|
293
294
|
'control.call_ready': CallReadyPayload;
|
|
294
295
|
'control.error': ControlErrorPayload;
|
|
295
296
|
'control.usage': UsagePayload;
|
|
@@ -302,6 +303,36 @@ export interface OutboundPayloadMap extends Record<OutboundType, unknown> {
|
|
|
302
303
|
* verification", not as success or failure. Emitted only when the session
|
|
303
304
|
* token carries the `data.activity` scope (granted from the agent template's
|
|
304
305
|
* Data flag). */
|
|
306
|
+
/** Payload of a `companion.skill_card` event — the rendered `card_template` of
|
|
307
|
+
* a skill whose tool the companion just ran server-side, so your app can show
|
|
308
|
+
* the result as a CARD instead of only hearing it described in the reply.
|
|
309
|
+
*
|
|
310
|
+
* The shape is bounded by the skill AUTHOR, not by the model: `card_template`
|
|
311
|
+
* is a manifest field written at authoring time, parsed and safety-reviewed at
|
|
312
|
+
* install. This event carries that template substituted against the skill's own
|
|
313
|
+
* HTTP response — it is a delivery channel for a declared shape, never an
|
|
314
|
+
* arbitrary payload the model can compose.
|
|
315
|
+
*
|
|
316
|
+
* `markdown` is TEXT, deliberately not HTML: a host handed HTML tends to put it
|
|
317
|
+
* in `innerHTML`, and the non-web SDKs cannot use it anyway. Render it with
|
|
318
|
+
* whatever markdown path your app already has. Placeholders the response did
|
|
319
|
+
* not fill are stripped, so a card never shows `{{price}}` to a user.
|
|
320
|
+
*
|
|
321
|
+
* Delivered only to sessions holding `skills.execute` — the scope that let the
|
|
322
|
+
* call happen — and only for skills whose author shipped a template, so a
|
|
323
|
+
* handler that never fires means "no template", not "no result".
|
|
324
|
+
*
|
|
325
|
+
* Ordering: like every outbound event it carries the session's monotonic `seq`,
|
|
326
|
+
* so it is totally ordered against the `companion.message` that describes it. */
|
|
327
|
+
export interface SkillCardPayload {
|
|
328
|
+
/** The installed skill's name, as the model named it. */
|
|
329
|
+
skill: string;
|
|
330
|
+
/** The tool of that skill which produced the response. */
|
|
331
|
+
tool: string;
|
|
332
|
+
/** The author's `card_template` with `{{placeholders}}` substituted from the
|
|
333
|
+
* response body. Markdown; unfilled placeholders removed. */
|
|
334
|
+
markdown: string;
|
|
335
|
+
}
|
|
305
336
|
export interface DataActivityPayload {
|
|
306
337
|
kind: 'view' | 'action';
|
|
307
338
|
capability: string;
|
package/dist/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAE3C,yCAAyC;AACzC,eAAO,MAAM,aAAa,0KAUhB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;qCAMqC;AACrC,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAE3C,yCAAyC;AACzC,eAAO,MAAM,aAAa,0KAUhB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;qCAMqC;AACrC,eAAO,MAAM,cAAc,+WAiBjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,YAAY,CAAC;AAErD;;;;;;oDAMoD;AACpD,eAAO,MAAM,mBAAmB,8CAGtB,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE;;;4EAG4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AC9B;AAED;;;;;;;kBAOkB;AAClB;;;;;;;;;;;;;;;;;;;;kFAoBkF;AAClF,MAAM,WAAW,gBAAgB;IAChC,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb;kEAC8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/protocol.js
CHANGED
|
@@ -37,6 +37,7 @@ export const OUTBOUND_TYPES = [
|
|
|
37
37
|
'companion.social_message',
|
|
38
38
|
'companion.typing',
|
|
39
39
|
'companion.data_activity', // metadata-only Data-plane activity (requires the data.activity scope)
|
|
40
|
+
'companion.skill_card', // a skill's own card_template rendered against its response (requires the skills.execute scope)
|
|
40
41
|
'control.call_ready',
|
|
41
42
|
'control.error',
|
|
42
43
|
'control.usage' // reserved — not emitted yet
|
package/dist/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+EAA+E;AAC/E,EAAE;AACF,mFAAmF;AACnF,iFAAiF;AACjF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAU,CAAC;AAE3C,yCAAyC;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,OAAO;IACP,YAAY;IACZ,eAAe;IACf,kBAAkB;IAClB,aAAa;IACb,oBAAoB;IACpB,kBAAkB;IAClB,wBAAwB;IACxB,cAAc;CACL,CAAC;AAGX;;;;;;qCAMqC;AACrC,MAAM,CAAC,MAAM,cAAc,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ai/companion-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "Embed the Pouchy companion \u2014 chat, voice, tools, memory, live world-state, instant UI, and agent-to-agent messaging \u2014 in any app, game, or site.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
package/src/index.ts
CHANGED
package/src/protocol.ts
CHANGED
|
@@ -41,6 +41,7 @@ export const OUTBOUND_TYPES = [
|
|
|
41
41
|
'companion.social_message',
|
|
42
42
|
'companion.typing',
|
|
43
43
|
'companion.data_activity', // metadata-only Data-plane activity (requires the data.activity scope)
|
|
44
|
+
'companion.skill_card', // a skill's own card_template rendered against its response (requires the skills.execute scope)
|
|
44
45
|
'control.call_ready',
|
|
45
46
|
'control.error',
|
|
46
47
|
'control.usage' // reserved — not emitted yet
|
|
@@ -363,6 +364,7 @@ export interface OutboundPayloadMap extends Record<OutboundType, unknown> {
|
|
|
363
364
|
'companion.social_message': SocialMessagePayload;
|
|
364
365
|
'companion.typing': TypingPayload;
|
|
365
366
|
'companion.data_activity': DataActivityPayload;
|
|
367
|
+
'companion.skill_card': SkillCardPayload;
|
|
366
368
|
'control.call_ready': CallReadyPayload;
|
|
367
369
|
'control.error': ControlErrorPayload;
|
|
368
370
|
'control.usage': UsagePayload;
|
|
@@ -376,6 +378,37 @@ export interface OutboundPayloadMap extends Record<OutboundType, unknown> {
|
|
|
376
378
|
* verification", not as success or failure. Emitted only when the session
|
|
377
379
|
* token carries the `data.activity` scope (granted from the agent template's
|
|
378
380
|
* Data flag). */
|
|
381
|
+
/** Payload of a `companion.skill_card` event — the rendered `card_template` of
|
|
382
|
+
* a skill whose tool the companion just ran server-side, so your app can show
|
|
383
|
+
* the result as a CARD instead of only hearing it described in the reply.
|
|
384
|
+
*
|
|
385
|
+
* The shape is bounded by the skill AUTHOR, not by the model: `card_template`
|
|
386
|
+
* is a manifest field written at authoring time, parsed and safety-reviewed at
|
|
387
|
+
* install. This event carries that template substituted against the skill's own
|
|
388
|
+
* HTTP response — it is a delivery channel for a declared shape, never an
|
|
389
|
+
* arbitrary payload the model can compose.
|
|
390
|
+
*
|
|
391
|
+
* `markdown` is TEXT, deliberately not HTML: a host handed HTML tends to put it
|
|
392
|
+
* in `innerHTML`, and the non-web SDKs cannot use it anyway. Render it with
|
|
393
|
+
* whatever markdown path your app already has. Placeholders the response did
|
|
394
|
+
* not fill are stripped, so a card never shows `{{price}}` to a user.
|
|
395
|
+
*
|
|
396
|
+
* Delivered only to sessions holding `skills.execute` — the scope that let the
|
|
397
|
+
* call happen — and only for skills whose author shipped a template, so a
|
|
398
|
+
* handler that never fires means "no template", not "no result".
|
|
399
|
+
*
|
|
400
|
+
* Ordering: like every outbound event it carries the session's monotonic `seq`,
|
|
401
|
+
* so it is totally ordered against the `companion.message` that describes it. */
|
|
402
|
+
export interface SkillCardPayload {
|
|
403
|
+
/** The installed skill's name, as the model named it. */
|
|
404
|
+
skill: string;
|
|
405
|
+
/** The tool of that skill which produced the response. */
|
|
406
|
+
tool: string;
|
|
407
|
+
/** The author's `card_template` with `{{placeholders}}` substituted from the
|
|
408
|
+
* response body. Markdown; unfilled placeholders removed. */
|
|
409
|
+
markdown: string;
|
|
410
|
+
}
|
|
411
|
+
|
|
379
412
|
export interface DataActivityPayload {
|
|
380
413
|
kind: 'view' | 'action';
|
|
381
414
|
capability: string;
|