@otto-code/protocol 0.8.10 → 0.8.13

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.
Files changed (83) hide show
  1. package/dist/agent-labels.d.ts +3 -0
  2. package/dist/agent-labels.js +10 -0
  3. package/dist/agent-personalities.d.ts +4 -3
  4. package/dist/agent-personalities.js +13 -20
  5. package/dist/agent-queue.d.ts +87 -0
  6. package/dist/agent-queue.js +106 -0
  7. package/dist/agent-types.d.ts +24 -4
  8. package/dist/binary-frames/terminal.d.ts +4 -0
  9. package/dist/binary-frames/terminal.js +1 -0
  10. package/dist/brain.d.ts +2412 -0
  11. package/dist/brain.js +1100 -0
  12. package/dist/chat/rpc-schemas.js +1 -0
  13. package/dist/chat/types.js +1 -0
  14. package/dist/client-capabilities.d.ts +3 -0
  15. package/dist/client-capabilities.js +14 -0
  16. package/dist/code-intelligence.d.ts +917 -0
  17. package/dist/code-intelligence.js +699 -0
  18. package/dist/communications.d.ts +1106 -0
  19. package/dist/communications.js +384 -0
  20. package/dist/context.d.ts +787 -0
  21. package/dist/context.js +295 -0
  22. package/dist/daemon-config.d.ts +383 -0
  23. package/dist/daemon-config.js +401 -0
  24. package/dist/file-operations.d.ts +380 -0
  25. package/dist/file-operations.js +282 -0
  26. package/dist/generated/validation/ws-outbound.aot.js +67260 -57392
  27. package/dist/git-hosting.d.ts +117 -0
  28. package/dist/git-hosting.js +109 -0
  29. package/dist/git-operations.d.ts +255 -0
  30. package/dist/git-operations.js +221 -0
  31. package/dist/integration-authorization.d.ts +195 -0
  32. package/dist/integration-authorization.js +125 -0
  33. package/dist/kanban.d.ts +341 -0
  34. package/dist/kanban.js +273 -0
  35. package/dist/loop/rpc-schemas.d.ts +6 -6
  36. package/dist/loop/rpc-schemas.js +1 -0
  37. package/dist/meetings.d.ts +95 -0
  38. package/dist/meetings.js +57 -0
  39. package/dist/messages.d.ts +11175 -11039
  40. package/dist/messages.js +4756 -8700
  41. package/dist/orchestration.d.ts +726 -0
  42. package/dist/orchestration.js +232 -0
  43. package/dist/personality-schemas.d.ts +221 -0
  44. package/dist/personality-schemas.js +340 -0
  45. package/dist/preview.d.ts +140 -0
  46. package/dist/preview.js +98 -0
  47. package/dist/project-knowledge.d.ts +740 -0
  48. package/dist/project-knowledge.js +229 -0
  49. package/dist/project-links.d.ts +102 -0
  50. package/dist/project-links.js +62 -0
  51. package/dist/provider-config.d.ts +87 -2
  52. package/dist/provider-config.js +110 -0
  53. package/dist/provider-manifest.js +7 -0
  54. package/dist/provider-snapshot-codec.d.ts +18 -0
  55. package/dist/provider-snapshot-codec.js +71 -0
  56. package/dist/refine.d.ts +93 -0
  57. package/dist/refine.js +78 -0
  58. package/dist/schedule/rpc-schemas.d.ts +55 -111
  59. package/dist/schedule/types.d.ts +16 -37
  60. package/dist/schedule/types.js +1 -11
  61. package/dist/search/text-match.d.ts +55 -0
  62. package/dist/search/text-match.js +262 -0
  63. package/dist/speech.d.ts +180 -0
  64. package/dist/speech.js +177 -0
  65. package/dist/storage.d.ts +79 -0
  66. package/dist/storage.js +107 -0
  67. package/dist/suggested-tasks.d.ts +106 -0
  68. package/dist/suggested-tasks.js +81 -0
  69. package/dist/terminal-compatibility.d.ts +55 -0
  70. package/dist/terminal-compatibility.js +35 -0
  71. package/dist/terminal-input-mode.d.ts +4 -0
  72. package/dist/terminal-input-mode.js +35 -6
  73. package/dist/terminal-key-input.js +15 -6
  74. package/dist/terminal-profiles.d.ts +35 -0
  75. package/dist/terminal-profiles.js +246 -4
  76. package/dist/tool-call-display.d.ts +2 -2
  77. package/dist/tool-call-display.js +6 -6
  78. package/dist/usage-stats.d.ts +255 -0
  79. package/dist/usage-stats.js +162 -0
  80. package/dist/validation/ws-outbound-schema-metadata.d.ts +1906 -266
  81. package/dist/worktree-ops.d.ts +81 -0
  82. package/dist/worktree-ops.js +88 -0
  83. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  export declare const ScheduleStatusSchema: z.ZodEnum<{
3
- paused: "paused";
4
3
  completed: "completed";
5
4
  active: "active";
5
+ paused: "paused";
6
6
  }>;
