@agimon-ai/po-preset 0.0.0-alpha.163
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 -0
- package/README.md +30 -0
- package/dist/apiContracts.cjs +30 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +52 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +25 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/extensions/mcp.cjs +26 -0
- package/dist/extensions/mcp.cjs.map +1 -0
- package/dist/extensions/mcp.d.mts +5 -0
- package/dist/extensions/mcp.d.mts.map +1 -0
- package/dist/extensions/mcp.mjs +21 -0
- package/dist/extensions/mcp.mjs.map +1 -0
- package/dist/extensions/server.cjs +100 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +95 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +42 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -0
- package/dist/presetText-Cd-rq9lL.cjs +89 -0
- package/dist/presetText-Cd-rq9lL.cjs.map +1 -0
- package/dist/presetText-CzKN5vOg.mjs +54 -0
- package/dist/presetText-CzKN5vOg.mjs.map +1 -0
- package/llms.txt +12 -0
- package/package.json +121 -0
- package/src/prompts/help-how-to-preset/SKILL.md +30 -0
- package/src/prompts/help-how-to-preset/references/presets-contract.md +147 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @agimon-ai/po-preset
|
|
2
|
+
|
|
3
|
+
Named presets select ordered runtime layers for a Po session. The distribution loads this package as fixed host infrastructure; it is not itself a selectable layer.
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
# .po/presets.yaml
|
|
7
|
+
layers:
|
|
8
|
+
team:
|
|
9
|
+
packages: ['@agimon-ai/po-team']
|
|
10
|
+
task:
|
|
11
|
+
packages: ['@agimon-ai/po-task']
|
|
12
|
+
preset:
|
|
13
|
+
minimal:
|
|
14
|
+
description: Delegation and persistent tasks.
|
|
15
|
+
layers: [team, task]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Default packages load before the selected layers. Layer order matters: it is not a set. Domains, profile, and modes are separate selection axes.
|
|
19
|
+
|
|
20
|
+
## Select a preset
|
|
21
|
+
|
|
22
|
+
`/preset` opens the picker; `/preset <name>` requests a change. The server validates the name and asks the host to change selection. Applying the package composition is the host's responsibility, so a config edit alone does not establish that new capabilities are loaded. Follow any synchronization or restart requirement the host reports.
|
|
23
|
+
|
|
24
|
+
## Authoring guidance
|
|
25
|
+
|
|
26
|
+
While Help is active, `help-how-to-preset` provides the [preset authoring guide](./src/prompts/help-how-to-preset/SKILL.md) and [configuration contract](./src/prompts/help-how-to-preset/references/presets-contract.md). The package publishes these through [`llms.txt`](./llms.txt).
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
|
|
6
|
+
let typebox = require("typebox");
|
|
7
|
+
//#region src/schemas/apiContracts.ts
|
|
8
|
+
const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
9
|
+
version: 1,
|
|
10
|
+
http: [{
|
|
11
|
+
id: "preset.current",
|
|
12
|
+
scope: "session",
|
|
13
|
+
basePath: "preset",
|
|
14
|
+
path: "/current",
|
|
15
|
+
method: "GET",
|
|
16
|
+
authentication: "owner",
|
|
17
|
+
description: "Read the current session selection.",
|
|
18
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({
|
|
19
|
+
preset: typebox.Type.String(),
|
|
20
|
+
activeLayers: typebox.Type.Array(typebox.Type.String())
|
|
21
|
+
}))
|
|
22
|
+
}],
|
|
23
|
+
sockets: [],
|
|
24
|
+
dynamic: []
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.apiContracts = apiContracts;
|
|
28
|
+
exports.default = apiContracts;
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=apiContracts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["defineApiContract","jsonApiResponses","Type"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nexport const apiContracts = defineApiContract({\n version: 1,\n http: [\n {\n id: 'preset.current',\n scope: 'session',\n basePath: 'preset',\n path: '/current',\n method: 'GET',\n authentication: 'owner',\n description: 'Read the current session selection.',\n responses: jsonApiResponses(Type.Object({ preset: Type.String(), activeLayers: Type.Array(Type.String()) })),\n },\n ],\n sockets: [],\n dynamic: [],\n});\nexport default apiContracts;\n"],"mappings":";;;;;;;AAGA,MAAa,gBAAA,GAAeA,gCAAAA,kBAAAA,CAAkB;CAC5C,SAAS;CACT,MAAM,CACJ;EACE,IAAI;EACJ,OAAO;EACP,UAAU;EACV,MAAM;EACN,QAAQ;EACR,gBAAgB;EAChB,aAAa;EACb,YAAA,GAAWC,gCAAAA,iBAAAA,CAAiBC,QAAAA,KAAK,OAAO;GAAE,QAAQA,QAAAA,KAAK,OAAO;GAAG,cAAcA,QAAAA,KAAK,MAAMA,QAAAA,KAAK,OAAO,CAAC;EAAE,CAAC,CAAC;CAC7G,CACF;CACA,SAAS,CAAC;CACV,SAAS,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/schemas/apiContracts.d.ts
|
|
2
|
+
export declare const apiContracts: {
|
|
3
|
+
version: 1;
|
|
4
|
+
protocols?: Record<string, string> | undefined;
|
|
5
|
+
schemas?: Record<string, boolean | object> | undefined;
|
|
6
|
+
http: {
|
|
7
|
+
id: string;
|
|
8
|
+
scope: "host" | "session" | "workspace";
|
|
9
|
+
basePath?: string | undefined;
|
|
10
|
+
path: string;
|
|
11
|
+
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
12
|
+
description: string;
|
|
13
|
+
availability?: string | undefined;
|
|
14
|
+
authentication: "device" | "none" | "owner";
|
|
15
|
+
parameters?: {
|
|
16
|
+
name: string;
|
|
17
|
+
in: "header" | "path" | "query";
|
|
18
|
+
required: boolean;
|
|
19
|
+
schema: boolean | object;
|
|
20
|
+
}[] | undefined;
|
|
21
|
+
body?: {
|
|
22
|
+
contentType: string;
|
|
23
|
+
contentTypes?: string[] | undefined;
|
|
24
|
+
required: boolean;
|
|
25
|
+
schema: boolean | object;
|
|
26
|
+
} | undefined;
|
|
27
|
+
responses: Record<string, {
|
|
28
|
+
description: string;
|
|
29
|
+
contentType?: string | undefined;
|
|
30
|
+
schema?: boolean | object | undefined;
|
|
31
|
+
events?: Record<string, boolean | object> | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
}[];
|
|
34
|
+
sockets: {
|
|
35
|
+
id: string;
|
|
36
|
+
scope: "host" | "session" | "workspace";
|
|
37
|
+
description: string;
|
|
38
|
+
availability?: string | undefined;
|
|
39
|
+
service: string;
|
|
40
|
+
member: string;
|
|
41
|
+
direction: "client-to-server" | "server-to-client";
|
|
42
|
+
kind: "channel" | "method" | "state";
|
|
43
|
+
input: boolean | object;
|
|
44
|
+
output?: boolean | object | undefined;
|
|
45
|
+
errors?: boolean | object | undefined;
|
|
46
|
+
}[];
|
|
47
|
+
dynamic: string[];
|
|
48
|
+
gaps?: string[] | undefined;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { apiContracts as default };
|
|
52
|
+
//# sourceMappingURL=apiContracts.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";qBAGa"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineApiContract, jsonApiResponses } from "@agimon-ai/po-core/apiContracts";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
//#region src/schemas/apiContracts.ts
|
|
4
|
+
const apiContracts = defineApiContract({
|
|
5
|
+
version: 1,
|
|
6
|
+
http: [{
|
|
7
|
+
id: "preset.current",
|
|
8
|
+
scope: "session",
|
|
9
|
+
basePath: "preset",
|
|
10
|
+
path: "/current",
|
|
11
|
+
method: "GET",
|
|
12
|
+
authentication: "owner",
|
|
13
|
+
description: "Read the current session selection.",
|
|
14
|
+
responses: jsonApiResponses(Type.Object({
|
|
15
|
+
preset: Type.String(),
|
|
16
|
+
activeLayers: Type.Array(Type.String())
|
|
17
|
+
}))
|
|
18
|
+
}],
|
|
19
|
+
sockets: [],
|
|
20
|
+
dynamic: []
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { apiContracts, apiContracts as default };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=apiContracts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nexport const apiContracts = defineApiContract({\n version: 1,\n http: [\n {\n id: 'preset.current',\n scope: 'session',\n basePath: 'preset',\n path: '/current',\n method: 'GET',\n authentication: 'owner',\n description: 'Read the current session selection.',\n responses: jsonApiResponses(Type.Object({ preset: Type.String(), activeLayers: Type.Array(Type.String()) })),\n },\n ],\n sockets: [],\n dynamic: [],\n});\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAa,eAAe,kBAAkB;CAC5C,SAAS;CACT,MAAM,CACJ;EACE,IAAI;EACJ,OAAO;EACP,UAAU;EACV,MAAM;EACN,QAAQ;EACR,gBAAgB;EAChB,aAAa;EACb,WAAW,iBAAiB,KAAK,OAAO;GAAE,QAAQ,KAAK,OAAO;GAAG,cAAc,KAAK,MAAM,KAAK,OAAO,CAAC;EAAE,CAAC,CAAC;CAC7G,CACF;CACA,SAAS,CAAC;CACV,SAAS,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let _agimon_ai_po_core_mcpFacet = require("@agimon-ai/po-core/mcpFacet");
|
|
6
|
+
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
7
|
+
//#region src/extensions/workspaces/sessions/(backend)/skill/help-how-to-preset.mcp.ts
|
|
8
|
+
var help_how_to_preset_mcp_default = (0, _agimon_ai_po_core_mcpFacet.defineMcpSkill)({
|
|
9
|
+
name: "help-how-to-preset",
|
|
10
|
+
description: "Configure Po default packages, layers, extensions, hook groups, and named presets. Use when creating or editing ~/.po/presets.yaml or a repository's .po/presets.yaml, choosing a default preset, or diagnosing which behavior a preset activates.",
|
|
11
|
+
read: () => (0, _agimon_ai_po_core_serverPlugin.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/help-how-to-preset/SKILL.md")
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region generated/mcp.ts
|
|
15
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
16
|
+
const mcp = (0, _agimon_ai_po_core_mcpFacet.defineMcpPlugin)({
|
|
17
|
+
name: "@agimon-ai/po-preset",
|
|
18
|
+
session: (context) => ({ get skills() {
|
|
19
|
+
return [at(help_how_to_preset_mcp_default, context)];
|
|
20
|
+
} })
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.default = mcp;
|
|
24
|
+
exports.mcp = mcp;
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=mcp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.cjs","names":["defineMcpSkill","readPackageResource","defineMcpPlugin","skillHelpHowToPreset"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/help-how-to-preset.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/po-core/mcpFacet';\nimport { readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineMcpSkill({\n name: 'help-how-to-preset',\n description:\n \"Configure Po default packages, layers, extensions, hook groups, and named presets. Use when creating or editing ~/.po/presets.yaml or a repository's .po/presets.yaml, choosing a default preset, or diagnosing which behavior a preset activates.\",\n read: () => readPackageResource(import.meta.url, 'src/prompts/help-how-to-preset/SKILL.md'),\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport skillHelpHowToPreset from '../src/extensions/workspaces/sessions/(backend)/skill/help-how-to-preset.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-preset',\n session: (context) => ({\n get skills(): PoMcpSessionPlugin['skills'] { return [at(skillHelpHowToPreset, context)]; },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;;;;AAGA,IAAA,kCAAA,GAAeA,4BAAAA,eAAAA,CAAe;CAC5B,MAAM;CACN,aACE;CACF,aAAA,GAAYC,gCAAAA,oBAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,MAAqC,yCAAyC;AAC5F,CAAC;;;ACFD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,OAAA,GAAMC,4BAAAA,gBAAAA,CAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,SAAuC;EAAE,OAAO,CAAC,GAAGC,gCAAsB,OAAO,CAAC;CAAG,EAC3F;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../../generated/mcp.ts"],"mappings":";qBASa,2CAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineMcpPlugin, defineMcpSkill } from "@agimon-ai/po-core/mcpFacet";
|
|
2
|
+
import { readPackageResource } from "@agimon-ai/po-core/serverPlugin";
|
|
3
|
+
//#region src/extensions/workspaces/sessions/(backend)/skill/help-how-to-preset.mcp.ts
|
|
4
|
+
var help_how_to_preset_mcp_default = defineMcpSkill({
|
|
5
|
+
name: "help-how-to-preset",
|
|
6
|
+
description: "Configure Po default packages, layers, extensions, hook groups, and named presets. Use when creating or editing ~/.po/presets.yaml or a repository's .po/presets.yaml, choosing a default preset, or diagnosing which behavior a preset activates.",
|
|
7
|
+
read: () => readPackageResource(import.meta.url, "src/prompts/help-how-to-preset/SKILL.md")
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region generated/mcp.ts
|
|
11
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
12
|
+
const mcp = defineMcpPlugin({
|
|
13
|
+
name: "@agimon-ai/po-preset",
|
|
14
|
+
session: (context) => ({ get skills() {
|
|
15
|
+
return [at(help_how_to_preset_mcp_default, context)];
|
|
16
|
+
} })
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { mcp as default, mcp };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=mcp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.mjs","names":["skillHelpHowToPreset"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/help-how-to-preset.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/po-core/mcpFacet';\nimport { readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineMcpSkill({\n name: 'help-how-to-preset',\n description:\n \"Configure Po default packages, layers, extensions, hook groups, and named presets. Use when creating or editing ~/.po/presets.yaml or a repository's .po/presets.yaml, choosing a default preset, or diagnosing which behavior a preset activates.\",\n read: () => readPackageResource(import.meta.url, 'src/prompts/help-how-to-preset/SKILL.md'),\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport skillHelpHowToPreset from '../src/extensions/workspaces/sessions/(backend)/skill/help-how-to-preset.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-preset',\n session: (context) => ({\n get skills(): PoMcpSessionPlugin['skills'] { return [at(skillHelpHowToPreset, context)]; },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;AAGA,IAAA,iCAAe,eAAe;CAC5B,MAAM;CACN,aACE;CACF,YAAY,oBAAoB,YAAY,KAAK,yCAAyC;AAC5F,CAAC;;;ACFD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,MAAM,gBAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,SAAuC;EAAE,OAAO,CAAC,GAAGA,gCAAsB,OAAO,CAAC;CAAG,EAC3F;AACF,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_presetText = require("../presetText-Cd-rq9lL.cjs");
|
|
6
|
+
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
7
|
+
let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
|
|
8
|
+
let _agimon_ai_po_config_presets = require("@agimon-ai/po-config/presets");
|
|
9
|
+
let _agimon_ai_po_core_help = require("@agimon-ai/po-core/help");
|
|
10
|
+
//#region src/extensions/workspaces/sessions/(backend)/api/preset/route.server.ts
|
|
11
|
+
var route_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoute)(({ agent }) => ({
|
|
12
|
+
basePath: "preset",
|
|
13
|
+
start: () => ({
|
|
14
|
+
fetch(request) {
|
|
15
|
+
if (new URL(request.url).pathname !== "/current") return Response.json({ error: "Not found" }, { status: 404 });
|
|
16
|
+
if (request.method !== "GET") return Response.json({ error: "Method not allowed" }, {
|
|
17
|
+
status: 405,
|
|
18
|
+
headers: { Allow: "GET" }
|
|
19
|
+
});
|
|
20
|
+
if (!agent) return Response.json({ error: "Session agent unavailable" }, { status: 404 });
|
|
21
|
+
const selection = agent.context.selection;
|
|
22
|
+
return Response.json({
|
|
23
|
+
preset: selection.preset,
|
|
24
|
+
activeLayers: selection.activeLayers
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
close() {}
|
|
28
|
+
})
|
|
29
|
+
}));
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/extensions/workspaces/sessions/(backend)/_lib/presetServerCommand.ts
|
|
32
|
+
function createPresetServerCommand(host) {
|
|
33
|
+
return {
|
|
34
|
+
name: require_presetText.PRESET_COMMAND,
|
|
35
|
+
description: "Show or change the active Po preset.",
|
|
36
|
+
async execute(args, execution) {
|
|
37
|
+
const config = (0, _agimon_ai_po_config_presets.loadPresetsConfig)(execution.repoRoot);
|
|
38
|
+
let requested = args.trim();
|
|
39
|
+
if (!requested) {
|
|
40
|
+
const selected = await execution.client.request({
|
|
41
|
+
kind: "select",
|
|
42
|
+
title: `Preset (current: ${execution.selection.preset})`,
|
|
43
|
+
options: Object.keys(config.preset).map((name) => ({
|
|
44
|
+
label: require_presetText.presetOptionLabel(name, config.preset[name]?.layers ?? [], execution.selection.preset),
|
|
45
|
+
value: name
|
|
46
|
+
}))
|
|
47
|
+
});
|
|
48
|
+
if (typeof selected !== "string" || !selected) return;
|
|
49
|
+
requested = selected;
|
|
50
|
+
}
|
|
51
|
+
(0, _agimon_ai_po_config_presets.resolveLayers)(config, requested);
|
|
52
|
+
if (requested === execution.selection.preset) return;
|
|
53
|
+
await host.changeSelection({
|
|
54
|
+
axis: "preset",
|
|
55
|
+
preset: requested
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/extensions/workspaces/sessions/(backend)/command/preset.server.ts
|
|
62
|
+
var preset_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoutedContribution)(({ agent }) => agent ? createPresetServerCommand(agent) : void 0, { cardinality: "optional" });
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/help-how-to-preset.server.ts
|
|
65
|
+
var help_how_to_preset_server_default = (0, _agimon_ai_po_core_extensionFile.defineResource)({
|
|
66
|
+
name: "help-how-to-preset",
|
|
67
|
+
description: "Configure Po default packages, layers, extensions, hook groups, and named presets. Use when creating or editing ~/.po/presets.yaml or a repository's .po/presets.yaml, choosing a default preset, or diagnosing which behavior a preset activates.",
|
|
68
|
+
when: _agimon_ai_po_core_help.PO_HELP_WHEN,
|
|
69
|
+
kind: "skill",
|
|
70
|
+
path: (0, _agimon_ai_po_core_serverPlugin.packageResourcePath)(require("url").pathToFileURL(__filename).href, "src/prompts/help-how-to-preset/SKILL.md"),
|
|
71
|
+
read: () => (0, _agimon_ai_po_core_serverPlugin.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/help-how-to-preset/SKILL.md")
|
|
72
|
+
});
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region generated/server.ts
|
|
75
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
76
|
+
/* v8 ignore next -- generated normalization branch */
|
|
77
|
+
const defined = (values) => values.filter((value) => value !== void 0);
|
|
78
|
+
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
79
|
+
...identity,
|
|
80
|
+
...value
|
|
81
|
+
};
|
|
82
|
+
const serverPlugin = (0, _agimon_ai_po_core_serverPlugin.defineServerPlugin)({
|
|
83
|
+
name: "@agimon-ai/po-preset",
|
|
84
|
+
session: (context) => ({
|
|
85
|
+
get api() {
|
|
86
|
+
return [at(route_server_default, context)];
|
|
87
|
+
},
|
|
88
|
+
get commands() {
|
|
89
|
+
return defined([via({ name: "preset" }, at(preset_server_default, context))]);
|
|
90
|
+
},
|
|
91
|
+
get resources() {
|
|
92
|
+
return [at(help_how_to_preset_server_default, context)];
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
//#endregion
|
|
97
|
+
exports.default = serverPlugin;
|
|
98
|
+
exports.serverPlugin = serverPlugin;
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=server.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.cjs","names":["defineRoute","PRESET_COMMAND","loadPresetsConfig","presetOptionLabel","defineRoutedContribution","defineResource","PO_HELP_WHEN","packageResourcePath","readPackageResource","defineServerPlugin","apiRoute","commandPreset","resourceHelpHowToPreset"],"sources":["../../src/extensions/workspaces/sessions/(backend)/api/preset/route.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/presetServerCommand.ts","../../src/extensions/workspaces/sessions/(backend)/command/preset.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-preset.server.ts","../../generated/server.ts"],"sourcesContent":["import { defineRoute } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoute(({ agent }: PoServerPluginContext) => ({\n basePath: 'preset',\n start: () => ({\n fetch(request: Request) {\n if (new URL(request.url).pathname !== '/current') return Response.json({ error: 'Not found' }, { status: 404 });\n if (request.method !== 'GET')\n return Response.json({ error: 'Method not allowed' }, { status: 405, headers: { Allow: 'GET' } });\n if (!agent) return Response.json({ error: 'Session agent unavailable' }, { status: 404 });\n const selection = agent.context.selection;\n return Response.json({ preset: selection.preset, activeLayers: selection.activeLayers });\n },\n close() {},\n }),\n}));\n","import { loadPresetsConfig, resolveLayers } from '@agimon-ai/po-config/presets';\nimport { type PoHeadlessCommand, type PoHeadlessHostService } from '@agimon-ai/po-core/headless';\n\nimport { PRESET_COMMAND, presetOptionLabel } from '../../../../../services/presetText';\n\nexport function createPresetServerCommand(host: PoHeadlessHostService): PoHeadlessCommand {\n return {\n name: PRESET_COMMAND,\n description: 'Show or change the active Po preset.',\n async execute(args, execution) {\n const config = loadPresetsConfig(execution.repoRoot);\n let requested = args.trim();\n if (!requested) {\n const selected = await execution.client.request({\n kind: 'select',\n title: `Preset (current: ${execution.selection.preset})`,\n options: Object.keys(config.preset).map((name) => ({\n label: presetOptionLabel(name, config.preset[name]?.layers ?? [], execution.selection.preset),\n value: name,\n })),\n });\n if (typeof selected !== 'string' || !selected) return;\n requested = selected;\n }\n // Reject invalid command input before requesting a capability transition.\n resolveLayers(config, requested);\n if (requested === execution.selection.preset) return;\n await host.changeSelection({ axis: 'preset', preset: requested });\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createPresetServerCommand } from '../_lib/presetServerCommand';\nexport default defineRoutedContribution(\n ({ agent }: PoServerPluginContext) => (agent ? createPresetServerCommand(agent) : undefined),\n { cardinality: 'optional' },\n);\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { PO_HELP_WHEN } from '@agimon-ai/po-core/help';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineResource({\n name: 'help-how-to-preset',\n description:\n \"Configure Po default packages, layers, extensions, hook groups, and named presets. Use when creating or editing ~/.po/presets.yaml or a repository's .po/presets.yaml, choosing a default preset, or diagnosing which behavior a preset activates.\",\n when: PO_HELP_WHEN,\n kind: 'skill' as const,\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-preset/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/help-how-to-preset/SKILL.md'),\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport apiRoute from '../src/extensions/workspaces/sessions/(backend)/api/preset/route.server';\nimport commandPreset from '../src/extensions/workspaces/sessions/(backend)/command/preset.server';\nimport resourceHelpHowToPreset from '../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-preset.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-preset',\n session: (context) => ({\n get api(): PoServerSessionPlugin['api'] { return [at(apiRoute, context)]; },\n get commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'preset' }, at(commandPreset, context))]); },\n get resources(): PoServerSessionPlugin['resources'] { return [at(resourceHelpHowToPreset, context)]; },\n }),\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;;AAGA,IAAA,wBAAA,GAAeA,iCAAAA,YAAAA,EAAa,EAAE,aAAoC;CAChE,UAAU;CACV,cAAc;EACZ,MAAM,SAAkB;GACtB,IAAI,IAAI,IAAI,QAAQ,GAAG,CAAC,CAAC,aAAa,YAAY,OAAO,SAAS,KAAK,EAAE,OAAO,YAAY,GAAG,EAAE,QAAQ,IAAI,CAAC;GAC9G,IAAI,QAAQ,WAAW,OACrB,OAAO,SAAS,KAAK,EAAE,OAAO,qBAAqB,GAAG;IAAE,QAAQ;IAAK,SAAS,EAAE,OAAO,MAAM;GAAE,CAAC;GAClG,IAAI,CAAC,OAAO,OAAO,SAAS,KAAK,EAAE,OAAO,4BAA4B,GAAG,EAAE,QAAQ,IAAI,CAAC;GACxF,MAAM,YAAY,MAAM,QAAQ;GAChC,OAAO,SAAS,KAAK;IAAE,QAAQ,UAAU;IAAQ,cAAc,UAAU;GAAa,CAAC;EACzF;EACA,QAAQ,CAAC;CACX;AACF,EAAE;;;ACXF,SAAgB,0BAA0B,MAAgD;CACxF,OAAO;EACL,MAAMC,mBAAAA;EACN,aAAa;EACb,MAAM,QAAQ,MAAM,WAAW;GAC7B,MAAM,UAAA,GAASC,6BAAAA,kBAAAA,CAAkB,UAAU,QAAQ;GACnD,IAAI,YAAY,KAAK,KAAK;GAC1B,IAAI,CAAC,WAAW;IACd,MAAM,WAAW,MAAM,UAAU,OAAO,QAAQ;KAC9C,MAAM;KACN,OAAO,oBAAoB,UAAU,UAAU,OAAO;KACtD,SAAS,OAAO,KAAK,OAAO,MAAM,CAAC,CAAC,KAAK,UAAU;MACjD,OAAOC,mBAAAA,kBAAkB,MAAM,OAAO,OAAO,KAAK,EAAE,UAAU,CAAC,GAAG,UAAU,UAAU,MAAM;MAC5F,OAAO;KACT,EAAE;IACJ,CAAC;IACD,IAAI,OAAO,aAAa,YAAY,CAAC,UAAU;IAC/C,YAAY;GACd;GAEA,CAAA,GAAA,6BAAA,cAAA,CAAc,QAAQ,SAAS;GAC/B,IAAI,cAAc,UAAU,UAAU,QAAQ;GAC9C,MAAM,KAAK,gBAAgB;IAAE,MAAM;IAAU,QAAQ;GAAU,CAAC;EAClE;CACF;AACF;;;AC1BA,IAAA,yBAAA,GAAeC,iCAAAA,yBAAAA,EACZ,EAAE,YAAoC,QAAQ,0BAA0B,KAAK,IAAI,KAAA,GAClF,EAAE,aAAa,WAAW,CAC5B;;;ACHA,IAAA,qCAAA,GAAeC,iCAAAA,eAAAA,CAAe;CAC5B,MAAM;CACN,aACE;CACF,MAAMC,wBAAAA;CACN,MAAM;CACN,OAAA,GAAMC,gCAAAA,oBAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,MAAqC,yCAAyC;CACpF,aAAA,GAAYC,gCAAAA,oBAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,MAAqC,yCAAyC;AAC5F,CAAC;;;ACJD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;;AAEpE,MAAM,WAAc,WAClB,OAAO,QAAQ,UAAsB,UAAU,KAAA,CAAS;AAC1D,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,MAAoC;GAAE,OAAO,CAAC,GAAGC,sBAAU,OAAO,CAAC;EAAG;EAC1E,IAAI,WAA8C;GAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,SAAS,GAAG,GAAGC,uBAAe,OAAO,CAAC,CAAC,CAAC;EAAG;EAC3H,IAAI,YAAgD;GAAE,OAAO,CAAC,GAAGC,mCAAyB,OAAO,CAAC;EAAG;CACvG;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";qBAgBa,wDAAY"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { a as presetOptionLabel, t as PRESET_COMMAND } from "../presetText-CzKN5vOg.mjs";
|
|
2
|
+
import { defineServerPlugin, packageResourcePath, readPackageResource } from "@agimon-ai/po-core/serverPlugin";
|
|
3
|
+
import { defineResource, defineRoute, defineRoutedContribution } from "@agimon-ai/po-core/extensionFile";
|
|
4
|
+
import { loadPresetsConfig, resolveLayers } from "@agimon-ai/po-config/presets";
|
|
5
|
+
import { PO_HELP_WHEN } from "@agimon-ai/po-core/help";
|
|
6
|
+
//#region src/extensions/workspaces/sessions/(backend)/api/preset/route.server.ts
|
|
7
|
+
var route_server_default = defineRoute(({ agent }) => ({
|
|
8
|
+
basePath: "preset",
|
|
9
|
+
start: () => ({
|
|
10
|
+
fetch(request) {
|
|
11
|
+
if (new URL(request.url).pathname !== "/current") return Response.json({ error: "Not found" }, { status: 404 });
|
|
12
|
+
if (request.method !== "GET") return Response.json({ error: "Method not allowed" }, {
|
|
13
|
+
status: 405,
|
|
14
|
+
headers: { Allow: "GET" }
|
|
15
|
+
});
|
|
16
|
+
if (!agent) return Response.json({ error: "Session agent unavailable" }, { status: 404 });
|
|
17
|
+
const selection = agent.context.selection;
|
|
18
|
+
return Response.json({
|
|
19
|
+
preset: selection.preset,
|
|
20
|
+
activeLayers: selection.activeLayers
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
close() {}
|
|
24
|
+
})
|
|
25
|
+
}));
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/extensions/workspaces/sessions/(backend)/_lib/presetServerCommand.ts
|
|
28
|
+
function createPresetServerCommand(host) {
|
|
29
|
+
return {
|
|
30
|
+
name: PRESET_COMMAND,
|
|
31
|
+
description: "Show or change the active Po preset.",
|
|
32
|
+
async execute(args, execution) {
|
|
33
|
+
const config = loadPresetsConfig(execution.repoRoot);
|
|
34
|
+
let requested = args.trim();
|
|
35
|
+
if (!requested) {
|
|
36
|
+
const selected = await execution.client.request({
|
|
37
|
+
kind: "select",
|
|
38
|
+
title: `Preset (current: ${execution.selection.preset})`,
|
|
39
|
+
options: Object.keys(config.preset).map((name) => ({
|
|
40
|
+
label: presetOptionLabel(name, config.preset[name]?.layers ?? [], execution.selection.preset),
|
|
41
|
+
value: name
|
|
42
|
+
}))
|
|
43
|
+
});
|
|
44
|
+
if (typeof selected !== "string" || !selected) return;
|
|
45
|
+
requested = selected;
|
|
46
|
+
}
|
|
47
|
+
resolveLayers(config, requested);
|
|
48
|
+
if (requested === execution.selection.preset) return;
|
|
49
|
+
await host.changeSelection({
|
|
50
|
+
axis: "preset",
|
|
51
|
+
preset: requested
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/extensions/workspaces/sessions/(backend)/command/preset.server.ts
|
|
58
|
+
var preset_server_default = defineRoutedContribution(({ agent }) => agent ? createPresetServerCommand(agent) : void 0, { cardinality: "optional" });
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/help-how-to-preset.server.ts
|
|
61
|
+
var help_how_to_preset_server_default = defineResource({
|
|
62
|
+
name: "help-how-to-preset",
|
|
63
|
+
description: "Configure Po default packages, layers, extensions, hook groups, and named presets. Use when creating or editing ~/.po/presets.yaml or a repository's .po/presets.yaml, choosing a default preset, or diagnosing which behavior a preset activates.",
|
|
64
|
+
when: PO_HELP_WHEN,
|
|
65
|
+
kind: "skill",
|
|
66
|
+
path: packageResourcePath(import.meta.url, "src/prompts/help-how-to-preset/SKILL.md"),
|
|
67
|
+
read: () => readPackageResource(import.meta.url, "src/prompts/help-how-to-preset/SKILL.md")
|
|
68
|
+
});
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region generated/server.ts
|
|
71
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
72
|
+
/* v8 ignore next -- generated normalization branch */
|
|
73
|
+
const defined = (values) => values.filter((value) => value !== void 0);
|
|
74
|
+
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
75
|
+
...identity,
|
|
76
|
+
...value
|
|
77
|
+
};
|
|
78
|
+
const serverPlugin = defineServerPlugin({
|
|
79
|
+
name: "@agimon-ai/po-preset",
|
|
80
|
+
session: (context) => ({
|
|
81
|
+
get api() {
|
|
82
|
+
return [at(route_server_default, context)];
|
|
83
|
+
},
|
|
84
|
+
get commands() {
|
|
85
|
+
return defined([via({ name: "preset" }, at(preset_server_default, context))]);
|
|
86
|
+
},
|
|
87
|
+
get resources() {
|
|
88
|
+
return [at(help_how_to_preset_server_default, context)];
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
//#endregion
|
|
93
|
+
export { serverPlugin as default, serverPlugin };
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.mjs","names":["apiRoute","commandPreset","resourceHelpHowToPreset"],"sources":["../../src/extensions/workspaces/sessions/(backend)/api/preset/route.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/presetServerCommand.ts","../../src/extensions/workspaces/sessions/(backend)/command/preset.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-preset.server.ts","../../generated/server.ts"],"sourcesContent":["import { defineRoute } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoute(({ agent }: PoServerPluginContext) => ({\n basePath: 'preset',\n start: () => ({\n fetch(request: Request) {\n if (new URL(request.url).pathname !== '/current') return Response.json({ error: 'Not found' }, { status: 404 });\n if (request.method !== 'GET')\n return Response.json({ error: 'Method not allowed' }, { status: 405, headers: { Allow: 'GET' } });\n if (!agent) return Response.json({ error: 'Session agent unavailable' }, { status: 404 });\n const selection = agent.context.selection;\n return Response.json({ preset: selection.preset, activeLayers: selection.activeLayers });\n },\n close() {},\n }),\n}));\n","import { loadPresetsConfig, resolveLayers } from '@agimon-ai/po-config/presets';\nimport { type PoHeadlessCommand, type PoHeadlessHostService } from '@agimon-ai/po-core/headless';\n\nimport { PRESET_COMMAND, presetOptionLabel } from '../../../../../services/presetText';\n\nexport function createPresetServerCommand(host: PoHeadlessHostService): PoHeadlessCommand {\n return {\n name: PRESET_COMMAND,\n description: 'Show or change the active Po preset.',\n async execute(args, execution) {\n const config = loadPresetsConfig(execution.repoRoot);\n let requested = args.trim();\n if (!requested) {\n const selected = await execution.client.request({\n kind: 'select',\n title: `Preset (current: ${execution.selection.preset})`,\n options: Object.keys(config.preset).map((name) => ({\n label: presetOptionLabel(name, config.preset[name]?.layers ?? [], execution.selection.preset),\n value: name,\n })),\n });\n if (typeof selected !== 'string' || !selected) return;\n requested = selected;\n }\n // Reject invalid command input before requesting a capability transition.\n resolveLayers(config, requested);\n if (requested === execution.selection.preset) return;\n await host.changeSelection({ axis: 'preset', preset: requested });\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createPresetServerCommand } from '../_lib/presetServerCommand';\nexport default defineRoutedContribution(\n ({ agent }: PoServerPluginContext) => (agent ? createPresetServerCommand(agent) : undefined),\n { cardinality: 'optional' },\n);\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { PO_HELP_WHEN } from '@agimon-ai/po-core/help';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineResource({\n name: 'help-how-to-preset',\n description:\n \"Configure Po default packages, layers, extensions, hook groups, and named presets. Use when creating or editing ~/.po/presets.yaml or a repository's .po/presets.yaml, choosing a default preset, or diagnosing which behavior a preset activates.\",\n when: PO_HELP_WHEN,\n kind: 'skill' as const,\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-preset/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/help-how-to-preset/SKILL.md'),\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport apiRoute from '../src/extensions/workspaces/sessions/(backend)/api/preset/route.server';\nimport commandPreset from '../src/extensions/workspaces/sessions/(backend)/command/preset.server';\nimport resourceHelpHowToPreset from '../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-preset.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-preset',\n session: (context) => ({\n get api(): PoServerSessionPlugin['api'] { return [at(apiRoute, context)]; },\n get commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'preset' }, at(commandPreset, context))]); },\n get resources(): PoServerSessionPlugin['resources'] { return [at(resourceHelpHowToPreset, context)]; },\n }),\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;AAGA,IAAA,uBAAe,aAAa,EAAE,aAAoC;CAChE,UAAU;CACV,cAAc;EACZ,MAAM,SAAkB;GACtB,IAAI,IAAI,IAAI,QAAQ,GAAG,CAAC,CAAC,aAAa,YAAY,OAAO,SAAS,KAAK,EAAE,OAAO,YAAY,GAAG,EAAE,QAAQ,IAAI,CAAC;GAC9G,IAAI,QAAQ,WAAW,OACrB,OAAO,SAAS,KAAK,EAAE,OAAO,qBAAqB,GAAG;IAAE,QAAQ;IAAK,SAAS,EAAE,OAAO,MAAM;GAAE,CAAC;GAClG,IAAI,CAAC,OAAO,OAAO,SAAS,KAAK,EAAE,OAAO,4BAA4B,GAAG,EAAE,QAAQ,IAAI,CAAC;GACxF,MAAM,YAAY,MAAM,QAAQ;GAChC,OAAO,SAAS,KAAK;IAAE,QAAQ,UAAU;IAAQ,cAAc,UAAU;GAAa,CAAC;EACzF;EACA,QAAQ,CAAC;CACX;AACF,EAAE;;;ACXF,SAAgB,0BAA0B,MAAgD;CACxF,OAAO;EACL,MAAM;EACN,aAAa;EACb,MAAM,QAAQ,MAAM,WAAW;GAC7B,MAAM,SAAS,kBAAkB,UAAU,QAAQ;GACnD,IAAI,YAAY,KAAK,KAAK;GAC1B,IAAI,CAAC,WAAW;IACd,MAAM,WAAW,MAAM,UAAU,OAAO,QAAQ;KAC9C,MAAM;KACN,OAAO,oBAAoB,UAAU,UAAU,OAAO;KACtD,SAAS,OAAO,KAAK,OAAO,MAAM,CAAC,CAAC,KAAK,UAAU;MACjD,OAAO,kBAAkB,MAAM,OAAO,OAAO,KAAK,EAAE,UAAU,CAAC,GAAG,UAAU,UAAU,MAAM;MAC5F,OAAO;KACT,EAAE;IACJ,CAAC;IACD,IAAI,OAAO,aAAa,YAAY,CAAC,UAAU;IAC/C,YAAY;GACd;GAEA,cAAc,QAAQ,SAAS;GAC/B,IAAI,cAAc,UAAU,UAAU,QAAQ;GAC9C,MAAM,KAAK,gBAAgB;IAAE,MAAM;IAAU,QAAQ;GAAU,CAAC;EAClE;CACF;AACF;;;AC1BA,IAAA,wBAAe,0BACZ,EAAE,YAAoC,QAAQ,0BAA0B,KAAK,IAAI,KAAA,GAClF,EAAE,aAAa,WAAW,CAC5B;;;ACHA,IAAA,oCAAe,eAAe;CAC5B,MAAM;CACN,aACE;CACF,MAAM;CACN,MAAM;CACN,MAAM,oBAAoB,YAAY,KAAK,yCAAyC;CACpF,YAAY,oBAAoB,YAAY,KAAK,yCAAyC;AAC5F,CAAC;;;ACJD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;;AAEpE,MAAM,WAAc,WAClB,OAAO,QAAQ,UAAsB,UAAU,KAAA,CAAS;AAC1D,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,eAAe,mBAAmB;CAC7C,MAAM;CACN,UAAU,aAAa;EACrB,IAAI,MAAoC;GAAE,OAAO,CAAC,GAAGA,sBAAU,OAAO,CAAC;EAAG;EAC1E,IAAI,WAA8C;GAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,SAAS,GAAG,GAAGC,uBAAe,OAAO,CAAC,CAAC,CAAC;EAAG;EAC3H,IAAI,YAAgD;GAAE,OAAO,CAAC,GAAGC,mCAAyB,OAAO,CAAC;EAAG;CACvG;AACF,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_presetText = require("./presetText-Cd-rq9lL.cjs");
|
|
3
|
+
//#region src/services/statusLine/index.ts
|
|
4
|
+
const STATUS_KEY = "po-preset";
|
|
5
|
+
/** Compact footer text for the selected preset, domains, and profile. */
|
|
6
|
+
function statusText(preset, domains, profile) {
|
|
7
|
+
return [
|
|
8
|
+
profile ? `*${profile}*` : void 0,
|
|
9
|
+
`[${preset}]`,
|
|
10
|
+
domains.join(",")
|
|
11
|
+
].filter((part) => Boolean(part)).join(":");
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/types/preset.ts
|
|
15
|
+
/** The npm name this package registers its voice tool and contributions under. */
|
|
16
|
+
const PRESET_SOURCE = "@agimon-ai/po-preset";
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.PRESET_COMMAND = require_presetText.PRESET_COMMAND;
|
|
19
|
+
exports.PRESET_SOURCE = PRESET_SOURCE;
|
|
20
|
+
exports.STATUS_KEY = STATUS_KEY;
|
|
21
|
+
exports.applySummary = require_presetText.applySummary;
|
|
22
|
+
exports.optionName = require_presetText.optionName;
|
|
23
|
+
exports.presetItems = require_presetText.presetItems;
|
|
24
|
+
exports.presetOptionLabel = require_presetText.presetOptionLabel;
|
|
25
|
+
exports.presetSummary = require_presetText.presetSummary;
|
|
26
|
+
exports.statusText = statusText;
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/services/statusLine/index.ts","../src/types/preset.ts"],"sourcesContent":["export const STATUS_KEY = 'po-preset';\n\n/** Compact footer text for the selected preset, domains, and profile. */\nexport function statusText(preset: string, domains: readonly string[], profile?: string): string {\n return [profile ? `*${profile}*` : undefined, `[${preset}]`, domains.join(',')]\n .filter((part) => Boolean(part))\n .join(':');\n}\n","import type { PresetsConfig } from '@agimon-ai/po-config/presets';\n\n/** The npm name this package registers its voice tool and contributions under. */\nexport const PRESET_SOURCE = '@agimon-ai/po-preset';\n\n/** The selection as both the command and the voice tool need to see it. */\nexport interface PresetView {\n config: PresetsConfig;\n preset: string;\n domains: readonly string[];\n profile?: string;\n}\n"],"mappings":";;;AAAA,MAAa,aAAa;;AAG1B,SAAgB,WAAW,QAAgB,SAA4B,SAA0B;CAC/F,OAAO;EAAC,UAAU,IAAI,QAAQ,KAAK,KAAA;EAAW,IAAI,OAAO;EAAI,QAAQ,KAAK,GAAG;CAAC,CAAC,CAC5E,QAAQ,SAAS,QAAQ,IAAI,CAAC,CAAC,CAC/B,KAAK,GAAG;AACb;;;;ACJA,MAAa,gBAAgB"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PresetsConfig } from "@agimon-ai/po-config/presets";
|
|
2
|
+
import { TransitionExecutionStrategy } from "@agimon-ai/po-core/transition";
|
|
3
|
+
//#region src/services/presetText/index.d.ts
|
|
4
|
+
interface SelectItem {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const PRESET_COMMAND = "preset";
|
|
10
|
+
/** Picker rows show the resolved layers while retaining bare preset values. */
|
|
11
|
+
export declare function presetItems(config: PresetsConfig, names: string[]): SelectItem[];
|
|
12
|
+
export declare function presetOptionLabel(name: string, layers: string[], current: string): string;
|
|
13
|
+
export declare function optionName(option: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* What a switch actually applied.
|
|
16
|
+
*
|
|
17
|
+
* A synced session composes its extension set on every load, so a reload picks
|
|
18
|
+
* up the new layers outright. A launcher session cannot: Pi freezes the CLI
|
|
19
|
+
* `--extension` list at construction, so a layer that contributes extensions
|
|
20
|
+
* needs a relaunch there and only the hooks change in place.
|
|
21
|
+
*/
|
|
22
|
+
export declare function applySummary(picked: string, layers: string[], stale: boolean, composed?: boolean, strategy?: TransitionExecutionStrategy, supervised?: boolean): string;
|
|
23
|
+
export declare function presetSummary(picked: string, layers: string[], current: string, composed?: boolean): string;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/services/statusLine/index.d.ts
|
|
26
|
+
export declare const STATUS_KEY = "po-preset";
|
|
27
|
+
/** Compact footer text for the selected preset, domains, and profile. */
|
|
28
|
+
export declare function statusText(preset: string, domains: readonly string[], profile?: string): string;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/types/preset.d.ts
|
|
31
|
+
/** The npm name this package registers its voice tool and contributions under. */
|
|
32
|
+
export declare const PRESET_SOURCE = "@agimon-ai/po-preset";
|
|
33
|
+
/** The selection as both the command and the voice tool need to see it. */
|
|
34
|
+
interface PresetView {
|
|
35
|
+
config: PresetsConfig;
|
|
36
|
+
preset: string;
|
|
37
|
+
domains: readonly string[];
|
|
38
|
+
profile?: string;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export type { PresetView };
|
|
42
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/services/presetText/index.ts","../src/services/statusLine/index.ts","../src/types/preset.ts"],"mappings":";;;UASU;EACR;EACA;EACA;;qBAGW;;wBAGG,YAAY,QAAQ,eAAe,kBAAkB;wBAQrD,kBAAkB,cAAc,kBAAkB;wBAIlD,WAAW;;;;;;;;;wBAYX,aACd,gBACA,kBACA,gBACA,oBACA,WAAW,6BACX;wBAqBc,cAAc,gBAAgB,kBAAkB,iBAAiB;;;qBCrEpE;;wBAGG,WAAW,gBAAgB,4BAA4B;;;;qBCA1D;;UAGI;EACf,QAAQ;EACR;EACA;EACA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { a as presetOptionLabel, i as presetItems, n as applySummary, o as presetSummary, r as optionName, t as PRESET_COMMAND } from "./presetText-CzKN5vOg.mjs";
|
|
2
|
+
//#region src/services/statusLine/index.ts
|
|
3
|
+
const STATUS_KEY = "po-preset";
|
|
4
|
+
/** Compact footer text for the selected preset, domains, and profile. */
|
|
5
|
+
function statusText(preset, domains, profile) {
|
|
6
|
+
return [
|
|
7
|
+
profile ? `*${profile}*` : void 0,
|
|
8
|
+
`[${preset}]`,
|
|
9
|
+
domains.join(",")
|
|
10
|
+
].filter((part) => Boolean(part)).join(":");
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/types/preset.ts
|
|
14
|
+
/** The npm name this package registers its voice tool and contributions under. */
|
|
15
|
+
const PRESET_SOURCE = "@agimon-ai/po-preset";
|
|
16
|
+
//#endregion
|
|
17
|
+
export { PRESET_COMMAND, PRESET_SOURCE, STATUS_KEY, applySummary, optionName, presetItems, presetOptionLabel, presetSummary, statusText };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/services/statusLine/index.ts","../src/types/preset.ts"],"sourcesContent":["export const STATUS_KEY = 'po-preset';\n\n/** Compact footer text for the selected preset, domains, and profile. */\nexport function statusText(preset: string, domains: readonly string[], profile?: string): string {\n return [profile ? `*${profile}*` : undefined, `[${preset}]`, domains.join(',')]\n .filter((part) => Boolean(part))\n .join(':');\n}\n","import type { PresetsConfig } from '@agimon-ai/po-config/presets';\n\n/** The npm name this package registers its voice tool and contributions under. */\nexport const PRESET_SOURCE = '@agimon-ai/po-preset';\n\n/** The selection as both the command and the voice tool need to see it. */\nexport interface PresetView {\n config: PresetsConfig;\n preset: string;\n domains: readonly string[];\n profile?: string;\n}\n"],"mappings":";;AAAA,MAAa,aAAa;;AAG1B,SAAgB,WAAW,QAAgB,SAA4B,SAA0B;CAC/F,OAAO;EAAC,UAAU,IAAI,QAAQ,KAAK,KAAA;EAAW,IAAI,OAAO;EAAI,QAAQ,KAAK,GAAG;CAAC,CAAC,CAC5E,QAAQ,SAAS,QAAQ,IAAI,CAAC,CAAC,CAC/B,KAAK,GAAG;AACb;;;;ACJA,MAAa,gBAAgB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
//#region src/services/presetText/index.ts
|
|
2
|
+
const OPTION_PREFIX = /^\[[ x]\] /;
|
|
3
|
+
const CORE_ONLY = "core only";
|
|
4
|
+
const MARK_ON = "[x]";
|
|
5
|
+
const MARK_OFF = "[ ]";
|
|
6
|
+
const RELAUNCH = "Relaunch with:";
|
|
7
|
+
const PRESET_OPTION = "--preset";
|
|
8
|
+
const PRESET_COMMAND = "preset";
|
|
9
|
+
/** Picker rows show the resolved layers while retaining bare preset values. */
|
|
10
|
+
function presetItems(config, names) {
|
|
11
|
+
return names.map((name) => ({
|
|
12
|
+
value: name,
|
|
13
|
+
label: name,
|
|
14
|
+
description: config.preset[name]?.description ?? CORE_ONLY
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
function presetOptionLabel(name, layers, current) {
|
|
18
|
+
return `${name === current ? MARK_ON : MARK_OFF} ${name}: ${layers.join(", ") || CORE_ONLY}`;
|
|
19
|
+
}
|
|
20
|
+
function optionName(option) {
|
|
21
|
+
return option.replace(OPTION_PREFIX, "").split(":")[0] ?? option;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What a switch actually applied.
|
|
25
|
+
*
|
|
26
|
+
* A synced session composes its extension set on every load, so a reload picks
|
|
27
|
+
* up the new layers outright. A launcher session cannot: Pi freezes the CLI
|
|
28
|
+
* `--extension` list at construction, so a layer that contributes extensions
|
|
29
|
+
* needs a relaunch there and only the hooks change in place.
|
|
30
|
+
*/
|
|
31
|
+
function applySummary(picked, layers, stale, composed = false, strategy, supervised = false) {
|
|
32
|
+
const head = `Switched to ${picked}: ${layers.join(", ") || CORE_ONLY}`;
|
|
33
|
+
if (strategy === "process-relaunch") {
|
|
34
|
+
if (supervised) return `Preset ${picked} is pending; the supervisor is restarting the agent with it.`;
|
|
35
|
+
return [`Preset ${picked} is pending; the current process remains active.`, ` ./pi.sh ${PRESET_OPTION} ${picked}`].join("\n");
|
|
36
|
+
}
|
|
37
|
+
if (strategy === "pi-reload") return [head, "Pi reloaded."].join("\n");
|
|
38
|
+
if (!stale || composed) return [head, "Hooks reloaded."].join("\n");
|
|
39
|
+
return [
|
|
40
|
+
head,
|
|
41
|
+
"Hooks reloaded. Extensions are fixed at launch, so for those:",
|
|
42
|
+
` ./pi.sh ${PRESET_OPTION} ${picked}`
|
|
43
|
+
].join("\n");
|
|
44
|
+
}
|
|
45
|
+
function presetSummary(picked, layers, current, composed = false) {
|
|
46
|
+
const contents = `Preset ${picked}: ${layers.join(", ") || CORE_ONLY}`;
|
|
47
|
+
if (picked !== current && !composed) return [contents, `${RELAUNCH}\n ./pi.sh ${PRESET_OPTION} ${picked}`].join("\n");
|
|
48
|
+
if (picked !== current) return contents;
|
|
49
|
+
return [contents, "Already using this preset."].join("\n");
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
Object.defineProperty(exports, "PRESET_COMMAND", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function() {
|
|
55
|
+
return PRESET_COMMAND;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "applySummary", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function() {
|
|
61
|
+
return applySummary;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, "optionName", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function() {
|
|
67
|
+
return optionName;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(exports, "presetItems", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function() {
|
|
73
|
+
return presetItems;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "presetOptionLabel", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function() {
|
|
79
|
+
return presetOptionLabel;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "presetSummary", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function() {
|
|
85
|
+
return presetSummary;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=presetText-Cd-rq9lL.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presetText-Cd-rq9lL.cjs","names":[],"sources":["../src/services/presetText/index.ts"],"sourcesContent":["import type { PresetsConfig } from '@agimon-ai/po-config/presets';\nimport type { TransitionExecutionStrategy } from '@agimon-ai/po-core/transition';\n\nconst OPTION_PREFIX = /^\\[[ x]\\] /;\nconst CORE_ONLY = 'core only';\nconst MARK_ON = '[x]';\nconst MARK_OFF = '[ ]';\nconst RELAUNCH = 'Relaunch with:';\nconst PRESET_OPTION = '--preset';\ninterface SelectItem {\n value: string;\n label: string;\n description?: string;\n}\n\nexport const PRESET_COMMAND = 'preset';\n\n/** Picker rows show the resolved layers while retaining bare preset values. */\nexport function presetItems(config: PresetsConfig, names: string[]): SelectItem[] {\n return names.map((name) => ({\n value: name,\n label: name,\n description: config.preset[name]?.description ?? CORE_ONLY,\n }));\n}\n\nexport function presetOptionLabel(name: string, layers: string[], current: string): string {\n return `${name === current ? MARK_ON : MARK_OFF} ${name}: ${layers.join(', ') || CORE_ONLY}`;\n}\n\nexport function optionName(option: string): string {\n return option.replace(OPTION_PREFIX, '').split(':')[0] ?? option;\n}\n\n/**\n * What a switch actually applied.\n *\n * A synced session composes its extension set on every load, so a reload picks\n * up the new layers outright. A launcher session cannot: Pi freezes the CLI\n * `--extension` list at construction, so a layer that contributes extensions\n * needs a relaunch there and only the hooks change in place.\n */\nexport function applySummary(\n picked: string,\n layers: string[],\n stale: boolean,\n composed = false,\n strategy?: TransitionExecutionStrategy,\n supervised = false,\n): string {\n const head = `Switched to ${picked}: ${layers.join(', ') || CORE_ONLY}`;\n if (strategy === 'process-relaunch') {\n if (supervised) {\n return `Preset ${picked} is pending; the supervisor is restarting the agent with it.`;\n }\n return [\n `Preset ${picked} is pending; the current process remains active.`,\n ` ./pi.sh ${PRESET_OPTION} ${picked}`,\n ].join('\\n');\n }\n if (strategy === 'pi-reload') return [head, 'Pi reloaded.'].join('\\n');\n if (!stale || composed) return [head, 'Hooks reloaded.'].join('\\n');\n return [\n head,\n 'Hooks reloaded. Extensions are fixed at launch, so for those:',\n ` ./pi.sh ${PRESET_OPTION} ${picked}`,\n ].join('\\n');\n}\n\nexport function presetSummary(picked: string, layers: string[], current: string, composed = false): string {\n const contents = `Preset ${picked}: ${layers.join(', ') || CORE_ONLY}`;\n if (picked !== current && !composed) {\n return [contents, `${RELAUNCH}\\n ./pi.sh ${PRESET_OPTION} ${picked}`].join('\\n');\n }\n if (picked !== current) return contents;\n return [contents, 'Already using this preset.'].join('\\n');\n}\n\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"],"mappings":";AAGA,MAAM,gBAAgB;AACtB,MAAM,YAAY;AAClB,MAAM,UAAU;AAChB,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,gBAAgB;AAOtB,MAAa,iBAAiB;;AAG9B,SAAgB,YAAY,QAAuB,OAA+B;CAChF,OAAO,MAAM,KAAK,UAAU;EAC1B,OAAO;EACP,OAAO;EACP,aAAa,OAAO,OAAO,KAAK,EAAE,eAAe;CACnD,EAAE;AACJ;AAEA,SAAgB,kBAAkB,MAAc,QAAkB,SAAyB;CACzF,OAAO,GAAG,SAAS,UAAU,UAAU,SAAS,GAAG,KAAK,IAAI,OAAO,KAAK,IAAI,KAAK;AACnF;AAEA,SAAgB,WAAW,QAAwB;CACjD,OAAO,OAAO,QAAQ,eAAe,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM;AAC5D;;;;;;;;;AAUA,SAAgB,aACd,QACA,QACA,OACA,WAAW,OACX,UACA,aAAa,OACL;CACR,MAAM,OAAO,eAAe,OAAO,IAAI,OAAO,KAAK,IAAI,KAAK;CAC5D,IAAI,aAAa,oBAAoB;EACnC,IAAI,YACF,OAAO,UAAU,OAAO;EAE1B,OAAO,CACL,UAAU,OAAO,mDACjB,aAAa,cAAc,GAAG,QAChC,CAAC,CAAC,KAAK,IAAI;CACb;CACA,IAAI,aAAa,aAAa,OAAO,CAAC,MAAM,cAAc,CAAC,CAAC,KAAK,IAAI;CACrE,IAAI,CAAC,SAAS,UAAU,OAAO,CAAC,MAAM,iBAAiB,CAAC,CAAC,KAAK,IAAI;CAClE,OAAO;EACL;EACA;EACA,aAAa,cAAc,GAAG;CAChC,CAAC,CAAC,KAAK,IAAI;AACb;AAEA,SAAgB,cAAc,QAAgB,QAAkB,SAAiB,WAAW,OAAe;CACzG,MAAM,WAAW,UAAU,OAAO,IAAI,OAAO,KAAK,IAAI,KAAK;CAC3D,IAAI,WAAW,WAAW,CAAC,UACzB,OAAO,CAAC,UAAU,GAAG,SAAS,cAAc,cAAc,GAAG,QAAQ,CAAC,CAAC,KAAK,IAAI;CAElF,IAAI,WAAW,SAAS,OAAO;CAC/B,OAAO,CAAC,UAAU,4BAA4B,CAAC,CAAC,KAAK,IAAI;AAC3D"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/services/presetText/index.ts
|
|
2
|
+
const OPTION_PREFIX = /^\[[ x]\] /;
|
|
3
|
+
const CORE_ONLY = "core only";
|
|
4
|
+
const MARK_ON = "[x]";
|
|
5
|
+
const MARK_OFF = "[ ]";
|
|
6
|
+
const RELAUNCH = "Relaunch with:";
|
|
7
|
+
const PRESET_OPTION = "--preset";
|
|
8
|
+
const PRESET_COMMAND = "preset";
|
|
9
|
+
/** Picker rows show the resolved layers while retaining bare preset values. */
|
|
10
|
+
function presetItems(config, names) {
|
|
11
|
+
return names.map((name) => ({
|
|
12
|
+
value: name,
|
|
13
|
+
label: name,
|
|
14
|
+
description: config.preset[name]?.description ?? CORE_ONLY
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
function presetOptionLabel(name, layers, current) {
|
|
18
|
+
return `${name === current ? MARK_ON : MARK_OFF} ${name}: ${layers.join(", ") || CORE_ONLY}`;
|
|
19
|
+
}
|
|
20
|
+
function optionName(option) {
|
|
21
|
+
return option.replace(OPTION_PREFIX, "").split(":")[0] ?? option;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What a switch actually applied.
|
|
25
|
+
*
|
|
26
|
+
* A synced session composes its extension set on every load, so a reload picks
|
|
27
|
+
* up the new layers outright. A launcher session cannot: Pi freezes the CLI
|
|
28
|
+
* `--extension` list at construction, so a layer that contributes extensions
|
|
29
|
+
* needs a relaunch there and only the hooks change in place.
|
|
30
|
+
*/
|
|
31
|
+
function applySummary(picked, layers, stale, composed = false, strategy, supervised = false) {
|
|
32
|
+
const head = `Switched to ${picked}: ${layers.join(", ") || CORE_ONLY}`;
|
|
33
|
+
if (strategy === "process-relaunch") {
|
|
34
|
+
if (supervised) return `Preset ${picked} is pending; the supervisor is restarting the agent with it.`;
|
|
35
|
+
return [`Preset ${picked} is pending; the current process remains active.`, ` ./pi.sh ${PRESET_OPTION} ${picked}`].join("\n");
|
|
36
|
+
}
|
|
37
|
+
if (strategy === "pi-reload") return [head, "Pi reloaded."].join("\n");
|
|
38
|
+
if (!stale || composed) return [head, "Hooks reloaded."].join("\n");
|
|
39
|
+
return [
|
|
40
|
+
head,
|
|
41
|
+
"Hooks reloaded. Extensions are fixed at launch, so for those:",
|
|
42
|
+
` ./pi.sh ${PRESET_OPTION} ${picked}`
|
|
43
|
+
].join("\n");
|
|
44
|
+
}
|
|
45
|
+
function presetSummary(picked, layers, current, composed = false) {
|
|
46
|
+
const contents = `Preset ${picked}: ${layers.join(", ") || CORE_ONLY}`;
|
|
47
|
+
if (picked !== current && !composed) return [contents, `${RELAUNCH}\n ./pi.sh ${PRESET_OPTION} ${picked}`].join("\n");
|
|
48
|
+
if (picked !== current) return contents;
|
|
49
|
+
return [contents, "Already using this preset."].join("\n");
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { presetOptionLabel as a, presetItems as i, applySummary as n, presetSummary as o, optionName as r, PRESET_COMMAND as t };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=presetText-CzKN5vOg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presetText-CzKN5vOg.mjs","names":[],"sources":["../src/services/presetText/index.ts"],"sourcesContent":["import type { PresetsConfig } from '@agimon-ai/po-config/presets';\nimport type { TransitionExecutionStrategy } from '@agimon-ai/po-core/transition';\n\nconst OPTION_PREFIX = /^\\[[ x]\\] /;\nconst CORE_ONLY = 'core only';\nconst MARK_ON = '[x]';\nconst MARK_OFF = '[ ]';\nconst RELAUNCH = 'Relaunch with:';\nconst PRESET_OPTION = '--preset';\ninterface SelectItem {\n value: string;\n label: string;\n description?: string;\n}\n\nexport const PRESET_COMMAND = 'preset';\n\n/** Picker rows show the resolved layers while retaining bare preset values. */\nexport function presetItems(config: PresetsConfig, names: string[]): SelectItem[] {\n return names.map((name) => ({\n value: name,\n label: name,\n description: config.preset[name]?.description ?? CORE_ONLY,\n }));\n}\n\nexport function presetOptionLabel(name: string, layers: string[], current: string): string {\n return `${name === current ? MARK_ON : MARK_OFF} ${name}: ${layers.join(', ') || CORE_ONLY}`;\n}\n\nexport function optionName(option: string): string {\n return option.replace(OPTION_PREFIX, '').split(':')[0] ?? option;\n}\n\n/**\n * What a switch actually applied.\n *\n * A synced session composes its extension set on every load, so a reload picks\n * up the new layers outright. A launcher session cannot: Pi freezes the CLI\n * `--extension` list at construction, so a layer that contributes extensions\n * needs a relaunch there and only the hooks change in place.\n */\nexport function applySummary(\n picked: string,\n layers: string[],\n stale: boolean,\n composed = false,\n strategy?: TransitionExecutionStrategy,\n supervised = false,\n): string {\n const head = `Switched to ${picked}: ${layers.join(', ') || CORE_ONLY}`;\n if (strategy === 'process-relaunch') {\n if (supervised) {\n return `Preset ${picked} is pending; the supervisor is restarting the agent with it.`;\n }\n return [\n `Preset ${picked} is pending; the current process remains active.`,\n ` ./pi.sh ${PRESET_OPTION} ${picked}`,\n ].join('\\n');\n }\n if (strategy === 'pi-reload') return [head, 'Pi reloaded.'].join('\\n');\n if (!stale || composed) return [head, 'Hooks reloaded.'].join('\\n');\n return [\n head,\n 'Hooks reloaded. Extensions are fixed at launch, so for those:',\n ` ./pi.sh ${PRESET_OPTION} ${picked}`,\n ].join('\\n');\n}\n\nexport function presetSummary(picked: string, layers: string[], current: string, composed = false): string {\n const contents = `Preset ${picked}: ${layers.join(', ') || CORE_ONLY}`;\n if (picked !== current && !composed) {\n return [contents, `${RELAUNCH}\\n ./pi.sh ${PRESET_OPTION} ${picked}`].join('\\n');\n }\n if (picked !== current) return contents;\n return [contents, 'Already using this preset.'].join('\\n');\n}\n\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"],"mappings":";AAGA,MAAM,gBAAgB;AACtB,MAAM,YAAY;AAClB,MAAM,UAAU;AAChB,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,gBAAgB;AAOtB,MAAa,iBAAiB;;AAG9B,SAAgB,YAAY,QAAuB,OAA+B;CAChF,OAAO,MAAM,KAAK,UAAU;EAC1B,OAAO;EACP,OAAO;EACP,aAAa,OAAO,OAAO,KAAK,EAAE,eAAe;CACnD,EAAE;AACJ;AAEA,SAAgB,kBAAkB,MAAc,QAAkB,SAAyB;CACzF,OAAO,GAAG,SAAS,UAAU,UAAU,SAAS,GAAG,KAAK,IAAI,OAAO,KAAK,IAAI,KAAK;AACnF;AAEA,SAAgB,WAAW,QAAwB;CACjD,OAAO,OAAO,QAAQ,eAAe,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM;AAC5D;;;;;;;;;AAUA,SAAgB,aACd,QACA,QACA,OACA,WAAW,OACX,UACA,aAAa,OACL;CACR,MAAM,OAAO,eAAe,OAAO,IAAI,OAAO,KAAK,IAAI,KAAK;CAC5D,IAAI,aAAa,oBAAoB;EACnC,IAAI,YACF,OAAO,UAAU,OAAO;EAE1B,OAAO,CACL,UAAU,OAAO,mDACjB,aAAa,cAAc,GAAG,QAChC,CAAC,CAAC,KAAK,IAAI;CACb;CACA,IAAI,aAAa,aAAa,OAAO,CAAC,MAAM,cAAc,CAAC,CAAC,KAAK,IAAI;CACrE,IAAI,CAAC,SAAS,UAAU,OAAO,CAAC,MAAM,iBAAiB,CAAC,CAAC,KAAK,IAAI;CAClE,OAAO;EACL;EACA;EACA,aAAa,cAAc,GAAG;CAChC,CAAC,CAAC,KAAK,IAAI;AACb;AAEA,SAAgB,cAAc,QAAgB,QAAkB,SAAiB,WAAW,OAAe;CACzG,MAAM,WAAW,UAAU,OAAO,IAAI,OAAO,KAAK,IAAI,KAAK;CAC3D,IAAI,WAAW,WAAW,CAAC,UACzB,OAAO,CAAC,UAAU,GAAG,SAAS,cAAc,cAAc,GAAG,QAAQ,CAAC,CAAC,KAAK,IAAI;CAElF,IAAI,WAAW,SAAS,OAAO;CAC/B,OAAO,CAAC,UAAU,4BAA4B,CAAC,CAAC,KAAK,IAAI;AAC3D"}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Po Pi Preset
|
|
2
|
+
|
|
3
|
+
Named preset selection for Po Pi sessions.
|
|
4
|
+
|
|
5
|
+
## How to author
|
|
6
|
+
|
|
7
|
+
- [Author Po presets](./src/prompts/help-how-to-preset/SKILL.md): Edit `presets.yaml` safely.
|
|
8
|
+
- [`presets.yaml` authoring contract](./src/prompts/help-how-to-preset/references/presets-contract.md): Source precedence, schema, resolution, and verification details.
|
|
9
|
+
|
|
10
|
+
## Package reference
|
|
11
|
+
|
|
12
|
+
- [Package README](./README.md): The `/preset` command, the `preset` voice tool, and how a preset resolves to layers.
|
package/package.json
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agimon-ai/po-preset",
|
|
3
|
+
"version": "0.0.0-alpha.163",
|
|
4
|
+
"description": "Named preset selection and layer composition switching for Po sessions.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"coding-agent",
|
|
8
|
+
"developer-tools",
|
|
9
|
+
"layer-composition",
|
|
10
|
+
"pi-coding-agent",
|
|
11
|
+
"pi-extension",
|
|
12
|
+
"pi-package",
|
|
13
|
+
"po",
|
|
14
|
+
"preset",
|
|
15
|
+
"session-reload"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://agimon.ai",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/AgiFlow/po/issues"
|
|
20
|
+
},
|
|
21
|
+
"license": "BUSL-1.1",
|
|
22
|
+
"author": "Vuong Ngo",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/AgiFlow/po.git",
|
|
26
|
+
"directory": "packages/foundations/po-preset"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"llms.txt",
|
|
31
|
+
"src/prompts",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"package.json"
|
|
35
|
+
],
|
|
36
|
+
"type": "module",
|
|
37
|
+
"main": "./dist/index.cjs",
|
|
38
|
+
"module": "./dist/index.mjs",
|
|
39
|
+
"types": "./dist/index.d.mts",
|
|
40
|
+
"jsnext:main": "./dist/index.mjs",
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"types": "./dist/index.d.mts",
|
|
44
|
+
"import": "./dist/index.mjs",
|
|
45
|
+
"require": "./dist/index.cjs"
|
|
46
|
+
},
|
|
47
|
+
"./apiContracts": {
|
|
48
|
+
"types": "./dist/apiContracts.d.mts",
|
|
49
|
+
"import": "./dist/apiContracts.mjs",
|
|
50
|
+
"require": "./dist/apiContracts.cjs"
|
|
51
|
+
},
|
|
52
|
+
"./extensions/server": {
|
|
53
|
+
"types": "./dist/extensions/server.d.mts",
|
|
54
|
+
"import": "./dist/extensions/server.mjs",
|
|
55
|
+
"require": "./dist/extensions/server.cjs"
|
|
56
|
+
},
|
|
57
|
+
"./package.json": "./package.json"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@agimon-ai/po-config": "0.0.0-alpha.163",
|
|
64
|
+
"@agimon-ai/po-core": "0.0.0-alpha.163",
|
|
65
|
+
"@deepseek-ai/cordis": "4.0.5",
|
|
66
|
+
"typebox": "1.4.2"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@agimon-ai/po-build": "0.0.0-alpha.163",
|
|
70
|
+
"@agimon-ai/po-voice": "0.0.0-alpha.163",
|
|
71
|
+
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.163",
|
|
72
|
+
"@deepseek-ai/cordis": "4.0.5",
|
|
73
|
+
"@earendil-works/pi-coding-agent": "1.5.1",
|
|
74
|
+
"@types/node": "26.6.5",
|
|
75
|
+
"@vitest/coverage-v8": "5.0.4",
|
|
76
|
+
"tsdown": "0.23.1",
|
|
77
|
+
"typescript": "7.0.2",
|
|
78
|
+
"vitest": "5.0.4"
|
|
79
|
+
},
|
|
80
|
+
"peerDependencies": {
|
|
81
|
+
"@earendil-works/pi-coding-agent": "1.5.1"
|
|
82
|
+
},
|
|
83
|
+
"peerDependenciesMeta": {
|
|
84
|
+
"@earendil-works/pi-coding-agent": {
|
|
85
|
+
"optional": true
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"engines": {
|
|
89
|
+
"node": ">=24"
|
|
90
|
+
},
|
|
91
|
+
"poMcp": {
|
|
92
|
+
"entry": "./generated/mcp.ts",
|
|
93
|
+
"dist": "./dist/extensions/mcp.mjs",
|
|
94
|
+
"scopes": [
|
|
95
|
+
"session"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"poServer": {
|
|
99
|
+
"entry": "./generated/server.ts",
|
|
100
|
+
"dist": "./dist/extensions/server.mjs",
|
|
101
|
+
"scopes": [
|
|
102
|
+
"session"
|
|
103
|
+
],
|
|
104
|
+
"contracts": {
|
|
105
|
+
"entry": "./src/exports/apiContracts.ts",
|
|
106
|
+
"dist": "./dist/apiContracts.mjs"
|
|
107
|
+
},
|
|
108
|
+
"brain": {
|
|
109
|
+
"version": 1,
|
|
110
|
+
"provides": {}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"scripts": {
|
|
114
|
+
"build": "tsdown && pnpm build:mcp",
|
|
115
|
+
"build:mcp": "tsdown --config tsdown.mcp.config.ts",
|
|
116
|
+
"test": "vitest --run",
|
|
117
|
+
"typecheck": "tsrs --noEmit",
|
|
118
|
+
"lint": "oxlint . && oxfmt . --check",
|
|
119
|
+
"fixcode": "oxlint . --fix && oxfmt ."
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: help-how-to-preset
|
|
3
|
+
description: Configure Po default packages, layers, extensions, hook groups, and named presets. Use when creating or editing ~/.po/presets.yaml or a repository's .po/presets.yaml, choosing a default preset, or diagnosing which behavior a preset activates.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Author Po presets
|
|
7
|
+
|
|
8
|
+
Use `presets.yaml` only for runtime composition. Presets choose ordered layers, and layers choose
|
|
9
|
+
Pi extensions, extension packages, and hook groups. Domains configure plugin content and MCP access;
|
|
10
|
+
profiles configure personas and environment defaults.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. Read both `~/.po/presets.yaml` and the repository's `.po/presets.yaml` when they exist.
|
|
15
|
+
2. Decide whether the change belongs in the personal defaults or only in the current repository.
|
|
16
|
+
3. Preserve unrelated definitions and authored array order.
|
|
17
|
+
4. Put unconditional packages in `default.packages`, reusable behavior in `layers`, and selections
|
|
18
|
+
under `preset`.
|
|
19
|
+
5. Write new presets as mappings with a useful `description` and an ordered `layers` array.
|
|
20
|
+
6. Put package-owned settings under that package's `config` mapping. Do not add layer-level `config`
|
|
21
|
+
or the removed `targets` field.
|
|
22
|
+
7. Check the result with `po --preset <name> --explain`. Use `po sync --check` when the
|
|
23
|
+
change affects installed packages or the synchronized matrix.
|
|
24
|
+
|
|
25
|
+
Relative local paths resolve from the repository root for repository configuration and from
|
|
26
|
+
`~/.po` for personal configuration. A repository definition replaces a personal definition
|
|
27
|
+
of the same name as a whole value, so never assume nested fields merge.
|
|
28
|
+
|
|
29
|
+
Read [references/presets-contract.md](references/presets-contract.md) before editing package entries,
|
|
30
|
+
local extension paths, hook-only layers, inherited definitions, or tombstones.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Po `presets.yaml` authoring contract
|
|
2
|
+
|
|
3
|
+
## Purpose and sources
|
|
4
|
+
|
|
5
|
+
`presets.yaml` controls the behavior axis of a Po session:
|
|
6
|
+
|
|
7
|
+
- `default.packages` is the unconditional package baseline.
|
|
8
|
+
- `layers` are reusable ordered bundles of extensions, packages, and hook groups.
|
|
9
|
+
- `preset` maps a session preset to an ordered list of layer names.
|
|
10
|
+
- `defaultPreset` selects the starting preset when no flag or inherited environment value wins.
|
|
11
|
+
|
|
12
|
+
Po reads `~/.po/presets.yaml` first and `<repoRoot>/.po/presets.yaml` second. Either file may
|
|
13
|
+
stand alone. A missing or empty file contributes nothing.
|
|
14
|
+
|
|
15
|
+
Named `layers` and `preset` entries merge by name. A repository entry replaces the complete
|
|
16
|
+
personal entry with the same name. Setting an inherited layer or preset to `null` removes it. The
|
|
17
|
+
top-level `default` block is also replaced as a whole when the repository declares it. An omitted
|
|
18
|
+
repository `default` keeps the personal definition. `defaultPreset` uses the last declared value.
|
|
19
|
+
|
|
20
|
+
Relative paths retain the source that declared them:
|
|
21
|
+
|
|
22
|
+
- Personal paths resolve from `~/.po`.
|
|
23
|
+
- Repository paths resolve from the repository root, not from `<repoRoot>/.po`.
|
|
24
|
+
|
|
25
|
+
## Supported shape
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
# Optional package baseline loaded before every selected named layer.
|
|
29
|
+
default:
|
|
30
|
+
packages:
|
|
31
|
+
- '@agimon-ai/po-help'
|
|
32
|
+
- name: '@scope/optional-extension'
|
|
33
|
+
optional: true
|
|
34
|
+
config:
|
|
35
|
+
policy: concise
|
|
36
|
+
|
|
37
|
+
layers:
|
|
38
|
+
local-review:
|
|
39
|
+
extensions:
|
|
40
|
+
- './extensions/review.ts'
|
|
41
|
+
packages:
|
|
42
|
+
- '@scope/review-extension'
|
|
43
|
+
hookGroups: [repository]
|
|
44
|
+
team:
|
|
45
|
+
packages:
|
|
46
|
+
- name: '@agimon-ai/po-team'
|
|
47
|
+
config:
|
|
48
|
+
models:
|
|
49
|
+
- model: provider/model-id
|
|
50
|
+
thinking: high
|
|
51
|
+
|
|
52
|
+
defaultPreset: copilot
|
|
53
|
+
preset:
|
|
54
|
+
minimal:
|
|
55
|
+
description: Small sessions with delegation only.
|
|
56
|
+
layers: [team]
|
|
57
|
+
copilot:
|
|
58
|
+
description: General coding with delegation and local review policy.
|
|
59
|
+
layers: [team, local-review]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Treat the `default` example as a shape, not as the current distribution package list. Preserve the
|
|
63
|
+
baseline emitted by `po init` unless the user explicitly wants to replace it. If neither source
|
|
64
|
+
declares `default`, Po adds no fallback feature package set. `default.packages: []` deliberately
|
|
65
|
+
selects an empty baseline. Fixed core packages remain active independently.
|
|
66
|
+
|
|
67
|
+
### `default`
|
|
68
|
+
|
|
69
|
+
`default` accepts exactly one field, `packages`, and `packages` must be an array. It does not accept
|
|
70
|
+
`extensions` or `hookGroups`. Its packages activate before packages from selected named layers.
|
|
71
|
+
|
|
72
|
+
### `layers`
|
|
73
|
+
|
|
74
|
+
Each layer is a mapping with these supported fields:
|
|
75
|
+
|
|
76
|
+
- `extensions`: an array of non-empty strings. A bare name selects a Po built-in extension.
|
|
77
|
+
A `./` or `../` path, or an absolute path, selects a Pi-compatible script or extension directory.
|
|
78
|
+
- `packages`: an array of package strings or package mappings. A normal npm package activates its
|
|
79
|
+
ordered `package.json` `pi.extensions` entries. An exported subpath can select one adapter.
|
|
80
|
+
Path-like packages are supported for local unpublished Pi packages.
|
|
81
|
+
- `hookGroups`: a legacy array of hook group IDs. It still parses but has no runtime effect.
|
|
82
|
+
|
|
83
|
+
A package mapping accepts only:
|
|
84
|
+
|
|
85
|
+
- `name`: required non-empty package specifier or local path.
|
|
86
|
+
- `optional`: optional boolean. A missing optional package is skipped and is not installed.
|
|
87
|
+
- `config`: optional mapping owned and interpreted by that package. Its contents stay opaque to the
|
|
88
|
+
preset parser.
|
|
89
|
+
|
|
90
|
+
Required npm packages missing from the active baseline or selected layers can be installed during
|
|
91
|
+
launch. `po sync` considers required packages from the baseline and every declared layer.
|
|
92
|
+
Optional packages and local paths are not installed automatically.
|
|
93
|
+
|
|
94
|
+
Package configuration belongs inside its package mapping. Layer-level `config` is rejected because
|
|
95
|
+
there is no unambiguous owner. The removed `targets` field is also rejected. Select a layer by naming
|
|
96
|
+
it from the appropriate presets.
|
|
97
|
+
|
|
98
|
+
### `preset` and `defaultPreset`
|
|
99
|
+
|
|
100
|
+
New presets use this mapping form:
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
preset:
|
|
104
|
+
review:
|
|
105
|
+
description: Focused review with repository policy and Team delegation.
|
|
106
|
+
layers: [team, local-review]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`description` must be a non-empty string and `layers` must be an array of non-empty layer names.
|
|
110
|
+
Every referenced layer must survive source merging. Layer order and repeated entries are preserved.
|
|
111
|
+
The array-only compatibility form, such as `review: [team, local-review]`, is accepted and receives a
|
|
112
|
+
generated description, but new configuration should use the mapping form.
|
|
113
|
+
|
|
114
|
+
When `defaultPreset` is explicitly configured, it must name a surviving preset. If no source
|
|
115
|
+
declares it, Po uses the compatible `copilot` fallback. Declare an explicit default when the
|
|
116
|
+
available presets do not include `copilot`.
|
|
117
|
+
|
|
118
|
+
## Safe changes
|
|
119
|
+
|
|
120
|
+
- Add a package to an existing layer when it should follow that layer's activation and ownership.
|
|
121
|
+
- Add a new layer when the behavior should be reusable across multiple presets or independently
|
|
122
|
+
ordered.
|
|
123
|
+
- Add a new preset by composing existing layers, then add new layers only for missing behavior.
|
|
124
|
+
- Use a repository replacement when a shared personal definition is unsuitable for one repository.
|
|
125
|
+
- Use `null` only to remove an inherited named layer or named preset. Do not use it as a package entry
|
|
126
|
+
or as a partial-field deletion mechanism.
|
|
127
|
+
- Keep local paths within trusted, reviewable locations and confirm they resolve from the declaring
|
|
128
|
+
source's base directory.
|
|
129
|
+
|
|
130
|
+
## Verification
|
|
131
|
+
|
|
132
|
+
Run a read-only resolution before launching:
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
po --preset review --explain
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Confirm the reported preset, ordered layers, hook groups, and resulting resources. If packages
|
|
139
|
+
or synchronized composition changed, check drift and missing packages without updating artifacts:
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
po sync --check
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Run `po sync` only when the user intends to install packages or refresh synchronized artifacts.
|
|
146
|
+
For repository changes to the parser or templates themselves, run the affected Po Config and
|
|
147
|
+
Po lint, typecheck, build, and test targets.
|