@agimon-ai/po-config 0.0.0-alpha.35 → 0.0.0-alpha.37
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/extensions/server.cjs +2 -347
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +1 -346
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.d.mts +11 -1
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -2
- package/dist/settingsApi-DKaiu9VZ.cjs +355 -0
- package/dist/settingsApi-DKaiu9VZ.cjs.map +1 -0
- package/dist/settingsApi-U-ZL7y8m.mjs +350 -0
- package/dist/settingsApi-U-ZL7y8m.mjs.map +1 -0
- package/package.json +4 -4
|
@@ -2,14 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
const require_core = require("../core-PWRd4mH_.cjs");
|
|
7
|
-
const require_config = require("../config-ClQ6YArf.cjs");
|
|
8
|
-
const require_configWriter = require("../configWriter-Dc-QSJQ0.cjs");
|
|
9
|
-
const require_domains = require("../domains-l6GiaShf.cjs");
|
|
10
|
-
const require_piConfig = require("../piConfig-cluCie5i.cjs");
|
|
11
|
-
const require_majorModes = require("../majorModes-D6PoY70a.cjs");
|
|
12
|
-
const require_profiles = require("../profiles-At7-fW46.cjs");
|
|
5
|
+
const require_settingsApi = require("../settingsApi-DKaiu9VZ.cjs");
|
|
13
6
|
const require_sessionConfig = require("../sessionConfig-6AQuJLcb.cjs");
|
|
14
7
|
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
15
8
|
let _agimon_ai_po_core_mcpProjection = require("@agimon-ai/po-core/mcpProjection");
|
|
@@ -18,7 +11,6 @@ let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile
|
|
|
18
11
|
let _agimon_ai_po_core_notification = require("@agimon-ai/po-core/notification");
|
|
19
12
|
let _agimon_ai_po_core_readiness = require("@agimon-ai/po-core/readiness");
|
|
20
13
|
let _agimon_ai_po_core_telemetry = require("@agimon-ai/po-core/telemetry");
|
|
21
|
-
let _agimon_ai_po_core_web = require("@agimon-ai/po-core/web");
|
|
22
14
|
//#region src/constants/config.ts
|
|
23
15
|
const PACKAGE_SOURCE = "@agimon-ai/po-config";
|
|
24
16
|
const CONFIG_HELP_SKILL = {
|
|
@@ -115,345 +107,8 @@ var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)(({ ag
|
|
|
115
107
|
};
|
|
116
108
|
});
|
|
117
109
|
//#endregion
|
|
118
|
-
//#region src/constants/settings.ts
|
|
119
|
-
const SELECTION_KEYS = {
|
|
120
|
-
majorMode: ["selection", "majorMode"],
|
|
121
|
-
domains: ["selection", "domains"],
|
|
122
|
-
profile: ["selection", "profile"]
|
|
123
|
-
};
|
|
124
|
-
//#endregion
|
|
125
|
-
//#region src/types/apiRoutes.ts
|
|
126
|
-
/**
|
|
127
|
-
* This package's routes, as data.
|
|
128
|
-
*
|
|
129
|
-
* No scope and no base path. The build reads both off
|
|
130
|
-
* `src/extensions/(backend)/api/settings/`, so the mount is stated once, by the
|
|
131
|
-
* folder that creates it. `settings` is the host's own API: it answers at
|
|
132
|
-
* `/api/settings` and `/api/workspaces/<id>/settings`, beside `/plugins` rather
|
|
133
|
-
* than under it, and the client knows that from the base path alone.
|
|
134
|
-
*
|
|
135
|
-
* This is the one file the mount's dispatcher and, once the client crosses the
|
|
136
|
-
* package boundary, the cockpit both read, so a path cannot move on one side
|
|
137
|
-
* alone.
|
|
138
|
-
*/
|
|
139
|
-
var apiRoutes_default = (0, _agimon_ai_po_core_web.defineApiRoutes)({
|
|
140
|
-
/** The mount itself: the selected keys and the hash of each file they came from. */
|
|
141
|
-
config: {
|
|
142
|
-
method: "GET",
|
|
143
|
-
path: "/",
|
|
144
|
-
/** Repeatable. The page also sends `repoRoot`, which the mount ignores: it serves one repository. */
|
|
145
|
-
query: ["key"],
|
|
146
|
-
response: (0, _agimon_ai_po_core_web.apiResponse)()
|
|
147
|
-
},
|
|
148
|
-
value: {
|
|
149
|
-
method: "PUT",
|
|
150
|
-
path: "/value",
|
|
151
|
-
response: (0, _agimon_ai_po_core_web.apiResponse)()
|
|
152
|
-
},
|
|
153
|
-
repositories: {
|
|
154
|
-
method: "GET",
|
|
155
|
-
path: "/repositories",
|
|
156
|
-
response: (0, _agimon_ai_po_core_web.apiResponse)()
|
|
157
|
-
},
|
|
158
|
-
/** The workspace this mount was bound to; a global mount has none and answers 404. */
|
|
159
|
-
repository: {
|
|
160
|
-
method: "GET",
|
|
161
|
-
path: "/repository",
|
|
162
|
-
response: (0, _agimon_ai_po_core_web.apiResponse)()
|
|
163
|
-
},
|
|
164
|
-
selection: {
|
|
165
|
-
method: "PUT",
|
|
166
|
-
path: "/repository/selection",
|
|
167
|
-
response: (0, _agimon_ai_po_core_web.apiResponse)()
|
|
168
|
-
},
|
|
169
|
-
/** Pi's own image limits, served by the global mount only. */
|
|
170
|
-
images: {
|
|
171
|
-
method: "GET",
|
|
172
|
-
path: "/images",
|
|
173
|
-
response: (0, _agimon_ai_po_core_web.apiResponse)()
|
|
174
|
-
},
|
|
175
|
-
/** The same path as `images`; the method is the whole of the difference. */
|
|
176
|
-
saveImages: {
|
|
177
|
-
method: "PUT",
|
|
178
|
-
path: "/images",
|
|
179
|
-
response: (0, _agimon_ai_po_core_web.apiResponse)()
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
//#endregion
|
|
183
|
-
//#region src/services/settings/index.ts
|
|
184
|
-
function isRecord(value) {
|
|
185
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
186
|
-
}
|
|
187
|
-
function describe(error) {
|
|
188
|
-
return error instanceof Error ? error.message : String(error);
|
|
189
|
-
}
|
|
190
|
-
/** The display form of a config value; a record has no single-line form, so it has none. */
|
|
191
|
-
function displayValue(value) {
|
|
192
|
-
if (typeof value === "string") return value;
|
|
193
|
-
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
194
|
-
if (Array.isArray(value)) return value.map((entry) => displayValue(entry) ?? "").join(", ");
|
|
195
|
-
}
|
|
196
|
-
function pathFor(scope, repoRoot, homeDirectory) {
|
|
197
|
-
return scope === "repository" ? require_core.repositoryPoConfigPath(repoRoot) : require_core.globalPoConfigPath(homeDirectory);
|
|
198
|
-
}
|
|
199
|
-
function parseWrite(body) {
|
|
200
|
-
if (!isRecord(body)) return void 0;
|
|
201
|
-
const { repoRoot, scope, expectedHash } = body;
|
|
202
|
-
if (typeof repoRoot !== "string" || scope !== "global" && scope !== "repository") return void 0;
|
|
203
|
-
if (scope === "repository" && repoRoot === "") return void 0;
|
|
204
|
-
if (typeof expectedHash !== "string") return void 0;
|
|
205
|
-
const edits = body.edits === void 0 ? [{
|
|
206
|
-
keyPath: body.keyPath,
|
|
207
|
-
value: body.value
|
|
208
|
-
}] : body.edits;
|
|
209
|
-
if (!Array.isArray(edits) || edits.length === 0 || edits.length > 100) return void 0;
|
|
210
|
-
const validated = [];
|
|
211
|
-
for (const edit of edits) {
|
|
212
|
-
if (!isRecord(edit)) return void 0;
|
|
213
|
-
const { keyPath, value } = edit;
|
|
214
|
-
if (!Array.isArray(keyPath) || keyPath.length === 0 || keyPath.some((part) => typeof part !== "string")) return void 0;
|
|
215
|
-
if (value !== null && typeof value !== "string" && (typeof value !== "number" || !Number.isFinite(value))) return void 0;
|
|
216
|
-
validated.push({
|
|
217
|
-
keyPath,
|
|
218
|
-
value
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
return {
|
|
222
|
-
repoRoot,
|
|
223
|
-
scope,
|
|
224
|
-
expectedHash,
|
|
225
|
-
edits: validated
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
function configuredSelectionValue(layers, key, effective) {
|
|
229
|
-
const origin = layers.originOf(SELECTION_KEYS[key]);
|
|
230
|
-
return {
|
|
231
|
-
...effective === void 0 ? {} : { effective },
|
|
232
|
-
...origin === "repository" && effective !== void 0 ? { repository: effective } : {},
|
|
233
|
-
origin
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
function repositorySettingsView(repository, homeDirectory, environment = process.env) {
|
|
237
|
-
const repoRoot = repository.path;
|
|
238
|
-
const layers = require_config.loadPoConfigLayers(repoRoot, homeDirectory, environment);
|
|
239
|
-
const modes = require_majorModes.loadMajorModesConfig(repoRoot, homeDirectory, environment);
|
|
240
|
-
const domains = require_domains.loadDomains(repoRoot, homeDirectory);
|
|
241
|
-
const profiles = require_profiles.loadProfiles(repoRoot, homeDirectory);
|
|
242
|
-
const configured = layers.effective.selection;
|
|
243
|
-
const effectiveMajorMode = configured?.majorMode ?? modes.defaultMajorMode;
|
|
244
|
-
const effectiveDomains = configured?.domains ?? require_domains.defaultDomainsForMajorMode(effectiveMajorMode, {}, domains.defaultDomains);
|
|
245
|
-
const majorModes = Object.entries(modes.majorMode).map(([name, definition]) => ({
|
|
246
|
-
name,
|
|
247
|
-
description: definition.description,
|
|
248
|
-
layers: definition.layers
|
|
249
|
-
})).sort((left, right) => left.name.localeCompare(right.name));
|
|
250
|
-
const domainOptions = [...Object.entries(domains.domains).map(([name, definition]) => ({
|
|
251
|
-
name,
|
|
252
|
-
...definition.description ? { description: definition.description } : {}
|
|
253
|
-
})), ...Object.entries(domains.aliases).map(([name, expandsTo]) => ({
|
|
254
|
-
name,
|
|
255
|
-
description: `Alias for ${expandsTo.join(", ") || "no domains"}.`,
|
|
256
|
-
expandsTo
|
|
257
|
-
}))].sort((left, right) => left.name.localeCompare(right.name));
|
|
258
|
-
return {
|
|
259
|
-
repository,
|
|
260
|
-
hash: layers.repositoryFile.hash,
|
|
261
|
-
catalogs: {
|
|
262
|
-
majorModes,
|
|
263
|
-
domains: domainOptions,
|
|
264
|
-
profiles: profiles.map((profile) => ({ name: profile.name }))
|
|
265
|
-
},
|
|
266
|
-
selection: {
|
|
267
|
-
majorMode: configuredSelectionValue(layers, "majorMode", effectiveMajorMode),
|
|
268
|
-
domains: configuredSelectionValue(layers, "domains", effectiveDomains),
|
|
269
|
-
profile: configuredSelectionValue(layers, "profile", configured?.profile)
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
function parseSelectionChanges(value) {
|
|
274
|
-
if (!isRecord(value)) return void 0;
|
|
275
|
-
const keys = Object.keys(value);
|
|
276
|
-
if (keys.length === 0 || keys.some((key) => !Object.hasOwn(SELECTION_KEYS, key))) return void 0;
|
|
277
|
-
const changes = {};
|
|
278
|
-
if (Object.hasOwn(value, "majorMode")) {
|
|
279
|
-
if (value.majorMode !== null && (typeof value.majorMode !== "string" || value.majorMode.trim() === "")) return void 0;
|
|
280
|
-
changes.majorMode = value.majorMode === null ? null : value.majorMode.trim();
|
|
281
|
-
}
|
|
282
|
-
if (Object.hasOwn(value, "domains")) {
|
|
283
|
-
if (value.domains !== null && (!Array.isArray(value.domains) || value.domains.some((name) => typeof name !== "string" || name.trim() === ""))) return;
|
|
284
|
-
changes.domains = value.domains === null ? null : [...new Set(value.domains.map((name) => name.trim()))];
|
|
285
|
-
}
|
|
286
|
-
if (Object.hasOwn(value, "profile")) {
|
|
287
|
-
if (value.profile !== null && (typeof value.profile !== "string" || value.profile.trim() === "")) return void 0;
|
|
288
|
-
changes.profile = value.profile === null ? null : value.profile.trim();
|
|
289
|
-
}
|
|
290
|
-
return changes;
|
|
291
|
-
}
|
|
292
|
-
function parseSelectionWrite(value) {
|
|
293
|
-
if (!isRecord(value) || typeof value.repositoryId !== "string" || typeof value.expectedHash !== "string") return void 0;
|
|
294
|
-
const changes = parseSelectionChanges(value.changes);
|
|
295
|
-
return changes === void 0 ? void 0 : {
|
|
296
|
-
repositoryId: value.repositoryId,
|
|
297
|
-
expectedHash: value.expectedHash,
|
|
298
|
-
changes
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
function validateSelectionChanges(view, changes) {
|
|
302
|
-
if (changes.majorMode !== void 0 && changes.majorMode !== null) {
|
|
303
|
-
if (!view.catalogs.majorModes.some((mode) => mode.name === changes.majorMode)) return `Unknown major mode '${changes.majorMode}'.`;
|
|
304
|
-
}
|
|
305
|
-
if (changes.domains !== void 0 && changes.domains !== null) {
|
|
306
|
-
const known = new Set(view.catalogs.domains.map((domain) => domain.name));
|
|
307
|
-
const unknown = changes.domains.find((domain) => !known.has(domain));
|
|
308
|
-
if (unknown !== void 0) return `Unknown domain '${unknown}'.`;
|
|
309
|
-
}
|
|
310
|
-
if (changes.profile !== void 0 && changes.profile !== null) {
|
|
311
|
-
if (!view.catalogs.profiles.some((profile) => profile.name === changes.profile)) return `Unknown profile '${changes.profile}'.`;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
function selectionEdits(changes) {
|
|
315
|
-
return Object.entries(changes).map(([key, value]) => ({
|
|
316
|
-
keyPath: SELECTION_KEYS[key],
|
|
317
|
-
...value === null ? {} : { value }
|
|
318
|
-
}));
|
|
319
|
-
}
|
|
320
|
-
function configView(context, keys) {
|
|
321
|
-
const root = context.scope === "workspace" ? context.workspaceRoot : void 0;
|
|
322
|
-
const layers = require_config.loadPoConfigLayers(root, context.homeDirectory, context.environment);
|
|
323
|
-
const values = {};
|
|
324
|
-
for (const key of keys) {
|
|
325
|
-
const keyPath = key.split(".");
|
|
326
|
-
const value = displayValue(layers.valueAt(keyPath));
|
|
327
|
-
values[key] = {
|
|
328
|
-
...value === void 0 ? {} : { value },
|
|
329
|
-
origin: layers.originOf(keyPath),
|
|
330
|
-
scope: require_configPolicy.configScopeOf(keyPath)
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
return {
|
|
334
|
-
repoRoot: root ?? "",
|
|
335
|
-
values,
|
|
336
|
-
hashes: {
|
|
337
|
-
global: layers.globalFile.hash,
|
|
338
|
-
repository: layers.repositoryFile.hash
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
//#endregion
|
|
343
|
-
//#region src/services/settingsApi/index.ts
|
|
344
|
-
/**
|
|
345
|
-
* Config handlers are bound to their mount. Request paths cannot choose a different repository.
|
|
346
|
-
* Writes and image settings go through the host's FileSystem.
|
|
347
|
-
*/
|
|
348
|
-
const createSettingsApi = (fs) => ({
|
|
349
|
-
basePath: "settings",
|
|
350
|
-
start(context) {
|
|
351
|
-
if (context.scope === "session") throw new Error("Configuration settings require a global or workspace mount.");
|
|
352
|
-
const { homeDirectory } = context;
|
|
353
|
-
const repository = () => context.scope === "workspace" && context.workspaceId && context.workspaceRoot ? {
|
|
354
|
-
id: context.workspaceId,
|
|
355
|
-
name: context.workspaceRoot.split("/").at(-1) ?? context.workspaceId,
|
|
356
|
-
path: context.workspaceRoot,
|
|
357
|
-
active: context.repositories?.().find((entry) => entry.id === context.workspaceId)?.active ?? false
|
|
358
|
-
} : void 0;
|
|
359
|
-
const io = _agimon_ai_po_core_platform.BACKGROUND_CONTEXT;
|
|
360
|
-
const imageView = async () => ({
|
|
361
|
-
...await require_piConfig.readPiImageSettings(fs, io, homeDirectory),
|
|
362
|
-
minDimension: 256,
|
|
363
|
-
maxAllowedDimension: require_piConfig.DEFAULT_IMAGE_MAX_DIMENSION
|
|
364
|
-
});
|
|
365
|
-
let writes = Promise.resolve();
|
|
366
|
-
let closed = false;
|
|
367
|
-
const dispatch = async (request) => {
|
|
368
|
-
if (closed) return Response.json({ error: "Configuration mount is closed." }, { status: 503 });
|
|
369
|
-
const url = new URL(request.url);
|
|
370
|
-
/**
|
|
371
|
-
* Whether this request addresses one declared route.
|
|
372
|
-
*
|
|
373
|
-
* The table owns both halves of the comparison, so the path this mount
|
|
374
|
-
* answers and the path the client asks for cannot drift apart: there is
|
|
375
|
-
* one spelling of each, in `src/types/apiRoutes`.
|
|
376
|
-
*/
|
|
377
|
-
const addresses = (route) => url.pathname === route.path && request.method === route.method;
|
|
378
|
-
const currentRepository = repository();
|
|
379
|
-
if (addresses(apiRoutes_default.config)) return Response.json(configView(context, url.searchParams.getAll("key")));
|
|
380
|
-
if (addresses(apiRoutes_default.repositories)) return Response.json({ repositories: context.repositories?.() ?? [] });
|
|
381
|
-
if (addresses(apiRoutes_default.repository)) return currentRepository ? Response.json(repositorySettingsView(currentRepository, homeDirectory, context.environment)) : Response.json({ error: "Choose a workspace." }, { status: 404 });
|
|
382
|
-
if (url.pathname === apiRoutes_default.images.path && context.scope === "global") {
|
|
383
|
-
if (request.method === apiRoutes_default.images.method) return Response.json(await imageView());
|
|
384
|
-
if (request.method === apiRoutes_default.saveImages.method) {
|
|
385
|
-
const body = await request.json();
|
|
386
|
-
if (!isRecord(body) || body.autoResize !== void 0 && typeof body.autoResize !== "boolean" || body.maxDimension !== void 0 && (typeof body.maxDimension !== "number" || !Number.isFinite(body.maxDimension))) return Response.json({ error: "Invalid image settings." }, { status: 400 });
|
|
387
|
-
await require_piConfig.savePiImageSettingsAsync(fs, {
|
|
388
|
-
...typeof body.autoResize === "boolean" ? { autoResize: body.autoResize } : {},
|
|
389
|
-
...typeof body.maxDimension === "number" ? { maxDimension: body.maxDimension } : {}
|
|
390
|
-
}, io, homeDirectory);
|
|
391
|
-
context.configurationChanged?.();
|
|
392
|
-
return Response.json(await imageView());
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
if (addresses(apiRoutes_default.selection)) {
|
|
396
|
-
const body = parseSelectionWrite(await request.json());
|
|
397
|
-
if (!body) return Response.json({ error: "A selection write needs typed changes and a file hash." }, { status: 400 });
|
|
398
|
-
if (!currentRepository || body.repositoryId !== currentRepository.id) return Response.json({ error: "Workspace not found in this mount." }, { status: 404 });
|
|
399
|
-
const before = repositorySettingsView(currentRepository, homeDirectory, context.environment);
|
|
400
|
-
if (before.hash !== body.expectedHash) return Response.json({
|
|
401
|
-
error: "The repository config changed since it was read.",
|
|
402
|
-
hash: before.hash
|
|
403
|
-
}, { status: 409 });
|
|
404
|
-
const invalid = validateSelectionChanges(before, body.changes);
|
|
405
|
-
if (invalid) return Response.json({ error: invalid }, { status: 422 });
|
|
406
|
-
await require_configWriter.writePoConfigValuesAsync(fs, require_core.repositoryPoConfigPath(currentRepository.path), selectionEdits(body.changes), io, { scope: "repository" });
|
|
407
|
-
context.configurationChanged?.();
|
|
408
|
-
return Response.json(repositorySettingsView(currentRepository, homeDirectory, context.environment));
|
|
409
|
-
}
|
|
410
|
-
if (addresses(apiRoutes_default.value)) {
|
|
411
|
-
const body = parseWrite(await request.json());
|
|
412
|
-
if (!body) return Response.json({ error: "A save requires a scope, key, value and file hash." }, { status: 400 });
|
|
413
|
-
const scope = context.scope === "global" ? "global" : "repository";
|
|
414
|
-
if (body.scope !== scope || scope === "repository" && body.repoRoot !== currentRepository?.path) return Response.json({ error: "The write targets a different mount." }, { status: 403 });
|
|
415
|
-
if (body.edits.some((edit) => {
|
|
416
|
-
const allowed = require_configPolicy.configScopeOf(edit.keyPath);
|
|
417
|
-
return allowed !== "both" && allowed !== scope;
|
|
418
|
-
})) return Response.json({ error: "This key cannot be set at this scope." }, { status: 409 });
|
|
419
|
-
const before = configView(context, []);
|
|
420
|
-
if (before.hashes[scope] !== body.expectedHash) return Response.json({
|
|
421
|
-
error: "The config changed since it was read.",
|
|
422
|
-
hash: before.hashes[scope]
|
|
423
|
-
}, { status: 409 });
|
|
424
|
-
const target = pathFor(scope, currentRepository?.path ?? "", homeDirectory);
|
|
425
|
-
await require_configWriter.writePoConfigValuesAsync(fs, target, body.edits.map(({ keyPath, value }) => ({
|
|
426
|
-
keyPath,
|
|
427
|
-
...value === null ? {} : { value }
|
|
428
|
-
})), io, { scope });
|
|
429
|
-
context.configurationChanged?.();
|
|
430
|
-
return Response.json(configView(context, body.edits.map((edit) => edit.keyPath.join("."))));
|
|
431
|
-
}
|
|
432
|
-
return Response.json({ error: "Configuration route not found." }, { status: 404 });
|
|
433
|
-
};
|
|
434
|
-
const guarded = async (request) => {
|
|
435
|
-
try {
|
|
436
|
-
return await dispatch(request);
|
|
437
|
-
} catch (error) {
|
|
438
|
-
return Response.json({ error: describe(error) }, { status: error instanceof SyntaxError ? 400 : 422 });
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
return {
|
|
442
|
-
fetch(request) {
|
|
443
|
-
if (request.method === "GET" || request.method === "HEAD") return guarded(request);
|
|
444
|
-
const result = writes.then(() => guarded(request));
|
|
445
|
-
writes = result.catch(() => void 0);
|
|
446
|
-
return result;
|
|
447
|
-
},
|
|
448
|
-
close() {
|
|
449
|
-
closed = true;
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
});
|
|
454
|
-
//#endregion
|
|
455
110
|
//#region src/extensions/(backend)/api/settings/route.server.ts
|
|
456
|
-
var route_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)(({ context, host }) => host.scope === "session" ? void 0 : createSettingsApi((0, _agimon_ai_po_core_platform.requirePoFs)(context)), { cardinality: "optional" });
|
|
111
|
+
var route_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)(({ context, host }) => host.scope === "session" ? void 0 : require_settingsApi.createSettingsApi((0, _agimon_ai_po_core_platform.requirePoFs)(context)), { cardinality: "optional" });
|
|
457
112
|
//#endregion
|
|
458
113
|
//#region src/extensions/workspaces/sessions/(backend)/resource/help-how-to-config.server.ts
|
|
459
114
|
var help_how_to_config_server_default = (0, _agimon_ai_po_core_extensionFile.defineResource)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","names":["createPoReadinessCoordinator","readPoNotificationService","PO_READINESS_SERVICE","createPoTelemetry","createNativePoConfigContext","withAbortSignal","BACKGROUND_CONTEXT","isPoMcpProjection","createDisabledPoMcpProjection","PO_MCP_PROJECTION_SERVICE","createPoMcpProjectionService","defineRoot","requirePoFs","defineApiRoutes","apiResponse","repositoryPoConfigPath","globalPoConfigPath","loadPoConfigLayers","loadMajorModesConfig","loadDomains","loadProfiles","defaultDomainsForMajorMode","configScopeOf","BACKGROUND_CONTEXT","readPiImageSettings","DEFAULT_IMAGE_MAX_DIMENSION","routes","savePiImageSettingsAsync","writePoConfigValuesAsync","repositoryPoConfigPath","configScopeOf","defineRoutedContribution","requirePoFs","defineResource","packageResourcePath","readPackageResource","defineServerPlugin","composeServerProviderOverrides","rootSession","composeRootInjects","apiRoute","composeRootHooks","resourceHelpHowToConfig"],"sources":["../../src/constants/config.ts","../../src/services/configRuntime/index.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/constants/settings.ts","../../src/types/apiRoutes.ts","../../src/services/settings/index.ts","../../src/services/settingsApi/index.ts","../../src/extensions/(backend)/api/settings/route.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-config.server.ts","../../generated/server.ts"],"sourcesContent":["export const PACKAGE_SOURCE = '@agimon-ai/po-config';\nexport const CONFIG_HELP_SKILL = {\n name: 'help-how-to-config',\n description:\n 'Configure Po runtime settings, source precedence, and typed session configuration. Use for config.yaml, the po/config Cordis service, immutable context snapshots, or shared selection transition state. Do not use for defining modes.yaml, domains.yaml, or profiles.yaml.',\n};\n","import type { PoHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport {\n createDisabledPoMcpProjection,\n createPoMcpProjectionService,\n PO_MCP_PROJECTION_SERVICE,\n isPoMcpProjection,\n} from '@agimon-ai/po-core/mcpProjection';\nimport { readPoNotificationService } from '@agimon-ai/po-core/notification';\nimport { BACKGROUND_CONTEXT, withAbortSignal, type FileSystem } from '@agimon-ai/po-core/platform';\nimport {\n createPoReadinessCoordinator,\n PO_READINESS_SERVICE,\n type PoReadinessNotification,\n} from '@agimon-ai/po-core/readiness';\nimport { createPoTelemetry } from '@agimon-ai/po-core/telemetry';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { PACKAGE_SOURCE } from '../../constants/config';\nimport { createNativePoConfigContext, providePoConfigContext } from '../sessionConfig';\nimport type { ConfigRuntime } from './type';\n\n/** One native session fiber owns initialization and all of its services. */\nexport function createConfigRuntime(\n cordis: Context,\n execution: PoHeadlessExecutionContext,\n fs: FileSystem,\n lifetime?: AbortSignal,\n): ConfigRuntime {\n const generation = `${execution.sessionId}:${crypto.randomUUID()}`;\n let active = true;\n const readiness = createPoReadinessCoordinator({\n notify(notification: PoReadinessNotification) {\n const diagnostics = notification.diagnostics.join('; ');\n const detail = (notification.error?.message ?? diagnostics) || 'Initialization did not complete.';\n const body = `${notification.packageId} initialization ${notification.state}: ${detail}`;\n const service = readPoNotificationService(cordis);\n // Both routes are best effort. The coordinator retains the failed outcome.\n try {\n void Promise.allSettled([\n Promise.resolve(\n service ? service.request({ body, level: 'warning' }) : execution.client.notify({ body, level: 'warning' }),\n ),\n ]);\n } catch (error) {\n process.emitWarning(`Config warning delivery failed: ${String(error)}`);\n }\n },\n });\n cordis.provide(PO_READINESS_SERVICE, readiness);\n const telemetry = createPoTelemetry({\n serviceName: 'po-config',\n packageName: PACKAGE_SOURCE,\n cwd: execution.cwd,\n env: execution.environment,\n enableLogs: true,\n enableTraces: true,\n });\n let initializationTask: Promise<void> = Promise.resolve();\n const cancel = (): void => {\n active = false;\n void Promise.allSettled([readiness.dispose()]);\n };\n lifetime?.addEventListener('abort', cancel, { once: true });\n cordis.effect(\n () => async () => {\n active = false;\n lifetime?.removeEventListener('abort', cancel);\n await Promise.allSettled([readiness.dispose(), initializationTask]);\n await telemetry.shutdown();\n },\n `${PACKAGE_SOURCE}/session`,\n );\n const handle = readiness.start<void>(PACKAGE_SOURCE, generation, async (signal) => {\n const config = await createNativePoConfigContext(execution, fs, withAbortSignal(signal, BACKGROUND_CONTEXT));\n signal.throwIfAborted();\n if (!active) throw new Error(`Po Config initialization was superseded: ${generation}.`);\n providePoConfigContext(cordis, config, `${generation}:config`);\n const repoRoot = config.harness.root ?? execution.cwd;\n const stagingDirectory = config.harness.temporaryDirectory ?? execution.cwd;\n const projection =\n config.harness.mcp &&\n isPoMcpProjection(config.harness.mcpProjection) &&\n config.harness.mcpProjection.repoRoot === repoRoot\n ? config.harness.mcpProjection\n : createDisabledPoMcpProjection({ repoRoot, stagingDirectory });\n cordis.provide(\n PO_MCP_PROJECTION_SERVICE,\n createPoMcpProjectionService({\n sessionId: execution.sessionId,\n generation: `${generation}:mcp-projection`,\n projection,\n }),\n );\n void Promise.allSettled([\n telemetry.recordEvent('po_config.context_bound', {\n 'config.major_mode': config.harness.majorMode,\n 'config.domain_count': config.harness.domains.length,\n 'config.has_profile': config.harness.profile !== undefined,\n 'config.requires_relaunch': config.requiresRelaunch,\n }),\n ]);\n return { value: undefined };\n });\n initializationTask = handle.wait();\n if (lifetime?.aborted) cancel();\n void Promise.allSettled([initializationTask]);\n return { ready: initializationTask };\n}\n","import { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport { requirePoFs } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { createConfigRuntime } from '../../../../services/configRuntime';\nimport type { ConfigRuntime } from '../../../../services/configRuntime/type';\n\nexport default defineRoot(({ agent, context: root, signal }: PoServerPluginContext) => {\n if (!agent) throw new Error('Config initialization requires the native session host.');\n const fs = requirePoFs(root);\n let runtime: ConfigRuntime | undefined;\n return {\n value: undefined,\n services: [\n (context: Context) => {\n runtime = createConfigRuntime(context, agent.context, fs, signal);\n },\n ],\n async onStart() {\n if (!runtime) throw new Error('Native config initializer was not installed.');\n // Pi previously awaited the barrier, then reported handler errors and continued.\n // Keep that degraded outcome, observable through readiness and notification.\n await Promise.allSettled([runtime.ready]);\n },\n };\n});\n","export const KEY_SEPARATOR = '.';\n\n/** The repeatable query parameter naming which keys a read is about. */\nexport const KEY_QUERY_PARAM = 'key';\n\nexport const SELECTION_KEYS = {\n majorMode: ['selection', 'majorMode'],\n domains: ['selection', 'domains'],\n profile: ['selection', 'profile'],\n} as const;\n","import { apiResponse, defineApiRoutes } from '@agimon-ai/po-core/web';\n\nimport { KEY_QUERY_PARAM } from '../constants/settings';\nimport type { RepositorySettingsView, SettingsConfigView, SettingsImagesView, SettingsRepository } from './settings';\n\n/**\n * This package's routes, as data.\n *\n * No scope and no base path. The build reads both off\n * `src/extensions/(backend)/api/settings/`, so the mount is stated once, by the\n * folder that creates it. `settings` is the host's own API: it answers at\n * `/api/settings` and `/api/workspaces/<id>/settings`, beside `/plugins` rather\n * than under it, and the client knows that from the base path alone.\n *\n * This is the one file the mount's dispatcher and, once the client crosses the\n * package boundary, the cockpit both read, so a path cannot move on one side\n * alone.\n */\nexport default defineApiRoutes({\n /** The mount itself: the selected keys and the hash of each file they came from. */\n config: {\n method: 'GET',\n path: '/',\n /** Repeatable. The page also sends `repoRoot`, which the mount ignores: it serves one repository. */\n query: [KEY_QUERY_PARAM],\n response: apiResponse<SettingsConfigView>(),\n },\n value: {\n method: 'PUT',\n path: '/value',\n response: apiResponse<SettingsConfigView>(),\n },\n repositories: {\n method: 'GET',\n path: '/repositories',\n response: apiResponse<{ repositories: readonly SettingsRepository[] }>(),\n },\n /** The workspace this mount was bound to; a global mount has none and answers 404. */\n repository: {\n method: 'GET',\n path: '/repository',\n response: apiResponse<RepositorySettingsView>(),\n },\n selection: {\n method: 'PUT',\n path: '/repository/selection',\n response: apiResponse<RepositorySettingsView>(),\n },\n /** Pi's own image limits, served by the global mount only. */\n images: {\n method: 'GET',\n path: '/images',\n response: apiResponse<SettingsImagesView>(),\n },\n /** The same path as `images`; the method is the whole of the difference. */\n saveImages: {\n method: 'PUT',\n path: '/images',\n response: apiResponse<SettingsImagesView>(),\n },\n});\n","import type { PoApiContext } from '@agimon-ai/po-core/packageApi';\n\nimport { KEY_SEPARATOR, SELECTION_KEYS } from '../../constants/settings';\nimport type {\n RepositoryCatalogOption,\n RepositorySelectionChanges,\n RepositorySelectionWriteRequest,\n RepositorySettingsView,\n SettingsConfigView,\n SettingsRepository,\n SettingsScope,\n SettingsValueView,\n SettingsBatchWriteRequest,\n} from '../../types/settings';\nimport { globalPoConfigPath, loadPoConfigLayers, repositoryPoConfigPath } from '../config';\nimport { configScopeOf } from '../configPolicy';\nimport { defaultDomainsForMajorMode, loadDomains } from '../domains';\nimport { loadMajorModesConfig } from '../majorModes';\nimport { loadProfiles } from '../profiles';\n\ntype SelectionKey = keyof typeof SELECTION_KEYS;\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function describe(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/** The display form of a config value; a record has no single-line form, so it has none. */\nexport function displayValue(value: unknown): string | undefined {\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean') return String(value);\n if (Array.isArray(value)) return value.map((entry) => displayValue(entry) ?? '').join(', ');\n return undefined;\n}\n\nexport function pathFor(scope: SettingsScope, repoRoot: string, homeDirectory: string | undefined): string {\n return scope === 'repository' ? repositoryPoConfigPath(repoRoot) : globalPoConfigPath(homeDirectory);\n}\n\nexport function parseWrite(body: unknown): SettingsBatchWriteRequest | undefined {\n if (!isRecord(body)) return undefined;\n const { repoRoot, scope, expectedHash } = body;\n if (typeof repoRoot !== 'string' || (scope !== 'global' && scope !== 'repository')) return undefined;\n if (scope === 'repository' && repoRoot === '') return undefined;\n if (typeof expectedHash !== 'string') return undefined;\n const edits = body.edits === undefined ? [{ keyPath: body.keyPath, value: body.value }] : body.edits;\n if (!Array.isArray(edits) || edits.length === 0 || edits.length > 100) return undefined;\n const validated: Array<SettingsBatchWriteRequest['edits'][number]> = [];\n for (const edit of edits) {\n if (!isRecord(edit)) return undefined;\n const { keyPath, value } = edit;\n if (!Array.isArray(keyPath) || keyPath.length === 0 || keyPath.some((part) => typeof part !== 'string'))\n return undefined;\n if (value !== null && typeof value !== 'string' && (typeof value !== 'number' || !Number.isFinite(value)))\n return undefined;\n validated.push({ keyPath: keyPath as string[], value });\n }\n return { repoRoot, scope, expectedHash, edits: validated };\n}\n\nexport function configuredSelectionValue<T>(\n layers: ReturnType<typeof loadPoConfigLayers>,\n key: SelectionKey,\n effective: T | undefined,\n): { effective?: T; repository?: T; origin: 'global' | 'repository' | 'default' } {\n const origin = layers.originOf(SELECTION_KEYS[key]);\n return {\n ...(effective === undefined ? {} : { effective }),\n ...(origin === 'repository' && effective !== undefined ? { repository: effective } : {}),\n origin,\n };\n}\n\nexport function repositorySettingsView(\n repository: SettingsRepository,\n homeDirectory: string | undefined,\n environment: NodeJS.ProcessEnv = process.env,\n): RepositorySettingsView {\n const repoRoot = repository.path;\n const layers = loadPoConfigLayers(repoRoot, homeDirectory, environment);\n const modes = loadMajorModesConfig(repoRoot, homeDirectory, environment);\n const domains = loadDomains(repoRoot, homeDirectory);\n const profiles = loadProfiles(repoRoot, homeDirectory);\n const configured = layers.effective.selection;\n const effectiveMajorMode = configured?.majorMode ?? modes.defaultMajorMode;\n const effectiveDomains =\n configured?.domains ?? defaultDomainsForMajorMode(effectiveMajorMode, {}, domains.defaultDomains);\n const majorModes: RepositoryCatalogOption[] = Object.entries(modes.majorMode)\n .map(([name, definition]) => ({ name, description: definition.description, layers: definition.layers }))\n .sort((left, right) => left.name.localeCompare(right.name));\n const domainOptions: RepositoryCatalogOption[] = [\n ...Object.entries(domains.domains).map(([name, definition]) => ({\n name,\n ...(definition.description ? { description: definition.description } : {}),\n })),\n ...Object.entries(domains.aliases).map(([name, expandsTo]) => ({\n name,\n description: `Alias for ${expandsTo.join(', ') || 'no domains'}.`,\n expandsTo,\n })),\n ].sort((left, right) => left.name.localeCompare(right.name));\n\n return {\n repository,\n hash: layers.repositoryFile.hash,\n catalogs: {\n majorModes,\n domains: domainOptions,\n profiles: profiles.map((profile) => ({ name: profile.name })),\n },\n selection: {\n majorMode: configuredSelectionValue(layers, 'majorMode', effectiveMajorMode),\n domains: configuredSelectionValue(layers, 'domains', effectiveDomains),\n profile: configuredSelectionValue(layers, 'profile', configured?.profile),\n },\n };\n}\n\nexport function parseSelectionChanges(value: unknown): RepositorySelectionChanges | undefined {\n if (!isRecord(value)) return undefined;\n const keys = Object.keys(value);\n if (keys.length === 0 || keys.some((key) => !Object.hasOwn(SELECTION_KEYS, key))) return undefined;\n const changes: RepositorySelectionChanges = {};\n if (Object.hasOwn(value, 'majorMode')) {\n if (value.majorMode !== null && (typeof value.majorMode !== 'string' || value.majorMode.trim() === ''))\n return undefined;\n changes.majorMode = value.majorMode === null ? null : value.majorMode.trim();\n }\n if (Object.hasOwn(value, 'domains')) {\n if (\n value.domains !== null &&\n (!Array.isArray(value.domains) || value.domains.some((name) => typeof name !== 'string' || name.trim() === ''))\n ) {\n return undefined;\n }\n changes.domains =\n value.domains === null ? null : [...new Set((value.domains as string[]).map((name) => name.trim()))];\n }\n if (Object.hasOwn(value, 'profile')) {\n if (value.profile !== null && (typeof value.profile !== 'string' || value.profile.trim() === '')) return undefined;\n changes.profile = value.profile === null ? null : value.profile.trim();\n }\n return changes;\n}\n\nexport function parseSelectionWrite(value: unknown): RepositorySelectionWriteRequest | undefined {\n if (!isRecord(value) || typeof value.repositoryId !== 'string' || typeof value.expectedHash !== 'string')\n return undefined;\n const changes = parseSelectionChanges(value.changes);\n return changes === undefined\n ? undefined\n : { repositoryId: value.repositoryId, expectedHash: value.expectedHash, changes };\n}\n\nexport function validateSelectionChanges(\n view: RepositorySettingsView,\n changes: RepositorySelectionChanges,\n): string | undefined {\n if (changes.majorMode !== undefined && changes.majorMode !== null) {\n if (!view.catalogs.majorModes.some((mode) => mode.name === changes.majorMode)) {\n return `Unknown major mode '${changes.majorMode}'.`;\n }\n }\n if (changes.domains !== undefined && changes.domains !== null) {\n const known = new Set(view.catalogs.domains.map((domain) => domain.name));\n const unknown = changes.domains.find((domain) => !known.has(domain));\n if (unknown !== undefined) return `Unknown domain '${unknown}'.`;\n }\n if (changes.profile !== undefined && changes.profile !== null) {\n if (!view.catalogs.profiles.some((profile) => profile.name === changes.profile)) {\n return `Unknown profile '${changes.profile}'.`;\n }\n }\n return undefined;\n}\n\nexport function selectionEdits(changes: RepositorySelectionChanges) {\n return (Object.entries(changes) as Array<[SelectionKey, string | readonly string[] | null]>).map(([key, value]) => ({\n keyPath: SELECTION_KEYS[key],\n ...(value === null ? {} : { value }),\n }));\n}\n\nexport function configView(context: PoApiContext, keys: readonly string[]): SettingsConfigView {\n const root = context.scope === 'workspace' ? context.workspaceRoot : undefined;\n const layers = loadPoConfigLayers(root, context.homeDirectory, context.environment);\n const values: Record<string, SettingsValueView> = {};\n for (const key of keys) {\n const keyPath = key.split(KEY_SEPARATOR);\n const value = displayValue(layers.valueAt(keyPath));\n values[key] = {\n ...(value === undefined ? {} : { value }),\n origin: layers.originOf(keyPath),\n scope: configScopeOf(keyPath),\n };\n }\n return {\n repoRoot: root ?? '',\n values,\n hashes: { global: layers.globalFile.hash, repository: layers.repositoryFile.hash },\n };\n}\n","import type { PoApi } from '@agimon-ai/po-core/packageApi';\nimport { BACKGROUND_CONTEXT, type FileSystem } from '@agimon-ai/po-core/platform';\n\nimport { KEY_QUERY_PARAM, KEY_SEPARATOR } from '../../constants/settings';\nimport routes from '../../types/apiRoutes';\nimport type { SettingsRepository } from '../../types/settings';\nimport { repositoryPoConfigPath } from '../config';\nimport { configScopeOf } from '../configPolicy';\nimport { writePoConfigValuesAsync } from '../configWriter';\nimport { DEFAULT_IMAGE_MAX_DIMENSION, MIN_IMAGE_MAX_DIMENSION } from '../imageSettings';\nimport { readPiImageSettings, savePiImageSettingsAsync } from '../piConfig';\nimport {\n configView,\n describe,\n isRecord,\n parseSelectionWrite,\n parseWrite,\n pathFor,\n repositorySettingsView,\n selectionEdits,\n validateSelectionChanges,\n} from '../settings';\n\n/** One declared route, as much of it as a comparison needs. */\ntype RouteSpec = { readonly method: string; readonly path: string };\n\n/**\n * Config handlers are bound to their mount. Request paths cannot choose a different repository.\n * Writes and image settings go through the host's FileSystem.\n */\nexport const createSettingsApi = (fs: FileSystem): PoApi => ({\n basePath: 'settings',\n start(context) {\n if (context.scope === 'session') throw new Error('Configuration settings require a global or workspace mount.');\n const { homeDirectory } = context;\n const repository = (): SettingsRepository | undefined =>\n context.scope === 'workspace' && context.workspaceId && context.workspaceRoot\n ? {\n id: context.workspaceId,\n name: context.workspaceRoot.split('/').at(-1) ?? context.workspaceId,\n path: context.workspaceRoot,\n active: context.repositories?.().find((entry) => entry.id === context.workspaceId)?.active ?? false,\n }\n : undefined;\n const io = BACKGROUND_CONTEXT;\n const imageView = async () => ({\n ...(await readPiImageSettings(fs, io, homeDirectory)),\n minDimension: MIN_IMAGE_MAX_DIMENSION,\n maxAllowedDimension: DEFAULT_IMAGE_MAX_DIMENSION,\n });\n let writes: Promise<unknown> = Promise.resolve();\n let closed = false;\n const dispatch = async (request: Request): Promise<Response> => {\n if (closed) return Response.json({ error: 'Configuration mount is closed.' }, { status: 503 });\n const url = new URL(request.url);\n /**\n * Whether this request addresses one declared route.\n *\n * The table owns both halves of the comparison, so the path this mount\n * answers and the path the client asks for cannot drift apart: there is\n * one spelling of each, in `src/types/apiRoutes`.\n */\n const addresses = (route: RouteSpec): boolean => url.pathname === route.path && request.method === route.method;\n const currentRepository = repository();\n if (addresses(routes.config)) return Response.json(configView(context, url.searchParams.getAll(KEY_QUERY_PARAM)));\n if (addresses(routes.repositories)) return Response.json({ repositories: context.repositories?.() ?? [] });\n if (addresses(routes.repository)) {\n return currentRepository\n ? Response.json(repositorySettingsView(currentRepository, homeDirectory, context.environment))\n : Response.json({ error: 'Choose a workspace.' }, { status: 404 });\n }\n // One path, two methods, so the branch is on the path the pair share.\n if (url.pathname === routes.images.path && context.scope === 'global') {\n if (request.method === routes.images.method) return Response.json(await imageView());\n if (request.method === routes.saveImages.method) {\n const body: unknown = await request.json();\n if (\n !isRecord(body) ||\n (body.autoResize !== undefined && typeof body.autoResize !== 'boolean') ||\n (body.maxDimension !== undefined &&\n (typeof body.maxDimension !== 'number' || !Number.isFinite(body.maxDimension)))\n )\n return Response.json({ error: 'Invalid image settings.' }, { status: 400 });\n await savePiImageSettingsAsync(\n fs,\n {\n ...(typeof body.autoResize === 'boolean' ? { autoResize: body.autoResize } : {}),\n ...(typeof body.maxDimension === 'number' ? { maxDimension: body.maxDimension } : {}),\n },\n io,\n homeDirectory,\n );\n context.configurationChanged?.();\n return Response.json(await imageView());\n }\n }\n if (addresses(routes.selection)) {\n const body = parseSelectionWrite(await request.json());\n if (!body)\n return Response.json({ error: 'A selection write needs typed changes and a file hash.' }, { status: 400 });\n if (!currentRepository || body.repositoryId !== currentRepository.id)\n return Response.json({ error: 'Workspace not found in this mount.' }, { status: 404 });\n const before = repositorySettingsView(currentRepository, homeDirectory, context.environment);\n if (before.hash !== body.expectedHash)\n return Response.json(\n { error: 'The repository config changed since it was read.', hash: before.hash },\n { status: 409 },\n );\n const invalid = validateSelectionChanges(before, body.changes);\n if (invalid) return Response.json({ error: invalid }, { status: 422 });\n await writePoConfigValuesAsync(\n fs,\n repositoryPoConfigPath(currentRepository.path),\n selectionEdits(body.changes),\n io,\n { scope: 'repository' },\n );\n context.configurationChanged?.();\n return Response.json(repositorySettingsView(currentRepository, homeDirectory, context.environment));\n }\n if (addresses(routes.value)) {\n const body = parseWrite(await request.json());\n if (!body)\n return Response.json({ error: 'A save requires a scope, key, value and file hash.' }, { status: 400 });\n const scope = context.scope === 'global' ? 'global' : 'repository';\n if (body.scope !== scope || (scope === 'repository' && body.repoRoot !== currentRepository?.path))\n return Response.json({ error: 'The write targets a different mount.' }, { status: 403 });\n if (\n body.edits.some((edit) => {\n const allowed = configScopeOf(edit.keyPath);\n return allowed !== 'both' && allowed !== scope;\n })\n )\n return Response.json({ error: 'This key cannot be set at this scope.' }, { status: 409 });\n const before = configView(context, []);\n if (before.hashes[scope] !== body.expectedHash)\n return Response.json(\n { error: 'The config changed since it was read.', hash: before.hashes[scope] },\n { status: 409 },\n );\n const target = pathFor(scope, currentRepository?.path ?? '', homeDirectory);\n await writePoConfigValuesAsync(\n fs,\n target,\n body.edits.map(({ keyPath, value }) => ({ keyPath, ...(value === null ? {} : { value }) })),\n io,\n { scope },\n );\n context.configurationChanged?.();\n return Response.json(\n configView(\n context,\n body.edits.map((edit) => edit.keyPath.join(KEY_SEPARATOR)),\n ),\n );\n }\n return Response.json({ error: 'Configuration route not found.' }, { status: 404 });\n };\n const guarded = async (request: Request): Promise<Response> => {\n try {\n return await dispatch(request);\n } catch (error) {\n return Response.json({ error: describe(error) }, { status: error instanceof SyntaxError ? 400 : 422 });\n }\n };\n return {\n fetch(request) {\n if (request.method === 'GET' || request.method === 'HEAD') return guarded(request);\n const result = writes.then(() => guarded(request));\n writes = result.catch(() => undefined);\n return result;\n },\n close() {\n closed = true;\n },\n };\n },\n});\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport { requirePoFs } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createSettingsApi } from '../../../../services/settingsApi';\n\nexport default defineRoutedContribution(\n ({ context, host }: PoServerPluginContext) =>\n host.scope === 'session' ? undefined : createSettingsApi(requirePoFs(context)),\n { cardinality: 'optional' },\n);\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nimport { CONFIG_HELP_SKILL } from '../../../../../constants/config';\n\nexport default defineResource({\n ...CONFIG_HELP_SKILL,\n when: { state: { 'minor-mode': 'help' }, attribution: { kind: 'minor' as const, mode: 'help' } },\n kind: 'skill' as const,\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-config/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/help-how-to-config/SKILL.md'),\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverPlugin';\nimport { composeRootHooks, composeRootInjects } from '@agimon-ai/po-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/(backend)/api/settings/route.server';\nimport resourceHelpHowToConfig from '../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-config.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-config',\n providerOverrides: composeServerProviderOverrides(rootSession),\n injects: composeRootInjects({ session: [rootSession] }),\n global: (context) => ({\n get api(): PoServerSessionPlugin['api'] { return defined([at(apiRoute, context)]); },\n }),\n workspace: (context) => ({\n get api(): PoServerSessionPlugin['api'] { return defined([at(apiRoute, context)]); },\n }),\n session: async (context) => {\n const scopeSession = await context.scopeRoot('session', rootSession, context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get api(): PoServerSessionPlugin['api'] { return defined([at(apiRoute, context)]); },\n get resources(): PoServerSessionPlugin['resources'] { return [at(resourceHelpHowToConfig, contextSession)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;CAC/B,MAAM;CACN,aACE;AACJ;;;;ACiBA,SAAgB,oBACd,QACA,WACA,IACA,UACe;CACf,MAAM,aAAa,GAAG,UAAU,UAAU,GAAG,OAAO,WAAW;CAC/D,IAAI,SAAS;CACb,MAAM,aAAA,GAAYA,6BAAAA,6BAAAA,CAA6B,EAC7C,OAAO,cAAuC;EAC5C,MAAM,cAAc,aAAa,YAAY,KAAK,IAAI;EACtD,MAAM,UAAU,aAAa,OAAO,WAAW,gBAAgB;EAC/D,MAAM,OAAO,GAAG,aAAa,UAAU,kBAAkB,aAAa,MAAM,IAAI;EAChF,MAAM,WAAA,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AChC,IAAI,MAAoC;IAAE,OAAO,QAAQ,CAAC,GAAGD,sBAAU,OAAO,CAAC,CAAC;GAAG;GACnF,IAAI,YAAgD;IAAE,OAAO,CAAC,GAAGE,mCAAyB,cAAc,CAAC;GAAG;GAC5G,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAkD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACvG;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.cjs","names":["createPoReadinessCoordinator","readPoNotificationService","PO_READINESS_SERVICE","createPoTelemetry","createNativePoConfigContext","withAbortSignal","BACKGROUND_CONTEXT","isPoMcpProjection","createDisabledPoMcpProjection","PO_MCP_PROJECTION_SERVICE","createPoMcpProjectionService","defineRoot","requirePoFs","defineRoutedContribution","createSettingsApi","requirePoFs","defineResource","packageResourcePath","readPackageResource","defineServerPlugin","composeServerProviderOverrides","rootSession","composeRootInjects","apiRoute","composeRootHooks","resourceHelpHowToConfig"],"sources":["../../src/constants/config.ts","../../src/services/configRuntime/index.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/(backend)/api/settings/route.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-config.server.ts","../../generated/server.ts"],"sourcesContent":["export const PACKAGE_SOURCE = '@agimon-ai/po-config';\nexport const CONFIG_HELP_SKILL = {\n name: 'help-how-to-config',\n description:\n 'Configure Po runtime settings, source precedence, and typed session configuration. Use for config.yaml, the po/config Cordis service, immutable context snapshots, or shared selection transition state. Do not use for defining modes.yaml, domains.yaml, or profiles.yaml.',\n};\n","import type { PoHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport {\n createDisabledPoMcpProjection,\n createPoMcpProjectionService,\n PO_MCP_PROJECTION_SERVICE,\n isPoMcpProjection,\n} from '@agimon-ai/po-core/mcpProjection';\nimport { readPoNotificationService } from '@agimon-ai/po-core/notification';\nimport { BACKGROUND_CONTEXT, withAbortSignal, type FileSystem } from '@agimon-ai/po-core/platform';\nimport {\n createPoReadinessCoordinator,\n PO_READINESS_SERVICE,\n type PoReadinessNotification,\n} from '@agimon-ai/po-core/readiness';\nimport { createPoTelemetry } from '@agimon-ai/po-core/telemetry';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { PACKAGE_SOURCE } from '../../constants/config';\nimport { createNativePoConfigContext, providePoConfigContext } from '../sessionConfig';\nimport type { ConfigRuntime } from './type';\n\n/** One native session fiber owns initialization and all of its services. */\nexport function createConfigRuntime(\n cordis: Context,\n execution: PoHeadlessExecutionContext,\n fs: FileSystem,\n lifetime?: AbortSignal,\n): ConfigRuntime {\n const generation = `${execution.sessionId}:${crypto.randomUUID()}`;\n let active = true;\n const readiness = createPoReadinessCoordinator({\n notify(notification: PoReadinessNotification) {\n const diagnostics = notification.diagnostics.join('; ');\n const detail = (notification.error?.message ?? diagnostics) || 'Initialization did not complete.';\n const body = `${notification.packageId} initialization ${notification.state}: ${detail}`;\n const service = readPoNotificationService(cordis);\n // Both routes are best effort. The coordinator retains the failed outcome.\n try {\n void Promise.allSettled([\n Promise.resolve(\n service ? service.request({ body, level: 'warning' }) : execution.client.notify({ body, level: 'warning' }),\n ),\n ]);\n } catch (error) {\n process.emitWarning(`Config warning delivery failed: ${String(error)}`);\n }\n },\n });\n cordis.provide(PO_READINESS_SERVICE, readiness);\n const telemetry = createPoTelemetry({\n serviceName: 'po-config',\n packageName: PACKAGE_SOURCE,\n cwd: execution.cwd,\n env: execution.environment,\n enableLogs: true,\n enableTraces: true,\n });\n let initializationTask: Promise<void> = Promise.resolve();\n const cancel = (): void => {\n active = false;\n void Promise.allSettled([readiness.dispose()]);\n };\n lifetime?.addEventListener('abort', cancel, { once: true });\n cordis.effect(\n () => async () => {\n active = false;\n lifetime?.removeEventListener('abort', cancel);\n await Promise.allSettled([readiness.dispose(), initializationTask]);\n await telemetry.shutdown();\n },\n `${PACKAGE_SOURCE}/session`,\n );\n const handle = readiness.start<void>(PACKAGE_SOURCE, generation, async (signal) => {\n const config = await createNativePoConfigContext(execution, fs, withAbortSignal(signal, BACKGROUND_CONTEXT));\n signal.throwIfAborted();\n if (!active) throw new Error(`Po Config initialization was superseded: ${generation}.`);\n providePoConfigContext(cordis, config, `${generation}:config`);\n const repoRoot = config.harness.root ?? execution.cwd;\n const stagingDirectory = config.harness.temporaryDirectory ?? execution.cwd;\n const projection =\n config.harness.mcp &&\n isPoMcpProjection(config.harness.mcpProjection) &&\n config.harness.mcpProjection.repoRoot === repoRoot\n ? config.harness.mcpProjection\n : createDisabledPoMcpProjection({ repoRoot, stagingDirectory });\n cordis.provide(\n PO_MCP_PROJECTION_SERVICE,\n createPoMcpProjectionService({\n sessionId: execution.sessionId,\n generation: `${generation}:mcp-projection`,\n projection,\n }),\n );\n void Promise.allSettled([\n telemetry.recordEvent('po_config.context_bound', {\n 'config.major_mode': config.harness.majorMode,\n 'config.domain_count': config.harness.domains.length,\n 'config.has_profile': config.harness.profile !== undefined,\n 'config.requires_relaunch': config.requiresRelaunch,\n }),\n ]);\n return { value: undefined };\n });\n initializationTask = handle.wait();\n if (lifetime?.aborted) cancel();\n void Promise.allSettled([initializationTask]);\n return { ready: initializationTask };\n}\n","import { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport { requirePoFs } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { createConfigRuntime } from '../../../../services/configRuntime';\nimport type { ConfigRuntime } from '../../../../services/configRuntime/type';\n\nexport default defineRoot(({ agent, context: root, signal }: PoServerPluginContext) => {\n if (!agent) throw new Error('Config initialization requires the native session host.');\n const fs = requirePoFs(root);\n let runtime: ConfigRuntime | undefined;\n return {\n value: undefined,\n services: [\n (context: Context) => {\n runtime = createConfigRuntime(context, agent.context, fs, signal);\n },\n ],\n async onStart() {\n if (!runtime) throw new Error('Native config initializer was not installed.');\n // Pi previously awaited the barrier, then reported handler errors and continued.\n // Keep that degraded outcome, observable through readiness and notification.\n await Promise.allSettled([runtime.ready]);\n },\n };\n});\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport { requirePoFs } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createSettingsApi } from '../../../../services/settingsApi';\n\nexport default defineRoutedContribution(\n ({ context, host }: PoServerPluginContext) =>\n host.scope === 'session' ? undefined : createSettingsApi(requirePoFs(context)),\n { cardinality: 'optional' },\n);\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nimport { CONFIG_HELP_SKILL } from '../../../../../constants/config';\n\nexport default defineResource({\n ...CONFIG_HELP_SKILL,\n when: { state: { 'minor-mode': 'help' }, attribution: { kind: 'minor' as const, mode: 'help' } },\n kind: 'skill' as const,\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-config/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/help-how-to-config/SKILL.md'),\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverPlugin';\nimport { composeRootHooks, composeRootInjects } from '@agimon-ai/po-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/(backend)/api/settings/route.server';\nimport resourceHelpHowToConfig from '../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-config.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-config',\n providerOverrides: composeServerProviderOverrides(rootSession),\n injects: composeRootInjects({ session: [rootSession] }),\n global: (context) => ({\n get api(): PoServerSessionPlugin['api'] { return defined([at(apiRoute, context)]); },\n }),\n workspace: (context) => ({\n get api(): PoServerSessionPlugin['api'] { return defined([at(apiRoute, context)]); },\n }),\n session: async (context) => {\n const scopeSession = await context.scopeRoot('session', rootSession, context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get api(): PoServerSessionPlugin['api'] { return defined([at(apiRoute, context)]); },\n get resources(): PoServerSessionPlugin['resources'] { return [at(resourceHelpHowToConfig, contextSession)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;;;;;;AAAA,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;CAC/B,MAAM;CACN,aACE;AACJ;;;;ACiBA,SAAgB,oBACd,QACA,WACA,IACA,UACe;CACf,MAAM,aAAa,GAAG,UAAU,UAAU,GAAG,OAAO,WAAW;CAC/D,IAAI,SAAS;CACb,MAAM,aAAA,GAAYA,6BAAAA,6BAAAA,CAA6B,EAC7C,OAAO,cAAuC;EAC5C,MAAM,cAAc,aAAa,YAAY,KAAK,IAAI;EACtD,MAAM,UAAU,aAAa,OAAO,WAAW,gBAAgB;EAC/D,MAAM,OAAO,GAAG,aAAa,UAAU,kBAAkB,aAAa,MAAM,IAAI;EAChF,MAAM,WAAA,GAAUC,gCAAAA,0BAAAA,CAA0B,MAAM;EAEhD,IAAI;GACF,QAAa,WAAW,CACtB,QAAQ,QACN,UAAU,QAAQ,QAAQ;IAAE;IAAM,OAAO;GAAU,CAAC,IAAI,UAAU,OAAO,OAAO;IAAE;IAAM,OAAO;GAAU,CAAC,CAC5G,CACF,CAAC;EACH,SAAS,OAAO;GACd,QAAQ,YAAY,mCAAmC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