@agimon-ai/po-help 0.0.0-alpha.41 → 0.0.0-alpha.43
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 +169 -7
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +170 -8
- package/dist/extensions/server.mjs.map +1 -1
- package/llms.txt +1 -0
- package/package.json +8 -8
- package/src/prompts/codemode-how-to-self-improve/SKILL.md +41 -0
- package/src/prompts/help-how-to-codemode-plugin/SKILL.md +1 -1
|
@@ -5,6 +5,7 @@ Object.defineProperties(exports, {
|
|
|
5
5
|
let _agimon_ai_po_core_help = require("@agimon-ai/po-core/help");
|
|
6
6
|
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
7
7
|
let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
|
|
8
|
+
let _agimon_ai_po_core_codemode = require("@agimon-ai/po-core/codemode");
|
|
8
9
|
let _agimon_ai_po_minor_mode = require("@agimon-ai/po-minor-mode");
|
|
9
10
|
let typebox = require("typebox");
|
|
10
11
|
//#region src/constants/help.ts
|
|
@@ -31,12 +32,17 @@ const HELP_NATIVE_SKILL = {
|
|
|
31
32
|
name: "help-how-to-native-extension",
|
|
32
33
|
description: "Add or change a Po package's phone UI (.native files, native templates) so it mirrors the cockpit, passes the native build, and is approved and verified before it ships."
|
|
33
34
|
};
|
|
35
|
+
const HELP_SELF_IMPROVE_SKILL = {
|
|
36
|
+
name: "codemode-how-to-self-improve",
|
|
37
|
+
description: "Reload Po's own packages after you edit them, without restarting Po or reopening the session. Use in Help mode after changing a plugin's source or build, or after adding or removing a package."
|
|
38
|
+
};
|
|
34
39
|
//#endregion
|
|
35
40
|
//#region src/schemas/diagnostics.ts
|
|
36
41
|
const helpStatusParameters = typebox.Type.Object({}, { additionalProperties: false });
|
|
37
42
|
//#endregion
|
|
38
43
|
//#region src/services/helpStatus/index.ts
|
|
39
|
-
|
|
44
|
+
/** `packageFailures`: the host's failed global and workspace packages; they never degrade Help itself. */
|
|
45
|
+
function serverHelpStatus(snapshot, enabled, packageFailures = []) {
|
|
40
46
|
const entries = snapshot.capabilities.filter((entry) => entry.when?.state?.["minor-mode"] === HELP_MODE_ID);
|
|
41
47
|
const skills = entries.filter((entry) => entry.kind === "skill");
|
|
42
48
|
const tools = entries.filter((entry) => entry.kind === "tool");
|
|
@@ -66,7 +72,8 @@ function serverHelpStatus(snapshot, enabled) {
|
|
|
66
72
|
...reason ? { reason } : {}
|
|
67
73
|
})),
|
|
68
74
|
diagnostics: diagnostics.slice(0, 128),
|
|
69
|
-
|
|
75
|
+
packages: enabled ? packageFailures.slice(-128) : [],
|
|
76
|
+
truncated: skills.length > 128 || tools.length > 128 || diagnostics.length > 128 || enabled && packageFailures.length > 128
|
|
70
77
|
};
|
|
71
78
|
}
|
|
72
79
|
function helpStatusDetail(report) {
|
|
@@ -95,15 +102,133 @@ function createHelpStatusTool(inspect, authorize) {
|
|
|
95
102
|
});
|
|
96
103
|
}
|
|
97
104
|
//#endregion
|
|
105
|
+
//#region src/services/selfImproveNamespace/index.ts
|
|
106
|
+
/** Finished operations kept for `operation(id)`; older ones are forgotten first. */
|
|
107
|
+
const MAX_OPERATIONS = 20;
|
|
108
|
+
const SCOPES = [
|
|
109
|
+
"session",
|
|
110
|
+
"workspace",
|
|
111
|
+
"global"
|
|
112
|
+
];
|
|
113
|
+
const AXES = [
|
|
114
|
+
"majorMode",
|
|
115
|
+
"domains",
|
|
116
|
+
"profile"
|
|
117
|
+
];
|
|
118
|
+
const DECLARATIONS = `type Scope = 'session' | 'workspace' | 'global';
|
|
119
|
+
type Axis = 'majorMode' | 'domains' | 'profile';
|
|
120
|
+
interface PackageFailure { scope: string; packageName: string; stage: string; reason: string; previous?: 'restored' | 'lost' | 'none'; at: string }
|
|
121
|
+
interface Operation {
|
|
122
|
+
operationId: string; scope: Scope; axes?: Axis[];
|
|
123
|
+
/** partial: applied, but some packages failed and keep their previous build when they had one. */
|
|
124
|
+
state: 'queued' | 'applied' | 'partial' | 'failed';
|
|
125
|
+
result?: { installed: string[]; removed: string[]; failed: { packageName: string; reason: string }[] };
|
|
126
|
+
error?: string;
|
|
127
|
+
}
|
|
128
|
+
declare const selfImprove: {
|
|
129
|
+
/** Packages whose current build failed to load or install, by scope. */
|
|
130
|
+
plugins(): Promise<{ failures: PackageFailure[] }>;
|
|
131
|
+
/** Queues a reload of one scope's packages from disk; check it with operation() in a later exec. global needs confirm: true, after the person agreed. */
|
|
132
|
+
reload(input: { scope: Scope; confirm?: boolean }): Promise<Operation>;
|
|
133
|
+
/** Queues a re-apply of this session's current major mode, domains or profile (default: all three) after editing their config; check it with operation(). */
|
|
134
|
+
refresh(input?: { axes?: Axis[] }): Promise<Operation>;
|
|
135
|
+
operation(operationId: string): Promise<Operation>;
|
|
136
|
+
};`;
|
|
137
|
+
function createSelfImproveNamespace(options) {
|
|
138
|
+
const operations = /* @__PURE__ */ new Map();
|
|
139
|
+
let next = 0;
|
|
140
|
+
const remember = (operation) => {
|
|
141
|
+
operations.set(operation.operationId, operation);
|
|
142
|
+
for (const id of operations.keys()) {
|
|
143
|
+
if (operations.size <= MAX_OPERATIONS) break;
|
|
144
|
+
if (operations.get(id)?.state !== "queued") operations.delete(id);
|
|
145
|
+
}
|
|
146
|
+
return operation;
|
|
147
|
+
};
|
|
148
|
+
return {
|
|
149
|
+
name: "selfImprove",
|
|
150
|
+
summary: "Reload Po's own packages after editing them, or refresh this session's mode, domains and profile config, without restarting. Help mode, main agent only.",
|
|
151
|
+
declarations: DECLARATIONS,
|
|
152
|
+
bind(run) {
|
|
153
|
+
if (run.sessionId !== options.sessionId) throw new Error("The selfImprove namespace belongs to another session.");
|
|
154
|
+
const check = () => {
|
|
155
|
+
run.signal.throwIfAborted();
|
|
156
|
+
options.assertActive();
|
|
157
|
+
if (run.caller !== "main") throw new Error("Only the main agent may reload or refresh Po.");
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
plugins: async () => {
|
|
161
|
+
check();
|
|
162
|
+
return { failures: JSON.parse(JSON.stringify(options.failures())) };
|
|
163
|
+
},
|
|
164
|
+
reload: async (input) => {
|
|
165
|
+
check();
|
|
166
|
+
const { scope, confirm } = input ?? {};
|
|
167
|
+
if (!SCOPES.includes(scope)) throw new Error("reload needs scope 'session', 'workspace' or 'global'.");
|
|
168
|
+
if (scope === "global" && confirm !== true) throw new Error("A global reload changes every session; ask the person, then pass confirm: true.");
|
|
169
|
+
const operationId = `reload-${String(++next)}`;
|
|
170
|
+
const queued = remember({
|
|
171
|
+
operationId,
|
|
172
|
+
scope,
|
|
173
|
+
state: "queued"
|
|
174
|
+
});
|
|
175
|
+
options.service.reload({
|
|
176
|
+
scope: queued.scope,
|
|
177
|
+
sessionId: options.sessionId
|
|
178
|
+
}).then((result) => remember({
|
|
179
|
+
...queued,
|
|
180
|
+
state: result.failed.length === 0 ? "applied" : "partial",
|
|
181
|
+
result: JSON.parse(JSON.stringify(result))
|
|
182
|
+
}), (error) => remember({
|
|
183
|
+
...queued,
|
|
184
|
+
state: "failed",
|
|
185
|
+
error: error instanceof Error ? error.message : String(error)
|
|
186
|
+
}));
|
|
187
|
+
return { ...queued };
|
|
188
|
+
},
|
|
189
|
+
refresh: async (input) => {
|
|
190
|
+
check();
|
|
191
|
+
const { axes = AXES } = input ?? {};
|
|
192
|
+
if (!Array.isArray(axes) || axes.length === 0 || !axes.every((axis) => AXES.includes(axis))) throw new Error("refresh axes are 'majorMode', 'domains' and 'profile'.");
|
|
193
|
+
const queued = remember({
|
|
194
|
+
operationId: `refresh-${String(++next)}`,
|
|
195
|
+
scope: "session",
|
|
196
|
+
axes: [...new Set(axes)],
|
|
197
|
+
state: "queued"
|
|
198
|
+
});
|
|
199
|
+
options.service.refresh({
|
|
200
|
+
sessionId: options.sessionId,
|
|
201
|
+
axes: queued.axes
|
|
202
|
+
}).then(() => remember({
|
|
203
|
+
...queued,
|
|
204
|
+
state: "applied"
|
|
205
|
+
}), (error) => remember({
|
|
206
|
+
...queued,
|
|
207
|
+
state: "failed",
|
|
208
|
+
error: error instanceof Error ? error.message : String(error)
|
|
209
|
+
}));
|
|
210
|
+
return JSON.parse(JSON.stringify(queued));
|
|
211
|
+
},
|
|
212
|
+
operation: async (operationId) => {
|
|
213
|
+
check();
|
|
214
|
+
const operation = typeof operationId === "string" ? operations.get(operationId) : void 0;
|
|
215
|
+
if (operation === void 0) throw new Error(`No operation '${String(operationId)}'.`);
|
|
216
|
+
return JSON.parse(JSON.stringify(operation));
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
98
223
|
//#region src/services/helpServerSession/index.ts
|
|
99
|
-
function createHelpServerSession(host) {
|
|
224
|
+
function createHelpServerSession(host, packageFailures = () => [], selfImprove) {
|
|
100
225
|
let modeOwner;
|
|
101
226
|
let pending;
|
|
102
227
|
let failure;
|
|
103
228
|
let generation = 0;
|
|
104
229
|
let disposed = false;
|
|
105
230
|
const active = () => (host.context.selection.state?.["minor-mode"] ?? []).includes(HELP_MODE_ID);
|
|
106
|
-
const inspect = () => serverHelpStatus(host.inspectCapabilities(), active());
|
|
231
|
+
const inspect = () => serverHelpStatus(host.inspectCapabilities(), active(), packageFailures());
|
|
107
232
|
const modeState = () => {
|
|
108
233
|
const report = inspect();
|
|
109
234
|
return {
|
|
@@ -171,7 +296,15 @@ function createHelpServerSession(host) {
|
|
|
171
296
|
if (!text.trim()) throw new Error("The installed code-mode plugin skill is missing or unreadable.");
|
|
172
297
|
return text;
|
|
173
298
|
}
|
|
174
|
-
}
|
|
299
|
+
},
|
|
300
|
+
...selfImprove === void 0 ? [] : [{
|
|
301
|
+
when: _agimon_ai_po_core_help.PO_HELP_WHEN,
|
|
302
|
+
...HELP_SELF_IMPROVE_SKILL,
|
|
303
|
+
kind: "skill",
|
|
304
|
+
pinned: true,
|
|
305
|
+
path: (0, _agimon_ai_po_core_serverPlugin.packageResourcePath)(require("url").pathToFileURL(__filename).href, "src/prompts/codemode-how-to-self-improve/SKILL.md"),
|
|
306
|
+
read: () => (0, _agimon_ai_po_core_serverPlugin.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/codemode-how-to-self-improve/SKILL.md")
|
|
307
|
+
}]
|
|
175
308
|
];
|
|
176
309
|
const selectMode = async (enabled, signal) => {
|
|
177
310
|
if (disposed) throw new Error("Help runtime is disposed.");
|
|
@@ -240,8 +373,33 @@ function createHelpServerSession(host) {
|
|
|
240
373
|
return { message: active() ? "Help mode activated." : "Help mode deactivated." };
|
|
241
374
|
}
|
|
242
375
|
}).createOwner(void 0);
|
|
376
|
+
const assertHelpActive = () => {
|
|
377
|
+
host.assertActive(HELP_PACKAGE_SOURCE);
|
|
378
|
+
if (disposed || !active()) throw new Error("Help mode is not active.");
|
|
379
|
+
};
|
|
380
|
+
const selfImproveService = (cordis) => {
|
|
381
|
+
cordis.inject([_agimon_ai_po_core_codemode.PO_CODEMODE_SERVICE], (scoped) => {
|
|
382
|
+
const codemode = (0, _agimon_ai_po_core_codemode.readPoCodemode)(scoped);
|
|
383
|
+
if (!codemode || !selfImprove) return void 0;
|
|
384
|
+
const namespace = createSelfImproveNamespace({
|
|
385
|
+
sessionId: host.context.sessionId,
|
|
386
|
+
service: selfImprove,
|
|
387
|
+
failures: packageFailures,
|
|
388
|
+
assertActive: assertHelpActive
|
|
389
|
+
});
|
|
390
|
+
const activity = host.registerActivity({
|
|
391
|
+
when: _agimon_ai_po_core_help.PO_HELP_WHEN,
|
|
392
|
+
name: "selfImprove",
|
|
393
|
+
start: () => {
|
|
394
|
+
const registration = codemode.register(HELP_PACKAGE_SOURCE, namespace);
|
|
395
|
+
return () => registration.dispose();
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
return () => activity.dispose();
|
|
399
|
+
});
|
|
400
|
+
};
|
|
243
401
|
return {
|
|
244
|
-
services: [(0, _agimon_ai_po_minor_mode.serverMinorModes)([modeOwner])],
|
|
402
|
+
services: [(0, _agimon_ai_po_minor_mode.serverMinorModes)([modeOwner]), ...selfImprove ? [selfImproveService] : []],
|
|
245
403
|
resources,
|
|
246
404
|
commands: [command],
|
|
247
405
|
tools: [createHelpStatusTool(inspect, (signal) => {
|
|
@@ -258,7 +416,7 @@ function createHelpServerSession(host) {
|
|
|
258
416
|
}
|
|
259
417
|
//#endregion
|
|
260
418
|
//#region src/extensions/workspaces/sessions/(backend)/_lib/runtime.server.ts
|
|
261
|
-
var runtime_server_default = (({ agent }) => agent ? createHelpServerSession(agent) : {});
|
|
419
|
+
var runtime_server_default = (({ agent, context }) => agent ? createHelpServerSession(agent, () => (0, _agimon_ai_po_core_help.readPoPackageHealth)(context)?.failures() ?? [], (0, _agimon_ai_po_core_help.readPoSelfImprove)(context)) : {});
|
|
262
420
|
//#endregion
|
|
263
421
|
//#region src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
264
422
|
var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)((context) => {
|
|
@@ -276,6 +434,9 @@ var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)((cont
|
|
|
276
434
|
//#region src/extensions/workspaces/sessions/(backend)/command/po-help.server.ts
|
|
277
435
|
var po_help_server_default$1 = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)((context) => context.root.commands?.[0], { cardinality: "optional" });
|
|
278
436
|
//#endregion
|
|
437
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-self-improve.server.ts
|
|
438
|
+
var codemode_how_to_self_improve_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)((context) => context.root.resources?.[5], { cardinality: "optional" });
|
|
439
|
+
//#endregion
|
|
279
440
|
//#region src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server.ts
|
|
280
441
|
var po_develop_codemode_plugin_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)((context) => context.root.resources?.[4], { cardinality: "optional" });
|
|
281
442
|
//#endregion
|
|
@@ -319,6 +480,7 @@ const serverPlugin = (0, _agimon_ai_po_core_serverPlugin.defineServerPlugin)({
|
|
|
319
480
|
},
|
|
320
481
|
get resources() {
|
|
321
482
|
return defined([
|
|
483
|
+
at(codemode_how_to_self_improve_server_default, contextSession),
|
|
322
484
|
at(po_develop_codemode_plugin_server_default, contextSession),
|
|
323
485
|
at(po_develop_native_extension_server_default, contextSession),
|
|
324
486
|
at(po_help_server_default, contextSession),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","names":["Type","defineTool","HELP_WHEN","HELP_WHEN","packageResourcePath","readPackageResource","defineMinorMode","serverMinorModes","defineRoot","runtime","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineServerPlugin","composeServerProviderOverrides","rootSession","composeRootInjects","composeRootHooks","commandPoHelp","resourcePoDevelopCodemodePlugin","resourcePoDevelopNativeExtension","resourcePoHelp","resourcePoUseChatgptInstructions","resourcePoUseHelp","toolHelpStatus"],"sources":["../../src/constants/help.ts","../../src/schemas/diagnostics.ts","../../src/services/helpStatus/index.ts","../../src/services/helpServerSession/index.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/runtime.server.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/command/po-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-use-chatgpt-instructions.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-use-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/help_status.server.ts","../../generated/server.ts"],"sourcesContent":["export const HELP_COMMAND_NAME = 'po-help';\nexport const HELP_COMMAND_DESCRIPTION = 'Toggle Help guidance and read-only support diagnostics';\nexport const HELP_MODE_ID = 'help';\nexport const HELP_PACKAGE_SOURCE = '@agimon-ai/po-help';\nexport const HELP_SKILL = {\n name: 'help-how-to-help',\n description:\n 'Set up and debug Po agents using installed package guidance and scoped, read-only diagnostics. Diagnose missing capabilities before proposing authorized repairs.',\n} as const;\nexport const HELP_GUIDANCE =\n 'Help mode is active. Read help-how-to-help, inspect the available diagnostics, and use the narrowest package guidance for the task. Diagnose before proposing changes. Help does not grant additional permissions.';\nexport const HELP_STATUS_TOOL_NAME = 'help_status';\nexport const HELP_STATUS_TOOL_DESCRIPTION =\n 'Inspect active Help skills, diagnostic tools, contributor ownership, and unavailable contributions in this session. Read-only; does not change selection or permissions.';\nexport const HELP_STATUS_LIMIT = 128;\n\nexport const HELP_CHATGPT_SKILL = {\n name: 'help-how-to-chatgpt-instructions',\n description:\n \"Print a paste-ready ChatGPT project instruction (at most 8,000 characters) that routes code-mode work through this session's MCP tools and condenses every AGENTS.md rule. Writes no files.\",\n} as const;\n\nexport const HELP_CODEMODE_SKILL = {\n name: 'help-how-to-codemode-plugin',\n description:\n 'Add code-mode support to a Po package: contribute a namespace to exec and discover, replace the direct tool it supersedes, and ship the skill that teaches agents to use it.',\n} as const;\n\nexport const HELP_NATIVE_SKILL = {\n name: 'help-how-to-native-extension',\n description:\n \"Add or change a Po package's phone UI (.native files, native templates) so it mirrors the cockpit, passes the native build, and is approved and verified before it ships.\",\n} as const;\n","import { Type } from 'typebox';\n\nexport const helpStatusParameters = Type.Object({}, { additionalProperties: false });\n","import type { PoHeadlessCapabilitySnapshot } from '@agimon-ai/po-core/headless';\nimport { PO_HELP_WHEN as HELP_WHEN } from '@agimon-ai/po-core/help';\nimport { defineTool } from '@agimon-ai/po-core/serverPlugin';\n\nimport {\n HELP_GUIDANCE,\n HELP_MODE_ID,\n HELP_STATUS_LIMIT,\n HELP_STATUS_TOOL_DESCRIPTION,\n HELP_STATUS_TOOL_NAME,\n} from '../../constants/help';\nimport { helpStatusParameters } from '../../schemas/diagnostics';\nimport type { HelpStatusReport } from './type';\n\nexport function serverHelpStatus(snapshot: PoHeadlessCapabilitySnapshot, enabled: boolean): HelpStatusReport {\n const entries = snapshot.capabilities.filter((entry) => entry.when?.state?.['minor-mode'] === HELP_MODE_ID);\n const skills = entries.filter((entry) => entry.kind === 'skill');\n const tools = entries.filter((entry) => entry.kind === 'tool');\n const diagnostics = entries\n .filter((entry) => enabled && entry.reason && entry.reason !== 'inactive')\n .map((entry) => ({ source: entry.source, code: `HELP_${entry.reason!.replaceAll('-', '_').toUpperCase()}` }));\n const ready = snapshot.ready;\n return {\n activation: !enabled ? 'inactive' : !ready ? 'activating' : diagnostics.length ? 'degraded' : 'active',\n ready,\n revision: snapshot.revision,\n counts: {\n skills: ready ? skills.filter((entry) => entry.active && entry.discoverable).length : null,\n tools: tools.filter((entry) => entry.active).length,\n },\n skills: skills.slice(0, HELP_STATUS_LIMIT).map(({ name, source, active, discoverable, reason }) => ({\n name,\n source,\n active: active && discoverable,\n ...(reason ? { reason } : {}),\n })),\n tools: tools\n .slice(0, HELP_STATUS_LIMIT)\n .map(({ name, source, active, reason }) => ({ name, source, active, ...(reason ? { reason } : {}) })),\n diagnostics: diagnostics.slice(0, HELP_STATUS_LIMIT),\n truncated:\n skills.length > HELP_STATUS_LIMIT || tools.length > HELP_STATUS_LIMIT || diagnostics.length > HELP_STATUS_LIMIT,\n };\n}\n\nexport function helpStatusDetail(report: HelpStatusReport): string {\n return `${report.counts.skills ?? 'pending'} Help skills, ${report.counts.tools} diagnostic tools${report.diagnostics.length ? ' (diagnostics available)' : ''}`;\n}\n\nexport function createHelpStatusTool(\n inspect: () => HelpStatusReport | Promise<HelpStatusReport>,\n authorize: (signal?: AbortSignal) => AbortSignal,\n) {\n return defineTool({\n name: HELP_STATUS_TOOL_NAME,\n description: HELP_STATUS_TOOL_DESCRIPTION,\n parameters: helpStatusParameters,\n when: HELP_WHEN,\n promptGuidelines: [HELP_GUIDANCE],\n async execute(_input, execution) {\n const signal = authorize(execution.signal);\n const report = await inspect();\n signal.throwIfAborted();\n authorize(execution.signal);\n return { content: [{ type: 'text', text: JSON.stringify(report, null, 2) }], details: report };\n },\n });\n}\n","import type { PoHeadlessCommand, PoHeadlessHostService, PoHeadlessResource } from '@agimon-ai/po-core/headless';\nimport { PO_HELP_WHEN as HELP_WHEN } from '@agimon-ai/po-core/help';\nimport { type PoServerSessionPlugin, packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverPlugin';\nimport { defineMinorMode, serverMinorModes, type MinorModeOwner, type MinorModeState } from '@agimon-ai/po-minor-mode';\n\nimport {\n HELP_COMMAND_DESCRIPTION,\n HELP_COMMAND_NAME,\n HELP_GUIDANCE,\n HELP_MODE_ID,\n HELP_PACKAGE_SOURCE,\n HELP_CHATGPT_SKILL,\n HELP_CODEMODE_SKILL,\n HELP_NATIVE_SKILL,\n HELP_SKILL,\n} from '../../constants/help';\nimport { createHelpStatusTool, helpStatusDetail, serverHelpStatus } from '../helpStatus';\nexport function createHelpServerSession(host: PoHeadlessHostService): PoServerSessionPlugin {\n let modeOwner: MinorModeOwner | undefined;\n let pending: boolean | undefined;\n let failure: string | undefined;\n let generation = 0;\n let disposed = false;\n const active = () => (host.context.selection.state?.['minor-mode'] ?? []).includes(HELP_MODE_ID);\n const inspect = () => serverHelpStatus(host.inspectCapabilities(), active());\n const modeState = (): MinorModeState => {\n const report = inspect();\n return {\n activation: pending === true ? 'activating' : active() ? 'active' : 'inactive',\n condition:\n pending !== undefined || !report.ready\n ? 'queued'\n : failure\n ? 'failed'\n : report.activation === 'degraded'\n ? 'degraded'\n : 'ready',\n ...(pending !== undefined\n ? { detail: 'applying Help capabilities' }\n : failure\n ? { detail: failure }\n : active()\n ? { detail: helpStatusDetail(report) }\n : {}),\n actions: [\n {\n id: 'activate',\n enabled: !active() && pending === undefined,\n ...(!active() && pending === undefined ? {} : { disabledReason: 'Help is active or changing.' }),\n },\n {\n id: 'deactivate',\n enabled: active() || pending === true,\n ...(active() || pending === true ? {} : { disabledReason: 'Help mode is not active.' }),\n },\n ],\n };\n };\n const resources: PoHeadlessResource[] = [\n { when: HELP_WHEN, name: 'po-help', kind: 'context', read: () => HELP_GUIDANCE },\n {\n when: HELP_WHEN,\n ...HELP_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-help/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-help/SKILL.md');\n if (!text.trim()) throw new Error('The installed Help skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_CHATGPT_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-chatgpt-instructions/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(\n import.meta.url,\n 'src/prompts/help-how-to-chatgpt-instructions/SKILL.md',\n );\n if (!text.trim()) throw new Error('The installed ChatGPT instruction skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_NATIVE_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-native-extension/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-native-extension/SKILL.md');\n if (!text.trim()) throw new Error('The installed native extension skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_CODEMODE_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-codemode-plugin/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-codemode-plugin/SKILL.md');\n if (!text.trim()) throw new Error('The installed code-mode plugin skill is missing or unreadable.');\n return text;\n },\n },\n ];\n const selectMode = async (enabled: boolean, signal?: AbortSignal): Promise<void> => {\n if (disposed) throw new Error('Help runtime is disposed.');\n signal?.throwIfAborted();\n const operation = ++generation;\n pending = enabled;\n failure = undefined;\n modeOwner?.publish();\n try {\n if (enabled) await resources[1]!.read(host.context);\n signal?.throwIfAborted();\n if (operation !== generation || disposed) throw new Error('Help activation was cancelled.');\n const modes = (host.context.selection.state?.['minor-mode'] ?? []).filter((mode) => mode !== HELP_MODE_ID);\n await host.changeSelection({\n axis: 'state',\n key: 'minor-mode',\n values: enabled ? [...modes, HELP_MODE_ID] : modes,\n });\n } catch (error) {\n if (operation === generation) failure = (error instanceof Error ? error.message : String(error)).slice(0, 160);\n throw error;\n } finally {\n if (operation === generation) {\n pending = undefined;\n modeOwner?.publish();\n }\n }\n };\n const command: PoHeadlessCommand = {\n name: HELP_COMMAND_NAME,\n description: HELP_COMMAND_DESCRIPTION,\n async execute(_args, execution) {\n await selectMode(!(pending ?? active()));\n await execution.client.notify({\n title: 'Po Help',\n body: active() ? 'Help mode activated.' : 'Help mode deactivated.',\n level: 'info',\n });\n },\n };\n modeOwner = defineMinorMode({\n descriptor: {\n source: HELP_PACKAGE_SOURCE,\n id: HELP_MODE_ID,\n label: 'Help',\n description: 'Package guidance and read-only diagnostics for agent setup and debugging.',\n order: 50,\n actions: [\n {\n id: 'activate',\n label: 'Activate',\n description: 'Expose Help guidance and diagnostic tools.',\n contexts: ['headless'],\n parameters: [],\n },\n {\n id: 'deactivate',\n label: 'Deactivate',\n description: 'Withdraw Help-only guidance and diagnostic tools.',\n contexts: ['headless'],\n parameters: [],\n },\n ],\n },\n state: modeState,\n async handleAction(_runtime, actionId, _argumentsValue, { signal }) {\n if (actionId !== 'activate' && actionId !== 'deactivate')\n throw new Error(`Unknown Help mode action: ${actionId}`);\n await selectMode(actionId === 'activate', signal);\n return { message: active() ? 'Help mode activated.' : 'Help mode deactivated.' };\n },\n }).createOwner(undefined);\n return {\n services: [serverMinorModes([modeOwner])],\n resources,\n commands: [command],\n tools: [\n createHelpStatusTool(inspect, (signal) => {\n signal?.throwIfAborted();\n host.assertActive(HELP_PACKAGE_SOURCE);\n if (disposed || !active()) throw new Error('Help mode is not active.');\n return signal ?? new AbortController().signal;\n }),\n ],\n onDispose() {\n disposed = true;\n generation += 1;\n },\n };\n}\n","import type { PoServerPluginDefinition, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createHelpServerSession } from '../../../../../services/helpServerSession';\n\nexport default (({ agent }): Partial<PoServerSessionPlugin> =>\n agent ? createHelpServerSession(agent) : {}) satisfies NonNullable<PoServerPluginDefinition['session']>;\n","import { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport runtime from './_lib/runtime.server';\n\nexport default defineRoot((context: PoServerPluginContext) => {\n const value = runtime(context);\n return {\n value,\n services: value.services,\n activities: value.activities,\n onStart: value.onStart,\n onStop: value.onStop,\n onDispose: value.onDispose,\n };\n});\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.commands?.[0],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[4],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[3],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[0],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[2],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[1],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.tools?.[0],\n { cardinality: 'optional' },\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 commandPoHelp from '../src/extensions/workspaces/sessions/(backend)/command/po-help.server';\nimport resourcePoDevelopCodemodePlugin from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server';\nimport resourcePoDevelopNativeExtension from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server';\nimport resourcePoHelp from '../src/extensions/workspaces/sessions/(backend)/resource/po-help.server';\nimport resourcePoUseChatgptInstructions from '../src/extensions/workspaces/sessions/(backend)/resource/po-use-chatgpt-instructions.server';\nimport resourcePoUseHelp from '../src/extensions/workspaces/sessions/(backend)/resource/po-use-help.server';\nimport toolHelpStatus from '../src/extensions/workspaces/sessions/(backend)/tool/help_status.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);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-help',\n providerOverrides: composeServerProviderOverrides(rootSession),\n injects: composeRootInjects({ session: [rootSession] }),\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 commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'po-help' }, at(commandPoHelp, contextSession))]); },\n get resources(): PoServerSessionPlugin['resources'] { return defined([at(resourcePoDevelopCodemodePlugin, contextSession), at(resourcePoDevelopNativeExtension, contextSession), at(resourcePoHelp, contextSession), at(resourcePoUseChatgptInstructions, contextSession), at(resourcePoUseHelp, contextSession)]); },\n get tools(): PoServerSessionPlugin['tools'] { return defined([via({ name: 'help_status' }, at(toolHelpStatus, contextSession))]); },\n services: [...(scopeSession.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;;AAAA,MAAa,oBAAoB;AACjC,MAAa,2BAA2B;AACxC,MAAa,eAAe;AAC5B,MAAa,sBAAsB;AACnC,MAAa,aAAa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;GAClI,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":["Type","defineTool","HELP_WHEN","HELP_WHEN","packageResourcePath","readPackageResource","defineMinorMode","PO_CODEMODE_SERVICE","readPoCodemode","serverMinorModes","readPoPackageHealth","readPoSelfImprove","defineRoot","runtime","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineServerPlugin","composeServerProviderOverrides","rootSession","composeRootInjects","composeRootHooks","commandPoHelp","resourceCodemodeHowToSelfImprove","resourcePoDevelopCodemodePlugin","resourcePoDevelopNativeExtension","resourcePoHelp","resourcePoUseChatgptInstructions","resourcePoUseHelp","toolHelpStatus"],"sources":["../../src/constants/help.ts","../../src/schemas/diagnostics.ts","../../src/services/helpStatus/index.ts","../../src/services/selfImproveNamespace/index.ts","../../src/services/helpServerSession/index.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/runtime.server.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/command/po-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-self-improve.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-use-chatgpt-instructions.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-use-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/help_status.server.ts","../../generated/server.ts"],"sourcesContent":["export const HELP_COMMAND_NAME = 'po-help';\nexport const HELP_COMMAND_DESCRIPTION = 'Toggle Help guidance and read-only support diagnostics';\nexport const HELP_MODE_ID = 'help';\nexport const HELP_PACKAGE_SOURCE = '@agimon-ai/po-help';\nexport const HELP_SKILL = {\n name: 'help-how-to-help',\n description:\n 'Set up and debug Po agents using installed package guidance and scoped, read-only diagnostics. Diagnose missing capabilities before proposing authorized repairs.',\n} as const;\nexport const HELP_GUIDANCE =\n 'Help mode is active. Read help-how-to-help, inspect the available diagnostics, and use the narrowest package guidance for the task. Diagnose before proposing changes. Help does not grant additional permissions.';\nexport const HELP_STATUS_TOOL_NAME = 'help_status';\nexport const HELP_STATUS_TOOL_DESCRIPTION =\n 'Inspect active Help skills, diagnostic tools, contributor ownership, and unavailable contributions in this session. Read-only; does not change selection or permissions.';\nexport const HELP_STATUS_LIMIT = 128;\n\nexport const HELP_CHATGPT_SKILL = {\n name: 'help-how-to-chatgpt-instructions',\n description:\n \"Print a paste-ready ChatGPT project instruction (at most 8,000 characters) that routes code-mode work through this session's MCP tools and condenses every AGENTS.md rule. Writes no files.\",\n} as const;\n\nexport const HELP_CODEMODE_SKILL = {\n name: 'help-how-to-codemode-plugin',\n description:\n 'Add code-mode support to a Po package: contribute a namespace to exec and discover, replace the direct tool it supersedes, and ship the skill that teaches agents to use it.',\n} as const;\n\nexport const HELP_NATIVE_SKILL = {\n name: 'help-how-to-native-extension',\n description:\n \"Add or change a Po package's phone UI (.native files, native templates) so it mirrors the cockpit, passes the native build, and is approved and verified before it ships.\",\n} as const;\n\nexport const HELP_SELF_IMPROVE_SKILL = {\n name: 'codemode-how-to-self-improve',\n description:\n \"Reload Po's own packages after you edit them, without restarting Po or reopening the session. Use in Help mode after changing a plugin's source or build, or after adding or removing a package.\",\n} as const;\n","import { Type } from 'typebox';\n\nexport const helpStatusParameters = Type.Object({}, { additionalProperties: false });\n","import type { PoHeadlessCapabilitySnapshot } from '@agimon-ai/po-core/headless';\nimport { PO_HELP_WHEN as HELP_WHEN, type PoPackageFailureRecord } from '@agimon-ai/po-core/help';\nimport { defineTool } from '@agimon-ai/po-core/serverPlugin';\n\nimport {\n HELP_GUIDANCE,\n HELP_MODE_ID,\n HELP_STATUS_LIMIT,\n HELP_STATUS_TOOL_DESCRIPTION,\n HELP_STATUS_TOOL_NAME,\n} from '../../constants/help';\nimport { helpStatusParameters } from '../../schemas/diagnostics';\nimport type { HelpStatusReport } from './type';\n\n/** `packageFailures`: the host's failed global and workspace packages; they never degrade Help itself. */\nexport function serverHelpStatus(\n snapshot: PoHeadlessCapabilitySnapshot,\n enabled: boolean,\n packageFailures: readonly PoPackageFailureRecord[] = [],\n): HelpStatusReport {\n const entries = snapshot.capabilities.filter((entry) => entry.when?.state?.['minor-mode'] === HELP_MODE_ID);\n const skills = entries.filter((entry) => entry.kind === 'skill');\n const tools = entries.filter((entry) => entry.kind === 'tool');\n const diagnostics = entries\n .filter((entry) => enabled && entry.reason && entry.reason !== 'inactive')\n .map((entry) => ({ source: entry.source, code: `HELP_${entry.reason!.replaceAll('-', '_').toUpperCase()}` }));\n const ready = snapshot.ready;\n return {\n activation: !enabled ? 'inactive' : !ready ? 'activating' : diagnostics.length ? 'degraded' : 'active',\n ready,\n revision: snapshot.revision,\n counts: {\n skills: ready ? skills.filter((entry) => entry.active && entry.discoverable).length : null,\n tools: tools.filter((entry) => entry.active).length,\n },\n skills: skills.slice(0, HELP_STATUS_LIMIT).map(({ name, source, active, discoverable, reason }) => ({\n name,\n source,\n active: active && discoverable,\n ...(reason ? { reason } : {}),\n })),\n tools: tools\n .slice(0, HELP_STATUS_LIMIT)\n .map(({ name, source, active, reason }) => ({ name, source, active, ...(reason ? { reason } : {}) })),\n diagnostics: diagnostics.slice(0, HELP_STATUS_LIMIT),\n packages: enabled ? packageFailures.slice(-HELP_STATUS_LIMIT) : [],\n truncated:\n skills.length > HELP_STATUS_LIMIT ||\n tools.length > HELP_STATUS_LIMIT ||\n diagnostics.length > HELP_STATUS_LIMIT ||\n (enabled && packageFailures.length > HELP_STATUS_LIMIT),\n };\n}\n\nexport function helpStatusDetail(report: HelpStatusReport): string {\n return `${report.counts.skills ?? 'pending'} Help skills, ${report.counts.tools} diagnostic tools${report.diagnostics.length ? ' (diagnostics available)' : ''}`;\n}\n\nexport function createHelpStatusTool(\n inspect: () => HelpStatusReport | Promise<HelpStatusReport>,\n authorize: (signal?: AbortSignal) => AbortSignal,\n) {\n return defineTool({\n name: HELP_STATUS_TOOL_NAME,\n description: HELP_STATUS_TOOL_DESCRIPTION,\n parameters: helpStatusParameters,\n when: HELP_WHEN,\n promptGuidelines: [HELP_GUIDANCE],\n async execute(_input, execution) {\n const signal = authorize(execution.signal);\n const report = await inspect();\n signal.throwIfAborted();\n authorize(execution.signal);\n return { content: [{ type: 'text', text: JSON.stringify(report, null, 2) }], details: report };\n },\n });\n}\n","import type { PoCodemodeNamespace } from '@agimon-ai/po-core/codemode';\nimport type { PoHeadlessRefreshAxis } from '@agimon-ai/po-core/headless';\n\nimport type { SelfImproveNamespaceOptions, SelfImproveOperation, SelfImproveScope } from './type';\n\n/** Finished operations kept for `operation(id)`; older ones are forgotten first. */\nconst MAX_OPERATIONS = 20;\nconst SCOPES: readonly SelfImproveScope[] = ['session', 'workspace', 'global'];\nconst AXES: readonly PoHeadlessRefreshAxis[] = ['majorMode', 'domains', 'profile'];\n\nconst DECLARATIONS = `type Scope = 'session' | 'workspace' | 'global';\ntype Axis = 'majorMode' | 'domains' | 'profile';\ninterface PackageFailure { scope: string; packageName: string; stage: string; reason: string; previous?: 'restored' | 'lost' | 'none'; at: string }\ninterface Operation {\n operationId: string; scope: Scope; axes?: Axis[];\n /** partial: applied, but some packages failed and keep their previous build when they had one. */\n state: 'queued' | 'applied' | 'partial' | 'failed';\n result?: { installed: string[]; removed: string[]; failed: { packageName: string; reason: string }[] };\n error?: string;\n}\ndeclare const selfImprove: {\n /** Packages whose current build failed to load or install, by scope. */\n plugins(): Promise<{ failures: PackageFailure[] }>;\n /** Queues a reload of one scope's packages from disk; check it with operation() in a later exec. global needs confirm: true, after the person agreed. */\n reload(input: { scope: Scope; confirm?: boolean }): Promise<Operation>;\n /** Queues a re-apply of this session's current major mode, domains or profile (default: all three) after editing their config; check it with operation(). */\n refresh(input?: { axes?: Axis[] }): Promise<Operation>;\n operation(operationId: string): Promise<Operation>;\n};`;\n\nexport function createSelfImproveNamespace(options: SelfImproveNamespaceOptions): PoCodemodeNamespace {\n const operations = new Map<string, SelfImproveOperation>();\n let next = 0;\n const remember = (operation: SelfImproveOperation): SelfImproveOperation => {\n operations.set(operation.operationId, operation);\n for (const id of operations.keys()) {\n if (operations.size <= MAX_OPERATIONS) break;\n if (operations.get(id)?.state !== 'queued') operations.delete(id);\n }\n return operation;\n };\n return {\n name: 'selfImprove',\n summary:\n \"Reload Po's own packages after editing them, or refresh this session's mode, domains and profile config, without restarting. Help mode, main agent only.\",\n declarations: DECLARATIONS,\n bind(run) {\n if (run.sessionId !== options.sessionId) throw new Error('The selfImprove namespace belongs to another session.');\n const check = () => {\n run.signal.throwIfAborted();\n options.assertActive();\n if (run.caller !== 'main') throw new Error('Only the main agent may reload or refresh Po.');\n };\n return {\n plugins: async () => {\n check();\n return { failures: JSON.parse(JSON.stringify(options.failures())) as unknown };\n },\n reload: async (input: unknown) => {\n check();\n const { scope, confirm } = (input ?? {}) as { scope?: unknown; confirm?: unknown };\n if (!SCOPES.includes(scope as SelfImproveScope))\n throw new Error(\"reload needs scope 'session', 'workspace' or 'global'.\");\n if (scope === 'global' && confirm !== true)\n throw new Error('A global reload changes every session; ask the person, then pass confirm: true.');\n const operationId = `reload-${String(++next)}`;\n const queued = remember({ operationId, scope: scope as SelfImproveScope, state: 'queued' });\n // Not awaited: a session reload waits for this tool round to end.\n void options.service.reload({ scope: queued.scope, sessionId: options.sessionId }).then(\n (result) =>\n remember({\n ...queued,\n state: result.failed.length === 0 ? 'applied' : 'partial',\n result: JSON.parse(JSON.stringify(result)) as SelfImproveOperation['result'],\n }),\n (error: unknown) =>\n remember({ ...queued, state: 'failed', error: error instanceof Error ? error.message : String(error) }),\n );\n return { ...queued };\n },\n refresh: async (input: unknown) => {\n check();\n const { axes = AXES } = (input ?? {}) as { axes?: unknown };\n if (\n !Array.isArray(axes) ||\n axes.length === 0 ||\n !axes.every((axis) => AXES.includes(axis as PoHeadlessRefreshAxis))\n )\n throw new Error(\"refresh axes are 'majorMode', 'domains' and 'profile'.\");\n const queued = remember({\n operationId: `refresh-${String(++next)}`,\n scope: 'session',\n axes: [...new Set(axes as PoHeadlessRefreshAxis[])],\n state: 'queued',\n });\n // Not awaited: the refresh waits for this tool round to end.\n void options.service.refresh({ sessionId: options.sessionId, axes: queued.axes! }).then(\n () => remember({ ...queued, state: 'applied' }),\n (error: unknown) =>\n remember({ ...queued, state: 'failed', error: error instanceof Error ? error.message : String(error) }),\n );\n return JSON.parse(JSON.stringify(queued)) as SelfImproveOperation;\n },\n operation: async (operationId: unknown) => {\n check();\n const operation = typeof operationId === 'string' ? operations.get(operationId) : undefined;\n if (operation === undefined) throw new Error(`No operation '${String(operationId)}'.`);\n return JSON.parse(JSON.stringify(operation)) as SelfImproveOperation;\n },\n };\n },\n };\n}\n","import { PO_CODEMODE_SERVICE, readPoCodemode } from '@agimon-ai/po-core/codemode';\nimport type { PoHeadlessCommand, PoHeadlessHostService, PoHeadlessResource } from '@agimon-ai/po-core/headless';\nimport { PO_HELP_WHEN as HELP_WHEN, type PoPackageFailureRecord, type PoSelfImprove } from '@agimon-ai/po-core/help';\nimport {\n type PoServerPluginContext,\n type PoServerSessionPlugin,\n packageResourcePath,\n readPackageResource,\n} from '@agimon-ai/po-core/serverPlugin';\nimport { defineMinorMode, serverMinorModes, type MinorModeOwner, type MinorModeState } from '@agimon-ai/po-minor-mode';\n\nimport {\n HELP_COMMAND_DESCRIPTION,\n HELP_COMMAND_NAME,\n HELP_GUIDANCE,\n HELP_MODE_ID,\n HELP_PACKAGE_SOURCE,\n HELP_CHATGPT_SKILL,\n HELP_CODEMODE_SKILL,\n HELP_NATIVE_SKILL,\n HELP_SELF_IMPROVE_SKILL,\n HELP_SKILL,\n} from '../../constants/help';\nimport { createHelpStatusTool, helpStatusDetail, serverHelpStatus } from '../helpStatus';\nimport { createSelfImproveNamespace } from '../selfImproveNamespace';\nexport function createHelpServerSession(\n host: PoHeadlessHostService,\n packageFailures: () => readonly PoPackageFailureRecord[] = () => [],\n /** The host's package reload; without it (edge, tests) Help offers no selfImprove namespace. */\n selfImprove?: PoSelfImprove,\n): PoServerSessionPlugin {\n let modeOwner: MinorModeOwner | undefined;\n let pending: boolean | undefined;\n let failure: string | undefined;\n let generation = 0;\n let disposed = false;\n const active = () => (host.context.selection.state?.['minor-mode'] ?? []).includes(HELP_MODE_ID);\n const inspect = () => serverHelpStatus(host.inspectCapabilities(), active(), packageFailures());\n const modeState = (): MinorModeState => {\n const report = inspect();\n return {\n activation: pending === true ? 'activating' : active() ? 'active' : 'inactive',\n condition:\n pending !== undefined || !report.ready\n ? 'queued'\n : failure\n ? 'failed'\n : report.activation === 'degraded'\n ? 'degraded'\n : 'ready',\n ...(pending !== undefined\n ? { detail: 'applying Help capabilities' }\n : failure\n ? { detail: failure }\n : active()\n ? { detail: helpStatusDetail(report) }\n : {}),\n actions: [\n {\n id: 'activate',\n enabled: !active() && pending === undefined,\n ...(!active() && pending === undefined ? {} : { disabledReason: 'Help is active or changing.' }),\n },\n {\n id: 'deactivate',\n enabled: active() || pending === true,\n ...(active() || pending === true ? {} : { disabledReason: 'Help mode is not active.' }),\n },\n ],\n };\n };\n const resources: PoHeadlessResource[] = [\n { when: HELP_WHEN, name: 'po-help', kind: 'context', read: () => HELP_GUIDANCE },\n {\n when: HELP_WHEN,\n ...HELP_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-help/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-help/SKILL.md');\n if (!text.trim()) throw new Error('The installed Help skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_CHATGPT_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-chatgpt-instructions/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(\n import.meta.url,\n 'src/prompts/help-how-to-chatgpt-instructions/SKILL.md',\n );\n if (!text.trim()) throw new Error('The installed ChatGPT instruction skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_NATIVE_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-native-extension/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-native-extension/SKILL.md');\n if (!text.trim()) throw new Error('The installed native extension skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_CODEMODE_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-codemode-plugin/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-codemode-plugin/SKILL.md');\n if (!text.trim()) throw new Error('The installed code-mode plugin skill is missing or unreadable.');\n return text;\n },\n },\n // Pinned like every code-mode guide, but listed only where the host can reload and Help is on.\n ...(selfImprove === undefined\n ? []\n : [\n {\n when: HELP_WHEN,\n ...HELP_SELF_IMPROVE_SKILL,\n kind: 'skill' as const,\n pinned: true,\n path: packageResourcePath(import.meta.url, 'src/prompts/codemode-how-to-self-improve/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/codemode-how-to-self-improve/SKILL.md'),\n },\n ]),\n ];\n const selectMode = async (enabled: boolean, signal?: AbortSignal): Promise<void> => {\n if (disposed) throw new Error('Help runtime is disposed.');\n signal?.throwIfAborted();\n const operation = ++generation;\n pending = enabled;\n failure = undefined;\n modeOwner?.publish();\n try {\n if (enabled) await resources[1]!.read(host.context);\n signal?.throwIfAborted();\n if (operation !== generation || disposed) throw new Error('Help activation was cancelled.');\n const modes = (host.context.selection.state?.['minor-mode'] ?? []).filter((mode) => mode !== HELP_MODE_ID);\n await host.changeSelection({\n axis: 'state',\n key: 'minor-mode',\n values: enabled ? [...modes, HELP_MODE_ID] : modes,\n });\n } catch (error) {\n if (operation === generation) failure = (error instanceof Error ? error.message : String(error)).slice(0, 160);\n throw error;\n } finally {\n if (operation === generation) {\n pending = undefined;\n modeOwner?.publish();\n }\n }\n };\n const command: PoHeadlessCommand = {\n name: HELP_COMMAND_NAME,\n description: HELP_COMMAND_DESCRIPTION,\n async execute(_args, execution) {\n await selectMode(!(pending ?? active()));\n await execution.client.notify({\n title: 'Po Help',\n body: active() ? 'Help mode activated.' : 'Help mode deactivated.',\n level: 'info',\n });\n },\n };\n modeOwner = defineMinorMode({\n descriptor: {\n source: HELP_PACKAGE_SOURCE,\n id: HELP_MODE_ID,\n label: 'Help',\n description: 'Package guidance and read-only diagnostics for agent setup and debugging.',\n order: 50,\n actions: [\n {\n id: 'activate',\n label: 'Activate',\n description: 'Expose Help guidance and diagnostic tools.',\n contexts: ['headless'],\n parameters: [],\n },\n {\n id: 'deactivate',\n label: 'Deactivate',\n description: 'Withdraw Help-only guidance and diagnostic tools.',\n contexts: ['headless'],\n parameters: [],\n },\n ],\n },\n state: modeState,\n async handleAction(_runtime, actionId, _argumentsValue, { signal }) {\n if (actionId !== 'activate' && actionId !== 'deactivate')\n throw new Error(`Unknown Help mode action: ${actionId}`);\n await selectMode(actionId === 'activate', signal);\n return { message: active() ? 'Help mode activated.' : 'Help mode deactivated.' };\n },\n }).createOwner(undefined);\n const assertHelpActive = () => {\n host.assertActive(HELP_PACKAGE_SOURCE);\n if (disposed || !active()) throw new Error('Help mode is not active.');\n };\n // Registered only while Help is on: the activity starts with Help and stops when it is withdrawn.\n const selfImproveService = (cordis: PoServerPluginContext['context']) => {\n cordis.inject([PO_CODEMODE_SERVICE], (scoped) => {\n const codemode = readPoCodemode(scoped);\n if (!codemode || !selfImprove) return undefined;\n const namespace = createSelfImproveNamespace({\n sessionId: host.context.sessionId,\n service: selfImprove,\n failures: packageFailures,\n assertActive: assertHelpActive,\n });\n const activity = host.registerActivity({\n when: HELP_WHEN,\n name: 'selfImprove',\n start: () => {\n const registration = codemode.register(HELP_PACKAGE_SOURCE, namespace);\n return () => registration.dispose();\n },\n });\n return () => activity.dispose();\n });\n };\n return {\n services: [serverMinorModes([modeOwner]), ...(selfImprove ? [selfImproveService] : [])],\n resources,\n commands: [command],\n tools: [\n createHelpStatusTool(inspect, (signal) => {\n signal?.throwIfAborted();\n host.assertActive(HELP_PACKAGE_SOURCE);\n if (disposed || !active()) throw new Error('Help mode is not active.');\n return signal ?? new AbortController().signal;\n }),\n ],\n onDispose() {\n disposed = true;\n generation += 1;\n },\n };\n}\n","import { readPoPackageHealth, readPoSelfImprove } from '@agimon-ai/po-core/help';\nimport type { PoServerPluginDefinition, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createHelpServerSession } from '../../../../../services/helpServerSession';\n\nexport default (({ agent, context }): Partial<PoServerSessionPlugin> =>\n agent\n ? createHelpServerSession(agent, () => readPoPackageHealth(context)?.failures() ?? [], readPoSelfImprove(context))\n : {}) satisfies NonNullable<PoServerPluginDefinition['session']>;\n","import { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport runtime from './_lib/runtime.server';\n\nexport default defineRoot((context: PoServerPluginContext) => {\n const value = runtime(context);\n return {\n value,\n services: value.services,\n activities: value.activities,\n onStart: value.onStart,\n onStop: value.onStop,\n onDispose: value.onDispose,\n };\n});\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.commands?.[0],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\n// Present only where the host binds package reload; see createHelpServerSession.\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[5],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[4],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[3],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[0],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[2],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[1],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.tools?.[0],\n { cardinality: 'optional' },\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 commandPoHelp from '../src/extensions/workspaces/sessions/(backend)/command/po-help.server';\nimport resourceCodemodeHowToSelfImprove from '../src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-self-improve.server';\nimport resourcePoDevelopCodemodePlugin from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server';\nimport resourcePoDevelopNativeExtension from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server';\nimport resourcePoHelp from '../src/extensions/workspaces/sessions/(backend)/resource/po-help.server';\nimport resourcePoUseChatgptInstructions from '../src/extensions/workspaces/sessions/(backend)/resource/po-use-chatgpt-instructions.server';\nimport resourcePoUseHelp from '../src/extensions/workspaces/sessions/(backend)/resource/po-use-help.server';\nimport toolHelpStatus from '../src/extensions/workspaces/sessions/(backend)/tool/help_status.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);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-help',\n providerOverrides: composeServerProviderOverrides(rootSession),\n injects: composeRootInjects({ session: [rootSession] }),\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 commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'po-help' }, at(commandPoHelp, contextSession))]); },\n get resources(): PoServerSessionPlugin['resources'] { return defined([at(resourceCodemodeHowToSelfImprove, contextSession), at(resourcePoDevelopCodemodePlugin, contextSession), at(resourcePoDevelopNativeExtension, contextSession), at(resourcePoHelp, contextSession), at(resourcePoUseChatgptInstructions, contextSession), at(resourcePoUseHelp, contextSession)]); },\n get tools(): PoServerSessionPlugin['tools'] { return defined([via({ name: 'help_status' }, at(toolHelpStatus, contextSession))]); },\n services: [...(scopeSession.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;;;AAAA,MAAa,oBAAoB;AACjC,MAAa,2BAA2B;AACxC,MAAa,eAAe;AAC5B,MAAa,sBAAsB;AACnC,MAAa,aAAa;CACxB,MAAM;CACN,aACE;AACJ;AACA,MAAa,gBACX;AACF,MAAa,wBAAwB;AACrC,MAAa,+BACX;AAGF,MAAa,qBAAqB;CAChC,MAAM;CACN,aACE;AACJ;AAEA,MAAa,sBAAsB;CACjC,MAAM;CACN,aACE;AACJ;AAEA,MAAa,oBAAoB;CAC/B,MAAM;CACN,aACE;AACJ;AAEA,MAAa,0BAA0B;CACrC,MAAM;CACN,aACE;AACJ;;;ACpCA,MAAa,uBAAuBA,QAAAA,KAAK,OAAO,CAAC,GAAG,EAAE,sBAAsB,MAAM,CAAC;;;;ACanF,SAAgB,iBACd,UACA,SACA,kBAAqD,CAAC,GACpC;CAClB,MAAM,UAAU,SAAS,aAAa,QAAQ,UAAU,MAAM,MAAM,QAAQ,kBAAkB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D,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,gBAAA,GAAeC,gCAAAA,mBAAAA,CAAmB;CAC7C,MAAM;CACN,oBAAA,GAAmBC,gCAAAA,+BAAAA,CAA+BC,mBAAW;CAC7D,UAAA,GAASC,iCAAAA,mBAAAA,CAAmB,EAAE,SAAS,CAACD,mBAAW,EAAE,CAAC;CACtD,SAAS,OAAO,YAAY;EAC1B,MAAM,eAAe,MAAM,QAAQ,UAAU,WAAWA,qBAAa,OAAO;EAC5E,MAAM,iBAAiB;GAAE,GAAG;GAAS,MAAM,aAAa;EAAM;EAC9D,OAAO;GACL,IAAA,GAAGE,iCAAAA,iBAAAA,CAAiB,YAAY;GAChC,IAAI,WAA8C;IAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,UAAU,GAAG,GAAGC,0BAAe,cAAc,CAAC,CAAC,CAAC;GAAG;GACnI,IAAI,YAAgD;IAAE,OAAO,QAAQ;KAAC,GAAGC,6CAAkC,cAAc;KAAG,GAAGC,2CAAiC,cAAc;KAAG,GAAGC,4CAAkC,cAAc;KAAG,GAAGC,wBAAgB,cAAc;KAAG,GAAGC,4CAAkC,cAAc;KAAG,GAAGC,4BAAmB,cAAc;IAAC,CAAC;GAAG;GAC1W,IAAI,QAAwC;IAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,cAAc,GAAG,GAAGC,4BAAgB,cAAc,CAAC,CAAC,CAAC;GAAG;GAClI,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAkD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACvG;CACF;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";qBAwBa,wDAAY"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { PO_HELP_WHEN } from "@agimon-ai/po-core/help";
|
|
1
|
+
import { PO_HELP_WHEN, readPoPackageHealth, readPoSelfImprove } from "@agimon-ai/po-core/help";
|
|
2
2
|
import { composeServerProviderOverrides, defineServerPlugin, defineTool, packageResourcePath, readPackageResource } from "@agimon-ai/po-core/serverPlugin";
|
|
3
3
|
import { composeRootHooks, composeRootInjects, defineRoot, defineRoutedContribution } from "@agimon-ai/po-core/extensionFile";
|
|
4
|
+
import { PO_CODEMODE_SERVICE, readPoCodemode } from "@agimon-ai/po-core/codemode";
|
|
4
5
|
import { defineMinorMode, serverMinorModes } from "@agimon-ai/po-minor-mode";
|
|
5
6
|
import { Type } from "typebox";
|
|
6
7
|
//#region src/constants/help.ts
|
|
@@ -27,12 +28,17 @@ const HELP_NATIVE_SKILL = {
|
|
|
27
28
|
name: "help-how-to-native-extension",
|
|
28
29
|
description: "Add or change a Po package's phone UI (.native files, native templates) so it mirrors the cockpit, passes the native build, and is approved and verified before it ships."
|
|
29
30
|
};
|
|
31
|
+
const HELP_SELF_IMPROVE_SKILL = {
|
|
32
|
+
name: "codemode-how-to-self-improve",
|
|
33
|
+
description: "Reload Po's own packages after you edit them, without restarting Po or reopening the session. Use in Help mode after changing a plugin's source or build, or after adding or removing a package."
|
|
34
|
+
};
|
|
30
35
|
//#endregion
|
|
31
36
|
//#region src/schemas/diagnostics.ts
|
|
32
37
|
const helpStatusParameters = Type.Object({}, { additionalProperties: false });
|
|
33
38
|
//#endregion
|
|
34
39
|
//#region src/services/helpStatus/index.ts
|
|
35
|
-
|
|
40
|
+
/** `packageFailures`: the host's failed global and workspace packages; they never degrade Help itself. */
|
|
41
|
+
function serverHelpStatus(snapshot, enabled, packageFailures = []) {
|
|
36
42
|
const entries = snapshot.capabilities.filter((entry) => entry.when?.state?.["minor-mode"] === HELP_MODE_ID);
|
|
37
43
|
const skills = entries.filter((entry) => entry.kind === "skill");
|
|
38
44
|
const tools = entries.filter((entry) => entry.kind === "tool");
|
|
@@ -62,7 +68,8 @@ function serverHelpStatus(snapshot, enabled) {
|
|
|
62
68
|
...reason ? { reason } : {}
|
|
63
69
|
})),
|
|
64
70
|
diagnostics: diagnostics.slice(0, 128),
|
|
65
|
-
|
|
71
|
+
packages: enabled ? packageFailures.slice(-128) : [],
|
|
72
|
+
truncated: skills.length > 128 || tools.length > 128 || diagnostics.length > 128 || enabled && packageFailures.length > 128
|
|
66
73
|
};
|
|
67
74
|
}
|
|
68
75
|
function helpStatusDetail(report) {
|
|
@@ -91,15 +98,133 @@ function createHelpStatusTool(inspect, authorize) {
|
|
|
91
98
|
});
|
|
92
99
|
}
|
|
93
100
|
//#endregion
|
|
101
|
+
//#region src/services/selfImproveNamespace/index.ts
|
|
102
|
+
/** Finished operations kept for `operation(id)`; older ones are forgotten first. */
|
|
103
|
+
const MAX_OPERATIONS = 20;
|
|
104
|
+
const SCOPES = [
|
|
105
|
+
"session",
|
|
106
|
+
"workspace",
|
|
107
|
+
"global"
|
|
108
|
+
];
|
|
109
|
+
const AXES = [
|
|
110
|
+
"majorMode",
|
|
111
|
+
"domains",
|
|
112
|
+
"profile"
|
|
113
|
+
];
|
|
114
|
+
const DECLARATIONS = `type Scope = 'session' | 'workspace' | 'global';
|
|
115
|
+
type Axis = 'majorMode' | 'domains' | 'profile';
|
|
116
|
+
interface PackageFailure { scope: string; packageName: string; stage: string; reason: string; previous?: 'restored' | 'lost' | 'none'; at: string }
|
|
117
|
+
interface Operation {
|
|
118
|
+
operationId: string; scope: Scope; axes?: Axis[];
|
|
119
|
+
/** partial: applied, but some packages failed and keep their previous build when they had one. */
|
|
120
|
+
state: 'queued' | 'applied' | 'partial' | 'failed';
|
|
121
|
+
result?: { installed: string[]; removed: string[]; failed: { packageName: string; reason: string }[] };
|
|
122
|
+
error?: string;
|
|
123
|
+
}
|
|
124
|
+
declare const selfImprove: {
|
|
125
|
+
/** Packages whose current build failed to load or install, by scope. */
|
|
126
|
+
plugins(): Promise<{ failures: PackageFailure[] }>;
|
|
127
|
+
/** Queues a reload of one scope's packages from disk; check it with operation() in a later exec. global needs confirm: true, after the person agreed. */
|
|
128
|
+
reload(input: { scope: Scope; confirm?: boolean }): Promise<Operation>;
|
|
129
|
+
/** Queues a re-apply of this session's current major mode, domains or profile (default: all three) after editing their config; check it with operation(). */
|
|
130
|
+
refresh(input?: { axes?: Axis[] }): Promise<Operation>;
|
|
131
|
+
operation(operationId: string): Promise<Operation>;
|
|
132
|
+
};`;
|
|
133
|
+
function createSelfImproveNamespace(options) {
|
|
134
|
+
const operations = /* @__PURE__ */ new Map();
|
|
135
|
+
let next = 0;
|
|
136
|
+
const remember = (operation) => {
|
|
137
|
+
operations.set(operation.operationId, operation);
|
|
138
|
+
for (const id of operations.keys()) {
|
|
139
|
+
if (operations.size <= MAX_OPERATIONS) break;
|
|
140
|
+
if (operations.get(id)?.state !== "queued") operations.delete(id);
|
|
141
|
+
}
|
|
142
|
+
return operation;
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
name: "selfImprove",
|
|
146
|
+
summary: "Reload Po's own packages after editing them, or refresh this session's mode, domains and profile config, without restarting. Help mode, main agent only.",
|
|
147
|
+
declarations: DECLARATIONS,
|
|
148
|
+
bind(run) {
|
|
149
|
+
if (run.sessionId !== options.sessionId) throw new Error("The selfImprove namespace belongs to another session.");
|
|
150
|
+
const check = () => {
|
|
151
|
+
run.signal.throwIfAborted();
|
|
152
|
+
options.assertActive();
|
|
153
|
+
if (run.caller !== "main") throw new Error("Only the main agent may reload or refresh Po.");
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
plugins: async () => {
|
|
157
|
+
check();
|
|
158
|
+
return { failures: JSON.parse(JSON.stringify(options.failures())) };
|
|
159
|
+
},
|
|
160
|
+
reload: async (input) => {
|
|
161
|
+
check();
|
|
162
|
+
const { scope, confirm } = input ?? {};
|
|
163
|
+
if (!SCOPES.includes(scope)) throw new Error("reload needs scope 'session', 'workspace' or 'global'.");
|
|
164
|
+
if (scope === "global" && confirm !== true) throw new Error("A global reload changes every session; ask the person, then pass confirm: true.");
|
|
165
|
+
const operationId = `reload-${String(++next)}`;
|
|
166
|
+
const queued = remember({
|
|
167
|
+
operationId,
|
|
168
|
+
scope,
|
|
169
|
+
state: "queued"
|
|
170
|
+
});
|
|
171
|
+
options.service.reload({
|
|
172
|
+
scope: queued.scope,
|
|
173
|
+
sessionId: options.sessionId
|
|
174
|
+
}).then((result) => remember({
|
|
175
|
+
...queued,
|
|
176
|
+
state: result.failed.length === 0 ? "applied" : "partial",
|
|
177
|
+
result: JSON.parse(JSON.stringify(result))
|
|
178
|
+
}), (error) => remember({
|
|
179
|
+
...queued,
|
|
180
|
+
state: "failed",
|
|
181
|
+
error: error instanceof Error ? error.message : String(error)
|
|
182
|
+
}));
|
|
183
|
+
return { ...queued };
|
|
184
|
+
},
|
|
185
|
+
refresh: async (input) => {
|
|
186
|
+
check();
|
|
187
|
+
const { axes = AXES } = input ?? {};
|
|
188
|
+
if (!Array.isArray(axes) || axes.length === 0 || !axes.every((axis) => AXES.includes(axis))) throw new Error("refresh axes are 'majorMode', 'domains' and 'profile'.");
|
|
189
|
+
const queued = remember({
|
|
190
|
+
operationId: `refresh-${String(++next)}`,
|
|
191
|
+
scope: "session",
|
|
192
|
+
axes: [...new Set(axes)],
|
|
193
|
+
state: "queued"
|
|
194
|
+
});
|
|
195
|
+
options.service.refresh({
|
|
196
|
+
sessionId: options.sessionId,
|
|
197
|
+
axes: queued.axes
|
|
198
|
+
}).then(() => remember({
|
|
199
|
+
...queued,
|
|
200
|
+
state: "applied"
|
|
201
|
+
}), (error) => remember({
|
|
202
|
+
...queued,
|
|
203
|
+
state: "failed",
|
|
204
|
+
error: error instanceof Error ? error.message : String(error)
|
|
205
|
+
}));
|
|
206
|
+
return JSON.parse(JSON.stringify(queued));
|
|
207
|
+
},
|
|
208
|
+
operation: async (operationId) => {
|
|
209
|
+
check();
|
|
210
|
+
const operation = typeof operationId === "string" ? operations.get(operationId) : void 0;
|
|
211
|
+
if (operation === void 0) throw new Error(`No operation '${String(operationId)}'.`);
|
|
212
|
+
return JSON.parse(JSON.stringify(operation));
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
94
219
|
//#region src/services/helpServerSession/index.ts
|
|
95
|
-
function createHelpServerSession(host) {
|
|
220
|
+
function createHelpServerSession(host, packageFailures = () => [], selfImprove) {
|
|
96
221
|
let modeOwner;
|
|
97
222
|
let pending;
|
|
98
223
|
let failure;
|
|
99
224
|
let generation = 0;
|
|
100
225
|
let disposed = false;
|
|
101
226
|
const active = () => (host.context.selection.state?.["minor-mode"] ?? []).includes(HELP_MODE_ID);
|
|
102
|
-
const inspect = () => serverHelpStatus(host.inspectCapabilities(), active());
|
|
227
|
+
const inspect = () => serverHelpStatus(host.inspectCapabilities(), active(), packageFailures());
|
|
103
228
|
const modeState = () => {
|
|
104
229
|
const report = inspect();
|
|
105
230
|
return {
|
|
@@ -167,7 +292,15 @@ function createHelpServerSession(host) {
|
|
|
167
292
|
if (!text.trim()) throw new Error("The installed code-mode plugin skill is missing or unreadable.");
|
|
168
293
|
return text;
|
|
169
294
|
}
|
|
170
|
-
}
|
|
295
|
+
},
|
|
296
|
+
...selfImprove === void 0 ? [] : [{
|
|
297
|
+
when: PO_HELP_WHEN,
|
|
298
|
+
...HELP_SELF_IMPROVE_SKILL,
|
|
299
|
+
kind: "skill",
|
|
300
|
+
pinned: true,
|
|
301
|
+
path: packageResourcePath(import.meta.url, "src/prompts/codemode-how-to-self-improve/SKILL.md"),
|
|
302
|
+
read: () => readPackageResource(import.meta.url, "src/prompts/codemode-how-to-self-improve/SKILL.md")
|
|
303
|
+
}]
|
|
171
304
|
];
|
|
172
305
|
const selectMode = async (enabled, signal) => {
|
|
173
306
|
if (disposed) throw new Error("Help runtime is disposed.");
|
|
@@ -236,8 +369,33 @@ function createHelpServerSession(host) {
|
|
|
236
369
|
return { message: active() ? "Help mode activated." : "Help mode deactivated." };
|
|
237
370
|
}
|
|
238
371
|
}).createOwner(void 0);
|
|
372
|
+
const assertHelpActive = () => {
|
|
373
|
+
host.assertActive(HELP_PACKAGE_SOURCE);
|
|
374
|
+
if (disposed || !active()) throw new Error("Help mode is not active.");
|
|
375
|
+
};
|
|
376
|
+
const selfImproveService = (cordis) => {
|
|
377
|
+
cordis.inject([PO_CODEMODE_SERVICE], (scoped) => {
|
|
378
|
+
const codemode = readPoCodemode(scoped);
|
|
379
|
+
if (!codemode || !selfImprove) return void 0;
|
|
380
|
+
const namespace = createSelfImproveNamespace({
|
|
381
|
+
sessionId: host.context.sessionId,
|
|
382
|
+
service: selfImprove,
|
|
383
|
+
failures: packageFailures,
|
|
384
|
+
assertActive: assertHelpActive
|
|
385
|
+
});
|
|
386
|
+
const activity = host.registerActivity({
|
|
387
|
+
when: PO_HELP_WHEN,
|
|
388
|
+
name: "selfImprove",
|
|
389
|
+
start: () => {
|
|
390
|
+
const registration = codemode.register(HELP_PACKAGE_SOURCE, namespace);
|
|
391
|
+
return () => registration.dispose();
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
return () => activity.dispose();
|
|
395
|
+
});
|
|
396
|
+
};
|
|
239
397
|
return {
|
|
240
|
-
services: [serverMinorModes([modeOwner])],
|
|
398
|
+
services: [serverMinorModes([modeOwner]), ...selfImprove ? [selfImproveService] : []],
|
|
241
399
|
resources,
|
|
242
400
|
commands: [command],
|
|
243
401
|
tools: [createHelpStatusTool(inspect, (signal) => {
|
|
@@ -254,7 +412,7 @@ function createHelpServerSession(host) {
|
|
|
254
412
|
}
|
|
255
413
|
//#endregion
|
|
256
414
|
//#region src/extensions/workspaces/sessions/(backend)/_lib/runtime.server.ts
|
|
257
|
-
var runtime_server_default = (({ agent }) => agent ? createHelpServerSession(agent) : {});
|
|
415
|
+
var runtime_server_default = (({ agent, context }) => agent ? createHelpServerSession(agent, () => readPoPackageHealth(context)?.failures() ?? [], readPoSelfImprove(context)) : {});
|
|
258
416
|
//#endregion
|
|
259
417
|
//#region src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
260
418
|
var root_server_default = defineRoot((context) => {
|
|
@@ -272,6 +430,9 @@ var root_server_default = defineRoot((context) => {
|
|
|
272
430
|
//#region src/extensions/workspaces/sessions/(backend)/command/po-help.server.ts
|
|
273
431
|
var po_help_server_default$1 = defineRoutedContribution((context) => context.root.commands?.[0], { cardinality: "optional" });
|
|
274
432
|
//#endregion
|
|
433
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-self-improve.server.ts
|
|
434
|
+
var codemode_how_to_self_improve_server_default = defineRoutedContribution((context) => context.root.resources?.[5], { cardinality: "optional" });
|
|
435
|
+
//#endregion
|
|
275
436
|
//#region src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server.ts
|
|
276
437
|
var po_develop_codemode_plugin_server_default = defineRoutedContribution((context) => context.root.resources?.[4], { cardinality: "optional" });
|
|
277
438
|
//#endregion
|
|
@@ -315,6 +476,7 @@ const serverPlugin = defineServerPlugin({
|
|
|
315
476
|
},
|
|
316
477
|
get resources() {
|
|
317
478
|
return defined([
|
|
479
|
+
at(codemode_how_to_self_improve_server_default, contextSession),
|
|
318
480
|
at(po_develop_codemode_plugin_server_default, contextSession),
|
|
319
481
|
at(po_develop_native_extension_server_default, contextSession),
|
|
320
482
|
at(po_help_server_default, contextSession),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","names":["HELP_WHEN","HELP_WHEN","runtime","rootSession","commandPoHelp","resourcePoDevelopCodemodePlugin","resourcePoDevelopNativeExtension","resourcePoHelp","resourcePoUseChatgptInstructions","resourcePoUseHelp","toolHelpStatus"],"sources":["../../src/constants/help.ts","../../src/schemas/diagnostics.ts","../../src/services/helpStatus/index.ts","../../src/services/helpServerSession/index.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/runtime.server.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/command/po-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-use-chatgpt-instructions.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-use-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/help_status.server.ts","../../generated/server.ts"],"sourcesContent":["export const HELP_COMMAND_NAME = 'po-help';\nexport const HELP_COMMAND_DESCRIPTION = 'Toggle Help guidance and read-only support diagnostics';\nexport const HELP_MODE_ID = 'help';\nexport const HELP_PACKAGE_SOURCE = '@agimon-ai/po-help';\nexport const HELP_SKILL = {\n name: 'help-how-to-help',\n description:\n 'Set up and debug Po agents using installed package guidance and scoped, read-only diagnostics. Diagnose missing capabilities before proposing authorized repairs.',\n} as const;\nexport const HELP_GUIDANCE =\n 'Help mode is active. Read help-how-to-help, inspect the available diagnostics, and use the narrowest package guidance for the task. Diagnose before proposing changes. Help does not grant additional permissions.';\nexport const HELP_STATUS_TOOL_NAME = 'help_status';\nexport const HELP_STATUS_TOOL_DESCRIPTION =\n 'Inspect active Help skills, diagnostic tools, contributor ownership, and unavailable contributions in this session. Read-only; does not change selection or permissions.';\nexport const HELP_STATUS_LIMIT = 128;\n\nexport const HELP_CHATGPT_SKILL = {\n name: 'help-how-to-chatgpt-instructions',\n description:\n \"Print a paste-ready ChatGPT project instruction (at most 8,000 characters) that routes code-mode work through this session's MCP tools and condenses every AGENTS.md rule. Writes no files.\",\n} as const;\n\nexport const HELP_CODEMODE_SKILL = {\n name: 'help-how-to-codemode-plugin',\n description:\n 'Add code-mode support to a Po package: contribute a namespace to exec and discover, replace the direct tool it supersedes, and ship the skill that teaches agents to use it.',\n} as const;\n\nexport const HELP_NATIVE_SKILL = {\n name: 'help-how-to-native-extension',\n description:\n \"Add or change a Po package's phone UI (.native files, native templates) so it mirrors the cockpit, passes the native build, and is approved and verified before it ships.\",\n} as const;\n","import { Type } from 'typebox';\n\nexport const helpStatusParameters = Type.Object({}, { additionalProperties: false });\n","import type { PoHeadlessCapabilitySnapshot } from '@agimon-ai/po-core/headless';\nimport { PO_HELP_WHEN as HELP_WHEN } from '@agimon-ai/po-core/help';\nimport { defineTool } from '@agimon-ai/po-core/serverPlugin';\n\nimport {\n HELP_GUIDANCE,\n HELP_MODE_ID,\n HELP_STATUS_LIMIT,\n HELP_STATUS_TOOL_DESCRIPTION,\n HELP_STATUS_TOOL_NAME,\n} from '../../constants/help';\nimport { helpStatusParameters } from '../../schemas/diagnostics';\nimport type { HelpStatusReport } from './type';\n\nexport function serverHelpStatus(snapshot: PoHeadlessCapabilitySnapshot, enabled: boolean): HelpStatusReport {\n const entries = snapshot.capabilities.filter((entry) => entry.when?.state?.['minor-mode'] === HELP_MODE_ID);\n const skills = entries.filter((entry) => entry.kind === 'skill');\n const tools = entries.filter((entry) => entry.kind === 'tool');\n const diagnostics = entries\n .filter((entry) => enabled && entry.reason && entry.reason !== 'inactive')\n .map((entry) => ({ source: entry.source, code: `HELP_${entry.reason!.replaceAll('-', '_').toUpperCase()}` }));\n const ready = snapshot.ready;\n return {\n activation: !enabled ? 'inactive' : !ready ? 'activating' : diagnostics.length ? 'degraded' : 'active',\n ready,\n revision: snapshot.revision,\n counts: {\n skills: ready ? skills.filter((entry) => entry.active && entry.discoverable).length : null,\n tools: tools.filter((entry) => entry.active).length,\n },\n skills: skills.slice(0, HELP_STATUS_LIMIT).map(({ name, source, active, discoverable, reason }) => ({\n name,\n source,\n active: active && discoverable,\n ...(reason ? { reason } : {}),\n })),\n tools: tools\n .slice(0, HELP_STATUS_LIMIT)\n .map(({ name, source, active, reason }) => ({ name, source, active, ...(reason ? { reason } : {}) })),\n diagnostics: diagnostics.slice(0, HELP_STATUS_LIMIT),\n truncated:\n skills.length > HELP_STATUS_LIMIT || tools.length > HELP_STATUS_LIMIT || diagnostics.length > HELP_STATUS_LIMIT,\n };\n}\n\nexport function helpStatusDetail(report: HelpStatusReport): string {\n return `${report.counts.skills ?? 'pending'} Help skills, ${report.counts.tools} diagnostic tools${report.diagnostics.length ? ' (diagnostics available)' : ''}`;\n}\n\nexport function createHelpStatusTool(\n inspect: () => HelpStatusReport | Promise<HelpStatusReport>,\n authorize: (signal?: AbortSignal) => AbortSignal,\n) {\n return defineTool({\n name: HELP_STATUS_TOOL_NAME,\n description: HELP_STATUS_TOOL_DESCRIPTION,\n parameters: helpStatusParameters,\n when: HELP_WHEN,\n promptGuidelines: [HELP_GUIDANCE],\n async execute(_input, execution) {\n const signal = authorize(execution.signal);\n const report = await inspect();\n signal.throwIfAborted();\n authorize(execution.signal);\n return { content: [{ type: 'text', text: JSON.stringify(report, null, 2) }], details: report };\n },\n });\n}\n","import type { PoHeadlessCommand, PoHeadlessHostService, PoHeadlessResource } from '@agimon-ai/po-core/headless';\nimport { PO_HELP_WHEN as HELP_WHEN } from '@agimon-ai/po-core/help';\nimport { type PoServerSessionPlugin, packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverPlugin';\nimport { defineMinorMode, serverMinorModes, type MinorModeOwner, type MinorModeState } from '@agimon-ai/po-minor-mode';\n\nimport {\n HELP_COMMAND_DESCRIPTION,\n HELP_COMMAND_NAME,\n HELP_GUIDANCE,\n HELP_MODE_ID,\n HELP_PACKAGE_SOURCE,\n HELP_CHATGPT_SKILL,\n HELP_CODEMODE_SKILL,\n HELP_NATIVE_SKILL,\n HELP_SKILL,\n} from '../../constants/help';\nimport { createHelpStatusTool, helpStatusDetail, serverHelpStatus } from '../helpStatus';\nexport function createHelpServerSession(host: PoHeadlessHostService): PoServerSessionPlugin {\n let modeOwner: MinorModeOwner | undefined;\n let pending: boolean | undefined;\n let failure: string | undefined;\n let generation = 0;\n let disposed = false;\n const active = () => (host.context.selection.state?.['minor-mode'] ?? []).includes(HELP_MODE_ID);\n const inspect = () => serverHelpStatus(host.inspectCapabilities(), active());\n const modeState = (): MinorModeState => {\n const report = inspect();\n return {\n activation: pending === true ? 'activating' : active() ? 'active' : 'inactive',\n condition:\n pending !== undefined || !report.ready\n ? 'queued'\n : failure\n ? 'failed'\n : report.activation === 'degraded'\n ? 'degraded'\n : 'ready',\n ...(pending !== undefined\n ? { detail: 'applying Help capabilities' }\n : failure\n ? { detail: failure }\n : active()\n ? { detail: helpStatusDetail(report) }\n : {}),\n actions: [\n {\n id: 'activate',\n enabled: !active() && pending === undefined,\n ...(!active() && pending === undefined ? {} : { disabledReason: 'Help is active or changing.' }),\n },\n {\n id: 'deactivate',\n enabled: active() || pending === true,\n ...(active() || pending === true ? {} : { disabledReason: 'Help mode is not active.' }),\n },\n ],\n };\n };\n const resources: PoHeadlessResource[] = [\n { when: HELP_WHEN, name: 'po-help', kind: 'context', read: () => HELP_GUIDANCE },\n {\n when: HELP_WHEN,\n ...HELP_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-help/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-help/SKILL.md');\n if (!text.trim()) throw new Error('The installed Help skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_CHATGPT_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-chatgpt-instructions/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(\n import.meta.url,\n 'src/prompts/help-how-to-chatgpt-instructions/SKILL.md',\n );\n if (!text.trim()) throw new Error('The installed ChatGPT instruction skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_NATIVE_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-native-extension/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-native-extension/SKILL.md');\n if (!text.trim()) throw new Error('The installed native extension skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_CODEMODE_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-codemode-plugin/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-codemode-plugin/SKILL.md');\n if (!text.trim()) throw new Error('The installed code-mode plugin skill is missing or unreadable.');\n return text;\n },\n },\n ];\n const selectMode = async (enabled: boolean, signal?: AbortSignal): Promise<void> => {\n if (disposed) throw new Error('Help runtime is disposed.');\n signal?.throwIfAborted();\n const operation = ++generation;\n pending = enabled;\n failure = undefined;\n modeOwner?.publish();\n try {\n if (enabled) await resources[1]!.read(host.context);\n signal?.throwIfAborted();\n if (operation !== generation || disposed) throw new Error('Help activation was cancelled.');\n const modes = (host.context.selection.state?.['minor-mode'] ?? []).filter((mode) => mode !== HELP_MODE_ID);\n await host.changeSelection({\n axis: 'state',\n key: 'minor-mode',\n values: enabled ? [...modes, HELP_MODE_ID] : modes,\n });\n } catch (error) {\n if (operation === generation) failure = (error instanceof Error ? error.message : String(error)).slice(0, 160);\n throw error;\n } finally {\n if (operation === generation) {\n pending = undefined;\n modeOwner?.publish();\n }\n }\n };\n const command: PoHeadlessCommand = {\n name: HELP_COMMAND_NAME,\n description: HELP_COMMAND_DESCRIPTION,\n async execute(_args, execution) {\n await selectMode(!(pending ?? active()));\n await execution.client.notify({\n title: 'Po Help',\n body: active() ? 'Help mode activated.' : 'Help mode deactivated.',\n level: 'info',\n });\n },\n };\n modeOwner = defineMinorMode({\n descriptor: {\n source: HELP_PACKAGE_SOURCE,\n id: HELP_MODE_ID,\n label: 'Help',\n description: 'Package guidance and read-only diagnostics for agent setup and debugging.',\n order: 50,\n actions: [\n {\n id: 'activate',\n label: 'Activate',\n description: 'Expose Help guidance and diagnostic tools.',\n contexts: ['headless'],\n parameters: [],\n },\n {\n id: 'deactivate',\n label: 'Deactivate',\n description: 'Withdraw Help-only guidance and diagnostic tools.',\n contexts: ['headless'],\n parameters: [],\n },\n ],\n },\n state: modeState,\n async handleAction(_runtime, actionId, _argumentsValue, { signal }) {\n if (actionId !== 'activate' && actionId !== 'deactivate')\n throw new Error(`Unknown Help mode action: ${actionId}`);\n await selectMode(actionId === 'activate', signal);\n return { message: active() ? 'Help mode activated.' : 'Help mode deactivated.' };\n },\n }).createOwner(undefined);\n return {\n services: [serverMinorModes([modeOwner])],\n resources,\n commands: [command],\n tools: [\n createHelpStatusTool(inspect, (signal) => {\n signal?.throwIfAborted();\n host.assertActive(HELP_PACKAGE_SOURCE);\n if (disposed || !active()) throw new Error('Help mode is not active.');\n return signal ?? new AbortController().signal;\n }),\n ],\n onDispose() {\n disposed = true;\n generation += 1;\n },\n };\n}\n","import type { PoServerPluginDefinition, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createHelpServerSession } from '../../../../../services/helpServerSession';\n\nexport default (({ agent }): Partial<PoServerSessionPlugin> =>\n agent ? createHelpServerSession(agent) : {}) satisfies NonNullable<PoServerPluginDefinition['session']>;\n","import { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport runtime from './_lib/runtime.server';\n\nexport default defineRoot((context: PoServerPluginContext) => {\n const value = runtime(context);\n return {\n value,\n services: value.services,\n activities: value.activities,\n onStart: value.onStart,\n onStop: value.onStop,\n onDispose: value.onDispose,\n };\n});\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.commands?.[0],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[4],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[3],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[0],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[2],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[1],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.tools?.[0],\n { cardinality: 'optional' },\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 commandPoHelp from '../src/extensions/workspaces/sessions/(backend)/command/po-help.server';\nimport resourcePoDevelopCodemodePlugin from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server';\nimport resourcePoDevelopNativeExtension from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server';\nimport resourcePoHelp from '../src/extensions/workspaces/sessions/(backend)/resource/po-help.server';\nimport resourcePoUseChatgptInstructions from '../src/extensions/workspaces/sessions/(backend)/resource/po-use-chatgpt-instructions.server';\nimport resourcePoUseHelp from '../src/extensions/workspaces/sessions/(backend)/resource/po-use-help.server';\nimport toolHelpStatus from '../src/extensions/workspaces/sessions/(backend)/tool/help_status.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);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-help',\n providerOverrides: composeServerProviderOverrides(rootSession),\n injects: composeRootInjects({ session: [rootSession] }),\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 commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'po-help' }, at(commandPoHelp, contextSession))]); },\n get resources(): PoServerSessionPlugin['resources'] { return defined([at(resourcePoDevelopCodemodePlugin, contextSession), at(resourcePoDevelopNativeExtension, contextSession), at(resourcePoHelp, contextSession), at(resourcePoUseChatgptInstructions, contextSession), at(resourcePoUseHelp, contextSession)]); },\n get tools(): PoServerSessionPlugin['tools'] { return defined([via({ name: 'help_status' }, at(toolHelpStatus, contextSession))]); },\n services: [...(scopeSession.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;AAAA,MAAa,oBAAoB;AACjC,MAAa,2BAA2B;AACxC,MAAa,eAAe;AAC5B,MAAa,sBAAsB;AACnC,MAAa,aAAa;CACxB,MAAM;CACN,aACE;AACJ;AACA,MAAa,gBACX;AACF,MAAa,wBAAwB;AACrC,MAAa,+BACX;AAGF,MAAa,qBAAqB;CAChC,MAAM;CACN,aACE;AACJ;AAEA,MAAa,sBAAsB;CACjC,MAAM;CACN,aACE;AACJ;AAEA,MAAa,oBAAoB;CAC/B,MAAM;CACN,aACE;AACJ;;;AC9BA,MAAa,uBAAuB,KAAK,OAAO,CAAC,GAAG,EAAE,sBAAsB,MAAM,CAAC;;;ACYnF,SAAgB,iBAAiB,UAAwC,SAAoC;CAC3G,MAAM,UAAU,SAAS,aAAa,QAAQ,UAAU,MAAM,MAAM,QAAQ,kBAAkB,YAAY;CAC1G,MAAM,SAAS,QAAQ,QAAQ,UAAU,MAAM,SAAS,OAAO;CAC/D,MAAM,QAAQ,QAAQ,QAAQ,UAAU,MAAM,SAAS,MAAM;CAC7D,MAAM,cAAc,QACjB,QAAQ,UAAU,WAAW,MAAM,UAAU,MAAM,WAAW,UAAU,CAAC,CACzE,KAAK,WAAW;EAAE,QAAQ,MAAM;EAAQ,MAAM,QAAQ,MAAM,OAAQ,WAAW,KAAK,GAAG,CAAC,CAAC,YAAY;CAAI,EAAE;CAC9G,MAAM,QAAQ,SAAS;CACvB,OAAO;EACL,YAAY,CAAC,UAAU,aAAa,CAAC,QAAQ,eAAe,YAAY,SAAS,aAAa;EAC9F;EAC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AS,OAAO,YAAY;EAC1B,MAAM,eAAe,MAAM,QAAQ,UAAU,WAAWA,qBAAa,OAAO;EAC5E,MAAM,iBAAiB;GAAE,GAAG;GAAS,MAAM,aAAa;EAAM;EAC9D,OAAO;GACL,GAAG,iBAAiB,YAAY;GAChC,IAAI,WAA8C;IAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,UAAU,GAAG,GAAGC,0BAAe,cAAc,CAAC,CAAC,CAAC;GAAG;GACnI,IAAI,YAAgD;IAAE,OAAO,QAAQ;KAAC,GAAGC,2CAAiC,cAAc;KAAG,GAAGC,4CAAkC,cAAc;KAAG,GAAGC,wBAAgB,cAAc;KAAG,GAAGC,4CAAkC,cAAc;KAAG,GAAGC,4BAAmB,cAAc;IAAC,CAAC;GAAG;GACpT,IAAI,QAAwC;IAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,cAAc,GAAG,GAAGC,4BAAgB,cAAc,CAAC,CAAC,CAAC;GAAG;GAClI,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.mjs","names":["HELP_WHEN","HELP_WHEN","runtime","rootSession","commandPoHelp","resourceCodemodeHowToSelfImprove","resourcePoDevelopCodemodePlugin","resourcePoDevelopNativeExtension","resourcePoHelp","resourcePoUseChatgptInstructions","resourcePoUseHelp","toolHelpStatus"],"sources":["../../src/constants/help.ts","../../src/schemas/diagnostics.ts","../../src/services/helpStatus/index.ts","../../src/services/selfImproveNamespace/index.ts","../../src/services/helpServerSession/index.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/runtime.server.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/command/po-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-self-improve.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-use-chatgpt-instructions.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-use-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/help_status.server.ts","../../generated/server.ts"],"sourcesContent":["export const HELP_COMMAND_NAME = 'po-help';\nexport const HELP_COMMAND_DESCRIPTION = 'Toggle Help guidance and read-only support diagnostics';\nexport const HELP_MODE_ID = 'help';\nexport const HELP_PACKAGE_SOURCE = '@agimon-ai/po-help';\nexport const HELP_SKILL = {\n name: 'help-how-to-help',\n description:\n 'Set up and debug Po agents using installed package guidance and scoped, read-only diagnostics. Diagnose missing capabilities before proposing authorized repairs.',\n} as const;\nexport const HELP_GUIDANCE =\n 'Help mode is active. Read help-how-to-help, inspect the available diagnostics, and use the narrowest package guidance for the task. Diagnose before proposing changes. Help does not grant additional permissions.';\nexport const HELP_STATUS_TOOL_NAME = 'help_status';\nexport const HELP_STATUS_TOOL_DESCRIPTION =\n 'Inspect active Help skills, diagnostic tools, contributor ownership, and unavailable contributions in this session. Read-only; does not change selection or permissions.';\nexport const HELP_STATUS_LIMIT = 128;\n\nexport const HELP_CHATGPT_SKILL = {\n name: 'help-how-to-chatgpt-instructions',\n description:\n \"Print a paste-ready ChatGPT project instruction (at most 8,000 characters) that routes code-mode work through this session's MCP tools and condenses every AGENTS.md rule. Writes no files.\",\n} as const;\n\nexport const HELP_CODEMODE_SKILL = {\n name: 'help-how-to-codemode-plugin',\n description:\n 'Add code-mode support to a Po package: contribute a namespace to exec and discover, replace the direct tool it supersedes, and ship the skill that teaches agents to use it.',\n} as const;\n\nexport const HELP_NATIVE_SKILL = {\n name: 'help-how-to-native-extension',\n description:\n \"Add or change a Po package's phone UI (.native files, native templates) so it mirrors the cockpit, passes the native build, and is approved and verified before it ships.\",\n} as const;\n\nexport const HELP_SELF_IMPROVE_SKILL = {\n name: 'codemode-how-to-self-improve',\n description:\n \"Reload Po's own packages after you edit them, without restarting Po or reopening the session. Use in Help mode after changing a plugin's source or build, or after adding or removing a package.\",\n} as const;\n","import { Type } from 'typebox';\n\nexport const helpStatusParameters = Type.Object({}, { additionalProperties: false });\n","import type { PoHeadlessCapabilitySnapshot } from '@agimon-ai/po-core/headless';\nimport { PO_HELP_WHEN as HELP_WHEN, type PoPackageFailureRecord } from '@agimon-ai/po-core/help';\nimport { defineTool } from '@agimon-ai/po-core/serverPlugin';\n\nimport {\n HELP_GUIDANCE,\n HELP_MODE_ID,\n HELP_STATUS_LIMIT,\n HELP_STATUS_TOOL_DESCRIPTION,\n HELP_STATUS_TOOL_NAME,\n} from '../../constants/help';\nimport { helpStatusParameters } from '../../schemas/diagnostics';\nimport type { HelpStatusReport } from './type';\n\n/** `packageFailures`: the host's failed global and workspace packages; they never degrade Help itself. */\nexport function serverHelpStatus(\n snapshot: PoHeadlessCapabilitySnapshot,\n enabled: boolean,\n packageFailures: readonly PoPackageFailureRecord[] = [],\n): HelpStatusReport {\n const entries = snapshot.capabilities.filter((entry) => entry.when?.state?.['minor-mode'] === HELP_MODE_ID);\n const skills = entries.filter((entry) => entry.kind === 'skill');\n const tools = entries.filter((entry) => entry.kind === 'tool');\n const diagnostics = entries\n .filter((entry) => enabled && entry.reason && entry.reason !== 'inactive')\n .map((entry) => ({ source: entry.source, code: `HELP_${entry.reason!.replaceAll('-', '_').toUpperCase()}` }));\n const ready = snapshot.ready;\n return {\n activation: !enabled ? 'inactive' : !ready ? 'activating' : diagnostics.length ? 'degraded' : 'active',\n ready,\n revision: snapshot.revision,\n counts: {\n skills: ready ? skills.filter((entry) => entry.active && entry.discoverable).length : null,\n tools: tools.filter((entry) => entry.active).length,\n },\n skills: skills.slice(0, HELP_STATUS_LIMIT).map(({ name, source, active, discoverable, reason }) => ({\n name,\n source,\n active: active && discoverable,\n ...(reason ? { reason } : {}),\n })),\n tools: tools\n .slice(0, HELP_STATUS_LIMIT)\n .map(({ name, source, active, reason }) => ({ name, source, active, ...(reason ? { reason } : {}) })),\n diagnostics: diagnostics.slice(0, HELP_STATUS_LIMIT),\n packages: enabled ? packageFailures.slice(-HELP_STATUS_LIMIT) : [],\n truncated:\n skills.length > HELP_STATUS_LIMIT ||\n tools.length > HELP_STATUS_LIMIT ||\n diagnostics.length > HELP_STATUS_LIMIT ||\n (enabled && packageFailures.length > HELP_STATUS_LIMIT),\n };\n}\n\nexport function helpStatusDetail(report: HelpStatusReport): string {\n return `${report.counts.skills ?? 'pending'} Help skills, ${report.counts.tools} diagnostic tools${report.diagnostics.length ? ' (diagnostics available)' : ''}`;\n}\n\nexport function createHelpStatusTool(\n inspect: () => HelpStatusReport | Promise<HelpStatusReport>,\n authorize: (signal?: AbortSignal) => AbortSignal,\n) {\n return defineTool({\n name: HELP_STATUS_TOOL_NAME,\n description: HELP_STATUS_TOOL_DESCRIPTION,\n parameters: helpStatusParameters,\n when: HELP_WHEN,\n promptGuidelines: [HELP_GUIDANCE],\n async execute(_input, execution) {\n const signal = authorize(execution.signal);\n const report = await inspect();\n signal.throwIfAborted();\n authorize(execution.signal);\n return { content: [{ type: 'text', text: JSON.stringify(report, null, 2) }], details: report };\n },\n });\n}\n","import type { PoCodemodeNamespace } from '@agimon-ai/po-core/codemode';\nimport type { PoHeadlessRefreshAxis } from '@agimon-ai/po-core/headless';\n\nimport type { SelfImproveNamespaceOptions, SelfImproveOperation, SelfImproveScope } from './type';\n\n/** Finished operations kept for `operation(id)`; older ones are forgotten first. */\nconst MAX_OPERATIONS = 20;\nconst SCOPES: readonly SelfImproveScope[] = ['session', 'workspace', 'global'];\nconst AXES: readonly PoHeadlessRefreshAxis[] = ['majorMode', 'domains', 'profile'];\n\nconst DECLARATIONS = `type Scope = 'session' | 'workspace' | 'global';\ntype Axis = 'majorMode' | 'domains' | 'profile';\ninterface PackageFailure { scope: string; packageName: string; stage: string; reason: string; previous?: 'restored' | 'lost' | 'none'; at: string }\ninterface Operation {\n operationId: string; scope: Scope; axes?: Axis[];\n /** partial: applied, but some packages failed and keep their previous build when they had one. */\n state: 'queued' | 'applied' | 'partial' | 'failed';\n result?: { installed: string[]; removed: string[]; failed: { packageName: string; reason: string }[] };\n error?: string;\n}\ndeclare const selfImprove: {\n /** Packages whose current build failed to load or install, by scope. */\n plugins(): Promise<{ failures: PackageFailure[] }>;\n /** Queues a reload of one scope's packages from disk; check it with operation() in a later exec. global needs confirm: true, after the person agreed. */\n reload(input: { scope: Scope; confirm?: boolean }): Promise<Operation>;\n /** Queues a re-apply of this session's current major mode, domains or profile (default: all three) after editing their config; check it with operation(). */\n refresh(input?: { axes?: Axis[] }): Promise<Operation>;\n operation(operationId: string): Promise<Operation>;\n};`;\n\nexport function createSelfImproveNamespace(options: SelfImproveNamespaceOptions): PoCodemodeNamespace {\n const operations = new Map<string, SelfImproveOperation>();\n let next = 0;\n const remember = (operation: SelfImproveOperation): SelfImproveOperation => {\n operations.set(operation.operationId, operation);\n for (const id of operations.keys()) {\n if (operations.size <= MAX_OPERATIONS) break;\n if (operations.get(id)?.state !== 'queued') operations.delete(id);\n }\n return operation;\n };\n return {\n name: 'selfImprove',\n summary:\n \"Reload Po's own packages after editing them, or refresh this session's mode, domains and profile config, without restarting. Help mode, main agent only.\",\n declarations: DECLARATIONS,\n bind(run) {\n if (run.sessionId !== options.sessionId) throw new Error('The selfImprove namespace belongs to another session.');\n const check = () => {\n run.signal.throwIfAborted();\n options.assertActive();\n if (run.caller !== 'main') throw new Error('Only the main agent may reload or refresh Po.');\n };\n return {\n plugins: async () => {\n check();\n return { failures: JSON.parse(JSON.stringify(options.failures())) as unknown };\n },\n reload: async (input: unknown) => {\n check();\n const { scope, confirm } = (input ?? {}) as { scope?: unknown; confirm?: unknown };\n if (!SCOPES.includes(scope as SelfImproveScope))\n throw new Error(\"reload needs scope 'session', 'workspace' or 'global'.\");\n if (scope === 'global' && confirm !== true)\n throw new Error('A global reload changes every session; ask the person, then pass confirm: true.');\n const operationId = `reload-${String(++next)}`;\n const queued = remember({ operationId, scope: scope as SelfImproveScope, state: 'queued' });\n // Not awaited: a session reload waits for this tool round to end.\n void options.service.reload({ scope: queued.scope, sessionId: options.sessionId }).then(\n (result) =>\n remember({\n ...queued,\n state: result.failed.length === 0 ? 'applied' : 'partial',\n result: JSON.parse(JSON.stringify(result)) as SelfImproveOperation['result'],\n }),\n (error: unknown) =>\n remember({ ...queued, state: 'failed', error: error instanceof Error ? error.message : String(error) }),\n );\n return { ...queued };\n },\n refresh: async (input: unknown) => {\n check();\n const { axes = AXES } = (input ?? {}) as { axes?: unknown };\n if (\n !Array.isArray(axes) ||\n axes.length === 0 ||\n !axes.every((axis) => AXES.includes(axis as PoHeadlessRefreshAxis))\n )\n throw new Error(\"refresh axes are 'majorMode', 'domains' and 'profile'.\");\n const queued = remember({\n operationId: `refresh-${String(++next)}`,\n scope: 'session',\n axes: [...new Set(axes as PoHeadlessRefreshAxis[])],\n state: 'queued',\n });\n // Not awaited: the refresh waits for this tool round to end.\n void options.service.refresh({ sessionId: options.sessionId, axes: queued.axes! }).then(\n () => remember({ ...queued, state: 'applied' }),\n (error: unknown) =>\n remember({ ...queued, state: 'failed', error: error instanceof Error ? error.message : String(error) }),\n );\n return JSON.parse(JSON.stringify(queued)) as SelfImproveOperation;\n },\n operation: async (operationId: unknown) => {\n check();\n const operation = typeof operationId === 'string' ? operations.get(operationId) : undefined;\n if (operation === undefined) throw new Error(`No operation '${String(operationId)}'.`);\n return JSON.parse(JSON.stringify(operation)) as SelfImproveOperation;\n },\n };\n },\n };\n}\n","import { PO_CODEMODE_SERVICE, readPoCodemode } from '@agimon-ai/po-core/codemode';\nimport type { PoHeadlessCommand, PoHeadlessHostService, PoHeadlessResource } from '@agimon-ai/po-core/headless';\nimport { PO_HELP_WHEN as HELP_WHEN, type PoPackageFailureRecord, type PoSelfImprove } from '@agimon-ai/po-core/help';\nimport {\n type PoServerPluginContext,\n type PoServerSessionPlugin,\n packageResourcePath,\n readPackageResource,\n} from '@agimon-ai/po-core/serverPlugin';\nimport { defineMinorMode, serverMinorModes, type MinorModeOwner, type MinorModeState } from '@agimon-ai/po-minor-mode';\n\nimport {\n HELP_COMMAND_DESCRIPTION,\n HELP_COMMAND_NAME,\n HELP_GUIDANCE,\n HELP_MODE_ID,\n HELP_PACKAGE_SOURCE,\n HELP_CHATGPT_SKILL,\n HELP_CODEMODE_SKILL,\n HELP_NATIVE_SKILL,\n HELP_SELF_IMPROVE_SKILL,\n HELP_SKILL,\n} from '../../constants/help';\nimport { createHelpStatusTool, helpStatusDetail, serverHelpStatus } from '../helpStatus';\nimport { createSelfImproveNamespace } from '../selfImproveNamespace';\nexport function createHelpServerSession(\n host: PoHeadlessHostService,\n packageFailures: () => readonly PoPackageFailureRecord[] = () => [],\n /** The host's package reload; without it (edge, tests) Help offers no selfImprove namespace. */\n selfImprove?: PoSelfImprove,\n): PoServerSessionPlugin {\n let modeOwner: MinorModeOwner | undefined;\n let pending: boolean | undefined;\n let failure: string | undefined;\n let generation = 0;\n let disposed = false;\n const active = () => (host.context.selection.state?.['minor-mode'] ?? []).includes(HELP_MODE_ID);\n const inspect = () => serverHelpStatus(host.inspectCapabilities(), active(), packageFailures());\n const modeState = (): MinorModeState => {\n const report = inspect();\n return {\n activation: pending === true ? 'activating' : active() ? 'active' : 'inactive',\n condition:\n pending !== undefined || !report.ready\n ? 'queued'\n : failure\n ? 'failed'\n : report.activation === 'degraded'\n ? 'degraded'\n : 'ready',\n ...(pending !== undefined\n ? { detail: 'applying Help capabilities' }\n : failure\n ? { detail: failure }\n : active()\n ? { detail: helpStatusDetail(report) }\n : {}),\n actions: [\n {\n id: 'activate',\n enabled: !active() && pending === undefined,\n ...(!active() && pending === undefined ? {} : { disabledReason: 'Help is active or changing.' }),\n },\n {\n id: 'deactivate',\n enabled: active() || pending === true,\n ...(active() || pending === true ? {} : { disabledReason: 'Help mode is not active.' }),\n },\n ],\n };\n };\n const resources: PoHeadlessResource[] = [\n { when: HELP_WHEN, name: 'po-help', kind: 'context', read: () => HELP_GUIDANCE },\n {\n when: HELP_WHEN,\n ...HELP_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-help/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-help/SKILL.md');\n if (!text.trim()) throw new Error('The installed Help skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_CHATGPT_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-chatgpt-instructions/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(\n import.meta.url,\n 'src/prompts/help-how-to-chatgpt-instructions/SKILL.md',\n );\n if (!text.trim()) throw new Error('The installed ChatGPT instruction skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_NATIVE_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-native-extension/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-native-extension/SKILL.md');\n if (!text.trim()) throw new Error('The installed native extension skill is missing or unreadable.');\n return text;\n },\n },\n {\n when: HELP_WHEN,\n ...HELP_CODEMODE_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-codemode-plugin/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-codemode-plugin/SKILL.md');\n if (!text.trim()) throw new Error('The installed code-mode plugin skill is missing or unreadable.');\n return text;\n },\n },\n // Pinned like every code-mode guide, but listed only where the host can reload and Help is on.\n ...(selfImprove === undefined\n ? []\n : [\n {\n when: HELP_WHEN,\n ...HELP_SELF_IMPROVE_SKILL,\n kind: 'skill' as const,\n pinned: true,\n path: packageResourcePath(import.meta.url, 'src/prompts/codemode-how-to-self-improve/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/codemode-how-to-self-improve/SKILL.md'),\n },\n ]),\n ];\n const selectMode = async (enabled: boolean, signal?: AbortSignal): Promise<void> => {\n if (disposed) throw new Error('Help runtime is disposed.');\n signal?.throwIfAborted();\n const operation = ++generation;\n pending = enabled;\n failure = undefined;\n modeOwner?.publish();\n try {\n if (enabled) await resources[1]!.read(host.context);\n signal?.throwIfAborted();\n if (operation !== generation || disposed) throw new Error('Help activation was cancelled.');\n const modes = (host.context.selection.state?.['minor-mode'] ?? []).filter((mode) => mode !== HELP_MODE_ID);\n await host.changeSelection({\n axis: 'state',\n key: 'minor-mode',\n values: enabled ? [...modes, HELP_MODE_ID] : modes,\n });\n } catch (error) {\n if (operation === generation) failure = (error instanceof Error ? error.message : String(error)).slice(0, 160);\n throw error;\n } finally {\n if (operation === generation) {\n pending = undefined;\n modeOwner?.publish();\n }\n }\n };\n const command: PoHeadlessCommand = {\n name: HELP_COMMAND_NAME,\n description: HELP_COMMAND_DESCRIPTION,\n async execute(_args, execution) {\n await selectMode(!(pending ?? active()));\n await execution.client.notify({\n title: 'Po Help',\n body: active() ? 'Help mode activated.' : 'Help mode deactivated.',\n level: 'info',\n });\n },\n };\n modeOwner = defineMinorMode({\n descriptor: {\n source: HELP_PACKAGE_SOURCE,\n id: HELP_MODE_ID,\n label: 'Help',\n description: 'Package guidance and read-only diagnostics for agent setup and debugging.',\n order: 50,\n actions: [\n {\n id: 'activate',\n label: 'Activate',\n description: 'Expose Help guidance and diagnostic tools.',\n contexts: ['headless'],\n parameters: [],\n },\n {\n id: 'deactivate',\n label: 'Deactivate',\n description: 'Withdraw Help-only guidance and diagnostic tools.',\n contexts: ['headless'],\n parameters: [],\n },\n ],\n },\n state: modeState,\n async handleAction(_runtime, actionId, _argumentsValue, { signal }) {\n if (actionId !== 'activate' && actionId !== 'deactivate')\n throw new Error(`Unknown Help mode action: ${actionId}`);\n await selectMode(actionId === 'activate', signal);\n return { message: active() ? 'Help mode activated.' : 'Help mode deactivated.' };\n },\n }).createOwner(undefined);\n const assertHelpActive = () => {\n host.assertActive(HELP_PACKAGE_SOURCE);\n if (disposed || !active()) throw new Error('Help mode is not active.');\n };\n // Registered only while Help is on: the activity starts with Help and stops when it is withdrawn.\n const selfImproveService = (cordis: PoServerPluginContext['context']) => {\n cordis.inject([PO_CODEMODE_SERVICE], (scoped) => {\n const codemode = readPoCodemode(scoped);\n if (!codemode || !selfImprove) return undefined;\n const namespace = createSelfImproveNamespace({\n sessionId: host.context.sessionId,\n service: selfImprove,\n failures: packageFailures,\n assertActive: assertHelpActive,\n });\n const activity = host.registerActivity({\n when: HELP_WHEN,\n name: 'selfImprove',\n start: () => {\n const registration = codemode.register(HELP_PACKAGE_SOURCE, namespace);\n return () => registration.dispose();\n },\n });\n return () => activity.dispose();\n });\n };\n return {\n services: [serverMinorModes([modeOwner]), ...(selfImprove ? [selfImproveService] : [])],\n resources,\n commands: [command],\n tools: [\n createHelpStatusTool(inspect, (signal) => {\n signal?.throwIfAborted();\n host.assertActive(HELP_PACKAGE_SOURCE);\n if (disposed || !active()) throw new Error('Help mode is not active.');\n return signal ?? new AbortController().signal;\n }),\n ],\n onDispose() {\n disposed = true;\n generation += 1;\n },\n };\n}\n","import { readPoPackageHealth, readPoSelfImprove } from '@agimon-ai/po-core/help';\nimport type { PoServerPluginDefinition, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createHelpServerSession } from '../../../../../services/helpServerSession';\n\nexport default (({ agent, context }): Partial<PoServerSessionPlugin> =>\n agent\n ? createHelpServerSession(agent, () => readPoPackageHealth(context)?.failures() ?? [], readPoSelfImprove(context))\n : {}) satisfies NonNullable<PoServerPluginDefinition['session']>;\n","import { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport runtime from './_lib/runtime.server';\n\nexport default defineRoot((context: PoServerPluginContext) => {\n const value = runtime(context);\n return {\n value,\n services: value.services,\n activities: value.activities,\n onStart: value.onStart,\n onStop: value.onStop,\n onDispose: value.onDispose,\n };\n});\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.commands?.[0],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\n// Present only where the host binds package reload; see createHelpServerSession.\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[5],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[4],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[3],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[0],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[2],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[1],\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.tools?.[0],\n { cardinality: 'optional' },\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 commandPoHelp from '../src/extensions/workspaces/sessions/(backend)/command/po-help.server';\nimport resourceCodemodeHowToSelfImprove from '../src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-self-improve.server';\nimport resourcePoDevelopCodemodePlugin from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server';\nimport resourcePoDevelopNativeExtension from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server';\nimport resourcePoHelp from '../src/extensions/workspaces/sessions/(backend)/resource/po-help.server';\nimport resourcePoUseChatgptInstructions from '../src/extensions/workspaces/sessions/(backend)/resource/po-use-chatgpt-instructions.server';\nimport resourcePoUseHelp from '../src/extensions/workspaces/sessions/(backend)/resource/po-use-help.server';\nimport toolHelpStatus from '../src/extensions/workspaces/sessions/(backend)/tool/help_status.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);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-help',\n providerOverrides: composeServerProviderOverrides(rootSession),\n injects: composeRootInjects({ session: [rootSession] }),\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 commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'po-help' }, at(commandPoHelp, contextSession))]); },\n get resources(): PoServerSessionPlugin['resources'] { return defined([at(resourceCodemodeHowToSelfImprove, contextSession), at(resourcePoDevelopCodemodePlugin, contextSession), at(resourcePoDevelopNativeExtension, contextSession), at(resourcePoHelp, contextSession), at(resourcePoUseChatgptInstructions, contextSession), at(resourcePoUseHelp, contextSession)]); },\n get tools(): PoServerSessionPlugin['tools'] { return defined([via({ name: 'help_status' }, at(toolHelpStatus, contextSession))]); },\n services: [...(scopeSession.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;AAAA,MAAa,oBAAoB;AACjC,MAAa,2BAA2B;AACxC,MAAa,eAAe;AAC5B,MAAa,sBAAsB;AACnC,MAAa,aAAa;CACxB,MAAM;CACN,aACE;AACJ;AACA,MAAa,gBACX;AACF,MAAa,wBAAwB;AACrC,MAAa,+BACX;AAGF,MAAa,qBAAqB;CAChC,MAAM;CACN,aACE;AACJ;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AG;GAClI,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAkD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACvG;CACF;AACF,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -14,3 +14,4 @@ Activation-gated, package-owned guidance for Po Pi parent sessions.
|
|
|
14
14
|
|
|
15
15
|
- [help-how-to-native-extension](./src/prompts/help-how-to-native-extension/SKILL.md): Add phone UI to a Po package that mirrors the cockpit, then approve and verify it.
|
|
16
16
|
- [help-how-to-codemode-plugin](./src/prompts/help-how-to-codemode-plugin/SKILL.md): Add code-mode support to a Po package: a namespace, the tool it replaces, and the skill that teaches agents to use it.
|
|
17
|
+
- [codemode-how-to-self-improve](./src/prompts/codemode-how-to-self-improve/SKILL.md): In Help mode, reload Po's own packages after editing them, without restarting Po or reopening the session.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-help",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.43",
|
|
4
4
|
"description": "Activation-gated package guidance and help skills for Po and Pi extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-documentation",
|
|
@@ -58,16 +58,16 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
62
|
-
"@agimon-ai/po-minor-mode": "0.0.0-alpha.
|
|
63
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
61
|
+
"@agimon-ai/po-core": "0.0.0-alpha.43",
|
|
62
|
+
"@agimon-ai/po-minor-mode": "0.0.0-alpha.43",
|
|
63
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.43",
|
|
64
64
|
"@deepseek-ai/cordis": "4.0.5",
|
|
65
65
|
"typebox": "1.4.2"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
69
|
-
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.
|
|
70
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
68
|
+
"@agimon-ai/po-build": "0.0.0-alpha.43",
|
|
69
|
+
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.43",
|
|
70
|
+
"@earendil-works/pi-coding-agent": "1.4.0",
|
|
71
71
|
"@types/node": "26.6.5",
|
|
72
72
|
"@types/react": "19.3.0",
|
|
73
73
|
"@vitest/coverage-v8": "5.0.4",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"vitest": "5.0.4"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
81
|
+
"@earendil-works/pi-coding-agent": "1.4.0"
|
|
82
82
|
},
|
|
83
83
|
"peerDependenciesMeta": {
|
|
84
84
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codemode-how-to-self-improve
|
|
3
|
+
description: "Reload Po's own packages, or refresh this session's mode, domain and profile config, after you edit them, without restarting Po or reopening the session. Use in Help mode after changing a plugin, adding or removing a package, or editing modes.yaml, a domain or a profile."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Reload Po packages with `selfImprove`
|
|
7
|
+
|
|
8
|
+
`selfImprove` exists only in Help mode, only for the main agent, and only on hosts that can reload (not the edge). Run `discover({ namespace: 'selfImprove' })` for signatures.
|
|
9
|
+
|
|
10
|
+
## Where to work
|
|
11
|
+
|
|
12
|
+
- Develop and test plugins in **workspace** scope. A workspace reload touches only this workspace's sessions.
|
|
13
|
+
- Leave global plugin files alone unless the person asked. Po already picks up saved changes to them, so an edit there reaches every session at once.
|
|
14
|
+
- A reload loads what is on disk. Build the package first; `selfImprove` never runs `npm install` or a build.
|
|
15
|
+
|
|
16
|
+
## Reloading
|
|
17
|
+
|
|
18
|
+
1. `selfImprove.reload({ scope })` returns `{ operationId, state: 'queued' }` at once. A session reload applies after the current tool round ends, so do not wait for it in the same `exec`.
|
|
19
|
+
2. In a later `exec`, read `selfImprove.operation(operationId)`:
|
|
20
|
+
- `applied`: every package installed. Installed packages no longer declared were removed (`result.removed`).
|
|
21
|
+
- `partial`: some packages failed (`result.failed`) and keep their previous build when they had one.
|
|
22
|
+
- `failed`: nothing changed; `error` says why.
|
|
23
|
+
3. The model sees new tools on its next request. Old tool handles from before the reload are refused.
|
|
24
|
+
|
|
25
|
+
`scope: 'global'` changes every session. Ask the person first (for example with `ask_user_question`), and pass `confirm: true` only after they agree. Without it the call is refused and nothing is queued.
|
|
26
|
+
|
|
27
|
+
## Refreshing config
|
|
28
|
+
|
|
29
|
+
After editing `modes.yaml`, a domain, or a profile's env or binding, call `selfImprove.refresh({ axes })` with any of `'majorMode'`, `'domains'`, `'profile'` (default: all three). It re-applies the session's current names from disk, so no rename or reopen is needed. It is queued like a reload and applies after the current tool round; read `operation(operationId)` in a later `exec`. A `profile` refresh reconnects its secret provider.
|
|
30
|
+
|
|
31
|
+
Domain code-mode scripts load once when the session opens; a new or changed domain script needs the session reopened.
|
|
32
|
+
|
|
33
|
+
## Checking health
|
|
34
|
+
|
|
35
|
+
`selfImprove.plugins()` lists packages whose current build failed to load or install, by scope, with the reason and whether the previous build still runs. Read it before and after a reload instead of guessing from missing tools.
|
|
36
|
+
|
|
37
|
+
## Mistakes to avoid
|
|
38
|
+
|
|
39
|
+
- Calling it from a subagent: refused. Do the reload in the main agent.
|
|
40
|
+
- Retrying in a loop: one failure means fix the code or build, then reload once.
|
|
41
|
+
- Presenting a restart as a reload: if a change needs a restart (provider overrides, MCP plugins), tell the person and let them reopen the session.
|
|
@@ -11,7 +11,7 @@ Use this when a Po package should be driven from code mode: a `name` global in e
|
|
|
11
11
|
|
|
12
12
|
Every package that contributes a namespace ships a skill that teaches an agent to use it. The namespace carries types and one-line reference. The skill carries judgement: when to use it, ordering, what it refuses and why, and the mistakes to avoid. A namespace without a skill is half shipped.
|
|
13
13
|
|
|
14
|
-
Package how-to guides have two roles, gated differently. A code-mode guide teaches agents to use a plugin through `exec`. Code mode is always available, so its `codemode-how-to-<plugin>` guide carries `pinned: true`, no `when` gate, and is always active. Its summary stays in the system prompt, outside the `load_skill` catalog and `search_skills`; the full body still loads by exact name. Read the base `how-to-codemode` guide first. A `help-how-to-<plugin>` guide, such as this one, teaches how to maintain or modify a plugin, and is gated on Help mode (`when: PO_HELP_WHEN`). Help guides and all other skills remain searchable. Never gate a code-mode guide behind Help.
|
|
14
|
+
Package how-to guides have two roles, gated differently. A code-mode guide teaches agents to use a plugin through `exec`. Code mode is always available, so its `codemode-how-to-<plugin>` guide carries `pinned: true`, no `when` gate, and is always active. A namespace offered only in one mode gates its guide on that mode instead: `selfImprove` on `PO_HELP_WHEN`, and the `computer` namespace on the `computer-use` minor-mode condition. Its summary stays in the system prompt, outside the `load_skill` catalog and `search_skills`; the full body still loads by exact name. Read the base `how-to-codemode` guide first. A `help-how-to-<plugin>` guide, such as this one, teaches how to maintain or modify a plugin, and is gated on Help mode (`when: PO_HELP_WHEN`). Help guides and all other skills remain searchable. Never gate a code-mode guide behind Help.
|
|
15
15
|
|
|
16
16
|
## Contribute the namespace
|
|
17
17
|
|