@alquimia-ai/tools 2.1.0 → 2.2.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/dist/adapters/fetch.d.mts +1 -0
- package/dist/adapters/fetch.d.ts +1 -0
- package/dist/adapters/fetch.js +3 -1
- package/dist/adapters/fetch.js.map +1 -1
- package/dist/adapters/fetch.mjs +3 -1
- package/dist/adapters/fetch.mjs.map +1 -1
- package/dist/adapters/next.d.mts +1 -0
- package/dist/adapters/next.d.ts +1 -0
- package/dist/adapters/next.js +3 -1
- package/dist/adapters/next.js.map +1 -1
- package/dist/adapters/next.mjs +3 -1
- package/dist/adapters/next.mjs.map +1 -1
- package/dist/hooks/index.d.mts +3 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +190 -21
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +171 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/types-CIqszY3g.d.mts +53 -0
- package/dist/types-CIqszY3g.d.ts +53 -0
- package/dist/worklog/index.d.mts +29 -0
- package/dist/worklog/index.d.ts +29 -0
- package/dist/worklog/index.js +218 -0
- package/dist/worklog/index.js.map +1 -0
- package/dist/worklog/index.mjs +195 -0
- package/dist/worklog/index.mjs.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/worklog/index.ts
|
|
21
|
+
var worklog_exports = {};
|
|
22
|
+
__export(worklog_exports, {
|
|
23
|
+
EVENT_REGISTRY: () => EVENT_REGISTRY,
|
|
24
|
+
foldWorklog: () => foldWorklog,
|
|
25
|
+
frameToRecord: () => frameToRecord,
|
|
26
|
+
initialWorklogState: () => initialWorklogState,
|
|
27
|
+
reduceWorklog: () => reduceWorklog,
|
|
28
|
+
resolveInterpreter: () => resolveInterpreter,
|
|
29
|
+
useWorklog: () => useWorklog
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(worklog_exports);
|
|
32
|
+
|
|
33
|
+
// src/worklog/types.ts
|
|
34
|
+
function initialWorklogState(taskId = null) {
|
|
35
|
+
return { taskId, status: "idle", answer: null, nodes: [], index: {}, raw: [] };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/worklog/registry.ts
|
|
39
|
+
var asRecord = (data) => data && typeof data === "object" ? data : {};
|
|
40
|
+
var toolTitle = (r) => {
|
|
41
|
+
const name = asRecord(r.data).name;
|
|
42
|
+
return typeof name === "string" && name.length > 0 ? `Tool: ${name}` : "Tool";
|
|
43
|
+
};
|
|
44
|
+
var agentTitle = (r) => {
|
|
45
|
+
const name = asRecord(r.data).name;
|
|
46
|
+
return typeof name === "string" && name.length > 0 ? `Agent: ${name}` : "Agent-to-agent";
|
|
47
|
+
};
|
|
48
|
+
var constTitle = (label) => () => label;
|
|
49
|
+
var EVENT_REGISTRY = {
|
|
50
|
+
// Run envelope
|
|
51
|
+
AssistantInference: { kind: "answer", role: "run-open", title: constTitle("Inference started") },
|
|
52
|
+
AssistantInferenceResponse: { kind: "answer", role: "run-close", title: constTitle("Answer") },
|
|
53
|
+
// Safeguard
|
|
54
|
+
ShieldInference: { kind: "safeguard", role: "open", title: constTitle("Safeguard") },
|
|
55
|
+
ShieldInferenceResponse: { kind: "safeguard", role: "close", title: constTitle("Safeguard") },
|
|
56
|
+
// Reasoning
|
|
57
|
+
ResponseInference: { kind: "reasoning", role: "open", title: constTitle("Reasoning") },
|
|
58
|
+
ResponseInferenceResponse: { kind: "reasoning", role: "close", title: constTitle("Reasoning") },
|
|
59
|
+
// Tools (server + subclasses) and their responses
|
|
60
|
+
ServerToolExecution: { kind: "tool", role: "open", title: toolTitle },
|
|
61
|
+
BuiltinToolExecution: { kind: "tool", role: "open", title: toolTitle },
|
|
62
|
+
UnknownToolExecution: { kind: "tool", role: "open", title: toolTitle },
|
|
63
|
+
ClientToolExecution: { kind: "tool", role: "open", title: toolTitle, pending: true },
|
|
64
|
+
ToolExecutionResponse: { kind: "tool", role: "close", title: toolTitle },
|
|
65
|
+
BuiltinToolExecutionResponse: { kind: "tool", role: "close", title: toolTitle },
|
|
66
|
+
// Tool schema discovery
|
|
67
|
+
ToolSchema: { kind: "tool", role: "open", title: constTitle("Tool schema") },
|
|
68
|
+
ToolSchemaResponse: { kind: "tool", role: "close", title: constTitle("Tool schema") },
|
|
69
|
+
// Agent-to-agent
|
|
70
|
+
A2AInference: { kind: "a2a", role: "open", title: agentTitle },
|
|
71
|
+
AgentDiscovery: { kind: "a2a", role: "open", title: constTitle("Agent discovery") },
|
|
72
|
+
AgentDiscoveryResponse: { kind: "a2a", role: "close", title: constTitle("Agent discovery") },
|
|
73
|
+
// Memory / persistence
|
|
74
|
+
ContextPersistence: { kind: "memory", role: "open", title: constTitle("Memory persistence") },
|
|
75
|
+
ContextFlush: { kind: "memory", role: "open", title: constTitle("Memory flush") },
|
|
76
|
+
ContextFlushResponse: { kind: "memory", role: "close", title: constTitle("Memory flush") },
|
|
77
|
+
// Human approval
|
|
78
|
+
HumanApprovalRequired: {
|
|
79
|
+
kind: "tool",
|
|
80
|
+
role: "open",
|
|
81
|
+
title: constTitle("Human approval required"),
|
|
82
|
+
pending: true
|
|
83
|
+
},
|
|
84
|
+
HumanApprovalRequiredResponse: { kind: "tool", role: "close", title: constTitle("Human approval") }
|
|
85
|
+
};
|
|
86
|
+
function resolveInterpreter(eventClass) {
|
|
87
|
+
if (Object.prototype.hasOwnProperty.call(EVENT_REGISTRY, eventClass)) {
|
|
88
|
+
return EVENT_REGISTRY[eventClass];
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
kind: "unknown",
|
|
92
|
+
role: "open",
|
|
93
|
+
title: (r) => r.event_class
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// src/worklog/reducer.ts
|
|
98
|
+
var asString = (v) => typeof v === "string" ? v : v == null ? "" : JSON.stringify(v);
|
|
99
|
+
var nodeDepth = (record) => {
|
|
100
|
+
const d = record.data && typeof record.data === "object" ? record.data.depth : void 0;
|
|
101
|
+
return typeof d === "number" ? d : 0;
|
|
102
|
+
};
|
|
103
|
+
var makeOpenNode = (record, interp, id) => ({
|
|
104
|
+
id,
|
|
105
|
+
kind: interp.kind,
|
|
106
|
+
eventClass: record.event_class,
|
|
107
|
+
status: interp.pending ? "pending" : "running",
|
|
108
|
+
title: interp.title(record),
|
|
109
|
+
startedAt: record.date_submitted,
|
|
110
|
+
depth: nodeDepth(record),
|
|
111
|
+
children: [],
|
|
112
|
+
command: record.data,
|
|
113
|
+
raw: [record]
|
|
114
|
+
});
|
|
115
|
+
var makeClosedNode = (record, interp, id) => ({
|
|
116
|
+
id,
|
|
117
|
+
kind: interp.kind,
|
|
118
|
+
eventClass: record.event_class,
|
|
119
|
+
status: record.status === "error" ? "failed" : "completed",
|
|
120
|
+
title: interp.title(record),
|
|
121
|
+
startedAt: record.date_submitted,
|
|
122
|
+
endedAt: record.date_submitted,
|
|
123
|
+
depth: nodeDepth(record),
|
|
124
|
+
children: [],
|
|
125
|
+
response: record.data,
|
|
126
|
+
error: record.status === "error" ? asString(record.data) : void 0,
|
|
127
|
+
raw: [record]
|
|
128
|
+
});
|
|
129
|
+
function reduceWorklog(state, record) {
|
|
130
|
+
const interp = resolveInterpreter(record.event_class);
|
|
131
|
+
const next = {
|
|
132
|
+
...state,
|
|
133
|
+
nodes: state.nodes.slice(),
|
|
134
|
+
index: { ...state.index },
|
|
135
|
+
raw: [...state.raw, record]
|
|
136
|
+
};
|
|
137
|
+
if (interp.role === "ignore") return next;
|
|
138
|
+
if (interp.role === "run-open") {
|
|
139
|
+
next.status = "running";
|
|
140
|
+
return next;
|
|
141
|
+
}
|
|
142
|
+
if (interp.role === "run-close") {
|
|
143
|
+
next.answer = asString(record.data) || null;
|
|
144
|
+
next.status = record.status === "error" ? "error" : "success";
|
|
145
|
+
return next;
|
|
146
|
+
}
|
|
147
|
+
const key = record.control_id ?? `${record.event_class}-${next.raw.length}`;
|
|
148
|
+
if (interp.role === "close") {
|
|
149
|
+
const pos2 = Object.prototype.hasOwnProperty.call(next.index, key) ? next.index[key] : void 0;
|
|
150
|
+
if (pos2 != null) {
|
|
151
|
+
const existing = next.nodes[pos2];
|
|
152
|
+
next.nodes[pos2] = {
|
|
153
|
+
...existing,
|
|
154
|
+
status: record.status === "error" ? "failed" : "completed",
|
|
155
|
+
endedAt: record.date_submitted,
|
|
156
|
+
response: record.data,
|
|
157
|
+
error: record.status === "error" ? asString(record.data) : existing.error,
|
|
158
|
+
raw: [...existing.raw, record]
|
|
159
|
+
};
|
|
160
|
+
} else {
|
|
161
|
+
next.index[key] = next.nodes.length;
|
|
162
|
+
next.nodes.push(makeClosedNode(record, interp, key));
|
|
163
|
+
}
|
|
164
|
+
if (record.status === "error") next.status = "error";
|
|
165
|
+
return next;
|
|
166
|
+
}
|
|
167
|
+
const pos = Object.prototype.hasOwnProperty.call(next.index, key) ? next.index[key] : void 0;
|
|
168
|
+
if (pos != null) {
|
|
169
|
+
const existing = next.nodes[pos];
|
|
170
|
+
next.nodes[pos] = { ...existing, raw: [...existing.raw, record] };
|
|
171
|
+
} else {
|
|
172
|
+
next.index[key] = next.nodes.length;
|
|
173
|
+
next.nodes.push(makeOpenNode(record, interp, key));
|
|
174
|
+
}
|
|
175
|
+
return next;
|
|
176
|
+
}
|
|
177
|
+
function foldWorklog(records, taskId = null) {
|
|
178
|
+
return records.reduce(reduceWorklog, initialWorklogState(taskId));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// src/worklog/use-worklog.ts
|
|
182
|
+
var import_react = require("react");
|
|
183
|
+
function hookReducer(state, action) {
|
|
184
|
+
switch (action.type) {
|
|
185
|
+
case "ingest":
|
|
186
|
+
return reduceWorklog(state, action.record);
|
|
187
|
+
case "ingestMany":
|
|
188
|
+
return action.records.reduce(reduceWorklog, state);
|
|
189
|
+
case "reset":
|
|
190
|
+
return initialWorklogState(action.taskId);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function useWorklog(taskId = null) {
|
|
194
|
+
const [worklog, dispatch] = (0, import_react.useReducer)(hookReducer, taskId, initialWorklogState);
|
|
195
|
+
const ingest = (0, import_react.useCallback)((record) => dispatch({ type: "ingest", record }), []);
|
|
196
|
+
const ingestMany = (0, import_react.useCallback)(
|
|
197
|
+
(records) => dispatch({ type: "ingestMany", records }),
|
|
198
|
+
[]
|
|
199
|
+
);
|
|
200
|
+
const reset = (0, import_react.useCallback)(
|
|
201
|
+
(id = null) => dispatch({ type: "reset", taskId: id }),
|
|
202
|
+
[]
|
|
203
|
+
);
|
|
204
|
+
return { worklog, ingest, ingestMany, reset };
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/worklog/from-frame.ts
|
|
208
|
+
function frameToRecord(frame) {
|
|
209
|
+
const status = frame.status === "success" || frame.status === "error" ? frame.status : null;
|
|
210
|
+
return {
|
|
211
|
+
event_class: typeof frame.event_class === "string" && frame.event_class.length > 0 ? frame.event_class : "Unknown",
|
|
212
|
+
control_id: frame.control_id ?? null,
|
|
213
|
+
data: frame.data,
|
|
214
|
+
status,
|
|
215
|
+
date_submitted: typeof frame.date_submitted === "string" ? frame.date_submitted : ""
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/worklog/index.ts","../../src/worklog/types.ts","../../src/worklog/registry.ts","../../src/worklog/reducer.ts","../../src/worklog/use-worklog.ts","../../src/worklog/from-frame.ts"],"sourcesContent":["export * from \"./types\";\nexport { EVENT_REGISTRY, resolveInterpreter } from \"./registry\";\nexport { reduceWorklog, foldWorklog } from \"./reducer\";\nexport { useWorklog } from \"./use-worklog\";\nexport { frameToRecord, type RawFrame } from \"./from-frame\";\n","/** One granular Runtime worklog record (a `bus_mode` SSE frame or a `/worklog/{task_id}/events` item). */\nexport interface WorklogRecord {\n event_class: string;\n control_id: string | null;\n data: unknown;\n status: \"success\" | \"error\" | null;\n date_submitted: string;\n}\n\n/** Semantic bucket a node belongs to. */\nexport type NodeKind =\n | \"safeguard\"\n | \"reasoning\"\n | \"tool\"\n | \"a2a\"\n | \"memory\"\n | \"answer\"\n | \"unknown\";\n\n/** Lifecycle state of a single node. */\nexport type NodeStatus = \"pending\" | \"running\" | \"completed\" | \"failed\" | \"skipped\";\n\n/** Overall run status. */\nexport type RunStatus = \"idle\" | \"running\" | \"success\" | \"error\";\n\n/** A single step in the execution chain (command + its response merged by control_id). */\nexport interface WorklogNode {\n id: string;\n kind: NodeKind;\n eventClass: string;\n status: NodeStatus;\n title: string;\n startedAt?: string;\n endedAt?: string;\n depth: number;\n parentId?: string;\n children: WorklogNode[];\n command?: unknown;\n response?: unknown;\n error?: string;\n raw: WorklogRecord[];\n}\n\n/** Normalized execution model produced by the reducer. */\nexport interface WorklogState {\n taskId: string | null;\n status: RunStatus;\n answer: string | null;\n nodes: WorklogNode[];\n index: Record<string, number>;\n raw: WorklogRecord[];\n}\n\n/** How a record acts on the model. */\nexport type EventRole = \"open\" | \"close\" | \"run-open\" | \"run-close\" | \"ignore\";\n\n/** Registry descriptor for one event_class. */\nexport interface EventInterpreter {\n kind: NodeKind;\n role: EventRole;\n title: (record: WorklogRecord) => string;\n /** If true, an opened node starts in \"pending\" (awaiting external input) rather than \"running\". */\n pending?: boolean;\n}\n\nexport function initialWorklogState(taskId: string | null = null): WorklogState {\n return { taskId, status: \"idle\", answer: null, nodes: [], index: {}, raw: [] };\n}\n","import type { EventInterpreter, WorklogRecord } from \"./types\";\n\nconst asRecord = (data: unknown): Record<string, unknown> =>\n data && typeof data === \"object\" ? (data as Record<string, unknown>) : {};\n\nconst toolTitle = (r: WorklogRecord): string => {\n const name = asRecord(r.data).name;\n return typeof name === \"string\" && name.length > 0 ? `Tool: ${name}` : \"Tool\";\n};\n\nconst agentTitle = (r: WorklogRecord): string => {\n const name = asRecord(r.data).name;\n return typeof name === \"string\" && name.length > 0 ? `Agent: ${name}` : \"Agent-to-agent\";\n};\n\nconst constTitle = (label: string) => () => label;\n\nexport const EVENT_REGISTRY: Record<string, EventInterpreter> = {\n // Run envelope\n AssistantInference: { kind: \"answer\", role: \"run-open\", title: constTitle(\"Inference started\") },\n AssistantInferenceResponse: { kind: \"answer\", role: \"run-close\", title: constTitle(\"Answer\") },\n\n // Safeguard\n ShieldInference: { kind: \"safeguard\", role: \"open\", title: constTitle(\"Safeguard\") },\n ShieldInferenceResponse: { kind: \"safeguard\", role: \"close\", title: constTitle(\"Safeguard\") },\n\n // Reasoning\n ResponseInference: { kind: \"reasoning\", role: \"open\", title: constTitle(\"Reasoning\") },\n ResponseInferenceResponse: { kind: \"reasoning\", role: \"close\", title: constTitle(\"Reasoning\") },\n\n // Tools (server + subclasses) and their responses\n ServerToolExecution: { kind: \"tool\", role: \"open\", title: toolTitle },\n BuiltinToolExecution: { kind: \"tool\", role: \"open\", title: toolTitle },\n UnknownToolExecution: { kind: \"tool\", role: \"open\", title: toolTitle },\n ClientToolExecution: { kind: \"tool\", role: \"open\", title: toolTitle, pending: true },\n ToolExecutionResponse: { kind: \"tool\", role: \"close\", title: toolTitle },\n BuiltinToolExecutionResponse: { kind: \"tool\", role: \"close\", title: toolTitle },\n\n // Tool schema discovery\n ToolSchema: { kind: \"tool\", role: \"open\", title: constTitle(\"Tool schema\") },\n ToolSchemaResponse: { kind: \"tool\", role: \"close\", title: constTitle(\"Tool schema\") },\n\n // Agent-to-agent\n A2AInference: { kind: \"a2a\", role: \"open\", title: agentTitle },\n AgentDiscovery: { kind: \"a2a\", role: \"open\", title: constTitle(\"Agent discovery\") },\n AgentDiscoveryResponse: { kind: \"a2a\", role: \"close\", title: constTitle(\"Agent discovery\") },\n\n // Memory / persistence\n ContextPersistence: { kind: \"memory\", role: \"open\", title: constTitle(\"Memory persistence\") },\n ContextFlush: { kind: \"memory\", role: \"open\", title: constTitle(\"Memory flush\") },\n ContextFlushResponse: { kind: \"memory\", role: \"close\", title: constTitle(\"Memory flush\") },\n\n // Human approval\n HumanApprovalRequired: {\n kind: \"tool\",\n role: \"open\",\n title: constTitle(\"Human approval required\"),\n pending: true,\n },\n HumanApprovalRequiredResponse: { kind: \"tool\", role: \"close\", title: constTitle(\"Human approval\") },\n};\n\nexport function resolveInterpreter(eventClass: string): EventInterpreter {\n if (Object.prototype.hasOwnProperty.call(EVENT_REGISTRY, eventClass)) {\n return EVENT_REGISTRY[eventClass];\n }\n return {\n kind: \"unknown\",\n role: \"open\",\n title: (r: WorklogRecord) => r.event_class,\n };\n}\n","import { resolveInterpreter } from \"./registry\";\nimport type { EventInterpreter, WorklogNode, WorklogRecord, WorklogState } from \"./types\";\nimport { initialWorklogState } from \"./types\";\n\nconst asString = (v: unknown): string =>\n typeof v === \"string\" ? v : v == null ? \"\" : JSON.stringify(v);\n\nconst nodeDepth = (record: WorklogRecord): number => {\n const d = record.data && typeof record.data === \"object\"\n ? (record.data as Record<string, unknown>).depth\n : undefined;\n return typeof d === \"number\" ? d : 0;\n};\n\nconst makeOpenNode = (record: WorklogRecord, interp: EventInterpreter, id: string): WorklogNode => ({\n id,\n kind: interp.kind,\n eventClass: record.event_class,\n status: interp.pending ? \"pending\" : \"running\",\n title: interp.title(record),\n startedAt: record.date_submitted,\n depth: nodeDepth(record),\n children: [],\n command: record.data,\n raw: [record],\n});\n\nconst makeClosedNode = (record: WorklogRecord, interp: EventInterpreter, id: string): WorklogNode => ({\n id,\n kind: interp.kind,\n eventClass: record.event_class,\n status: record.status === \"error\" ? \"failed\" : \"completed\",\n title: interp.title(record),\n startedAt: record.date_submitted,\n endedAt: record.date_submitted,\n depth: nodeDepth(record),\n children: [],\n response: record.data,\n error: record.status === \"error\" ? asString(record.data) : undefined,\n raw: [record],\n});\n\nexport function reduceWorklog(state: WorklogState, record: WorklogRecord): WorklogState {\n const interp = resolveInterpreter(record.event_class);\n const next: WorklogState = {\n ...state,\n nodes: state.nodes.slice(),\n index: { ...state.index },\n raw: [...state.raw, record],\n };\n\n if (interp.role === \"ignore\") return next;\n\n if (interp.role === \"run-open\") {\n next.status = \"running\";\n return next;\n }\n\n if (interp.role === \"run-close\") {\n next.answer = asString(record.data) || null;\n next.status = record.status === \"error\" ? \"error\" : \"success\";\n return next;\n }\n\n const key = record.control_id ?? `${record.event_class}-${next.raw.length}`;\n\n if (interp.role === \"close\") {\n const pos = Object.prototype.hasOwnProperty.call(next.index, key) ? next.index[key] : undefined;\n if (pos != null) {\n const existing = next.nodes[pos];\n next.nodes[pos] = {\n ...existing,\n status: record.status === \"error\" ? \"failed\" : \"completed\",\n endedAt: record.date_submitted,\n response: record.data,\n error: record.status === \"error\" ? asString(record.data) : existing.error,\n raw: [...existing.raw, record],\n };\n } else {\n // response arrived without a seen command — create it already closed\n next.index[key] = next.nodes.length;\n next.nodes.push(makeClosedNode(record, interp, key));\n }\n if (record.status === \"error\") next.status = \"error\";\n return next;\n }\n\n // role === \"open\"\n const pos = Object.prototype.hasOwnProperty.call(next.index, key) ? next.index[key] : undefined;\n if (pos != null) {\n const existing = next.nodes[pos];\n next.nodes[pos] = { ...existing, raw: [...existing.raw, record] };\n } else {\n next.index[key] = next.nodes.length;\n next.nodes.push(makeOpenNode(record, interp, key));\n }\n return next;\n}\n\nexport function foldWorklog(records: WorklogRecord[], taskId: string | null = null): WorklogState {\n return records.reduce(reduceWorklog, initialWorklogState(taskId));\n}\n","import { useCallback, useReducer } from \"react\";\nimport { reduceWorklog } from \"./reducer\";\nimport { initialWorklogState, type WorklogRecord, type WorklogState } from \"./types\";\n\ntype Action =\n | { type: \"ingest\"; record: WorklogRecord }\n | { type: \"ingestMany\"; records: WorklogRecord[] }\n | { type: \"reset\"; taskId: string | null };\n\nfunction hookReducer(state: WorklogState, action: Action): WorklogState {\n switch (action.type) {\n case \"ingest\":\n return reduceWorklog(state, action.record);\n case \"ingestMany\":\n return action.records.reduce(reduceWorklog, state);\n case \"reset\":\n return initialWorklogState(action.taskId);\n }\n}\n\n/** Live worklog accumulator. Feed it `bus_mode` records via `ingest`; use `foldWorklog` for history. */\nexport function useWorklog(taskId: string | null = null) {\n const [worklog, dispatch] = useReducer(hookReducer, taskId, initialWorklogState);\n\n const ingest = useCallback((record: WorklogRecord) => dispatch({ type: \"ingest\", record }), []);\n const ingestMany = useCallback(\n (records: WorklogRecord[]) => dispatch({ type: \"ingestMany\", records }),\n [],\n );\n const reset = useCallback(\n (id: string | null = null) => dispatch({ type: \"reset\", taskId: id }),\n [],\n );\n\n return { worklog, ingest, ingestMany, reset };\n}\n","import type { WorklogRecord } from \"./types\";\n\n/** Loosely-typed shape of a parsed SSE `data:` frame from the granular Runtime stream. */\nexport interface RawFrame {\n event_class?: string;\n control_id?: string | null;\n data?: unknown;\n status?: string | null;\n date_submitted?: string;\n}\n\n/** Normalize a parsed SSE frame into a WorklogRecord (defaults missing fields; never throws). */\nexport function frameToRecord(frame: RawFrame): WorklogRecord {\n const status = frame.status === \"success\" || frame.status === \"error\" ? frame.status : null;\n return {\n event_class: typeof frame.event_class === \"string\" && frame.event_class.length > 0\n ? frame.event_class\n : \"Unknown\",\n control_id: frame.control_id ?? null,\n data: frame.data,\n status,\n date_submitted: typeof frame.date_submitted === \"string\" ? frame.date_submitted : \"\",\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiEO,SAAS,oBAAoB,SAAwB,MAAoB;AAC9E,SAAO,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE;AAC/E;;;ACjEA,IAAM,WAAW,CAAC,SAChB,QAAQ,OAAO,SAAS,WAAY,OAAmC,CAAC;AAE1E,IAAM,YAAY,CAAC,MAA6B;AAC9C,QAAM,OAAO,SAAS,EAAE,IAAI,EAAE;AAC9B,SAAO,OAAO,SAAS,YAAY,KAAK,SAAS,IAAI,SAAS,IAAI,KAAK;AACzE;AAEA,IAAM,aAAa,CAAC,MAA6B;AAC/C,QAAM,OAAO,SAAS,EAAE,IAAI,EAAE;AAC9B,SAAO,OAAO,SAAS,YAAY,KAAK,SAAS,IAAI,UAAU,IAAI,KAAK;AAC1E;AAEA,IAAM,aAAa,CAAC,UAAkB,MAAM;AAErC,IAAM,iBAAmD;AAAA;AAAA,EAE9D,oBAAoB,EAAE,MAAM,UAAU,MAAM,YAAY,OAAO,WAAW,mBAAmB,EAAE;AAAA,EAC/F,4BAA4B,EAAE,MAAM,UAAU,MAAM,aAAa,OAAO,WAAW,QAAQ,EAAE;AAAA;AAAA,EAG7F,iBAAiB,EAAE,MAAM,aAAa,MAAM,QAAQ,OAAO,WAAW,WAAW,EAAE;AAAA,EACnF,yBAAyB,EAAE,MAAM,aAAa,MAAM,SAAS,OAAO,WAAW,WAAW,EAAE;AAAA;AAAA,EAG5F,mBAAmB,EAAE,MAAM,aAAa,MAAM,QAAQ,OAAO,WAAW,WAAW,EAAE;AAAA,EACrF,2B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AAgC;AAC5D,QAAM,SAAS,MAAM,WAAW,aAAa,MAAM,WAAW,UAAU,MAAM,SAAS;AACvF,SAAO;AAAA,IACL,aAAa,OAAO,MAAM,gBAAgB,YAAY,MAAM,YAAY,SAAS,IAC7E,MAAM,cACN;AAAA,IACJ,YAAY,MAAM,cAAc;AAAA,IAChC,MAAM,MAAM;AAAA,IACZ;AAAA,IACA,gBAAgB,OAAO,MAAM,mBAAmB,WAAW,MAAM,iBAAiB;AAAA,EACpF;AACF;","names":["pos"]}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// src/worklog/types.ts
|
|
2
|
+
function initialWorklogState(taskId = null) {
|
|
3
|
+
return { taskId, status: "idle", answer: null, nodes: [], index: {}, raw: [] };
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// src/worklog/registry.ts
|
|
7
|
+
var asRecord = (data) => data && typeof data === "object" ? data : {};
|
|
8
|
+
var toolTitle = (r) => {
|
|
9
|
+
const name = asRecord(r.data).name;
|
|
10
|
+
return typeof name === "string" && name.length > 0 ? `Tool: ${name}` : "Tool";
|
|
11
|
+
};
|
|
12
|
+
var agentTitle = (r) => {
|
|
13
|
+
const name = asRecord(r.data).name;
|
|
14
|
+
return typeof name === "string" && name.length > 0 ? `Agent: ${name}` : "Agent-to-agent";
|
|
15
|
+
};
|
|
16
|
+
var constTitle = (label) => () => label;
|
|
17
|
+
var EVENT_REGISTRY = {
|
|
18
|
+
// Run envelope
|
|
19
|
+
AssistantInference: { kind: "answer", role: "run-open", title: constTitle("Inference started") },
|
|
20
|
+
AssistantInferenceResponse: { kind: "answer", role: "run-close", title: constTitle("Answer") },
|
|
21
|
+
// Safeguard
|
|
22
|
+
ShieldInference: { kind: "safeguard", role: "open", title: constTitle("Safeguard") },
|
|
23
|
+
ShieldInferenceResponse: { kind: "safeguard", role: "close", title: constTitle("Safeguard") },
|
|
24
|
+
// Reasoning
|
|
25
|
+
ResponseInference: { kind: "reasoning", role: "open", title: constTitle("Reasoning") },
|
|
26
|
+
ResponseInferenceResponse: { kind: "reasoning", role: "close", title: constTitle("Reasoning") },
|
|
27
|
+
// Tools (server + subclasses) and their responses
|
|
28
|
+
ServerToolExecution: { kind: "tool", role: "open", title: toolTitle },
|
|
29
|
+
BuiltinToolExecution: { kind: "tool", role: "open", title: toolTitle },
|
|
30
|
+
UnknownToolExecution: { kind: "tool", role: "open", title: toolTitle },
|
|
31
|
+
ClientToolExecution: { kind: "tool", role: "open", title: toolTitle, pending: true },
|
|
32
|
+
ToolExecutionResponse: { kind: "tool", role: "close", title: toolTitle },
|
|
33
|
+
BuiltinToolExecutionResponse: { kind: "tool", role: "close", title: toolTitle },
|
|
34
|
+
// Tool schema discovery
|
|
35
|
+
ToolSchema: { kind: "tool", role: "open", title: constTitle("Tool schema") },
|
|
36
|
+
ToolSchemaResponse: { kind: "tool", role: "close", title: constTitle("Tool schema") },
|
|
37
|
+
// Agent-to-agent
|
|
38
|
+
A2AInference: { kind: "a2a", role: "open", title: agentTitle },
|
|
39
|
+
AgentDiscovery: { kind: "a2a", role: "open", title: constTitle("Agent discovery") },
|
|
40
|
+
AgentDiscoveryResponse: { kind: "a2a", role: "close", title: constTitle("Agent discovery") },
|
|
41
|
+
// Memory / persistence
|
|
42
|
+
ContextPersistence: { kind: "memory", role: "open", title: constTitle("Memory persistence") },
|
|
43
|
+
ContextFlush: { kind: "memory", role: "open", title: constTitle("Memory flush") },
|
|
44
|
+
ContextFlushResponse: { kind: "memory", role: "close", title: constTitle("Memory flush") },
|
|
45
|
+
// Human approval
|
|
46
|
+
HumanApprovalRequired: {
|
|
47
|
+
kind: "tool",
|
|
48
|
+
role: "open",
|
|
49
|
+
title: constTitle("Human approval required"),
|
|
50
|
+
pending: true
|
|
51
|
+
},
|
|
52
|
+
HumanApprovalRequiredResponse: { kind: "tool", role: "close", title: constTitle("Human approval") }
|
|
53
|
+
};
|
|
54
|
+
function resolveInterpreter(eventClass) {
|
|
55
|
+
if (Object.prototype.hasOwnProperty.call(EVENT_REGISTRY, eventClass)) {
|
|
56
|
+
return EVENT_REGISTRY[eventClass];
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
kind: "unknown",
|
|
60
|
+
role: "open",
|
|
61
|
+
title: (r) => r.event_class
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/worklog/reducer.ts
|
|
66
|
+
var asString = (v) => typeof v === "string" ? v : v == null ? "" : JSON.stringify(v);
|
|
67
|
+
var nodeDepth = (record) => {
|
|
68
|
+
const d = record.data && typeof record.data === "object" ? record.data.depth : void 0;
|
|
69
|
+
return typeof d === "number" ? d : 0;
|
|
70
|
+
};
|
|
71
|
+
var makeOpenNode = (record, interp, id) => ({
|
|
72
|
+
id,
|
|
73
|
+
kind: interp.kind,
|
|
74
|
+
eventClass: record.event_class,
|
|
75
|
+
status: interp.pending ? "pending" : "running",
|
|
76
|
+
title: interp.title(record),
|
|
77
|
+
startedAt: record.date_submitted,
|
|
78
|
+
depth: nodeDepth(record),
|
|
79
|
+
children: [],
|
|
80
|
+
command: record.data,
|
|
81
|
+
raw: [record]
|
|
82
|
+
});
|
|
83
|
+
var makeClosedNode = (record, interp, id) => ({
|
|
84
|
+
id,
|
|
85
|
+
kind: interp.kind,
|
|
86
|
+
eventClass: record.event_class,
|
|
87
|
+
status: record.status === "error" ? "failed" : "completed",
|
|
88
|
+
title: interp.title(record),
|
|
89
|
+
startedAt: record.date_submitted,
|
|
90
|
+
endedAt: record.date_submitted,
|
|
91
|
+
depth: nodeDepth(record),
|
|
92
|
+
children: [],
|
|
93
|
+
response: record.data,
|
|
94
|
+
error: record.status === "error" ? asString(record.data) : void 0,
|
|
95
|
+
raw: [record]
|
|
96
|
+
});
|
|
97
|
+
function reduceWorklog(state, record) {
|
|
98
|
+
const interp = resolveInterpreter(record.event_class);
|
|
99
|
+
const next = {
|
|
100
|
+
...state,
|
|
101
|
+
nodes: state.nodes.slice(),
|
|
102
|
+
index: { ...state.index },
|
|
103
|
+
raw: [...state.raw, record]
|
|
104
|
+
};
|
|
105
|
+
if (interp.role === "ignore") return next;
|
|
106
|
+
if (interp.role === "run-open") {
|
|
107
|
+
next.status = "running";
|
|
108
|
+
return next;
|
|
109
|
+
}
|
|
110
|
+
if (interp.role === "run-close") {
|
|
111
|
+
next.answer = asString(record.data) || null;
|
|
112
|
+
next.status = record.status === "error" ? "error" : "success";
|
|
113
|
+
return next;
|
|
114
|
+
}
|
|
115
|
+
const key = record.control_id ?? `${record.event_class}-${next.raw.length}`;
|
|
116
|
+
if (interp.role === "close") {
|
|
117
|
+
const pos2 = Object.prototype.hasOwnProperty.call(next.index, key) ? next.index[key] : void 0;
|
|
118
|
+
if (pos2 != null) {
|
|
119
|
+
const existing = next.nodes[pos2];
|
|
120
|
+
next.nodes[pos2] = {
|
|
121
|
+
...existing,
|
|
122
|
+
status: record.status === "error" ? "failed" : "completed",
|
|
123
|
+
endedAt: record.date_submitted,
|
|
124
|
+
response: record.data,
|
|
125
|
+
error: record.status === "error" ? asString(record.data) : existing.error,
|
|
126
|
+
raw: [...existing.raw, record]
|
|
127
|
+
};
|
|
128
|
+
} else {
|
|
129
|
+
next.index[key] = next.nodes.length;
|
|
130
|
+
next.nodes.push(makeClosedNode(record, interp, key));
|
|
131
|
+
}
|
|
132
|
+
if (record.status === "error") next.status = "error";
|
|
133
|
+
return next;
|
|
134
|
+
}
|
|
135
|
+
const pos = Object.prototype.hasOwnProperty.call(next.index, key) ? next.index[key] : void 0;
|
|
136
|
+
if (pos != null) {
|
|
137
|
+
const existing = next.nodes[pos];
|
|
138
|
+
next.nodes[pos] = { ...existing, raw: [...existing.raw, record] };
|
|
139
|
+
} else {
|
|
140
|
+
next.index[key] = next.nodes.length;
|
|
141
|
+
next.nodes.push(makeOpenNode(record, interp, key));
|
|
142
|
+
}
|
|
143
|
+
return next;
|
|
144
|
+
}
|
|
145
|
+
function foldWorklog(records, taskId = null) {
|
|
146
|
+
return records.reduce(reduceWorklog, initialWorklogState(taskId));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// src/worklog/use-worklog.ts
|
|
150
|
+
import { useCallback, useReducer } from "react";
|
|
151
|
+
function hookReducer(state, action) {
|
|
152
|
+
switch (action.type) {
|
|
153
|
+
case "ingest":
|
|
154
|
+
return reduceWorklog(state, action.record);
|
|
155
|
+
case "ingestMany":
|
|
156
|
+
return action.records.reduce(reduceWorklog, state);
|
|
157
|
+
case "reset":
|
|
158
|
+
return initialWorklogState(action.taskId);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function useWorklog(taskId = null) {
|
|
162
|
+
const [worklog, dispatch] = useReducer(hookReducer, taskId, initialWorklogState);
|
|
163
|
+
const ingest = useCallback((record) => dispatch({ type: "ingest", record }), []);
|
|
164
|
+
const ingestMany = useCallback(
|
|
165
|
+
(records) => dispatch({ type: "ingestMany", records }),
|
|
166
|
+
[]
|
|
167
|
+
);
|
|
168
|
+
const reset = useCallback(
|
|
169
|
+
(id = null) => dispatch({ type: "reset", taskId: id }),
|
|
170
|
+
[]
|
|
171
|
+
);
|
|
172
|
+
return { worklog, ingest, ingestMany, reset };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// src/worklog/from-frame.ts
|
|
176
|
+
function frameToRecord(frame) {
|
|
177
|
+
const status = frame.status === "success" || frame.status === "error" ? frame.status : null;
|
|
178
|
+
return {
|
|
179
|
+
event_class: typeof frame.event_class === "string" && frame.event_class.length > 0 ? frame.event_class : "Unknown",
|
|
180
|
+
control_id: frame.control_id ?? null,
|
|
181
|
+
data: frame.data,
|
|
182
|
+
status,
|
|
183
|
+
date_submitted: typeof frame.date_submitted === "string" ? frame.date_submitted : ""
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
export {
|
|
187
|
+
EVENT_REGISTRY,
|
|
188
|
+
foldWorklog,
|
|
189
|
+
frameToRecord,
|
|
190
|
+
initialWorklogState,
|
|
191
|
+
reduceWorklog,
|
|
192
|
+
resolveInterpreter,
|
|
193
|
+
useWorklog
|
|
194
|
+
};
|
|
195
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/worklog/types.ts","../../src/worklog/registry.ts","../../src/worklog/reducer.ts","../../src/worklog/use-worklog.ts","../../src/worklog/from-frame.ts"],"sourcesContent":["/** One granular Runtime worklog record (a `bus_mode` SSE frame or a `/worklog/{task_id}/events` item). */\nexport interface WorklogRecord {\n event_class: string;\n control_id: string | null;\n data: unknown;\n status: \"success\" | \"error\" | null;\n date_submitted: string;\n}\n\n/** Semantic bucket a node belongs to. */\nexport type NodeKind =\n | \"safeguard\"\n | \"reasoning\"\n | \"tool\"\n | \"a2a\"\n | \"memory\"\n | \"answer\"\n | \"unknown\";\n\n/** Lifecycle state of a single node. */\nexport type NodeStatus = \"pending\" | \"running\" | \"completed\" | \"failed\" | \"skipped\";\n\n/** Overall run status. */\nexport type RunStatus = \"idle\" | \"running\" | \"success\" | \"error\";\n\n/** A single step in the execution chain (command + its response merged by control_id). */\nexport interface WorklogNode {\n id: string;\n kind: NodeKind;\n eventClass: string;\n status: NodeStatus;\n title: string;\n startedAt?: string;\n endedAt?: string;\n depth: number;\n parentId?: string;\n children: WorklogNode[];\n command?: unknown;\n response?: unknown;\n error?: string;\n raw: WorklogRecord[];\n}\n\n/** Normalized execution model produced by the reducer. */\nexport interface WorklogState {\n taskId: string | null;\n status: RunStatus;\n answer: string | null;\n nodes: WorklogNode[];\n index: Record<string, number>;\n raw: WorklogRecord[];\n}\n\n/** How a record acts on the model. */\nexport type EventRole = \"open\" | \"close\" | \"run-open\" | \"run-close\" | \"ignore\";\n\n/** Registry descriptor for one event_class. */\nexport interface EventInterpreter {\n kind: NodeKind;\n role: EventRole;\n title: (record: WorklogRecord) => string;\n /** If true, an opened node starts in \"pending\" (awaiting external input) rather than \"running\". */\n pending?: boolean;\n}\n\nexport function initialWorklogState(taskId: string | null = null): WorklogState {\n return { taskId, status: \"idle\", answer: null, nodes: [], index: {}, raw: [] };\n}\n","import type { EventInterpreter, WorklogRecord } from \"./types\";\n\nconst asRecord = (data: unknown): Record<string, unknown> =>\n data && typeof data === \"object\" ? (data as Record<string, unknown>) : {};\n\nconst toolTitle = (r: WorklogRecord): string => {\n const name = asRecord(r.data).name;\n return typeof name === \"string\" && name.length > 0 ? `Tool: ${name}` : \"Tool\";\n};\n\nconst agentTitle = (r: WorklogRecord): string => {\n const name = asRecord(r.data).name;\n return typeof name === \"string\" && name.length > 0 ? `Agent: ${name}` : \"Agent-to-agent\";\n};\n\nconst constTitle = (label: string) => () => label;\n\nexport const EVENT_REGISTRY: Record<string, EventInterpreter> = {\n // Run envelope\n AssistantInference: { kind: \"answer\", role: \"run-open\", title: constTitle(\"Inference started\") },\n AssistantInferenceResponse: { kind: \"answer\", role: \"run-close\", title: constTitle(\"Answer\") },\n\n // Safeguard\n ShieldInference: { kind: \"safeguard\", role: \"open\", title: constTitle(\"Safeguard\") },\n ShieldInferenceResponse: { kind: \"safeguard\", role: \"close\", title: constTitle(\"Safeguard\") },\n\n // Reasoning\n ResponseInference: { kind: \"reasoning\", role: \"open\", title: constTitle(\"Reasoning\") },\n ResponseInferenceResponse: { kind: \"reasoning\", role: \"close\", title: constTitle(\"Reasoning\") },\n\n // Tools (server + subclasses) and their responses\n ServerToolExecution: { kind: \"tool\", role: \"open\", title: toolTitle },\n BuiltinToolExecution: { kind: \"tool\", role: \"open\", title: toolTitle },\n UnknownToolExecution: { kind: \"tool\", role: \"open\", title: toolTitle },\n ClientToolExecution: { kind: \"tool\", role: \"open\", title: toolTitle, pending: true },\n ToolExecutionResponse: { kind: \"tool\", role: \"close\", title: toolTitle },\n BuiltinToolExecutionResponse: { kind: \"tool\", role: \"close\", title: toolTitle },\n\n // Tool schema discovery\n ToolSchema: { kind: \"tool\", role: \"open\", title: constTitle(\"Tool schema\") },\n ToolSchemaResponse: { kind: \"tool\", role: \"close\", title: constTitle(\"Tool schema\") },\n\n // Agent-to-agent\n A2AInference: { kind: \"a2a\", role: \"open\", title: agentTitle },\n AgentDiscovery: { kind: \"a2a\", role: \"open\", title: constTitle(\"Agent discovery\") },\n AgentDiscoveryResponse: { kind: \"a2a\", role: \"close\", title: constTitle(\"Agent discovery\") },\n\n // Memory / persistence\n ContextPersistence: { kind: \"memory\", role: \"open\", title: constTitle(\"Memory persistence\") },\n ContextFlush: { kind: \"memory\", role: \"open\", title: constTitle(\"Memory flush\") },\n ContextFlushResponse: { kind: \"memory\", role: \"close\", title: constTitle(\"Memory flush\") },\n\n // Human approval\n HumanApprovalRequired: {\n kind: \"tool\",\n role: \"open\",\n title: constTitle(\"Human approval required\"),\n pending: true,\n },\n HumanApprovalRequiredResponse: { kind: \"tool\", role: \"close\", title: constTitle(\"Human approval\") },\n};\n\nexport function resolveInterpreter(eventClass: string): EventInterpreter {\n if (Object.prototype.hasOwnProperty.call(EVENT_REGISTRY, eventClass)) {\n return EVENT_REGISTRY[eventClass];\n }\n return {\n kind: \"unknown\",\n role: \"open\",\n title: (r: WorklogRecord) => r.event_class,\n };\n}\n","import { resolveInterpreter } from \"./registry\";\nimport type { EventInterpreter, WorklogNode, WorklogRecord, WorklogState } from \"./types\";\nimport { initialWorklogState } from \"./types\";\n\nconst asString = (v: unknown): string =>\n typeof v === \"string\" ? v : v == null ? \"\" : JSON.stringify(v);\n\nconst nodeDepth = (record: WorklogRecord): number => {\n const d = record.data && typeof record.data === \"object\"\n ? (record.data as Record<string, unknown>).depth\n : undefined;\n return typeof d === \"number\" ? d : 0;\n};\n\nconst makeOpenNode = (record: WorklogRecord, interp: EventInterpreter, id: string): WorklogNode => ({\n id,\n kind: interp.kind,\n eventClass: record.event_class,\n status: interp.pending ? \"pending\" : \"running\",\n title: interp.title(record),\n startedAt: record.date_submitted,\n depth: nodeDepth(record),\n children: [],\n command: record.data,\n raw: [record],\n});\n\nconst makeClosedNode = (record: WorklogRecord, interp: EventInterpreter, id: string): WorklogNode => ({\n id,\n kind: interp.kind,\n eventClass: record.event_class,\n status: record.status === \"error\" ? \"failed\" : \"completed\",\n title: interp.title(record),\n startedAt: record.date_submitted,\n endedAt: record.date_submitted,\n depth: nodeDepth(record),\n children: [],\n response: record.data,\n error: record.status === \"error\" ? asString(record.data) : undefined,\n raw: [record],\n});\n\nexport function reduceWorklog(state: WorklogState, record: WorklogRecord): WorklogState {\n const interp = resolveInterpreter(record.event_class);\n const next: WorklogState = {\n ...state,\n nodes: state.nodes.slice(),\n index: { ...state.index },\n raw: [...state.raw, record],\n };\n\n if (interp.role === \"ignore\") return next;\n\n if (interp.role === \"run-open\") {\n next.status = \"running\";\n return next;\n }\n\n if (interp.role === \"run-close\") {\n next.answer = asString(record.data) || null;\n next.status = record.status === \"error\" ? \"error\" : \"success\";\n return next;\n }\n\n const key = record.control_id ?? `${record.event_class}-${next.raw.length}`;\n\n if (interp.role === \"close\") {\n const pos = Object.prototype.hasOwnProperty.call(next.index, key) ? next.index[key] : undefined;\n if (pos != null) {\n const existing = next.nodes[pos];\n next.nodes[pos] = {\n ...existing,\n status: record.status === \"error\" ? \"failed\" : \"completed\",\n endedAt: record.date_submitted,\n response: record.data,\n error: record.status === \"error\" ? asString(record.data) : existing.error,\n raw: [...existing.raw, record],\n };\n } else {\n // response arrived without a seen command — create it already closed\n next.index[key] = next.nodes.length;\n next.nodes.push(makeClosedNode(record, interp, key));\n }\n if (record.status === \"error\") next.status = \"error\";\n return next;\n }\n\n // role === \"open\"\n const pos = Object.prototype.hasOwnProperty.call(next.index, key) ? next.index[key] : undefined;\n if (pos != null) {\n const existing = next.nodes[pos];\n next.nodes[pos] = { ...existing, raw: [...existing.raw, record] };\n } else {\n next.index[key] = next.nodes.length;\n next.nodes.push(makeOpenNode(record, interp, key));\n }\n return next;\n}\n\nexport function foldWorklog(records: WorklogRecord[], taskId: string | null = null): WorklogState {\n return records.reduce(reduceWorklog, initialWorklogState(taskId));\n}\n","import { useCallback, useReducer } from \"react\";\nimport { reduceWorklog } from \"./reducer\";\nimport { initialWorklogState, type WorklogRecord, type WorklogState } from \"./types\";\n\ntype Action =\n | { type: \"ingest\"; record: WorklogRecord }\n | { type: \"ingestMany\"; records: WorklogRecord[] }\n | { type: \"reset\"; taskId: string | null };\n\nfunction hookReducer(state: WorklogState, action: Action): WorklogState {\n switch (action.type) {\n case \"ingest\":\n return reduceWorklog(state, action.record);\n case \"ingestMany\":\n return action.records.reduce(reduceWorklog, state);\n case \"reset\":\n return initialWorklogState(action.taskId);\n }\n}\n\n/** Live worklog accumulator. Feed it `bus_mode` records via `ingest`; use `foldWorklog` for history. */\nexport function useWorklog(taskId: string | null = null) {\n const [worklog, dispatch] = useReducer(hookReducer, taskId, initialWorklogState);\n\n const ingest = useCallback((record: WorklogRecord) => dispatch({ type: \"ingest\", record }), []);\n const ingestMany = useCallback(\n (records: WorklogRecord[]) => dispatch({ type: \"ingestMany\", records }),\n [],\n );\n const reset = useCallback(\n (id: string | null = null) => dispatch({ type: \"reset\", taskId: id }),\n [],\n );\n\n return { worklog, ingest, ingestMany, reset };\n}\n","import type { WorklogRecord } from \"./types\";\n\n/** Loosely-typed shape of a parsed SSE `data:` frame from the granular Runtime stream. */\nexport interface RawFrame {\n event_class?: string;\n control_id?: string | null;\n data?: unknown;\n status?: string | null;\n date_submitted?: string;\n}\n\n/** Normalize a parsed SSE frame into a WorklogRecord (defaults missing fields; never throws). */\nexport function frameToRecord(frame: RawFrame): WorklogRecord {\n const status = frame.status === \"success\" || frame.status === \"error\" ? frame.status : null;\n return {\n event_class: typeof frame.event_class === \"string\" && frame.event_class.length > 0\n ? frame.event_class\n : \"Unknown\",\n control_id: frame.control_id ?? null,\n data: frame.data,\n status,\n date_submitted: typeof frame.date_submitted === \"string\" ? frame.date_submitted : \"\",\n };\n}\n"],"mappings":";AAiEO,SAAS,oBAAoB,SAAwB,MAAoB;AAC9E,SAAO,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE;AAC/E;;;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2
|
"name": "@alquimia-ai/tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"author": "Alquimia AI",
|
|
5
5
|
"description": "tools for Alquimia SDK",
|
|
6
6
|
"private": false,
|
|
@@ -61,6 +61,11 @@
|
|
|
61
61
|
"import": "./dist/utils/index.mjs",
|
|
62
62
|
"require": "./dist/utils/index.js"
|
|
63
63
|
},
|
|
64
|
+
"./worklog": {
|
|
65
|
+
"types": "./dist/worklog/index.d.ts",
|
|
66
|
+
"import": "./dist/worklog/index.mjs",
|
|
67
|
+
"require": "./dist/worklog/index.js"
|
|
68
|
+
},
|
|
64
69
|
"./types": {
|
|
65
70
|
"types": "./dist/types/index.d.ts",
|
|
66
71
|
"import": "./dist/types/index.mjs",
|