veryfront 0.1.646 → 0.1.648

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.648",
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 +1 @@
1
- {"version":3,"file":"tool-ui.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/tool-ui.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAU1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AA4B7F,gCAAgC;AAChC,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAS/E;AA8ED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,IAAI,GACL,EAAE;IACD,IAAI,EAAE,YAAY,GAAG,mBAAmB,CAAC;CAC1C,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAiEpB"}
1
+ {"version":3,"file":"tool-ui.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/tool-ui.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAU1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AA4B7F,gCAAgC;AAChC,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAS/E;AAkFD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,IAAI,GACL,EAAE;IACD,IAAI,EAAE,YAAY,GAAG,mBAAmB,CAAC;CAC1C,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAgEpB"}
@@ -72,13 +72,17 @@ function renderOutputAsTable(output) {
72
72
  return (React.createElement("tr", { key: i, className: "border-b border-[var(--border)]" }, keys.map((key) => (React.createElement("td", { key: key, className: "px-4 py-2 text-[var(--card-foreground)]" }, String(record?.[key] ?? ""))))));
73
73
  })))));
74
74
  }
75
+ function hasVisibleToolOutput(output) {
76
+ return output !== undefined && output !== null;
77
+ }
75
78
  /**
76
79
  * Tool call card component - renders tool invocations with parameters and results
77
80
  * Styled to match AI Elements (https://ai-sdk.dev/elements)
78
81
  */
