gestalt-mobile 0.48.2 → 0.49.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 +15 -3
- package/dist/client/assets/index-D7fHU74R.js +113 -0
- package/dist/client/index.html +1 -1
- package/dist/server/server/app.js +1 -1
- package/dist/server/server/composition.contracts.js +3 -0
- package/dist/server/server/composition.js +3 -4
- package/dist/server/server/features/maintenance/register-routes.js +3 -1
- package/dist/server/server/features/maintenance/upgrade/endpoint.js +30 -0
- package/dist/server/server/features/skills/model/skill-profile.js +4 -5
- package/dist/server/server/platform/codex/codex-serena.js +4 -3
- package/dist/server/server/platform/codex/session-runtime.js +0 -7
- package/dist/server/server/platform/maintenance/managed-upgrade.js +67 -0
- package/dist/server/server/platform/retrieval/xerj-indexer.js +0 -1
- package/dist/server/shared/contracts/upgrade.js +6 -0
- package/package.json +1 -1
- package/dist/client/assets/index-DvIxykMj.js +0 -112
package/dist/client/index.html
CHANGED
|
@@ -16,7 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
16
16
|
<link rel="icon" href="/icons/gestalt-mobile-192.png" />
|
|
17
17
|
<link rel="apple-touch-icon" href="/icons/gestalt-mobile-180.png" />
|
|
18
18
|
<title>Gestalt Mobile</title>
|
|
19
|
-
<script type="module" crossorigin src="/assets/index-
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-D7fHU74R.js"></script>
|
|
20
20
|
<link rel="stylesheet" crossorigin href="/assets/index-CE4-9CY1.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
|
@@ -58,7 +58,7 @@ export async function buildApp(deps) {
|
|
|
58
58
|
registerFileRoutes(app, deps);
|
|
59
59
|
registerGitRoutes(app, deps);
|
|
60
60
|
registerSkillRoutes(app, deps);
|
|
61
|
-
registerMaintenanceRoutes(app);
|
|
61
|
+
registerMaintenanceRoutes(app, deps.upgrade);
|
|
62
62
|
registerProblemHandler(app, Boolean(deps.staticDir));
|
|
63
63
|
return app;
|
|
64
64
|
}
|
|
@@ -3772,6 +3772,9 @@ describe('production composition', () => {
|
|
|
3772
3772
|
],
|
|
3773
3773
|
['POST', '/api/git/clone', '/api/git/clone', 'protected'],
|
|
3774
3774
|
['POST', '/api/maintenance/quit', '/api/maintenance/quit', 'protected'],
|
|
3775
|
+
['POST', '/api/maintenance/upgrade', '/api/maintenance/upgrade', 'protected'],
|
|
3776
|
+
['GET', '/api/maintenance/upgrade', '/api/maintenance/upgrade', 'protected'],
|
|
3777
|
+
['HEAD', '/api/maintenance/upgrade', '/api/maintenance/upgrade', 'protected'],
|
|
3775
3778
|
['GET', '/api/skills', '/api/skills', 'protected'],
|
|
3776
3779
|
['HEAD', '/api/skills', '/api/skills', 'protected'],
|
|
3777
3780
|
['GET', '/api/skill-profiles', '/api/skill-profiles', 'protected'],
|
|
@@ -11,6 +11,7 @@ import { SessionModelConfig } from './platform/codex/session-model-config.js';
|
|
|
11
11
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
12
12
|
import { debuglog } from 'node:util';
|
|
13
13
|
import { buildApp } from './app.js';
|
|
14
|
+
import { ManagedUpgrade } from './platform/maintenance/managed-upgrade.js';
|
|
14
15
|
import { SelfDebugWorkspace } from './platform/self-debug/workspace.js';
|
|
15
16
|
import { createSelfDebugSession } from './features/self-debug/create-session.js';
|
|
16
17
|
import { startSession } from './features/sessions/start-session/use-case.js';
|
|
@@ -1005,10 +1006,7 @@ export async function composeRelayApp(options) {
|
|
|
1005
1006
|
const project = await skillProfiles.readWorkspaceDefault(session.workspacePath);
|
|
1006
1007
|
const selected = compileSkillOverride({
|
|
1007
1008
|
discovered: catalog.skills,
|
|
1008
|
-
explicit: session.effectiveSkillSelection?.skills
|
|
1009
|
-
session.effectiveSkillSelection?.serenaSelected !== undefined
|
|
1010
|
-
? { ...skill, enabled: session.effectiveSkillSelection.serenaSelected }
|
|
1011
|
-
: skill) ?? options.explicitSkillProfile?.skills,
|
|
1009
|
+
explicit: session.effectiveSkillSelection?.skills ?? options.explicitSkillProfile?.skills,
|
|
1012
1010
|
project: project?.skills,
|
|
1013
1011
|
});
|
|
1014
1012
|
return capabilities.prepare({
|
|
@@ -1218,6 +1216,7 @@ export async function composeRelayApp(options) {
|
|
|
1218
1216
|
let app;
|
|
1219
1217
|
try {
|
|
1220
1218
|
app = await buildApp({
|
|
1219
|
+
upgrade: new ManagedUpgrade(options.root),
|
|
1221
1220
|
...(authorization
|
|
1222
1221
|
? {
|
|
1223
1222
|
auth: {
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
*/
|
|
6
6
|
import { registerQuit } from './quit/endpoint.js';
|
|
7
|
-
|
|
7
|
+
import { registerUpgrade } from './upgrade/endpoint.js';
|
|
8
|
+
export function registerMaintenanceRoutes(app, upgrade) {
|
|
8
9
|
registerQuit(app);
|
|
10
|
+
registerUpgrade(app, upgrade);
|
|
9
11
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { problem } from '../../../platform/http/problem.js';
|
|
7
|
+
export function registerUpgrade(app, upgrade) {
|
|
8
|
+
app.get('/api/maintenance/upgrade', async (_request, reply) => {
|
|
9
|
+
reply.header('Cache-Control', 'no-store');
|
|
10
|
+
if (!upgrade)
|
|
11
|
+
return reply
|
|
12
|
+
.code(503)
|
|
13
|
+
.send(problem('UPGRADE_UNAVAILABLE', 503, 'Start Mobile with gestalt mobile to enable upgrades.'));
|
|
14
|
+
return upgrade.status();
|
|
15
|
+
});
|
|
16
|
+
app.post('/api/maintenance/upgrade', async (_request, reply) => {
|
|
17
|
+
if (!upgrade)
|
|
18
|
+
return reply
|
|
19
|
+
.code(503)
|
|
20
|
+
.send(problem('UPGRADE_UNAVAILABLE', 503, 'Start Mobile with gestalt mobile to enable upgrades.'));
|
|
21
|
+
try {
|
|
22
|
+
return reply.code(202).send(await upgrade.start());
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return reply
|
|
26
|
+
.code(503)
|
|
27
|
+
.send(problem('UPGRADE_FAILED', 503, 'Could not start the upgrade. Check the Gestalt manager and whether another upgrade is running.'));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -56,9 +56,8 @@ export const availableSkillSchema = z
|
|
|
56
56
|
.strict();
|
|
57
57
|
/** Gestalt workflow skills are session infrastructure, not optional profile entries. */
|
|
58
58
|
export function isAlwaysAdvertisedSkill(skill) {
|
|
59
|
-
return (skill.name
|
|
60
|
-
|
|
61
|
-
(skill.name !== 'gestalt:xerj' || skill.enabled));
|
|
59
|
+
return (isGestaltSkillName(skill.name) &&
|
|
60
|
+
(!['gestalt:xerj', 'gestalt:serena'].includes(skill.name) || skill.enabled));
|
|
62
61
|
}
|
|
63
62
|
export function isGestaltSkillName(name) {
|
|
64
63
|
return name.startsWith('gestalt:');
|
|
@@ -161,7 +160,7 @@ export function applySkillSelectionSnapshot(discovered, selection) {
|
|
|
161
160
|
const enabledByPath = new Map(createSkillSelection(selection).map((entry) => [entry.path, entry.enabled]));
|
|
162
161
|
return catalog.map((skill) => ({
|
|
163
162
|
...skill,
|
|
164
|
-
enabled:
|
|
163
|
+
enabled: ['gestalt:xerj', 'gestalt:serena'].includes(skill.name)
|
|
165
164
|
? skill.enabled
|
|
166
165
|
: isAlwaysAdvertisedSkill(skill)
|
|
167
166
|
? true
|
|
@@ -221,7 +220,7 @@ export function createSkillProfile(input) {
|
|
|
221
220
|
// Gestalt skills are mandatory thread infrastructure. Legacy profiles are
|
|
222
221
|
// normalized on read so they cannot pin a stale plugin-cache version or
|
|
223
222
|
// expose a meaningless enable/disable control in the editor.
|
|
224
|
-
skills: createSkillSelection(input.skills.filter((skill) =>
|
|
223
|
+
skills: createSkillSelection(input.skills.filter((skill) => !isGestaltSkillName(skill.name))),
|
|
225
224
|
};
|
|
226
225
|
}
|
|
227
226
|
/** Parse the version-1 YAML document without performing filesystem access. */
|
|
@@ -78,7 +78,6 @@ export class CodexSerena {
|
|
|
78
78
|
};
|
|
79
79
|
state.fallback();
|
|
80
80
|
const rules = native.skills;
|
|
81
|
-
const selected = input.skillsConfig.find((entry) => entry.path === skill?.path);
|
|
82
81
|
const conflict = reserved.enabled === false ||
|
|
83
82
|
(reserved.env && Object.keys(reserved.env).length) ||
|
|
84
83
|
reserved.enabled_tools ||
|
|
@@ -86,7 +85,6 @@ export class CodexSerena {
|
|
|
86
85
|
Object.values((reserved.tools ?? {})).some((tool) => tool.enabled !== undefined);
|
|
87
86
|
if (!compatible ||
|
|
88
87
|
!skill ||
|
|
89
|
-
!selected?.enabled ||
|
|
90
88
|
rules?.include_instructions === false ||
|
|
91
89
|
native.features?.hooks !== true ||
|
|
92
90
|
rules?.config?.filter((rule) => rule.name === skill.name || rule.path === skill.path).at(-1)
|
|
@@ -126,7 +124,10 @@ export class CodexSerena {
|
|
|
126
124
|
},
|
|
127
125
|
developer_instructions: `${instructions}\n<gestalt_serena_capability>\nSerena is bound to this workspace. Connection and listed tools do not prove language readiness. First call get_symbols_overview on a current project source file and verify success before semantic editing; on failure use native code tools. Native session and child permissions and approvals apply. Plan mode prohibits edits. Do not switch projects or modes.\n${guidance}\n</gestalt_serena_capability>`,
|
|
128
126
|
};
|
|
129
|
-
state.skillsConfig =
|
|
127
|
+
state.skillsConfig = [
|
|
128
|
+
...input.skillsConfig.filter((entry) => entry.path !== skill.path),
|
|
129
|
+
{ path: skill.path, enabled: true },
|
|
130
|
+
];
|
|
130
131
|
state.ready = true;
|
|
131
132
|
}
|
|
132
133
|
catch {
|
|
@@ -1022,13 +1022,6 @@ export class CodexSessionRuntime {
|
|
|
1022
1022
|
(serena.diagnostic || session.effectiveSkillSelection.warnings?.includes(warning))
|
|
1023
1023
|
? { warnings }
|
|
1024
1024
|
: {}),
|
|
1025
|
-
...(resource.retrieval.capabilities &&
|
|
1026
|
-
session.effectiveSkillSelection.skills.some((skill) => skill.name === 'gestalt:serena')
|
|
1027
|
-
? {
|
|
1028
|
-
serenaSelected: session.effectiveSkillSelection.serenaSelected ??
|
|
1029
|
-
Boolean(session.effectiveSkillSelection.skills.find((skill) => skill.name === 'gestalt:serena')?.enabled),
|
|
1030
|
-
}
|
|
1031
|
-
: {}),
|
|
1032
1025
|
skills: session.effectiveSkillSelection.skills.map((skill) => resource.retrieval.capabilities?.some((capability) => capability.skillName === skill.name)
|
|
1033
1026
|
? {
|
|
1034
1027
|
...skill,
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { execFile } from 'node:child_process';
|
|
7
|
+
import { randomUUID } from 'node:crypto';
|
|
8
|
+
import { access } from 'node:fs/promises';
|
|
9
|
+
import { dirname, join } from 'node:path';
|
|
10
|
+
import { promisify } from 'node:util';
|
|
11
|
+
const runFile = promisify(execFile);
|
|
12
|
+
export class ManagedUpgrade {
|
|
13
|
+
cwd;
|
|
14
|
+
environment;
|
|
15
|
+
run;
|
|
16
|
+
exists;
|
|
17
|
+
current = { instanceId: randomUUID(), phase: 'idle' };
|
|
18
|
+
starting;
|
|
19
|
+
constructor(cwd, environment = process.env, run = runFile, exists = (path) => access(path).then(() => true, () => false)) {
|
|
20
|
+
this.cwd = cwd;
|
|
21
|
+
this.environment = environment;
|
|
22
|
+
this.run = run;
|
|
23
|
+
this.exists = exists;
|
|
24
|
+
}
|
|
25
|
+
async status() {
|
|
26
|
+
if (this.current.phase === 'updating' && !this.starting) {
|
|
27
|
+
const state = this.environment.GESTALT_MOBILE_RESTART_STATE;
|
|
28
|
+
if (!state || !(await this.exists(join(dirname(state), 'update-restart.lock')))) {
|
|
29
|
+
this.current = {
|
|
30
|
+
...this.current,
|
|
31
|
+
phase: 'failed',
|
|
32
|
+
message: 'The upgrade stopped before Mobile restarted. Check the Gestalt update-restart.log, then retry.',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { ...this.current };
|
|
37
|
+
}
|
|
38
|
+
async start() {
|
|
39
|
+
if (this.starting)
|
|
40
|
+
return this.starting;
|
|
41
|
+
if ((await this.status()).phase === 'updating')
|
|
42
|
+
return { ...this.current };
|
|
43
|
+
// Check again after the asynchronous status read so concurrent requests share one launch.
|
|
44
|
+
if (this.starting)
|
|
45
|
+
return this.starting;
|
|
46
|
+
if (this.environment.GESTALT_MOBILE_PID !== String(process.pid) ||
|
|
47
|
+
!this.environment.GESTALT_MOBILE_RESTART_STATE) {
|
|
48
|
+
throw new Error('A managed Mobile restart descriptor is required');
|
|
49
|
+
}
|
|
50
|
+
this.current = { instanceId: this.current.instanceId, phase: 'updating' };
|
|
51
|
+
this.starting = this.run('gestalt', ['update-restart'], {
|
|
52
|
+
cwd: this.cwd,
|
|
53
|
+
env: this.environment,
|
|
54
|
+
timeout: 15_000,
|
|
55
|
+
maxBuffer: 64 * 1024,
|
|
56
|
+
})
|
|
57
|
+
.then(() => ({ ...this.current }))
|
|
58
|
+
.catch(() => {
|
|
59
|
+
this.current = { ...this.current, phase: 'failed' };
|
|
60
|
+
throw new Error('Could not schedule the managed upgrade');
|
|
61
|
+
})
|
|
62
|
+
.finally(() => {
|
|
63
|
+
this.starting = undefined;
|
|
64
|
+
});
|
|
65
|
+
return this.starting;
|
|
66
|
+
}
|
|
67
|
+
}
|