@agimon-ai/po-ui 0.0.0-alpha.4 → 0.0.0-alpha.41
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/LICENSE +149 -21
- package/README.md +1 -1
- package/dist/apiContracts.cjs +1 -1
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +1 -1
- package/dist/apiContracts.mjs +1 -1
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/extensions/server.cjs +7 -5
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts +2 -2
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +6 -4
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +11 -17
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/{index-2GW2dj0I.d.mts → index-DJvl27YF.d.mts} +2 -2
- package/dist/{index-2GW2dj0I.d.mts.map → index-DJvl27YF.d.mts.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/logSinkTelemetry.cjs +1 -1
- package/dist/logSinkTelemetry.d.mts +1 -1
- package/dist/logSinkTelemetry.mjs +1 -1
- package/dist/{telemetry-RiFqd0cg.mjs → telemetry-BvCR35jo.mjs} +2 -2
- package/dist/telemetry-BvCR35jo.mjs.map +1 -0
- package/dist/{telemetry-EXlQc9s0.cjs → telemetry-DZXeC4kO.cjs} +3 -3
- package/dist/telemetry-DZXeC4kO.cjs.map +1 -0
- package/package.json +16 -17
- package/dist/telemetry-EXlQc9s0.cjs.map +0 -1
- package/dist/telemetry-RiFqd0cg.mjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,149 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
2
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
3
|
+
|
|
4
|
+
Parameters
|
|
5
|
+
|
|
6
|
+
Licensor: Agimon Pty Ltd
|
|
7
|
+
Licensed Work: Po, the software in the Po source repository and the
|
|
8
|
+
packages released from it, in each version released by
|
|
9
|
+
the Licensor.
|
|
10
|
+
The Licensed Work is (c) 2026 Agimon Pty Ltd.
|
|
11
|
+
Material identified as third-party in the "Third-party
|
|
12
|
+
components" section at the end of this file or in a
|
|
13
|
+
NOTICE file, and any package or directory whose own
|
|
14
|
+
license file grants a different license, is not part of
|
|
15
|
+
the Licensed Work and remains under its own license.
|
|
16
|
+
Additional Use Grant: You may make production use of the Licensed Work if
|
|
17
|
+
your use is Eligible Use. "Eligible Use" is production use that falls
|
|
18
|
+
within at least one of the following:
|
|
19
|
+
|
|
20
|
+
(a) Personal Use. Use by an individual for their own personal purposes,
|
|
21
|
+
and not on behalf of, or for the benefit of, an employer, client, or
|
|
22
|
+
other Organization. Use by an individual in the course of employment
|
|
23
|
+
or engagement by an Organization is use by that Organization.
|
|
24
|
+
|
|
25
|
+
(b) Small Organization Use. Use by or on behalf of an Organization whose
|
|
26
|
+
Annual Revenue is less than USD 1,000,000.
|
|
27
|
+
|
|
28
|
+
(c) Non-profit, Education and Research Use. Use, regardless of Annual
|
|
29
|
+
Revenue, by (i) an Organization registered or recognized as a
|
|
30
|
+
non-profit or charitable organization under the laws of its
|
|
31
|
+
jurisdiction, for its non-profit purposes; (ii) an accredited school,
|
|
32
|
+
college, or university, for teaching, learning, or academic research;
|
|
33
|
+
or (iii) a publicly funded research institution, for its research.
|
|
34
|
+
|
|
35
|
+
(d) Service Provider Use. Use by a consultant, contractor, agency, or other
|
|
36
|
+
service provider, regardless of its own Annual Revenue, solely to
|
|
37
|
+
build, deploy, host, operate, or support the Licensed Work for a client
|
|
38
|
+
whose own use would be Eligible Use under (a), (b), or (c). A service
|
|
39
|
+
provider's use for its own purposes is Eligible Use only if the service
|
|
40
|
+
provider itself qualifies under (b) or (c).
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Hosted services. Offering the Licensed Work to third parties as a hosted
|
|
44
|
+
or managed service whose primary value is the Licensed Work is Eligible
|
|
45
|
+
Use only if each such third party's own use would be Eligible Use.
|
|
46
|
+
|
|
47
|
+
Definitions. "Organization" means any company, partnership, sole
|
|
48
|
+
proprietorship, trust, association, government body, or other entity, and
|
|
49
|
+
includes an individual acting in a business or professional capacity.
|
|
50
|
+
"Affiliate" means any entity that directly or indirectly controls, is
|
|
51
|
+
controlled by, or is under common control with an Organization, where
|
|
52
|
+
"control" means ownership of more than 50% of the voting interests of an
|
|
53
|
+
entity or the power to direct its management and policies by contract or
|
|
54
|
+
otherwise. "Annual Revenue" means the total gross revenue of an
|
|
55
|
+
Organization and all of its Affiliates combined, from all sources and
|
|
56
|
+
whether or not related to the Licensed Work, for its most recently
|
|
57
|
+
completed fiscal year, or, if it has not completed a fiscal year, for the
|
|
58
|
+
twelve months before the use (or since its formation, if shorter),
|
|
59
|
+
converted into US dollars at the average exchange rate for that period.
|
|
60
|
+
Proceeds of equity or debt financing are not revenue.
|
|
61
|
+
|
|
62
|
+
Threshold. If an Organization stops qualifying under (b), its existing
|
|
63
|
+
production use remains Eligible Use for 90 days after it stops
|
|
64
|
+
qualifying, after which it must obtain a commercial license or stop
|
|
65
|
+
production use. Use that was Eligible Use when it occurred never requires
|
|
66
|
+
a commercial license after the fact.
|
|
67
|
+
Change Date: Four years from the date a version of the Licensed Work
|
|
68
|
+
is first publicly released by the Licensor.
|
|
69
|
+
Change License: Apache License, Version 2.0
|
|
70
|
+
|
|
71
|
+
For information about alternative licensing arrangements for the Licensed
|
|
72
|
+
Work, please visit: https://agimon.ai/licensing
|
|
73
|
+
|
|
74
|
+
Notice
|
|
75
|
+
|
|
76
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
77
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
78
|
+
under an Open Source License, as stated in this License.
|
|
79
|
+
|
|
80
|
+
-----------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
Business Source License 1.1
|
|
83
|
+
|
|
84
|
+
Terms
|
|
85
|
+
|
|
86
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
87
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
88
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
89
|
+
production use.
|
|
90
|
+
|
|
91
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
92
|
+
available distribution of a specific version of the Licensed Work under this
|
|
93
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
94
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
95
|
+
above terminate.
|
|
96
|
+
|
|
97
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
98
|
+
currently in effect as described in this License, you must purchase a
|
|
99
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
100
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
101
|
+
|
|
102
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
103
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
104
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
105
|
+
for each version of the Licensed Work released by Licensor.
|
|
106
|
+
|
|
107
|
+
You must conspicuously display this License on each original or modified copy
|
|
108
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
109
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
110
|
+
License apply to your use of that work.
|
|
111
|
+
|
|
112
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
113
|
+
terminate your rights under this License for the current and all other
|
|
114
|
+
versions of the Licensed Work.
|
|
115
|
+
|
|
116
|
+
This License does not grant you any right in any trademark or logo of
|
|
117
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
118
|
+
Licensor as expressly required by this License).
|
|
119
|
+
|
|
120
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
121
|
+
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
122
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
123
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
124
|
+
TITLE.
|
|
125
|
+
|
|
126
|
+
MariaDB hereby grants you permission to use this License’s text to license
|
|
127
|
+
your works, and to refer to it using the trademark “Business Source License”,
|
|
128
|
+
as long as you comply with the Covenants of Licensor below.
|
|
129
|
+
|
|
130
|
+
Covenants of Licensor
|
|
131
|
+
|
|
132
|
+
In consideration of the right to use this License’s text and the “Business
|
|
133
|
+
Source License” name and trademark, Licensor covenants to MariaDB, and to all
|
|
134
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
135
|
+
|
|
136
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
137
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
138
|
+
where “compatible” means that software provided under the Change License can
|
|
139
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
140
|
+
later version. Licensor may specify additional Change Licenses without
|
|
141
|
+
limitation.
|
|
142
|
+
|
|
143
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
144
|
+
impose any additional restriction on the right granted in this License, as
|
|
145
|
+
the Additional Use Grant; or (b) insert the text “None”.
|
|
146
|
+
|
|
147
|
+
3. To specify a Change Date.
|
|
148
|
+
|
|
149
|
+
4. Not to modify this License in any other way.
|
package/README.md
CHANGED
package/dist/apiContracts.cjs
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
//#region src/schemas/apiContracts.ts
|
|
6
|
-
/** This
|
|
6
|
+
/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
7
7
|
const apiContracts = (0, require("@agimon-ai/po-core/apiContracts").defineApiContract)({
|
|
8
8
|
version: 1,
|
|
9
9
|
http: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,4CAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
package/dist/apiContracts.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/schemas/apiContracts.d.ts
|
|
2
|
-
/** This
|
|
2
|
+
/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
3
3
|
export declare const apiContracts: {
|
|
4
4
|
version: 1;
|
|
5
5
|
protocols?: Record<string, string> | undefined;
|
package/dist/apiContracts.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineApiContract } from "@agimon-ai/po-core/apiContracts";
|
|
2
2
|
//#region src/schemas/apiContracts.ts
|
|
3
|
-
/** This
|
|
3
|
+
/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
4
4
|
const apiContracts = defineApiContract({
|
|
5
5
|
version: 1,
|
|
6
6
|
http: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
let
|
|
5
|
+
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
6
6
|
let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
|
|
7
7
|
let _agimon_ai_po_core_headless = require("@agimon-ai/po-core/headless");
|
|
8
8
|
let _earendil_works_pi_coding_agent = require("@earendil-works/pi-coding-agent");
|
|
@@ -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
|
}
|
|
@@ -115,7 +117,7 @@ const via = (identity, value) => value === void 0 ? void 0 : {
|
|
|
115
117
|
...identity,
|
|
116
118
|
...value
|
|
117
119
|
};
|
|
118
|
-
const
|
|
120
|
+
const serverPlugin = (0, _agimon_ai_po_core_serverPlugin.defineServerPlugin)({
|
|
119
121
|
name: "@agimon-ai/po-ui",
|
|
120
122
|
session: (context) => ({
|
|
121
123
|
get commands() {
|
|
@@ -131,7 +133,7 @@ const facet = (0, _agimon_ai_po_core_serverFacet.defineServerPlugin)({
|
|
|
131
133
|
})
|
|
132
134
|
});
|
|
133
135
|
//#endregion
|
|
134
|
-
exports.default =
|
|
135
|
-
exports.
|
|
136
|
+
exports.default = serverPlugin;
|
|
137
|
+
exports.serverPlugin = serverPlugin;
|
|
136
138
|
|
|
137
139
|
//# sourceMappingURL=server.cjs.map
|
|
@@ -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/serverFacet';\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/serverFacet';\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 facet = 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 facet;\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,s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AAeK,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,SAAA,GAAQC,+BAAAA,mBAAAA,CAAmB;CACtC,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,I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;EACL,MAAM;EACN;EACA;EACA;EACA;EACA;EACA,MAAM,QAAQ,YAAY,YAAY,QAAQ,UAAU,WAAW;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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region generated/server.d.ts
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const serverPlugin: import("@agimon-ai/po-core/serverPlugin").PoServerPlugin;
|
|
3
3
|
//#endregion
|
|
4
|
-
export {
|
|
4
|
+
export { serverPlugin as default };
|
|
5
5
|
//# sourceMappingURL=server.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";qBAca,
|
|
1
|
+
{"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";qBAca,wDAAY"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineServerPlugin } from "@agimon-ai/po-core/
|
|
1
|
+
import { defineServerPlugin } from "@agimon-ai/po-core/serverPlugin";
|
|
2
2
|
import { defineServerCommand, defineServerTool } from "@agimon-ai/po-core/extensionFile";
|
|
3
3
|
import { toPoHeadlessToolResult } from "@agimon-ai/po-core/headless";
|
|
4
4
|
import { createFindTool, createFindToolDefinition, createLsTool, createLsToolDefinition, createWriteTool, createWriteToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
@@ -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
|
}
|
|
@@ -111,7 +113,7 @@ const via = (identity, value) => value === void 0 ? void 0 : {
|
|
|
111
113
|
...identity,
|
|
112
114
|
...value
|
|
113
115
|
};
|
|
114
|
-
const
|
|
116
|
+
const serverPlugin = defineServerPlugin({
|
|
115
117
|
name: "@agimon-ai/po-ui",
|
|
116
118
|
session: (context) => ({
|
|
117
119
|
get commands() {
|
|
@@ -127,6 +129,6 @@ const facet = defineServerPlugin({
|
|
|
127
129
|
})
|
|
128
130
|
});
|
|
129
131
|
//#endregion
|
|
130
|
-
export {
|
|
132
|
+
export { serverPlugin as default, serverPlugin };
|
|
131
133
|
|
|
132
134
|
//# sourceMappingURL=server.mjs.map
|
|
@@ -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/serverFacet';\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/serverFacet';\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 facet = 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 facet;\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,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;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,QAAQ,mBAAmB;CACtC,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,MAAM,wBAAQ,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AAU,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/dist/extensions/web.mjs
CHANGED
|
@@ -135,11 +135,6 @@ function ListingBody({ tool, limitKey, limitUnit, expanded, props }) {
|
|
|
135
135
|
]
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
/** Whether the listing hides lines while collapsed, so the item can offer its toggle. */
|
|
139
|
-
function listingExpandable(props, limitKey, limitUnit) {
|
|
140
|
-
if (props.result === null || props.isError) return false;
|
|
141
|
-
return listResultView(props.result, props.output, false, limitKey, limitUnit).hidden > 0;
|
|
142
|
-
}
|
|
143
138
|
//#endregion
|
|
144
139
|
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/FindToolMessage.tsx
|
|
145
140
|
const LIMIT_KEY$1 = "resultLimitReached";
|
|
@@ -152,7 +147,7 @@ function FindToolMessage(props) {
|
|
|
152
147
|
running: props.running,
|
|
153
148
|
isError: props.isError
|
|
154
149
|
}),
|
|
155
|
-
expandable:
|
|
150
|
+
expandable: true,
|
|
156
151
|
children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
157
152
|
title: "find",
|
|
158
153
|
children: /* @__PURE__ */ jsxs("span", {
|
|
@@ -166,13 +161,13 @@ function FindToolMessage(props) {
|
|
|
166
161
|
children: ["· ", view.details.join(" · ")]
|
|
167
162
|
}) : null]
|
|
168
163
|
})
|
|
169
|
-
}), /* @__PURE__ */ jsx(ListingBody, {
|
|
164
|
+
}), expanded ? /* @__PURE__ */ jsx(ListingBody, {
|
|
170
165
|
tool: "find",
|
|
171
166
|
limitKey: LIMIT_KEY$1,
|
|
172
167
|
limitUnit: LIMIT_UNIT$1,
|
|
173
|
-
expanded,
|
|
168
|
+
expanded: true,
|
|
174
169
|
props
|
|
175
|
-
})] })
|
|
170
|
+
}) : null] })
|
|
176
171
|
});
|
|
177
172
|
}
|
|
178
173
|
//#endregion
|
|
@@ -190,7 +185,7 @@ function LsToolMessage(props) {
|
|
|
190
185
|
running: props.running,
|
|
191
186
|
isError: props.isError
|
|
192
187
|
}),
|
|
193
|
-
expandable:
|
|
188
|
+
expandable: true,
|
|
194
189
|
children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
195
190
|
title: "ls",
|
|
196
191
|
children: /* @__PURE__ */ jsxs("span", {
|
|
@@ -204,13 +199,13 @@ function LsToolMessage(props) {
|
|
|
204
199
|
children: ["· ", view.details.join(" · ")]
|
|
205
200
|
}) : null]
|
|
206
201
|
})
|
|
207
|
-
}), /* @__PURE__ */ jsx(ListingBody, {
|
|
202
|
+
}), expanded ? /* @__PURE__ */ jsx(ListingBody, {
|
|
208
203
|
tool: "ls",
|
|
209
204
|
limitKey: LIMIT_KEY,
|
|
210
205
|
limitUnit: LIMIT_UNIT,
|
|
211
|
-
expanded,
|
|
206
|
+
expanded: true,
|
|
212
207
|
props
|
|
213
|
-
})] })
|
|
208
|
+
}) : null] })
|
|
214
209
|
});
|
|
215
210
|
}
|
|
216
211
|
//#endregion
|
|
@@ -242,8 +237,7 @@ function WritePreview({ view, path }) {
|
|
|
242
237
|
}
|
|
243
238
|
/**
|
|
244
239
|
* The write tool's timeline item: `path · N chars` in the header. Pi's write
|
|
245
|
-
* result is silent on success, so
|
|
246
|
-
* TUI folds into its call: ten lines, or all of them once the item expands.
|
|
240
|
+
* result is silent on success, so expanding shows the numbered file content.
|
|
247
241
|
* A failure shows the tool's message in red instead.
|
|
248
242
|
*/
|
|
249
243
|
function WriteToolMessage({ args, result, output, running, isError, fileTabFor, openTransientTab }) {
|
|
@@ -254,7 +248,7 @@ function WriteToolMessage({ args, result, output, running, isError, fileTabFor,
|
|
|
254
248
|
running,
|
|
255
249
|
isError
|
|
256
250
|
}),
|
|
257
|
-
expandable:
|
|
251
|
+
expandable: true,
|
|
258
252
|
children: ({ expanded }) => {
|
|
259
253
|
const view = expanded ? writeCallView(args, true) : collapsed;
|
|
260
254
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
@@ -270,7 +264,7 @@ function WriteToolMessage({ args, result, output, running, isError, fileTabFor,
|
|
|
270
264
|
children: ["· ", view.size]
|
|
271
265
|
})]
|
|
272
266
|
})
|
|
273
|
-
}), isError ? /* @__PURE__ */ jsxs(MessageItemBody, {
|
|
267
|
+
}), !expanded ? null : isError ? /* @__PURE__ */ jsxs(MessageItemBody, {
|
|
274
268
|
"data-testid": "tool-result-write",
|
|
275
269
|
className: "flex flex-col",
|
|
276
270
|
children: [/* @__PURE__ */ jsx(MessageItemStatus, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.mjs","names":["LIMIT_KEY","LIMIT_UNIT","toolFind","toolLs","toolWrite"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/builtinToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ListingBody.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/FindToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/find.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/LsToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/ls.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/WriteToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/write.web.tsx","../../generated/web.ts"],"sourcesContent":["import type { ToolResultView } from '@agimon-ai/po-core/web';\n\n/** The TUI's collapsed budgets: ten preview lines for a write, twenty for a listing. */\nexport const WRITE_COLLAPSED_LINES = 10;\nexport const LIST_COLLAPSED_LINES = 20;\n/** Pi's default output cap, the size its truncation warning names when details omit one. */\nconst DEFAULT_MAX_BYTES = 50 * 1024;\nconst KIBIBYTE = 1024;\n\nexport interface NumberedLine {\n readonly number: number;\n readonly text: string;\n}\n\nexport interface WriteCallView {\n readonly path: string;\n /** `N chars`, the size the TUI's call heading shows. */\n readonly size: string;\n readonly preview: readonly NumberedLine[];\n readonly hidden: number;\n /** Widest shown line number, in characters. */\n readonly gutter: number;\n}\n\nexport interface SearchCallView {\n readonly primary: string;\n readonly details: readonly string[];\n}\n\nexport interface ListResultView {\n readonly lines: readonly string[];\n readonly hidden: number;\n /** Pi's `[Truncated: ...]` warning, when the listing hit a limit. */\n readonly truncated: string | undefined;\n}\n\nfunction compactDetails(values: ReadonlyArray<string | undefined>): string[] {\n return values.filter((value): value is string => value !== undefined && value.length > 0);\n}\n\nfunction optionalCount(value: unknown, unit: string): string | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? `${value} ${unit}` : undefined;\n}\n\nfunction pathOrDot(value: unknown): string {\n return typeof value === 'string' && value.length > 0 ? value : '.';\n}\n\n/** Pi's size formatter, so the web warning names the same figure the TUI does. */\nexport function formatSize(bytes: number): string {\n if (bytes < KIBIBYTE) return `${bytes}B`;\n if (bytes < KIBIBYTE * KIBIBYTE) return `${(bytes / KIBIBYTE).toFixed(1)}KB`;\n return `${(bytes / (KIBIBYTE * KIBIBYTE)).toFixed(1)}MB`;\n}\n\n/** What the write call shows: the path, the content size, and a numbered preview of the file. */\nexport function writeCallView(args: Readonly<Record<string, unknown>>, expanded: boolean): WriteCallView {\n const content = typeof args.content === 'string' ? args.content : '';\n const path = typeof args.path === 'string' ? args.path : '';\n const size = `${content.length.toLocaleString('en-US')} chars`;\n if (content.length === 0) return { path, size, preview: [], hidden: 0, gutter: 1 };\n const lines = content.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (lines.at(-1) === '') lines.pop();\n const visible = expanded ? lines : lines.slice(0, WRITE_COLLAPSED_LINES);\n const preview = visible.map((text, index) => ({ number: index + 1, text }));\n return { path, size, preview, hidden: lines.length - visible.length, gutter: String(visible.length).length };\n}\n\n/** `pattern · path · N results`, as the find call heading lists them. */\nexport function findCallView(args: Readonly<Record<string, unknown>>): SearchCallView {\n return {\n primary: typeof args.pattern === 'string' ? args.pattern : '',\n details: compactDetails([pathOrDot(args.path), optionalCount(args.limit, 'results')]),\n };\n}\n\n/** `path · N entries`, as the ls call heading lists them. */\nexport function lsCallView(args: Readonly<Record<string, unknown>>): SearchCallView {\n return { primary: pathOrDot(args.path), details: compactDetails([optionalCount(args.limit, 'entries')]) };\n}\n\n/** The result's text, from its blocks when the view exists and from the joined output otherwise. */\nexport function resultText(result: ToolResultView | null, output: string): string {\n if (result === null) return output;\n return result.content\n .flatMap((block) => {\n const record = typeof block === 'object' && block !== null ? (block as { type?: unknown; text?: unknown }) : {};\n return record.type === 'text' && typeof record.text === 'string' ? [record.text] : [];\n })\n .join('\\n');\n}\n\n/**\n * A find or ls listing the way Pi's own renderer shows it: the lines,\n * collapsed to twenty, and the limit warning its details carry. `limitKey`\n * names the per-tool counter (resultLimitReached, entryLimitReached).\n */\nexport function listResultView(\n result: ToolResultView | null,\n output: string,\n expanded: boolean,\n limitKey: string,\n limitUnit: string,\n): ListResultView {\n const text = resultText(result, output).trim();\n const all = text.length === 0 ? [] : text.split('\\n');\n const lines = expanded ? all : all.slice(0, LIST_COLLAPSED_LINES);\n const details =\n typeof result?.details === 'object' && result.details !== null ? (result.details as Record<string, unknown>) : {};\n const limit = details[limitKey];\n const truncation =\n typeof details.truncation === 'object' && details.truncation !== null\n ? (details.truncation as Record<string, unknown>)\n : undefined;\n const warnings: string[] = [];\n if (typeof limit === 'number' && limit > 0) warnings.push(`${limit} ${limitUnit} limit`);\n if (truncation?.truncated === true) {\n warnings.push(\n `${formatSize(typeof truncation.maxBytes === 'number' ? truncation.maxBytes : DEFAULT_MAX_BYTES)} limit`,\n );\n }\n return {\n lines,\n hidden: all.length - lines.length,\n truncated: warnings.length > 0 ? `[Truncated: ${warnings.join(', ')}]` : undefined,\n };\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItemBody, MessageItemStatus } from '@agimon-ai/po-web-components';\n\nimport { listResultView, resultText } from '../_lib/builtinToolView';\n\n/**\n * The body shared by find and ls: Pi's listing lines, collapsed to twenty\n * until the item expands, with the limit warning its details carry.\n */\nexport function ListingBody({\n tool,\n limitKey,\n limitUnit,\n expanded,\n props,\n}: {\n tool: string;\n limitKey: string;\n limitUnit: string;\n expanded: boolean;\n props: ToolMessageRenderProps;\n}) {\n const { result, output, running, isError } = props;\n if (isError) {\n return (\n <MessageItemBody data-testid={`tool-result-${tool}`} className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n <span className=\"whitespace-pre-wrap break-words text-po-red\">{resultText(result, output)}</span>\n </MessageItemBody>\n );\n }\n if (result === null) {\n return running ? (\n <MessageItemBody data-testid={`tool-result-${tool}`}>\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null;\n }\n const view = listResultView(result, output, expanded, limitKey, limitUnit);\n if (view.lines.length === 0 && view.truncated === undefined) return null;\n return (\n <MessageItemBody data-testid={`tool-result-${tool}`} className=\"flex flex-col font-mono\">\n {view.lines.map((line, index) => (\n <span key={`${String(index)}-${line}`} className=\"whitespace-pre-wrap break-words text-po-text\">\n {line}\n </span>\n ))}\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more lines</MessageItemStatus> : null}\n {view.truncated !== undefined ? <span className=\"text-po-yellow\">{view.truncated}</span> : null}\n </MessageItemBody>\n );\n}\n\n/** Whether the listing hides lines while collapsed, so the item can offer its toggle. */\nexport function listingExpandable(props: ToolMessageRenderProps, limitKey: string, limitUnit: string): boolean {\n if (props.result === null || props.isError) return false;\n return listResultView(props.result, props.output, false, limitKey, limitUnit).hidden > 0;\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItem, MessageItemHeader, toolTone } from '@agimon-ai/po-web-components';\n\nimport { findCallView } from '../_lib/builtinToolView';\nimport { ListingBody, listingExpandable } from './ListingBody';\n\nconst LIMIT_KEY = 'resultLimitReached';\nconst LIMIT_UNIT = 'results';\n\n/** The find tool's timeline item: `pattern · path · N results` over Pi's listing lines. */\nexport function FindToolMessage(props: ToolMessageRenderProps) {\n const view = findCallView(props.args);\n return (\n <MessageItem\n tone={toolTone({ running: props.running, isError: props.isError })}\n expandable={listingExpandable(props, LIMIT_KEY, LIMIT_UNIT)}\n >\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"find\">\n <span data-testid=\"tool-call-find\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"truncate text-po-text\">{view.primary}</span>\n {view.details.length > 0 ? (\n <span className=\"shrink-0 text-po-faint\">· {view.details.join(' · ')}</span>\n ) : null}\n </span>\n </MessageItemHeader>\n <ListingBody tool=\"find\" limitKey={LIMIT_KEY} limitUnit={LIMIT_UNIT} expanded={expanded} props={props} />\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { FindToolMessage } from './_components/FindToolMessage';\n\nexport default defineToolRenderer({ message: FindToolMessage });\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItem, MessageItemHeader, toolTone } from '@agimon-ai/po-web-components';\n\nimport { lsCallView } from '../_lib/builtinToolView';\nimport { ListingBody, listingExpandable } from './ListingBody';\n\nconst LIMIT_KEY = 'entryLimitReached';\nconst LIMIT_UNIT = 'entries';\n\n/** The ls tool's timeline item: `path · N entries` over Pi's listing lines. */\nexport function LsToolMessage(props: ToolMessageRenderProps) {\n const view = lsCallView(props.args);\n return (\n <MessageItem\n tone={toolTone({ running: props.running, isError: props.isError })}\n expandable={listingExpandable(props, LIMIT_KEY, LIMIT_UNIT)}\n >\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"ls\">\n <span data-testid=\"tool-call-ls\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"truncate text-po-text\">{view.primary}</span>\n {view.details.length > 0 ? (\n <span className=\"shrink-0 text-po-faint\">· {view.details.join(' · ')}</span>\n ) : null}\n </span>\n </MessageItemHeader>\n <ListingBody tool=\"ls\" limitKey={LIMIT_KEY} limitUnit={LIMIT_UNIT} expanded={expanded} props={props} />\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { LsToolMessage } from './_components/LsToolMessage';\n\nexport default defineToolRenderer({ message: LsToolMessage });\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n SyntaxLine,\n ToolPathLink,\n toolTone,\n useSyntaxLines,\n} from '@agimon-ai/po-web-components';\n\nimport { resultText, type WriteCallView, writeCallView } from '../_lib/builtinToolView';\n\n/**\n * The numbered preview, coloured as the file it is about to become.\n *\n * Its own component so the highlighting hook has somewhere to live: the body\n * around it is picked inside a render prop. The preview is a prefix of the\n * content, so it parses as the file it came from up to wherever it was cut.\n */\nfunction WritePreview({ view, path }: { view: WriteCallView; path: string }) {\n const spans = useSyntaxLines(view.preview.map((line) => line.text).join('\\n'), { path });\n return (\n <>\n {view.preview.map((line, index) => (\n <span key={line.number} className=\"flex gap-2\">\n <span className=\"shrink-0 text-right text-po-faint\" style={{ width: `${String(view.gutter)}ch` }}>\n {line.number}\n </span>\n <SyntaxLine\n spans={spans?.[index]}\n text={line.text}\n className=\"min-w-0 whitespace-pre-wrap break-words text-po-text\"\n />\n </span>\n ))}\n </>\n );\n}\n\n/**\n * The write tool's timeline item: `path · N chars` in the header. Pi's write\n * result is silent on success, so the body shows the numbered preview the\n * TUI folds into its call: ten lines, or all of them once the item expands.\n * A failure shows the tool's message in red instead.\n */\nexport function WriteToolMessage({\n args,\n result,\n output,\n running,\n isError,\n fileTabFor,\n openTransientTab,\n}: ToolMessageRenderProps) {\n const collapsed = writeCallView(args, false);\n // The header names a file the tool is writing, so the reader can open it\n // rather than hunt for it; nothing installed to show files leaves it as text.\n const tab = fileTabFor(collapsed.path);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={collapsed.hidden > 0}>\n {({ expanded }) => {\n const view = expanded ? writeCallView(args, true) : collapsed;\n return (\n <>\n <MessageItemHeader title=\"write\">\n <span data-testid=\"tool-call-write\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <ToolPathLink\n path={view.path}\n {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })}\n />\n <span className=\"shrink-0 text-po-faint\">· {view.size}</span>\n </span>\n </MessageItemHeader>\n {isError ? (\n <MessageItemBody data-testid=\"tool-result-write\" className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n <span className=\"whitespace-pre-wrap break-words text-po-red\">{resultText(result, output)}</span>\n </MessageItemBody>\n ) : view.preview.length === 0 ? (\n running ? (\n <MessageItemBody data-testid=\"tool-result-write\">\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : (\n <MessageItemBody data-testid=\"tool-result-write\" className=\"flex flex-col font-mono\">\n <WritePreview view={view} path={view.path} />\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more lines</MessageItemStatus> : null}\n {running ? <MessageItemStatus tone=\"running\">running</MessageItemStatus> : null}\n </MessageItemBody>\n )}\n </>\n );\n }}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { WriteToolMessage } from './_components/WriteToolMessage';\n\nexport default defineToolRenderer({ message: WriteToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport toolFind from '../src/extensions/workspaces/sessions/(frontend)/tool/find.web';\nimport toolLs from '../src/extensions/workspaces/sessions/(frontend)/tool/ls.web';\nimport toolWrite from '../src/extensions/workspaces/sessions/(frontend)/tool/write.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'builtin-tools',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['find'] }, toolFind), via({ tools: ['ls'] }, toolLs), via({ tools: ['write'] }, toolWrite)]; },\n },\n});\n"],"mappings":";;;;AAMA,MAAM,oBAAoB;AAC1B,MAAM,WAAW;AA6BjB,SAAS,eAAe,QAAqD;CAC3E,OAAO,OAAO,QAAQ,UAA2B,UAAU,KAAA,KAAa,MAAM,SAAS,CAAC;AAC1F;AAEA,SAAS,cAAc,OAAgB,MAAkC;CACvE,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,GAAG,MAAM,GAAG,SAAS,KAAA;AACpF;AAEA,SAAS,UAAU,OAAwB;CACzC,OAAO,OAAO,UAAU,YAAY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C,iBAAS;EAAC;CAAG,EACpL;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"web.mjs","names":["LIMIT_KEY","LIMIT_UNIT","toolFind","toolLs","toolWrite"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/builtinToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ListingBody.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/FindToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/find.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/LsToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/ls.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/WriteToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/write.web.tsx","../../generated/web.ts"],"sourcesContent":["import type { ToolResultView } from '@agimon-ai/po-core/web';\n\n/** The TUI's collapsed budgets: ten preview lines for a write, twenty for a listing. */\nexport const WRITE_COLLAPSED_LINES = 10;\nexport const LIST_COLLAPSED_LINES = 20;\n/** Pi's default output cap, the size its truncation warning names when details omit one. */\nconst DEFAULT_MAX_BYTES = 50 * 1024;\nconst KIBIBYTE = 1024;\n\nexport interface NumberedLine {\n readonly number: number;\n readonly text: string;\n}\n\nexport interface WriteCallView {\n readonly path: string;\n /** `N chars`, the size the TUI's call heading shows. */\n readonly size: string;\n readonly preview: readonly NumberedLine[];\n readonly hidden: number;\n /** Widest shown line number, in characters. */\n readonly gutter: number;\n}\n\nexport interface SearchCallView {\n readonly primary: string;\n readonly details: readonly string[];\n}\n\nexport interface ListResultView {\n readonly lines: readonly string[];\n readonly hidden: number;\n /** Pi's `[Truncated: ...]` warning, when the listing hit a limit. */\n readonly truncated: string | undefined;\n}\n\nfunction compactDetails(values: ReadonlyArray<string | undefined>): string[] {\n return values.filter((value): value is string => value !== undefined && value.length > 0);\n}\n\nfunction optionalCount(value: unknown, unit: string): string | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? `${value} ${unit}` : undefined;\n}\n\nfunction pathOrDot(value: unknown): string {\n return typeof value === 'string' && value.length > 0 ? value : '.';\n}\n\n/** Pi's size formatter, so the web warning names the same figure the TUI does. */\nexport function formatSize(bytes: number): string {\n if (bytes < KIBIBYTE) return `${bytes}B`;\n if (bytes < KIBIBYTE * KIBIBYTE) return `${(bytes / KIBIBYTE).toFixed(1)}KB`;\n return `${(bytes / (KIBIBYTE * KIBIBYTE)).toFixed(1)}MB`;\n}\n\n/** What the write call shows: the path, the content size, and a numbered preview of the file. */\nexport function writeCallView(args: Readonly<Record<string, unknown>>, expanded: boolean): WriteCallView {\n const content = typeof args.content === 'string' ? args.content : '';\n const path = typeof args.path === 'string' ? args.path : '';\n const size = `${content.length.toLocaleString('en-US')} chars`;\n if (content.length === 0) return { path, size, preview: [], hidden: 0, gutter: 1 };\n const lines = content.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (lines.at(-1) === '') lines.pop();\n const visible = expanded ? lines : lines.slice(0, WRITE_COLLAPSED_LINES);\n const preview = visible.map((text, index) => ({ number: index + 1, text }));\n return { path, size, preview, hidden: lines.length - visible.length, gutter: String(visible.length).length };\n}\n\n/** `pattern · path · N results`, as the find call heading lists them. */\nexport function findCallView(args: Readonly<Record<string, unknown>>): SearchCallView {\n return {\n primary: typeof args.pattern === 'string' ? args.pattern : '',\n details: compactDetails([pathOrDot(args.path), optionalCount(args.limit, 'results')]),\n };\n}\n\n/** `path · N entries`, as the ls call heading lists them. */\nexport function lsCallView(args: Readonly<Record<string, unknown>>): SearchCallView {\n return { primary: pathOrDot(args.path), details: compactDetails([optionalCount(args.limit, 'entries')]) };\n}\n\n/** The result's text, from its blocks when the view exists and from the joined output otherwise. */\nexport function resultText(result: ToolResultView | null, output: string): string {\n if (result === null) return output;\n return result.content\n .flatMap((block) => {\n const record = typeof block === 'object' && block !== null ? (block as { type?: unknown; text?: unknown }) : {};\n return record.type === 'text' && typeof record.text === 'string' ? [record.text] : [];\n })\n .join('\\n');\n}\n\n/**\n * A find or ls listing the way Pi's own renderer shows it: the lines,\n * collapsed to twenty, and the limit warning its details carry. `limitKey`\n * names the per-tool counter (resultLimitReached, entryLimitReached).\n */\nexport function listResultView(\n result: ToolResultView | null,\n output: string,\n expanded: boolean,\n limitKey: string,\n limitUnit: string,\n): ListResultView {\n const text = resultText(result, output).trim();\n const all = text.length === 0 ? [] : text.split('\\n');\n const lines = expanded ? all : all.slice(0, LIST_COLLAPSED_LINES);\n const details =\n typeof result?.details === 'object' && result.details !== null ? (result.details as Record<string, unknown>) : {};\n const limit = details[limitKey];\n const truncation =\n typeof details.truncation === 'object' && details.truncation !== null\n ? (details.truncation as Record<string, unknown>)\n : undefined;\n const warnings: string[] = [];\n if (typeof limit === 'number' && limit > 0) warnings.push(`${limit} ${limitUnit} limit`);\n if (truncation?.truncated === true) {\n warnings.push(\n `${formatSize(typeof truncation.maxBytes === 'number' ? truncation.maxBytes : DEFAULT_MAX_BYTES)} limit`,\n );\n }\n return {\n lines,\n hidden: all.length - lines.length,\n truncated: warnings.length > 0 ? `[Truncated: ${warnings.join(', ')}]` : undefined,\n };\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItemBody, MessageItemStatus } from '@agimon-ai/po-web-components';\n\nimport { listResultView, resultText } from '../_lib/builtinToolView';\n\n/**\n * The body shared by find and ls: Pi's listing lines, collapsed to twenty\n * until the item expands, with the limit warning its details carry.\n */\nexport function ListingBody({\n tool,\n limitKey,\n limitUnit,\n expanded,\n props,\n}: {\n tool: string;\n limitKey: string;\n limitUnit: string;\n expanded: boolean;\n props: ToolMessageRenderProps;\n}) {\n const { result, output, running, isError } = props;\n if (isError) {\n return (\n <MessageItemBody data-testid={`tool-result-${tool}`} className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n <span className=\"whitespace-pre-wrap break-words text-po-red\">{resultText(result, output)}</span>\n </MessageItemBody>\n );\n }\n if (result === null) {\n return running ? (\n <MessageItemBody data-testid={`tool-result-${tool}`}>\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null;\n }\n const view = listResultView(result, output, expanded, limitKey, limitUnit);\n if (view.lines.length === 0 && view.truncated === undefined) return null;\n return (\n <MessageItemBody data-testid={`tool-result-${tool}`} className=\"flex flex-col font-mono\">\n {view.lines.map((line, index) => (\n <span key={`${String(index)}-${line}`} className=\"whitespace-pre-wrap break-words text-po-text\">\n {line}\n </span>\n ))}\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more lines</MessageItemStatus> : null}\n {view.truncated !== undefined ? <span className=\"text-po-yellow\">{view.truncated}</span> : null}\n </MessageItemBody>\n );\n}\n\n/** Whether the listing hides lines while collapsed, so the item can offer its toggle. */\nexport function listingExpandable(props: ToolMessageRenderProps, limitKey: string, limitUnit: string): boolean {\n if (props.result === null || props.isError) return false;\n return listResultView(props.result, props.output, false, limitKey, limitUnit).hidden > 0;\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItem, MessageItemHeader, toolTone } from '@agimon-ai/po-web-components';\n\nimport { findCallView } from '../_lib/builtinToolView';\nimport { ListingBody } from './ListingBody';\n\nconst LIMIT_KEY = 'resultLimitReached';\nconst LIMIT_UNIT = 'results';\n\n/** The find tool's timeline item: `pattern · path · N results` over Pi's listing lines. */\nexport function FindToolMessage(props: ToolMessageRenderProps) {\n const view = findCallView(props.args);\n return (\n <MessageItem tone={toolTone({ running: props.running, isError: props.isError })} expandable>\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"find\">\n <span data-testid=\"tool-call-find\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"truncate text-po-text\">{view.primary}</span>\n {view.details.length > 0 ? (\n <span className=\"shrink-0 text-po-faint\">· {view.details.join(' · ')}</span>\n ) : null}\n </span>\n </MessageItemHeader>\n {expanded ? (\n <ListingBody tool=\"find\" limitKey={LIMIT_KEY} limitUnit={LIMIT_UNIT} expanded props={props} />\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { FindToolMessage } from './_components/FindToolMessage';\n\nexport default defineToolRenderer({ message: FindToolMessage });\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItem, MessageItemHeader, toolTone } from '@agimon-ai/po-web-components';\n\nimport { lsCallView } from '../_lib/builtinToolView';\nimport { ListingBody } from './ListingBody';\n\nconst LIMIT_KEY = 'entryLimitReached';\nconst LIMIT_UNIT = 'entries';\n\n/** The ls tool's timeline item: `path · N entries` over Pi's listing lines. */\nexport function LsToolMessage(props: ToolMessageRenderProps) {\n const view = lsCallView(props.args);\n return (\n <MessageItem tone={toolTone({ running: props.running, isError: props.isError })} expandable>\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"ls\">\n <span data-testid=\"tool-call-ls\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"truncate text-po-text\">{view.primary}</span>\n {view.details.length > 0 ? (\n <span className=\"shrink-0 text-po-faint\">· {view.details.join(' · ')}</span>\n ) : null}\n </span>\n </MessageItemHeader>\n {expanded ? (\n <ListingBody tool=\"ls\" limitKey={LIMIT_KEY} limitUnit={LIMIT_UNIT} expanded props={props} />\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { LsToolMessage } from './_components/LsToolMessage';\n\nexport default defineToolRenderer({ message: LsToolMessage });\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n SyntaxLine,\n ToolPathLink,\n toolTone,\n useSyntaxLines,\n} from '@agimon-ai/po-web-components';\n\nimport { resultText, type WriteCallView, writeCallView } from '../_lib/builtinToolView';\n\n/**\n * The numbered preview, coloured as the file it is about to become.\n *\n * Its own component so the highlighting hook has somewhere to live: the body\n * around it is picked inside a render prop. The preview is a prefix of the\n * content, so it parses as the file it came from up to wherever it was cut.\n */\nfunction WritePreview({ view, path }: { view: WriteCallView; path: string }) {\n const spans = useSyntaxLines(view.preview.map((line) => line.text).join('\\n'), { path });\n return (\n <>\n {view.preview.map((line, index) => (\n <span key={line.number} className=\"flex gap-2\">\n <span className=\"shrink-0 text-right text-po-faint\" style={{ width: `${String(view.gutter)}ch` }}>\n {line.number}\n </span>\n <SyntaxLine\n spans={spans?.[index]}\n text={line.text}\n className=\"min-w-0 whitespace-pre-wrap break-words text-po-text\"\n />\n </span>\n ))}\n </>\n );\n}\n\n/**\n * The write tool's timeline item: `path · N chars` in the header. Pi's write\n * result is silent on success, so expanding shows the numbered file content.\n * A failure shows the tool's message in red instead.\n */\nexport function WriteToolMessage({\n args,\n result,\n output,\n running,\n isError,\n fileTabFor,\n openTransientTab,\n}: ToolMessageRenderProps) {\n const collapsed = writeCallView(args, false);\n // The header names a file the tool is writing, so the reader can open it\n // rather than hunt for it; nothing installed to show files leaves it as text.\n const tab = fileTabFor(collapsed.path);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable>\n {({ expanded }) => {\n const view = expanded ? writeCallView(args, true) : collapsed;\n return (\n <>\n <MessageItemHeader title=\"write\">\n <span data-testid=\"tool-call-write\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <ToolPathLink\n path={view.path}\n {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })}\n />\n <span className=\"shrink-0 text-po-faint\">· {view.size}</span>\n </span>\n </MessageItemHeader>\n {!expanded ? null : isError ? (\n <MessageItemBody data-testid=\"tool-result-write\" className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n <span className=\"whitespace-pre-wrap break-words text-po-red\">{resultText(result, output)}</span>\n </MessageItemBody>\n ) : view.preview.length === 0 ? (\n running ? (\n <MessageItemBody data-testid=\"tool-result-write\">\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : (\n <MessageItemBody data-testid=\"tool-result-write\" className=\"flex flex-col font-mono\">\n <WritePreview view={view} path={view.path} />\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more lines</MessageItemStatus> : null}\n {running ? <MessageItemStatus tone=\"running\">running</MessageItemStatus> : null}\n </MessageItemBody>\n )}\n </>\n );\n }}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { WriteToolMessage } from './_components/WriteToolMessage';\n\nexport default defineToolRenderer({ message: WriteToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport toolFind from '../src/extensions/workspaces/sessions/(frontend)/tool/find.web';\nimport toolLs from '../src/extensions/workspaces/sessions/(frontend)/tool/ls.web';\nimport toolWrite from '../src/extensions/workspaces/sessions/(frontend)/tool/write.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'builtin-tools',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['find'] }, toolFind), via({ tools: ['ls'] }, toolLs), via({ tools: ['write'] }, toolWrite)]; },\n },\n});\n"],"mappings":";;;;AAMA,MAAM,oBAAoB;AAC1B,MAAM,WAAW;AA6BjB,SAAS,eAAe,QAAqD;CAC3E,OAAO,OAAO,QAAQ,UAA2B,UAAU,KAAA,KAAa,MAAM,SAAS,CAAC;AAC1F;AAEA,SAAS,cAAc,OAAgB,MAAkC;CACvE,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,GAAG,MAAM,GAAG,SAAS,KAAA;AACpF;AAEA,SAAS,UAAU,OAAwB;CACzC,OAAO,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ;AACjE;;AAGA,SAAgB,WAAW,OAAuB;CAChD,IAAI,QAAQ,UAAU,OAAO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Q,MAAM;IAAQ,CAAA,CACjF;GACf,CAAA,IAAA,KAAK,QAAQ,WAAW,IAC1B,UACE,oBAAC,iBAAD;IAAiB,eAAY;IAC3B,UAAA,oBAAC,mBAAD;KAAmB,MAAK;KAAU,UAAA;IAA0B,CAAA;GAC7C,CAAA,IACf,OAEJ,qBAAC,iBAAD;IAAiB,eAAY;IAAoB,WAAU;IAA3D,UAAA;KACE,oBAAC,cAAD;MAAoB;MAAM,MAAM,KAAK;KAAO,CAAA;KAC3C,KAAK,SAAS,IAAI,qBAAC,mBAAD;MAAmB,SAAA;MAAnB,UAAA,CAA4B,KAAK,QAAO,aAA8B;KAAI,CAAA,IAAA;KAC5F,UAAU,oBAAC,mBAAD;MAAmB,MAAK;MAAU,UAAA;KAA0B,CAAA,IAAI;IAC5D;GAEnB,CAAA,CAAA,EAAA,CAAA;EAEN;CACW,CAAA;AAEjB;;;AC7FA,IAAA,oBAAe,mBAAmB,EAAE,SAAS,iBAAiB,CAAC;;;ACG/D,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,YAAY,gBAAgB;CACvC,IAAI;CACJ,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO;GAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAGC,gBAAQ;GAAG,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAGC,cAAM;GAAG,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAGC,iBAAS;EAAC;CAAG,EACpL;AACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PoTelemetryOptions } from "@agimon-ai/po-telemetry";
|
|
1
|
+
import { PoTelemetryOptions } from "@agimon-ai/po-core/telemetry";
|
|
2
2
|
//#region src/services/telemetry/index.d.ts
|
|
3
3
|
declare const UI_EVENT: {
|
|
4
4
|
readonly leaderContributionRejected: 'po_pi_ui.leader_contribution_rejected';
|
|
@@ -27,4 +27,4 @@ interface UiTelemetry {
|
|
|
27
27
|
declare function createUiTelemetry(options?: UiTelemetryOptions): UiTelemetry;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { UiTelemetryOptions as a, UiTelemetry as i, UiEventAttributes as n, createUiTelemetry as o, UiEventName as r, UI_EVENT as t };
|
|
30
|
-
//# sourceMappingURL=index-
|
|
30
|
+
//# sourceMappingURL=index-DJvl27YF.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-DJvl27YF.d.mts","names":[],"sources":["../src/services/telemetry/index.ts"],"mappings":";;cAKa;WACX;WACA;WACA;WACA;WACA;WACA;;KAGU,sBAAsB,uBAAuB;KAC7C,oBAAoB;UAEf;EACf;EACA;EACA,MAAM,OAAO;EACb,mBAAmB,YAAY;EAC/B,QAAQ;;UAGO;EACf,YAAY,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACjF,cAAc,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACnF,YAAY,OAAO,aAAa,aAAa,oBAAoB;EACjE,SAAS;EACT,YAAY;;iBAGE,kBAAkB,UAAS,qBAA0B"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_harnessMetadata = require("./harnessMetadata-B3mBGrS3.cjs");
|
|
3
|
-
const require_telemetry = require("./telemetry-
|
|
3
|
+
const require_telemetry = require("./telemetry-DZXeC4kO.cjs");
|
|
4
4
|
const require_uiState = require("./uiState-CCytmxyX.cjs");
|
|
5
5
|
const require_theme = require("./theme-BfC_GGQ4.cjs");
|
|
6
6
|
exports.DEFAULT_THEME = require_theme.DEFAULT_THEME;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as readPoHarnessMetadata, t as PoHarnessMetadata } from "./harnessMetadata-BzMgOB0W.mjs";
|
|
2
|
-
import { a as UiTelemetryOptions, i as UiTelemetry, n as UiEventAttributes, o as createUiTelemetry, r as UiEventName, t as UI_EVENT } from "./index-
|
|
2
|
+
import { a as UiTelemetryOptions, i as UiTelemetry, n as UiEventAttributes, o as createUiTelemetry, r as UiEventName, t as UI_EVENT } from "./index-DJvl27YF.mjs";
|
|
3
3
|
import { n as LeaderSnapshot, r as PoUiState, t as LeaderOption } from "./uiState-DbjaVyxl.mjs";
|
|
4
4
|
import { a as DEFAULT_THEME, i as writeDefaultTheme, o as DEFAULT_THEME_NAME } from "./index-DFSkSBBh.mjs";
|
|
5
5
|
import { ConfigChoice, ConfigField, ConfigSection, ConfigStep, PoConfigActionInput, PoConfigContributionHandle, PoConfigContributionOptions } from "@agimon-ai/po-core/config";
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as readPoHarnessMetadata } from "./harnessMetadata-Ccv_j7WP.mjs";
|
|
2
|
-
import { n as createUiTelemetry, t as UI_EVENT } from "./telemetry-
|
|
2
|
+
import { n as createUiTelemetry, t as UI_EVENT } from "./telemetry-BvCR35jo.mjs";
|
|
3
3
|
import { t as PoUiState } from "./uiState-C7I5WcMl.mjs";
|
|
4
4
|
import { a as DEFAULT_THEME, i as writeDefaultTheme, o as DEFAULT_THEME_NAME } from "./theme-BX_hfErv.mjs";
|
|
5
5
|
export { DEFAULT_THEME, DEFAULT_THEME_NAME, PoUiState, UI_EVENT, createUiTelemetry, readPoHarnessMetadata, writeDefaultTheme };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_telemetry = require("./telemetry-
|
|
2
|
+
const require_telemetry = require("./telemetry-DZXeC4kO.cjs");
|
|
3
3
|
exports.UI_EVENT = require_telemetry.UI_EVENT;
|
|
4
4
|
exports.createUiTelemetry = require_telemetry.createUiTelemetry;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as UiTelemetryOptions, i as UiTelemetry, n as UiEventAttributes, o as createUiTelemetry, r as UiEventName, t as UI_EVENT } from "./index-
|
|
1
|
+
import { a as UiTelemetryOptions, i as UiTelemetry, n as UiEventAttributes, o as createUiTelemetry, r as UiEventName, t as UI_EVENT } from "./index-DJvl27YF.mjs";
|
|
2
2
|
export { UI_EVENT, type UiEventAttributes, type UiEventName, type UiTelemetry, type UiTelemetryOptions, createUiTelemetry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as UI_EVENT, n as createUiTelemetry } from "./telemetry-
|
|
1
|
+
export { t as UI_EVENT, n as createUiTelemetry } from "./telemetry-BvCR35jo.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createPoTelemetry } from "@agimon-ai/po-telemetry";
|
|
1
|
+
import { createPoTelemetry } from "@agimon-ai/po-core/telemetry";
|
|
2
2
|
//#region src/services/telemetry/index.ts
|
|
3
3
|
const SERVICE_NAME = "po-ui";
|
|
4
4
|
const PACKAGE_NAME = "@agimon-ai/po-ui";
|
|
@@ -33,4 +33,4 @@ function createUiTelemetry(options = {}) {
|
|
|
33
33
|
//#endregion
|
|
34
34
|
export { createUiTelemetry as n, UI_EVENT as t };
|
|
35
35
|
|
|
36
|
-
//# sourceMappingURL=telemetry-
|
|
36
|
+
//# sourceMappingURL=telemetry-BvCR35jo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-BvCR35jo.mjs","names":[],"sources":["../src/services/telemetry/index.ts"],"sourcesContent":["import { createPoTelemetry, type PoTelemetry, type PoTelemetryOptions } from '@agimon-ai/po-core/telemetry';\n\nconst SERVICE_NAME = 'po-ui';\nconst PACKAGE_NAME = '@agimon-ai/po-ui';\n\nexport const UI_EVENT = {\n leaderContributionRejected: 'po_pi_ui.leader_contribution_rejected',\n leaderCommandUnavailable: 'po_pi_ui.leader_command_unavailable',\n leaderActionUnavailable: 'po_pi_ui.leader_action_unavailable',\n themeApplyFailed: 'po_pi_ui.theme_apply_failed',\n shellInstalled: 'po_pi_ui.shell_installed',\n eventLoopStalled: 'po_pi_ui.event_loop_stalled',\n} as const;\n\nexport type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];\nexport type UiEventAttributes = Record<string, string | number | boolean>;\n\nexport interface UiTelemetryOptions {\n cwd?: string;\n workspaceRoot?: string;\n env?: NodeJS.ProcessEnv;\n telemetryFactory?: NonNullable<PoTelemetryOptions['telemetryFactory']>;\n warn?: (message: string) => void;\n}\n\nexport interface UiTelemetry {\n recordError(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordWarning(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordEvent(event: UiEventName, attributes?: UiEventAttributes): Promise<void>;\n flush(): Promise<void>;\n shutdown(): Promise<void>;\n}\n\nexport function createUiTelemetry(options: UiTelemetryOptions = {}): UiTelemetry {\n const telemetry: PoTelemetry = createPoTelemetry({\n serviceName: SERVICE_NAME,\n packageName: PACKAGE_NAME,\n cwd: options.cwd,\n workspaceRoot: options.workspaceRoot,\n env: options.env,\n telemetryFactory: options.telemetryFactory,\n warn: options.warn,\n enableLogs: true,\n enableTraces: true,\n });\n return {\n recordError: (event, error, attributes) => telemetry.recordError(event, error, attributes),\n recordWarning: (event, error, attributes) => telemetry.recordWarning(event, error, attributes),\n recordEvent: (event, attributes) => telemetry.recordEvent(event, attributes),\n flush: () => telemetry.flush(),\n shutdown: () => telemetry.shutdown(),\n };\n}\n"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,eAAe;AAErB,MAAa,WAAW;CACtB,4BAA4B;CAC5B,0BAA0B;CAC1B,yBAAyB;CACzB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;AACpB;AAqBA,SAAgB,kBAAkB,UAA8B,CAAC,GAAgB;CAC/E,MAAM,YAAyB,kBAAkB;EAC/C,aAAa;EACb,aAAa;EACb,KAAK,QAAQ;EACb,eAAe,QAAQ;EACvB,KAAK,QAAQ;EACb,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,YAAY;EACZ,cAAc;CAChB,CAAC;CACD,OAAO;EACL,cAAc,OAAO,OAAO,eAAe,UAAU,YAAY,OAAO,OAAO,UAAU;EACzF,gBAAgB,OAAO,OAAO,eAAe,UAAU,cAAc,OAAO,OAAO,UAAU;EAC7F,cAAc,OAAO,eAAe,UAAU,YAAY,OAAO,UAAU;EAC3E,aAAa,UAAU,MAAM;EAC7B,gBAAgB,UAAU,SAAS;CACrC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let
|
|
1
|
+
let _agimon_ai_po_core_telemetry = require("@agimon-ai/po-core/telemetry");
|
|
2
2
|
//#region src/services/telemetry/index.ts
|
|
3
3
|
const SERVICE_NAME = "po-ui";
|
|
4
4
|
const PACKAGE_NAME = "@agimon-ai/po-ui";
|
|
@@ -11,7 +11,7 @@ const UI_EVENT = {
|
|
|
11
11
|
eventLoopStalled: "po_pi_ui.event_loop_stalled"
|
|
12
12
|
};
|
|
13
13
|
function createUiTelemetry(options = {}) {
|
|
14
|
-
const telemetry = (0,
|
|
14
|
+
const telemetry = (0, _agimon_ai_po_core_telemetry.createPoTelemetry)({
|
|
15
15
|
serviceName: SERVICE_NAME,
|
|
16
16
|
packageName: PACKAGE_NAME,
|
|
17
17
|
cwd: options.cwd,
|
|
@@ -44,4 +44,4 @@ Object.defineProperty(exports, "createUiTelemetry", {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
//# sourceMappingURL=telemetry-
|
|
47
|
+
//# sourceMappingURL=telemetry-DZXeC4kO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-DZXeC4kO.cjs","names":["createPoTelemetry"],"sources":["../src/services/telemetry/index.ts"],"sourcesContent":["import { createPoTelemetry, type PoTelemetry, type PoTelemetryOptions } from '@agimon-ai/po-core/telemetry';\n\nconst SERVICE_NAME = 'po-ui';\nconst PACKAGE_NAME = '@agimon-ai/po-ui';\n\nexport const UI_EVENT = {\n leaderContributionRejected: 'po_pi_ui.leader_contribution_rejected',\n leaderCommandUnavailable: 'po_pi_ui.leader_command_unavailable',\n leaderActionUnavailable: 'po_pi_ui.leader_action_unavailable',\n themeApplyFailed: 'po_pi_ui.theme_apply_failed',\n shellInstalled: 'po_pi_ui.shell_installed',\n eventLoopStalled: 'po_pi_ui.event_loop_stalled',\n} as const;\n\nexport type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];\nexport type UiEventAttributes = Record<string, string | number | boolean>;\n\nexport interface UiTelemetryOptions {\n cwd?: string;\n workspaceRoot?: string;\n env?: NodeJS.ProcessEnv;\n telemetryFactory?: NonNullable<PoTelemetryOptions['telemetryFactory']>;\n warn?: (message: string) => void;\n}\n\nexport interface UiTelemetry {\n recordError(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordWarning(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordEvent(event: UiEventName, attributes?: UiEventAttributes): Promise<void>;\n flush(): Promise<void>;\n shutdown(): Promise<void>;\n}\n\nexport function createUiTelemetry(options: UiTelemetryOptions = {}): UiTelemetry {\n const telemetry: PoTelemetry = createPoTelemetry({\n serviceName: SERVICE_NAME,\n packageName: PACKAGE_NAME,\n cwd: options.cwd,\n workspaceRoot: options.workspaceRoot,\n env: options.env,\n telemetryFactory: options.telemetryFactory,\n warn: options.warn,\n enableLogs: true,\n enableTraces: true,\n });\n return {\n recordError: (event, error, attributes) => telemetry.recordError(event, error, attributes),\n recordWarning: (event, error, attributes) => telemetry.recordWarning(event, error, attributes),\n recordEvent: (event, attributes) => telemetry.recordEvent(event, attributes),\n flush: () => telemetry.flush(),\n shutdown: () => telemetry.shutdown(),\n };\n}\n"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,eAAe;AAErB,MAAa,WAAW;CACtB,4BAA4B;CAC5B,0BAA0B;CAC1B,yBAAyB;CACzB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;AACpB;AAqBA,SAAgB,kBAAkB,UAA8B,CAAC,GAAgB;CAC/E,MAAM,aAAA,GAAyBA,6BAAAA,kBAAAA,CAAkB;EAC/C,aAAa;EACb,aAAa;EACb,KAAK,QAAQ;EACb,eAAe,QAAQ;EACvB,KAAK,QAAQ;EACb,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,YAAY;EACZ,cAAc;CAChB,CAAC;CACD,OAAO;EACL,cAAc,OAAO,OAAO,eAAe,UAAU,YAAY,OAAO,OAAO,UAAU;EACzF,gBAAgB,OAAO,OAAO,eAAe,UAAU,cAAc,OAAO,OAAO,UAAU;EAC7F,cAAc,OAAO,eAAe,UAAU,YAAY,OAAO,UAAU;EAC3E,aAAa,UAAU,MAAM;EAC7B,gBAAgB,UAAU,SAAS;CACrC;AACF"}
|
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.41",
|
|
4
4
|
"description": "Leader-key menus, themes, and TUI components for Po and Pi extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"bugs": {
|
|
19
19
|
"url": "https://github.com/AgiFlow/po/issues"
|
|
20
20
|
},
|
|
21
|
-
"license": "
|
|
21
|
+
"license": "BUSL-1.1",
|
|
22
22
|
"author": "Vuong Ngo",
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
@@ -110,34 +110,33 @@
|
|
|
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-
|
|
117
|
-
"@
|
|
118
|
-
"@deepseek-ai/cordis": "4.0.4",
|
|
113
|
+
"@agimon-ai/po-core": "0.0.0-alpha.41",
|
|
114
|
+
"@agimon-ai/po-hashline": "0.0.0-alpha.41",
|
|
115
|
+
"@agimon-ai/po-minor-mode": "0.0.0-alpha.41",
|
|
116
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.41",
|
|
117
|
+
"@deepseek-ai/cordis": "4.0.5",
|
|
119
118
|
"yaml": "2.9.1"
|
|
120
119
|
},
|
|
121
120
|
"devDependencies": {
|
|
122
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
123
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
124
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
125
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
121
|
+
"@agimon-ai/po-build": "0.0.0-alpha.41",
|
|
122
|
+
"@agimon-ai/po-core": "0.0.0-alpha.41",
|
|
123
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.41",
|
|
124
|
+
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
126
125
|
"@tanstack/react-store": "0.11.2",
|
|
127
126
|
"@tanstack/store": "0.11.2",
|
|
128
127
|
"@types/node": "26.6.5",
|
|
129
128
|
"@types/react": "19.3.0",
|
|
130
129
|
"@vitest/coverage-v8": "5.0.4",
|
|
131
|
-
"react": "19.3.
|
|
132
|
-
"react-dom": "19.3.
|
|
130
|
+
"react": "19.3.1",
|
|
131
|
+
"react-dom": "19.3.1",
|
|
133
132
|
"tsdown": "0.23.1",
|
|
134
133
|
"typescript": "7.0.2",
|
|
135
134
|
"vitest": "5.0.4"
|
|
136
135
|
},
|
|
137
136
|
"peerDependencies": {
|
|
138
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
139
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
140
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
137
|
+
"@agimon-ai/po-core": "0.0.0-alpha.41",
|
|
138
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.41",
|
|
139
|
+
"@earendil-works/pi-coding-agent": "1.3.0"
|
|
141
140
|
},
|
|
142
141
|
"peerDependenciesMeta": {
|
|
143
142
|
"@agimon-ai/po-web-components": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry-EXlQc9s0.cjs","names":["createPoTelemetry"],"sources":["../src/services/telemetry/index.ts"],"sourcesContent":["import { createPoTelemetry, type PoTelemetry, type PoTelemetryOptions } from '@agimon-ai/po-telemetry';\n\nconst SERVICE_NAME = 'po-ui';\nconst PACKAGE_NAME = '@agimon-ai/po-ui';\n\nexport const UI_EVENT = {\n leaderContributionRejected: 'po_pi_ui.leader_contribution_rejected',\n leaderCommandUnavailable: 'po_pi_ui.leader_command_unavailable',\n leaderActionUnavailable: 'po_pi_ui.leader_action_unavailable',\n themeApplyFailed: 'po_pi_ui.theme_apply_failed',\n shellInstalled: 'po_pi_ui.shell_installed',\n eventLoopStalled: 'po_pi_ui.event_loop_stalled',\n} as const;\n\nexport type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];\nexport type UiEventAttributes = Record<string, string | number | boolean>;\n\nexport interface UiTelemetryOptions {\n cwd?: string;\n workspaceRoot?: string;\n env?: NodeJS.ProcessEnv;\n telemetryFactory?: NonNullable<PoTelemetryOptions['telemetryFactory']>;\n warn?: (message: string) => void;\n}\n\nexport interface UiTelemetry {\n recordError(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordWarning(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordEvent(event: UiEventName, attributes?: UiEventAttributes): Promise<void>;\n flush(): Promise<void>;\n shutdown(): Promise<void>;\n}\n\nexport function createUiTelemetry(options: UiTelemetryOptions = {}): UiTelemetry {\n const telemetry: PoTelemetry = createPoTelemetry({\n serviceName: SERVICE_NAME,\n packageName: PACKAGE_NAME,\n cwd: options.cwd,\n workspaceRoot: options.workspaceRoot,\n env: options.env,\n telemetryFactory: options.telemetryFactory,\n warn: options.warn,\n enableLogs: true,\n enableTraces: true,\n });\n return {\n recordError: (event, error, attributes) => telemetry.recordError(event, error, attributes),\n recordWarning: (event, error, attributes) => telemetry.recordWarning(event, error, attributes),\n recordEvent: (event, attributes) => telemetry.recordEvent(event, attributes),\n flush: () => telemetry.flush(),\n shutdown: () => telemetry.shutdown(),\n };\n}\n"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,eAAe;AAErB,MAAa,WAAW;CACtB,4BAA4B;CAC5B,0BAA0B;CAC1B,yBAAyB;CACzB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;AACpB;AAqBA,SAAgB,kBAAkB,UAA8B,CAAC,GAAgB;CAC/E,MAAM,aAAA,GAAyBA,wBAAAA,kBAAAA,CAAkB;EAC/C,aAAa;EACb,aAAa;EACb,KAAK,QAAQ;EACb,eAAe,QAAQ;EACvB,KAAK,QAAQ;EACb,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,YAAY;EACZ,cAAc;CAChB,CAAC;CACD,OAAO;EACL,cAAc,OAAO,OAAO,eAAe,UAAU,YAAY,OAAO,OAAO,UAAU;EACzF,gBAAgB,OAAO,OAAO,eAAe,UAAU,cAAc,OAAO,OAAO,UAAU;EAC7F,cAAc,OAAO,eAAe,UAAU,YAAY,OAAO,UAAU;EAC3E,aAAa,UAAU,MAAM;EAC7B,gBAAgB,UAAU,SAAS;CACrC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry-RiFqd0cg.mjs","names":[],"sources":["../src/services/telemetry/index.ts"],"sourcesContent":["import { createPoTelemetry, type PoTelemetry, type PoTelemetryOptions } from '@agimon-ai/po-telemetry';\n\nconst SERVICE_NAME = 'po-ui';\nconst PACKAGE_NAME = '@agimon-ai/po-ui';\n\nexport const UI_EVENT = {\n leaderContributionRejected: 'po_pi_ui.leader_contribution_rejected',\n leaderCommandUnavailable: 'po_pi_ui.leader_command_unavailable',\n leaderActionUnavailable: 'po_pi_ui.leader_action_unavailable',\n themeApplyFailed: 'po_pi_ui.theme_apply_failed',\n shellInstalled: 'po_pi_ui.shell_installed',\n eventLoopStalled: 'po_pi_ui.event_loop_stalled',\n} as const;\n\nexport type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];\nexport type UiEventAttributes = Record<string, string | number | boolean>;\n\nexport interface UiTelemetryOptions {\n cwd?: string;\n workspaceRoot?: string;\n env?: NodeJS.ProcessEnv;\n telemetryFactory?: NonNullable<PoTelemetryOptions['telemetryFactory']>;\n warn?: (message: string) => void;\n}\n\nexport interface UiTelemetry {\n recordError(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordWarning(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordEvent(event: UiEventName, attributes?: UiEventAttributes): Promise<void>;\n flush(): Promise<void>;\n shutdown(): Promise<void>;\n}\n\nexport function createUiTelemetry(options: UiTelemetryOptions = {}): UiTelemetry {\n const telemetry: PoTelemetry = createPoTelemetry({\n serviceName: SERVICE_NAME,\n packageName: PACKAGE_NAME,\n cwd: options.cwd,\n workspaceRoot: options.workspaceRoot,\n env: options.env,\n telemetryFactory: options.telemetryFactory,\n warn: options.warn,\n enableLogs: true,\n enableTraces: true,\n });\n return {\n recordError: (event, error, attributes) => telemetry.recordError(event, error, attributes),\n recordWarning: (event, error, attributes) => telemetry.recordWarning(event, error, attributes),\n recordEvent: (event, attributes) => telemetry.recordEvent(event, attributes),\n flush: () => telemetry.flush(),\n shutdown: () => telemetry.shutdown(),\n };\n}\n"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,eAAe;AAErB,MAAa,WAAW;CACtB,4BAA4B;CAC5B,0BAA0B;CAC1B,yBAAyB;CACzB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;AACpB;AAqBA,SAAgB,kBAAkB,UAA8B,CAAC,GAAgB;CAC/E,MAAM,YAAyB,kBAAkB;EAC/C,aAAa;EACb,aAAa;EACb,KAAK,QAAQ;EACb,eAAe,QAAQ;EACvB,KAAK,QAAQ;EACb,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,YAAY;EACZ,cAAc;CAChB,CAAC;CACD,OAAO;EACL,cAAc,OAAO,OAAO,eAAe,UAAU,YAAY,OAAO,OAAO,UAAU;EACzF,gBAAgB,OAAO,OAAO,eAAe,UAAU,cAAc,OAAO,OAAO,UAAU;EAC7F,cAAc,OAAO,eAAe,UAAU,YAAY,OAAO,UAAU;EAC3E,aAAa,UAAU,MAAM;EAC7B,gBAAgB,UAAU,SAAS;CACrC;AACF"}
|