@peer-agent/runtime-core 0.1.0-rc.4 → 0.1.0-rc.41

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.
@@ -53,7 +53,9 @@ export type ContextAccountingPipelineOptions<TState, TRequest, TResponse> = Read
53
53
  error?: unknown;
54
54
  }>) => void;
55
55
  getOverflow?: (response: TResponse) => ContextOverflowEvidence | null | undefined;
56
- fingerprintRequest?: (request: TRequest) => string;
56
+ fingerprintRequest?: (request: TRequest, options?: {
57
+ readonly refresh?: boolean;
58
+ }) => string;
57
59
  now?: () => number;
58
60
  }>;
59
61
  export type ContextAccountingExecuteInput<TState> = Readonly<{
@@ -89,7 +91,17 @@ export declare function createRestoredObservedContextAccountingSnapshot(input: R
89
91
  pendingUncountedChanges?: boolean;
90
92
  now?: number;
91
93
  }>): ContextAccountingSnapshot;
92
- export declare function fingerprintCanonicalRequest(request: unknown): string;
94
+ /** Counts real canonical JSON.stringify passes, not cache hits. Test seam. */
95
+ export declare function readCanonicalRequestFingerprintEvaluations(): number;
96
+ export declare function resetCanonicalRequestFingerprintEvaluations(): void;
97
+ /**
98
+ * Fingerprint a canonical provider request once per object.
99
+ * A later call with the same reference reuses the digest. Pass `{ refresh: true }`
100
+ * only after an await that may have mutated the request, such as a transport retry.
101
+ */
102
+ export declare function fingerprintCanonicalRequest(request: unknown, options?: {
103
+ readonly refresh?: boolean;
104
+ }): string;
93
105
  export declare function parseContextOverflowEvidence(error: unknown): ContextOverflowEvidence | null;
