@agimon-ai/doompi-notification 0.0.1-alpha.6 → 0.0.1-alpha.60

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.
Files changed (77) hide show
  1. package/README.md +62 -13
  2. package/dist/apiContracts.cjs +17 -0
  3. package/dist/apiContracts.cjs.map +1 -0
  4. package/dist/apiContracts.d.mts +53 -0
  5. package/dist/apiContracts.d.mts.map +1 -0
  6. package/dist/apiContracts.mjs +13 -0
  7. package/dist/apiContracts.mjs.map +1 -0
  8. package/dist/extensions/pi.cjs +283 -1
  9. package/dist/extensions/pi.cjs.map +1 -0
  10. package/dist/extensions/pi.d.mts +6 -2
  11. package/dist/extensions/pi.d.mts.map +1 -0
  12. package/dist/extensions/pi.mjs +277 -1
  13. package/dist/extensions/pi.mjs.map +1 -0
  14. package/dist/extensions/server.cjs +39 -0
  15. package/dist/extensions/server.cjs.map +1 -0
  16. package/dist/extensions/server.d.mts +5 -0
  17. package/dist/extensions/server.d.mts.map +1 -0
  18. package/dist/extensions/server.mjs +34 -0
  19. package/dist/extensions/server.mjs.map +1 -0
  20. package/dist/index-xcDR9yL0.d.mts +116 -0
  21. package/dist/index-xcDR9yL0.d.mts.map +1 -0
  22. package/dist/index.cjs +14 -1
  23. package/dist/index.d.mts +2 -7
  24. package/dist/index.mjs +2 -1
  25. package/dist/notificationPolicy-DMx0HQZ1.mjs +272 -0
  26. package/dist/notificationPolicy-DMx0HQZ1.mjs.map +1 -0
  27. package/dist/notificationPolicy-HT5zVaqJ.cjs +372 -0
  28. package/dist/notificationPolicy-HT5zVaqJ.cjs.map +1 -0
  29. package/llms.txt +2 -2
  30. package/package.json +41 -10
  31. package/dist/_virtual/_rolldown/runtime.cjs +0 -1
  32. package/dist/adapters/pi/extension.cjs +0 -2
  33. package/dist/adapters/pi/extension.cjs.map +0 -1
  34. package/dist/adapters/pi/extension.d.cts +0 -13
  35. package/dist/adapters/pi/extension.d.cts.map +0 -1
  36. package/dist/adapters/pi/extension.d.mts +0 -13
  37. package/dist/adapters/pi/extension.d.mts.map +0 -1
  38. package/dist/adapters/pi/extension.mjs +0 -2
  39. package/dist/adapters/pi/extension.mjs.map +0 -1
  40. package/dist/adapters/shellTitleController.cjs +0 -27
  41. package/dist/adapters/shellTitleController.cjs.map +0 -1
  42. package/dist/adapters/shellTitleController.d.cts +0 -13
  43. package/dist/adapters/shellTitleController.d.cts.map +0 -1
  44. package/dist/adapters/shellTitleController.d.mts +0 -13
  45. package/dist/adapters/shellTitleController.d.mts.map +0 -1
  46. package/dist/adapters/shellTitleController.mjs +0 -27
  47. package/dist/adapters/shellTitleController.mjs.map +0 -1
  48. package/dist/adapters/systemNotification.cjs +0 -2
  49. package/dist/adapters/systemNotification.cjs.map +0 -1
  50. package/dist/adapters/systemNotification.d.cts +0 -14
  51. package/dist/adapters/systemNotification.d.cts.map +0 -1
  52. package/dist/adapters/systemNotification.d.mts +0 -14
  53. package/dist/adapters/systemNotification.d.mts.map +0 -1
  54. package/dist/adapters/systemNotification.mjs +0 -2
  55. package/dist/adapters/systemNotification.mjs.map +0 -1
  56. package/dist/extensions/pi.d.cts +0 -2
  57. package/dist/index.d.cts +0 -7
  58. package/dist/services/notificationPolicy.cjs +0 -2
  59. package/dist/services/notificationPolicy.cjs.map +0 -1
  60. package/dist/services/notificationPolicy.d.cts +0 -28
  61. package/dist/services/notificationPolicy.d.cts.map +0 -1
  62. package/dist/services/notificationPolicy.d.mts +0 -28
  63. package/dist/services/notificationPolicy.d.mts.map +0 -1
  64. package/dist/services/notificationPolicy.mjs +0 -2
  65. package/dist/services/notificationPolicy.mjs.map +0 -1
  66. package/dist/services/notificationText.cjs +0 -2
  67. package/dist/services/notificationText.cjs.map +0 -1
  68. package/dist/services/notificationText.d.cts +0 -28
  69. package/dist/services/notificationText.d.cts.map +0 -1
  70. package/dist/services/notificationText.d.mts +0 -28
  71. package/dist/services/notificationText.d.mts.map +0 -1
  72. package/dist/services/notificationText.mjs +0 -2
  73. package/dist/services/notificationText.mjs.map +0 -1
  74. package/dist/types/notifications.d.cts +0 -33
  75. package/dist/types/notifications.d.cts.map +0 -1
  76. package/dist/types/notifications.d.mts +0 -33
  77. package/dist/types/notifications.d.mts.map +0 -1
