deepline 0.3.90 → 0.3.92

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 (87) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +101 -6
  2. package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +2 -556
  3. package/dist/bundling-sources/sdk/src/monitor-fleets.ts +2 -2
  4. package/dist/bundling-sources/sdk/src/release.ts +7 -12
  5. package/dist/bundling-sources/sdk/src/types.ts +6 -1
  6. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +549 -0
  7. package/dist/bundling-sources/shared_libs/monitors/fleets/errors.ts +96 -0
  8. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
  9. package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +320 -0
  10. package/dist/bundling-sources/shared_libs/monitors/fleets/verdict.ts +106 -0
  11. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +5 -1
  12. package/dist/bundling-sources/shared_libs/monitors/monitor-fleet-limits.ts +2 -12
  13. package/dist/bundling-sources/shared_libs/monitors/package.json +107 -5
  14. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +12 -7
  15. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +48 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +1 -1
  17. package/dist/bundling-sources/shared_libs/play-runtime/db-session-lease-store.ts +578 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-execution-relay.ts +521 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-receipt-gateway.ts +1378 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/runtime-topology.ts +1024 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-gateway-route-probe.ts +193 -0
  22. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machine-lifecycle.ts +104 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +1844 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +21 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/deployment/process-tree.ts +40 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-gateway-drain.ts +262 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-surface.ts +98 -0
  28. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +303 -0
  29. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-publication-guardian.ts +70 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-recovery.ts +519 -0
  31. package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +280 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-production-gate.ts +159 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/memory-store.ts +114 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +44 -5
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/child-play-resolver.ts +26 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +3662 -0
  37. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +47 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-deadline.ts +84 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-gateway-transport.ts +91 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +424 -0
  41. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +321 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts +110 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +625 -0
  44. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +46 -3
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +1 -1
  46. package/dist/bundling-sources/shared_libs/play-runtime/webhook-receipt-retry.ts +50 -0
  47. package/dist/bundling-sources/shared_libs/plays/bundling/repository-adapter.ts +24 -0
  48. package/dist/bundling-sources/shared_libs/plays/child-run-projection.ts +174 -0
  49. package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +267 -0
  50. package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +73 -0
  51. package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +162 -0
  52. package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +87 -0
  53. package/dist/bundling-sources/shared_libs/plays/deploy/source-file-path.ts +26 -0
  54. package/dist/bundling-sources/shared_libs/plays/deploy/target-paths.ts +36 -0
  55. package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +400 -0
  56. package/dist/bundling-sources/shared_libs/plays/launch/prepare.ts +96 -0
  57. package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +385 -0
  58. package/dist/bundling-sources/shared_libs/plays/play-grep-search.ts +79 -6
  59. package/dist/bundling-sources/shared_libs/plays/play-reference.ts +117 -0
  60. package/dist/bundling-sources/shared_libs/plays/run-input-summary.ts +260 -0
  61. package/dist/bundling-sources/shared_libs/plays/run-summary-types.ts +49 -0
  62. package/dist/bundling-sources/shared_libs/plays/secrets/errors.ts +19 -0
  63. package/dist/bundling-sources/shared_libs/plays/sheet-filter.ts +347 -0
  64. package/dist/bundling-sources/shared_libs/plays/standard-webhooks.ts +117 -0
  65. package/dist/bundling-sources/shared_libs/plays/status-result.ts +388 -0
  66. package/dist/bundling-sources/shared_libs/plays/transform-factor-structure.ts +377 -0
  67. package/dist/bundling-sources/shared_libs/plays/webhook-payload.ts +113 -0
  68. package/dist/cli/index.js +369 -162
  69. package/dist/cli/index.mjs +369 -162
  70. package/dist/{compiler-manifest-BaJfE-5H.d.mts → compiler-manifest-x14KL83E.d.mts} +1 -1
  71. package/dist/{compiler-manifest-BaJfE-5H.d.ts → compiler-manifest-x14KL83E.d.ts} +1 -1
  72. package/dist/index.d.mts +45 -8
  73. package/dist/index.d.ts +45 -8
  74. package/dist/index.js +61 -14
  75. package/dist/index.mjs +61 -14
  76. package/dist/install-integrity.json +54 -2
  77. package/dist/monitor-fleet-contract.d.mts +3 -10
  78. package/dist/monitor-fleet-contract.d.ts +3 -10
  79. package/dist/monitor-fleet-contract.js +2 -0
  80. package/dist/monitor-fleet-contract.mjs +1 -1
  81. package/dist/plays/bundle-play-file.d.mts +2 -2
  82. package/dist/plays/bundle-play-file.d.ts +2 -2
  83. package/dist/release.d.mts +3 -3
  84. package/dist/release.d.ts +3 -3
  85. package/dist/release.js +7 -12
  86. package/dist/release.mjs +7 -12
  87. package/package.json +2 -2
