@gixcopilot/headless 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ahmed khaled
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 ADDED
@@ -0,0 +1,33 @@
1
+ # @gixcopilot/headless
2
+
3
+ The framework-neutral chat layer shared by `@gixcopilot/react` and `@gixcopilot/angular`
4
+ (extracted from the React SDK in Phase 12 so the Angular adapter reuses it instead of forking it).
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install @gixcopilot/headless
10
+ ```
11
+
12
+ Requires Node.js >=22.12.0. ESM only.
13
+
14
+ | Export | Purpose |
15
+ | --- | --- |
16
+ | `createChatStore(client, model?, threadId?, resolveContext?, resolveTools?, toolRuntime?)` | Immutable chat snapshot + `subscribe`/`getSnapshot` + stable actions (send, stop, retry, regenerate, clear, approve, reject, invokeTool). Consumed by React's `useSyncExternalStore` and Angular signals |
17
+ | `createCopilotParts(options)` / `clearCopilotParts(parts)` | One copilot's context registry and engine, state store, frontend tool registry and runtime, generative-UI registry |
18
+ | `createContextMessageResolver`, `createToolManifestResolver` | What each run sends: resolved context and the enabled frontend tool manifest (nothing when nothing is registered) |
19
+ | `toGenerativeUIRequests` | Projects tool calls onto requests for *registered* components only |
20
+ | `ChatSnapshot`, `CopilotMessage`, `ToolCallState`, `ApprovalState`, `AgentRunState`, `WorkflowRunState`, … | Shared state types (re-exported unchanged by `@gixcopilot/react`) |
21
+
22
+ Application code normally uses a framework adapter; use this package directly to build an
23
+ adapter for another framework. No DOM access, no framework imports.
24
+
25
+ ## Documentation
26
+
27
+ - [react guide](https://github.com/AfoudaSWE/gix_ai_copilot_nx/blob/main/docs/guides/react.md)
28
+ - [Getting started](https://github.com/AfoudaSWE/gix_ai_copilot_nx/blob/main/docs/guides/getting-started.md)
29
+ - [Source](https://github.com/AfoudaSWE/gix_ai_copilot_nx/tree/main/packages/headless)
30
+
31
+ ## License
32
+
33
+ MIT
@@ -0,0 +1,42 @@
1
+ import type { ClientModelReference, CopilotClient } from '@gixcopilot/client';
2
+ import type { ToolManifestEntry } from '@gixcopilot/protocol';
3
+ import type { ToolRuntime } from '@gixcopilot/tools';
4
+ import type { ResolvedContext } from '@gixcopilot/context';
5
+ import type { ChatSnapshot, CopilotAccess } from './types.js';
6
+ /**
7
+ * Builds the frontend tool manifest to advertise on this run (Section 45-46), or `undefined`
8
+ * when nothing is registered - mirrors `ResolveContextMessage`'s "send exactly what Phase 4
9
+ * always sent when there's nothing to add" convention (Section 64).
10
+ */
11
+ export type ResolveToolManifest = () => readonly ToolManifestEntry[] | undefined;
12
+ /**
13
+ * A framework-independent chat store: an immutable snapshot plus subscribe/getSnapshot, the
14
+ * shape both React's `useSyncExternalStore` and an Angular signal bridge consume. Transport and
15
+ * runtime behavior stay in `@gixcopilot/client`; this only projects client runs into state.
16
+ */
17
+ export interface ChatStore {
18
+ readonly access: CopilotAccess;
19
+ readonly getSnapshot: () => ChatSnapshot;
20
+ readonly getServerSnapshot: () => ChatSnapshot;
21
+ readonly subscribe: (listener: () => void) => () => void;
22
+ readonly mount: () => void;
23
+ readonly dispose: () => void;
24
+ }
25
+ /**
26
+ * Resolves Phase 4 application context (if any) to prepend its content as
27
+ * a leading `system` message, or `undefined` when there is nothing to add - so a provider
28
+ * with no registered context sends exactly the same request Phase 3 always sent (Section
29
+ * 64). The provider bridges its context engine into this function (Section 33's
30
+ * "structured system message" placement decision - see
31
+ * docs/adr/0009-context-and-state-architecture.md).
32
+ *
33
+ * May return synchronously (`undefined`, when nothing is registered) instead of a `Promise`
34
+ * - `consume()` only `await`s when it actually gets one, so a provider with zero context
35
+ * items dispatches `client.run()` on the exact same tick Phase 3 always did, not one
36
+ * microtask later.
37
+ */
38
+ export type ResolveContextMessage = () => Promise<ResolvedContext | undefined> | ResolvedContext | undefined;
39
+ /** Creates the chat store for one copilot instance. Call `mount()` when it becomes active and
40
+ * `dispose()` when its owner is destroyed (cancels any active run). */
41
+ export declare function createChatStore(client: CopilotClient, model?: ClientModelReference, threadId?: string, resolveContextMessage?: ResolveContextMessage, resolveToolManifest?: ResolveToolManifest, toolRuntime?: ToolRuntime): ChatStore;
42
+ //# sourceMappingURL=chat-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-store.d.ts","sourceRoot":"","sources":["../src/chat-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAa,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEzF,OAAO,KAAK,EAAgD,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC5G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAIV,YAAY,EACZ,aAAa,EAMd,MAAM,YAAY,CAAC;AAcpB;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,SAAS,iBAAiB,EAAE,GAAG,SAAS,CAAC;AAEjF;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,YAAY,CAAC;IACzC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,YAAY,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,GAAG,eAAe,GAAG,SAAS,CAAC;AAY7G;uEACuE;AACvE,wBAAgB,eAAe,CAC7B,MAAM,EAAE,aAAa,EACrB,KAAK,CAAC,EAAE,oBAAoB,EAC5B,QAAQ,CAAC,EAAE,MAAM,EACjB,qBAAqB,CAAC,EAAE,qBAAqB,EAC7C,mBAAmB,CAAC,EAAE,mBAAmB,EACzC,WAAW,CAAC,EAAE,WAAW,GACxB,SAAS,CA4lBX"}
@@ -0,0 +1,597 @@
1
+ import { CopilotError, createMessageId, createThreadId } from '@gixcopilot/protocol';
2
+ function summarizeContext(resolved) {
3
+ return {
4
+ items: resolved.items.map(({ id, name, scope, priority, sensitivity, estimatedTokens, truncated }) => ({ id, name, scope, priority, sensitivity, estimatedTokens, truncated })),
5
+ excluded: resolved.excluded.map(({ id, name, scope, reason }) => ({ id, name, scope, reason })),
6
+ estimatedTokens: resolved.estimatedTokens,
7
+ diagnostics: { ...resolved.diagnostics },
8
+ };
9
+ }
10
+ /** Creates the chat store for one copilot instance. Call `mount()` when it becomes active and
11
+ * `dispose()` when its owner is destroyed (cancels any active run). */
12
+ export function createChatStore(client, model, threadId, resolveContextMessage, resolveToolManifest, toolRuntime) {
13
+ const initial = {
14
+ messages: [],
15
+ thread: null,
16
+ runId: null,
17
+ status: 'idle',
18
+ error: null,
19
+ usage: undefined,
20
+ finishReason: undefined,
21
+ toolCalls: [],
22
+ approvals: [],
23
+ agentRuns: [],
24
+ agentDelegations: [],
25
+ agentHandoffs: [],
26
+ workflowRuns: [],
27
+ };
28
+ let state = initial;
29
+ let active;
30
+ let enabled = true;
31
+ let replay;
32
+ const listeners = new Set();
33
+ function publish(next) {
34
+ state = next;
35
+ for (const listener of listeners)
36
+ listener();
37
+ }
38
+ function seal(status) {
39
+ return state.messages.map((message) => message.status === 'streaming' ? { ...message, status } : message);
40
+ }
41
+ function fail(error) {
42
+ publish({ ...state, messages: seal('error'), status: 'error', error });
43
+ }
44
+ function textOfContent(content) {
45
+ return content
46
+ .filter((part) => part.type === 'text')
47
+ .map((part) => part.text)
48
+ .join('');
49
+ }
50
+ function updateToolCall(id, patch) {
51
+ publish({
52
+ ...state,
53
+ toolCalls: state.toolCalls.map((toolCall) => toolCall.id === id ? { ...toolCall, ...patch } : toolCall),
54
+ });
55
+ }
56
+ function updateApproval(approvalId, patch) {
57
+ publish({
58
+ ...state,
59
+ approvals: state.approvals.map((approval) => approval.approvalId === approvalId ? { ...approval, ...patch } : approval),
60
+ });
61
+ }
62
+ function updateAgentRun(agentRunId, patch) {
63
+ publish({
64
+ ...state,
65
+ agentRuns: state.agentRuns.map((run) => (run.agentRunId === agentRunId ? { ...run, ...patch } : run)),
66
+ });
67
+ }
68
+ /** A workflow run is created lazily on its first observed event, then patched/merged - a
69
+ * client run may never involve a workflow at all (the common case), so nothing is
70
+ * pre-allocated (mirrors `agentRuns`/`toolCalls` only ever growing on a real event). */
71
+ function upsertWorkflowRun(workflowRunId, build) {
72
+ const existing = state.workflowRuns.find((run) => run.workflowRunId === workflowRunId);
73
+ const next = build(existing);
74
+ publish({
75
+ ...state,
76
+ workflowRuns: existing
77
+ ? state.workflowRuns.map((run) => (run.workflowRunId === workflowRunId ? next : run))
78
+ : [...state.workflowRuns, next],
79
+ });
80
+ }
81
+ function upsertWorkflowStep(workflowRunId, patch) {
82
+ upsertWorkflowRun(workflowRunId, (existing) => {
83
+ const base = existing ?? {
84
+ workflowRunId,
85
+ workflowId: '',
86
+ status: 'running',
87
+ steps: [],
88
+ };
89
+ const hasStep = base.steps.some((step) => step.stepId === patch.stepId && step.phase === patch.phase);
90
+ return {
91
+ ...base,
92
+ steps: hasStep
93
+ ? base.steps.map((step) => (step.stepId === patch.stepId && step.phase === patch.phase ? patch : step))
94
+ : [...base.steps, patch],
95
+ };
96
+ });
97
+ }
98
+ /**
99
+ * Executes a browser-registered frontend tool for a `tool.requested` event with
100
+ * `source: 'frontend'` (Section 45, 58), then reports the outcome back to the server
101
+ * (Section 50) so its suspended Model -> Tool -> Model loop can resume. Never throws -
102
+ * `toolRuntime.execute()` already normalizes every failure mode (unregistered tool,
103
+ * invalid arguments, a thrown error) into a `ToolResult`, which is what gets submitted
104
+ * either way.
105
+ */
106
+ async function executeFrontendTool(event, token) {
107
+ if (!toolRuntime)
108
+ return;
109
+ const controller = new AbortController();
110
+ token.frontendToolControllers.set(event.toolCallId, controller);
111
+ try {
112
+ const result = await toolRuntime.execute({
113
+ toolCallId: event.toolCallId,
114
+ name: event.name,
115
+ arguments: event.arguments,
116
+ context: { runId: event.runId, signal: controller.signal },
117
+ });
118
+ await client.submitToolResult(event.runId, event.toolCallId, result);
119
+ }
120
+ catch {
121
+ // The server's own frontendToolTimeoutMs (Section 51) is the safety net if this
122
+ // submission itself fails (e.g. the network dropped) - nothing further to do here.
123
+ }
124
+ finally {
125
+ token.frontendToolControllers.delete(event.toolCallId);
126
+ }
127
+ }
128
+ function receive(event, token) {
129
+ if (event.threadId !== state.thread?.id)
130
+ return;
131
+ if (!token.runId) {
132
+ if (event.type !== 'run.started' && event.type !== 'run.cancelled')
133
+ return;
134
+ token.runId = event.runId;
135
+ }
136
+ if (event.runId !== token.runId || event.sequence <= token.sequence)
137
+ return;
138
+ token.sequence = event.sequence;
139
+ switch (event.type) {
140
+ case 'run.started':
141
+ publish({ ...state, runId: event.runId });
142
+ break;
143
+ case 'message.started':
144
+ if (state.messages.some((message) => message.id === event.messageId))
145
+ return;
146
+ publish({
147
+ ...state,
148
+ messages: [
149
+ ...state.messages,
150
+ {
151
+ id: event.messageId,
152
+ threadId: event.threadId,
153
+ createdAt: event.timestamp,
154
+ role: event.role,
155
+ content: [],
156
+ status: 'streaming',
157
+ },
158
+ ],
159
+ });
160
+ break;
161
+ case 'message.delta':
162
+ publish({
163
+ ...state,
164
+ status: 'streaming',
165
+ error: null,
166
+ messages: state.messages.map((message) => message.id === event.messageId && message.status === 'streaming'
167
+ ? {
168
+ ...message,
169
+ content: [
170
+ {
171
+ type: 'text',
172
+ text: textOfContent(message.content) + event.delta,
173
+ },
174
+ ],
175
+ }
176
+ : message),
177
+ });
178
+ break;
179
+ case 'message.end':
180
+ publish({
181
+ ...state,
182
+ messages: state.messages.map((message) => message.id === event.messageId
183
+ ? { ...message, content: event.content, status: 'complete' }
184
+ : message),
185
+ });
186
+ break;
187
+ case 'run.completed':
188
+ active = undefined;
189
+ publish({
190
+ ...state,
191
+ messages: seal('complete'),
192
+ status: 'completed',
193
+ error: null,
194
+ usage: event.usage,
195
+ finishReason: event.finishReason,
196
+ });
197
+ break;
198
+ case 'run.cancelled':
199
+ active = undefined;
200
+ publish({
201
+ ...state,
202
+ messages: seal('stopped'),
203
+ status: 'stopped',
204
+ error: null,
205
+ finishReason: 'cancelled',
206
+ approvals: state.approvals.map((approval) => approval.status === 'pending' ? { ...approval, status: 'cancelled' } : approval),
207
+ agentRuns: state.agentRuns.map((run) => (run.status === 'running' ? { ...run, status: 'cancelled' } : run)),
208
+ workflowRuns: state.workflowRuns.map((run) => run.status === 'running' || run.status === 'paused' ? { ...run, status: 'cancelled' } : run),
209
+ });
210
+ break;
211
+ case 'run.failed':
212
+ case 'error':
213
+ active = undefined;
214
+ fail(event.error);
215
+ break;
216
+ case 'tool.requested':
217
+ if (state.toolCalls.some((toolCall) => toolCall.id === event.toolCallId))
218
+ return;
219
+ publish({
220
+ ...state,
221
+ toolCalls: [
222
+ ...state.toolCalls,
223
+ {
224
+ id: event.toolCallId,
225
+ name: event.name,
226
+ source: event.source,
227
+ status: 'requested',
228
+ arguments: event.arguments,
229
+ },
230
+ ],
231
+ });
232
+ if (event.source === 'frontend') {
233
+ void executeFrontendTool(event, token);
234
+ }
235
+ break;
236
+ case 'tool.started':
237
+ updateToolCall(event.toolCallId, { status: 'running' });
238
+ break;
239
+ case 'tool.completed':
240
+ token.resolveAction?.({ status: 'success', toolCallId: event.toolCallId, data: event.result });
241
+ token.resolveAction = undefined;
242
+ updateToolCall(event.toolCallId, { status: 'succeeded', result: event.result });
243
+ break;
244
+ case 'tool.failed':
245
+ token.resolveAction?.({ status: 'error', toolCallId: event.toolCallId, error: event.error });
246
+ token.resolveAction = undefined;
247
+ updateToolCall(event.toolCallId, { status: 'failed', error: event.error });
248
+ break;
249
+ case 'approval.requested':
250
+ if (state.approvals.some((approval) => approval.approvalId === event.approvalId))
251
+ return;
252
+ publish({
253
+ ...state,
254
+ status: 'waiting_for_approval',
255
+ error: null,
256
+ approvals: [
257
+ ...state.approvals,
258
+ {
259
+ approvalId: event.approvalId,
260
+ toolCallId: event.toolCallId,
261
+ action: event.action,
262
+ approvalLevel: event.approvalLevel,
263
+ summary: event.summary,
264
+ status: 'pending',
265
+ risk: event.risk,
266
+ reversibility: event.reversibility,
267
+ expiresAt: event.expiresAt,
268
+ preview: event.preview,
269
+ },
270
+ ],
271
+ });
272
+ break;
273
+ case 'approval.approved':
274
+ updateApproval(event.approvalId, { status: 'approved', decidedBy: event.decidedBy });
275
+ break;
276
+ case 'approval.rejected':
277
+ updateApproval(event.approvalId, { status: 'rejected', decidedBy: event.decidedBy });
278
+ break;
279
+ case 'approval.expired':
280
+ updateApproval(event.approvalId, { status: 'expired' });
281
+ break;
282
+ // Agent/workflow events, added in Phase 10 (Section 139-143) - structured facts only
283
+ // (Section 18, 140: no chain-of-thought), reusing the exact same event stream every
284
+ // other case in this switch already consumes; a client with no agent/workflow-aware
285
+ // backend simply never sees these event types at all.
286
+ case 'agent.run.started':
287
+ if (state.agentRuns.some((run) => run.agentRunId === event.agentRunId))
288
+ return;
289
+ publish({
290
+ ...state,
291
+ agentRuns: [
292
+ ...state.agentRuns,
293
+ {
294
+ agentRunId: event.agentRunId,
295
+ agentId: event.agentId,
296
+ rootRunId: event.rootRunId,
297
+ parentRunId: event.parentRunId,
298
+ status: 'running',
299
+ },
300
+ ],
301
+ });
302
+ break;
303
+ case 'agent.run.completed':
304
+ updateAgentRun(event.agentRunId, { status: 'completed' });
305
+ break;
306
+ case 'agent.run.failed':
307
+ updateAgentRun(event.agentRunId, { status: 'failed', error: event.error });
308
+ break;
309
+ case 'agent.run.cancelled':
310
+ updateAgentRun(event.agentRunId, { status: 'cancelled' });
311
+ break;
312
+ case 'agent.delegation.started':
313
+ if (state.agentDelegations.some((delegation) => delegation.delegationId === event.delegationId))
314
+ return;
315
+ publish({
316
+ ...state,
317
+ agentDelegations: [
318
+ ...state.agentDelegations,
319
+ {
320
+ delegationId: event.delegationId,
321
+ fromAgentId: event.fromAgentId,
322
+ toAgentId: event.toAgentId,
323
+ depth: event.depth,
324
+ status: 'started',
325
+ },
326
+ ],
327
+ });
328
+ break;
329
+ case 'agent.delegation.completed':
330
+ publish({
331
+ ...state,
332
+ agentDelegations: state.agentDelegations.map((delegation) => delegation.delegationId === event.delegationId
333
+ ? { ...delegation, status: event.status, error: event.error }
334
+ : delegation),
335
+ });
336
+ break;
337
+ case 'agent.handoff': {
338
+ const handoff = {
339
+ fromAgentId: event.fromAgentId,
340
+ toAgentId: event.toAgentId,
341
+ reason: event.reason,
342
+ };
343
+ publish({ ...state, agentHandoffs: [...state.agentHandoffs, handoff] });
344
+ break;
345
+ }
346
+ case 'agent.routing.decided':
347
+ // Auditable (Section 47, 51, 182), but not yet surfaced through a dedicated headless
348
+ // hook - no UI requirement in this phase reads it. Recorded nowhere client-side for
349
+ // now; a future consumer can add a hook the same way this file's other cases do.
350
+ break;
351
+ case 'workflow.run.started':
352
+ upsertWorkflowRun(event.workflowRunId, () => ({
353
+ workflowRunId: event.workflowRunId,
354
+ workflowId: event.workflowId,
355
+ status: 'running',
356
+ steps: [],
357
+ }));
358
+ break;
359
+ case 'workflow.run.paused':
360
+ upsertWorkflowRun(event.workflowRunId, (existing) => ({
361
+ ...(existing ?? { workflowRunId: event.workflowRunId, workflowId: event.workflowId, steps: [] }),
362
+ status: 'paused',
363
+ pauseReason: event.reason,
364
+ pausedStepId: event.stepId,
365
+ }));
366
+ break;
367
+ case 'workflow.run.resumed':
368
+ upsertWorkflowRun(event.workflowRunId, (existing) => ({
369
+ ...(existing ?? { workflowRunId: event.workflowRunId, workflowId: event.workflowId, steps: [] }),
370
+ status: 'running',
371
+ pauseReason: undefined,
372
+ pausedStepId: undefined,
373
+ }));
374
+ break;
375
+ case 'workflow.run.completed':
376
+ upsertWorkflowRun(event.workflowRunId, (existing) => ({
377
+ ...(existing ?? { workflowRunId: event.workflowRunId, workflowId: event.workflowId, steps: [] }),
378
+ status: 'completed',
379
+ }));
380
+ break;
381
+ case 'workflow.run.failed':
382
+ upsertWorkflowRun(event.workflowRunId, (existing) => ({
383
+ ...(existing ?? { workflowRunId: event.workflowRunId, workflowId: event.workflowId, steps: [] }),
384
+ status: 'failed',
385
+ error: event.error,
386
+ }));
387
+ break;
388
+ case 'workflow.run.cancelled':
389
+ upsertWorkflowRun(event.workflowRunId, (existing) => ({
390
+ ...(existing ?? { workflowRunId: event.workflowRunId, workflowId: event.workflowId, steps: [] }),
391
+ status: 'cancelled',
392
+ }));
393
+ break;
394
+ case 'workflow.step.started':
395
+ upsertWorkflowStep(event.workflowRunId, {
396
+ stepId: event.stepId,
397
+ stepType: event.stepType,
398
+ status: 'running',
399
+ attempt: event.attempt,
400
+ phase: event.phase,
401
+ });
402
+ break;
403
+ case 'workflow.step.completed':
404
+ upsertWorkflowStep(event.workflowRunId, {
405
+ stepId: event.stepId,
406
+ stepType: state.workflowRuns
407
+ .find((run) => run.workflowRunId === event.workflowRunId)
408
+ ?.steps.find((step) => step.stepId === event.stepId && step.phase === event.phase)?.stepType ??
409
+ 'function',
410
+ status: 'completed',
411
+ attempt: event.attempt,
412
+ phase: event.phase,
413
+ });
414
+ break;
415
+ case 'workflow.step.failed':
416
+ upsertWorkflowStep(event.workflowRunId, {
417
+ stepId: event.stepId,
418
+ stepType: state.workflowRuns
419
+ .find((run) => run.workflowRunId === event.workflowRunId)
420
+ ?.steps.find((step) => step.stepId === event.stepId && step.phase === event.phase)?.stepType ??
421
+ 'function',
422
+ status: 'failed',
423
+ attempt: event.attempt,
424
+ phase: event.phase,
425
+ error: event.error,
426
+ willRetry: event.willRetry,
427
+ });
428
+ break;
429
+ case 'workflow.checkpoint.saved':
430
+ // The resumability audit trail (Section 100) - not yet surfaced through a dedicated
431
+ // headless hook, same posture as 'agent.routing.decided' above.
432
+ break;
433
+ }
434
+ }
435
+ async function consume(token, history) {
436
+ try {
437
+ if (active !== token || !enabled)
438
+ return;
439
+ const contextResult = resolveContextMessage?.();
440
+ const resolvedContext = contextResult instanceof Promise ? await contextResult : contextResult;
441
+ if (active !== token)
442
+ return; // Re-check: stop()/a new send may have run during the await.
443
+ if (resolvedContext)
444
+ publish({ ...state, contextDiagnostics: summarizeContext(resolvedContext) });
445
+ const contextContent = resolvedContext?.content;
446
+ const historyMessages = history.map(({ role, content }) => ({ role, content }));
447
+ const messages = contextContent
448
+ ? [{ role: 'system', content: [{ type: 'text', text: contextContent }] }, ...historyMessages]
449
+ : historyMessages;
450
+ token.handle = client.run({
451
+ threadId: state.thread?.id,
452
+ model,
453
+ messages,
454
+ tools: resolveToolManifest?.(),
455
+ action: token.action,
456
+ });
457
+ if (active !== token)
458
+ return;
459
+ for await (const event of token.handle.events) {
460
+ if (active !== token)
461
+ break;
462
+ receive(event, token);
463
+ if (active !== token)
464
+ break;
465
+ }
466
+ if (active === token) {
467
+ active = undefined;
468
+ fail(CopilotError.transport('The response ended before completion.').toPublicJSON());
469
+ }
470
+ }
471
+ catch (error) {
472
+ if (active === token) {
473
+ active = undefined;
474
+ fail((CopilotError.isCopilotError(error)
475
+ ? error
476
+ : CopilotError.transport('Unable to complete the request.', error)).toPublicJSON());
477
+ }
478
+ }
479
+ finally {
480
+ token.resolveAction?.({ status: 'error', toolCallId: 'cancelled', error: CopilotError.cancelled().toPublicJSON() });
481
+ token.resolveAction = undefined;
482
+ token.handle?.cancel();
483
+ abortFrontendToolCalls(token);
484
+ }
485
+ }
486
+ function abortFrontendToolCalls(token) {
487
+ for (const controller of token.frontendToolControllers.values()) {
488
+ controller.abort();
489
+ }
490
+ token.frontendToolControllers.clear();
491
+ }
492
+ function start(history, action, resolveAction) {
493
+ if (active || !enabled)
494
+ return false;
495
+ const token = { sequence: 0, frontendToolControllers: new Map(), action, resolveAction };
496
+ active = token;
497
+ replay = history;
498
+ publish({
499
+ ...state,
500
+ messages: history,
501
+ status: 'submitting',
502
+ error: null,
503
+ runId: null,
504
+ usage: undefined,
505
+ finishReason: undefined,
506
+ contextDiagnostics: undefined,
507
+ toolCalls: [],
508
+ approvals: [],
509
+ agentRuns: [],
510
+ agentDelegations: [],
511
+ agentHandoffs: [],
512
+ workflowRuns: [],
513
+ });
514
+ void consume(token, history);
515
+ return true;
516
+ }
517
+ const access = {
518
+ client,
519
+ invokeTool(name, args) {
520
+ return new Promise((resolve) => {
521
+ const accepted = start(state.messages.length ? state.messages : [{
522
+ id: createMessageId(), threadId: state.thread?.id ?? createThreadId(), role: 'user',
523
+ content: [{ type: 'text', text: `Requested action: ${name}` }],
524
+ createdAt: new Date().toISOString(), status: 'complete',
525
+ }], { name, arguments: args }, resolve);
526
+ if (!accepted)
527
+ resolve({ status: 'error', toolCallId: 'busy', error: CopilotError.validation('A run is already active.').toPublicJSON() });
528
+ });
529
+ },
530
+ sendMessage(text) {
531
+ if (!text.trim() || active || !enabled)
532
+ return false;
533
+ const thread = state.thread ?? {
534
+ id: threadId ?? createThreadId(),
535
+ createdAt: new Date().toISOString(),
536
+ };
537
+ const message = {
538
+ id: createMessageId(),
539
+ threadId: thread.id,
540
+ role: 'user',
541
+ content: [{ type: 'text', text }],
542
+ createdAt: new Date().toISOString(),
543
+ status: 'complete',
544
+ };
545
+ state = { ...state, thread };
546
+ return start([...state.messages, message]);
547
+ },
548
+ stop() {
549
+ const token = active;
550
+ if (!token)
551
+ return;
552
+ active = undefined; // Invalidate BEFORE abort: late events cannot touch the next run.
553
+ token.handle?.cancel();
554
+ abortFrontendToolCalls(token);
555
+ publish({
556
+ ...state,
557
+ messages: seal('stopped'),
558
+ status: 'stopped',
559
+ error: null,
560
+ finishReason: 'cancelled',
561
+ approvals: state.approvals.map((approval) => approval.status === 'pending' ? { ...approval, status: 'cancelled' } : approval),
562
+ agentRuns: state.agentRuns.map((run) => (run.status === 'running' ? { ...run, status: 'cancelled' } : run)),
563
+ workflowRuns: state.workflowRuns.map((run) => run.status === 'running' || run.status === 'paused' ? { ...run, status: 'cancelled' } : run),
564
+ });
565
+ },
566
+ retry: () => state.status === 'error' && replay !== undefined && start(replay),
567
+ regenerate: () => (state.status === 'completed' || state.status === 'stopped') &&
568
+ replay !== undefined &&
569
+ start(replay),
570
+ clear() {
571
+ access.stop();
572
+ replay = undefined;
573
+ publish(initial);
574
+ },
575
+ approveAction: (approvalId, comment) => client.decideApproval(approvalId, 'approve', comment),
576
+ rejectAction: (approvalId, comment) => client.decideApproval(approvalId, 'reject', comment),
577
+ };
578
+ return {
579
+ access,
580
+ getSnapshot: () => state,
581
+ getServerSnapshot: () => initial,
582
+ subscribe(listener) {
583
+ listeners.add(listener);
584
+ return () => {
585
+ listeners.delete(listener);
586
+ };
587
+ },
588
+ mount() {
589
+ enabled = true;
590
+ },
591
+ dispose() {
592
+ enabled = false;
593
+ access.stop();
594
+ },
595
+ };
596
+ }
597
+ //# sourceMappingURL=chat-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-store.js","sourceRoot":"","sources":["../src/chat-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAiErF,SAAS,gBAAgB,CAAC,QAAyB;IACjD,OAAO;QACL,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,EAAE,CACnG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC;QAC3E,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/F,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,WAAW,EAAE,EAAE,GAAG,QAAQ,CAAC,WAAW,EAAE;KACzC,CAAC;AACJ,CAAC;AAED;uEACuE;AACvE,MAAM,UAAU,eAAe,CAC7B,MAAqB,EACrB,KAA4B,EAC5B,QAAiB,EACjB,qBAA6C,EAC7C,mBAAyC,EACzC,WAAyB;IAEzB,MAAM,OAAO,GAAiB;QAC5B,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,SAAS;QAChB,YAAY,EAAE,SAAS;QACvB,SAAS,EAAE,EAAE;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I,EAAE,CAAC;YACd,MAAM,GAAG,SAAS,CAAC;YACnB,OAAO,CAAC,OAAO,CAAC,CAAC;QACnB,CAAC;QACD,aAAa,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;QAC7F,YAAY,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC;KAC5F,CAAC;IAEF,OAAO;QACL,MAAM;QACN,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK;QACxB,iBAAiB,EAAE,GAAG,EAAE,CAAC,OAAO;QAChC,SAAS,CAAC,QAAoB;YAC5B,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,OAAO,GAAG,EAAE;gBACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC7B,CAAC,CAAC;QACJ,CAAC;QACD,KAAK;YACH,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QACD,OAAO;YACL,OAAO,GAAG,KAAK,CAAC;YAChB,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { AnyGenerativeComponentDefinition, GenerativeUiRenderResult } from '@gixcopilot/generative-ui';
2
+ import type { ToolCallState } from './types.js';
3
+ /** One model request to render a trusted, registered component (Phase 6), derived from the
4
+ * tool-call timeline. `props` exist only once the request succeeded and passed the
5
+ * component's schema validation in the tool runtime. */
6
+ export interface GenerativeUIRequestState {
7
+ readonly id: string;
8
+ readonly component: string;
9
+ readonly status: 'requested' | 'running' | 'succeeded' | 'failed';
10
+ readonly props?: unknown;
11
+ readonly error?: ToolCallState['error'];
12
+ }
13
+ export declare function isGenerativeUiRenderResult(value: unknown): value is GenerativeUiRenderResult;
14
+ /** Projects tool calls onto generative-UI requests for registered components only; a tool call
15
+ * naming an unregistered component is never turned into something renderable. */
16
+ export declare function toGenerativeUIRequests(toolCalls: readonly ToolCallState[], registry: {
17
+ readonly list: () => readonly AnyGenerativeComponentDefinition[];
18
+ }): readonly GenerativeUIRequestState[];
19
+ //# sourceMappingURL=generative-ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generative-ui.d.ts","sourceRoot":"","sources":["../src/generative-ui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC5G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;wDAEwD;AACxD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAClE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACzC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,wBAAwB,CAE5F;AAED;iFACiF;AACjF,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,SAAS,aAAa,EAAE,EACnC,QAAQ,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,SAAS,gCAAgC,EAAE,CAAA;CAAE,GAC7E,SAAS,wBAAwB,EAAE,CAcrC"}
@@ -0,0 +1,23 @@
1
+ import { generativeUiComponentNameOfToolName } from '@gixcopilot/generative-ui';
2
+ export function isGenerativeUiRenderResult(value) {
3
+ return typeof value === 'object' && value !== null && 'component' in value && 'props' in value;
4
+ }
5
+ /** Projects tool calls onto generative-UI requests for registered components only; a tool call
6
+ * naming an unregistered component is never turned into something renderable. */
7
+ export function toGenerativeUIRequests(toolCalls, registry) {
8
+ const requests = [];
9
+ for (const toolCall of toolCalls) {
10
+ const component = generativeUiComponentNameOfToolName(toolCall.name, registry);
11
+ if (!component)
12
+ continue;
13
+ requests.push({
14
+ id: toolCall.id,
15
+ component,
16
+ status: toolCall.status,
17
+ props: toolCall.status === 'succeeded' && isGenerativeUiRenderResult(toolCall.result) ? toolCall.result.props : undefined,
18
+ error: toolCall.error,
19
+ });
20
+ }
21
+ return requests;
22
+ }
23
+ //# sourceMappingURL=generative-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generative-ui.js","sourceRoot":"","sources":["../src/generative-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAehF,MAAM,UAAU,0BAA0B,CAAC,KAAc;IACvD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,WAAW,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC;AACjG,CAAC;AAED;iFACiF;AACjF,MAAM,UAAU,sBAAsB,CACpC,SAAmC,EACnC,QAA8E;IAE9E,MAAM,QAAQ,GAA+B,EAAE,CAAC;IAChD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,SAAS,GAAG,mCAAmC,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,SAAS;YAAE,SAAS;QACzB,QAAQ,CAAC,IAAI,CAAC;YACZ,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,SAAS;YACT,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,KAAK,EAAE,QAAQ,CAAC,MAAM,KAAK,WAAW,IAAI,0BAA0B,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;YACzH,KAAK,EAAE,QAAQ,CAAC,KAAK;SACtB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { createChatStore } from './chat-store.js';
2
+ export type { ChatStore, ResolveContextMessage, ResolveToolManifest } from './chat-store.js';
3
+ export { clearCopilotParts, createContextMessageResolver, createCopilotParts, createToolManifestResolver } from './parts.js';
4
+ export type { CopilotParts } from './parts.js';
5
+ export type { AgentDelegationState, AgentHandoffState, AgentRunState, ApprovalState, ChatActions, ChatSnapshot, ChatStatus, CopilotAccess, CopilotChatResult, CopilotContextOptions, CopilotMessage, ResolvedContextSummary, ToolCallState, WorkflowRunState, WorkflowStepState, } from './types.js';
6
+ export { isGenerativeUiRenderResult, toGenerativeUIRequests } from './generative-ui.js';
7
+ export type { GenerativeUIRequestState } from './generative-ui.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,SAAS,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAC7H,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACxF,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { createChatStore } from './chat-store.js';
2
+ export { clearCopilotParts, createContextMessageResolver, createCopilotParts, createToolManifestResolver } from './parts.js';
3
+ export { isGenerativeUiRenderResult, toGenerativeUIRequests } from './generative-ui.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAqB7H,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { ContextEngine, ContextRegistry, CopilotStateStore } from '@gixcopilot/context';
2
+ import type { ToolRegistry, ToolRuntime } from '@gixcopilot/tools';
3
+ import type { GenerativeComponentRegistry } from '@gixcopilot/generative-ui';
4
+ import type { ResolveContextMessage, ResolveToolManifest } from './chat-store.js';
5
+ import type { CopilotContextOptions } from './types.js';
6
+ /**
7
+ * The framework-independent pieces one copilot instance owns: its application-context
8
+ * registry and engine (Phase 4), shared state store (Phase 4/6), frontend tool registry and
9
+ * the canonical tool runtime (Phase 5), and the trusted generative-UI component registry
10
+ * (Phase 6). Every framework adapter creates exactly one set per provider instance - never a
11
+ * module-level singleton - so sibling copilots never see each other's context, tools or state.
12
+ */
13
+ export interface CopilotParts {
14
+ readonly registry: ContextRegistry;
15
+ readonly engine: ContextEngine;
16
+ readonly stateStore: CopilotStateStore;
17
+ readonly toolRegistry: ToolRegistry;
18
+ readonly toolRuntime: ToolRuntime;
19
+ readonly generativeComponentRegistry: GenerativeComponentRegistry;
20
+ }
21
+ export declare function createCopilotParts(options?: CopilotContextOptions): CopilotParts;
22
+ /** Releases everything registered into `parts` (context items, frontend tools, components). */
23
+ export declare function clearCopilotParts(parts: CopilotParts): void;
24
+ /**
25
+ * Resolves registered application context for the next run, or `undefined` when nothing is
26
+ * registered - the fully synchronous fast path, so a copilot with no context dispatches on the
27
+ * same tick and sends exactly what Phase 3 always sent.
28
+ */
29
+ export declare function createContextMessageResolver(parts: Pick<CopilotParts, 'registry' | 'engine'>): ResolveContextMessage;
30
+ /** Builds the frontend tool manifest to advertise, or `undefined` when nothing is enabled. */
31
+ export declare function createToolManifestResolver(parts: Pick<CopilotParts, 'toolRegistry'>): ResolveToolManifest;
32
+ //# sourceMappingURL=parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../src/parts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,2BAA2B,EAAE,2BAA2B,CAAC;CACnE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,qBAA0B,GAAG,YAAY,CAUpF;AAED,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAI3D;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,QAAQ,CAAC,GAAG,qBAAqB,CAKpH;AAED,8FAA8F;AAC9F,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,GAAG,mBAAmB,CAKzG"}
package/dist/parts.js ADDED
@@ -0,0 +1,40 @@
1
+ import { createContextEngine, createContextRegistry, createCopilotStateStore } from '@gixcopilot/context';
2
+ import { createDefaultToolResolver, createToolRegistry, createToolRuntime, isToolEnabled, toToolManifest } from '@gixcopilot/tools';
3
+ import { createGenerativeComponentRegistry } from '@gixcopilot/generative-ui';
4
+ export function createCopilotParts(options = {}) {
5
+ const toolRegistry = createToolRegistry();
6
+ return {
7
+ registry: createContextRegistry(),
8
+ engine: createContextEngine({ maxContextTokens: options.maxContextTokens, dataPolicy: options.dataPolicy }),
9
+ stateStore: createCopilotStateStore(),
10
+ toolRegistry,
11
+ toolRuntime: createToolRuntime({ resolver: createDefaultToolResolver(toolRegistry) }),
12
+ generativeComponentRegistry: createGenerativeComponentRegistry(),
13
+ };
14
+ }
15
+ /** Releases everything registered into `parts` (context items, frontend tools, components). */
16
+ export function clearCopilotParts(parts) {
17
+ parts.registry.clear();
18
+ parts.toolRegistry.clear();
19
+ parts.generativeComponentRegistry.clear();
20
+ }
21
+ /**
22
+ * Resolves registered application context for the next run, or `undefined` when nothing is
23
+ * registered - the fully synchronous fast path, so a copilot with no context dispatches on the
24
+ * same tick and sends exactly what Phase 3 always sent.
25
+ */
26
+ export function createContextMessageResolver(parts) {
27
+ return () => {
28
+ if (parts.registry.list({ enabledOnly: true }).length === 0)
29
+ return undefined;
30
+ return parts.engine.resolve(parts.registry);
31
+ };
32
+ }
33
+ /** Builds the frontend tool manifest to advertise, or `undefined` when nothing is enabled. */
34
+ export function createToolManifestResolver(parts) {
35
+ return () => {
36
+ const enabled = parts.toolRegistry.list().filter(isToolEnabled);
37
+ return enabled.length === 0 ? undefined : toToolManifest(enabled);
38
+ };
39
+ }
40
+ //# sourceMappingURL=parts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parts.js","sourceRoot":"","sources":["../src/parts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE1G,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEpI,OAAO,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AAqB9E,MAAM,UAAU,kBAAkB,CAAC,UAAiC,EAAE;IACpE,MAAM,YAAY,GAAG,kBAAkB,EAAE,CAAC;IAC1C,OAAO;QACL,QAAQ,EAAE,qBAAqB,EAAE;QACjC,MAAM,EAAE,mBAAmB,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;QAC3G,UAAU,EAAE,uBAAuB,EAAE;QACrC,YAAY;QACZ,WAAW,EAAE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,yBAAyB,CAAC,YAAY,CAAC,EAAE,CAAC;QACrF,2BAA2B,EAAE,iCAAiC,EAAE;KACjE,CAAC;AACJ,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,iBAAiB,CAAC,KAAmB;IACnD,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACvB,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC3B,KAAK,CAAC,2BAA2B,CAAC,KAAK,EAAE,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAgD;IAC3F,OAAO,GAAG,EAAE;QACV,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAC9E,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC,CAAC;AACJ,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,0BAA0B,CAAC,KAAyC;IAClF,OAAO,GAAG,EAAE;QACV,MAAM,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAChE,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACpE,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Framework-neutral chat types shared by every framework adapter (React, Angular). Moved
3
+ * here from `@gixcopilot/react` in Phase 12; `@gixcopilot/react` re-exports them unchanged.
4
+ */
5
+ import type { CopilotClient } from '@gixcopilot/client';
6
+ import type { Message, PublicCopilotError, RunId, Thread, ToolActionPreview, ToolActionRisk, ToolActionReversibility, ToolApprovalLevel, ToolCallId, ToolResult, ToolSource, Usage, FinishReason } from '@gixcopilot/protocol';
7
+ import type { ContextDiagnostics, ContextExclusion, ResolvedContextItem } from '@gixcopilot/context';
8
+ /** Serializable context metadata for the current run. Item content is never retained. */
9
+ export interface ResolvedContextSummary {
10
+ readonly items: readonly Pick<ResolvedContextItem, 'id' | 'name' | 'scope' | 'priority' | 'sensitivity' | 'estimatedTokens' | 'truncated'>[];
11
+ readonly excluded: readonly Pick<ContextExclusion, 'id' | 'name' | 'scope' | 'reason'>[];
12
+ readonly estimatedTokens: number;
13
+ readonly diagnostics: ContextDiagnostics;
14
+ }
15
+ /** A protocol message with local presentation metadata; wire content is unchanged. */
16
+ export interface CopilotMessage extends Message {
17
+ readonly status: 'complete' | 'streaming' | 'stopped' | 'error';
18
+ }
19
+ /** Exactly one generation state is observable at a time. */
20
+ export type ChatStatus = 'idle' | 'submitting' | 'streaming' | 'waiting_for_approval' | 'completed' | 'stopped' | 'error';
21
+ /**
22
+ * Headless tool activity state (Section 59-61, added in Phase 5) - a generic timeline of
23
+ * every tool call in the current run, regardless of origin, for a custom/headless UI (or the
24
+ * default `CopilotChat` activity rendering) to display without parsing raw protocol events
25
+ * itself. `arguments`/`result` are present for an advanced consumer that explicitly wants
26
+ * them; the *default* UI intentionally does not render them (Section 60).
27
+ */
28
+ export interface ToolCallState {
29
+ readonly id: ToolCallId;
30
+ readonly name: string;
31
+ readonly source: ToolSource;
32
+ readonly status: 'requested' | 'running' | 'succeeded' | 'failed';
33
+ readonly arguments: Readonly<Record<string, unknown>>;
34
+ readonly result?: unknown;
35
+ readonly error?: PublicCopilotError;
36
+ }
37
+ /**
38
+ * Headless approval state (Phase 7, Section 76, 81-82) - a per-run timeline of every action
39
+ * that paused for human approval, mirroring `ToolCallState`'s own pattern so a custom/
40
+ * headless approval UI never needs to parse raw `approval.*` protocol events itself.
41
+ */
42
+ export interface ApprovalState {
43
+ readonly approvalId: string;
44
+ readonly toolCallId: ToolCallId;
45
+ readonly action: string;
46
+ readonly approvalLevel: ToolApprovalLevel;
47
+ readonly summary: string;
48
+ readonly status: 'pending' | 'approved' | 'rejected' | 'expired' | 'cancelled';
49
+ readonly risk?: ToolActionRisk;
50
+ readonly reversibility?: ToolActionReversibility;
51
+ readonly expiresAt?: string;
52
+ readonly preview?: ToolActionPreview;
53
+ readonly decidedBy?: string;
54
+ }
55
+ /**
56
+ * Headless agent-run progress (Phase 10, Section 139-143) - one entry per agent run that
57
+ * occurred during the current client run, including every delegated/handed-off child run
58
+ * (each carries its own `agentRunId`; `rootRunId`/`parentRunId` let a consumer reconstruct
59
+ * the tree if it wants one). Mirrors `ToolCallState`'s "generic timeline, no
60
+ * chain-of-thought" posture (Section 18, 140) - only structured facts, never raw model
61
+ * reasoning.
62
+ */
63
+ export interface AgentRunState {
64
+ readonly agentRunId: string;
65
+ readonly agentId: string;
66
+ readonly rootRunId?: RunId;
67
+ readonly parentRunId?: RunId;
68
+ readonly status: 'running' | 'completed' | 'failed' | 'cancelled';
69
+ readonly error?: PublicCopilotError;
70
+ }
71
+ /** One delegation (A -> B -> A, Section 56-58) observed during the current client run. */
72
+ export interface AgentDelegationState {
73
+ readonly delegationId: string;
74
+ readonly fromAgentId: string;
75
+ readonly toAgentId: string;
76
+ readonly depth: number;
77
+ readonly status: 'started' | 'completed' | 'failed';
78
+ readonly error?: PublicCopilotError;
79
+ }
80
+ /** One handoff (A -> B, B becomes active, Section 61-65) observed during the current client
81
+ * run. */
82
+ export interface AgentHandoffState {
83
+ readonly fromAgentId: string;
84
+ readonly toAgentId: string;
85
+ readonly reason: string;
86
+ }
87
+ /**
88
+ * Headless workflow-step progress (Phase 10, Section 139-143) - one entry per step attempt of
89
+ * the current workflow run. `attempt`/`phase` mirror the underlying
90
+ * `workflow.step.*` events (Section 117, 121, 202's retry/compensation reuse of this one
91
+ * event triad).
92
+ */
93
+ export interface WorkflowStepState {
94
+ readonly stepId: string;
95
+ readonly stepType: 'function' | 'tool' | 'agent' | 'approval' | 'condition' | 'parallel';
96
+ readonly status: 'running' | 'completed' | 'failed';
97
+ readonly attempt: number;
98
+ readonly phase?: 'forward' | 'compensation';
99
+ readonly error?: PublicCopilotError;
100
+ readonly willRetry?: boolean;
101
+ }
102
+ /** Headless workflow-run progress (Phase 10, Section 139-143), mirroring `AgentRunState`. */
103
+ export interface WorkflowRunState {
104
+ readonly workflowRunId: string;
105
+ readonly workflowId: string;
106
+ readonly status: 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
107
+ readonly pauseReason?: 'approval' | 'checkpoint' | 'manual' | 'external-event';
108
+ readonly pausedStepId?: string;
109
+ readonly error?: PublicCopilotError;
110
+ readonly steps: readonly WorkflowStepState[];
111
+ }
112
+ interface ChatSnapshotBase {
113
+ readonly messages: readonly CopilotMessage[];
114
+ readonly thread: Thread | null;
115
+ readonly runId: string | null;
116
+ readonly usage: Usage | undefined;
117
+ readonly finishReason: FinishReason | undefined;
118
+ /** Resolved context metadata for this run, without any item text or values. */
119
+ readonly contextDiagnostics?: ResolvedContextSummary;
120
+ /** Cleared at the start of every new run (Section 59) - this is per-turn activity, not a
121
+ * persistent tool-call history across the whole conversation. */
122
+ readonly toolCalls: readonly ToolCallState[];
123
+ /** Cleared at the start of every new run, same as `toolCalls` above. */
124
+ readonly approvals: readonly ApprovalState[];
125
+ /** Cleared at the start of every new run, same as `toolCalls` above (Phase 10). */
126
+ readonly agentRuns: readonly AgentRunState[];
127
+ readonly agentDelegations: readonly AgentDelegationState[];
128
+ readonly agentHandoffs: readonly AgentHandoffState[];
129
+ readonly workflowRuns: readonly WorkflowRunState[];
130
+ }
131
+ /** Immutable chat snapshot. Errors exist only in the error state. */
132
+ export type ChatSnapshot = ChatSnapshotBase & ({
133
+ readonly status: Exclude<ChatStatus, 'error'>;
134
+ readonly error: null;
135
+ } | {
136
+ readonly status: 'error';
137
+ readonly error: PublicCopilotError;
138
+ });
139
+ /** Actions are stable for the lifetime of a provider configuration. */
140
+ export interface ChatActions {
141
+ readonly invokeTool: (name: string, args: Readonly<Record<string, unknown>>) => Promise<ToolResult>;
142
+ /** Accept a nonblank user turn unless busy/disposed. True means accepted, not completed. */
143
+ readonly sendMessage: (text: string) => boolean;
144
+ /** Cancel the actual client run, preserving partial text. */
145
+ readonly stop: () => void;
146
+ /** Replay the failed turn with the same user message and replace its partial answer. */
147
+ readonly retry: () => boolean;
148
+ /** Replace the latest completed/stopped answer by replaying its user turn. */
149
+ readonly regenerate: () => boolean;
150
+ /** Cancel and reset local history/thread; does not delete server data. */
151
+ readonly clear: () => void;
152
+ /** Phase 7, Section 83 - approves a pending action. Resolves once the server accepts the
153
+ * decision; the resulting state update itself still arrives as an `approval.approved`
154
+ * event on the run, same as any other server-driven state change. */
155
+ readonly approveAction: (approvalId: string, comment?: string) => Promise<void>;
156
+ readonly rejectAction: (approvalId: string, comment?: string) => Promise<void>;
157
+ }
158
+ /** Full headless chat subscription plus stable actions. */
159
+ export type CopilotChatResult = ChatSnapshot & ChatActions;
160
+ /** Stable SDK access without subscribing to token updates. */
161
+ export interface CopilotAccess extends ChatActions {
162
+ readonly client: CopilotClient;
163
+ }
164
+ /** Phase 4 application-context tuning (Section 25). Omit for the engine's own default. */
165
+ export interface CopilotContextOptions {
166
+ readonly dataPolicy?: {
167
+ redact(data: unknown): unknown;
168
+ };
169
+ /** Total token budget resolved application context may consume. Default 8000. */
170
+ readonly maxContextTokens?: number;
171
+ }
172
+ export {};
173
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EACV,OAAO,EACP,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,UAAU,EACV,KAAK,EACL,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAErG,yFAAyF;AACzF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,iBAAiB,GAAG,WAAW,CAAC,EAAE,CAAC;IAC7I,QAAQ,CAAC,QAAQ,EAAE,SAAS,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;IACzF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AAa,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChF,QAAQ,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChF;AAED,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,WAAW,CAAC;AAE3D,8DAA8D;AAC9D,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;CAChC;AAED,0FAA0F;AAC1F,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,UAAU,CAAC,EAAE;QAAE,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;KAAE,CAAC;IACzD,iFAAiF;IACjF,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@gixcopilot/headless",
3
+ "version": "0.1.0",
4
+ "description": "Framework-neutral chat store and copilot composition shared by the React and Angular adapters.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/AfoudaSWE/gix_ai_copilot_nx.git",
9
+ "directory": "packages/headless"
10
+ },
11
+ "homepage": "https://github.com/AfoudaSWE/gix_ai_copilot_nx/tree/main/packages/headless#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/AfoudaSWE/gix_ai_copilot_nx/issues"
14
+ },
15
+ "type": "module",
16
+ "sideEffects": false,
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "!dist/**/*.spec.*",
29
+ "!dist/**/*.spec-helper.*",
30
+ "!dist/**/*.tsbuildinfo"
31
+ ],
32
+ "engines": {
33
+ "node": ">=22.12.0"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "dependencies": {
39
+ "@gixcopilot/client": "0.1.0",
40
+ "@gixcopilot/tools": "0.1.0",
41
+ "@gixcopilot/context": "0.1.0",
42
+ "@gixcopilot/generative-ui": "0.1.0",
43
+ "@gixcopilot/protocol": "0.1.0"
44
+ },
45
+ "devDependencies": {
46
+ "vitest": "5.0.1",
47
+ "zod": "4.6.5"
48
+ },
49
+ "scripts": {
50
+ "build": "tsc -b tsconfig.json",
51
+ "typecheck": "tsc -b tsconfig.json",
52
+ "test": "vitest run",
53
+ "lint": "eslint src"
54
+ }
55
+ }