@agimon-ai/po-ui 0.0.0-alpha.2 → 0.0.0-alpha.21
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/config.d.mts +2 -2
- package/dist/config.mjs +1 -2
- package/dist/extensionName.cjs +66 -16
- package/dist/extensionName.cjs.map +1 -1
- package/dist/extensionName.d.mts +13 -1
- package/dist/extensionName.d.mts.map +1 -1
- package/dist/extensionName.mjs +64 -16
- package/dist/extensionName.mjs.map +1 -1
- package/dist/extensions/mcp-ui.mjs.map +1 -1
- package/dist/extensions/mcp.cjs +3 -3
- package/dist/extensions/mcp.cjs.map +1 -1
- package/dist/extensions/mcp.d.mts +1 -1
- package/dist/extensions/mcp.mjs +4 -4
- package/dist/extensions/mcp.mjs.map +1 -1
- package/dist/extensions/server.cjs +7 -7
- 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 +7 -7
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +11 -11
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/footer.d.mts +2 -2
- package/dist/footer.mjs +1 -2
- package/dist/{harnessMetadata-Dw9Rb1nW.cjs → harnessMetadata-B3mBGrS3.cjs} +4 -4
- package/dist/harnessMetadata-B3mBGrS3.cjs.map +1 -0
- package/dist/{harnessMetadata-CzsdGAxL.d.mts → harnessMetadata-BzMgOB0W.d.mts} +4 -4
- package/dist/harnessMetadata-BzMgOB0W.d.mts.map +1 -0
- package/dist/{harnessMetadata-DkMSJutN.mjs → harnessMetadata-Ccv_j7WP.mjs} +3 -3
- package/dist/harnessMetadata-Ccv_j7WP.mjs.map +1 -0
- package/dist/harnessMetadata.cjs +2 -2
- package/dist/harnessMetadata.d.mts +2 -2
- package/dist/harnessMetadata.mjs +1 -2
- package/dist/{index-Bx49wmE7.d.mts → index-2GW2dj0I.d.mts} +9 -9
- package/dist/{index-Bx49wmE7.d.mts.map → index-2GW2dj0I.d.mts.map} +1 -1
- package/dist/{index-Dpzvl-vg.d.mts → index-DFSkSBBh.d.mts} +19 -11
- package/dist/index-DFSkSBBh.d.mts.map +1 -0
- package/dist/index.cjs +6 -6
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +5 -5
- package/dist/leader.d.mts +2 -2
- package/dist/leaderRegistry.cjs +2 -2
- package/dist/leaderRegistry.cjs.map +1 -1
- package/dist/leaderRegistry.d.mts +15 -15
- package/dist/leaderRegistry.d.mts.map +1 -1
- package/dist/leaderRegistry.mjs +2 -2
- package/dist/leaderRegistry.mjs.map +1 -1
- package/dist/logSinkTelemetry.cjs +1 -1
- package/dist/logSinkTelemetry.d.mts +1 -1
- package/dist/logSinkTelemetry.mjs +1 -2
- package/dist/skills.cjs +8 -8
- package/dist/skills.d.mts +2 -2
- package/dist/skills.mjs +1 -2
- package/dist/{telemetry-DMR6cIT1.cjs → telemetry-EXlQc9s0.cjs} +8 -8
- package/dist/telemetry-EXlQc9s0.cjs.map +1 -0
- package/dist/{telemetry--EgKB9ei.mjs → telemetry-RiFqd0cg.mjs} +9 -9
- package/dist/telemetry-RiFqd0cg.mjs.map +1 -0
- package/dist/{theme-Byj_dBlT.mjs → theme-BX_hfErv.mjs} +60 -40
- package/dist/theme-BX_hfErv.mjs.map +1 -0
- package/dist/{theme-2wveit5V.cjs → theme-BfC_GGQ4.cjs} +66 -40
- package/dist/theme-BfC_GGQ4.cjs.map +1 -0
- package/dist/theme.cjs +2 -1
- package/dist/theme.d.mts +2 -2
- package/dist/theme.mjs +1 -2
- package/dist/toolInventory.mjs +1 -2
- package/dist/{uiState-G_Pso-5i.mjs → uiState-C7I5WcMl.mjs} +3 -3
- package/dist/uiState-C7I5WcMl.mjs.map +1 -0
- package/dist/{uiState-rUwgKslb.cjs → uiState-CCytmxyX.cjs} +4 -4
- package/dist/uiState-CCytmxyX.cjs.map +1 -0
- package/dist/{uiState-Binu4nUb.d.mts → uiState-DbjaVyxl.d.mts} +3 -3
- package/dist/{uiState-Binu4nUb.d.mts.map → uiState-DbjaVyxl.d.mts.map} +1 -1
- package/dist/uiState.cjs +2 -2
- package/dist/uiState.d.mts +2 -2
- package/dist/uiState.mjs +1 -2
- package/package.json +19 -19
- package/dist/harnessMetadata-CzsdGAxL.d.mts.map +0 -1
- package/dist/harnessMetadata-DkMSJutN.mjs.map +0 -1
- package/dist/harnessMetadata-Dw9Rb1nW.cjs.map +0 -1
- package/dist/index-Dpzvl-vg.d.mts.map +0 -1
- package/dist/telemetry--EgKB9ei.mjs.map +0 -1
- package/dist/telemetry-DMR6cIT1.cjs.map +0 -1
- package/dist/theme-2wveit5V.cjs.map +0 -1
- package/dist/theme-Byj_dBlT.mjs.map +0 -1
- package/dist/uiState-G_Pso-5i.mjs.map +0 -1
- package/dist/uiState-rUwgKslb.cjs.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"}
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CONFIG_ACTION, ConfigAction, ConfigActionSchema, ConfigChoice, ConfigChoiceSchema, ConfigField, ConfigFieldKind, ConfigFieldKindSchema, ConfigFieldSchema, ConfigProgress, ConfigProgressSchema, ConfigSection, ConfigSectionSchema, ConfigSnapshot, ConfigSourceRef, ConfigSourceSchema, ConfigStatus, ConfigStatusSchema, ConfigStep, ConfigStepSchema,
|
|
2
|
-
export { CONFIG_ACTION, type ConfigAction, ConfigActionSchema, type ConfigChoice, ConfigChoiceSchema, type ConfigField, type ConfigFieldKind, ConfigFieldKindSchema, ConfigFieldSchema, type ConfigProgress, ConfigProgressSchema, type ConfigSection, ConfigSectionSchema, type ConfigSnapshot, type ConfigSourceRef, ConfigSourceSchema, type ConfigStatus, ConfigStatusSchema, type ConfigStep, ConfigStepSchema, type
|
|
1
|
+
import { CONFIG_ACTION, ConfigAction, ConfigActionSchema, ConfigChoice, ConfigChoiceSchema, ConfigField, ConfigFieldKind, ConfigFieldKindSchema, ConfigFieldSchema, ConfigProgress, ConfigProgressSchema, ConfigSection, ConfigSectionSchema, ConfigSnapshot, ConfigSourceRef, ConfigSourceSchema, ConfigStatus, ConfigStatusSchema, ConfigStep, ConfigStepSchema, PoConfigActionInput, PoConfigContributionHandle, PoConfigContributionOptions, PoConfigInvocation, PoConfigSectionView, PoExtensionContext } from "@agimon-ai/po-core/config";
|
|
2
|
+
export { CONFIG_ACTION, type ConfigAction, ConfigActionSchema, type ConfigChoice, ConfigChoiceSchema, type ConfigField, type ConfigFieldKind, ConfigFieldKindSchema, ConfigFieldSchema, type ConfigProgress, ConfigProgressSchema, type ConfigSection, ConfigSectionSchema, type ConfigSnapshot, type ConfigSourceRef, ConfigSourceSchema, type ConfigStatus, ConfigStatusSchema, type ConfigStep, ConfigStepSchema, type PoConfigActionInput, type PoConfigContributionHandle, type PoConfigContributionOptions, type PoConfigInvocation, type PoConfigSectionView, type PoExtensionContext };
|
package/dist/config.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { CONFIG_ACTION, ConfigActionSchema, ConfigChoiceSchema, ConfigFieldKindSchema, ConfigFieldSchema, ConfigProgressSchema, ConfigSectionSchema, ConfigSourceSchema, ConfigStatusSchema, ConfigStepSchema };
|
|
1
|
+
export { CONFIG_ACTION, ConfigActionSchema, ConfigChoiceSchema, ConfigFieldKindSchema, ConfigFieldSchema, ConfigProgressSchema, ConfigSectionSchema, ConfigSourceSchema, ConfigStatusSchema, ConfigStepSchema } from "@agimon-ai/po-core/config";
|
package/dist/extensionName.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
3
|
-
let node_fs = require("node:fs");
|
|
4
|
-
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
5
3
|
let node_path = require("node:path");
|
|
6
4
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
7
|
-
|
|
5
|
+
let node_fs = require("node:fs");
|
|
6
|
+
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
7
|
+
//#region src/services/extensionSource/packageName.ts
|
|
8
8
|
/**
|
|
9
9
|
* Display name for an extension that Pi could not attribute to a package.
|
|
10
10
|
*
|
|
@@ -14,26 +14,47 @@ node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
|
14
14
|
* package that registered the tools.
|
|
15
15
|
*/
|
|
16
16
|
/** Results are stable for the life of a session, and every source hits the same few dirs. */
|
|
17
|
-
const
|
|
17
|
+
const nameCache = /* @__PURE__ */ new Map();
|
|
18
18
|
const packageCache = /* @__PURE__ */ new Map();
|
|
19
|
+
const MANIFEST_FILE = "package.json";
|
|
20
|
+
/** The manifest's non-empty name; undefined for a malformed or nameless manifest. */
|
|
21
|
+
function manifestPackageName(text) {
|
|
22
|
+
try {
|
|
23
|
+
const manifest = JSON.parse(text);
|
|
24
|
+
return typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name : void 0;
|
|
25
|
+
} catch {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** The next directory to search, or undefined at the filesystem root. */
|
|
30
|
+
function parentDirectory(directory) {
|
|
31
|
+
const parent = node_path.default.dirname(directory);
|
|
32
|
+
return parent === directory ? void 0 : parent;
|
|
33
|
+
}
|
|
34
|
+
/** `@agimon-ai/po-task` reads as `po-task`; the scope is noise in a tree. */
|
|
35
|
+
function displayExtensionName(name, entryPath) {
|
|
36
|
+
return name ? name.split("/").pop() ?? name : node_path.default.basename(entryPath, node_path.default.extname(entryPath));
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/services/extensionSource/sync.ts
|
|
19
40
|
function packageName(directory) {
|
|
20
|
-
let current = directory;
|
|
21
|
-
|
|
41
|
+
for (let current = directory; current !== void 0; current = parentDirectory(current)) {
|
|
42
|
+
let text;
|
|
22
43
|
try {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
44
|
+
text = node_fs.default.readFileSync(node_path.default.join(current, MANIFEST_FILE), "utf8");
|
|
45
|
+
} catch {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const name = manifestPackageName(text);
|
|
49
|
+
if (name) return name;
|
|
29
50
|
}
|
|
30
51
|
}
|
|
52
|
+
/** @deprecated Node-only sync shim; use readExtensionName. Removed in M2. */
|
|
31
53
|
function extensionName(entryPath) {
|
|
32
|
-
const cached =
|
|
54
|
+
const cached = nameCache.get(entryPath);
|
|
33
55
|
if (cached !== void 0) return cached;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
cache.set(entryPath, resolved);
|
|
56
|
+
const resolved = displayExtensionName(packageName(node_path.default.dirname(entryPath)), entryPath);
|
|
57
|
+
nameCache.set(entryPath, resolved);
|
|
37
58
|
return resolved;
|
|
38
59
|
}
|
|
39
60
|
/**
|
|
@@ -44,6 +65,8 @@ function extensionName(entryPath) {
|
|
|
44
65
|
* `@agimon-ai/po-team`, so joining a registered tool back to the layer that
|
|
45
66
|
* admitted it needs the unshortened name. Attribution and display are different
|
|
46
67
|
* jobs, so they get different functions rather than one lossy one.
|
|
68
|
+
*
|
|
69
|
+
* @deprecated Node-only sync shim; use readExtensionPackageName. Removed in M2.
|
|
47
70
|
*/
|
|
48
71
|
function extensionPackageName(entryPath) {
|
|
49
72
|
const cached = packageCache.get(entryPath);
|
|
@@ -53,7 +76,34 @@ function extensionPackageName(entryPath) {
|
|
|
53
76
|
return name;
|
|
54
77
|
}
|
|
55
78
|
//#endregion
|
|
79
|
+
//#region src/services/extensionSource/index.ts
|
|
80
|
+
async function readPackageName(fs, directory, context) {
|
|
81
|
+
for (let current = directory; current !== void 0; current = parentDirectory(current)) {
|
|
82
|
+
const text = await fs.readTextFile(node_path.default.join(current, MANIFEST_FILE), context);
|
|
83
|
+
const name = text.ok ? manifestPackageName(text.value) : void 0;
|
|
84
|
+
if (name) return name;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** Display name of the package that owns an extension entry, read through `fs`. */
|
|
88
|
+
async function readExtensionName(fs, entryPath, context) {
|
|
89
|
+
const cached = nameCache.get(entryPath);
|
|
90
|
+
if (cached !== void 0) return cached;
|
|
91
|
+
const resolved = displayExtensionName(await readPackageName(fs, node_path.default.dirname(entryPath), context), entryPath);
|
|
92
|
+
nameCache.set(entryPath, resolved);
|
|
93
|
+
return resolved;
|
|
94
|
+
}
|
|
95
|
+
/** The owning package name with its scope, read through `fs`; see `extensionPackageName`. */
|
|
96
|
+
async function readExtensionPackageName(fs, entryPath, context) {
|
|
97
|
+
const cached = packageCache.get(entryPath);
|
|
98
|
+
if (cached !== void 0) return cached.name;
|
|
99
|
+
const name = await readPackageName(fs, node_path.default.dirname(entryPath), context);
|
|
100
|
+
packageCache.set(entryPath, { name });
|
|
101
|
+
return name;
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
56
104
|
exports.extensionName = extensionName;
|
|
57
105
|
exports.extensionPackageName = extensionPackageName;
|
|
106
|
+
exports.readExtensionName = readExtensionName;
|
|
107
|
+
exports.readExtensionPackageName = readExtensionPackageName;
|
|
58
108
|
|
|
59
109
|
//# sourceMappingURL=extensionName.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionName.cjs","names":["fs","path"],"sources":["../src/services/extensionSource/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"extensionName.cjs","names":["path","fs","path","path"],"sources":["../src/services/extensionSource/packageName.ts","../src/services/extensionSource/sync.ts","../src/services/extensionSource/index.ts"],"sourcesContent":["import path from 'node:path';\n\n/**\n * Display name for an extension that Pi could not attribute to a package.\n *\n * Pi stamps every `--extension <path>` argument with the literal source `cli`,\n * and po launches all of its extensions that way, so the only surviving\n * identity is the entry path. The nearest `package.json` above it names the\n * package that registered the tools.\n */\n\n/** Results are stable for the life of a session, and every source hits the same few dirs. */\nexport const nameCache = new Map<string, string>();\n// Wrapped, because \"no package above this path\" is a real answer worth caching\n// and a bare undefined cannot be told apart from a miss.\nexport const packageCache = new Map<string, { readonly name: string | undefined }>();\n\nexport const MANIFEST_FILE = 'package.json';\n\n/** The manifest's non-empty name; undefined for a malformed or nameless manifest. */\nexport function manifestPackageName(text: string): string | undefined {\n try {\n const manifest = JSON.parse(text) as { name?: unknown };\n return typeof manifest.name === 'string' && manifest.name.length > 0 ? manifest.name : undefined;\n } catch {\n // An unreadable manifest names nothing; keep walking up.\n return undefined;\n }\n}\n\n/** The next directory to search, or undefined at the filesystem root. */\nexport function parentDirectory(directory: string): string | undefined {\n const parent = path.dirname(directory);\n return parent === directory ? undefined : parent;\n}\n\n/** `@agimon-ai/po-task` reads as `po-task`; the scope is noise in a tree. */\nexport function displayExtensionName(name: string | undefined, entryPath: string): string {\n return name ? (name.split('/').pop() ?? name) : path.basename(entryPath, path.extname(entryPath));\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n MANIFEST_FILE,\n displayExtensionName,\n manifestPackageName,\n nameCache,\n packageCache,\n parentDirectory,\n} from './packageName';\n\nfunction packageName(directory: string): string | undefined {\n for (let current: string | undefined = directory; current !== undefined; current = parentDirectory(current)) {\n let text: string;\n try {\n text = fs.readFileSync(path.join(current, MANIFEST_FILE), 'utf8');\n } catch {\n // No manifest here; keep walking up.\n continue;\n }\n const name = manifestPackageName(text);\n if (name) return name;\n }\n return undefined;\n}\n\n/** @deprecated Node-only sync shim; use readExtensionName. Removed in M2. */\nexport function extensionName(entryPath: string): string {\n const cached = nameCache.get(entryPath);\n if (cached !== undefined) return cached;\n const resolved = displayExtensionName(packageName(path.dirname(entryPath)), entryPath);\n nameCache.set(entryPath, resolved);\n return resolved;\n}\n\n/**\n * The package name exactly as a manifest spells it, scope and all.\n *\n * `extensionName` drops the scope because a tree reads better without it, but\n * that makes it useless as a key: `.po/modes.yaml` names packages as\n * `@agimon-ai/po-team`, so joining a registered tool back to the layer that\n * admitted it needs the unshortened name. Attribution and display are different\n * jobs, so they get different functions rather than one lossy one.\n *\n * @deprecated Node-only sync shim; use readExtensionPackageName. Removed in M2.\n */\nexport function extensionPackageName(entryPath: string): string | undefined {\n const cached = packageCache.get(entryPath);\n if (cached !== undefined) return cached.name;\n const name = packageName(path.dirname(entryPath));\n packageCache.set(entryPath, { name });\n return name;\n}\n","import path from 'node:path';\n\nimport type { FileSystem } from '@agimon-ai/po-core/platform';\n\nimport {\n MANIFEST_FILE,\n displayExtensionName,\n manifestPackageName,\n nameCache,\n packageCache,\n parentDirectory,\n} from './packageName';\n\nexport { extensionName, extensionPackageName } from './sync';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nasync function readPackageName(fs: FileSystem, directory: string, context: IoContext): Promise<string | undefined> {\n for (let current: string | undefined = directory; current !== undefined; current = parentDirectory(current)) {\n const text = await fs.readTextFile(path.join(current, MANIFEST_FILE), context);\n // No readable manifest here; keep walking up.\n const name = text.ok ? manifestPackageName(text.value) : undefined;\n if (name) return name;\n }\n return undefined;\n}\n\n/** Display name of the package that owns an extension entry, read through `fs`. */\nexport async function readExtensionName(fs: FileSystem, entryPath: string, context: IoContext): Promise<string> {\n const cached = nameCache.get(entryPath);\n if (cached !== undefined) return cached;\n const resolved = displayExtensionName(await readPackageName(fs, path.dirname(entryPath), context), entryPath);\n nameCache.set(entryPath, resolved);\n return resolved;\n}\n\n/** The owning package name with its scope, read through `fs`; see `extensionPackageName`. */\nexport async function readExtensionPackageName(\n fs: FileSystem,\n entryPath: string,\n context: IoContext,\n): Promise<string | undefined> {\n const cached = packageCache.get(entryPath);\n if (cached !== undefined) return cached.name;\n const name = await readPackageName(fs, path.dirname(entryPath), context);\n packageCache.set(entryPath, { name });\n return name;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAYA,MAAa,4BAAY,IAAI,IAAoB;AAGjD,MAAa,+BAAe,IAAI,IAAmD;AAEnF,MAAa,gBAAgB;;AAG7B,SAAgB,oBAAoB,MAAkC;CACpE,IAAI;EACF,MAAM,WAAW,KAAK,MAAM,IAAI;EAChC,OAAO,OAAO,SAAS,SAAS,YAAY,SAAS,KAAK,SAAS,IAAI,SAAS,OAAO,KAAA;CACzF,QAAQ;EAEN;CACF;AACF;;AAGA,SAAgB,gBAAgB,WAAuC;CACrE,MAAM,SAASA,UAAAA,QAAK,QAAQ,SAAS;CACrC,OAAO,WAAW,YAAY,KAAA,IAAY;AAC5C;;AAGA,SAAgB,qBAAqB,MAA0B,WAA2B;CACxF,OAAO,OAAQ,KAAK,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,OAAQA,UAAAA,QAAK,SAAS,WAAWA,UAAAA,QAAK,QAAQ,SAAS,CAAC;AAClG;;;AC3BA,SAAS,YAAY,WAAuC;CAC1D,KAAK,IAAI,UAA8B,WAAW,YAAY,KAAA,GAAW,UAAU,gBAAgB,OAAO,GAAG;EAC3G,IAAI;EACJ,IAAI;GACF,OAAOC,QAAAA,QAAG,aAAaC,UAAAA,QAAK,KAAK,SAAS,aAAa,GAAG,MAAM;EAClE,QAAQ;GAEN;EACF;EACA,MAAM,OAAO,oBAAoB,IAAI;EACrC,IAAI,MAAM,OAAO;CACnB;AAEF;;AAGA,SAAgB,cAAc,WAA2B;CACvD,MAAM,SAAS,UAAU,IAAI,SAAS;CACtC,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,MAAM,WAAW,qBAAqB,YAAYA,UAAAA,QAAK,QAAQ,SAAS,CAAC,GAAG,SAAS;CACrF,UAAU,IAAI,WAAW,QAAQ;CACjC,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,qBAAqB,WAAuC;CAC1E,MAAM,SAAS,aAAa,IAAI,SAAS;CACzC,IAAI,WAAW,KAAA,GAAW,OAAO,OAAO;CACxC,MAAM,OAAO,YAAYA,UAAAA,QAAK,QAAQ,SAAS,CAAC;CAChD,aAAa,IAAI,WAAW,EAAE,KAAK,CAAC;CACpC,OAAO;AACT;;;ACpCA,eAAe,gBAAgB,IAAgB,WAAmB,SAAiD;CACjH,KAAK,IAAI,UAA8B,WAAW,YAAY,KAAA,GAAW,UAAU,gBAAgB,OAAO,GAAG;EAC3G,MAAM,OAAO,MAAM,GAAG,aAAaC,UAAAA,QAAK,KAAK,SAAS,aAAa,GAAG,OAAO;EAE7E,MAAM,OAAO,KAAK,KAAK,oBAAoB,KAAK,KAAK,IAAI,KAAA;EACzD,IAAI,MAAM,OAAO;CACnB;AAEF;;AAGA,eAAsB,kBAAkB,IAAgB,WAAmB,SAAqC;CAC9G,MAAM,SAAS,UAAU,IAAI,SAAS;CACtC,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,MAAM,WAAW,qBAAqB,MAAM,gBAAgB,IAAIA,UAAAA,QAAK,QAAQ,SAAS,GAAG,OAAO,GAAG,SAAS;CAC5G,UAAU,IAAI,WAAW,QAAQ;CACjC,OAAO;AACT;;AAGA,eAAsB,yBACpB,IACA,WACA,SAC6B;CAC7B,MAAM,SAAS,aAAa,IAAI,SAAS;CACzC,IAAI,WAAW,KAAA,GAAW,OAAO,OAAO;CACxC,MAAM,OAAO,MAAM,gBAAgB,IAAIA,UAAAA,QAAK,QAAQ,SAAS,GAAG,OAAO;CACvE,aAAa,IAAI,WAAW,EAAE,KAAK,CAAC;CACpC,OAAO;AACT"}
|
package/dist/extensionName.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { FileSystem } from "@agimon-ai/po-core/platform";
|
|
2
|
+
//#region src/services/extensionSource/sync.d.ts
|
|
3
|
+
/** @deprecated Node-only sync shim; use readExtensionName. Removed in M2. */
|
|
2
4
|
export declare function extensionName(entryPath: string): string;
|
|
3
5
|
/**
|
|
4
6
|
* The package name exactly as a manifest spells it, scope and all.
|
|
@@ -8,7 +10,17 @@ export declare function extensionName(entryPath: string): string;
|
|
|
8
10
|
* `@agimon-ai/po-team`, so joining a registered tool back to the layer that
|
|
9
11
|
* admitted it needs the unshortened name. Attribution and display are different
|
|
10
12
|
* jobs, so they get different functions rather than one lossy one.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated Node-only sync shim; use readExtensionPackageName. Removed in M2.
|
|
11
15
|
*/
|
|
12
16
|
export declare function extensionPackageName(entryPath: string): string | undefined;
|
|
13
17
|
//#endregion
|
|
18
|
+
//#region src/services/extensionSource/index.d.ts
|
|
19
|
+
type IoContext = Parameters<FileSystem['readTextFile']>[1];
|
|
20
|
+
/** Display name of the package that owns an extension entry, read through `fs`. */
|
|
21
|
+
export declare function readExtensionName(fs: FileSystem, entryPath: string, context: IoContext): Promise<string>;
|
|
22
|
+
/** The owning package name with its scope, read through `fs`; see `extensionPackageName`. */
|
|
23
|
+
export declare function readExtensionPackageName(fs: FileSystem, entryPath: string, context: IoContext): Promise<string | undefined>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export {};
|
|
14
26
|
//# sourceMappingURL=extensionName.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionName.d.mts","names":[],"sources":["../src/services/extensionSource/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"extensionName.d.mts","names":[],"sources":["../src/services/extensionSource/sync.ts","../src/services/extensionSource/index.ts"],"mappings":";;;wBA4BgB,cAAc;;;;;;;;;;;;wBAmBd,qBAAqB;;;KChChC,YAAY,WAAW;;wBAaN,kBAAkB,IAAI,YAAY,mBAAmB,SAAS,YAAY;;wBAS1E,yBACpB,IAAI,YACJ,mBACA,SAAS,YACR"}
|
package/dist/extensionName.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
1
|
import path from "node:path";
|
|
3
|
-
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
//#region src/services/extensionSource/packageName.ts
|
|
4
4
|
/**
|
|
5
5
|
* Display name for an extension that Pi could not attribute to a package.
|
|
6
6
|
*
|
|
@@ -10,26 +10,47 @@ import path from "node:path";
|
|
|
10
10
|
* package that registered the tools.
|
|
11
11
|
*/
|
|
12
12
|
/** Results are stable for the life of a session, and every source hits the same few dirs. */
|
|
13
|
-
const
|
|
13
|
+
const nameCache = /* @__PURE__ */ new Map();
|
|
14
14
|
const packageCache = /* @__PURE__ */ new Map();
|
|
15
|
+
const MANIFEST_FILE = "package.json";
|
|
16
|
+
/** The manifest's non-empty name; undefined for a malformed or nameless manifest. */
|
|
17
|
+
function manifestPackageName(text) {
|
|
18
|
+
try {
|
|
19
|
+
const manifest = JSON.parse(text);
|
|
20
|
+
return typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name : void 0;
|
|
21
|
+
} catch {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** The next directory to search, or undefined at the filesystem root. */
|
|
26
|
+
function parentDirectory(directory) {
|
|
27
|
+
const parent = path.dirname(directory);
|
|
28
|
+
return parent === directory ? void 0 : parent;
|
|
29
|
+
}
|
|
30
|
+
/** `@agimon-ai/po-task` reads as `po-task`; the scope is noise in a tree. */
|
|
31
|
+
function displayExtensionName(name, entryPath) {
|
|
32
|
+
return name ? name.split("/").pop() ?? name : path.basename(entryPath, path.extname(entryPath));
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/services/extensionSource/sync.ts
|
|
15
36
|
function packageName(directory) {
|
|
16
|
-
let current = directory;
|
|
17
|
-
|
|
37
|
+
for (let current = directory; current !== void 0; current = parentDirectory(current)) {
|
|
38
|
+
let text;
|
|
18
39
|
try {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
text = fs.readFileSync(path.join(current, MANIFEST_FILE), "utf8");
|
|
41
|
+
} catch {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const name = manifestPackageName(text);
|
|
45
|
+
if (name) return name;
|
|
25
46
|
}
|
|
26
47
|
}
|
|
48
|
+
/** @deprecated Node-only sync shim; use readExtensionName. Removed in M2. */
|
|
27
49
|
function extensionName(entryPath) {
|
|
28
|
-
const cached =
|
|
50
|
+
const cached = nameCache.get(entryPath);
|
|
29
51
|
if (cached !== void 0) return cached;
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
cache.set(entryPath, resolved);
|
|
52
|
+
const resolved = displayExtensionName(packageName(path.dirname(entryPath)), entryPath);
|
|
53
|
+
nameCache.set(entryPath, resolved);
|
|
33
54
|
return resolved;
|
|
34
55
|
}
|
|
35
56
|
/**
|
|
@@ -40,6 +61,8 @@ function extensionName(entryPath) {
|
|
|
40
61
|
* `@agimon-ai/po-team`, so joining a registered tool back to the layer that
|
|
41
62
|
* admitted it needs the unshortened name. Attribution and display are different
|
|
42
63
|
* jobs, so they get different functions rather than one lossy one.
|
|
64
|
+
*
|
|
65
|
+
* @deprecated Node-only sync shim; use readExtensionPackageName. Removed in M2.
|
|
43
66
|
*/
|
|
44
67
|
function extensionPackageName(entryPath) {
|
|
45
68
|
const cached = packageCache.get(entryPath);
|
|
@@ -49,6 +72,31 @@ function extensionPackageName(entryPath) {
|
|
|
49
72
|
return name;
|
|
50
73
|
}
|
|
51
74
|
//#endregion
|
|
52
|
-
|
|
75
|
+
//#region src/services/extensionSource/index.ts
|
|
76
|
+
async function readPackageName(fs, directory, context) {
|
|
77
|
+
for (let current = directory; current !== void 0; current = parentDirectory(current)) {
|
|
78
|
+
const text = await fs.readTextFile(path.join(current, MANIFEST_FILE), context);
|
|
79
|
+
const name = text.ok ? manifestPackageName(text.value) : void 0;
|
|
80
|
+
if (name) return name;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** Display name of the package that owns an extension entry, read through `fs`. */
|
|
84
|
+
async function readExtensionName(fs, entryPath, context) {
|
|
85
|
+
const cached = nameCache.get(entryPath);
|
|
86
|
+
if (cached !== void 0) return cached;
|
|
87
|
+
const resolved = displayExtensionName(await readPackageName(fs, path.dirname(entryPath), context), entryPath);
|
|
88
|
+
nameCache.set(entryPath, resolved);
|
|
89
|
+
return resolved;
|
|
90
|
+
}
|
|
91
|
+
/** The owning package name with its scope, read through `fs`; see `extensionPackageName`. */
|
|
92
|
+
async function readExtensionPackageName(fs, entryPath, context) {
|
|
93
|
+
const cached = packageCache.get(entryPath);
|
|
94
|
+
if (cached !== void 0) return cached.name;
|
|
95
|
+
const name = await readPackageName(fs, path.dirname(entryPath), context);
|
|
96
|
+
packageCache.set(entryPath, { name });
|
|
97
|
+
return name;
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { extensionName, extensionPackageName, readExtensionName, readExtensionPackageName };
|
|
53
101
|
|
|
54
102
|
//# sourceMappingURL=extensionName.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionName.mjs","names":[],"sources":["../src/services/extensionSource/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"extensionName.mjs","names":[],"sources":["../src/services/extensionSource/packageName.ts","../src/services/extensionSource/sync.ts","../src/services/extensionSource/index.ts"],"sourcesContent":["import path from 'node:path';\n\n/**\n * Display name for an extension that Pi could not attribute to a package.\n *\n * Pi stamps every `--extension <path>` argument with the literal source `cli`,\n * and po launches all of its extensions that way, so the only surviving\n * identity is the entry path. The nearest `package.json` above it names the\n * package that registered the tools.\n */\n\n/** Results are stable for the life of a session, and every source hits the same few dirs. */\nexport const nameCache = new Map<string, string>();\n// Wrapped, because \"no package above this path\" is a real answer worth caching\n// and a bare undefined cannot be told apart from a miss.\nexport const packageCache = new Map<string, { readonly name: string | undefined }>();\n\nexport const MANIFEST_FILE = 'package.json';\n\n/** The manifest's non-empty name; undefined for a malformed or nameless manifest. */\nexport function manifestPackageName(text: string): string | undefined {\n try {\n const manifest = JSON.parse(text) as { name?: unknown };\n return typeof manifest.name === 'string' && manifest.name.length > 0 ? manifest.name : undefined;\n } catch {\n // An unreadable manifest names nothing; keep walking up.\n return undefined;\n }\n}\n\n/** The next directory to search, or undefined at the filesystem root. */\nexport function parentDirectory(directory: string): string | undefined {\n const parent = path.dirname(directory);\n return parent === directory ? undefined : parent;\n}\n\n/** `@agimon-ai/po-task` reads as `po-task`; the scope is noise in a tree. */\nexport function displayExtensionName(name: string | undefined, entryPath: string): string {\n return name ? (name.split('/').pop() ?? name) : path.basename(entryPath, path.extname(entryPath));\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n MANIFEST_FILE,\n displayExtensionName,\n manifestPackageName,\n nameCache,\n packageCache,\n parentDirectory,\n} from './packageName';\n\nfunction packageName(directory: string): string | undefined {\n for (let current: string | undefined = directory; current !== undefined; current = parentDirectory(current)) {\n let text: string;\n try {\n text = fs.readFileSync(path.join(current, MANIFEST_FILE), 'utf8');\n } catch {\n // No manifest here; keep walking up.\n continue;\n }\n const name = manifestPackageName(text);\n if (name) return name;\n }\n return undefined;\n}\n\n/** @deprecated Node-only sync shim; use readExtensionName. Removed in M2. */\nexport function extensionName(entryPath: string): string {\n const cached = nameCache.get(entryPath);\n if (cached !== undefined) return cached;\n const resolved = displayExtensionName(packageName(path.dirname(entryPath)), entryPath);\n nameCache.set(entryPath, resolved);\n return resolved;\n}\n\n/**\n * The package name exactly as a manifest spells it, scope and all.\n *\n * `extensionName` drops the scope because a tree reads better without it, but\n * that makes it useless as a key: `.po/modes.yaml` names packages as\n * `@agimon-ai/po-team`, so joining a registered tool back to the layer that\n * admitted it needs the unshortened name. Attribution and display are different\n * jobs, so they get different functions rather than one lossy one.\n *\n * @deprecated Node-only sync shim; use readExtensionPackageName. Removed in M2.\n */\nexport function extensionPackageName(entryPath: string): string | undefined {\n const cached = packageCache.get(entryPath);\n if (cached !== undefined) return cached.name;\n const name = packageName(path.dirname(entryPath));\n packageCache.set(entryPath, { name });\n return name;\n}\n","import path from 'node:path';\n\nimport type { FileSystem } from '@agimon-ai/po-core/platform';\n\nimport {\n MANIFEST_FILE,\n displayExtensionName,\n manifestPackageName,\n nameCache,\n packageCache,\n parentDirectory,\n} from './packageName';\n\nexport { extensionName, extensionPackageName } from './sync';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nasync function readPackageName(fs: FileSystem, directory: string, context: IoContext): Promise<string | undefined> {\n for (let current: string | undefined = directory; current !== undefined; current = parentDirectory(current)) {\n const text = await fs.readTextFile(path.join(current, MANIFEST_FILE), context);\n // No readable manifest here; keep walking up.\n const name = text.ok ? manifestPackageName(text.value) : undefined;\n if (name) return name;\n }\n return undefined;\n}\n\n/** Display name of the package that owns an extension entry, read through `fs`. */\nexport async function readExtensionName(fs: FileSystem, entryPath: string, context: IoContext): Promise<string> {\n const cached = nameCache.get(entryPath);\n if (cached !== undefined) return cached;\n const resolved = displayExtensionName(await readPackageName(fs, path.dirname(entryPath), context), entryPath);\n nameCache.set(entryPath, resolved);\n return resolved;\n}\n\n/** The owning package name with its scope, read through `fs`; see `extensionPackageName`. */\nexport async function readExtensionPackageName(\n fs: FileSystem,\n entryPath: string,\n context: IoContext,\n): Promise<string | undefined> {\n const cached = packageCache.get(entryPath);\n if (cached !== undefined) return cached.name;\n const name = await readPackageName(fs, path.dirname(entryPath), context);\n packageCache.set(entryPath, { name });\n return name;\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,4BAAY,IAAI,IAAoB;AAGjD,MAAa,+BAAe,IAAI,IAAmD;AAEnF,MAAa,gBAAgB;;AAG7B,SAAgB,oBAAoB,MAAkC;CACpE,IAAI;EACF,MAAM,WAAW,KAAK,MAAM,IAAI;EAChC,OAAO,OAAO,SAAS,SAAS,YAAY,SAAS,KAAK,SAAS,IAAI,SAAS,OAAO,KAAA;CACzF,QAAQ;EAEN;CACF;AACF;;AAGA,SAAgB,gBAAgB,WAAuC;CACrE,MAAM,SAAS,KAAK,QAAQ,SAAS;CACrC,OAAO,WAAW,YAAY,KAAA,IAAY;AAC5C;;AAGA,SAAgB,qBAAqB,MAA0B,WAA2B;CACxF,OAAO,OAAQ,KAAK,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,OAAQ,KAAK,SAAS,WAAW,KAAK,QAAQ,SAAS,CAAC;AAClG;;;AC3BA,SAAS,YAAY,WAAuC;CAC1D,KAAK,IAAI,UAA8B,WAAW,YAAY,KAAA,GAAW,UAAU,gBAAgB,OAAO,GAAG;EAC3G,IAAI;EACJ,IAAI;GACF,OAAO,GAAG,aAAa,KAAK,KAAK,SAAS,aAAa,GAAG,MAAM;EAClE,QAAQ;GAEN;EACF;EACA,MAAM,OAAO,oBAAoB,IAAI;EACrC,IAAI,MAAM,OAAO;CACnB;AAEF;;AAGA,SAAgB,cAAc,WAA2B;CACvD,MAAM,SAAS,UAAU,IAAI,SAAS;CACtC,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,MAAM,WAAW,qBAAqB,YAAY,KAAK,QAAQ,SAAS,CAAC,GAAG,SAAS;CACrF,UAAU,IAAI,WAAW,QAAQ;CACjC,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,qBAAqB,WAAuC;CAC1E,MAAM,SAAS,aAAa,IAAI,SAAS;CACzC,IAAI,WAAW,KAAA,GAAW,OAAO,OAAO;CACxC,MAAM,OAAO,YAAY,KAAK,QAAQ,SAAS,CAAC;CAChD,aAAa,IAAI,WAAW,EAAE,KAAK,CAAC;CACpC,OAAO;AACT;;;ACpCA,eAAe,gBAAgB,IAAgB,WAAmB,SAAiD;CACjH,KAAK,IAAI,UAA8B,WAAW,YAAY,KAAA,GAAW,UAAU,gBAAgB,OAAO,GAAG;EAC3G,MAAM,OAAO,MAAM,GAAG,aAAa,KAAK,KAAK,SAAS,aAAa,GAAG,OAAO;EAE7E,MAAM,OAAO,KAAK,KAAK,oBAAoB,KAAK,KAAK,IAAI,KAAA;EACzD,IAAI,MAAM,OAAO;CACnB;AAEF;;AAGA,eAAsB,kBAAkB,IAAgB,WAAmB,SAAqC;CAC9G,MAAM,SAAS,UAAU,IAAI,SAAS;CACtC,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,MAAM,WAAW,qBAAqB,MAAM,gBAAgB,IAAI,KAAK,QAAQ,SAAS,GAAG,OAAO,GAAG,SAAS;CAC5G,UAAU,IAAI,WAAW,QAAQ;CACjC,OAAO;AACT;;AAGA,eAAsB,yBACpB,IACA,WACA,SAC6B;CAC7B,MAAM,SAAS,aAAa,IAAI,SAAS;CACzC,IAAI,WAAW,KAAA,GAAW,OAAO,OAAO;CACxC,MAAM,OAAO,MAAM,gBAAgB,IAAI,KAAK,QAAQ,SAAS,GAAG,OAAO;CACvE,aAAa,IAAI,WAAW,EAAE,KAAK,CAAC;CACpC,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-ui.mjs","names":["Widget0","Widget1","Widget2"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/find.mcp.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/ls.mcp.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/write.mcp.tsx","../../generated/mcp-ui.ts"],"sourcesContent":["import { defineMcpWidget, type
|
|
1
|
+
{"version":3,"file":"mcp-ui.mjs","names":["Widget0","Widget1","Widget2"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/find.mcp.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/ls.mcp.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/write.mcp.tsx","../../generated/mcp-ui.ts"],"sourcesContent":["import { defineMcpWidget, type PoMcpWidgetProps } from '@agimon-ai/po-core/web';\nimport { McpToolFrame, McpToolFields, McpToolOutput } from '@agimon-ai/po-web-components';\n\nfunction FindMcpWidget(props: PoMcpWidgetProps) {\n return (\n <McpToolFrame {...props} title=\"Find files\">\n <McpToolFields\n fields={[\n ['Pattern', props.args.pattern],\n ['Path', props.args.path],\n ['Limit', props.args.limit],\n ]}\n />\n <McpToolOutput result={props.result} />\n </McpToolFrame>\n );\n}\n\nexport default defineMcpWidget(FindMcpWidget);\n","import { defineMcpWidget, type PoMcpWidgetProps } from '@agimon-ai/po-core/web';\nimport { McpToolFrame, McpToolFields, McpToolOutput } from '@agimon-ai/po-web-components';\n\nfunction LsMcpWidget(props: PoMcpWidgetProps) {\n return (\n <McpToolFrame {...props} title=\"List directory\">\n <McpToolFields\n fields={[\n ['Path', props.args.path],\n ['Limit', props.args.limit],\n ]}\n />\n <McpToolOutput result={props.result} />\n </McpToolFrame>\n );\n}\n\nexport default defineMcpWidget(LsMcpWidget);\n","import { defineMcpWidget, type PoMcpWidgetProps } from '@agimon-ai/po-core/web';\nimport { McpToolFrame, McpToolFields, McpToolOutput } from '@agimon-ai/po-web-components';\n\nfunction WriteMcpWidget(props: PoMcpWidgetProps) {\n return (\n <McpToolFrame {...props} title=\"Write file\">\n <McpToolFields\n fields={[\n ['Path', props.args.path],\n ['Characters', typeof props.args.content === 'string' ? props.args.content.length : undefined],\n ]}\n />\n <McpToolOutput result={props.result} />\n </McpToolFrame>\n );\n}\n\nexport default defineMcpWidget(WriteMcpWidget);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport type { ComponentType } from 'react';\nimport type { PoMcpWidgetProps } from '@agimon-ai/po-core/mcpWidget';\nimport Widget0 from \"../src/extensions/workspaces/sessions/(frontend)/tool/find.mcp\";\nimport Widget1 from \"../src/extensions/workspaces/sessions/(frontend)/tool/ls.mcp\";\nimport Widget2 from \"../src/extensions/workspaces/sessions/(frontend)/tool/write.mcp\";\n\nexport const widgets: Readonly<Record<string, ComponentType<PoMcpWidgetProps>>> = {\n \"@agimon-ai/po-ui/find\": Widget0,\n \"@agimon-ai/po-ui/ls\": Widget1,\n \"@agimon-ai/po-ui/write\": Widget2,\n};\n"],"mappings":";;;;AAGA,SAAS,cAAc,OAAyB;CAC9C,OACE,qBAAC,cAAD;EAAc,GAAI;EAAO,OAAM;EAA/B,UAAA,CACE,oBAAC,eAAD,EACE,QAAQ;GACN,CAAC,WAAW,MAAM,KAAK,OAAO;GAC9B,CAAC,QAAQ,MAAM,KAAK,IAAI;GACxB,CAAC,SAAS,MAAM,KAAK,KAAK;EAC5B,EACD,CAAA,GACD,oBAAC,eAAD,EAAe,QAAQ,MAAM,OAAS,CAAA,CAC1B;;AAElB;AAEA,IAAA,mBAAe,gBAAgB,aAAa;;;ACf5C,SAAS,YAAY,OAAyB;CAC5C,OACE,qBAAC,cAAD;EAAc,GAAI;EAAO,OAAM;EAA/B,UAAA,CACE,oBAAC,eAAD,EACE,QAAQ,CACN,CAAC,QAAQ,MAAM,KAAK,IAAI,GACxB,CAAC,SAAS,MAAM,KAAK,KAAK,CAC5B,EACD,CAAA,GACD,oBAAC,eAAD,EAAe,QAAQ,MAAM,OAAS,CAAA,CAC1B;;AAElB;AAEA,IAAA,iBAAe,gBAAgB,WAAW;;;ACd1C,SAAS,eAAe,OAAyB;CAC/C,OACE,qBAAC,cAAD;EAAc,GAAI;EAAO,OAAM;EAA/B,UAAA,CACE,oBAAC,eAAD,EACE,QAAQ,CACN,CAAC,QAAQ,MAAM,KAAK,IAAI,GACxB,CAAC,cAAc,OAAO,MAAM,KAAK,YAAY,WAAW,MAAM,KAAK,QAAQ,SAAS,KAAA,CAAS,CAC/F,EACD,CAAA,GACD,oBAAC,eAAD,EAAe,QAAQ,MAAM,OAAS,CAAA,CAC1B;;AAElB;;;ACRA,MAAa,UAAqE;CAChF,yBAAyBA;CACzB,uBAAuBC;CACvB,0BDOa,gBAAgB,cCPHC;AAC5B"}
|
package/dist/extensions/mcp.cjs
CHANGED
|
@@ -13,7 +13,7 @@ function createMcpWriteTool(context) {
|
|
|
13
13
|
description: "Create or fully overwrite a file in the Po session's repository on the host machine, creating parent folders. Use this server's edit tool to change part of an existing file.",
|
|
14
14
|
executionMode: tool.executionMode === "sequential" ? "serial" : tool.executionMode,
|
|
15
15
|
async execute(toolCallId, parameters, signal, onUpdate) {
|
|
16
|
-
return (0, _agimon_ai_po_core_headless.
|
|
16
|
+
return (0, _agimon_ai_po_core_headless.toPoHeadlessToolResult)(await tool.execute(toolCallId, parameters, AbortSignal.any([context.signal, signal ?? context.signal]), onUpdate && ((partial) => onUpdate((0, _agimon_ai_po_core_headless.toPoHeadlessToolResult)(partial)))));
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
}
|
|
@@ -24,7 +24,7 @@ function createMcpFindTool(context) {
|
|
|
24
24
|
description: "Find files by name or glob pattern in the Po session's repository on the host machine (locate paths). Respects .gitignore. Up to 1000 results by default, with output capped at 50KB.",
|
|
25
25
|
executionMode: tool.executionMode === "sequential" ? "serial" : tool.executionMode,
|
|
26
26
|
async execute(toolCallId, parameters, signal, onUpdate) {
|
|
27
|
-
return (0, _agimon_ai_po_core_headless.
|
|
27
|
+
return (0, _agimon_ai_po_core_headless.toPoHeadlessToolResult)(await tool.execute(toolCallId, parameters, AbortSignal.any([context.signal, signal ?? context.signal]), onUpdate && ((partial) => onUpdate((0, _agimon_ai_po_core_headless.toPoHeadlessToolResult)(partial)))));
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
}
|
|
@@ -35,7 +35,7 @@ function createMcpLsTool(context) {
|
|
|
35
35
|
description: "List a directory in the Po session's repository on the host machine (folder contents). Sorted, directories end with '/', dotfiles included. Up to 500 entries by default, with output capped at 50KB.",
|
|
36
36
|
executionMode: tool.executionMode === "sequential" ? "serial" : tool.executionMode,
|
|
37
37
|
async execute(toolCallId, parameters, signal, onUpdate) {
|
|
38
|
-
return (0, _agimon_ai_po_core_headless.
|
|
38
|
+
return (0, _agimon_ai_po_core_headless.toPoHeadlessToolResult)(await tool.execute(toolCallId, parameters, AbortSignal.any([context.signal, signal ?? context.signal]), onUpdate && ((partial) => onUpdate((0, _agimon_ai_po_core_headless.toPoHeadlessToolResult)(partial)))));
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
}
|