package/README.md CHANGED
@@ -1,22 +1,62 @@
1
1
  # @agimon-ai/doompi-notification
2
2
 
3
- Desktop notifications and an animated shell-tab title for
3
+ System and browser notifications, plus an animated shell-tab title, for
4
4
  [DoomPi](https://www.npmjs.com/package/@agimon-ai/doompi) sessions.
5
5
 
6
- Long agent runs are worth walking away from. This package makes that safe: the terminal tab says
7
- what the session is doing at a glance, and the desktop says when the agent has stopped and why.
6
+ Long agent runs are worth walking away from. This package owns the shared `doom/notification` service,
7
+ routes each request for the active session, and announces when the agent needs attention.
8
8
 
9
9
  ## What it does
10
10
 
11
- | Surface | Behaviour |
12
- | ---------------- | ----------------------------------------------------------------------------------------------------- |
13
- | Shell tab title | `π - <session or first prompt> - <repository>`, with a braille spinner while the agent works |
14
- | Desktop, mid-run | one notification per dialog the agent opens on its own initiative, and per `ask_user_question` prompt |
15
- | Desktop, at rest | one notification when a run settles with nothing queued behind it |
11
+ | Surface | Behavior |
12
+ | ---------------- | -------------------------------------------------------------------------------------------- |
13
+ | Shell tab title | `π - <session or first prompt> - <repository>`, with a braille spinner while the agent works |
14
+ | Notification API | caller-authored notices through the shared `doom/notification` Cordis service |
15
+ | Mid-run | one notification for each agent-initiated dialog and each `ask_user_question` prompt |
16
+ | At rest | one notification when a run settles with nothing queued behind it |
16
17
 
17
- Notifications go to `cmux notify` first, because it routes them back to the window the session
18
- lives in. On macOS a missing `cmux` falls back to `osascript`. Any other host stays silent rather
19
- than failing the turn.
18
+ In an interactive terminal session, requests use `cmux notify` first because it routes them back to
19
+ the session window. On macOS, a missing `cmux` falls back to `osascript`. In RPC mode, requests become
20
+ versioned `doom-notification` session entries for a live client such as `doompi-web`. An RPC append
21
+ failure stays silent and never falls back to a host notifier. Hosts without a supported notifier also
22
+ stay silent.
23
+
24
+ ## Service usage
25
+
26
+ Callers should discover the optional service through Cordis and request delivery without depending on
27
+ a particular host:
28
+
29
+ ```ts
30
+ import { DOOM_NOTIFICATION_SERVICE, readDoomNotificationService } from '@agimon-ai/doompi-core/notification';
31
+
32
+ ctx.inject([DOOM_NOTIFICATION_SERVICE], (notificationContext) => {
33
+ void readDoomNotificationService(notificationContext)?.request({
34
+ body: 'Deployment needs approval',
35
+ level: 'warning',
36
+ });
37
+ });
38
+ ```
39
+
40
+ `body` is required. `title`, `subtitle`, and `level` are optional, and `level` accepts `info`,
41
+ `warning`, or `error`. The router defaults the title to `Pi`, the subtitle to the session name or
42
+ working-directory basename, and the level to `info`. Invalid requests, missing active sessions,
43
+ unavailable providers, and delivery failures are silent so notifications cannot fail an agent turn.
44
+
45
+ The package also wraps Pi's broad `ui.notify(message, level)` API while active, so existing extensions
46
+ use the same route without changing their calls. If this package is muted or the process is a detached
47
+ subagent child, it does not install that wrapper and Pi's original `ui.notify` behavior remains.
48
+
49
+ ## Browser delivery
50
+
51
+ `doompi-web` shows full notification text only for entries received by a currently open page. Every connected
52
+ page receives live notification entries for every attached session, not only the focused session. Permission
53
+ is requested only from an explicit settings action.
54
+
55
+ A paired installed PWA may also opt into live Web Push while closed. That payload is fixed generic copy with
56
+ `TTL: 0`; it contains no session, prompt, response, or file data. The host keeps subscriptions only in memory,
57
+ so there is no durable database, outbox, replay, or delivery of historical entries. The open app re-registers
58
+ a browser-held subscription after a host restart. Device revocation or expiry, remote shutdown, browser
59
+ disable, and expired provider endpoints remove the live subscription.
20
60
 
21
61
  ## The shell title
22
62
 
@@ -29,8 +69,8 @@ escape sequences never end up in machine-read output.
29
69
 
30
70
  ## Quiet by design
31
71
 
32
- - A detached subagent (`PI_SUBAGENT_CHILD`) registers nothing. It shares its parent's terminal and
33
- desktop, and a second voice reporting the same run is noise.
72
+ - A detached subagent (`PI_SUBAGENT_CHILD`) does not register this package's service or wrappers. It
73
+ shares its parent's terminal and desktop, and a second voice reporting the same run is noise.
34
74
  - Dialogs only notify while the agent holds the turn. A dialog the user opened is already in front
35
75
  of them.
36
76
  - An `ask_user_question` prompt notifies from its own event, and the dialog it then opens stays
@@ -42,6 +82,15 @@ escape sequences never end up in machine-read output.
42
82
  DoomPi depends on this package and activates it as fixed host core, so a DoomPi install already has
43
83
  it. It is not selectable from `.doom/modes.yaml`.
44
84
 
85
+ The Pi and server loaders use `/extensions/pi` and `/extensions/server`, built directly from
86
+ `src/extensions`. The root export contains reusable notification helpers and types.
87
+ Controllers own delivery and UI integration; policy and text services live in named service folders.
88
+
89
+ The Pi declaration installs its router and optional session binding before handling events.
90
+ `onStop` restores the original UI methods and shell title before service registrations are removed.
91
+ `onDispose` provides the same cleanup after partial startup. Detached children return before
92
+ acquiring a Cordis connection, leaving notification ownership with the parent.
93
+
45
94
  ## License
46
95
 
47
96
  MIT
@@ -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"}
@@ -1 +1,283 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../adapters/pi/extension.cjs");exports.default=e.default,exports.notificationExtension=e.default;
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
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
258
+ //#region generated/pi.ts
259
+ const at = (value, context) => typeof value === "function" ? value(context) : value;
260
+ /* v8 ignore next -- generated normalization branch */
261
+ const keyed = (key, value) => value === void 0 ? {} : { [key]: value };
262
+ const extension = (0, _agimon_ai_doompi_core_piExtension.definePiExtension)("@agimon-ai/doompi-notification", async (context) => {
263
+ const scopeSession = await root_cli_default(context);
264
+ const contextSession = {
265
+ ...context,
266
+ root: scopeSession.value
267
+ };
268
+ return {
269
+ ...(0, _agimon_ai_doompi_core_extensionFile.composeRootHooks)(scopeSession),
270
+ events: {
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))
275
+ },
276
+ services: [...scopeSession.services ?? []]
277
+ };
278
+ });
279
+ //#endregion
280
+ exports.default = extension;
281
+ exports.extension = extension;
282
+
283
+ //# sourceMappingURL=pi.cjs.map
@@ -0,0 +1 @@
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,WA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AA,EACZ,YACC,QAAQ,MAAM,QAAQ,OACxB,EAAE,aAAa,WAAW,CAC5B;;;ACJA,IAAA,4BAAA,GAAeC,qCAAAA,yBAAAA,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"}
@@ -1,2 +1,6 @@
1
- import notificationExtension from "../adapters/pi/extension.mjs";
2
- export { notificationExtension as default, notificationExtension };
1
+ import { _ as NotificationExtensionOptions } from "../index-xcDR9yL0.mjs";
2
+ //#region generated/pi.d.ts
3
+ export declare const extension: import("@agimon-ai/doompi-core/runtimePiExtension").DefinedPiExtension<NotificationExtensionOptions>;
4
+ //#endregion
5
+ export { extension as default };
6
+ //# sourceMappingURL=pi.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.d.mts","names":[],"sources":["../../generated/pi.ts"],"mappings":";;qBAuBa,+DAAS,mBAAT"}