@kingsoftcloud/agentkit-harness-core 0.0.31 → 0.0.32

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.
@@ -69,27 +69,82 @@ function modelSize(result) {
69
69
  return bytes(canonical({ content: result.context?.content ?? canonical(result.content), media: result.context?.media ?? [],
70
70
  additionalContexts: result.additionalContexts ?? [] }));
71
71
  }
72
- function offloadedView(result, payloadBytes, maximum, ref, preview, unavailable) {
72
+ function offloadedView(result, payloadBytes, maximum, ref, preview, unavailable, commandPreview) {
73
73
  const base = { code: ref ? 'tool_result_offloaded' : 'tool_result_truncated', execution_status: result.status,
74
74
  original_bytes: payloadBytes, artifact_state: ref ? 'available' : 'unavailable',
75
75
  instruction: ref ? 'Read the granted artifact for omitted text. The original tool has already returned; do not repeat its effects.'
76
76
  : 'Omitted text is unavailable. The original execution status is unchanged; do not repeat effects to recover its output.',
77
77
  ...(ref ? { artifact_uri: ref.uri } : {}), ...(unavailable ? { archive_error: 'archive_unavailable' } : {}),
78
78
  ...(result.context?.media?.length ? { media_observation: 'Inline media omitted; it has not been observed in this response.' } : {}) };
79
+ const evidence = {};
80
+ if (commandPreview) {
81
+ const { exit_code, task_id, stdout_cursor, stderr_cursor } = commandPreview;
82
+ if (exit_code === null || typeof exit_code === 'number' && Number.isSafeInteger(exit_code))
83
+ evidence.exit_code = exit_code;
84
+ if (typeof task_id === 'string' && /^[a-zA-Z0-9_-]{1,128}$/.test(task_id))
85
+ evidence.task_id = task_id;
86
+ if (typeof stdout_cursor === 'number' && Number.isSafeInteger(stdout_cursor) && stdout_cursor >= 0)
87
+ evidence.stdout_cursor = stdout_cursor;
88
+ if (typeof stderr_cursor === 'number' && Number.isSafeInteger(stderr_cursor) && stderr_cursor >= 0)
89
+ evidence.stderr_cursor = stderr_cursor;
90
+ preview = ['stdout', 'stderr'].filter(key => typeof commandPreview[key] === 'string')
91
+ .map(key => key + ': ' + commandPreview[key]).join('\n');
92
+ }
79
93
  // Account for JSON escaping and the complete ToolContext framing, not just preview characters.
80
94
  const chars = Array.from(preview);
81
95
  let low = 0, high = chars.length;
82
- const encode = (count) => canonical({ ...base, preview: chars.slice(0, count).join('') });
83
- invariant(bytes(canonical({ content: encode(0), media: [], additionalContexts: [] })) <= maximum, 'artifact_result_budget_too_small');
96
+ const encode = (count) => {
97
+ const head = commandPreview && count > 1 && count < chars.length ? Math.ceil(count / 2) : count;
98
+ const excerpt = chars.slice(0, head).join('') + (count > head ? '\n…\n' + chars.slice(-(count - head)).join('') : '');
99
+ return canonical({ ...base, ...evidence, preview: excerpt });
100
+ };
101
+ const fits = (count) => bytes(canonical({ content: encode(count), media: [], additionalContexts: [] })) <= maximum;
102
+ for (const key of ['task_id', 'stderr_cursor', 'stdout_cursor', 'exit_code']) {
103
+ if (fits(0))
104
+ break;
105
+ delete evidence[key];
106
+ }
107
+ invariant(fits(0), 'artifact_result_budget_too_small');
108
+ if (fits(high))
109
+ return encode(high);
84
110
  while (low < high) {
85
111
  const mid = Math.ceil((low + high) / 2);
86
- if (bytes(canonical({ content: encode(mid), media: [], additionalContexts: [] })) <= maximum)
112
+ if (fits(mid))
87
113
  low = mid;
88
114
  else
89
115
  high = mid - 1;
90
116
  }
91
117
  return encode(low);
92
118
  }
119
+ function commandOutputPreview(result, definition, config) {
120
+ if (config.contextPolicy?.commandOutputProjection !== 'receipt-preview/v1'
121
+ || definition.name !== 'run_command' || definition.workspaceChangePolicy !== 'observed-command/v1'
122
+ || result.context?.media?.length || result.additionalContexts?.length
123
+ || config.contract.allowedToolNames !== null && !config.contract.allowedToolNames.includes('ArtifactRead'))
124
+ return null;
125
+ let observed;
126
+ try {
127
+ observed = parseNativeJson(projectToolResultContext(result, config).content);
128
+ }
129
+ catch {
130
+ return null;
131
+ }
132
+ if (!object(observed))
133
+ return null;
134
+ const sizes = {}, preview = { ...observed };
135
+ for (const stream of ['stdout', 'stderr']) {
136
+ const text = observed[stream];
137
+ if (typeof text !== 'string' || bytes(text) <= 2048)
138
+ continue;
139
+ const chars = Array.from(text);
140
+ const tail = stream === 'stderr' ? 768 : 512;
141
+ if (chars.length <= 128 + tail)
142
+ continue;
143
+ sizes[`${stream}_receipt_bytes`] = bytes(text);
144
+ preview[stream] = chars.slice(0, 128).join('') + '\n…\n' + chars.slice(-tail).join('');
145
+ }
146
+ return Object.keys(sizes).length ? { ...preview, output_preview: sizes } : null;
147
+ }
93
148
  /** Runs within the original durable tool intent. Archive failures never relabel a known mutation or cause a retry. */
94
149
  export async function governArtifactResult(context, definition, input, config, artifacts) {
95
150
  if (config.artifactPolicy !== RUNTIME_ARTIFACT_POLICY)
@@ -135,7 +190,8 @@ export async function governArtifactResult(context, definition, input, config, a
135
190
  return result;
136
191
  const tooLarge = modelObservationBytes(result, config) > config.limits.maxToolResultBytes;
137
192
  const force = ['archived-model-view/v4', 'archived-model-view/v5'].includes(definition.resultArchivePolicy ?? '') && result.status === 'ok';
138
- if (!tooLarge && !force)
193
+ const commandPreview = commandOutputPreview(result, definition, config);
194
+ if (!tooLarge && !force && !commandPreview)
139
195
  return result;
140
196
  // Preserve the canonical receipt in SQLite. The readable archive follows the actual post-policy model view;
141
197
  // hidden/raw Host facts must not become visible merely by asking ArtifactRead for the overflow.
@@ -156,6 +212,17 @@ export async function governArtifactResult(context, definition, input, config, a
156
212
  catch { /* The original tool outcome remains authoritative even when storage fails. */ }
157
213
  if (ref)
158
214
  result.artifactRefs = [ref];
215
+ if (commandPreview && ref) {
216
+ const content = canonical({ ...commandPreview, artifact_uri: ref.uri, artifact_state: 'available',
217
+ output_preview_instruction: 'Read the granted artifact for omitted receipt text. Output cursors still refer to the original command. Do not repeat its effects.' });
218
+ if (modelSize({ ...result, context: { content } }) <= config.limits.maxToolResultBytes
219
+ && bytes(content) < bytes(projectToolResultContext(result, config).content)) {
220
+ result.context = { ...result.context, content };
221
+ return result;
222
+ }
223
+ if (!tooLarge && !force)
224
+ return result;
225
+ }
159
226
  // Pixel observations use the independent image allowance; a forced text archive cannot erase them.
160
227
  if (config.modelSurface && !tooLarge && result.context?.media?.length)
161
228
  return result;
@@ -177,7 +244,7 @@ export async function governArtifactResult(context, definition, input, config, a
177
244
  }
178
245
  if (!tooLarge && !ref)
179
246
  return result;
180
- result.context = { content: offloadedView(result, bytes(content), config.limits.maxToolResultBytes, ref, result.context?.content ?? canonical(result.content), !ref) };
247
+ result.context = { content: offloadedView(result, bytes(content), config.limits.maxToolResultBytes, ref, result.context?.content ?? canonical(result.content), !ref, commandPreview) };
181
248
  delete result.additionalContexts;
182
249
  return result;
183
250
  }
@@ -9,6 +9,7 @@ export declare const builtinStrategies: Readonly<{
9
9
  todoItems(value: unknown): import("./contracts.mjs").TodoItem[];
10
10
  executeTodo(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall): ToolResult;
11
11
  reduceTodo(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall, result: ToolResult): RunSnapshot["todos"] | undefined;
12
+ projectTodoWriteReceipt(message: import("./contracts.mjs").Message): import("./contracts.mjs").Message;
12
13
  todoReminder(snapshot: RunSnapshot, config: RunConfiguration): Partial<RunSnapshot> | null;
13
14
  todoUpdateFact(snapshot: RunSnapshot, messageCursor: number): ObjectValue;
14
15
  TODO_POLICY: "session-todos/v1";
@@ -61,18 +62,8 @@ export declare const builtinStrategies: Readonly<{
61
62
  delivery: Readonly<{
62
63
  deliveryScopeEnabled(config: Pick<RunConfiguration, "deliveryScopePolicy">): boolean;
63
64
  deliveryToolDefinitions(policy?: RunConfiguration["deliveryScopePolicy"]): import("./contracts.mjs").ToolDefinition[];
64
- deliveryArtifacts(value: unknown): delivery.DeliveryArtifact[];
65
- isDeliveryCall(config: RunConfiguration, call: Pick<ToolCall, "name">): boolean;
66
- validateDeliveryConfiguration(config: RunConfiguration): void;
67
- executeDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall): ToolResult;
68
- reduceDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall, result: ToolResult): Partial<RunSnapshot>;
69
- deliveryManifestChanges(snapshot: RunSnapshot, values: unknown): Partial<RunSnapshot>;
70
- currentDeliveryManifest(snapshot: RunSnapshot): delivery.DeliveryManifest | null;
71
- webDelivery(snapshot: RunSnapshot): delivery.DeliveryArtifact | null;
72
- DELIVERY_SCOPE_POLICY: "declared-deliverables/v1";
73
- RESULT_DELIVERY_POLICY: "answer-artifacts/v2";
74
- DECLARE_DELIVERABLES: "declare_deliverables";
75
- deliveryArtifactsSchema: {
65
+ usesHistoricalDeliveryTools(config: RunConfiguration): boolean;
66
+ deliverySchemaForRun(config: RunConfiguration): {
76
67
  type: string;
77
68
  maxItems: number;
78
69
  items: {
@@ -95,6 +86,102 @@ export declare const builtinStrategies: Readonly<{
95
86
  };
96
87
  };
97
88
  };
89
+ } | {
90
+ type: string;
91
+ maxItems: number;
92
+ items: {
93
+ oneOf: ({
94
+ type: string;
95
+ additionalProperties: boolean;
96
+ required: string[];
97
+ properties: {
98
+ kind: {
99
+ type: string;
100
+ const: string;
101
+ };
102
+ path: {
103
+ type: string;
104
+ minLength: number;
105
+ maxLength: number;
106
+ };
107
+ root?: never;
108
+ };
109
+ } | {
110
+ type: string;
111
+ additionalProperties: boolean;
112
+ required: string[];
113
+ properties: {
114
+ kind: {
115
+ type: string;
116
+ const: string;
117
+ };
118
+ path: {
119
+ type: string;
120
+ minLength: number;
121
+ maxLength: number;
122
+ };
123
+ root: {
124
+ type: string;
125
+ minLength: number;
126
+ maxLength: number;
127
+ };
128
+ };
129
+ })[];
130
+ };
131
+ };
132
+ deliveryArtifacts(value: unknown): delivery.DeliveryArtifact[];
133
+ isDeliveryCall(config: RunConfiguration, call: Pick<ToolCall, "name">): boolean;
134
+ validateDeliveryConfiguration(config: RunConfiguration): void;
135
+ executeDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall): ToolResult;
136
+ reduceDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall, result: ToolResult): Partial<RunSnapshot>;
137
+ deliveryManifestChanges(snapshot: RunSnapshot, values: unknown): Partial<RunSnapshot>;
138
+ currentDeliveryManifest(snapshot: RunSnapshot): delivery.DeliveryManifest | null;
139
+ webDelivery(snapshot: RunSnapshot): delivery.DeliveryArtifact | null;
140
+ DELIVERY_SCOPE_POLICY: "declared-deliverables/v1";
141
+ RESULT_DELIVERY_POLICY: "answer-artifacts/v2";
142
+ DECLARE_DELIVERABLES: "declare_deliverables";
143
+ deliveryArtifactsSchema: {
144
+ type: string;
145
+ maxItems: number;
146
+ items: {
147
+ oneOf: ({
148
+ type: string;
149
+ additionalProperties: boolean;
150
+ required: string[];
151
+ properties: {
152
+ kind: {
153
+ type: string;
154
+ const: string;
155
+ };
156
+ path: {
157
+ type: string;
158
+ minLength: number;
159
+ maxLength: number;
160
+ };
161
+ root?: never;
162
+ };
163
+ } | {
164
+ type: string;
165
+ additionalProperties: boolean;
166
+ required: string[];
167
+ properties: {
168
+ kind: {
169
+ type: string;
170
+ const: string;
171
+ };
172
+ path: {
173
+ type: string;
174
+ minLength: number;
175
+ maxLength: number;
176
+ };
177
+ root: {
178
+ type: string;
179
+ minLength: number;
180
+ maxLength: number;
181
+ };
182
+ };
183
+ })[];
184
+ };
98
185
  };
99
186
  }>;
100
187
  }>;
