@plurnk/plurnk-agui 3.1.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/.env.defaults +17 -8
  2. package/README.md +33 -13
  3. package/SPEC.md +589 -268
  4. package/dist/AguiPlus.d.ts +24 -29
  5. package/dist/AguiPlus.d.ts.map +1 -1
  6. package/dist/AguiPlus.js +25 -36
  7. package/dist/AguiPlus.js.map +1 -1
  8. package/dist/AguiSurface.d.ts +1 -2
  9. package/dist/AguiSurface.d.ts.map +1 -1
  10. package/dist/AguiSurface.js +23 -16
  11. package/dist/AguiSurface.js.map +1 -1
  12. package/dist/AuthorizationDocuments.d.ts +33 -0
  13. package/dist/AuthorizationDocuments.d.ts.map +1 -0
  14. package/dist/AuthorizationDocuments.js +84 -0
  15. package/dist/AuthorizationDocuments.js.map +1 -0
  16. package/dist/BuiltinActions.d.ts +11 -5
  17. package/dist/BuiltinActions.d.ts.map +1 -1
  18. package/dist/BuiltinActions.js +73 -125
  19. package/dist/BuiltinActions.js.map +1 -1
  20. package/dist/EventRouter.d.ts +11 -3
  21. package/dist/EventRouter.d.ts.map +1 -1
  22. package/dist/EventRouter.js +17 -32
  23. package/dist/EventRouter.js.map +1 -1
  24. package/dist/MessageAddress.d.ts +7 -5
  25. package/dist/MessageAddress.d.ts.map +1 -1
  26. package/dist/MessageAddress.js +14 -12
  27. package/dist/MessageAddress.js.map +1 -1
  28. package/dist/Module.d.ts +5 -4
  29. package/dist/Module.d.ts.map +1 -1
  30. package/dist/Module.js +221 -82
  31. package/dist/Module.js.map +1 -1
  32. package/dist/OAuthServer.d.ts +30 -0
  33. package/dist/OAuthServer.d.ts.map +1 -0
  34. package/dist/OAuthServer.js +607 -0
  35. package/dist/OAuthServer.js.map +1 -0
  36. package/dist/Portal.d.ts +39 -9
  37. package/dist/Portal.d.ts.map +1 -1
  38. package/dist/Portal.js +414 -141
  39. package/dist/Portal.js.map +1 -1
  40. package/dist/ProposalHitl.d.ts +17 -4
  41. package/dist/ProposalHitl.d.ts.map +1 -1
  42. package/dist/ProposalHitl.js +30 -43
  43. package/dist/ProposalHitl.js.map +1 -1
  44. package/dist/RunHandler.d.ts +18 -8
  45. package/dist/RunHandler.d.ts.map +1 -1
  46. package/dist/RunHandler.js +214 -96
  47. package/dist/RunHandler.js.map +1 -1
  48. package/dist/ThreadAddress.d.ts +8 -0
  49. package/dist/ThreadAddress.d.ts.map +1 -0
  50. package/dist/ThreadAddress.js +18 -0
  51. package/dist/ThreadAddress.js.map +1 -0
  52. package/dist/Translator.d.ts +52 -2
  53. package/dist/Translator.d.ts.map +1 -1
  54. package/dist/Translator.js +390 -117
  55. package/dist/Translator.js.map +1 -1
  56. package/dist/client.d.ts +2 -0
  57. package/dist/client.d.ts.map +1 -0
  58. package/dist/client.js +2 -0
  59. package/dist/client.js.map +1 -0
  60. package/dist/config.d.ts +22 -2
  61. package/dist/config.d.ts.map +1 -1
  62. package/dist/config.js +65 -13
  63. package/dist/config.js.map +1 -1
  64. package/dist/index.d.ts +1 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +2 -0
  67. package/dist/index.js.map +1 -1
  68. package/dist/run-events.d.ts +1 -0
  69. package/dist/run-events.d.ts.map +1 -1
  70. package/dist/run-events.js +4 -2
  71. package/dist/run-events.js.map +1 -1
  72. package/dist/types.d.ts +4 -22
  73. package/dist/types.d.ts.map +1 -1
  74. package/package.json +12 -8
