@agimon-ai/po-notification 0.0.0-alpha.193 → 0.0.0-alpha.195
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -149
- package/README.md +1 -1
- package/dist/index.cjs +8 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -10
- package/dist/index.mjs.map +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/package.json +8 -8
package/LICENSE
CHANGED
|
@@ -1,149 +1,21 @@
|
|
|
1
|
-
License
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
other Organization. Use by an individual in the course of employment
|
|
23
|
-
or engagement by an Organization is use by that Organization.
|
|
24
|
-
|
|
25
|
-
(b) Small Organization Use. Use by or on behalf of an Organization whose
|
|
26
|
-
Annual Revenue is less than USD 1,000,000.
|
|
27
|
-
|
|
28
|
-
(c) Non-profit, Education and Research Use. Use, regardless of Annual
|
|
29
|
-
Revenue, by (i) an Organization registered or recognized as a
|
|
30
|
-
non-profit or charitable organization under the laws of its
|
|
31
|
-
jurisdiction, for its non-profit purposes; (ii) an accredited school,
|
|
32
|
-
college, or university, for teaching, learning, or academic research;
|
|
33
|
-
or (iii) a publicly funded research institution, for its research.
|
|
34
|
-
|
|
35
|
-
(d) Service Provider Use. Use by a consultant, contractor, agency, or other
|
|
36
|
-
service provider, regardless of its own Annual Revenue, solely to
|
|
37
|
-
build, deploy, host, operate, or support the Licensed Work for a client
|
|
38
|
-
whose own use would be Eligible Use under (a), (b), or (c). A service
|
|
39
|
-
provider's use for its own purposes is Eligible Use only if the service
|
|
40
|
-
provider itself qualifies under (b) or (c).
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Hosted services. Offering the Licensed Work to third parties as a hosted
|
|
44
|
-
or managed service whose primary value is the Licensed Work is Eligible
|
|
45
|
-
Use only if each such third party's own use would be Eligible Use.
|
|
46
|
-
|
|
47
|
-
Definitions. "Organization" means any company, partnership, sole
|
|
48
|
-
proprietorship, trust, association, government body, or other entity, and
|
|
49
|
-
includes an individual acting in a business or professional capacity.
|
|
50
|
-
"Affiliate" means any entity that directly or indirectly controls, is
|
|
51
|
-
controlled by, or is under common control with an Organization, where
|
|
52
|
-
"control" means ownership of more than 50% of the voting interests of an
|
|
53
|
-
entity or the power to direct its management and policies by contract or
|
|
54
|
-
otherwise. "Annual Revenue" means the total gross revenue of an
|
|
55
|
-
Organization and all of its Affiliates combined, from all sources and
|
|
56
|
-
whether or not related to the Licensed Work, for its most recently
|
|
57
|
-
completed fiscal year, or, if it has not completed a fiscal year, for the
|
|
58
|
-
twelve months before the use (or since its formation, if shorter),
|
|
59
|
-
converted into US dollars at the average exchange rate for that period.
|
|
60
|
-
Proceeds of equity or debt financing are not revenue.
|
|
61
|
-
|
|
62
|
-
Threshold. If an Organization stops qualifying under (b), its existing
|
|
63
|
-
production use remains Eligible Use for 90 days after it stops
|
|
64
|
-
qualifying, after which it must obtain a commercial license or stop
|
|
65
|
-
production use. Use that was Eligible Use when it occurred never requires
|
|
66
|
-
a commercial license after the fact.
|
|
67
|
-
Change Date: Four years from the date a version of the Licensed Work
|
|
68
|
-
is first publicly released by the Licensor.
|
|
69
|
-
Change License: Apache License, Version 2.0
|
|
70
|
-
|
|
71
|
-
For information about alternative licensing arrangements for the Licensed
|
|
72
|
-
Work, please visit: https://agimon.ai/licensing
|
|
73
|
-
|
|
74
|
-
Notice
|
|
75
|
-
|
|
76
|
-
The Business Source License (this document, or the "License") is not an Open
|
|
77
|
-
Source license. However, the Licensed Work will eventually be made available
|
|
78
|
-
under an Open Source License, as stated in this License.
|
|
79
|
-
|
|
80
|
-
-----------------------------------------------------------------------------
|
|
81
|
-
|
|
82
|
-
Business Source License 1.1
|
|
83
|
-
|
|
84
|
-
Terms
|
|
85
|
-
|
|
86
|
-
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
87
|
-
works, redistribute, and make non-production use of the Licensed Work. The
|
|
88
|
-
Licensor may make an Additional Use Grant, above, permitting limited
|
|
89
|
-
production use.
|
|
90
|
-
|
|
91
|
-
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
92
|
-
available distribution of a specific version of the Licensed Work under this
|
|
93
|
-
License, whichever comes first, the Licensor hereby grants you rights under
|
|
94
|
-
the terms of the Change License, and the rights granted in the paragraph
|
|
95
|
-
above terminate.
|
|
96
|
-
|
|
97
|
-
If your use of the Licensed Work does not comply with the requirements
|
|
98
|
-
currently in effect as described in this License, you must purchase a
|
|
99
|
-
commercial license from the Licensor, its affiliated entities, or authorized
|
|
100
|
-
resellers, or you must refrain from using the Licensed Work.
|
|
101
|
-
|
|
102
|
-
All copies of the original and modified Licensed Work, and derivative works
|
|
103
|
-
of the Licensed Work, are subject to this License. This License applies
|
|
104
|
-
separately for each version of the Licensed Work and the Change Date may vary
|
|
105
|
-
for each version of the Licensed Work released by Licensor.
|
|
106
|
-
|
|
107
|
-
You must conspicuously display this License on each original or modified copy
|
|
108
|
-
of the Licensed Work. If you receive the Licensed Work in original or
|
|
109
|
-
modified form from a third party, the terms and conditions set forth in this
|
|
110
|
-
License apply to your use of that work.
|
|
111
|
-
|
|
112
|
-
Any use of the Licensed Work in violation of this License will automatically
|
|
113
|
-
terminate your rights under this License for the current and all other
|
|
114
|
-
versions of the Licensed Work.
|
|
115
|
-
|
|
116
|
-
This License does not grant you any right in any trademark or logo of
|
|
117
|
-
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
118
|
-
Licensor as expressly required by this License).
|
|
119
|
-
|
|
120
|
-
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
121
|
-
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
122
|
-
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
123
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
124
|
-
TITLE.
|
|
125
|
-
|
|
126
|
-
MariaDB hereby grants you permission to use this License’s text to license
|
|
127
|
-
your works, and to refer to it using the trademark “Business Source License”,
|
|
128
|
-
as long as you comply with the Covenants of Licensor below.
|
|
129
|
-
|
|
130
|
-
Covenants of Licensor
|
|
131
|
-
|
|
132
|
-
In consideration of the right to use this License’s text and the “Business
|
|
133
|
-
Source License” name and trademark, Licensor covenants to MariaDB, and to all
|
|
134
|
-
other recipients of the licensed work to be provided by Licensor:
|
|
135
|
-
|
|
136
|
-
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
137
|
-
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
138
|
-
where “compatible” means that software provided under the Change License can
|
|
139
|
-
be included in a program with software provided under GPL Version 2.0 or a
|
|
140
|
-
later version. Licensor may specify additional Change Licenses without
|
|
141
|
-
limitation.
|
|
142
|
-
|
|
143
|
-
2. To either: (a) specify an additional grant of rights to use that does not
|
|
144
|
-
impose any additional restriction on the right granted in this License, as
|
|
145
|
-
the Additional Use Grant; or (b) insert the text “None”.
|
|
146
|
-
|
|
147
|
-
3. To specify a Change Date.
|
|
148
|
-
|
|
149
|
-
4. Not to modify this License in any other way.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Agimon Pty Ltd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -141,4 +141,4 @@ has no Pi entry, notification wrapper, or automatically installed shell-title co
|
|
|
141
141
|
|
|
142
142
|
## License
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
MIT. See [LICENSE](LICENSE).
|
package/dist/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
let node_worker_threads = require("node:worker_threads");
|
|
25
25
|
let node_path = require("node:path");
|
|
26
26
|
node_path = __toESM(node_path, 1);
|
|
27
|
+
let _agimon_ai_po_core_locale = require("@agimon-ai/po-core/locale");
|
|
27
28
|
let node_crypto = require("node:crypto");
|
|
28
29
|
let node_http2 = require("node:http2");
|
|
29
30
|
let node_https = require("node:https");
|
|
@@ -176,13 +177,9 @@ function createWorkerTitleController() {
|
|
|
176
177
|
}
|
|
177
178
|
//#endregion
|
|
178
179
|
//#region src/services/notificationText/index.ts
|
|
179
|
-
const ATTENTION_SUBTITLE = "Approval or feedback required";
|
|
180
|
-
const ATTENTION_TITLE = "Po needs your input";
|
|
181
180
|
const ELLIPSIS = "…";
|
|
182
181
|
const MAX_BODY_LENGTH = 240;
|
|
183
182
|
const MAX_PROMPT_TITLE_LENGTH = 36;
|
|
184
|
-
const SETTLED_BODY = "The agent finished its work and is waiting for you.";
|
|
185
|
-
const SETTLED_TITLE_PREFIX = "Po finished: ";
|
|
186
183
|
const SHELL_TITLE_SEPARATOR = " - ";
|
|
187
184
|
const SHELL_TITLE_PREFIX = "π";
|
|
188
185
|
function collapseWhitespace(value) {
|
|
@@ -211,11 +208,12 @@ function shellTabTitle({ cwd, sessionName, prompt }) {
|
|
|
211
208
|
function notificationBody(body) {
|
|
212
209
|
return truncate(collapseWhitespace(body), MAX_BODY_LENGTH);
|
|
213
210
|
}
|
|
211
|
+
const english = (_key, fallback, vars) => (0, _agimon_ai_po_core_locale.formatMessage)(fallback, vars);
|
|
214
212
|
/** Sent while the agent holds the turn and something is blocking on the user. */
|
|
215
|
-
function attentionNotification(body) {
|
|
213
|
+
function attentionNotification(body, t = english) {
|
|
216
214
|
return {
|
|
217
|
-
title:
|
|
218
|
-
subtitle:
|
|
215
|
+
title: t("notification.attention.title", "Po needs your input"),
|
|
216
|
+
subtitle: t("notification.attention.subtitle", "Approval or feedback required"),
|
|
219
217
|
body
|
|
220
218
|
};
|
|
221
219
|
}
|
|
@@ -223,13 +221,13 @@ function attentionNotification(body) {
|
|
|
223
221
|
* Sent once a run has stopped. The title carries the session name so it shows even where a
|
|
224
222
|
* platform hides subtitles; an unnamed session (the hub sends `''`) falls back to the repository.
|
|
225
223
|
*/
|
|
226
|
-
function settledNotification({ cwd, sessionName }) {
|
|
224
|
+
function settledNotification({ cwd, sessionName }, t = english) {
|
|
227
225
|
const repository = node_path.default.basename(cwd);
|
|
228
226
|
const name = sessionName?.trim();
|
|
229
227
|
return {
|
|
230
|
-
title:
|
|
228
|
+
title: t("notification.settled.title", "Po finished: {name}", { name: name || repository }),
|
|
231
229
|
subtitle: name ? repository : "",
|
|
232
|
-
body:
|
|
230
|
+
body: t("notification.settled.body", "The agent finished its work and is waiting for you.")
|
|
233
231
|
};
|
|
234
232
|
}
|
|
235
233
|
//#endregion
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["Worker","path","sign","connect","request","DEFAULT_AUTO_STOP_DELAYS","BACKGROUND_RUNNER_DEADLINE_MS","holdsSettledSessionAfterRunnerDeadline","holdsSettledSession","BACKGROUND_WORK_HOLDING_PROVIDERS","decideOnRecheck","AUTO_STOP_ACTION"],"sources":["../src/services/shellTitleController/mainThread.ts","../src/services/shellTitleController/index.ts","../src/services/notificationText/index.ts","../src/services/systemNotification/index.ts","../src/services/nativePushSender/sync.ts","../src/services/nativePushSender/index.ts","../src/services/completion/index.ts","../src/services/notificationPolicy/index.ts"],"sourcesContent":["import type { ShellTitleController } from '../../types/notifications';\n\nexport const BRAILLE_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\nexport const TITLE_FRAME_INTERVAL_MS = 80;\n\n/** Animates on the main thread, for hosts where a worker could not be started. */\nexport function createMainThreadTitleController(): ShellTitleController {\n let frameIndex = 0;\n let timer: ReturnType<typeof setInterval> | undefined;\n const stopAnimation = () => {\n if (timer) clearInterval(timer);\n timer = undefined;\n frameIndex = 0;\n };\n\n return {\n set(title, write) {\n stopAnimation();\n write(title);\n },\n start(title, write) {\n stopAnimation();\n const render = () => {\n write(`${BRAILLE_FRAMES[frameIndex % BRAILLE_FRAMES.length]} ${title}`);\n frameIndex += 1;\n };\n render();\n timer = setInterval(render, TITLE_FRAME_INTERVAL_MS);\n },\n stop(title, write) {\n stopAnimation();\n write(title);\n },\n dispose(title, write) {\n stopAnimation();\n write(title);\n },\n };\n}\n","import { Worker } from 'node:worker_threads';\n\nimport type { ShellTitleCommand, ShellTitleController, WriteTitle } from '../../types/notifications';\nimport { BRAILLE_FRAMES, TITLE_FRAME_INTERVAL_MS, createMainThreadTitleController } from './mainThread';\n\nexport { createMainThreadTitleController } from './mainThread';\n/**\n * The animator runs off the main thread so a busy agent turn cannot stall the\n * spinner. It is an inline eval source rather than a shipped file because the\n * package is bundled per entry, and a separate worker module would have to be\n * located on disk at runtime.\n */\nconst TITLE_WORKER_SOURCE = `\nconst { createWriteStream } = require('node:fs');\nconst output = createWriteStream('', { fd: 1, autoClose: false });\nconst { parentPort, workerData } = require('node:worker_threads');\nlet frameIndex = 0;\nlet timer;\nconst writeTitle = (title) => output.write('\\\\u001b]0;' + title + '\\\\u0007');\nconst stop = () => {\n if (timer) clearInterval(timer);\n timer = undefined;\n frameIndex = 0;\n};\nparentPort.on('message', (command) => {\n stop();\n if (command.action === 'start') {\n const render = () => {\n writeTitle(workerData.frames[frameIndex % workerData.frames.length] + ' ' + command.title);\n frameIndex += 1;\n };\n render();\n timer = setInterval(render, workerData.intervalMs);\n return;\n }\n writeTitle(command.title);\n if (command.action === 'dispose') output.end(() => parentPort.close());\n});\n`;\n\n/**\n * Animates from a worker thread, replaying the last command on the main thread\n * if the worker never started, failed, or exited under us. The worker is\n * unreferenced so a pending frame never holds the process open.\n */\nexport function createWorkerTitleController(): ShellTitleController {\n const fallback = createMainThreadTitleController();\n let lastCommand: ShellTitleCommand | undefined;\n let lastWrite: WriteTitle | undefined;\n let worker: Worker | undefined;\n\n const fallBack = () => {\n worker = undefined;\n if (!lastCommand || !lastWrite) return;\n fallback[lastCommand.action](lastCommand.title, lastWrite);\n };\n\n try {\n const titleWorker = new Worker(TITLE_WORKER_SOURCE, {\n eval: true,\n workerData: { frames: BRAILLE_FRAMES, intervalMs: TITLE_FRAME_INTERVAL_MS },\n });\n titleWorker.unref();\n titleWorker.once('error', fallBack);\n titleWorker.once('exit', (code) => {\n if (code !== 0 && worker === titleWorker) fallBack();\n });\n worker = titleWorker;\n } catch {\n // Workers are unavailable on this host, which the main-thread animator covers.\n worker = undefined;\n }\n\n const dispatch = (command: ShellTitleCommand, write: WriteTitle) => {\n lastCommand = command;\n lastWrite = write;\n if (!worker) {\n fallback[command.action](command.title, write);\n return;\n }\n try {\n worker.postMessage(command);\n } catch {\n // The worker closed between the last frame and this command.\n fallBack();\n }\n };\n\n return {\n set: (title, write) => dispatch({ action: 'set', title }, write),\n start: (title, write) => dispatch({ action: 'start', title }, write),\n stop: (title, write) => dispatch({ action: 'stop', title }, write),\n dispose: (title, write) => dispatch({ action: 'dispose', title }, write),\n };\n}\n","import path from 'node:path';\n\nimport type { DesktopNotification } from '../../types/notifications';\n\nconst ATTENTION_SUBTITLE = 'Approval or feedback required';\nconst ATTENTION_TITLE = 'Po needs your input';\nconst ELLIPSIS = '…';\nconst MAX_BODY_LENGTH = 240;\nconst MAX_PROMPT_TITLE_LENGTH = 36;\nconst SETTLED_BODY = 'The agent finished its work and is waiting for you.';\nconst SETTLED_TITLE_PREFIX = 'Po finished: ';\nconst SHELL_TITLE_SEPARATOR = ' - ';\nconst SHELL_TITLE_PREFIX = 'π';\n\nfunction collapseWhitespace(value: string): string {\n return value.replace(/\\s+/g, ' ').trim();\n}\n\nfunction truncate(value: string, maxLength: number): string {\n return value.length > maxLength ? `${value.slice(0, maxLength - 1)}${ELLIPSIS}` : value;\n}\n\n/** The first user prompt, shortened to fit a shell tab. A blank prompt names nothing. */\nexport function promptTitle(prompt: string): string | undefined {\n const normalized = collapseWhitespace(prompt);\n return normalized ? truncate(normalized, MAX_PROMPT_TITLE_LENGTH) : undefined;\n}\n\nexport interface ShellTabTitleInput {\n cwd: string;\n sessionName?: string;\n prompt?: string;\n}\n\n/**\n * The idle shell-tab title: `π - <label> - <repository>`.\n *\n * The session name wins over the first prompt because the user chose it. With\n * neither, the repository alone still tells two tabs apart.\n */\nexport function shellTabTitle({ cwd, sessionName, prompt }: ShellTabTitleInput): string {\n const repository = path.basename(cwd);\n const label = sessionName ?? prompt;\n return label\n ? `${SHELL_TITLE_PREFIX}${SHELL_TITLE_SEPARATOR}${label}${SHELL_TITLE_SEPARATOR}${repository}`\n : `${SHELL_TITLE_PREFIX}${SHELL_TITLE_SEPARATOR}${repository}`;\n}\n\n/** Notification bodies are one line in a system panel, so they collapse and truncate. */\nexport function notificationBody(body: string): string {\n return truncate(collapseWhitespace(body), MAX_BODY_LENGTH);\n}\n\n/** Sent while the agent holds the turn and something is blocking on the user. */\nexport function attentionNotification(body: string): DesktopNotification {\n return { title: ATTENTION_TITLE, subtitle: ATTENTION_SUBTITLE, body };\n}\n\n/**\n * Sent once a run has stopped. The title carries the session name so it shows even where a\n * platform hides subtitles; an unnamed session (the hub sends `''`) falls back to the repository.\n */\nexport function settledNotification({ cwd, sessionName }: { cwd: string; sessionName?: string }): DesktopNotification {\n const repository = path.basename(cwd);\n const name = sessionName?.trim();\n return {\n title: `${SETTLED_TITLE_PREFIX}${name || repository}`,\n subtitle: name ? repository : '',\n body: SETTLED_BODY,\n };\n}\n","import type { DesktopNotification, NotificationExecutor } from '../../types/notifications';\nimport { notificationBody } from '../notificationText';\n\nconst CMUX_COMMAND = 'cmux';\nconst COMMAND_TIMEOUT_MS = 3_000;\nconst DARWIN_PLATFORM = 'darwin';\nconst OSASCRIPT_COMMAND = 'osascript';\nconst OSASCRIPT_EXPRESSION_FLAG = '-e';\n\nasync function execute(pi: NotificationExecutor, command: string, args: string[]): Promise<boolean> {\n try {\n const result = await pi.exec(command, args, { timeout: COMMAND_TIMEOUT_MS });\n return result.code === 0;\n } catch {\n // A notifier that is not installed is the ordinary case, not a fault: report\n // \"not delivered\" and let the caller decide whether another one exists.\n return false;\n }\n}\n\n/**\n * Delivers one desktop notification on a best-effort basis.\n *\n * cmux is tried first because it routes the notification to the window the\n * session actually lives in. Only macOS has a second option worth attempting,\n * and a host with neither stays silent rather than failing the turn.\n */\nexport async function sendSystemNotification(\n pi: NotificationExecutor,\n notification: DesktopNotification,\n platform: string = process.platform,\n): Promise<void> {\n const body = notificationBody(notification.body);\n const sentToCmux = await execute(pi, CMUX_COMMAND, [\n 'notify',\n '--title',\n notification.title,\n '--subtitle',\n notification.subtitle,\n '--body',\n body,\n ]);\n if (sentToCmux || platform !== DARWIN_PLATFORM) return;\n\n await execute(pi, OSASCRIPT_COMMAND, [\n OSASCRIPT_EXPRESSION_FLAG,\n 'on run argv',\n OSASCRIPT_EXPRESSION_FLAG,\n 'display notification (item 3 of argv) with title (item 1 of argv) subtitle (item 2 of argv)',\n OSASCRIPT_EXPRESSION_FLAG,\n 'end run',\n notification.title,\n notification.subtitle,\n body,\n ]);\n}\n","import { sign } from 'node:crypto';\nimport { connect } from 'node:http2';\nimport { request } from 'node:https';\n\nimport type { NativePushRequest, NativePushResponse } from './type';\n\nconst MAX_RESPONSE_BYTES = 65_536;\n\nexport function signPushJwt(header: object, claims: object, key: string, algorithm: 'ES256' | 'RS256'): string {\n const input = [header, claims].map((part) => Buffer.from(JSON.stringify(part)).toString('base64url')).join('.');\n const signature = sign('sha256', Buffer.from(input), { key, dsaEncoding: 'ieee-p1363' });\n // APNs requires the raw P1363 ECDSA signature, not ASN.1 DER.\n if (algorithm === 'ES256' && signature.length !== 64) throw new Error('Invalid signing key');\n return `${input}.${signature.toString('base64url')}`;\n}\n\nexport function createPushTransport() {\n const pending = new Set<() => void>();\n return {\n request(this: void, input: NativePushRequest): Promise<NativePushResponse> {\n return new Promise((resolve, reject) => {\n const url = new URL(input.url);\n let size = 0;\n const chunks: Buffer[] = [];\n let done = false;\n let dispose = () => {};\n const finish = (error?: Error, status = 0) => {\n if (done) return;\n done = true;\n clearTimeout(timer);\n pending.delete(cancel);\n dispose();\n if (error) reject(error);\n else resolve({ status, body: Buffer.concat(chunks).toString('utf8') });\n };\n const cancel = () => finish(new Error('Push request cancelled'));\n const timer = setTimeout(() => finish(new Error('Push request timed out')), input.timeoutMs);\n pending.add(cancel);\n const data = (chunk: Buffer) => {\n size += chunk.length;\n if (size > MAX_RESPONSE_BYTES) finish(new Error('Push response too large'));\n else chunks.push(Buffer.from(chunk));\n };\n if (input.http2) {\n const session = connect(url.origin);\n dispose = () => session.destroy();\n session.on('error', (error) => finish(error));\n const stream = session.request({ ':method': 'POST', ':path': url.pathname, ...input.headers });\n let status = 0;\n stream.on('response', (headers) => {\n status = Number(headers[':status']);\n });\n stream.on('data', data);\n stream.on('error', (error) => finish(error));\n stream.on('end', () => finish(undefined, status));\n stream.end(input.body);\n } else {\n const req = request(url, { method: 'POST', headers: input.headers }, (response) => {\n response.on('data', data);\n response.on('error', (error) => finish(error));\n response.on('end', () => finish(undefined, response.statusCode));\n });\n dispose = () => req.destroy();\n req.on('error', (error) => finish(error));\n req.end(input.body);\n }\n });\n },\n close() {\n for (const cancel of pending) cancel();\n },\n };\n}\n","import type { PoNotificationEntryData } from '@agimon-ai/po-core';\n\nimport { createPushTransport, signPushJwt } from './sync';\nimport type { NativePushSender, NativePushSenderOptions } from './type';\n\nconst MAX_PAYLOAD_BYTES = 4096;\nconst APNS_TOPIC = 'ai.po.app';\n// Only documented provider codes may enter diagnostics, never arbitrary response text.\nconst APNS_REASONS = new Set([\n 'BadCollapseId',\n 'BadDeviceToken',\n 'BadExpirationDate',\n 'BadMessageId',\n 'BadPriority',\n 'BadTopic',\n 'DeviceTokenNotForTopic',\n 'DuplicateHeaders',\n 'IdleTimeout',\n 'InvalidPushType',\n 'MissingDeviceToken',\n 'MissingTopic',\n 'PayloadEmpty',\n 'TopicDisallowed',\n 'BadCertificate',\n 'BadCertificateEnvironment',\n 'ExpiredProviderToken',\n 'Forbidden',\n 'InvalidProviderToken',\n 'MissingProviderToken',\n 'BadPath',\n 'MethodNotAllowed',\n 'Unregistered',\n 'PayloadTooLarge',\n 'TooManyProviderTokenUpdates',\n 'TooManyRequests',\n 'InternalServerError',\n 'ServiceUnavailable',\n 'Shutdown',\n]);\nconst OAUTH_URL = 'https://oauth2.googleapis.com/token';\nconst FCM_ERROR_TYPE = 'type.googleapis.com/google.firebase.fcm.v1.FcmError';\nconst encoder = new TextEncoder();\n\nfunction parse(body: string): Record<string, unknown> {\n try {\n const value: unknown = JSON.parse(body);\n return value && typeof value === 'object' ? (value as Record<string, unknown>) : {};\n } catch {\n return {};\n } // Malformed provider responses never invalidate registrations.\n}\n\nfunction payload(\n notification: PoNotificationEntryData,\n build: (text: { title: string; subtitle: string; body: string }) => object,\n): string {\n const text = { title: notification.title, subtitle: notification.subtitle, body: notification.body };\n let result = JSON.stringify(build(text));\n // Measure the full serialized envelope, including escaped text and the FCM token.\n for (const field of ['body', 'subtitle', 'title'] as const) {\n if (encoder.encode(result).length <= MAX_PAYLOAD_BYTES) break;\n const points = Array.from(text[field]);\n let low = 0;\n let high = points.length;\n while (low < high) {\n const middle = Math.ceil((low + high) / 2);\n text[field] = points.slice(0, middle).join('');\n if (encoder.encode(JSON.stringify(build(text))).length <= MAX_PAYLOAD_BYTES) low = middle;\n else high = middle - 1;\n }\n text[field] = points.slice(0, low).join('');\n result = JSON.stringify(build(text));\n }\n if (encoder.encode(result).length > MAX_PAYLOAD_BYTES) throw new Error('Push payload too large');\n return result;\n}\n\nexport function createNativePushSender(options: NativePushSenderOptions): NativePushSender {\n const transport = createPushTransport();\n const request = options.request ?? transport.request;\n const now = options.now ?? Date.now;\n const timeoutMs = Number.isFinite(options.timeoutMs) ? Math.max(1, Math.min(options.timeoutMs!, 30_000)) : 10_000;\n let closed = false;\n let apnsJwt: { value: string; expires: number } | undefined;\n let oauth: { value: string; expires: number } | undefined;\n let oauthPending: Promise<string> | undefined;\n\n async function accessToken(): Promise<string> {\n if (oauth && now() < oauth.expires) return oauth.value;\n if (oauthPending) return oauthPending;\n oauthPending = (async () => {\n const credentials = options.fcm!;\n const issued = Math.floor(now() / 1000);\n const assertion = signPushJwt(\n { alg: 'RS256', typ: 'JWT' },\n {\n iss: credentials.clientEmail,\n scope: 'https://www.googleapis.com/auth/firebase.messaging',\n aud: OAUTH_URL,\n iat: issued,\n exp: issued + 3600,\n },\n credentials.privateKey,\n 'RS256',\n );\n const response = await request({\n url: OAUTH_URL,\n headers: { 'content-type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams({ grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', assertion }).toString(),\n timeoutMs,\n });\n const data = parse(response.body);\n if (\n response.status !== 200 ||\n typeof data.access_token !== 'string' ||\n !data.access_token ||\n typeof data.expires_in !== 'number' ||\n !Number.isFinite(data.expires_in) ||\n data.expires_in <= 0\n )\n throw new Error('OAuth failed');\n oauth = { value: data.access_token, expires: now() + Math.max(0, Math.min(data.expires_in, 3600) - 60) * 1000 };\n return oauth.value;\n })();\n try {\n return await oauthPending;\n } finally {\n oauthPending = undefined;\n }\n }\n\n return {\n async send(registration, notification, sessionId) {\n const provider = registration.platform === 'ios' ? 'apns' : 'fcm';\n if (closed || !options[provider]) {\n options.diagnostic?.({ provider, outcome: 'unavailable' });\n return { invalid: false };\n }\n try {\n const data = {\n ...(registration.hostRef ? { hostRef: registration.hostRef } : {}),\n ...(sessionId ? { sessionId } : {}),\n };\n let response;\n let reason: string | undefined;\n if (registration.platform === 'ios') {\n const credentials = options.apns!;\n if (!apnsJwt || now() >= apnsJwt.expires) {\n apnsJwt = {\n value: signPushJwt(\n { alg: 'ES256', kid: credentials.keyId },\n {\n iss: credentials.teamId,\n iat: Math.floor(now() / 1000),\n },\n credentials.key,\n 'ES256',\n ),\n expires: now() + 50 * 60_000,\n };\n }\n response = await request({\n url: `https://${registration.environment === 'development' ? 'api.sandbox.push.apple.com' : 'api.push.apple.com'}/3/device/${encodeURIComponent(registration.token)}`,\n http2: true,\n timeoutMs,\n headers: {\n authorization: `bearer ${apnsJwt.value}`,\n 'apns-topic': APNS_TOPIC,\n 'apns-push-type': 'alert',\n 'apns-priority': '10',\n 'apns-expiration': '0',\n 'content-type': 'application/json',\n },\n // ponytail: live alerts only; add a durable outbox if delayed delivery becomes a requirement.\n // Expo iOS reads custom remote data from userInfo.body. Keep data as the provider-neutral payload.\n body: payload(notification, (text) => ({ aps: { alert: text, sound: 'default' }, data, body: data })),\n });\n const value = parse(response.body).reason;\n if (typeof value === 'string' && APNS_REASONS.has(value)) reason = value;\n if (\n (response.status === 410 && reason === 'Unregistered') ||\n (response.status === 400 && reason === 'BadDeviceToken')\n ) {\n options.diagnostic?.({\n provider,\n outcome: 'invalid',\n status: response.status,\n ...(reason ? { reason } : {}),\n });\n return { invalid: true };\n }\n } else {\n const body = payload(notification, (text) => ({\n message: {\n token: registration.token,\n data,\n notification: { title: text.title, body: [text.subtitle, text.body].filter(Boolean).join('\\n') },\n // ponytail: zero TTL, no offline delivery; an outbox would own delayed sends.\n android: { ttl: '0s', priority: 'HIGH', notification: { channel_id: 'po-notifications' } },\n },\n }));\n const token = await accessToken();\n if (closed) return { invalid: false };\n response = await request({\n url: `https://fcm.googleapis.com/v1/projects/${encodeURIComponent(options.fcm!.projectId)}/messages:send`,\n headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },\n body,\n timeoutMs,\n });\n const error = parse(response.body).error;\n if (\n response.status === 404 &&\n error &&\n typeof error === 'object' &&\n 'details' in error &&\n Array.isArray(error.details) &&\n error.details.some(\n (detail: unknown) =>\n detail &&\n typeof detail === 'object' &&\n '@type' in detail &&\n detail['@type'] === FCM_ERROR_TYPE &&\n 'errorCode' in detail &&\n detail.errorCode === 'UNREGISTERED',\n )\n ) {\n options.diagnostic?.({\n provider,\n outcome: 'invalid',\n status: response.status,\n ...(reason ? { reason } : {}),\n });\n return { invalid: true };\n }\n }\n if (response.status < 200 || response.status >= 300)\n options.diagnostic?.({ provider, outcome: 'failed', status: response.status, ...(reason ? { reason } : {}) });\n } catch {\n // Never expose provider bodies, credentials, device tokens, or network errors.\n options.diagnostic?.({ provider, outcome: 'failed' });\n }\n return { invalid: false };\n },\n close() {\n closed = true;\n apnsJwt = undefined;\n oauth = undefined;\n transport.close();\n },\n };\n}\n","import { AUTO_STOP_ACTION, DEFAULT_AUTO_STOP_DELAYS, decideOnRecheck } from '@agimon-ai/po-autostop';\nimport {\n BACKGROUND_RUNNER_DEADLINE_MS,\n BACKGROUND_WORK_HOLDING_PROVIDERS,\n holdsSettledSession,\n holdsSettledSessionAfterRunnerDeadline,\n} from '@agimon-ai/po-core/backgroundWork';\nimport type { PoHubSessionExecutionState } from '@agimon-ai/po-core/hubChannel';\n\nimport type { SessionFinishedDecision } from './type';\n\nexport const SESSION_FINISHED_COOLDOWN_MS = DEFAULT_AUTO_STOP_DELAYS.cooldownMs;\n\n/** The completion test shared by spoken notices and native push, after the initial cooldown. */\nexport function decideSessionFinished(\n state: PoHubSessionExecutionState | undefined,\n holdingSince: number | undefined,\n now: number,\n): SessionFinishedDecision {\n // Unknown background work cannot prove the run finished.\n if (!state?.backgroundWork) return { action: 'unavailable' };\n const expired = holdingSince !== undefined && now - holdingSince >= BACKGROUND_RUNNER_DEADLINE_MS;\n const holds = expired ? holdsSettledSessionAfterRunnerDeadline : holdsSettledSession;\n const { items, errors } = state.backgroundWork;\n if (items.some(holds) || errors.some((error) => BACKGROUND_WORK_HOLDING_PROVIDERS.includes(error.provider)))\n return {\n action: 'hold',\n delayMs: SESSION_FINISHED_COOLDOWN_MS,\n holdingSince: holdingSince ?? now,\n };\n const decision = decideOnRecheck(state, DEFAULT_AUTO_STOP_DELAYS);\n if (decision.action === AUTO_STOP_ACTION.recheck) return { action: 'recheck', delayMs: decision.delayMs };\n return { action: decision.action === AUTO_STOP_ACTION.shutdown ? 'finished' : 'stand-down' };\n}\n","const DEFAULT_ASK_USER_BODY = 'The agent is waiting for your feedback.';\nconst RPC_MODE = 'rpc';\n\nexport interface AttentionState {\n agentRunning: boolean;\n askUserBlocked: boolean;\n}\n\nexport interface ShellSurface {\n hasUI: boolean;\n mode?: string;\n}\n\n/**\n * A dialog is worth interrupting the user for only while the agent holds the turn.\n *\n * Outside a run the user opened the dialog themselves and is already looking at\n * it. An ask-user prompt is announced by its own event, so the dialog it then\n * opens must stay silent or the same question notifies twice.\n */\nexport function warrantsAttentionNotification({ agentRunning, askUserBlocked }: AttentionState): boolean {\n return agentRunning && !askUserBlocked;\n}\n\n/** A queued follow-up means the agent keeps working, so the run has not stopped for the user. */\nexport function warrantsSettledNotification(hasPendingMessages: boolean): boolean {\n return !hasPendingMessages;\n}\n\n/** Terminal title escapes only mean something on an attached terminal; RPC output stays clean. */\nexport function supportsShellTitle({ hasUI, mode }: ShellSurface): boolean {\n return hasUI && mode !== RPC_MODE;\n}\n\n/** The question an ask-user prompt is blocking on, or a stand-in when it asked none. */\nexport function askUserPromptBody(questions: readonly { question: string }[]): string {\n return questions[0]?.question ?? DEFAULT_ASK_USER_BODY;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,iBAAiB;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG;;AAI/E,SAAgB,kCAAwD;CACtE,IAAI,aAAa;CACjB,IAAI;CACJ,MAAM,sBAAsB;EAC1B,IAAI,OAAO,cAAc,KAAK;EAC9B,QAAQ,KAAA;EACR,aAAa;CACf;CAEA,OAAO;EACL,IAAI,OAAO,OAAO;GAChB,cAAc;GACd,MAAM,KAAK;EACb;EACA,MAAM,OAAO,OAAO;GAClB,cAAc;GACd,MAAM,eAAe;IACnB,MAAM,GAAG,eAAe,aAAa,eAAe,QAAQ,GAAG,OAAO;IACtE,cAAc;GAChB;GACA,OAAO;GACP,QAAQ,YAAY,QAAA,EAA+B;EACrD;EACA,KAAK,OAAO,OAAO;GACjB,cAAc;GACd,MAAM,KAAK;EACb;EACA,QAAQ,OAAO,OAAO;GACpB,cAAc;GACd,MAAM,KAAK;EACb;CACF;AACF;;;;;;;;;AC1BA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiC5B,SAAgB,8BAAoD;CAClE,MAAM,WAAW,gCAAgC;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,MAAM,iBAAiB;EACrB,SAAS,KAAA;EACT,IAAI,CAAC,eAAe,CAAC,WAAW;EAChC,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E_MS","holdsSettledSessionAfterRunnerDeadline","holdsSettledSession","BACKGROUND_WORK_HOLDING_PROVIDERS","decideOnRecheck","AUTO_STOP_ACTION"],"sources":["../src/services/shellTitleController/mainThread.ts","../src/services/shellTitleController/index.ts","../src/services/notificationText/index.ts","../src/services/systemNotification/index.ts","../src/services/nativePushSender/sync.ts","../src/services/nativePushSender/index.ts","../src/services/completion/index.ts","../src/services/notificationPolicy/index.ts"],"sourcesContent":["import type { ShellTitleController } from '../../types/notifications';\n\nexport const BRAILLE_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\nexport const TITLE_FRAME_INTERVAL_MS = 80;\n\n/** Animates on the main thread, for hosts where a worker could not be started. */\nexport function createMainThreadTitleController(): ShellTitleController {\n let frameIndex = 0;\n let timer: ReturnType<typeof setInterval> | undefined;\n const stopAnimation = () => {\n if (timer) clearInterval(timer);\n timer = undefined;\n frameIndex = 0;\n };\n\n return {\n set(title, write) {\n stopAnimation();\n write(title);\n },\n start(title, write) {\n stopAnimation();\n const render = () => {\n write(`${BRAILLE_FRAMES[frameIndex % BRAILLE_FRAMES.length]} ${title}`);\n frameIndex += 1;\n };\n render();\n timer = setInterval(render, TITLE_FRAME_INTERVAL_MS);\n },\n stop(title, write) {\n stopAnimation();\n write(title);\n },\n dispose(title, write) {\n stopAnimation();\n write(title);\n },\n };\n}\n","import { Worker } from 'node:worker_threads';\n\nimport type { ShellTitleCommand, ShellTitleController, WriteTitle } from '../../types/notifications';\nimport { BRAILLE_FRAMES, TITLE_FRAME_INTERVAL_MS, createMainThreadTitleController } from './mainThread';\n\nexport { createMainThreadTitleController } from './mainThread';\n/**\n * The animator runs off the main thread so a busy agent turn cannot stall the\n * spinner. It is an inline eval source rather than a shipped file because the\n * package is bundled per entry, and a separate worker module would have to be\n * located on disk at runtime.\n */\nconst TITLE_WORKER_SOURCE = `\nconst { createWriteStream } = require('node:fs');\nconst output = createWriteStream('', { fd: 1, autoClose: false });\nconst { parentPort, workerData } = require('node:worker_threads');\nlet frameIndex = 0;\nlet timer;\nconst writeTitle = (title) => output.write('\\\\u001b]0;' + title + '\\\\u0007');\nconst stop = () => {\n if (timer) clearInterval(timer);\n timer = undefined;\n frameIndex = 0;\n};\nparentPort.on('message', (command) => {\n stop();\n if (command.action === 'start') {\n const render = () => {\n writeTitle(workerData.frames[frameIndex % workerData.frames.length] + ' ' + command.title);\n frameIndex += 1;\n };\n render();\n timer = setInterval(render, workerData.intervalMs);\n return;\n }\n writeTitle(command.title);\n if (command.action === 'dispose') output.end(() => parentPort.close());\n});\n`;\n\n/**\n * Animates from a worker thread, replaying the last command on the main thread\n * if the worker never started, failed, or exited under us. The worker is\n * unreferenced so a pending frame never holds the process open.\n */\nexport function createWorkerTitleController(): ShellTitleController {\n const fallback = createMainThreadTitleController();\n let lastCommand: ShellTitleCommand | undefined;\n let lastWrite: WriteTitle | undefined;\n let worker: Worker | undefined;\n\n const fallBack = () => {\n worker = undefined;\n if (!lastCommand || !lastWrite) return;\n fallback[lastCommand.action](lastCommand.title, lastWrite);\n };\n\n try {\n const titleWorker = new Worker(TITLE_WORKER_SOURCE, {\n eval: true,\n workerData: { frames: BRAILLE_FRAMES, intervalMs: TITLE_FRAME_INTERVAL_MS },\n });\n titleWorker.unref();\n titleWorker.once('error', fallBack);\n titleWorker.once('exit', (code) => {\n if (code !== 0 && worker === titleWorker) fallBack();\n });\n worker = titleWorker;\n } catch {\n // Workers are unavailable on this host, which the main-thread animator covers.\n worker = undefined;\n }\n\n const dispatch = (command: ShellTitleCommand, write: WriteTitle) => {\n lastCommand = command;\n lastWrite = write;\n if (!worker) {\n fallback[command.action](command.title, write);\n return;\n }\n try {\n worker.postMessage(command);\n } catch {\n // The worker closed between the last frame and this command.\n fallBack();\n }\n };\n\n return {\n set: (title, write) => dispatch({ action: 'set', title }, write),\n start: (title, write) => dispatch({ action: 'start', title }, write),\n stop: (title, write) => dispatch({ action: 'stop', title }, write),\n dispose: (title, write) => dispatch({ action: 'dispose', title }, write),\n };\n}\n","import path from 'node:path';\n\nimport { formatMessage } from '@agimon-ai/po-core/locale';\n\nimport type { DesktopNotification } from '../../types/notifications';\n\nconst ELLIPSIS = '…';\nconst MAX_BODY_LENGTH = 240;\nconst MAX_PROMPT_TITLE_LENGTH = 36;\nconst SHELL_TITLE_SEPARATOR = ' - ';\nconst SHELL_TITLE_PREFIX = 'π';\n\nfunction collapseWhitespace(value: string): string {\n return value.replace(/\\s+/g, ' ').trim();\n}\n\nfunction truncate(value: string, maxLength: number): string {\n return value.length > maxLength ? `${value.slice(0, maxLength - 1)}${ELLIPSIS}` : value;\n}\n\n/** The first user prompt, shortened to fit a shell tab. A blank prompt names nothing. */\nexport function promptTitle(prompt: string): string | undefined {\n const normalized = collapseWhitespace(prompt);\n return normalized ? truncate(normalized, MAX_PROMPT_TITLE_LENGTH) : undefined;\n}\n\nexport interface ShellTabTitleInput {\n cwd: string;\n sessionName?: string;\n prompt?: string;\n}\n\n/**\n * The idle shell-tab title: `π - <label> - <repository>`.\n *\n * The session name wins over the first prompt because the user chose it. With\n * neither, the repository alone still tells two tabs apart.\n */\nexport function shellTabTitle({ cwd, sessionName, prompt }: ShellTabTitleInput): string {\n const repository = path.basename(cwd);\n const label = sessionName ?? prompt;\n return label\n ? `${SHELL_TITLE_PREFIX}${SHELL_TITLE_SEPARATOR}${label}${SHELL_TITLE_SEPARATOR}${repository}`\n : `${SHELL_TITLE_PREFIX}${SHELL_TITLE_SEPARATOR}${repository}`;\n}\n\n/** Notification bodies are one line in a system panel, so they collapse and truncate. */\nexport function notificationBody(body: string): string {\n return truncate(collapseWhitespace(body), MAX_BODY_LENGTH);\n}\n\n/** Renders one message: a language pack's text for `key`, or the English `fallback`. */\nexport type NotificationTranslate = (\n key: string,\n fallback: string,\n vars?: Readonly<Record<string, string | number>>,\n) => string;\n\nconst english: NotificationTranslate = (_key, fallback, vars) => formatMessage(fallback, vars);\n\n/** Sent while the agent holds the turn and something is blocking on the user. */\nexport function attentionNotification(body: string, t: NotificationTranslate = english): DesktopNotification {\n return {\n title: t('notification.attention.title', 'Po needs your input'),\n subtitle: t('notification.attention.subtitle', 'Approval or feedback required'),\n body,\n };\n}\n\n/**\n * Sent once a run has stopped. The title carries the session name so it shows even where a\n * platform hides subtitles; an unnamed session (the hub sends `''`) falls back to the repository.\n */\nexport function settledNotification(\n { cwd, sessionName }: { cwd: string; sessionName?: string },\n t: NotificationTranslate = english,\n): DesktopNotification {\n const repository = path.basename(cwd);\n const name = sessionName?.trim();\n return {\n title: t('notification.settled.title', 'Po finished: {name}', { name: name || repository }),\n subtitle: name ? repository : '',\n body: t('notification.settled.body', 'The agent finished its work and is waiting for you.'),\n };\n}\n","import type { DesktopNotification, NotificationExecutor } from '../../types/notifications';\nimport { notificationBody } from '../notificationText';\n\nconst CMUX_COMMAND = 'cmux';\nconst COMMAND_TIMEOUT_MS = 3_000;\nconst DARWIN_PLATFORM = 'darwin';\nconst OSASCRIPT_COMMAND = 'osascript';\nconst OSASCRIPT_EXPRESSION_FLAG = '-e';\n\nasync function execute(pi: NotificationExecutor, command: string, args: string[]): Promise<boolean> {\n try {\n const result = await pi.exec(command, args, { timeout: COMMAND_TIMEOUT_MS });\n return result.code === 0;\n } catch {\n // A notifier that is not installed is the ordinary case, not a fault: report\n // \"not delivered\" and let the caller decide whether another one exists.\n return false;\n }\n}\n\n/**\n * Delivers one desktop notification on a best-effort basis.\n *\n * cmux is tried first because it routes the notification to the window the\n * session actually lives in. Only macOS has a second option worth attempting,\n * and a host with neither stays silent rather than failing the turn.\n */\nexport async function sendSystemNotification(\n pi: NotificationExecutor,\n notification: DesktopNotification,\n platform: string = process.platform,\n): Promise<void> {\n const body = notificationBody(notification.body);\n const sentToCmux = await execute(pi, CMUX_COMMAND, [\n 'notify',\n '--title',\n notification.title,\n '--subtitle',\n notification.subtitle,\n '--body',\n body,\n ]);\n if (sentToCmux || platform !== DARWIN_PLATFORM) return;\n\n await execute(pi, OSASCRIPT_COMMAND, [\n OSASCRIPT_EXPRESSION_FLAG,\n 'on run argv',\n OSASCRIPT_EXPRESSION_FLAG,\n 'display notification (item 3 of argv) with title (item 1 of argv) subtitle (item 2 of argv)',\n OSASCRIPT_EXPRESSION_FLAG,\n 'end run',\n notification.title,\n notification.subtitle,\n body,\n ]);\n}\n","import { sign } from 'node:crypto';\nimport { connect } from 'node:http2';\nimport { request } from 'node:https';\n\nimport type { NativePushRequest, NativePushResponse } from './type';\n\nconst MAX_RESPONSE_BYTES = 65_536;\n\nexport function signPushJwt(header: object, claims: object, key: string, algorithm: 'ES256' | 'RS256'): string {\n const input = [header, claims].map((part) => Buffer.from(JSON.stringify(part)).toString('base64url')).join('.');\n const signature = sign('sha256', Buffer.from(input), { key, dsaEncoding: 'ieee-p1363' });\n // APNs requires the raw P1363 ECDSA signature, not ASN.1 DER.\n if (algorithm === 'ES256' && signature.length !== 64) throw new Error('Invalid signing key');\n return `${input}.${signature.toString('base64url')}`;\n}\n\nexport function createPushTransport() {\n const pending = new Set<() => void>();\n return {\n request(this: void, input: NativePushRequest): Promise<NativePushResponse> {\n return new Promise((resolve, reject) => {\n const url = new URL(input.url);\n let size = 0;\n const chunks: Buffer[] = [];\n let done = false;\n let dispose = () => {};\n const finish = (error?: Error, status = 0) => {\n if (done) return;\n done = true;\n clearTimeout(timer);\n pending.delete(cancel);\n dispose();\n if (error) reject(error);\n else resolve({ status, body: Buffer.concat(chunks).toString('utf8') });\n };\n const cancel = () => finish(new Error('Push request cancelled'));\n const timer = setTimeout(() => finish(new Error('Push request timed out')), input.timeoutMs);\n pending.add(cancel);\n const data = (chunk: Buffer) => {\n size += chunk.length;\n if (size > MAX_RESPONSE_BYTES) finish(new Error('Push response too large'));\n else chunks.push(Buffer.from(chunk));\n };\n if (input.http2) {\n const session = connect(url.origin);\n dispose = () => session.destroy();\n session.on('error', (error) => finish(error));\n const stream = session.request({ ':method': 'POST', ':path': url.pathname, ...input.headers });\n let status = 0;\n stream.on('response', (headers) => {\n status = Number(headers[':status']);\n });\n stream.on('data', data);\n stream.on('error', (error) => finish(error));\n stream.on('end', () => finish(undefined, status));\n stream.end(input.body);\n } else {\n const req = request(url, { method: 'POST', headers: input.headers }, (response) => {\n response.on('data', data);\n response.on('error', (error) => finish(error));\n response.on('end', () => finish(undefined, response.statusCode));\n });\n dispose = () => req.destroy();\n req.on('error', (error) => finish(error));\n req.end(input.body);\n }\n });\n },\n close() {\n for (const cancel of pending) cancel();\n },\n };\n}\n","import type { PoNotificationEntryData } from '@agimon-ai/po-core';\n\nimport { createPushTransport, signPushJwt } from './sync';\nimport type { NativePushSender, NativePushSenderOptions } from './type';\n\nconst MAX_PAYLOAD_BYTES = 4096;\nconst APNS_TOPIC = 'ai.po.app';\n// Only documented provider codes may enter diagnostics, never arbitrary response text.\nconst APNS_REASONS = new Set([\n 'BadCollapseId',\n 'BadDeviceToken',\n 'BadExpirationDate',\n 'BadMessageId',\n 'BadPriority',\n 'BadTopic',\n 'DeviceTokenNotForTopic',\n 'DuplicateHeaders',\n 'IdleTimeout',\n 'InvalidPushType',\n 'MissingDeviceToken',\n 'MissingTopic',\n 'PayloadEmpty',\n 'TopicDisallowed',\n 'BadCertificate',\n 'BadCertificateEnvironment',\n 'ExpiredProviderToken',\n 'Forbidden',\n 'InvalidProviderToken',\n 'MissingProviderToken',\n 'BadPath',\n 'MethodNotAllowed',\n 'Unregistered',\n 'PayloadTooLarge',\n 'TooManyProviderTokenUpdates',\n 'TooManyRequests',\n 'InternalServerError',\n 'ServiceUnavailable',\n 'Shutdown',\n]);\nconst OAUTH_URL = 'https://oauth2.googleapis.com/token';\nconst FCM_ERROR_TYPE = 'type.googleapis.com/google.firebase.fcm.v1.FcmError';\nconst encoder = new TextEncoder();\n\nfunction parse(body: string): Record<string, unknown> {\n try {\n const value: unknown = JSON.parse(body);\n return value && typeof value === 'object' ? (value as Record<string, unknown>) : {};\n } catch {\n return {};\n } // Malformed provider responses never invalidate registrations.\n}\n\nfunction payload(\n notification: PoNotificationEntryData,\n build: (text: { title: string; subtitle: string; body: string }) => object,\n): string {\n const text = { title: notification.title, subtitle: notification.subtitle, body: notification.body };\n let result = JSON.stringify(build(text));\n // Measure the full serialized envelope, including escaped text and the FCM token.\n for (const field of ['body', 'subtitle', 'title'] as const) {\n if (encoder.encode(result).length <= MAX_PAYLOAD_BYTES) break;\n const points = Array.from(text[field]);\n let low = 0;\n let high = points.length;\n while (low < high) {\n const middle = Math.ceil((low + high) / 2);\n text[field] = points.slice(0, middle).join('');\n if (encoder.encode(JSON.stringify(build(text))).length <= MAX_PAYLOAD_BYTES) low = middle;\n else high = middle - 1;\n }\n text[field] = points.slice(0, low).join('');\n result = JSON.stringify(build(text));\n }\n if (encoder.encode(result).length > MAX_PAYLOAD_BYTES) throw new Error('Push payload too large');\n return result;\n}\n\nexport function createNativePushSender(options: NativePushSenderOptions): NativePushSender {\n const transport = createPushTransport();\n const request = options.request ?? transport.request;\n const now = options.now ?? Date.now;\n const timeoutMs = Number.isFinite(options.timeoutMs) ? Math.max(1, Math.min(options.timeoutMs!, 30_000)) : 10_000;\n let closed = false;\n let apnsJwt: { value: string; expires: number } | undefined;\n let oauth: { value: string; expires: number } | undefined;\n let oauthPending: Promise<string> | undefined;\n\n async function accessToken(): Promise<string> {\n if (oauth && now() < oauth.expires) return oauth.value;\n if (oauthPending) return oauthPending;\n oauthPending = (async () => {\n const credentials = options.fcm!;\n const issued = Math.floor(now() / 1000);\n const assertion = signPushJwt(\n { alg: 'RS256', typ: 'JWT' },\n {\n iss: credentials.clientEmail,\n scope: 'https://www.googleapis.com/auth/firebase.messaging',\n aud: OAUTH_URL,\n iat: issued,\n exp: issued + 3600,\n },\n credentials.privateKey,\n 'RS256',\n );\n const response = await request({\n url: OAUTH_URL,\n headers: { 'content-type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams({ grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', assertion }).toString(),\n timeoutMs,\n });\n const data = parse(response.body);\n if (\n response.status !== 200 ||\n typeof data.access_token !== 'string' ||\n !data.access_token ||\n typeof data.expires_in !== 'number' ||\n !Number.isFinite(data.expires_in) ||\n data.expires_in <= 0\n )\n throw new Error('OAuth failed');\n oauth = { value: data.access_token, expires: now() + Math.max(0, Math.min(data.expires_in, 3600) - 60) * 1000 };\n return oauth.value;\n })();\n try {\n return await oauthPending;\n } finally {\n oauthPending = undefined;\n }\n }\n\n return {\n async send(registration, notification, sessionId) {\n const provider = registration.platform === 'ios' ? 'apns' : 'fcm';\n if (closed || !options[provider]) {\n options.diagnostic?.({ provider, outcome: 'unavailable' });\n return { invalid: false };\n }\n try {\n const data = {\n ...(registration.hostRef ? { hostRef: registration.hostRef } : {}),\n ...(sessionId ? { sessionId } : {}),\n };\n let response;\n let reason: string | undefined;\n if (registration.platform === 'ios') {\n const credentials = options.apns!;\n if (!apnsJwt || now() >= apnsJwt.expires) {\n apnsJwt = {\n value: signPushJwt(\n { alg: 'ES256', kid: credentials.keyId },\n {\n iss: credentials.teamId,\n iat: Math.floor(now() / 1000),\n },\n credentials.key,\n 'ES256',\n ),\n expires: now() + 50 * 60_000,\n };\n }\n response = await request({\n url: `https://${registration.environment === 'development' ? 'api.sandbox.push.apple.com' : 'api.push.apple.com'}/3/device/${encodeURIComponent(registration.token)}`,\n http2: true,\n timeoutMs,\n headers: {\n authorization: `bearer ${apnsJwt.value}`,\n 'apns-topic': APNS_TOPIC,\n 'apns-push-type': 'alert',\n 'apns-priority': '10',\n 'apns-expiration': '0',\n 'content-type': 'application/json',\n },\n // ponytail: live alerts only; add a durable outbox if delayed delivery becomes a requirement.\n // Expo iOS reads custom remote data from userInfo.body. Keep data as the provider-neutral payload.\n body: payload(notification, (text) => ({ aps: { alert: text, sound: 'default' }, data, body: data })),\n });\n const value = parse(response.body).reason;\n if (typeof value === 'string' && APNS_REASONS.has(value)) reason = value;\n if (\n (response.status === 410 && reason === 'Unregistered') ||\n (response.status === 400 && reason === 'BadDeviceToken')\n ) {\n options.diagnostic?.({\n provider,\n outcome: 'invalid',\n status: response.status,\n ...(reason ? { reason } : {}),\n });\n return { invalid: true };\n }\n } else {\n const body = payload(notification, (text) => ({\n message: {\n token: registration.token,\n data,\n notification: { title: text.title, body: [text.subtitle, text.body].filter(Boolean).join('\\n') },\n // ponytail: zero TTL, no offline delivery; an outbox would own delayed sends.\n android: { ttl: '0s', priority: 'HIGH', notification: { channel_id: 'po-notifications' } },\n },\n }));\n const token = await accessToken();\n if (closed) return { invalid: false };\n response = await request({\n url: `https://fcm.googleapis.com/v1/projects/${encodeURIComponent(options.fcm!.projectId)}/messages:send`,\n headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },\n body,\n timeoutMs,\n });\n const error = parse(response.body).error;\n if (\n response.status === 404 &&\n error &&\n typeof error === 'object' &&\n 'details' in error &&\n Array.isArray(error.details) &&\n error.details.some(\n (detail: unknown) =>\n detail &&\n typeof detail === 'object' &&\n '@type' in detail &&\n detail['@type'] === FCM_ERROR_TYPE &&\n 'errorCode' in detail &&\n detail.errorCode === 'UNREGISTERED',\n )\n ) {\n options.diagnostic?.({\n provider,\n outcome: 'invalid',\n status: response.status,\n ...(reason ? { reason } : {}),\n });\n return { invalid: true };\n }\n }\n if (response.status < 200 || response.status >= 300)\n options.diagnostic?.({ provider, outcome: 'failed', status: response.status, ...(reason ? { reason } : {}) });\n } catch {\n // Never expose provider bodies, credentials, device tokens, or network errors.\n options.diagnostic?.({ provider, outcome: 'failed' });\n }\n return { invalid: false };\n },\n close() {\n closed = true;\n apnsJwt = undefined;\n oauth = undefined;\n transport.close();\n },\n };\n}\n","import { AUTO_STOP_ACTION, DEFAULT_AUTO_STOP_DELAYS, decideOnRecheck } from '@agimon-ai/po-autostop';\nimport {\n BACKGROUND_RUNNER_DEADLINE_MS,\n BACKGROUND_WORK_HOLDING_PROVIDERS,\n holdsSettledSession,\n holdsSettledSessionAfterRunnerDeadline,\n} from '@agimon-ai/po-core/backgroundWork';\nimport type { PoHubSessionExecutionState } from '@agimon-ai/po-core/hubChannel';\n\nimport type { SessionFinishedDecision } from './type';\n\nexport const SESSION_FINISHED_COOLDOWN_MS = DEFAULT_AUTO_STOP_DELAYS.cooldownMs;\n\n/** The completion test shared by spoken notices and native push, after the initial cooldown. */\nexport function decideSessionFinished(\n state: PoHubSessionExecutionState | undefined,\n holdingSince: number | undefined,\n now: number,\n): SessionFinishedDecision {\n // Unknown background work cannot prove the run finished.\n if (!state?.backgroundWork) return { action: 'unavailable' };\n const expired = holdingSince !== undefined && now - holdingSince >= BACKGROUND_RUNNER_DEADLINE_MS;\n const holds = expired ? holdsSettledSessionAfterRunnerDeadline : holdsSettledSession;\n const { items, errors } = state.backgroundWork;\n if (items.some(holds) || errors.some((error) => BACKGROUND_WORK_HOLDING_PROVIDERS.includes(error.provider)))\n return {\n action: 'hold',\n delayMs: SESSION_FINISHED_COOLDOWN_MS,\n holdingSince: holdingSince ?? now,\n };\n const decision = decideOnRecheck(state, DEFAULT_AUTO_STOP_DELAYS);\n if (decision.action === AUTO_STOP_ACTION.recheck) return { action: 'recheck', delayMs: decision.delayMs };\n return { action: decision.action === AUTO_STOP_ACTION.shutdown ? 'finished' : 'stand-down' };\n}\n","const DEFAULT_ASK_USER_BODY = 'The agent is waiting for your feedback.';\nconst RPC_MODE = 'rpc';\n\nexport interface AttentionState {\n agentRunning: boolean;\n askUserBlocked: boolean;\n}\n\nexport interface ShellSurface {\n hasUI: boolean;\n mode?: string;\n}\n\n/**\n * A dialog is worth interrupting the user for only while the agent holds the turn.\n *\n * Outside a run the user opened the dialog themselves and is already looking at\n * it. An ask-user prompt is announced by its own event, so the dialog it then\n * opens must stay silent or the same question notifies twice.\n */\nexport function warrantsAttentionNotification({ agentRunning, askUserBlocked }: AttentionState): boolean {\n return agentRunning && !askUserBlocked;\n}\n\n/** A queued follow-up means the agent keeps working, so the run has not stopped for the user. */\nexport function warrantsSettledNotification(hasPendingMessages: boolean): boolean {\n return !hasPendingMessages;\n}\n\n/** Terminal title escapes only mean something on an attached terminal; RPC output stays clean. */\nexport function supportsShellTitle({ hasUI, mode }: ShellSurface): boolean {\n return hasUI && mode !== RPC_MODE;\n}\n\n/** The question an ask-user prompt is blocking on, or a stand-in when it asked none. */\nexport function askUserPromptBody(questions: readonly { question: string }[]): string {\n return questions[0]?.question ?? DEFAULT_ASK_USER_BODY;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,iBAAiB;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG;;AAI/E,SAAgB,kCAAwD;CACtE,IAAI,aAAa;CACjB,IAAI;CACJ,MAAM,sBAAsB;EAC1B,IAAI,OAAO,cAAc,KAAK;EAC9B,QAAQ,KAAA;EACR,aAAa;CACf;CAEA,OAAO;EACL,IAAI,OAAO,OAAO;GAChB,cAAc;GACd,MAAM,KAAK;EACb;EACA,MAAM,OAAO,OAAO;GAClB,cAAc;GACd,MAAM,eAAe;IACnB,MAAM,GAAG,eAAe,aAAa,eAAe,QAAQ,GAAG,OAAO;IACtE,cAAc;GAChB;GACA,OAAO;GACP,QAAQ,YAAY,QAAA,EAA+B;EACrD;EACA,KAAK,OAAO,OAAO;GACjB,cAAc;GACd,MAAM,KAAK;EACb;EACA,QAAQ,OAAO,OAAO;GACpB,cAAc;GACd,MAAM,KAAK;EACb;CACF;AACF;;;;;;;;;AC1BA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiC5B,SAAgB,8BAAoD;CAClE,MAAM,WAAW,gCAAgC;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,MAAM,iBAAiB;EACrB,SAAS,KAAA;EACT,IAAI,CAAC,eAAe,CAAC,WAAW;EAChC,SAAS,YAAY,OAAO,CAAC,YAAY,OAAO,SAAS;CAC3D;CAEA,IAAI;EACF,MAAM,cAAc,IAAIA,oBAAAA,OAAO,qBAAqB;GAClD,MAAM;GACN,YAAY;IAAE,QAAQ;IAAgB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AQ;GACN,SAAS;GACT,UAAU,KAAA;GACV,QAAQ,KAAA;GACR,UAAU,MAAM;EAClB;CACF;AACF;;;AC/OA,MAAa,+BAA+BC,uBAAAA,yBAAyB;;AAGrE,SAAgB,sBACd,OACA,cACA,KACyB;CAEzB,IAAI,CAAC,OAAO,gBAAgB,OAAO,EAAE,QAAQ,cAAc;CAE3D,MAAM,QADU,iBAAiB,KAAA,KAAa,MAAM,gBAAgBC,kCAAAA,gCAC5CC,kCAAAA,yCAAyCC,kCAAAA;CACjE,MAAM,EAAE,OAAO,WAAW,MAAM;CAChC,IAAI,MAAM,KAAK,KAAK,KAAK,OAAO,MAAM,UAAUC,kCAAAA,kCAAkC,SAAS,MAAM,QAAQ,CAAC,GACxG,OAAO;EACL,QAAQ;EACR,SAAS;EACT,cAAc,gBAAgB;CAChC;CACF,MAAM,YAAA,GAAWC,uBAAAA,gBAAAA,CAAgB,OAAOL,uBAAAA,wBAAwB;CAChE,IAAI,SAAS,WAAWM,uBAAAA,iBAAiB,SAAS,OAAO;EAAE,QAAQ;EAAW,SAAS,SAAS;CAAQ;CACxG,OAAO,EAAE,QAAQ,SAAS,WAAWA,uBAAAA,iBAAiB,WAAW,aAAa,aAAa;AAC7F;;;ACjCA,MAAM,wBAAwB;AAC9B,MAAM,WAAW;;;;;;;;AAmBjB,SAAgB,8BAA8B,EAAE,cAAc,kBAA2C;CACvG,OAAO,gBAAgB,CAAC;AAC1B;;AAGA,SAAgB,4BAA4B,oBAAsC;CAChF,OAAO,CAAC;AACV;;AAGA,SAAgB,mBAAmB,EAAE,OAAO,QAA+B;CACzE,OAAO,SAAS,SAAS;AAC3B;;AAGA,SAAgB,kBAAkB,WAAoD;CACpF,OAAO,UAAU,EAAE,EAAE,YAAY;AACnC"}
|
package/dist/index.d.mts
CHANGED
|
@@ -182,8 +182,10 @@ interface ShellTabTitleInput {
|
|
|
182
182
|
export declare function shellTabTitle({ cwd, sessionName, prompt }: ShellTabTitleInput): string;
|
|
183
183
|
/** Notification bodies are one line in a system panel, so they collapse and truncate. */
|
|
184
184
|
export declare function notificationBody(body: string): string;
|
|
185
|
+
/** Renders one message: a language pack's text for `key`, or the English `fallback`. */
|
|
186
|
+
type NotificationTranslate = (key: string, fallback: string, vars?: Readonly<Record<string, string | number>>) => string;
|
|
185
187
|
/** Sent while the agent holds the turn and something is blocking on the user. */
|
|
186
|
-
export declare function attentionNotification(body: string): DesktopNotification;
|
|
188
|
+
export declare function attentionNotification(body: string, t?: NotificationTranslate): DesktopNotification;
|
|
187
189
|
/**
|
|
188
190
|
* Sent once a run has stopped. The title carries the session name so it shows even where a
|
|
189
191
|
* platform hides subtitles; an unnamed session (the hub sends `''`) falls back to the repository.
|
|
@@ -191,7 +193,7 @@ export declare function attentionNotification(body: string): DesktopNotification
|
|
|
191
193
|
export declare function settledNotification({ cwd, sessionName }: {
|
|
192
194
|
cwd: string;
|
|
193
195
|
sessionName?: string;
|
|
194
|
-
}): DesktopNotification;
|
|
196
|
+
}, t?: NotificationTranslate): DesktopNotification;
|
|
195
197
|
//#endregion
|
|
196
|
-
export type { AttentionState, DesktopNotification, NotificationExtensionOptions, SessionFinishedDecision, ShellSurface, ShellTabTitleInput, ShellTitleAction, ShellTitleCommand, ShellTitleController, WriteTitle };
|
|
198
|
+
export type { AttentionState, DesktopNotification, NotificationExtensionOptions, NotificationTranslate, SessionFinishedDecision, ShellSurface, ShellTabTitleInput, ShellTitleAction, ShellTitleCommand, ShellTitleController, WriteTitle };
|
|
197
199
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/notifications.ts","../src/services/shellTitleController/mainThread.ts","../src/services/shellTitleController/index.ts","../src/services/systemNotification/index.ts","../src/services/nativePushSender/type.ts","../src/services/nativePushSender/index.ts","../src/services/completion/type.ts","../src/services/completion/index.ts","../src/services/notificationPolicy/index.ts","../src/services/notificationText/index.ts"],"mappings":";;;UAAiB;;EAEf,kBAAkB;EAClB,cAAc,OAAO;;UAGN;EACf,KAAK,iBAAiB,gBAAgB;IAAW;MAAoB;IAAU;;;;KAIrE,cAAc;;KAGd;;UAGK;EACf,QAAQ;EACR;;;;;;;;;;UAWe;EACf,IAAI,eAAe,OAAO;EAC1B,MAAM,eAAe,OAAO;EAC5B,KAAK,eAAe,OAAO;EAC3B,QAAQ,eAAe,OAAO;;;UAIf;EACf;EACA;EACA;;;;;wBCnCc,mCAAmC;;;;;;;;wBCuCnC,+BAA+B;;;;;;;;;;wBClBzB,uBACpB,IAAI,sBACJ,cAAc,qBACd,oBACC;;;KC7BS;EACN;EAAiB;EAAe;EAAkB;;EAClD;EAAqB;EAAe;;UAEzB;EACf;EACA,SAAS;EACT;EACA;EACA;;UAEe;EACf;EACA;;UAEe;EACf;IAAS;IAAa;IAAe;;EACrC;IAAQ;IAAqB;IAAoB;;EACjD;EACA,WAAW,SAAS,sBAAsB,QAAQ;EAClD;EACA,cAAc;IACZ;IACA;IACA;IACA;;;UAGa;EACf,KACE,cAAc,wBACd,cAAc,yBACd,qBACC;IAAU;;EACb;;;;wBCyCc,uBAAuB,SAAS,0BAA0B;;;KC7E9D;WACG;;WACA;WAA4B;;WAC5B;WAAyB;WAA0B;;WACnD;;WACA;;;;qBCMF;;wBAGG,sBACd,OAAO,wCACP,kCACA,cACC;;;UCfc;EACf;EACA;;UAGe;EACf;EACA;;;;;;;;;wBAUc,gCAAgC,cAAc,kBAAkB;;wBAKhE,4BAA4B;;wBAK5B,qBAAqB,OAAO,QAAQ;;wBAKpC,kBAAkB;EAAsB;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/notifications.ts","../src/services/shellTitleController/mainThread.ts","../src/services/shellTitleController/index.ts","../src/services/systemNotification/index.ts","../src/services/nativePushSender/type.ts","../src/services/nativePushSender/index.ts","../src/services/completion/type.ts","../src/services/completion/index.ts","../src/services/notificationPolicy/index.ts","../src/services/notificationText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AG,wBACF"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Worker } from "node:worker_threads";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { formatMessage } from "@agimon-ai/po-core/locale";
|
|
3
4
|
import { sign } from "node:crypto";
|
|
4
5
|
import { connect } from "node:http2";
|
|
5
6
|
import { request } from "node:https";
|
|
@@ -152,13 +153,9 @@ function createWorkerTitleController() {
|
|
|
152
153
|
}
|
|
153
154
|
//#endregion
|
|
154
155
|
//#region src/services/notificationText/index.ts
|
|
155
|
-
const ATTENTION_SUBTITLE = "Approval or feedback required";
|
|
156
|
-
const ATTENTION_TITLE = "Po needs your input";
|
|
157
156
|
const ELLIPSIS = "…";
|
|
158
157
|
const MAX_BODY_LENGTH = 240;
|
|
159
158
|
const MAX_PROMPT_TITLE_LENGTH = 36;
|
|
160
|
-
const SETTLED_BODY = "The agent finished its work and is waiting for you.";
|
|
161
|
-
const SETTLED_TITLE_PREFIX = "Po finished: ";
|
|
162
159
|
const SHELL_TITLE_SEPARATOR = " - ";
|
|
163
160
|
const SHELL_TITLE_PREFIX = "π";
|
|
164
161
|
function collapseWhitespace(value) {
|
|
@@ -187,11 +184,12 @@ function shellTabTitle({ cwd, sessionName, prompt }) {
|
|
|
187
184
|
function notificationBody(body) {
|
|
188
185
|
return truncate(collapseWhitespace(body), MAX_BODY_LENGTH);
|
|
189
186
|
}
|
|
187
|
+
const english = (_key, fallback, vars) => formatMessage(fallback, vars);
|
|
190
188
|
/** Sent while the agent holds the turn and something is blocking on the user. */
|
|
191
|
-
function attentionNotification(body) {
|
|
189
|
+
function attentionNotification(body, t = english) {
|
|
192
190
|
return {
|
|
193
|
-
title:
|
|
194
|
-
subtitle:
|
|
191
|
+
title: t("notification.attention.title", "Po needs your input"),
|
|
192
|
+
subtitle: t("notification.attention.subtitle", "Approval or feedback required"),
|
|
195
193
|
body
|
|
196
194
|
};
|
|
197
195
|
}
|
|
@@ -199,13 +197,13 @@ function attentionNotification(body) {
|
|
|
199
197
|
* Sent once a run has stopped. The title carries the session name so it shows even where a
|
|
200
198
|
* platform hides subtitles; an unnamed session (the hub sends `''`) falls back to the repository.
|
|
201
199
|
*/
|
|
202
|
-
function settledNotification({ cwd, sessionName }) {
|
|
200
|
+
function settledNotification({ cwd, sessionName }, t = english) {
|
|
203
201
|
const repository = path.basename(cwd);
|
|
204
202
|
const name = sessionName?.trim();
|
|
205
203
|
return {
|
|
206
|
-
title:
|
|
204
|
+
title: t("notification.settled.title", "Po finished: {name}", { name: name || repository }),
|
|
207
205
|
subtitle: name ? repository : "",
|
|
208
|
-
body:
|
|
206
|
+
body: t("notification.settled.body", "The agent finished its work and is waiting for you.")
|
|
209
207
|
};
|
|
210
208
|
}
|
|
211
209
|
//#endregion
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/services/shellTitleController/mainThread.ts","../src/services/shellTitleController/index.ts","../src/services/notificationText/index.ts","../src/services/systemNotification/index.ts","../src/services/nativePushSender/sync.ts","../src/services/nativePushSender/index.ts","../src/services/completion/index.ts","../src/services/notificationPolicy/index.ts"],"sourcesContent":["import type { ShellTitleController } from '../../types/notifications';\n\nexport const BRAILLE_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\nexport const TITLE_FRAME_INTERVAL_MS = 80;\n\n/** Animates on the main thread, for hosts where a worker could not be started. */\nexport function createMainThreadTitleController(): ShellTitleController {\n let frameIndex = 0;\n let timer: ReturnType<typeof setInterval> | undefined;\n const stopAnimation = () => {\n if (timer) clearInterval(timer);\n timer = undefined;\n frameIndex = 0;\n };\n\n return {\n set(title, write) {\n stopAnimation();\n write(title);\n },\n start(title, write) {\n stopAnimation();\n const render = () => {\n write(`${BRAILLE_FRAMES[frameIndex % BRAILLE_FRAMES.length]} ${title}`);\n frameIndex += 1;\n };\n render();\n timer = setInterval(render, TITLE_FRAME_INTERVAL_MS);\n },\n stop(title, write) {\n stopAnimation();\n write(title);\n },\n dispose(title, write) {\n stopAnimation();\n write(title);\n },\n };\n}\n","import { Worker } from 'node:worker_threads';\n\nimport type { ShellTitleCommand, ShellTitleController, WriteTitle } from '../../types/notifications';\nimport { BRAILLE_FRAMES, TITLE_FRAME_INTERVAL_MS, createMainThreadTitleController } from './mainThread';\n\nexport { createMainThreadTitleController } from './mainThread';\n/**\n * The animator runs off the main thread so a busy agent turn cannot stall the\n * spinner. It is an inline eval source rather than a shipped file because the\n * package is bundled per entry, and a separate worker module would have to be\n * located on disk at runtime.\n */\nconst TITLE_WORKER_SOURCE = `\nconst { createWriteStream } = require('node:fs');\nconst output = createWriteStream('', { fd: 1, autoClose: false });\nconst { parentPort, workerData } = require('node:worker_threads');\nlet frameIndex = 0;\nlet timer;\nconst writeTitle = (title) => output.write('\\\\u001b]0;' + title + '\\\\u0007');\nconst stop = () => {\n if (timer) clearInterval(timer);\n timer = undefined;\n frameIndex = 0;\n};\nparentPort.on('message', (command) => {\n stop();\n if (command.action === 'start') {\n const render = () => {\n writeTitle(workerData.frames[frameIndex % workerData.frames.length] + ' ' + command.title);\n frameIndex += 1;\n };\n render();\n timer = setInterval(render, workerData.intervalMs);\n return;\n }\n writeTitle(command.title);\n if (command.action === 'dispose') output.end(() => parentPort.close());\n});\n`;\n\n/**\n * Animates from a worker thread, replaying the last command on the main thread\n * if the worker never started, failed, or exited under us. The worker is\n * unreferenced so a pending frame never holds the process open.\n */\nexport function createWorkerTitleController(): ShellTitleController {\n const fallback = createMainThreadTitleController();\n let lastCommand: ShellTitleCommand | undefined;\n let lastWrite: WriteTitle | undefined;\n let worker: Worker | undefined;\n\n const fallBack = () => {\n worker = undefined;\n if (!lastCommand || !lastWrite) return;\n fallback[lastCommand.action](lastCommand.title, lastWrite);\n };\n\n try {\n const titleWorker = new Worker(TITLE_WORKER_SOURCE, {\n eval: true,\n workerData: { frames: BRAILLE_FRAMES, intervalMs: TITLE_FRAME_INTERVAL_MS },\n });\n titleWorker.unref();\n titleWorker.once('error', fallBack);\n titleWorker.once('exit', (code) => {\n if (code !== 0 && worker === titleWorker) fallBack();\n });\n worker = titleWorker;\n } catch {\n // Workers are unavailable on this host, which the main-thread animator covers.\n worker = undefined;\n }\n\n const dispatch = (command: ShellTitleCommand, write: WriteTitle) => {\n lastCommand = command;\n lastWrite = write;\n if (!worker) {\n fallback[command.action](command.title, write);\n return;\n }\n try {\n worker.postMessage(command);\n } catch {\n // The worker closed between the last frame and this command.\n fallBack();\n }\n };\n\n return {\n set: (title, write) => dispatch({ action: 'set', title }, write),\n start: (title, write) => dispatch({ action: 'start', title }, write),\n stop: (title, write) => dispatch({ action: 'stop', title }, write),\n dispose: (title, write) => dispatch({ action: 'dispose', title }, write),\n };\n}\n","import path from 'node:path';\n\nimport type { DesktopNotification } from '../../types/notifications';\n\nconst ATTENTION_SUBTITLE = 'Approval or feedback required';\nconst ATTENTION_TITLE = 'Po needs your input';\nconst ELLIPSIS = '…';\nconst MAX_BODY_LENGTH = 240;\nconst MAX_PROMPT_TITLE_LENGTH = 36;\nconst SETTLED_BODY = 'The agent finished its work and is waiting for you.';\nconst SETTLED_TITLE_PREFIX = 'Po finished: ';\nconst SHELL_TITLE_SEPARATOR = ' - ';\nconst SHELL_TITLE_PREFIX = 'π';\n\nfunction collapseWhitespace(value: string): string {\n return value.replace(/\\s+/g, ' ').trim();\n}\n\nfunction truncate(value: string, maxLength: number): string {\n return value.length > maxLength ? `${value.slice(0, maxLength - 1)}${ELLIPSIS}` : value;\n}\n\n/** The first user prompt, shortened to fit a shell tab. A blank prompt names nothing. */\nexport function promptTitle(prompt: string): string | undefined {\n const normalized = collapseWhitespace(prompt);\n return normalized ? truncate(normalized, MAX_PROMPT_TITLE_LENGTH) : undefined;\n}\n\nexport interface ShellTabTitleInput {\n cwd: string;\n sessionName?: string;\n prompt?: string;\n}\n\n/**\n * The idle shell-tab title: `π - <label> - <repository>`.\n *\n * The session name wins over the first prompt because the user chose it. With\n * neither, the repository alone still tells two tabs apart.\n */\nexport function shellTabTitle({ cwd, sessionName, prompt }: ShellTabTitleInput): string {\n const repository = path.basename(cwd);\n const label = sessionName ?? prompt;\n return label\n ? `${SHELL_TITLE_PREFIX}${SHELL_TITLE_SEPARATOR}${label}${SHELL_TITLE_SEPARATOR}${repository}`\n : `${SHELL_TITLE_PREFIX}${SHELL_TITLE_SEPARATOR}${repository}`;\n}\n\n/** Notification bodies are one line in a system panel, so they collapse and truncate. */\nexport function notificationBody(body: string): string {\n return truncate(collapseWhitespace(body), MAX_BODY_LENGTH);\n}\n\n/** Sent while the agent holds the turn and something is blocking on the user. */\nexport function attentionNotification(body: string): DesktopNotification {\n return { title: ATTENTION_TITLE, subtitle: ATTENTION_SUBTITLE, body };\n}\n\n/**\n * Sent once a run has stopped. The title carries the session name so it shows even where a\n * platform hides subtitles; an unnamed session (the hub sends `''`) falls back to the repository.\n */\nexport function settledNotification({ cwd, sessionName }: { cwd: string; sessionName?: string }): DesktopNotification {\n const repository = path.basename(cwd);\n const name = sessionName?.trim();\n return {\n title: `${SETTLED_TITLE_PREFIX}${name || repository}`,\n subtitle: name ? repository : '',\n body: SETTLED_BODY,\n };\n}\n","import type { DesktopNotification, NotificationExecutor } from '../../types/notifications';\nimport { notificationBody } from '../notificationText';\n\nconst CMUX_COMMAND = 'cmux';\nconst COMMAND_TIMEOUT_MS = 3_000;\nconst DARWIN_PLATFORM = 'darwin';\nconst OSASCRIPT_COMMAND = 'osascript';\nconst OSASCRIPT_EXPRESSION_FLAG = '-e';\n\nasync function execute(pi: NotificationExecutor, command: string, args: string[]): Promise<boolean> {\n try {\n const result = await pi.exec(command, args, { timeout: COMMAND_TIMEOUT_MS });\n return result.code === 0;\n } catch {\n // A notifier that is not installed is the ordinary case, not a fault: report\n // \"not delivered\" and let the caller decide whether another one exists.\n return false;\n }\n}\n\n/**\n * Delivers one desktop notification on a best-effort basis.\n *\n * cmux is tried first because it routes the notification to the window the\n * session actually lives in. Only macOS has a second option worth attempting,\n * and a host with neither stays silent rather than failing the turn.\n */\nexport async function sendSystemNotification(\n pi: NotificationExecutor,\n notification: DesktopNotification,\n platform: string = process.platform,\n): Promise<void> {\n const body = notificationBody(notification.body);\n const sentToCmux = await execute(pi, CMUX_COMMAND, [\n 'notify',\n '--title',\n notification.title,\n '--subtitle',\n notification.subtitle,\n '--body',\n body,\n ]);\n if (sentToCmux || platform !== DARWIN_PLATFORM) return;\n\n await execute(pi, OSASCRIPT_COMMAND, [\n OSASCRIPT_EXPRESSION_FLAG,\n 'on run argv',\n OSASCRIPT_EXPRESSION_FLAG,\n 'display notification (item 3 of argv) with title (item 1 of argv) subtitle (item 2 of argv)',\n OSASCRIPT_EXPRESSION_FLAG,\n 'end run',\n notification.title,\n notification.subtitle,\n body,\n ]);\n}\n","import { sign } from 'node:crypto';\nimport { connect } from 'node:http2';\nimport { request } from 'node:https';\n\nimport type { NativePushRequest, NativePushResponse } from './type';\n\nconst MAX_RESPONSE_BYTES = 65_536;\n\nexport function signPushJwt(header: object, claims: object, key: string, algorithm: 'ES256' | 'RS256'): string {\n const input = [header, claims].map((part) => Buffer.from(JSON.stringify(part)).toString('base64url')).join('.');\n const signature = sign('sha256', Buffer.from(input), { key, dsaEncoding: 'ieee-p1363' });\n // APNs requires the raw P1363 ECDSA signature, not ASN.1 DER.\n if (algorithm === 'ES256' && signature.length !== 64) throw new Error('Invalid signing key');\n return `${input}.${signature.toString('base64url')}`;\n}\n\nexport function createPushTransport() {\n const pending = new Set<() => void>();\n return {\n request(this: void, input: NativePushRequest): Promise<NativePushResponse> {\n return new Promise((resolve, reject) => {\n const url = new URL(input.url);\n let size = 0;\n const chunks: Buffer[] = [];\n let done = false;\n let dispose = () => {};\n const finish = (error?: Error, status = 0) => {\n if (done) return;\n done = true;\n clearTimeout(timer);\n pending.delete(cancel);\n dispose();\n if (error) reject(error);\n else resolve({ status, body: Buffer.concat(chunks).toString('utf8') });\n };\n const cancel = () => finish(new Error('Push request cancelled'));\n const timer = setTimeout(() => finish(new Error('Push request timed out')), input.timeoutMs);\n pending.add(cancel);\n const data = (chunk: Buffer) => {\n size += chunk.length;\n if (size > MAX_RESPONSE_BYTES) finish(new Error('Push response too large'));\n else chunks.push(Buffer.from(chunk));\n };\n if (input.http2) {\n const session = connect(url.origin);\n dispose = () => session.destroy();\n session.on('error', (error) => finish(error));\n const stream = session.request({ ':method': 'POST', ':path': url.pathname, ...input.headers });\n let status = 0;\n stream.on('response', (headers) => {\n status = Number(headers[':status']);\n });\n stream.on('data', data);\n stream.on('error', (error) => finish(error));\n stream.on('end', () => finish(undefined, status));\n stream.end(input.body);\n } else {\n const req = request(url, { method: 'POST', headers: input.headers }, (response) => {\n response.on('data', data);\n response.on('error', (error) => finish(error));\n response.on('end', () => finish(undefined, response.statusCode));\n });\n dispose = () => req.destroy();\n req.on('error', (error) => finish(error));\n req.end(input.body);\n }\n });\n },\n close() {\n for (const cancel of pending) cancel();\n },\n };\n}\n","import type { PoNotificationEntryData } from '@agimon-ai/po-core';\n\nimport { createPushTransport, signPushJwt } from './sync';\nimport type { NativePushSender, NativePushSenderOptions } from './type';\n\nconst MAX_PAYLOAD_BYTES = 4096;\nconst APNS_TOPIC = 'ai.po.app';\n// Only documented provider codes may enter diagnostics, never arbitrary response text.\nconst APNS_REASONS = new Set([\n 'BadCollapseId',\n 'BadDeviceToken',\n 'BadExpirationDate',\n 'BadMessageId',\n 'BadPriority',\n 'BadTopic',\n 'DeviceTokenNotForTopic',\n 'DuplicateHeaders',\n 'IdleTimeout',\n 'InvalidPushType',\n 'MissingDeviceToken',\n 'MissingTopic',\n 'PayloadEmpty',\n 'TopicDisallowed',\n 'BadCertificate',\n 'BadCertificateEnvironment',\n 'ExpiredProviderToken',\n 'Forbidden',\n 'InvalidProviderToken',\n 'MissingProviderToken',\n 'BadPath',\n 'MethodNotAllowed',\n 'Unregistered',\n 'PayloadTooLarge',\n 'TooManyProviderTokenUpdates',\n 'TooManyRequests',\n 'InternalServerError',\n 'ServiceUnavailable',\n 'Shutdown',\n]);\nconst OAUTH_URL = 'https://oauth2.googleapis.com/token';\nconst FCM_ERROR_TYPE = 'type.googleapis.com/google.firebase.fcm.v1.FcmError';\nconst encoder = new TextEncoder();\n\nfunction parse(body: string): Record<string, unknown> {\n try {\n const value: unknown = JSON.parse(body);\n return value && typeof value === 'object' ? (value as Record<string, unknown>) : {};\n } catch {\n return {};\n } // Malformed provider responses never invalidate registrations.\n}\n\nfunction payload(\n notification: PoNotificationEntryData,\n build: (text: { title: string; subtitle: string; body: string }) => object,\n): string {\n const text = { title: notification.title, subtitle: notification.subtitle, body: notification.body };\n let result = JSON.stringify(build(text));\n // Measure the full serialized envelope, including escaped text and the FCM token.\n for (const field of ['body', 'subtitle', 'title'] as const) {\n if (encoder.encode(result).length <= MAX_PAYLOAD_BYTES) break;\n const points = Array.from(text[field]);\n let low = 0;\n let high = points.length;\n while (low < high) {\n const middle = Math.ceil((low + high) / 2);\n text[field] = points.slice(0, middle).join('');\n if (encoder.encode(JSON.stringify(build(text))).length <= MAX_PAYLOAD_BYTES) low = middle;\n else high = middle - 1;\n }\n text[field] = points.slice(0, low).join('');\n result = JSON.stringify(build(text));\n }\n if (encoder.encode(result).length > MAX_PAYLOAD_BYTES) throw new Error('Push payload too large');\n return result;\n}\n\nexport function createNativePushSender(options: NativePushSenderOptions): NativePushSender {\n const transport = createPushTransport();\n const request = options.request ?? transport.request;\n const now = options.now ?? Date.now;\n const timeoutMs = Number.isFinite(options.timeoutMs) ? Math.max(1, Math.min(options.timeoutMs!, 30_000)) : 10_000;\n let closed = false;\n let apnsJwt: { value: string; expires: number } | undefined;\n let oauth: { value: string; expires: number } | undefined;\n let oauthPending: Promise<string> | undefined;\n\n async function accessToken(): Promise<string> {\n if (oauth && now() < oauth.expires) return oauth.value;\n if (oauthPending) return oauthPending;\n oauthPending = (async () => {\n const credentials = options.fcm!;\n const issued = Math.floor(now() / 1000);\n const assertion = signPushJwt(\n { alg: 'RS256', typ: 'JWT' },\n {\n iss: credentials.clientEmail,\n scope: 'https://www.googleapis.com/auth/firebase.messaging',\n aud: OAUTH_URL,\n iat: issued,\n exp: issued + 3600,\n },\n credentials.privateKey,\n 'RS256',\n );\n const response = await request({\n url: OAUTH_URL,\n headers: { 'content-type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams({ grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', assertion }).toString(),\n timeoutMs,\n });\n const data = parse(response.body);\n if (\n response.status !== 200 ||\n typeof data.access_token !== 'string' ||\n !data.access_token ||\n typeof data.expires_in !== 'number' ||\n !Number.isFinite(data.expires_in) ||\n data.expires_in <= 0\n )\n throw new Error('OAuth failed');\n oauth = { value: data.access_token, expires: now() + Math.max(0, Math.min(data.expires_in, 3600) - 60) * 1000 };\n return oauth.value;\n })();\n try {\n return await oauthPending;\n } finally {\n oauthPending = undefined;\n }\n }\n\n return {\n async send(registration, notification, sessionId) {\n const provider = registration.platform === 'ios' ? 'apns' : 'fcm';\n if (closed || !options[provider]) {\n options.diagnostic?.({ provider, outcome: 'unavailable' });\n return { invalid: false };\n }\n try {\n const data = {\n ...(registration.hostRef ? { hostRef: registration.hostRef } : {}),\n ...(sessionId ? { sessionId } : {}),\n };\n let response;\n let reason: string | undefined;\n if (registration.platform === 'ios') {\n const credentials = options.apns!;\n if (!apnsJwt || now() >= apnsJwt.expires) {\n apnsJwt = {\n value: signPushJwt(\n { alg: 'ES256', kid: credentials.keyId },\n {\n iss: credentials.teamId,\n iat: Math.floor(now() / 1000),\n },\n credentials.key,\n 'ES256',\n ),\n expires: now() + 50 * 60_000,\n };\n }\n response = await request({\n url: `https://${registration.environment === 'development' ? 'api.sandbox.push.apple.com' : 'api.push.apple.com'}/3/device/${encodeURIComponent(registration.token)}`,\n http2: true,\n timeoutMs,\n headers: {\n authorization: `bearer ${apnsJwt.value}`,\n 'apns-topic': APNS_TOPIC,\n 'apns-push-type': 'alert',\n 'apns-priority': '10',\n 'apns-expiration': '0',\n 'content-type': 'application/json',\n },\n // ponytail: live alerts only; add a durable outbox if delayed delivery becomes a requirement.\n // Expo iOS reads custom remote data from userInfo.body. Keep data as the provider-neutral payload.\n body: payload(notification, (text) => ({ aps: { alert: text, sound: 'default' }, data, body: data })),\n });\n const value = parse(response.body).reason;\n if (typeof value === 'string' && APNS_REASONS.has(value)) reason = value;\n if (\n (response.status === 410 && reason === 'Unregistered') ||\n (response.status === 400 && reason === 'BadDeviceToken')\n ) {\n options.diagnostic?.({\n provider,\n outcome: 'invalid',\n status: response.status,\n ...(reason ? { reason } : {}),\n });\n return { invalid: true };\n }\n } else {\n const body = payload(notification, (text) => ({\n message: {\n token: registration.token,\n data,\n notification: { title: text.title, body: [text.subtitle, text.body].filter(Boolean).join('\\n') },\n // ponytail: zero TTL, no offline delivery; an outbox would own delayed sends.\n android: { ttl: '0s', priority: 'HIGH', notification: { channel_id: 'po-notifications' } },\n },\n }));\n const token = await accessToken();\n if (closed) return { invalid: false };\n response = await request({\n url: `https://fcm.googleapis.com/v1/projects/${encodeURIComponent(options.fcm!.projectId)}/messages:send`,\n headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },\n body,\n timeoutMs,\n });\n const error = parse(response.body).error;\n if (\n response.status === 404 &&\n error &&\n typeof error === 'object' &&\n 'details' in error &&\n Array.isArray(error.details) &&\n error.details.some(\n (detail: unknown) =>\n detail &&\n typeof detail === 'object' &&\n '@type' in detail &&\n detail['@type'] === FCM_ERROR_TYPE &&\n 'errorCode' in detail &&\n detail.errorCode === 'UNREGISTERED',\n )\n ) {\n options.diagnostic?.({\n provider,\n outcome: 'invalid',\n status: response.status,\n ...(reason ? { reason } : {}),\n });\n return { invalid: true };\n }\n }\n if (response.status < 200 || response.status >= 300)\n options.diagnostic?.({ provider, outcome: 'failed', status: response.status, ...(reason ? { reason } : {}) });\n } catch {\n // Never expose provider bodies, credentials, device tokens, or network errors.\n options.diagnostic?.({ provider, outcome: 'failed' });\n }\n return { invalid: false };\n },\n close() {\n closed = true;\n apnsJwt = undefined;\n oauth = undefined;\n transport.close();\n },\n };\n}\n","import { AUTO_STOP_ACTION, DEFAULT_AUTO_STOP_DELAYS, decideOnRecheck } from '@agimon-ai/po-autostop';\nimport {\n BACKGROUND_RUNNER_DEADLINE_MS,\n BACKGROUND_WORK_HOLDING_PROVIDERS,\n holdsSettledSession,\n holdsSettledSessionAfterRunnerDeadline,\n} from '@agimon-ai/po-core/backgroundWork';\nimport type { PoHubSessionExecutionState } from '@agimon-ai/po-core/hubChannel';\n\nimport type { SessionFinishedDecision } from './type';\n\nexport const SESSION_FINISHED_COOLDOWN_MS = DEFAULT_AUTO_STOP_DELAYS.cooldownMs;\n\n/** The completion test shared by spoken notices and native push, after the initial cooldown. */\nexport function decideSessionFinished(\n state: PoHubSessionExecutionState | undefined,\n holdingSince: number | undefined,\n now: number,\n): SessionFinishedDecision {\n // Unknown background work cannot prove the run finished.\n if (!state?.backgroundWork) return { action: 'unavailable' };\n const expired = holdingSince !== undefined && now - holdingSince >= BACKGROUND_RUNNER_DEADLINE_MS;\n const holds = expired ? holdsSettledSessionAfterRunnerDeadline : holdsSettledSession;\n const { items, errors } = state.backgroundWork;\n if (items.some(holds) || errors.some((error) => BACKGROUND_WORK_HOLDING_PROVIDERS.includes(error.provider)))\n return {\n action: 'hold',\n delayMs: SESSION_FINISHED_COOLDOWN_MS,\n holdingSince: holdingSince ?? now,\n };\n const decision = decideOnRecheck(state, DEFAULT_AUTO_STOP_DELAYS);\n if (decision.action === AUTO_STOP_ACTION.recheck) return { action: 'recheck', delayMs: decision.delayMs };\n return { action: decision.action === AUTO_STOP_ACTION.shutdown ? 'finished' : 'stand-down' };\n}\n","const DEFAULT_ASK_USER_BODY = 'The agent is waiting for your feedback.';\nconst RPC_MODE = 'rpc';\n\nexport interface AttentionState {\n agentRunning: boolean;\n askUserBlocked: boolean;\n}\n\nexport interface ShellSurface {\n hasUI: boolean;\n mode?: string;\n}\n\n/**\n * A dialog is worth interrupting the user for only while the agent holds the turn.\n *\n * Outside a run the user opened the dialog themselves and is already looking at\n * it. An ask-user prompt is announced by its own event, so the dialog it then\n * opens must stay silent or the same question notifies twice.\n */\nexport function warrantsAttentionNotification({ agentRunning, askUserBlocked }: AttentionState): boolean {\n return agentRunning && !askUserBlocked;\n}\n\n/** A queued follow-up means the agent keeps working, so the run has not stopped for the user. */\nexport function warrantsSettledNotification(hasPendingMessages: boolean): boolean {\n return !hasPendingMessages;\n}\n\n/** Terminal title escapes only mean something on an attached terminal; RPC output stays clean. */\nexport function supportsShellTitle({ hasUI, mode }: ShellSurface): boolean {\n return hasUI && mode !== RPC_MODE;\n}\n\n/** The question an ask-user prompt is blocking on, or a stand-in when it asked none. */\nexport function askUserPromptBody(questions: readonly { question: string }[]): string {\n return questions[0]?.question ?? DEFAULT_ASK_USER_BODY;\n}\n"],"mappings":";;;;;;;;AAEA,MAAa,iBAAiB;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG;;AAI/E,SAAgB,kCAAwD;CACtE,IAAI,aAAa;CACjB,IAAI;CACJ,MAAM,sBAAsB;EAC1B,IAAI,OAAO,cAAc,KAAK;EAC9B,QAAQ,KAAA;EACR,aAAa;CACf;CAEA,OAAO;EACL,IAAI,OAAO,OAAO;GAChB,cAAc;GACd,MAAM,KAAK;EACb;EACA,MAAM,OAAO,OAAO;GAClB,cAAc;GACd,MAAM,eAAe;IACnB,MAAM,GAAG,eAAe,aAAa,eAAe,QAAQ,GAAG,OAAO;IACtE,cAAc;GAChB;GACA,OAAO;GACP,QAAQ,YAAY,QAAA,EAA+B;EACrD;EACA,KAAK,OAAO,OAAO;GACjB,cAAc;GACd,MAAM,KAAK;EACb;EACA,QAAQ,OAAO,OAAO;GACpB,cAAc;GACd,MAAM,KAAK;EACb;CACF;AACF;;;;;;;;;AC1BA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiC5B,SAAgB,8BAAoD;CAClE,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AAE;KAAU,SAAS;IAAS,CAAC;GACtD;GACA,OAAO,EAAE,SAAS,MAAM;EAC1B;EACA,QAAQ;GACN,SAAS;GACT,UAAU,KAAA;GACV,QAAQ,KAAA;GACR,UAAU,MAAM;EAClB;CACF;AACF;;;AC/OA,MAAa,+BAA+B,yBAAyB;;AAGrE,SAAgB,sBACd,OACA,cACA,KACyB;CAEzB,IAAI,CAAC,OAAO,gBAAgB,OAAO,EAAE,QAAQ,cAAc;CAE3D,MAAM,QADU,iBAAiB,KAAA,KAAa,MAAM,gBAAgB,gCAC5C,yCAAyC;CACjE,MAAM,EAAE,OAAO,WAAW,MAAM;CAChC,IAAI,MAAM,KAAK,KAAK,KAAK,OAAO,MAAM,UAAU,kCAAkC,SAAS,MAAM,QAAQ,CAAC,GACxG,OAAO;EACL,QAAQ;EACR,SAAS;EACT,cAAc,gBAAgB;CAChC;CACF,MAAM,WAAW,gBAAgB,OAAO,wBAAwB;CAChE,IAAI,SAAS,WAAW,iBAAiB,SAAS,OAAO;EAAE,QAAQ;EAAW,SAAS,SAAS;CAAQ;CACxG,OAAO,EAAE,QAAQ,SAAS,WAAW,iBAAiB,WAAW,aAAa,aAAa;AAC7F;;;ACjCA,MAAM,wBAAwB;AAC9B,MAAM,WAAW;;;;;;;;AAmBjB,SAAgB,8BAA8B,EAAE,cAAc,kBAA2C;CACvG,OAAO,gBAAgB,CAAC;AAC1B;;AAGA,SAAgB,4BAA4B,oBAAsC;CAChF,OAAO,CAAC;AACV;;AAGA,SAAgB,mBAAmB,EAAE,OAAO,QAA+B;CACzE,OAAO,SAAS,SAAS;AAC3B;;AAGA,SAAgB,kBAAkB,WAAoD;CACpF,OAAO,UAAU,EAAE,EAAE,YAAY;AACnC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/services/shellTitleController/mainThread.ts","../src/services/shellTitleController/index.ts","../src/services/notificationText/index.ts","../src/services/systemNotification/index.ts","../src/services/nativePushSender/sync.ts","../src/services/nativePushSender/index.ts","../src/services/completion/index.ts","../src/services/notificationPolicy/index.ts"],"sourcesContent":["import type { ShellTitleController } from '../../types/notifications';\n\nexport const BRAILLE_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\nexport const TITLE_FRAME_INTERVAL_MS = 80;\n\n/** Animates on the main thread, for hosts where a worker could not be started. */\nexport function createMainThreadTitleController(): ShellTitleController {\n let frameIndex = 0;\n let timer: ReturnType<typeof setInterval> | undefined;\n const stopAnimation = () => {\n if (timer) clearInterval(timer);\n timer = undefined;\n frameIndex = 0;\n };\n\n return {\n set(title, write) {\n stopAnimation();\n write(title);\n },\n start(title, write) {\n stopAnimation();\n const render = () => {\n write(`${BRAILLE_FRAMES[frameIndex % BRAILLE_FRAMES.length]} ${title}`);\n frameIndex += 1;\n };\n render();\n timer = setInterval(render, TITLE_FRAME_INTERVAL_MS);\n },\n stop(title, write) {\n stopAnimation();\n write(title);\n },\n dispose(title, write) {\n stopAnimation();\n write(title);\n },\n };\n}\n","import { Worker } from 'node:worker_threads';\n\nimport type { ShellTitleCommand, ShellTitleController, WriteTitle } from '../../types/notifications';\nimport { BRAILLE_FRAMES, TITLE_FRAME_INTERVAL_MS, createMainThreadTitleController } from './mainThread';\n\nexport { createMainThreadTitleController } from './mainThread';\n/**\n * The animator runs off the main thread so a busy agent turn cannot stall the\n * spinner. It is an inline eval source rather than a shipped file because the\n * package is bundled per entry, and a separate worker module would have to be\n * located on disk at runtime.\n */\nconst TITLE_WORKER_SOURCE = `\nconst { createWriteStream } = require('node:fs');\nconst output = createWriteStream('', { fd: 1, autoClose: false });\nconst { parentPort, workerData } = require('node:worker_threads');\nlet frameIndex = 0;\nlet timer;\nconst writeTitle = (title) => output.write('\\\\u001b]0;' + title + '\\\\u0007');\nconst stop = () => {\n if (timer) clearInterval(timer);\n timer = undefined;\n frameIndex = 0;\n};\nparentPort.on('message', (command) => {\n stop();\n if (command.action === 'start') {\n const render = () => {\n writeTitle(workerData.frames[frameIndex % workerData.frames.length] + ' ' + command.title);\n frameIndex += 1;\n };\n render();\n timer = setInterval(render, workerData.intervalMs);\n return;\n }\n writeTitle(command.title);\n if (command.action === 'dispose') output.end(() => parentPort.close());\n});\n`;\n\n/**\n * Animates from a worker thread, replaying the last command on the main thread\n * if the worker never started, failed, or exited under us. The worker is\n * unreferenced so a pending frame never holds the process open.\n */\nexport function createWorkerTitleController(): ShellTitleController {\n const fallback = createMainThreadTitleController();\n let lastCommand: ShellTitleCommand | undefined;\n let lastWrite: WriteTitle | undefined;\n let worker: Worker | undefined;\n\n const fallBack = () => {\n worker = undefined;\n if (!lastCommand || !lastWrite) return;\n fallback[lastCommand.action](lastCommand.title, lastWrite);\n };\n\n try {\n const titleWorker = new Worker(TITLE_WORKER_SOURCE, {\n eval: true,\n workerData: { frames: BRAILLE_FRAMES, intervalMs: TITLE_FRAME_INTERVAL_MS },\n });\n titleWorker.unref();\n titleWorker.once('error', fallBack);\n titleWorker.once('exit', (code) => {\n if (code !== 0 && worker === titleWorker) fallBack();\n });\n worker = titleWorker;\n } catch {\n // Workers are unavailable on this host, which the main-thread animator covers.\n worker = undefined;\n }\n\n const dispatch = (command: ShellTitleCommand, write: WriteTitle) => {\n lastCommand = command;\n lastWrite = write;\n if (!worker) {\n fallback[command.action](command.title, write);\n return;\n }\n try {\n worker.postMessage(command);\n } catch {\n // The worker closed between the last frame and this command.\n fallBack();\n }\n };\n\n return {\n set: (title, write) => dispatch({ action: 'set', title }, write),\n start: (title, write) => dispatch({ action: 'start', title }, write),\n stop: (title, write) => dispatch({ action: 'stop', title }, write),\n dispose: (title, write) => dispatch({ action: 'dispose', title }, write),\n };\n}\n","import path from 'node:path';\n\nimport { formatMessage } from '@agimon-ai/po-core/locale';\n\nimport type { DesktopNotification } from '../../types/notifications';\n\nconst ELLIPSIS = '…';\nconst MAX_BODY_LENGTH = 240;\nconst MAX_PROMPT_TITLE_LENGTH = 36;\nconst SHELL_TITLE_SEPARATOR = ' - ';\nconst SHELL_TITLE_PREFIX = 'π';\n\nfunction collapseWhitespace(value: string): string {\n return value.replace(/\\s+/g, ' ').trim();\n}\n\nfunction truncate(value: string, maxLength: number): string {\n return value.length > maxLength ? `${value.slice(0, maxLength - 1)}${ELLIPSIS}` : value;\n}\n\n/** The first user prompt, shortened to fit a shell tab. A blank prompt names nothing. */\nexport function promptTitle(prompt: string): string | undefined {\n const normalized = collapseWhitespace(prompt);\n return normalized ? truncate(normalized, MAX_PROMPT_TITLE_LENGTH) : undefined;\n}\n\nexport interface ShellTabTitleInput {\n cwd: string;\n sessionName?: string;\n prompt?: string;\n}\n\n/**\n * The idle shell-tab title: `π - <label> - <repository>`.\n *\n * The session name wins over the first prompt because the user chose it. With\n * neither, the repository alone still tells two tabs apart.\n */\nexport function shellTabTitle({ cwd, sessionName, prompt }: ShellTabTitleInput): string {\n const repository = path.basename(cwd);\n const label = sessionName ?? prompt;\n return label\n ? `${SHELL_TITLE_PREFIX}${SHELL_TITLE_SEPARATOR}${label}${SHELL_TITLE_SEPARATOR}${repository}`\n : `${SHELL_TITLE_PREFIX}${SHELL_TITLE_SEPARATOR}${repository}`;\n}\n\n/** Notification bodies are one line in a system panel, so they collapse and truncate. */\nexport function notificationBody(body: string): string {\n return truncate(collapseWhitespace(body), MAX_BODY_LENGTH);\n}\n\n/** Renders one message: a language pack's text for `key`, or the English `fallback`. */\nexport type NotificationTranslate = (\n key: string,\n fallback: string,\n vars?: Readonly<Record<string, string | number>>,\n) => string;\n\nconst english: NotificationTranslate = (_key, fallback, vars) => formatMessage(fallback, vars);\n\n/** Sent while the agent holds the turn and something is blocking on the user. */\nexport function attentionNotification(body: string, t: NotificationTranslate = english): DesktopNotification {\n return {\n title: t('notification.attention.title', 'Po needs your input'),\n subtitle: t('notification.attention.subtitle', 'Approval or feedback required'),\n body,\n };\n}\n\n/**\n * Sent once a run has stopped. The title carries the session name so it shows even where a\n * platform hides subtitles; an unnamed session (the hub sends `''`) falls back to the repository.\n */\nexport function settledNotification(\n { cwd, sessionName }: { cwd: string; sessionName?: string },\n t: NotificationTranslate = english,\n): DesktopNotification {\n const repository = path.basename(cwd);\n const name = sessionName?.trim();\n return {\n title: t('notification.settled.title', 'Po finished: {name}', { name: name || repository }),\n subtitle: name ? repository : '',\n body: t('notification.settled.body', 'The agent finished its work and is waiting for you.'),\n };\n}\n","import type { DesktopNotification, NotificationExecutor } from '../../types/notifications';\nimport { notificationBody } from '../notificationText';\n\nconst CMUX_COMMAND = 'cmux';\nconst COMMAND_TIMEOUT_MS = 3_000;\nconst DARWIN_PLATFORM = 'darwin';\nconst OSASCRIPT_COMMAND = 'osascript';\nconst OSASCRIPT_EXPRESSION_FLAG = '-e';\n\nasync function execute(pi: NotificationExecutor, command: string, args: string[]): Promise<boolean> {\n try {\n const result = await pi.exec(command, args, { timeout: COMMAND_TIMEOUT_MS });\n return result.code === 0;\n } catch {\n // A notifier that is not installed is the ordinary case, not a fault: report\n // \"not delivered\" and let the caller decide whether another one exists.\n return false;\n }\n}\n\n/**\n * Delivers one desktop notification on a best-effort basis.\n *\n * cmux is tried first because it routes the notification to the window the\n * session actually lives in. Only macOS has a second option worth attempting,\n * and a host with neither stays silent rather than failing the turn.\n */\nexport async function sendSystemNotification(\n pi: NotificationExecutor,\n notification: DesktopNotification,\n platform: string = process.platform,\n): Promise<void> {\n const body = notificationBody(notification.body);\n const sentToCmux = await execute(pi, CMUX_COMMAND, [\n 'notify',\n '--title',\n notification.title,\n '--subtitle',\n notification.subtitle,\n '--body',\n body,\n ]);\n if (sentToCmux || platform !== DARWIN_PLATFORM) return;\n\n await execute(pi, OSASCRIPT_COMMAND, [\n OSASCRIPT_EXPRESSION_FLAG,\n 'on run argv',\n OSASCRIPT_EXPRESSION_FLAG,\n 'display notification (item 3 of argv) with title (item 1 of argv) subtitle (item 2 of argv)',\n OSASCRIPT_EXPRESSION_FLAG,\n 'end run',\n notification.title,\n notification.subtitle,\n body,\n ]);\n}\n","import { sign } from 'node:crypto';\nimport { connect } from 'node:http2';\nimport { request } from 'node:https';\n\nimport type { NativePushRequest, NativePushResponse } from './type';\n\nconst MAX_RESPONSE_BYTES = 65_536;\n\nexport function signPushJwt(header: object, claims: object, key: string, algorithm: 'ES256' | 'RS256'): string {\n const input = [header, claims].map((part) => Buffer.from(JSON.stringify(part)).toString('base64url')).join('.');\n const signature = sign('sha256', Buffer.from(input), { key, dsaEncoding: 'ieee-p1363' });\n // APNs requires the raw P1363 ECDSA signature, not ASN.1 DER.\n if (algorithm === 'ES256' && signature.length !== 64) throw new Error('Invalid signing key');\n return `${input}.${signature.toString('base64url')}`;\n}\n\nexport function createPushTransport() {\n const pending = new Set<() => void>();\n return {\n request(this: void, input: NativePushRequest): Promise<NativePushResponse> {\n return new Promise((resolve, reject) => {\n const url = new URL(input.url);\n let size = 0;\n const chunks: Buffer[] = [];\n let done = false;\n let dispose = () => {};\n const finish = (error?: Error, status = 0) => {\n if (done) return;\n done = true;\n clearTimeout(timer);\n pending.delete(cancel);\n dispose();\n if (error) reject(error);\n else resolve({ status, body: Buffer.concat(chunks).toString('utf8') });\n };\n const cancel = () => finish(new Error('Push request cancelled'));\n const timer = setTimeout(() => finish(new Error('Push request timed out')), input.timeoutMs);\n pending.add(cancel);\n const data = (chunk: Buffer) => {\n size += chunk.length;\n if (size > MAX_RESPONSE_BYTES) finish(new Error('Push response too large'));\n else chunks.push(Buffer.from(chunk));\n };\n if (input.http2) {\n const session = connect(url.origin);\n dispose = () => session.destroy();\n session.on('error', (error) => finish(error));\n const stream = session.request({ ':method': 'POST', ':path': url.pathname, ...input.headers });\n let status = 0;\n stream.on('response', (headers) => {\n status = Number(headers[':status']);\n });\n stream.on('data', data);\n stream.on('error', (error) => finish(error));\n stream.on('end', () => finish(undefined, status));\n stream.end(input.body);\n } else {\n const req = request(url, { method: 'POST', headers: input.headers }, (response) => {\n response.on('data', data);\n response.on('error', (error) => finish(error));\n response.on('end', () => finish(undefined, response.statusCode));\n });\n dispose = () => req.destroy();\n req.on('error', (error) => finish(error));\n req.end(input.body);\n }\n });\n },\n close() {\n for (const cancel of pending) cancel();\n },\n };\n}\n","import type { PoNotificationEntryData } from '@agimon-ai/po-core';\n\nimport { createPushTransport, signPushJwt } from './sync';\nimport type { NativePushSender, NativePushSenderOptions } from './type';\n\nconst MAX_PAYLOAD_BYTES = 4096;\nconst APNS_TOPIC = 'ai.po.app';\n// Only documented provider codes may enter diagnostics, never arbitrary response text.\nconst APNS_REASONS = new Set([\n 'BadCollapseId',\n 'BadDeviceToken',\n 'BadExpirationDate',\n 'BadMessageId',\n 'BadPriority',\n 'BadTopic',\n 'DeviceTokenNotForTopic',\n 'DuplicateHeaders',\n 'IdleTimeout',\n 'InvalidPushType',\n 'MissingDeviceToken',\n 'MissingTopic',\n 'PayloadEmpty',\n 'TopicDisallowed',\n 'BadCertificate',\n 'BadCertificateEnvironment',\n 'ExpiredProviderToken',\n 'Forbidden',\n 'InvalidProviderToken',\n 'MissingProviderToken',\n 'BadPath',\n 'MethodNotAllowed',\n 'Unregistered',\n 'PayloadTooLarge',\n 'TooManyProviderTokenUpdates',\n 'TooManyRequests',\n 'InternalServerError',\n 'ServiceUnavailable',\n 'Shutdown',\n]);\nconst OAUTH_URL = 'https://oauth2.googleapis.com/token';\nconst FCM_ERROR_TYPE = 'type.googleapis.com/google.firebase.fcm.v1.FcmError';\nconst encoder = new TextEncoder();\n\nfunction parse(body: string): Record<string, unknown> {\n try {\n const value: unknown = JSON.parse(body);\n return value && typeof value === 'object' ? (value as Record<string, unknown>) : {};\n } catch {\n return {};\n } // Malformed provider responses never invalidate registrations.\n}\n\nfunction payload(\n notification: PoNotificationEntryData,\n build: (text: { title: string; subtitle: string; body: string }) => object,\n): string {\n const text = { title: notification.title, subtitle: notification.subtitle, body: notification.body };\n let result = JSON.stringify(build(text));\n // Measure the full serialized envelope, including escaped text and the FCM token.\n for (const field of ['body', 'subtitle', 'title'] as const) {\n if (encoder.encode(result).length <= MAX_PAYLOAD_BYTES) break;\n const points = Array.from(text[field]);\n let low = 0;\n let high = points.length;\n while (low < high) {\n const middle = Math.ceil((low + high) / 2);\n text[field] = points.slice(0, middle).join('');\n if (encoder.encode(JSON.stringify(build(text))).length <= MAX_PAYLOAD_BYTES) low = middle;\n else high = middle - 1;\n }\n text[field] = points.slice(0, low).join('');\n result = JSON.stringify(build(text));\n }\n if (encoder.encode(result).length > MAX_PAYLOAD_BYTES) throw new Error('Push payload too large');\n return result;\n}\n\nexport function createNativePushSender(options: NativePushSenderOptions): NativePushSender {\n const transport = createPushTransport();\n const request = options.request ?? transport.request;\n const now = options.now ?? Date.now;\n const timeoutMs = Number.isFinite(options.timeoutMs) ? Math.max(1, Math.min(options.timeoutMs!, 30_000)) : 10_000;\n let closed = false;\n let apnsJwt: { value: string; expires: number } | undefined;\n let oauth: { value: string; expires: number } | undefined;\n let oauthPending: Promise<string> | undefined;\n\n async function accessToken(): Promise<string> {\n if (oauth && now() < oauth.expires) return oauth.value;\n if (oauthPending) return oauthPending;\n oauthPending = (async () => {\n const credentials = options.fcm!;\n const issued = Math.floor(now() / 1000);\n const assertion = signPushJwt(\n { alg: 'RS256', typ: 'JWT' },\n {\n iss: credentials.clientEmail,\n scope: 'https://www.googleapis.com/auth/firebase.messaging',\n aud: OAUTH_URL,\n iat: issued,\n exp: issued + 3600,\n },\n credentials.privateKey,\n 'RS256',\n );\n const response = await request({\n url: OAUTH_URL,\n headers: { 'content-type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams({ grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', assertion }).toString(),\n timeoutMs,\n });\n const data = parse(response.body);\n if (\n response.status !== 200 ||\n typeof data.access_token !== 'string' ||\n !data.access_token ||\n typeof data.expires_in !== 'number' ||\n !Number.isFinite(data.expires_in) ||\n data.expires_in <= 0\n )\n throw new Error('OAuth failed');\n oauth = { value: data.access_token, expires: now() + Math.max(0, Math.min(data.expires_in, 3600) - 60) * 1000 };\n return oauth.value;\n })();\n try {\n return await oauthPending;\n } finally {\n oauthPending = undefined;\n }\n }\n\n return {\n async send(registration, notification, sessionId) {\n const provider = registration.platform === 'ios' ? 'apns' : 'fcm';\n if (closed || !options[provider]) {\n options.diagnostic?.({ provider, outcome: 'unavailable' });\n return { invalid: false };\n }\n try {\n const data = {\n ...(registration.hostRef ? { hostRef: registration.hostRef } : {}),\n ...(sessionId ? { sessionId } : {}),\n };\n let response;\n let reason: string | undefined;\n if (registration.platform === 'ios') {\n const credentials = options.apns!;\n if (!apnsJwt || now() >= apnsJwt.expires) {\n apnsJwt = {\n value: signPushJwt(\n { alg: 'ES256', kid: credentials.keyId },\n {\n iss: credentials.teamId,\n iat: Math.floor(now() / 1000),\n },\n credentials.key,\n 'ES256',\n ),\n expires: now() + 50 * 60_000,\n };\n }\n response = await request({\n url: `https://${registration.environment === 'development' ? 'api.sandbox.push.apple.com' : 'api.push.apple.com'}/3/device/${encodeURIComponent(registration.token)}`,\n http2: true,\n timeoutMs,\n headers: {\n authorization: `bearer ${apnsJwt.value}`,\n 'apns-topic': APNS_TOPIC,\n 'apns-push-type': 'alert',\n 'apns-priority': '10',\n 'apns-expiration': '0',\n 'content-type': 'application/json',\n },\n // ponytail: live alerts only; add a durable outbox if delayed delivery becomes a requirement.\n // Expo iOS reads custom remote data from userInfo.body. Keep data as the provider-neutral payload.\n body: payload(notification, (text) => ({ aps: { alert: text, sound: 'default' }, data, body: data })),\n });\n const value = parse(response.body).reason;\n if (typeof value === 'string' && APNS_REASONS.has(value)) reason = value;\n if (\n (response.status === 410 && reason === 'Unregistered') ||\n (response.status === 400 && reason === 'BadDeviceToken')\n ) {\n options.diagnostic?.({\n provider,\n outcome: 'invalid',\n status: response.status,\n ...(reason ? { reason } : {}),\n });\n return { invalid: true };\n }\n } else {\n const body = payload(notification, (text) => ({\n message: {\n token: registration.token,\n data,\n notification: { title: text.title, body: [text.subtitle, text.body].filter(Boolean).join('\\n') },\n // ponytail: zero TTL, no offline delivery; an outbox would own delayed sends.\n android: { ttl: '0s', priority: 'HIGH', notification: { channel_id: 'po-notifications' } },\n },\n }));\n const token = await accessToken();\n if (closed) return { invalid: false };\n response = await request({\n url: `https://fcm.googleapis.com/v1/projects/${encodeURIComponent(options.fcm!.projectId)}/messages:send`,\n headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },\n body,\n timeoutMs,\n });\n const error = parse(response.body).error;\n if (\n response.status === 404 &&\n error &&\n typeof error === 'object' &&\n 'details' in error &&\n Array.isArray(error.details) &&\n error.details.some(\n (detail: unknown) =>\n detail &&\n typeof detail === 'object' &&\n '@type' in detail &&\n detail['@type'] === FCM_ERROR_TYPE &&\n 'errorCode' in detail &&\n detail.errorCode === 'UNREGISTERED',\n )\n ) {\n options.diagnostic?.({\n provider,\n outcome: 'invalid',\n status: response.status,\n ...(reason ? { reason } : {}),\n });\n return { invalid: true };\n }\n }\n if (response.status < 200 || response.status >= 300)\n options.diagnostic?.({ provider, outcome: 'failed', status: response.status, ...(reason ? { reason } : {}) });\n } catch {\n // Never expose provider bodies, credentials, device tokens, or network errors.\n options.diagnostic?.({ provider, outcome: 'failed' });\n }\n return { invalid: false };\n },\n close() {\n closed = true;\n apnsJwt = undefined;\n oauth = undefined;\n transport.close();\n },\n };\n}\n","import { AUTO_STOP_ACTION, DEFAULT_AUTO_STOP_DELAYS, decideOnRecheck } from '@agimon-ai/po-autostop';\nimport {\n BACKGROUND_RUNNER_DEADLINE_MS,\n BACKGROUND_WORK_HOLDING_PROVIDERS,\n holdsSettledSession,\n holdsSettledSessionAfterRunnerDeadline,\n} from '@agimon-ai/po-core/backgroundWork';\nimport type { PoHubSessionExecutionState } from '@agimon-ai/po-core/hubChannel';\n\nimport type { SessionFinishedDecision } from './type';\n\nexport const SESSION_FINISHED_COOLDOWN_MS = DEFAULT_AUTO_STOP_DELAYS.cooldownMs;\n\n/** The completion test shared by spoken notices and native push, after the initial cooldown. */\nexport function decideSessionFinished(\n state: PoHubSessionExecutionState | undefined,\n holdingSince: number | undefined,\n now: number,\n): SessionFinishedDecision {\n // Unknown background work cannot prove the run finished.\n if (!state?.backgroundWork) return { action: 'unavailable' };\n const expired = holdingSince !== undefined && now - holdingSince >= BACKGROUND_RUNNER_DEADLINE_MS;\n const holds = expired ? holdsSettledSessionAfterRunnerDeadline : holdsSettledSession;\n const { items, errors } = state.backgroundWork;\n if (items.some(holds) || errors.some((error) => BACKGROUND_WORK_HOLDING_PROVIDERS.includes(error.provider)))\n return {\n action: 'hold',\n delayMs: SESSION_FINISHED_COOLDOWN_MS,\n holdingSince: holdingSince ?? now,\n };\n const decision = decideOnRecheck(state, DEFAULT_AUTO_STOP_DELAYS);\n if (decision.action === AUTO_STOP_ACTION.recheck) return { action: 'recheck', delayMs: decision.delayMs };\n return { action: decision.action === AUTO_STOP_ACTION.shutdown ? 'finished' : 'stand-down' };\n}\n","const DEFAULT_ASK_USER_BODY = 'The agent is waiting for your feedback.';\nconst RPC_MODE = 'rpc';\n\nexport interface AttentionState {\n agentRunning: boolean;\n askUserBlocked: boolean;\n}\n\nexport interface ShellSurface {\n hasUI: boolean;\n mode?: string;\n}\n\n/**\n * A dialog is worth interrupting the user for only while the agent holds the turn.\n *\n * Outside a run the user opened the dialog themselves and is already looking at\n * it. An ask-user prompt is announced by its own event, so the dialog it then\n * opens must stay silent or the same question notifies twice.\n */\nexport function warrantsAttentionNotification({ agentRunning, askUserBlocked }: AttentionState): boolean {\n return agentRunning && !askUserBlocked;\n}\n\n/** A queued follow-up means the agent keeps working, so the run has not stopped for the user. */\nexport function warrantsSettledNotification(hasPendingMessages: boolean): boolean {\n return !hasPendingMessages;\n}\n\n/** Terminal title escapes only mean something on an attached terminal; RPC output stays clean. */\nexport function supportsShellTitle({ hasUI, mode }: ShellSurface): boolean {\n return hasUI && mode !== RPC_MODE;\n}\n\n/** The question an ask-user prompt is blocking on, or a stand-in when it asked none. */\nexport function askUserPromptBody(questions: readonly { question: string }[]): string {\n return questions[0]?.question ?? DEFAULT_ASK_USER_BODY;\n}\n"],"mappings":";;;;;;;;;AAEA,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,kCAAkC,SAAS,MAAM,QAAQ,CAAC,GACxG,OAAO;EACL,QAAQ;EACR,SAAS;EACT,cAAc,gBAAgB;CAChC;CACF,MAAM,WAAW,gBAAgB,OAAO,wBAAwB;CAChE,IAAI,SAAS,WAAW,iBAAiB,SAAS,OAAO;EAAE,QAAQ;EAAW,SAAS,SAAS;CAAQ;CACxG,OAAO,EAAE,QAAQ,SAAS,WAAW,iBAAiB,WAAW,aAAa,aAAa;AAC7F;;;ACjCA,MAAM,wBAAwB;AAC9B,MAAM,WAAW;;;;;;;;AAmBjB,SAAgB,8BAA8B,EAAE,cAAc,kBAA2C;CACvG,OAAO,gBAAgB,CAAC;AAC1B;;AAGA,SAAgB,4BAA4B,oBAAsC;CAChF,OAAO,CAAC;AACV;;AAGA,SAAgB,mBAAmB,EAAE,OAAO,QAA+B;CACzE,OAAO,SAAS,SAAS;AAC3B;;AAGA,SAAgB,kBAAkB,WAAoD;CACpF,OAAO,UAAU,EAAE,EAAE,YAAY;AACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"platformRequirements":{},"sourceFiles":["LICENSE","README.md","generated/server.ts","llms.txt","package.json","src/exports/apiContracts.ts","src/exports/index.ts","src/extensions/workspaces/sessions/(backend)/_lib/notificationCommand.ts","src/extensions/workspaces/sessions/(backend)/command/notify.server.ts","src/schemas/apiContracts.ts","src/services/completion/index.ts","src/services/completion/type.ts","src/services/nativePushSender/index.ts","src/services/nativePushSender/sync.ts","src/services/nativePushSender/type.ts","src/services/notificationPolicy/index.ts","src/services/notificationText/index.ts","src/services/shellTitleController/index.edge.ts","src/services/shellTitleController/index.ts","src/services/shellTitleController/mainThread.ts","src/services/systemNotification/index.ts","src/types/notifications.ts","tsdown.config.ts"],"sourceRevision":"
|
|
1
|
+
{"version":1,"platformRequirements":{},"sourceFiles":["LICENSE","README.md","generated/server.ts","llms.txt","package.json","src/exports/apiContracts.ts","src/exports/index.ts","src/extensions/workspaces/sessions/(backend)/_lib/notificationCommand.ts","src/extensions/workspaces/sessions/(backend)/command/notify.server.ts","src/schemas/apiContracts.ts","src/services/completion/index.ts","src/services/completion/type.ts","src/services/nativePushSender/index.ts","src/services/nativePushSender/sync.ts","src/services/nativePushSender/type.ts","src/services/notificationPolicy/index.ts","src/services/notificationText/index.ts","src/services/shellTitleController/index.edge.ts","src/services/shellTitleController/index.ts","src/services/shellTitleController/mainThread.ts","src/services/systemNotification/index.ts","src/types/notifications.ts","tsdown.config.ts"],"sourceRevision":"9b87767824acc6c5177dd5d1bc6a9237","manifestRevision":"94c5ce7d2271a38a3b653b4f53a6291f","outputFiles":["LICENSE","README.md","dist/apiContracts.cjs","dist/apiContracts.mjs","dist/extensions/server.cjs","dist/extensions/server.mjs","dist/index.cjs","dist/index.mjs","llms.txt"],"outputRevision":"f6f5f606c9b601af99b84c0c927169a5"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-notification",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.195",
|
|
4
4
|
"description": "Desktop notifications and an animated shell-tab title for Po sessions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"bugs": {
|
|
20
20
|
"url": "https://github.com/AgiFlow/po/issues"
|
|
21
21
|
},
|
|
22
|
-
"license": "
|
|
22
|
+
"license": "MIT",
|
|
23
23
|
"author": "Vuong Ngo",
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@agimon-ai/po-autostop": "0.0.0-alpha.
|
|
64
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
63
|
+
"@agimon-ai/po-autostop": "0.0.0-alpha.195",
|
|
64
|
+
"@agimon-ai/po-core": "0.0.0-alpha.195",
|
|
65
65
|
"@deepseek-ai/cordis": "4.0.5"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
69
|
-
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.
|
|
70
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
68
|
+
"@agimon-ai/po-build": "0.0.0-alpha.195",
|
|
69
|
+
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.195",
|
|
70
|
+
"@earendil-works/pi-coding-agent": "1.6.1",
|
|
71
71
|
"@types/node": "26.6.5",
|
|
72
72
|
"@vitest/coverage-v8": "5.0.4",
|
|
73
73
|
"tsdown": "0.23.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"vitest": "5.0.4"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
78
|
+
"@earendil-works/pi-coding-agent": "1.6.1"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
81
81
|
"@earendil-works/pi-coding-agent": {
|