@@ -116,18 +203,8 @@ export declare const builtinPolicyModules: readonly (Readonly<{
116
203
  strategy: Readonly<{
117
204
  deliveryScopeEnabled(config: Pick<RunConfiguration, "deliveryScopePolicy">): boolean;
118
205
  deliveryToolDefinitions(policy?: RunConfiguration["deliveryScopePolicy"]): import("./contracts.mjs").ToolDefinition[];
119
- deliveryArtifacts(value: unknown): delivery.DeliveryArtifact[];
120
- isDeliveryCall(config: RunConfiguration, call: Pick<ToolCall, "name">): boolean;
121
- validateDeliveryConfiguration(config: RunConfiguration): void;
122
- executeDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall): ToolResult;
123
- reduceDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall, result: ToolResult): Partial<RunSnapshot>;
124
- deliveryManifestChanges(snapshot: RunSnapshot, values: unknown): Partial<RunSnapshot>;
125
- currentDeliveryManifest(snapshot: RunSnapshot): delivery.DeliveryManifest | null;
126
- webDelivery(snapshot: RunSnapshot): delivery.DeliveryArtifact | null;
127
- DELIVERY_SCOPE_POLICY: "declared-deliverables/v1";
128
- RESULT_DELIVERY_POLICY: "answer-artifacts/v2";
129
- DECLARE_DELIVERABLES: "declare_deliverables";
130
- deliveryArtifactsSchema: {
206
+ usesHistoricalDeliveryTools(config: RunConfiguration): boolean;
207
+ deliverySchemaForRun(config: RunConfiguration): {
131
208
  type: string;
132
209
  maxItems: number;
133
210
  items: {
@@ -150,6 +227,102 @@ export declare const builtinPolicyModules: readonly (Readonly<{
150
227
  };
151
228
  };
152
229
  };
230
+ } | {
231
+ type: string;
232
+ maxItems: number;
233
+ items: {
234
+ oneOf: ({
235
+ type: string;
236
+ additionalProperties: boolean;
237
+ required: string[];
238
+ properties: {
239
+ kind: {
240
+ type: string;
241
+ const: string;
242
+ };
243
+ path: {
244
+ type: string;
245
+ minLength: number;
246
+ maxLength: number;
247
+ };
248
+ root?: never;
249
+ };
250
+ } | {
251
+ type: string;
252
+ additionalProperties: boolean;
253
+ required: string[];
254
+ properties: {
255
+ kind: {
256
+ type: string;
257
+ const: string;
258
+ };
259
+ path: {
260
+ type: string;
261
+ minLength: number;
262
+ maxLength: number;
263
+ };
264
+ root: {
265
+ type: string;
266
+ minLength: number;
267
+ maxLength: number;
268
+ };
269
+ };
270
+ })[];
271
+ };
272
+ };
273
+ deliveryArtifacts(value: unknown): delivery.DeliveryArtifact[];
274
+ isDeliveryCall(config: RunConfiguration, call: Pick<ToolCall, "name">): boolean;
275
+ validateDeliveryConfiguration(config: RunConfiguration): void;
276
+ executeDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall): ToolResult;
277
+ reduceDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall, result: ToolResult): Partial<RunSnapshot>;
278
+ deliveryManifestChanges(snapshot: RunSnapshot, values: unknown): Partial<RunSnapshot>;
279
+ currentDeliveryManifest(snapshot: RunSnapshot): delivery.DeliveryManifest | null;
280
+ webDelivery(snapshot: RunSnapshot): delivery.DeliveryArtifact | null;
281
+ DELIVERY_SCOPE_POLICY: "declared-deliverables/v1";
282
+ RESULT_DELIVERY_POLICY: "answer-artifacts/v2";
283
+ DECLARE_DELIVERABLES: "declare_deliverables";
284
+ deliveryArtifactsSchema: {
285
+ type: string;
286
+ maxItems: number;
287
+ items: {
288
+ oneOf: ({
289
+ type: string;
290
+ additionalProperties: boolean;
291
+ required: string[];
292
+ properties: {
293
+ kind: {
294
+ type: string;
295
+ const: string;
296
+ };
297
+ path: {
298
+ type: string;
299
+ minLength: number;
300
+ maxLength: number;
301
+ };
302
+ root?: never;
303
+ };
304
+ } | {
305
+ type: string;
306
+ additionalProperties: boolean;
307
+ required: string[];
308
+ properties: {
309
+ kind: {
310
+ type: string;
311
+ const: string;
312
+ };
313
+ path: {
314
+ type: string;
315
+ minLength: number;
316
+ maxLength: number;
317
+ };
318
+ root: {
319
+ type: string;
320
+ minLength: number;
321
+ maxLength: number;
322
+ };
323
+ };
324
+ })[];
325
+ };
153
326
  };