package/.env.defaults CHANGED
@@ -1,13 +1,22 @@
1
1
  # @plurnk/plurnk-agui — client protocol. Listener address: the shared PLURNK_HOST/PLURNK_PORT
2
- # (@plurnk/plurnk-contracts).
2
+ # (@plurnk/plurnk-contracts). The posture, the operator's secret and the browser sign-in are the
3
+ # shared PLURNK_AUTH, PLURNK_SECRET and PLURNK_PASS there ({§agui-oauth}).
3
4
 
4
- # Bearer required on non-preflight requests; empty = no module-level authentication. Empty is the
5
- # package floor, not the shipped posture: a fresh install mints its own token into the operator's
6
- # `.env` above this ({§agui-http-authorization}), and every client reads it from there. Emptying
7
- # that line is how an operator turns the perimeter off.
8
- PLURNK_AGUI_TOKEN=
9
- # The origin whose pages a browser lets read replies (CORS): * = any page; one origin = that page
10
- # only; empty = no CORS headers, so no page reads a reply. The bearer, not this, is the perimeter.
5
+ # The authorization server's issuer, the public origin clients reach this daemon at
6
+ # ({§agui-oauth-endpoints}). Empty = the address each request reached this daemon at, so a daemon on
7
+ # every interface (PLURNK_HOST=0.0.0.0) answers each caller where it called; set it when a front the
8
+ # daemon cannot see, such as a TLS proxy, serves another origin.
9
+ PLURNK_AGUI_ISSUER=
10
+ # Credential lifetimes ({§agui-oauth-tokens}), seconds. An access token is presented as the bearer and
11
+ # renewed through the refresh token or the secret; a refresh token rotates on every use.
12
+ PLURNK_AGUI_ACCESS_TTL_SEC=3600
13
+ PLURNK_AGUI_REFRESH_TTL_SEC=2592000
14
+ # Confidential clients beyond the operator's own, one line each ({§agui-oauth-clients}):
15
+ # PLURNK_AGUI_CLIENT_<id>={"secret":"<its secret>","scopes":["agui"]}. Each holds its own
16
+ # credentials; removing its line and restarting revokes them. "operator" is reserved.
17
+ # The other origin whose pages a browser lets read replies (CORS): * = any page; one origin = that
18
+ # page only; empty = no CORS headers, so no page of another origin reads a reply (a page this
19
+ # daemon serves reads its own). The bearer, not this, is the perimeter.
11
20
  PLURNK_AGUI_ALLOW_ORIGIN=*
12
21
  # Default run turn cap: empty = no module default; -1 = unlimited; otherwise nonnegative integer.
13
22
  # Core's operator ceiling still applies.
package/README.md CHANGED
@@ -7,34 +7,50 @@ interface and translates daemon lifecycle events into AG-UI events.
7
7
 
8
8
  `POST /agui` accepts `RunAgentInput` and returns an AG-UI event stream.
9
9
 
10
+ A stock AG-UI client needs only the endpoint and, when enabled, authentication.
11
+ Its first message creates a folderless workspace and worker; the same `threadId`
12
+ reopens that conversation after reconnect or daemon restart. An existing worker
13
+ is directly addressable as `<workspace ID>#<worker name>`, stable across workspace
14
+ renames. Inspection creates nothing ({§agui-thread-binding}, {§agui-thread-address}).
15
+
10
16
  PLURNK uses standard AG-UI events for Runs, messages, steps, tool calls, state,
11
- and approval requests. Additional execution metadata uses namespaced
12
- `plurnk.*` custom events so generic AG-UI clients can ignore it safely.
17
+ and approval requests. PLURNK's facts about those parts ride their standard
18
+ `metadata` under `plurnk`; facts with no standard subject use namespaced
19
+ `plurnk.*` custom events, so generic AG-UI clients can ignore them safely.
13
20
 
14
21
  Workspace selection and PLURNK-specific management actions use namespaced
