@agimon-ai/po-config 0.0.0-alpha.0
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 +21 -0
- package/README.md +170 -0
- package/dist/agentPluginMcp.cjs +322 -0
- package/dist/agentPluginMcp.cjs.map +1 -0
- package/dist/agentPluginMcp.d.mts +38 -0
- package/dist/agentPluginMcp.d.mts.map +1 -0
- package/dist/agentPluginMcp.mjs +318 -0
- package/dist/agentPluginMcp.mjs.map +1 -0
- package/dist/apiContracts.cjs +203 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +198 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/atomicJson-1W0WhuFF.mjs +44 -0
- package/dist/atomicJson-1W0WhuFF.mjs.map +1 -0
- package/dist/atomicJson-Dt2z_DXl.cjs +52 -0
- package/dist/atomicJson-Dt2z_DXl.cjs.map +1 -0
- package/dist/atomicJson.cjs +3 -0
- package/dist/atomicJson.d.mts +2 -0
- package/dist/atomicJson.mjs +2 -0
- package/dist/config-BUw5kHsx.cjs +219 -0
- package/dist/config-BUw5kHsx.cjs.map +1 -0
- package/dist/config-CKA07FxG.mjs +162 -0
- package/dist/config-CKA07FxG.mjs.map +1 -0
- package/dist/config-Cm3EV1jp.d.mts +320 -0
- package/dist/config-Cm3EV1jp.d.mts.map +1 -0
- package/dist/config-NSHRd6na.mjs +2 -0
- package/dist/config-zZz80Mh5.cjs +1 -0
- package/dist/config.cjs +24 -0
- package/dist/config.d.mts +3 -0
- package/dist/config.mjs +3 -0
- package/dist/configPolicy--TNX7feH.mjs +718 -0
- package/dist/configPolicy--TNX7feH.mjs.map +1 -0
- package/dist/configPolicy-DmsZEp0t.cjs +795 -0
- package/dist/configPolicy-DmsZEp0t.cjs.map +1 -0
- package/dist/configSchema.cjs +0 -0
- package/dist/configSchema.d.mts +2 -0
- package/dist/configSchema.mjs +1 -0
- package/dist/configWriter-BTuinLjs.cjs +150 -0
- package/dist/configWriter-BTuinLjs.cjs.map +1 -0
- package/dist/configWriter-BgkGaLrf.mjs +130 -0
- package/dist/configWriter-BgkGaLrf.mjs.map +1 -0
- package/dist/configWriter.cjs +5 -0
- package/dist/configWriter.d.mts +2 -0
- package/dist/configWriter.mjs +2 -0
- package/dist/domains-CBYkuxs5.cjs +727 -0
- package/dist/domains-CBYkuxs5.cjs.map +1 -0
- package/dist/domains-DZOu9vYM.mjs +633 -0
- package/dist/domains-DZOu9vYM.mjs.map +1 -0
- package/dist/domains.cjs +19 -0
- package/dist/domains.d.mts +3 -0
- package/dist/domains.mjs +3 -0
- package/dist/extensions/mcp-ui.mjs +101 -0
- package/dist/extensions/mcp-ui.mjs.map +1 -0
- package/dist/extensions/mcp.cjs +171 -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 +166 -0
- package/dist/extensions/mcp.mjs.map +1 -0
- package/dist/extensions/server.cjs +504 -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 +499 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/harnessState-CCyBeutB.cjs +188 -0
- package/dist/harnessState-CCyBeutB.cjs.map +1 -0
- package/dist/harnessState-Dn_S7fB9.mjs +163 -0
- package/dist/harnessState-Dn_S7fB9.mjs.map +1 -0
- package/dist/harnessState.cjs +6 -0
- package/dist/harnessState.d.mts +2 -0
- package/dist/harnessState.mjs +2 -0
- package/dist/harnessStore-CJSxdSkV.cjs +343 -0
- package/dist/harnessStore-CJSxdSkV.cjs.map +1 -0
- package/dist/harnessStore-CltwLB7M.mjs +262 -0
- package/dist/harnessStore-CltwLB7M.mjs.map +1 -0
- package/dist/harnessStore.cjs +15 -0
- package/dist/harnessStore.d.mts +2 -0
- package/dist/harnessStore.mjs +2 -0
- package/dist/index-BAaTySaM.d.mts +35 -0
- package/dist/index-BAaTySaM.d.mts.map +1 -0
- package/dist/index-BT29GZx5.d.mts +142 -0
- package/dist/index-BT29GZx5.d.mts.map +1 -0
- package/dist/index-B_lp0W3U.d.mts +114 -0
- package/dist/index-B_lp0W3U.d.mts.map +1 -0
- package/dist/index-C6GaYjq-.d.mts +6 -0
- package/dist/index-C6GaYjq-.d.mts.map +1 -0
- package/dist/index-CIQrKS1A.d.mts +50 -0
- package/dist/index-CIQrKS1A.d.mts.map +1 -0
- package/dist/index-CRcoVYXz.d.mts +39 -0
- package/dist/index-CRcoVYXz.d.mts.map +1 -0
- package/dist/index-CVlciCJF.d.mts +40 -0
- package/dist/index-CVlciCJF.d.mts.map +1 -0
- package/dist/index-CeOk2kqs.d.mts +118 -0
- package/dist/index-CeOk2kqs.d.mts.map +1 -0
- package/dist/index-Ch7ptOkW.d.mts +54 -0
- package/dist/index-Ch7ptOkW.d.mts.map +1 -0
- package/dist/index-Cvdt-Y-i.d.mts +66 -0
- package/dist/index-Cvdt-Y-i.d.mts.map +1 -0
- package/dist/index-DJpG-I9K.d.mts +122 -0
- package/dist/index-DJpG-I9K.d.mts.map +1 -0
- package/dist/index-DNk4q0Qm.d.mts +81 -0
- package/dist/index-DNk4q0Qm.d.mts.map +1 -0
- package/dist/index.cjs +121 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.mjs +15 -0
- package/dist/init-C_9nyp3-.cjs +448 -0
- package/dist/init-C_9nyp3-.cjs.map +1 -0
- package/dist/init-DJ6wm-dr.mjs +415 -0
- package/dist/init-DJ6wm-dr.mjs.map +1 -0
- package/dist/init.cjs +7 -0
- package/dist/init.d.mts +2 -0
- package/dist/init.mjs +2 -0
- package/dist/layeredConfig-B922ibgn.mjs +67 -0
- package/dist/layeredConfig-B922ibgn.mjs.map +1 -0
- package/dist/layeredConfig-DdI5ysUf.cjs +94 -0
- package/dist/layeredConfig-DdI5ysUf.cjs.map +1 -0
- package/dist/layeredConfig.cjs +6 -0
- package/dist/layeredConfig.d.mts +2 -0
- package/dist/layeredConfig.mjs +2 -0
- package/dist/majorModes-CmPLEpMT.mjs +333 -0
- package/dist/majorModes-CmPLEpMT.mjs.map +1 -0
- package/dist/majorModes-DPhVMuhT.cjs +383 -0
- package/dist/majorModes-DPhVMuhT.cjs.map +1 -0
- package/dist/majorModes.cjs +10 -0
- package/dist/majorModes.d.mts +2 -0
- package/dist/majorModes.mjs +2 -0
- package/dist/piConfig-Bx26HMb_.d.mts +33 -0
- package/dist/piConfig-Bx26HMb_.d.mts.map +1 -0
- package/dist/piConfig-CCBdZXQr.cjs +260 -0
- package/dist/piConfig-CCBdZXQr.cjs.map +1 -0
- package/dist/piConfig-qGyCbcVj.mjs +197 -0
- package/dist/piConfig-qGyCbcVj.mjs.map +1 -0
- package/dist/piConfig.cjs +12 -0
- package/dist/piConfig.d.mts +2 -0
- package/dist/piConfig.mjs +2 -0
- package/dist/piContext.cjs +18 -0
- package/dist/piContext.d.mts +3 -0
- package/dist/piContext.mjs +2 -0
- package/dist/profiles-CTrUCmIh.d.mts +27 -0
- package/dist/profiles-CTrUCmIh.d.mts.map +1 -0
- package/dist/profiles-DnF9DBpd.cjs +552 -0
- package/dist/profiles-DnF9DBpd.cjs.map +1 -0
- package/dist/profiles-fujQKrS0.mjs +483 -0
- package/dist/profiles-fujQKrS0.mjs.map +1 -0
- package/dist/profiles.cjs +13 -0
- package/dist/profiles.d.mts +25 -0
- package/dist/profiles.d.mts.map +1 -0
- package/dist/profiles.mjs +2 -0
- package/dist/rolldown-runtime-VH7oDXx4.cjs +28 -0
- package/dist/selectionSwitch.cjs +70 -0
- package/dist/selectionSwitch.cjs.map +1 -0
- package/dist/selectionSwitch.d.mts +30 -0
- package/dist/selectionSwitch.d.mts.map +1 -0
- package/dist/selectionSwitch.mjs +64 -0
- package/dist/selectionSwitch.mjs.map +1 -0
- package/dist/sessionConfig-Boh4Fdje.cjs +342 -0
- package/dist/sessionConfig-Boh4Fdje.cjs.map +1 -0
- package/dist/sessionConfig-CtLoc-lO.mjs +240 -0
- package/dist/sessionConfig-CtLoc-lO.mjs.map +1 -0
- package/dist/types.cjs +9 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +2 -0
- package/llms.txt +12 -0
- package/package.json +206 -0
- package/src/prompts/po-author-config/SKILL.md +26 -0
- package/src/prompts/po-author-config/agents/openai.yaml +4 -0
- package/src/prompts/po-author-config/references/config-contract.md +201 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { a as loadDoomConfigAsync, i as loadDoomConfig } from "./config-CKA07FxG.mjs";
|
|
2
|
+
import { a as getSessionHarnessState, i as getHarnessState } from "./harnessStore-CltwLB7M.mjs";
|
|
3
|
+
import { t as DOOM_CONFIG_SERVICE } from "./config-NSHRd6na.mjs";
|
|
4
|
+
import { Service } from "@deepseek-ai/cordis";
|
|
5
|
+
//#region src/services/doomConfigService/index.ts
|
|
6
|
+
function deepFreeze$1(value) {
|
|
7
|
+
if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
|
|
8
|
+
for (const child of Object.values(value)) deepFreeze$1(child);
|
|
9
|
+
return Object.freeze(value);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Doom configuration published on the shared cordis Context.
|
|
13
|
+
*
|
|
14
|
+
* Every extension resolves the same instance by name, so configuration stays
|
|
15
|
+
* one read per session instead of one per consumer, and the registration is
|
|
16
|
+
* removed with the fiber that created it. The loader is injected so this stays
|
|
17
|
+
* free of filesystem access.
|
|
18
|
+
*/
|
|
19
|
+
var DoomConfigService = class extends Service {
|
|
20
|
+
loadConfig;
|
|
21
|
+
generation;
|
|
22
|
+
snapshot;
|
|
23
|
+
constructor(ctx, snapshot, loadConfig, generation = `doom-config:${crypto.randomUUID()}`) {
|
|
24
|
+
super(ctx, DOOM_CONFIG_SERVICE);
|
|
25
|
+
this.loadConfig = loadConfig;
|
|
26
|
+
this.snapshot = deepFreeze$1(snapshot);
|
|
27
|
+
this.generation = generation;
|
|
28
|
+
}
|
|
29
|
+
getSnapshot() {
|
|
30
|
+
return this.snapshot;
|
|
31
|
+
}
|
|
32
|
+
replaceSnapshot(context) {
|
|
33
|
+
this.snapshot = deepFreeze$1(context);
|
|
34
|
+
return this.snapshot;
|
|
35
|
+
}
|
|
36
|
+
load(repoRoot, homeDirectory) {
|
|
37
|
+
return this.loadConfig(repoRoot, homeDirectory);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/services/sessionConfig/index.ts
|
|
42
|
+
const DOOM_CONFIG_ENTRY_TYPE = "po:config:v1";
|
|
43
|
+
const DOOM_CONFIG_TRANSITION_ENTRY_TYPE = "po:transition:v1";
|
|
44
|
+
function isSelection(value) {
|
|
45
|
+
if (typeof value !== "object" || value === null) return false;
|
|
46
|
+
const selection = value;
|
|
47
|
+
return selection.version === 1 && typeof selection.majorMode === "string" && Array.isArray(selection.domains) && selection.domains.every((domain) => typeof domain === "string") && (selection.profile === void 0 || typeof selection.profile === "string") && (selection.compositionFingerprint === void 0 || typeof selection.compositionFingerprint === "string");
|
|
48
|
+
}
|
|
49
|
+
function branchSelection(entries) {
|
|
50
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
51
|
+
const entry = entries[index];
|
|
52
|
+
if (entry?.type === "custom" && entry.customType === "po:config:v1" && isSelection(entry.data)) return entry.data;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function isTransitionStrategy(value) {
|
|
56
|
+
return value === "pi-reload" || value === "process-relaunch";
|
|
57
|
+
}
|
|
58
|
+
function isTransition(value) {
|
|
59
|
+
if (typeof value !== "object" || value === null) return false;
|
|
60
|
+
const transition = value;
|
|
61
|
+
return transition.version === 1 && typeof transition.operationId === "string" && isSelection(transition.active) && isSelection(transition.target) && isTransitionStrategy(transition.strategy) && (transition.phase === "pending" || transition.phase === "applied" || transition.phase === "aborted" || transition.phase === "superseded");
|
|
62
|
+
}
|
|
63
|
+
function branchTransition(entries) {
|
|
64
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
65
|
+
const entry = entries[index];
|
|
66
|
+
if (entry?.type === "custom" && entry.customType === "po:transition:v1" && isTransition(entry.data)) return entry.data;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function sameSelection(left, state) {
|
|
70
|
+
return left.majorMode === state.majorMode && left.profile === state.profile && (left.compositionFingerprint === void 0 || left.compositionFingerprint === state.compositionFingerprint) && left.domains.length === state.domains.length && left.domains.every((domain, index) => domain === state.domains[index]);
|
|
71
|
+
}
|
|
72
|
+
function isActiveTransitionTarget(target, state) {
|
|
73
|
+
return target.compositionFingerprint !== void 0 && target.compositionFingerprint === state.compositionFingerprint && sameSelection(target, state);
|
|
74
|
+
}
|
|
75
|
+
function pendingFromTransition(transition) {
|
|
76
|
+
if (transition.phase !== "pending") return void 0;
|
|
77
|
+
return {
|
|
78
|
+
...transition,
|
|
79
|
+
phase: "pending"
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function pendingFromLegacySelection(selection, bootstrap) {
|
|
83
|
+
if (sameSelection(selection, bootstrap)) return void 0;
|
|
84
|
+
return {
|
|
85
|
+
version: 1,
|
|
86
|
+
operationId: "legacy-config-selection",
|
|
87
|
+
active: {
|
|
88
|
+
version: 1,
|
|
89
|
+
majorMode: bootstrap.majorMode,
|
|
90
|
+
domains: [...bootstrap.domains],
|
|
91
|
+
profile: bootstrap.profile,
|
|
92
|
+
compositionFingerprint: bootstrap.compositionFingerprint
|
|
93
|
+
},
|
|
94
|
+
target: selection,
|
|
95
|
+
strategy: "process-relaunch",
|
|
96
|
+
phase: "pending"
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function deepFreeze(value) {
|
|
100
|
+
if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
|
|
101
|
+
for (const child of Object.values(value)) deepFreeze(child);
|
|
102
|
+
return Object.freeze(value);
|
|
103
|
+
}
|
|
104
|
+
function readDoomConfigSelection(ctx) {
|
|
105
|
+
return branchSelection(ctx.sessionManager.getBranch());
|
|
106
|
+
}
|
|
107
|
+
function resolveContextState(ctx) {
|
|
108
|
+
const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());
|
|
109
|
+
return resolveBranchState(ctx.sessionManager.getBranch(), bootstrap);
|
|
110
|
+
}
|
|
111
|
+
function resolveBranchState(entries, bootstrap) {
|
|
112
|
+
const selection = branchSelection(entries);
|
|
113
|
+
const transition = branchTransition(entries);
|
|
114
|
+
const transitionPending = transition ? pendingFromTransition(transition) : void 0;
|
|
115
|
+
const pendingSelection = transition ? transitionPending : selection ? pendingFromLegacySelection(selection, bootstrap) : void 0;
|
|
116
|
+
return {
|
|
117
|
+
harness: bootstrap,
|
|
118
|
+
pendingSelection,
|
|
119
|
+
requiresRelaunch: pendingSelection !== void 0 && (transitionPending === void 0 || !isActiveTransitionTarget(pendingSelection.target, bootstrap)),
|
|
120
|
+
root: bootstrap.root
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function createDoomConfigContext(ctx) {
|
|
124
|
+
const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);
|
|
125
|
+
return deepFreeze({
|
|
126
|
+
settings: loadDoomConfig(root ?? ctx.cwd),
|
|
127
|
+
harness,
|
|
128
|
+
pendingSelection,
|
|
129
|
+
requiresRelaunch
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async function createDoomConfigContextAsync(ctx) {
|
|
133
|
+
const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);
|
|
134
|
+
return deepFreeze({
|
|
135
|
+
settings: await loadDoomConfigAsync(root ?? ctx.cwd),
|
|
136
|
+
harness,
|
|
137
|
+
pendingSelection,
|
|
138
|
+
requiresRelaunch
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/** Initializes from this native session's branch, awaiting durable transition acknowledgement. */
|
|
142
|
+
async function createNativeDoomConfigContext(execution) {
|
|
143
|
+
const bootstrap = getSessionHarnessState(execution.sessionId);
|
|
144
|
+
const branch = (await execution.session.entries({ type: "custom" })).map((entry) => ({
|
|
145
|
+
type: String(entry.type),
|
|
146
|
+
customType: typeof entry.customType === "string" ? entry.customType : void 0,
|
|
147
|
+
data: entry.data
|
|
148
|
+
}));
|
|
149
|
+
const transition = branchTransition(branch);
|
|
150
|
+
if (transition?.phase === "pending" && isActiveTransitionTarget(transition.target, bootstrap)) {
|
|
151
|
+
const data = {
|
|
152
|
+
...transition,
|
|
153
|
+
phase: "applied"
|
|
154
|
+
};
|
|
155
|
+
await execution.session.appendCustomEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, data);
|
|
156
|
+
branch.push({
|
|
157
|
+
type: "custom",
|
|
158
|
+
customType: DOOM_CONFIG_TRANSITION_ENTRY_TYPE,
|
|
159
|
+
data
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
const { harness, pendingSelection, requiresRelaunch, root } = resolveBranchState(branch, bootstrap);
|
|
163
|
+
return deepFreeze({
|
|
164
|
+
settings: await loadDoomConfigAsync(root ?? execution.cwd, void 0, execution.environment),
|
|
165
|
+
harness,
|
|
166
|
+
pendingSelection,
|
|
167
|
+
requiresRelaunch
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function appendDoomConfigSelection(pi, selection) {
|
|
171
|
+
pi.appendEntry(DOOM_CONFIG_ENTRY_TYPE, selection);
|
|
172
|
+
}
|
|
173
|
+
/** Journals the live selection, defaulting to whatever the harness store holds. */
|
|
174
|
+
function persistHarnessSelection(pi, state = getHarnessState()) {
|
|
175
|
+
appendDoomConfigSelection(pi, {
|
|
176
|
+
version: 1,
|
|
177
|
+
majorMode: state.majorMode,
|
|
178
|
+
domains: state.domains,
|
|
179
|
+
profile: state.profile,
|
|
180
|
+
compositionFingerprint: state.compositionFingerprint
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function appendDoomConfigTransition(pi, transition) {
|
|
184
|
+
pi.appendEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, transition);
|
|
185
|
+
}
|
|
186
|
+
function supersedeDoomConfigTransition(pi, transition) {
|
|
187
|
+
pi.appendEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, {
|
|
188
|
+
...transition,
|
|
189
|
+
phase: "superseded"
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
/** Acknowledges the latest pending transition from a fresh session that owns its exact target composition. */
|
|
193
|
+
function acknowledgeDoomConfigTransition(pi, ctx, harness) {
|
|
194
|
+
const transition = branchTransition(ctx.sessionManager.getBranch());
|
|
195
|
+
if (!transition || transition.phase !== "pending" || !isActiveTransitionTarget(transition.target, harness)) return false;
|
|
196
|
+
appendDoomConfigTransition(pi, {
|
|
197
|
+
...transition,
|
|
198
|
+
phase: "applied"
|
|
199
|
+
});
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
function readDoomConfigPendingSelection(ctx) {
|
|
203
|
+
const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());
|
|
204
|
+
const transition = branchTransition(ctx.sessionManager.getBranch());
|
|
205
|
+
const transitionPending = transition ? pendingFromTransition(transition) : void 0;
|
|
206
|
+
if (transition) return transitionPending;
|
|
207
|
+
const selection = branchSelection(ctx.sessionManager.getBranch());
|
|
208
|
+
return selection ? pendingFromLegacySelection(selection, bootstrap) : void 0;
|
|
209
|
+
}
|
|
210
|
+
function provideDoomConfigContext(ctx, context, generation = `doom-config:${crypto.randomUUID()}`) {
|
|
211
|
+
return new DoomConfigService(ctx, deepFreeze(context), loadDoomConfig, generation);
|
|
212
|
+
}
|
|
213
|
+
/** Returns the binding identity used to fence in-flight transitions. */
|
|
214
|
+
function readDoomConfigContextGeneration(ctx) {
|
|
215
|
+
return readDoomConfigService(ctx)?.generation;
|
|
216
|
+
}
|
|
217
|
+
/** Precomputes an immutable context before a transaction reaches publication. */
|
|
218
|
+
function freezeDoomConfigContext(context) {
|
|
219
|
+
return deepFreeze(context);
|
|
220
|
+
}
|
|
221
|
+
/** Replaces a live binding with a deeply frozen context after publication. */
|
|
222
|
+
function replaceDoomConfigContext(ctx, context) {
|
|
223
|
+
const next = deepFreeze(context);
|
|
224
|
+
return requireDoomConfigService(ctx).replaceSnapshot(next);
|
|
225
|
+
}
|
|
226
|
+
function readDoomConfigService(ctx) {
|
|
227
|
+
return ctx.get(DOOM_CONFIG_SERVICE);
|
|
228
|
+
}
|
|
229
|
+
function requireDoomConfigService(ctx) {
|
|
230
|
+
const service = readDoomConfigService(ctx);
|
|
231
|
+
if (!service) throw new Error("Doom config service is unavailable. Load @agimon-ai/po-config/extensions/server.");
|
|
232
|
+
return service;
|
|
233
|
+
}
|
|
234
|
+
function requireDoomConfigContext(ctx) {
|
|
235
|
+
return requireDoomConfigService(ctx).getSnapshot();
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
export { supersedeDoomConfigTransition as _, appendDoomConfigTransition as a, createNativeDoomConfigContext as c, provideDoomConfigContext as d, readDoomConfigContextGeneration as f, requireDoomConfigContext as g, replaceDoomConfigContext as h, appendDoomConfigSelection as i, freezeDoomConfigContext as l, readDoomConfigSelection as m, DOOM_CONFIG_TRANSITION_ENTRY_TYPE as n, createDoomConfigContext as o, readDoomConfigPendingSelection as p, acknowledgeDoomConfigTransition as r, createDoomConfigContextAsync as s, DOOM_CONFIG_ENTRY_TYPE as t, persistHarnessSelection as u };
|
|
239
|
+
|
|
240
|
+
//# sourceMappingURL=sessionConfig-CtLoc-lO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionConfig-CtLoc-lO.mjs","names":["deepFreeze"],"sources":["../src/services/doomConfigService/index.ts","../src/services/sessionConfig/index.ts"],"sourcesContent":["import { type Context, Service } from '@deepseek-ai/cordis';\n\nimport {\n DOOM_CONFIG_SERVICE,\n type DeepReadonly,\n type DoomConfig,\n type DoomConfigContext,\n type DoomConfigLoader,\n type IDoomConfigService,\n} from '../../types/config';\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\n/**\n * Doom configuration published on the shared cordis Context.\n *\n * Every extension resolves the same instance by name, so configuration stays\n * one read per session instead of one per consumer, and the registration is\n * removed with the fiber that created it. The loader is injected so this stays\n * free of filesystem access.\n */\nexport class DoomConfigService extends Service implements IDoomConfigService {\n readonly generation: string;\n private snapshot: DoomConfigContext;\n\n constructor(\n ctx: Context,\n snapshot: DoomConfigContext,\n private readonly loadConfig: DoomConfigLoader,\n generation = `doom-config:${crypto.randomUUID()}`,\n ) {\n super(ctx, DOOM_CONFIG_SERVICE);\n this.snapshot = deepFreeze(snapshot) as DoomConfigContext;\n this.generation = generation;\n }\n\n getSnapshot(): DoomConfigContext {\n return this.snapshot;\n }\n\n replaceSnapshot(context: DoomConfigContext): DoomConfigContext {\n this.snapshot = deepFreeze(context) as DoomConfigContext;\n return this.snapshot;\n }\n\n load(repoRoot: string, homeDirectory?: string): DoomConfig {\n return this.loadConfig(repoRoot, homeDirectory);\n }\n}\n","import type { DoomHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\n\nimport type {\n DoomConfigSelection as ConfigSelection,\n DeepReadonly,\n DoomConfigContext,\n DoomConfigPendingSelection,\n DoomConfigTransitionRecord,\n DoomConfigTransitionStrategy,\n HarnessState,\n IDoomConfigService,\n} from '../../types/config';\nimport { DOOM_CONFIG_SERVICE } from '../../types/config';\nimport { loadDoomConfig, loadDoomConfigAsync } from '../config';\nimport { DoomConfigService } from '../doomConfigService';\nimport { getHarnessState, getSessionHarnessState } from '../harnessStore';\n\nexport const DOOM_CONFIG_ENTRY_TYPE = 'po:config:v1';\nexport const DOOM_CONFIG_TRANSITION_ENTRY_TYPE = 'po:transition:v1';\n\nexport type DoomConfigSelection = ConfigSelection;\n\ntype DoomConfigTransitionEntry = DoomConfigTransitionRecord;\n\nfunction isSelection(value: unknown): value is DoomConfigSelection {\n if (typeof value !== 'object' || value === null) return false;\n const selection = value as Partial<DoomConfigSelection>;\n return (\n selection.version === 1 &&\n typeof selection.majorMode === 'string' &&\n Array.isArray(selection.domains) &&\n selection.domains.every((domain) => typeof domain === 'string') &&\n (selection.profile === undefined || typeof selection.profile === 'string') &&\n (selection.compositionFingerprint === undefined || typeof selection.compositionFingerprint === 'string')\n );\n}\n\nfunction branchSelection(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): DoomConfigSelection | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (entry?.type === 'custom' && entry.customType === DOOM_CONFIG_ENTRY_TYPE && isSelection(entry.data)) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction isTransitionStrategy(value: unknown): value is DoomConfigTransitionStrategy {\n return value === 'pi-reload' || value === 'process-relaunch';\n}\n\nfunction isTransition(value: unknown): value is DoomConfigTransitionEntry {\n if (typeof value !== 'object' || value === null) return false;\n const transition = value as Partial<DoomConfigTransitionEntry>;\n return (\n transition.version === 1 &&\n typeof transition.operationId === 'string' &&\n isSelection(transition.active) &&\n isSelection(transition.target) &&\n isTransitionStrategy(transition.strategy) &&\n (transition.phase === 'pending' ||\n transition.phase === 'applied' ||\n transition.phase === 'aborted' ||\n transition.phase === 'superseded')\n );\n}\n\nfunction branchTransition(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n): DoomConfigTransitionEntry | undefined {\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const entry = entries[index];\n if (\n entry?.type === 'custom' &&\n entry.customType === DOOM_CONFIG_TRANSITION_ENTRY_TYPE &&\n isTransition(entry.data)\n ) {\n return entry.data;\n }\n }\n return undefined;\n}\n\nfunction sameSelection(left: DoomConfigSelection, state: HarnessState): boolean {\n return (\n left.majorMode === state.majorMode &&\n left.profile === state.profile &&\n (left.compositionFingerprint === undefined || left.compositionFingerprint === state.compositionFingerprint) &&\n left.domains.length === state.domains.length &&\n left.domains.every((domain, index) => domain === state.domains[index])\n );\n}\n\nfunction isActiveTransitionTarget(target: DoomConfigSelection, state: HarnessState): boolean {\n return (\n target.compositionFingerprint !== undefined &&\n target.compositionFingerprint === state.compositionFingerprint &&\n sameSelection(target, state)\n );\n}\n\nfunction pendingFromTransition(transition: DoomConfigTransitionEntry): DoomConfigPendingSelection | undefined {\n if (transition.phase !== 'pending') return undefined;\n return { ...transition, phase: 'pending' };\n}\n\nfunction pendingFromLegacySelection(\n selection: DoomConfigSelection,\n bootstrap: HarnessState,\n): DoomConfigPendingSelection | undefined {\n if (sameSelection(selection, bootstrap)) return undefined;\n const active: DoomConfigSelection = {\n version: 1,\n majorMode: bootstrap.majorMode,\n domains: [...bootstrap.domains],\n profile: bootstrap.profile,\n compositionFingerprint: bootstrap.compositionFingerprint,\n };\n return {\n version: 1,\n operationId: 'legacy-config-selection',\n active,\n target: selection,\n strategy: 'process-relaunch',\n phase: 'pending',\n };\n}\n\nfunction deepFreeze<TValue>(value: TValue): DeepReadonly<TValue> {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {\n return value as DeepReadonly<TValue>;\n }\n for (const child of Object.values(value)) deepFreeze(child);\n return Object.freeze(value) as DeepReadonly<TValue>;\n}\n\nexport function readDoomConfigSelection(\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n): DoomConfigSelection | undefined {\n return branchSelection(ctx.sessionManager.getBranch());\n}\n\nfunction resolveContextState(ctx: Pick<ExtensionContext, 'sessionManager'>): {\n harness: HarnessState;\n pendingSelection: DoomConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n return resolveBranchState(ctx.sessionManager.getBranch(), bootstrap);\n}\n\nfunction resolveBranchState(\n entries: readonly { type: string; customType?: string; data?: unknown }[],\n bootstrap: HarnessState,\n): {\n harness: HarnessState;\n pendingSelection: DoomConfigPendingSelection | undefined;\n requiresRelaunch: boolean;\n root: string | undefined;\n} {\n const selection = branchSelection(entries);\n const transition = branchTransition(entries);\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n const pendingSelection = transition\n ? transitionPending\n : selection\n ? pendingFromLegacySelection(selection, bootstrap)\n : undefined;\n return {\n harness: bootstrap,\n pendingSelection,\n requiresRelaunch:\n pendingSelection !== undefined &&\n (transitionPending === undefined || !isActiveTransitionTarget(pendingSelection.target, bootstrap)),\n root: bootstrap.root,\n };\n}\n\nexport function createDoomConfigContext(ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>): DoomConfigContext {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n return deepFreeze({ settings: loadDoomConfig(root ?? ctx.cwd), harness, pendingSelection, requiresRelaunch });\n}\n\nexport async function createDoomConfigContextAsync(\n ctx: Pick<ExtensionContext, 'cwd' | 'sessionManager'>,\n): Promise<DoomConfigContext> {\n const { harness, pendingSelection, requiresRelaunch, root } = resolveContextState(ctx);\n const settings = await loadDoomConfigAsync(root ?? ctx.cwd);\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\n/** Initializes from this native session's branch, awaiting durable transition acknowledgement. */\nexport async function createNativeDoomConfigContext(\n execution: DoomHeadlessExecutionContext,\n): Promise<DoomConfigContext> {\n const bootstrap = getSessionHarnessState(execution.sessionId);\n const entries = await execution.session.entries({ type: 'custom' });\n const branch = entries.map((entry) => ({\n type: String(entry.type),\n customType: typeof entry.customType === 'string' ? entry.customType : undefined,\n data: entry.data,\n }));\n const transition = branchTransition(branch);\n if (transition?.phase === 'pending' && isActiveTransitionTarget(transition.target, bootstrap)) {\n const data = { ...transition, phase: 'applied' as const };\n await execution.session.appendCustomEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, data);\n branch.push({ type: 'custom', customType: DOOM_CONFIG_TRANSITION_ENTRY_TYPE, data });\n }\n const { harness, pendingSelection, requiresRelaunch, root } = resolveBranchState(branch, bootstrap);\n const settings = await loadDoomConfigAsync(root ?? execution.cwd, undefined, execution.environment);\n return deepFreeze({ settings, harness, pendingSelection, requiresRelaunch });\n}\n\nexport function appendDoomConfigSelection(pi: Pick<ExtensionAPI, 'appendEntry'>, selection: DoomConfigSelection): void {\n pi.appendEntry(DOOM_CONFIG_ENTRY_TYPE, selection);\n}\n\n/** Journals the live selection, defaulting to whatever the harness store holds. */\nexport function persistHarnessSelection(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n state: {\n readonly majorMode: string;\n readonly domains: readonly string[];\n readonly profile?: string;\n readonly compositionFingerprint?: string;\n } = getHarnessState(),\n): void {\n appendDoomConfigSelection(pi, {\n version: 1,\n majorMode: state.majorMode,\n domains: state.domains,\n profile: state.profile,\n compositionFingerprint: state.compositionFingerprint,\n });\n}\n\nexport function appendDoomConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: DoomConfigTransitionRecord,\n): void {\n pi.appendEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, transition);\n}\n\nexport function supersedeDoomConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n transition: DoomConfigPendingSelection,\n): void {\n pi.appendEntry(DOOM_CONFIG_TRANSITION_ENTRY_TYPE, { ...transition, phase: 'superseded' });\n}\n\n/** Acknowledges the latest pending transition from a fresh session that owns its exact target composition. */\nexport function acknowledgeDoomConfigTransition(\n pi: Pick<ExtensionAPI, 'appendEntry'>,\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n harness: HarnessState,\n): boolean {\n const transition = branchTransition(ctx.sessionManager.getBranch());\n if (!transition || transition.phase !== 'pending' || !isActiveTransitionTarget(transition.target, harness)) {\n return false;\n }\n appendDoomConfigTransition(pi, { ...transition, phase: 'applied' });\n return true;\n}\n\nexport function readDoomConfigPendingSelection(\n ctx: Pick<ExtensionContext, 'sessionManager'>,\n): DoomConfigPendingSelection | undefined {\n const bootstrap = getSessionHarnessState(ctx.sessionManager.getSessionId());\n const transition = branchTransition(ctx.sessionManager.getBranch());\n const transitionPending = transition ? pendingFromTransition(transition) : undefined;\n if (transition) return transitionPending;\n const selection = branchSelection(ctx.sessionManager.getBranch());\n return selection ? pendingFromLegacySelection(selection, bootstrap) : undefined;\n}\n\nexport function provideDoomConfigContext(\n ctx: Context,\n context: DoomConfigContext,\n generation = `doom-config:${crypto.randomUUID()}`,\n): IDoomConfigService {\n return new DoomConfigService(ctx, deepFreeze(context) as DoomConfigContext, loadDoomConfig, generation);\n}\n\n/** Returns the binding identity used to fence in-flight transitions. */\nexport function readDoomConfigContextGeneration(ctx: Context): string | undefined {\n return readDoomConfigService(ctx)?.generation;\n}\n\n/** Precomputes an immutable context before a transaction reaches publication. */\nexport function freezeDoomConfigContext(context: DoomConfigContext): DoomConfigContext {\n return deepFreeze(context);\n}\n\n/** Replaces a live binding with a deeply frozen context after publication. */\nexport function replaceDoomConfigContext(ctx: Context, context: DoomConfigContext): DoomConfigContext {\n const next = deepFreeze(context);\n return requireDoomConfigService(ctx).replaceSnapshot(next as DoomConfigContext);\n}\n\nexport function readDoomConfigService(ctx: Context): IDoomConfigService | undefined {\n return ctx.get(DOOM_CONFIG_SERVICE) as IDoomConfigService | undefined;\n}\n\nexport function requireDoomConfigService(ctx: Context): IDoomConfigService {\n const service = readDoomConfigService(ctx);\n if (!service) throw new Error('Doom config service is unavailable. Load @agimon-ai/po-config/extensions/server.');\n return service;\n}\n\nexport function requireDoomConfigContext(ctx: Context): DoomConfigContext {\n return requireDoomConfigService(ctx).getSnapshot();\n}\n"],"mappings":";;;;;AAWA,SAASA,aAAmB,OAAqC;CAC/D,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,SAAS,KAAK,GACtE,OAAO;CAET,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG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AClE,OAAO;AACT;AAEA,SAAgB,+BACd,KACwC;CACxC,MAAM,YAAY,uBAAuB,IAAI,eAAe,aAAa,CAAC;CAC1E,MAAM,aAAa,iBAAiB,IAAI,eAAe,UAAU,CAAC;CAClE,MAAM,oBAAoB,aAAa,sBAAsB,UAAU,IAAI,KAAA;CAC3E,IAAI,YAAY,OAAO;CACvB,MAAM,YAAY,gBAAgB,IAAI,eAAe,UAAU,CAAC;CAChE,OAAO,YAAY,2BAA2B,WAAW,SAAS,IAAI,KAAA;AACxE;AAEA,SAAgB,yBACd,KACA,SACA,aAAa,eAAe,OAAO,WAAW,KAC1B;CACpB,OAAO,IAAI,kBAAkB,KAAK,WAAW,OAAO,GAAwB,gBAAgB,UAAU;AACxG;;AAGA,SAAgB,gCAAgC,KAAkC;CAChF,OAAO,sBAAsB,GAAG,CAAC,EAAE;AACrC;;AAGA,SAAgB,wBAAwB,SAA+C;CACrF,OAAO,WAAW,OAAO;AAC3B;;AAGA,SAAgB,yBAAyB,KAAc,SAA+C;CACpG,MAAM,OAAO,WAAW,OAAO;CAC/B,OAAO,yBAAyB,GAAG,CAAC,CAAC,gBAAgB,IAAyB;AAChF;AAEA,SAAgB,sBAAsB,KAA8C;CAClF,OAAO,IAAI,IAAI,mBAAmB;AACpC;AAEA,SAAgB,yBAAyB,KAAkC;CACzE,MAAM,UAAU,sBAAsB,GAAG;CACzC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,kFAAkF;CAChH,OAAO;AACT;AAEA,SAAgB,yBAAyB,KAAiC;CACxE,OAAO,yBAAyB,GAAG,CAAC,CAAC,YAAY;AACnD"}
|
package/dist/types.cjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./config-zZz80Mh5.cjs");
|
|
3
|
+
let _agimon_ai_po_core_config = require("@agimon-ai/po-core/config");
|
|
4
|
+
Object.defineProperty(exports, "DOOM_CONFIG_SERVICE", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function() {
|
|
7
|
+
return _agimon_ai_po_core_config.DOOM_CONFIG_SERVICE;
|
|
8
|
+
}
|
|
9
|
+
});
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as PluginHookSource, B as VoiceTtsConfig, C as IDoomConfigService, D as PlanningAgentConfig, E as PackageAttribution, F as VoiceAutoCaptureConfig, I as VoiceConfig, L as VoiceEngine, M as ResolvedVoiceAutoCaptureConfig, N as ResolvedVoiceConfig, O as PlanningModeConfig, P as VoiceAdapterConfig, R as VoiceMode, S as IDoomConfigLoader, T as LenientParseResult, V as VoiceTtsEngine, _ as DoomConfigTransitionStrategy, a as ConfigDiagnostic, b as EditorConfig, c as DeepReadonly, d as DoomConfigLayer, f as DoomConfigLayers, g as DoomConfigTransitionRecord, h as DoomConfigTransitionPhase, i as AutocompactTokenConfig, j as ProjectTrust, k as PlanningThinkingLevel, l as DoomConfig, m as DoomConfigSelection, n as AutocompactOverrideConfig, o as ConfigValueOrigin, p as DoomConfigPendingSelection, r as AutocompactThresholdConfig, s as DOOM_CONFIG_SERVICE, t as AutocompactModeConfig, u as DoomConfigContext, v as DoomHarnessContext, w as LenientParseOptions, x as HarnessState, y as DoomSelectionConfig, z as VoiceModelConfig } from "./config-Cm3EV1jp.mjs";
|
|
2
|
+
export { type AutocompactModeConfig, type AutocompactOverrideConfig, type AutocompactThresholdConfig, type AutocompactTokenConfig, type ConfigDiagnostic, type ConfigValueOrigin, DOOM_CONFIG_SERVICE, type DeepReadonly, type DoomConfig, type DoomConfigContext, type DoomConfigLayer, type DoomConfigLayers, type DoomConfigPendingSelection, type DoomConfigSelection, type DoomConfigTransitionPhase, type DoomConfigTransitionRecord, type DoomConfigTransitionStrategy, type DoomHarnessContext, type DoomSelectionConfig, type EditorConfig, type HarnessState, type IDoomConfigLoader, type IDoomConfigService, type LenientParseOptions, type LenientParseResult, type PackageAttribution, type PlanningAgentConfig, type PlanningModeConfig, type PlanningThinkingLevel, type PluginHookSource, type ProjectTrust, type ResolvedVoiceAutoCaptureConfig, type ResolvedVoiceConfig, type VoiceAdapterConfig, type VoiceAutoCaptureConfig, type VoiceConfig, type VoiceEngine, type VoiceMode, type VoiceModelConfig, type VoiceTtsConfig, type VoiceTtsEngine };
|
package/dist/types.mjs
ADDED
package/llms.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Doom Pi Config
|
|
2
|
+
|
|
3
|
+
Package-owned guidance for Po runtime settings, source precedence, and typed session context.
|
|
4
|
+
|
|
5
|
+
## How to author
|
|
6
|
+
|
|
7
|
+
- [Author Po runtime configuration](./src/prompts/po-author-config/SKILL.md): Change `config.yaml` and consume session configuration safely.
|
|
8
|
+
- [Configuration authoring contract](./src/prompts/po-author-config/references/config-contract.md): Runtime schema, source merge rules, typed context, transition state, and verification.
|
|
9
|
+
|
|
10
|
+
## Package reference
|
|
11
|
+
|
|
12
|
+
- [Package README](./README.md): Runtime configuration, immutable context, transitions, and public APIs.
|
package/package.json
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agimon-ai/po-config",
|
|
3
|
+
"version": "0.0.0-alpha.0",
|
|
4
|
+
"description": "Typed configuration loading, validation, and host services for composing Po sessions.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent-configuration",
|
|
7
|
+
"ai",
|
|
8
|
+
"coding-agent",
|
|
9
|
+
"configuration",
|
|
10
|
+
"dependency-injection",
|
|
11
|
+
"developer-tools",
|
|
12
|
+
"pi-coding-agent",
|
|
13
|
+
"pi-package",
|
|
14
|
+
"po",
|
|
15
|
+
"typescript",
|
|
16
|
+
"yaml"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://agimon.ai",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/AgiFlow/po/issues"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"author": "Vuong Ngo",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/AgiFlow/po.git",
|
|
27
|
+
"directory": "packages/foundations/po-config"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"llms.txt",
|
|
32
|
+
"README.md",
|
|
33
|
+
"src/prompts"
|
|
34
|
+
],
|
|
35
|
+
"type": "module",
|
|
36
|
+
"main": "./dist/index.cjs",
|
|
37
|
+
"types": "./dist/index.d.mts",
|
|
38
|
+
"jsnext:main": "./dist/index.mjs",
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./dist/index.d.mts",
|
|
42
|
+
"import": "./dist/index.mjs",
|
|
43
|
+
"require": "./dist/index.cjs"
|
|
44
|
+
},
|
|
45
|
+
"./agentPluginMcp": {
|
|
46
|
+
"types": "./dist/agentPluginMcp.d.mts",
|
|
47
|
+
"import": "./dist/agentPluginMcp.mjs",
|
|
48
|
+
"require": "./dist/agentPluginMcp.cjs"
|
|
49
|
+
},
|
|
50
|
+
"./apiContracts": {
|
|
51
|
+
"types": "./dist/apiContracts.d.mts",
|
|
52
|
+
"import": "./dist/apiContracts.mjs",
|
|
53
|
+
"require": "./dist/apiContracts.cjs"
|
|
54
|
+
},
|
|
55
|
+
"./atomicJson": {
|
|
56
|
+
"types": "./dist/atomicJson.d.mts",
|
|
57
|
+
"import": "./dist/atomicJson.mjs",
|
|
58
|
+
"require": "./dist/atomicJson.cjs"
|
|
59
|
+
},
|
|
60
|
+
"./config": {
|
|
61
|
+
"types": "./dist/config.d.mts",
|
|
62
|
+
"import": "./dist/config.mjs",
|
|
63
|
+
"require": "./dist/config.cjs"
|
|
64
|
+
},
|
|
65
|
+
"./configSchema": {
|
|
66
|
+
"types": "./dist/configSchema.d.mts",
|
|
67
|
+
"import": "./dist/configSchema.mjs",
|
|
68
|
+
"require": "./dist/configSchema.cjs"
|
|
69
|
+
},
|
|
70
|
+
"./configWriter": {
|
|
71
|
+
"types": "./dist/configWriter.d.mts",
|
|
72
|
+
"import": "./dist/configWriter.mjs",
|
|
73
|
+
"require": "./dist/configWriter.cjs"
|
|
74
|
+
},
|
|
75
|
+
"./domains": {
|
|
76
|
+
"types": "./dist/domains.d.mts",
|
|
77
|
+
"import": "./dist/domains.mjs",
|
|
78
|
+
"require": "./dist/domains.cjs"
|
|
79
|
+
},
|
|
80
|
+
"./extensions/server": {
|
|
81
|
+
"types": "./dist/extensions/server.d.mts",
|
|
82
|
+
"import": "./dist/extensions/server.mjs",
|
|
83
|
+
"require": "./dist/extensions/server.cjs"
|
|
84
|
+
},
|
|
85
|
+
"./harnessState": {
|
|
86
|
+
"types": "./dist/harnessState.d.mts",
|
|
87
|
+
"import": "./dist/harnessState.mjs",
|
|
88
|
+
"require": "./dist/harnessState.cjs"
|
|
89
|
+
},
|
|
90
|
+
"./harnessStore": {
|
|
91
|
+
"types": "./dist/harnessStore.d.mts",
|
|
92
|
+
"import": "./dist/harnessStore.mjs",
|
|
93
|
+
"require": "./dist/harnessStore.cjs"
|
|
94
|
+
},
|
|
95
|
+
"./init": {
|
|
96
|
+
"types": "./dist/init.d.mts",
|
|
97
|
+
"import": "./dist/init.mjs",
|
|
98
|
+
"require": "./dist/init.cjs"
|
|
99
|
+
},
|
|
100
|
+
"./layeredConfig": {
|
|
101
|
+
"types": "./dist/layeredConfig.d.mts",
|
|
102
|
+
"import": "./dist/layeredConfig.mjs",
|
|
103
|
+
"require": "./dist/layeredConfig.cjs"
|
|
104
|
+
},
|
|
105
|
+
"./majorModes": {
|
|
106
|
+
"types": "./dist/majorModes.d.mts",
|
|
107
|
+
"import": "./dist/majorModes.mjs",
|
|
108
|
+
"require": "./dist/majorModes.cjs"
|
|
109
|
+
},
|
|
110
|
+
"./piConfig": {
|
|
111
|
+
"types": "./dist/piConfig.d.mts",
|
|
112
|
+
"import": "./dist/piConfig.mjs",
|
|
113
|
+
"require": "./dist/piConfig.cjs"
|
|
114
|
+
},
|
|
115
|
+
"./piContext": {
|
|
116
|
+
"types": "./dist/piContext.d.mts",
|
|
117
|
+
"import": "./dist/piContext.mjs",
|
|
118
|
+
"require": "./dist/piContext.cjs"
|
|
119
|
+
},
|
|
120
|
+
"./profiles": {
|
|
121
|
+
"types": "./dist/profiles.d.mts",
|
|
122
|
+
"import": "./dist/profiles.mjs",
|
|
123
|
+
"require": "./dist/profiles.cjs"
|
|
124
|
+
},
|
|
125
|
+
"./selectionSwitch": {
|
|
126
|
+
"types": "./dist/selectionSwitch.d.mts",
|
|
127
|
+
"import": "./dist/selectionSwitch.mjs",
|
|
128
|
+
"require": "./dist/selectionSwitch.cjs"
|
|
129
|
+
},
|
|
130
|
+
"./types": {
|
|
131
|
+
"types": "./dist/types.d.mts",
|
|
132
|
+
"import": "./dist/types.mjs",
|
|
133
|
+
"require": "./dist/types.cjs"
|
|
134
|
+
},
|
|
135
|
+
"./package.json": "./package.json"
|
|
136
|
+
},
|
|
137
|
+
"publishConfig": {
|
|
138
|
+
"access": "public",
|
|
139
|
+
"registry": "https://registry.npmjs.org/"
|
|
140
|
+
},
|
|
141
|
+
"dependencies": {
|
|
142
|
+
"@agimon-ai/po-core": "0.0.0-alpha.0",
|
|
143
|
+
"@agimon-ai/po-telemetry": "0.0.0-alpha.0",
|
|
144
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.0",
|
|
145
|
+
"@deepseek-ai/cordis": "4.0.4",
|
|
146
|
+
"typebox": "1.3.34",
|
|
147
|
+
"yaml": "2.9.1"
|
|
148
|
+
},
|
|
149
|
+
"devDependencies": {
|
|
150
|
+
"@agimon-ai/po-build": "0.0.0-alpha.0",
|
|
151
|
+
"@earendil-works/pi-coding-agent": "1.0.2",
|
|
152
|
+
"@modelcontextprotocol/ext-apps": "2.0.3",
|
|
153
|
+
"@modelcontextprotocol/server": "2.2.0",
|
|
154
|
+
"@playwright/test": "1.63.0",
|
|
155
|
+
"@types/node": "26.6.4",
|
|
156
|
+
"@types/react": "19.3.0",
|
|
157
|
+
"@vitest/coverage-v8": "5.0.3",
|
|
158
|
+
"react": "19.3.0",
|
|
159
|
+
"tsdown": "0.23.0",
|
|
160
|
+
"typescript": "7.0.2",
|
|
161
|
+
"vitest": "5.0.3"
|
|
162
|
+
},
|
|
163
|
+
"peerDependencies": {
|
|
164
|
+
"@earendil-works/pi-coding-agent": "1.0.2"
|
|
165
|
+
},
|
|
166
|
+
"engines": {
|
|
167
|
+
"node": ">=24"
|
|
168
|
+
},
|
|
169
|
+
"poMcp": {
|
|
170
|
+
"entry": "./generated/mcp.ts",
|
|
171
|
+
"dist": "./dist/extensions/mcp.mjs",
|
|
172
|
+
"scopes": [
|
|
173
|
+
"session"
|
|
174
|
+
],
|
|
175
|
+
"ui": {
|
|
176
|
+
"entry": "./generated/mcp-ui.ts",
|
|
177
|
+
"dist": "./dist/extensions/mcp-ui.mjs",
|
|
178
|
+
"widgets": [
|
|
179
|
+
"@agimon-ai/po-config/load_context",
|
|
180
|
+
"@agimon-ai/po-config/rename_thread",
|
|
181
|
+
"@agimon-ai/po-config/show_session"
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"poServer": {
|
|
186
|
+
"entry": "./generated/server.ts",
|
|
187
|
+
"dist": "./dist/extensions/server.mjs",
|
|
188
|
+
"scopes": [
|
|
189
|
+
"global",
|
|
190
|
+
"workspace",
|
|
191
|
+
"session"
|
|
192
|
+
],
|
|
193
|
+
"contracts": {
|
|
194
|
+
"entry": "./src/exports/apiContracts.ts",
|
|
195
|
+
"dist": "./dist/apiContracts.mjs"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"scripts": {
|
|
199
|
+
"build": "tsdown && pnpm build:mcp",
|
|
200
|
+
"build:mcp": "tsdown --config tsdown.mcp.config.ts",
|
|
201
|
+
"test": "vitest --run",
|
|
202
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.mcp.json",
|
|
203
|
+
"lint": "oxlint . && oxfmt . --check",
|
|
204
|
+
"fixcode": "oxlint . --fix && oxfmt ."
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: po-author-config
|
|
3
|
+
description: Configure Po runtime settings, source precedence, and typed session configuration. Use for config.yaml, the doom/config Cordis service, immutable context snapshots, or shared selection transition state. Do not use for defining modes.yaml, domains.yaml, or profiles.yaml.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Author Po runtime configuration
|
|
7
|
+
|
|
8
|
+
Configure runtime policy in `config.yaml` and consume one immutable session snapshot through Cordis.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. Read both `~/.po/config.yaml` and the repository's `.po/config.yaml` before changing effective settings.
|
|
13
|
+
2. Check the `DoomConfig` types and parser before adding or editing a field. Unknown keys and invalid values fail early
|
|
14
|
+
everywhere a session reads config. `po sync` is the one exception: it reports an unknown key and carries on, so a
|
|
15
|
+
config written for another version cannot break a build. Invalid values for known keys still fail there too. Run
|
|
16
|
+
`po doctor` for the strict check.
|
|
17
|
+
3. Preserve field-specific source policy. Repository settings do not uniformly replace every personal setting.
|
|
18
|
+
4. Consume live state only inside an owning `cordis.inject([DOOM_CONFIG_SERVICE], ...)` callback, using `requireDoomConfigContext(cordis)`.
|
|
19
|
+
5. Treat `settings`, `harness`, `pendingSelection`, and nested values as immutable. Do not mutate or cache a snapshot across session replacement.
|
|
20
|
+
6. Route live major-mode, domain, and profile changes through the transition coordinator. Keep append-only selection and transition entries consistent with the active harness.
|
|
21
|
+
7. Keep `process.env` as launcher transport and the controlled live-switch boundary, not as an alternative configuration registry.
|
|
22
|
+
8. Verify parsing and merge behavior with Doom Config tests, then exercise `po --explain` and a real session when transition behavior changes.
|
|
23
|
+
|
|
24
|
+
Use the package-owned Major Mode, Domain, or Profile Help skill when the task is to define an axis in `modes.yaml`, `domains.yaml`, or `profiles.yaml`.
|
|
25
|
+
|
|
26
|
+
Read [references/config-contract.md](references/config-contract.md) for the runtime schema, source merge rules, immutable context, and transition contract.
|