154
327
  }>;
155
328
  tool: InternalToolPolicy;
@@ -164,18 +337,8 @@ export declare const builtinPolicyModules: readonly (Readonly<{
164
337
  strategy: Readonly<{
165
338
  deliveryScopeEnabled(config: Pick<RunConfiguration, "deliveryScopePolicy">): boolean;
166
339
  deliveryToolDefinitions(policy?: RunConfiguration["deliveryScopePolicy"]): import("./contracts.mjs").ToolDefinition[];
167
- deliveryArtifacts(value: unknown): delivery.DeliveryArtifact[];
168
- isDeliveryCall(config: RunConfiguration, call: Pick<ToolCall, "name">): boolean;
169
- validateDeliveryConfiguration(config: RunConfiguration): void;
170
- executeDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall): ToolResult;
171
- reduceDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall, result: ToolResult): Partial<RunSnapshot>;
172
- deliveryManifestChanges(snapshot: RunSnapshot, values: unknown): Partial<RunSnapshot>;
173
- currentDeliveryManifest(snapshot: RunSnapshot): delivery.DeliveryManifest | null;
174
- webDelivery(snapshot: RunSnapshot): delivery.DeliveryArtifact | null;
175
- DELIVERY_SCOPE_POLICY: "declared-deliverables/v1";
176
- RESULT_DELIVERY_POLICY: "answer-artifacts/v2";
177
- DECLARE_DELIVERABLES: "declare_deliverables";
178
- deliveryArtifactsSchema: {
340
+ usesHistoricalDeliveryTools(config: RunConfiguration): boolean;
341
+ deliverySchemaForRun(config: RunConfiguration): {
179
342
  type: string;
180
343
  maxItems: number;
181
344
  items: {
@@ -198,6 +361,102 @@ export declare const builtinPolicyModules: readonly (Readonly<{
198
361
  };
199
362
  };
200
363
  };
364
+ } | {
365
+ type: string;
366
+ maxItems: number;
367
+ items: {
368
+ oneOf: ({
369
+ type: string;
370
+ additionalProperties: boolean;
371
+ required: string[];
372
+ properties: {
373
+ kind: {
374
+ type: string;
375
+ const: string;
376
+ };
377
+ path: {
378
+ type: string;
379
+ minLength: number;
380
+ maxLength: number;
381
+ };
382
+ root?: never;
383
+ };
384
+ } | {
385
+ type: string;
386
+ additionalProperties: boolean;
387
+ required: string[];
388
+ properties: {
389
+ kind: {
390
+ type: string;
391
+ const: string;
392
+ };
393
+ path: {
394
+ type: string;
395
+ minLength: number;
396
+ maxLength: number;
397
+ };
398
+ root: {
399
+ type: string;
400
+ minLength: number;
401
+ maxLength: number;
402
+ };
403
+ };
404
+ })[];
405
+ };
406
+ };
407
+ deliveryArtifacts(value: unknown): delivery.DeliveryArtifact[];
408
+ isDeliveryCall(config: RunConfiguration, call: Pick<ToolCall, "name">): boolean;
409
+ validateDeliveryConfiguration(config: RunConfiguration): void;
410
+ executeDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall): ToolResult;
411
+ reduceDelivery(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall, result: ToolResult): Partial<RunSnapshot>;
412
+ deliveryManifestChanges(snapshot: RunSnapshot, values: unknown): Partial<RunSnapshot>;
413
+ currentDeliveryManifest(snapshot: RunSnapshot): delivery.DeliveryManifest | null;
414
+ webDelivery(snapshot: RunSnapshot): delivery.DeliveryArtifact | null;
415
+ DELIVERY_SCOPE_POLICY: "declared-deliverables/v1";
416
+ RESULT_DELIVERY_POLICY: "answer-artifacts/v2";
417
+ DECLARE_DELIVERABLES: "declare_deliverables";
418
+ deliveryArtifactsSchema: {
419
+ type: string;
420
+ maxItems: number;
421
+ items: {
422
+ oneOf: ({
423
+ type: string;
424
+ additionalProperties: boolean;
425
+ required: string[];
426
+ properties: {
427
+ kind: {
428
+ type: string;
429
+ const: string;
430
+ };
431
+ path: {
432
+ type: string;
433
+ minLength: number;
434
+ maxLength: number;
435
+ };
436
+ root?: never;
437
+ };
438
+ } | {
439
+ type: string;
440
+ additionalProperties: boolean;
441
+ required: string[];
442
+ properties: {
443
+ kind: {
444
+ type: string;
445
+ const: string;
446
+ };
447
+ path: {
448
+ type: string;
449
+ minLength: number;
450
+ maxLength: number;
451
+ };
452
+ root: {
453
+ type: string;
454
+ minLength: number;
455
+ maxLength: number;
456
+ };
457
+ };
458
+ })[];
459
+ };
201
460
  };
202
461
  }>;
