@k2b/cloud 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -4
- package/src/_internal/app-presentation.ts +22 -1
- package/src/_internal/capabilities.ts +2 -2
- package/src/_internal/define-app.ts +17 -5
- package/src/_internal/registry.ts +50 -6
- package/src/_internal/widget-declarations.ts +53 -0
- package/src/ai/app-skills.ts +1 -7
- package/src/ai/approval-routes.ts +40 -4
- package/src/ai/approvals.ts +68 -10
- package/src/ai/audio-tool.ts +2 -1
- package/src/ai/browser.ts +109 -0
- package/src/ai/capabilities.ts +6 -2
- package/src/ai/chart-block.ts +431 -81
- package/src/ai/chat/action-sentences.ts +13 -7
- package/src/ai/chat/blocks.tsx +64 -39
- package/src/ai/chat/builtin-tools.tsx +9 -7
- package/src/ai/chat/chart-block.tsx +218 -44
- package/src/ai/chat/explorer-block.tsx +276 -0
- package/src/ai/chat/file-tools.tsx +40 -1
- package/src/ai/chat/live-turn.browser-harness.tsx +4 -1
- package/src/ai/chat/message-actions.tsx +9 -1
- package/src/ai/chat/message-utils.ts +7 -0
- package/src/ai/chat/messages.ts +34 -0
- package/src/ai/chat/presentation.tsx +13 -3
- package/src/ai/chat/reference-text.tsx +34 -0
- package/src/ai/chat/tool-groups.ts +67 -12
- package/src/ai/chat/tool-names.ts +18 -2
- package/src/ai/chat/turn-layout.ts +8 -0
- package/src/ai/chat/turn-view.tsx +111 -32
- package/src/ai/chat/view-block.browser-harness.tsx +35 -0
- package/src/ai/chat/view-block.tsx +417 -0
- package/src/ai/chat/visual-tools.tsx +32 -53
- package/src/ai/chat/web-tools.tsx +95 -1
- package/src/ai/client/controller.ts +6 -3
- package/src/ai/client-tool-results.ts +9 -0
- package/src/ai/code-runtime-tools.ts +50 -17
- package/src/ai/code-source-contracts.ts +25 -21
- package/src/ai/code-source-tools.ts +3 -1
- package/src/ai/default-tool-contracts.ts +334 -91
- package/src/ai/default-tools.ts +87 -11
- package/src/ai/executor.ts +343 -45
- package/src/ai/fetch-file-tool.ts +41 -4
- package/src/ai/file-error.ts +2 -0
- package/src/ai/file-tools.ts +27 -7
- package/src/ai/files-store.ts +60 -0
- package/src/ai/firecrawl-tools.ts +87 -4
- package/src/ai/html-pdf-tool.ts +3 -2
- package/src/ai/http.ts +37 -12
- package/src/ai/index.ts +98 -0
- package/src/ai/local-tool-contracts.ts +244 -0
- package/src/ai/malformed-tool-call-repair.ts +144 -0
- package/src/ai/markdown-pdf-tool.ts +2 -1
- package/src/ai/migrate.ts +120 -2
- package/src/ai/openai-api-messages.ts +53 -0
- package/src/ai/openai-api-slots.ts +40 -0
- package/src/ai/openai-api.ts +383 -0
- package/src/ai/protocol.ts +28 -3
- package/src/ai/provider.ts +16 -4
- package/src/ai/request-context.ts +33 -0
- package/src/ai/routes.ts +99 -49
- package/src/ai/runtime.ts +90 -15
- package/src/ai/settings.ts +5 -0
- package/src/ai/skill-catalog.ts +20 -5
- package/src/ai/skill-format.ts +17 -7
- package/src/ai/skill-tool.ts +15 -5
- package/src/ai/skills-routes.ts +20 -6
- package/src/ai/skills.ts +26 -7
- package/src/ai/store.ts +91 -1
- package/src/ai/system-prompt.ts +69 -10
- package/src/ai/timeline.ts +3 -1
- package/src/ai/tool-audit.ts +11 -1
- package/src/ai/tools.ts +94 -3
- package/src/ai/types.ts +48 -0
- package/src/ai/view-block.ts +941 -0
- package/src/ai/vision-tool.ts +2 -1
- package/src/ai/web-provenance.ts +103 -0
- package/src/api/admin-identity.ts +6 -1
- package/src/api/app-approval-actions.ts +36 -0
- package/src/api/app-approval.ts +10 -2
- package/src/api/approvals-loader.ts +15 -0
- package/src/api/approvals.ts +120 -0
- package/src/api/capabilities.ts +3 -2
- package/src/api/index.ts +3 -0
- package/src/api/me.ts +12 -3
- package/src/api/widgets.ts +36 -5
- package/src/approvals/Approvals.browser-harness.tsx +16 -0
- package/src/approvals/Approvals.tsx +621 -0
- package/src/approvals/ApprovalsNavStatus.tsx +20 -0
- package/src/approvals/messages.ts +95 -0
- package/src/approvals/ui.ts +8 -0
- package/src/browser/CloudResourceSearch.tsx +1 -1
- package/src/browser/app-approval.ts +32 -0
- package/src/browser/choose-files.tsx +26 -13
- package/src/browser/command-shortcuts.ts +21 -6
- package/src/browser/commands.ts +13 -4
- package/src/browser/file-provider-error.ts +11 -0
- package/src/browser/file-providers.ts +3 -12
- package/src/browser/files.tsx +1 -2
- package/src/browser/live-connection.ts +2 -3
- package/src/browser/provider-list.ts +2 -1
- package/src/browser/save-files.tsx +13 -2
- package/src/browser/spotlight-position.ts +4 -1
- package/src/browser/widgets.ts +7 -5
- package/src/capabilities/executions.ts +3 -0
- package/src/cli/account.ts +21 -2
- package/src/cli/commands.ts +24 -2
- package/src/cli/index.ts +16 -0
- package/src/cli/plugin.ts +30 -0
- package/src/contracts/app-approval.ts +120 -0
- package/src/contracts/app.ts +34 -2
- package/src/contracts/approval-paths.ts +4 -0
- package/src/contracts/approvals.ts +81 -0
- package/src/contracts/command-path.ts +17 -0
- package/src/contracts/commands.ts +5 -15
- package/src/contracts/registry.ts +9 -1
- package/src/contracts/shared.ts +5 -0
- package/src/contracts/widgets.ts +47 -2
- package/src/desktop/solid.tsx +6 -7
- package/src/events/live-protocol.ts +2 -1
- package/src/events/live-server-message.ts +40 -0
- package/src/events/testing.ts +88 -0
- package/src/server/index.ts +3 -0
- package/src/server/middleware/auth.ts +11 -1
- package/src/server/request-timeout.ts +22 -0
- package/src/server/services/access.ts +4 -3
- package/src/server/widget-request.ts +27 -0
- package/src/services/app-approval.ts +103 -15
- package/src/services/approvals/cursor.ts +15 -0
- package/src/services/approvals/device.ts +112 -0
- package/src/services/approvals/index.ts +241 -0
- package/src/services/approvals/list.ts +120 -0
- package/src/services/approvals/migrate.ts +41 -0
- package/src/services/identity/models-only-auth.ts +25 -0
- package/src/services/notifications/email-frame.ts +16 -3
- package/src/services/service-account-credentials.ts +22 -10
- package/src/services/settings/core-settings.ts +27 -0
- package/src/shared/ai-platform-prompt.ts +26 -1
- package/src/shared/app-presentation.ts +11 -0
- package/src/shared/email-html.ts +46 -7
- package/src/shared/index.ts +6 -1
- package/src/shared/markdown/extensions/code.ts +14 -0
- package/src/shared/markdown/index.ts +4 -4
- package/src/ssr/AdminLayout.tsx +4 -7
- package/src/ssr/AppBadge.tsx +4 -4
- package/src/ssr/AppLaunchpad.island.tsx +1 -1
- package/src/ssr/AppLaunchpadPanel.tsx +4 -4
- package/src/ssr/Layout.tsx +38 -14
- package/src/ssr/LayoutFooter.tsx +1 -1
- package/src/ssr/LayoutHeader.tsx +17 -20
- package/src/ssr/LayoutHelp.tsx +1 -1
- package/src/ssr/LayoutRail.tsx +1 -2
- package/src/ssr/PageTrail.tsx +23 -0
- package/src/ssr/PageTrailRow.island.tsx +20 -0
- package/src/ssr/PageTrailRuntime.island.tsx +26 -0
- package/src/ssr/ProfilePreferences.island.tsx +7 -3
- package/src/ssr/RailApps.island.tsx +2 -2
- package/src/ssr/app-badges.ts +50 -6
- package/src/ssr/islands/index.ts +1 -0
- package/src/ssr/layout-runtime.ts +60 -0
- package/src/ssr/mobile-menu-history.ts +1 -1
- package/src/ssr/page-trail-runtime.ts +313 -0
- package/src/ssr/page-trail.browser-harness.tsx +265 -0
- package/src/ssr/page-trail.ts +59 -0
- package/src/ssr/platform-messages.ts +4 -0
- package/src/ssr/rail-navigation.ts +5 -3
- package/src/ssr/runtime.ts +6 -1
- package/src/styles/approvals.css +390 -0
- package/src/styles/effects.css +21 -4
- package/src/styles/global.css +39 -3
- package/src/styles/utilities-layout.css +24 -1
- package/src/styles/utilities-navigation.css +6 -18
package/src/ai/default-tools.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { runManagedCodeTool } from "./code-runtime-tools";
|
|
|
18
18
|
import { CODE_SOURCE_TOOLS } from "./code-source-contracts";
|
|
19
19
|
import { createCodeSourceTools } from "./code-source-tools";
|
|
20
20
|
import {
|
|
21
|
+
CLOUD_AI_GROUP_MAX_CHARTS,
|
|
21
22
|
CloudAiCardInputSchema,
|
|
22
23
|
CloudAiCardOutputSchema,
|
|
23
24
|
CloudAiChartInputSchema,
|
|
@@ -39,6 +40,22 @@ import {
|
|
|
39
40
|
} from "./file-tools";
|
|
40
41
|
import { createCloudAiWebExtractTool, createCloudAiWebSearchTool, isCloudAiFirecrawlConfigured } from "./firecrawl-tools";
|
|
41
42
|
import { createCloudAiHtmlToPdfTool } from "./html-pdf-tool";
|
|
43
|
+
import {
|
|
44
|
+
CloudAiLoadLocalSkillInputSchema,
|
|
45
|
+
CloudAiLoadLocalSkillOutputSchema,
|
|
46
|
+
CloudAiLocalDownloadInputSchema,
|
|
47
|
+
CloudAiLocalDownloadOutputSchema,
|
|
48
|
+
CloudAiLocalListInputSchema,
|
|
49
|
+
CloudAiLocalListOutputSchema,
|
|
50
|
+
CloudAiLocalMoveInputSchema,
|
|
51
|
+
CloudAiLocalMoveOutputSchema,
|
|
52
|
+
CloudAiLocalReadInputSchema,
|
|
53
|
+
CloudAiLocalReadOutputSchema,
|
|
54
|
+
CloudAiLocalUploadInputSchema,
|
|
55
|
+
CloudAiLocalUploadOutputSchema,
|
|
56
|
+
CloudAiLocalWriteInputSchema,
|
|
57
|
+
CloudAiLocalWriteOutputSchema,
|
|
58
|
+
} from "./local-tool-contracts";
|
|
42
59
|
import { createCloudAiMarkdownToPdfTool } from "./markdown-pdf-tool";
|
|
43
60
|
import { createAiTodoTool } from "./todo-tool";
|
|
44
61
|
import { defineAiTool } from "./tools";
|
|
@@ -72,23 +89,22 @@ export const createCloudAiCardTool = () =>
|
|
|
72
89
|
defineAiTool({
|
|
73
90
|
name: "card",
|
|
74
91
|
description:
|
|
75
|
-
"
|
|
92
|
+
"Show one highlight figure you already have, such as a status, metric or short result, as a stat tile in the chat. Keep the value to a short figure or status and the caption to one line. Several figures computed in code_run go through cloud.view.stats in the run, not several card calls; tables, lists and longer explanations stay Markdown. Keep all fields flat; do not pass arrays or nested objects.",
|
|
76
93
|
inputSchema: CloudAiCardInputSchema,
|
|
77
94
|
outputSchema: CloudAiCardOutputSchema,
|
|
78
95
|
approval: "never",
|
|
79
|
-
promptHint: "show one
|
|
96
|
+
promptHint: "show one highlight figure already known; several computed figures use cloud.view.stats in code_run.",
|
|
80
97
|
}).clientView();
|
|
81
98
|
|
|
82
99
|
export const createCloudAiChartTool = () =>
|
|
83
100
|
defineAiTool({
|
|
84
101
|
name: "chart",
|
|
85
|
-
description:
|
|
86
|
-
"Show one chart in the chat from data you already have: bar, line (area: true fills it), scatter, pie, donut, histogram, gauge or sparkline. Cloud draws it with the renderer of cloud.chart() in Studio apps and gives the reader a data table and Copy data; no code, sandbox or app check is involved. Aggregate first. Compute derived numbers with calculate or code_run before charting them. Say what the chart shows in title and put the unit, period or source in subtitle. The chart has no state, filters or actions: for interaction show an app in the chat with code_present, and build a saved Studio App only when data must be kept or the app reused. After the chart, state the finding instead of repeating its values.",
|
|
102
|
+
description: `Show one chart in the chat from a few values you already have that did not come from a code run, such as figures from the conversation, a web page or a small capability result: bar, line (area: true fills it), scatter, pie, donut, histogram, gauge, sparkline, boxplot, heatmap, barGauge or stat. Several related measures go into one call as a group of small charts (charts, at most ${CLOUD_AI_GROUP_MAX_CHARTS}); linkX shares the x cursor between line charts with the same kind of x. There is no second y axis: compare measures with different units as a group. Cloud draws it with the renderer of cloud.chart() and gives the reader a data table and Copy data; no code, sandbox or app check is involved. Values computed in code_run never go here: the script shows them itself with cloud.view.chart, cloud.view.group, cloud.view.table, cloud.view.stats, cloud.view.details or cloud.view.explorer, and you present the returned path. Aggregate first. Say what the chart shows in title and put the unit, period or source in subtitle; formats are data ({ style: "percent" } takes fractions). The chart has no state, filters or actions: filters, steps and comparison over computed rows come from cloud.view.explorer in code_run; for other interaction show an app in the chat with code_present, and build a saved Studio App only when data must be kept or the app reused. After the chart, state the finding instead of repeating its values.`,
|
|
87
103
|
inputSchema: CloudAiChartInputSchema,
|
|
88
104
|
outputSchema: CloudAiChartOutputSchema,
|
|
89
105
|
approval: "never",
|
|
90
106
|
promptHint:
|
|
91
|
-
"show
|
|
107
|
+
"show a few values you already have (not from a code run) as a chart in the chat. Code results use cloud.view.* and present; filters, steps and comparison use cloud.view.explorer in code_run; interaction beyond that needs a chat app (code_present).",
|
|
92
108
|
}).clientView();
|
|
93
109
|
|
|
94
110
|
export const createCloudAiSurveyTool = () =>
|
|
@@ -118,14 +134,73 @@ export const createCloudAiLocalBashTool = () =>
|
|
|
118
134
|
defineAiTool({
|
|
119
135
|
name: "local_bash",
|
|
120
136
|
description:
|
|
121
|
-
"Run one Bash command on the user's
|
|
137
|
+
"Run one Bash command in the workspace folder on the user's computer, as the user's OS account. Use it only when no file or Cloud tool fits; the client may ask the user first, and a run does not prove that the user saw the command.",
|
|
122
138
|
inputSchema: CloudAiLocalBashInputSchema,
|
|
123
139
|
outputSchema: CloudAiLocalBashOutputSchema,
|
|
124
140
|
approval: "never",
|
|
125
|
-
promptHint:
|
|
126
|
-
"use local_bash only when work on the user's local CLI computer is necessary; every command requires local confirmation and its result must be checked.",
|
|
141
|
+
promptHint: "use local_bash only when no local file tool or Cloud tool fits; check status, exit code, and output.",
|
|
127
142
|
}).client();
|
|
128
143
|
|
|
144
|
+
/** File tools a local client runs in the user's workspace folder; the client applies its path rules and questions. */
|
|
145
|
+
export const createCloudAiLocalTools = () => [
|
|
146
|
+
defineAiTool({
|
|
147
|
+
name: "local_list",
|
|
148
|
+
description:
|
|
149
|
+
"List files and folders in the user's local workspace, optionally recursive or filtered by a case-insensitive glob such as **/*.pdf, in pages of up to 1000 entries with size and modification time. Folders outside the workspace ask the user first.",
|
|
150
|
+
inputSchema: CloudAiLocalListInputSchema,
|
|
151
|
+
outputSchema: CloudAiLocalListOutputSchema,
|
|
152
|
+
approval: "never",
|
|
153
|
+
}).client(),
|
|
154
|
+
defineAiTool({
|
|
155
|
+
name: "local_read",
|
|
156
|
+
description:
|
|
157
|
+
"Read a local text file with line numbers, 16 KiB by default and 64 KiB at most per call; continue with nextOffset. PDFs, images, and office or spreadsheet files are uploaded to this chat instead, and the result names the chat path for read_file or view_image.",
|
|
158
|
+
inputSchema: CloudAiLocalReadInputSchema,
|
|
159
|
+
outputSchema: CloudAiLocalReadOutputSchema,
|
|
160
|
+
approval: "never",
|
|
161
|
+
}).client(),
|
|
162
|
+
defineAiTool({
|
|
163
|
+
name: "local_upload",
|
|
164
|
+
description:
|
|
165
|
+
"Upload up to 64 local files to this chat and return their chat paths, so Cloud tools such as read_file, view_image, and code mode can use them. Uploads stay in the chat until it is deleted; each file can have up to 50 MB.",
|
|
166
|
+
inputSchema: CloudAiLocalUploadInputSchema,
|
|
167
|
+
outputSchema: CloudAiLocalUploadOutputSchema,
|
|
168
|
+
approval: "never",
|
|
169
|
+
}).client(),
|
|
170
|
+
defineAiTool({
|
|
171
|
+
name: "local_download",
|
|
172
|
+
description:
|
|
173
|
+
"Save a chat file, text or binary, into the local workspace and create missing folders. It never overwrites an existing file unless replace is true, which asks the user.",
|
|
174
|
+
inputSchema: CloudAiLocalDownloadInputSchema,
|
|
175
|
+
outputSchema: CloudAiLocalDownloadOutputSchema,
|
|
176
|
+
approval: "never",
|
|
177
|
+
}).client(),
|
|
178
|
+
defineAiTool({
|
|
179
|
+
name: "local_write",
|
|
180
|
+
description:
|
|
181
|
+
"Write a local text file of up to 100 KiB: create makes a new file and fails if one exists, append adds to an existing file, and replace overwrites one. Append and replace ask the user.",
|
|
182
|
+
inputSchema: CloudAiLocalWriteInputSchema,
|
|
183
|
+
outputSchema: CloudAiLocalWriteOutputSchema,
|
|
184
|
+
approval: "never",
|
|
185
|
+
}).client(),
|
|
186
|
+
defineAiTool({
|
|
187
|
+
name: "local_move",
|
|
188
|
+
description:
|
|
189
|
+
"Rename or move up to 64 files or folders inside the workspace in one batch, which the user confirms once as a list. It never overwrites: if a target exists, nothing moves and the result names the conflicts.",
|
|
190
|
+
inputSchema: CloudAiLocalMoveInputSchema,
|
|
191
|
+
outputSchema: CloudAiLocalMoveOutputSchema,
|
|
192
|
+
approval: "never",
|
|
193
|
+
}).client(),
|
|
194
|
+
defineAiTool({
|
|
195
|
+
name: "load_local_skill",
|
|
196
|
+
description:
|
|
197
|
+
"Load a Skill marked [local] in the Skills section by its exact name. Returns its instructions, folder, and file list; read referenced files with local_read.",
|
|
198
|
+
inputSchema: CloudAiLoadLocalSkillInputSchema,
|
|
199
|
+
outputSchema: CloudAiLoadLocalSkillOutputSchema,
|
|
200
|
+
approval: "never",
|
|
201
|
+
}).client(),
|
|
202
|
+
];
|
|
203
|
+
|
|
129
204
|
export const createCloudAiCodeTools = () => [
|
|
130
205
|
defineAiTool({
|
|
131
206
|
name: "code_secret",
|
|
@@ -146,16 +221,17 @@ export const createCloudAiCodeTools = () => [
|
|
|
146
221
|
defineAiTool({
|
|
147
222
|
name: "code_run",
|
|
148
223
|
promptHint:
|
|
149
|
-
"For file analysis, data transformations or combining Cloud data, run a short one-off script with code_run. Load assistant-code-mode for its runtime APIs; no saved app is required.",
|
|
224
|
+
"For file analysis, data transformations or combining Cloud data, run a short one-off script with code_run; its computed views come from cloud.view.* in the script and present. Load assistant-code-mode for its runtime APIs; no saved app is required.",
|
|
150
225
|
description:
|
|
151
|
-
"Run one-off script code OR a saved script resource in the isolated worker. Optional resourceId binds one-off code to existing app data (Manage required), without editing its source. Includes cloud.capabilities.run(name,input) to chain Cloud capabilities in JavaScript; load assistant-code-mode for its runtime APIs. Scripts read explicit chat inputPaths. Returns output, logs
|
|
226
|
+
"Run one-off script code OR a saved script resource in the isolated worker. Optional resourceId binds one-off code to existing app data (Manage required), without editing its source. Includes cloud.capabilities.run(name,input) to chain Cloud capabilities in JavaScript; load assistant-code-mode for its runtime APIs. Scripts read explicit chat inputPaths. Returns output, logs, captured files and view references for agent inspection only. Show computed views with cloud.view.chart, cloud.view.group, cloud.view.table, cloud.view.stats, cloud.view.details or cloud.view.explorer in the script, then present({path}) each returned view; never retype run values into chart arguments, files or Markdown. Apps with an index.html interface do not run here: show them with code_open or code_present. Runs use real shared and personal data; database writes and capability effects keep normal permissions and approvals.",
|
|
152
227
|
inputSchema: CodeRunInput,
|
|
153
228
|
outputSchema: z.json(),
|
|
154
229
|
approval: "never",
|
|
155
230
|
}).server(runManagedCodeTool("code_run")),
|
|
156
231
|
defineAiTool({
|
|
157
232
|
name: "code_inspect",
|
|
158
|
-
description:
|
|
233
|
+
description:
|
|
234
|
+
"Inspect a script run: status, progress, errors, logs, output, captured files and view references. Use waitMs to wait for background work.",
|
|
159
235
|
inputSchema: CodeInspectInput,
|
|
160
236
|
outputSchema: z.json(),
|
|
161
237
|
approval: "never",
|