@agimon-ai/doompi-model-guidance 0.0.1-alpha.78 → 0.0.1-alpha.80
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/dist/{src/schemas/apiContracts.cjs → apiContracts.cjs} +5 -1
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/{src/schemas/apiContracts.d.mts.map → apiContracts.d.mts.map} +1 -1
- package/dist/{src/schemas/apiContracts.mjs → apiContracts.mjs} +1 -1
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/extensions/mcp.cjs +5 -5
- package/dist/extensions/mcp.cjs.map +1 -1
- package/dist/extensions/mcp.d.mts +1 -1
- package/dist/extensions/mcp.d.mts.map +1 -1
- package/dist/extensions/mcp.mjs +2 -2
- package/dist/extensions/mcp.mjs.map +1 -1
- package/dist/extensions/pi.cjs +19 -3
- package/dist/extensions/pi.cjs.map +1 -1
- package/dist/extensions/pi.d.mts +1 -1
- package/dist/extensions/pi.d.mts.map +1 -1
- package/dist/extensions/pi.mjs +18 -2
- package/dist/extensions/pi.mjs.map +1 -1
- package/dist/extensions/server.cjs +40 -7
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +37 -4
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/index.cjs +7 -9
- package/dist/index.d.mts +66 -5
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1 -3
- package/dist/modelGuidanceStore-BPKgawjz.mjs +76 -0
- package/dist/modelGuidanceStore-BPKgawjz.mjs.map +1 -0
- package/dist/modelGuidanceStore-DEs_jtoI.cjs +111 -0
- package/dist/modelGuidanceStore-DEs_jtoI.cjs.map +1 -0
- package/package.json +15 -15
- package/dist/api-contracts.cjs +0 -7
- package/dist/api-contracts.d.cts +0 -2
- package/dist/api-contracts.d.mts +0 -2
- package/dist/api-contracts.mjs +0 -2
- package/dist/extensions/mcp.d.cts +0 -5
- package/dist/extensions/mcp.d.cts.map +0 -1
- package/dist/extensions/pi.d.cts +0 -5
- package/dist/extensions/pi.d.cts.map +0 -1
- package/dist/extensions/server.d.cts +0 -5
- package/dist/extensions/server.d.cts.map +0 -1
- package/dist/index.d.cts +0 -5
- package/dist/src/constants/modelGuidance.cjs +0 -8
- package/dist/src/constants/modelGuidance.cjs.map +0 -1
- package/dist/src/constants/modelGuidance.d.cts +0 -8
- package/dist/src/constants/modelGuidance.d.cts.map +0 -1
- package/dist/src/constants/modelGuidance.d.mts +0 -8
- package/dist/src/constants/modelGuidance.d.mts.map +0 -1
- package/dist/src/constants/modelGuidance.mjs +0 -7
- package/dist/src/constants/modelGuidance.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.cli.cjs +0 -18
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.cli.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.cli.mjs +0 -17
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.cli.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.server.cjs +0 -18
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.server.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.server.mjs +0 -17
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.server.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli.cjs +0 -7
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli.mjs +0 -8
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.cjs +0 -7
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.mjs +0 -8
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiModelGuidance.server.cjs +0 -18
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiModelGuidance.server.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiModelGuidance.server.mjs +0 -18
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiModelGuidance.server.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseModelGuidance.server.cjs +0 -11
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseModelGuidance.server.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseModelGuidance.server.mjs +0 -11
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseModelGuidance.server.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiModelGuidance.server.cjs +0 -7
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiModelGuidance.server.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiModelGuidance.server.mjs +0 -8
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiModelGuidance.server.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseModelGuidance.server.cjs +0 -7
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseModelGuidance.server.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseModelGuidance.server.mjs +0 -8
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseModelGuidance.server.mjs.map +0 -1
- package/dist/src/schemas/apiContracts.cjs.map +0 -1
- package/dist/src/schemas/apiContracts.d.cts +0 -53
- package/dist/src/schemas/apiContracts.d.cts.map +0 -1
- package/dist/src/schemas/apiContracts.mjs.map +0 -1
- package/dist/src/services/modelGuidance/index.cjs +0 -49
- package/dist/src/services/modelGuidance/index.cjs.map +0 -1
- package/dist/src/services/modelGuidance/index.d.cts +0 -30
- package/dist/src/services/modelGuidance/index.d.cts.map +0 -1
- package/dist/src/services/modelGuidance/index.d.mts +0 -30
- package/dist/src/services/modelGuidance/index.d.mts.map +0 -1
- package/dist/src/services/modelGuidance/index.mjs +0 -46
- package/dist/src/services/modelGuidance/index.mjs.map +0 -1
- package/dist/src/services/modelGuidanceStore/index.cjs +0 -33
- package/dist/src/services/modelGuidanceStore/index.cjs.map +0 -1
- package/dist/src/services/modelGuidanceStore/index.d.cts +0 -18
- package/dist/src/services/modelGuidanceStore/index.d.cts.map +0 -1
- package/dist/src/services/modelGuidanceStore/index.d.mts +0 -18
- package/dist/src/services/modelGuidanceStore/index.d.mts.map +0 -1
- package/dist/src/services/modelGuidanceStore/index.mjs +0 -32
- package/dist/src/services/modelGuidanceStore/index.mjs.map +0 -1
- package/dist/src/types/modelGuidance.d.cts +0 -16
- package/dist/src/types/modelGuidance.d.cts.map +0 -1
- package/dist/src/types/modelGuidance.d.mts +0 -16
- package/dist/src/types/modelGuidance.d.mts.map +0 -1
- /package/dist/{src/schemas/apiContracts.d.mts → apiContracts.d.mts} +0 -0
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
1
5
|
//#region src/schemas/apiContracts.ts
|
|
2
6
|
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
3
|
-
const apiContracts = (0, require("@agimon-ai/doompi-core/
|
|
7
|
+
const apiContracts = (0, require("@agimon-ai/doompi-core/apiContracts").defineApiContract)({
|
|
4
8
|
version: 1,
|
|
5
9
|
http: [],
|
|
6
10
|
sockets: [],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/doompi-core/apiContracts';\n\n/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,gDAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAGa"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineApiContract } from "@agimon-ai/doompi-core/
|
|
1
|
+
import { defineApiContract } from "@agimon-ai/doompi-core/apiContracts";
|
|
2
2
|
//#region src/schemas/apiContracts.ts
|
|
3
3
|
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
4
4
|
const apiContracts = defineApiContract({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/doompi-core/apiContracts';\n\n/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
package/dist/extensions/mcp.cjs
CHANGED
|
@@ -2,18 +2,18 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
let
|
|
6
|
-
let
|
|
5
|
+
let _agimon_ai_doompi_core_mcpFacet = require("@agimon-ai/doompi-core/mcpFacet");
|
|
6
|
+
let _agimon_ai_doompi_core_serverFacet = require("@agimon-ai/doompi-core/serverFacet");
|
|
7
7
|
//#region src/extensions/workspaces/sessions/(backend)/skill/doompi-use-model-guidance.mcp.ts
|
|
8
|
-
var doompi_use_model_guidance_mcp_default = (0,
|
|
8
|
+
var doompi_use_model_guidance_mcp_default = (0, _agimon_ai_doompi_core_mcpFacet.defineMcpSkill)({
|
|
9
9
|
name: "doompi-use-model-guidance",
|
|
10
10
|
description: "Use @agimon-ai/doompi-model-guidance: per-model system prompt guidance, layered across global and repository scope",
|
|
11
|
-
read: () => (0,
|
|
11
|
+
read: () => (0, _agimon_ai_doompi_core_serverFacet.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/doompi-use-model-guidance/SKILL.md")
|
|
12
12
|
});
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region generated/mcp.ts
|
|
15
15
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
16
|
-
const mcp = (0,
|
|
16
|
+
const mcp = (0, _agimon_ai_doompi_core_mcpFacet.defineMcpPlugin)({
|
|
17
17
|
name: "@agimon-ai/doompi-model-guidance",
|
|
18
18
|
session: (context) => ({ get skills() {
|
|
19
19
|
return [at(doompi_use_model_guidance_mcp_default, context)];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.cjs","names":["defineMcpSkill","readPackageResource","defineMcpPlugin","skillDoompiUseModelGuidance"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/doompi-use-model-guidance.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/doompi-core/
|
|
1
|
+
{"version":3,"file":"mcp.cjs","names":["defineMcpSkill","readPackageResource","defineMcpPlugin","skillDoompiUseModelGuidance"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/doompi-use-model-guidance.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/doompi-core/mcpFacet';\nimport { readPackageResource } from '@agimon-ai/doompi-core/serverFacet';\n\nexport default defineMcpSkill({\n name: 'doompi-use-model-guidance',\n description:\n 'Use @agimon-ai/doompi-model-guidance: per-model system prompt guidance, layered across global and repository scope',\n read: () => readPackageResource(import.meta.url, 'src/prompts/doompi-use-model-guidance/SKILL.md'),\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineMcpPlugin, type DoomMcpSessionPlugin } from '@agimon-ai/doompi-core/mcpFacet';\n\nimport skillDoompiUseModelGuidance from '../src/extensions/workspaces/sessions/(backend)/skill/doompi-use-model-guidance.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/doompi-model-guidance',\n session: (context) => ({\n get skills(): DoomMcpSessionPlugin['skills'] { return [at(skillDoompiUseModelGuidance, context)]; },\n }) satisfies DoomMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;;;;AAGA,IAAA,yCAAA,GAAeA,gCAAAA,eAAAA,CAAe;CAC5B,MAAM;CACN,aACE;CACF,aAAA,GAAYC,mCAAAA,oBAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,MAAqC,gDAAgD;AACnG,CAAC;;;ACFD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,OAAA,GAAMC,gCAAAA,gBAAAA,CAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,SAAyC;EAAE,OAAO,CAAC,GAAGC,uCAA6B,OAAO,CAAC;CAAG,EACpG;AACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region generated/mcp.d.ts
|
|
2
|
-
export declare const mcp: import("@agimon-ai/doompi-core/
|
|
2
|
+
export declare const mcp: import("@agimon-ai/doompi-core/mcpFacet").DoomMcpPluginDefinition;
|
|
3
3
|
//#endregion
|
|
4
4
|
export { mcp as default };
|
|
5
5
|
//# sourceMappingURL=mcp.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../../generated/mcp.ts"],"mappings":";qBASa
|
|
1
|
+
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../../generated/mcp.ts"],"mappings":";qBASa,+CAAG"}
|
package/dist/extensions/mcp.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineMcpPlugin, defineMcpSkill } from "@agimon-ai/doompi-core/
|
|
2
|
-
import { readPackageResource } from "@agimon-ai/doompi-core/
|
|
1
|
+
import { defineMcpPlugin, defineMcpSkill } from "@agimon-ai/doompi-core/mcpFacet";
|
|
2
|
+
import { readPackageResource } from "@agimon-ai/doompi-core/serverFacet";
|
|
3
3
|
//#region src/extensions/workspaces/sessions/(backend)/skill/doompi-use-model-guidance.mcp.ts
|
|
4
4
|
var doompi_use_model_guidance_mcp_default = defineMcpSkill({
|
|
5
5
|
name: "doompi-use-model-guidance",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.mjs","names":["skillDoompiUseModelGuidance"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/doompi-use-model-guidance.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/doompi-core/
|
|
1
|
+
{"version":3,"file":"mcp.mjs","names":["skillDoompiUseModelGuidance"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/doompi-use-model-guidance.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/doompi-core/mcpFacet';\nimport { readPackageResource } from '@agimon-ai/doompi-core/serverFacet';\n\nexport default defineMcpSkill({\n name: 'doompi-use-model-guidance',\n description:\n 'Use @agimon-ai/doompi-model-guidance: per-model system prompt guidance, layered across global and repository scope',\n read: () => readPackageResource(import.meta.url, 'src/prompts/doompi-use-model-guidance/SKILL.md'),\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineMcpPlugin, type DoomMcpSessionPlugin } from '@agimon-ai/doompi-core/mcpFacet';\n\nimport skillDoompiUseModelGuidance from '../src/extensions/workspaces/sessions/(backend)/skill/doompi-use-model-guidance.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/doompi-model-guidance',\n session: (context) => ({\n get skills(): DoomMcpSessionPlugin['skills'] { return [at(skillDoompiUseModelGuidance, context)]; },\n }) satisfies DoomMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;AAGA,IAAA,wCAAe,eAAe;CAC5B,MAAM;CACN,aACE;CACF,YAAY,oBAAoB,YAAY,KAAK,gDAAgD;AACnG,CAAC;;;ACFD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,MAAM,gBAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,SAAyC;EAAE,OAAO,CAAC,GAAGA,uCAA6B,OAAO,CAAC;CAAG,EACpG;AACF,CAAC"}
|
package/dist/extensions/pi.cjs
CHANGED
|
@@ -2,11 +2,27 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
let
|
|
5
|
+
const require_modelGuidanceStore = require("../modelGuidanceStore-DEs_jtoI.cjs");
|
|
6
|
+
let _agimon_ai_doompi_core_piExtension = require("@agimon-ai/doompi-core/piExtension");
|
|
7
|
+
let _agimon_ai_doompi_core_extensionFile = require("@agimon-ai/doompi-core/extensionFile");
|
|
8
|
+
let _agimon_ai_doompi_config = require("@agimon-ai/doompi-config");
|
|
9
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.cli.ts
|
|
10
|
+
/** Read each turn so configuration edits take effect without restarting the session. */
|
|
11
|
+
const modelGuidanceEvents = { before_agent_start(event, context) {
|
|
12
|
+
const modelId = context.model?.id;
|
|
13
|
+
if (!modelId) return void 0;
|
|
14
|
+
const guidance = require_modelGuidanceStore.guidanceForModel(require_modelGuidanceStore.loadModelGuidance((0, _agimon_ai_doompi_config.getHarnessState)().root), modelId);
|
|
15
|
+
const systemPrompt = require_modelGuidanceStore.applyModelGuidance(event.systemPrompt, guidance);
|
|
16
|
+
return systemPrompt ? { systemPrompt } : void 0;
|
|
17
|
+
} };
|
|
18
|
+
var beforeAgentStart_cli_default$1 = (_context) => (...args) => modelGuidanceEvents.before_agent_start(...args);
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli.ts
|
|
21
|
+
var beforeAgentStart_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineCliHook)(beforeAgentStart_cli_default$1);
|
|
22
|
+
//#endregion
|
|
7
23
|
//#region generated/pi.ts
|
|
8
24
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
9
|
-
const extension = (0,
|
|
25
|
+
const extension = (0, _agimon_ai_doompi_core_piExtension.definePiExtension)("@agimon-ai/doompi-model-guidance", (context) => ({ events: { before_agent_start: at(beforeAgentStart_cli_default, context) } }));
|
|
10
26
|
//#endregion
|
|
11
27
|
exports.default = extension;
|
|
12
28
|
exports.extension = extension;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.cjs","names":["definePiExtension","hookBeforeAgentStart"],"sources":["../../generated/pi.ts"],"sourcesContent":["// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/
|
|
1
|
+
{"version":3,"file":"pi.cjs","names":["guidanceForModel","loadModelGuidance","getHarnessState","applyModelGuidance","defineCliHook","contribution","definePiExtension","hookBeforeAgentStart"],"sources":["../../src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli.ts","../../generated/pi.ts"],"sourcesContent":["import { getHarnessState } from '@agimon-ai/doompi-config';\nimport type { PiEventHandlers, PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport { applyModelGuidance, guidanceForModel } from '../../../../../../services/modelGuidance';\nimport { loadModelGuidance } from '../../../../../../services/modelGuidanceStore';\n\n/** Read each turn so configuration edits take effect without restarting the session. */\nexport const modelGuidanceEvents = {\n before_agent_start(event, context) {\n const modelId = context.model?.id;\n if (!modelId) return undefined;\n const guidance = guidanceForModel(loadModelGuidance(getHarnessState().root), modelId);\n const systemPrompt = applyModelGuidance(event.systemPrompt, guidance);\n return systemPrompt ? { systemPrompt } : undefined;\n },\n} satisfies PiEventHandlers;\n\nexport default (_context: PiPluginContext) =>\n (...args: Parameters<typeof modelGuidanceEvents.before_agent_start>) =>\n modelGuidanceEvents.before_agent_start(...args);\n","import { defineCliHook } from '@agimon-ai/doompi-core/extensionFile';\n\nimport contribution from './_lib/beforeAgentStart.cli';\n\nexport default defineCliHook(contribution);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/piExtension';\n\nimport hookBeforeAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof hookBeforeAgentStart>, undefined>;\ntype Intersect<Union> =\n (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\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 extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-model-guidance', (context) => ({\n events: {\n before_agent_start: at(hookBeforeAgentStart, context) as NonNullable<PiPluginContributions['events']>['before_agent_start'],\n },\n}));\n\nexport default extension;\n"],"mappings":";;;;;;;;;;AAOA,MAAa,sBAAsB,EACjC,mBAAmB,OAAO,SAAS;CACjC,MAAM,UAAU,QAAQ,OAAO;CAC/B,IAAI,CAAC,SAAS,OAAO,KAAA;CACrB,MAAM,WAAWA,2BAAAA,iBAAiBC,2BAAAA,mBAAAA,GAAkBC,yBAAAA,gBAAAA,CAAgB,CAAC,CAAC,IAAI,GAAG,OAAO;CACpF,MAAM,eAAeC,2BAAAA,mBAAmB,MAAM,cAAc,QAAQ;CACpE,OAAO,eAAe,EAAE,aAAa,IAAI,KAAA;AAC3C,EACF;AAEA,IAAA,kCAAgB,cACb,GAAG,SACF,oBAAoB,mBAAmB,GAAG,IAAI;;;ACflD,IAAA,gCAAA,GAAeC,qCAAAA,cAAAA,CAAcC,8BAAY;;;ACQzC,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,aAAA,GAAYC,mCAAAA,kBAAAA,CAAoC,qCAAqC,aAAa,EAC7G,QAAQ,EACN,oBAAoB,GAAGC,8BAAsB,OAAO,EACtD,EACF,EAAE"}
|
package/dist/extensions/pi.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region generated/pi.d.ts
|
|
2
|
-
export declare const extension: import("@agimon-ai/doompi-core/
|
|
2
|
+
export declare const extension: import("@agimon-ai/doompi-core/runtimePiExtension").DefinedPiExtension<undefined>;
|
|
3
3
|
//#endregion
|
|
4
4
|
export { extension as default };
|
|
5
5
|
//# sourceMappingURL=pi.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.mts","names":[],"sources":["../../generated/pi.ts"],"mappings":";qBAea
|
|
1
|
+
{"version":3,"file":"pi.d.mts","names":[],"sources":["../../generated/pi.ts"],"mappings":";qBAea,+DAAS"}
|
package/dist/extensions/pi.mjs
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { definePiExtension } from "@agimon-ai/doompi-core/
|
|
1
|
+
import { i as guidanceForModel, n as loadModelGuidance, r as applyModelGuidance } from "../modelGuidanceStore-BPKgawjz.mjs";
|
|
2
|
+
import { definePiExtension } from "@agimon-ai/doompi-core/piExtension";
|
|
3
|
+
import { defineCliHook } from "@agimon-ai/doompi-core/extensionFile";
|
|
4
|
+
import { getHarnessState } from "@agimon-ai/doompi-config";
|
|
5
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.cli.ts
|
|
6
|
+
/** Read each turn so configuration edits take effect without restarting the session. */
|
|
7
|
+
const modelGuidanceEvents = { before_agent_start(event, context) {
|
|
8
|
+
const modelId = context.model?.id;
|
|
9
|
+
if (!modelId) return void 0;
|
|
10
|
+
const guidance = guidanceForModel(loadModelGuidance(getHarnessState().root), modelId);
|
|
11
|
+
const systemPrompt = applyModelGuidance(event.systemPrompt, guidance);
|
|
12
|
+
return systemPrompt ? { systemPrompt } : void 0;
|
|
13
|
+
} };
|
|
14
|
+
var beforeAgentStart_cli_default$1 = (_context) => (...args) => modelGuidanceEvents.before_agent_start(...args);
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli.ts
|
|
17
|
+
var beforeAgentStart_cli_default = defineCliHook(beforeAgentStart_cli_default$1);
|
|
18
|
+
//#endregion
|
|
3
19
|
//#region generated/pi.ts
|
|
4
20
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
5
21
|
const extension = definePiExtension("@agimon-ai/doompi-model-guidance", (context) => ({ events: { before_agent_start: at(beforeAgentStart_cli_default, context) } }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.mjs","names":["hookBeforeAgentStart"],"sources":["../../generated/pi.ts"],"sourcesContent":["// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/
|
|
1
|
+
{"version":3,"file":"pi.mjs","names":["contribution","hookBeforeAgentStart"],"sources":["../../src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli.ts","../../generated/pi.ts"],"sourcesContent":["import { getHarnessState } from '@agimon-ai/doompi-config';\nimport type { PiEventHandlers, PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport { applyModelGuidance, guidanceForModel } from '../../../../../../services/modelGuidance';\nimport { loadModelGuidance } from '../../../../../../services/modelGuidanceStore';\n\n/** Read each turn so configuration edits take effect without restarting the session. */\nexport const modelGuidanceEvents = {\n before_agent_start(event, context) {\n const modelId = context.model?.id;\n if (!modelId) return undefined;\n const guidance = guidanceForModel(loadModelGuidance(getHarnessState().root), modelId);\n const systemPrompt = applyModelGuidance(event.systemPrompt, guidance);\n return systemPrompt ? { systemPrompt } : undefined;\n },\n} satisfies PiEventHandlers;\n\nexport default (_context: PiPluginContext) =>\n (...args: Parameters<typeof modelGuidanceEvents.before_agent_start>) =>\n modelGuidanceEvents.before_agent_start(...args);\n","import { defineCliHook } from '@agimon-ai/doompi-core/extensionFile';\n\nimport contribution from './_lib/beforeAgentStart.cli';\n\nexport default defineCliHook(contribution);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/piExtension';\n\nimport hookBeforeAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof hookBeforeAgentStart>, undefined>;\ntype Intersect<Union> =\n (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\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 extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-model-guidance', (context) => ({\n events: {\n before_agent_start: at(hookBeforeAgentStart, context) as NonNullable<PiPluginContributions['events']>['before_agent_start'],\n },\n}));\n\nexport default extension;\n"],"mappings":";;;;;;AAOA,MAAa,sBAAsB,EACjC,mBAAmB,OAAO,SAAS;CACjC,MAAM,UAAU,QAAQ,OAAO;CAC/B,IAAI,CAAC,SAAS,OAAO,KAAA;CACrB,MAAM,WAAW,iBAAiB,kBAAkB,gBAAgB,CAAC,CAAC,IAAI,GAAG,OAAO;CACpF,MAAM,eAAe,mBAAmB,MAAM,cAAc,QAAQ;CACpE,OAAO,eAAe,EAAE,aAAa,IAAI,KAAA;AAC3C,EACF;AAEA,IAAA,kCAAgB,cACb,GAAG,SACF,oBAAoB,mBAAmB,GAAG,IAAI;;;ACflD,IAAA,+BAAe,cAAcA,8BAAY;;;ACQzC,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,YAAY,kBAAoC,qCAAqC,aAAa,EAC7G,QAAQ,EACN,oBAAoB,GAAGC,8BAAsB,OAAO,EACtD,EACF,EAAE"}
|
|
@@ -2,24 +2,57 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const require_modelGuidanceStore = require("../modelGuidanceStore-DEs_jtoI.cjs");
|
|
6
|
+
let _agimon_ai_doompi_core_extensionFile = require("@agimon-ai/doompi-core/extensionFile");
|
|
7
|
+
let _agimon_ai_doompi_core_serverFacet = require("@agimon-ai/doompi-core/serverFacet");
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.ts
|
|
10
|
+
var beforeAgentStart_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineHook)({
|
|
11
|
+
event: "before_agent_start",
|
|
12
|
+
handle(event, execution) {
|
|
13
|
+
const modelId = execution.model?.id;
|
|
14
|
+
if (!modelId) return void 0;
|
|
15
|
+
const guidance = require_modelGuidanceStore.guidanceForModel(require_modelGuidanceStore.loadModelGuidance(execution.cwd), modelId);
|
|
16
|
+
const systemPrompt = require_modelGuidanceStore.applyModelGuidance(typeof event.systemPrompt === "string" ? event.systemPrompt : "", guidance);
|
|
17
|
+
return systemPrompt ? { systemPrompt } : void 0;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/doompiModelGuidance.server.ts
|
|
22
|
+
var doompiModelGuidance_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineResource)({
|
|
23
|
+
when: {
|
|
24
|
+
state: { "minor-mode": "help" },
|
|
25
|
+
attribution: {
|
|
26
|
+
kind: "minor",
|
|
27
|
+
mode: "help"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
name: "doompi-model-guidance",
|
|
31
|
+
kind: "context",
|
|
32
|
+
read: () => (0, _agimon_ai_doompi_core_serverFacet.readPackageResource)(require("url").pathToFileURL(__filename).href, "llms.txt")
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/doompiUseModelGuidance.server.ts
|
|
36
|
+
var doompiUseModelGuidance_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineResource)({
|
|
37
|
+
name: "doompi-use-model-guidance",
|
|
38
|
+
kind: "skill",
|
|
39
|
+
read: () => (0, _agimon_ai_doompi_core_serverFacet.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/doompi-use-model-guidance/SKILL.md")
|
|
40
|
+
});
|
|
41
|
+
//#endregion
|
|
9
42
|
//#region generated/server.ts
|
|
10
43
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
11
44
|
const via = (identity, value) => ({
|
|
12
45
|
...identity,
|
|
13
46
|
...value
|
|
14
47
|
});
|
|
15
|
-
const facet = (0,
|
|
48
|
+
const facet = (0, _agimon_ai_doompi_core_serverFacet.defineServerPlugin)({
|
|
16
49
|
name: "@agimon-ai/doompi-model-guidance",
|
|
17
50
|
session: (context) => ({
|
|
18
51
|
get hooks() {
|
|
19
|
-
return [via({ event: "before_agent_start" }, at(
|
|
52
|
+
return [via({ event: "before_agent_start" }, at(beforeAgentStart_server_default, context))];
|
|
20
53
|
},
|
|
21
54
|
get resources() {
|
|
22
|
-
return [at(
|
|
55
|
+
return [at(doompiModelGuidance_server_default, context), at(doompiUseModelGuidance_server_default, context)];
|
|
23
56
|
}
|
|
24
57
|
})
|
|
25
58
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","names":["defineServerPlugin","hookBeforeAgentStart","resourceDoompiModelGuidance","resourceDoompiUseModelGuidance"],"sources":["../../generated/server.ts"],"sourcesContent":["// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/doompi-core/
|
|
1
|
+
{"version":3,"file":"server.cjs","names":["guidanceForModel","loadModelGuidance","applyModelGuidance","defineHook","contribution","readPackageResource","defineResource","contribution","readPackageResource","defineResource","contribution","defineServerPlugin","hookBeforeAgentStart","resourceDoompiModelGuidance","resourceDoompiUseModelGuidance"],"sources":["../../src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiModelGuidance.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/doompiModelGuidance.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseModelGuidance.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/doompiUseModelGuidance.server.ts","../../generated/server.ts"],"sourcesContent":["import type { DoomHeadlessHook } from '@agimon-ai/doompi-core/headless';\n\nimport { applyModelGuidance, guidanceForModel } from '../../../../../../services/modelGuidance';\nimport { loadModelGuidance } from '../../../../../../services/modelGuidanceStore';\n\nexport const modelGuidanceHook: DoomHeadlessHook = {\n event: 'before_agent_start',\n handle(event, execution) {\n const modelId = execution.model?.id;\n if (!modelId) return undefined;\n const guidance = guidanceForModel(loadModelGuidance(execution.cwd), modelId);\n const systemPrompt = applyModelGuidance(typeof event.systemPrompt === 'string' ? event.systemPrompt : '', guidance);\n return systemPrompt ? { systemPrompt } : undefined;\n },\n};\n\nexport default modelGuidanceHook;\n","import { defineHook } from '@agimon-ai/doompi-core/extensionFile';\n\nimport contribution from './_lib/beforeAgentStart.server';\n\nexport default defineHook(contribution);\n","import { readPackageResource } from '@agimon-ai/doompi-core/serverFacet';\n\nexport default {\n // The package index is Help-catalog material, not standing instruction, so it\n // only enters the prompt while Help mode is active.\n when: { state: { 'minor-mode': 'help' }, attribution: { kind: 'minor' as const, mode: 'help' } },\n name: 'doompi-model-guidance',\n kind: 'context' as const,\n read: () => readPackageResource(import.meta.url, 'llms.txt'),\n};\n","import { defineResource } from '@agimon-ai/doompi-core/extensionFile';\n\nimport contribution from './_lib/doompiModelGuidance.server';\n\nexport default defineResource(contribution);\n","import { readPackageResource } from '@agimon-ai/doompi-core/serverFacet';\n\nexport default {\n name: 'doompi-use-model-guidance',\n kind: 'skill' as const,\n read: () => readPackageResource(import.meta.url, 'src/prompts/doompi-use-model-guidance/SKILL.md'),\n};\n","import { defineResource } from '@agimon-ai/doompi-core/extensionFile';\n\nimport contribution from './_lib/doompiUseModelGuidance.server';\n\nexport default defineResource(contribution);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/doompi-core/serverFacet';\n\nimport hookBeforeAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server';\nimport resourceDoompiModelGuidance from '../src/extensions/workspaces/sessions/(backend)/resource/doompiModelGuidance.server';\nimport resourceDoompiUseModelGuidance from '../src/extensions/workspaces/sessions/(backend)/resource/doompiUseModelGuidance.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => ({ ...identity, ...(value as object) }) as T;\n\nexport const facet = defineServerPlugin({\n name: '@agimon-ai/doompi-model-guidance',\n session: (context) => ({\n get hooks(): DoomServerSessionPlugin['hooks'] { return [via({ event: 'before_agent_start' }, at(hookBeforeAgentStart, context))]; },\n get resources(): DoomServerSessionPlugin['resources'] { return [at(resourceDoompiModelGuidance, context), at(resourceDoompiUseModelGuidance, context)]; },\n }),\n});\n\nexport default facet;\n"],"mappings":";;;;;;;;;ACIA,IAAA,mCAAA,GAAeG,qCAAAA,WAAAA,CAAWC;CDExB,OAAO;CACP,OAAO,OAAO,WAAW;EACvB,MAAM,UAAU,UAAU,OAAO;EACjC,IAAI,CAAC,SAAS,OAAO,KAAA;EACrB,MAAM,WAAWJ,2BAAAA,iBAAiBC,2BAAAA,kBAAkB,UAAU,GAAG,GAAG,OAAO;EAC3E,MAAM,eAAeC,2BAAAA,mBAAmB,OAAO,MAAM,iBAAiB,WAAW,MAAM,eAAe,IAAI,QAAQ;EAClH,OAAO,eAAe,EAAE,aAAa,IAAI,KAAA;CAC3C;ACTwBE,CAAY;;;AEAtC,IAAA,sCAAA,GAAeE,qCAAAA,eAAAA,CAAeC;CDC5B,MAAM;EAAE,OAAO,EAAE,cAAc,OAAO;EAAG,aAAa;GAAE,MAAM;GAAkB,MAAM;EAAO;CAAE;CAC/F,MAAM;CACN,MAAM;CACN,aAAA,GAAYF,mCAAAA,oBAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,MAAqC,UAAU;ACJ/BE,CAAY;;;AEA1C,IAAA,yCAAA,GAAeE,qCAAAA,eAAAA,CAAeC;CDD5B,MAAM;CACN,MAAM;CACN,aAAA,GAAYF,mCAAAA,oBAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,MAAqC,gDAAgD;ACDrEE,CAAY;;;ACI1C,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,WAAuB;CAAE,GAAG;CAAU,GAAI;AAAiB;AAE9G,MAAa,SAAA,GAAQC,mCAAAA,mBAAAA,CAAmB;CACtC,MAAM;CACN,UAAU,aAAa;EACrB,IAAI,QAA0C;GAAE,OAAO,CAAC,IAAI,EAAE,OAAO,qBAAqB,GAAG,GAAGC,iCAAsB,OAAO,CAAC,CAAC;EAAG;EAClI,IAAI,YAAkD;GAAE,OAAO,CAAC,GAAGC,oCAA6B,OAAO,GAAG,GAAGC,uCAAgC,OAAO,CAAC;EAAG;CAC1J;AACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region generated/server.d.ts
|
|
2
|
-
export declare const facet: import("@agimon-ai/doompi-core/
|
|
2
|
+
export declare const facet: import("@agimon-ai/doompi-core/serverFacet").DoomServerFacet;
|
|
3
3
|
//#endregion
|
|
4
4
|
export { facet as default };
|
|
5
5
|
//# sourceMappingURL=server.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";qBAYa,
|
|
1
|
+
{"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";qBAYa,oDAAK"}
|
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { i as guidanceForModel, n as loadModelGuidance, r as applyModelGuidance } from "../modelGuidanceStore-BPKgawjz.mjs";
|
|
2
|
+
import { defineHook, defineResource } from "@agimon-ai/doompi-core/extensionFile";
|
|
3
|
+
import { defineServerPlugin, readPackageResource } from "@agimon-ai/doompi-core/serverFacet";
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.ts
|
|
6
|
+
var beforeAgentStart_server_default = defineHook({
|
|
7
|
+
event: "before_agent_start",
|
|
8
|
+
handle(event, execution) {
|
|
9
|
+
const modelId = execution.model?.id;
|
|
10
|
+
if (!modelId) return void 0;
|
|
11
|
+
const guidance = guidanceForModel(loadModelGuidance(execution.cwd), modelId);
|
|
12
|
+
const systemPrompt = applyModelGuidance(typeof event.systemPrompt === "string" ? event.systemPrompt : "", guidance);
|
|
13
|
+
return systemPrompt ? { systemPrompt } : void 0;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/doompiModelGuidance.server.ts
|
|
18
|
+
var doompiModelGuidance_server_default = defineResource({
|
|
19
|
+
when: {
|
|
20
|
+
state: { "minor-mode": "help" },
|
|
21
|
+
attribution: {
|
|
22
|
+
kind: "minor",
|
|
23
|
+
mode: "help"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
name: "doompi-model-guidance",
|
|
27
|
+
kind: "context",
|
|
28
|
+
read: () => readPackageResource(import.meta.url, "llms.txt")
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/doompiUseModelGuidance.server.ts
|
|
32
|
+
var doompiUseModelGuidance_server_default = defineResource({
|
|
33
|
+
name: "doompi-use-model-guidance",
|
|
34
|
+
kind: "skill",
|
|
35
|
+
read: () => readPackageResource(import.meta.url, "src/prompts/doompi-use-model-guidance/SKILL.md")
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
5
38
|
//#region generated/server.ts
|
|
6
39
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
7
40
|
const via = (identity, value) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","names":["hookBeforeAgentStart","resourceDoompiModelGuidance","resourceDoompiUseModelGuidance"],"sources":["../../generated/server.ts"],"sourcesContent":["// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/doompi-core/
|
|
1
|
+
{"version":3,"file":"server.mjs","names":["contribution","contribution","contribution","hookBeforeAgentStart","resourceDoompiModelGuidance","resourceDoompiUseModelGuidance"],"sources":["../../src/extensions/workspaces/sessions/(backend)/hook/_lib/beforeAgentStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiModelGuidance.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/doompiModelGuidance.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseModelGuidance.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/doompiUseModelGuidance.server.ts","../../generated/server.ts"],"sourcesContent":["import type { DoomHeadlessHook } from '@agimon-ai/doompi-core/headless';\n\nimport { applyModelGuidance, guidanceForModel } from '../../../../../../services/modelGuidance';\nimport { loadModelGuidance } from '../../../../../../services/modelGuidanceStore';\n\nexport const modelGuidanceHook: DoomHeadlessHook = {\n event: 'before_agent_start',\n handle(event, execution) {\n const modelId = execution.model?.id;\n if (!modelId) return undefined;\n const guidance = guidanceForModel(loadModelGuidance(execution.cwd), modelId);\n const systemPrompt = applyModelGuidance(typeof event.systemPrompt === 'string' ? event.systemPrompt : '', guidance);\n return systemPrompt ? { systemPrompt } : undefined;\n },\n};\n\nexport default modelGuidanceHook;\n","import { defineHook } from '@agimon-ai/doompi-core/extensionFile';\n\nimport contribution from './_lib/beforeAgentStart.server';\n\nexport default defineHook(contribution);\n","import { readPackageResource } from '@agimon-ai/doompi-core/serverFacet';\n\nexport default {\n // The package index is Help-catalog material, not standing instruction, so it\n // only enters the prompt while Help mode is active.\n when: { state: { 'minor-mode': 'help' }, attribution: { kind: 'minor' as const, mode: 'help' } },\n name: 'doompi-model-guidance',\n kind: 'context' as const,\n read: () => readPackageResource(import.meta.url, 'llms.txt'),\n};\n","import { defineResource } from '@agimon-ai/doompi-core/extensionFile';\n\nimport contribution from './_lib/doompiModelGuidance.server';\n\nexport default defineResource(contribution);\n","import { readPackageResource } from '@agimon-ai/doompi-core/serverFacet';\n\nexport default {\n name: 'doompi-use-model-guidance',\n kind: 'skill' as const,\n read: () => readPackageResource(import.meta.url, 'src/prompts/doompi-use-model-guidance/SKILL.md'),\n};\n","import { defineResource } from '@agimon-ai/doompi-core/extensionFile';\n\nimport contribution from './_lib/doompiUseModelGuidance.server';\n\nexport default defineResource(contribution);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/doompi-core/serverFacet';\n\nimport hookBeforeAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server';\nimport resourceDoompiModelGuidance from '../src/extensions/workspaces/sessions/(backend)/resource/doompiModelGuidance.server';\nimport resourceDoompiUseModelGuidance from '../src/extensions/workspaces/sessions/(backend)/resource/doompiUseModelGuidance.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => ({ ...identity, ...(value as object) }) as T;\n\nexport const facet = defineServerPlugin({\n name: '@agimon-ai/doompi-model-guidance',\n session: (context) => ({\n get hooks(): DoomServerSessionPlugin['hooks'] { return [via({ event: 'before_agent_start' }, at(hookBeforeAgentStart, context))]; },\n get resources(): DoomServerSessionPlugin['resources'] { return [at(resourceDoompiModelGuidance, context), at(resourceDoompiUseModelGuidance, context)]; },\n }),\n});\n\nexport default facet;\n"],"mappings":";;;;;ACIA,IAAA,kCAAe,WAAWA;CDExB,OAAO;CACP,OAAO,OAAO,WAAW;EACvB,MAAM,UAAU,UAAU,OAAO;EACjC,IAAI,CAAC,SAAS,OAAO,KAAA;EACrB,MAAM,WAAW,iBAAiB,kBAAkB,UAAU,GAAG,GAAG,OAAO;EAC3E,MAAM,eAAe,mBAAmB,OAAO,MAAM,iBAAiB,WAAW,MAAM,eAAe,IAAI,QAAQ;EAClH,OAAO,eAAe,EAAE,aAAa,IAAI,KAAA;CAC3C;ACTwBA,CAAY;;;AEAtC,IAAA,qCAAe,eAAeC;CDC5B,MAAM;EAAE,OAAO,EAAE,cAAc,OAAO;EAAG,aAAa;GAAE,MAAM;GAAkB,MAAM;EAAO;CAAE;CAC/F,MAAM;CACN,MAAM;CACN,YAAY,oBAAoB,YAAY,KAAK,UAAU;ACJ/BA,CAAY;;;AEA1C,IAAA,wCAAe,eAAeC;CDD5B,MAAM;CACN,MAAM;CACN,YAAY,oBAAoB,YAAY,KAAK,gDAAgD;ACDrEA,CAAY;;;ACI1C,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,WAAuB;CAAE,GAAG;CAAU,GAAI;AAAiB;AAE9G,MAAa,QAAQ,mBAAmB;CACtC,MAAM;CACN,UAAU,aAAa;EACrB,IAAI,QAA0C;GAAE,OAAO,CAAC,IAAI,EAAE,OAAO,qBAAqB,GAAG,GAAGC,iCAAsB,OAAO,CAAC,CAAC;EAAG;EAClI,IAAI,YAAkD;GAAE,OAAO,CAAC,GAAGC,oCAA6B,OAAO,GAAG,GAAGC,uCAAgC,OAAO,CAAC;EAAG;CAC1J;AACF,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.loadModelGuidance = require_index$1.loadModelGuidance;
|
|
10
|
-
exports.mergeModelGuidance = require_index.mergeModelGuidance;
|
|
2
|
+
const require_modelGuidanceStore = require("./modelGuidanceStore-DEs_jtoI.cjs");
|
|
3
|
+
exports.DEFAULT_MODEL_GUIDANCE_PRESET = require_modelGuidanceStore.DEFAULT_MODEL_GUIDANCE_PRESET;
|
|
4
|
+
exports.GUIDANCE_FILE = require_modelGuidanceStore.GUIDANCE_FILE;
|
|
5
|
+
exports.applyModelGuidance = require_modelGuidanceStore.applyModelGuidance;
|
|
6
|
+
exports.guidanceForModel = require_modelGuidanceStore.guidanceForModel;
|
|
7
|
+
exports.loadModelGuidance = require_modelGuidanceStore.loadModelGuidance;
|
|
8
|
+
exports.mergeModelGuidance = require_modelGuidanceStore.mergeModelGuidance;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/types/modelGuidance.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Wire and domain shapes for per-model system prompt guidance.
|
|
4
|
+
*
|
|
5
|
+
* Document values are `unknown` rather than `string` because a guidance file is
|
|
6
|
+
* user-authored YAML: the parser cannot promise a string, so the fold narrows
|
|
7
|
+
* each value instead of asserting one.
|
|
8
|
+
*/
|
|
9
|
+
/** Raw shape of one `.doom/model-guidance.yaml` document. */
|
|
10
|
+
interface ModelGuidanceDocument {
|
|
11
|
+
readonly modelGuidance?: Readonly<Record<string, unknown>>;
|
|
12
|
+
}
|
|
13
|
+
/** Model id to guidance text, after the global and repository documents are folded. */
|
|
14
|
+
type ModelGuidanceMap = Readonly<Record<string, string>>;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/services/modelGuidanceStore/index.d.ts
|
|
17
|
+
/** Layered guidance document, read from the global then the repository `.doom` directory. */
|
|
18
|
+
export declare const GUIDANCE_FILE = "model-guidance.yaml";
|
|
19
|
+
/**
|
|
20
|
+
* Reads and folds the global and repository guidance documents.
|
|
21
|
+
*
|
|
22
|
+
* Fails open. The reader parses YAML without a guard, so a typo in an optional
|
|
23
|
+
* prompt file would otherwise throw on every turn of the session. Degrading to
|
|
24
|
+
* the built-in preset keeps the package useful without letting malformed user
|
|
25
|
+
* input end the turn.
|
|
26
|
+
*
|
|
27
|
+
* `homeDirectory` exists so a test can point the global scope at a temporary
|
|
28
|
+
* directory; production callers omit it and the reader falls back to the real home.
|
|
29
|
+
*/
|
|
30
|
+
export declare function loadModelGuidance(repositoryRoot: string | undefined, homeDirectory?: string): ModelGuidanceMap;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/constants/modelGuidance.d.ts
|
|
33
|
+
export declare const DEFAULT_MODEL_GUIDANCE_PRESET: {
|
|
34
|
+
readonly modelGuidance: {
|
|
35
|
+
readonly 'gpt-6-astra': 'Continue executing an agreed plan and its scoped tasks without pausing for small decisions or repeated confirmation. Treat the accepted plan and task list as authorization to complete the work, make reasonable low-risk and reversible implementation choices, and verify the result. Ask only when blocked or when a decision would materially change scope, requirements, security, data safety, or destructive behavior.';
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/services/modelGuidance/index.d.ts
|
|
40
|
+
/**
|
|
41
|
+
* Folds guidance documents in source order, so a later document overrides one
|
|
42
|
+
* model id at a time.
|
|
43
|
+
*
|
|
44
|
+
* The reader hands back global then repository, so a repository entry wins the
|
|
45
|
+
* ids it names while global entries it does not name survive. That per-id
|
|
46
|
+
* granularity is the point: a personal default stays useful inside a project
|
|
47
|
+
* that only pins one model.
|
|
48
|
+
*
|
|
49
|
+
* Non-string values are dropped rather than rejected, because a guidance file is
|
|
50
|
+
* optional user input and one bad entry must not discard the rest.
|
|
51
|
+
*/
|
|
52
|
+
export declare function mergeModelGuidance(documents: readonly ModelGuidanceDocument[]): ModelGuidanceMap;
|
|
53
|
+
/** Exact-match lookup. An unknown or absent model id contributes nothing. */
|
|
54
|
+
export declare function guidanceForModel(guidance: ModelGuidanceMap, modelId: string | undefined): string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Builds the replacement system prompt for one turn.
|
|
57
|
+
*
|
|
58
|
+
* Pi treats a returned `systemPrompt` as a full replacement and chains handlers,
|
|
59
|
+
* so the incoming prompt has to be re-embedded. Returning bare guidance would
|
|
60
|
+
* discard every earlier contribution, including plan mode and the persona.
|
|
61
|
+
* Keeping that in one function leaves a single place for it to be right.
|
|
62
|
+
*/
|
|
63
|
+
export declare function applyModelGuidance(systemPrompt: string, guidance: string | undefined): string | undefined;
|
|
64
|
+
//#endregion
|
|
65
|
+
export type { ModelGuidanceDocument, ModelGuidanceMap };
|
|
66
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/modelGuidance.ts","../src/services/modelGuidanceStore/index.ts","../src/constants/modelGuidance.ts","../src/services/modelGuidance/index.ts"],"mappings":";;;;;;;;;UASiB;WACN,gBAAgB,SAAS;;;KAIxB,mBAAmB,SAAS;;;;qBCP3B;;;;;;;;;;;;wBAaG,kBAAkB,oCAAoC,yBAAyB;;;qBChBlF;WAAkC;aAF3C;;;;;;;;;;;;;;;;;wBCeY,mBAAmB,oBAAoB,0BAA0B;;wBAajE,iBAAiB,UAAU,kBAAkB;;;;;;;;;wBAa7C,mBAAmB,sBAAsB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { DEFAULT_MODEL_GUIDANCE_PRESET } from "./
|
|
2
|
-
import { applyModelGuidance, guidanceForModel, mergeModelGuidance } from "./src/services/modelGuidance/index.mjs";
|
|
3
|
-
import { GUIDANCE_FILE, loadModelGuidance } from "./src/services/modelGuidanceStore/index.mjs";
|
|
1
|
+
import { a as mergeModelGuidance, i as guidanceForModel, n as loadModelGuidance, o as DEFAULT_MODEL_GUIDANCE_PRESET, r as applyModelGuidance, t as GUIDANCE_FILE } from "./modelGuidanceStore-BPKgawjz.mjs";
|
|
4
2
|
export { DEFAULT_MODEL_GUIDANCE_PRESET, GUIDANCE_FILE, applyModelGuidance, guidanceForModel, loadModelGuidance, mergeModelGuidance };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { readDoomConfigSources } from "@agimon-ai/doompi-config/layeredConfig";
|
|
2
|
+
//#region src/constants/modelGuidance.ts
|
|
3
|
+
const DEFAULT_GUIDANCE = { "gpt-6-astra": "Continue executing an agreed plan and its scoped tasks without pausing for small decisions or repeated confirmation. Treat the accepted plan and task list as authorization to complete the work, make reasonable low-risk and reversible implementation choices, and verify the result. Ask only when blocked or when a decision would materially change scope, requirements, security, data safety, or destructive behavior." };
|
|
4
|
+
const DEFAULT_MODEL_GUIDANCE_PRESET = { modelGuidance: DEFAULT_GUIDANCE };
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/services/modelGuidance/index.ts
|
|
7
|
+
Object.freeze(DEFAULT_GUIDANCE);
|
|
8
|
+
Object.freeze(DEFAULT_MODEL_GUIDANCE_PRESET);
|
|
9
|
+
/**
|
|
10
|
+
* Folds guidance documents in source order, so a later document overrides one
|
|
11
|
+
* model id at a time.
|
|
12
|
+
*
|
|
13
|
+
* The reader hands back global then repository, so a repository entry wins the
|
|
14
|
+
* ids it names while global entries it does not name survive. That per-id
|
|
15
|
+
* granularity is the point: a personal default stays useful inside a project
|
|
16
|
+
* that only pins one model.
|
|
17
|
+
*
|
|
18
|
+
* Non-string values are dropped rather than rejected, because a guidance file is
|
|
19
|
+
* optional user input and one bad entry must not discard the rest.
|
|
20
|
+
*/
|
|
21
|
+
function mergeModelGuidance(documents) {
|
|
22
|
+
const merged = {};
|
|
23
|
+
for (const document of documents) for (const [modelId, guidance] of Object.entries(document.modelGuidance ?? {})) {
|
|
24
|
+
if (typeof guidance !== "string") continue;
|
|
25
|
+
const trimmed = guidance.trim();
|
|
26
|
+
if (trimmed) merged[modelId] = trimmed;
|
|
27
|
+
}
|
|
28
|
+
return merged;
|
|
29
|
+
}
|
|
30
|
+
/** Exact-match lookup. An unknown or absent model id contributes nothing. */
|
|
31
|
+
function guidanceForModel(guidance, modelId) {
|
|
32
|
+
if (!modelId) return void 0;
|
|
33
|
+
return guidance[modelId];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds the replacement system prompt for one turn.
|
|
37
|
+
*
|
|
38
|
+
* Pi treats a returned `systemPrompt` as a full replacement and chains handlers,
|
|
39
|
+
* so the incoming prompt has to be re-embedded. Returning bare guidance would
|
|
40
|
+
* discard every earlier contribution, including plan mode and the persona.
|
|
41
|
+
* Keeping that in one function leaves a single place for it to be right.
|
|
42
|
+
*/
|
|
43
|
+
function applyModelGuidance(systemPrompt, guidance) {
|
|
44
|
+
if (!guidance) return void 0;
|
|
45
|
+
return `${systemPrompt}\n\n${guidance}`;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/services/modelGuidanceStore/index.ts
|
|
49
|
+
/** Layered guidance document, read from the global then the repository `.doom` directory. */
|
|
50
|
+
const GUIDANCE_FILE = "model-guidance.yaml";
|
|
51
|
+
/**
|
|
52
|
+
* Reads and folds the global and repository guidance documents.
|
|
53
|
+
*
|
|
54
|
+
* Fails open. The reader parses YAML without a guard, so a typo in an optional
|
|
55
|
+
* prompt file would otherwise throw on every turn of the session. Degrading to
|
|
56
|
+
* the built-in preset keeps the package useful without letting malformed user
|
|
57
|
+
* input end the turn.
|
|
58
|
+
*
|
|
59
|
+
* `homeDirectory` exists so a test can point the global scope at a temporary
|
|
60
|
+
* directory; production callers omit it and the reader falls back to the real home.
|
|
61
|
+
*/
|
|
62
|
+
function loadModelGuidance(repositoryRoot, homeDirectory) {
|
|
63
|
+
if (!repositoryRoot) return DEFAULT_GUIDANCE;
|
|
64
|
+
try {
|
|
65
|
+
const sources = readDoomConfigSources(GUIDANCE_FILE, repositoryRoot, homeDirectory);
|
|
66
|
+
return mergeModelGuidance([DEFAULT_MODEL_GUIDANCE_PRESET, ...sources.map((source) => source.document)]);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
69
|
+
process.stderr.write(`[doompi-model-guidance] could not read ${GUIDANCE_FILE}: ${reason}\n`);
|
|
70
|
+
return DEFAULT_GUIDANCE;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { mergeModelGuidance as a, guidanceForModel as i, loadModelGuidance as n, DEFAULT_MODEL_GUIDANCE_PRESET as o, applyModelGuidance as r, GUIDANCE_FILE as t };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=modelGuidanceStore-BPKgawjz.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelGuidanceStore-BPKgawjz.mjs","names":[],"sources":["../src/constants/modelGuidance.ts","../src/services/modelGuidance/index.ts","../src/services/modelGuidanceStore/index.ts"],"sourcesContent":["export const DEFAULT_GUIDANCE = {\n 'gpt-6-astra':\n 'Continue executing an agreed plan and its scoped tasks without pausing for small decisions or repeated confirmation. Treat the accepted plan and task list as authorization to complete the work, make reasonable low-risk and reversible implementation choices, and verify the result. Ask only when blocked or when a decision would materially change scope, requirements, security, data safety, or destructive behavior.',\n} as const;\nexport const DEFAULT_MODEL_GUIDANCE_PRESET = { modelGuidance: DEFAULT_GUIDANCE } as const;\n","import { DEFAULT_GUIDANCE, DEFAULT_MODEL_GUIDANCE_PRESET } from '../../constants/modelGuidance';\nimport type { ModelGuidanceDocument, ModelGuidanceMap } from '../../types/modelGuidance';\nexport { DEFAULT_MODEL_GUIDANCE_PRESET } from '../../constants/modelGuidance';\nObject.freeze(DEFAULT_GUIDANCE);\nObject.freeze(DEFAULT_MODEL_GUIDANCE_PRESET);\n/**\n * Folds guidance documents in source order, so a later document overrides one\n * model id at a time.\n *\n * The reader hands back global then repository, so a repository entry wins the\n * ids it names while global entries it does not name survive. That per-id\n * granularity is the point: a personal default stays useful inside a project\n * that only pins one model.\n *\n * Non-string values are dropped rather than rejected, because a guidance file is\n * optional user input and one bad entry must not discard the rest.\n */\nexport function mergeModelGuidance(documents: readonly ModelGuidanceDocument[]): ModelGuidanceMap {\n const merged: Record<string, string> = {};\n for (const document of documents) {\n for (const [modelId, guidance] of Object.entries(document.modelGuidance ?? {})) {\n if (typeof guidance !== 'string') continue;\n const trimmed = guidance.trim();\n if (trimmed) merged[modelId] = trimmed;\n }\n }\n return merged;\n}\n\n/** Exact-match lookup. An unknown or absent model id contributes nothing. */\nexport function guidanceForModel(guidance: ModelGuidanceMap, modelId: string | undefined): string | undefined {\n if (!modelId) return undefined;\n return guidance[modelId];\n}\n\n/**\n * Builds the replacement system prompt for one turn.\n *\n * Pi treats a returned `systemPrompt` as a full replacement and chains handlers,\n * so the incoming prompt has to be re-embedded. Returning bare guidance would\n * discard every earlier contribution, including plan mode and the persona.\n * Keeping that in one function leaves a single place for it to be right.\n */\nexport function applyModelGuidance(systemPrompt: string, guidance: string | undefined): string | undefined {\n if (!guidance) return undefined;\n return `${systemPrompt}\\n\\n${guidance}`;\n}\n","import { readDoomConfigSources } from '@agimon-ai/doompi-config/layeredConfig';\n\nimport { DEFAULT_GUIDANCE } from '../../constants/modelGuidance';\nimport type { ModelGuidanceDocument, ModelGuidanceMap } from '../../types/modelGuidance';\nimport { DEFAULT_MODEL_GUIDANCE_PRESET, mergeModelGuidance } from '../modelGuidance';\n\n/** Layered guidance document, read from the global then the repository `.doom` directory. */\nexport const GUIDANCE_FILE = 'model-guidance.yaml';\n\n/**\n * Reads and folds the global and repository guidance documents.\n *\n * Fails open. The reader parses YAML without a guard, so a typo in an optional\n * prompt file would otherwise throw on every turn of the session. Degrading to\n * the built-in preset keeps the package useful without letting malformed user\n * input end the turn.\n *\n * `homeDirectory` exists so a test can point the global scope at a temporary\n * directory; production callers omit it and the reader falls back to the real home.\n */\nexport function loadModelGuidance(repositoryRoot: string | undefined, homeDirectory?: string): ModelGuidanceMap {\n if (!repositoryRoot) return DEFAULT_GUIDANCE;\n\n try {\n const sources = readDoomConfigSources<ModelGuidanceDocument>(GUIDANCE_FILE, repositoryRoot, homeDirectory);\n return mergeModelGuidance([DEFAULT_MODEL_GUIDANCE_PRESET, ...sources.map((source) => source.document)]);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[doompi-model-guidance] could not read ${GUIDANCE_FILE}: ${reason}\\n`);\n return DEFAULT_GUIDANCE;\n }\n}\n"],"mappings":";;AAAA,MAAa,mBAAmB,EAC9B,eACE,iaACJ;AACA,MAAa,gCAAgC,EAAE,eAAe,iBAAiB;;;ACD/E,OAAO,OAAO,gBAAgB;AAC9B,OAAO,OAAO,6BAA6B;;;;;;;;;;;;;AAa3C,SAAgB,mBAAmB,WAA+D;CAChG,MAAM,SAAiC,CAAC;CACxC,KAAK,MAAM,YAAY,WACrB,KAAK,MAAM,CAAC,SAAS,aAAa,OAAO,QAAQ,SAAS,iBAAiB,CAAC,CAAC,GAAG;EAC9E,IAAI,OAAO,aAAa,UAAU;EAClC,MAAM,UAAU,SAAS,KAAK;EAC9B,IAAI,SAAS,OAAO,WAAW;CACjC;CAEF,OAAO;AACT;;AAGA,SAAgB,iBAAiB,UAA4B,SAAiD;CAC5G,IAAI,CAAC,SAAS,OAAO,KAAA;CACrB,OAAO,SAAS;AAClB;;;;;;;;;AAUA,SAAgB,mBAAmB,cAAsB,UAAkD;CACzG,IAAI,CAAC,UAAU,OAAO,KAAA;CACtB,OAAO,GAAG,aAAa,MAAM;AAC/B;;;;ACvCA,MAAa,gBAAgB;;;;;;;;;;;;AAa7B,SAAgB,kBAAkB,gBAAoC,eAA0C;CAC9G,IAAI,CAAC,gBAAgB,OAAO;CAE5B,IAAI;EACF,MAAM,UAAU,sBAA6C,eAAe,gBAAgB,aAAa;EACzG,OAAO,mBAAmB,CAAC,+BAA+B,GAAG,QAAQ,KAAK,WAAW,OAAO,QAAQ,CAAC,CAAC;CACxG,SAAS,OAAO;EACd,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACpE,QAAQ,OAAO,MAAM,0CAA0C,cAAc,IAAI,OAAO,GAAG;EAC3F,OAAO;CACT;AACF"}
|