15
22
  fields under `forwardedProps.plurnk`. `SPEC.md` defines those extensions.
16
23
 
17
- ## Conversation projection
24
+ ## Event projection
18
25
 
19
- Each Run observes its bound Worker and, once known, its exact Loop. Sibling
20
- events do not become chat messages; child activity arrives only when Core
21
- delivers it into the parent's log ({§agui-topology-scope}).
26
+ Each Run observes its bound worker and, once known, its exact loop. Delegated
27
+ children have standard subagent identities rather than speaking as the parent;
28
+ Core owns delivery of their replies and results into the parent's log
29
+ ({§agui-topology-scope}, {§agui-subagents}). Unrelated siblings stay outside the
30
+ conversation.
22
31
 
23
32
  | Daemon evidence | Client projection |
24
33
  | --- | --- |
25
34
  | NOTE | Ordinary operation row containing literal working memory. |
26
- | WAIT / loop conclusion | Lifecycle signals; delivered SEND replies are assistant speech. |
35
+ | WAIT | A tool call with its receipt; a WAIT that carries a body speaks it instead. |
36
+ | Loop conclusion | Lifecycle signals; delivered SEND replies are assistant speech. |
27
37
  | Live provider reasoning | Standard `REASONING_*` deltas, immediately. Retries have separate identities. |
28
38
  | SEND | Assistant text; already-streamed reasoning is not repeated. |
39
+ | A message to the worker | A user message, named by its source unless this client sent it. |
29
40
  | Other model operations | Standard tool calls and results. |
30
- | Log rows | `CUSTOM plurnk.row` for richer clients; not a second chat stream to render alongside standard messages. |
31
- | Harness activity | `CUSTOM plurnk.ambient`, without invented model speech. |
32
- | Packet and terminal usage | State updates and `plurnk.terminated`; daemon quantities pass through unchanged. |
41
+ | A row's facts | `metadata.plurnk` on the message, tool call or result the row builds, live and on snapshot. |
42
+ | Delegated child activity | Standard `SUBAGENT_*` lifecycle and attributed messages/tool calls; its conclusion answers the parent's delegation call. |
43
+ | Non-conversation harness activity | `CUSTOM plurnk.ambient`, without invented model speech. |
44
+ | Loop end | `RUN_FINISHED` completed with its result or cancelled, or `RUN_ERROR` for a failure; the end carries its token `usage`. |
45
+ | Packet and terminal usage | State updates, and the loop's terminal record as the end's `metadata.plurnk.terminal`: the complete accounting with cost; daemon quantities pass through unchanged. |
33
46
 
34
47
  READ of `reasoning://<worker>/…` is an operation receipt, not another reasoning stream.
35
- On reattach, the durable conversation snapshot restores accepted reasoning and
36
- SENDs. `forwardedProps.plurnk.mode="sync"` obtains that state without a prompt
37
- or model inference ({§agui-conversation-sync}).
48
+
49
+ A Run's `messages` are the client's copy of the conversation. A Run submits only a
50
+ user message the conversation doesn't hold, and a Run with nothing new reattaches:
51
+ the durable `MESSAGES_SNAPSHOT` restores the whole conversation without a prompt or
52
+ model inference ({§agui-run-input}, {§agui-sync}). A stock `HttpAgent` therefore
53
+ reattaches by running again with its history.
38
54
 
39
55
  Pending proposals and user interactions use standard AG-UI interrupts and
40
56
  resume Runs. Core decides their owner and disposition, including delegated
@@ -43,6 +59,10 @@ event schemas, and settlement rules live in [SPEC.md](./SPEC.md).
43
59
 
44
60
  ## Integration
45
61
 
62
+ A browser client imports the state and action-outcome types from
63
+ `@plurnk/plurnk-agui/client`, which needs no Node types ({§agui-client-types}); the
64
+ package root is the server module.
65
+
46
66
  The daemon discovers this package as a module: its `package.json` declares
47
67
  `plurnk: { kind: "module", module: "./module" }`, and the service composes
48
68
  nothing by hand. The module mounts only `/agui` on the daemon's listener