@@ -1,556 +1,2 @@
1
- /**
2
- * The fleet member ceiling, mirrored — deliberately a literal.
3
- *
4
- * The canonical declaration is packages/monitors/monitor-fleet-limits.ts,
5
- * which the Convex commit mutation reads to size its transaction. This package
6
- * cannot import it: the workspace-architecture ratchet forbids NEW shared_libs
7
- * imports from packages absolutely (only relocations of pre-existing edges
8
- * pass CI), because shared_libs is being migrated into workspace packages.
9
- * Until a monitors package exists, the two copies are held equal by
10
- * tests/lib/monitors/monitor-fleet-limits-mirror.test.ts — change one without
11
- * the other and that test names both files.
12
- */
13
- export const MONITOR_FLEET_MAX_MEMBERS = 1_000;
14
-
15
- export const MONITOR_FLEET_FRONTIER_MAX_ROWS = 10_000;
16
- /**
17
- * Fleet definitions are admitted once and executed many times. Keep the
18
- * edition beside the definition just as Plays keep their authoring-contract
19
- * edition: a future syntax change can add a reader without reinterpreting a
20
- * stored Fleet under new rules.
21
- */
22
- export const MONITOR_FLEET_AUTHORING_CONTRACT_EDITION = 1 as const;
23
- export const SUPPORTED_MONITOR_FLEET_AUTHORING_CONTRACT_EDITIONS = [
24
- MONITOR_FLEET_AUTHORING_CONTRACT_EDITION,
25
- ] as const;
26
-
27
- export type MonitorFleetAuthoringContractEdition =
28
- (typeof SUPPORTED_MONITOR_FLEET_AUTHORING_CONTRACT_EDITIONS)[number];
29
-
30
- export const MONITOR_FLEET_AUTHORING_CONTRACT_CHANGELOG = [
31
- {
32
- edition: 1,
33
- changed:
34
- 'Initial Fleet JSON contract: bounded sticky table membership, one daily sync, and a seven-day removal grace.',
35
- compatibilityOwner: 'Monitors Runtime',
36
- newWritesEnd: null,
37
- readerRemoval: null,
38
- },
39
- ] as const;
40
- /**
41
- * Fleets are deliberately opinionated in beta: a member absent from the
42
- * source remains intact for seven days, then its ordinary monitor is
43
- * deactivated. This prevents transient source refreshes from deleting a
44
- * provider resource while keeping the customer contract small.
45
- */
46
- export const MONITOR_FLEET_REMOVAL_GRACE_MS = 7 * 24 * 60 * 60_000;
47
-
48
- /**
49
- * Public, machine-readable guidance for every Monitor Fleet authoring
50
- * surface. SDK clients may render this directly; the CLI uses the same fixed
51
- * policy values in its help rather than maintaining another contract.
52
- */
53
- export const MONITOR_FLEET_DOCUMENTATION = {
54
- summary:
55
- 'A Monitor Fleet keeps one bounded, sticky set of ordinary monitors aligned with Customer DB rows.',
56
- authoredFields: {
57
- id: 'Stable lowercase fleet id used by sync, get, and deactivate.',
58
- source:
59
- 'Customer DB table, unique row key, and optional equality filters that select candidate rows.',
60
- member:
61
- 'Ordinary monitor tool, stable key template, and payload evaluated for each selected source row.',
62
- selection:
63
- 'Deterministic ranking and an active-member limit between 1 and 1,000.',
64
- },
65
- fixedPolicy: {
66
- cadence: 'daily',
67
- membership: 'sticky',
68
- removalGrace: '7d',
69
- onRemoved: 'deactivate',
70
- ownership:
71
- 'A Fleet may adopt a same-tool ordinary monitor with its deterministic member key. The first Fleet claim wins; another Fleet or a different tool receives a conflict.',
72
- billing:
73
- 'No Fleet fee, permit, or renewal. Dry-run reports ordinary monitor lifecycle charges due now.',
74
- },
75
- stickyMembership:
76
- 'Ranking fills vacancies but never replaces a current member merely because another row ranks higher.',
77
- columnExpression:
78
- 'Use { "$fleet": "column", "name": "column_name" } in a member key or payload to read a value from each source row.',
79
- } as const;
80
-
81
- export type MonitorFleetColumn = {
82
- $fleet: 'column';
83
- name: string;
84
- };
85
-
86
- export type MonitorFleetTemplate = {
87
- $fleet: 'template';
88
- parts: Array<string | MonitorFleetColumn>;
89
- };
90
-
91
- export type MonitorFleetExpression = MonitorFleetColumn | MonitorFleetTemplate;
92
-
93
- export type MonitorFleetDefinition = {
94
- /** Stable lowercase fleet id, used by CLI and API lifecycle commands. */
95
- id: string;
96
- /** Customer DB rows that may become members. */
97
- source: {
98
- kind: 'customer_db_table';
99
- schema: string;
100
- table: string;
101
- key: { column: string; type: 'text' | 'uuid' | 'int4' | 'int8' };
102
- where?: Record<string, string | number | boolean | null>;
103
- };
104
- /** One ordinary monitor definition, evaluated once for each selected row. */
105
- member: {
106
- tool: string;
107
- key: MonitorFleetTemplate;
108
- payload: Record<string, unknown>;
109
- };
110
- /**
111
- * Bounded deterministic candidate selection. Membership is intentionally
112
- * sticky: ranking chooses vacant slots but does not replace existing members
113
- * merely because another row's score changed.
114
- */
115
- selection: {
116
- limit: number;
117
- orderBy: Array<{
118
- column: string;
119
- direction: 'asc' | 'desc';
120
- }>;
121
- membership: 'sticky';
122
- };
123
- };
124
-
125
- export type MonitorFleetContractIssue = {
126
- path: string;
127
- code: string;
128
- message: string;
129
- };
130
-
131
- /** The durable, validated snapshot that a Fleet sync is allowed to execute. */
132
- export type AdmittedMonitorFleetAuthoringContract = {
133
- edition: MonitorFleetAuthoringContractEdition;
134
- definition: MonitorFleetDefinition;
135
- };
136
-
137
- export type MonitorFleetAuthoringContractResult = {
138
- valid: boolean;
139
- contract?: AdmittedMonitorFleetAuthoringContract;
140
- issues: MonitorFleetContractIssue[];
141
- };
142
-
143
- function record(value: unknown): Record<string, unknown> | null {
144
- return value && typeof value === 'object' && !Array.isArray(value)
145
- ? (value as Record<string, unknown>)
146
- : null;
147
- }
148
-
149
- function identifier(value: unknown): value is string {
150
- return typeof value === 'string' && /^[A-Za-z_][A-Za-z0-9_]*$/.test(value);
151
- }
152
-
153
- function exactKeys(
154
- input: Record<string, unknown> | null,
155
- keys: readonly string[],
156
- path: string,
157
- issues: MonitorFleetContractIssue[],
158
- ): void {
159
- if (!input) return;
160
- for (const key of Object.keys(input)) {
161
- if (keys.includes(key)) continue;
162
- issues.push({
163
- path: path ? `${path}.${key}` : key,
164
- code: 'unknown_fleet_field',
165
- message: `${path || 'Fleet'} does not accept '${key}'.`,
166
- });
167
- }
168
- }
169
-
170
- function jsonValue(
171
- value: unknown,
172
- path: string,
173
- issues: MonitorFleetContractIssue[],
174
- ): void {
175
- if (
176
- value === null ||
177
- typeof value === 'string' ||
178
- typeof value === 'boolean' ||
179
- (typeof value === 'number' && Number.isFinite(value))
180
- ) {
181
- return;
182
- }
183
- if (Array.isArray(value)) {
184
- value.forEach((item, index) => jsonValue(item, `${path}.${index}`, issues));
185
- return;
186
- }
187
- const input = record(value);
188
- if (!input) {
189
- issues.push({
190
- path,
191
- code: 'invalid_fleet_json_value',
192
- message: 'Fleet payload values must be JSON values.',
193
- });
194
- return;
195
- }
196
- for (const [key, item] of Object.entries(input)) {
197
- jsonValue(item, `${path}.${key}`, issues);
198
- }
199
- }
200
-
201
- export function fleetColumn(name: string): MonitorFleetColumn {
202
- if (!identifier(name)) throw new Error(`Invalid fleet column '${name}'.`);
203
- return { $fleet: 'column', name };
204
- }
205
-
206
- export function fleetKey(
207
- ...parts: Array<string | MonitorFleetColumn>
208
- ): MonitorFleetTemplate {
209
- if (parts.length === 0)
210
- throw new Error('A fleet key needs at least one part.');
211
- return { $fleet: 'template', parts };
212
- }
213
-
214
- export function defineMonitorFleet<const T extends MonitorFleetDefinition>(
215
- definition: T,
216
- ): T {
217
- return definition;
218
- }
219
-
220
- function validateExpression(
221
- value: unknown,
222
- path: string,
223
- issues: MonitorFleetContractIssue[],
224
- ): void {
225
- const input = record(value);
226
- if (!input || input.$fleet !== 'column' || !identifier(input.name)) {
227
- issues.push({
228
- path,
229
- code: 'invalid_fleet_expression',
230
- message: 'Fleet expressions must be an exact tagged column reference.',
231
- });
232
- return;
233
- }
234
- exactKeys(input, ['$fleet', 'name'], path, issues);
235
- }
236
-
237
- function walkPayload(
238
- value: unknown,
239
- path: string,
240
- issues: MonitorFleetContractIssue[],
241
- ): void {
242
- if (Array.isArray(value)) {
243
- value.forEach((item, index) =>
244
- walkPayload(item, `${path}.${index}`, issues),
245
- );
246
- return;
247
- }
248
- const input = record(value);
249
- if (!input) return;
250
- if ('$fleet' in input) {
251
- validateExpression(input, path, issues);
252
- return;
253
- }
254
- for (const [key, item] of Object.entries(input)) {
255
- walkPayload(item, `${path}.${key}`, issues);
256
- }
257
- }
258
-
259
- export function validateMonitorFleetDefinition(value: unknown): {
260
- valid: boolean;
261
- definition?: MonitorFleetDefinition;
262
- issues: MonitorFleetContractIssue[];
263
- } {
264
- const issues: MonitorFleetContractIssue[] = [];
265
- const input = record(value);
266
- if (!input) {
267
- return {
268
- valid: false,
269
- issues: [
270
- {
271
- path: '',
272
- code: 'invalid_fleet',
273
- message: 'Fleet must be an object.',
274
- },
275
- ],
276
- };
277
- }
278
- exactKeys(input, ['id', 'source', 'member', 'selection'], '', issues);
279
- if (
280
- typeof input.id !== 'string' ||
281
- !/^[a-z][a-z0-9-]{0,199}$/.test(input.id)
282
- ) {
283
- issues.push({
284
- path: 'id',
285
- code: 'invalid_fleet_id',
286
- message: 'Fleet id must be lowercase kebab-case.',
287
- });
288
- }
289
- const source = record(input.source);
290
- exactKeys(
291
- source,
292
- ['kind', 'schema', 'table', 'key', 'where'],
293
- 'source',
294
- issues,
295
- );
296
- if (!source || source.kind !== 'customer_db_table') {
297
- issues.push({
298
- path: 'source.kind',
299
- code: 'invalid_fleet_source',
300
- message: 'Beta fleets require customer_db_table.',
301
- });
302
- }
303
- if (!identifier(source?.schema) || !identifier(source?.table)) {
304
- issues.push({
305
- path: 'source',
306
- code: 'invalid_fleet_table',
307
- message: 'Source schema and table must be SQL identifiers.',
308
- });
309
- }
310
- const sourceKey = record(source?.key);
311
- exactKeys(sourceKey, ['column', 'type'], 'source.key', issues);
312
- if (
313
- !sourceKey ||
314
- !identifier(sourceKey.column) ||
315
- !['text', 'uuid', 'int4', 'int8'].includes(String(sourceKey.type))
316
- ) {
317
- issues.push({
318
- path: 'source.key',
319
- code: 'invalid_fleet_source_key',
320
- message: 'Source key must name a supported typed column.',
321
- });
322
- }
323
- if (source?.where !== undefined) {
324
- const where = record(source.where);
325
- if (!where) {
326
- issues.push({
327
- path: 'source.where',
328
- code: 'invalid_fleet_where',
329
- message: 'source.where must be an object of equality values.',
330
- });
331
- } else {
332
- for (const [column, expected] of Object.entries(where)) {
333
- if (!identifier(column)) {
334
- issues.push({
335
- path: `source.where.${column}`,
336
- code: 'invalid_fleet_where_column',
337
- message: 'source.where keys must be SQL identifiers.',
338
- });
339
- }
340
- if (
341
- expected !== null &&
342
- typeof expected !== 'string' &&
343
- typeof expected !== 'boolean' &&
344
- !(typeof expected === 'number' && Number.isFinite(expected))
345
- ) {
346
- issues.push({
347
- path: `source.where.${column}`,
348
- code: 'invalid_fleet_where_value',
349
- message: 'source.where values must be finite JSON scalars or null.',
350
- });
351
- }
352
- }
353
- }
354
- }
355
- const member = record(input.member);
356
- exactKeys(member, ['tool', 'key', 'payload'], 'member', issues);
357
- const key = record(member?.key);
358
- if (!member || typeof member.tool !== 'string' || !member.tool.trim()) {
359
- issues.push({
360
- path: 'member.tool',
361
- code: 'invalid_fleet_tool',
362
- message: 'Member tool is required.',
363
- });
364
- }
365
- if (
366
- !key ||
367
- key.$fleet !== 'template' ||
368
- !Array.isArray(key.parts) ||
369
- key.parts.length === 0
370
- ) {
371
- issues.push({
372
- path: 'member.key',
373
- code: 'invalid_fleet_key',
374
- message: 'Member key must be a tagged fleet template.',
375
- });
376
- } else {
377
- exactKeys(key, ['$fleet', 'parts'], 'member.key', issues);
378
- for (const [index, part] of key.parts.entries()) {
379
- if (typeof part !== 'string')
380
- validateExpression(part, `member.key.parts.${index}`, issues);
381
- }
382
- if (
383
- sourceKey &&
384
- !key.parts.some(
385
- (part) =>
386
- record(part)?.$fleet === 'column' &&
387
- record(part)?.name === sourceKey.column,
388
- )
389
- ) {
390
- issues.push({
391
- path: 'member.key.parts',
392
- code: 'fleet_key_missing_source_key',
393
- message: 'Member key must include the source key column.',
394
- });
395
- }
396
- }
397
- if (!member || !('payload' in member)) {
398
- issues.push({
399
- path: 'member.payload',
400
- code: 'invalid_fleet_payload',
401
- message: 'Member payload is required.',
402
- });
403
- } else {
404
- jsonValue(member.payload, 'member.payload', issues);
405
- }
406
- walkPayload(member?.payload, 'member.payload', issues);
407
- const selection = record(input.selection);
408
- exactKeys(selection, ['limit', 'orderBy', 'membership'], 'selection', issues);
409
- if (
410
- !selection ||
411
- !Number.isSafeInteger(selection.limit) ||
412
- Number(selection.limit) < 1 ||
413
- Number(selection.limit) > MONITOR_FLEET_MAX_MEMBERS
414
- ) {
415
- issues.push({
416
- path: 'selection.limit',
417
- code: 'MONITOR_FLEET_LIMIT_EXCEEDED',
418
- message: 'selection.limit must be between 1 and 1,000.',
419
- });
420
- }
421
- if (selection?.membership !== 'sticky') {
422
- issues.push({
423
- path: 'selection.membership',
424
- code: 'invalid_fleet_membership',
425
- message: `Fleet membership is fixed to ${MONITOR_FLEET_DOCUMENTATION.fixedPolicy.membership}. ${MONITOR_FLEET_DOCUMENTATION.stickyMembership}`,
426
- });
427
- }
428
- const orderBy = selection?.orderBy;
429
- if (!Array.isArray(orderBy) || orderBy.length === 0) {
430
- issues.push({
431
- path: 'selection.orderBy',
432
- code: 'invalid_fleet_order',
433
- message: 'At least one deterministic order field is required.',
434
- });
435
- } else {
436
- const orderColumns = new Set<string>();
437
- for (const [index, order] of orderBy.entries()) {
438
- const item = record(order);
439
- exactKeys(
440
- item,
441
- ['column', 'direction'],
442
- `selection.orderBy.${index}`,
443
- issues,
444
- );
445
- if (
446
- !item ||
447
- !identifier(item.column) ||
448
- !['asc', 'desc'].includes(String(item.direction))
449
- ) {
450
- issues.push({
451
- path: `selection.orderBy.${index}`,
452
- code: 'invalid_fleet_order',
453
- message: 'Order fields need a column and asc/desc direction.',
454
- });
455
- } else if (orderColumns.has(item.column as string)) {
456
- issues.push({
457
- path: `selection.orderBy.${index}.column`,
458
- code: 'duplicate_fleet_order_column',
459
- message: 'Each selection order column may appear only once.',
460
- });
461
- } else {
462
- orderColumns.add(item.column as string);
463
- }
464
- }
465
- if (sourceKey && record(orderBy.at(-1))?.column !== sourceKey.column) {
466
- issues.push({
467
- path: 'selection.orderBy',
468
- code: 'fleet_order_missing_key',
469
- message: 'The final order field must be the source key.',
470
- });
471
- }
472
- }
473
- for (const removedOption of ['spendLimits', 'lifecycle', 'reconciliation']) {
474
- if (removedOption in input) {
475
- issues.push({
476
- path: removedOption,
477
- code: 'unsupported_fleet_option',
478
- message:
479
- `${removedOption} is fixed by Monitor Fleets and must be omitted. ` +
480
- `Fleets sync ${MONITOR_FLEET_DOCUMENTATION.fixedPolicy.cadence} and ${MONITOR_FLEET_DOCUMENTATION.fixedPolicy.onRemoved} members after ${MONITOR_FLEET_DOCUMENTATION.fixedPolicy.removalGrace} absent from the source.`,
481
- });
482
- }
483
- }
484
- return issues.length === 0
485
- ? { valid: true, definition: value as MonitorFleetDefinition, issues }
486
- : { valid: false, issues };
487
- }
488
-
489
- /**
490
- * Compile JSON into the exact authoring snapshot persisted by a Fleet. This
491
- * does not inspect the Customer DB or provider; use
492
- * `fleets sync --file <fleet.json> --dry-run` for that environment-aware
493
- * preflight, which returns the real plan and the credits due.
494
- */
495
- export function admitMonitorFleetAuthoringContract(
496
- value: unknown,
497
- edition: number = MONITOR_FLEET_AUTHORING_CONTRACT_EDITION,
498
- ): MonitorFleetAuthoringContractResult {
499
- if (
500
- !SUPPORTED_MONITOR_FLEET_AUTHORING_CONTRACT_EDITIONS.includes(
501
- edition as MonitorFleetAuthoringContractEdition,
502
- )
503
- ) {
504
- return {
505
- valid: false,
506
- issues: [
507
- {
508
- path: 'authoring_contract_edition',
509
- code: 'unsupported_fleet_authoring_contract_edition',
510
- message: `Monitor Fleet authoring contract edition ${edition} is not supported.`,
511
- },
512
- ],
513
- };
514
- }
515
- const result = validateMonitorFleetDefinition(value);
516
- return result.valid && result.definition
517
- ? {
518
- valid: true,
519
- contract: {
520
- edition: edition as MonitorFleetAuthoringContractEdition,
521
- // JSON cloning prevents later caller mutation from changing the
522
- // admitted snapshot.
523
- definition: JSON.parse(
524
- JSON.stringify(result.definition),
525
- ) as MonitorFleetDefinition,
526
- },
527
- issues: [],
528
- }
529
- : { valid: false, issues: result.issues };
530
- }
531
-
532
- export function evaluateMonitorFleetValue(
533
- value: unknown,
534
- row: Record<string, unknown>,
535
- ): unknown {
536
- if (Array.isArray(value))
537
- return value.map((item) => evaluateMonitorFleetValue(item, row));
538
- const input = record(value);
539
- if (!input) return value;
540
- if (input.$fleet === 'column') return row[String(input.name)];
541
- if (input.$fleet === 'template' && Array.isArray(input.parts)) {
542
- return input.parts
543
- .map((part) =>
544
- typeof part === 'string'
545
- ? part
546
- : String(evaluateMonitorFleetValue(part, row) ?? ''),
547
- )
548
- .join('');
549
- }
550
- return Object.fromEntries(
551
- Object.entries(input).map(([key, item]) => [
552
- key,
553
- evaluateMonitorFleetValue(item, row),
554
- ]),
555
- );
556
- }
1
+ // Preserve the published SDK entrypoint; the shared contract has one owner.
2
+ export * from '../../shared_libs/integration-contracts/monitor-fleet-contract';
@@ -17,7 +17,7 @@ export {
17
17
  fleetColumn,
18
18
  fleetKey,
19
19
  validateMonitorFleetDefinition,
20
- } from './monitor-fleet-contract.js';
20
+ } from '../../shared_libs/integration-contracts/monitor-fleet-contract';
21
21
 
