@plurnk/plurnk-agui 1.6.0 → 1.7.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.
- package/SPEC.md +45 -25
- package/dist/AguiPlus.d.ts +17 -2
- package/dist/AguiPlus.d.ts.map +1 -1
- package/dist/AguiPlus.js +53 -1
- package/dist/AguiPlus.js.map +1 -1
- package/dist/DaemonSeam.d.ts +17 -4
- package/dist/DaemonSeam.d.ts.map +1 -1
- package/dist/EventRouter.d.ts.map +1 -1
- package/dist/EventRouter.js +3 -1
- package/dist/EventRouter.js.map +1 -1
- package/dist/Module.d.ts.map +1 -1
- package/dist/Module.js +36 -21
- package/dist/Module.js.map +1 -1
- package/dist/Portal.d.ts +3 -2
- package/dist/Portal.d.ts.map +1 -1
- package/dist/Portal.js +24 -4
- package/dist/Portal.js.map +1 -1
- package/dist/ProposalHitl.d.ts +9 -5
- package/dist/ProposalHitl.d.ts.map +1 -1
- package/dist/ProposalHitl.js +139 -54
- package/dist/ProposalHitl.js.map +1 -1
- package/dist/Translator.d.ts.map +1 -1
- package/dist/Translator.js +5 -3
- package/dist/Translator.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/SPEC.md
CHANGED
|
@@ -66,7 +66,7 @@ same log identity and verbatim goals:
|
|
|
66
66
|
|
|
67
67
|
- **An op row IS a tool call** — its `coordinate` is the `toolCallId`, its tx the args (one
|
|
68
68
|
delta: a dispatched plurnk op is atomic), its rx the result. The log-shaped richness the
|
|
69
|
-
core vocabulary can't hold (fold state, tags,
|
|
69
|
+
core vocabulary can't hold (fold state, tags, curation weight) stays on the row inside
|
|
70
70
|
`plurnk.ambient`/`TOOL_CALL_RESULT` payloads.
|
|
71
71
|
- §agui-encrypted-reasoning **Encrypted reasoning projects only onto an entity
|
|
72
72
|
AG-UI actually created.** Core supplies the exact normalized provider-detail
|
|
@@ -98,9 +98,12 @@ state paths that could be mistaken for standard AG-UI fields.
|
|
|
98
98
|
|
|
99
99
|
| AG-UI state location | Daemon source | Meaning |
|
|
100
100
|
|:--------------------------------------------|:-----------------------------------------|:--------|
|
|
101
|
-
| `snapshot.plurnk.providers[*].
|
|
102
|
-
| `
|
|
103
|
-
| `STATE_DELTA /budget/
|
|
101
|
+
| `snapshot.plurnk.providers[*].inputCapacity` | `providers.list.aliases[*]` | Each provider alias's derived physical input capacity, or `null` when unknown. |
|
|
102
|
+
| `snapshot.budget` | Run initialization | Creates all four gauge fields as `null`, so subsequent RFC 6902 `replace` operations always address existing values. |
|
|
103
|
+
| `STATE_DELTA /budget/curationWeight` | `loop/terminated.usage.curationWeight` | Latest assembled packet's model-independent curation weight, or `null` when no packet exists. |
|
|
104
|
+
| `STATE_DELTA /budget/curationBudget` | `loop/terminated.usage.curationBudget` | Latest turn's provider-derived curation calibration, or `null` when capacity is unknown. |
|
|
105
|
+
| `STATE_DELTA /budget/contextTokens` | `loop/terminated.usage.contextTokens` | Latest emission call's last physical request input occupancy, or `null` when that call issued none or reported none. |
|
|
106
|
+
| `STATE_DELTA /budget/contextCapacity` | `loop/terminated.usage.contextCapacity` | That same latest emission call's request-shaped physical input capacity, or `null` when unknown. |
|
|
104
107
|
|
|
105
108
|
§agui-cost-evidence AG-UI defines lifecycle, messages, tools, state transport,
|
|
106
109
|
`RAW`, and `CUSTOM`, but no standard token-usage or monetary-accounting event.
|
|
@@ -113,32 +116,39 @@ ignore the extension; PLURNK clients consume the same contracts-owned shape as
|
|
|
113
116
|
every other daemon surface.
|
|
114
117
|
|
|
115
118
|
- §agui-row-channel **The row channel** — every log row ALSO rides `CUSTOM plurnk.row`
|
|
116
|
-
carrying the full wire entry (fold state, durable tags,
|
|
119
|
+
carrying the full wire entry (fold state, durable tags, curation weight, coordinate) alongside its
|
|
117
120
|
core projection. Rich clients (TUI/nvim) render plurnk-native fidelity from `plurnk.row`;
|
|
118
121
|
generic clients never see the difference. This is the metadata channel the exclusive-portal
|
|
119
122
|
migration stands on.
|
|
120
123
|
- **The gauge starts true** — `RUN_STARTED` is followed by a `STATE_SNAPSHOT` carrying the
|
|
121
|
-
daemon's `providers.list` truth (the effective
|
|
124
|
+
daemon's `providers.list` truth (the effective input capacity, the active model), then
|
|
122
125
|
`STATE_DELTA`s. A dropped SSE stream cancels the loop (`loop.cancel`) — the frontend hanging
|
|
123
126
|
up IS the abort signal; no worker is orphaned unwatched.
|
|
124
127
|
|
|
125
128
|
- §agui-replay **Reattach replays** — a rediscovered thread (the module restarted, a second
|
|
126
129
|
frontend arrived) attaches to its existing workspace by name→id and opens ORIENTED: the model
|
|
127
130
|
worker's PLAN activities and SEND speech replay as `MESSAGES_SNAPSHOT`; everything else stays
|
|
128
|
-
reachable via live `plurnk.row`. Pending proposals
|
|
129
|
-
interrupts when the owning conversation is
|
|
130
|
-
never converted into a mystery hang.
|
|
131
|
+
reachable via live `plurnk.row`. Pending proposals and client interactions remain durable while
|
|
132
|
+
their operation owners are live and are presented as interrupts when the owning conversation is
|
|
133
|
+
resumed; a days-old question is discoverable, never converted into a mystery hang.
|
|
131
134
|
|
|
132
|
-
## §agui-proposal-resolve
|
|
135
|
+
## §agui-proposal-resolve Client-owned stop-the-world interactions
|
|
133
136
|
|
|
134
|
-
Every client-owned daemon proposal
|
|
135
|
-
emits an AG-UI tool call and terminates AG-UI Run A with
|
|
137
|
+
Every client-owned daemon proposal—file edits and `[300]` operator questions—and
|
|
138
|
+
every contracts-owned client interaction emits an AG-UI tool call and terminates AG-UI Run A with
|
|
136
139
|
`RUN_FINISHED.outcome.type = "interrupt"`. The durable loop remains paused indefinitely
|
|
137
140
|
by default; absence is not an answer. AG-UI Run B on the same thread supplies standard
|
|
138
|
-
`RunAgentInput.resume` entries. Each entry correlates through `interruptId = toolCallId
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
`RunAgentInput.resume` entries. Each entry correlates through `interruptId = toolCallId`, using
|
|
142
|
+
`prop:<logEntryId>` for proposals and `int:<interactionId>` for client interactions. The module
|
|
143
|
+
resolves the complete pending interrupt set for one worker, binds AG-UI Run B to the persisted
|
|
144
|
+
loop, and releases it. A resume containing foreign, partial, unknown, duplicate, or multi-worker
|
|
145
|
+
interrupt sets fails before any stopped operation is released.
|
|
146
|
+
|
|
147
|
+
Proposal tool-call arguments and resume payloads retain the proposal review contract.
|
|
148
|
+
Client-interaction tool calls use the request's exact `toolName` and `arguments`; their standard
|
|
149
|
+
interrupt carries its optional `message` and `responseSchema`. A resolved resume payload becomes
|
|
150
|
+
the generic resolved payload, while AG-UI cancellation becomes interaction cancellation. AG-UI
|
|
151
|
+
never sees or reconstructs an upstream protocol's continuation state.
|
|
142
152
|
|
|
143
153
|
§agui-proposal-disposition **AG-UI consumes disposition; it does not infer policy.** Both the live `loop/proposal` payload and `CoreSeam.pendingProposals()` return the contracts-owned `ProposalProjection`. `disposition.owner` is the sole presentation branch:
|
|
144
154
|
|
|
@@ -157,7 +167,7 @@ an omitted service-default selection.
|
|
|
157
167
|
## §agui-management-plane The action surface
|
|
158
168
|
|
|
159
169
|
PLURNK has three inputs through the one AG-UI Run endpoint. A normal user message
|
|
160
|
-
and a standard
|
|
170
|
+
and a standard interrupt resume are not management actions and have no invented
|
|
161
171
|
`loop.run` or `loop.resolve` action names.
|
|
162
172
|
|
|
163
173
|
```mermaid
|
|
@@ -165,12 +175,12 @@ flowchart LR
|
|
|
165
175
|
client["AG-UI client"] --> run["POST RunAgentInput"]
|
|
166
176
|
run --> classify{"Input form"}
|
|
167
177
|
classify -->|"textual user message"| loop["CoreSeam.runLoop"]
|
|
168
|
-
classify -->|"RunAgentInput.resume"|
|
|
178
|
+
classify -->|"RunAgentInput.resume"| resume["CoreSeam proposal / interaction resolution"]
|
|
169
179
|
classify -->|"forwardedProps.plurnk.action"| actions{"AG-UI action registry"}
|
|
170
180
|
actions --> builtIn["Built-in validation<br/>and typed CoreSeam call"]
|
|
171
|
-
actions --> extension["CoreSeam.invokeModuleAction"]
|
|
181
|
+
actions --> extension["Scoped CoreSeam.invokeModuleAction"]
|
|
172
182
|
loop --> events["Core event source"]
|
|
173
|
-
|
|
183
|
+
resume --> events
|
|
174
184
|
builtIn --> events
|
|
175
185
|
events --> projection["AG-UI projection"]
|
|
176
186
|
extension --> result["plurnk.action.result"]
|
|
@@ -212,7 +222,17 @@ successfully transported management Run; it does not turn the Run into
|
|
|
212
222
|
| `workspace.members` | Workspace | none | `CoreSeam.listMembers`. |
|
|
213
223
|
| `op.look` | Workspace | `text` | Admits one LOOK under {§agui-op-look}, rewrites it to READ, and calls core's no-log `look` projection. |
|
|
214
224
|
| `run.fork` | Workspace | `name?` | `CoreSeam.forkWorker` from the thread's conversation worker. |
|
|
215
|
-
| Registered module action |
|
|
225
|
+
| Registered module action | Owner-declared | owner-defined | `CoreSeam.invokeModuleAction`; AG-UI passes either a worldless context or the already-bound workspace context outside supplied params. The owner validates params and owns the result. |
|
|
226
|
+
|
|
227
|
+
§agui-module-action-scope **An extension action uses the same management plane,
|
|
228
|
+
not a private endpoint.** `CoreSeam.listModuleActions()` returns its exact
|
|
229
|
+
`{ name, scope }` descriptors. A worldless action follows the control path and
|
|
230
|
+
cannot establish a workspace. A workspace action follows ordinary thread
|
|
231
|
+
binding, resolves the client envelope first, and invokes core with
|
|
232
|
+
`{ scope: "workspace", workspaceId: envelope.workspaceId }`; an `id`,
|
|
233
|
+
`workspaceId`, or similarly named owner parameter cannot override that
|
|
234
|
+
identity. `discover.methods` advertises both kinds by name without importing
|
|
235
|
+
the extension owner.
|
|
216
236
|
|
|
217
237
|
### §agui-op-parse Parsed-operation projection
|
|
218
238
|
|
|
@@ -307,14 +327,14 @@ into the conversation a generic frontend renders.
|
|
|
307
327
|
Workspace information fans to every open AG-UI Run: ambient rows and stream activity
|
|
308
328
|
remain visible across the workspace, with each SSE
|
|
309
329
|
using its own render router. Terminal control does not fan. A message AG-UI Run binds
|
|
310
|
-
to the exact `loopId` returned by `CoreSeam.runLoop`;
|
|
311
|
-
pending
|
|
330
|
+
to the exact `loopId` returned by `CoreSeam.runLoop`; an interrupt-resume AG-UI Run binds to the
|
|
331
|
+
pending item's persisted `loopId` before resolving it. Only that loop's
|
|
312
332
|
`loop/terminated` event may emit `plurnk.terminated` and close the SSE.
|
|
313
333
|
The custom event preserves the daemon's exact universal `result`; failures use
|
|
314
334
|
the Problem `type` as the AG-UI error code and `detail` as its message. The
|
|
315
335
|
module never reconstructs a failure from a status, summary, or exception text.
|
|
316
|
-
|
|
317
|
-
|
|
336
|
+
Stopped-world tool calls and interrupt outcomes route only to their owning worker;
|
|
337
|
+
interrupting sibling AG-UI Runs would violate AG-UI Run identity. Terminations
|
|
318
338
|
that race ahead of the `runLoop` acknowledgement are held until
|
|
319
339
|
the loop identity is known. A sibling, child, or concurrent loop can therefore
|
|
320
340
|
remain visible as topology without ending or relabelling this AG-UI Run.
|
package/dist/AguiPlus.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AguiEvent, type ProposalNotification } from "./types.ts";
|
|
2
2
|
import type { Interrupt, ResumeEntry } from "@ag-ui/core";
|
|
3
|
-
import type { ProblemDetails } from "@plurnk/plurnk-contracts";
|
|
3
|
+
import type { ClientInteractionProjection, ClientInteractionResolution, ProblemDetails } from "@plurnk/plurnk-contracts";
|
|
4
4
|
export declare const proposalToolCallId: (logEntryId: number) => string;
|
|
5
5
|
export declare const logEntryIdFromToolCallId: (toolCallId: string) => number | null;
|
|
6
6
|
export declare const proposalToolName: (op: string) => string;
|
|
@@ -12,12 +12,21 @@ export interface Resolution {
|
|
|
12
12
|
body?: string;
|
|
13
13
|
}
|
|
14
14
|
export declare const resolutionFromResume: (entry: ResumeEntry) => Resolution | null;
|
|
15
|
+
export declare const interactionToolCallId: (interactionId: number) => string;
|
|
16
|
+
export declare const interactionIdFromToolCallId: (toolCallId: string) => number | null;
|
|
17
|
+
export declare const interactionToolCall: (interaction: ClientInteractionProjection) => AguiEvent[];
|
|
18
|
+
export declare const interactionInterrupt: (interaction: ClientInteractionProjection) => Interrupt;
|
|
19
|
+
export interface InteractionResolution {
|
|
20
|
+
interactionId: number;
|
|
21
|
+
resolution: ClientInteractionResolution;
|
|
22
|
+
}
|
|
23
|
+
export declare const interactionResolutionFromResume: (entry: ResumeEntry) => InteractionResolution | null;
|
|
15
24
|
export interface AguiPlusState {
|
|
16
25
|
providers?: Array<{
|
|
17
26
|
alias: string;
|
|
18
27
|
model: string;
|
|
19
28
|
active: boolean;
|
|
20
|
-
|
|
29
|
+
inputCapacity: number | null;
|
|
21
30
|
}>;
|
|
22
31
|
workspace?: {
|
|
23
32
|
id: number;
|
|
@@ -34,6 +43,12 @@ export interface AguiPlusState {
|
|
|
34
43
|
glob: string;
|
|
35
44
|
}>;
|
|
36
45
|
}
|
|
46
|
+
export interface AguiBudgetState {
|
|
47
|
+
readonly curationWeight: number | null;
|
|
48
|
+
readonly curationBudget: number | null;
|
|
49
|
+
readonly contextTokens: number | null;
|
|
50
|
+
readonly contextCapacity: number | null;
|
|
51
|
+
}
|
|
37
52
|
export declare const stateSnapshot: (s: AguiPlusState) => AguiEvent;
|
|
38
53
|
export declare const stateDelta: (patches: Array<{
|
|
39
54
|
op: string;
|
package/dist/AguiPlus.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AguiPlus.d.ts","sourceRoot":"","sources":["../src/AguiPlus.ts"],"names":[],"mappings":"AAQA,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"AguiPlus.d.ts","sourceRoot":"","sources":["../src/AguiPlus.ts"],"names":[],"mappings":"AAQA,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;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,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC;AACpG,eAAO,MAAM,YAAY,SAAU,MAAM,WAAW,aAAa,KAAG,SACuB,CAAC"}
|
package/dist/AguiPlus.js
CHANGED
|
@@ -57,7 +57,59 @@ export const resolutionFromResume = (entry) => {
|
|
|
57
57
|
return null;
|
|
58
58
|
return { logEntryId, decision, ...(body !== undefined ? { body } : {}) };
|
|
59
59
|
};
|
|
60
|
-
export const
|
|
60
|
+
export const interactionToolCallId = (interactionId) => `int:${interactionId}`;
|
|
61
|
+
export const interactionIdFromToolCallId = (toolCallId) => {
|
|
62
|
+
const match = /^int:(\d+)$/.exec(toolCallId);
|
|
63
|
+
return match === null ? null : Number(match[1]);
|
|
64
|
+
};
|
|
65
|
+
export const interactionToolCall = (interaction) => {
|
|
66
|
+
const toolCallId = interactionToolCallId(interaction.interactionId);
|
|
67
|
+
return [
|
|
68
|
+
{
|
|
69
|
+
type: EventType.TOOL_CALL_START,
|
|
70
|
+
toolCallId,
|
|
71
|
+
toolCallName: interaction.request.toolName,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: EventType.TOOL_CALL_ARGS,
|
|
75
|
+
toolCallId,
|
|
76
|
+
delta: JSON.stringify(interaction.request.arguments),
|
|
77
|
+
},
|
|
78
|
+
{ type: EventType.TOOL_CALL_END, toolCallId },
|
|
79
|
+
];
|
|
80
|
+
};
|
|
81
|
+
export const interactionInterrupt = (interaction) => ({
|
|
82
|
+
id: interactionToolCallId(interaction.interactionId),
|
|
83
|
+
reason: "tool_call",
|
|
84
|
+
toolCallId: interactionToolCallId(interaction.interactionId),
|
|
85
|
+
message: interaction.request.message ?? "Provide the requested input.",
|
|
86
|
+
responseSchema: interaction.request.responseSchema,
|
|
87
|
+
});
|
|
88
|
+
export const interactionResolutionFromResume = (entry) => {
|
|
89
|
+
const interactionId = interactionIdFromToolCallId(entry.interruptId);
|
|
90
|
+
if (interactionId === null)
|
|
91
|
+
return null;
|
|
92
|
+
if (entry.status === "cancelled") {
|
|
93
|
+
return { interactionId, resolution: { status: "cancelled" } };
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
interactionId,
|
|
97
|
+
resolution: {
|
|
98
|
+
status: "resolved",
|
|
99
|
+
...(Object.hasOwn(entry, "payload") ? { payload: entry.payload } : {}),
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
const EMPTY_BUDGET = Object.freeze({
|
|
104
|
+
curationWeight: null,
|
|
105
|
+
curationBudget: null,
|
|
106
|
+
contextTokens: null,
|
|
107
|
+
contextCapacity: null,
|
|
108
|
+
});
|
|
109
|
+
export const stateSnapshot = (s) => ({
|
|
110
|
+
type: EventType.STATE_SNAPSHOT,
|
|
111
|
+
snapshot: { plurnk: s, budget: EMPTY_BUDGET },
|
|
112
|
+
});
|
|
61
113
|
export const stateDelta = (patches) => ({ type: EventType.STATE_DELTA, delta: patches });
|
|
62
114
|
export const parseAction = (forwardedProps) => {
|
|
63
115
|
const action = forwardedProps?.plurnk?.action;
|
package/dist/AguiPlus.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AguiPlus.js","sourceRoot":"","sources":["../src/AguiPlus.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,qCAAqC;AACrC,oFAAoF;AACpF,0EAA0E;AAC1E,EAAE;AACF,gFAAgF;AAChF,kFAAkF;AAElF,OAAO,EAAE,SAAS,EAA6C,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"AguiPlus.js","sourceRoot":"","sources":["../src/AguiPlus.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,qCAAqC;AACrC,oFAAoF;AACpF,0EAA0E;AAC1E,EAAE;AACF,gFAAgF;AAChF,kFAAkF;AAElF,OAAO,EAAE,SAAS,E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,EAAE,OAAO,EAAE,CAAC,CAAC;AAU1J,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,cAAuB,EAAwB,EAAE;IACzE,MAAM,MAAM,GAAI,cAAgE,EAAE,MAAM,EAAE,MAAM,CAAC;IACjG,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC/D,MAAM,IAAI,GAAI,MAA6B,CAAC,IAAI,CAAC;IACjD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/D,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,GAAG,MAAiC,CAAC;IACrE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,OAAsB,EAAa,EAAE,CAC5E,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,CAAC"}
|
package/dist/DaemonSeam.d.ts
CHANGED
|
@@ -5,18 +5,31 @@ export interface ProposalResolution {
|
|
|
5
5
|
outcome?: string;
|
|
6
6
|
}
|
|
7
7
|
export type { ProposalProjection as PendingProposal } from "@plurnk/plurnk-contracts";
|
|
8
|
-
|
|
8
|
+
export type { ClientInteractionProjection as PendingClientInteraction } from "@plurnk/plurnk-contracts";
|
|
9
|
+
import type { ClientDisplayCapabilities, ClientInteractionProjection, ClientInteractionResolution, EntryReadResult, ProposalProjection } from "@plurnk/plurnk-contracts";
|
|
9
10
|
import type { OperationResult } from "@plurnk/plurnk-contracts";
|
|
10
11
|
import type { PlurnkStatement } from "@plurnk/plurnk-contracts";
|
|
11
12
|
export type { PlurnkStatement };
|
|
13
|
+
export type ModuleActionContext = {
|
|
14
|
+
readonly scope: "worldless";
|
|
15
|
+
} | {
|
|
16
|
+
readonly scope: "workspace";
|
|
17
|
+
readonly workspaceId: number;
|
|
18
|
+
};
|
|
19
|
+
export interface ModuleActionDescriptor {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly scope: ModuleActionContext["scope"];
|
|
22
|
+
}
|
|
12
23
|
export type LogEntryWire = Record<string, unknown>;
|
|
13
24
|
export interface DaemonSeam {
|
|
14
25
|
listClientDisplayCapabilities(): Promise<ClientDisplayCapabilities>;
|
|
15
|
-
listModuleActions():
|
|
16
|
-
invokeModuleAction(name: string, params: Readonly<Record<string, unknown
|
|
26
|
+
listModuleActions(): ModuleActionDescriptor[];
|
|
27
|
+
invokeModuleAction(name: string, params: Readonly<Record<string, unknown>>, context: ModuleActionContext): Promise<unknown>;
|
|
17
28
|
subscribeToEvents(handler: (workspaceId: number | null, method: string, params: unknown) => void): () => void;
|
|
18
29
|
pendingProposals(workspaceId: number): Promise<ProposalProjection[]>;
|
|
19
30
|
resolveProposal(logEntryId: number, resolution: ProposalResolution): void;
|
|
31
|
+
pendingClientInteractions(workspaceId: number): Promise<ClientInteractionProjection[]>;
|
|
32
|
+
resolveClientInteraction(interactionId: number, resolution: ClientInteractionResolution): Promise<void>;
|
|
20
33
|
ensureModelWorker(workspaceId: number): Promise<number>;
|
|
21
34
|
runLoop(args: {
|
|
22
35
|
workspaceId: number;
|
|
@@ -59,7 +72,7 @@ export interface DaemonSeam {
|
|
|
59
72
|
provider: string;
|
|
60
73
|
model: string;
|
|
61
74
|
active: boolean;
|
|
62
|
-
|
|
75
|
+
inputCapacity: number | null;
|
|
63
76
|
}>;
|
|
64
77
|
};
|
|
65
78
|
createWorkspace(args: {
|
package/dist/DaemonSeam.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DaemonSeam.d.ts","sourceRoot":"","sources":["../src/DaemonSeam.ts"],"names":[],"mappings":"AAMA,MAAM,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M,GAAG,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAEhH;IAED,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,CAAyC;IACpF,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,EAAE,CAAoC;IAEhG,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,CAMlD;
|
|
1
|
+
{"version":3,"file":"EventRouter.d.ts","sourceRoot":"","sources":["../src/EventRouter.ts"],"names":[],"mappings":"AAQA,OAAO,EAAa,KAAK,SAAS,EAA0D,MAAM,YAAY,CAAC;AAG/G,MAAM,CAAC,OAAO,OAAO,WAAW;;IAG5B,YAAY,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAEhH;IAED,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,CAAyC;IACpF,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,EAAE,CAAoC;IAEhG,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,CAMlD;CA2CJ"}
|
package/dist/EventRouter.js
CHANGED
|
@@ -36,7 +36,9 @@ class EventRouter {
|
|
|
36
36
|
{ type: EventType.CUSTOM, name: "plurnk.stream", value: params },
|
|
37
37
|
_a.#activity(params),
|
|
38
38
|
];
|
|
39
|
-
case "loop/proposal":
|
|
39
|
+
case "loop/proposal":
|
|
40
|
+
case "loop/interaction":
|
|
41
|
+
return []; // ProposalHitl owns the shared terminate-resume path.
|
|
40
42
|
default: return []; // workspace/created + anything unmodeled: the module handles out-of-band
|
|
41
43
|
}
|
|
42
44
|
}
|
package/dist/EventRouter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventRouter.js","sourceRoot":"","sources":["../src/EventRouter.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,qFAAqF;AACrF,sFAAsF;AACtF,8FAA8F;AAC9F,wFAAwF;AACxF,kFAAkF;;AAElF,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,SAAS,EAA0E,MAAM,YAAY,CAAC;AAC/G,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAqB,WAAW;IAC5B,EAAE,CAAa;IAEf,YAAY,IAAqG;QAC7G,IAAI,CAAC,EAAE,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,UAAU,CAAC,QAAkB,IAAiB,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpF,MAAM,CAAC,OAAuC,IAAiB,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEhG,KAAK,CAAC,MAAc,EAAE,MAAe;QACjC,OAAO,YAAY,CAAE,8EAA8E;QAC/F,YAAY,EACZ,EAAE,MAAM,EAAE,EACV,GAAgB,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CACxD,CAAC;IACN,CAAC;IAED,aAAa,CAAC,MAAc,EAAE,MAAe;QACzC,QAAQ,MAAM,EAAE,CAAC;YACb,KAAK,WAAW,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAA8B,CAAC,CAAC;YAC1E,KAAK,iBAAiB,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAgC,CA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AAI,EAAE,CAA0C,CAAC;QAClE,MAAM,OAAO,GAAG,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ;YACzD,CAAC,CAAC,MAAiC;YACnC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QACxB,OAAO;YACH,IAAI,EAAE,SAAS,CAAC,iBAAiB;YACjC,SAAS,EAAE,UAAU,CAAC,CAAC,OAAO,IAAI,CAAC,EAAE;YACrC,YAAY,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ;YACrG,OAAO;YACP,OAAO,EAAE,IAAI;SAChB,CAAC;IACN,CAAC;CACJ"}
|
package/dist/Module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Module.d.ts","sourceRoot":"","sources":["../src/Module.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Module.d.ts","sourceRoot":"","sources":["../src/Module.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACR,UAAU,EAIb,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAwB,KAAK,aAAa,EAA8B,MAAM,aAAa,CAAC;AAEnG,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,kBAAkB;IAC/B,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5C;AAsGD,MAAM,CAAC,OAAO,OAAO,MAAM;;IA6BvB,YAAY,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAMhD;IAsBD,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,GAAG,kBAAkB,CAQnD;IAEK,MAAM,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAMtD;IAED,OAAO,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAIxC;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAG3B;CA6uBJ"}
|
package/dist/Module.js
CHANGED
|
@@ -19,7 +19,6 @@ import { PlurnkParser, UNKNOWN_POSITION } from "@plurnk/plurnk-contracts";
|
|
|
19
19
|
import { EventType } from "./types.js";
|
|
20
20
|
import { aguiRouteTemplate, observed } from "./observe.js";
|
|
21
21
|
import { RunAgentInputSchema } from "@ag-ui/core";
|
|
22
|
-
import { logEntryIdFromToolCallId, proposalInterrupt } from "./AguiPlus.js";
|
|
23
22
|
import { Problems, Validator } from "@plurnk/plurnk-contracts";
|
|
24
23
|
import { resolveModuleOptions } from "./config.js";
|
|
25
24
|
const actionFailure = (code, detail, status = 400, extensions = {}) => ({
|
|
@@ -112,28 +111,34 @@ class Module {
|
|
|
112
111
|
...this.#WORLD_SCOPED,
|
|
113
112
|
]));
|
|
114
113
|
static #NOTIFICATIONS = Object.freeze([
|
|
115
|
-
"log/entry", "loop/terminated", "loop/proposal", "notice/event",
|
|
114
|
+
"log/entry", "loop/terminated", "loop/proposal", "loop/interaction", "notice/event",
|
|
116
115
|
"stream/event", "stream/concluded", "workspace/branch-batch",
|
|
117
116
|
]);
|
|
118
117
|
constructor(seam, opts) {
|
|
119
118
|
this.#seam = seam;
|
|
120
119
|
this.#opts = resolveModuleOptions(opts);
|
|
121
|
-
this.#
|
|
120
|
+
this.#moduleActions();
|
|
122
121
|
this.#portal = new Portal(seam);
|
|
123
122
|
this.#http = createServer((req, res) => { void this.#route(req, res); });
|
|
124
123
|
}
|
|
125
|
-
#
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
|
|
124
|
+
#moduleActions() {
|
|
125
|
+
const actions = new Map();
|
|
126
|
+
for (const descriptor of this.#seam.listModuleActions()) {
|
|
127
|
+
const { name, scope } = descriptor;
|
|
129
128
|
if (_a.#BUILTIN_ACTIONS.has(name)) {
|
|
130
129
|
throw new Error(`module action '${name}' collides with AG-UI built-in action`);
|
|
131
130
|
}
|
|
132
|
-
if (
|
|
131
|
+
if (scope !== "worldless" && scope !== "workspace") {
|
|
132
|
+
throw new Error(`module action '${name}' has invalid scope '${String(scope)}'`);
|
|
133
|
+
}
|
|
134
|
+
if (actions.has(name))
|
|
133
135
|
throw new Error(`module action '${name}' is registered more than once`);
|
|
134
|
-
|
|
136
|
+
actions.set(name, descriptor);
|
|
135
137
|
}
|
|
136
|
-
return
|
|
138
|
+
return actions;
|
|
139
|
+
}
|
|
140
|
+
#isWorkspaceAction(kind) {
|
|
141
|
+
return _a.#WORLD_SCOPED.has(kind) || this.#moduleActions().get(kind)?.scope === "workspace";
|
|
137
142
|
}
|
|
138
143
|
static init(opts) {
|
|
139
144
|
return {
|
|
@@ -296,8 +301,9 @@ class Module {
|
|
|
296
301
|
// unknown kind, which is no worker at all) answers without binding — or forging — a
|
|
297
302
|
// workspace. Only world-scoped actions and conversations reach #envelope below.
|
|
298
303
|
const action = parseAction(input.forwardedProps);
|
|
299
|
-
if (action !== null && !
|
|
304
|
+
if (action !== null && !this.#isWorkspaceAction(action.kind)) {
|
|
300
305
|
return await this.#controlRun(action, input, res);
|
|
306
|
+
}
|
|
301
307
|
let prompt = null;
|
|
302
308
|
if (action === null && input.resume === undefined) {
|
|
303
309
|
const lastUser = [...input.messages].reverse().find((message) => message.role === "user");
|
|
@@ -336,12 +342,12 @@ class Module {
|
|
|
336
342
|
const emit = (events) => {
|
|
337
343
|
for (const e of events) {
|
|
338
344
|
res.write(`data: ${JSON.stringify(e)}\n\n`);
|
|
339
|
-
// Terminate-resume, the terminate half: a
|
|
340
|
-
// AG-UI Run
|
|
345
|
+
// Terminate-resume, the terminate half: a stopped-world tool call
|
|
346
|
+
// ends this AG-UI Run while its core owner remains paused.
|
|
341
347
|
if (e.type === "TOOL_CALL_END") {
|
|
342
|
-
const
|
|
343
|
-
if (
|
|
344
|
-
interrupts.push(
|
|
348
|
+
const interrupt = this.#portal.interruptForToolCall(e.toolCallId);
|
|
349
|
+
if (interrupt !== null)
|
|
350
|
+
interrupts.push(interrupt);
|
|
345
351
|
}
|
|
346
352
|
if (e.type === "RUN_FINISHED" || e.type === "RUN_ERROR")
|
|
347
353
|
finish();
|
|
@@ -494,7 +500,7 @@ class Module {
|
|
|
494
500
|
for (const k of [
|
|
495
501
|
..._a.#CONTROL_ACTIONS,
|
|
496
502
|
..._a.#WORLD_SCOPED,
|
|
497
|
-
...this.#
|
|
503
|
+
...this.#moduleActions().keys(),
|
|
498
504
|
]) {
|
|
499
505
|
if (methods[k])
|
|
500
506
|
throw new Error(`AG-UI action '${k}' is registered more than once`);
|
|
@@ -512,7 +518,7 @@ class Module {
|
|
|
512
518
|
// runLoop folds a prompt into the active drain; the steered effect streams on the SSE.
|
|
513
519
|
async #action(a, env, conversationWorkerId) {
|
|
514
520
|
const p = a.params;
|
|
515
|
-
const
|
|
521
|
+
const moduleAction = this.#moduleActions().get(a.kind);
|
|
516
522
|
try {
|
|
517
523
|
// The control plane — worldless verbs (no bound workspace; #WORLD_SCOPED gates this).
|
|
518
524
|
switch (a.kind) {
|
|
@@ -561,12 +567,15 @@ class Module {
|
|
|
561
567
|
return { ok: true, result: { id: att.workspaceId, name: att.workspaceName, workerId: att.workerId } };
|
|
562
568
|
}
|
|
563
569
|
}
|
|
564
|
-
if (
|
|
565
|
-
return {
|
|
570
|
+
if (moduleAction?.scope === "worldless") {
|
|
571
|
+
return {
|
|
572
|
+
ok: true,
|
|
573
|
+
result: await this.#seam.invokeModuleAction(a.kind, p, { scope: "worldless" }),
|
|
574
|
+
};
|
|
566
575
|
}
|
|
567
576
|
// Below this line lives IN a world. An unknown kind is no worker at all; a
|
|
568
577
|
// world-scoped kind with no bound workspace is a routing bug — both surface plainly.
|
|
569
|
-
if (!_a.#WORLD_SCOPED.has(a.kind)) {
|
|
578
|
+
if (!_a.#WORLD_SCOPED.has(a.kind) && moduleAction?.scope !== "workspace") {
|
|
570
579
|
return actionFailure("unknown-action", `Action '${a.kind}' is not registered.`, 404, {
|
|
571
580
|
requestedAction: a.kind,
|
|
572
581
|
recovery: "Use an action advertised by discover.",
|
|
@@ -574,6 +583,12 @@ class Module {
|
|
|
574
583
|
}
|
|
575
584
|
if (env === null)
|
|
576
585
|
throw new Error(`action '${a.kind}' operates within a workspace, but none is bound`);
|
|
586
|
+
if (moduleAction?.scope === "workspace") {
|
|
587
|
+
return {
|
|
588
|
+
ok: true,
|
|
589
|
+
result: await this.#seam.invokeModuleAction(a.kind, p, { scope: "workspace", workspaceId: env.workspaceId }),
|
|
590
|
+
};
|
|
591
|
+
}
|
|
577
592
|
switch (a.kind) {
|
|
578
593
|
case "workspace.workers": return { ok: true, result: { workers: await this.#seam.listWorkers(typeof p.id === "number" ? p.id : env.workspaceId) } };
|
|
579
594
|
case "log.read": {
|