7
7
  export type ScheduleStatus = z.infer<typeof ScheduleStatusSchema>;
8
8
  export declare const ScheduleCadenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -32,15 +32,8 @@ export declare const ScheduleTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
32
32
  local: "local";
33
33
  }>>;
34
34
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
- approvalPolicy: z.ZodOptional<z.ZodString>;
36
- sandboxMode: z.ZodOptional<z.ZodString>;
37
- networkAccess: z.ZodOptional<z.ZodBoolean>;
38
- webSearch: z.ZodOptional<z.ZodBoolean>;
35
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
39
36
  featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
40
- extra: z.ZodOptional<z.ZodObject<{
41
- codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
42
- claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
43
- }, z.core.$strip>>;
44
37
  systemPrompt: z.ZodOptional<z.ZodString>;
45
38
  mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
46
39
  }, z.core.$strip>;
@@ -95,23 +88,16 @@ export declare const StoredScheduleSchema: z.ZodObject<{
95
88
  local: "local";
96
89
  }>>;
97
90
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
- approvalPolicy: z.ZodOptional<z.ZodString>;
99
- sandboxMode: z.ZodOptional<z.ZodString>;
100
- networkAccess: z.ZodOptional<z.ZodBoolean>;
101
- webSearch: z.ZodOptional<z.ZodBoolean>;
91
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
102
92
  featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
103
- extra: z.ZodOptional<z.ZodObject<{
104
- codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
105
- claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
106
- }, z.core.$strip>>;
107
93
  systemPrompt: z.ZodOptional<z.ZodString>;
108
94
  mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
109
95
  }, z.core.$strip>;
110
96
  }, z.core.$strip>], "type">;
111
97
  status: z.ZodEnum<{
112
- paused: "paused";
113
98
  completed: "completed";
114
99
  active: "active";
100
+ paused: "paused";
115
101
  }>;
116
102
  createdAt: z.ZodString;
117
103
  updatedAt: z.ZodString;
@@ -152,22 +138,14 @@ export declare const ScheduleSummarySchema: z.ZodObject<{
152
138
  prompt: z.ZodString;
153
139
  name: z.ZodNullable<z.ZodString>;
154
140
  id: z.ZodString;
141
+ createdAt: z.ZodString;
142
+ updatedAt: z.ZodString;
155
143
  status: z.ZodEnum<{
156
- paused: "paused";
157
144
  completed: "completed";
158
145
  active: "active";
146
+ paused: "paused";
159
147
  }>;
160
- createdAt: z.ZodString;
161
- updatedAt: z.ZodString;
162
148
  expiresAt: z.ZodNullable<z.ZodString>;
163
- cadence: z.ZodDiscriminatedUnion<[z.ZodObject<{
164
- type: z.ZodLiteral<"every">;
165
- everyMs: z.ZodNumber;
166
- }, z.core.$strip>, z.ZodObject<{
167
- type: z.ZodLiteral<"cron">;
168
- expression: z.ZodString;
169
- timezone: z.ZodOptional<z.ZodString>;
170
- }, z.core.$strip>], "type">;
171
149
  target: z.ZodDiscriminatedUnion<[z.ZodObject<{
172
150
  type: z.ZodLiteral<"agent">;
173
151
  agentId: z.ZodGUID;
@@ -186,19 +164,20 @@ export declare const ScheduleSummarySchema: z.ZodObject<{
186
164
  local: "local";
187
165
  }>>;
188
166
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
189
- approvalPolicy: z.ZodOptional<z.ZodString>;
190
- sandboxMode: z.ZodOptional<z.ZodString>;
191
- networkAccess: z.ZodOptional<z.ZodBoolean>;
192
- webSearch: z.ZodOptional<z.ZodBoolean>;
167
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
193
168
  featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
194
- extra: z.ZodOptional<z.ZodObject<{
195
- codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
196
- claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
197
- }, z.core.$strip>>;
198
169
  systemPrompt: z.ZodOptional<z.ZodString>;
199
170
  mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
200
171
  }, z.core.$strip>;
201
172
  }, z.core.$strip>], "type">;