22
22
  export type {
23
23
  AdmittedMonitorFleetAuthoringContract,
@@ -28,4 +28,4 @@ export type {
28
28
  MonitorFleetDefinition,
29
29
  MonitorFleetExpression,
30
30
  MonitorFleetTemplate,
31
- } from './monitor-fleet-contract.js';
31
+ } from '../../shared_libs/integration-contracts/monitor-fleet-contract';
@@ -199,28 +199,23 @@ export const SDK_RELEASE = {
199
199
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
- // 0.3.90 is the first deliberately versioned SDK release for API v3. Play
203
- // grep hard-cuts to the single Convex full-text index; it does not retain a
204
- // registry/scanner reader for any SDK/API major.
205
- version: '0.3.90',
202
+ // 0.3.90 is the first deliberately versioned SDK release for API v3.
203
+ version: '0.3.92',
206
204
  updateSummary:
207
- 'Play grep now uses one source-only Convex full-text index. It no longer scans the registry, pages through the complete indexed match set, and rejects retired grep modes. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.',
205
+ 'Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.',
208
206
  packageCapabilities: {
209
207
  updatePreferences: 1,
210
208
  },
211
209
  contracts: {
212
210
  api: {
213
211
  name: 'sdk-http-api',
214
- // API v3 hard-cuts Play grep to the canonical Convex index. API v2 stays
215
- // admitted for the explicit SDK support window, but it selects neither a
216
- // registry scanner nor another grep reader: every accepted grep request
217
- // uses the same indexed query and retired flags fail at the API boundary.
212
+ // Concise Play grep has the current wire id. Older ids follow the
213
+ // standard API support window.
218
214
  currentMajor: 3,
219
215
  supportedMajors: [3, 2],
220
- // The first wire id is emitted by the current SDK. Remaining ids are
221
- // accepted only while the API v2 support window is open.
216
+ // Older ids remain subject to the API support window.
222
217
  legacyWireIds: [
223
- '2026-09-play-grep-convex-index-hard-cutover',
218
+ '2026-09-play-grep-concise-results',
224
219
  '2026-07-admin-cli-local-cutover',
225
220
  '2026-07-native-monitor-launch-hard-cutover',
226
221
  ],
@@ -1,4 +1,5 @@
1
1
  import type { PlayCompilerManifest } from '../../shared_libs/plays/compiler-manifest';
2
+ import type { PlayGrepMatch } from '../../shared_libs/plays/play-grep-search';
2
3
  import type { PlayRuntimeSelection } from '../../shared_libs/play-runtime/runtime-environment';
3
4
  import type {
4
5
  PlayActivityObservation,
@@ -666,7 +667,9 @@ export type PlayRunDatasetActions = {
666
667
  scope?: { kind: 'database'; mutability: 'current' };
667
668
  };
668
669
  exportCsv?: PlayRunExportAction & {
669
- scope?: { kind: 'run'; runId: string };
670
+ scope?:
671
+ | { kind: 'database'; mutability: 'current' }
672
+ | { kind: 'run'; runId: string };
670
673
  };
671
674
  };
672
675
 
@@ -1235,6 +1238,8 @@ export interface PlayListItem {
1235
1238
  aliases?: string[];
1236
1239
  triggerStatus?: PlayTriggerStatus;
1237
1240
  costEstimate?: PlayCostEstimate;
1241
+ /** Indexed fields that matched a grep query. */
1242
+ matches?: PlayGrepMatch[];
1238
1243
  }
1239
1244
 
1240
1245
  /** Additive live trigger state shared by list, get, and describe. */