@getpaseo/protocol 0.3.0-beta.4 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-types.d.ts +14 -8
- package/dist/generated/validation/ws-outbound.aot.js +38410 -37418
- package/dist/host-connection-schema.d.ts +0 -1
- package/dist/host-connection-schema.js +0 -1
- package/dist/messages.d.ts +356 -261
- package/dist/messages.js +66 -12
- package/dist/schedule/rpc-schemas.d.ts +8 -64
- package/dist/schedule/types.d.ts +3 -24
- package/dist/schedule/types.js +1 -11
- package/dist/search/text-match.d.ts +55 -0
- package/dist/search/text-match.js +262 -0
- package/dist/validation/ws-outbound-schema-metadata.d.ts +51 -57
- package/package.json +1 -1
package/dist/messages.js
CHANGED
|
@@ -238,6 +238,19 @@ const McpServerConfigSchema = z.discriminatedUnion("type", [
|
|
|
238
238
|
McpHttpServerConfigSchema,
|
|
239
239
|
McpSseServerConfigSchema,
|
|
240
240
|
]);
|
|
241
|
+
const ProviderOptionsSchema = z.record(z.string(), z.json());
|
|
242
|
+
const McpToolRefSchema = z
|
|
243
|
+
.object({
|
|
244
|
+
kind: z.literal("mcp"),
|
|
245
|
+
server: z.string().trim().min(1),
|
|
246
|
+
tool: z.string().trim().min(1),
|
|
247
|
+
})
|
|
248
|
+
.strict();
|
|
249
|
+
const ToolPolicySchema = z
|
|
250
|
+
.object({
|
|
251
|
+
preapproved: z.array(McpToolRefSchema),
|
|
252
|
+
})
|
|
253
|
+
.strict();
|
|
241
254
|
const AgentSessionConfigSchema = z.object({
|
|
242
255
|
provider: AgentProviderSchema,
|
|
243
256
|
cwd: z.string(),
|
|
@@ -246,17 +259,8 @@ const AgentSessionConfigSchema = z.object({
|
|
|
246
259
|
thinkingOptionId: z.string().optional(),
|
|
247
260
|
featureValues: z.record(z.string(), z.unknown()).optional(),
|
|
248
261
|
title: z.string().trim().min(1).max(MAX_EXPLICIT_AGENT_TITLE_CHARS).optional().nullable(),
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
networkAccess: z.boolean().optional(),
|
|
252
|
-
webSearch: z.boolean().optional(),
|
|
253
|
-
extra: z
|
|
254
|
-
.object({
|
|
255
|
-
codex: z.record(z.string(), z.unknown()).optional(),
|
|
256
|
-
claude: z.record(z.string(), z.unknown()).optional(),
|
|
257
|
-
})
|
|
258
|
-
.partial()
|
|
259
|
-
.optional(),
|
|
262
|
+
providerOptions: ProviderOptionsSchema.optional(),
|
|
263
|
+
toolPolicy: ToolPolicySchema.optional(),
|
|
260
264
|
systemPrompt: z.string().optional(),
|
|
261
265
|
mcpServers: z.record(z.string(), McpServerConfigSchema).optional(),
|
|
262
266
|
});
|
|
@@ -927,6 +931,10 @@ export const FetchAgentHistoryRequestMessageSchema = z.object({
|
|
|
927
931
|
type: z.literal("fetch_agent_history_request"),
|
|
928
932
|
requestId: z.string(),
|
|
929
933
|
filter: AgentDirectoryFilterSchema.optional(),
|
|
934
|
+
// A ranked free-text query over agent title, workspace name, branch, and
|
|
935
|
+
// project name. Present only on history: agent subscriptions filter on
|
|
936
|
+
// structure, not on relevance. Ranking replaces `sort` when it is set.
|
|
937
|
+
search: z.string().optional(),
|
|
930
938
|
sort: z
|
|
931
939
|
.array(z.object({
|
|
932
940
|
key: z.enum(["status_priority", "created_at", "updated_at", "title"]),
|
|
@@ -2117,15 +2125,38 @@ export const HubExecutionAgentCreateRequestSchema = z.object({
|
|
|
2117
2125
|
provider: z.string(),
|
|
2118
2126
|
cwd: z.string(),
|
|
2119
2127
|
prompt: z.string(),
|
|
2128
|
+
// COMPAT(hubExecutionWorkspaceSelection): semantics retired in v0.3.1; remove after 2027-08-08 once the Hub floor no longer sends it.
|
|
2120
2129
|
workspaceId: z.string().optional(),
|
|
2121
2130
|
model: z.string().optional(),
|
|
2122
2131
|
modeId: z.string().optional(),
|
|
2123
2132
|
thinkingOptionId: z.string().optional(),
|
|
2124
2133
|
featureValues: z.record(z.string(), z.unknown()).optional(),
|
|
2134
|
+
providerOptions: ProviderOptionsSchema.optional(),
|
|
2135
|
+
toolPolicy: ToolPolicySchema.optional(),
|
|
2125
2136
|
env: z.record(z.string(), z.string()).optional(),
|
|
2126
2137
|
mcpServers: z.record(z.string(), McpServerConfigSchema).optional(),
|
|
2127
2138
|
worktree: CreateAgentWorktreeTargetSchema.optional(),
|
|
2128
2139
|
});
|
|
2140
|
+
const HubExecutionAgentCreateErrorSchema = z.discriminatedUnion("code", [
|
|
2141
|
+
z.object({
|
|
2142
|
+
code: z.literal("provider_options_invalid"),
|
|
2143
|
+
provider: z.string(),
|
|
2144
|
+
issues: z.array(z.object({
|
|
2145
|
+
path: z.array(z.union([z.string(), z.number()])),
|
|
2146
|
+
message: z.string(),
|
|
2147
|
+
})),
|
|
2148
|
+
message: z.string(),
|
|
2149
|
+
}),
|
|
2150
|
+
z.object({
|
|
2151
|
+
code: z.literal("tool_policy_unsupported"),
|
|
2152
|
+
provider: z.string(),
|
|
2153
|
+
message: z.string(),
|
|
2154
|
+
}),
|
|
2155
|
+
z.object({
|
|
2156
|
+
code: z.literal("create_failed"),
|
|
2157
|
+
message: z.string(),
|
|
2158
|
+
}),
|
|
2159
|
+
]);
|
|
2129
2160
|
export const HubExecutionControlActionSchema = z.enum(["interrupt", "archive"]);
|
|
2130
2161
|
export const HubExecutionControlRequestSchema = z.object({
|
|
2131
2162
|
type: z.literal("hub.execution.control.request"),
|
|
@@ -2464,6 +2495,8 @@ export const ServerInfoStatusPayloadSchema = z
|
|
|
2464
2495
|
rewind: z.boolean().optional(),
|
|
2465
2496
|
// COMPAT(agentTimelinePromptIndex): added in v0.2.X, drop the gate when floor >= v0.2.X.
|
|
2466
2497
|
agentTimelinePromptIndex: z.boolean().optional(),
|
|
2498
|
+
// COMPAT(agentHistorySearch): added in v0.3.0, remove gate after 2027-02-07.
|
|
2499
|
+
agentHistorySearch: z.boolean().optional(),
|
|
2467
2500
|
// COMPAT(checkoutRefresh): added in v0.1.86, remove gate after 2026-11-29.
|
|
2468
2501
|
checkoutRefresh: z.boolean().optional(),
|
|
2469
2502
|
// COMPAT(workspaceMultiplicity): added in v0.1.97, drop the gate when floor >= v0.1.97
|
|
@@ -2858,9 +2891,25 @@ export const AgentListMessageSchema = z.object({
|
|
|
2858
2891
|
agents: z.array(AgentSnapshotPayloadSchema),
|
|
2859
2892
|
}),
|
|
2860
2893
|
});
|
|
2894
|
+
export const AgentSearchMatchFieldSchema = z.enum(["workspace", "title", "branch", "project"]);
|
|
2895
|
+
export const AgentSearchMatchSchema = z.object({
|
|
2896
|
+
field: AgentSearchMatchFieldSchema,
|
|
2897
|
+
ranges: z.array(z.object({
|
|
2898
|
+
start: z.number().int().nonnegative(),
|
|
2899
|
+
length: z.number().int().positive(),
|
|
2900
|
+
})),
|
|
2901
|
+
});
|
|
2861
2902
|
const AgentDirectoryResponseEntrySchema = z.object({
|
|
2862
2903
|
agent: AgentSnapshotPayloadSchema,
|
|
2863
2904
|
project: ProjectPlacementPayloadSchema,
|
|
2905
|
+
// Relevance of this entry to the request's `search`, lower being better.
|
|
2906
|
+
// Set only when the request carried a query; a client merging results from
|
|
2907
|
+
// several hosts needs it to interleave their separately ranked pages.
|
|
2908
|
+
searchScore: z.number().optional(),
|
|
2909
|
+
// Where the query matched, so the row can mark it. The ranker computes this
|
|
2910
|
+
// anyway; sending it keeps the client from re-deriving a second opinion that
|
|
2911
|
+
// could disagree with the ranking it is explaining.
|
|
2912
|
+
searchMatches: z.array(AgentSearchMatchSchema).optional(),
|
|
2864
2913
|
});
|
|
2865
2914
|
const AgentDirectoryPageInfoSchema = z.object({
|
|
2866
2915
|
nextCursor: z.string().nullable(),
|
|
@@ -2882,6 +2931,10 @@ export const FetchAgentHistoryResponseMessageSchema = z.object({
|
|
|
2882
2931
|
requestId: z.string(),
|
|
2883
2932
|
entries: z.array(AgentDirectoryResponseEntrySchema),
|
|
2884
2933
|
pageInfo: AgentDirectoryPageInfoSchema,
|
|
2934
|
+
// More sessions matched the request's `search` than the page could hold.
|
|
2935
|
+
// Distinct from `pageInfo.hasMore`, which promises a fetchable next page —
|
|
2936
|
+
// a ranked result set has none, and the way on is a narrower query.
|
|
2937
|
+
searchTruncated: z.boolean().optional(),
|
|
2885
2938
|
}),
|
|
2886
2939
|
});
|
|
2887
2940
|
export const FetchRecentProviderSessionsResponseMessageSchema = z.object({
|
|
@@ -4614,7 +4667,8 @@ export const HubExecutionAgentCreateResponseSchema = z.object({
|
|
|
4614
4667
|
agentId: z.string().nullable(),
|
|
4615
4668
|
agent: AgentSnapshotPayloadSchema.nullable(),
|
|
4616
4669
|
success: z.boolean(),
|
|
4617
|
-
|
|
4670
|
+
toolPolicyApplied: z.literal(true).optional(),
|
|
4671
|
+
error: HubExecutionAgentCreateErrorSchema.nullable(),
|
|
4618
4672
|
}),
|
|
4619
4673
|
});
|
|
4620
4674
|
export const HubExecutionControlResponseSchema = z.object({
|
|
@@ -32,15 +32,8 @@ export declare const ScheduleCreateRequestSchema: z.ZodObject<{
|
|
|
32
32
|
worktree: "worktree";
|
|
33
33
|
}>>;
|
|
34
34
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
-
|
|
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>;
|
|
@@ -151,15 +144,8 @@ export declare const ScheduleCreateResponseSchema: z.ZodObject<{
|
|
|
151
144
|
worktree: "worktree";
|
|
152
145
|
}>>;
|
|
153
146
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
154
|
-
|
|
155
|
-
sandboxMode: z.ZodOptional<z.ZodString>;
|
|
156
|
-
networkAccess: z.ZodOptional<z.ZodBoolean>;
|
|
157
|
-
webSearch: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
158
148
|
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
159
|
-
extra: z.ZodOptional<z.ZodObject<{
|
|
160
|
-
codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
161
|
-
claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
162
|
-
}, z.core.$strip>>;
|
|
163
149
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
164
150
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
165
151
|
}, z.core.$strip>;
|
|
@@ -213,15 +199,8 @@ export declare const ScheduleListResponseSchema: z.ZodObject<{
|
|
|
213
199
|
worktree: "worktree";
|
|
214
200
|
}>>;
|
|
215
201
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
216
|
-
|
|
217
|
-
sandboxMode: z.ZodOptional<z.ZodString>;
|
|
218
|
-
networkAccess: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
-
webSearch: z.ZodOptional<z.ZodBoolean>;
|
|
202
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
220
203
|
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
221
|
-
extra: z.ZodOptional<z.ZodObject<{
|
|
222
|
-
codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
223
|
-
claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
224
|
-
}, z.core.$strip>>;
|
|
225
204
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
226
205
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
227
206
|
}, z.core.$strip>;
|
|
@@ -269,15 +248,8 @@ export declare const ScheduleInspectResponseSchema: z.ZodObject<{
|
|
|
269
248
|
worktree: "worktree";
|
|
270
249
|
}>>;
|
|
271
250
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
272
|
-
|
|
273
|
-
sandboxMode: z.ZodOptional<z.ZodString>;
|
|
274
|
-
networkAccess: z.ZodOptional<z.ZodBoolean>;
|
|
275
|
-
webSearch: z.ZodOptional<z.ZodBoolean>;
|
|
251
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
276
252
|
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
277
|
-
extra: z.ZodOptional<z.ZodObject<{
|
|
278
|
-
codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
279
|
-
claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
280
|
-
}, z.core.$strip>>;
|
|
281
253
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
282
254
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
283
255
|
}, z.core.$strip>;
|
|
@@ -374,15 +346,8 @@ export declare const SchedulePauseResponseSchema: z.ZodObject<{
|
|
|
374
346
|
worktree: "worktree";
|
|
375
347
|
}>>;
|
|
376
348
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
377
|
-
|
|
378
|
-
sandboxMode: z.ZodOptional<z.ZodString>;
|
|
379
|
-
networkAccess: z.ZodOptional<z.ZodBoolean>;
|
|
380
|
-
webSearch: z.ZodOptional<z.ZodBoolean>;
|
|
349
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
381
350
|
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
382
|
-
extra: z.ZodOptional<z.ZodObject<{
|
|
383
|
-
codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
384
|
-
claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
385
|
-
}, z.core.$strip>>;
|
|
386
351
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
387
352
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
388
353
|
}, z.core.$strip>;
|
|
@@ -436,15 +401,8 @@ export declare const ScheduleResumeResponseSchema: z.ZodObject<{
|
|
|
436
401
|
worktree: "worktree";
|
|
437
402
|
}>>;
|
|
438
403
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
439
|
-
|
|
440
|
-
sandboxMode: z.ZodOptional<z.ZodString>;
|
|
441
|
-
networkAccess: z.ZodOptional<z.ZodBoolean>;
|
|
442
|
-
webSearch: z.ZodOptional<z.ZodBoolean>;
|
|
404
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
443
405
|
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
444
|
-
extra: z.ZodOptional<z.ZodObject<{
|
|
445
|
-
codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
446
|
-
claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
447
|
-
}, z.core.$strip>>;
|
|
448
406
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
449
407
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
450
408
|
}, z.core.$strip>;
|
|
@@ -500,15 +458,8 @@ export declare const ScheduleRunOnceResponseSchema: z.ZodObject<{
|
|
|
500
458
|
worktree: "worktree";
|
|
501
459
|
}>>;
|
|
502
460
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
503
|
-
|
|
504
|
-
sandboxMode: z.ZodOptional<z.ZodString>;
|
|
505
|
-
networkAccess: z.ZodOptional<z.ZodBoolean>;
|
|
506
|
-
webSearch: z.ZodOptional<z.ZodBoolean>;
|
|
461
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
507
462
|
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
508
|
-
extra: z.ZodOptional<z.ZodObject<{
|
|
509
|
-
codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
510
|
-
claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
511
|
-
}, z.core.$strip>>;
|
|
512
463
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
513
464
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
514
465
|
}, z.core.$strip>;
|
|
@@ -577,15 +528,8 @@ export declare const ScheduleUpdateResponseSchema: z.ZodObject<{
|
|
|
577
528
|
worktree: "worktree";
|
|
578
529
|
}>>;
|
|
579
530
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
580
|
-
|
|
581
|
-
sandboxMode: z.ZodOptional<z.ZodString>;
|
|
582
|
-
networkAccess: z.ZodOptional<z.ZodBoolean>;
|
|
583
|
-
webSearch: z.ZodOptional<z.ZodBoolean>;
|
|
531
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
584
532
|
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
585
|
-
extra: z.ZodOptional<z.ZodObject<{
|
|
586
|
-
codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
587
|
-
claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
588
|
-
}, z.core.$strip>>;
|
|
589
533
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
590
534
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
591
535
|
}, z.core.$strip>;
|
package/dist/schedule/types.d.ts
CHANGED
|
@@ -31,15 +31,8 @@ export declare const ScheduleTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
31
31
|
worktree: "worktree";
|
|
32
32
|
}>>;
|
|
33
33
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
-
|
|
35
|
-
sandboxMode: z.ZodOptional<z.ZodString>;
|
|
36
|
-
networkAccess: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
-
webSearch: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
38
35
|
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
39
|
-
extra: z.ZodOptional<z.ZodObject<{
|
|
40
|
-
codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
41
|
-
claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
42
|
-
}, z.core.$strip>>;
|
|
43
36
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
44
37
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
45
38
|
}, z.core.$strip>;
|
|
@@ -90,15 +83,8 @@ export declare const StoredScheduleSchema: z.ZodObject<{
|
|
|
90
83
|
worktree: "worktree";
|
|
91
84
|
}>>;
|
|
92
85
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
93
|
-
|
|
94
|
-
sandboxMode: z.ZodOptional<z.ZodString>;
|
|
95
|
-
networkAccess: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
-
webSearch: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
97
87
|
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
98
|
-
extra: z.ZodOptional<z.ZodObject<{
|
|
99
|
-
codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
100
|
-
claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
101
|
-
}, z.core.$strip>>;
|
|
102
88
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
103
89
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
104
90
|
}, z.core.$strip>;
|
|
@@ -167,15 +153,8 @@ export declare const ScheduleSummarySchema: z.ZodObject<{
|
|
|
167
153
|
worktree: "worktree";
|
|
168
154
|
}>>;
|
|
169
155
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
170
|
-
|
|
171
|
-
sandboxMode: z.ZodOptional<z.ZodString>;
|
|
172
|
-
networkAccess: z.ZodOptional<z.ZodBoolean>;
|
|
173
|
-
webSearch: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
174
157
|
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
175
|
-
extra: z.ZodOptional<z.ZodObject<{
|
|
176
|
-
codex: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
177
|
-
claude: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
178
|
-
}, z.core.$strip>>;
|
|
179
158
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
180
159
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
181
160
|
}, z.core.$strip>;
|
package/dist/schedule/types.js
CHANGED
|
@@ -28,18 +28,8 @@ export const ScheduleTargetSchema = z.discriminatedUnion("type", [
|
|
|
28
28
|
archiveOnFinish: z.boolean().optional(),
|
|
29
29
|
isolation: z.enum(["local", "worktree"]).optional(),
|
|
30
30
|
title: z.string().trim().min(1).nullable().optional(),
|
|
31
|
-
|
|
32
|
-
sandboxMode: z.string().trim().min(1).optional(),
|
|
33
|
-
networkAccess: z.boolean().optional(),
|
|
34
|
-
webSearch: z.boolean().optional(),
|
|
31
|
+
providerOptions: z.record(z.string(), z.json()).optional(),
|
|
35
32
|
featureValues: z.record(z.string(), z.unknown()).optional(),
|
|
36
|
-
extra: z
|
|
37
|
-
.object({
|
|
38
|
-
codex: z.record(z.string(), z.unknown()).optional(),
|
|
39
|
-
claude: z.record(z.string(), z.unknown()).optional(),
|
|
40
|
-
})
|
|
41
|
-
.partial()
|
|
42
|
-
.optional(),
|
|
43
33
|
systemPrompt: z.string().optional(),
|
|
44
34
|
mcpServers: z.record(z.string(), z.unknown()).optional(),
|
|
45
35
|
}),
|
|
@@ -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
|