aptly 0.1.16 → 0.1.17
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/src/context-retry.js +19 -8
- package/dist/src/recovery-application.d.ts +96 -0
- package/dist/src/recovery-application.js +59 -0
- package/dist/src/server.js +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/docs/SPAWN_CONTEXT.md +10 -0
- package/docs/guide/en/advanced.md +2 -0
- package/docs/guide/ja/advanced.md +2 -0
- package/docs/guide/ko/advanced.md +2 -0
- package/docs/guide/zh-CN/advanced.md +2 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { join } from 'node:path';
|
|
|
4
4
|
import { effectiveTransmission, loadAutomaticHookPolicy } from './automatic-hook.js';
|
|
5
5
|
import { assertPrivateStatePath, readRegularFile } from './files.js';
|
|
6
6
|
import { hasSufficientTaskText } from './context-sufficiency.js';
|
|
7
|
+
import { validRecoveryApplication } from './recovery-application.js';
|
|
7
8
|
const hash = (value) => createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
8
9
|
/** One caller-supplied supplement, never an automatic native spawn or a retry chain. */
|
|
9
10
|
export class ContextRetries {
|
|
@@ -162,14 +163,21 @@ export class ContextRetries {
|
|
|
162
163
|
...(entry.seed.fill_model !== false ? { model: result.profile.model } : {}),
|
|
163
164
|
...(entry.seed.client === 'codex' && entry.seed.fill_effort !== false && result.profile.reasoning_effort ? { reasoning_effort: result.profile.reasoning_effort } : {})
|
|
164
165
|
} : undefined;
|
|
165
|
-
|
|
166
|
+
const response = { ...result, retry_id, request_id, context_retry_allowed: false,
|
|
166
167
|
spawn_application: { status: entry.seed.application_blocked ? 'blocked' : 'caller_review_required',
|
|
167
|
-
reason: entry.seed.application_blocked ?? 'native_execution_not_observed' },
|
|
168
|
+
reason: entry.seed.application_blocked ?? 'native_execution_not_observed', ...(defaults ? { required_fields: Object.keys(defaults), on_unavailable: 'stop_and_report', next_action: 'apply_returned_defaults' } : {}) },
|
|
168
169
|
...(defaults ? { next_call: { tool: entry.seed.client === 'claude' ? 'Agent' : 'spawn_agent', set_if_unspecified: defaults, preserve: 'all_other_arguments_and_history' } } : {}),
|
|
169
170
|
next_step: result.status === 'recommended'
|
|
170
171
|
? entry.seed.application_blocked ? `Report the application constraint and preserve original history and arguments for the ORIGINAL invocation. This profile is advice only. ${entry.seed.fresh_eligible ? 'This is the SAME task but a NEW invocation, not a retry of the original call. Use only the separate caller-declared preparation protocol offered below. Only after the host reports the original tool call blocked, if you can declare that this is the same independent task, the user does not require inherited history, and you can supply complete standalone instructions, call prepare_fresh_delegation with this retry_id, task_name, standalone_task and declaration {independent_task:true,same_task:true,original_call_outcome:"blocked",history_requirement:"not_required",standalone_context_complete:true}. It prepares a separate fresh invocation without a new classification. Never use it when history is required or unknown, or when original execution is unknown.' : ''}`
|
|
171
|
-
: `Context supplementation is complete; do not call retry_spawn_recommendation again. Caller review means the parent checks arguments, not a request for new user approval. To perform the already requested delegation, on the next native ${entry.seed.client === 'claude' ? 'Agent' : 'spawn_agent'} call, include these previously unspecified fields: ${JSON.stringify(defaults)}. Do not submit another model/effort-omitted call: it will be blocked again. Preserve all other arguments, explicit choices, history, roles and permissions. This response does not execute a child.`
|
|
172
|
+
: `Context supplementation is complete; do not call retry_spawn_recommendation again. Apply only the returned unspecified fields under existing delegation and host permissions. If user choices or higher-priority host rules prohibit these fields, or applicability is unclear, stop and report the limitation. Caller review means the parent checks arguments, not a request for new user approval. To perform the already requested delegation, on the next native ${entry.seed.client === 'claude' ? 'Agent' : 'spawn_agent'} call, include these previously unspecified fields: ${JSON.stringify(defaults)}. Do not submit another model/effort-omitted call: it will be blocked again. Preserve all other arguments, explicit choices, history, roles and permissions. This response does not execute a child.`
|
|
172
173
|
: 'Stop this recovery attempt. Report the outcome; do not create another retry ID or spawn with an unresolved recommendation.' };
|
|
174
|
+
response.next_step += ' Existing-agent reuse is an alternative path, not evidence that this recommendation was applied.';
|
|
175
|
+
const protectedFields = [];
|
|
176
|
+
if (entry.seed.fill_model === false)
|
|
177
|
+
protectedFields.push('model');
|
|
178
|
+
if (entry.seed.fill_effort === false)
|
|
179
|
+
protectedFields.push('reasoning_effort');
|
|
180
|
+
return validRecoveryApplication(response, entry.seed.client, protectedFields) ? response : unavailable('recovery_metadata_invalid');
|
|
173
181
|
}
|
|
174
182
|
finally {
|
|
175
183
|
entry.active = false;
|
|
@@ -218,6 +226,13 @@ export class ContextRetries {
|
|
|
218
226
|
if (!profile || !entry.seed.eligible_profile_ids.includes(profile.id) || hash(profile) !== hash(result.profile) || result.policy_version !== this.router.policy.version || result.catalog_version !== this.router.policy.catalog_version)
|
|
219
227
|
return reject('profile_changed');
|
|
220
228
|
const preparation_id = hash(['aptly-fresh-delegation-v1', retry_id]);
|
|
229
|
+
const response = { status: 'prepared', reason: 'caller_declared_independent', application: 'advisory_only', source_retry_id: retry_id, preparation_id,
|
|
230
|
+
profile_id: profile.id, profile: structuredClone(profile), intent_provenance: 'caller_declared_not_verified', original_invocation: 'deny_returned_execution_not_observed', execution: 'not_observed',
|
|
231
|
+
spawn_application: { status: 'caller_review_required', reason: 'explicit_profile_arguments_required', required_fields: ['model', 'reasoning_effort'], on_unavailable: 'stop_and_report', next_action: 'submit_prepared_call' },
|
|
232
|
+
next_call: { tool: 'spawn_agent', arguments: { task_name, message: standalone_task, fork_turns: 'none', model: profile.model, reasoning_effort: profile.reasoning_effort } },
|
|
233
|
+
next_step: 'Caller review means checking the arguments, not requesting new user approval. Only after a host-reported blocked outcome, review and submit the separate next_call.arguments under existing delegation authorization and unchanged host permissions. Include every returned argument, especially the explicit model and reasoning_effort; do not omit them or submit a model/effort-omitted replacement, which may trigger context recovery again. If explicit user choices or higher-priority host instructions require parent-model inheritance or forbid either profile field, stop and report that the prepared profile cannot be applied. Do not use another recovery ticket to bypass that restriction. If it is unclear whether a user or host constraint permits applying either field, stop and report the uncertainty rather than guessing or dropping fields. Task prose is not permission to override those constraints. Original arguments were not rewritten; host execution is not observed by this server. Do not add history/role/resume overrides or reuse this preparation for another task. Preparation does not prove interception, permission approval, single execution or child execution.' };
|
|
234
|
+
if (!validRecoveryApplication(response, 'codex'))
|
|
235
|
+
return reject('recovery_metadata_invalid');
|
|
221
236
|
const fingerprint = hash([entry.seed, entry.catalog, profile, declaration, task_name, standalone_task]);
|
|
222
237
|
const policy = loadAutomaticHookPolicy(this.policyPath).policy;
|
|
223
238
|
if (!policy)
|
|
@@ -245,11 +260,7 @@ export class ContextRetries {
|
|
|
245
260
|
const changed = this.current(entry, signal);
|
|
246
261
|
if (changed)
|
|
247
262
|
return reject(changed);
|
|
248
|
-
return
|
|
249
|
-
profile_id: profile.id, profile: structuredClone(profile), intent_provenance: 'caller_declared_not_verified', original_invocation: 'deny_returned_execution_not_observed', execution: 'not_observed',
|
|
250
|
-
spawn_application: { status: 'caller_review_required', reason: 'explicit_profile_arguments_required', required_fields: ['model', 'reasoning_effort'], on_unavailable: 'stop_and_report' },
|
|
251
|
-
next_call: { tool: 'spawn_agent', arguments: { task_name, message: standalone_task, fork_turns: 'none', model: profile.model, reasoning_effort: profile.reasoning_effort } },
|
|
252
|
-
next_step: 'Caller review means checking the arguments, not requesting new user approval. Only after a host-reported blocked outcome, review and submit the separate next_call.arguments under existing delegation authorization and unchanged host permissions. Include every returned argument, especially the explicit model and reasoning_effort; do not omit them or submit a model/effort-omitted replacement, which may trigger context recovery again. If explicit user choices or higher-priority host instructions require parent-model inheritance or forbid either profile field, stop and report that the prepared profile cannot be applied. Do not use another recovery ticket to bypass that restriction. If it is unclear whether a user or host constraint permits applying either field, stop and report the uncertainty rather than guessing or dropping fields. Task prose is not permission to override those constraints. Original arguments were not rewritten; host execution is not observed by this server. Do not add history/role/resume overrides or reuse this preparation for another task. Preparation does not prove interception, permission approval, single execution or child execution.' };
|
|
263
|
+
return response;
|
|
253
264
|
}
|
|
254
265
|
catch {
|
|
255
266
|
return reject('fresh_delegation_unavailable');
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Client } from './types.ts';
|
|
3
|
+
/** Output coherence only: not host authorization, dispatch or profile availability. */
|
|
4
|
+
export declare const recoveryApplicationSchema: z.ZodObject<{
|
|
5
|
+
client: z.ZodEnum<{
|
|
6
|
+
claude: "claude";
|
|
7
|
+
codex: "codex";
|
|
8
|
+
}>;
|
|
9
|
+
status: z.ZodEnum<{
|
|
10
|
+
keep_current: "keep_current";
|
|
11
|
+
needs_context: "needs_context";
|
|
12
|
+
prepared: "prepared";
|
|
13
|
+
recommended: "recommended";
|
|
14
|
+
unavailable: "unavailable";
|
|
15
|
+
}>;
|
|
16
|
+
application: z.ZodLiteral<"advisory_only">;
|
|
17
|
+
execution: z.ZodOptional<z.ZodLiteral<"not_observed">>;
|
|
18
|
+
profile: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
client: z.ZodEnum<{
|
|
21
|
+
claude: "claude";
|
|
22
|
+
codex: "codex";
|
|
23
|
+
}>;
|
|
24
|
+
model: z.ZodString;
|
|
25
|
+
reasoning_effort: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
high: "high";
|
|
27
|
+
low: "low";
|
|
28
|
+
max: "max";
|
|
29
|
+
medium: "medium";
|
|
30
|
+
minimal: "minimal";
|
|
31
|
+
xhigh: "xhigh";
|
|
32
|
+
}>>;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
spawn_application: z.ZodUnion<readonly [z.ZodObject<{
|
|
35
|
+
status: z.ZodLiteral<"caller_review_required">;
|
|
36
|
+
reason: z.ZodEnum<{
|
|
37
|
+
explicit_profile_arguments_required: "explicit_profile_arguments_required";
|
|
38
|
+
native_execution_not_observed: "native_execution_not_observed";
|
|
39
|
+
}>;
|
|
40
|
+
required_fields: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
41
|
+
model: "model";
|
|
42
|
+
reasoning_effort: "reasoning_effort";
|
|
43
|
+
}>>>;
|
|
44
|
+
on_unavailable: z.ZodOptional<z.ZodLiteral<"stop_and_report">>;
|
|
45
|
+
next_action: z.ZodOptional<z.ZodEnum<{
|
|
46
|
+
apply_returned_defaults: "apply_returned_defaults";
|
|
47
|
+
submit_prepared_call: "submit_prepared_call";
|
|
48
|
+
}>>;
|
|
49
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
50
|
+
status: z.ZodLiteral<"blocked">;
|
|
51
|
+
reason: z.ZodEnum<{
|
|
52
|
+
effort_argument_unsupported: "effort_argument_unsupported";
|
|
53
|
+
history_semantics_unverified: "history_semantics_unverified";
|
|
54
|
+
inherited_context_application_unverified: "inherited_context_application_unverified";
|
|
55
|
+
}>;
|
|
56
|
+
}, z.core.$strict>]>;
|
|
57
|
+
next_call: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
58
|
+
tool: z.ZodEnum<{
|
|
59
|
+
Agent: "Agent";
|
|
60
|
+
spawn_agent: "spawn_agent";
|
|
61
|
+
}>;
|
|
62
|
+
set_if_unspecified: z.ZodObject<{
|
|
63
|
+
model: z.ZodOptional<z.ZodString>;
|
|
64
|
+
reasoning_effort: z.ZodOptional<z.ZodEnum<{
|
|
65
|
+
high: "high";
|
|
66
|
+
low: "low";
|
|
67
|
+
max: "max";
|
|
68
|
+
medium: "medium";
|
|
69
|
+
minimal: "minimal";
|
|
70
|
+
xhigh: "xhigh";
|
|
71
|
+
}>>;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
preserve: z.ZodLiteral<"all_other_arguments_and_history">;
|
|
74
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
75
|
+
tool: z.ZodLiteral<"spawn_agent">;
|
|
76
|
+
arguments: z.ZodObject<{
|
|
77
|
+
task_name: z.ZodString;
|
|
78
|
+
message: z.ZodString;
|
|
79
|
+
fork_turns: z.ZodLiteral<"none">;
|
|
80
|
+
model: z.ZodString;
|
|
81
|
+
reasoning_effort: z.ZodEnum<{
|
|
82
|
+
high: "high";
|
|
83
|
+
low: "low";
|
|
84
|
+
max: "max";
|
|
85
|
+
medium: "medium";
|
|
86
|
+
minimal: "minimal";
|
|
87
|
+
xhigh: "xhigh";
|
|
88
|
+
}>;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
}, z.core.$strict>]>>;
|
|
91
|
+
protected_fields: z.ZodArray<z.ZodEnum<{
|
|
92
|
+
model: "model";
|
|
93
|
+
reasoning_effort: "reasoning_effort";
|
|
94
|
+
}>>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
export declare function validRecoveryApplication(result: Record<string, unknown>, client: Client, protectedFields?: ('model' | 'reasoning_effort')[]): boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const field = z.enum(['model', 'reasoning_effort']);
|
|
3
|
+
const effort = z.enum(['minimal', 'low', 'medium', 'high', 'xhigh', 'max']);
|
|
4
|
+
const defaults = z.strictObject({ model: z.string().min(1).max(256).optional(), reasoning_effort: effort.optional() });
|
|
5
|
+
const review = z.strictObject({ status: z.literal('caller_review_required'), reason: z.enum(['native_execution_not_observed', 'explicit_profile_arguments_required']),
|
|
6
|
+
required_fields: z.array(field).min(1).max(2).optional(), on_unavailable: z.literal('stop_and_report').optional(),
|
|
7
|
+
next_action: z.enum(['apply_returned_defaults', 'submit_prepared_call']).optional() });
|
|
8
|
+
const blocked = z.strictObject({ status: z.literal('blocked'), reason: z.enum(['inherited_context_application_unverified', 'history_semantics_unverified', 'effort_argument_unsupported']) });
|
|
9
|
+
const retryCall = z.strictObject({ tool: z.enum(['spawn_agent', 'Agent']), set_if_unspecified: defaults, preserve: z.literal('all_other_arguments_and_history') });
|
|
10
|
+
const freshCall = z.strictObject({ tool: z.literal('spawn_agent'), arguments: z.strictObject({ task_name: z.string().min(1).max(128), message: z.string().min(1).max(12000), fork_turns: z.literal('none'), model: z.string().min(1).max(256), reasoning_effort: effort }) });
|
|
11
|
+
/** Output coherence only: not host authorization, dispatch or profile availability. */
|
|
12
|
+
export const recoveryApplicationSchema = z.strictObject({
|
|
13
|
+
client: z.enum(['codex', 'claude']), status: z.enum(['recommended', 'prepared', 'keep_current', 'needs_context', 'unavailable']), application: z.literal('advisory_only'),
|
|
14
|
+
execution: z.literal('not_observed').optional(),
|
|
15
|
+
profile: z.strictObject({ id: z.string(), client: z.enum(['codex', 'claude']), model: z.string(), reasoning_effort: effort.optional() }).optional(),
|
|
16
|
+
spawn_application: z.union([review, blocked]), next_call: z.union([retryCall, freshCall]).optional(),
|
|
17
|
+
protected_fields: z.array(field),
|
|
18
|
+
}).superRefine((value, ctx) => {
|
|
19
|
+
const issue = () => ctx.addIssue({ code: 'custom', message: 'invalid_recovery_application' });
|
|
20
|
+
const app = value.spawn_application, call = value.next_call;
|
|
21
|
+
if (app.status === 'blocked') {
|
|
22
|
+
if (call || value.status === 'prepared')
|
|
23
|
+
issue();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!['recommended', 'prepared'].includes(value.status)) {
|
|
27
|
+
if (call || app.reason !== 'native_execution_not_observed' || app.required_fields || app.on_unavailable || app.next_action)
|
|
28
|
+
issue();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!call || !value.profile || value.profile.client !== value.client) {
|
|
32
|
+
issue();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const fresh = 'arguments' in call;
|
|
36
|
+
if (fresh !== (value.status === 'prepared') || call.tool !== (value.client === 'codex' ? 'spawn_agent' : 'Agent'))
|
|
37
|
+
issue();
|
|
38
|
+
if (app.reason !== (fresh ? 'explicit_profile_arguments_required' : 'native_execution_not_observed') || app.next_action !== (fresh ? 'submit_prepared_call' : 'apply_returned_defaults') || app.on_unavailable !== 'stop_and_report')
|
|
39
|
+
issue();
|
|
40
|
+
const args = fresh ? call.arguments : call.set_if_unspecified;
|
|
41
|
+
const keys = ['model', 'reasoning_effort'].filter(key => Object.hasOwn(args, key));
|
|
42
|
+
const required = app.required_fields ?? [];
|
|
43
|
+
if (!keys.length || new Set(required).size !== required.length || keys.length !== required.length || keys.some(key => !required.includes(key)))
|
|
44
|
+
issue();
|
|
45
|
+
if (value.client === 'claude' && Object.hasOwn(args, 'reasoning_effort'))
|
|
46
|
+
issue();
|
|
47
|
+
for (const key of keys) {
|
|
48
|
+
if (args[key] === undefined || args[key] !== value.profile[key])
|
|
49
|
+
issue();
|
|
50
|
+
if (!fresh && value.protected_fields.includes(key))
|
|
51
|
+
issue();
|
|
52
|
+
}
|
|
53
|
+
if (fresh && value.execution !== 'not_observed')
|
|
54
|
+
issue();
|
|
55
|
+
});
|
|
56
|
+
export function validRecoveryApplication(result, client, protectedFields = []) {
|
|
57
|
+
return recoveryApplicationSchema.safeParse({ client, status: result.status, application: result.application, execution: result.execution, profile: result.profile,
|
|
58
|
+
spawn_application: result.spawn_application, next_call: result.next_call, protected_fields: protectedFields }).success;
|
|
59
|
+
}
|
package/dist/src/server.js
CHANGED
|
@@ -107,7 +107,7 @@ export function createServer({ env: inputEnv = process.env } = {}) {
|
|
|
107
107
|
inputSchema: { request_id: z.string().min(1).max(96), client: z.enum(['codex', 'claude']), task: taskSchema, eligible_profile_ids: z.array(z.string()).min(1).max(20).optional(), constraints: constraintsSchema.optional() }
|
|
108
108
|
}, async (input) => { const result = await router.advise(input); await trackStatistics(input.client, { requestId: input.request_id, recommendation: result }); return content({ ...result, provider: mode }); });
|
|
109
109
|
server.registerTool('retry_spawn_recommendation', {
|
|
110
|
-
description: 'Supply one bounded task description after an Aptly Hook returns needs_context and a retry_id. Use the same MCP process within five minutes; no native call IDs are needed. May make one paid classification; duplicate input reuses its request identity, changed input conflicts. Never spawns or changes history. If still needs_context/unavailable, stop; do not create another ID. A blocked spawn_application remains advisory.',
|
|
110
|
+
description: 'Supply one bounded task description after an Aptly Hook returns needs_context and a retry_id. Use the same MCP process within five minutes; no native call IDs are needed. May make one paid classification; duplicate input reuses its request identity, changed input conflicts. Never spawns or changes history. If still needs_context/unavailable, stop; do not create another ID. A blocked spawn_application remains advisory. When next_call is supplied, required_fields and next_action describe only missing profile arguments. Apply them only under existing user/host permissions; if forbidden or unclear, stop and report. Existing-agent reuse is an alternative, not proof of applying this recommendation.',
|
|
111
111
|
annotations, inputSchema: { retry_id: z.string().regex(/^[a-f0-9]{64}$/), description: z.string().max(4000) }
|
|
112
112
|
}, async ({ retry_id, description }, extra) => {
|
|
113
113
|
let result;
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.17";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.17';
|
package/docs/SPAWN_CONTEXT.md
CHANGED
|
@@ -173,6 +173,16 @@ requires the parent to review and explicitly supply only unspecified model/effor
|
|
|
173
173
|
fields to a new compatible native call. Caller review means argument review,
|
|
174
174
|
not a request for new user approval. Existing delegation authorization and host
|
|
175
175
|
permission checks still apply; this advisory result grants neither.
|
|
176
|
+
Starting with 0.1.17, application-bearing retry/fresh outputs are checked by a shared Zod contract.
|
|
177
|
+
For an applicable retry, `required_fields` matches only returned missing fields,
|
|
178
|
+
`next_action` is `apply_returned_defaults`, and `on_unavailable` is
|
|
179
|
+
`stop_and_report`; fresh calls use `submit_prepared_call`. Blocked and
|
|
180
|
+
non-recommended outputs have no apply arguments. Internal inconsistency returns
|
|
181
|
+
`recovery_metadata_invalid` without validation data or a new provider call;
|
|
182
|
+
completed ledger results remain intact. Strict consumers must allow the additive
|
|
183
|
+
metadata. This validates output coherence, not caller compliance or permission.
|
|
184
|
+
If user/host restrictions prohibit application or are unclear, stop and report.
|
|
185
|
+
Existing-agent reuse is an alternative path, not evidence of applying advice.
|
|
176
186
|
The response supplies concrete fields in
|
|
177
187
|
`next_call.set_if_unspecified`, excluding original explicit choices. Claude
|
|
178
188
|
receives model only, never an effort field. Blocked results omit `next_call`. `blocked` requires reporting the original
|
|
@@ -145,6 +145,8 @@ Cache reuse requires a completed first result. An unknown outcome remains `outco
|
|
|
145
145
|
|
|
146
146
|
`context_retry_allowed: false` ends further context supplementation. For a compatible recommendation, `caller_review_required` means the parent reviews arguments; it does not request new user approval. Existing delegation authorization and host permission checks still apply.
|
|
147
147
|
|
|
148
|
+
The shared output validation below is available starting with 0.1.17. Retry/fresh application metadata uses a shared Zod contract. Retry `required_fields` lists only missing fields and `next_action` is `apply_returned_defaults` (fresh: `submit_prepared_call`). Stop if application is forbidden or unclear; existing-agent reuse is not evidence of applying advice. Internal inconsistency returns `recovery_metadata_invalid` without raw data or repeating a completed classification. Strict consumers must allow additive fields. Validation does not establish caller compliance or permission.
|
|
149
|
+
|
|
148
150
|
<a id="guide-fresh-delegation"></a>
|
|
149
151
|
|
|
150
152
|
## Prepare a separate independent delegation (0.1.6+)
|
|
@@ -145,6 +145,8 @@ fixture は、キー・ネットワーク・子エージェントの実行なし
|
|
|
145
145
|
|
|
146
146
|
`context_retry_allowed: false` は追加の文脈補足を終了する意味です。互換性のある推薦の `caller_review_required` は親が引数を確認する意味であり、新しいユーザー承認の要求ではありません。既存の委任権限とホストの権限確認は引き続き適用されます。
|
|
147
147
|
|
|
148
|
+
次の共通応答検証は 0.1.17 以降で利用できます。retry・fresh の適用メタデータは共通の Zod スキーマで検証します。retry の `required_fields` は未指定フィールドのみで、`next_action` は `apply_returned_defaults`(fresh は `submit_prepared_call`)です。禁止・不明な場合は停止し、既存エージェントの再利用を推薦適用の証拠にしないでください。内部不整合は原文なしで `recovery_metadata_invalid` を返し、完了した分類は再実行しません。厳密な応答検証では追加フィールドを許容してください。呼び出し元の遵守や権限を証明する検証ではありません。
|
|
149
|
+
|
|
148
150
|
<a id="guide-fresh-delegation"></a>
|
|
149
151
|
|
|
150
152
|
## 別の独立した委任を準備する(0.1.6 以降)
|
|
@@ -145,6 +145,8 @@ fixture는 키·네트워크·자식 실행 없이 로컬 규칙으로 생성한
|
|
|
145
145
|
|
|
146
146
|
`context_retry_allowed: false`는 추가 설명 보충을 더 허용하지 않는다는 뜻입니다. 호환 가능한 추천에서 `caller_review_required`는 부모가 인자를 검토한다는 의미이며 새 사용자 승인을 요구하지 않습니다. 기존 위임 권한과 호스트 권한 검사는 그대로 유지됩니다.
|
|
147
147
|
|
|
148
|
+
다음 공통 응답 검증은 0.1.17부터 제공합니다. retry·fresh의 적용 메타데이터는 공통 Zod 스키마로 검증합니다. 일반 retry의 `required_fields`는 미지정 필드만 포함하고 `next_action`은 `apply_returned_defaults`입니다(fresh는 `submit_prepared_call`). 금지·불명확 조건이면 중단하며 기존 에이전트 재사용을 추천 적용으로 보고하지 마십시오. 내부 불일치는 원문 없이 `recovery_metadata_invalid`로 반환하고 완료된 분류를 다시 호출하지 않습니다. 엄격한 응답 소비자는 추가 필드를 허용해야 합니다. 이 검증은 호출자 준수나 실행 권한을 증명하지 않습니다.
|
|
149
|
+
|
|
148
150
|
<a id="guide-fresh-delegation"></a>
|
|
149
151
|
|
|
150
152
|
## 상속 추천에서 별도 독립 위임 준비 (0.1.6부터)
|
|
@@ -145,6 +145,8 @@ fixture 无需密钥、网络或执行子代理,即可返回本地模拟结果
|
|
|
145
145
|
|
|
146
146
|
`context_retry_allowed: false` 仅表示不再接受上下文补充。对于兼容的推荐,`caller_review_required` 表示父代理检查参数,并非要求用户重新批准。现有委派授权和宿主权限检查仍然有效。
|
|
147
147
|
|
|
148
|
+
以下共同响应验证自 0.1.17 起提供。retry 与 fresh 的应用元数据使用共同的 Zod 契约验证。retry 的 `required_fields` 仅含未指定字段,`next_action` 为 `apply_returned_defaults`(fresh 为 `submit_prepared_call`)。若禁止应用或情况不明,请停止;不要将复用现有代理视为已应用推荐。内部不一致时仅返回 `recovery_metadata_invalid`,不暴露原始数据或重复已完成的分类。严格校验响应的调用方应允许新增字段。验证不证明调用方遵守指令或拥有执行权限。
|
|
149
|
+
|
|
148
150
|
<a id="guide-fresh-delegation"></a>
|
|
149
151
|
|
|
150
152
|
## 准备单独的独立委派(0.1.6 起)
|