@agimon-ai/po-session 0.0.0-alpha.21 → 0.0.0-alpha.211
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 +47 -1
- package/dist/apiContracts.cjs +34 -2
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +2 -2
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +35 -2
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/extensions/native.mjs +410 -0
- package/dist/extensions/native.mjs.map +1 -0
- package/dist/extensions/server.cjs +1661 -113
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +1657 -109
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +361 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +410 -25
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +599 -82
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +358 -1
- package/dist/index.mjs.map +1 -0
- package/dist/po-runtime-identity.json +1 -0
- package/dist/type-BlbiS10p.mjs +2622 -0
- package/dist/type-BlbiS10p.mjs.map +1 -0
- package/dist/type-DZtqhE4a.cjs +3083 -0
- package/dist/type-DZtqhE4a.cjs.map +1 -0
- package/llms.txt +4 -1
- package/locales/vi.json +29 -0
- package/locales/zh-CN.json +29 -0
- package/package.json +96 -11
- package/src/prompts/codemode-how-to-network/SKILL.md +49 -0
- package/src/prompts/codemode-how-to-session/SKILL.md +25 -0
- package/dist/sessionDelivery-4svjzWUW.mjs +0 -1028
- package/dist/sessionDelivery-4svjzWUW.mjs.map +0 -1
- package/dist/sessionDelivery-CGWuQyLV.cjs +0 -1219
- package/dist/sessionDelivery-CGWuQyLV.cjs.map +0 -1
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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Shared session coordination services for Po.
|
|
4
4
|
|
|
5
|
-
The foundation owns the session-scoped background-work coordinator used by optional execution packages. It also provides SQLite-backed delivery with host-bound sender identities, durable inbox and outbox state, acknowledgements, keyed duplicate suppression, and prompt admission that wakes idle recipients.
|
|
5
|
+
The foundation owns the session-scoped background-work coordinator used by optional execution packages. It also provides SQLite-backed delivery with host-bound sender identities, durable inbox and outbox state, acknowledgements, keyed duplicate suppression, and prompt admission that wakes idle recipients. An admission that a restart or a busy session interrupted is replayed under the same request ID. One that keeps failing for two minutes, or fails for any other reason, is marked for recovery, and the sender gets a notice that names the message.
|
|
6
6
|
|
|
7
7
|
Its public services also include:
|
|
8
8
|
|
|
@@ -12,6 +12,18 @@ Its public services also include:
|
|
|
12
12
|
|
|
13
13
|
Session delivery rechecks current authority before each initial send and queued retry. Removing a member therefore blocks later publication while preserving already accepted delivery evidence.
|
|
14
14
|
|
|
15
|
+
## Lanes
|
|
16
|
+
|
|
17
|
+
Messages between sessions travel in three lanes, so a busy session is not interrupted for news that can wait.
|
|
18
|
+
|
|
19
|
+
- **Queued** (`network.send`, and Team `intercom` to a session): stored, then folded with other queued messages into one digest when the recipient's run ends. A digest is written once and replayed as written after a restart.
|
|
20
|
+
- **Urgent** (`network.send` with `urgent: true`, `network.ask`, replies): joins the recipient's running turn. `urgent` is offered only where the host has lanes.
|
|
21
|
+
- **Logbook** (`network.log`, stop reports): stored without a turn. A `blocked` entry wakes the coordinator. A stop report wakes it only for a session it started or messaged in the last 24 hours that is still stopped. Wakes gather for 30 seconds.
|
|
22
|
+
|
|
23
|
+
A sender may start six messages or questions to one recipient in ten minutes, two of them interrupting. Replies and notices are not counted. An unanswered question brings one reminder after three minutes, also after a restart. A session files a stop report once it has stayed stopped for 90 seconds.
|
|
24
|
+
|
|
25
|
+
`sessions.start` sends the brief as `/goal -- <brief>`, so a session with Goal keeps the brief as its goal and the result says `goal: true`. A brief over 4,000 characters is refused before the session is created.
|
|
26
|
+
|
|
15
27
|
## Paired hosts
|
|
16
28
|
|
|
17
29
|
A paired host is configured privately in `~/.po/session/peers.json`. The file must be owner-only (`0600`). Each peer needs an HTTPS tunnel URL, a shared secret of at least 32 characters, and explicit operation-specific session allowlists. Pairing alone grants no Session or Voice access.
|
|
@@ -34,6 +46,16 @@ A paired host is configured privately in `~/.po/session/peers.json`. The file mu
|
|
|
34
46
|
|
|
35
47
|
Use `peer/<host-id>/<session-id>` as a qualified target. `allowedSessionIds` grants durable messages and acknowledgements. `allowedVoiceSessionIds` separately grants bounded Voice client-media relay operations. Neither grant exposes owner, `/host/*`, or `/hub/*` routes.
|
|
36
48
|
|
|
49
|
+
## Host links
|
|
50
|
+
|
|
51
|
+
`po/session-peers` owns the live peer configuration and atomic private writes. Host identity is stable across tunnel URL changes. The existing version-1 format accepts optional URL generations and revocation tombstones; existing allowlist readers remain compatible.
|
|
52
|
+
|
|
53
|
+
The sealed API under `/api/plugins/session-peer` exposes `GET /links` and `POST /link/prepare`, `/link/accept`, `/link/unlink`, and `/link/hint`. Prepare, accept, and unlink require a fresh `peer.link` step-up. Quick-tunnel linking requires a native device-key session; named tunnels also accept passkeys. An invite expires after 60 seconds and is consumed once. The app relays public ECDH material, never the derived link secret.
|
|
54
|
+
|
|
55
|
+
Links begin with empty messaging and Voice allowlists. They do not chain through a third host. Peer delivery is sealed using an authenticated handshake; a URL hint cannot bypass it. Signed rebinds must name the sender itself and advance its URL generation. Unlinking stores a tombstone. Removing a paired device does not remove a host link.
|
|
56
|
+
|
|
57
|
+
Computers of the same owner on a fresh account roster link themselves. Each one offers an invitation to the others every minute through `po/host-requests`, as a `link-auto` message on `/control` carrying a host proof instead of a step-up. The computer with the smaller host identity invites; the other accepts unless it is already linked or holds a tombstone for that host, so an unlink is never undone automatically. Both computers need a public HTTPS origin. Messages stay gated on shared session groups. Removing a computer from the account does not remove a link made this way: unlink it.
|
|
58
|
+
|
|
37
59
|
## Development
|
|
38
60
|
|
|
39
61
|
```bash
|
|
@@ -42,3 +64,27 @@ pnpm typecheck
|
|
|
42
64
|
pnpm test
|
|
43
65
|
pnpm lint
|
|
44
66
|
```
|
|
67
|
+
|
|
68
|
+
## Account network peer links
|
|
69
|
+
|
|
70
|
+
`createRosterPeerLink(ports)` adds direct host-key-authenticated sealed links using
|
|
71
|
+
an already verified C6 snapshot. Supply it as `createPeerLink({ network, ... })`
|
|
72
|
+
to expose it alongside the existing invite control as `control.network`.
|
|
73
|
+
`connect(hostId, token, exchange)` and `accept(proof, token)` sign fresh ephemeral
|
|
74
|
+
handshake keys with `signEnvelope` using the roster host key. The receiving host's
|
|
75
|
+
`authorize` port must validate the identity token's issuer, audience, current
|
|
76
|
+
membership, and proof-bound caller host. The `verifyRequest` port must perform
|
|
77
|
+
normal destination C3/C4 verification, including durable replay admission.
|
|
78
|
+
Neither a roster entry, an identity token alone, nor a channel grants application
|
|
79
|
+
permissions. Roster keys use base64url DER P-256 SPKI encoding.
|
|
80
|
+
|
|
81
|
+
Channels recheck roster epoch, membership and keys on each use. Publish C6 changes
|
|
82
|
+
before admitting new traffic; removal or key rotation refuses existing channels.
|
|
83
|
+
Fresh handshakes are required after restart. The account path does not write
|
|
84
|
+
legacy peer secrets or session permission lists. Existing 60-second invites and
|
|
85
|
+
pre-account session links retain their behavior and confer no network capability.
|
|
86
|
+
Direct links do not require an elected coordinator: in a two-voter network with
|
|
87
|
+
one down, existing direct authorized traffic can continue even though neither
|
|
88
|
+
roster writes nor coordinated relay service can progress. Election is CFT, not
|
|
89
|
+
Byzantine-safe. Actual host roster-sync and network activation are composition
|
|
90
|
+
responsibilities, not implicit consequences of enabling session peers.
|
package/dist/apiContracts.cjs
CHANGED
|
@@ -4,11 +4,33 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
|
|
6
6
|
let typebox = require("typebox");
|
|
7
|
+
//#region src/schemas/sendToSession.ts
|
|
8
|
+
/** The person's own words, steered into another live session and shown there as "From you, via <from>". */
|
|
9
|
+
const sendToSessionMethod = (0, require("@agimon-ai/po-core/pluginProtocol").definePoPluginMethod)({
|
|
10
|
+
service: "sessions",
|
|
11
|
+
method: "sendToSession",
|
|
12
|
+
scope: "host",
|
|
13
|
+
direction: "client-to-server",
|
|
14
|
+
input: typebox.Type.Object({
|
|
15
|
+
/** The session whose composer the person typed in; it names the message, nothing more. */
|
|
16
|
+
from: typebox.Type.String({ minLength: 1 }),
|
|
17
|
+
to: typebox.Type.String({ minLength: 1 }),
|
|
18
|
+
text: typebox.Type.String({
|
|
19
|
+
minLength: 1,
|
|
20
|
+
maxLength: 1e5
|
|
21
|
+
})
|
|
22
|
+
}, { additionalProperties: false }),
|
|
23
|
+
output: typebox.Type.Object({
|
|
24
|
+
to: typebox.Type.String(),
|
|
25
|
+
name: typebox.Type.String()
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
7
29
|
//#region src/schemas/apiContracts.ts
|
|
8
30
|
/** The endpoint validates its own HMAC peer credential because tunnel device authentication is intentionally bypassed. */
|
|
9
31
|
const http = [{
|
|
10
32
|
id: "peer-inbox",
|
|
11
|
-
scope: "
|
|
33
|
+
scope: "host",
|
|
12
34
|
basePath: "session-peer",
|
|
13
35
|
method: "POST",
|
|
14
36
|
path: "/inbox",
|
|
@@ -27,7 +49,17 @@ const http = [{
|
|
|
27
49
|
const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
28
50
|
version: 1,
|
|
29
51
|
http,
|
|
30
|
-
sockets: [
|
|
52
|
+
sockets: [{
|
|
53
|
+
id: "sessions.sendToSession",
|
|
54
|
+
scope: "host",
|
|
55
|
+
service: sendToSessionMethod.service,
|
|
56
|
+
member: sendToSessionMethod.method,
|
|
57
|
+
kind: "method",
|
|
58
|
+
direction: "client-to-server",
|
|
59
|
+
description: "Steer the person's text into another live session, shown there as from them.",
|
|
60
|
+
input: sendToSessionMethod.input,
|
|
61
|
+
output: sendToSessionMethod.output
|
|
62
|
+
}],
|
|
31
63
|
dynamic: []
|
|
32
64
|
});
|
|
33
65
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.cjs","names":["Type","jsonApiResponses","defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses, type PoHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\n/** The endpoint validates its own HMAC peer credential because tunnel device authentication is intentionally bypassed. */\nconst http: PoHttpContract[] = [\n {\n id: 'peer-inbox',\n scope: '
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["definePoPluginMethod","Type","Type","jsonApiResponses","defineApiContract"],"sources":["../src/schemas/sendToSession.ts","../src/schemas/apiContracts.ts"],"sourcesContent":["import { definePoPluginMethod } from '@agimon-ai/po-core/pluginProtocol';\nimport { Type } from 'typebox';\n\n/** The person's own words, steered into another live session and shown there as \"From you, via <from>\". */\nexport const sendToSessionMethod = definePoPluginMethod({\n service: 'sessions',\n method: 'sendToSession',\n scope: 'host',\n direction: 'client-to-server',\n input: Type.Object(\n {\n /** The session whose composer the person typed in; it names the message, nothing more. */\n from: Type.String({ minLength: 1 }),\n to: Type.String({ minLength: 1 }),\n text: Type.String({ minLength: 1, maxLength: 100_000 }),\n },\n { additionalProperties: false },\n ),\n output: Type.Object({ to: Type.String(), name: Type.String() }),\n});\n","import { defineApiContract, jsonApiResponses, type PoHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nimport { sendToSessionMethod } from './sendToSession';\n\n/** The endpoint validates its own HMAC peer credential because tunnel device authentication is intentionally bypassed. */\nconst http: PoHttpContract[] = [\n {\n id: 'peer-inbox',\n scope: 'host',\n basePath: 'session-peer',\n method: 'POST',\n path: '/inbox',\n authentication: 'none',\n description:\n 'Accept an HMAC-authenticated durable Session delivery envelope from an explicitly configured tunnel peer.',\n body: { contentType: 'application/json', required: true, schema: Type.Unknown() },\n responses: jsonApiResponses(Type.Object({ accepted: Type.Boolean(), state: Type.String() })),\n },\n];\n\nexport const apiContracts = defineApiContract({\n version: 1,\n http,\n sockets: [\n {\n id: 'sessions.sendToSession',\n scope: 'host',\n service: sendToSessionMethod.service,\n member: sendToSessionMethod.method,\n kind: 'method',\n direction: 'client-to-server',\n description: \"Steer the person's text into another live session, shown there as from them.\",\n input: sendToSessionMethod.input,\n output: sendToSessionMethod.output,\n },\n ],\n dynamic: [],\n});\nexport default apiContracts;\n"],"mappings":";;;;;;;;AAIA,MAAa,uBAAA,G,2CAAsBA,CAAAA,CAAAA,qBAAAA,CAAqB;CACtD,SAAS;CACT,QAAQ;CACR,OAAO;CACP,WAAW;CACX,OAAOC,QAAAA,KAAK,OACV;;EAEE,MAAMA,QAAAA,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;EAClC,IAAIA,QAAAA,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;EAChC,MAAMA,QAAAA,KAAK,OAAO;GAAE,WAAW;GAAG,WAAW;EAAQ,CAAC;CACxD,GACA,EAAE,sBAAsB,MAAM,CAChC;CACA,QAAQA,QAAAA,KAAK,OAAO;EAAE,IAAIA,QAAAA,KAAK,OAAO;EAAG,MAAMA,QAAAA,KAAK,OAAO;CAAE,CAAC;AAChE,CAAC;;;;ACbD,MAAM,OAAyB,CAC7B;CACE,IAAI;CACJ,OAAO;CACP,UAAU;CACV,QAAQ;CACR,MAAM;CACN,gBAAgB;CAChB,aACE;CACF,MAAM;EAAE,aAAa;EAAoB,UAAU;EAAM,QAAQC,QAAAA,KAAK,QAAQ;CAAE;CAChF,YAAA,GAAWC,gCAAAA,iBAAAA,CAAiBD,QAAAA,KAAK,OAAO;EAAE,UAAUA,QAAAA,KAAK,QAAQ;EAAG,OAAOA,QAAAA,KAAK,OAAO;CAAE,CAAC,CAAC;AAC7F,CACF;AAEA,MAAa,gBAAA,GAAeE,gCAAAA,kBAAAA,CAAkB;CAC5C,SAAS;CACT;CACA,SAAS,CACP;EACE,IAAI;EACJ,OAAO;EACP,SAAS,oBAAoB;EAC7B,QAAQ,oBAAoB;EAC5B,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAO,oBAAoB;EAC3B,QAAQ,oBAAoB;CAC9B,CACF;CACA,SAAS,CAAC;AACZ,CAAC"}
|
package/dist/apiContracts.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const apiContracts: {
|
|
|
5
5
|
schemas?: Record<string, boolean | object> | undefined;
|
|
6
6
|
http: {
|
|
7
7
|
id: string;
|
|
8
|
-
scope: "
|
|
8
|
+
scope: "host" | "session" | "workspace";
|
|
9
9
|
basePath?: string | undefined;
|
|
10
10
|
path: string;
|
|
11
11
|
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
@@ -33,7 +33,7 @@ export declare const apiContracts: {
|
|
|
33
33
|
}[];
|
|
34
34
|
sockets: {
|
|
35
35
|
id: string;
|
|
36
|
-
scope: "
|
|
36
|
+
scope: "host" | "session" | "workspace";
|
|
37
37
|
description: string;
|
|
38
38
|
availability?: string | undefined;
|
|
39
39
|
service: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";qBAqBa"}
|
package/dist/apiContracts.mjs
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
import { defineApiContract, jsonApiResponses } from "@agimon-ai/po-core/apiContracts";
|
|
2
2
|
import { Type } from "typebox";
|
|
3
|
+
import { definePoPluginMethod } from "@agimon-ai/po-core/pluginProtocol";
|
|
4
|
+
//#region src/schemas/sendToSession.ts
|
|
5
|
+
/** The person's own words, steered into another live session and shown there as "From you, via <from>". */
|
|
6
|
+
const sendToSessionMethod = definePoPluginMethod({
|
|
7
|
+
service: "sessions",
|
|
8
|
+
method: "sendToSession",
|
|
9
|
+
scope: "host",
|
|
10
|
+
direction: "client-to-server",
|
|
11
|
+
input: Type.Object({
|
|
12
|
+
/** The session whose composer the person typed in; it names the message, nothing more. */
|
|
13
|
+
from: Type.String({ minLength: 1 }),
|
|
14
|
+
to: Type.String({ minLength: 1 }),
|
|
15
|
+
text: Type.String({
|
|
16
|
+
minLength: 1,
|
|
17
|
+
maxLength: 1e5
|
|
18
|
+
})
|
|
19
|
+
}, { additionalProperties: false }),
|
|
20
|
+
output: Type.Object({
|
|
21
|
+
to: Type.String(),
|
|
22
|
+
name: Type.String()
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
3
26
|
//#region src/schemas/apiContracts.ts
|
|
4
27
|
/** The endpoint validates its own HMAC peer credential because tunnel device authentication is intentionally bypassed. */
|
|
5
28
|
const http = [{
|
|
6
29
|
id: "peer-inbox",
|
|
7
|
-
scope: "
|
|
30
|
+
scope: "host",
|
|
8
31
|
basePath: "session-peer",
|
|
9
32
|
method: "POST",
|
|
10
33
|
path: "/inbox",
|
|
@@ -23,7 +46,17 @@ const http = [{
|
|
|
23
46
|
const apiContracts = defineApiContract({
|
|
24
47
|
version: 1,
|
|
25
48
|
http,
|
|
26
|
-
sockets: [
|
|
49
|
+
sockets: [{
|
|
50
|
+
id: "sessions.sendToSession",
|
|
51
|
+
scope: "host",
|
|
52
|
+
service: sendToSessionMethod.service,
|
|
53
|
+
member: sendToSessionMethod.method,
|
|
54
|
+
kind: "method",
|
|
55
|
+
direction: "client-to-server",
|
|
56
|
+
description: "Steer the person's text into another live session, shown there as from them.",
|
|
57
|
+
input: sendToSessionMethod.input,
|
|
58
|
+
output: sendToSessionMethod.output
|
|
59
|
+
}],
|
|
27
60
|
dynamic: []
|
|
28
61
|
});
|
|
29
62
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses, type PoHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\n/** The endpoint validates its own HMAC peer credential because tunnel device authentication is intentionally bypassed. */\nconst http: PoHttpContract[] = [\n {\n id: 'peer-inbox',\n scope: '
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/sendToSession.ts","../src/schemas/apiContracts.ts"],"sourcesContent":["import { definePoPluginMethod } from '@agimon-ai/po-core/pluginProtocol';\nimport { Type } from 'typebox';\n\n/** The person's own words, steered into another live session and shown there as \"From you, via <from>\". */\nexport const sendToSessionMethod = definePoPluginMethod({\n service: 'sessions',\n method: 'sendToSession',\n scope: 'host',\n direction: 'client-to-server',\n input: Type.Object(\n {\n /** The session whose composer the person typed in; it names the message, nothing more. */\n from: Type.String({ minLength: 1 }),\n to: Type.String({ minLength: 1 }),\n text: Type.String({ minLength: 1, maxLength: 100_000 }),\n },\n { additionalProperties: false },\n ),\n output: Type.Object({ to: Type.String(), name: Type.String() }),\n});\n","import { defineApiContract, jsonApiResponses, type PoHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nimport { sendToSessionMethod } from './sendToSession';\n\n/** The endpoint validates its own HMAC peer credential because tunnel device authentication is intentionally bypassed. */\nconst http: PoHttpContract[] = [\n {\n id: 'peer-inbox',\n scope: 'host',\n basePath: 'session-peer',\n method: 'POST',\n path: '/inbox',\n authentication: 'none',\n description:\n 'Accept an HMAC-authenticated durable Session delivery envelope from an explicitly configured tunnel peer.',\n body: { contentType: 'application/json', required: true, schema: Type.Unknown() },\n responses: jsonApiResponses(Type.Object({ accepted: Type.Boolean(), state: Type.String() })),\n },\n];\n\nexport const apiContracts = defineApiContract({\n version: 1,\n http,\n sockets: [\n {\n id: 'sessions.sendToSession',\n scope: 'host',\n service: sendToSessionMethod.service,\n member: sendToSessionMethod.method,\n kind: 'method',\n direction: 'client-to-server',\n description: \"Steer the person's text into another live session, shown there as from them.\",\n input: sendToSessionMethod.input,\n output: sendToSessionMethod.output,\n },\n ],\n dynamic: [],\n});\nexport default apiContracts;\n"],"mappings":";;;;;AAIA,MAAa,sBAAsB,qBAAqB;CACtD,SAAS;CACT,QAAQ;CACR,OAAO;CACP,WAAW;CACX,OAAO,KAAK,OACV;;EAEE,MAAM,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;EAClC,IAAI,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;EAChC,MAAM,KAAK,OAAO;GAAE,WAAW;GAAG,WAAW;EAAQ,CAAC;CACxD,GACA,EAAE,sBAAsB,MAAM,CAChC;CACA,QAAQ,KAAK,OAAO;EAAE,IAAI,KAAK,OAAO;EAAG,MAAM,KAAK,OAAO;CAAE,CAAC;AAChE,CAAC;;;;ACbD,MAAM,OAAyB,CAC7B;CACE,IAAI;CACJ,OAAO;CACP,UAAU;CACV,QAAQ;CACR,MAAM;CACN,gBAAgB;CAChB,aACE;CACF,MAAM;EAAE,aAAa;EAAoB,UAAU;EAAM,QAAQ,KAAK,QAAQ;CAAE;CAChF,WAAW,iBAAiB,KAAK,OAAO;EAAE,UAAU,KAAK,QAAQ;EAAG,OAAO,KAAK,OAAO;CAAE,CAAC,CAAC;AAC7F,CACF;AAEA,MAAa,eAAe,kBAAkB;CAC5C,SAAS;CACT;CACA,SAAS,CACP;EACE,IAAI;EACJ,OAAO;EACP,SAAS,oBAAoB;EAC7B,QAAQ,oBAAoB;EAC5B,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAO,oBAAoB;EAC3B,QAAQ,oBAAoB;CAC9B,CACF;CACA,SAAS,CAAC;AACZ,CAAC"}
|