203
462
  tool: InternalToolPolicy;
@@ -215,6 +474,7 @@ export declare const builtinPolicyModules: readonly (Readonly<{
215
474
  todoItems(value: unknown): import("./contracts.mjs").TodoItem[];
216
475
  executeTodo(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall): ToolResult;
217
476
  reduceTodo(snapshot: RunSnapshot, config: RunConfiguration, call: ToolCall, result: ToolResult): RunSnapshot["todos"] | undefined;
477
+ projectTodoWriteReceipt(message: import("./contracts.mjs").Message): import("./contracts.mjs").Message;
218
478
  todoReminder(snapshot: RunSnapshot, config: RunConfiguration): Partial<RunSnapshot> | null;
219
479
  todoUpdateFact(snapshot: RunSnapshot, messageCursor: number): ObjectValue;
220
480
  TODO_POLICY: "session-todos/v1";
@@ -196,7 +196,7 @@ export function configure(input) {
196
196
  const policy = profile.providerCompatibilityPolicy;
197
197
  invariant(policy !== null && typeof policy === 'object' && !Array.isArray(policy)
198
198
  && Object.keys(policy).every(key => ['contract', 'rule'].includes(key))
199
- && ['provider-compat/v1', 'provider-compat/v2', 'provider-compat/v3', 'provider-compat/v4', 'provider-compat/v5'].includes(policy.contract)
199
+ && ['provider-compat/v1', 'provider-compat/v2', 'provider-compat/v3', 'provider-compat/v4', 'provider-compat/v5', 'provider-compat/v6'].includes(policy.contract)
200
200
  && ['auto', 'permissive', 'openai', 'strict-openai', 'cerebras', 'groq', 'deepseek',
201
201
  'zai', 'kspmas-gateway', 'moonshot', 'mimo'].includes(policy.rule), 'invalid_provider_compatibility_policy');
202
202
  }
@@ -340,8 +340,12 @@ export function configure(input) {
340
340
  && Number.isSafeInteger(policy.summaryMaxTokens) && policy.summaryMaxTokens > 0
341
341
  && ['strict', 'context_bounded_estimate'].includes(policy.summaryBudgetMode ?? 'strict')
342
342
  && (policy.budgetTiming === undefined || policy.budgetTiming === 'before-model/v1')
343
- && (policy.continuityPlacement === undefined || policy.continuityPlacement === 'after-history/v1'
343
+ && (policy.continuityPlacement === undefined || ['after-history/v1', 'split-after-history/v1'].includes(policy.continuityPlacement)
344
344
  && profile.operatorGuidancePolicy === undefined)
345
+ && (policy.continuityProjection === undefined || policy.continuityProjection === 'decision-input/v1'
346
+ && config.modelSurface?.verificationProjection === 'readable-evidence/v1')
347
+ && (policy.commandOutputProjection === undefined || policy.commandOutputProjection === 'receipt-preview/v1'
348
+ && config.artifactPolicy === 'runtime-artifacts/v1')
345
349
  && (policy.sourceReusePolicy === undefined || policy.sourceReusePolicy === 'captured-source/v1'
346
350
  && profile.providerFamily === 'openai-chat' && config.artifactPolicy === 'runtime-artifacts/v1')
347
351
  && (policy.maxCompactions === null || Number.isSafeInteger(policy.maxCompactions) && policy.maxCompactions >= 0)
@@ -11,6 +11,14 @@ export declare const contextMessageRef: (message: Message, index: number, digest
11
11
  /** Host facts remain separate from low-trust prose, including summaries and hook proposals. */
12
12
  export declare function contextContinuity(snapshot: RunSnapshot, config: RunConfiguration, policies?: NativePolicyRegistry): ObjectValue;
13
13
  export declare function contextSummaryMessage(summary: string): Message;
14
+ /** Split continuity into a stable header and a compact current-state tail.
15
+ * The tail omits empty fields; background commands already reported to the
16
+ * model are counted instead of repeated. The header is identical across the
17
+ * model calls of a Run, so providers can serve it from the prompt cache. */
18
+ export declare function splitContextContinuity(continuity: ObjectValue): {
19
+ fixed: ObjectValue;
20
+ current: ObjectValue;
21
+ };
14
22
  /** Planning performs only pinned token counts. All summary model calls belong to the Kernel. */
15
23
  export declare function planNativeContext(snapshot: RunSnapshot, config: RunConfiguration, tools: ToolDefinition[], counters: ContextCounters, digest: (value: unknown) => string, forceCompaction: boolean, allowCompaction: boolean, inputContributions?: Message[], policies?: NativePolicyRegistry): Promise<ContextPlanningResult>;
16
24
  /** Summary text is never a candidate, tool request, transcript rewrite or acceptance verdict. */