@agimon-ai/po-notification 0.0.0-alpha.19 → 0.0.0-alpha.190

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 CHANGED
@@ -1,21 +1,149 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Vuong Ngo
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.
1
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
2
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
3
+
4
+ Parameters
5
+
6
+ Licensor: Agimon Pty Ltd
7
+ Licensed Work: Po, the software in the Po source repository and the
8
+ packages released from it, in each version released by
9
+ the Licensor.
10
+ The Licensed Work is (c) 2026 Agimon Pty Ltd.
11
+ Material identified as third-party in the "Third-party
12
+ components" section at the end of this file or in a
13
+ NOTICE file, and any package or directory whose own
14
+ license file grants a different license, is not part of
15
+ the Licensed Work and remains under its own license.
16
+ Additional Use Grant: You may make production use of the Licensed Work if
17
+ your use is Eligible Use. "Eligible Use" is production use that falls
18
+ within at least one of the following:
19
+
20
+ (a) Personal Use. Use by an individual for their own personal purposes,
21
+ and not on behalf of, or for the benefit of, an employer, client, or
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.
package/README.md CHANGED
@@ -1,25 +1,25 @@
1
1
  # @agimon-ai/po-notification
2
2
 
3
- System and browser notifications, plus an animated shell-tab title, for
3
+ Native push delivery, notification text helpers, and shell-tab title utilities for
4
4
  [Po](https://www.npmjs.com/package/@agimon-ai/po) sessions.
5
5
 
6
- Long agent runs are worth walking away from. This package owns the shared `po/notification` service,
7
- routes each request for the active session, and announces when the agent needs attention.
6
+ This package supplies the native push sender and `/notify` command. Hosts own routing through
7
+ the shared `po/notification` service and live session entries.
8
8
 
9
9
  ## What it does
10
10
 
11
- | Surface | Behavior |
12
- | ---------------- | -------------------------------------------------------------------------------------------- |
13
- | Shell tab title | `π - <session or first prompt> - <repository>`, with a braille spinner while the agent works |
14
- | Notification API | caller-authored notices through the shared `po/notification` Cordis service |
15
- | Mid-run | one notification for each agent-initiated dialog and each `ask_user_question` prompt |
16
- | At rest | one notification when a run settles with nothing queued behind it |
11
+ | Surface | Behavior |
12
+ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
13
+ | Shell tab title | `π - <session or first prompt> - <repository>`, with a braille spinner while the agent works |
14
+ | Notification API | caller-authored notices through the shared `po/notification` Cordis service |
15
+ | Mid-run | server-derived native push for each dialog during a run, parent sessions only |
16
+ | Attention | native push for notices marked `attention: true` (a pending approval), every session including child sessions |
17
+ | At rest | server-derived native push once a parent run has finished by po-autostop's test; requires host execution state, skipped for sandbox sessions |
17
18
 
18
- In an interactive terminal session, requests use `cmux notify` first because it routes them back to
19
- the session window. On macOS, a missing `cmux` falls back to `osascript`. In RPC mode, requests become
20
- versioned `po-notification` session entries for a live client such as `po-web`. An RPC append
21
- failure stays silent and never falls back to a host notifier. Hosts without a supported notifier also
22
- stay silent.
19
+ The package exports shell-title controllers and a system-notification helper (`cmux notify`, then
20
+ `osascript` on macOS), but does not install a terminal router or shell-title lifecycle itself.
21
+ The `/notify` command calls the active headless client's notification API, which appends a versioned
22
+ `po-notification` session entry for live clients. Only entries marked `attention: true` also reach native push.
23
23
 
24
24
  ## Service usage
25
25
 
@@ -37,14 +37,11 @@ ctx.inject([PO_NOTIFICATION_SERVICE], (notificationContext) => {
37
37
  });
38
38
  ```
39
39
 
40
- `body` is required. `title`, `subtitle`, and `level` are optional, and `level` accepts `info`,
41
- `warning`, or `error`. The router defaults the title to `Pi`, the subtitle to the session name or
42
- working-directory basename, and the level to `info`. Invalid requests, missing active sessions,
43
- unavailable providers, and delivery failures are silent so notifications cannot fail an agent turn.
44
-
45
- The package also wraps Pi's broad `ui.notify(message, level)` API while active, so existing extensions
46
- use the same route without changing their calls. If this package is muted or the process is a detached
47
- subagent child, it does not install that wrapper and Pi's original `ui.notify` behavior remains.
40
+ `body` is required. `title`, `subtitle`, `level` and `attention` are optional, and `level` accepts `info`,
41
+ `warning`, or `error`. Entry normalization defaults title and subtitle to empty strings and level to
42
+ `info`. Set `attention: true` only when the person must act (po-approval uses it for a new pending request):
43
+ that notice is also pushed to paired devices. A host must provide the optional service. This package does not
44
+ wrap Pi's `ui.notify` API.
48
45
 
49
46
  ## Browser delivery
50
47
 
@@ -52,11 +49,64 @@ subagent child, it does not install that wrapper and Pi's original `ui.notify` b
52
49
  page receives live notification entries for every attached session, not only the focused session. Permission
53
50
  is requested only from an explicit settings action.
54
51
 
55
- A paired installed PWA may also opt into live Web Push while closed. That payload is fixed generic copy with
56
- `TTL: 0`; it contains no session, prompt, response, or file data. The host keeps subscriptions only in memory,
57
- so there is no durable database, outbox, replay, or delivery of historical entries. The open app re-registers
58
- a browser-held subscription after a host restart. Device revocation or expiry, remote shutdown, browser
59
- disable, and expired provider endpoints remove the live subscription.
52
+ Browser Web Push is not supported. Closed-app delivery uses the paired native iOS or Android app,
53
+ with explicit notification permission and native push enrollment. The server subscribes to live
54
+ hub events across all sessions, even with no client sockets connected. It pushes entries marked
55
+ `attention: true`, and derives "Input needed" (`Po needs your input`) and "Run finished"
56
+ (`Po finished`) notices without adding transcript entries. Other entries stay in-app. Push does
57
+ not read history and has no durable outbox or replay. Enrollment is persisted on the trusted device record;
58
+ revocation, token rotation and remote disable are rechecked before queued work is dispatched.
59
+
60
+ ## Native push server credentials
61
+
62
+ Configure the needed provider credentials in the server's launch environment, using absolute paths:
63
+
64
+ ```sh
65
+ export PO_APNS_KEY_FILE="$HOME/.po-secrets/AuthKey.p8"
66
+ export PO_APNS_KEY_ID="ABCDEFGHIJ"
67
+ export PO_APNS_TEAM_ID="KLMNOPQRST"
68
+ export PO_FCM_SERVICE_ACCOUNT_FILE="$HOME/.po-secrets/firebase-service-account.json"
69
+ ```
70
+
71
+ Restrict the directory to the server user (`chmod 700`) and credential files to owner read/write
72
+ (`chmod 600`). Never commit, paste into logs, or distribute these files with the app. The server must inherit these variables. GUI or service launches may not read shell configuration;
73
+ configure their launch environment explicitly. Restart the server after changing credentials or variables: files and
74
+ key material are validated once at startup. Missing or invalid credentials disable only that provider,
75
+ with a redacted diagnostic. No provider credentials are read from a session's environment.
76
+
77
+ For Apple, provision the company `ai.po.app` App ID with Push Notifications, sign the native app with the
78
+ matching entitlement and provisioning profile, and create an APNs signing key in the Apple Developer
79
+ team. The server topic is fixed to `ai.po.app`. The native build-only variable
80
+ `PO_NATIVE_APNS_ENVIRONMENT` selects `development` or `production` to match the signed entitlement;
81
+ it is not a server credential. At runtime the native app reads the provisioning profile through
82
+ `expo-application`, falling back to production for App Store/TestFlight installs without a profile,
83
+ and registers its token with that environment for server routing. iOS push enrollment
84
+ refuses a different application ID, including the previous `ai.agimon.po` development app. Rebuild and
85
+ pair the company iOS app with its matching profile; old iOS installs are a separate app identity.
86
+
87
+ For Firebase, register Android package `ai.agimon.po`, enable the FCM HTTP v1 API, and grant a service
88
+ account permission to send FCM messages. The server reads `client_email`, `private_key`, and
89
+ `project_id` from its service-account JSON, not from a separate project environment variable.
90
+ The native build-only `PO_NATIVE_ANDROID_GOOGLE_SERVICES_FILE` points to the matching Android
91
+ `google-services.json`. This client configuration is not the server service-account private key.
92
+ Rebuild and reinstall the app when changing native build configuration.
93
+
94
+ Provider rejections produce redacted `Native push <provider>: <outcome> <status> <reason>` notices;
95
+ status and allowlisted APNs reason are included when available, never tokens, text, or keys.
96
+
97
+ **Privacy:** native push carries the full notification title, subtitle and body, subject to provider
98
+ payload limits. Apple or Google and the device lock screen can receive that text, including sensitive
99
+ agent output. This is not generic-copy-only delivery. Do not enable it for content you cannot share
100
+ with those providers or display on the lock screen.
101
+
102
+ Delivery is bounded, best effort, and timeout-limited, not guaranteed. FCM uses TTL 0 and APNs uses
103
+ expiration 0, so providers are asked not to retain notifications for offline delivery. This is an
104
+ offline-retention ceiling, not a guarantee that every background or terminated app receives a notice.
105
+ Excess pending work is dropped. Invalid endpoints are conditionally cleared without deleting a rotated
106
+ token. Verify delivery on signed Apple/Firebase builds with configured credentials and paired devices;
107
+ source tests alone do not establish real-device delivery.
108
+
109
+ Forgetting a paired host is local and works offline: the phone clears its keys and cached host data immediately. If remote revocation cannot finish, it retains only revoke-only metadata and retries later, not credentials for reconnecting. Revocation cannot recall notifications already submitted to Apple or Google.
60
110
 
61
111
  ## The shell title
62
112
 
@@ -69,28 +119,26 @@ escape sequences never end up in machine-read output.
69
119
 
70
120
  ## Quiet by design
71
121
 
72
- - A detached subagent (`PI_SUBAGENT_CHILD`) does not register this package's service or wrappers. It
73
- shares its parent's terminal and desktop, and a second voice reporting the same run is noise.
74
- - Dialogs only notify while the agent holds the turn. A dialog the user opened is already in front
75
- of them.
76
- - An `ask_user_question` prompt notifies from its own event, and the dialog it then opens stays
77
- silent, so one question is announced once.
78
- - A settled run with pending follow-up messages notifies nothing: the agent is about to keep going.
122
+ - Server-derived pushes are silent for child sessions. Attention notices (pending approvals) push from every
123
+ session, because the work is blocked until the person answers.
124
+ - Dialogs notify only during a run, once per dialog id. A new run resets deduplication.
125
+ - A finished push waits for the same completion test po-autostop applies before closing a session:
126
+ a 5 second cooldown after the run settles, then no holding background work (running commands,
127
+ subagents, delegated tasks, codemode jobs), then the host reports idle with no pending follow-up
128
+ messages. Holding work is rechecked every cooldown; running commands stop holding 5 minutes after
129
+ they are first seen. A new run, removal or unsubscribe cancels the wait.
130
+ - Missing execution-state readers or background-work state, including sandbox mirrors, skip completion
131
+ pushes and log one redacted notice per session. Dialog pushes still work.
79
132
 
80
133
  ## Installation
81
134
 
82
135
  Po depends on this package and activates it as fixed host core, so a Po install already has
83
- it. It is not selectable from `.po/modes.yaml`.
84
-
85
- The Pi and server loaders use `/extensions/pi` and `/extensions/server`, built directly from
86
- `src/extensions`. The root export contains reusable notification helpers and types.
87
- Controllers own delivery and UI integration; policy and text services live in named service folders.
136
+ it. It is not selectable from `.po/presets.yaml`.
88
137
 
89
- The Pi declaration installs its router and optional session binding before handling events.
90
- `onStop` restores the original UI methods and shell title before service registrations are removed.
91
- `onDispose` provides the same cleanup after partial startup. Detached children return before
92
- acquiring a Cordis connection, leaving notification ownership with the parent.
138
+ The server loader uses `/extensions/server`, built from `src/extensions`. The root export contains
139
+ reusable notification helpers and types. The session command delegates to the host client; this package
140
+ has no Pi entry, notification wrapper, or automatically installed shell-title controller.
93
141
 
94
142
  ## License
95
143
 
96
- MIT
144
+ Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
@@ -1 +1 @@
1
- {"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,4CAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
1
+ {"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,G,yCAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
@@ -6,7 +6,7 @@ export declare const apiContracts: {
6
6
  schemas?: Record<string, boolean | object> | undefined;
7
7
  http: {
8
8
  id: string;
9
- scope: "global" | "session" | "workspace";
9
+ scope: "host" | "session" | "workspace";
10
10
  basePath?: string | undefined;
11
11
  path: string;
12
12
  method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
@@ -34,7 +34,7 @@ export declare const apiContracts: {
34
34
  }[];
35
35
  sockets: {
36
36
  id: string;
37
- scope: "global" | "session" | "workspace";
37
+ scope: "host" | "session" | "workspace";
38
38
  description: string;
39
39
  availability?: string | undefined;
40
40
  service: string;