gestalt-mobile 0.61.1 → 0.62.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 +34 -5
- package/dist/client/assets/{index-Cp-JfcNd.css → index-CRnoGk06.css} +1 -1
- package/dist/client/assets/{index-DeNYHfGR.js → index-DehRk2EQ.js} +7 -3
- package/dist/client/index.html +2 -2
- package/dist/server/server/composition.js +47 -2
- package/dist/server/server/features/plans/application/parse-supervised-plan.js +5 -0
- package/dist/server/server/features/plans/application/supervised-plan-registry.js +11 -2
- package/dist/server/server/features/sessions/model/relay-session.js +17 -2
- package/dist/server/server/features/sessions/start-session/use-case.js +1 -0
- package/dist/server/server/features/skills/list-available/endpoint.js +1 -0
- package/dist/server/server/features/skills/list-profiles/endpoint.js +1 -0
- package/dist/server/server/features/skills/model/skill-profile.js +20 -7
- package/dist/server/server/features/skills/replace-profile/endpoint.js +6 -1
- package/dist/server/server/platform/codex/codex-playwright.js +399 -0
- package/dist/server/server/platform/codex/managed-playwright.js +150 -0
- package/dist/server/server/platform/codex/session-runtime.js +34 -1
- package/dist/server/server/platform/skills/codex-skill-catalog.js +1 -1
- package/dist/server/shared/contracts/managed-playwright.js +34 -0
- package/dist/server/shared/contracts/profile-capabilities.js +13 -0
- package/package.json +1 -1
package/dist/client/index.html
CHANGED
|
@@ -16,8 +16,8 @@ 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-
|
|
20
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-DehRk2EQ.js"></script>
|
|
20
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CRnoGk06.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
|
23
23
|
<div id="app"></div>
|
|
@@ -78,6 +78,9 @@ import { CodexXerj } from './platform/retrieval/codex-xerj.js';
|
|
|
78
78
|
import { CodexSerena } from './platform/codex/codex-serena.js';
|
|
79
79
|
import { ManagedSerena } from './platform/codex/managed-serena.js';
|
|
80
80
|
import { CodexCapabilities } from './platform/codex/codex-capabilities.js';
|
|
81
|
+
import { CodexPlaywright } from './platform/codex/codex-playwright.js';
|
|
82
|
+
import { ManagedPlaywright } from './platform/codex/managed-playwright.js';
|
|
83
|
+
import { isManagedPlaywrightCall } from '../shared/contracts/managed-playwright.js';
|
|
81
84
|
import { compileSkillOverride } from './features/skills/model/skill-profile.js';
|
|
82
85
|
import { SupervisedPlanRegistry } from './features/plans/application/supervised-plan-registry.js';
|
|
83
86
|
import { FilesystemPlanStatusSource } from './platform/plans/filesystem-plan-status-source.js';
|
|
@@ -484,6 +487,22 @@ export async function composeRelayApp(options) {
|
|
|
484
487
|
const xerj = new CodexXerj(retrievalCapability);
|
|
485
488
|
const serenaInstallation = new ManagedSerena();
|
|
486
489
|
const capabilities = new CodexCapabilities(xerj, new CodexSerena(serenaInstallation));
|
|
490
|
+
const playwright = new CodexPlaywright(new ManagedPlaywright());
|
|
491
|
+
const playwrightAuthority = (session) => {
|
|
492
|
+
const plan = supervisedPlans.findCurrent(session.id);
|
|
493
|
+
const active = plan?.steps[currentExecutableL1Index(plan)];
|
|
494
|
+
const control = autopilotStore.find(session.id);
|
|
495
|
+
return {
|
|
496
|
+
session,
|
|
497
|
+
planIdentity: supervisedPlans.identity(session.id),
|
|
498
|
+
activePlanId: active?.id ?? null,
|
|
499
|
+
declared: active?.state === 'WIP' && active.managedMcp?.includes('playwright') === true,
|
|
500
|
+
fenced: control?.stopReason === 'manualDisabled' ||
|
|
501
|
+
control?.state === 'safetyPaused' ||
|
|
502
|
+
control?.state === 'attentionRequired' ||
|
|
503
|
+
blockingInteractions(session.id).length > 0,
|
|
504
|
+
};
|
|
505
|
+
};
|
|
487
506
|
const skillCatalog = (provider, profile) => provider === 'kimi'
|
|
488
507
|
? kimiSkillCatalog
|
|
489
508
|
: new CodexSkillCatalog(profile, options.launchAppServer ?? launchCodexAppServer);
|
|
@@ -948,6 +967,15 @@ export async function composeRelayApp(options) {
|
|
|
948
967
|
const session = withPendingInteractions(sessions.find(sessionId));
|
|
949
968
|
if (!session)
|
|
950
969
|
return false;
|
|
970
|
+
if (isManagedPlaywrightCall(request)) {
|
|
971
|
+
const result = await playwright.control(playwrightAuthority(session), request.params.arguments, origin.kind === 'root' &&
|
|
972
|
+
origin.physicalThreadId === session.threadId &&
|
|
973
|
+
origin.physicalTurnId === session.activeTurnId);
|
|
974
|
+
return (runtime?.resolveServerRequest(sessionId, String(request.id), {
|
|
975
|
+
success: true,
|
|
976
|
+
contentItems: [{ type: 'inputText', text: JSON.stringify(result) }],
|
|
977
|
+
}) === true);
|
|
978
|
+
}
|
|
951
979
|
const toolCall = request.params;
|
|
952
980
|
if (request.method === 'item/tool/call' &&
|
|
953
981
|
toolCall?.tool === gestaltTestRunnerDynamicTool.name) {
|
|
@@ -1240,7 +1268,7 @@ export async function composeRelayApp(options) {
|
|
|
1240
1268
|
explicit: session.effectiveSkillSelection?.skills ?? options.explicitSkillProfile?.skills,
|
|
1241
1269
|
project: project?.skills,
|
|
1242
1270
|
});
|
|
1243
|
-
|
|
1271
|
+
const state = await capabilities.prepare({
|
|
1244
1272
|
cwd: session.workspacePath,
|
|
1245
1273
|
approvalPolicy: session.executionPolicy?.approvalPolicy ?? 'on-request',
|
|
1246
1274
|
rpc,
|
|
@@ -1250,8 +1278,25 @@ export async function composeRelayApp(options) {
|
|
|
1250
1278
|
skillsConfig: selected.skillsConfig,
|
|
1251
1279
|
start: true,
|
|
1252
1280
|
});
|
|
1281
|
+
return playwright.prepare(state, playwrightAuthority(session), {
|
|
1282
|
+
rpc,
|
|
1283
|
+
skills: catalog.skills,
|
|
1284
|
+
deadline: Date.now() + 5_000,
|
|
1285
|
+
current: () => playwrightAuthority(sessions.find(session.id) ?? session),
|
|
1286
|
+
});
|
|
1287
|
+
},
|
|
1288
|
+
verify: async (rpc, threadId, state) => {
|
|
1289
|
+
const base = playwright.base(state);
|
|
1290
|
+
const [retrievalReady, browserReady] = await Promise.all([
|
|
1291
|
+
capabilities.verify(rpc, threadId, base),
|
|
1292
|
+
playwright.verify(rpc, threadId, state),
|
|
1293
|
+
]);
|
|
1294
|
+
return retrievalReady && browserReady;
|
|
1253
1295
|
},
|
|
1254
|
-
|
|
1296
|
+
needsResume: (session) => playwright.needsResume(playwrightAuthority(session)),
|
|
1297
|
+
release: (sessionId) => playwright.release(sessionId),
|
|
1298
|
+
observe: (sessionId, notification) => playwright.observe(sessionId, notification),
|
|
1299
|
+
bound: (state, threadId) => playwright.bound(state, threadId),
|
|
1255
1300
|
}, async (sessionId, threadId) => {
|
|
1256
1301
|
requireOrgExecutionAdmission(sessionId);
|
|
1257
1302
|
const plan = supervisedPlans.find(sessionId);
|
|
@@ -191,6 +191,9 @@ function makeStep(heading) {
|
|
|
191
191
|
const measurement = measurementFor(heading);
|
|
192
192
|
if (!description || measurement === null)
|
|
193
193
|
return null;
|
|
194
|
+
const managed = heading.descriptions.get('Managed MCP');
|
|
195
|
+
if (managed !== undefined && (heading.level !== 1 || managed !== 'playwright'))
|
|
196
|
+
return null;
|
|
194
197
|
if (heading.level === 1) {
|
|
195
198
|
const reviewStatus = heading.properties.get('REVIEW_STATUS');
|
|
196
199
|
const skills = heading.properties.get('SKILLS');
|
|
@@ -204,6 +207,7 @@ function makeStep(heading) {
|
|
|
204
207
|
priority: heading.priority,
|
|
205
208
|
reviewStatus: reviewStatus,
|
|
206
209
|
skills: skills.split(/\s+/).filter(Boolean),
|
|
210
|
+
...(managed === 'playwright' ? { managedMcp: ['playwright'] } : {}),
|
|
207
211
|
description,
|
|
208
212
|
...(measurement ? { measurement } : {}),
|
|
209
213
|
children: [],
|
|
@@ -399,6 +403,7 @@ function freezePlan(plan) {
|
|
|
399
403
|
const freezeStep = (step) => Object.freeze({
|
|
400
404
|
...step,
|
|
401
405
|
...(step.skills ? { skills: Object.freeze([...step.skills]) } : {}),
|
|
406
|
+
...(step.managedMcp ? { managedMcp: Object.freeze(['playwright']) } : {}),
|
|
402
407
|
description: Object.freeze({ ...step.description }),
|
|
403
408
|
children: Object.freeze(step.children.map(freezeStep)),
|
|
404
409
|
});
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
/** Retains at most one validated plan projection for each relay session. */
|
|
7
7
|
export class SupervisedPlanRegistry {
|
|
8
8
|
policyUnavailable = new Set();
|
|
9
|
+
currentUnavailable = new Set();
|
|
9
10
|
plans = new Map();
|
|
10
11
|
accept(sessionId, update) {
|
|
11
12
|
if (update.kind === 'updated') {
|
|
@@ -15,9 +16,12 @@ export class SupervisedPlanRegistry {
|
|
|
15
16
|
publicationReason: update.reason,
|
|
16
17
|
});
|
|
17
18
|
this.policyUnavailable.delete(sessionId);
|
|
19
|
+
this.currentUnavailable.delete(sessionId);
|
|
18
20
|
}
|
|
19
|
-
else
|
|
20
|
-
this.
|
|
21
|
+
else {
|
|
22
|
+
this.currentUnavailable.add(sessionId);
|
|
23
|
+
if (update.modelPolicyRequired || this.find(sessionId)?.modelPolicyVersion === 1)
|
|
24
|
+
this.policyUnavailable.add(sessionId);
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
/** An invalid mandatory publication cannot silently reuse a legacy execution policy. */
|
|
@@ -31,6 +35,10 @@ export class SupervisedPlanRegistry {
|
|
|
31
35
|
find(sessionId) {
|
|
32
36
|
return this.plans.get(sessionId)?.plan ?? null;
|
|
33
37
|
}
|
|
38
|
+
/** Retained display state cannot authorize a capability after an invalid publication. */
|
|
39
|
+
findCurrent(sessionId) {
|
|
40
|
+
return this.currentUnavailable.has(sessionId) ? null : this.find(sessionId);
|
|
41
|
+
}
|
|
34
42
|
identity(sessionId) {
|
|
35
43
|
return this.plans.get(sessionId)?.identity ?? null;
|
|
36
44
|
}
|
|
@@ -40,5 +48,6 @@ export class SupervisedPlanRegistry {
|
|
|
40
48
|
clear(sessionId) {
|
|
41
49
|
this.plans.delete(sessionId);
|
|
42
50
|
this.policyUnavailable.delete(sessionId);
|
|
51
|
+
this.currentUnavailable.delete(sessionId);
|
|
43
52
|
}
|
|
44
53
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
*/
|
|
6
6
|
import { DomainError } from './errors.js';
|
|
7
|
+
import { profileCapabilitiesSchema, } from '../../../../shared/contracts/profile-capabilities.js';
|
|
7
8
|
import { createSkillSelection, normalizeSkillProfileName, } from '../../skills/model/skill-profile.js';
|
|
8
9
|
import { interactionId, profileName, sessionId, threadId, turnId, workspaceId, workspacePath, } from './value-objects.js';
|
|
9
10
|
/** A durable thread can be read even when this relay has no live writer. */
|
|
@@ -37,6 +38,9 @@ export function createSessionExecutionPolicy(input) {
|
|
|
37
38
|
export function createEffectiveSkillSelection(input) {
|
|
38
39
|
const warnings = (input.warnings ?? []).filter((warning) => typeof warning === 'string' && warning.length > 0);
|
|
39
40
|
return {
|
|
41
|
+
...(input.capabilities === undefined
|
|
42
|
+
? {}
|
|
43
|
+
: { capabilities: profileCapabilitiesSchema.parse(input.capabilities) }),
|
|
40
44
|
...(input.selectedProfileName === undefined
|
|
41
45
|
? {}
|
|
42
46
|
: { selectedProfileName: normalizeSkillProfileName(input.selectedProfileName) }),
|
|
@@ -62,7 +66,12 @@ export class RelaySession {
|
|
|
62
66
|
...(input.model === undefined ? {} : { model: input.model }),
|
|
63
67
|
...(input.modelSettings === undefined ? {} : { modelSettings: { ...input.modelSettings } }),
|
|
64
68
|
...(input.branch === undefined ? {} : { branch: input.branch }),
|
|
65
|
-
effectiveSkillSelection: createEffectiveSkillSelection(
|
|
69
|
+
effectiveSkillSelection: createEffectiveSkillSelection({
|
|
70
|
+
...input.effectiveSkillSelection,
|
|
71
|
+
...(input.provider === 'kimi' && input.effectiveSkillSelection.capabilities !== undefined
|
|
72
|
+
? { capabilities: { playwright: { enabled: false } } }
|
|
73
|
+
: {}),
|
|
74
|
+
}),
|
|
66
75
|
executionPolicy: createSessionExecutionPolicy(input),
|
|
67
76
|
threadId: null,
|
|
68
77
|
state: 'starting',
|
|
@@ -180,7 +189,13 @@ function copy(snapshot) {
|
|
|
180
189
|
...(snapshot.effectiveSkillSelection === undefined
|
|
181
190
|
? {}
|
|
182
191
|
: {
|
|
183
|
-
effectiveSkillSelection: createEffectiveSkillSelection(
|
|
192
|
+
effectiveSkillSelection: createEffectiveSkillSelection({
|
|
193
|
+
...snapshot.effectiveSkillSelection,
|
|
194
|
+
...(snapshot.provider === 'kimi' &&
|
|
195
|
+
snapshot.effectiveSkillSelection.capabilities !== undefined
|
|
196
|
+
? { capabilities: { playwright: { enabled: false } } }
|
|
197
|
+
: {}),
|
|
198
|
+
}),
|
|
184
199
|
}),
|
|
185
200
|
pendingInteractions: snapshot.pendingInteractions.map((item) => ({ ...item })),
|
|
186
201
|
};
|
|
@@ -45,6 +45,7 @@ export async function startSession(input, deps) {
|
|
|
45
45
|
const sourceProfile = selectedProfile ?? projectProfile;
|
|
46
46
|
const reconciledSkills = reconcileSkillSelectionSnapshot(catalog.skills, sourceProfile?.skills);
|
|
47
47
|
effectiveSkillSelection = {
|
|
48
|
+
...(sourceProfile?.capabilities ? { capabilities: sourceProfile.capabilities } : {}),
|
|
48
49
|
...(selectedProfile ? { selectedProfileName: selectedProfile.name } : {}),
|
|
49
50
|
skills: [
|
|
50
51
|
...reconciledSkills.skills.map((skill) => ({
|
|
@@ -39,6 +39,7 @@ export function registerListAvailableSkills(app, deps) {
|
|
|
39
39
|
const skills = applySkillSelectionSnapshot(discovered.skills, project?.skills);
|
|
40
40
|
return {
|
|
41
41
|
source: project ? 'project' : 'native',
|
|
42
|
+
...(project?.capabilities ? { capabilities: project.capabilities } : {}),
|
|
42
43
|
errors: discovered.errors.map(({ message }) => ({ message })),
|
|
43
44
|
skills: skills
|
|
44
45
|
.filter((skill) => !isAlwaysAdvertisedSkill(skill) && skill.name !== 'gestalt:xerj')
|
|
@@ -7,6 +7,7 @@ import { isAbsolute, normalize } from 'node:path';
|
|
|
7
7
|
import { parseDocument, stringify } from 'yaml';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { SkillProfileError } from './errors.js';
|
|
10
|
+
import { profileCapabilitiesSchema, } from '../../../../shared/contracts/profile-capabilities.js';
|
|
10
11
|
const profileNamePattern = /^[a-z0-9](?:[a-z0-9-]{0,62})?$/;
|
|
11
12
|
/**
|
|
12
13
|
* A path-keyed skill record. `name` is display metadata only: a skill's path is
|
|
@@ -61,18 +62,26 @@ export const availableSkillSchema = z
|
|
|
61
62
|
*/
|
|
62
63
|
export function isAlwaysAdvertisedSkill(skill) {
|
|
63
64
|
return (isGestaltSkillName(skill.name) &&
|
|
64
|
-
(!['gestalt:xerj', 'gestalt:serena'].includes(skill.name) ||
|
|
65
|
+
(!['gestalt:xerj', 'gestalt:serena', 'gestalt:playwright'].includes(skill.name) ||
|
|
66
|
+
skill.enabled));
|
|
65
67
|
}
|
|
66
68
|
export function isGestaltSkillName(name) {
|
|
67
69
|
return name.startsWith('gestalt:');
|
|
68
70
|
}
|
|
69
|
-
const
|
|
71
|
+
const legacyProfileDocumentSchema = z
|
|
70
72
|
.object({
|
|
71
73
|
version: z.literal(1),
|
|
72
74
|
name: z.string().min(1),
|
|
73
75
|
skills: z.array(skillSelectionEntrySchema),
|
|
74
76
|
})
|
|
75
77
|
.strict();
|
|
78
|
+
const profileDocumentSchema = z.discriminatedUnion('version', [
|
|
79
|
+
legacyProfileDocumentSchema,
|
|
80
|
+
legacyProfileDocumentSchema.extend({
|
|
81
|
+
version: z.literal(2),
|
|
82
|
+
capabilities: profileCapabilitiesSchema,
|
|
83
|
+
}),
|
|
84
|
+
]);
|
|
76
85
|
/**
|
|
77
86
|
* Normalize a profile name before using it in its global filename. The output
|
|
78
87
|
* is deliberately narrow so a profile name can never become a path traversal.
|
|
@@ -164,7 +173,7 @@ export function applySkillSelectionSnapshot(discovered, selection) {
|
|
|
164
173
|
const enabledByPath = new Map(createSkillSelection(selection).map((entry) => [entry.path, entry.enabled]));
|
|
165
174
|
return catalog.map((skill) => ({
|
|
166
175
|
...skill,
|
|
167
|
-
enabled: ['gestalt:xerj', 'gestalt:serena'].includes(skill.name)
|
|
176
|
+
enabled: ['gestalt:xerj', 'gestalt:serena', 'gestalt:playwright'].includes(skill.name)
|
|
168
177
|
? skill.enabled
|
|
169
178
|
: isAlwaysAdvertisedSkill(skill)
|
|
170
179
|
? true
|
|
@@ -218,16 +227,20 @@ export function compileSkillOverride(input) {
|
|
|
218
227
|
}
|
|
219
228
|
/** Construct the single profile contract shared by global and project YAML files. */
|
|
220
229
|
export function createSkillProfile(input) {
|
|
230
|
+
const capabilities = input.capabilities === undefined
|
|
231
|
+
? undefined
|
|
232
|
+
: profileCapabilitiesSchema.parse(input.capabilities);
|
|
221
233
|
return {
|
|
222
|
-
version: 1,
|
|
234
|
+
version: capabilities === undefined ? 1 : 2,
|
|
223
235
|
name: normalizeSkillProfileName(input.name),
|
|
236
|
+
...(capabilities === undefined ? {} : { capabilities }),
|
|
224
237
|
// Gestalt skills are mandatory thread infrastructure. Legacy profiles are
|
|
225
238
|
// normalized on read so they cannot pin a stale plugin-cache version or
|
|
226
239
|
// expose a meaningless enable/disable control in the editor.
|
|
227
240
|
skills: createSkillSelection(input.skills.filter((skill) => !isGestaltSkillName(skill.name))),
|
|
228
241
|
};
|
|
229
242
|
}
|
|
230
|
-
/**
|
|
243
|
+
/** Import strict versioned YAML without silently dropping unknown fields. */
|
|
231
244
|
export function parseSkillProfileYaml(source) {
|
|
232
245
|
const document = parseDocument(source, { prettyErrors: false, strict: true, uniqueKeys: true });
|
|
233
246
|
if (document.errors.length > 0) {
|
|
@@ -239,8 +252,8 @@ export function parseSkillProfileYaml(source) {
|
|
|
239
252
|
}
|
|
240
253
|
return createSkillProfile(parsed.data);
|
|
241
254
|
}
|
|
242
|
-
/**
|
|
255
|
+
/** Export deterministic YAML, retaining explicit capability choices. */
|
|
243
256
|
export function serializeSkillProfileYaml(profile) {
|
|
244
257
|
const canonical = createSkillProfile(profile);
|
|
245
|
-
return stringify(
|
|
258
|
+
return stringify(canonical);
|
|
246
259
|
}
|
|
@@ -7,13 +7,18 @@ import { z } from 'zod';
|
|
|
7
7
|
import { createSkillProfile, normalizeSkillProfileName } from '../model/skill-profile.js';
|
|
8
8
|
import { SkillProfileError } from '../model/errors.js';
|
|
9
9
|
import { problem } from '../../../platform/http/problem.js';
|
|
10
|
-
|
|
10
|
+
import { profileCapabilitiesSchema } from '../../../../shared/contracts/profile-capabilities.js';
|
|
11
|
+
const legacyRequestSchema = z
|
|
11
12
|
.object({
|
|
12
13
|
version: z.literal(1),
|
|
13
14
|
name: z.string(),
|
|
14
15
|
skills: z.array(z.object({ name: z.string(), path: z.string(), enabled: z.boolean() }).strict()),
|
|
15
16
|
})
|
|
16
17
|
.strict();
|
|
18
|
+
const requestSchema = z.discriminatedUnion('version', [
|
|
19
|
+
legacyRequestSchema,
|
|
20
|
+
legacyRequestSchema.extend({ version: z.literal(2), capabilities: profileCapabilitiesSchema }),
|
|
21
|
+
]);
|
|
17
22
|
export function registerReplaceSkillProfile(app, deps) {
|
|
18
23
|
app.put('/api/skill-profiles/:name', { bodyLimit: 64 * 1024 }, async (request, reply) => {
|
|
19
24
|
const body = requestSchema.safeParse(request.body);
|