@agimon-ai/doompi-notification 0.0.1-alpha.57 → 0.0.1-alpha.58
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/pi.cjs +260 -14
- package/dist/extensions/pi.cjs.map +1 -1
- package/dist/extensions/pi.d.mts +2 -2
- package/dist/extensions/pi.d.mts.map +1 -1
- package/dist/extensions/pi.mjs +252 -7
- package/dist/extensions/pi.mjs.map +1 -1
- package/dist/extensions/server.cjs +20 -4
- 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 +18 -2
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/index-xcDR9yL0.d.mts +116 -0
- package/dist/index-xcDR9yL0.d.mts.map +1 -0
- package/dist/index.cjs +13 -16
- package/dist/index.d.mts +1 -5
- package/dist/index.mjs +1 -4
- package/dist/notificationPolicy-DMx0HQZ1.mjs +272 -0
- package/dist/notificationPolicy-DMx0HQZ1.mjs.map +1 -0
- package/dist/notificationPolicy-HT5zVaqJ.cjs +372 -0
- package/dist/notificationPolicy-HT5zVaqJ.cjs.map +1 -0
- package/package.json +12 -12
- package/dist/_virtual/_rolldown/runtime.cjs +0 -23
- 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/pi.d.cts +0 -6
- 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 -6
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/notificationCommand.cjs +0 -16
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/notificationCommand.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/notificationCommand.mjs +0 -17
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/notificationCommand.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/command/notify.server.cjs +0 -7
- package/dist/src/extensions/workspaces/sessions/(backend)/command/notify.server.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/command/notify.server.mjs +0 -8
- package/dist/src/extensions/workspaces/sessions/(backend)/command/notify.server.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/agentSettled.cli.cjs +0 -6
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/agentSettled.cli.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/agentSettled.cli.mjs +0 -7
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/agentSettled.cli.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/agentStart.cli.cjs +0 -6
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/agentStart.cli.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/agentStart.cli.mjs +0 -7
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/agentStart.cli.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/input.cli.cjs +0 -6
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/input.cli.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/input.cli.mjs +0 -7
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/input.cli.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.cjs +0 -6
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.mjs +0 -7
- package/dist/src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs +0 -23
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs +0 -23
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.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/notificationPolicy/index.cjs +0 -32
- package/dist/src/services/notificationPolicy/index.cjs.map +0 -1
- package/dist/src/services/notificationPolicy/index.d.cts +0 -27
- package/dist/src/services/notificationPolicy/index.d.cts.map +0 -1
- package/dist/src/services/notificationPolicy/index.d.mts +0 -27
- package/dist/src/services/notificationPolicy/index.d.mts.map +0 -1
- package/dist/src/services/notificationPolicy/index.mjs +0 -29
- package/dist/src/services/notificationPolicy/index.mjs.map +0 -1
- package/dist/src/services/notificationRouter/index.cjs +0 -43
- package/dist/src/services/notificationRouter/index.cjs.map +0 -1
- package/dist/src/services/notificationRouter/index.mjs +0 -41
- package/dist/src/services/notificationRouter/index.mjs.map +0 -1
- package/dist/src/services/notificationRuntime/index.cjs +0 -190
- package/dist/src/services/notificationRuntime/index.cjs.map +0 -1
- package/dist/src/services/notificationRuntime/index.mjs +0 -190
- package/dist/src/services/notificationRuntime/index.mjs.map +0 -1
- package/dist/src/services/notificationText/index.cjs +0 -63
- package/dist/src/services/notificationText/index.cjs.map +0 -1
- package/dist/src/services/notificationText/index.d.cts +0 -27
- package/dist/src/services/notificationText/index.d.cts.map +0 -1
- package/dist/src/services/notificationText/index.d.mts +0 -27
- package/dist/src/services/notificationText/index.d.mts.map +0 -1
- package/dist/src/services/notificationText/index.mjs +0 -57
- package/dist/src/services/notificationText/index.mjs.map +0 -1
- package/dist/src/services/shellTitleController/index.cjs +0 -149
- package/dist/src/services/shellTitleController/index.cjs.map +0 -1
- package/dist/src/services/shellTitleController/index.d.cts +0 -12
- package/dist/src/services/shellTitleController/index.d.cts.map +0 -1
- package/dist/src/services/shellTitleController/index.d.mts +0 -12
- package/dist/src/services/shellTitleController/index.d.mts.map +0 -1
- package/dist/src/services/shellTitleController/index.mjs +0 -148
- package/dist/src/services/shellTitleController/index.mjs.map +0 -1
- package/dist/src/services/systemNotification/index.cjs +0 -48
- package/dist/src/services/systemNotification/index.cjs.map +0 -1
- package/dist/src/services/systemNotification/index.d.cts +0 -12
- package/dist/src/services/systemNotification/index.d.cts.map +0 -1
- package/dist/src/services/systemNotification/index.d.mts +0 -12
- package/dist/src/services/systemNotification/index.d.mts.map +0 -1
- package/dist/src/services/systemNotification/index.mjs +0 -48
- package/dist/src/services/systemNotification/index.mjs.map +0 -1
- package/dist/src/types/notifications.d.cts +0 -44
- package/dist/src/types/notifications.d.cts.map +0 -1
- package/dist/src/types/notifications.d.mts +0 -44
- package/dist/src/types/notifications.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/pi.cjs
CHANGED
|
@@ -2,30 +2,276 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
let
|
|
5
|
+
const require_notificationPolicy = require("../notificationPolicy-HT5zVaqJ.cjs");
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_notificationPolicy.__toESM(node_path, 1);
|
|
8
|
+
let _agimon_ai_doompi_core_piExtension = require("@agimon-ai/doompi-core/piExtension");
|
|
9
|
+
let _agimon_ai_doompi_core_extensionFile = require("@agimon-ai/doompi-core/extensionFile");
|
|
10
|
+
let _agimon_ai_doompi_core_childProcess = require("@agimon-ai/doompi-core/childProcess");
|
|
11
|
+
let _agimon_ai_doompi_core_askUser = require("@agimon-ai/doompi-core/askUser");
|
|
12
|
+
let _agimon_ai_doompi_core_cordisHost = require("@agimon-ai/doompi-core/cordisHost");
|
|
13
|
+
let _agimon_ai_doompi_core_notification = require("@agimon-ai/doompi-core/notification");
|
|
14
|
+
//#region src/services/notificationRouter/index.ts
|
|
15
|
+
const DEFAULT_TITLE = "Pi";
|
|
16
|
+
/**
|
|
17
|
+
* Creates the shared notification router for one extension runtime.
|
|
18
|
+
*
|
|
19
|
+
* A missing session, invalid request, or delivery failure is an intentional
|
|
20
|
+
* silent outcome because notification delivery must never fail the active turn.
|
|
21
|
+
* RPC delivery never falls back to a host notifier after an append failure.
|
|
22
|
+
*/
|
|
23
|
+
function createDoomNotificationRouter({ generation, pi, context: readContext }) {
|
|
24
|
+
return Object.freeze({
|
|
25
|
+
generation,
|
|
26
|
+
async request(request) {
|
|
27
|
+
const context = readContext();
|
|
28
|
+
if (!context) return;
|
|
29
|
+
try {
|
|
30
|
+
const normalized = (0, _agimon_ai_doompi_core_notification.normalizeDoomNotificationRequest)(request);
|
|
31
|
+
if (!normalized) return;
|
|
32
|
+
const data = (0, _agimon_ai_doompi_core_notification.createDoomNotificationEntryData)({
|
|
33
|
+
title: normalized.title ?? DEFAULT_TITLE,
|
|
34
|
+
subtitle: normalized.subtitle ?? pi.getSessionName() ?? node_path.default.basename(context.cwd),
|
|
35
|
+
body: normalized.body,
|
|
36
|
+
level: normalized.level ?? "info"
|
|
37
|
+
});
|
|
38
|
+
if (!data) return;
|
|
39
|
+
if (context.mode === "rpc") {
|
|
40
|
+
pi.appendEntry(_agimon_ai_doompi_core_notification.DOOM_NOTIFICATION_ENTRY_TYPE, data);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
await require_notificationPolicy.sendSystemNotification(pi, data);
|
|
44
|
+
} catch (error) {}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/services/notificationRuntime/index.ts
|
|
50
|
+
const AGENT_SETTLED_EVENT = "agent_settled";
|
|
51
|
+
const AGENT_START_EVENT = "agent_start";
|
|
52
|
+
const EXTENSION_INPUT_SOURCE = "extension";
|
|
53
|
+
const INPUT_EVENT = "input";
|
|
54
|
+
const SESSION_START_EVENT = "session_start";
|
|
55
|
+
const ORIGINAL_UI_METHOD = Symbol.for("@agimon-ai/doompi-notification/original-ui-method");
|
|
56
|
+
/** Capture the true host method even when another bundle copy currently owns the UI. */
|
|
57
|
+
function captureUiMethod(ui, method) {
|
|
58
|
+
let captured = ui[method];
|
|
59
|
+
const seen = /* @__PURE__ */ new Set();
|
|
60
|
+
while (typeof captured === "function" && !seen.has(captured)) {
|
|
61
|
+
seen.add(captured);
|
|
62
|
+
const original = Reflect.get(captured, ORIGINAL_UI_METHOD);
|
|
63
|
+
if (typeof original !== "function") break;
|
|
64
|
+
captured = original;
|
|
65
|
+
}
|
|
66
|
+
return captured;
|
|
67
|
+
}
|
|
68
|
+
function tagUiWrapper(wrapper, original) {
|
|
69
|
+
Reflect.defineProperty(wrapper, ORIGINAL_UI_METHOD, {
|
|
70
|
+
configurable: false,
|
|
71
|
+
enumerable: false,
|
|
72
|
+
value: original,
|
|
73
|
+
writable: false
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Routes UI notices and announces dialogs the agent opens on its own initiative.
|
|
78
|
+
* Dialog wrappers preserve the original behavior. The notice wrapper replaces
|
|
79
|
+
* host delivery while this plugin owns the UI and restores its exact identity.
|
|
80
|
+
*/
|
|
81
|
+
function wrapUiNotifications(ui, isActive, shouldNotifyAttention, notifyAttention, notify) {
|
|
82
|
+
const originalConfirm = captureUiMethod(ui, "confirm");
|
|
83
|
+
const wrappedConfirm = (title, message, options) => {
|
|
84
|
+
if (shouldNotifyAttention()) notifyAttention(`${title}: ${message}`);
|
|
85
|
+
return originalConfirm.call(ui, title, message, options);
|
|
86
|
+
};
|
|
87
|
+
tagUiWrapper(wrappedConfirm, originalConfirm);
|
|
88
|
+
ui.confirm = wrappedConfirm;
|
|
89
|
+
const originalSelect = captureUiMethod(ui, "select");
|
|
90
|
+
const wrappedSelect = (title, options, dialogOptions) => {
|
|
91
|
+
if (shouldNotifyAttention()) notifyAttention(title);
|
|
92
|
+
return originalSelect.call(ui, title, options, dialogOptions);
|
|
93
|
+
};
|
|
94
|
+
tagUiWrapper(wrappedSelect, originalSelect);
|
|
95
|
+
ui.select = wrappedSelect;
|
|
96
|
+
const originalInput = captureUiMethod(ui, "input");
|
|
97
|
+
const wrappedInput = (title, placeholder, options) => {
|
|
98
|
+
if (shouldNotifyAttention()) notifyAttention(title);
|
|
99
|
+
return originalInput.call(ui, title, placeholder, options);
|
|
100
|
+
};
|
|
101
|
+
tagUiWrapper(wrappedInput, originalInput);
|
|
102
|
+
ui.input = wrappedInput;
|
|
103
|
+
const originalEditor = captureUiMethod(ui, "editor");
|
|
104
|
+
const wrappedEditor = (title, prefill) => {
|
|
105
|
+
if (shouldNotifyAttention()) notifyAttention(title);
|
|
106
|
+
return originalEditor.call(ui, title, prefill);
|
|
107
|
+
};
|
|
108
|
+
tagUiWrapper(wrappedEditor, originalEditor);
|
|
109
|
+
ui.editor = wrappedEditor;
|
|
110
|
+
const originalNotify = captureUiMethod(ui, "notify");
|
|
111
|
+
const wrappedNotify = (message, level) => {
|
|
112
|
+
if (isActive()) notify(message, level);
|
|
113
|
+
else originalNotify.call(ui, message, level);
|
|
114
|
+
};
|
|
115
|
+
tagUiWrapper(wrappedNotify, originalNotify);
|
|
116
|
+
ui.notify = wrappedNotify;
|
|
117
|
+
return () => {
|
|
118
|
+
if (ui.confirm === wrappedConfirm) ui.confirm = originalConfirm;
|
|
119
|
+
if (ui.select === wrappedSelect) ui.select = originalSelect;
|
|
120
|
+
if (ui.input === wrappedInput) ui.input = originalInput;
|
|
121
|
+
if (ui.editor === wrappedEditor) ui.editor = originalEditor;
|
|
122
|
+
if (ui.notify === wrappedNotify) ui.notify = originalNotify;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function createNotificationRuntime({ generation, pi, options }) {
|
|
126
|
+
let activeContext;
|
|
127
|
+
const router = createDoomNotificationRouter({
|
|
128
|
+
generation,
|
|
129
|
+
pi,
|
|
130
|
+
context: () => activeContext
|
|
131
|
+
});
|
|
132
|
+
const titles = options.titleController ?? require_notificationPolicy.createWorkerTitleController();
|
|
133
|
+
const wrappedUis = /* @__PURE__ */ new Map();
|
|
134
|
+
let active = true;
|
|
135
|
+
let agentRunning = false;
|
|
136
|
+
let askUserBlocked = false;
|
|
137
|
+
let firstPrompt;
|
|
138
|
+
let surface;
|
|
139
|
+
const idleTitle = (cwd) => require_notificationPolicy.shellTabTitle({
|
|
140
|
+
cwd,
|
|
141
|
+
sessionName: pi.getSessionName(),
|
|
142
|
+
prompt: firstPrompt
|
|
143
|
+
});
|
|
144
|
+
const titleSurface = (context) => {
|
|
145
|
+
if (!active || !require_notificationPolicy.supportsShellTitle(context)) return void 0;
|
|
146
|
+
surface = {
|
|
147
|
+
cwd: context.cwd,
|
|
148
|
+
write: (title) => context.ui.setTitle(title)
|
|
149
|
+
};
|
|
150
|
+
return surface;
|
|
151
|
+
};
|
|
152
|
+
const notifyAttention = (body) => {
|
|
153
|
+
if (active) router.request(require_notificationPolicy.attentionNotification(body));
|
|
154
|
+
};
|
|
155
|
+
const stop = () => {
|
|
156
|
+
active = false;
|
|
157
|
+
agentRunning = false;
|
|
158
|
+
askUserBlocked = false;
|
|
159
|
+
for (const restore of wrappedUis.values()) restore();
|
|
160
|
+
wrappedUis.clear();
|
|
161
|
+
if (surface) titles.dispose(idleTitle(surface.cwd), surface.write);
|
|
162
|
+
surface = void 0;
|
|
163
|
+
activeContext = void 0;
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
services: [(cordis) => {
|
|
167
|
+
cordis.plugin((providerContext) => {
|
|
168
|
+
providerContext.provide(_agimon_ai_doompi_core_notification.DOOM_NOTIFICATION_SERVICE, router);
|
|
169
|
+
});
|
|
170
|
+
cordis.inject([_agimon_ai_doompi_core_cordisHost.DOOM_CORDIS_SESSION_SERVICE], (sessionContext) => {
|
|
171
|
+
const context = sessionContext.get(_agimon_ai_doompi_core_cordisHost.DOOM_CORDIS_SESSION_SERVICE).context;
|
|
172
|
+
activeContext = context;
|
|
173
|
+
return () => {
|
|
174
|
+
if (activeContext === context) activeContext = void 0;
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
cordis.effect(() => cordis.on(_agimon_ai_doompi_core_askUser.DOOM_ASK_USER_PROMPT_EVENT, (prompt) => {
|
|
178
|
+
notifyAttention(require_notificationPolicy.askUserPromptBody(prompt.questions));
|
|
179
|
+
}));
|
|
180
|
+
cordis.effect(() => cordis.on(_agimon_ai_doompi_core_askUser.DOOM_ASK_USER_BLOCKED_EVENT, (payload) => {
|
|
181
|
+
askUserBlocked = payload.active;
|
|
182
|
+
}));
|
|
183
|
+
}],
|
|
184
|
+
onStop: stop,
|
|
185
|
+
onDispose: stop,
|
|
186
|
+
events: {
|
|
187
|
+
[INPUT_EVENT]: (event, context) => {
|
|
188
|
+
if (!active || firstPrompt || event.source === EXTENSION_INPUT_SOURCE) return;
|
|
189
|
+
activeContext = context;
|
|
190
|
+
firstPrompt = require_notificationPolicy.promptTitle(event.text);
|
|
191
|
+
const target = firstPrompt ? titleSurface(context) : void 0;
|
|
192
|
+
if (target) titles.set(idleTitle(target.cwd), target.write);
|
|
193
|
+
},
|
|
194
|
+
[SESSION_START_EVENT]: (_event, context) => {
|
|
195
|
+
if (!active || wrappedUis.has(context.ui)) return;
|
|
196
|
+
activeContext = context;
|
|
197
|
+
wrappedUis.set(context.ui, wrapUiNotifications(context.ui, () => active, () => active && require_notificationPolicy.warrantsAttentionNotification({
|
|
198
|
+
agentRunning,
|
|
199
|
+
askUserBlocked
|
|
200
|
+
}), notifyAttention, (body, level) => void router.request({
|
|
201
|
+
body,
|
|
202
|
+
...level ? { level } : {}
|
|
203
|
+
})));
|
|
204
|
+
},
|
|
205
|
+
[AGENT_START_EVENT]: (_event, context) => {
|
|
206
|
+
if (!active) return;
|
|
207
|
+
activeContext = context;
|
|
208
|
+
agentRunning = true;
|
|
209
|
+
const target = titleSurface(context);
|
|
210
|
+
if (target) titles.start(idleTitle(target.cwd), target.write);
|
|
211
|
+
},
|
|
212
|
+
[AGENT_SETTLED_EVENT]: async (_event, context) => {
|
|
213
|
+
if (!active) return;
|
|
214
|
+
activeContext = context;
|
|
215
|
+
agentRunning = false;
|
|
216
|
+
askUserBlocked = false;
|
|
217
|
+
const target = titleSurface(context);
|
|
218
|
+
if (target) titles.stop(idleTitle(target.cwd), target.write);
|
|
219
|
+
if (!require_notificationPolicy.warrantsSettledNotification(context.hasPendingMessages())) return;
|
|
220
|
+
await router.request(require_notificationPolicy.settledNotification({
|
|
221
|
+
cwd: context.cwd,
|
|
222
|
+
sessionName: pi.getSessionName()
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/extensions/workspaces/sessions/(backend)/root.cli.ts
|
|
230
|
+
var root_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoot)((context) => {
|
|
231
|
+
if ((context.options?.environment ?? process.env)[_agimon_ai_doompi_core_childProcess.SUBAGENT_CHILD_ENV]) return { value: void 0 };
|
|
232
|
+
if (!context.runtime) throw new Error("This Pi extension requires the Cordis runtime metadata.");
|
|
233
|
+
const runtime = createNotificationRuntime({
|
|
234
|
+
pi: context.pi,
|
|
235
|
+
options: context.options ?? {},
|
|
236
|
+
generation: `${context.runtime.generation}:notification`
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
value: runtime,
|
|
240
|
+
services: runtime.services,
|
|
241
|
+
onStop: runtime.onStop,
|
|
242
|
+
onDispose: runtime.onDispose
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/agentSettled.cli.ts
|
|
247
|
+
var agentSettled_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoutedContribution)((context) => context.root?.events?.agent_settled, { cardinality: "optional" });
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/agentStart.cli.ts
|
|
250
|
+
var agentStart_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoutedContribution)((context) => context.root?.events?.agent_start, { cardinality: "optional" });
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/input.cli.ts
|
|
253
|
+
var input_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoutedContribution)((context) => context.root?.events?.input, { cardinality: "optional" });
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.ts
|
|
256
|
+
var sessionStart_cli_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoutedContribution)((context) => context.root?.events?.session_start, { cardinality: "optional" });
|
|
257
|
+
//#endregion
|
|
12
258
|
//#region generated/pi.ts
|
|
13
259
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
14
260
|
/* v8 ignore next -- generated normalization branch */
|
|
15
261
|
const keyed = (key, value) => value === void 0 ? {} : { [key]: value };
|
|
16
|
-
const extension = (0,
|
|
17
|
-
const scopeSession = await
|
|
262
|
+
const extension = (0, _agimon_ai_doompi_core_piExtension.definePiExtension)("@agimon-ai/doompi-notification", async (context) => {
|
|
263
|
+
const scopeSession = await root_cli_default(context);
|
|
18
264
|
const contextSession = {
|
|
19
265
|
...context,
|
|
20
266
|
root: scopeSession.value
|
|
21
267
|
};
|
|
22
268
|
return {
|
|
23
|
-
...(0,
|
|
269
|
+
...(0, _agimon_ai_doompi_core_extensionFile.composeRootHooks)(scopeSession),
|
|
24
270
|
events: {
|
|
25
|
-
...keyed("agent_settled", at(
|
|
26
|
-
...keyed("agent_start", at(
|
|
27
|
-
...keyed("input", at(
|
|
28
|
-
...keyed("session_start", at(
|
|
271
|
+
...keyed("agent_settled", at(agentSettled_cli_default, contextSession)),
|
|
272
|
+
...keyed("agent_start", at(agentStart_cli_default, contextSession)),
|
|
273
|
+
...keyed("input", at(input_cli_default, contextSession)),
|
|
274
|
+
...keyed("session_start", at(sessionStart_cli_default, contextSession))
|
|
29
275
|
},
|
|
30
276
|
services: [...scopeSession.services ?? []]
|
|
31
277
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.cjs","names":["definePiExtension","rootSession","composeRootHooks","hookAgentSettled","hookAgentStart","hookInput","hookSessionStart"],"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/pi-extension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport hookAgentSettled from '../src/extensions/workspaces/sessions/(backend)/hook/agentSettled.cli';\nimport hookAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/agentStart.cli';\nimport hookInput from '../src/extensions/workspaces/sessions/(backend)/hook/input.cli';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof hookAgentSettled> | OptionsOf<typeof hookAgentStart> | OptionsOf<typeof hookInput> | OptionsOf<typeof hookSessionStart>, 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/* v8 ignore next -- generated normalization branch */\nconst keyed = <T>(key: string, value: T | undefined): Record<string, T> =>\n value === undefined ? {} : { [key]: value };\n\nexport const extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-notification', async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n events: {\n ...keyed('agent_settled', at(hookAgentSettled, contextSession) as NonNullable<PiPluginContributions['events']>['agent_settled']),\n ...keyed('agent_start', at(hookAgentStart, contextSession) as NonNullable<PiPluginContributions['events']>['agent_start']),\n ...keyed('input', at(hookInput, contextSession) as NonNullable<PiPluginContributions['events']>['input']),\n ...keyed('session_start', at(hookSessionStart, contextSession) as NonNullable<PiPluginContributions['events']>['session_start']),\n },\n services: [...(scopeSession.services ?? [])],\n };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;;AAEpE,MAAM,SAAY,KAAa,UAC7B,UAAU,KAAA,IAAY,CAAC,IAAI,GAAG,MAAM,MAAM;AAE5C,MAAa,aAAA,GAAYA,oCAAAA,kBAAAA,CAAoC,kCAAkC,OAAO,YAAY;CAChH,MAAM,eAAe,MAAMC,iBAAAA,QAAY,OAAO;CAC9C,MAAM,iBAAiB;EAAE,GAAG;EAAS,MAAM,aAAa;CAAM;CAC9D,OAAO;EACL,IAAA,GAAGC,sCAAAA,iBAAAA,CAAiB,YAAY;EAChC,QAAQ;GACN,GAAG,MAAM,iBAAiB,GAAGC,yBAAAA,SAAkB,cAAc,CAAkE;GAC/H,GAAG,MAAM,eAAe,GAAGC,uBAAAA,SAAgB,cAAc,CAAgE;GACzH,GAAG,MAAM,SAAS,GAAGC,kBAAAA,SAAW,cAAc,CAA0D;GACxG,GAAG,MAAM,iBAAiB,GAAGC,yBAAAA,SAAkB,cAAc,CAAkE;EACjI;EACA,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;CAC7C;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"pi.cjs","names":["normalizeDoomNotificationRequest","createDoomNotificationEntryData","path","DOOM_NOTIFICATION_ENTRY_TYPE","sendSystemNotification","createWorkerTitleController","shellTabTitle","supportsShellTitle","attentionNotification","DOOM_NOTIFICATION_SERVICE","DOOM_CORDIS_SESSION_SERVICE","DOOM_ASK_USER_PROMPT_EVENT","askUserPromptBody","DOOM_ASK_USER_BLOCKED_EVENT","promptTitle","warrantsAttentionNotification","warrantsSettledNotification","settledNotification","defineRoot","SUBAGENT_CHILD_ENV","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","definePiExtension","rootSession","composeRootHooks","hookAgentSettled","hookAgentStart","hookInput","hookSessionStart"],"sources":["../../src/services/notificationRouter/index.ts","../../src/services/notificationRuntime/index.ts","../../src/extensions/workspaces/sessions/(backend)/root.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/agentSettled.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/agentStart.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/input.cli.ts","../../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli.ts","../../generated/pi.ts"],"sourcesContent":["import path from 'node:path';\n\nimport {\n createDoomNotificationEntryData,\n DOOM_NOTIFICATION_ENTRY_TYPE,\n type DoomNotificationRequest,\n type DoomNotificationService,\n normalizeDoomNotificationRequest,\n} from '@agimon-ai/doompi-core/notification';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\n\nimport { sendSystemNotification } from '../systemNotification';\n\nconst DEFAULT_TITLE = 'Pi';\n\nexport interface DoomNotificationRouterOptions {\n readonly generation: string;\n readonly pi: ExtensionAPI;\n readonly context: () => ExtensionContext | undefined;\n}\n\n/**\n * Creates the shared notification router for one extension runtime.\n *\n * A missing session, invalid request, or delivery failure is an intentional\n * silent outcome because notification delivery must never fail the active turn.\n * RPC delivery never falls back to a host notifier after an append failure.\n */\nexport function createDoomNotificationRouter({\n generation,\n pi,\n context: readContext,\n}: DoomNotificationRouterOptions): DoomNotificationService {\n return Object.freeze({\n generation,\n async request(request: DoomNotificationRequest): Promise<void> {\n const context = readContext();\n if (!context) return;\n\n try {\n const normalized = normalizeDoomNotificationRequest(request);\n if (!normalized) return;\n const data = createDoomNotificationEntryData({\n title: normalized.title ?? DEFAULT_TITLE,\n subtitle: normalized.subtitle ?? pi.getSessionName() ?? path.basename(context.cwd),\n body: normalized.body,\n level: normalized.level ?? 'info',\n });\n if (!data) return;\n\n if (context.mode === 'rpc') {\n pi.appendEntry(DOOM_NOTIFICATION_ENTRY_TYPE, data);\n return;\n }\n await sendSystemNotification(pi, data);\n } catch (error) {\n // Best-effort delivery deliberately ends here. In particular, an RPC\n // append failure must not leak the notification through the host OS.\n void error;\n }\n },\n });\n}\n","import { DOOM_ASK_USER_BLOCKED_EVENT, DOOM_ASK_USER_PROMPT_EVENT } from '@agimon-ai/doompi-core/askUser';\nimport { DOOM_CORDIS_SESSION_SERVICE, type DoomCordisSessionService } from '@agimon-ai/doompi-core/cordisHost';\nimport { DOOM_NOTIFICATION_SERVICE, type DoomNotificationLevel } from '@agimon-ai/doompi-core/notification';\nimport type { PiPluginContributions } from '@agimon-ai/doompi-core/piExtension';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext, ExtensionUIContext } from '@earendil-works/pi-coding-agent';\n\nimport type { NotificationExtensionOptions, WriteTitle } from '../../types/notifications';\nimport {\n askUserPromptBody,\n supportsShellTitle,\n warrantsAttentionNotification,\n warrantsSettledNotification,\n} from '../notificationPolicy';\nimport { createDoomNotificationRouter } from '../notificationRouter';\nimport { attentionNotification, promptTitle, settledNotification, shellTabTitle } from '../notificationText';\nimport { createWorkerTitleController } from '../shellTitleController';\n\nconst AGENT_SETTLED_EVENT = 'agent_settled';\nconst AGENT_START_EVENT = 'agent_start';\nconst EXTENSION_INPUT_SOURCE = 'extension';\nconst INPUT_EVENT = 'input';\nconst SESSION_START_EVENT = 'session_start';\n\n/** Where the tab title is written, remembered so shutdown can restore it without an event. */\ninterface TitleSurface {\n cwd: string;\n write: WriteTitle;\n}\n\ntype WrappedUiMethod = 'confirm' | 'editor' | 'input' | 'notify' | 'select';\n\nconst ORIGINAL_UI_METHOD = Symbol.for('@agimon-ai/doompi-notification/original-ui-method');\n\n/** Capture the true host method even when another bundle copy currently owns the UI. */\nfunction captureUiMethod<Method extends WrappedUiMethod>(\n ui: ExtensionUIContext,\n method: Method,\n): ExtensionUIContext[Method] {\n let captured: unknown = ui[method];\n const seen = new Set<unknown>();\n while (typeof captured === 'function' && !seen.has(captured)) {\n seen.add(captured);\n const original = Reflect.get(captured, ORIGINAL_UI_METHOD) as unknown;\n if (typeof original !== 'function') break;\n captured = original;\n }\n return captured as ExtensionUIContext[Method];\n}\n\nfunction tagUiWrapper(wrapper: object, original: object): void {\n Reflect.defineProperty(wrapper, ORIGINAL_UI_METHOD, {\n configurable: false,\n enumerable: false,\n value: original,\n writable: false,\n });\n}\n\n/**\n * Routes UI notices and announces dialogs the agent opens on its own initiative.\n * Dialog wrappers preserve the original behavior. The notice wrapper replaces\n * host delivery while this plugin owns the UI and restores its exact identity.\n */\nfunction wrapUiNotifications(\n ui: ExtensionUIContext,\n isActive: () => boolean,\n shouldNotifyAttention: () => boolean,\n notifyAttention: (body: string) => void,\n notify: (body: string, level?: DoomNotificationLevel) => void,\n): () => void {\n const originalConfirm = captureUiMethod(ui, 'confirm');\n const wrappedConfirm: ExtensionUIContext['confirm'] = (title, message, options) => {\n if (shouldNotifyAttention()) notifyAttention(`${title}: ${message}`);\n return originalConfirm.call(ui, title, message, options);\n };\n tagUiWrapper(wrappedConfirm, originalConfirm);\n ui.confirm = wrappedConfirm;\n\n const originalSelect = captureUiMethod(ui, 'select');\n const wrappedSelect: ExtensionUIContext['select'] = (title, options, dialogOptions) => {\n if (shouldNotifyAttention()) notifyAttention(title);\n return originalSelect.call(ui, title, options, dialogOptions);\n };\n tagUiWrapper(wrappedSelect, originalSelect);\n ui.select = wrappedSelect;\n\n const originalInput = captureUiMethod(ui, 'input');\n const wrappedInput: ExtensionUIContext['input'] = (title, placeholder, options) => {\n if (shouldNotifyAttention()) notifyAttention(title);\n return originalInput.call(ui, title, placeholder, options);\n };\n tagUiWrapper(wrappedInput, originalInput);\n ui.input = wrappedInput;\n\n const originalEditor = captureUiMethod(ui, 'editor');\n const wrappedEditor: ExtensionUIContext['editor'] = (title, prefill) => {\n if (shouldNotifyAttention()) notifyAttention(title);\n return originalEditor.call(ui, title, prefill);\n };\n tagUiWrapper(wrappedEditor, originalEditor);\n ui.editor = wrappedEditor;\n\n const originalNotify = captureUiMethod(ui, 'notify');\n const wrappedNotify: ExtensionUIContext['notify'] = (message, level) => {\n if (isActive()) notify(message, level);\n else originalNotify.call(ui, message, level);\n };\n tagUiWrapper(wrappedNotify, originalNotify);\n ui.notify = wrappedNotify;\n\n return () => {\n if (ui.confirm === wrappedConfirm) ui.confirm = originalConfirm;\n if (ui.select === wrappedSelect) ui.select = originalSelect;\n if (ui.input === wrappedInput) ui.input = originalInput;\n if (ui.editor === wrappedEditor) ui.editor = originalEditor;\n if (ui.notify === wrappedNotify) ui.notify = originalNotify;\n };\n}\n\ninterface NotificationPluginConfig {\n readonly generation: string;\n readonly pi: ExtensionAPI;\n readonly options: NotificationExtensionOptions;\n}\n\nexport function createNotificationRuntime({\n generation,\n pi,\n options,\n}: NotificationPluginConfig): PiPluginContributions<NotificationExtensionOptions> {\n let activeContext: ExtensionContext | undefined;\n const router = createDoomNotificationRouter({ generation, pi, context: () => activeContext });\n\n const titles = options.titleController ?? createWorkerTitleController();\n const wrappedUis = new Map<ExtensionUIContext, () => void>();\n let active = true;\n let agentRunning = false;\n let askUserBlocked = false;\n let firstPrompt: string | undefined;\n let surface: TitleSurface | undefined;\n\n const idleTitle = (cwd: string): string =>\n shellTabTitle({ cwd, sessionName: pi.getSessionName(), prompt: firstPrompt });\n const titleSurface = (context: ExtensionContext): TitleSurface | undefined => {\n if (!active || !supportsShellTitle(context)) return undefined;\n surface = { cwd: context.cwd, write: (title) => context.ui.setTitle(title) };\n return surface;\n };\n const notifyAttention = (body: string): void => {\n if (active) void router.request(attentionNotification(body));\n };\n\n const stop = (): void => {\n active = false;\n agentRunning = false;\n askUserBlocked = false;\n for (const restore of wrappedUis.values()) restore();\n wrappedUis.clear();\n if (surface) titles.dispose(idleTitle(surface.cwd), surface.write);\n surface = undefined;\n activeContext = undefined;\n };\n return {\n services: [\n (cordis: Context) => {\n cordis.plugin((providerContext) => {\n providerContext.provide(DOOM_NOTIFICATION_SERVICE, router);\n });\n cordis.inject([DOOM_CORDIS_SESSION_SERVICE], (sessionContext) => {\n const session = sessionContext.get(DOOM_CORDIS_SESSION_SERVICE) as DoomCordisSessionService;\n const context = session.context;\n activeContext = context;\n return () => {\n if (activeContext === context) activeContext = undefined;\n };\n });\n cordis.effect(() =>\n cordis.on(DOOM_ASK_USER_PROMPT_EVENT, (prompt) => {\n notifyAttention(askUserPromptBody(prompt.questions));\n }),\n );\n cordis.effect(() =>\n cordis.on(DOOM_ASK_USER_BLOCKED_EVENT, (payload) => {\n askUserBlocked = payload.active;\n }),\n );\n },\n ],\n onStop: stop,\n onDispose: stop,\n events: {\n [INPUT_EVENT]: (event, context) => {\n if (!active || firstPrompt || event.source === EXTENSION_INPUT_SOURCE) return;\n activeContext = context;\n firstPrompt = promptTitle(event.text);\n const target = firstPrompt ? titleSurface(context) : undefined;\n if (target) titles.set(idleTitle(target.cwd), target.write);\n },\n [SESSION_START_EVENT]: (_event, context) => {\n if (!active || wrappedUis.has(context.ui)) return;\n activeContext = context;\n wrappedUis.set(\n context.ui,\n wrapUiNotifications(\n context.ui,\n () => active,\n () => active && warrantsAttentionNotification({ agentRunning, askUserBlocked }),\n notifyAttention,\n (body, level) => void router.request({ body, ...(level ? { level } : {}) }),\n ),\n );\n },\n [AGENT_START_EVENT]: (_event, context) => {\n if (!active) return;\n activeContext = context;\n agentRunning = true;\n const target = titleSurface(context);\n if (target) titles.start(idleTitle(target.cwd), target.write);\n },\n [AGENT_SETTLED_EVENT]: async (_event, context) => {\n if (!active) return;\n activeContext = context;\n agentRunning = false;\n askUserBlocked = false;\n const target = titleSurface(context);\n if (target) titles.stop(idleTitle(target.cwd), target.write);\n if (!warrantsSettledNotification(context.hasPendingMessages())) return;\n await router.request(settledNotification({ cwd: context.cwd, sessionName: pi.getSessionName() }));\n },\n },\n };\n}\n","import { SUBAGENT_CHILD_ENV } from '@agimon-ai/doompi-core/childProcess';\nimport { defineRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport { createNotificationRuntime } from '../../../../services/notificationRuntime';\nimport type { NotificationExtensionOptions } from '../../../../types/notifications';\nexport default defineRoot((context: PiPluginContext<NotificationExtensionOptions>) => {\n if ((context.options?.environment ?? process.env)[SUBAGENT_CHILD_ENV]) return { value: undefined };\n if (!context.runtime) throw new Error('This Pi extension requires the Cordis runtime metadata.');\n const runtime = createNotificationRuntime({\n pi: context.pi,\n options: context.options ?? {},\n generation: `${context.runtime.generation}:notification`,\n });\n return { value: runtime, services: runtime.services, onStop: runtime.onStop, onDispose: runtime.onDispose };\n});\n","import { defineRoutedContribution } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport { createNotificationRuntime } from '../../../../../services/notificationRuntime';\nexport default defineRoutedContribution(\n (context: WithRoot<PiPluginContext<unknown>, ReturnType<typeof createNotificationRuntime> | undefined>) =>\n context.root?.events?.agent_settled,\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport { createNotificationRuntime } from '../../../../../services/notificationRuntime';\nexport default defineRoutedContribution(\n (context: WithRoot<PiPluginContext<unknown>, ReturnType<typeof createNotificationRuntime> | undefined>) =>\n context.root?.events?.agent_start,\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport { createNotificationRuntime } from '../../../../../services/notificationRuntime';\nexport default defineRoutedContribution(\n (context: WithRoot<PiPluginContext<unknown>, ReturnType<typeof createNotificationRuntime> | undefined>) =>\n context.root?.events?.input,\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution } from '@agimon-ai/doompi-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { PiPluginContext } from '@agimon-ai/doompi-core/piExtension';\n\nimport { createNotificationRuntime } from '../../../../../services/notificationRuntime';\nexport default defineRoutedContribution(\n (context: WithRoot<PiPluginContext<unknown>, ReturnType<typeof createNotificationRuntime> | undefined>) =>\n context.root?.events?.session_start,\n { cardinality: 'optional' },\n);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/piExtension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport hookAgentSettled from '../src/extensions/workspaces/sessions/(backend)/hook/agentSettled.cli';\nimport hookAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/agentStart.cli';\nimport hookInput from '../src/extensions/workspaces/sessions/(backend)/hook/input.cli';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof hookAgentSettled> | OptionsOf<typeof hookAgentStart> | OptionsOf<typeof hookInput> | OptionsOf<typeof hookSessionStart>, 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/* v8 ignore next -- generated normalization branch */\nconst keyed = <T>(key: string, value: T | undefined): Record<string, T> =>\n value === undefined ? {} : { [key]: value };\n\nexport const extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-notification', async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n events: {\n ...keyed('agent_settled', at(hookAgentSettled, contextSession) as NonNullable<PiPluginContributions['events']>['agent_settled']),\n ...keyed('agent_start', at(hookAgentStart, contextSession) as NonNullable<PiPluginContributions['events']>['agent_start']),\n ...keyed('input', at(hookInput, contextSession) as NonNullable<PiPluginContributions['events']>['input']),\n ...keyed('session_start', at(hookSessionStart, contextSession) as NonNullable<PiPluginContributions['events']>['session_start']),\n },\n services: [...(scopeSession.services ?? [])],\n };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAM,gBAAgB;;;;;;;;AAetB,SAAgB,6BAA6B,EAC3C,YACA,IACA,SAAS,eACgD;CACzD,OAAO,OAAO,OAAO;EACnB;EACA,MAAM,QAAQ,SAAiD;GAC7D,MAAM,UAAU,YAAY;GAC5B,IAAI,CAAC,SAAS;GAEd,IAAI;IACF,MAAM,cAAA,GAAaA,oCAAAA,iCAAAA,CAAiC,OAAO;IAC3D,IAAI,CAAC,YAAY;IACjB,MAAM,QAAA,GAAOC,oCAAAA,gCAAAA,CAAgC;KAC3C,OAAO,WAAW,SAAS;KAC3B,UAAU,WAAW,YAAY,GAAG,eAAe,KAAKC,UAAAA,QAAK,SAAS,QAAQ,GAAG;KACjF,MAAM,WAAW;KACjB,OAAO,WAAW,SAAS;IAC7B,CAAC;IACD,IAAI,CAAC,MAAM;IAEX,IAAI,QAAQ,SAAS,OAAO;KAC1B,GAAG,YAAYC,oCAAAA,8BAA8B,IAAI;KACjD;IACF;IACA,MAAMC,2BAAAA,uBAAuB,IAAI,IAAI;GACvC,SAAS,OAAO,CAIhB;EACF;CACF,CAAC;AACH;;;AC5CA,MAAM,sBAAsB;AAC5B,MAAM,oBAAoB;AAC1B,MAAM,yBAAyB;AAC/B,MAAM,cAAc;AACpB,MAAM,sBAAsB;AAU5B,MAAM,qBAAqB,OAAO,IAAI,mDAAmD;;AAGzF,SAAS,gBACP,IACA,QAC4B;CAC5B,IAAI,WAAoB,GAAG;CAC3B,MAAM,uBAAO,IAAI,IAAa;CAC9B,OAAO,OAAO,aAAa,cAAc,CAAC,KAAK,IAAI,QAAQ,GAAG;EAC5D,KAAK,IAAI,QAAQ;EACjB,MAAM,WAAW,QAAQ,IAAI,UAAU,kBAAkB;EACzD,IAAI,OAAO,aAAa,YAAY;EACpC,WAAW;CACb;CACA,OAAO;AACT;AAEA,SAAS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BAAAA,EACZ,YACC,QAAQ,MAAM,QAAQ,eACxB,EAAE,aAAa,WAAW,CAC5B;;;ACQA,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;;AAEpE,MAAM,SAAY,KAAa,UAC7B,UAAU,KAAA,IAAY,CAAC,IAAI,GAAG,MAAM,MAAM;AAE5C,MAAa,aAAA,GAAYC,mCAAAA,kBAAAA,CAAoC,kCAAkC,OAAO,YAAY;CAChH,MAAM,eAAe,MAAMC,iBAAY,OAAO;CAC9C,MAAM,iBAAiB;EAAE,GAAG;EAAS,MAAM,aAAa;CAAM;CAC9D,OAAO;EACL,IAAA,GAAGC,qCAAAA,iBAAAA,CAAiB,YAAY;EAChC,QAAQ;GACN,GAAG,MAAM,iBAAiB,GAAGC,0BAAkB,cAAc,CAAkE;GAC/H,GAAG,MAAM,eAAe,GAAGC,wBAAgB,cAAc,CAAgE;GACzH,GAAG,MAAM,SAAS,GAAGC,mBAAW,cAAc,CAA0D;GACxG,GAAG,MAAM,iBAAiB,GAAGC,0BAAkB,cAAc,CAAkE;EACjI;EACA,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;CAC7C;AACF,CAAC"}
|
package/dist/extensions/pi.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NotificationExtensionOptions } from "../
|
|
1
|
+
import { _ as NotificationExtensionOptions } from "../index-xcDR9yL0.mjs";
|
|
2
2
|
//#region generated/pi.d.ts
|
|
3
|
-
export declare const extension: import("@agimon-ai/doompi-core/
|
|
3
|
+
export declare const extension: import("@agimon-ai/doompi-core/runtimePiExtension").DefinedPiExtension<NotificationExtensionOptions>;
|
|
4
4
|
//#endregion
|
|
5
5
|
export { extension as default };
|
|
6
6
|
//# sourceMappingURL=pi.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.mts","names":[],"sources":["../../generated/pi.ts"],"mappings":";;qBAuBa,
|
|
1
|
+
{"version":3,"file":"pi.d.mts","names":[],"sources":["../../generated/pi.ts"],"mappings":";;qBAuBa,+DAAS,mBAAT"}
|