@agimon-ai/doompi-major-mode 0.0.1-alpha.7 → 0.0.1-alpha.71
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/README.md +9 -0
- package/dist/apiContracts.cjs +17 -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 +13 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/extensions/mcp.cjs +26 -0
- package/dist/extensions/mcp.cjs.map +1 -0
- package/dist/extensions/mcp.d.mts +5 -0
- package/dist/extensions/mcp.d.mts.map +1 -0
- package/dist/extensions/mcp.mjs +21 -0
- package/dist/extensions/mcp.mjs.map +1 -0
- package/dist/extensions/pi.cjs +468 -1
- package/dist/extensions/pi.cjs.map +1 -0
- package/dist/extensions/pi.d.mts +6 -2
- package/dist/extensions/pi.d.mts.map +1 -0
- package/dist/extensions/pi.mjs +440 -1
- package/dist/extensions/pi.mjs.map +1 -0
- package/dist/extensions/server.cjs +81 -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 +76 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/index-WVJHFxo7.d.mts +136 -0
- package/dist/index-WVJHFxo7.d.mts.map +1 -0
- package/dist/index.cjs +24 -1
- package/dist/index.d.mts +2 -11
- package/dist/index.mjs +3 -1
- package/dist/majorModeText-DBUA4b8j.cjs +121 -0
- package/dist/majorModeText-DBUA4b8j.cjs.map +1 -0
- package/dist/majorModeText-y7YRPKIB.mjs +68 -0
- package/dist/majorModeText-y7YRPKIB.mjs.map +1 -0
- package/dist/telemetry-CMQmvgf9.mjs +135 -0
- package/dist/telemetry-CMQmvgf9.mjs.map +1 -0
- package/dist/telemetry-VMPKEj8y.cjs +212 -0
- package/dist/telemetry-VMPKEj8y.cjs.map +1 -0
- package/package.json +59 -18
- package/dist/adapters/pi/extension.cjs +0 -2
- package/dist/adapters/pi/extension.cjs.map +0 -1
- package/dist/adapters/pi/extension.d.cts +0 -8
- package/dist/adapters/pi/extension.d.cts.map +0 -1
- package/dist/adapters/pi/extension.d.mts +0 -8
- package/dist/adapters/pi/extension.d.mts.map +0 -1
- package/dist/adapters/pi/extension.mjs +0 -2
- package/dist/adapters/pi/extension.mjs.map +0 -1
- package/dist/adapters/pi/voiceTool.cjs +0 -2
- package/dist/adapters/pi/voiceTool.cjs.map +0 -1
- package/dist/adapters/pi/voiceTool.d.cts +0 -18
- package/dist/adapters/pi/voiceTool.d.cts.map +0 -1
- package/dist/adapters/pi/voiceTool.d.mts +0 -18
- package/dist/adapters/pi/voiceTool.d.mts.map +0 -1
- package/dist/adapters/pi/voiceTool.mjs +0 -2
- package/dist/adapters/pi/voiceTool.mjs.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.cjs +0 -2
- package/dist/adapters/telemetry/logSinkTelemetry.cjs.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts +0 -14
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts +0 -14
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.mjs +0 -2
- package/dist/adapters/telemetry/logSinkTelemetry.mjs.map +0 -1
- package/dist/commands/majorModeCommand.cjs +0 -2
- package/dist/commands/majorModeCommand.cjs.map +0 -1
- package/dist/commands/majorModeCommand.d.cts +0 -19
- package/dist/commands/majorModeCommand.d.cts.map +0 -1
- package/dist/commands/majorModeCommand.d.mts +0 -19
- package/dist/commands/majorModeCommand.d.mts.map +0 -1
- package/dist/commands/majorModeCommand.mjs +0 -2
- package/dist/commands/majorModeCommand.mjs.map +0 -1
- package/dist/extensions/pi.d.cts +0 -2
- package/dist/index.d.cts +0 -11
- package/dist/schemas/majorModeVoiceTools.cjs +0 -2
- package/dist/schemas/majorModeVoiceTools.cjs.map +0 -1
- package/dist/schemas/majorModeVoiceTools.d.cts +0 -30
- package/dist/schemas/majorModeVoiceTools.d.cts.map +0 -1
- package/dist/schemas/majorModeVoiceTools.d.mts +0 -30
- package/dist/schemas/majorModeVoiceTools.d.mts.map +0 -1
- package/dist/schemas/majorModeVoiceTools.mjs +0 -2
- package/dist/schemas/majorModeVoiceTools.mjs.map +0 -1
- package/dist/services/majorModeText.cjs +0 -8
- package/dist/services/majorModeText.cjs.map +0 -1
- package/dist/services/majorModeText.d.cts +0 -25
- package/dist/services/majorModeText.d.cts.map +0 -1
- package/dist/services/majorModeText.d.mts +0 -25
- package/dist/services/majorModeText.d.mts.map +0 -1
- package/dist/services/majorModeText.mjs +0 -8
- package/dist/services/majorModeText.mjs.map +0 -1
- package/dist/services/pendingSelection.cjs +0 -2
- package/dist/services/pendingSelection.cjs.map +0 -1
- package/dist/services/pendingSelection.d.cts +0 -18
- package/dist/services/pendingSelection.d.cts.map +0 -1
- package/dist/services/pendingSelection.d.mts +0 -18
- package/dist/services/pendingSelection.d.mts.map +0 -1
- package/dist/services/pendingSelection.mjs +0 -2
- package/dist/services/pendingSelection.mjs.map +0 -1
- package/dist/services/statusLine.cjs +0 -2
- package/dist/services/statusLine.cjs.map +0 -1
- package/dist/services/statusLine.d.cts +0 -16
- package/dist/services/statusLine.d.cts.map +0 -1
- package/dist/services/statusLine.d.mts +0 -16
- package/dist/services/statusLine.d.mts.map +0 -1
- package/dist/services/statusLine.mjs +0 -2
- package/dist/services/statusLine.mjs.map +0 -1
- package/dist/types/majorMode.cjs +0 -2
- package/dist/types/majorMode.cjs.map +0 -1
- package/dist/types/majorMode.d.cts +0 -16
- package/dist/types/majorMode.d.cts.map +0 -1
- package/dist/types/majorMode.d.mts +0 -16
- package/dist/types/majorMode.d.mts.map +0 -1
- package/dist/types/majorMode.mjs +0 -2
- package/dist/types/majorMode.mjs.map +0 -1
- package/dist/types/telemetry.cjs +0 -2
- package/dist/types/telemetry.cjs.map +0 -1
- package/dist/types/telemetry.d.cts +0 -15
- package/dist/types/telemetry.d.cts.map +0 -1
- package/dist/types/telemetry.d.mts +0 -15
- package/dist/types/telemetry.d.mts.map +0 -1
- package/dist/types/telemetry.mjs +0 -2
- package/dist/types/telemetry.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -76,3 +76,12 @@ it. It is not selectable from `.doom/modes.yaml`. It is what reads that file.
|
|
|
76
76
|
## License
|
|
77
77
|
|
|
78
78
|
MIT
|
|
79
|
+
|
|
80
|
+
Pi and server declarations live in `src/extensions` and build directly to `/extensions/pi`
|
|
81
|
+
and `/extensions/server`. Flat root exports expose selection, status, telemetry, and schema helpers.
|
|
82
|
+
Controllers own host integration; text and telemetry services live in named folders.
|
|
83
|
+
|
|
84
|
+
The Pi declaration installs optional Config, Transition, and Voice service bindings before its
|
|
85
|
+
command and event declarations. Session startup awaits the runtime binding before publishing status.
|
|
86
|
+
The shared helper owns teardown of those bindings. Picker, selection-switch, and journal modules
|
|
87
|
+
remain lazy imports, so registering `/mode` does not load them eagerly.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
//#region src/schemas/apiContracts.ts
|
|
6
|
+
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
7
|
+
const apiContracts = (0, require("@agimon-ai/doompi-core/apiContracts").defineApiContract)({
|
|
8
|
+
version: 1,
|
|
9
|
+
http: [],
|
|
10
|
+
sockets: [],
|
|
11
|
+
dynamic: []
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.apiContracts = apiContracts;
|
|
15
|
+
exports.default = apiContracts;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=apiContracts.cjs.map
|
|
@@ -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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/schemas/apiContracts.d.ts
|
|
2
|
+
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
3
|
+
export declare const apiContracts: {
|
|
4
|
+
version: 1;
|
|
5
|
+
protocols?: Record<string, string> | undefined;
|
|
6
|
+
schemas?: Record<string, boolean | object> | undefined;
|
|
7
|
+
http: {
|
|
8
|
+
id: string;
|
|
9
|
+
scope: "global" | "session" | "workspace";
|
|
10
|
+
basePath?: string | undefined;
|
|
11
|
+
path: string;
|
|
12
|
+
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
13
|
+
description: string;
|
|
14
|
+
availability?: string | undefined;
|
|
15
|
+
authentication: "device" | "none" | "owner";
|
|
16
|
+
parameters?: {
|
|
17
|
+
name: string;
|
|
18
|
+
in: "header" | "path" | "query";
|
|
19
|
+
required: boolean;
|
|
20
|
+
schema: boolean | object;
|
|
21
|
+
}[] | undefined;
|
|
22
|
+
body?: {
|
|
23
|
+
contentType: string;
|
|
24
|
+
contentTypes?: string[] | undefined;
|
|
25
|
+
required: boolean;
|
|
26
|
+
schema: boolean | object;
|
|
27
|
+
} | undefined;
|
|
28
|
+
responses: Record<string, {
|
|
29
|
+
description: string;
|
|
30
|
+
contentType?: string | undefined;
|
|
31
|
+
schema?: boolean | object | undefined;
|
|
32
|
+
events?: Record<string, boolean | object> | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
}[];
|
|
35
|
+
sockets: {
|
|
36
|
+
id: string;
|
|
37
|
+
scope: "global" | "session" | "workspace";
|
|
38
|
+
description: string;
|
|
39
|
+
availability?: string | undefined;
|
|
40
|
+
service: string;
|
|
41
|
+
member: string;
|
|
42
|
+
direction: "client-to-server" | "server-to-client";
|
|
43
|
+
kind: "channel" | "method" | "state";
|
|
44
|
+
input: boolean | object;
|
|
45
|
+
output?: boolean | object | undefined;
|
|
46
|
+
errors?: boolean | object | undefined;
|
|
47
|
+
}[];
|
|
48
|
+
dynamic: string[];
|
|
49
|
+
gaps?: string[] | undefined;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { apiContracts as default };
|
|
53
|
+
//# sourceMappingURL=apiContracts.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAGa"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineApiContract } from "@agimon-ai/doompi-core/apiContracts";
|
|
2
|
+
//#region src/schemas/apiContracts.ts
|
|
3
|
+
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
4
|
+
const apiContracts = defineApiContract({
|
|
5
|
+
version: 1,
|
|
6
|
+
http: [],
|
|
7
|
+
sockets: [],
|
|
8
|
+
dynamic: []
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { apiContracts, apiContracts as default };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=apiContracts.mjs.map
|
|
@@ -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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
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
|
+
//#region src/extensions/workspaces/sessions/(backend)/skill/doompi-author-major-mode.mcp.ts
|
|
8
|
+
var doompi_author_major_mode_mcp_default = (0, _agimon_ai_doompi_core_mcpFacet.defineMcpSkill)({
|
|
9
|
+
name: "doompi-author-major-mode",
|
|
10
|
+
description: "Configure DoomPi default packages, layers, extensions, hook groups, and named major modes. Use when creating or editing ~/.pi/.doom/modes.yaml or a repository's .doom/modes.yaml, choosing a default mode, or diagnosing which behavior a mode activates.",
|
|
11
|
+
read: () => (0, _agimon_ai_doompi_core_serverFacet.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/doompi-author-major-mode/SKILL.md")
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region generated/mcp.ts
|
|
15
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
16
|
+
const mcp = (0, _agimon_ai_doompi_core_mcpFacet.defineMcpPlugin)({
|
|
17
|
+
name: "@agimon-ai/doompi-major-mode",
|
|
18
|
+
session: (context) => ({ get skills() {
|
|
19
|
+
return [at(doompi_author_major_mode_mcp_default, context)];
|
|
20
|
+
} })
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.default = mcp;
|
|
24
|
+
exports.mcp = mcp;
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=mcp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.cjs","names":["defineMcpSkill","readPackageResource","defineMcpPlugin","skillDoompiAuthorMajorMode"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/doompi-author-major-mode.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-author-major-mode',\n description:\n \"Configure DoomPi default packages, layers, extensions, hook groups, and named major modes. Use when creating or editing ~/.pi/.doom/modes.yaml or a repository's .doom/modes.yaml, choosing a default mode, or diagnosing which behavior a mode activates.\",\n read: () => readPackageResource(import.meta.url, 'src/prompts/doompi-author-major-mode/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 skillDoompiAuthorMajorMode from '../src/extensions/workspaces/sessions/(backend)/skill/doompi-author-major-mode.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-major-mode',\n session: (context) => ({\n get skills(): DoomMcpSessionPlugin['skills'] { return [at(skillDoompiAuthorMajorMode, context)]; },\n }) satisfies DoomMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;;;;AAGA,IAAA,wCAAA,GAAeA,gCAAAA,eAAAA,CAAe;CAC5B,MAAM;CACN,aACE;CACF,aAAA,GAAYC,mCAAAA,oBAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,MAAqC,+CAA+C;AAClG,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,sCAA4B,OAAO,CAAC;CAAG,EACnG;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../../generated/mcp.ts"],"mappings":";qBASa,+CAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineMcpPlugin, defineMcpSkill } from "@agimon-ai/doompi-core/mcpFacet";
|
|
2
|
+
import { readPackageResource } from "@agimon-ai/doompi-core/serverFacet";
|
|
3
|
+
//#region src/extensions/workspaces/sessions/(backend)/skill/doompi-author-major-mode.mcp.ts
|
|
4
|
+
var doompi_author_major_mode_mcp_default = defineMcpSkill({
|
|
5
|
+
name: "doompi-author-major-mode",
|
|
6
|
+
description: "Configure DoomPi default packages, layers, extensions, hook groups, and named major modes. Use when creating or editing ~/.pi/.doom/modes.yaml or a repository's .doom/modes.yaml, choosing a default mode, or diagnosing which behavior a mode activates.",
|
|
7
|
+
read: () => readPackageResource(import.meta.url, "src/prompts/doompi-author-major-mode/SKILL.md")
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region generated/mcp.ts
|
|
11
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
12
|
+
const mcp = defineMcpPlugin({
|
|
13
|
+
name: "@agimon-ai/doompi-major-mode",
|
|
14
|
+
session: (context) => ({ get skills() {
|
|
15
|
+
return [at(doompi_author_major_mode_mcp_default, context)];
|
|
16
|
+
} })
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { mcp as default, mcp };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=mcp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.mjs","names":["skillDoompiAuthorMajorMode"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/doompi-author-major-mode.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-author-major-mode',\n description:\n \"Configure DoomPi default packages, layers, extensions, hook groups, and named major modes. Use when creating or editing ~/.pi/.doom/modes.yaml or a repository's .doom/modes.yaml, choosing a default mode, or diagnosing which behavior a mode activates.\",\n read: () => readPackageResource(import.meta.url, 'src/prompts/doompi-author-major-mode/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 skillDoompiAuthorMajorMode from '../src/extensions/workspaces/sessions/(backend)/skill/doompi-author-major-mode.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-major-mode',\n session: (context) => ({\n get skills(): DoomMcpSessionPlugin['skills'] { return [at(skillDoompiAuthorMajorMode, context)]; },\n }) satisfies DoomMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;AAGA,IAAA,uCAAe,eAAe;CAC5B,MAAM;CACN,aACE;CACF,YAAY,oBAAoB,YAAY,KAAK,+CAA+C;AAClG,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,sCAA4B,OAAO,CAAC;CAAG,EACnG;AACF,CAAC"}
|
package/dist/extensions/pi.cjs
CHANGED
|
@@ -1 +1,468 @@
|
|
|
1
|
-
Object.defineProperties(exports,{
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
var __create = Object.create;
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
//#endregion
|
|
27
|
+
const require_telemetry = require("../telemetry-VMPKEj8y.cjs");
|
|
28
|
+
const require_majorModeText = require("../majorModeText-DBUA4b8j.cjs");
|
|
29
|
+
let _agimon_ai_doompi_core_voiceTools = require("@agimon-ai/doompi-core/voiceTools");
|
|
30
|
+
let _agimon_ai_doompi_config_piContext = require("@agimon-ai/doompi-config/piContext");
|
|
31
|
+
let _agimon_ai_doompi_core_piExtension = require("@agimon-ai/doompi-core/piExtension");
|
|
32
|
+
let _agimon_ai_doompi_core_extensionFile = require("@agimon-ai/doompi-core/extensionFile");
|
|
33
|
+
let _agimon_ai_doompi_config_harnessStore = require("@agimon-ai/doompi-config/harnessStore");
|
|
34
|
+
let _agimon_ai_doompi_core_config = require("@agimon-ai/doompi-core/config");
|
|
35
|
+
let _agimon_ai_doompi_core_transition = require("@agimon-ai/doompi-core/transition");
|
|
36
|
+
let _agimon_ai_doompi_core_voiceReloadHandoff = require("@agimon-ai/doompi-core/voiceReloadHandoff");
|
|
37
|
+
let _agimon_ai_doompi_config_majorModes = require("@agimon-ai/doompi-config/majorModes");
|
|
38
|
+
let _agimon_ai_doompi_core_childProcess = require("@agimon-ai/doompi-core/childProcess");
|
|
39
|
+
let _agimon_ai_doompi_minor_mode = require("@agimon-ai/doompi-minor-mode");
|
|
40
|
+
let _agimon_ai_doompi_minor_mode_reloadHandoff = require("@agimon-ai/doompi-minor-mode/reloadHandoff");
|
|
41
|
+
let node_fs = require("node:fs");
|
|
42
|
+
node_fs = __toESM(node_fs, 1);
|
|
43
|
+
let _agimon_ai_doompi_core_relaunchHandoff = require("@agimon-ai/doompi-core/relaunchHandoff");
|
|
44
|
+
//#region src/services/majorModeCommand/index.ts
|
|
45
|
+
function transitionError(result) {
|
|
46
|
+
return /* @__PURE__ */ new Error(`Major-mode transition was ${result.outcome}: ${result.diagnostics.join(", ")}`);
|
|
47
|
+
}
|
|
48
|
+
function createMajorModeCommand(pi, telemetry, dependencies) {
|
|
49
|
+
return [require_majorModeText.MAJOR_MODE_COMMAND, {
|
|
50
|
+
description: "Pick a named major mode",
|
|
51
|
+
handler: async (args, ctx) => {
|
|
52
|
+
let token;
|
|
53
|
+
try {
|
|
54
|
+
token = require_majorModeText.voiceSwitchToken(args);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
ctx.ui.notify(require_majorModeText.errorMessage(error), "error");
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (args.trim() && !token) {
|
|
60
|
+
ctx.ui.notify(`Usage: /${require_majorModeText.MAJOR_MODE_COMMAND}`, "warning");
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const sessionId = ctx.sessionManager.getSessionId();
|
|
64
|
+
const cordis = dependencies.cordisContext();
|
|
65
|
+
let sessionIdentity;
|
|
66
|
+
let handoff;
|
|
67
|
+
let minorModeReloadHandoff;
|
|
68
|
+
let reloadRequested = false;
|
|
69
|
+
let performRelaunch;
|
|
70
|
+
try {
|
|
71
|
+
const { config, majorMode, domains, profile } = await dependencies.currentView(ctx);
|
|
72
|
+
const names = Object.keys(config.majorMode);
|
|
73
|
+
let picked;
|
|
74
|
+
if (token) {
|
|
75
|
+
const voiceSession = (0, _agimon_ai_doompi_core_voiceTools.readDoomVoiceToolsService)(cordis)?.readSession(sessionId);
|
|
76
|
+
if (voiceSession) sessionIdentity = {
|
|
77
|
+
sessionId,
|
|
78
|
+
hostGeneration: voiceSession.hostGeneration
|
|
79
|
+
};
|
|
80
|
+
handoff = sessionIdentity ? dependencies.reloadHandoffs.accept(token, sessionIdentity) : void 0;
|
|
81
|
+
if (handoff?.kind !== "major-mode-switch" || !handoff.majorMode) throw new Error("The voice major-mode switch token is stale or belongs to another session.");
|
|
82
|
+
picked = handoff.majorMode;
|
|
83
|
+
} else {
|
|
84
|
+
const title = `Major mode (current: ${majorMode})`;
|
|
85
|
+
picked = (ctx.mode === "tui" ? await dependencies.loadPicker().then(({ MatrixPickerComponent }) => ctx.ui.custom((_tui, theme, keybindings, done) => new MatrixPickerComponent({
|
|
86
|
+
title,
|
|
87
|
+
items: require_majorModeText.majorModeItems(config, names),
|
|
88
|
+
selected: [majorMode],
|
|
89
|
+
multi: false
|
|
90
|
+
}, theme, keybindings, done))) : [require_majorModeText.optionName(await ctx.ui.select(title, names.map((name) => require_majorModeText.majorModeOptionLabel(name, config.majorMode[name]?.layers ?? [], majorMode))) ?? "")])?.[0];
|
|
91
|
+
}
|
|
92
|
+
if (!picked) return;
|
|
93
|
+
const composed = (0, _agimon_ai_doompi_core_childProcess.alreadyComposed)();
|
|
94
|
+
if (picked === majorMode) {
|
|
95
|
+
if (token && sessionIdentity) dependencies.reloadHandoffs.discard(token, sessionIdentity);
|
|
96
|
+
require_telemetry.clearPendingSelection(pi, dependencies.cordisContext());
|
|
97
|
+
ctx.ui.notify(require_majorModeText.majorModeSummary(picked, dependencies.resolveLayers(config, picked), majorMode, composed), "info");
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const coordinator = (0, _agimon_ai_doompi_core_transition.requireDoomTransitionCoordinator)(cordis);
|
|
101
|
+
const result = await coordinator.execute({
|
|
102
|
+
sessionId: ctx.sessionManager.getSessionId(),
|
|
103
|
+
hostGeneration: coordinator.hostGeneration,
|
|
104
|
+
operationId: handoff?.operationId ?? crypto.randomUUID(),
|
|
105
|
+
source: handoff ? "voice" : "command",
|
|
106
|
+
target: {
|
|
107
|
+
axis: "major-mode",
|
|
108
|
+
majorMode: picked
|
|
109
|
+
}
|
|
110
|
+
}, async (_request, plan) => {
|
|
111
|
+
const selected = [...plan.candidate.layers];
|
|
112
|
+
const stale = plan.externalRelaunchRequired;
|
|
113
|
+
const currentContextAtExecution = (0, _agimon_ai_doompi_config_piContext.requireDoomConfigContext)(cordis);
|
|
114
|
+
const harness = currentContextAtExecution.harness;
|
|
115
|
+
if (plan.strategy === "process-relaunch") {
|
|
116
|
+
const pendingSelection = {
|
|
117
|
+
version: 1,
|
|
118
|
+
operationId: plan.operationId,
|
|
119
|
+
active: require_telemetry.selectionFromSnapshot(plan.previous),
|
|
120
|
+
target: require_telemetry.selectionFromSnapshot(plan.candidate),
|
|
121
|
+
strategy: plan.strategy,
|
|
122
|
+
phase: "pending"
|
|
123
|
+
};
|
|
124
|
+
const existingPending = (0, _agimon_ai_doompi_config_piContext.requireDoomConfigContext)(cordis).pendingSelection;
|
|
125
|
+
if (existingPending) (0, _agimon_ai_doompi_config_piContext.supersedeDoomConfigTransition)(pi, existingPending);
|
|
126
|
+
(0, _agimon_ai_doompi_config_piContext.appendDoomConfigTransition)(pi, pendingSelection);
|
|
127
|
+
(0, _agimon_ai_doompi_config_piContext.replaceDoomConfigContext)(cordis, require_telemetry.bindPendingSelection((0, _agimon_ai_doompi_config_piContext.requireDoomConfigContext)(cordis), pendingSelection));
|
|
128
|
+
telemetry.recordEvent(require_telemetry.MAJOR_MODE_EVENT.majorModeSwitched, {
|
|
129
|
+
"harness.major_mode.previous": harness.majorMode,
|
|
130
|
+
"harness.major_mode": picked,
|
|
131
|
+
"harness.layers": selected.join(","),
|
|
132
|
+
"harness.major_mode.stale": true,
|
|
133
|
+
"harness.transition.disposition": plan.disposition,
|
|
134
|
+
"harness.transition.operation_id": plan.operationId
|
|
135
|
+
});
|
|
136
|
+
ctx.ui.setStatus(require_telemetry.STATUS_KEY, require_telemetry.colorStatus(ctx.ui.theme, harness.majorMode, harness.domains, harness.profile, true));
|
|
137
|
+
if (dependencies.supervisedRelaunchAvailable()) {
|
|
138
|
+
const target = picked;
|
|
139
|
+
performRelaunch = () => dependencies.requestSupervisedRelaunch(target, plan.operationId);
|
|
140
|
+
}
|
|
141
|
+
ctx.ui.notify(require_majorModeText.applySummary(picked, selected, true, composed, plan.strategy, performRelaunch !== void 0), "info");
|
|
142
|
+
return "queued";
|
|
143
|
+
}
|
|
144
|
+
const [{ applyMajorMode }, { persistHarnessSelection }] = await Promise.all([dependencies.loadSelectionSwitch(), dependencies.loadConfigJournal()]);
|
|
145
|
+
const transition = {
|
|
146
|
+
version: 1,
|
|
147
|
+
operationId: plan.operationId,
|
|
148
|
+
active: require_telemetry.selectionFromSnapshot(plan.previous),
|
|
149
|
+
target: require_telemetry.selectionFromSnapshot(plan.candidate),
|
|
150
|
+
strategy: plan.strategy ?? "pi-reload",
|
|
151
|
+
phase: "pending"
|
|
152
|
+
};
|
|
153
|
+
const activeConfig = (0, _agimon_ai_doompi_config_majorModes.loadMajorModesConfig)(harness.root ?? ctx.cwd);
|
|
154
|
+
const snapshot = (0, _agimon_ai_doompi_config_harnessStore.snapshotHarnessState)();
|
|
155
|
+
const existingPending = currentContextAtExecution.pendingSelection;
|
|
156
|
+
minorModeReloadHandoff = (0, _agimon_ai_doompi_minor_mode_reloadHandoff.prepareMinorModeReloadHandoff)(cordis, ctx.sessionManager.getSessionId(), coordinator.hostGeneration, plan.operationId, (0, _agimon_ai_doompi_minor_mode.readMinorModeCatalog)(cordis)?.getSnapshot());
|
|
157
|
+
try {
|
|
158
|
+
if (existingPending) (0, _agimon_ai_doompi_config_piContext.supersedeDoomConfigTransition)(pi, existingPending);
|
|
159
|
+
(0, _agimon_ai_doompi_config_piContext.appendDoomConfigTransition)(pi, transition);
|
|
160
|
+
persistHarnessSelection(pi, applyMajorMode(activeConfig, picked, harness, plan.candidate.compositionFingerprint, plan.candidate.childActivation));
|
|
161
|
+
} catch (error) {
|
|
162
|
+
minorModeReloadHandoff?.discard();
|
|
163
|
+
minorModeReloadHandoff = void 0;
|
|
164
|
+
try {
|
|
165
|
+
(0, _agimon_ai_doompi_config_harnessStore.restoreHarnessStateSnapshot)(snapshot);
|
|
166
|
+
} catch (compensationError) {
|
|
167
|
+
const detail = compensationError instanceof Error ? compensationError.message : String(compensationError);
|
|
168
|
+
throw new Error(`Transition failed and compensation failed: ${detail}`, { cause: error });
|
|
169
|
+
}
|
|
170
|
+
(0, _agimon_ai_doompi_config_piContext.appendDoomConfigTransition)(pi, {
|
|
171
|
+
...transition,
|
|
172
|
+
phase: "aborted"
|
|
173
|
+
});
|
|
174
|
+
if (existingPending) (0, _agimon_ai_doompi_config_piContext.appendDoomConfigTransition)(pi, existingPending);
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
telemetry.recordEvent(require_telemetry.MAJOR_MODE_EVENT.majorModeSwitched, {
|
|
178
|
+
"harness.major_mode.previous": majorMode,
|
|
179
|
+
"harness.major_mode": picked,
|
|
180
|
+
"harness.layers": selected.join(","),
|
|
181
|
+
"harness.major_mode.stale": stale,
|
|
182
|
+
"harness.transition.disposition": plan.disposition,
|
|
183
|
+
"harness.transition.operation_id": plan.operationId
|
|
184
|
+
});
|
|
185
|
+
ctx.ui.setStatus(require_telemetry.STATUS_KEY, require_telemetry.colorStatus(ctx.ui.theme, picked, domains, profile, false));
|
|
186
|
+
ctx.ui.notify(require_majorModeText.applySummary(picked, selected, false, composed, plan.strategy), "info");
|
|
187
|
+
reloadRequested = true;
|
|
188
|
+
return "applied";
|
|
189
|
+
});
|
|
190
|
+
if (result.outcome === "rejected" || result.outcome === "stale") throw transitionError(result);
|
|
191
|
+
} catch (error) {
|
|
192
|
+
reloadRequested = false;
|
|
193
|
+
performRelaunch = void 0;
|
|
194
|
+
minorModeReloadHandoff?.discard();
|
|
195
|
+
minorModeReloadHandoff = void 0;
|
|
196
|
+
if (!token) throw error;
|
|
197
|
+
if (sessionIdentity) dependencies.reloadHandoffs.discard(token, sessionIdentity);
|
|
198
|
+
ctx.ui.notify(require_majorModeText.errorMessage(error), "error");
|
|
199
|
+
}
|
|
200
|
+
if (reloadRequested) try {
|
|
201
|
+
await ctx.waitForIdle();
|
|
202
|
+
await ctx.reload();
|
|
203
|
+
} catch (error) {
|
|
204
|
+
minorModeReloadHandoff?.discard();
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
if (performRelaunch) {
|
|
208
|
+
await ctx.waitForIdle();
|
|
209
|
+
if (performRelaunch()) ctx.shutdown();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}];
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/extensions/workspaces/sessions/(backend)/_lib/relaunchRequest.ts
|
|
216
|
+
/** Whether a process supervisor is listening for relaunch requests. */
|
|
217
|
+
function supervisedRelaunchAvailable(env = process.env) {
|
|
218
|
+
return Boolean(env[_agimon_ai_doompi_core_relaunchHandoff.DOOM_RELAUNCH_FILE_ENV]);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Hands a relaunch-class major-mode switch to the process supervisor.
|
|
222
|
+
*
|
|
223
|
+
* A supervisor that owns this agent process (doompi-server) points
|
|
224
|
+
* DOOMPI_RELAUNCH_FILE at a path it watches; writing the target selection
|
|
225
|
+
* there asks it to end this agent's input for a graceful exit and respawn it
|
|
226
|
+
* with the new major mode under the same session id. Write only when the
|
|
227
|
+
* session is idle: the supervisor acts on the file as soon as it appears.
|
|
228
|
+
* Returns false when no supervisor is listening or the write fails, in which
|
|
229
|
+
* case the caller keeps the manual-relaunch message.
|
|
230
|
+
*/
|
|
231
|
+
function requestSupervisedRelaunch(majorMode, operationId, env = process.env) {
|
|
232
|
+
const file = env[_agimon_ai_doompi_core_relaunchHandoff.DOOM_RELAUNCH_FILE_ENV];
|
|
233
|
+
if (!file) return false;
|
|
234
|
+
try {
|
|
235
|
+
node_fs.default.writeFileSync(file, (0, _agimon_ai_doompi_core_relaunchHandoff.serializeRelaunchHandoff)({
|
|
236
|
+
version: 1,
|
|
237
|
+
majorMode,
|
|
238
|
+
operationId
|
|
239
|
+
}));
|
|
240
|
+
return true;
|
|
241
|
+
} catch {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/extensions/workspaces/sessions/(backend)/_lib/voiceTool.ts
|
|
247
|
+
function majorModeListing(view) {
|
|
248
|
+
return {
|
|
249
|
+
status: "listed",
|
|
250
|
+
current: view.majorMode,
|
|
251
|
+
modes: Object.entries(view.config.majorMode).map(([name, definition]) => ({
|
|
252
|
+
name,
|
|
253
|
+
description: definition.description,
|
|
254
|
+
layers: [...definition.layers]
|
|
255
|
+
}))
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The model-facing half of the axis.
|
|
260
|
+
*
|
|
261
|
+
* A switch is never applied here. It plans the transition, mints an opaque
|
|
262
|
+
* handoff token and sends `/mode --voice-switch-token=…` back as a follow-up, so
|
|
263
|
+
* the reload happens inside a command handler where it can be the terminal
|
|
264
|
+
* action.
|
|
265
|
+
*/
|
|
266
|
+
function registerMajorModeVoiceCapability(voiceTools, pi, currentView, reloadHandoffs, cordisContext) {
|
|
267
|
+
const registration = voiceTools.register({
|
|
268
|
+
descriptor: {
|
|
269
|
+
source: require_telemetry.MAJOR_MODE_SOURCE,
|
|
270
|
+
id: require_telemetry.MAJOR_MODE_VOICE_TOOL_NAME,
|
|
271
|
+
name: require_telemetry.MAJOR_MODE_VOICE_TOOL_NAME,
|
|
272
|
+
label: "Major Mode",
|
|
273
|
+
description: "List configured Doom major modes with their purpose and layers, or queue a validated mode switch.",
|
|
274
|
+
order: 10,
|
|
275
|
+
inputSchema: require_telemetry.MAJOR_MODE_VOICE_INPUT_SCHEMA,
|
|
276
|
+
resultSchema: require_telemetry.MAJOR_MODE_VOICE_RESULT_SCHEMA
|
|
277
|
+
},
|
|
278
|
+
async execute(input, execution) {
|
|
279
|
+
const params = input;
|
|
280
|
+
const view = await currentView(execution.context);
|
|
281
|
+
if (params.action === "list") return majorModeListing(view);
|
|
282
|
+
const majorMode = params.majorMode.trim();
|
|
283
|
+
if (!Object.hasOwn(view.config.majorMode, majorMode)) throw new Error(`Unknown major mode: ${majorMode}. Known major modes: ${Object.keys(view.config.majorMode).sort().join(", ")}`);
|
|
284
|
+
if (majorMode === view.majorMode) {
|
|
285
|
+
require_telemetry.clearPendingSelection(pi, cordisContext());
|
|
286
|
+
return {
|
|
287
|
+
status: "unchanged",
|
|
288
|
+
majorMode
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
const coordinator = (0, _agimon_ai_doompi_core_transition.requireDoomTransitionCoordinator)(cordisContext());
|
|
292
|
+
const transitionPlan = coordinator.plan({
|
|
293
|
+
sessionId: execution.sessionId,
|
|
294
|
+
hostGeneration: coordinator.hostGeneration,
|
|
295
|
+
operationId: execution.operationId,
|
|
296
|
+
source: "voice",
|
|
297
|
+
target: {
|
|
298
|
+
axis: "major-mode",
|
|
299
|
+
majorMode
|
|
300
|
+
},
|
|
301
|
+
signal: execution.signal
|
|
302
|
+
});
|
|
303
|
+
if (transitionPlan.disposition === "sync-required") throw new Error(`Major-mode transition requires doompi sync: ${transitionPlan.diagnostics.join(", ")}`);
|
|
304
|
+
const reloadHandoff = reloadHandoffs.prepare({
|
|
305
|
+
active: !execution.signal.aborted,
|
|
306
|
+
sessionId: execution.sessionId,
|
|
307
|
+
hostGeneration: execution.hostGeneration
|
|
308
|
+
}, {
|
|
309
|
+
operationId: execution.operationId,
|
|
310
|
+
kind: require_telemetry.MAJOR_MODE_SWITCH_HANDOFF_KIND,
|
|
311
|
+
majorMode
|
|
312
|
+
});
|
|
313
|
+
try {
|
|
314
|
+
pi.sendUserMessage.bind(pi)(`/${require_majorModeText.MAJOR_MODE_COMMAND} ${require_majorModeText.VOICE_SWITCH_TOKEN_PREFIX}${reloadHandoff.token}`, {
|
|
315
|
+
deliverAs: "followUp",
|
|
316
|
+
expandPromptTemplates: true
|
|
317
|
+
});
|
|
318
|
+
} catch (error) {
|
|
319
|
+
reloadHandoff.discard();
|
|
320
|
+
throw error;
|
|
321
|
+
}
|
|
322
|
+
return {
|
|
323
|
+
status: "queued",
|
|
324
|
+
majorMode,
|
|
325
|
+
stopBatch: "session-reload"
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
return () => registration.dispose();
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/extensions/workspaces/sessions/(backend)/_lib/majorModeRuntime.ts
|
|
333
|
+
/**
|
|
334
|
+
* Everything the axis needs beyond the session, loaded on first use.
|
|
335
|
+
*
|
|
336
|
+
* Every session registers /mode, but most never run it, so the picker, the
|
|
337
|
+
* switch and the journal stay off the startup path.
|
|
338
|
+
*/
|
|
339
|
+
function lazyModules() {
|
|
340
|
+
let config;
|
|
341
|
+
let journal;
|
|
342
|
+
let picker;
|
|
343
|
+
let selection;
|
|
344
|
+
return {
|
|
345
|
+
config: () => config ??= import("@agimon-ai/doompi-config/majorModes"),
|
|
346
|
+
journal: () => journal ??= import("@agimon-ai/doompi-config/piContext"),
|
|
347
|
+
picker: () => picker ??= import("@agimon-ai/doompi-ui/matrixPicker"),
|
|
348
|
+
selection: () => selection ??= import("@agimon-ai/doompi-config/selectionSwitch")
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function createMajorModeRuntime({ pi, telemetry }) {
|
|
352
|
+
const load = lazyModules();
|
|
353
|
+
let activeContext;
|
|
354
|
+
let runtimeInjection;
|
|
355
|
+
const bindRuntime = (cordis) => {
|
|
356
|
+
runtimeInjection = cordis.inject([_agimon_ai_doompi_core_config.DOOM_CONFIG_SERVICE, _agimon_ai_doompi_core_transition.DOOM_TRANSITION_SERVICE], (context) => {
|
|
357
|
+
activeContext = context;
|
|
358
|
+
return () => {
|
|
359
|
+
if (activeContext === context) activeContext = void 0;
|
|
360
|
+
};
|
|
361
|
+
});
|
|
362
|
+
};
|
|
363
|
+
const requireRuntimeContext = () => {
|
|
364
|
+
if (!activeContext) throw new Error("Doom major-mode runtime is waiting for the session config service.");
|
|
365
|
+
return activeContext;
|
|
366
|
+
};
|
|
367
|
+
const currentView = async (_ctx) => {
|
|
368
|
+
const state = (0, _agimon_ai_doompi_config_piContext.requireDoomConfigContext)(requireRuntimeContext()).harness;
|
|
369
|
+
const { loadMajorModesConfig } = await load.config();
|
|
370
|
+
return {
|
|
371
|
+
config: loadMajorModesConfig((0, _agimon_ai_doompi_config_harnessStore.requireHarnessRoot)(state)),
|
|
372
|
+
majorMode: state.majorMode,
|
|
373
|
+
domains: state.domains,
|
|
374
|
+
profile: state.profile
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
const reloadHandoffs = (0, _agimon_ai_doompi_core_voiceReloadHandoff.createVoiceReloadHandoffStore)({
|
|
378
|
+
now: () => Date.now(),
|
|
379
|
+
createToken: () => crypto.randomUUID()
|
|
380
|
+
});
|
|
381
|
+
const bindVoice = (cordis) => {
|
|
382
|
+
cordis.inject([
|
|
383
|
+
_agimon_ai_doompi_core_config.DOOM_CONFIG_SERVICE,
|
|
384
|
+
_agimon_ai_doompi_core_transition.DOOM_TRANSITION_SERVICE,
|
|
385
|
+
_agimon_ai_doompi_core_voiceTools.DOOM_VOICE_TOOLS_SERVICE
|
|
386
|
+
], (voiceContext) => registerMajorModeVoiceCapability((0, _agimon_ai_doompi_core_voiceTools.requireDoomVoiceToolsService)(voiceContext), pi, currentView, reloadHandoffs, () => voiceContext));
|
|
387
|
+
};
|
|
388
|
+
return {
|
|
389
|
+
services: [bindRuntime, bindVoice],
|
|
390
|
+
commands: [createMajorModeCommand(pi, telemetry, {
|
|
391
|
+
cordisContext: requireRuntimeContext,
|
|
392
|
+
currentView,
|
|
393
|
+
reloadHandoffs,
|
|
394
|
+
loadPicker: load.picker,
|
|
395
|
+
loadSelectionSwitch: load.selection,
|
|
396
|
+
loadConfigJournal: load.journal,
|
|
397
|
+
resolveLayers: (config, majorMode) => [...config.majorMode[majorMode]?.layers ?? []],
|
|
398
|
+
supervisedRelaunchAvailable,
|
|
399
|
+
requestSupervisedRelaunch
|
|
400
|
+
})],
|
|
401
|
+
events: { session_start: async (_event, ctx) => {
|
|
402
|
+
await runtimeInjection?.await();
|
|
403
|
+
try {
|
|
404
|
+
const { majorMode, domains, profile } = (0, _agimon_ai_doompi_config_piContext.requireDoomConfigContext)(requireRuntimeContext()).harness;
|
|
405
|
+
ctx.ui.setStatus(require_telemetry.STATUS_KEY, require_telemetry.colorStatus(ctx.ui.theme, majorMode, domains, profile, false));
|
|
406
|
+
} catch (error) {
|
|
407
|
+
telemetry.recordError(require_telemetry.MAJOR_MODE_EVENT.majorModeUnavailable, error);
|
|
408
|
+
ctx.ui.setStatus(require_telemetry.STATUS_KEY, `major mode unavailable (${error instanceof Error ? error.message : String(error)})`);
|
|
409
|
+
}
|
|
410
|
+
} }
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/extensions/workspaces/sessions/(backend)/root.cli.ts
|
|
415
|
+
var root_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoot)(({ pi, options }) => {
|
|
416
|
+
const runtime = createMajorModeRuntime({
|
|
417
|
+
pi,
|
|
418
|
+
telemetry: options ?? require_telemetry.createMajorModeTelemetry()
|
|
419
|
+
});
|
|
420
|
+
return {
|
|
421
|
+
value: runtime,
|
|
422
|
+
services: runtime.services,
|
|
423
|
+
onStop: runtime.onStop,
|
|
424
|
+
onDispose: runtime.onDispose
|
|
425
|
+
};
|
|
426
|
+
});
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/extensions/workspaces/sessions/(backend)/command/majorMode.cli.ts
|
|
429
|
+
var majorMode_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineCliCommand)((context) => context.root.commands[0]);
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.ts
|
|
432
|
+
var sessionStart_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineCliHook)((context) => context.root.events.session_start);
|
|
433
|
+
//#endregion
|
|
434
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/doompiAuthorMajorMode.cli.ts
|
|
435
|
+
var doompiAuthorMajorMode_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineResource)({
|
|
436
|
+
source: require_telemetry.MAJOR_MODE_SOURCE,
|
|
437
|
+
moduleUrl: require("url").pathToFileURL(__filename).href,
|
|
438
|
+
skills: [{
|
|
439
|
+
name: "doompi-author-major-mode",
|
|
440
|
+
description: "Configure DoomPi default packages, layers, extensions, hook groups, and named major modes. Use when creating or editing ~/.pi/.doom/modes.yaml or a repository's .doom/modes.yaml, choosing a default mode, or diagnosing which behavior a mode activates."
|
|
441
|
+
}]
|
|
442
|
+
});
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region generated/pi.ts
|
|
445
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
446
|
+
const extension = (0, _agimon_ai_doompi_core_piExtension.definePiExtension)("@agimon-ai/doompi-major-mode", async (context) => {
|
|
447
|
+
const scopeSession = await root_cli_default(context);
|
|
448
|
+
const contextSession = {
|
|
449
|
+
...context,
|
|
450
|
+
root: scopeSession.value
|
|
451
|
+
};
|
|
452
|
+
return {
|
|
453
|
+
...(0, _agimon_ai_doompi_core_extensionFile.composeRootHooks)(scopeSession),
|
|
454
|
+
get commands() {
|
|
455
|
+
return [at(majorMode_cli_default, contextSession)];
|
|
456
|
+
},
|
|
457
|
+
events: { session_start: at(sessionStart_cli_default, contextSession) },
|
|
458
|
+
get resources() {
|
|
459
|
+
return [at(doompiAuthorMajorMode_cli_default, contextSession)];
|
|
460
|
+
},
|
|
461
|
+
services: [...scopeSession.services ?? []]
|
|
462
|
+
};
|
|
463
|
+
});
|
|
464
|
+
//#endregion
|
|
465
|
+
exports.default = extension;
|
|
466
|
+
exports.extension = extension;
|
|
467
|
+
|
|
468
|
+
//# sourceMappingURL=pi.cjs.map
|