gestalt-mobile 0.66.2 → 0.67.0
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/client/assets/{index-BDsGojoG.js → index-Dp2s0z9f.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/server/composition.contracts.js +450 -61
- package/dist/server/server/composition.js +1 -0
- package/dist/server/server/features/autopilot/application/service.js +67 -5
- package/dist/server/server/features/autopilot/domain/supervision-protocol.js +32 -0
- package/dist/server/server/features/control-plane-trace/export-trace.js +110 -10
- package/dist/server/server/platform/codex/codex-capabilities.js +65 -7
- package/dist/server/server/platform/codex/codex-playwright.js +20 -3
- package/dist/server/server/platform/codex/codex-serena.js +14 -4
- package/dist/server/server/platform/codex/instruction-blocks.js +17 -0
- package/dist/server/server/platform/codex/session-runtime.js +7 -0
- package/dist/server/server/platform/codex/startup-guidance.fixture.js +38 -0
- package/dist/server/server/platform/codex/startup-guidance.js +94 -0
- package/dist/server/server/platform/retrieval/codex-xerj.js +14 -4
- package/package.json +1 -1
|
@@ -1301,6 +1301,13 @@ export class CodexSessionRuntime {
|
|
|
1301
1301
|
if (!canRebindMissingRollout(session, error))
|
|
1302
1302
|
throw error;
|
|
1303
1303
|
missingRollout = error;
|
|
1304
|
+
// The retained rollout is absent: this authorized replacement is a
|
|
1305
|
+
// fresh instruction boundary, using the already-owned capability state.
|
|
1306
|
+
// Do not replay provider preparation, leases or scratch allocation.
|
|
1307
|
+
if (resource.retrieval?.prepareFreshStartup) {
|
|
1308
|
+
await resource.retrieval.prepareFreshStartup();
|
|
1309
|
+
resource.modelConfig = resource.retrieval.config;
|
|
1310
|
+
}
|
|
1304
1311
|
const replacementThreadId = await this.startThread(resource.process, session, resource.skillsConfig, resource.modelConfig);
|
|
1305
1312
|
result = rebindMissingRollout(session, error, replacementThreadId, now);
|
|
1306
1313
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2026 Dyne.org foundation
|
|
3
|
+
* Designed by Denis Roio <jaromil@dyne.org>
|
|
4
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
|
+
*/
|
|
6
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
// Synthetic package data, never a second copy of the production guide.
|
|
9
|
+
export const syntheticBootstrap = 'SYNTHETIC_SELECTED_PACKAGE_BOOTSTRAP\n';
|
|
10
|
+
export const syntheticBlock = `<!-- gestalt:startup:v1 -->\n${syntheticBootstrap}<!-- /gestalt:startup -->`;
|
|
11
|
+
export const startupDescriptor = {
|
|
12
|
+
schemaVersion: 1,
|
|
13
|
+
owner: 'gestalt-agents',
|
|
14
|
+
blockId: 'gestalt:startup',
|
|
15
|
+
blockVersion: 1,
|
|
16
|
+
source: 'startup/bootstrap.md',
|
|
17
|
+
composer: 'scripts/startup-contract.mjs',
|
|
18
|
+
maxWords: 350,
|
|
19
|
+
};
|
|
20
|
+
export async function installStartupFixture(root, version = '0.0.1') {
|
|
21
|
+
for (const path of ['.codex-plugin', 'startup', 'skills/coding', 'skills/xerj', 'skills/serena'])
|
|
22
|
+
await mkdir(join(root, path), { recursive: true });
|
|
23
|
+
await writeFile(join(root, '.codex-plugin/plugin.json'), JSON.stringify({
|
|
24
|
+
name: 'gestalt',
|
|
25
|
+
version,
|
|
26
|
+
description: 'Synthetic Mobile startup fixture',
|
|
27
|
+
skills: './skills/',
|
|
28
|
+
}));
|
|
29
|
+
await writeFile(join(root, 'gestalt-startup-contract.json'), JSON.stringify(startupDescriptor));
|
|
30
|
+
await writeFile(join(root, 'startup/bootstrap.md'), syntheticBootstrap);
|
|
31
|
+
for (const name of ['coding', 'xerj', 'serena'])
|
|
32
|
+
await writeFile(join(root, `skills/${name}/SKILL.md`), `---\nname: ${name}\ndescription: Synthetic ${name} fixture\n---\nSYNTHETIC_${name.toUpperCase()}_GUIDANCE\n`);
|
|
33
|
+
return ['coding', 'xerj', 'serena'].map((name) => ({
|
|
34
|
+
name: `gestalt:${name}`,
|
|
35
|
+
path: join(root, `skills/${name}/SKILL.md`),
|
|
36
|
+
enabled: true,
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2026 Dyne.org foundation
|
|
3
|
+
* Designed by Denis Roio <jaromil@dyne.org>
|
|
4
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
|
+
*/
|
|
6
|
+
import { createHash } from 'node:crypto';
|
|
7
|
+
import { readFile, realpath } from 'node:fs/promises';
|
|
8
|
+
import { resolve } from 'node:path';
|
|
9
|
+
/** Native discovery selects the installed package; never scan caches or consult a checkout. */
|
|
10
|
+
export async function prepareStartupGuidance(input) {
|
|
11
|
+
const unchanged = (reason, packageVersion) => ({
|
|
12
|
+
instructions: input.instructions,
|
|
13
|
+
startup: {
|
|
14
|
+
status: 'unavailable',
|
|
15
|
+
reason,
|
|
16
|
+
...(packageVersion ? { packageVersion } : {}),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
const rules = input.native.skills;
|
|
20
|
+
if (rules?.include_instructions === false)
|
|
21
|
+
return unchanged('excluded');
|
|
22
|
+
const selected = input.skills.filter((skill) => skill.name.startsWith('gestalt:') &&
|
|
23
|
+
skill.enabled !== false &&
|
|
24
|
+
[...(rules?.config ?? []), ...input.skillsConfig]
|
|
25
|
+
.filter((rule) => ('name' in rule && rule.name === skill.name) || rule.path === skill.path)
|
|
26
|
+
.at(-1)?.enabled !== false);
|
|
27
|
+
if (!selected.length)
|
|
28
|
+
return unchanged('excluded');
|
|
29
|
+
let packageVersion;
|
|
30
|
+
try {
|
|
31
|
+
const roots = new Set(await Promise.all(selected.map(async (skill) => resolve(await realpath(skill.path), '../../..'))));
|
|
32
|
+
if (roots.size !== 1)
|
|
33
|
+
return unchanged('ambiguous-selected-package');
|
|
34
|
+
const root = [...roots][0];
|
|
35
|
+
const manifest = JSON.parse(await readFile(resolve(root, '.codex-plugin/plugin.json'), 'utf8'));
|
|
36
|
+
if (manifest.name !== 'gestalt' ||
|
|
37
|
+
manifest.skills !== './skills/' ||
|
|
38
|
+
typeof manifest.version !== 'string' ||
|
|
39
|
+
manifest.version.length > 64 ||
|
|
40
|
+
!/^\d+\.\d+\.\d+$/.test(manifest.version))
|
|
41
|
+
return unchanged('invalid-contract');
|
|
42
|
+
packageVersion = manifest.version;
|
|
43
|
+
let descriptor;
|
|
44
|
+
try {
|
|
45
|
+
descriptor = JSON.parse(await readFile(resolve(root, 'gestalt-startup-contract.json'), 'utf8'));
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (error.code === 'ENOENT')
|
|
49
|
+
return unchanged('missing-contract', packageVersion);
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
if (descriptor.schemaVersion !== 1 || descriptor.blockVersion !== 1)
|
|
53
|
+
return unchanged('unsupported-contract', packageVersion);
|
|
54
|
+
if (descriptor.owner !== 'gestalt-agents' ||
|
|
55
|
+
descriptor.blockId !== 'gestalt:startup' ||
|
|
56
|
+
descriptor.source !== 'startup/bootstrap.md' ||
|
|
57
|
+
descriptor.composer !== 'scripts/startup-contract.mjs' ||
|
|
58
|
+
descriptor.maxWords !== 350)
|
|
59
|
+
throw new Error('Invalid descriptor');
|
|
60
|
+
const text = await readFile(resolve(root, descriptor.source), 'utf8');
|
|
61
|
+
if (!text.trim() || text.trim().split(/\s+/u).length > 350 || text.includes('<!--'))
|
|
62
|
+
throw new Error('Invalid bootstrap');
|
|
63
|
+
// Version-1 composition mirrors the Agents contract. Outside bytes are immutable.
|
|
64
|
+
const pattern = /<!-- gestalt:startup:v(\d+) -->[\s\S]*?<!-- \/gestalt:startup -->/gu;
|
|
65
|
+
const matches = [...input.instructions.matchAll(pattern)];
|
|
66
|
+
if ((input.instructions.match(/<!-- gestalt:startup/gu) ?? []).length !== matches.length ||
|
|
67
|
+
(input.instructions.match(/<!-- \/gestalt:startup/gu) ?? []).length !== matches.length ||
|
|
68
|
+
matches.some((match) => match[1] !== '1'))
|
|
69
|
+
throw new Error('Invalid owned block');
|
|
70
|
+
const block = `<!-- gestalt:startup:v1 -->\n${text}<!-- /gestalt:startup -->`;
|
|
71
|
+
let first = true;
|
|
72
|
+
const instructions = matches.length
|
|
73
|
+
? input.instructions.replace(pattern, () => {
|
|
74
|
+
if (!first)
|
|
75
|
+
return '';
|
|
76
|
+
first = false;
|
|
77
|
+
return block;
|
|
78
|
+
})
|
|
79
|
+
: input.instructions + (input.instructions ? '\n\n' : '') + block;
|
|
80
|
+
return {
|
|
81
|
+
instructions,
|
|
82
|
+
startup: {
|
|
83
|
+
status: 'ready',
|
|
84
|
+
packageVersion,
|
|
85
|
+
blockVersion: 1,
|
|
86
|
+
sha256: createHash('sha256').update(block).digest('hex'),
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// Never echo source text, paths, parser errors or user customization.
|
|
92
|
+
return unchanged('invalid-contract', packageVersion);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -7,6 +7,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
7
7
|
import { sessionScratchEnvironmentKeys } from '../scratch/child-environment.js';
|
|
8
8
|
import { parseXerjStartupReason, } from '../../../shared/contracts/xerj-startup.js';
|
|
9
9
|
import { ReadinessEvidence } from './readiness-evidence.js';
|
|
10
|
+
import { withCapabilityInstructions } from '../codex/instruction-blocks.js';
|
|
10
11
|
export const xerjServerName = 'gestalt-xerj';
|
|
11
12
|
export const xerjTools = ['xerj_search', 'xerj_map', 'xerj_code_search'];
|
|
12
13
|
const connectionTimeoutMs = 5_000;
|
|
@@ -36,7 +37,9 @@ export class CodexXerj {
|
|
|
36
37
|
let native = {};
|
|
37
38
|
let compatible = false;
|
|
38
39
|
try {
|
|
39
|
-
const read =
|
|
40
|
+
const read = input.nativeConfig !== undefined
|
|
41
|
+
? { config: input.nativeConfig ?? undefined }
|
|
42
|
+
: (await beforeDeadline(input.rpc.request('config/read', { cwd: input.cwd, includeLayers: false }), input.deadline));
|
|
40
43
|
native = read.config ?? {};
|
|
41
44
|
compatible = read.config !== undefined;
|
|
42
45
|
}
|
|
@@ -52,7 +55,11 @@ export class CodexXerj {
|
|
|
52
55
|
if (server?.args?.[0] === 'xerj' && server.args[1] === 'mcp')
|
|
53
56
|
mcp[name] = { ...server, enabled: false, required: false };
|
|
54
57
|
}
|
|
55
|
-
const instructions = typeof
|
|
58
|
+
const instructions = typeof input.config.developer_instructions === 'string'
|
|
59
|
+
? input.config.developer_instructions
|
|
60
|
+
: typeof native.developer_instructions === 'string'
|
|
61
|
+
? native.developer_instructions
|
|
62
|
+
: '';
|
|
56
63
|
state.fallback = () => {
|
|
57
64
|
evidence.connection('unavailable');
|
|
58
65
|
state.ready = false;
|
|
@@ -60,6 +67,8 @@ export class CodexXerj {
|
|
|
60
67
|
...entry,
|
|
61
68
|
enabled: entry.path === skill?.path ? false : entry.enabled,
|
|
62
69
|
}));
|
|
70
|
+
state.instructionBlock =
|
|
71
|
+
'<gestalt_xerj_unavailable>\nXerj retrieval is unavailable in this runtime. Earlier retrieval guidance is inactive; use rg and current source reads.\n</gestalt_xerj_unavailable>';
|
|
63
72
|
state.config = {
|
|
64
73
|
...input.config,
|
|
65
74
|
skills: { config: [{ name: 'gestalt:xerj', enabled: false }] },
|
|
@@ -72,7 +81,7 @@ export class CodexXerj {
|
|
|
72
81
|
required: false,
|
|
73
82
|
},
|
|
74
83
|
},
|
|
75
|
-
developer_instructions:
|
|
84
|
+
developer_instructions: withCapabilityInstructions(instructions, 'xerj', state.instructionBlock),
|
|
76
85
|
};
|
|
77
86
|
};
|
|
78
87
|
state.fallback();
|
|
@@ -107,6 +116,7 @@ export class CodexXerj {
|
|
|
107
116
|
...entry,
|
|
108
117
|
enabled: entry.path === skill.path ? true : entry.enabled,
|
|
109
118
|
}));
|
|
119
|
+
state.instructionBlock = `<gestalt_xerj_capability>\nWorkspace index counts do not establish coverage or freshness for a selected repository. Verify hit identity and current source before relying on it.\n${guidance}\n</gestalt_xerj_capability>`;
|
|
110
120
|
state.config = {
|
|
111
121
|
...input.config,
|
|
112
122
|
skills: { config: [{ name: 'gestalt:xerj', enabled: true }] },
|
|
@@ -131,7 +141,7 @@ export class CodexXerj {
|
|
|
131
141
|
default_tools_approval_mode: 'approve',
|
|
132
142
|
},
|
|
133
143
|
},
|
|
134
|
-
developer_instructions:
|
|
144
|
+
developer_instructions: withCapabilityInstructions(instructions, 'xerj', state.instructionBlock),
|
|
135
145
|
};
|
|
136
146
|
state.ready = true;
|
|
137
147
|
evidence.connection('unknown');
|