173
+ cadence: z.ZodDiscriminatedUnion<[z.ZodObject<{
174
+ type: z.ZodLiteral<"every">;
175
+ everyMs: z.ZodNumber;
176
+ }, z.core.$strip>, z.ZodObject<{
177
+ type: z.ZodLiteral<"cron">;
178
+ expression: z.ZodString;
179
+ timezone: z.ZodOptional<z.ZodString>;
180
+ }, z.core.$strip>], "type">;
202
181
  nextRunAt: z.ZodNullable<z.ZodString>;
203
182
  lastRunAt: z.ZodNullable<z.ZodString>;
204
183
  lastRunStatus: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
@@ -32,18 +32,8 @@ export const ScheduleTargetSchema = z.discriminatedUnion("type", [
32
32
  archiveOnFinish: z.boolean().optional(),
33
33
  isolation: z.enum(["local", "worktree"]).optional(),
34
34
  title: z.string().trim().min(1).nullable().optional(),
35
- approvalPolicy: z.string().trim().min(1).optional(),
36
- sandboxMode: z.string().trim().min(1).optional(),
37
- networkAccess: z.boolean().optional(),
38
- webSearch: z.boolean().optional(),
35
+ providerOptions: z.record(z.string(), z.json()).optional(),
39
36
  featureValues: z.record(z.string(), z.unknown()).optional(),
40
- extra: z
41
- .object({
42
- codex: z.record(z.string(), z.unknown()).optional(),
43
- claude: z.record(z.string(), z.unknown()).optional(),
44
- })
45
- .partial()
46
- .optional(),
47
37
  systemPrompt: z.string().optional(),
48
38
  mcpServers: z.record(z.string(), z.unknown()).optional(),
49
39
  }),
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Ranked text matching shared by the app's pickers and the daemon's history
3
+ * search. A match is a tier plus the offset it was found at; lower is better on
4
+ * both, so callers sort ascending and never have to invent a scale.
5
+ *
6
+ * Typo tolerance is opt-in via `fuzzy`. The pickers leave it off — a combobox
7
+ * over a known list wants exact narrowing — while history search turns it on
8
+ * because the user is recalling a title from memory.
9
+ */
10
+ export interface MatchScore {
11
+ tier: number;
12
+ offset: number;
13
+ spread?: number;
14
+ }
15
+ export interface MatchOptions {
16
+ /** Omit or pass null to match exactly. `fuzzyPolicyForToken` picks a policy. */
17
+ fuzzy?: FuzzyPolicy | null;
18
+ }
19
+ /**
20
+ * How much a typo in one query token is forgiven. Short tokens get
21
+ * transpositions and nothing else: at four characters a free substitution turns
22
+ * "main" into "mail", "maid", and "rain", while a swap can only ever reach the
23
+ * word the user meant. Null means the token is matched exactly.
24
+ */
25
+ export interface FuzzyPolicy {
26
+ maxEdits: number;
27
+ transpositionsOnly: boolean;
28
+ }
29
+ export declare function fuzzyPolicyForToken(token: string): FuzzyPolicy | null;
30
+ export declare function scoreMatch(query: string, text: string, options?: MatchOptions): MatchScore | null;
31
+ export interface MatchRange {
32
+ start: number;
33
+ length: number;
34
+ }
35
+ /**
36
+ * Where a score's match actually landed, so a caller can mark it. Derived from
37
+ * a score rather than produced alongside one: ranking touches every candidate
38
+ * and needs no ranges, while only the handful of rows that get rendered do.
39
+ *
40
+ * The tier decides the shape. A substring hit is one span; a subsequence hit is
41
+ * the scattered characters it walked; a typo hit marks the whole word, because
42
+ * the characters the user got wrong are not in the text to point at.
43
+ */
44
+ export declare function matchRanges(query: string, text: string, score: MatchScore): MatchRange[];
45
+ export declare function compareMatchScores(a: MatchScore, b: MatchScore): number;
46
+ export declare function tokenizeQuery(query: string): string[];
47
+ export interface TextFieldsOptions {
48
+ /**
49
+ * Forgive typos. The budget is per token rather than per query, because a
50
+ * query mixes long words that can absorb an edit with short ones that cannot.
51
+ */
52
+ typoTolerant?: boolean;
53
+ }
54
+ export declare function scoreTextFields(query: string, fields: string[], options?: TextFieldsOptions): MatchScore | null;
55
+ //# sourceMappingURL=text-match.d.ts.map
@@ -0,0 +1,262 @@
1
+ /**
2
+ * Ranked text matching shared by the app's pickers and the daemon's history
3
+ * search. A match is a tier plus the offset it was found at; lower is better on
4
+ * both, so callers sort ascending and never have to invent a scale.
5
+ *
6
+ * Typo tolerance is opt-in via `fuzzy`. The pickers leave it off — a combobox
7
+ * over a known list wants exact narrowing — while history search turns it on
8
+ * because the user is recalling a title from memory.
9
+ */
10
+ /** Exact tiers, best to worst. The fuzzy tier always sorts after all of them. */
11
+ const TIER_EXACT = 0;
12
+ const TIER_WHOLE_WORD = 1;
13
+ const TIER_PREFIX = 2;
14
+ const TIER_WORD_START = 3;
15
+ const TIER_SUBSTRING = 4;
16
+ const TIER_SUBSEQUENCE = 5;
17
+ const TIER_FUZZY = 6;
18
+ function isWordBoundaryChar(ch) {
19
+ if (ch === undefined)
20
+ return true;
21
+ return !/[a-z0-9]/.test(ch);
22
+ }
23
+ function scoreSubstringMatch(query, text) {
24
+ let best = null;
25
+ let pos = 0;
26
+ while (pos <= text.length - query.length) {
27
+ const found = text.indexOf(query, pos);
28
+ if (found === -1)
29
+ break;
30
+ const before = found > 0 ? text[found - 1] : undefined;
31
+ const after = text[found + query.length];
32
+ const startsAtBoundary = found === 0 || isWordBoundaryChar(before);
33
+ const endsAtBoundary = after === undefined || isWordBoundaryChar(after);
34
+ let tier;
35
+ if (startsAtBoundary && endsAtBoundary) {
36
+ tier = TIER_WHOLE_WORD;
37
+ }
38
+ else if (found === 0) {
39
+ tier = TIER_PREFIX;
40
+ }
41
+ else if (startsAtBoundary) {
42
+ tier = TIER_WORD_START;
43
+ }
44
+ else {
45
+ tier = TIER_SUBSTRING;
46
+ }
47
+ if (!best || tier < best.tier || (tier === best.tier && found < best.offset)) {
48
+ best = { tier, offset: found };
49
+ }
50
+ pos = found + 1;
51
+ }
52
+ return best;
53
+ }
54
+ function scoreSubsequenceMatch(query, text) {
55
+ let queryIndex = 0;
56
+ let firstIndex = -1;
57
+ let lastIndex = -1;
58
+ for (let textIndex = 0; textIndex < text.length && queryIndex < query.length; textIndex += 1) {
59
+ if (text[textIndex] !== query[queryIndex])
60
+ continue;
61
+ if (firstIndex === -1)
62
+ firstIndex = textIndex;
63
+ lastIndex = textIndex;
64
+ queryIndex += 1;
65
+ }
66
+ if (queryIndex !== query.length || firstIndex === -1)
67
+ return null;
68
+ return { tier: TIER_SUBSEQUENCE, offset: firstIndex, spread: lastIndex - firstIndex + 1 };
69
+ }
70
+ /**
71
+ * Damerau-Levenshtein distance, abandoned as soon as every cell in a row is
72
+ * over budget. Bounding it is what keeps the fuzzy tier affordable to run
73
+ * against every word of every candidate.
74
+ */
75
+ function boundedEditDistance(query, word, budget) {
76
+ if (Math.abs(query.length - word.length) > budget)
77
+ return null;
78
+ let twoRowsBack = [];
79
+ let previousRow = Array.from({ length: word.length + 1 }, (_, index) => index);
80
+ for (let queryIndex = 1; queryIndex <= query.length; queryIndex += 1) {
81
+ const currentRow = [queryIndex];
82
+ let rowBest = queryIndex;
83
+ for (let wordIndex = 1; wordIndex <= word.length; wordIndex += 1) {
84
+ const substitutionCost = query[queryIndex - 1] === word[wordIndex - 1] ? 0 : 1;
85
+ let cost = Math.min(currentRow[wordIndex - 1] + 1, previousRow[wordIndex] + 1, previousRow[wordIndex - 1] + substitutionCost);
86
+ const isTransposition = queryIndex > 1 &&
87
+ wordIndex > 1 &&
88
+ query[queryIndex - 1] === word[wordIndex - 2] &&
89
+ query[queryIndex - 2] === word[wordIndex - 1];
90
+ if (isTransposition) {
91
+ cost = Math.min(cost, twoRowsBack[wordIndex - 2] + 1);
92
+ }
93
+ currentRow.push(cost);
94
+ rowBest = Math.min(rowBest, cost);
95
+ }
96
+ if (rowBest > budget)
97
+ return null;
98
+ twoRowsBack = previousRow;
99
+ previousRow = currentRow;
100
+ }
101
+ const distance = previousRow[word.length];
102
+ return distance <= budget ? distance : null;
103
+ }
104
+ function transpositionDistance(query, word) {
105
+ return isAdjacentTransposition(query, word) ? 1 : null;
106
+ }
107
+ /** True when the two differ only by one swap of neighbouring characters. */
108
+ function isAdjacentTransposition(query, word) {
109
+ if (query.length !== word.length)
110
+ return false;
111
+ let index = 0;
112
+ while (index < query.length && query[index] === word[index])
113
+ index += 1;
114
+ if (index >= query.length - 1)
115
+ return false;
116
+ if (query[index] !== word[index + 1] || query[index + 1] !== word[index])
117
+ return false;
118
+ return query.slice(index + 2) === word.slice(index + 2);
119
+ }
120
+ export function fuzzyPolicyForToken(token) {
121
+ if (token.length <= 3)
122
+ return null;
123
+ if (token.length === 4)
124
+ return { maxEdits: 1, transpositionsOnly: true };
125
+ if (token.length <= 7)
126
+ return { maxEdits: 1, transpositionsOnly: false };
127
+ return { maxEdits: 2, transpositionsOnly: false };
128
+ }
129
+ /**
130
+ * Words are what people mistype, so the fuzzy tier compares the query against
131
+ * each word rather than against the whole string — otherwise a long title's
132
+ * length difference alone would blow the budget.
133
+ */
134
+ function scoreFuzzyMatch(query, text, policy) {
135
+ if (policy.maxEdits <= 0 || query.length <= policy.maxEdits)
136
+ return null;
137
+ let best = null;
138
+ const wordPattern = /[a-z0-9]+/g;
139
+ let word = wordPattern.exec(text);
140
+ while (word !== null) {
141
+ // Compare against the whole word and against its leading slices, so a typo
142
+ // in a prefix ("confug" for "configuration") still lands — the length gap
143
+ // to the full word would otherwise blow the budget on its own.
144
+ const candidates = new Set([
145
+ word[0],
146
+ word[0].slice(0, query.length),
147
+ word[0].slice(0, query.length + policy.maxEdits),
148
+ ]);
149
+ for (const candidate of candidates) {
150
+ const distance = policy.transpositionsOnly
151
+ ? transpositionDistance(query, candidate)
152
+ : boundedEditDistance(query, candidate, policy.maxEdits);
153
+ if (distance === null)
154
+ continue;
155
+ const score = { tier: TIER_FUZZY, offset: word.index, spread: distance };
156
+ if (!best || compareMatchScores(score, best) < 0) {
157
+ best = score;
158
+ }
159
+ }
160
+ word = wordPattern.exec(text);
161
+ }
162
+ return best;
163
+ }
164
+ export function scoreMatch(query, text, options = {}) {
165
+ if (!query)
166
+ return { tier: TIER_EXACT, offset: 0 };
167
+ const q = query.toLowerCase();
168
+ const t = text.toLowerCase();
169
+ if (t === q)
170
+ return { tier: TIER_EXACT, offset: 0 };
171
+ const exact = scoreSubstringMatch(q, t) ?? scoreSubsequenceMatch(q, t);
172
+ if (exact)
173
+ return exact;
174
+ const fuzzy = options.fuzzy;
175
+ return fuzzy ? scoreFuzzyMatch(q, t, fuzzy) : null;
176
+ }
177
+ function mergeAdjacentRanges(indices) {
178
+ const ranges = [];
179
+ for (const index of indices) {
180
+ const last = ranges.at(-1);
181
+ if (last && last.start + last.length === index) {
182
+ last.length += 1;
183
+ continue;
184
+ }
185
+ ranges.push({ start: index, length: 1 });
186
+ }
187
+ return ranges;
188
+ }
189
+ function wordRangeAt(text, offset) {
190
+ let end = offset;
191
+ while (end < text.length && /[a-z0-9]/.test(text[end]))
192
+ end += 1;
193
+ return { start: offset, length: Math.max(end - offset, 1) };
194
+ }
195
+ /**
196
+ * Where a score's match actually landed, so a caller can mark it. Derived from
197
+ * a score rather than produced alongside one: ranking touches every candidate
198
+ * and needs no ranges, while only the handful of rows that get rendered do.
199
+ *
200
+ * The tier decides the shape. A substring hit is one span; a subsequence hit is
201
+ * the scattered characters it walked; a typo hit marks the whole word, because
202
+ * the characters the user got wrong are not in the text to point at.
203
+ */
204
+ export function matchRanges(query, text, score) {
205
+ if (!query)
206
+ return [];
207
+ const q = query.toLowerCase();
208
+ const t = text.toLowerCase();
209
+ if (score.tier === TIER_EXACT)
210
+ return [{ start: 0, length: text.length }];
211
+ if (score.tier === TIER_FUZZY)
212
+ return [wordRangeAt(t, score.offset)];
213
+ if (score.tier === TIER_SUBSEQUENCE) {
214
+ const indices = [];
215
+ let queryIndex = 0;
216
+ for (let textIndex = 0; textIndex < t.length && queryIndex < q.length; textIndex += 1) {
217
+ if (t[textIndex] !== q[queryIndex])
218
+ continue;
219
+ indices.push(textIndex);
220
+ queryIndex += 1;
221
+ }
222
+ return mergeAdjacentRanges(indices);
223
+ }
224
+ return [{ start: score.offset, length: q.length }];
225
+ }
226
+ export function compareMatchScores(a, b) {
227
+ if (a.tier !== b.tier)
228
+ return a.tier - b.tier;
229
+ if (a.offset !== b.offset)
230
+ return a.offset - b.offset;
231
+ return (a.spread ?? 0) - (b.spread ?? 0);
232
+ }
233
+ export function tokenizeQuery(query) {
234
+ return query
235
+ .trim()
236
+ .toLowerCase()
237
+ .split(/\s+/)
238
+ .filter((token) => token.length > 0);
239
+ }
240
+ export function scoreTextFields(query, fields, options = {}) {
241
+ const tokens = tokenizeQuery(query);
242
+ if (tokens.length === 0)
243
+ return { tier: TIER_EXACT, offset: 0, spread: 0 };
244
+ const aggregate = { tier: TIER_EXACT, offset: 0, spread: 0 };
245
+ for (const token of tokens) {
246
+ const fuzzy = options.typoTolerant ? fuzzyPolicyForToken(token) : null;
247
+ let best = null;
248
+ for (const field of fields) {
249
+ const score = scoreMatch(token, field, { fuzzy });
250
+ if (score && (!best || compareMatchScores(score, best) < 0)) {
251
+ best = score;
252
+ }
253
+ }
254
+ if (!best)
255
+ return null;
256
+ aggregate.tier += best.tier;
257
+ aggregate.offset += best.offset;
258
+ aggregate.spread = (aggregate.spread ?? 0) + (best.spread ?? token.length);
259
+ }
260
+ return aggregate;
261
+ }
262
+ //# sourceMappingURL=text-match.js.map
@@ -0,0 +1,180 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Otto speech wire schemas: the speech.* settings, TTS preview and speak RPCs, the local STT/TTS model options, and the mutable speech daemon config. Fork-only capability, so it owns its schemas; messages.ts re-exports them.
4
+ */
5
+ export declare const MutableSpeechSttConfigSchema: z.ZodObject<{
6
+ provider: z.ZodOptional<z.ZodString>;
7
+ model: z.ZodOptional<z.ZodString>;
8
+ language: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$loose>;
10
+ export declare const MutableSpeechTtsConfigSchema: z.ZodObject<{
11
+ provider: z.ZodOptional<z.ZodString>;
12
+ model: z.ZodOptional<z.ZodString>;
13
+ voice: z.ZodOptional<z.ZodString>;
14
+ speed: z.ZodOptional<z.ZodNumber>;
15
+ }, z.core.$loose>;
16
+ export declare const MutableSpeechDictationConfigSchema: z.ZodObject<{
17
+ enabled: z.ZodOptional<z.ZodBoolean>;
18
+ stt: z.ZodOptional<z.ZodObject<{
19
+ provider: z.ZodOptional<z.ZodString>;
20
+ model: z.ZodOptional<z.ZodString>;
21
+ language: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$loose>>;
23
+ }, z.core.$loose>;
24
+ export declare const MutableSpeechVoiceModeConfigSchema: z.ZodObject<{
25
+ enabled: z.ZodOptional<z.ZodBoolean>;
26
+ stt: z.ZodOptional<z.ZodObject<{
27
+ provider: z.ZodOptional<z.ZodString>;
28
+ model: z.ZodOptional<z.ZodString>;
29
+ language: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$loose>>;
31
+ tts: z.ZodOptional<z.ZodObject<{
32
+ provider: z.ZodOptional<z.ZodString>;
33
+ model: z.ZodOptional<z.ZodString>;
34
+ voice: z.ZodOptional<z.ZodString>;
35
+ speed: z.ZodOptional<z.ZodNumber>;
36
+ }, z.core.$loose>>;
37
+ }, z.core.$loose>;
38
+ export declare const MutableSpeechOpenAiConfigSchema: z.ZodObject<{
39
+ apiKey: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$loose>;
41
+ export declare const MutableSpeechConfigSchema: z.ZodObject<{
42
+ dictation: z.ZodOptional<z.ZodObject<{
43
+ enabled: z.ZodOptional<z.ZodBoolean>;
44
+ stt: z.ZodOptional<z.ZodObject<{
45
+ provider: z.ZodOptional<z.ZodString>;
46
+ model: z.ZodOptional<z.ZodString>;
47
+ language: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$loose>>;
49
+ }, z.core.$loose>>;
50
+ voiceMode: z.ZodOptional<z.ZodObject<{
51
+ enabled: z.ZodOptional<z.ZodBoolean>;
52
+ stt: z.ZodOptional<z.ZodObject<{
53
+ provider: z.ZodOptional<z.ZodString>;
54
+ model: z.ZodOptional<z.ZodString>;
55
+ language: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$loose>>;
57
+ tts: z.ZodOptional<z.ZodObject<{
58
+ provider: z.ZodOptional<z.ZodString>;
59
+ model: z.ZodOptional<z.ZodString>;
60
+ voice: z.ZodOptional<z.ZodString>;
61
+ speed: z.ZodOptional<z.ZodNumber>;
62
+ }, z.core.$loose>>;
63
+ }, z.core.$loose>>;
64
+ openai: z.ZodOptional<z.ZodObject<{
65
+ apiKey: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$loose>>;
67
+ }, z.core.$loose>;
68
+ export type MutableSpeechConfig = z.infer<typeof MutableSpeechConfigSchema>;
69
+ export declare const SpeechSettingsGetOptionsRequestSchema: z.ZodObject<{
70
+ type: z.ZodLiteral<"speech.settings.get_options.request">;
71
+ requestId: z.ZodString;
72
+ }, z.core.$strip>;
73
+ export declare const SpeechTtsPreviewRequestSchema: z.ZodObject<{
74
+ type: z.ZodLiteral<"speech.tts.preview.request">;
75
+ requestId: z.ZodString;
76
+ text: z.ZodString;
77
+ voice: z.ZodOptional<z.ZodObject<{
78
+ provider: z.ZodOptional<z.ZodString>;
79
+ model: z.ZodOptional<z.ZodString>;
80
+ name: z.ZodString;
81
+ }, z.core.$loose>>;
82
+ }, z.core.$strip>;
83
+ export declare const SpeechTtsSpeakRequestSchema: z.ZodObject<{
84
+ type: z.ZodLiteral<"speech.tts.speak.request">;
85
+ requestId: z.ZodString;
86
+ text: z.ZodString;
87
+ voice: z.ZodOptional<z.ZodObject<{
88
+ provider: z.ZodOptional<z.ZodString>;
89
+ model: z.ZodOptional<z.ZodString>;
90
+ name: z.ZodString;
91
+ }, z.core.$loose>>;
92
+ }, z.core.$strip>;
93
+ export declare const SpeechTtsSpeakCancelRequestSchema: z.ZodObject<{
94
+ type: z.ZodLiteral<"speech.tts.speak.cancel.request">;
95
+ requestId: z.ZodString;
96
+ }, z.core.$strip>;
97
+ export declare const SpeechEngineOptionSchema: z.ZodObject<{
98
+ id: z.ZodString;
99
+ available: z.ZodBoolean;
100
+ reason: z.ZodOptional<z.ZodString>;
101
+ }, z.core.$strip>;
102
+ export declare const LocalSpeechSttModelOptionSchema: z.ZodObject<{
103
+ id: z.ZodString;
104
+ label: z.ZodOptional<z.ZodString>;
105
+ description: z.ZodString;
106
+ }, z.core.$strip>;
107
+ export declare const LocalSpeechTtsModelOptionSchema: z.ZodObject<{
108
+ id: z.ZodString;
109
+ label: z.ZodOptional<z.ZodString>;
110
+ description: z.ZodString;
111
+ voices: z.ZodArray<z.ZodString>;
112
+ defaultVoice: z.ZodString;
113
+ }, z.core.$strip>;
114
+ export declare const SpeechSettingsGetOptionsResponseSchema: z.ZodObject<{
115
+ type: z.ZodLiteral<"speech.settings.get_options.response">;
116
+ payload: z.ZodObject<{
117
+ requestId: z.ZodString;
118
+ options: z.ZodObject<{
119
+ sttEngines: z.ZodArray<z.ZodObject<{
120
+ id: z.ZodString;
121
+ available: z.ZodBoolean;
122
+ reason: z.ZodOptional<z.ZodString>;
123
+ }, z.core.$strip>>;
124
+ ttsEngines: z.ZodArray<z.ZodObject<{
125
+ id: z.ZodString;
126
+ available: z.ZodBoolean;
127
+ reason: z.ZodOptional<z.ZodString>;
128
+ }, z.core.$strip>>;
129
+ local: z.ZodObject<{
130
+ sttModels: z.ZodArray<z.ZodObject<{
131
+ id: z.ZodString;
132
+ label: z.ZodOptional<z.ZodString>;
133
+ description: z.ZodString;
134
+ }, z.core.$strip>>;
135
+ ttsModels: z.ZodArray<z.ZodObject<{
136
+ id: z.ZodString;
137
+ label: z.ZodOptional<z.ZodString>;
138
+ description: z.ZodString;
139
+ voices: z.ZodArray<z.ZodString>;
140
+ defaultVoice: z.ZodString;
141
+ }, z.core.$strip>>;
142
+ }, z.core.$strip>;
143
+ openai: z.ZodObject<{
144
+ configured: z.ZodBoolean;
145
+ sttModels: z.ZodArray<z.ZodString>;
146
+ ttsModels: z.ZodArray<z.ZodString>;
147
+ ttsVoices: z.ZodArray<z.ZodString>;
148
+ }, z.core.$strip>;
149
+ }, z.core.$strip>;
150
+ }, z.core.$loose>;
151
+ }, z.core.$strip>;
152
+ export type SpeechSettingsOptions = z.infer<typeof SpeechSettingsGetOptionsResponseSchema>["payload"]["options"];
153
+ export declare const SpeechTtsPreviewResponseSchema: z.ZodObject<{
154
+ type: z.ZodLiteral<"speech.tts.preview.response">;
155
+ payload: z.ZodObject<{
156
+ requestId: z.ZodString;
157
+ audio: z.ZodOptional<z.ZodString>;
158
+ format: z.ZodOptional<z.ZodString>;
159
+ error: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$loose>;
161
+ }, z.core.$strip>;
162
+ export type SpeechTtsPreviewResult = z.infer<typeof SpeechTtsPreviewResponseSchema>["payload"];
163
+ export declare const SpeechTtsSpeakResponseSchema: z.ZodObject<{
164
+ type: z.ZodLiteral<"speech.tts.speak.response">;
165
+ payload: z.ZodObject<{
166
+ requestId: z.ZodString;
167
+ ok: z.ZodOptional<z.ZodBoolean>;
168
+ canceled: z.ZodOptional<z.ZodBoolean>;
169
+ error: z.ZodOptional<z.ZodString>;
170
+ }, z.core.$loose>;
171
+ }, z.core.$strip>;
172
+ export type SpeechTtsSpeakResult = z.infer<typeof SpeechTtsSpeakResponseSchema>["payload"];
173
+ export declare const SpeechTtsSpeakCancelResponseSchema: z.ZodObject<{
174
+ type: z.ZodLiteral<"speech.tts.speak.cancel.response">;
175
+ payload: z.ZodObject<{
176
+ requestId: z.ZodString;
177
+ }, z.core.$loose>;
178
+ }, z.core.$strip>;
179
+ export type SpeechTtsSpeakCancelResult = z.infer<typeof SpeechTtsSpeakCancelResponseSchema>["payload"];
180
+ //# sourceMappingURL=speech.d.ts.map