@agimon-ai/po-ui 0.0.0-alpha.36 → 0.0.0-alpha.38
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.
|
@@ -41,9 +41,11 @@ function createUiServerContributions() {
|
|
|
41
41
|
name: TOOLS_COMMAND,
|
|
42
42
|
description: "Show tools observed in this headless session. TUI rendering remains unavailable.",
|
|
43
43
|
async execute(_args, execution) {
|
|
44
|
+
const names = /* @__PURE__ */ new Set();
|
|
45
|
+
for await (const entry of execution.session.entriesNewestFirst({ type: "message" })) for (const name of toolNames([entry])) names.add(name);
|
|
44
46
|
await execution.client.notify({
|
|
45
47
|
title: "Po tools",
|
|
46
|
-
body:
|
|
48
|
+
body: [...names].sort().join("\n") || "(no tool calls recorded in this session)",
|
|
47
49
|
level: "info"
|
|
48
50
|
});
|
|
49
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","names":["defineServerCommand","createWriteToolDefinition","createWriteTool","toPoHeadlessToolResult","createFindToolDefinition","createFindTool","createLsToolDefinition","createLsTool","defineServerTool","defineServerTool","defineServerTool","defineServerPlugin","commandTools","toolFind","toolLs","toolWrite"],"sources":["../../src/constants/ui.ts","../../src/services/sessionToolInventory/index.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/sessionInventory.ts","../../src/extensions/workspaces/sessions/(backend)/command/tools.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/serverFileTools.ts","../../src/extensions/workspaces/sessions/(backend)/tool/find.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/ls.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/write.server.ts","../../generated/server.ts"],"sourcesContent":["export const LEADER_WIDGET_KEY = 'po-leader';\nexport const TUI_MODE = 'tui';\nexport const WIDGET_PLACEMENT = 'belowEditor';\nexport const WARNING_STYLE = 'warning';\nexport const THEME_ENVIRONMENT_KEY = 'PO_THEME';\nexport const HOTKEYS_COMMAND = 'hotkeys';\nexport const TOOLS_COMMAND = 'tools';\nexport const CONFIG_COMMAND = 'config';\nexport const SESSION_START_EVENT = 'session_start';\nexport const SESSION_MESSAGE_ENTRY = 'message';\nexport const INPUT_EVENT = 'input';\nexport const INTERACTIVE_INPUT_SOURCE = 'interactive';\nexport const TITLE_MESSAGE_MAX_LENGTH = 64;\nexport const TITLE_PREFIX = 'po';\nexport const BUILTIN_LEADER_COMMANDS: readonly string[] = [HOTKEYS_COMMAND];\nexport const PACKAGE_SOURCE = '@agimon-ai/po-ui';\n","export function toolNames(entries: readonly Record<string, unknown>[]): string[] {\n const names = new Set<string>();\n for (const entry of entries) {\n const message = entry.message;\n if (!message || typeof message !== 'object' || Array.isArray(message)) continue;\n const content = (message as { content?: unknown }).content;\n if (!Array.isArray(content)) continue;\n for (const block of content) {\n if (!block || typeof block !== 'object' || Array.isArray(block)) continue;\n const name = (block as { name?: unknown }).name;\n if (typeof name === 'string' && name) names.add(name);\n }\n }\n return [...names].sort();\n}\n","import type { PoHeadlessCommand } from '@agimon-ai/po-core/headless';\nimport type { PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport { TOOLS_COMMAND } from '../../../../../constants/ui';\nimport { toolNames } from '../../../../../services/sessionToolInventory';\n\n/**\n * The TUI shell itself stays Pi-only. Inventory is the shared part and is exposed\n * from session data rather than silently installing a fake editor/widget host.\n *\n * Inventory is a command, never a context resource. It reports the tools observed\n * in the transcript, which is not the tool surface the current selection exposes:\n * as a prompt section it listed tools the session had since gated out, directly\n * contradicting the `Available tools:` block, and it grew for the whole session.\n */\nexport function createUiServerContributions(): PoServerSessionPlugin {\n return {\n commands: [\n {\n name: TOOLS_COMMAND,\n description: 'Show tools observed in this headless session. TUI rendering remains unavailable.',\n async execute(_args, execution) {\n await execution.client.notify({\n title: 'Po tools',\n body:\n toolNames(await execution.session.entries({ type: 'message' })).join('\\n') ||\n '(no tool calls recorded in this session)',\n level: 'info',\n });\n },\n } satisfies PoHeadlessCommand,\n ],\n };\n}\n","import { defineServerCommand } from '@agimon-ai/po-core/extensionFile';\n\nimport { createUiServerContributions } from '../_lib/sessionInventory';\n\nexport default defineServerCommand(createUiServerContributions().commands![0]!);\n","import { toPoHeadlessToolResult, type PoHeadlessTool } from '@agimon-ai/po-core/headless';\nimport {\n createWriteToolDefinition,\n createWriteTool,\n createFindToolDefinition,\n createFindTool,\n createLsToolDefinition,\n createLsTool,\n} from '@earendil-works/pi-coding-agent';\n\n// Preserve the SDK schemas and prompt guidance, but never import terminal renderers\n// into Po's native tool declarations. Execution resolves cwd for each call, including\n// a child session or a session whose working directory differs from process.cwd().\n\nexport function createServerWriteTool(): PoHeadlessTool<ReturnType<typeof createWriteToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createWriteToolDefinition('.');\n return {\n name: 'write',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createWriteTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n\nexport function createServerFindTool(): PoHeadlessTool<ReturnType<typeof createFindToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createFindToolDefinition('.');\n return {\n name: 'find',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createFindTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n\nexport function createServerLsTool(): PoHeadlessTool<ReturnType<typeof createLsToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createLsToolDefinition('.');\n return {\n name: 'ls',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createLsTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerFindTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerFindTool);\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerLsTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerLsTool);\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerWriteTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerWriteTool);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport commandTools from '../src/extensions/workspaces/sessions/(backend)/command/tools.server';\nimport toolFind from '../src/extensions/workspaces/sessions/(backend)/tool/find.server';\nimport toolLs from '../src/extensions/workspaces/sessions/(backend)/tool/ls.server';\nimport toolWrite from '../src/extensions/workspaces/sessions/(backend)/tool/write.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;\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-ui',\n session: (context) => ({\n get commands(): PoServerSessionPlugin['commands'] { return [via({ name: 'tools' }, at(commandTools, context))]; },\n get tools(): PoServerSessionPlugin['tools'] { return [via({ name: 'find' }, at(toolFind, context)), via({ name: 'ls' }, at(toolLs, context)), via({ name: 'write' }, at(toolWrite, context))]; },\n }),\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;AAMA,MAAa,gBAAgB;;;ACN7B,SAAgB,UAAU,SAAuD;CAC/E,MAAM,wBAAQ,IAAI,IAAY;CAC9B,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,UAAU,MAAM;EACtB,IAAI,CAAC,WAAW,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG;EACvE,MAAM,UAAW,QAAkC;EACnD,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;EAC7B,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG;GACjE,MAAM,OAAQ,MAA6B;GAC3C,IAAI,OAAO,SAAS,YAAY,MAAM,MAAM,IAAI,IAAI;EACtD;CACF;CACA,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK;AACzB;;;;;;;;;;;;ACCA,SAAgB,8BAAqD;CACnE,OAAO,EACL,UAAU,CACR;EACE,MAAM;EACN,aAAa;EACb,MAAM,QAAQ,OAAO,WAAW;GAC9B,MAAM,UAAU,OAAO,OAAO;IAC5B,OAAO;IACP,MACE,UAAU,MAAM,UAAU,QAAQ,QAAQ,EAAE,MAAM,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,KACzE;IACF,OAAO;GACT,CAAC;EACH;CACF,CACF,EACF;AACF;;;AC7BA,IAAA,wBAAA,GAAeA,iCAAAA,oBAAAA,CAAoB,4BAA4B,CAAC,CAAC,SAAU,EAAG;;;ACU9E,SAAgB,wBAAoG;CAClH,MAAM,EAAE,OAAO,aAAa,YAAY,eAAe,sBAAA,GAAqBC,gCAAAA,0BAAAA,CAA0B,GAAG;CACzG,OAAO;EACL,MAAM;EACN;EACA;EACA;EACA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CAA+C,kBAAkB;;;ACAhF,IAAA,wBAAA,GAAeC,iCAAAA,iBAAAA,CAA+C,qBAAqB;;;ACInF,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,gBAAA,GAAeC,gCAAAA,mBAAAA,CAAmB;CAC7C,MAAM;CACN,UAAU,aAAa;EACrB,IAAI,WAA8C;GAAE,OAAO,CAAC,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGC,sBAAc,OAAO,CAAC,CAAC;EAAG;EAChH,IAAI,QAAwC;GAAE,OAAO;IAAC,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,qBAAU,OAAO,CAAC;IAAG,IAAI,EAAE,MAAM,KAAK,GAAG,GAAGC,mBAAQ,OAAO,CAAC;IAAG,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGC,sBAAW,OAAO,CAAC;GAAC;EAAG;CACjM;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.cjs","names":["defineServerCommand","createWriteToolDefinition","createWriteTool","toPoHeadlessToolResult","createFindToolDefinition","createFindTool","createLsToolDefinition","createLsTool","defineServerTool","defineServerTool","defineServerTool","defineServerPlugin","commandTools","toolFind","toolLs","toolWrite"],"sources":["../../src/constants/ui.ts","../../src/services/sessionToolInventory/index.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/sessionInventory.ts","../../src/extensions/workspaces/sessions/(backend)/command/tools.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/serverFileTools.ts","../../src/extensions/workspaces/sessions/(backend)/tool/find.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/ls.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/write.server.ts","../../generated/server.ts"],"sourcesContent":["export const LEADER_WIDGET_KEY = 'po-leader';\nexport const TUI_MODE = 'tui';\nexport const WIDGET_PLACEMENT = 'belowEditor';\nexport const WARNING_STYLE = 'warning';\nexport const THEME_ENVIRONMENT_KEY = 'PO_THEME';\nexport const HOTKEYS_COMMAND = 'hotkeys';\nexport const TOOLS_COMMAND = 'tools';\nexport const CONFIG_COMMAND = 'config';\nexport const SESSION_START_EVENT = 'session_start';\nexport const SESSION_MESSAGE_ENTRY = 'message';\nexport const INPUT_EVENT = 'input';\nexport const INTERACTIVE_INPUT_SOURCE = 'interactive';\nexport const TITLE_MESSAGE_MAX_LENGTH = 64;\nexport const TITLE_PREFIX = 'po';\nexport const BUILTIN_LEADER_COMMANDS: readonly string[] = [HOTKEYS_COMMAND];\nexport const PACKAGE_SOURCE = '@agimon-ai/po-ui';\n","export function toolNames(entries: readonly Record<string, unknown>[]): string[] {\n const names = new Set<string>();\n for (const entry of entries) {\n const message = entry.message;\n if (!message || typeof message !== 'object' || Array.isArray(message)) continue;\n const content = (message as { content?: unknown }).content;\n if (!Array.isArray(content)) continue;\n for (const block of content) {\n if (!block || typeof block !== 'object' || Array.isArray(block)) continue;\n const name = (block as { name?: unknown }).name;\n if (typeof name === 'string' && name) names.add(name);\n }\n }\n return [...names].sort();\n}\n","import type { PoHeadlessCommand } from '@agimon-ai/po-core/headless';\nimport type { PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport { TOOLS_COMMAND } from '../../../../../constants/ui';\nimport { toolNames } from '../../../../../services/sessionToolInventory';\n\n/**\n * The TUI shell itself stays Pi-only. Inventory is the shared part and is exposed\n * from session data rather than silently installing a fake editor/widget host.\n *\n * Inventory is a command, never a context resource. It reports the tools observed\n * in the transcript, which is not the tool surface the current selection exposes:\n * as a prompt section it listed tools the session had since gated out, directly\n * contradicting the `Available tools:` block, and it grew for the whole session.\n */\nexport function createUiServerContributions(): PoServerSessionPlugin {\n return {\n commands: [\n {\n name: TOOLS_COMMAND,\n description: 'Show tools observed in this headless session. TUI rendering remains unavailable.',\n async execute(_args, execution) {\n const names = new Set<string>();\n for await (const entry of execution.session.entriesNewestFirst({ type: 'message' }))\n for (const name of toolNames([entry])) names.add(name);\n await execution.client.notify({\n title: 'Po tools',\n body: [...names].sort().join('\\n') || '(no tool calls recorded in this session)',\n level: 'info',\n });\n },\n } satisfies PoHeadlessCommand,\n ],\n };\n}\n","import { defineServerCommand } from '@agimon-ai/po-core/extensionFile';\n\nimport { createUiServerContributions } from '../_lib/sessionInventory';\n\nexport default defineServerCommand(createUiServerContributions().commands![0]!);\n","import { toPoHeadlessToolResult, type PoHeadlessTool } from '@agimon-ai/po-core/headless';\nimport {\n createWriteToolDefinition,\n createWriteTool,\n createFindToolDefinition,\n createFindTool,\n createLsToolDefinition,\n createLsTool,\n} from '@earendil-works/pi-coding-agent';\n\n// Preserve the SDK schemas and prompt guidance, but never import terminal renderers\n// into Po's native tool declarations. Execution resolves cwd for each call, including\n// a child session or a session whose working directory differs from process.cwd().\n\nexport function createServerWriteTool(): PoHeadlessTool<ReturnType<typeof createWriteToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createWriteToolDefinition('.');\n return {\n name: 'write',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createWriteTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n\nexport function createServerFindTool(): PoHeadlessTool<ReturnType<typeof createFindToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createFindToolDefinition('.');\n return {\n name: 'find',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createFindTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n\nexport function createServerLsTool(): PoHeadlessTool<ReturnType<typeof createLsToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createLsToolDefinition('.');\n return {\n name: 'ls',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createLsTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerFindTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerFindTool);\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerLsTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerLsTool);\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerWriteTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerWriteTool);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport commandTools from '../src/extensions/workspaces/sessions/(backend)/command/tools.server';\nimport toolFind from '../src/extensions/workspaces/sessions/(backend)/tool/find.server';\nimport toolLs from '../src/extensions/workspaces/sessions/(backend)/tool/ls.server';\nimport toolWrite from '../src/extensions/workspaces/sessions/(backend)/tool/write.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;\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-ui',\n session: (context) => ({\n get commands(): PoServerSessionPlugin['commands'] { return [via({ name: 'tools' }, at(commandTools, context))]; },\n get tools(): PoServerSessionPlugin['tools'] { return [via({ name: 'find' }, at(toolFind, context)), via({ name: 'ls' }, at(toolLs, context)), via({ name: 'write' }, at(toolWrite, context))]; },\n }),\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;AAMA,MAAa,gBAAgB;;;ACN7B,SAAgB,UAAU,SAAuD;CAC/E,MAAM,wBAAQ,IAAI,IAAY;CAC9B,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,UAAU,MAAM;EACtB,IAAI,CAAC,WAAW,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG;EACvE,MAAM,UAAW,QAAkC;EACnD,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;EAC7B,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG;GACjE,MAAM,OAAQ,MAA6B;GAC3C,IAAI,OAAO,SAAS,YAAY,MAAM,MAAM,IAAI,IAAI;EACtD;CACF;CACA,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK;AACzB;;;;;;;;;;;;ACCA,SAAgB,8BAAqD;CACnE,OAAO,EACL,UAAU,CACR;EACE,MAAM;EACN,aAAa;EACb,MAAM,QAAQ,OAAO,WAAW;GAC9B,MAAM,wBAAQ,IAAI,IAAY;GAC9B,WAAW,MAAM,SAAS,UAAU,QAAQ,mBAAmB,EAAE,MAAM,UAAU,CAAC,GAChF,KAAK,MAAM,QAAQ,UAAU,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,IAAI;GACvD,MAAM,UAAU,OAAO,OAAO;IAC5B,OAAO;IACP,MAAM,CAAC,GAAG,KAAK,CAAC,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W;GACjE,MAAM,QAAA,GAAOC,gCAAAA,aAAAA,CAAa,UAAU,GAAG;GACvC,QAAA,GAAOJ,4BAAAA,uBAAAA,CACL,MAAM,KAAK,QACT,YACA,YACA,QACA,cAAc,YAAY,UAAA,GAASA,4BAAAA,uBAAAA,CAAuB,OAAO,CAAC,EACpE,CACF;EACF;CACF;AACF;;;AC5EA,IAAA,uBAAA,GAAeK,iCAAAA,iBAAAA,CAA+C,oBAAoB;;;ACAlF,IAAA,qBAAA,GAAeC,iCAAAA,iBAAAA,CAA+C,kBAAkB;;;ACAhF,IAAA,wBAAA,GAAeC,iCAAAA,iBAAAA,CAA+C,qBAAqB;;;ACInF,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,gBAAA,GAAeC,gCAAAA,mBAAAA,CAAmB;CAC7C,MAAM;CACN,UAAU,aAAa;EACrB,IAAI,WAA8C;GAAE,OAAO,CAAC,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGC,sBAAc,OAAO,CAAC,CAAC;EAAG;EAChH,IAAI,QAAwC;GAAE,OAAO;IAAC,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,qBAAU,OAAO,CAAC;IAAG,IAAI,EAAE,MAAM,KAAK,GAAG,GAAGC,mBAAQ,OAAO,CAAC;IAAG,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGC,sBAAW,OAAO,CAAC;GAAC;EAAG;CACjM;AACF,CAAC"}
|
|
@@ -37,9 +37,11 @@ function createUiServerContributions() {
|
|
|
37
37
|
name: TOOLS_COMMAND,
|
|
38
38
|
description: "Show tools observed in this headless session. TUI rendering remains unavailable.",
|
|
39
39
|
async execute(_args, execution) {
|
|
40
|
+
const names = /* @__PURE__ */ new Set();
|
|
41
|
+
for await (const entry of execution.session.entriesNewestFirst({ type: "message" })) for (const name of toolNames([entry])) names.add(name);
|
|
40
42
|
await execution.client.notify({
|
|
41
43
|
title: "Po tools",
|
|
42
|
-
body:
|
|
44
|
+
body: [...names].sort().join("\n") || "(no tool calls recorded in this session)",
|
|
43
45
|
level: "info"
|
|
44
46
|
});
|
|
45
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","names":["commandTools","toolFind","toolLs","toolWrite"],"sources":["../../src/constants/ui.ts","../../src/services/sessionToolInventory/index.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/sessionInventory.ts","../../src/extensions/workspaces/sessions/(backend)/command/tools.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/serverFileTools.ts","../../src/extensions/workspaces/sessions/(backend)/tool/find.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/ls.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/write.server.ts","../../generated/server.ts"],"sourcesContent":["export const LEADER_WIDGET_KEY = 'po-leader';\nexport const TUI_MODE = 'tui';\nexport const WIDGET_PLACEMENT = 'belowEditor';\nexport const WARNING_STYLE = 'warning';\nexport const THEME_ENVIRONMENT_KEY = 'PO_THEME';\nexport const HOTKEYS_COMMAND = 'hotkeys';\nexport const TOOLS_COMMAND = 'tools';\nexport const CONFIG_COMMAND = 'config';\nexport const SESSION_START_EVENT = 'session_start';\nexport const SESSION_MESSAGE_ENTRY = 'message';\nexport const INPUT_EVENT = 'input';\nexport const INTERACTIVE_INPUT_SOURCE = 'interactive';\nexport const TITLE_MESSAGE_MAX_LENGTH = 64;\nexport const TITLE_PREFIX = 'po';\nexport const BUILTIN_LEADER_COMMANDS: readonly string[] = [HOTKEYS_COMMAND];\nexport const PACKAGE_SOURCE = '@agimon-ai/po-ui';\n","export function toolNames(entries: readonly Record<string, unknown>[]): string[] {\n const names = new Set<string>();\n for (const entry of entries) {\n const message = entry.message;\n if (!message || typeof message !== 'object' || Array.isArray(message)) continue;\n const content = (message as { content?: unknown }).content;\n if (!Array.isArray(content)) continue;\n for (const block of content) {\n if (!block || typeof block !== 'object' || Array.isArray(block)) continue;\n const name = (block as { name?: unknown }).name;\n if (typeof name === 'string' && name) names.add(name);\n }\n }\n return [...names].sort();\n}\n","import type { PoHeadlessCommand } from '@agimon-ai/po-core/headless';\nimport type { PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport { TOOLS_COMMAND } from '../../../../../constants/ui';\nimport { toolNames } from '../../../../../services/sessionToolInventory';\n\n/**\n * The TUI shell itself stays Pi-only. Inventory is the shared part and is exposed\n * from session data rather than silently installing a fake editor/widget host.\n *\n * Inventory is a command, never a context resource. It reports the tools observed\n * in the transcript, which is not the tool surface the current selection exposes:\n * as a prompt section it listed tools the session had since gated out, directly\n * contradicting the `Available tools:` block, and it grew for the whole session.\n */\nexport function createUiServerContributions(): PoServerSessionPlugin {\n return {\n commands: [\n {\n name: TOOLS_COMMAND,\n description: 'Show tools observed in this headless session. TUI rendering remains unavailable.',\n async execute(_args, execution) {\n await execution.client.notify({\n title: 'Po tools',\n body:\n toolNames(await execution.session.entries({ type: 'message' })).join('\\n') ||\n '(no tool calls recorded in this session)',\n level: 'info',\n });\n },\n } satisfies PoHeadlessCommand,\n ],\n };\n}\n","import { defineServerCommand } from '@agimon-ai/po-core/extensionFile';\n\nimport { createUiServerContributions } from '../_lib/sessionInventory';\n\nexport default defineServerCommand(createUiServerContributions().commands![0]!);\n","import { toPoHeadlessToolResult, type PoHeadlessTool } from '@agimon-ai/po-core/headless';\nimport {\n createWriteToolDefinition,\n createWriteTool,\n createFindToolDefinition,\n createFindTool,\n createLsToolDefinition,\n createLsTool,\n} from '@earendil-works/pi-coding-agent';\n\n// Preserve the SDK schemas and prompt guidance, but never import terminal renderers\n// into Po's native tool declarations. Execution resolves cwd for each call, including\n// a child session or a session whose working directory differs from process.cwd().\n\nexport function createServerWriteTool(): PoHeadlessTool<ReturnType<typeof createWriteToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createWriteToolDefinition('.');\n return {\n name: 'write',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createWriteTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n\nexport function createServerFindTool(): PoHeadlessTool<ReturnType<typeof createFindToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createFindToolDefinition('.');\n return {\n name: 'find',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createFindTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n\nexport function createServerLsTool(): PoHeadlessTool<ReturnType<typeof createLsToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createLsToolDefinition('.');\n return {\n name: 'ls',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createLsTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerFindTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerFindTool);\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerLsTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerLsTool);\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerWriteTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerWriteTool);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport commandTools from '../src/extensions/workspaces/sessions/(backend)/command/tools.server';\nimport toolFind from '../src/extensions/workspaces/sessions/(backend)/tool/find.server';\nimport toolLs from '../src/extensions/workspaces/sessions/(backend)/tool/ls.server';\nimport toolWrite from '../src/extensions/workspaces/sessions/(backend)/tool/write.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;\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-ui',\n session: (context) => ({\n get commands(): PoServerSessionPlugin['commands'] { return [via({ name: 'tools' }, at(commandTools, context))]; },\n get tools(): PoServerSessionPlugin['tools'] { return [via({ name: 'find' }, at(toolFind, context)), via({ name: 'ls' }, at(toolLs, context)), via({ name: 'write' }, at(toolWrite, context))]; },\n }),\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;AAMA,MAAa,gBAAgB;;;ACN7B,SAAgB,UAAU,SAAuD;CAC/E,MAAM,wBAAQ,IAAI,IAAY;CAC9B,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,UAAU,MAAM;EACtB,IAAI,CAAC,WAAW,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG;EACvE,MAAM,UAAW,QAAkC;EACnD,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;EAC7B,KAAK,MAAM,SAAS,SAAS;G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pE,CACF;EACF;CACF;AACF;AAEA,SAAgB,qBAA8F;CAC5G,MAAM,EAAE,OAAO,aAAa,YAAY,eAAe,qBAAqB,uBAAuB,GAAG;CACtG,OAAO;EACL,MAAM;EACN;EACA;EACA;EACA;EACA;EACA,MAAM,QAAQ,YAAY,YAAY,QAAQ,UAAU,WAAW;GACjE,MAAM,OAAO,aAAa,UAAU,GAAG;GACvC,OAAO,uBACL,MAAM,KAAK,QACT,YACA,YACA,QACA,cAAc,YAAY,SAAS,uBAAuB,OAAO,CAAC,EACpE,CACF;EACF;CACF;AACF;;;AC5EA,IAAA,sBAAe,iBAA+C,oBAAoB;;;ACAlF,IAAA,oBAAe,iBAA+C,kBAAkB;;;ACAhF,IAAA,uBAAe,iBAA+C,qBAAqB;;;ACInF,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,eAAe,mBAAmB;CAC7C,MAAM;CACN,UAAU,aAAa;EACrB,IAAI,WAA8C;GAAE,OAAO,CAAC,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGA,sBAAc,OAAO,CAAC,CAAC;EAAG;EAChH,IAAI,QAAwC;GAAE,OAAO;IAAC,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,qBAAU,OAAO,CAAC;IAAG,IAAI,EAAE,MAAM,KAAK,GAAG,GAAGC,mBAAQ,OAAO,CAAC;IAAG,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGC,sBAAW,OAAO,CAAC;GAAC;EAAG;CACjM;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.mjs","names":["commandTools","toolFind","toolLs","toolWrite"],"sources":["../../src/constants/ui.ts","../../src/services/sessionToolInventory/index.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/sessionInventory.ts","../../src/extensions/workspaces/sessions/(backend)/command/tools.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/serverFileTools.ts","../../src/extensions/workspaces/sessions/(backend)/tool/find.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/ls.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/write.server.ts","../../generated/server.ts"],"sourcesContent":["export const LEADER_WIDGET_KEY = 'po-leader';\nexport const TUI_MODE = 'tui';\nexport const WIDGET_PLACEMENT = 'belowEditor';\nexport const WARNING_STYLE = 'warning';\nexport const THEME_ENVIRONMENT_KEY = 'PO_THEME';\nexport const HOTKEYS_COMMAND = 'hotkeys';\nexport const TOOLS_COMMAND = 'tools';\nexport const CONFIG_COMMAND = 'config';\nexport const SESSION_START_EVENT = 'session_start';\nexport const SESSION_MESSAGE_ENTRY = 'message';\nexport const INPUT_EVENT = 'input';\nexport const INTERACTIVE_INPUT_SOURCE = 'interactive';\nexport const TITLE_MESSAGE_MAX_LENGTH = 64;\nexport const TITLE_PREFIX = 'po';\nexport const BUILTIN_LEADER_COMMANDS: readonly string[] = [HOTKEYS_COMMAND];\nexport const PACKAGE_SOURCE = '@agimon-ai/po-ui';\n","export function toolNames(entries: readonly Record<string, unknown>[]): string[] {\n const names = new Set<string>();\n for (const entry of entries) {\n const message = entry.message;\n if (!message || typeof message !== 'object' || Array.isArray(message)) continue;\n const content = (message as { content?: unknown }).content;\n if (!Array.isArray(content)) continue;\n for (const block of content) {\n if (!block || typeof block !== 'object' || Array.isArray(block)) continue;\n const name = (block as { name?: unknown }).name;\n if (typeof name === 'string' && name) names.add(name);\n }\n }\n return [...names].sort();\n}\n","import type { PoHeadlessCommand } from '@agimon-ai/po-core/headless';\nimport type { PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport { TOOLS_COMMAND } from '../../../../../constants/ui';\nimport { toolNames } from '../../../../../services/sessionToolInventory';\n\n/**\n * The TUI shell itself stays Pi-only. Inventory is the shared part and is exposed\n * from session data rather than silently installing a fake editor/widget host.\n *\n * Inventory is a command, never a context resource. It reports the tools observed\n * in the transcript, which is not the tool surface the current selection exposes:\n * as a prompt section it listed tools the session had since gated out, directly\n * contradicting the `Available tools:` block, and it grew for the whole session.\n */\nexport function createUiServerContributions(): PoServerSessionPlugin {\n return {\n commands: [\n {\n name: TOOLS_COMMAND,\n description: 'Show tools observed in this headless session. TUI rendering remains unavailable.',\n async execute(_args, execution) {\n const names = new Set<string>();\n for await (const entry of execution.session.entriesNewestFirst({ type: 'message' }))\n for (const name of toolNames([entry])) names.add(name);\n await execution.client.notify({\n title: 'Po tools',\n body: [...names].sort().join('\\n') || '(no tool calls recorded in this session)',\n level: 'info',\n });\n },\n } satisfies PoHeadlessCommand,\n ],\n };\n}\n","import { defineServerCommand } from '@agimon-ai/po-core/extensionFile';\n\nimport { createUiServerContributions } from '../_lib/sessionInventory';\n\nexport default defineServerCommand(createUiServerContributions().commands![0]!);\n","import { toPoHeadlessToolResult, type PoHeadlessTool } from '@agimon-ai/po-core/headless';\nimport {\n createWriteToolDefinition,\n createWriteTool,\n createFindToolDefinition,\n createFindTool,\n createLsToolDefinition,\n createLsTool,\n} from '@earendil-works/pi-coding-agent';\n\n// Preserve the SDK schemas and prompt guidance, but never import terminal renderers\n// into Po's native tool declarations. Execution resolves cwd for each call, including\n// a child session or a session whose working directory differs from process.cwd().\n\nexport function createServerWriteTool(): PoHeadlessTool<ReturnType<typeof createWriteToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createWriteToolDefinition('.');\n return {\n name: 'write',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createWriteTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n\nexport function createServerFindTool(): PoHeadlessTool<ReturnType<typeof createFindToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createFindToolDefinition('.');\n return {\n name: 'find',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createFindTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n\nexport function createServerLsTool(): PoHeadlessTool<ReturnType<typeof createLsToolDefinition>['parameters']> {\n const { label, description, parameters, promptSnippet, promptGuidelines } = createLsToolDefinition('.');\n return {\n name: 'ls',\n label,\n description,\n parameters,\n promptSnippet,\n promptGuidelines,\n async execute(toolCallId, parameters, signal, onUpdate, execution) {\n const tool = createLsTool(execution.cwd);\n return toPoHeadlessToolResult(\n await tool.execute(\n toolCallId,\n parameters,\n signal,\n onUpdate && ((partial) => onUpdate(toPoHeadlessToolResult(partial))),\n ),\n );\n },\n };\n}\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerFindTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerFindTool);\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerLsTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerLsTool);\n","import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\n\nimport { createServerWriteTool } from '../_lib/serverFileTools';\n\nexport default defineServerTool<PoHeadlessTool['parameters']>(createServerWriteTool);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport commandTools from '../src/extensions/workspaces/sessions/(backend)/command/tools.server';\nimport toolFind from '../src/extensions/workspaces/sessions/(backend)/tool/find.server';\nimport toolLs from '../src/extensions/workspaces/sessions/(backend)/tool/ls.server';\nimport toolWrite from '../src/extensions/workspaces/sessions/(backend)/tool/write.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;\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-ui',\n session: (context) => ({\n get commands(): PoServerSessionPlugin['commands'] { return [via({ name: 'tools' }, at(commandTools, context))]; },\n get tools(): PoServerSessionPlugin['tools'] { return [via({ name: 'find' }, at(toolFind, context)), via({ name: 'ls' }, at(toolLs, context)), via({ name: 'write' }, at(toolWrite, context))]; },\n }),\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;AAMA,MAAa,gBAAgB;;;ACN7B,SAAgB,UAAU,SAAuD;CAC/E,MAAM,wBAAQ,IAAI,IAAY;CAC9B,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,UAAU,MAAM;EACtB,IAAI,CAAC,WAAW,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG;EACvE,MAAM,UAAW,QAAkC;EACnD,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;EAC7B,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG;GACjE,MAAM,OAAQ,MAA6B;GAC3C,IAAI,OAAO,SAAS,YAAY,MAAM,MAAM,IAAI,IAAI;EACtD;CACF;CACA,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK;AACzB;;;;;;;;;;;;ACCA,SAAgB,8BAAqD;CACnE,OAAO,EACL,UAAU,CACR;EACE,MAAM;EACN,aAAa;EACb,MAAM,QAAQ,OAAO,WAAW;GAC9B,MA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AY,QAAQ,UAAU,WAAW;GACjE,MAAM,OAAO,aAAa,UAAU,GAAG;GACvC,OAAO,uBACL,MAAM,KAAK,QACT,YACA,YACA,QACA,cAAc,YAAY,SAAS,uBAAuB,OAAO,CAAC,EACpE,CACF;EACF;CACF;AACF;;;AC5EA,IAAA,sBAAe,iBAA+C,oBAAoB;;;ACAlF,IAAA,oBAAe,iBAA+C,kBAAkB;;;ACAhF,IAAA,uBAAe,iBAA+C,qBAAqB;;;ACInF,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,eAAe,mBAAmB;CAC7C,MAAM;CACN,UAAU,aAAa;EACrB,IAAI,WAA8C;GAAE,OAAO,CAAC,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGA,sBAAc,OAAO,CAAC,CAAC;EAAG;EAChH,IAAI,QAAwC;GAAE,OAAO;IAAC,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,qBAAU,OAAO,CAAC;IAAG,IAAI,EAAE,MAAM,KAAK,GAAG,GAAGC,mBAAQ,OAAO,CAAC;IAAG,IAAI,EAAE,MAAM,QAAQ,GAAG,GAAGC,sBAAW,OAAO,CAAC;GAAC;EAAG;CACjM;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-ui",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.38",
|
|
4
4
|
"description": "Leader-key menus, themes, and TUI components for Po and Pi extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -110,32 +110,32 @@
|
|
|
110
110
|
"access": "public"
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
114
|
-
"@agimon-ai/po-hashline": "0.0.0-alpha.
|
|
115
|
-
"@agimon-ai/po-minor-mode": "0.0.0-alpha.
|
|
116
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
113
|
+
"@agimon-ai/po-core": "0.0.0-alpha.38",
|
|
114
|
+
"@agimon-ai/po-hashline": "0.0.0-alpha.38",
|
|
115
|
+
"@agimon-ai/po-minor-mode": "0.0.0-alpha.38",
|
|
116
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.38",
|
|
117
117
|
"@deepseek-ai/cordis": "4.0.5",
|
|
118
118
|
"yaml": "2.9.1"
|
|
119
119
|
},
|
|
120
120
|
"devDependencies": {
|
|
121
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
122
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
123
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
121
|
+
"@agimon-ai/po-build": "0.0.0-alpha.38",
|
|
122
|
+
"@agimon-ai/po-core": "0.0.0-alpha.38",
|
|
123
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.38",
|
|
124
124
|
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
125
125
|
"@tanstack/react-store": "0.11.2",
|
|
126
126
|
"@tanstack/store": "0.11.2",
|
|
127
127
|
"@types/node": "26.6.5",
|
|
128
128
|
"@types/react": "19.3.0",
|
|
129
129
|
"@vitest/coverage-v8": "5.0.4",
|
|
130
|
-
"react": "19.3.
|
|
131
|
-
"react-dom": "19.3.
|
|
130
|
+
"react": "19.3.1",
|
|
131
|
+
"react-dom": "19.3.1",
|
|
132
132
|
"tsdown": "0.23.1",
|
|
133
133
|
"typescript": "7.0.2",
|
|
134
134
|
"vitest": "5.0.4"
|
|
135
135
|
},
|
|
136
136
|
"peerDependencies": {
|
|
137
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
138
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
137
|
+
"@agimon-ai/po-core": "0.0.0-alpha.38",
|
|
138
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.38",
|
|
139
139
|
"@earendil-works/pi-coding-agent": "1.3.0"
|
|
140
140
|
},
|
|
141
141
|
"peerDependenciesMeta": {
|