gestalt-mobile 0.71.4 → 0.72.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/README.md +15 -48
- package/dist/client/assets/index-CwgSPgbi.css +1 -0
- package/dist/client/assets/index-ME1MRi_3.js +182 -0
- package/dist/client/index.html +2 -2
- package/dist/server/client/features/chat/activity-summary.js +11 -0
- package/dist/server/client/features/chat/chat-projection.js +6 -2
- package/dist/server/server/cli.js +0 -3
- package/dist/server/server/composition.contracts.js +32 -3
- package/dist/server/server/composition.js +8 -25
- package/dist/server/server/config.js +2 -5
- package/dist/server/server/features/agent-activity/registry.js +42 -15
- package/dist/server/server/features/catalog/get-bootstrap/use-case.js +0 -1
- package/dist/server/server/features/catalog/register-routes.js +0 -3
- package/dist/server/server/features/skills/list-available/endpoint.js +1 -1
- package/dist/server/server/features/skills/model/skill-profile.js +2 -3
- package/dist/server/server/platform/codex/capability-deadline.js +26 -0
- package/dist/server/server/platform/codex/codex-capabilities.js +23 -56
- package/dist/server/server/platform/codex/codex-playwright.js +3 -3
- package/dist/server/server/platform/codex/codex-serena.js +1 -1
- package/dist/server/server/platform/codex/mcp-startup-failure.js +0 -25
- package/dist/server/server/platform/codex/normalizer.js +0 -17
- package/dist/server/server/platform/codex/retired-capability-migration.js +105 -0
- package/dist/server/server/platform/codex/session-runtime.js +13 -58
- package/dist/server/server/platform/codex/startup-guidance.fixture.js +3 -3
- package/dist/server/server/platform/kimi/kimi-skill-catalog.js +2 -8
- package/dist/server/server/platform/retrieval/repository-readiness.js +2 -7
- package/dist/server/server/platform/skills/codex-skill-catalog.js +9 -7
- package/dist/server/shared/contracts/mcp-startup-failure.js +5 -30
- package/package.json +1 -1
- package/dist/client/assets/index-BOJci8Jh.css +0 -1
- package/dist/client/assets/index-Cb4qCgbe.js +0 -183
- package/dist/server/server/features/catalog/get-xerj-status/endpoint.js +0 -13
- package/dist/server/server/platform/retrieval/codex-xerj.js +0 -205
- package/dist/server/server/platform/retrieval/managed-xerj.js +0 -196
- package/dist/server/server/platform/retrieval/xerj-index-config.js +0 -70
- package/dist/server/server/platform/retrieval/xerj-index-diagnostic.js +0 -124
- package/dist/server/server/platform/retrieval/xerj-indexer.js +0 -399
- package/dist/server/shared/contracts/xerj-startup.js +0 -76
- /package/dist/server/{shared/contracts/xerj-status.js → server/platform/codex/capability-contracts.js} +0 -0
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { parseMcpStartupFailure, parseMcpStartupStatus, startupIdentifier, startupServers, } from '../../../shared/contracts/mcp-startup-failure.js';
|
|
7
7
|
import { randomUUID } from 'node:crypto';
|
|
8
|
-
import { parseXerjStartupReason } from '../../../shared/contracts/xerj-startup.js';
|
|
9
8
|
/**
|
|
10
9
|
* Codex 0.164.0 generated experimental schema: McpServerStatusUpdatedNotification.
|
|
11
10
|
* Upstream supplies error prose and one structured failure reason, but no child
|
|
@@ -44,30 +43,6 @@ export function observedMcpStartupFailure(correlation, observation) {
|
|
|
44
43
|
export class McpStartupTracker {
|
|
45
44
|
runtimeId = randomUUID();
|
|
46
45
|
attempts = new Map();
|
|
47
|
-
/** Trusted local observation only; upstream notifications cannot supply this phase. */
|
|
48
|
-
observeReadiness(status, reason) {
|
|
49
|
-
const observation = this.observe({
|
|
50
|
-
method: 'mcpServer/statusUpdated',
|
|
51
|
-
params: { name: 'gestalt-xerj', status },
|
|
52
|
-
});
|
|
53
|
-
if (!observation)
|
|
54
|
-
return undefined;
|
|
55
|
-
const local = parseMcpStartupStatus({
|
|
56
|
-
...observation,
|
|
57
|
-
phase: 'readiness',
|
|
58
|
-
failure: observation.failure
|
|
59
|
-
? {
|
|
60
|
-
...observation.failure,
|
|
61
|
-
phase: 'readiness',
|
|
62
|
-
code: 'readiness-failed',
|
|
63
|
-
readinessReason: parseXerjStartupReason(reason),
|
|
64
|
-
}
|
|
65
|
-
: null,
|
|
66
|
-
});
|
|
67
|
-
if (local)
|
|
68
|
-
this.attempts.set(JSON.stringify([null, 'gestalt-xerj']), local);
|
|
69
|
-
return local;
|
|
70
|
-
}
|
|
71
46
|
observe(notification) {
|
|
72
47
|
if (!['mcpServer/startupStatus/updated', 'mcpServer/statusUpdated'].includes(notification.method ?? '') ||
|
|
73
48
|
!notification.params ||
|
|
@@ -74,23 +74,6 @@ export function normalizeCodexNotification(sessionId, sequence, occurredAt, noti
|
|
|
74
74
|
},
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
if (notification.method === 'mcpServer/statusUpdated' &&
|
|
78
|
-
!connection?.threadId &&
|
|
79
|
-
connection?.name === 'gestalt-xerj' &&
|
|
80
|
-
['failed', 'cancelled'].includes(String(connection.status))) {
|
|
81
|
-
return {
|
|
82
|
-
sessionId,
|
|
83
|
-
sequence,
|
|
84
|
-
occurredAt,
|
|
85
|
-
type: 'activity.updated',
|
|
86
|
-
payload: {
|
|
87
|
-
id: 'gestalt-xerj-availability',
|
|
88
|
-
label: 'Xerj unavailable',
|
|
89
|
-
detail: 'Retrieval is unavailable. Check gestalt xerj status. Use rg and current source reads; readiness will be checked when the runtime resumes.',
|
|
90
|
-
...(activeTurnId ? { turnId: activeTurnId } : {}),
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
77
|
if (notification.method === 'mcpServer/statusUpdated' &&
|
|
95
78
|
!connection?.threadId &&
|
|
96
79
|
connection?.name === 'gestalt-serena' &&
|
|
@@ -0,0 +1,105 @@
|
|
|
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 { constants } from 'node:fs';
|
|
7
|
+
import { access, realpath } from 'node:fs/promises';
|
|
8
|
+
import { isAbsolute, join } from 'node:path';
|
|
9
|
+
/** In-memory retirement only: never change native configuration or user data. */
|
|
10
|
+
export function retireLegacyCapabilityInstructions(instructions) {
|
|
11
|
+
const stack = [];
|
|
12
|
+
let start = 0;
|
|
13
|
+
let nested = false;
|
|
14
|
+
let copied = 0;
|
|
15
|
+
let retained = '';
|
|
16
|
+
for (const marker of instructions.matchAll(/<(\/?)gestalt_xerj_(capability|unavailable)>/gu)) {
|
|
17
|
+
const [, closing, kind] = marker;
|
|
18
|
+
if (!closing) {
|
|
19
|
+
if (stack.length === 0) {
|
|
20
|
+
start = marker.index;
|
|
21
|
+
nested = false;
|
|
22
|
+
}
|
|
23
|
+
else
|
|
24
|
+
nested = true;
|
|
25
|
+
stack.push(kind);
|
|
26
|
+
}
|
|
27
|
+
else if (stack.length) {
|
|
28
|
+
// Mismatched or nested markers leave their entire enclosing region intact.
|
|
29
|
+
if (stack.at(-1) !== kind) {
|
|
30
|
+
nested = true;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
stack.pop();
|
|
34
|
+
if (stack.length === 0 && !nested) {
|
|
35
|
+
retained += instructions.slice(copied, start);
|
|
36
|
+
copied = marker.index + marker[0].length;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Unclosed regions are copied verbatim, including any complete inner markers.
|
|
41
|
+
return retained + instructions.slice(copied);
|
|
42
|
+
}
|
|
43
|
+
function managedArguments(value) {
|
|
44
|
+
if (!Array.isArray(value) || value[0] !== 'xerj' || value[1] !== 'mcp')
|
|
45
|
+
return false;
|
|
46
|
+
if (value.length === 2)
|
|
47
|
+
return true;
|
|
48
|
+
// Earlier Mobile thread overrides used this exact loopback endpoint form.
|
|
49
|
+
if (value.length !== 4 || value[2] !== '--url' || typeof value[3] !== 'string')
|
|
50
|
+
return false;
|
|
51
|
+
if (!/^http:\/\/(?:127\.0\.0\.1|\[::1\])(?::\d{1,5})?$/.test(value[3]))
|
|
52
|
+
return false;
|
|
53
|
+
try {
|
|
54
|
+
const port = Number(new URL(value[3]).port || 80);
|
|
55
|
+
return port >= 1 && port <= 65535;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A mixed-version installation must migrate before a native thread can launch
|
|
63
|
+
* a retired managed service. Names alone never establish ownership. Unresolved
|
|
64
|
+
* executables, custom arguments and user transports remain native-owned.
|
|
65
|
+
*/
|
|
66
|
+
export async function assertNoLegacyManagedConnection(servers, environment = process.env) {
|
|
67
|
+
if (!servers || typeof servers !== 'object' || Array.isArray(servers))
|
|
68
|
+
return;
|
|
69
|
+
const candidates = Object.values(servers).filter((server) => !!server &&
|
|
70
|
+
typeof server === 'object' &&
|
|
71
|
+
!Array.isArray(server) &&
|
|
72
|
+
server.enabled !== false &&
|
|
73
|
+
!server.url &&
|
|
74
|
+
typeof server.command === 'string' &&
|
|
75
|
+
isAbsolute(server.command) &&
|
|
76
|
+
managedArguments(server.args));
|
|
77
|
+
if (!candidates.length)
|
|
78
|
+
return;
|
|
79
|
+
const paths = environment.GESTALT_MANAGER_BIN
|
|
80
|
+
? [environment.GESTALT_MANAGER_BIN]
|
|
81
|
+
: (environment.PATH ?? '')
|
|
82
|
+
.split(':')
|
|
83
|
+
.filter(Boolean)
|
|
84
|
+
.map((path) => join(path, 'gestalt'));
|
|
85
|
+
let manager;
|
|
86
|
+
for (const path of paths) {
|
|
87
|
+
if (!isAbsolute(path))
|
|
88
|
+
continue;
|
|
89
|
+
try {
|
|
90
|
+
await access(path, constants.X_OK);
|
|
91
|
+
manager = await realpath(path);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
/* Missing manager identity grants no migration authority. */
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (!manager)
|
|
99
|
+
return;
|
|
100
|
+
for (const server of candidates) {
|
|
101
|
+
const executable = await realpath(String(server.command)).catch(() => undefined);
|
|
102
|
+
if (executable === manager)
|
|
103
|
+
throw new Error('Retired Gestalt-managed Xerj connection requires migration. Run gestalt update, then reopen the session. Configuration and user data are unchanged.');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -25,7 +25,7 @@ import { threadPlanName } from './thread-plan-name.js';
|
|
|
25
25
|
import { WriterAcquisitionError, } from '../../features/sessions/application/writer-acquisition.js';
|
|
26
26
|
import { CodexJsonRpcError, isCodexThreadWriterBusy, isMissingCodexThreadRollout, } from './json-rpc-client.js';
|
|
27
27
|
import { resolvedServerRequestId } from './server-request.js';
|
|
28
|
-
import {
|
|
28
|
+
import { capabilityDeadline } from './capability-deadline.js';
|
|
29
29
|
import { McpStartupTracker } from './mcp-startup-failure.js';
|
|
30
30
|
/** Sticky thread config keeps skill paths out of the app-server process argv. */
|
|
31
31
|
export function threadSkillConfig(skillsConfig, modelConfig = {}) {
|
|
@@ -81,10 +81,9 @@ class SessionResource {
|
|
|
81
81
|
this.onDisposed = onDisposed;
|
|
82
82
|
}
|
|
83
83
|
retrieval;
|
|
84
|
-
retrievalFailureReported = false;
|
|
85
84
|
capabilityFailuresReported = new Set();
|
|
86
85
|
readinessPublished = new Map();
|
|
87
|
-
readinessDeadline =
|
|
86
|
+
readinessDeadline = capabilityDeadline();
|
|
88
87
|
dispose() {
|
|
89
88
|
if (this.disposed)
|
|
90
89
|
return false;
|
|
@@ -1116,18 +1115,21 @@ export class CodexSessionRuntime {
|
|
|
1116
1115
|
}
|
|
1117
1116
|
async withResolvedChildModels(resource, children) {
|
|
1118
1117
|
for (const child of children) {
|
|
1119
|
-
if (
|
|
1118
|
+
if (child.model ||
|
|
1119
|
+
resource.spawnedAgentModels.has(child.id) ||
|
|
1120
1120
|
resource.attemptedAgentModelRecovery.has(child.id))
|
|
1121
1121
|
continue;
|
|
1122
|
-
//
|
|
1123
|
-
//
|
|
1124
|
-
//
|
|
1122
|
+
// Roster reconciliation must not load historical children. Resuming them
|
|
1123
|
+
// just to read a model consumes agent slots (including pending_init slots
|
|
1124
|
+
// after a runtime recycle). Read metadata and leave missing models unknown.
|
|
1125
1125
|
resource.attemptedAgentModelRecovery.add(child.id);
|
|
1126
1126
|
try {
|
|
1127
|
-
const response = await resource.process.rpc.request('thread/
|
|
1127
|
+
const response = await resource.process.rpc.request('thread/read', {
|
|
1128
1128
|
threadId: child.id,
|
|
1129
|
+
includeTurns: false,
|
|
1129
1130
|
});
|
|
1130
|
-
const
|
|
1131
|
+
const thread = asRecord(asRecord(response)?.thread);
|
|
1132
|
+
const model = thread?.id === child.id ? boundedString(thread.model, 256) : undefined;
|
|
1131
1133
|
if (model)
|
|
1132
1134
|
resource.spawnedAgentModels.set(child.id, model);
|
|
1133
1135
|
}
|
|
@@ -1567,7 +1569,7 @@ export class CodexSessionRuntime {
|
|
|
1567
1569
|
if (purpose === 'execution')
|
|
1568
1570
|
this.scratch?.reserveRuntime?.(session);
|
|
1569
1571
|
this.confirmedWorkspaceReleases.delete(session.id);
|
|
1570
|
-
const deadline =
|
|
1572
|
+
const deadline = capabilityDeadline();
|
|
1571
1573
|
const lease = purpose === 'execution' && this.planStatusSource
|
|
1572
1574
|
? await this.planStatusSource.open({ id: session.id, workspacePath: session.workspacePath }, (update) => this.onPlanStatus?.(session.id, update))
|
|
1573
1575
|
: undefined;
|
|
@@ -1689,13 +1691,6 @@ export class CodexSessionRuntime {
|
|
|
1689
1691
|
return;
|
|
1690
1692
|
resource.capabilityFailuresReported.add(status.name);
|
|
1691
1693
|
}
|
|
1692
|
-
if (!asRecord(notification.params)?.threadId &&
|
|
1693
|
-
status?.name === 'gestalt-xerj' &&
|
|
1694
|
-
['failed', 'cancelled'].includes(status.status ?? '')) {
|
|
1695
|
-
if (resource.retrievalFailureReported)
|
|
1696
|
-
return;
|
|
1697
|
-
resource.retrievalFailureReported = true;
|
|
1698
|
-
}
|
|
1699
1694
|
}
|
|
1700
1695
|
const childModel = decodeThreadSettingsModel(notification);
|
|
1701
1696
|
if (childModel &&
|
|
@@ -1766,9 +1761,7 @@ export class CodexSessionRuntime {
|
|
|
1766
1761
|
...skill,
|
|
1767
1762
|
enabled: Boolean(resource.retrieval.capabilities.find((capability) => capability.skillName === skill.name)?.ready),
|
|
1768
1763
|
}
|
|
1769
|
-
: skill
|
|
1770
|
-
? { ...skill, enabled: resource.retrieval.ready }
|
|
1771
|
-
: skill),
|
|
1764
|
+
: skill),
|
|
1772
1765
|
},
|
|
1773
1766
|
};
|
|
1774
1767
|
}
|
|
@@ -1779,34 +1772,10 @@ export class CodexSessionRuntime {
|
|
|
1779
1772
|
resource.retrieval = state;
|
|
1780
1773
|
resource.skillsConfig = state.skillsConfig;
|
|
1781
1774
|
resource.modelConfig = state.config;
|
|
1782
|
-
if (state.backendPreparation) {
|
|
1783
|
-
const status = state.backendPreparation.status === 'starting' ? 'starting' : 'failed';
|
|
1784
|
-
this.publishStartupStatus(resource, resource.mcpStartup.observeReadiness(status, state.backendPreparation.reason));
|
|
1785
|
-
if (status === 'failed') {
|
|
1786
|
-
resource.retrievalFailureReported = true;
|
|
1787
|
-
this.onNotification?.(session.id, {
|
|
1788
|
-
method: 'mcpServer/statusUpdated',
|
|
1789
|
-
params: { name: 'gestalt-xerj', status },
|
|
1790
|
-
}, { kind: 'root' });
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
1775
|
this.reportCapabilityFailures(resource, session);
|
|
1794
|
-
if (state.diagnostic && !state.backendPreparation && !resource.retrievalFailureReported) {
|
|
1795
|
-
resource.retrievalFailureReported = true;
|
|
1796
|
-
this.publishMcpStartup(resource, {
|
|
1797
|
-
method: 'mcpServer/statusUpdated',
|
|
1798
|
-
params: { name: 'gestalt-xerj', status: 'failed' },
|
|
1799
|
-
});
|
|
1800
|
-
this.onNotification?.(session.id, {
|
|
1801
|
-
method: 'mcpServer/statusUpdated',
|
|
1802
|
-
params: { name: 'gestalt-xerj', status: 'failed' },
|
|
1803
|
-
}, { kind: 'root' });
|
|
1804
|
-
}
|
|
1805
1776
|
}
|
|
1806
1777
|
reportCapabilityFailures(resource, session) {
|
|
1807
1778
|
for (const capability of resource.retrieval?.capabilities ?? []) {
|
|
1808
|
-
if (capability.serverName === 'gestalt-xerj' && resource.retrieval?.backendPreparation)
|
|
1809
|
-
continue;
|
|
1810
1779
|
if (!capability.diagnostic || resource.capabilityFailuresReported.has(capability.serverName))
|
|
1811
1780
|
continue;
|
|
1812
1781
|
resource.capabilityFailuresReported.add(capability.serverName);
|
|
@@ -1839,20 +1808,6 @@ export class CodexSessionRuntime {
|
|
|
1839
1808
|
}
|
|
1840
1809
|
state.fallback();
|
|
1841
1810
|
this.reportCapabilityFailures(resource, session);
|
|
1842
|
-
if (!state.capabilities && !resource.retrievalFailureReported) {
|
|
1843
|
-
resource.retrievalFailureReported = true;
|
|
1844
|
-
this.publishMcpStartup(resource, {
|
|
1845
|
-
method: 'mcpServer/statusUpdated',
|
|
1846
|
-
params: { name: 'gestalt-xerj', status: 'failed' },
|
|
1847
|
-
});
|
|
1848
|
-
this.onNotification?.(session.id, {
|
|
1849
|
-
method: 'mcpServer/statusUpdated',
|
|
1850
|
-
params: {
|
|
1851
|
-
name: 'gestalt-xerj',
|
|
1852
|
-
status: 'failed',
|
|
1853
|
-
},
|
|
1854
|
-
}, { kind: 'root' });
|
|
1855
|
-
}
|
|
1856
1811
|
resource.skillsConfig = state.skillsConfig;
|
|
1857
1812
|
resource.modelConfig = state.config;
|
|
1858
1813
|
// A fresh Codex thread has no durable rollout until its first turn, so it
|
|
@@ -18,7 +18,7 @@ export const startupDescriptor = {
|
|
|
18
18
|
maxWords: 350,
|
|
19
19
|
};
|
|
20
20
|
export async function installStartupFixture(root, version = '0.0.1') {
|
|
21
|
-
for (const path of ['.codex-plugin', 'startup', 'skills/coding', 'skills/
|
|
21
|
+
for (const path of ['.codex-plugin', 'startup', 'skills/coding', 'skills/serena'])
|
|
22
22
|
await mkdir(join(root, path), { recursive: true });
|
|
23
23
|
await writeFile(join(root, '.codex-plugin/plugin.json'), JSON.stringify({
|
|
24
24
|
name: 'gestalt',
|
|
@@ -28,9 +28,9 @@ export async function installStartupFixture(root, version = '0.0.1') {
|
|
|
28
28
|
}));
|
|
29
29
|
await writeFile(join(root, 'gestalt-startup-contract.json'), JSON.stringify(startupDescriptor));
|
|
30
30
|
await writeFile(join(root, 'startup/bootstrap.md'), syntheticBootstrap);
|
|
31
|
-
for (const name of ['coding', '
|
|
31
|
+
for (const name of ['coding', 'serena'])
|
|
32
32
|
await writeFile(join(root, `skills/${name}/SKILL.md`), `---\nname: ${name}\ndescription: Synthetic ${name} fixture\n---\nSYNTHETIC_${name.toUpperCase()}_GUIDANCE\n`);
|
|
33
|
-
return ['coding', '
|
|
33
|
+
return ['coding', 'serena'].map((name) => ({
|
|
34
34
|
name: `gestalt:${name}`,
|
|
35
35
|
path: join(root, `skills/${name}/SKILL.md`),
|
|
36
36
|
enabled: true,
|
|
@@ -71,15 +71,9 @@ export class KimiSkillCatalog {
|
|
|
71
71
|
const skill = wire;
|
|
72
72
|
if (!skill || typeof skill !== 'object' || typeof skill.name !== 'string')
|
|
73
73
|
continue;
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
// conditional retrieval guidance without that verified connection.
|
|
77
|
-
if (skill.name === 'gestalt:xerj') {
|
|
78
|
-
errors.push({
|
|
79
|
-
message: 'Xerj retrieval is unavailable for Kimi web: native session readiness is unsupported.',
|
|
80
|
-
});
|
|
74
|
+
// Compatibility only: do not advertise the retired managed skill from old installations.
|
|
75
|
+
if (skill.name === 'gestalt:xerj')
|
|
81
76
|
continue;
|
|
82
|
-
}
|
|
83
77
|
// The shared catalog contract canonicalizes skill paths as absolute
|
|
84
78
|
// filesystem paths (profile snapshots and overrides resolve against
|
|
85
79
|
// them). kimi built-ins report no path and cannot be materialized per
|
|
@@ -9,7 +9,7 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
9
9
|
import { readFile, realpath, stat } from 'node:fs/promises';
|
|
10
10
|
import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
11
11
|
import { promisify } from 'node:util';
|
|
12
|
-
import { beforeDeadline } from '
|
|
12
|
+
import { beforeDeadline } from '../codex/capability-deadline.js';
|
|
13
13
|
import { ReadinessEvidence } from './readiness-evidence.js';
|
|
14
14
|
import { hasUnrestrictedReadAuthority } from './read-authority.js';
|
|
15
15
|
const execute = promisify(execFile);
|
|
@@ -137,12 +137,7 @@ async function capture(workspace, cwd, path, configuration, authorize) {
|
|
|
137
137
|
builds.push(hash(JSON.stringify([build, item])));
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
for (const name of [
|
|
141
|
-
'.serena/project.yml',
|
|
142
|
-
'.xerjignore',
|
|
143
|
-
'CMakePresets.json',
|
|
144
|
-
'CMakeUserPresets.json',
|
|
145
|
-
]) {
|
|
140
|
+
for (const name of ['.serena/project.yml', 'CMakePresets.json', 'CMakeUserPresets.json']) {
|
|
146
141
|
const content = await read(join(repository, name), true);
|
|
147
142
|
metadata.push([name, content ? hash(content) : null]);
|
|
148
143
|
}
|
|
@@ -8,7 +8,7 @@ import { resolve } from 'node:path';
|
|
|
8
8
|
import { availableSkillSchema, } from '../../features/skills/model/skill-profile.js';
|
|
9
9
|
import { SkillProfileError } from '../../features/skills/model/errors.js';
|
|
10
10
|
import { launchCodexAppServer } from '../codex/codex-process-launcher.js';
|
|
11
|
-
import {
|
|
11
|
+
import { capabilityDeadline } from '../codex/capability-deadline.js';
|
|
12
12
|
import { threadSkillConfig } from '../codex/session-runtime.js';
|
|
13
13
|
const optionalString = z.preprocess((value) => (value === null ? undefined : value), z.string().optional());
|
|
14
14
|
const optionalObject = (schema) => z.preprocess((value) => (value === null ? undefined : value), schema.optional());
|
|
@@ -53,7 +53,7 @@ export class CodexSkillCatalog {
|
|
|
53
53
|
this.retrieval = retrieval;
|
|
54
54
|
}
|
|
55
55
|
async list(workspace) {
|
|
56
|
-
const deadline = Math.min(
|
|
56
|
+
const deadline = Math.min(capabilityDeadline(), Date.now() + this.timeoutMs);
|
|
57
57
|
const canonicalWorkspace = resolve(workspace);
|
|
58
58
|
const server = this.launch({ profile: this.profile, cwd: canonicalWorkspace });
|
|
59
59
|
try {
|
|
@@ -68,16 +68,18 @@ export class CodexSkillCatalog {
|
|
|
68
68
|
const entry = parsed.data.data.find((candidate) => candidate.cwd === canonicalWorkspace);
|
|
69
69
|
if (!entry)
|
|
70
70
|
throw new SkillProfileError('INVALID_SKILL_DISCOVERY', 'Codex did not return the requested workspace catalog.');
|
|
71
|
-
|
|
71
|
+
// Ignore the retired managed skill from independently updated older installations.
|
|
72
|
+
const skills = entry.skills
|
|
73
|
+
.filter((skill) => skill.name !== 'gestalt:xerj')
|
|
74
|
+
.map((skill) => {
|
|
72
75
|
const stable = availableSkillSchema.safeParse(skill);
|
|
73
76
|
if (!stable.success)
|
|
74
77
|
throw new SkillProfileError('INVALID_SKILL_DISCOVERY', 'Invalid Codex skill metadata.');
|
|
75
|
-
return
|
|
78
|
+
return stable.data.name === 'gestalt:playwright'
|
|
76
79
|
? { ...stable.data, enabled: false }
|
|
77
80
|
: stable.data;
|
|
78
81
|
});
|
|
79
|
-
if (this.retrieval &&
|
|
80
|
-
skills.some((skill) => ['gestalt:xerj', 'gestalt:serena'].includes(skill.name))) {
|
|
82
|
+
if (this.retrieval && skills.some((skill) => skill.name === 'gestalt:serena')) {
|
|
81
83
|
const state = await this.retrieval.prepare({
|
|
82
84
|
cwd: canonicalWorkspace,
|
|
83
85
|
deadline,
|
|
@@ -100,7 +102,7 @@ export class CodexSkillCatalog {
|
|
|
100
102
|
const ready = result.thread?.id &&
|
|
101
103
|
(await this.retrieval.verify(server.rpc, result.thread.id, state));
|
|
102
104
|
for (const skill of skills)
|
|
103
|
-
if (
|
|
105
|
+
if (skill.name === 'gestalt:serena')
|
|
104
106
|
skill.enabled = state.capabilities
|
|
105
107
|
? Boolean(result.thread?.id) &&
|
|
106
108
|
Boolean(state.capabilities.find((capability) => capability.skillName === skill.name)
|
|
@@ -3,14 +3,8 @@
|
|
|
3
3
|
* Designed by Denis Roio <jaromil@dyne.org>
|
|
4
4
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
export const
|
|
8
|
-
'context-mode',
|
|
9
|
-
'gestalt-context-mode',
|
|
10
|
-
'gestalt-serena',
|
|
11
|
-
'gestalt-xerj',
|
|
12
|
-
];
|
|
13
|
-
export const startupPhases = ['artifact', 'spawn', 'initialize', 'startup', 'readiness'];
|
|
6
|
+
export const startupServers = ['context-mode', 'gestalt-context-mode', 'gestalt-serena'];
|
|
7
|
+
export const startupPhases = ['artifact', 'spawn', 'initialize', 'startup'];
|
|
14
8
|
export const startupFailureCodes = [
|
|
15
9
|
'artifact-unavailable',
|
|
16
10
|
'process-exited',
|
|
@@ -19,7 +13,6 @@ export const startupFailureCodes = [
|
|
|
19
13
|
'reauthentication-required',
|
|
20
14
|
'startup-failed',
|
|
21
15
|
'cancelled',
|
|
22
|
-
'readiness-failed',
|
|
23
16
|
];
|
|
24
17
|
const signals = [
|
|
25
18
|
'SIGHUP',
|
|
@@ -62,9 +55,6 @@ export function parseMcpStartupFailure(value) {
|
|
|
62
55
|
!member(startupPhases, r.phase) ||
|
|
63
56
|
!member(startupFailureCodes, r.code))
|
|
64
57
|
return undefined;
|
|
65
|
-
if ((r.phase === 'readiness' || r.code === 'readiness-failed') &&
|
|
66
|
-
!(r.phase === 'readiness' && r.code === 'readiness-failed' && r.serverName === 'gestalt-xerj'))
|
|
67
|
-
return undefined;
|
|
68
58
|
return {
|
|
69
59
|
schemaVersion: 1,
|
|
70
60
|
failureId,
|
|
@@ -85,9 +75,6 @@ export function parseMcpStartupFailure(value) {
|
|
|
85
75
|
? r.exitCode
|
|
86
76
|
: null,
|
|
87
77
|
signal: member(signals, r.signal) ? r.signal : null,
|
|
88
|
-
...(r.phase === 'readiness' && r.code === 'readiness-failed' && r.serverName === 'gestalt-xerj'
|
|
89
|
-
? { readinessReason: parseXerjStartupReason(r.readinessReason) }
|
|
90
|
-
: {}),
|
|
91
78
|
};
|
|
92
79
|
}
|
|
93
80
|
export function parseMcpStartupStatus(value) {
|
|
@@ -126,9 +113,6 @@ export function parseMcpStartupStatus(value) {
|
|
|
126
113
|
observedAt,
|
|
127
114
|
status: r.status,
|
|
128
115
|
failure: failure ?? null,
|
|
129
|
-
...(r.phase === 'readiness' && r.serverName === 'gestalt-xerj'
|
|
130
|
-
? { phase: 'readiness' }
|
|
131
|
-
: {}),
|
|
132
116
|
};
|
|
133
117
|
}
|
|
134
118
|
/** One current row per physical thread/tool; unattributed lifetimes stay separate. */
|
|
@@ -137,19 +121,13 @@ export function mcpStartupActivity(status) {
|
|
|
137
121
|
id: `mcp-startup:${status.threadId ?? `unattributed:${status.runtimeId}`}:${status.serverName}`,
|
|
138
122
|
label: `${status.serverName} · ${status.status}`,
|
|
139
123
|
detail: status.failure
|
|
140
|
-
? status.failure.
|
|
141
|
-
? `Backend readiness: ${status.failure.readinessReason ?? 'unknown'}.`
|
|
142
|
-
: `Startup observation: ${status.failure.code}. Child exit diagnostics are unavailable.`
|
|
124
|
+
? `Startup observation: ${status.failure.code}. Child exit diagnostics are unavailable.`
|
|
143
125
|
: `Startup observation: ${status.status}.`,
|
|
144
126
|
mcpStartup: status,
|
|
145
127
|
};
|
|
146
128
|
}
|
|
147
129
|
export function startupToolLabel(server) {
|
|
148
|
-
return server === 'gestalt-serena'
|
|
149
|
-
? 'Serena'
|
|
150
|
-
: server === 'gestalt-xerj'
|
|
151
|
-
? 'XERJ'
|
|
152
|
-
: 'Context Mode';
|
|
130
|
+
return server === 'gestalt-serena' ? 'Serena' : 'Context Mode';
|
|
153
131
|
}
|
|
154
132
|
export function startupFailureReason(code) {
|
|
155
133
|
return {
|
|
@@ -160,13 +138,10 @@ export function startupFailureReason(code) {
|
|
|
160
138
|
'reauthentication-required': 'Codex reported that authentication is required again.',
|
|
161
139
|
'startup-failed': 'Codex reported a startup failure without a more specific reason.',
|
|
162
140
|
cancelled: 'Startup was cancelled.',
|
|
163
|
-
'readiness-failed': 'Gestalt could not prepare the XERJ backend.',
|
|
164
141
|
}[code];
|
|
165
142
|
}
|
|
166
143
|
export function startupRecoveryGuidance(server) {
|
|
167
144
|
return server === 'gestalt-serena'
|
|
168
145
|
? 'Optional tool unavailable. Continue with native code tools. Operators can inspect it with gestalt serena doctor.'
|
|
169
|
-
:
|
|
170
|
-
? 'Optional retrieval unavailable. Continue with rg and current source reads. Operators can inspect gestalt xerj status.'
|
|
171
|
-
: 'Required tool unavailable. The affected startup cannot continue until Context Mode is available. Operators can inspect it with ctx-doctor.';
|
|
146
|
+
: 'Required tool unavailable. The affected startup cannot continue until Context Mode is available. Operators can inspect it with ctx-doctor.';
|
|
172
147
|
}
|