79
82
  export function ToolCallCard({ tool, }) {
80
83
  const [isExpanded, setIsExpanded] = React.useState(true);
81
- const tableOutput = tool.output === undefined ? null : renderOutputAsTable(tool.output);
84
+ const hasOutput = hasVisibleToolOutput(tool.output);
85
+ const tableOutput = hasOutput ? renderOutputAsTable(tool.output) : null;
82
86
  return (React.createElement("div", { className: "not-prose w-full rounded-xl border border-[var(--border)] bg-[var(--card)]" },
83
87
  React.createElement("button", { type: "button", onClick: () => setIsExpanded((v) => !v), className: "group flex w-full items-center justify-between gap-4 p-3 hover:bg-[var(--accent)] transition-all rounded-t-xl" },
84
88
  React.createElement("div", { className: "flex items-center gap-2" },
@@ -90,11 +94,9 @@ export function ToolCallCard({ tool, }) {
90
94
  tool.input === undefined ? null : (React.createElement("div", { className: "space-y-2 overflow-hidden p-4" },
91
95
  React.createElement("h4", { className: "font-medium text-[var(--muted-foreground)] text-xs uppercase tracking-wide" }, "Parameters"),
92
96
  React.createElement("div", { className: "rounded-lg bg-[var(--accent)] p-3" }, formatJsonWithHighlight(tool.input)))),
93
- tool.output === undefined
94
- ? null
95
- : (React.createElement("div", { className: "space-y-2 p-4 border-t border-[var(--border)]" },
96
- React.createElement("h4", { className: "font-medium text-[var(--muted-foreground)] text-xs uppercase tracking-wide" }, "Result"),
97
- React.createElement("div", { className: "overflow-x-auto rounded-lg bg-[var(--accent)] text-[var(--foreground)]" }, tableOutput ?? React.createElement("div", { className: "p-3" }, formatJsonWithHighlight(tool.output))))),
97
+ !hasOutput ? null : (React.createElement("div", { className: "space-y-2 p-4 border-t border-[var(--border)]" },
98
+ React.createElement("h4", { className: "font-medium text-[var(--muted-foreground)] text-xs uppercase tracking-wide" }, "Result"),
99
+ React.createElement("div", { className: "overflow-x-auto rounded-lg bg-[var(--accent)] text-[var(--foreground)]" }, tableOutput ?? React.createElement("div", { className: "p-3" }, formatJsonWithHighlight(tool.output))))),
98
100
  !tool.errorText ? null : (React.createElement("div", { className: "space-y-2 p-4 border-t border-[var(--border)]" },
99
101
  React.createElement("h4", { className: "font-medium text-[var(--destructive)] text-xs uppercase tracking-wide" }, "Error"),
100
102
  React.createElement("div", { className: "rounded-lg bg-[var(--destructive)]/10 text-[var(--destructive)] p-3 text-sm" }, tool.errorText)))))));
@@ -1 +1 @@
1
- {"version":3,"file":"framework-candidates.generated.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/framework-candidates.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAujLjD,CAAC"}
1
+ {"version":3,"file":"framework-candidates.generated.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/framework-candidates.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAwkLjD,CAAC"}
@@ -27,6 +27,7 @@ export const FRAMEWORK_CANDIDATES = [
27
27
  "!gap-0",
28
28
  "!hasError",
29
29
  "!hasInput",
30
+ "!hasOutput",
30
31
  "!hideTabSwitcher",
31
32
  "!isActive",
32
33
  "!isBrowserEnvironment())",
@@ -1683,6 +1684,7 @@ export const FRAMEWORK_CANDIDATES = [
1683
1684
  "Svg,",
1684
1685
  "SvgProps",
1685
1686
  "SvgProps):",
1687
+ "Swedish",
1686
1688
  "Switch",
1687
1689
  "Sync",
1688
1690
  "System",
@@ -2099,6 +2101,7 @@ export const FRAMEWORK_CANDIDATES = [
2099
2101
  "assertEquals(getTextContent(message),",
2100
2102
  "assertEquals(groupPartsInOrder([]).length,",
2101
2103
  "assertEquals(groups.length,",
2104
+ "assertEquals(html.includes(",
2102
2105
  "assertEquals(isReasoningPart(part),",
2103
2106
  "assertEquals(isToolPart(part),",
2104
2107
  "assertEquals(nonce,",
@@ -2114,6 +2117,8 @@ export const FRAMEWORK_CANDIDATES = [
2114
2117
  "assertExists(first);",
2115
2118
  "assertExists(second);",
2116
2119
  "assertExists(third);",
2120
+ "assertStringIncludes",
2121
+ "assertStringIncludes(html,",
2117
2122
  "assistant",
2118
2123
  "assistant:",
2119
2124
  "assistant?:",
@@ -3246,8 +3251,11 @@ export const FRAMEWORK_CANDIDATES = [
3246
3251
  "hasInput={!!input.trim()}",
3247
3252
  "hasInput?:",
3248
3253
  "hasMessages",
3254
+ "hasOutput",
3249
3255
  "hasThreads",
3250
3256
  "hasToolCalls",
3257
+ "hasVisibleToolOutput(output:",
3258
+ "hasVisibleToolOutput(tool.output);",
3251
3259
  "head>",
3252
3260
  "height:",
3253
3261
  "height=",
@@ -4289,6 +4297,7 @@ export const FRAMEWORK_CANDIDATES = [
4289
4297
  "p>{error}</p>",
4290
4298
  "padding:",
4291
4299
  "page.",
4300
+ "panel",
4292
4301
  "panel.",
4293
4302
  "parameters",
4294
4303
  "parent-defined",
@@ -4439,6 +4448,7 @@ export const FRAMEWORK_CANDIDATES = [
4439
4448
  "py-4",
4440
4449
  "py-5",
4441
4450
  "py-6",
4451
+ "query:",
4442
4452
  "questions",
4443
4453
  "quick",
4444
4454
  "quickActions",
@@ -4586,11 +4596,12 @@ export const FRAMEWORK_CANDIDATES = [
4586
4596
  "renderOutput,",
4587
4597
  "renderOutput?:",
4588
4598
  "renderOutputAsTable(output:",
4589
- "renderOutputAsTable(tool.output);",
4599
+ "renderOutputAsTable(tool.output)",
4590
4600
  "renderReasoning)",
4591
4601
  "renderReasoning,",
4592
4602
  "renderReasoning?:",
4593
4603
  "renderToString",
4604
+ "renderToString(<ToolCallCard",
4594
4605
  "renderToString(element);",
4595
4606
  "renderTool",
4596
4607
  "renderTool(group.tool)",
@@ -4618,6 +4629,7 @@ export const FRAMEWORK_CANDIDATES = [
4618
4629
  "requestAnimationFrame:",
4619
4630
  "reset",
4620
4631
  "reset:",
4632
+ "residency",
4621
4633
  "resize",
4622
4634
  "resize();",
4623
4635
  "resize-none",
@@ -5146,6 +5158,7 @@ export const FRAMEWORK_CANDIDATES = [
5146
5158
  "take",
5147
5159
  "target",
5148
5160
  "target=",
5161
+ "tax",
5149
5162
  "tbody>",
5150
5163
  "tc1",
5151
5164
  "td",
@@ -5337,6 +5350,8 @@ export const FRAMEWORK_CANDIDATES = [
5337
5350
  "tool-primitives.tsx",
5338
5351
  "tool-result",
5339
5352
  "tool-search",
5353
+ "tool-ui.tsx",
5354
+ "tool-web-search",
5340
5355
  "tool.",
5341
5356
  "tool.error",
5342
5357
  "tool.errorText}",
@@ -5350,6 +5365,7 @@ export const FRAMEWORK_CANDIDATES = [
5350
5365
  "tool.type",
5351
5366
  "tool:",
5352
5367
  "tool={group.tool}",
5368
+ "tool={tool}",
5353
5369
  "tool?:",
5354
5370
  "toolCall:",
5355
5371
  "toolCallId",
@@ -5640,6 +5656,7 @@ export const FRAMEWORK_CANDIDATES = [
5640
5656
  "waitFor(condition:",
5641
5657
  "waiting",
5642
5658
  "we",
5659
+ "web_search",
5643
5660
  "when",
5644
5661
  "which",
5645
5662
  "while",
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.646";
2
+ export declare const VERSION = "0.1.648";
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.648";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.646",
3
+ "version": "0.1.648",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",