gestalt-mobile 0.61.0 → 0.61.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/server/server/composition.contracts.js +23 -6
- package/dist/server/server/composition.js +6 -1
- package/dist/server/server/features/autopilot/application/policy.js +3 -3
- package/dist/server/server/features/plans/application/parse-model-policy.js +4 -4
- package/dist/server/server/features/plans/domain/model-policy-admission.js +14 -12
- package/dist/server/server/features/plans/domain/supervised-plan.js +4 -0
- package/dist/server/server/platform/codex/session-runtime.js +4 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,6 +67,10 @@ Expand **Advanced settings** to change model thinking, the Org-plan executor mod
|
|
|
67
67
|
and thinking, provider, sandbox, or approval policy, or to manage skill profiles.
|
|
68
68
|
The executor starts with `gpt-5.6-terra` and high thinking; the supervisor uses medium thinking.
|
|
69
69
|
Executor overrides preserve the installed role instructions and belong to each new session.
|
|
70
|
+
These settings are launch defaults, not a mandatory L1 model. The Org supervisor's
|
|
71
|
+
explicit runtime-supported model/effort choice wins; conflicting fixed roles use
|
|
72
|
+
the default-agent override route with executor duties. Follow-ups without an L1
|
|
73
|
+
policy preserve the existing child's settings instead of repinning defaults.
|
|
70
74
|
**Save as defaults** stores the
|
|
71
75
|
current session settings in `~/.gestalt/session-defaults.json` on the relay host.
|
|
72
76
|
New browser visits load those settings; Advanced settings starts collapsed.
|
|
@@ -106,17 +110,21 @@ Version-1 plans separate requested model choices from assurance. Existing plans
|
|
|
106
110
|
without `#+MODEL_POLICY_ASSURANCE` use disclosed **configured compatibility**;
|
|
107
111
|
their policy metadata and file bytes need no migration. An explicit
|
|
108
112
|
`#+MODEL_POLICY_ASSURANCE: configured` selects the same mode. Mobile validates
|
|
109
|
-
|
|
113
|
+
bounded model/effort identifiers and any optional detailed effort rationale, checks the active runtime
|
|
110
114
|
catalog before versioned root dispatch, and directs the root to launch the exact
|
|
111
115
|
L1 model/effort through supported overrides with inherited sandbox and approval
|
|
112
116
|
policy. Automatic executor resumes use that L1 policy rather than session defaults.
|
|
117
|
+
The supervisor may revise each L1 choice without a separate model/effort approval.
|
|
118
|
+
After pausing an active writer and recording/resyncing the revised policy,
|
|
119
|
+
Mobile validates support and applies it to the same child's next safe turn.
|
|
120
|
+
Unavailable model/effort pairs fail explicitly; defaults never replace them silently.
|
|
113
121
|
|
|
114
122
|
`#+MODEL_POLICY_ASSURANCE: runtime-attested` explicitly requires strict runtime
|
|
115
123
|
receipts. The current adapter cannot supply runtime-issued settings revisions;
|
|
116
124
|
strict plans fail with `RUNTIME_ATTESTATION_UNAVAILABLE` and remain strict until
|
|
117
125
|
the user authorizes a change. Repeated approvals or attention resolution cannot
|
|
118
126
|
provide that capability. Manual Off is independently respected. Legacy plans
|
|
119
|
-
without model policy
|
|
127
|
+
without model policy preserve their executor's existing settings on follow-up.
|
|
120
128
|
|
|
121
129
|
`gestalt_org_plan_health` reports `executionAdmission.allowed`, configured
|
|
122
130
|
assurance and `executorLaunch`, which checks the requested L1 model/effort using
|
|
@@ -916,6 +916,8 @@ describe('production composition', () => {
|
|
|
916
916
|
it.each([
|
|
917
917
|
'match',
|
|
918
918
|
'mismatch',
|
|
919
|
+
'supervisor-terra',
|
|
920
|
+
'unsupported-terra-effort',
|
|
919
921
|
'off-during-read',
|
|
920
922
|
'policy-during-read',
|
|
921
923
|
'same-plan-during-read',
|
|
@@ -962,7 +964,11 @@ describe('production composition', () => {
|
|
|
962
964
|
timer.cancelled = true;
|
|
963
965
|
};
|
|
964
966
|
},
|
|
965
|
-
},
|
|
967
|
+
}, ['supervisor-terra', 'unsupported-terra-effort'].includes(scenario)
|
|
968
|
+
? versionedText()
|
|
969
|
+
.replace(':MODEL: gpt-6.1-sol', ':MODEL: gpt-6.1-terra')
|
|
970
|
+
.replace(':REASONING_EFFORT: medium', ':REASONING_EFFORT: high')
|
|
971
|
+
: versionedText());
|
|
966
972
|
onTestFinished(() => f.app.close());
|
|
967
973
|
const actualRootThreadId = (await f.app.inject(`/api/sessions/${f.sessionId}`)).json()
|
|
968
974
|
.threadId;
|
|
@@ -980,7 +986,18 @@ describe('production composition', () => {
|
|
|
980
986
|
for (const handle of f.handles)
|
|
981
987
|
handle.respond = async (method, params) => {
|
|
982
988
|
if (method === 'model/list')
|
|
983
|
-
return
|
|
989
|
+
return ['supervisor-terra', 'unsupported-terra-effort'].includes(scenario)
|
|
990
|
+
? {
|
|
991
|
+
data: [
|
|
992
|
+
{
|
|
993
|
+
id: 'gpt-6.1-terra',
|
|
994
|
+
supportedReasoningEfforts: [
|
|
995
|
+
{ reasoningEffort: scenario === 'supervisor-terra' ? 'high' : 'medium' },
|
|
996
|
+
],
|
|
997
|
+
},
|
|
998
|
+
],
|
|
999
|
+
}
|
|
1000
|
+
: policyCatalog;
|
|
984
1001
|
if (method === 'thread/read' && params.threadId === 'child-1') {
|
|
985
1002
|
sawRead = true;
|
|
986
1003
|
if (['off-during-read', 'policy-during-read', 'same-plan-during-read'].includes(scenario))
|
|
@@ -1052,15 +1069,15 @@ describe('production composition', () => {
|
|
|
1052
1069
|
}
|
|
1053
1070
|
pendingRead.resolve({});
|
|
1054
1071
|
pendingRecovery.resolve({});
|
|
1055
|
-
if (
|
|
1072
|
+
if (['match', 'mismatch', 'supervisor-terra', 'same-plan-during-read'].includes(scenario)) {
|
|
1056
1073
|
await vi.waitFor(() => expect(childStarts).toBe(1));
|
|
1057
1074
|
const call = f.handles
|
|
1058
1075
|
.flatMap((handle) => handle.requests)
|
|
1059
1076
|
.find((call) => call.method === 'turn/start');
|
|
1060
1077
|
expect(call?.params).toMatchObject({
|
|
1061
1078
|
threadId: 'child-1',
|
|
1062
|
-
model: 'gpt-6.1-sol',
|
|
1063
|
-
effort: 'medium',
|
|
1079
|
+
model: scenario === 'supervisor-terra' ? 'gpt-6.1-terra' : 'gpt-6.1-sol',
|
|
1080
|
+
effort: scenario === 'supervisor-terra' ? 'high' : 'medium',
|
|
1064
1081
|
});
|
|
1065
1082
|
}
|
|
1066
1083
|
else {
|
|
@@ -3713,7 +3730,7 @@ describe('production composition', () => {
|
|
|
3713
3730
|
// rejected child continuation; it must never target the dead child.
|
|
3714
3731
|
expect((starts[3]?.params).threadId).not.toBe('child-1');
|
|
3715
3732
|
expect((starts[3]?.params).input?.[0]?.text).toContain('Launch task_name l1_g2 for canonical L1');
|
|
3716
|
-
expect((starts[3]?.params).input?.[0]?.text).toContain('
|
|
3733
|
+
expect((starts[3]?.params).input?.[0]?.text).toContain('The supervisor chooses the exact runtime-supported model');
|
|
3717
3734
|
// Capacity recovery is allowed only for the active root control. It
|
|
3718
3735
|
// recycles that writer but must retain the one durable g2 handoff.
|
|
3719
3736
|
const rootHandle = fixture.handles.find((candidate) => candidate.requests.some((request) => request.method === 'turn/start' &&
|
|
@@ -1276,9 +1276,10 @@ export async function composeRelayApp(options) {
|
|
|
1276
1276
|
assertCurrent();
|
|
1277
1277
|
const report = await executorModelEvidence.read(sessionId);
|
|
1278
1278
|
assertCurrent();
|
|
1279
|
+
const settingsChange = report && ['MODEL_MISMATCH', 'EFFORT_MISMATCH'].includes(report.code);
|
|
1279
1280
|
if (!report ||
|
|
1280
1281
|
report.child.threadId !== threadId ||
|
|
1281
|
-
report.configuration === 'mismatch' ||
|
|
1282
|
+
(report.configuration === 'mismatch' && !settingsChange) ||
|
|
1282
1283
|
[
|
|
1283
1284
|
'CONTROLLER_BINDING_INVALID',
|
|
1284
1285
|
'CONTEXT_CHANGED',
|
|
@@ -1286,6 +1287,10 @@ export async function composeRelayApp(options) {
|
|
|
1286
1287
|
'OBSERVATION_CHANGED',
|
|
1287
1288
|
].includes(report.code))
|
|
1288
1289
|
throw new Error(`EXECUTOR_POLICY_BLOCKED:${report?.code ?? 'CHILD_BINDING_UNKNOWN'}`);
|
|
1290
|
+
// The supervisor's current L1 choice is applied at this safe turn
|
|
1291
|
+
// boundary, including a deliberate change from the child's old model.
|
|
1292
|
+
await runtime.validateExecutorPolicy(sessionId, report.requested);
|
|
1293
|
+
assertCurrent();
|
|
1289
1294
|
return { ...report.requested, assertCurrent };
|
|
1290
1295
|
})
|
|
1291
1296
|
: null;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { currentExecutableL1Index, } from '../../plans/domain/supervised-plan.js';
|
|
7
7
|
import { parseOrgPlanAgentIdentity } from '../../../../shared/org-plan-position.js';
|
|
8
|
-
export const AUTOPILOT_PROMPT_VERSION = '
|
|
8
|
+
export const AUTOPILOT_PROMPT_VERSION = 'v14';
|
|
9
9
|
export const AUTOPILOT_CONTINUATION_PROMPT = 'Inspect the active supervised Org Plan. Refer to every L1 as L<a> and each nested L2 as L<a>.<b>, using one-based positions. Spawn exactly one executor per L1 and pass the exact literal task_name l<a>: l1 for L1, l2 for L2, and so on. Never create an L2-specific task name or append a title, role, nickname, plan name, or generated label. A validated DONE L2 and an accepted L1 are mandatory answer boundaries. The corresponding gestalt_org_plan_checkpoint call must be the last tool call of that root turn: immediately emit exactly one boundary final and end the turn, without followup_task, review, executor launch, or later milestone work. An accepted L1 always ends the root turn with a chat answer: never continue into the next L1 or emit post-acceptance documentation as commentary. Roll up commentary, files, verification, and commands since the previous boundary into that one answer; all later milestone activity belongs to a new root turn. On this later Autopilot turn, resume the same executor after an L2 boundary or launch exactly one fresh canonical executor for the next L1 after an accepted-L1 boundary. Treat a status question as an interruption: answer briefly, then perform the applicable continuation in the same turn. Before sending any blocker response or yielding because progress cannot continue safely, call gestalt_org_plan_attention for the matching decision-table blocker; never rely on blocker prose as the signal. When explicit human permission is required for a physical executor replacement, include executorReplacement with the exact canonicalTaskName; Mobile alone computes and persists the physical generation. Do not call attention for routine progress or a recoverable failure. Before yielding for known long work, call gestalt_autopilot_wait_lease version 2 with relevant observable wake conditions and a bounded maxWaitMs; it is one episode, so reassess before registering another in a later turn. Yield only when its response contains accepted:true; accepted:false means no continuation was registered and requires same-turn supervision. For GitHub PR CI, start an owned gh pr checks --watch process and lease processExited plus processResultAvailable while it runs. Timestamp watcher state-change and terminal observations in UTC; distinguish observation time from upstream updated_at and process exit time. When the Autopilot probe is active, register the compatible wait lease, declare genuine attention, or immediately do actionable work; never acknowledge waiting in prose. Do not send a status-only response.';
|
|
10
10
|
export const AUTOPILOT_EXECUTOR_CONTINUATION_PROMPT = 'Continue the same assigned Org L1 from its durable state. A prior turn ending did not complete the objective. Consume any supplied process result and take the next legal L2 action. Whenever an L2 reaches DONE, return its concise structured evidence and end the executor turn so the root can publish that mandatory answer boundary. Also report at the L1 review boundary or through structured attention.';
|
|
11
11
|
/** Builds a physical launch instruction while keeping durable L1 identity canonical. */
|
|
@@ -13,10 +13,10 @@ export function autopilotExecutorLaunchPrompt(identity, plan) {
|
|
|
13
13
|
const policy = plan?.steps.find((_, index) => `L${index + 1}` === identity.canonicalPosition)?.modelPolicy;
|
|
14
14
|
const launch = policy
|
|
15
15
|
? `Launch task_name ${identity.taskName} for canonical ${identity.canonicalPosition}, preferring agent_type default, fork_turns none, explicit model ${policy.model} and reasoning_effort ${policy.reasoningEffort}. If explicit overrides are unavailable, use the verified fixed org-plan-executor role only when both pins exactly match ${policy.model}/${policy.reasoningEffort}, omitting ineffective overrides. Load the executor duties and full L1 assignment from the Org-plan launch contract. Validate actual host support and sandbox/approval inheritance before spawning; unsupported routes are capability blockers. Assurance is configured compatibility: unavailable runtime metadata remains unknown and does not require repeated human approval. Reject observed settings mismatches; never call requested settings observed or runtime-enforced. Preserve one writer, independent review, checkpoint and terminal review gates.`
|
|
16
|
-
: `Launch task_name ${identity.taskName} for canonical ${identity.canonicalPosition}
|
|
16
|
+
: `Launch task_name ${identity.taskName} for canonical ${identity.canonicalPosition}. The supervisor chooses the exact runtime-supported model and reasoning effort for this L1. For an explicit choice use agent_type default, fork_turns none, explicit model and reasoning_effort, and supply the executor duties and full assignment. The configured org-plan-executor role is a fallback only when no L1 choice is supplied; omit ineffective overrides on a fixed role. Retain canonical identity, permissions and review gates.`;
|
|
17
17
|
if (identity.generation === 1)
|
|
18
18
|
return `${AUTOPILOT_CONTINUATION_PROMPT} ${launch}`;
|
|
19
|
-
return `${AUTOPILOT_CONTINUATION_PROMPT} ${launch} This exact replacement generation ${identity.generation} is durably authorized by Mobile; do not infer another generation from this prompt or the roster; the durable ${identity.canonicalTaskName} slot may remain reserved. Do not reuse that task_name or
|
|
19
|
+
return `${AUTOPILOT_CONTINUATION_PROMPT} ${launch} This exact replacement generation ${identity.generation} is durably authorized by Mobile; do not infer another generation from this prompt or the roster; the durable ${identity.canonicalTaskName} slot may remain reserved. Do not reuse that task_name or treat a model change as replacement authorization. Apply updated model/effort only at a safe turn boundary. Interrupt the previous physical executor if it is still running, then spawn the authorized ${identity.taskName}. Transfer sole ${identity.canonicalPosition} ownership and continue from its durable Org Plan and worktree state.`;
|
|
20
20
|
}
|
|
21
21
|
export const defaultAutopilotPolicy = Object.freeze({
|
|
22
22
|
quiescenceMs: 1_000,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Designed by Denis Roio <jaromil@dyne.org>
|
|
4
4
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
import { validPlanModel, validPlanEffort } from '../domain/supervised-plan.js';
|
|
7
7
|
const required = [
|
|
8
8
|
'MODEL',
|
|
9
9
|
'REASONING_EFFORT',
|
|
@@ -37,11 +37,11 @@ export function parseModelPolicy(properties, level, version) {
|
|
|
37
37
|
invalid();
|
|
38
38
|
const model = properties.get('MODEL');
|
|
39
39
|
const reasoningEffort = properties.get('REASONING_EFFORT');
|
|
40
|
-
if (!
|
|
40
|
+
if (!validPlanModel(model) || !validPlanEffort(reasoningEffort))
|
|
41
41
|
invalid();
|
|
42
42
|
const rawFallbacks = properties.get('MODEL_FALLBACKS');
|
|
43
43
|
const allowedFallbacks = rawFallbacks === 'none' ? [] : rawFallbacks.split(' ');
|
|
44
|
-
if (allowedFallbacks.some((id) => !
|
|
44
|
+
if (allowedFallbacks.some((id) => !validPlanModel(id) || id === model) ||
|
|
45
45
|
new Set(allowedFallbacks).size !== allowedFallbacks.length)
|
|
46
46
|
invalid();
|
|
47
47
|
let necessity = null;
|
|
@@ -49,7 +49,7 @@ export function parseModelPolicy(properties, level, version) {
|
|
|
49
49
|
if (exception.some((key) => properties.has(key)))
|
|
50
50
|
invalid();
|
|
51
51
|
}
|
|
52
|
-
else {
|
|
52
|
+
else if (exception.some((key) => properties.has(key))) {
|
|
53
53
|
if (exception.slice(0, 5).some((key) => !properties.get(key)?.trim()) ||
|
|
54
54
|
!['unresolved-correctness', 'specific-reasoning'].includes(properties.get('EFFORT_NECESSITY_KIND')) ||
|
|
55
55
|
(reasoningEffort === 'xhigh' && !properties.get('SCOPE_REASSESSMENT')?.trim()))
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Designed by Denis Roio <jaromil@dyne.org>
|
|
4
4
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
*/
|
|
6
|
+
import { validPlanModel, validPlanEffort } from './supervised-plan.js';
|
|
6
7
|
/** Scope is automatic Org execution, not the supervisor's manual model selection or repair input. */
|
|
7
8
|
export function assessModelPolicyAdmission(plan, status = 'legacy') {
|
|
8
9
|
const blocked = (reason) => ({
|
|
@@ -23,23 +24,24 @@ export function assessModelPolicyAdmission(plan, status = 'legacy') {
|
|
|
23
24
|
return blocked('POLICY_VERSION_UNSUPPORTED');
|
|
24
25
|
if (!plan?.steps.length || plan.steps.some((step) => step.modelPolicy?.version !== 1))
|
|
25
26
|
return blocked('POLICY_FIELDS_INVALID');
|
|
26
|
-
if (plan.steps.some((step) => !
|
|
27
|
+
if (plan.steps.some((step) => !validPlanModel(step.modelPolicy.model)))
|
|
27
28
|
return blocked('MODEL_PROHIBITED');
|
|
28
29
|
if (plan.steps.some((step) => {
|
|
29
30
|
const policy = step.modelPolicy;
|
|
30
31
|
const necessity = policy.necessity;
|
|
31
|
-
return (!
|
|
32
|
+
return (!validPlanEffort(policy.reasoningEffort) ||
|
|
32
33
|
(policy.reasoningEffort === 'medium'
|
|
33
34
|
? necessity !== null
|
|
34
|
-
:
|
|
35
|
-
!
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
: necessity !== null &&
|
|
36
|
+
(!necessity ||
|
|
37
|
+
!['unresolved-correctness', 'specific-reasoning'].includes(necessity.kind) ||
|
|
38
|
+
![
|
|
39
|
+
necessity.whyMediumInadequate,
|
|
40
|
+
necessity.evidence,
|
|
41
|
+
necessity.affectedScope,
|
|
42
|
+
necessity.returnToMedium,
|
|
43
|
+
...(policy.reasoningEffort === 'xhigh' ? [necessity.scopeReassessment] : []),
|
|
44
|
+
].every((value) => typeof value === 'string' && value.trim()))));
|
|
43
45
|
}))
|
|
44
46
|
return blocked('EFFORT_UNSUPPORTED');
|
|
45
47
|
const assurance = plan.modelPolicyAssurance ?? 'configured';
|
|
@@ -52,7 +54,7 @@ export function assessModelPolicyAdmission(plan, status = 'legacy') {
|
|
|
52
54
|
scope: 'configured',
|
|
53
55
|
assurance: 'configured',
|
|
54
56
|
runtimeEnforcement: false,
|
|
55
|
-
action: 'Compatibility mode: validate
|
|
57
|
+
action: 'Compatibility mode: validate the supervisor-selected L1 settings against the runtime catalog and preserve controller-owned executor identity. Apply changed settings at the next safe turn, never repin them to session defaults. Missing observations remain unknown; no runtime attestation is claimed.',
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
export class ModelPolicyAdmissionError extends Error {
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* Designed by Denis Roio <jaromil@dyne.org>
|
|
4
4
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
*/
|
|
6
|
+
export const validPlanModel = (value) => typeof value === 'string' &&
|
|
7
|
+
value !== 'none' &&
|
|
8
|
+
/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,63}$/.test(value);
|
|
9
|
+
export const validPlanEffort = (value) => typeof value === 'string' && /^[a-z][a-z0-9_-]{0,23}$/.test(value);
|
|
6
10
|
/** Suspended work is a barrier: no later implementation may be selected. */
|
|
7
11
|
export function currentExecutableL1Index(plan) {
|
|
8
12
|
const boundary = plan.steps.findIndex((step) => step.state === 'SUSPENDED');
|
|
@@ -309,12 +309,10 @@ export class CodexSessionRuntime {
|
|
|
309
309
|
threadId: childThreadId,
|
|
310
310
|
input: [{ type: 'text', text, text_elements: [] }],
|
|
311
311
|
clientUserMessageId,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
...(
|
|
316
|
-
? { effort: policy?.reasoningEffort ?? session.modelSettings?.executorReasoningEffort }
|
|
317
|
-
: {}),
|
|
312
|
+
// Defaults apply at launch. Without an explicit L1 policy, preserve the
|
|
313
|
+
// existing child's choices rather than repinning it on every follow-up.
|
|
314
|
+
...(policy?.model ? { model: policy.model } : {}),
|
|
315
|
+
...(policy?.reasoningEffort ? { effort: policy.reasoningEffort } : {}),
|
|
318
316
|
};
|
|
319
317
|
let response;
|
|
320
318
|
try {
|