@agimon-ai/po-help 0.0.0-alpha.83 → 0.0.0-alpha.85
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 +21 -2
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +21 -2
- package/dist/extensions/server.mjs.map +1 -1
- package/llms.txt +1 -0
- package/package.json +8 -8
- package/src/prompts/help-how-to-dashboard-extension/SKILL.md +86 -0
- package/src/prompts/help-how-to-native-extension/SKILL.md +11 -1
|
@@ -32,6 +32,10 @@ const HELP_NATIVE_SKILL = {
|
|
|
32
32
|
name: "help-how-to-native-extension",
|
|
33
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."
|
|
34
34
|
};
|
|
35
|
+
const HELP_DASHBOARD_SKILL = {
|
|
36
|
+
name: "help-how-to-dashboard-extension",
|
|
37
|
+
description: "Add plugin sections to Home and Workspace pages with dashboard-tiles on web and native. Choose global or workspace scope, supply tile presentation and navigation, and migrate legacy home-apps cards."
|
|
38
|
+
};
|
|
35
39
|
const HELP_SELF_IMPROVE_SKILL = {
|
|
36
40
|
name: "codemode-how-to-self-improve",
|
|
37
41
|
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."
|
|
@@ -333,7 +337,18 @@ function createHelpServerSession(host, packageFailures = () => [], selfImprove)
|
|
|
333
337
|
pinned: true,
|
|
334
338
|
path: (0, _agimon_ai_po_core_serverPlugin.packageResourcePath)(require("url").pathToFileURL(__filename).href, "src/prompts/codemode-how-to-self-improve/SKILL.md"),
|
|
335
339
|
read: () => (0, _agimon_ai_po_core_serverPlugin.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/codemode-how-to-self-improve/SKILL.md")
|
|
336
|
-
}]
|
|
340
|
+
}],
|
|
341
|
+
{
|
|
342
|
+
when: _agimon_ai_po_core_help.PO_HELP_WHEN,
|
|
343
|
+
...HELP_DASHBOARD_SKILL,
|
|
344
|
+
kind: "skill",
|
|
345
|
+
path: (0, _agimon_ai_po_core_serverPlugin.packageResourcePath)(require("url").pathToFileURL(__filename).href, "src/prompts/help-how-to-dashboard-extension/SKILL.md"),
|
|
346
|
+
read: async () => {
|
|
347
|
+
const text = await (0, _agimon_ai_po_core_serverPlugin.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/help-how-to-dashboard-extension/SKILL.md");
|
|
348
|
+
if (!text.trim()) throw new Error("The installed dashboard extension skill is missing or unreadable.");
|
|
349
|
+
return text;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
337
352
|
];
|
|
338
353
|
const selectMode = async (enabled, signal) => {
|
|
339
354
|
if (disposed) throw new Error("Help runtime is disposed.");
|
|
@@ -465,11 +480,14 @@ var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)((cont
|
|
|
465
480
|
var po_help_server_default$1 = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)((context) => context.root.commands?.[0], { cardinality: "optional" });
|
|
466
481
|
//#endregion
|
|
467
482
|
//#region src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-self-improve.server.ts
|
|
468
|
-
var codemode_how_to_self_improve_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)((context) => context.root.resources?.
|
|
483
|
+
var codemode_how_to_self_improve_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)((context) => context.root.resources?.find((resource) => resource.name === "codemode-how-to-self-improve"), { cardinality: "optional" });
|
|
469
484
|
//#endregion
|
|
470
485
|
//#region src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server.ts
|
|
471
486
|
var po_develop_codemode_plugin_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)((context) => context.root.resources?.[4], { cardinality: "optional" });
|
|
472
487
|
//#endregion
|
|
488
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/po-develop-dashboard-extension.server.ts
|
|
489
|
+
var po_develop_dashboard_extension_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)((context) => context.root.resources?.find((resource) => resource.name === "help-how-to-dashboard-extension"), { cardinality: "optional" });
|
|
490
|
+
//#endregion
|
|
473
491
|
//#region src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server.ts
|
|
474
492
|
var po_develop_native_extension_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)((context) => context.root.resources?.[3], { cardinality: "optional" });
|
|
475
493
|
//#endregion
|
|
@@ -512,6 +530,7 @@ const serverPlugin = (0, _agimon_ai_po_core_serverPlugin.defineServerPlugin)({
|
|
|
512
530
|
return defined([
|
|
513
531
|
at(codemode_how_to_self_improve_server_default, contextSession),
|
|
514
532
|
at(po_develop_codemode_plugin_server_default, contextSession),
|
|
533
|
+
at(po_develop_dashboard_extension_server_default, contextSession),
|
|
515
534
|
at(po_develop_native_extension_server_default, contextSession),
|
|
516
535
|
at(po_help_server_default, contextSession),
|
|
517
536
|
at(po_use_chatgpt_instructions_server_default, contextSession),
|
|
@@ -1 +1 @@
|
|
|
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'];\nconst OUTCOME_MESSAGE_TYPE = 'po-help/self-improve';\n\n/** One line the agent can pass on to the person without calling operation(). */\nfunction describeOutcome(operation: SelfImproveOperation): string {\n const what = operation.axes\n ? `Refresh ${operation.operationId} (${operation.axes.join(', ')})`\n : `Reload ${operation.operationId} (${operation.scope} scope)`;\n const tell = 'Tell the person the outcome.';\n if (operation.state === 'failed')\n return `${what} failed, nothing changed: ${(operation.error ?? 'unknown error').replace(/\\.$/u, '')}. ${tell}`;\n const result = operation.result;\n const parts = [\n result?.installed.length ? `installed ${result.installed.join(', ')}` : '',\n result?.removed.length ? `removed ${result.removed.join(', ')}` : '',\n result?.failed.length\n ? `failed ${result.failed.map((item) => `${item.packageName} (${item.reason})`).join(', ')}, which keep their previous build`\n : '',\n ].filter(Boolean);\n return `${what} ${operation.state}${parts.length ? `: ${parts.join('; ')}` : ''}. ${tell}`;\n}\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 /** Why the outcome follow-up could not reach you, when it did not. */\n undelivered?: 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. When it finishes you get a follow-up message with the outcome; operation() returns it too. 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; reports its outcome like reload. */\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 // The agent hears the outcome on its own instead of being asked whether a queued reload worked.\n const finish = (operation: SelfImproveOperation) => {\n remember(operation);\n void Promise.resolve(\n options.admitMessage?.(\n { type: OUTCOME_MESSAGE_TYPE, text: describeOutcome(operation), display: true },\n 'followUp',\n ),\n ).catch((error: unknown) => {\n // A session closed mid-reload cannot take the message; operation(id) reports the outcome and why it was not sent.\n remember({ ...operation, undelivered: error instanceof Error ? error.message : String(error) });\n });\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 finish({\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 finish({ ...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 () => finish({ ...queued, state: 'applied' }),\n (error: unknown) =>\n finish({ ...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 admitMessage: host.context.session.admitMessage?.bind(host.context.session),\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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":["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","defineRoutedContribution","defineServerPlugin","composeServerProviderOverrides","rootSession","composeRootInjects","composeRootHooks","commandPoHelp","resourceCodemodeHowToSelfImprove","resourcePoDevelopCodemodePlugin","resourcePoDevelopDashboardExtension","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-dashboard-extension.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_DASHBOARD_SKILL = {\n name: 'help-how-to-dashboard-extension',\n description:\n 'Add plugin sections to Home and Workspace pages with dashboard-tiles on web and native. Choose global or workspace scope, supply tile presentation and navigation, and migrate legacy home-apps cards.',\n} as const;\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'];\nconst OUTCOME_MESSAGE_TYPE = 'po-help/self-improve';\n\n/** One line the agent can pass on to the person without calling operation(). */\nfunction describeOutcome(operation: SelfImproveOperation): string {\n const what = operation.axes\n ? `Refresh ${operation.operationId} (${operation.axes.join(', ')})`\n : `Reload ${operation.operationId} (${operation.scope} scope)`;\n const tell = 'Tell the person the outcome.';\n if (operation.state === 'failed')\n return `${what} failed, nothing changed: ${(operation.error ?? 'unknown error').replace(/\\.$/u, '')}. ${tell}`;\n const result = operation.result;\n const parts = [\n result?.installed.length ? `installed ${result.installed.join(', ')}` : '',\n result?.removed.length ? `removed ${result.removed.join(', ')}` : '',\n result?.failed.length\n ? `failed ${result.failed.map((item) => `${item.packageName} (${item.reason})`).join(', ')}, which keep their previous build`\n : '',\n ].filter(Boolean);\n return `${what} ${operation.state}${parts.length ? `: ${parts.join('; ')}` : ''}. ${tell}`;\n}\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 /** Why the outcome follow-up could not reach you, when it did not. */\n undelivered?: 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. When it finishes you get a follow-up message with the outcome; operation() returns it too. 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; reports its outcome like reload. */\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 // The agent hears the outcome on its own instead of being asked whether a queued reload worked.\n const finish = (operation: SelfImproveOperation) => {\n remember(operation);\n void Promise.resolve(\n options.admitMessage?.(\n { type: OUTCOME_MESSAGE_TYPE, text: describeOutcome(operation), display: true },\n 'followUp',\n ),\n ).catch((error: unknown) => {\n // A session closed mid-reload cannot take the message; operation(id) reports the outcome and why it was not sent.\n remember({ ...operation, undelivered: error instanceof Error ? error.message : String(error) });\n });\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 finish({\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 finish({ ...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 () => finish({ ...queued, state: 'applied' }),\n (error: unknown) =>\n finish({ ...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_DASHBOARD_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 when: HELP_WHEN,\n ...HELP_DASHBOARD_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-dashboard-extension/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-dashboard-extension/SKILL.md');\n if (!text.trim()) throw new Error('The installed dashboard extension 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 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 admitMessage: host.context.session.admitMessage?.bind(host.context.session),\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>>) =>\n context.root.resources?.find((resource) => resource.name === 'codemode-how-to-self-improve'),\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>>) =>\n context.root.resources?.find((resource) => resource.name === 'help-how-to-dashboard-extension'),\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 resourcePoDevelopDashboardExtension from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-dashboard-extension.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(resourcePoDevelopDashboardExtension, 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,MA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AAG;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,+CAAqC,cAAc;KAAG,GAAGC,4CAAkC,cAAc;KAAG,GAAGC,wBAAgB,cAAc;KAAG,GAAGC,4CAAkC,cAAc;KAAG,GAAGC,4BAAmB,cAAc;IAAC,CAAC;GAAG;GACna,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":";qBAyBa,wDAAY"}
|
|
@@ -28,6 +28,10 @@ const HELP_NATIVE_SKILL = {
|
|
|
28
28
|
name: "help-how-to-native-extension",
|
|
29
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."
|
|
30
30
|
};
|
|
31
|
+
const HELP_DASHBOARD_SKILL = {
|
|
32
|
+
name: "help-how-to-dashboard-extension",
|
|
33
|
+
description: "Add plugin sections to Home and Workspace pages with dashboard-tiles on web and native. Choose global or workspace scope, supply tile presentation and navigation, and migrate legacy home-apps cards."
|
|
34
|
+
};
|
|
31
35
|
const HELP_SELF_IMPROVE_SKILL = {
|
|
32
36
|
name: "codemode-how-to-self-improve",
|
|
33
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."
|
|
@@ -329,7 +333,18 @@ function createHelpServerSession(host, packageFailures = () => [], selfImprove)
|
|
|
329
333
|
pinned: true,
|
|
330
334
|
path: packageResourcePath(import.meta.url, "src/prompts/codemode-how-to-self-improve/SKILL.md"),
|
|
331
335
|
read: () => readPackageResource(import.meta.url, "src/prompts/codemode-how-to-self-improve/SKILL.md")
|
|
332
|
-
}]
|
|
336
|
+
}],
|
|
337
|
+
{
|
|
338
|
+
when: PO_HELP_WHEN,
|
|
339
|
+
...HELP_DASHBOARD_SKILL,
|
|
340
|
+
kind: "skill",
|
|
341
|
+
path: packageResourcePath(import.meta.url, "src/prompts/help-how-to-dashboard-extension/SKILL.md"),
|
|
342
|
+
read: async () => {
|
|
343
|
+
const text = await readPackageResource(import.meta.url, "src/prompts/help-how-to-dashboard-extension/SKILL.md");
|
|
344
|
+
if (!text.trim()) throw new Error("The installed dashboard extension skill is missing or unreadable.");
|
|
345
|
+
return text;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
333
348
|
];
|
|
334
349
|
const selectMode = async (enabled, signal) => {
|
|
335
350
|
if (disposed) throw new Error("Help runtime is disposed.");
|
|
@@ -461,11 +476,14 @@ var root_server_default = defineRoot((context) => {
|
|
|
461
476
|
var po_help_server_default$1 = defineRoutedContribution((context) => context.root.commands?.[0], { cardinality: "optional" });
|
|
462
477
|
//#endregion
|
|
463
478
|
//#region src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-self-improve.server.ts
|
|
464
|
-
var codemode_how_to_self_improve_server_default = defineRoutedContribution((context) => context.root.resources?.
|
|
479
|
+
var codemode_how_to_self_improve_server_default = defineRoutedContribution((context) => context.root.resources?.find((resource) => resource.name === "codemode-how-to-self-improve"), { cardinality: "optional" });
|
|
465
480
|
//#endregion
|
|
466
481
|
//#region src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server.ts
|
|
467
482
|
var po_develop_codemode_plugin_server_default = defineRoutedContribution((context) => context.root.resources?.[4], { cardinality: "optional" });
|
|
468
483
|
//#endregion
|
|
484
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/po-develop-dashboard-extension.server.ts
|
|
485
|
+
var po_develop_dashboard_extension_server_default = defineRoutedContribution((context) => context.root.resources?.find((resource) => resource.name === "help-how-to-dashboard-extension"), { cardinality: "optional" });
|
|
486
|
+
//#endregion
|
|
469
487
|
//#region src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server.ts
|
|
470
488
|
var po_develop_native_extension_server_default = defineRoutedContribution((context) => context.root.resources?.[3], { cardinality: "optional" });
|
|
471
489
|
//#endregion
|
|
@@ -508,6 +526,7 @@ const serverPlugin = defineServerPlugin({
|
|
|
508
526
|
return defined([
|
|
509
527
|
at(codemode_how_to_self_improve_server_default, contextSession),
|
|
510
528
|
at(po_develop_codemode_plugin_server_default, contextSession),
|
|
529
|
+
at(po_develop_dashboard_extension_server_default, contextSession),
|
|
511
530
|
at(po_develop_native_extension_server_default, contextSession),
|
|
512
531
|
at(po_help_server_default, contextSession),
|
|
513
532
|
at(po_use_chatgpt_instructions_server_default, contextSession),
|
|
@@ -1 +1 @@
|
|
|
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'];\nconst OUTCOME_MESSAGE_TYPE = 'po-help/self-improve';\n\n/** One line the agent can pass on to the person without calling operation(). */\nfunction describeOutcome(operation: SelfImproveOperation): string {\n const what = operation.axes\n ? `Refresh ${operation.operationId} (${operation.axes.join(', ')})`\n : `Reload ${operation.operationId} (${operation.scope} scope)`;\n const tell = 'Tell the person the outcome.';\n if (operation.state === 'failed')\n return `${what} failed, nothing changed: ${(operation.error ?? 'unknown error').replace(/\\.$/u, '')}. ${tell}`;\n const result = operation.result;\n const parts = [\n result?.installed.length ? `installed ${result.installed.join(', ')}` : '',\n result?.removed.length ? `removed ${result.removed.join(', ')}` : '',\n result?.failed.length\n ? `failed ${result.failed.map((item) => `${item.packageName} (${item.reason})`).join(', ')}, which keep their previous build`\n : '',\n ].filter(Boolean);\n return `${what} ${operation.state}${parts.length ? `: ${parts.join('; ')}` : ''}. ${tell}`;\n}\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 /** Why the outcome follow-up could not reach you, when it did not. */\n undelivered?: 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. When it finishes you get a follow-up message with the outcome; operation() returns it too. 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; reports its outcome like reload. */\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 // The agent hears the outcome on its own instead of being asked whether a queued reload worked.\n const finish = (operation: SelfImproveOperation) => {\n remember(operation);\n void Promise.resolve(\n options.admitMessage?.(\n { type: OUTCOME_MESSAGE_TYPE, text: describeOutcome(operation), display: true },\n 'followUp',\n ),\n ).catch((error: unknown) => {\n // A session closed mid-reload cannot take the message; operation(id) reports the outcome and why it was not sent.\n remember({ ...operation, undelivered: error instanceof Error ? error.message : String(error) });\n });\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 finish({\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 finish({ ...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 () => finish({ ...queued, state: 'applied' }),\n (error: unknown) =>\n finish({ ...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 admitMessage: host.context.session.admitMessage?.bind(host.context.session),\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,uBAAuB,KAAK,OAAO,CAAC,GAAG,EAAE,sBA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B,UAAU,KAAA,CAAS;AAC1D,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,eAAe,mBAAmB;CAC7C,MAAM;CACN,mBAAmB,+BAA+BC,mBAAW;CAC7D,SAAS,mBAAmB,EAAE,SAAS,CAACA,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,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,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
|
+
{"version":3,"file":"server.mjs","names":["HELP_WHEN","HELP_WHEN","runtime","rootSession","commandPoHelp","resourceCodemodeHowToSelfImprove","resourcePoDevelopCodemodePlugin","resourcePoDevelopDashboardExtension","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-dashboard-extension.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_DASHBOARD_SKILL = {\n name: 'help-how-to-dashboard-extension',\n description:\n 'Add plugin sections to Home and Workspace pages with dashboard-tiles on web and native. Choose global or workspace scope, supply tile presentation and navigation, and migrate legacy home-apps cards.',\n} as const;\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'];\nconst OUTCOME_MESSAGE_TYPE = 'po-help/self-improve';\n\n/** One line the agent can pass on to the person without calling operation(). */\nfunction describeOutcome(operation: SelfImproveOperation): string {\n const what = operation.axes\n ? `Refresh ${operation.operationId} (${operation.axes.join(', ')})`\n : `Reload ${operation.operationId} (${operation.scope} scope)`;\n const tell = 'Tell the person the outcome.';\n if (operation.state === 'failed')\n return `${what} failed, nothing changed: ${(operation.error ?? 'unknown error').replace(/\\.$/u, '')}. ${tell}`;\n const result = operation.result;\n const parts = [\n result?.installed.length ? `installed ${result.installed.join(', ')}` : '',\n result?.removed.length ? `removed ${result.removed.join(', ')}` : '',\n result?.failed.length\n ? `failed ${result.failed.map((item) => `${item.packageName} (${item.reason})`).join(', ')}, which keep their previous build`\n : '',\n ].filter(Boolean);\n return `${what} ${operation.state}${parts.length ? `: ${parts.join('; ')}` : ''}. ${tell}`;\n}\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 /** Why the outcome follow-up could not reach you, when it did not. */\n undelivered?: 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. When it finishes you get a follow-up message with the outcome; operation() returns it too. 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; reports its outcome like reload. */\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 // The agent hears the outcome on its own instead of being asked whether a queued reload worked.\n const finish = (operation: SelfImproveOperation) => {\n remember(operation);\n void Promise.resolve(\n options.admitMessage?.(\n { type: OUTCOME_MESSAGE_TYPE, text: describeOutcome(operation), display: true },\n 'followUp',\n ),\n ).catch((error: unknown) => {\n // A session closed mid-reload cannot take the message; operation(id) reports the outcome and why it was not sent.\n remember({ ...operation, undelivered: error instanceof Error ? error.message : String(error) });\n });\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 finish({\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 finish({ ...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 () => finish({ ...queued, state: 'applied' }),\n (error: unknown) =>\n finish({ ...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_DASHBOARD_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 when: HELP_WHEN,\n ...HELP_DASHBOARD_SKILL,\n kind: 'skill',\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-dashboard-extension/SKILL.md'),\n read: async () => {\n const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-dashboard-extension/SKILL.md');\n if (!text.trim()) throw new Error('The installed dashboard extension 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 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 admitMessage: host.context.session.admitMessage?.bind(host.context.session),\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>>) =>\n context.root.resources?.find((resource) => resource.name === 'codemode-how-to-self-improve'),\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>>) =>\n context.root.resources?.find((resource) => resource.name === 'help-how-to-dashboard-extension'),\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 resourcePoDevelopDashboardExtension from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-dashboard-extension.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(resourcePoDevelopDashboardExtension, 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,uBAAuB;CAClC,MAAM;CACN,aACE;AACJ;AACA,MAAa,0BAA0B;CACrC,MAAM;CACN,aACE;AACJ;;;ACzCA,MAAa,uBAAuB,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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O,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACvG;CACF;AACF,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -12,6 +12,7 @@ Activation-gated, package-owned guidance for Po Pi parent sessions.
|
|
|
12
12
|
|
|
13
13
|
- [help-how-to-chatgpt-instructions](./src/prompts/help-how-to-chatgpt-instructions/SKILL.md): Print paste-ready code-mode instructions with all repository rules.
|
|
14
14
|
|
|
15
|
+
- [help-how-to-dashboard-extension](./src/prompts/help-how-to-dashboard-extension/SKILL.md): Add Home and Workspace page tiles on web and native, choose scope and navigation, and migrate legacy home-apps cards.
|
|
15
16
|
- [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
17
|
- [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
18
|
- [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.85",
|
|
4
4
|
"description": "Activation-gated package guidance and help skills for Po and Pi extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-documentation",
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
65
|
-
"@agimon-ai/po-minor-mode": "0.0.0-alpha.
|
|
66
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
64
|
+
"@agimon-ai/po-core": "0.0.0-alpha.85",
|
|
65
|
+
"@agimon-ai/po-minor-mode": "0.0.0-alpha.85",
|
|
66
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.85",
|
|
67
67
|
"@deepseek-ai/cordis": "4.0.5",
|
|
68
68
|
"typebox": "1.4.2"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
72
|
-
"@agimon-ai/po-native-components": "0.0.0-alpha.
|
|
73
|
-
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.
|
|
71
|
+
"@agimon-ai/po-build": "0.0.0-alpha.85",
|
|
72
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.85",
|
|
73
|
+
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.85",
|
|
74
74
|
"@earendil-works/pi-coding-agent": "1.4.0",
|
|
75
75
|
"@types/node": "26.6.5",
|
|
76
76
|
"@types/react": "19.3.0",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"vitest": "5.0.4"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@agimon-ai/po-native-components": "0.0.0-alpha.
|
|
88
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.85",
|
|
89
89
|
"@earendil-works/pi-coding-agent": "1.4.0",
|
|
90
90
|
"react-native": "0.88.0",
|
|
91
91
|
"react-native-unistyles": "^3.5.3"
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: help-how-to-dashboard-extension
|
|
3
|
+
description: Add plugin sections to Home and Workspace pages with dashboard-tiles on web and native. Choose global or workspace scope, supply tile presentation and navigation, and migrate legacy home-apps cards.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Extend Home and Workspace pages
|
|
7
|
+
|
|
8
|
+
Use `dashboard-tiles` fills for plugin sections on Home (`/`) and Workspace
|
|
9
|
+
(`/workspace/<workspaceId>`). This is a shared web and native contract, not a session activity
|
|
10
|
+
slot. For phone build setup and platform restrictions, load
|
|
11
|
+
[help-how-to-native-extension](../help-how-to-native-extension/SKILL.md).
|
|
12
|
+
|
|
13
|
+
## Choose the owning scope
|
|
14
|
+
|
|
15
|
+
- **Home:** put the fill under `src/extensions/(frontend)/fill/`. Home reads global fills only,
|
|
16
|
+
regardless of the focused session or workspace. Global tiles default to `surfaces: ['home']`.
|
|
17
|
+
- **One workspace:** put it under `src/extensions/workspaces/(frontend)/fill/`. It belongs to
|
|
18
|
+
that workspace's composition, not `workspaces/sessions/`. The Workspace page passes its
|
|
19
|
+
explicit `workspaceId`; do not infer it from the focused session.
|
|
20
|
+
- **A global tile on Workspace pages too:** set `data.surfaces: ['home', 'workspace']`.
|
|
21
|
+
For Workspace pages only, use `['workspace']`. This filters global tiles; workspace-owned
|
|
22
|
+
tiles stay with their workspace and never become global Home tiles through `surfaces`.
|
|
23
|
+
|
|
24
|
+
A Workspace page merges eligible global tiles with that workspace's own tiles. The same
|
|
25
|
+
`(pluginId, id)` at workspace scope replaces its global tile there. Other workspaces' and
|
|
26
|
+
session-scoped fills are not included. Tiles sort by `order`, then plugin id, then fill id.
|
|
27
|
+
|
|
28
|
+
## Contribute a body, not a card shell
|
|
29
|
+
|
|
30
|
+
For example, `src/extensions/(frontend)/fill/Overview.dashboard-tiles.web.tsx`:
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { defineFill } from '@agimon-ai/po-core/web';
|
|
34
|
+
|
|
35
|
+
import { OverviewBody } from './_components/OverviewBody';
|
|
36
|
+
|
|
37
|
+
export default defineFill({
|
|
38
|
+
slot: 'dashboard-tiles',
|
|
39
|
+
id: 'overview',
|
|
40
|
+
order: 10,
|
|
41
|
+
data: { version: 1, title: 'Overview', size: 'wide', surfaces: ['home', 'workspace'] },
|
|
42
|
+
component: OverviewBody,
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Ship the matching `.native.tsx` fill with `defineFill` from `@agimon-ai/po-core/native`,
|
|
47
|
+
the same identity and presentation, and a native body. Use existing components and design
|
|
48
|
+
tokens; write deterministic stories and obtain approval before implementing visual changes.
|
|
49
|
+
The host draws the frame, title, optional icon and navigation affordance. The body supplies
|
|
50
|
+
content only, including its own loading, empty and failure states.
|
|
51
|
+
|
|
52
|
+
Presentation requires `data.version: 1` and a non-empty `title`. Optional `size` is `small`
|
|
53
|
+
(the default), `wide`, `tall` or `large`; these are host layout hints, not pixel dimensions.
|
|
54
|
+
Optional `column: 'main' | 'side'` places web tiles in independent 2:1 desktop columns;
|
|
55
|
+
phone layouts use a natural-height stack, and native preserves fill order rather than columns.
|
|
56
|
+
`icon` uses the component/object contract, not an icon-name string. A malformed presentation
|
|
57
|
+
or missing body is rejected with an install diagnostic.
|
|
58
|
+
|
|
59
|
+
For a host-rendered navigation action, set `data.open: { kind: 'page', id: '<page-fill-id>' }`
|
|
60
|
+
or `{ kind: 'settings', id: '<section-id>' }` and provide the matching destination. Use slot
|
|
61
|
+
props such as `openPage`, `openSettings` and `openWorkspace` for body actions rather than
|
|
62
|
+
hardcoding host routes. When the body has a labeled navigation action, omit `data.open` to
|
|
63
|
+
avoid duplicating that action in the host header. A `page` fill is the full destination,
|
|
64
|
+
not a dashboard section. Native `EmptyState` fills its parent by default; use
|
|
65
|
+
`style={{ flex: 0, flexBasis: 'auto' }}` when embedding it in a content-sized tile.
|
|
66
|
+
|
|
67
|
+
## Keep data ownership explicit
|
|
68
|
+
|
|
69
|
+
These surfaces have no active session. Use global or workspace backend capabilities matching
|
|
70
|
+
the fill's owner, not a session channel borrowed from whichever conversation is focused.
|
|
71
|
+
For workspace metadata, load `help-how-to-config`: resolve the explicit workspace id through
|
|
72
|
+
the backend's injected `po/workspace-registry`, validate the fields your plugin consumes,
|
|
73
|
+
and use that workspace's injected services. The browser does not parse `.po/workspaces.yaml`,
|
|
74
|
+
and the registry is not a cross-workspace service locator.
|
|
75
|
+
|
|
76
|
+
## Legacy cards and verification
|
|
77
|
+
|
|
78
|
+
`home-apps` remains compatibility for full Home cards; use `dashboard-tiles` for new sections.
|
|
79
|
+
Publishing any new global Home tile suppresses all legacy Home cards from that plugin, so
|
|
80
|
+
migrate its cards together. `data.column` controls web placement, not tile size.
|
|
81
|
+
The `home` data slot is separate: it feeds native Needs your eye entries, not tile bodies.
|
|
82
|
+
|
|
83
|
+
Run the package's lint, typecheck, build and tests. Verify Home and two distinct Workspace
|
|
84
|
+
pages, including a switch of focused session, to catch scope leakage. Render web and native
|
|
85
|
+
stories, and report source checks, rendered appearance and runtime verification separately.
|
|
86
|
+
Do not claim rendered or device behavior from source checks alone.
|
|
@@ -54,7 +54,17 @@ export default defineNativeTemplate({
|
|
|
54
54
|
|
|
55
55
|
`sessions` receives `{ workspaces, openSession }` with the cockpit rail's data. The app keeps pairing, navigation, tabs, headers and Home. `native.template` in `.po/config.yaml` selects a layout; otherwise the app's bundled Advanced is used. A screen that throws falls back to the built-in one.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
## Home and Workspace tiles
|
|
58
|
+
|
|
59
|
+
For plugin sections on Home or `/workspace/<workspaceId>`, load
|
|
60
|
+
[help-how-to-dashboard-extension](../help-how-to-dashboard-extension/SKILL.md).
|
|
61
|
+
Use a body-only `fill/<Name>.dashboard-tiles.native.tsx` with a matching `.web.tsx` contribution.
|
|
62
|
+
The host owns the tile frame, heading, size and navigation affordance. Put presentation in
|
|
63
|
+
`data: { version: 1, title, size, open }`; do not draw another card shell inside the body.
|
|
64
|
+
|
|
65
|
+
`home-apps` is legacy compatibility for full Home cards, not the API for new tiles or workspace
|
|
66
|
+
sections. Its web `data.column` hint is ignored on native. A plugin publishing new Home tiles
|
|
67
|
+
suppresses that plugin's legacy Home cards; migrate all of its cards together.
|
|
58
68
|
|
|
59
69
|
## Design, approve, verify
|
|
60
70
|
|