94
106
  export declare function createContextAccountingCompactionPipeline<TState, TRequest, TResponse>(options: ContextAccountingPipelineOptions<TState, TRequest, TResponse>): Readonly<{
95
107
  execute: (input: ContextAccountingExecuteInput<TState>) => Promise<ContextAccountingExecuteResult<TState, TRequest, TResponse>>;
@@ -126,14 +126,39 @@ function stableValue(value, seen) {
126
126
  seen.delete(value);
127
127
  return result;
128
128
  }
129
- export function fingerprintCanonicalRequest(request) {
129
+ const canonicalFingerprintCache = new WeakMap();
130
+ let canonicalFingerprintEvaluations = 0;
131
+ /** Counts real canonical JSON.stringify passes, not cache hits. Test seam. */
132
+ export function readCanonicalRequestFingerprintEvaluations() {
133
+ return canonicalFingerprintEvaluations;
134
+ }
135
+ export function resetCanonicalRequestFingerprintEvaluations() {
136
+ canonicalFingerprintEvaluations = 0;
137
+ }
138
+ /**
139
+ * Fingerprint a canonical provider request once per object.
140
+ * A later call with the same reference reuses the digest. Pass `{ refresh: true }`
141
+ * only after an await that may have mutated the request, such as a transport retry.
142
+ */
143
+ export function fingerprintCanonicalRequest(request, options) {
144
+ const refresh = options?.refresh === true;
145
+ if (!refresh && request !== null && typeof request === 'object') {
146
+ const cached = canonicalFingerprintCache.get(request);
147
+ if (cached)
148
+ return cached;
149
+ }
130
150
  const text = JSON.stringify(stableValue(request, new WeakSet()));
151
+ canonicalFingerprintEvaluations += 1;
131
152
  let hash = 0x811c9dc5;
132
153
  for (let index = 0; index < text.length; index += 1) {
133
154
  hash ^= text.charCodeAt(index);
134
155
  hash = Math.imul(hash, 0x01000193);
135
156
  }
136
- return `ctx_${(hash >>> 0).toString(16).padStart(8, '0')}_${text.length}`;
157
+ const fingerprint = `ctx_${(hash >>> 0).toString(16).padStart(8, '0')}_${text.length}`;
158
+ if (request !== null && typeof request === 'object') {
159
+ canonicalFingerprintCache.set(request, fingerprint);
160
+ }
161
+ return fingerprint;
137
162
  }
138
163
  function errorDetails(error) {
139
164
  if (error instanceof Error) {
@@ -329,14 +354,12 @@ export function createContextAccountingCompactionPipeline(options) {
329
354
  }
330
355
  }
331
356
  };
332
- const count = async (request, requestFingerprint) => {
357
+ // Exact count must not mutate the canonical request. The digest is taken once
358
+ // after the counter returns, so the count path does not stringify again.
359
+ const count = async (request) => {
333
360
  nextCounted = undefined;
334
361
  if (!options.countRequest || counterStatus === 'degraded')
335
- return;
336
- const before = fingerprint(request);
337
- if (before !== requestFingerprint) {
338
- throw new Error('context_request_fingerprint_mismatch: request changed before exact count');
339
- }
362
+ return null;
340
363
  let rawCount;
341
364
  try {
342
365
  rawCount = await options.countRequest(request);
@@ -347,27 +370,23 @@ export function createContextAccountingCompactionPipeline(options) {
347
370
  // explicitly and continue with observed usage instead of blocking chat.
348
371
  counterStatus = 'degraded';
349
372
  nextCounted = undefined;
350
- return;
351
- }
352
- const counted = exactResult(rawCount, capability);
353
- const after = fingerprint(request);
354
- if (after !== requestFingerprint) {
355
- throw new Error('context_request_fingerprint_mismatch: exact counter mutated the canonical request');
373
+ return null;
356
374
  }
357
- if (!counted)
358
- return;
359
- nextCounted = {
360
- inputTokens: counted.inputTokens,
361
- requestFingerprint,
362
- compactionEpoch,
363
- source: counted.source,
364
- countedAt: now(),
365
- };
375
+ return exactResult(rawCount, capability);
366
376
  };
367
377
  const build = async (state) => {
368
378
  const request = await options.buildRequest(state);
379
+ const counted = await count(request);
369
380
  const requestFingerprint = fingerprint(request);
370
- await count(request, requestFingerprint);
381
+ if (counted) {
382
+ nextCounted = {
383
+ inputTokens: counted.inputTokens,
384
+ requestFingerprint,
385
+ compactionEpoch,
386
+ source: counted.source,
387
+ countedAt: now(),
388
+ };
389
+ }
371
390
  latestBuiltFingerprint = requestFingerprint;
372
391
  latestBuiltRequest = request;
373
392
  return { request, requestFingerprint };
@@ -40,6 +40,7 @@ export interface CompactionSummaryCascadeOptions<TMessage extends CompactionMess
40
40
  readonly summarizeStructurally: (messages: readonly TMessage[]) => string | null | undefined;
41
41
  readonly fallbackSummary?: string;
42
42
  }
43
+ export declare function isHumanUserMessage(message: Partial<Pick<CompactionMessage, 'role' | 'content' | '_compaction'>>): boolean;
43
44
  /**
44
45
  * Host-neutral form of Desktop's compaction split rules. System messages are kept
45
46
  * separately; automatic preflight preserves the newest human turn; and a split
@@ -126,7 +126,7 @@ function toolResultIds(message) {
126
126
  function hasToolResult(message) {
127
127
  return message.role === 'tool' || toolResultIds(message).length > 0;
128
128
  }
129
- function isHumanUserMessage(message) {
129
+ export function isHumanUserMessage(message) {
130
130
  if (message.role !== 'user' || message._compaction)
131
131
  return false;
132
132
  const blocks = contentBlocks(message);
@@ -1,3 +1,4 @@
1
+ import type { CanonicalToolMaterialObservation } from '@peer-agent/protocol';
1
2
  export type RuntimeCapabilityId = string;
2
3
  export type RuntimeProviderId = string;
3
4
  export type RuntimeRunId = string;
@@ -29,6 +30,8 @@ export interface RuntimeToolError {
29
30
  readonly details?: unknown;
30
31
  }
31
32
  export interface RuntimeToolResult {
33
+ /** Local canonical bytes; non-enumerable, never event/renderer/provider-message data. */
34
+ readonly materialObservation?: CanonicalToolMaterialObservation;
32
35
  readonly toolCallId: string;
33
36
  readonly capabilityId: RuntimeCapabilityId;
34
37
  readonly status: RuntimeToolStatus;
@@ -4,8 +4,10 @@
4
4
  * Desktop send, Desktop restore and CLI/TUI restore must all cross this seam.
5
5
  * Provider adapters may lower the camelCase tool fields to their wire format,
6
6
  * but must not reinterpret persisted segments.
7
+ * Oversized tool bodies stay intact here so the host can spill them to a
8
+ * local file before the provider request. This projector does not drop them.
7
9
  */
8
- export declare const CANONICAL_HISTORY_PROJECTOR_VERSION = 1;
10
+ export declare const CANONICAL_HISTORY_PROJECTOR_VERSION = 2;
9
11
  export type CanonicalHistoryContentPart = {
10
12
  readonly type: 'text';
11
13
  readonly text: string;
@@ -50,3 +52,11 @@ export declare function formatCanonicalHistoricalLocalRecord(input: {
50
52
  readonly result?: unknown;
51
53
  }): string;
52
54
  export declare function projectConversationHistory(values: readonly unknown[]): CanonicalConversationHistory;
55
+ /**
56
+ * Same projection as projectConversationHistory, but yields during the scan so
57
+ * a long open-session restore does not hold the main thread until it finishes.
58
+ */
59
+ export declare function projectConversationHistoryYielding(values: readonly unknown[], options?: {
60
+ readonly yieldEvery?: number;
61
+ readonly yield?: () => Promise<void>;
62
+ }): Promise<CanonicalConversationHistory>;
@@ -1,11 +1,14 @@
1
+ import { formatResourceFeedbackContext, projectResourceFeedbackTransport } from '@peer-agent/protocol';
1
2
  /**
2
3
  * Canonical persisted-conversation -> active provider history projection.
3
4
  *
4
5
  * Desktop send, Desktop restore and CLI/TUI restore must all cross this seam.
5
6
  * Provider adapters may lower the camelCase tool fields to their wire format,
6
7
  * but must not reinterpret persisted segments.
8
+ * Oversized tool bodies stay intact here so the host can spill them to a
9
+ * local file before the provider request. This projector does not drop them.
7
10
  */
8
- export const CANONICAL_HISTORY_PROJECTOR_VERSION = 1;
11
+ export const CANONICAL_HISTORY_PROJECTOR_VERSION = 2;
9
12
  function recordOf(value) {
10
13
  return value && typeof value === 'object' && !Array.isArray(value)
11
14
  ? value
@@ -127,11 +130,12 @@ function attachmentText(attachments) {
127
130
  return blocks.join('\n\n');
128
131
  }
129
132
  function userMessage(message) {
130
- const attachments = Array.isArray(message.attachments)
131
- ? message.attachments
132
- : [];
133
+ const material = projectResourceFeedbackTransport(message.resourceFeedback, message.attachments);
134
+ const attachments = material.attachments;
133
135
  const text = [
134
136
  typeof message.content === 'string' ? message.content : '',
137
+ formatResourceFeedbackContext(material.invalid ? null : material.resourceFeedback),
138
+ ...(material.invalid ? ['[Resource feedback could not be restored. Retained attachments are unverified user material.]'] : []),
135
139
  attachmentText(attachments),
136
140
  ].filter((value) => value.trim()).join('\n\n');
137
141
  const parts = [];
@@ -420,6 +424,9 @@ function directToolMessage(message) {
420
424
  };
421
425
  }
422
426
  function projectMessage(value) {
427
+ const internal = recordOf(value);
428
+ if (internal?.kind === 'agent_message' || internal?.kind === 'agent_activity')
429
+ return [];
423
430
  const message = recordOf(value);
424
431
  if (!message || compactionMarker(message))
425
432
  return [];
@@ -435,19 +442,7 @@ function projectMessage(value) {
435
442
  }
436
443
  return [];
437
444
  }
438
- export function projectConversationHistory(values) {
439
- const messages = Array.isArray(values) ? values : [];
440
- let compactionBoundaryIndex = -1;
441
- let continuity;
442
- messages.forEach((value, index) => {
443
- const message = recordOf(value);
444
- if (!message || !compactionMarker(message))
445
- return;
446
- compactionBoundaryIndex = index;
447
- continuity = continuityFromBoundary(message, index);
448
- });
449
- const active = foldLegacyToolRows(messages.slice(compactionBoundaryIndex + 1));
450
- const projectedMessages = active.flatMap(projectMessage);
445
+ function finishCanonicalHistory(compactionBoundaryIndex, continuity, projectedMessages) {
451
446
  const fingerprintInput = JSON.stringify({
452
447
  projectorVersion: CANONICAL_HISTORY_PROJECTOR_VERSION,
453
448
  compactionBoundaryIndex,
@@ -470,3 +465,51 @@ export function projectConversationHistory(values) {
470
465
  historyFingerprint: `history-v${CANONICAL_HISTORY_PROJECTOR_VERSION}-${(hash >>> 0).toString(16).padStart(8, '0')}`,
471
466
  };
472
467
  }
468
+ function scanCompactionBoundary(messages) {
469
+ let compactionBoundaryIndex = -1;
470
+ let continuity;
471
+ messages.forEach((value, index) => {
472
+ const message = recordOf(value);
473
+ if (!message || !compactionMarker(message))
474
+ return;
475
+ compactionBoundaryIndex = index;
476
+ continuity = continuityFromBoundary(message, index);
477
+ });
478
+ return { compactionBoundaryIndex, continuity };
479
+ }
480
+ export function projectConversationHistory(values) {
481
+ const messages = Array.isArray(values) ? values : [];
482
+ const scanned = scanCompactionBoundary(messages);
483
+ const active = foldLegacyToolRows(messages.slice(scanned.compactionBoundaryIndex + 1));
484
+ return finishCanonicalHistory(scanned.compactionBoundaryIndex, scanned.continuity, active.flatMap(projectMessage));
485
+ }
486
+ /**
487
+ * Same projection as projectConversationHistory, but yields during the scan so
488
+ * a long open-session restore does not hold the main thread until it finishes.
489
+ */
490
+ export async function projectConversationHistoryYielding(values, options) {
491
+ const messages = Array.isArray(values) ? values : [];
492
+ const yieldEvery = Math.max(1, options?.yieldEvery ?? 200);
493
+ const pause = options?.yield ?? (() => new Promise((resolve) => {
494
+ setTimeout(resolve, 0);
495
+ }));
496
+ let compactionBoundaryIndex = -1;
497
+ let continuity;
498
+ for (let index = 0; index < messages.length; index += 1) {
499
+ if (index > 0 && index % yieldEvery === 0)
500
+ await pause();
501
+ const message = recordOf(messages[index]);
502
+ if (!message || !compactionMarker(message))
503
+ continue;
504
+ compactionBoundaryIndex = index;
505
+ continuity = continuityFromBoundary(message, index);
506
+ }
507
+ const active = foldLegacyToolRows(messages.slice(compactionBoundaryIndex + 1));
508
+ const projectedMessages = [];
509
+ for (let index = 0; index < active.length; index += 1) {
510
+ if (index > 0 && index % yieldEvery === 0)
511
+ await pause();
512
+ projectedMessages.push(...projectMessage(active[index]));
513
+ }
514
+ return finishCanonicalHistory(compactionBoundaryIndex, continuity, projectedMessages);
515
+ }
package/dist/evidence.js CHANGED
@@ -30,6 +30,7 @@ export function collectToolEvidenceRefs(options = {}) {
30
30
  const execution = asEvidenceObject(options.execution);
31
31
  const result = asEvidenceObject(execution?.result);
32
32
  const evidence = asEvidenceObject(result?.evidence);
33
+ addEvidenceRefStrings(refs, evidence?.refs);
33
34
  addEvidenceRefStrings(refs, evidence?.artifactRefs);
34
35
  const outputPreview = asEvidenceObject(result?.outputPreview);
35
36
  addEvidenceRefStrings(refs, outputPreview?.artifactRef);
@@ -46,6 +46,8 @@ export declare function decideGoalToolReplay(input: {
46
46
  readonly evidenceRefs?: readonly string[];
47
47
  readonly toolCallId?: string;
48
48
  }> | null;
49
+ /** Host-owned tool metadata; transient context must be re-admitted after recovery. */
50
+ readonly requiresFreshResult?: boolean;
49
51
  }): GoalToolReplayDecision;
50
52
  export interface GoalIdempotencyLedgerEntry {
51
53
  status: string;
@@ -16,6 +16,8 @@ export const GOAL_TOOL_REPLAY_POLICIES = Object.freeze([
16
16
  ]);
17
17
  const READ_ONLY_TOOLS = new Set([
18
18
  'read_file',
19
+ 'view_image',
20
+ 'git_query',
19
21
  'list_files',
20
22
  'search_files',
21
23
  'batch_search',
@@ -151,6 +153,9 @@ export function decideGoalToolReplay(input) {
151
153
  intent: input.intent,
152
154
  });
153
155
  const ledgerHit = input.completedLedger?.get(idempotencyKey) ?? null;
156
+ if (input.requiresFreshResult && mutationClass === 'read_only') {
157
+ return { action: 'execute', reason: 'fresh_read_context_required', policy: 'safe_retry', mutationClass, idempotencyKey };
158
+ }
154
159
  if (ledgerHit && (ledgerHit.status === 'completed' || ledgerHit.status === 'succeeded')) {
155
160
  return {
156
161
  action: 'reuse',
@@ -0,0 +1,225 @@
1
+ /**
2
+ * Shared Goal / Plan tool contracts (platform-neutral).
3
+ *
4
+ * Single source of truth for what the model sees about the goal toolchain: the
5
+ * tool description (prompt) and the JSON input schema. Desktop and TUI both
6
+ * project from here, so the model-visible contract cannot drift per surface.
7
+ *
8
+ * Deliberately NOT owned here (stays in each surface's Manifest):
9
+ * - permissionPolicy / runtime adapter / availableInModes (platform policy)
10
+ * - execution logic and goal-plan-store wiring
11
+ *
12
+ * Note: `local-tool-contracts.ts` owns toolName + capabilityId only; input
13
+ * schemas stay with their capability module. This file is the goal capability's
14
+ * schema module.
15
+ */
16
+ export declare const GOAL_CREATE_PLAN_PROMPT: string;
17
+ export declare const GOAL_UPDATE_TASK_PROMPT: string;
18
+ export declare const GOAL_GET_PLAN_PROMPT: string;
19
+ export declare const GOAL_REQUEST_EXPLORER_PROMPT: string;
20
+ export declare const GOAL_CREATE_PLAN_INPUT_SCHEMA: {
21
+ readonly type: "object";
22
+ readonly properties: {
23
+ readonly title: {
24
+ readonly type: "string";
25
+ readonly description: string;
26
+ };
27
+ readonly goal: {
28
+ readonly type: "string";
29
+ readonly description: "The concrete goal this plan aims to achieve, in one or two sentences.";
30
+ };
31
+ readonly targetWorkspacePath: {
32
+ readonly type: "string";
33
+ readonly description: string;
34
+ };
35
+ readonly parentPlanId: {
36
+ readonly type: "string";
37
+ readonly description: string;
38
+ };
39
+ readonly sourceTaskId: {
40
+ readonly type: "string";
41
+ readonly description: string;
42
+ };
43
+ readonly tasks: {
44
+ readonly type: "array";
45
+ readonly description: "Ordered list of subtasks that make up the plan.";
46
+ readonly items: {
47
+ readonly type: "object";
48
+ readonly properties: {
49
+ readonly taskId: {
50
+ readonly type: "string";
51
+ readonly description: "Optional stable id for the subtask; generated if omitted.";
52
+ };
53
+ readonly title: {
54
+ readonly type: "string";
55
+ readonly description: string;
56
+ };
57
+ readonly dependsOn: {
58
+ readonly type: "array";
59
+ readonly items: {
60
+ readonly type: "string";
61
+ };
62
+ readonly description: "taskIds this subtask depends on (must run after them).";
63
+ };
64
+ };
65
+ readonly required: readonly ["title"];
66
+ readonly additionalProperties: false;
67
+ };
68
+ };
69
+ readonly successCriteria: {
70
+ readonly type: "array";
71
+ readonly description: string;
72
+ readonly items: {
73
+ readonly oneOf: readonly [{
74
+ readonly type: "string";
75
+ }, {
76
+ readonly type: "object";
77
+ readonly properties: {
78
+ readonly id: {
79
+ readonly type: "string";
80
+ readonly description: "Optional stable id for this criterion; generated if omitted.";
81
+ };
82
+ readonly kind: {
83
+ readonly type: "string";
84
+ readonly enum: readonly ["command", "test", "file-contains", "file-exists", "manual"];
85
+ readonly description: string;
86
+ };
87
+ readonly description: {
88
+ readonly type: "string";
89
+ readonly description: "Human-readable statement of what \"done\" means for this criterion.";
90
+ };
91
+ readonly command: {
92
+ readonly type: "string";
93
+ readonly description: "Shell/test command to run (for kind=command/test).";
94
+ };
95
+ readonly path: {
96
+ readonly type: "string";
97
+ readonly description: "Target file path (for kind=file-contains/file-exists).";
98
+ };
99
+ readonly expect: {
100
+ readonly type: "string";
101
+ readonly description: "Expected substring the file must contain (for kind=file-contains).";
102
+ };
103
+ };
104
+ readonly required: readonly ["kind"];
105
+ readonly additionalProperties: false;
106
+ }];
107
+ };
108
+ };
109
+ };
110
+ readonly required: readonly ["title", "goal", "tasks"];
111
+ readonly additionalProperties: false;
112
+ };
113
+ export declare const GOAL_UPDATE_TASK_INPUT_SCHEMA: {
114
+ readonly type: "object";
115
+ readonly properties: {
116
+ readonly planId: {
117
+ readonly type: "string";
118
+ readonly description: "Target goal plan id (planId).";
119
+ };
120
+ readonly taskId: {
121
+ readonly type: "string";
122
+ readonly description: "Target subtask id (taskId) within the plan. Must reference a leaf subtask when setting completion.";
123
+ };
124
+ readonly status: {
125
+ readonly type: "string";
126
+ readonly enum: readonly ["pending", "running", "completed", "failed", "cancelled", "waiting_user"];
127
+ readonly description: "New execution status for the subtask. Use \"completed\" only with evidenceRefs.";
128
+ };
129
+ readonly evidenceRefs: {
130
+ readonly type: "array";
131
+ readonly items: {
132
+ readonly type: "string";
133
+ };
134
+ readonly description: "Artifact refs / tool-result refs that prove the subtask outcome. Required to mark completed.";
135
+ };
136
+ readonly result: {
137
+ readonly type: "string";
138
+ readonly description: "Short factual summary of what was produced (optional).";
139
+ };
140
+ readonly failureReason: {
141
+ readonly type: "string";
142
+ readonly description: "Why the subtask failed (when status=failed).";
143
+ };
144
+ readonly blockedReason: {
145
+ readonly type: "string";
146
+ readonly description: "Why the subtask is blocked / waiting (when status=waiting_user).";
147
+ };
148
+ readonly criterionResults: {
149
+ readonly type: "array";
150
+ readonly description: string;
151
+ readonly items: {
152
+ readonly type: "object";
153
+ readonly properties: {
154
+ readonly criterionId: {
155
+ readonly type: "string";
156
+ readonly description: "The id of the success criterion this result verifies.";
157
+ };
158
+ readonly passed: {
159
+ readonly type: "boolean";
160
+ readonly description: "Whether the criterion check passed.";
161
+ };
162
+ readonly evidenceRef: {
163
+ readonly type: "string";
164
+ readonly description: "Artifact/tool-result ref proving the check outcome (e.g. the shell result ref).";
165
+ };
166
+ readonly detail: {
167
+ readonly type: "string";
168
+ readonly description: "Short human-readable detail of what was checked / observed.";
169
+ };
170
+ };
171
+ readonly required: readonly ["criterionId", "passed"];
172
+ readonly additionalProperties: false;
173
+ };
174
+ };
175
+ };
176
+ readonly required: readonly ["planId", "taskId"];
177
+ readonly additionalProperties: false;
178
+ };
179
+ export declare const GOAL_GET_PLAN_INPUT_SCHEMA: {
180
+ readonly type: "object";
181
+ readonly properties: {
182
+ readonly planId: {
183
+ readonly type: "string";
184
+ readonly description: "Target goal plan id (planId) to read back. Omit to list the active plans for the current conversation.";
185
+ };
186
+ };
187
+ readonly required: readonly [];
188
+ readonly additionalProperties: false;
189
+ };
190
+ export declare const GOAL_REQUEST_EXPLORER_INPUT_SCHEMA: {
191
+ readonly type: "object";
192
+ readonly properties: {
193
+ readonly question: {
194
+ readonly type: "string";
195
+ readonly description: "The focused, read-only question the Explorer should answer (what to find out).";
196
+ };
197
+ readonly reason: {
198
+ readonly type: "string";
199
+ readonly description: "Why answering this question helps advance the current goal.";
200
+ };
201
+ readonly scope: {
202
+ readonly type: "object";
203
+ readonly description: "Optional path hints to scope the read-only investigation.";
204
+ readonly properties: {
205
+ readonly include: {
206
+ readonly type: "array";
207
+ readonly items: {
208
+ readonly type: "string";
209
+ };
210
+ readonly description: "Path globs / directories the Explorer should focus on.";
211
+ };
212
+ readonly exclude: {
213
+ readonly type: "array";
214
+ readonly items: {
215
+ readonly type: "string";
216
+ };
217
+ readonly description: "Path globs / directories the Explorer should avoid.";
218
+ };
219
+ };
220
+ readonly additionalProperties: false;
221
+ };
222
+ };
223
+ readonly required: readonly ["question"];
224
+ readonly additionalProperties: false;
225
+ };