@ouispec/agent-core 0.14.0 → 0.15.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * How the person entered a message.
2
+ * How the person entered a message, and how the reply reaches them.
3
3
  *
4
4
  * A message the person spoke, and the tab transcribed with speech
5
5
  * recognition, carries `{ mode: 'voice', language }` on its turn's context,
@@ -8,8 +8,13 @@
8
8
  * sense of may be a mis-hearing; the host stores it on the user's message so
9
9
  * the chat can show the message was spoken.
10
10
  *
11
- * It arrives from a browser, so every reader takes it through
12
- * `readMessageInput`, which keeps only what it recognises.
11
+ * A reply that will be spoken rather than shown (a live call, where a voice
12
+ * reads the reply out) carries `{ mode: 'voice' }` under `output`. The worker
13
+ * then tells the model to write for the ear.
14
+ *
15
+ * Both arrive from outside the worker, so every reader takes them through
16
+ * `readMessageInput` and `readReplyOutput`, which keep only what they
17
+ * recognise.
13
18
  */
14
19
  /** The key under a turn's context that carries how its message was entered. */
15
20
  export declare const MESSAGE_INPUT_CONTEXT_KEY = "input";
@@ -39,4 +44,19 @@ export declare function readMessageInputLanguage(value: unknown): string | null;
39
44
  * is left out, and the message is still read as spoken.
40
45
  */
41
46
  export declare function readMessageInput(value: unknown): MessageInput | null;
47
+ /** The key under a turn's context that carries how its reply reaches the person. */
48
+ export declare const REPLY_OUTPUT_CONTEXT_KEY = "output";
49
+ /** The ways a reply can reach the person besides being shown as text. A shown reply carries no `output`. */
50
+ export declare const REPLY_OUTPUT_MODES: readonly ["voice"];
51
+ export type ReplyOutputMode = (typeof REPLY_OUTPUT_MODES)[number];
52
+ /** A reply that will be spoken: a voice reads its text out, and nothing of it is shown. */
53
+ export interface ReplyOutput {
54
+ mode: ReplyOutputMode;
55
+ }
56
+ /**
57
+ * How a reply reaches the person, when `value` says so in a way this runtime
58
+ * knows; else null, and the reply is shown as text. Anything but the mode is
59
+ * left out.
60
+ */
61
+ export declare function readReplyOutput(value: unknown): ReplyOutput | null;
42
62
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/message-input/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAEjD,4FAA4F;AAC5F,eAAO,MAAM,mBAAmB,oBAAqB,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,kFAAkF;AAClF,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,mFAAmF;AACnF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAStE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAMpE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/message-input/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAEjD,4FAA4F;AAC5F,eAAO,MAAM,mBAAmB,oBAAqB,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,kFAAkF;AAClF,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,mFAAmF;AACnF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAStE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAMpE;AAED,oFAAoF;AACpF,eAAO,MAAM,wBAAwB,WAAW,CAAC;AAEjD,4GAA4G;AAC5G,eAAO,MAAM,kBAAkB,oBAAqB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,2FAA2F;AAC3F,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAKlE"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * How the person entered a message.
2
+ * How the person entered a message, and how the reply reaches them.
3
3
  *
4
4
  * A message the person spoke, and the tab transcribed with speech
5
5
  * recognition, carries `{ mode: 'voice', language }` on its turn's context,
@@ -8,8 +8,13 @@
8
8
  * sense of may be a mis-hearing; the host stores it on the user's message so
9
9
  * the chat can show the message was spoken.
10
10
  *
11
- * It arrives from a browser, so every reader takes it through
12
- * `readMessageInput`, which keeps only what it recognises.
11
+ * A reply that will be spoken rather than shown (a live call, where a voice
12
+ * reads the reply out) carries `{ mode: 'voice' }` under `output`. The worker
13
+ * then tells the model to write for the ear.
14
+ *
15
+ * Both arrive from outside the worker, so every reader takes them through
16
+ * `readMessageInput` and `readReplyOutput`, which keep only what they
17
+ * recognise.
13
18
  */
14
19
  /** The key under a turn's context that carries how its message was entered. */
15
20
  export const MESSAGE_INPUT_CONTEXT_KEY = 'input';
@@ -51,4 +56,21 @@ export function readMessageInput(value) {
51
56
  const tag = readMessageInputLanguage(language);
52
57
  return { mode: mode, ...(tag ? { language: tag } : {}) };
53
58
  }
59
+ /** The key under a turn's context that carries how its reply reaches the person. */
60
+ export const REPLY_OUTPUT_CONTEXT_KEY = 'output';
61
+ /** The ways a reply can reach the person besides being shown as text. A shown reply carries no `output`. */
62
+ export const REPLY_OUTPUT_MODES = ['voice'];
63
+ /**
64
+ * How a reply reaches the person, when `value` says so in a way this runtime
65
+ * knows; else null, and the reply is shown as text. Anything but the mode is
66
+ * left out.
67
+ */
68
+ export function readReplyOutput(value) {
69
+ if (!value || typeof value !== 'object' || Array.isArray(value))
70
+ return null;
71
+ const { mode } = value;
72
+ if (typeof mode !== 'string' || !REPLY_OUTPUT_MODES.includes(mode))
73
+ return null;
74
+ return { mode: mode };
75
+ }
54
76
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/message-input/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAC;AAEjD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAO,CAAU,CAAC;AAItD,kFAAkF;AAClF,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAYnD,uFAAuF;AACvF,MAAM,YAAY,GAAG,uCAAuC,CAAC;AAE7D;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,gCAAgC;QAAE,OAAO,IAAI,CAAC;IACpH,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3C,IAAI,CAAC;QACH,8EAA8E;QAC9E,OAAO,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;A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,IAAI,CAAC;IACvG,OAAO,EAAE,IAAI,EAAE,IAAuB,EAAE,CAAC;AAC3C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouispec/agent-core",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Schema types, entity graph, intent resolution, and protocol definitions for the agent SDK",
5
5
  "homepage": "https://github.com/wesreid/oui/tree/main/packages/agent-core#readme",
6
6
  "bugs": {
@@ -30,8 +30,8 @@
30
30
  "dependencies": {
31
31
  "ajv": "^8.17.0",
32
32
  "yaml": "^2.7.0",
33
- "@ouispec/agent-events": "^0.14.0",
34
33
  "@ouispec/contract": "^0.4.6",
34
+ "@ouispec/agent-events": "^0.14.0",
35
35
  "oui-spec": "^0.11.1"
36
36
  },
37
37
  "devDependencies": {