veryfront 0.1.646 → 0.1.647

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.646",
3
+ "version": "0.1.647",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/ag-ui/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAY7B,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EACL,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,WAAW,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AA0S3B,yCAAyC;AACzC,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EACJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACvF,cAAc,CAAC,EAAE,uBAAuB,CAAC,eAAe,CAAC,CAAC;IAC1D,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAED,+DAA+D;AAC/D,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE,KAAK,EAAE,KAAK,CAAC;CACd;AAUD,gCAAgC;AAChC,wBAAgB,iBAAiB,CAC/B,OA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,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,kBAAkB,GAC3B,CAAC,YAAY,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAChD,gCAAgC;AAChC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,0BAA0B,EAClC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,CAAC,YAAY,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC"}
@@ -20,6 +20,11 @@ const AG_UI_HEADERS = {
20
20
  function generateRunId() {
21
21
  return `run_${dntShim.crypto.randomUUID().replaceAll("-", "")}`;
22
22
  }
23
+ function getProviderToolNames(agent) {
24
+ return Array.isArray(agent.config.providerTools)
25
+ ? agent.config.providerTools.filter((toolName) => typeof toolName === "string" && toolName.length > 0)
26
+ : [];
27
+ }
23
28
  function createToolDataEventBridge() {
24
29
  const pendingEvents = [];
25
30
  let publishDataEvent = (event) => {
@@ -141,7 +146,9 @@ async function createAgUiDirectStreamResponse(agent, request, rawRequest, baseCo
141
146
  const threadId = request.threadId ?? dntShim.crypto.randomUUID();
142
147
  const runId = request.runId ?? generateRunId();
143
148
  const context = buildStreamContext(request, baseContext, threadId, runId);
144
- let messages = normalizeAgUiMessages(request.messages);
149
+ let messages = normalizeAgUiMessages(request.messages, {
150
+ providerOwnedToolNames: getProviderToolNames(agent),
151
+ });
145
152
  const beforeStreamResult = await beforeStream?.({
146
153
  request: rawRequest,
147
154
  messages,
@@ -179,7 +186,9 @@ async function createAgUiInjectedToolsStreamResponse(agent, request, rawRequest,
179
186
  const threadId = request.threadId ?? dntShim.crypto.randomUUID();
180
187
  const runId = request.runId ?? generateRunId();
181
188
  const context = buildStreamContext(request, baseContext, threadId, runId);
182
- let messages = normalizeAgUiMessages(request.messages);
189
+ let messages = normalizeAgUiMessages(request.messages, {
190
+ providerOwnedToolNames: getProviderToolNames(agent),
191
+ });
183
192
  const beforeStreamResult = await beforeStream?.({
184
193
  request: rawRequest,
185
194
  messages,
@@ -128,12 +128,15 @@ export type AgUiInjectedTool = InferSchema<ReturnType<typeof getAgUiInjectedTool
128
128
  export type AgUiContextItem = InferSchema<ReturnType<typeof getAgUiContextItemSchema>>;
129
129
  /** Request payload for AG-UI. */
130
130
  export type AgUiRequest = InferSchema<ReturnType<typeof getAgUiRequestSchema>>;
131
+ export interface NormalizeAgUiMessagesOptions {
132
+ providerOwnedToolNames?: readonly string[];
133
+ }
131
134
  /** Request payload for parse AG-UI. */
132
135
  export declare function parseAgUiRequest(request: Request): Promise<AgUiRequest>;
133
136
  /** Error shape for parse AG-UI request or. */
134
137
  export declare function parseAgUiRequestOrError(request: Request): Promise<AgUiRequest | Response>;
135
138
  /** Normalizes AG-UI messages. */
136
- export declare function normalizeAgUiMessages(messages: AgUiRequest["messages"]): Message[];
139
+ export declare function normalizeAgUiMessages(messages: AgUiRequest["messages"], options?: NormalizeAgUiMessagesOptions): Message[];
137
140
  /** Event emitted for create AG-UI run error. */
138
141
  export declare function createAgUiRunErrorEvent(message: string, code?: string): AgUiSseEvent;
139
142
  /** Response payload for create AG-UI sse error. */
@@ -1 +1 @@
1
- {"version":3,"file":"host-support.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/ag-ui/host-support.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAa3C,mCAAmC;AACnC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAgBD,eAAO,MAAM,yBAAyB;;;;GASrC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;GAuBpC,CAAC;AAuBF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBhC,CAAC;AAEF,kDAAkD;AAClD,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AAQ,CAAC,CAKjC;AAED,iCAAiC;AACjC,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,EACjC,OAAO,GAAE,4BAAiC,GACzC,OAAO,EAAE,CAmCX;AAED,gDAAgD;AAChD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,CAQpF;AAED,mDAAmD;AACnD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAUxF;AAED,6CAA6C;AAC7C,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,QAAQ,CASlF"}
@@ -95,6 +95,37 @@ function hasToolResultPart(parts, toolCallId) {
95
95
  return parts.some((part) => (part.type === "tool-result" && part.toolCallId === toolCallId) ||
96
96
  (part.type === "tool_result" && part.tool_call_id === toolCallId));
97
97
  }
98
+ function getMessagePartToolCallId(part) {
99
+ const record = part;
100
+ const value = record.toolCallId ?? record.tool_call_id ?? record.id;
101
+ return typeof value === "string" && value.length > 0 ? value : undefined;
102
+ }
103
+ function getMessagePartToolName(part) {
104
+ const record = part;
105
+ const explicitToolName = record.toolName ?? record.tool_name ?? record.name;
106
+ if (typeof explicitToolName === "string" && explicitToolName.length > 0) {
107
+ return explicitToolName;
108
+ }
109
+ return part.type.startsWith("tool-") && part.type !== "tool-call" && part.type !== "tool-result"
110
+ ? part.type.replace(/^tool-/, "")
111
+ : undefined;
112
+ }
113
+ function shouldKeepProviderVisibleToolPart(part, providerOwnedToolNames, providerOwnedToolCallIds) {
114
+ if (providerOwnedToolNames.size === 0) {
115
+ return true;
116
+ }
117
+ const toolName = getMessagePartToolName(part);
118
+ const toolCallId = getMessagePartToolCallId(part);
119
+ const ownedByName = toolName ? providerOwnedToolNames.has(toolName) : false;
120
+ const ownedByCallId = toolCallId ? providerOwnedToolCallIds.has(toolCallId) : false;
121
+ if (!ownedByName && !ownedByCallId) {
122
+ return true;
123
+ }
124
+ if (toolCallId) {
125
+ providerOwnedToolCallIds.add(toolCallId);
126
+ }
127
+ return false;
128
+ }
98
129
  function normalizeMessagePart(part) {
99
130
  if (part.type === "text" && typeof part.text === "string" &&
100
131
  part.text.length <= MAX_TEXT_PART_LENGTH) {
@@ -148,14 +179,40 @@ function normalizeMessagePart(part) {
148
179
  }
149
180
  return null;
150
181
  }
151
- function extractAssistantToolOutputMessages(message) {
152
- if (message.role !== "assistant")
153
- return [];
154
- return message.parts.flatMap((part) => {
155
- if (!isToolPartWithOutput(part) || hasToolResultPart(message.parts, part.toolCallId)) {
156
- return [];
182
+ function buildMessageMetadataFields(message) {
183
+ return {
184
+ ...(message.createdAt ? { timestamp: Date.parse(message.createdAt) || undefined } : {}),
185
+ ...(message.metadata ? { metadata: message.metadata } : {}),
186
+ };
187
+ }
188
+ function normalizeAssistantMessage(message, providerOwnedToolNames, providerOwnedToolCallIds) {
189
+ const messages = [];
190
+ const metadataFields = buildMessageMetadataFields(message);
191
+ let segmentParts = [];
192
+ let segmentIndex = 0;
193
+ const flushAssistantSegment = () => {
194
+ if (segmentParts.length === 0)
195
+ return;
196
+ messages.push({
197
+ id: segmentIndex === 0 ? message.id : `${message.id}-${segmentIndex}`,
198
+ role: "assistant",
199
+ parts: segmentParts,
200
+ ...metadataFields,
201
+ });
202
+ segmentParts = [];
203
+ segmentIndex += 1;
204
+ };
205
+ for (const part of message.parts) {
206
+ const normalizedPart = normalizeMessagePart(part);
207
+ if (!normalizedPart)
208
+ continue;
209
+ if (!shouldKeepProviderVisibleToolPart(normalizedPart, providerOwnedToolNames, providerOwnedToolCallIds)) {
210
+ continue;
157
211
  }
158
- return [{
212
+ if (isToolPartWithOutput(part) && !hasToolResultPart(message.parts, part.toolCallId)) {
213
+ segmentParts.push(normalizedPart);
214
+ flushAssistantSegment();
215
+ messages.push({
159
216
  id: `tool_${part.toolCallId}`,
160
217
  role: "tool",
161
218
  parts: [{
@@ -164,8 +221,13 @@ function extractAssistantToolOutputMessages(message) {
164
221
  toolName: part.toolName,
165
222
  result: part.output,
166
223
  }],
167
- }];
168
- });
224
+ });
225
+ continue;
226
+ }
227
+ segmentParts.push(normalizedPart);
228
+ }
229
+ flushAssistantSegment();
230
+ return messages;
169
231
  }
170
232
  /** Request payload for parse AG-UI. */
171
233
  export async function parseAgUiRequest(request) {
@@ -176,21 +238,26 @@ export async function parseAgUiRequestOrError(request) {
176
238
  return await parseAgUiJsonRequestOrError(() => parseAgUiRequest(request), "Invalid AG-UI request");
177
239
  }
178
240
  /** Normalizes AG-UI messages. */
179
- export function normalizeAgUiMessages(messages) {
241
+ export function normalizeAgUiMessages(messages, options = {}) {
242
+ const providerOwnedToolNames = new Set(options.providerOwnedToolNames ?? []);
243
+ const providerOwnedToolCallIds = new Set();
180
244
  return messages.flatMap((message) => {
245
+ if (message.role === "user" || message.role === "system") {
246
+ providerOwnedToolCallIds.clear();
247
+ }
248
+ if (message.role === "assistant") {
249
+ return normalizeAssistantMessage(message, providerOwnedToolNames, providerOwnedToolCallIds);
250
+ }
181
251
  const normalizedMessage = {
182
252
  id: message.id,
183
253
  role: message.role,
184
254
  parts: message.parts
185
255
  .map((part) => normalizeMessagePart(part))
186
- .filter((part) => part !== null),
187
- ...(message.createdAt ? { timestamp: Date.parse(message.createdAt) || undefined } : {}),
188
- ...(message.metadata ? { metadata: message.metadata } : {}),
256
+ .filter((part) => part !== null)
257
+ .filter((part) => shouldKeepProviderVisibleToolPart(part, providerOwnedToolNames, providerOwnedToolCallIds)),
258
+ ...buildMessageMetadataFields(message),
189
259
  };
190
- return [
191
- normalizedMessage,
192
- ...extractAssistantToolOutputMessages(message),
193
- ];
260
+ return normalizedMessage.parts.length > 0 ? [normalizedMessage] : [];
194
261
  });
195
262
  }
196
263
  /** Event emitted for create AG-UI run error. */
@@ -1 +1 @@
1
- {"version":3,"file":"chat-request.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/ch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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyC,CAAC;AAE9E,uCAAuC;AACvC,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC;AAC3F,6CAA6C;AAC7C,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAChD,OAAO,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC,cAAc,CAAC,EAAE,wBAAwB,CAAC;CAC3C,CAAC;AAmBF,gFAAgF;AAChF,wBAAgB,8DAA8D,CAC5E,KAAK,EAAE,yBAAyB,GAC/B,iBAAiB,CAAC,gBAAgB,CAAC,CAcrC;AAED,sEAAsE;AACtE,wBAAgB,qDAAqD,CACnE,KAAK,EAAE,yBAAyB,GAC/B,sBAAsB,CAoBxB;AAED,gEAAgE;AAChE,wBAAgB,gDAAgD,CAC9D,KAAK,EAAE,yBAAyB,GAC/B,iBAAiB,CAInB"}
@@ -39,6 +39,17 @@ export const hostedChatRequestSchema = lazySchema(getHostedChatRequestSchema);
39
39
  function isRecord(value) {
40
40
  return value !== null && typeof value === "object" && !Array.isArray(value);
41
41
  }
42
+ function getStudioRuntimeEnvironmentContext(input) {
43
+ for (const item of input.context) {
44
+ if (item.type !== "json" || item.title !== "studio_context")
45
+ continue;
46
+ const environmentContext = item.data.environmentContext;
47
+ if (typeof environmentContext === "string" && environmentContext.trim().length > 0) {
48
+ return environmentContext;
49
+ }
50
+ }
51
+ return undefined;
52
+ }
42
53
  /** Builds hosted chat request forwarded props from runtime agent invocation. */
43
54
  export function buildHostedChatRequestForwardedPropsFromRuntimeAgentInvocation(input) {
44
55
  const forwardedProps = isRecord(input.forwardedProps)
@@ -54,12 +65,14 @@ export function buildHostedChatRequestForwardedPropsFromRuntimeAgentInvocation(i
54
65
  }
55
66
  /** Builds hosted chat request input from runtime agent invocation. */
56
67
  export function buildHostedChatRequestInputFromRuntimeAgentInvocation(input) {
68
+ const environmentContext = getStudioRuntimeEnvironmentContext(input);
57
69
  return {
58
70
  messages: input.messages,
59
71
  context: {
60
72
  conversationId: input.run.conversationId,
61
73
  projectId: input.run.project.projectId,
62
74
  branchId: input.run.project.runtimeTargetBranchId ?? null,
75
+ ...(environmentContext ? { environmentContext } : {}),
63
76
  },
64
77
  forwardedProps: buildHostedChatRequestForwardedPropsFromRuntimeAgentInvocation(input),
65
78
  durableRootRun: {
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.646";
2
+ export declare const VERSION = "0.1.647";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.646";
4
+ export const VERSION = "0.1.647";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.646",
3
+ "version": "0.1.647",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",