@dxos/assistant 0.8.4-main.f5c0578 → 0.8.4-main.fcfe5033a5
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/README.md +1 -0
- package/dist/lib/neutral/chunk-2TBLG3XY.mjs +1793 -0
- package/dist/lib/neutral/chunk-2TBLG3XY.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/extraction/index.mjs +219 -0
- package/dist/lib/neutral/extraction/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +537 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/testing/index.mjs +111 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/conversation/context.d.ts +130 -65
- package/dist/types/src/conversation/context.d.ts.map +1 -1
- package/dist/types/src/conversation/context.test.d.ts +2 -0
- package/dist/types/src/conversation/context.test.d.ts.map +1 -0
- package/dist/types/src/conversation/index.d.ts +1 -1
- package/dist/types/src/conversation/index.d.ts.map +1 -1
- package/dist/types/src/conversation/session.d.ts +78 -0
- package/dist/types/src/conversation/session.d.ts.map +1 -0
- package/dist/types/src/conversation/session.test.d.ts.map +1 -0
- package/dist/types/src/diff.d.ts +17 -0
- package/dist/types/src/diff.d.ts.map +1 -0
- package/dist/types/src/diff.test.d.ts +2 -0
- package/dist/types/src/diff.test.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +46 -18
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/execution-graph.d.ts +85 -0
- package/dist/types/src/execution-graph.d.ts.map +1 -0
- package/dist/types/src/execution-graph.test.d.ts +2 -0
- package/dist/types/src/execution-graph.test.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/index.d.ts +0 -1
- package/dist/types/src/extraction/extraction-ner-function/index.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction.d.ts +1066 -277
- package/dist/types/src/extraction/extraction.d.ts.map +1 -1
- package/dist/types/src/extraction/index.d.ts +0 -1
- package/dist/types/src/extraction/index.d.ts.map +1 -1
- package/dist/types/src/extraction/quotes.d.ts +3 -3
- package/dist/types/src/extraction/quotes.d.ts.map +1 -1
- package/dist/types/src/functions/services.d.ts +15 -5
- package/dist/types/src/functions/services.d.ts.map +1 -1
- package/dist/types/src/functions.test.d.ts +2 -0
- package/dist/types/src/functions.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/service/AgentService.d.ts +75 -0
- package/dist/types/src/service/AgentService.d.ts.map +1 -0
- package/dist/types/src/service/AgentService.test.d.ts +2 -0
- package/dist/types/src/service/AgentService.test.d.ts.map +1 -0
- package/dist/types/src/service/agent-process.d.ts +21 -0
- package/dist/types/src/service/agent-process.d.ts.map +1 -0
- package/dist/types/src/service/index.d.ts +3 -0
- package/dist/types/src/service/index.d.ts.map +1 -0
- package/dist/types/src/session/artifact-diff.d.ts +2 -2
- package/dist/types/src/session/artifact-diff.d.ts.map +1 -1
- package/dist/types/src/session/error-handling.d.ts +4 -0
- package/dist/types/src/session/error-handling.d.ts.map +1 -0
- package/dist/types/src/session/format.d.ts +9 -161
- package/dist/types/src/session/format.d.ts.map +1 -1
- package/dist/types/src/session/index.d.ts +4 -1
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/observer.d.ts +23 -0
- package/dist/types/src/session/observer.d.ts.map +1 -0
- package/dist/types/src/session/request.d.ts +106 -0
- package/dist/types/src/session/request.d.ts.map +1 -0
- package/dist/types/src/session/request.test.d.ts +2 -0
- package/dist/types/src/session/request.test.d.ts.map +1 -0
- package/dist/types/src/session/session-ollama.test.d.ts +2 -0
- package/dist/types/src/session/session-ollama.test.d.ts.map +1 -0
- package/dist/types/src/session/toolkit.d.ts +16 -0
- package/dist/types/src/session/toolkit.d.ts.map +1 -0
- package/dist/types/src/session/version-pin.d.ts +4 -4
- package/dist/types/src/session/version-pin.d.ts.map +1 -1
- package/dist/types/src/templates/system.d.ts +7 -12
- package/dist/types/src/templates/system.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/layer.d.ts +40 -0
- package/dist/types/src/testing/layer.d.ts.map +1 -0
- package/dist/types/src/tracing.d.ts +223 -0
- package/dist/types/src/tracing.d.ts.map +1 -0
- package/dist/types/src/types/artifact.d.ts +28 -0
- package/dist/types/src/types/artifact.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -36
- package/src/conversation/context.test.ts +52 -0
- package/src/conversation/context.ts +338 -68
- package/src/conversation/index.ts +1 -1
- package/src/conversation/session.test.ts +58 -0
- package/src/conversation/session.ts +300 -0
- package/src/diff.test.ts +74 -0
- package/src/diff.ts +93 -0
- package/src/errors.ts +6 -1
- package/src/execution-graph.test.ts +740 -0
- package/src/execution-graph.ts +509 -0
- package/src/extraction/extraction-ner-function/index.ts +0 -1
- package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +12 -6
- package/src/extraction/extraction-ner-function/named-entity-recognition.ts +2 -0
- package/src/extraction/extraction.ts +44 -15
- package/src/extraction/index.ts +0 -1
- package/src/extraction/quotes.test.ts +2 -2
- package/src/extraction/quotes.ts +6 -7
- package/src/functions/services.ts +166 -66
- package/src/functions.conversations.json +1 -0
- package/src/functions.test.ts +88 -0
- package/src/index.ts +5 -1
- package/src/service/AgentService.conversations.json +1 -0
- package/src/service/AgentService.test.ts +169 -0
- package/src/service/AgentService.ts +184 -0
- package/src/service/agent-process.ts +364 -0
- package/src/service/index.ts +6 -0
- package/src/session/artifact-diff.ts +8 -4
- package/src/session/error-handling.ts +41 -0
- package/src/session/format.test.ts +113 -41
- package/src/session/format.ts +39 -29
- package/src/session/index.ts +4 -1
- package/src/session/observer.ts +62 -0
- package/src/session/request.conversations.json +1 -0
- package/src/session/request.test.ts +195 -0
- package/src/session/request.ts +344 -0
- package/src/session/session-ollama.test.ts +81 -0
- package/src/session/toolkit.ts +47 -0
- package/src/session/version-pin.ts +7 -7
- package/src/templates/{format.tpl → instructions/format.tpl} +6 -4
- package/src/templates/{system.tpl → instructions/system.tpl} +52 -14
- package/src/templates/system.ts +26 -17
- package/src/testing/index.ts +5 -0
- package/src/testing/layer.ts +236 -0
- package/src/tracing.ts +43 -0
- package/src/{types.ts → types/artifact.ts} +44 -7
- package/src/types/index.ts +5 -0
- package/dist/lib/browser/chunk-6WRGDEMH.mjs +0 -89
- package/dist/lib/browser/chunk-6WRGDEMH.mjs.map +0 -7
- package/dist/lib/browser/chunk-AVKQ32JL.mjs +0 -352
- package/dist/lib/browser/chunk-AVKQ32JL.mjs.map +0 -7
- package/dist/lib/browser/extraction/index.mjs +0 -269
- package/dist/lib/browser/extraction/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -355
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/named-entity-recognition-O46UTCLR.mjs +0 -13
- package/dist/lib/node-esm/chunk-3UU5V4FS.mjs +0 -91
- package/dist/lib/node-esm/chunk-3UU5V4FS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MNAVETJA.mjs +0 -354
- package/dist/lib/node-esm/chunk-MNAVETJA.mjs.map +0 -7
- package/dist/lib/node-esm/extraction/index.mjs +0 -270
- package/dist/lib/node-esm/extraction/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -356
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/named-entity-recognition-W4VMRCH6.mjs +0 -14
- package/dist/lib/node-esm/named-entity-recognition-W4VMRCH6.mjs.map +0 -7
- package/dist/types/src/conversation/conversation.d.ts +0 -49
- package/dist/types/src/conversation/conversation.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +0 -4
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +0 -2
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-llm-function/index.d.ts +0 -2
- package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +0 -306
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +0 -2
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +0 -1
- package/dist/types/src/session/session.d.ts +0 -170
- package/dist/types/src/session/session.d.ts.map +0 -1
- package/dist/types/src/session/session.test.d.ts.map +0 -1
- package/dist/types/src/session/version-pin.test.d.ts +0 -2
- package/dist/types/src/session/version-pin.test.d.ts.map +0 -1
- package/dist/types/src/summarization/summarization.test.d.ts +0 -2
- package/dist/types/src/summarization/summarization.test.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -16
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/conversation/conversation.ts +0 -127
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +0 -84
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +0 -71
- package/src/extraction/extraction-llm-function/index.ts +0 -5
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +0 -116
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +0 -57
- package/src/session/__snapshots__/session.test.ts.snap +0 -32
- package/src/session/session.test.ts +0 -308
- package/src/session/session.ts +0 -303
- package/src/session/version-pin.test.ts +0 -7
- package/src/summarization/summarization.test.ts +0 -197
- /package/dist/lib/{browser/named-entity-recognition-O46UTCLR.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/types/src/{session → conversation}/session.test.d.ts +0 -0
- /package/src/extraction/extraction-llm-function/{instructions.tpl → transcription-instructions.tpl} +0 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AGENT_PROCESS_KEY,
|
|
3
|
+
AgentRequestBegin,
|
|
4
|
+
AgentRequestEnd,
|
|
5
|
+
AgentService_exports,
|
|
6
|
+
AiAssistantError,
|
|
7
|
+
AiContextBinder,
|
|
8
|
+
AiContextService,
|
|
9
|
+
AiModelError,
|
|
10
|
+
AiRequest,
|
|
11
|
+
AiSession,
|
|
12
|
+
AiSessionService,
|
|
13
|
+
ArtifactDiffResolver,
|
|
14
|
+
ArtifactId,
|
|
15
|
+
Bindings,
|
|
16
|
+
CompleteBlock,
|
|
17
|
+
ContextBinding,
|
|
18
|
+
GenerationObserver,
|
|
19
|
+
PartialBlock,
|
|
20
|
+
RefFromLLM,
|
|
21
|
+
ToolExecutionServices,
|
|
22
|
+
VersionPin,
|
|
23
|
+
createArtifactElement,
|
|
24
|
+
createToolkit,
|
|
25
|
+
formatSystemPrompt,
|
|
26
|
+
formatUserPrompt,
|
|
27
|
+
getOperationFromTool,
|
|
28
|
+
makeToolExecutionService,
|
|
29
|
+
makeToolExecutionServiceFromOperationInvoker,
|
|
30
|
+
makeToolResolverFromOperations
|
|
31
|
+
} from "./chunk-2TBLG3XY.mjs";
|
|
32
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
33
|
+
|
|
34
|
+
// src/diff.ts
|
|
35
|
+
import { next as A } from "@automerge/automerge";
|
|
36
|
+
import { DocAccessor, toCursorRange } from "@dxos/echo-db";
|
|
37
|
+
import { log } from "@dxos/log";
|
|
38
|
+
import { isNonNullable } from "@dxos/util";
|
|
39
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/core/assistant/src/diff.ts";
|
|
40
|
+
var reduceDiffs = (diffs) => {
|
|
41
|
+
return diffs.reduce((acc, diff) => {
|
|
42
|
+
const current = acc[acc.length - 1];
|
|
43
|
+
const [op, ...rest] = diff.split(" ");
|
|
44
|
+
switch (op) {
|
|
45
|
+
case "-": {
|
|
46
|
+
if (current && !current.match) {
|
|
47
|
+
current.match += rest.join(" ");
|
|
48
|
+
} else {
|
|
49
|
+
acc.push({
|
|
50
|
+
match: rest.join(" "),
|
|
51
|
+
replace: ""
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return acc;
|
|
55
|
+
}
|
|
56
|
+
case "+": {
|
|
57
|
+
if (current && !current.replace) {
|
|
58
|
+
current.replace += rest.join(" ");
|
|
59
|
+
} else {
|
|
60
|
+
acc.push({
|
|
61
|
+
match: "",
|
|
62
|
+
replace: rest.join(" ")
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return acc;
|
|
66
|
+
}
|
|
67
|
+
default: {
|
|
68
|
+
throw new Error(`Invalid diff format: each line must start with "- " or "+ ", got: ${JSON.stringify(diff)}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}, []);
|
|
72
|
+
};
|
|
73
|
+
var computeDiffsWithCursors = (accessor, diffs) => {
|
|
74
|
+
return reduceDiffs(diffs).map((diff) => {
|
|
75
|
+
const text = DocAccessor.getValue(accessor);
|
|
76
|
+
const idx = text.indexOf(diff.match);
|
|
77
|
+
if (idx !== -1) {
|
|
78
|
+
return {
|
|
79
|
+
cursor: toCursorRange(accessor, idx, idx + diff.match.length),
|
|
80
|
+
text: diff.replace
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}).filter(isNonNullable);
|
|
84
|
+
};
|
|
85
|
+
var applyDiffs = (accessor, diffs, { errorOnNotFound = false } = {}) => {
|
|
86
|
+
for (const diff of reduceDiffs(diffs)) {
|
|
87
|
+
accessor.handle.change((doc) => {
|
|
88
|
+
const text = DocAccessor.getValue(accessor);
|
|
89
|
+
const idx = text.indexOf(diff.match);
|
|
90
|
+
if (idx !== -1) {
|
|
91
|
+
A.splice(doc, accessor.path, idx, diff.match.length, diff.replace);
|
|
92
|
+
} else {
|
|
93
|
+
if (errorOnNotFound) {
|
|
94
|
+
throw new Error(`Diff not found: ${diff.match}`);
|
|
95
|
+
} else {
|
|
96
|
+
log.warn("diff not found", diff, {
|
|
97
|
+
F: __dxlog_file,
|
|
98
|
+
L: 86,
|
|
99
|
+
S: void 0,
|
|
100
|
+
C: (f, a) => f(...a)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return DocAccessor.getValue(accessor);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// src/execution-graph.ts
|
|
110
|
+
import { AgentStatus } from "@dxos/ai";
|
|
111
|
+
import { Obj } from "@dxos/echo";
|
|
112
|
+
import { MESSAGE_PROPERTY_TOOL_CALL_ID } from "@dxos/functions";
|
|
113
|
+
import { LogLevel } from "@dxos/log";
|
|
114
|
+
import { ContentBlock, Message } from "@dxos/types";
|
|
115
|
+
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
116
|
+
var SKIP_BLOCKS = [
|
|
117
|
+
"text"
|
|
118
|
+
];
|
|
119
|
+
var ExecutionGraph = class {
|
|
120
|
+
_skipBlocks;
|
|
121
|
+
// TODO(dmaretskyi): Evolve the internal state to support chats, functions, circuit workflows, etc.
|
|
122
|
+
_commits = [];
|
|
123
|
+
_branchNames = /* @__PURE__ */ new Set();
|
|
124
|
+
_lastBlockId;
|
|
125
|
+
// Tool call tracking.
|
|
126
|
+
_toolCallCommitIds = /* @__PURE__ */ new Map();
|
|
127
|
+
_lastCommitByBranch = /* @__PURE__ */ new Map();
|
|
128
|
+
_pendingToolResults = /* @__PURE__ */ new Map();
|
|
129
|
+
constructor(_skipBlocks = SKIP_BLOCKS) {
|
|
130
|
+
this._skipBlocks = _skipBlocks;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Adds events to the graph.
|
|
134
|
+
*/
|
|
135
|
+
addEvents(events) {
|
|
136
|
+
const sortedEvents = this.sortObjectsByCreated(events);
|
|
137
|
+
for (const event of sortedEvents) {
|
|
138
|
+
if (Obj.instanceOf(Message.Message, event)) {
|
|
139
|
+
this._processMessage(event);
|
|
140
|
+
} else if (Obj.instanceOf(AgentStatus, event)) {
|
|
141
|
+
this._processAgentStatus(event);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Processes a message event and creates commits for its blocks.
|
|
147
|
+
*/
|
|
148
|
+
_processMessage(message) {
|
|
149
|
+
const messageCommits = messageToCommits(message, this._lastBlockId, this._toolCallCommitIds, this._lastCommitByBranch, this._skipBlocks);
|
|
150
|
+
this._commits.push(...messageCommits);
|
|
151
|
+
messageCommits.forEach((commit) => this._branchNames.add(commit.branch));
|
|
152
|
+
this._trackToolCalls(messageCommits);
|
|
153
|
+
if (messageCommits.length > 0) {
|
|
154
|
+
this._lastBlockId = messageCommits[messageCommits.length - 1].id;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Processes an AgentStatus event.
|
|
159
|
+
*/
|
|
160
|
+
_processAgentStatus(event) {
|
|
161
|
+
const branch = this._getToolCallBranch(event.parentMessage, event.toolCallId);
|
|
162
|
+
this._branchNames.add(branch);
|
|
163
|
+
const agentStatusCommit = {
|
|
164
|
+
id: event.id,
|
|
165
|
+
branch,
|
|
166
|
+
message: event.message,
|
|
167
|
+
icon: "ph--flag--regular",
|
|
168
|
+
parents: this._getAgentStatusParents(event),
|
|
169
|
+
timestamp: new Date(event.created)
|
|
170
|
+
};
|
|
171
|
+
this._commits.push(agentStatusCommit);
|
|
172
|
+
this._lastBlockId = event.id;
|
|
173
|
+
if (event.toolCallId) {
|
|
174
|
+
this._lastCommitByBranch.set(branch, event.id);
|
|
175
|
+
this._updatePendingToolResults(event.toolCallId, event.id);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Stable sort: objects with 'created' field are sorted by it, others remain in place.
|
|
180
|
+
*/
|
|
181
|
+
sortObjectsByCreated(objects) {
|
|
182
|
+
const sortedObjects = objects.slice();
|
|
183
|
+
const createdObjects = [];
|
|
184
|
+
sortedObjects.forEach((obj, idx) => {
|
|
185
|
+
if (obj && typeof obj.created === "string") {
|
|
186
|
+
createdObjects.push({
|
|
187
|
+
idx,
|
|
188
|
+
obj
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
createdObjects.sort((a, b) => {
|
|
193
|
+
const aDate = new Date(a.obj.created).getTime();
|
|
194
|
+
const bDate = new Date(b.obj.created).getTime();
|
|
195
|
+
return aDate - bDate;
|
|
196
|
+
});
|
|
197
|
+
let createdIdx = 0;
|
|
198
|
+
return sortedObjects.map((obj, _idx) => {
|
|
199
|
+
if (obj && typeof obj.created === "string") {
|
|
200
|
+
return createdObjects[createdIdx++].obj;
|
|
201
|
+
}
|
|
202
|
+
return obj;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Returns the current state of the graph.
|
|
207
|
+
*/
|
|
208
|
+
getGraph(lastRequest = false) {
|
|
209
|
+
const idx = lastRequest ? this._commits.findLastIndex((c) => c.tags?.includes("user")) : -1;
|
|
210
|
+
const commits = idx === -1 ? this._commits : this._commits.slice(idx);
|
|
211
|
+
return {
|
|
212
|
+
branches: Array.from(this._branchNames),
|
|
213
|
+
commits
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Tracks tool calls and handles pending tool result updates.
|
|
218
|
+
*/
|
|
219
|
+
_trackToolCalls(commits) {
|
|
220
|
+
commits.forEach((commit) => {
|
|
221
|
+
if (this._isToolCallCommit(commit)) {
|
|
222
|
+
const toolCallId = this._extractToolCallId(commit.id);
|
|
223
|
+
if (toolCallId) {
|
|
224
|
+
this._toolCallCommitIds.set(toolCallId, commit.id);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (this._isToolResultCommit(commit)) {
|
|
228
|
+
const toolCallId = this._extractToolCallId(commit.id);
|
|
229
|
+
if (toolCallId) {
|
|
230
|
+
this._pendingToolResults.set(toolCallId, commit.id);
|
|
231
|
+
this._handleLateToolResultUpdate(toolCallId, commit.id);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
this._lastCommitByBranch.set(commit.branch, commit.id);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Updates pending tool results to point to an AgentStatus event.
|
|
239
|
+
*/
|
|
240
|
+
_updatePendingToolResults(toolCallId, agentStatusId) {
|
|
241
|
+
const toolResultId = this._pendingToolResults.get(toolCallId);
|
|
242
|
+
if (!toolResultId) return;
|
|
243
|
+
const toolResultCommit = this._commits.find((c) => c.id === toolResultId);
|
|
244
|
+
if (!toolResultCommit) return;
|
|
245
|
+
const toolCallCommitId = this._toolCallCommitIds.get(toolCallId);
|
|
246
|
+
if (!toolCallCommitId) return;
|
|
247
|
+
const toolCallIndex = toolResultCommit.parents.indexOf(toolCallCommitId);
|
|
248
|
+
if (toolCallIndex !== -1) {
|
|
249
|
+
toolResultCommit.parents[toolCallIndex] = agentStatusId;
|
|
250
|
+
}
|
|
251
|
+
this._pendingToolResults.delete(toolCallId);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Handles late updates when AgentStatus is processed before tool result.
|
|
255
|
+
*/
|
|
256
|
+
_handleLateToolResultUpdate(toolCallId, toolResultId) {
|
|
257
|
+
const toolCallCommitId = this._toolCallCommitIds.get(toolCallId);
|
|
258
|
+
if (!toolCallCommitId) return;
|
|
259
|
+
const messageId = toolCallCommitId.split("_toolCall_")[0];
|
|
260
|
+
const toolCallBranch = `${messageId}_${toolCallId}`;
|
|
261
|
+
const agentStatusCommitId = this._lastCommitByBranch.get(toolCallBranch);
|
|
262
|
+
if (agentStatusCommitId && agentStatusCommitId !== toolCallCommitId) {
|
|
263
|
+
const toolResultCommit = this._commits.find((c) => c.id === toolResultId);
|
|
264
|
+
if (toolResultCommit) {
|
|
265
|
+
const toolCallIndex = toolResultCommit.parents.indexOf(toolCallCommitId);
|
|
266
|
+
if (toolCallIndex !== -1) {
|
|
267
|
+
toolResultCommit.parents[toolCallIndex] = agentStatusCommitId;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
this._pendingToolResults.delete(toolCallId);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Gets the branch name for a tool call.
|
|
275
|
+
*/
|
|
276
|
+
_getToolCallBranch(parentMessage, toolCallId) {
|
|
277
|
+
if (toolCallId) {
|
|
278
|
+
return toolCallId;
|
|
279
|
+
}
|
|
280
|
+
return parentMessage || "main";
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Gets the parents for an AgentStatus commit.
|
|
284
|
+
*/
|
|
285
|
+
_getAgentStatusParents(event) {
|
|
286
|
+
if (event.parentMessage && event.toolCallId) {
|
|
287
|
+
return [
|
|
288
|
+
getToolCallId(event.parentMessage, event.toolCallId)
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
return [];
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Checks if a commit is a tool call commit.
|
|
295
|
+
*/
|
|
296
|
+
_isToolCallCommit(commit) {
|
|
297
|
+
return commit.message.includes("Calling tool");
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Checks if a commit is a tool result commit.
|
|
301
|
+
*/
|
|
302
|
+
_isToolResultCommit(commit) {
|
|
303
|
+
return commit.message.includes("Tool call succeeded") || commit.message.includes("Tool error:");
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Extracts tool call ID from a commit ID.
|
|
307
|
+
*/
|
|
308
|
+
_extractToolCallId(commitId) {
|
|
309
|
+
const toolCallMatch = commitId.match(/_toolCall_(.+)$/);
|
|
310
|
+
const toolResultMatch = commitId.match(/_toolResult_(.+)$/);
|
|
311
|
+
return toolCallMatch?.[1] || toolResultMatch?.[1];
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
var messageToCommits = (message, lastBlockId, toolCallIds, lastCommitByBranch, skipBlocks) => {
|
|
315
|
+
let previousBlockId = lastBlockId;
|
|
316
|
+
return message.blocks.map((block, idx) => {
|
|
317
|
+
const branch = getMessageBranch(message);
|
|
318
|
+
const parents = getBlockParents(block, previousBlockId, message, toolCallIds, lastCommitByBranch);
|
|
319
|
+
if (skipBlocks?.includes(block._tag)) {
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
const commit = createBlockCommit(block, message, branch, parents, idx);
|
|
323
|
+
if (commit) {
|
|
324
|
+
previousBlockId = commit.id;
|
|
325
|
+
}
|
|
326
|
+
return commit;
|
|
327
|
+
}).filter(isNonNullable2);
|
|
328
|
+
};
|
|
329
|
+
var getBlockParents = (block, previousBlockId, message, toolCallIds, lastCommitByBranch) => {
|
|
330
|
+
const parents = [];
|
|
331
|
+
if (block._tag === "toolResult") {
|
|
332
|
+
if (previousBlockId) {
|
|
333
|
+
parents.push(previousBlockId);
|
|
334
|
+
}
|
|
335
|
+
const toolCallCommitId = toolCallIds?.get(block.toolCallId);
|
|
336
|
+
if (toolCallCommitId) {
|
|
337
|
+
const toolCallBranch = getToolCallBranchFromCommitId(toolCallCommitId, block.toolCallId);
|
|
338
|
+
const lastBlockFromToolCallBranch = lastCommitByBranch?.get(toolCallBranch);
|
|
339
|
+
if (lastBlockFromToolCallBranch) {
|
|
340
|
+
parents.push(lastBlockFromToolCallBranch);
|
|
341
|
+
} else {
|
|
342
|
+
parents.push(toolCallCommitId);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
} else {
|
|
346
|
+
if (previousBlockId) {
|
|
347
|
+
parents.push(previousBlockId);
|
|
348
|
+
} else {
|
|
349
|
+
const toolCallParent = getParentId(message);
|
|
350
|
+
if (toolCallParent) {
|
|
351
|
+
parents.push(toolCallParent);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return parents;
|
|
356
|
+
};
|
|
357
|
+
var createBlockCommit = (block, message, branch, parents, idx) => {
|
|
358
|
+
const timestamp = new Date(message.created);
|
|
359
|
+
switch (block._tag) {
|
|
360
|
+
case "text":
|
|
361
|
+
if (!block.text.trim().length) return null;
|
|
362
|
+
return {
|
|
363
|
+
id: getGenericBlockId(message.id, idx),
|
|
364
|
+
branch,
|
|
365
|
+
parents,
|
|
366
|
+
timestamp,
|
|
367
|
+
...message.sender.role === "user" ? {
|
|
368
|
+
icon: "ph--user--regular",
|
|
369
|
+
tags: [
|
|
370
|
+
"user"
|
|
371
|
+
],
|
|
372
|
+
message: "Processing request..."
|
|
373
|
+
} : {
|
|
374
|
+
icon: "ph--drone--regular",
|
|
375
|
+
message: `Response (${block.text.split(" ").length} words)`
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
case "toolCall":
|
|
379
|
+
return {
|
|
380
|
+
id: getToolCallId(message.id, block.toolCallId),
|
|
381
|
+
branch,
|
|
382
|
+
parents,
|
|
383
|
+
timestamp,
|
|
384
|
+
icon: "ph--wrench--regular",
|
|
385
|
+
level: LogLevel.INFO,
|
|
386
|
+
message: `Calling tool (${block.name})`
|
|
387
|
+
};
|
|
388
|
+
case "toolResult":
|
|
389
|
+
return {
|
|
390
|
+
id: getToolResultId(message.id, block.toolCallId),
|
|
391
|
+
branch,
|
|
392
|
+
parents,
|
|
393
|
+
timestamp,
|
|
394
|
+
icon: block.error ? "ph--x-circle--regular" : "ph--check-circle--regular",
|
|
395
|
+
level: block.error ? LogLevel.ERROR : LogLevel.INFO,
|
|
396
|
+
message: block.error ? "Tool error: " + block.error : "Tool call succeeded"
|
|
397
|
+
};
|
|
398
|
+
case "stats":
|
|
399
|
+
return {
|
|
400
|
+
id: getGenericBlockId(message.id, idx),
|
|
401
|
+
branch,
|
|
402
|
+
parents,
|
|
403
|
+
timestamp,
|
|
404
|
+
icon: "ph--rocket--regular",
|
|
405
|
+
level: LogLevel.INFO,
|
|
406
|
+
message: ContentBlock.createStatsMessage(block)
|
|
407
|
+
};
|
|
408
|
+
case "status":
|
|
409
|
+
return {
|
|
410
|
+
id: getGenericBlockId(message.id, idx),
|
|
411
|
+
branch,
|
|
412
|
+
parents,
|
|
413
|
+
timestamp,
|
|
414
|
+
message: block.statusText,
|
|
415
|
+
level: LogLevel.INFO,
|
|
416
|
+
icon: "ph--flag--regular"
|
|
417
|
+
};
|
|
418
|
+
case "reasoning":
|
|
419
|
+
return {
|
|
420
|
+
id: getGenericBlockId(message.id, idx),
|
|
421
|
+
branch,
|
|
422
|
+
parents,
|
|
423
|
+
timestamp,
|
|
424
|
+
message: block.reasoningText ?? "Thinking...",
|
|
425
|
+
icon: "ph--brain--regular"
|
|
426
|
+
};
|
|
427
|
+
case "reference":
|
|
428
|
+
return {
|
|
429
|
+
id: getGenericBlockId(message.id, idx),
|
|
430
|
+
branch,
|
|
431
|
+
parents,
|
|
432
|
+
timestamp,
|
|
433
|
+
icon: "ph--link--regular",
|
|
434
|
+
message: stringifyRef(block.reference)
|
|
435
|
+
};
|
|
436
|
+
default:
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
var getToolCallBranchFromCommitId = (toolCallCommitId, toolCallId) => {
|
|
441
|
+
const messageId = toolCallCommitId.split("_toolCall_")[0];
|
|
442
|
+
return `${messageId}_${toolCallId}`;
|
|
443
|
+
};
|
|
444
|
+
var getToolCallId = (messageId, toolCallId) => `${messageId}_toolCall_${toolCallId}`;
|
|
445
|
+
var getToolResultId = (messageId, toolCallId) => `${messageId}_toolResult_${toolCallId}`;
|
|
446
|
+
var getGenericBlockId = (messageId, idx) => `${messageId}_block_${idx}`;
|
|
447
|
+
var getBranchName = (options) => {
|
|
448
|
+
if (options.toolCallId) {
|
|
449
|
+
return options.toolCallId;
|
|
450
|
+
} else if (options.parentMessage) {
|
|
451
|
+
return options.parentMessage;
|
|
452
|
+
} else {
|
|
453
|
+
return "main";
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
var getMessageBranch = (message) => {
|
|
457
|
+
return getBranchName({
|
|
458
|
+
parentMessage: message.parentMessage,
|
|
459
|
+
toolCallId: message.properties?.[MESSAGE_PROPERTY_TOOL_CALL_ID]
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
var getParentId = (message) => {
|
|
463
|
+
if (message.parentMessage && message.properties?.[MESSAGE_PROPERTY_TOOL_CALL_ID]) {
|
|
464
|
+
return getToolCallId(message.parentMessage, message.properties[MESSAGE_PROPERTY_TOOL_CALL_ID]);
|
|
465
|
+
} else {
|
|
466
|
+
return void 0;
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
var stringifyRef = (ref) => {
|
|
470
|
+
if (ref.target) {
|
|
471
|
+
return stringifyObject(ref.target);
|
|
472
|
+
}
|
|
473
|
+
return ref.dxn.asEchoDXN()?.echoId ?? ref.dxn.asQueueDXN()?.objectId ?? "";
|
|
474
|
+
};
|
|
475
|
+
var stringifyObject = (obj) => {
|
|
476
|
+
return Obj.getLabel(obj) ?? Obj.getTypename(obj) ?? obj.id;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
// src/templates/system.ts
|
|
480
|
+
import defaultsDeep from "lodash.defaultsdeep";
|
|
481
|
+
import { Template } from "@dxos/blueprints";
|
|
482
|
+
|
|
483
|
+
// raw-loader:/__w/dxos/dxos/packages/core/assistant/src/templates/instructions/format.tpl?raw
|
|
484
|
+
var format_default = "{{! System Core }}\n\n## Input Formats\n\n### Blueprints\n\nYou may be provided with Blueprint definitions that include specific instructions and tools for a given set of tasks.\nBlue print instructions will be enclosed in a <blueprint> tag.\n\n### Context objects\n\nYou may be provided with references to objects that are relevant to the current prompt.\nObjects will be in the form of a <object> tag with a <dxn> element that is the unique key of the object required by many tools.\nThe <typename> element is the type of the object.\n\n<object>\n <dxn>object-id</dxn>\n <typename>example.com/type/TypeName</typename>\n</object>\n\n## Response Formats\n\nIt is very important to respond in the correct format.\nYou response must be valid Markdown.\nIn some cases you should respond with well-formed XML tags along with the content.\nCode snippets should use 2-space indents.\n\n{{#if cot}}\nBefore responding, explain your reasoning and include your detailed chain-of-thought enclosed in a <cot> tag.\nThe <cot> tag should be the first thing in your response.\n{{/if}}\n\n## Block references\n\nYou can reply with a block reference for objects if you have the DXN. For example:\n\n<object>\n <dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M</dxn>\n</object>\n<object>\n <dxn>dxn:echo:@:01K24XPK464FSCKVQJAB2H662M</dxn>\n</object>\n\n### Suggestions\n\nEach suggestion must in the form of a proposed action enclosed in a <suggestion> tag.\nExample: <suggestion>Show on a map</suggestion>\nDo not use bullets when listing suggestions.\n\n### Multiple choice questions\n\nYou may ask multiple choice questions by wrapping consise options inside <option> tags inside a well formed <select> tag.\nExample: <select><option>Yes</option><option>No</option></select>\n\n## Context\n\nThe current date and time is {{DATETIME}}.\n";
|
|
485
|
+
|
|
486
|
+
// raw-loader:/__w/dxos/dxos/packages/core/assistant/src/templates/instructions/system.tpl?raw
|
|
487
|
+
var system_default = "{{! System Prompt }}\n\n- You are a helpful assistant called Kai. \n- Your name is Kai and you are powered by different language models.\n- You were created by DXOS and operate inside of Composer and on the DXOS EDGE network.\n- In your initial greeting state your name and make some suggestions based on the current context objects.\n- You are an advanced AI assistant capable of creating and managing artifacts from provided data and tools.\n- Your task is to process user commands and questions and decide how best to respond.\n- In general be concise and direct.\n- Follow all instructions carefully.\n\n## Planning\n\n- Analyze the structure and type of the content in the user's message.\n- Determine if you complete the task using the available blueprint definitions?\n- If you can't complete the task using the available blueprint definitions, query the list of available blueprint definitions using the appropriate tool.\n- Identify which blueprint definitions are relevant to the user's request.\n- Evaluate the potential benefits of creating an artifact vs. normal processing for each identified element.\n- Make a final decision on whether to create an artifact and explain your reasoning.\n- Are the required blueprint definitions already available?\n- If not, select which blueprint definition(s) will be the most relevant and require them using the require_artifact_definitions tool.\n- The require'd artifact tools will be available for use after require.\n- If creating an artifact, outline how you will structure it within the response.\n- Decide if the artifact needs to be shown to the user.\n- Call the show tool to show the artifact to the user.\n- Your reasoning must include: whether to use artifacts or not, to create one or query, whether to show the artifact to the user, and how to structure the response.\n\n## Blueprints and Artifacts\n\n- Determine if the interaction involves an artifact. Prefer artifacts for tables, lists, spreadsheets, kanbans, games, images, and other structured data.\n- Determine if the user is explicitly talking about creating a new artifact, or wants to use an existing artifact.\n- If it is ambiguous, query for existing artifacts first and then decide.\n- If you decide to create an artifact, call the associated tool to create the artifact.\n- Artifacts are stored in the database. Tools are used to create and query artifacts.\n- If you are unsure about creating an artifact ask the user for clarification.\n- Artifacts are mutable objects that can change over the course of the conversation.\n- Always re-query the artifact using the tool (like query or inspect) to get the latest state of the artifact before answering the user.\n- You must never generate the id of the artifact; only recall the ids that are already in the history.\n- Artifacts are created by requiring the specific artifact using the require_artifact tool and creating it by calling the associated tool.\n- You can add suggested actions at the end of your response.\n- Suggested actions should be very concise and start with a verb and be phrased as a command to an agent -- not a question to the user.\n- Suggested actions must be in the form of a user instruction that you can follow.\n- Suggested actions could include actions that create artifacts.\n- After creating an artifact use a tool to add it to the chat context.\n\n## Navigation\n\n- When the user asks to open, go to, navigate to, or show a specific document, page, or object, use the navigation tools instead of loading content inline.\n- First, call the Resolve navigation targets tool to find the navigation path for the requested item.\n - Without arguments, it returns available pages that can be navigated to.\n - With a DXN in the query, it resolves that specific object to a navigation path.\n- If you know the object's DXN (e.g. from a database query or context objects), pass it in the query to get the exact navigation path.\n- Then, call the Open tool with the resolved navigation path(s) in the subject array to navigate the user to that item.\n- Do not respond with the document's content when the user asks to open it \u2014 open it in the main content area instead.\n- If multiple targets match, present the options to the user and let them choose which to open.\n\n## Response format\n\n- When updating the user about the progress of the work you are doing, put the update in a <status> XML tag.\n- Only when you need to show the result to the user or ask a question use a text block without status tags.\n\n<example>\n// reasoning...\n<status>Looking for emails from Depot</status>\n// tool call..\n<status>Found 2 emails from Depot.</status>\n<status>Loading email details</status>\n// tool call\n<status>Located mailbox</status>\nI found **2 emails from Depot**:\n</example>\n\nDo not do (no status tags):\n\n<incorrect_example>\n// reasoning...\n// tool call..\nI found 2 emails from Depot. Let me load their details:\n// tool call\nI found **2 emails from Depot**:\n</incorrect_example>\n\n- Avoid using plain text to tell the user what you are about to do; instead, use status blocks.\n- WRONG: Let me get...\n- CORRECT: <status>Getting...</status>";
|
|
488
|
+
|
|
489
|
+
// src/templates/system.ts
|
|
490
|
+
var createSystemPrompt = (options = {}) => Template.process(format_default, defaultsDeep(options, {
|
|
491
|
+
DATETIME: (/* @__PURE__ */ new Date()).toISOString()
|
|
492
|
+
}));
|
|
493
|
+
var SYSTEM_ID = "01K2J2FZWH39F55CS7B26GP1Q3";
|
|
494
|
+
var templates = {
|
|
495
|
+
system: Template.make({
|
|
496
|
+
id: SYSTEM_ID,
|
|
497
|
+
source: system_default
|
|
498
|
+
})
|
|
499
|
+
};
|
|
500
|
+
export {
|
|
501
|
+
AGENT_PROCESS_KEY,
|
|
502
|
+
AgentRequestBegin,
|
|
503
|
+
AgentRequestEnd,
|
|
504
|
+
AgentService_exports as AgentService,
|
|
505
|
+
AiAssistantError,
|
|
506
|
+
AiContextBinder,
|
|
507
|
+
AiContextService,
|
|
508
|
+
AiModelError,
|
|
509
|
+
AiRequest,
|
|
510
|
+
AiSession,
|
|
511
|
+
AiSessionService,
|
|
512
|
+
ArtifactDiffResolver,
|
|
513
|
+
ArtifactId,
|
|
514
|
+
Bindings,
|
|
515
|
+
CompleteBlock,
|
|
516
|
+
ContextBinding,
|
|
517
|
+
ExecutionGraph,
|
|
518
|
+
GenerationObserver,
|
|
519
|
+
PartialBlock,
|
|
520
|
+
RefFromLLM,
|
|
521
|
+
ToolExecutionServices,
|
|
522
|
+
VersionPin,
|
|
523
|
+
applyDiffs,
|
|
524
|
+
computeDiffsWithCursors,
|
|
525
|
+
createArtifactElement,
|
|
526
|
+
createSystemPrompt,
|
|
527
|
+
createToolkit,
|
|
528
|
+
formatSystemPrompt,
|
|
529
|
+
formatUserPrompt,
|
|
530
|
+
getOperationFromTool,
|
|
531
|
+
makeToolExecutionService,
|
|
532
|
+
makeToolExecutionServiceFromOperationInvoker,
|
|
533
|
+
makeToolResolverFromOperations,
|
|
534
|
+
reduceDiffs,
|
|
535
|
+
templates
|
|
536
|
+
};
|
|
537
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/diff.ts", "../../../src/execution-graph.ts", "../../../src/templates/system.ts", "raw-loader:/__w/dxos/dxos/packages/core/assistant/src/templates/instructions/format.tpl?raw", "raw-loader:/__w/dxos/dxos/packages/core/assistant/src/templates/instructions/system.tpl?raw"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { next as A, type Doc } from '@automerge/automerge';\n\nimport { DocAccessor, toCursorRange } from '@dxos/echo-db';\nimport { log } from '@dxos/log';\nimport { isNonNullable } from '@dxos/util';\n\n// Relevant info:\n// https://github.com/Minahil-official/GPT-4.1-Promting-Guide?tab=readme-ov-file#-apply-patch-tool-format-v4a-diff\n\n// TODO(burdon): Anthropic only.\n// https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/text-editor-tool#example-str-replace-command\n// AI_TOOL_NOT_FOUND: str_replace_based_edit_tool\n// 'str_replace_based_edit_tool',\n\n// TOOD(burdon): Support append to end (no \"-\").\n\nexport type Diff = {\n match: string;\n replace: string;\n};\n\n/**\n * Convert a list of diffs into a list of operations.\n */\nexport const reduceDiffs = (diffs: readonly string[]): Diff[] => {\n return diffs.reduce<Diff[]>((acc, diff) => {\n const current = acc[acc.length - 1];\n const [op, ...rest] = diff.split(' ');\n switch (op) {\n case '-': {\n if (current && !current.match) {\n current.match += rest.join(' ');\n } else {\n acc.push({ match: rest.join(' '), replace: '' });\n }\n return acc;\n }\n case '+': {\n if (current && !current.replace) {\n current.replace += rest.join(' ');\n } else {\n acc.push({ match: '', replace: rest.join(' ') });\n }\n return acc;\n }\n default: {\n throw new Error(`Invalid diff format: each line must start with \"- \" or \"+ \", got: ${JSON.stringify(diff)}`);\n }\n }\n }, []);\n};\n\nexport const computeDiffsWithCursors = <T>(accessor: DocAccessor<T>, diffs: readonly string[]) => {\n return reduceDiffs(diffs)\n .map((diff) => {\n const text = DocAccessor.getValue<string>(accessor);\n const idx = text.indexOf(diff.match);\n if (idx !== -1) {\n return { cursor: toCursorRange(accessor, idx, idx + diff.match.length), text: diff.replace };\n }\n })\n .filter(isNonNullable);\n};\n\nexport const applyDiffs = <T>(\n accessor: DocAccessor<T>,\n diffs: readonly string[],\n { errorOnNotFound = false }: { errorOnNotFound?: boolean } = {},\n): string => {\n for (const diff of reduceDiffs(diffs)) {\n accessor.handle.change((doc: Doc<T>) => {\n const text = DocAccessor.getValue<string>(accessor);\n const idx = text.indexOf(diff.match);\n if (idx !== -1) {\n // TODO(burdon): Replace smallest substring.\n // NOTE: This only replaces the first match.\n A.splice(doc, accessor.path as A.Prop[], idx, diff.match.length, diff.replace);\n } else {\n if (errorOnNotFound) {\n throw new Error(`Diff not found: ${diff.match}`);\n } else {\n log.warn('diff not found', diff);\n }\n }\n });\n }\n\n return DocAccessor.getValue<string>(accessor);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { AgentStatus } from '@dxos/ai';\nimport { type Entity, Obj, type Ref } from '@dxos/echo';\nimport { MESSAGE_PROPERTY_TOOL_CALL_ID } from '@dxos/functions';\nimport { type ObjectId } from '@dxos/keys';\nimport { LogLevel } from '@dxos/log';\nimport { ContentBlock, Message } from '@dxos/types';\nimport { isNonNullable } from '@dxos/util';\n\nconst SKIP_BLOCKS: ContentBlock.Any['_tag'][] = ['text'];\n\n/**\n * Mercurial-style Commit.\n */\n// TODO(wittjosiah): Reconcile with @dxos/react-ui-components.\nexport type Commit = {\n id: string;\n parents: string[];\n branch: string;\n icon?: string;\n level?: LogLevel;\n message: string;\n timestamp?: Date;\n tags?: string[];\n};\n\n// TODO(burdon): Add colors?\nenum IconType {\n // General status.\n SUCCESS = 'ph--check-circle--regular',\n WARNING = 'ph--warning-circle--regular',\n ERROR = 'ph--x-circle--regular',\n FLAG = 'ph--flag--regular',\n ROCKET = 'ph--rocket--regular',\n TIMER = 'ph--timer--regular',\n\n // Interactions.\n USER = 'ph--user--regular',\n USER_INTERACTION = 'ph--user-sound--regular',\n AGENT = 'ph--drone--regular',\n THINKING = 'ph--brain--regular',\n LINK = 'ph--link--regular',\n TOOL = 'ph--wrench--regular',\n}\n\n/**\n * Models the execution graph based on a stream of events.\n */\nexport class ExecutionGraph {\n // TODO(dmaretskyi): Evolve the internal state to support chats, functions, circuit workflows, etc.\n private _commits: Commit[] = [];\n private _branchNames = new Set<string>();\n private _lastBlockId: string | undefined;\n\n // Tool call tracking.\n private _toolCallCommitIds = new Map<string, string>(); // toolCallId -> commitId\n private _lastCommitByBranch = new Map<string, string>(); // branch -> last commitId\n private _pendingToolResults = new Map<string, string>(); // toolCallId -> toolResultCommitId\n\n constructor(private readonly _skipBlocks: ContentBlock.Any['_tag'][] = SKIP_BLOCKS) {}\n\n /**\n * Adds events to the graph.\n */\n addEvents(events: Entity.Unknown[]) {\n const sortedEvents = this.sortObjectsByCreated(events);\n for (const event of sortedEvents) {\n if (Obj.instanceOf(Message.Message, event)) {\n this._processMessage(event);\n } else if (Obj.instanceOf(AgentStatus, event)) {\n this._processAgentStatus(event);\n }\n }\n }\n\n /**\n * Processes a message event and creates commits for its blocks.\n */\n private _processMessage(message: Message.Message) {\n const messageCommits = messageToCommits(\n message,\n this._lastBlockId,\n this._toolCallCommitIds,\n this._lastCommitByBranch,\n this._skipBlocks,\n );\n this._commits.push(...messageCommits);\n\n // Track branches.\n messageCommits.forEach((commit) => this._branchNames.add(commit.branch));\n\n // Track tool calls and update pending tool results.\n this._trackToolCalls(messageCommits);\n\n // Update last block ID for sequential chaining.\n if (messageCommits.length > 0) {\n this._lastBlockId = messageCommits[messageCommits.length - 1].id;\n }\n }\n\n /**\n * Processes an AgentStatus event.\n */\n private _processAgentStatus(event: AgentStatus) {\n const branch = this._getToolCallBranch(event.parentMessage, event.toolCallId);\n this._branchNames.add(branch);\n\n const agentStatusCommit: Commit = {\n id: event.id,\n branch,\n message: event.message,\n icon: IconType.FLAG,\n parents: this._getAgentStatusParents(event),\n timestamp: new Date(event.created),\n };\n\n this._commits.push(agentStatusCommit);\n\n // Update last block ID for sequential chaining.\n this._lastBlockId = event.id;\n\n // Update pending tool results to point to this AgentStatus.\n if (event.toolCallId) {\n this._lastCommitByBranch.set(branch, event.id);\n this._updatePendingToolResults(event.toolCallId, event.id);\n }\n }\n\n /**\n * Stable sort: objects with 'created' field are sorted by it, others remain in place.\n */\n private sortObjectsByCreated(objects: any[]) {\n const sortedObjects = objects.slice();\n // Find indices of objects with 'created'\n const createdObjects: { idx: number; obj: any }[] = [];\n sortedObjects.forEach((obj, idx) => {\n if (obj && typeof obj.created === 'string') {\n createdObjects.push({ idx, obj });\n }\n });\n // Sort only the objects with 'created' by their date, stable\n createdObjects.sort((a, b) => {\n const aDate = new Date(a.obj.created).getTime();\n const bDate = new Date(b.obj.created).getTime();\n return aDate - bDate;\n });\n // Place sorted createdObjects back into their original positions\n let createdIdx = 0;\n return sortedObjects.map((obj, _idx) => {\n if (obj && typeof obj.created === 'string') {\n return createdObjects[createdIdx++].obj;\n }\n return obj;\n });\n }\n\n /**\n * Returns the current state of the graph.\n */\n getGraph(lastRequest = false): { branches: string[]; commits: Commit[] } {\n const idx = lastRequest ? this._commits.findLastIndex((c) => c.tags?.includes('user')) : -1;\n const commits = idx === -1 ? this._commits : this._commits.slice(idx);\n\n return {\n branches: Array.from(this._branchNames),\n commits,\n };\n }\n\n /**\n * Tracks tool calls and handles pending tool result updates.\n */\n private _trackToolCalls(commits: Commit[]) {\n commits.forEach((commit) => {\n if (this._isToolCallCommit(commit)) {\n const toolCallId = this._extractToolCallId(commit.id);\n if (toolCallId) {\n this._toolCallCommitIds.set(toolCallId, commit.id);\n }\n }\n\n if (this._isToolResultCommit(commit)) {\n const toolCallId = this._extractToolCallId(commit.id);\n if (toolCallId) {\n this._pendingToolResults.set(toolCallId, commit.id);\n this._handleLateToolResultUpdate(toolCallId, commit.id);\n }\n }\n\n this._lastCommitByBranch.set(commit.branch, commit.id);\n });\n }\n\n /**\n * Updates pending tool results to point to an AgentStatus event.\n */\n private _updatePendingToolResults(toolCallId: string, agentStatusId: string) {\n const toolResultId = this._pendingToolResults.get(toolCallId);\n if (!toolResultId) return;\n\n const toolResultCommit = this._commits.find((c) => c.id === toolResultId);\n if (!toolResultCommit) return;\n\n const toolCallCommitId = this._toolCallCommitIds.get(toolCallId);\n if (!toolCallCommitId) return;\n\n // Replace tool call commit with AgentStatus commit.\n const toolCallIndex = toolResultCommit.parents.indexOf(toolCallCommitId);\n if (toolCallIndex !== -1) {\n toolResultCommit.parents[toolCallIndex] = agentStatusId;\n }\n\n this._pendingToolResults.delete(toolCallId);\n }\n\n /**\n * Handles late updates when AgentStatus is processed before tool result.\n */\n private _handleLateToolResultUpdate(toolCallId: string, toolResultId: string) {\n const toolCallCommitId = this._toolCallCommitIds.get(toolCallId);\n if (!toolCallCommitId) return;\n\n const messageId = toolCallCommitId.split('_toolCall_')[0];\n const toolCallBranch = `${messageId}_${toolCallId}`;\n const agentStatusCommitId = this._lastCommitByBranch.get(toolCallBranch);\n\n if (agentStatusCommitId && agentStatusCommitId !== toolCallCommitId) {\n const toolResultCommit = this._commits.find((c) => c.id === toolResultId);\n if (toolResultCommit) {\n const toolCallIndex = toolResultCommit.parents.indexOf(toolCallCommitId);\n if (toolCallIndex !== -1) {\n toolResultCommit.parents[toolCallIndex] = agentStatusCommitId;\n }\n }\n this._pendingToolResults.delete(toolCallId);\n }\n }\n\n /**\n * Gets the branch name for a tool call.\n */\n private _getToolCallBranch(parentMessage?: ObjectId, toolCallId?: string): string {\n if (toolCallId) {\n return toolCallId;\n }\n return parentMessage || 'main';\n }\n\n /**\n * Gets the parents for an AgentStatus commit.\n */\n private _getAgentStatusParents(event: AgentStatus): string[] {\n if (event.parentMessage && event.toolCallId) {\n return [getToolCallId(event.parentMessage, event.toolCallId)];\n }\n return [];\n }\n\n /**\n * Checks if a commit is a tool call commit.\n */\n private _isToolCallCommit(commit: Commit): boolean {\n return commit.message.includes('Calling tool');\n }\n\n /**\n * Checks if a commit is a tool result commit.\n */\n private _isToolResultCommit(commit: Commit): boolean {\n return commit.message.includes('Tool call succeeded') || commit.message.includes('Tool error:');\n }\n\n /**\n * Extracts tool call ID from a commit ID.\n */\n private _extractToolCallId(commitId: string): string | undefined {\n const toolCallMatch = commitId.match(/_toolCall_(.+)$/);\n const toolResultMatch = commitId.match(/_toolResult_(.+)$/);\n return toolCallMatch?.[1] || toolResultMatch?.[1];\n }\n}\n\n/**\n * Creates commits for all blocks in a message.\n */\n// TODO(burdon): Pass in AiToolProvider.\nconst messageToCommits = (\n message: Message.Message,\n lastBlockId?: string,\n toolCallIds?: Map<string, string>,\n lastCommitByBranch?: Map<string, string>,\n skipBlocks?: ContentBlock.Any['_tag'][],\n): Commit[] => {\n let previousBlockId: string | undefined = lastBlockId;\n\n return message.blocks\n .map((block, idx) => {\n const branch = getMessageBranch(message);\n const parents = getBlockParents(block, previousBlockId, message, toolCallIds, lastCommitByBranch);\n if (skipBlocks?.includes(block._tag)) {\n return null;\n }\n\n const commit = createBlockCommit(block, message, branch, parents, idx);\n if (commit) {\n previousBlockId = commit.id;\n }\n\n return commit;\n })\n .filter(isNonNullable);\n};\n\n/**\n * Determines the parent commits for a block based on its type and context.\n */\nconst getBlockParents = (\n block: ContentBlock.Any,\n previousBlockId: string | undefined,\n message: Message.Message,\n toolCallIds?: Map<string, string>,\n lastCommitByBranch?: Map<string, string>,\n): string[] => {\n const parents: string[] = [];\n\n if (block._tag === 'toolResult') {\n // Tool results have two parents: previous block and last block from tool call branch.\n if (previousBlockId) {\n parents.push(previousBlockId);\n }\n\n const toolCallCommitId = toolCallIds?.get(block.toolCallId);\n if (toolCallCommitId) {\n const toolCallBranch = getToolCallBranchFromCommitId(toolCallCommitId, block.toolCallId);\n const lastBlockFromToolCallBranch = lastCommitByBranch?.get(toolCallBranch);\n\n if (lastBlockFromToolCallBranch) {\n parents.push(lastBlockFromToolCallBranch);\n } else {\n // Fallback to tool call commit if no AgentStatus exists yet.\n parents.push(toolCallCommitId);\n }\n }\n } else {\n // For other blocks, use previous block as parent (or tool call parent for first block).\n if (previousBlockId) {\n parents.push(previousBlockId);\n } else {\n const toolCallParent = getParentId(message);\n if (toolCallParent) {\n parents.push(toolCallParent);\n }\n }\n }\n\n return parents;\n};\n\n/**\n * Creates a commit for a specific block.\n */\nconst createBlockCommit = (\n block: ContentBlock.Any,\n message: Message.Message,\n branch: string,\n parents: string[],\n idx: number,\n): Commit | null => {\n const timestamp = new Date(message.created);\n switch (block._tag) {\n case 'text':\n if (!block.text.trim().length) return null;\n return {\n id: getGenericBlockId(message.id, idx),\n branch,\n parents,\n timestamp,\n ...(message.sender.role === 'user'\n ? {\n icon: IconType.USER,\n tags: ['user'],\n message: 'Processing request...',\n }\n : {\n icon: IconType.AGENT,\n message: `Response (${block.text.split(' ').length} words)`,\n }),\n } satisfies Commit;\n\n case 'toolCall':\n return {\n id: getToolCallId(message.id, block.toolCallId),\n branch,\n parents,\n timestamp,\n icon: IconType.TOOL,\n level: LogLevel.INFO,\n message: `Calling tool (${block.name})`,\n } satisfies Commit;\n\n case 'toolResult':\n return {\n id: getToolResultId(message.id, block.toolCallId),\n branch,\n parents,\n timestamp,\n icon: block.error ? IconType.ERROR : IconType.SUCCESS,\n level: block.error ? LogLevel.ERROR : LogLevel.INFO,\n message: block.error ? 'Tool error: ' + block.error : 'Tool call succeeded',\n } satisfies Commit;\n\n case 'stats':\n return {\n id: getGenericBlockId(message.id, idx),\n branch,\n parents,\n timestamp,\n icon: IconType.ROCKET,\n level: LogLevel.INFO,\n message: ContentBlock.createStatsMessage(block),\n } satisfies Commit;\n\n case 'status':\n return {\n id: getGenericBlockId(message.id, idx),\n branch,\n parents,\n timestamp,\n message: block.statusText,\n level: LogLevel.INFO,\n icon: IconType.FLAG,\n } satisfies Commit;\n\n case 'reasoning':\n return {\n id: getGenericBlockId(message.id, idx),\n branch,\n parents,\n timestamp,\n message: block.reasoningText ?? 'Thinking...',\n icon: IconType.THINKING,\n } satisfies Commit;\n\n case 'reference':\n return {\n id: getGenericBlockId(message.id, idx),\n branch,\n parents,\n timestamp,\n icon: IconType.LINK,\n message: stringifyRef(block.reference),\n } satisfies Commit;\n\n default:\n return null;\n }\n};\n\n/**\n * Gets the tool call branch name from a tool call commit ID.\n */\nconst getToolCallBranchFromCommitId = (toolCallCommitId: string, toolCallId: string): string => {\n const messageId = toolCallCommitId.split('_toolCall_')[0];\n return `${messageId}_${toolCallId}`;\n};\n\nconst getToolCallId = (messageId: ObjectId, toolCallId: string) => `${messageId}_toolCall_${toolCallId}`;\nconst getToolResultId = (messageId: ObjectId, toolCallId: string) => `${messageId}_toolResult_${toolCallId}`;\nconst getGenericBlockId = (messageId: ObjectId, idx: number) => `${messageId}_block_${idx}`;\n\nconst getBranchName = (options: { parentMessage?: ObjectId; toolCallId?: string }) => {\n if (options.toolCallId) {\n return options.toolCallId;\n } else if (options.parentMessage) {\n return options.parentMessage;\n } else {\n return 'main';\n }\n};\n\nconst getMessageBranch = (message: Message.Message) => {\n return getBranchName({\n parentMessage: message.parentMessage,\n toolCallId: message.properties?.[MESSAGE_PROPERTY_TOOL_CALL_ID],\n });\n};\n\nconst getParentId = (message: Message.Message) => {\n if (message.parentMessage && message.properties?.[MESSAGE_PROPERTY_TOOL_CALL_ID]) {\n return getToolCallId(message.parentMessage, message.properties[MESSAGE_PROPERTY_TOOL_CALL_ID]);\n } else {\n return undefined;\n }\n};\n\nconst stringifyRef = (ref: Ref.Unknown) => {\n if (ref.target) {\n return stringifyObject(ref.target);\n }\n\n return ref.dxn.asEchoDXN()?.echoId ?? ref.dxn.asQueueDXN()?.objectId ?? '';\n};\n\nconst stringifyObject = (obj: Obj.Unknown) => {\n return Obj.getLabel(obj) ?? Obj.getTypename(obj) ?? obj.id;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { type ModelCapabilities } from '@dxos/ai';\nimport { Template } from '@dxos/blueprints';\n\nimport FORMAT from './instructions/format.tpl?raw';\nimport SYSTEM from './instructions/system.tpl?raw';\n\n/**\n * System template variables.\n */\nexport type SystemPromptOptions = ModelCapabilities & {\n DATETIME: string;\n};\n\n/**\n * Base system prompt.\n * NOTE: This contains protocol instructions that can not be dynamically edited.\n */\nexport const createSystemPrompt = (options: Partial<SystemPromptOptions> = {}) =>\n Template.process<SystemPromptOptions>(\n FORMAT,\n defaultsDeep(options, {\n DATETIME: new Date().toISOString(),\n }),\n );\n\n/**\n * NOTE: We are forbidden from accessing randomness at model level in cloudflare, so we have to have pre-generated ids.\n */\nconst SYSTEM_ID = '01K2J2FZWH39F55CS7B26GP1Q3';\n\nexport const templates = {\n system: Template.make({\n id: SYSTEM_ID,\n source: SYSTEM,\n }),\n};\n", "{{! System Core }}\n\n## Input Formats\n\n### Blueprints\n\nYou may be provided with Blueprint definitions that include specific instructions and tools for a given set of tasks.\nBlue print instructions will be enclosed in a <blueprint> tag.\n\n### Context objects\n\nYou may be provided with references to objects that are relevant to the current prompt.\nObjects will be in the form of a <object> tag with a <dxn> element that is the unique key of the object required by many tools.\nThe <typename> element is the type of the object.\n\n<object>\n <dxn>object-id</dxn>\n <typename>example.com/type/TypeName</typename>\n</object>\n\n## Response Formats\n\nIt is very important to respond in the correct format.\nYou response must be valid Markdown.\nIn some cases you should respond with well-formed XML tags along with the content.\nCode snippets should use 2-space indents.\n\n{{#if cot}}\nBefore responding, explain your reasoning and include your detailed chain-of-thought enclosed in a <cot> tag.\nThe <cot> tag should be the first thing in your response.\n{{/if}}\n\n## Block references\n\nYou can reply with a block reference for objects if you have the DXN. For example:\n\n<object>\n <dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M</dxn>\n</object>\n<object>\n <dxn>dxn:echo:@:01K24XPK464FSCKVQJAB2H662M</dxn>\n</object>\n\n### Suggestions\n\nEach suggestion must in the form of a proposed action enclosed in a <suggestion> tag.\nExample: <suggestion>Show on a map</suggestion>\nDo not use bullets when listing suggestions.\n\n### Multiple choice questions\n\nYou may ask multiple choice questions by wrapping consise options inside <option> tags inside a well formed <select> tag.\nExample: <select><option>Yes</option><option>No</option></select>\n\n## Context\n\nThe current date and time is {{DATETIME}}.\n", "{{! System Prompt }}\n\n- You are a helpful assistant called Kai. \n- Your name is Kai and you are powered by different language models.\n- You were created by DXOS and operate inside of Composer and on the DXOS EDGE network.\n- In your initial greeting state your name and make some suggestions based on the current context objects.\n- You are an advanced AI assistant capable of creating and managing artifacts from provided data and tools.\n- Your task is to process user commands and questions and decide how best to respond.\n- In general be concise and direct.\n- Follow all instructions carefully.\n\n## Planning\n\n- Analyze the structure and type of the content in the user's message.\n- Determine if you complete the task using the available blueprint definitions?\n- If you can't complete the task using the available blueprint definitions, query the list of available blueprint definitions using the appropriate tool.\n- Identify which blueprint definitions are relevant to the user's request.\n- Evaluate the potential benefits of creating an artifact vs. normal processing for each identified element.\n- Make a final decision on whether to create an artifact and explain your reasoning.\n- Are the required blueprint definitions already available?\n- If not, select which blueprint definition(s) will be the most relevant and require them using the require_artifact_definitions tool.\n- The require'd artifact tools will be available for use after require.\n- If creating an artifact, outline how you will structure it within the response.\n- Decide if the artifact needs to be shown to the user.\n- Call the show tool to show the artifact to the user.\n- Your reasoning must include: whether to use artifacts or not, to create one or query, whether to show the artifact to the user, and how to structure the response.\n\n## Blueprints and Artifacts\n\n- Determine if the interaction involves an artifact. Prefer artifacts for tables, lists, spreadsheets, kanbans, games, images, and other structured data.\n- Determine if the user is explicitly talking about creating a new artifact, or wants to use an existing artifact.\n- If it is ambiguous, query for existing artifacts first and then decide.\n- If you decide to create an artifact, call the associated tool to create the artifact.\n- Artifacts are stored in the database. Tools are used to create and query artifacts.\n- If you are unsure about creating an artifact ask the user for clarification.\n- Artifacts are mutable objects that can change over the course of the conversation.\n- Always re-query the artifact using the tool (like query or inspect) to get the latest state of the artifact before answering the user.\n- You must never generate the id of the artifact; only recall the ids that are already in the history.\n- Artifacts are created by requiring the specific artifact using the require_artifact tool and creating it by calling the associated tool.\n- You can add suggested actions at the end of your response.\n- Suggested actions should be very concise and start with a verb and be phrased as a command to an agent -- not a question to the user.\n- Suggested actions must be in the form of a user instruction that you can follow.\n- Suggested actions could include actions that create artifacts.\n- After creating an artifact use a tool to add it to the chat context.\n\n## Navigation\n\n- When the user asks to open, go to, navigate to, or show a specific document, page, or object, use the navigation tools instead of loading content inline.\n- First, call the Resolve navigation targets tool to find the navigation path for the requested item.\n - Without arguments, it returns available pages that can be navigated to.\n - With a DXN in the query, it resolves that specific object to a navigation path.\n- If you know the object's DXN (e.g. from a database query or context objects), pass it in the query to get the exact navigation path.\n- Then, call the Open tool with the resolved navigation path(s) in the subject array to navigate the user to that item.\n- Do not respond with the document's content when the user asks to open it \u2014 open it in the main content area instead.\n- If multiple targets match, present the options to the user and let them choose which to open.\n\n## Response format\n\n- When updating the user about the progress of the work you are doing, put the update in a <status> XML tag.\n- Only when you need to show the result to the user or ask a question use a text block without status tags.\n\n<example>\n// reasoning...\n<status>Looking for emails from Depot</status>\n// tool call..\n<status>Found 2 emails from Depot.</status>\n<status>Loading email details</status>\n// tool call\n<status>Located mailbox</status>\nI found **2 emails from Depot**:\n</example>\n\nDo not do (no status tags):\n\n<incorrect_example>\n// reasoning...\n// tool call..\nI found 2 emails from Depot. Let me load their details:\n// tool call\nI found **2 emails from Depot**:\n</incorrect_example>\n\n- Avoid using plain text to tell the user what you are about to do; instead, use status blocks.\n- WRONG: Let me get...\n- CORRECT: <status>Getting...</status>"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,QAAQC,SAAmB;AAEpC,SAASC,aAAaC,qBAAqB;AAC3C,SAASC,WAAW;AACpB,SAASC,qBAAqB;;AAoBvB,IAAMC,cAAc,CAACC,UAAAA;AAC1B,SAAOA,MAAMC,OAAe,CAACC,KAAKC,SAAAA;AAChC,UAAMC,UAAUF,IAAIA,IAAIG,SAAS,CAAA;AACjC,UAAM,CAACC,IAAI,GAAGC,IAAAA,IAAQJ,KAAKK,MAAM,GAAA;AACjC,YAAQF,IAAAA;MACN,KAAK,KAAK;AACR,YAAIF,WAAW,CAACA,QAAQK,OAAO;AAC7BL,kBAAQK,SAASF,KAAKG,KAAK,GAAA;QAC7B,OAAO;AACLR,cAAIS,KAAK;YAAEF,OAAOF,KAAKG,KAAK,GAAA;YAAME,SAAS;UAAG,CAAA;QAChD;AACA,eAAOV;MACT;MACA,KAAK,KAAK;AACR,YAAIE,WAAW,CAACA,QAAQQ,SAAS;AAC/BR,kBAAQQ,WAAWL,KAAKG,KAAK,GAAA;QAC/B,OAAO;AACLR,cAAIS,KAAK;YAAEF,OAAO;YAAIG,SAASL,KAAKG,KAAK,GAAA;UAAK,CAAA;QAChD;AACA,eAAOR;MACT;MACA,SAAS;AACP,cAAM,IAAIW,MAAM,qEAAqEC,KAAKC,UAAUZ,IAAAA,CAAAA,EAAO;MAC7G;IACF;EACF,GAAG,CAAA,CAAE;AACP;AAEO,IAAMa,0BAA0B,CAAIC,UAA0BjB,UAAAA;AACnE,SAAOD,YAAYC,KAAAA,EAChBkB,IAAI,CAACf,SAAAA;AACJ,UAAMgB,OAAOxB,YAAYyB,SAAiBH,QAAAA;AAC1C,UAAMI,MAAMF,KAAKG,QAAQnB,KAAKM,KAAK;AACnC,QAAIY,QAAQ,IAAI;AACd,aAA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;IACJK,QAAQC;EACV,CAAA;AACF;",
|
|
6
|
+
"names": ["next", "A", "DocAccessor", "toCursorRange", "log", "isNonNullable", "reduceDiffs", "diffs", "reduce", "acc", "diff", "current", "length", "op", "rest", "split", "match", "join", "push", "replace", "Error", "JSON", "stringify", "computeDiffsWithCursors", "accessor", "map", "text", "getValue", "idx", "indexOf", "cursor", "filter", "applyDiffs", "errorOnNotFound", "handle", "change", "doc", "splice", "path", "warn", "AgentStatus", "Obj", "MESSAGE_PROPERTY_TOOL_CALL_ID", "LogLevel", "ContentBlock", "Message", "isNonNullable", "SKIP_BLOCKS", "ExecutionGraph", "_commits", "_branchNames", "Set", "_lastBlockId", "_toolCallCommitIds", "Map", "_lastCommitByBranch", "_pendingToolResults", "_skipBlocks", "SKIP_BLOCKS", "addEvents", "events", "sortedEvents", "sortObjectsByCreated", "event", "Obj", "instanceOf", "Message", "_processMessage", "AgentStatus", "_processAgentStatus", "message", "messageCommits", "messageToCommits", "push", "forEach", "commit", "add", "branch", "_trackToolCalls", "length", "id", "_getToolCallBranch", "parentMessage", "toolCallId", "agentStatusCommit", "icon", "parents", "_getAgentStatusParents", "timestamp", "Date", "created", "set", "_updatePendingToolResults", "objects", "sortedObjects", "slice", "createdObjects", "obj", "idx", "sort", "a", "b", "aDate", "getTime", "bDate", "createdIdx", "map", "_idx", "getGraph", "lastRequest", "findLastIndex", "c", "tags", "includes", "commits", "branches", "Array", "from", "_isToolCallCommit", "_extractToolCallId", "_isToolResultCommit", "_handleLateToolResultUpdate", "agentStatusId", "toolResultId", "get", "toolResultCommit", "find", "toolCallCommitId", "toolCallIndex", "indexOf", "delete", "messageId", "split", "toolCallBranch", "agentStatusCommitId", "getToolCallId", "commitId", "toolCallMatch", "match", "toolResultMatch", "lastBlockId", "toolCallIds", "lastCommitByBranch", "skipBlocks", "previousBlockId", "blocks", "block", "getMessageBranch", "getBlockParents", "_tag", "createBlockCommit", "filter", "isNonNullable", "getToolCallBranchFromCommitId", "lastBlockFromToolCallBranch", "toolCallParent", "getParentId", "text", "trim", "getGenericBlockId", "sender", "role", "level", "LogLevel", "INFO", "name", "getToolResultId", "error", "ERROR", "ContentBlock", "createStatsMessage", "statusText", "reasoningText", "stringifyRef", "reference", "getBranchName", "options", "properties", "MESSAGE_PROPERTY_TOOL_CALL_ID", "undefined", "ref", "target", "stringifyObject", "dxn", "asEchoDXN", "echoId", "asQueueDXN", "objectId", "getLabel", "getTypename", "defaultsDeep", "Template", "createSystemPrompt", "options", "Template", "process", "FORMAT", "defaultsDeep", "DATETIME", "Date", "toISOString", "SYSTEM_ID", "templates", "system", "make", "id", "source", "SYSTEM"]
|
|
7
|
+
}
|