@vellumai/assistant 0.12.1-dev.202609141913.5e16607 → 0.12.1-dev.202609142113.d1590bc
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/ARCHITECTURE.md +9 -9
- package/openapi.yaml +35 -2
- package/package.json +2 -1
- package/src/__tests__/anthropic-provider.test.ts +0 -63
- package/src/__tests__/assistant-event-hub-machine-name.test.ts +6 -7
- package/src/__tests__/assistant-event-hub.test.ts +44 -0
- package/src/__tests__/computer-use-skill-manifest-regression.test.ts +1 -1
- package/src/__tests__/computer-use-tools.test.ts +2 -2
- package/src/__tests__/heartbeat-service.test.ts +56 -40
- package/src/__tests__/host-cu-proxy.test.ts +539 -0
- package/src/__tests__/list-messages-camera-frame.test.ts +121 -0
- package/src/__tests__/oauth-commands-routes.test.ts +113 -0
- package/src/__tests__/oauth-provider-profiles.test.ts +18 -0
- package/src/__tests__/openai-provider.test.ts +1 -0
- package/src/__tests__/plugin-import-boundary-guard.test.ts +1 -0
- package/src/__tests__/qdrant-manager.test.ts +132 -0
- package/src/__tests__/scaffold-managed-skill-tool.test.ts +229 -6
- package/src/__tests__/skills.test.ts +9 -4
- package/src/__tests__/test-support/computer-use-skill-harness.ts +3 -2
- package/src/__tests__/unicode.test.ts +13 -0
- package/src/acp/agent-process.ts +2 -1
- package/src/agent/loop.ts +1 -0
- package/src/api/events/user-message-echo.ts +7 -1
- package/src/api/responses/conversation-message.ts +5 -0
- package/src/avatar/identity-avatar.ts +7 -2
- package/src/config/bundled-skills/computer-use/SKILL.md +20 -2
- package/src/config/bundled-skills/computer-use/TOOLS.json +99 -0
- package/src/config/bundled-skills/computer-use/tools/computer-use-sequence.ts +12 -0
- package/src/config/bundled-skills/media-processing/services/preprocess.ts +2 -1
- package/src/config/bundled-skills/media-processing/services/processing-pipeline.ts +2 -1
- package/src/config/bundled-skills/media-processing/tools/generate-clip.ts +2 -1
- package/src/config/bundled-skills/playbooks/tools/playbook-create.ts +2 -1
- package/src/config/bundled-skills/playbooks/tools/playbook-update.ts +2 -1
- package/src/config/bundled-skills/skill-management/TOOLS.json +4 -0
- package/src/config/bundled-skills/transcribe/tools/transcribe-media.ts +5 -2
- package/src/credential-health/credential-health-service.ts +11 -17
- package/src/daemon/conversation-error.ts +3 -2
- package/src/daemon/conversation-media-retry.ts +2 -1
- package/src/daemon/conversation-runtime-assembly.ts +2 -1
- package/src/daemon/conversation-surfaces.ts +5 -1
- package/src/daemon/dictation-profile-store.ts +2 -1
- package/src/daemon/handlers/shared.ts +2 -1
- package/src/daemon/handlers/skills.ts +6 -3
- package/src/daemon/host-cu-proxy.ts +186 -19
- package/src/daemon/host-proxy-preactivation.ts +2 -1
- package/src/daemon/reaction-history-render.ts +2 -1
- package/src/heartbeat/heartbeat-service.ts +21 -3
- package/src/live-voice/__tests__/live-voice-sight-frame-echo.test.ts +238 -0
- package/src/live-voice/live-voice-photo.ts +25 -6
- package/src/oauth/AGENTS.md +2 -0
- package/src/oauth/byo-connection.test.ts +60 -0
- package/src/oauth/scope-utils.ts +24 -0
- package/src/oauth/seed-providers.ts +39 -25
- package/src/persistence/conversation-queries.ts +2 -2
- package/src/persistence/embeddings/qdrant-manager.ts +163 -18
- package/src/plugins/defaults/memory/__tests__/memory-retrospective-prompt.test.ts +5 -0
- package/src/plugins/defaults/memory/context-search/agent-runner.ts +3 -2
- package/src/plugins/defaults/memory/context-search/format.ts +3 -2
- package/src/plugins/defaults/memory/context-search/sources/memory-v2.ts +6 -3
- package/src/plugins/defaults/memory/context-search/sources/workspace.ts +3 -2
- package/src/plugins/defaults/memory/graph/capability-seed.ts +2 -1
- package/src/plugins/defaults/memory/host-utils.ts +10 -0
- package/src/plugins/defaults/memory/memory-retrospective-prompt.ts +1 -1
- package/src/plugins/defaults/memory/startup.ts +22 -1
- package/src/plugins/defaults/memory/substrate/page-index.ts +6 -1
- package/src/plugins/defaults/memory/v1/graph/consolidation.ts +4 -2
- package/src/plugins/defaults/memory/v1/graph/extraction.ts +4 -2
- package/src/plugins/defaults/memory/v1/graph/retriever.ts +4 -1
- package/src/plugins/defaults/memory/v2/reranker.ts +6 -1
- package/src/plugins/defaults/memory/v3/__tests__/card.test.ts +24 -0
- package/src/plugins/defaults/memory/v3/__tests__/pool-select.test.ts +39 -3
- package/src/plugins/defaults/memory/v3/__tests__/sections.test.ts +26 -0
- package/src/plugins/defaults/memory/v3/__tests__/shadow-plugin.test.ts +30 -0
- package/src/plugins/defaults/memory/v3/card.ts +3 -2
- package/src/plugins/defaults/memory/v3/pool-select.ts +5 -3
- package/src/plugins/defaults/memory/v3/sections.ts +9 -3
- package/src/plugins/defaults/memory/v3/shadow-plugin.ts +5 -2
- package/src/providers/__tests__/retry-outbound-sanitize.test.ts +176 -0
- package/src/providers/anthropic/client.ts +0 -47
- package/src/providers/openai/__tests__/chat-completions-output-token-limit.test.ts +141 -0
- package/src/providers/openai/chat-completions-provider.ts +20 -1
- package/src/providers/openrouter/client.ts +20 -0
- package/src/providers/outbound-request-sanitize.ts +96 -0
- package/src/providers/retry.ts +24 -3
- package/src/providers/unparseable-tool-args.ts +5 -1
- package/src/runtime/AGENTS.md +1 -1
- package/src/runtime/__tests__/host-observe.test.ts +40 -1
- package/src/runtime/agent-wake.ts +2 -1
- package/src/runtime/assistant-event-hub.ts +21 -3
- package/src/runtime/host-observe.ts +11 -1
- package/src/runtime/routes/conversation-routes.ts +16 -3
- package/src/runtime/routes/diagnostics-routes.ts +6 -1
- package/src/runtime/routes/events-routes.ts +4 -0
- package/src/runtime/routes/host-cu-routes.ts +6 -0
- package/src/runtime/routes/oauth-commands-routes.ts +36 -0
- package/src/runtime/routes/workspace-routes.test.ts +55 -26
- package/src/runtime/routes/workspace-routes.ts +46 -63
- package/src/runtime/routes/workspace-tree-walk.test.ts +244 -0
- package/src/runtime/routes/workspace-tree-walk.ts +240 -0
- package/src/runtime/routes/workspace-utils.ts +17 -0
- package/src/schedule/run-script.ts +2 -1
- package/src/schedule/schedule-store.ts +9 -2
- package/src/security/untrusted-content.ts +3 -1
- package/src/tools/__tests__/side-effect-abort-guard.test.ts +1 -0
- package/src/tools/browser/browser-execution.ts +1 -1
- package/src/tools/browser/cdp-client/accessibility-snapshot.ts +9 -3
- package/src/tools/browser/cdp-client/cdp-inspect/discovery.ts +2 -1
- package/src/tools/browser/cdp-client/extension-cdp-client.ts +3 -2
- package/src/tools/browser/network-recorder.ts +2 -1
- package/src/tools/computer-use/definitions.ts +117 -0
- package/src/tools/filesystem/search.ts +2 -1
- package/src/tools/network/web-search.ts +6 -1
- package/src/tools/skills/scaffold-managed.ts +61 -3
- package/src/types/host-capabilities.ts +5 -3
- package/src/util/unicode.ts +15 -1
- package/src/watch/watch-timeline.ts +2 -2
- package/src/workflows/run-manager.ts +2 -1
- package/src/workspace/git-service.ts +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Reusable constants and helpers for the computer-use skill migration test suite.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
/** The
|
|
5
|
+
/** The 12 computer_use_* action tool names provided by the bundled computer-use skill. */
|
|
6
6
|
export const COMPUTER_USE_TOOL_NAMES = [
|
|
7
7
|
"computer_use_observe",
|
|
8
8
|
"computer_use_click",
|
|
@@ -13,9 +13,10 @@ export const COMPUTER_USE_TOOL_NAMES = [
|
|
|
13
13
|
"computer_use_wait",
|
|
14
14
|
"computer_use_open_app",
|
|
15
15
|
"computer_use_run_applescript",
|
|
16
|
+
"computer_use_sequence",
|
|
16
17
|
"computer_use_done",
|
|
17
18
|
"computer_use_respond",
|
|
18
19
|
] as const;
|
|
19
20
|
|
|
20
21
|
/** Number of computer_use_* tools. */
|
|
21
|
-
export const COMPUTER_USE_TOOL_COUNT = COMPUTER_USE_TOOL_NAMES.length; //
|
|
22
|
+
export const COMPUTER_USE_TOOL_COUNT = COMPUTER_USE_TOOL_NAMES.length; // 12
|
|
@@ -171,6 +171,19 @@ describe("stripOrphanedSurrogatesDeep", () => {
|
|
|
171
171
|
expect(result.value.b[1]).toBe("also clean");
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
+
test("skipKey leaves a property unscanned and uncopied", () => {
|
|
175
|
+
const payload = { type: "base64", data: `raw${HIGH}` };
|
|
176
|
+
const input = { text: `bad${HIGH}`, payload };
|
|
177
|
+
const result = stripOrphanedSurrogatesDeep(input, {
|
|
178
|
+
skipKey: (key, parent) => key === "data" && parent.type === "base64",
|
|
179
|
+
});
|
|
180
|
+
expect(result.changed).toBe(true);
|
|
181
|
+
expect(result.fixedStringCount).toBe(1);
|
|
182
|
+
expect(result.value.text).toBe(`bad${REPLACEMENT}`);
|
|
183
|
+
// The skipped subtree is carried over by reference, orphan and all.
|
|
184
|
+
expect(result.value.payload).toBe(payload);
|
|
185
|
+
});
|
|
186
|
+
|
|
174
187
|
test("leaves non-plain objects untouched", () => {
|
|
175
188
|
class Custom {
|
|
176
189
|
value = `bad${HIGH}`;
|
package/src/acp/agent-process.ts
CHANGED
|
@@ -25,6 +25,7 @@ import type {
|
|
|
25
25
|
import * as acp from "@agentclientprotocol/sdk";
|
|
26
26
|
|
|
27
27
|
import { getLogger } from "../util/logger.js";
|
|
28
|
+
import { safeStringSlice } from "../util/unicode.js";
|
|
28
29
|
import {
|
|
29
30
|
AcpAuthRequiredError,
|
|
30
31
|
CLAUDE_ACP_COMMAND,
|
|
@@ -163,7 +164,7 @@ export class AcpAgentProcess {
|
|
|
163
164
|
// deriveFailureError reads from the end, so dropping the head is lossless.
|
|
164
165
|
const line =
|
|
165
166
|
text.length > STDERR_RETENTION_BYTES
|
|
166
|
-
? text.
|
|
167
|
+
? safeStringSlice(text, text.length - STDERR_RETENTION_BYTES)
|
|
167
168
|
: text;
|
|
168
169
|
this.stderrSeq += 1;
|
|
169
170
|
this.stderrRing.push({ seq: this.stderrSeq, text: line });
|
package/src/agent/loop.ts
CHANGED
|
@@ -2485,6 +2485,7 @@ export class AgentLoop {
|
|
|
2485
2485
|
contentBlocks: response.content.length,
|
|
2486
2486
|
toolUseCount: modelToolUseBlocks.length,
|
|
2487
2487
|
durationMs: providerDurationMs,
|
|
2488
|
+
cacheReadInputTokens: response.usage.cacheReadInputTokens,
|
|
2488
2489
|
},
|
|
2489
2490
|
"LLM call complete",
|
|
2490
2491
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `user_message_echo` SSE event.
|
|
3
3
|
*
|
|
4
|
-
* Emitted when a user message is persisted to a conversation
|
|
4
|
+
* Emitted when a user message is persisted to a conversation: direct
|
|
5
5
|
* sends, slash/canned/compaction turns, and synthetic surface-action
|
|
6
6
|
* prompts. Carries the user's outbound `text` so clients that did not
|
|
7
7
|
* originate the send (passive viewers, other devices) can render the
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
* 202 response. `requestId` correlates with `message_queued` /
|
|
16
16
|
* `message_dequeued` for the same turn.
|
|
17
17
|
*
|
|
18
|
+
* `cameraFrame` is present only on standalone ambient camera-frame echoes,
|
|
19
|
+
* before `sync_changed` refetches hydrate their images. Photos and spoken
|
|
20
|
+
* turns omit it. Older strict parsers drop marked echoes and recover the
|
|
21
|
+
* persisted rows through the following `sync_changed` invalidation.
|
|
22
|
+
*
|
|
18
23
|
* Canonical wire-contract source. Daemon code imports the type directly
|
|
19
24
|
* from this file; external consumers import via `@vellumai/assistant-api`.
|
|
20
25
|
*/
|
|
@@ -29,6 +34,7 @@ export const UserMessageEchoEventSchema = z
|
|
|
29
34
|
messageId: z.string().optional(),
|
|
30
35
|
requestId: z.string().optional(),
|
|
31
36
|
clientMessageId: z.string().optional(),
|
|
37
|
+
cameraFrame: z.literal(true).optional(),
|
|
32
38
|
})
|
|
33
39
|
.strict();
|
|
34
40
|
|
|
@@ -615,6 +615,11 @@ export const ConversationMessageSchema = z.object({
|
|
|
615
615
|
* sentinel text, and treat the row as the turn's reply so nothing keeps
|
|
616
616
|
* waiting for one. */
|
|
617
617
|
noResponse: z.boolean().optional(),
|
|
618
|
+
/** Set only on standalone ambient camera-frame rows, derived from
|
|
619
|
+
* `messageMetadataIsAmbientSightKeep`. Clients may fold consecutive frames
|
|
620
|
+
* into the following user message. Absent on shutter photos, spoken turns
|
|
621
|
+
* carrying parked frames, and every other row. */
|
|
622
|
+
cameraFrame: z.literal(true).optional(),
|
|
618
623
|
/** How this assistant row's plain text reached the user, set only on a turn
|
|
619
624
|
* that routed its reply through the `send_user_message` tool. `"private"`
|
|
620
625
|
* means the row's text blocks are the model's working notes and the text
|
|
@@ -5,6 +5,7 @@ import type { AvatarState } from "@vellumai/avatar-manifest";
|
|
|
5
5
|
import { isTemplateContent } from "../prompts/template-detection.js";
|
|
6
6
|
import { getLogger } from "../util/logger.js";
|
|
7
7
|
import { getWorkspacePromptPath } from "../util/platform.js";
|
|
8
|
+
import { safeStringSlice } from "../util/unicode.js";
|
|
8
9
|
|
|
9
10
|
const log = getLogger("identity-avatar");
|
|
10
11
|
|
|
@@ -26,7 +27,7 @@ export const AVATAR_IDENTITY_NOTE_MAX_CHARS = 240;
|
|
|
26
27
|
function toIdentityLine(text: string): string {
|
|
27
28
|
const line = text.replace(/\s+/g, " ").trim();
|
|
28
29
|
return line.length > AVATAR_IDENTITY_NOTE_MAX_CHARS
|
|
29
|
-
? `${line
|
|
30
|
+
? `${safeStringSlice(line, 0, AVATAR_IDENTITY_NOTE_MAX_CHARS - 3).trimEnd()}...`
|
|
30
31
|
: line;
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -117,7 +118,11 @@ export function updateIdentityAvatarSection(description: string): void {
|
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
try {
|
|
120
|
-
writeFileSync(
|
|
121
|
+
writeFileSync(
|
|
122
|
+
identityPath,
|
|
123
|
+
withAvatarSection(content, description),
|
|
124
|
+
"utf-8",
|
|
125
|
+
);
|
|
121
126
|
} catch (err) {
|
|
122
127
|
log.warn({ err }, "Failed to update IDENTITY.md avatar section");
|
|
123
128
|
}
|
|
@@ -23,6 +23,25 @@ The skill is internally preactivated for conversations with a connected desktop
|
|
|
23
23
|
Tools in this skill are proxy tools. Execution is forwarded to a connected
|
|
24
24
|
desktop client and is never handled locally by the assistant.
|
|
25
25
|
|
|
26
|
+
## Observations
|
|
27
|
+
|
|
28
|
+
Every computer-use step returns the accessibility tree. A screenshot comes with
|
|
29
|
+
a desktop's first look, with window-scoped observations, or when you call
|
|
30
|
+
`computer_use_observe` with `include_screenshot: true`. Ask for one whenever the
|
|
31
|
+
tree is not enough to act on: a canvas, a game, a custom-drawn view, few or
|
|
32
|
+
unlabeled controls, or a layout question.
|
|
33
|
+
|
|
34
|
+
The tree is walked to a limited depth to keep steps fast, and says when it was
|
|
35
|
+
cut off. If the element you need is not in it, call `computer_use_observe` with
|
|
36
|
+
`full_tree: true`.
|
|
37
|
+
|
|
38
|
+
## Batching known steps (macOS)
|
|
39
|
+
|
|
40
|
+
When you already know the next few actions and none depends on seeing the
|
|
41
|
+
result of the one before, send them as one `computer_use_sequence` call, for
|
|
42
|
+
example opening a new window, typing a URL and pressing enter. Act one step at
|
|
43
|
+
a time whenever the next action depends on what the screen shows.
|
|
44
|
+
|
|
26
45
|
## Window-scoped observation (macOS)
|
|
27
46
|
|
|
28
47
|
`computer_use_observe` accepts optional `capture_window_id`, a native macOS
|
|
@@ -33,8 +52,7 @@ including secondary windows, even when another app covers the selected window.
|
|
|
33
52
|
A missing window must not be replaced with a desktop capture.
|
|
34
53
|
|
|
35
54
|
This is a **single observation**, not a session-wide privacy boundary: normal
|
|
36
|
-
click/type/scroll and other action tools still
|
|
37
|
-
observations. Do not promise app-only capture for a whole control session.
|
|
55
|
+
click/type/scroll and other action tools still observe the whole desktop. Do not promise app-only capture for a whole control session.
|
|
38
56
|
The desktop must explicitly advertise `host_cu_window_capture` support on its
|
|
39
57
|
connection; the daemon rejects older or unsupported clients before requesting
|
|
40
58
|
any capture. Other desktop platforms reject this option.
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
"maximum": 4294967295,
|
|
16
16
|
"description": "macOS only: capture this native CGWindowID instead of the desktop, including only its accessibility tree. Obtain a current native window ID first; do not guess or use a browser tab ID. Applies to this observation only, not subsequent actions. Requires a desktop helper with window-capture support. Screenshot coordinates are window-relative; use accessibility element IDs for later actions, not desktop scaling."
|
|
17
17
|
},
|
|
18
|
+
"include_screenshot": {
|
|
19
|
+
"type": "boolean",
|
|
20
|
+
"description": "Force a screenshot with this observation. The accessibility tree is returned every step; ask for pixels whenever the tree is not enough to act on, such as a canvas, a game, a custom-drawn view, a window with few or unlabeled controls, or a question about layout."
|
|
21
|
+
},
|
|
22
|
+
"full_tree": {
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"description": "Walk the accessibility tree to full depth. Observations list the tree to a limited depth and say when it was cut off; pass this when the element you need is not in the tree."
|
|
25
|
+
},
|
|
18
26
|
"target_client_id": {
|
|
19
27
|
"type": "string",
|
|
20
28
|
"description": "ID of the specific client to target. Required when multiple clients support host_cu; omit when only one is connected. Obtain IDs from `assistant clients list --capability host_cu`."
|
|
@@ -286,6 +294,97 @@
|
|
|
286
294
|
"execution_target": "host",
|
|
287
295
|
"supported_client_os": ["macos"]
|
|
288
296
|
},
|
|
297
|
+
{
|
|
298
|
+
"name": "computer_use_sequence",
|
|
299
|
+
"description": "Run several computer-use actions you already know, in order, in one step, for example open an app, press cmd+n, type a URL and press enter. Use it when no action depends on seeing the result of the one before; otherwise act one step at a time. Element IDs refer to the latest observation, so use them only for actions that act before the screen changes. Stops at the first action that is refused or fails and reports which one. Returns one observation after the last action.",
|
|
300
|
+
"category": "computer-use",
|
|
301
|
+
"risk": "medium",
|
|
302
|
+
"input_schema": {
|
|
303
|
+
"type": "object",
|
|
304
|
+
"properties": {
|
|
305
|
+
"actions": {
|
|
306
|
+
"type": "array",
|
|
307
|
+
"minItems": 1,
|
|
308
|
+
"maxItems": 10,
|
|
309
|
+
"description": "The actions to run, in order",
|
|
310
|
+
"items": {
|
|
311
|
+
"type": "object",
|
|
312
|
+
"properties": {
|
|
313
|
+
"action": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"enum": [
|
|
316
|
+
"key",
|
|
317
|
+
"type_text",
|
|
318
|
+
"type",
|
|
319
|
+
"click",
|
|
320
|
+
"double_click",
|
|
321
|
+
"right_click",
|
|
322
|
+
"scroll",
|
|
323
|
+
"wait",
|
|
324
|
+
"open_app"
|
|
325
|
+
],
|
|
326
|
+
"description": "The action to run"
|
|
327
|
+
},
|
|
328
|
+
"key": {
|
|
329
|
+
"type": "string",
|
|
330
|
+
"description": "key: key or shortcut to press (e.g. enter, tab, cmd+n)"
|
|
331
|
+
},
|
|
332
|
+
"text": {
|
|
333
|
+
"type": "string",
|
|
334
|
+
"description": "type_text (or type): the text to type"
|
|
335
|
+
},
|
|
336
|
+
"element_id": {
|
|
337
|
+
"type": "integer",
|
|
338
|
+
"description": "click, double_click, right_click, scroll: the [ID] of the element from the latest accessibility tree (preferred)"
|
|
339
|
+
},
|
|
340
|
+
"x": {
|
|
341
|
+
"type": "integer",
|
|
342
|
+
"description": "click, double_click, right_click, scroll: X coordinate on screen (fallback when no element_id)"
|
|
343
|
+
},
|
|
344
|
+
"y": {
|
|
345
|
+
"type": "integer",
|
|
346
|
+
"description": "click, double_click, right_click, scroll: Y coordinate on screen (fallback when no element_id)"
|
|
347
|
+
},
|
|
348
|
+
"direction": {
|
|
349
|
+
"type": "string",
|
|
350
|
+
"enum": ["up", "down", "left", "right"],
|
|
351
|
+
"description": "scroll: scroll direction"
|
|
352
|
+
},
|
|
353
|
+
"amount": {
|
|
354
|
+
"type": "integer",
|
|
355
|
+
"description": "scroll: scroll amount (1-10)"
|
|
356
|
+
},
|
|
357
|
+
"duration_ms": {
|
|
358
|
+
"type": "integer",
|
|
359
|
+
"description": "wait: milliseconds to wait"
|
|
360
|
+
},
|
|
361
|
+
"app_name": {
|
|
362
|
+
"type": "string",
|
|
363
|
+
"description": "open_app: the name of the application to open (e.g. \"Google Chrome\")"
|
|
364
|
+
},
|
|
365
|
+
"reasoning": {
|
|
366
|
+
"type": "string",
|
|
367
|
+
"description": "Optional: why this action"
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
"required": ["action"]
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
"reasoning": {
|
|
374
|
+
"type": "string",
|
|
375
|
+
"description": "Optional: what these actions do together. Reasoning on each action works too"
|
|
376
|
+
},
|
|
377
|
+
"target_client_id": {
|
|
378
|
+
"type": "string",
|
|
379
|
+
"description": "ID of the specific client to target. Required when multiple clients support host_cu; omit when only one is connected. Obtain IDs from `assistant clients list --capability host_cu`."
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"required": ["actions"]
|
|
383
|
+
},
|
|
384
|
+
"executor": "tools/computer-use-sequence.ts",
|
|
385
|
+
"execution_target": "host",
|
|
386
|
+
"supported_client_os": ["macos"]
|
|
387
|
+
},
|
|
289
388
|
{
|
|
290
389
|
"name": "computer_use_done",
|
|
291
390
|
"description": "Signal that the computer use task is complete. Provide a summary of what was accomplished. This ends the computer use session.",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { forwardComputerUseProxyTool } from "../../../../tools/computer-use/skill-proxy-bridge.js";
|
|
2
|
+
import type {
|
|
3
|
+
ToolContext,
|
|
4
|
+
ToolExecutionResult,
|
|
5
|
+
} from "../../../../tools/types.js";
|
|
6
|
+
|
|
7
|
+
export async function run(
|
|
8
|
+
input: Record<string, unknown>,
|
|
9
|
+
context: ToolContext,
|
|
10
|
+
): Promise<ToolExecutionResult> {
|
|
11
|
+
return forwardComputerUseProxyTool("computer_use_sequence", input, context);
|
|
12
|
+
}
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
FFMPEG_PREPROCESS_TIMEOUT_MS,
|
|
27
27
|
spawnWithTimeout,
|
|
28
28
|
} from "../../../../util/spawn.js";
|
|
29
|
+
import { safeStringSlice } from "../../../../util/unicode.js";
|
|
29
30
|
import { transcribeSegmentAudio } from "./audio-transcribe.js";
|
|
30
31
|
|
|
31
32
|
// ---------------------------------------------------------------------------
|
|
@@ -691,7 +692,7 @@ export async function preprocessForAsset(
|
|
|
691
692
|
const msg = (err as Error).message;
|
|
692
693
|
updateProcessingStage(stage.id, {
|
|
693
694
|
status: "failed",
|
|
694
|
-
lastError: msg
|
|
695
|
+
lastError: safeStringSlice(msg, 0, 500),
|
|
695
696
|
});
|
|
696
697
|
throw err;
|
|
697
698
|
}
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
updateProcessingStage,
|
|
22
22
|
} from "../../../../persistence/media-store.js";
|
|
23
23
|
import { computeRetryDelay, sleep } from "../../../../util/retry.js";
|
|
24
|
+
import { safeStringSlice } from "../../../../util/unicode.js";
|
|
24
25
|
|
|
25
26
|
// ---------------------------------------------------------------------------
|
|
26
27
|
// Types
|
|
@@ -224,7 +225,7 @@ export async function runPipeline(
|
|
|
224
225
|
onProgress?.(`Completed stage: ${stageName}`);
|
|
225
226
|
break;
|
|
226
227
|
} catch (err) {
|
|
227
|
-
const errorMsg = (err as Error).message
|
|
228
|
+
const errorMsg = safeStringSlice((err as Error).message, 0, 500);
|
|
228
229
|
onProgress?.(
|
|
229
230
|
`Stage ${stageName} failed (attempt ${attempt + 1}/${maxRetries + 1}): ${errorMsg}`,
|
|
230
231
|
);
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
FFPROBE_TIMEOUT_MS,
|
|
27
27
|
spawnWithTimeout,
|
|
28
28
|
} from "../../../../util/spawn.js";
|
|
29
|
+
import { safeStringSlice } from "../../../../util/unicode.js";
|
|
29
30
|
|
|
30
31
|
// ---------------------------------------------------------------------------
|
|
31
32
|
// Helpers
|
|
@@ -268,7 +269,7 @@ export async function run(
|
|
|
268
269
|
);
|
|
269
270
|
if (reencodeResult.exitCode !== 0) {
|
|
270
271
|
return {
|
|
271
|
-
content: `ffmpeg clip extraction failed (both stream copy and re-encode): ${reencodeResult.stderr
|
|
272
|
+
content: `ffmpeg clip extraction failed (both stream copy and re-encode): ${safeStringSlice(reencodeResult.stderr, 0, 500)}`,
|
|
272
273
|
isError: true,
|
|
273
274
|
};
|
|
274
275
|
}
|
|
@@ -23,6 +23,7 @@ import type {
|
|
|
23
23
|
ToolContext,
|
|
24
24
|
ToolExecutionResult,
|
|
25
25
|
} from "../../../../tools/types.js";
|
|
26
|
+
import { safeStringSlice } from "../../../../util/unicode.js";
|
|
26
27
|
|
|
27
28
|
const VALID_AUTONOMY_LEVELS = new Set<string>(["auto", "draft", "notify"]);
|
|
28
29
|
|
|
@@ -68,7 +69,7 @@ export async function executePlaybookCreate(
|
|
|
68
69
|
};
|
|
69
70
|
const statement = JSON.stringify(playbook);
|
|
70
71
|
const sanitizedTrigger = trigger.replace(/[\r\n]+/g, " ");
|
|
71
|
-
const subject = `Playbook: ${sanitizedTrigger}
|
|
72
|
+
const subject = safeStringSlice(`Playbook: ${sanitizedTrigger}`, 0, 80);
|
|
72
73
|
const content = `${subject}\n${statement}`;
|
|
73
74
|
|
|
74
75
|
try {
|
|
@@ -23,6 +23,7 @@ import type {
|
|
|
23
23
|
ToolContext,
|
|
24
24
|
ToolExecutionResult,
|
|
25
25
|
} from "../../../../tools/types.js";
|
|
26
|
+
import { safeStringSlice } from "../../../../util/unicode.js";
|
|
26
27
|
|
|
27
28
|
const VALID_AUTONOMY_LEVELS = new Set<string>(["auto", "draft", "notify"]);
|
|
28
29
|
|
|
@@ -100,7 +101,7 @@ export async function executePlaybookUpdate(
|
|
|
100
101
|
|
|
101
102
|
const statement = JSON.stringify(updated);
|
|
102
103
|
const sanitizedTrigger = updated.trigger.replace(/[\r\n]+/g, " ");
|
|
103
|
-
const subject = `Playbook: ${sanitizedTrigger}
|
|
104
|
+
const subject = safeStringSlice(`Playbook: ${sanitizedTrigger}`, 0, 80);
|
|
104
105
|
const content = `${subject}\n${statement}`;
|
|
105
106
|
|
|
106
107
|
// Check for duplicate content among other playbook nodes
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
"type": "boolean",
|
|
38
38
|
"description": "Whether to overwrite an existing skill with the same ID (default: false)."
|
|
39
39
|
},
|
|
40
|
+
"change_summary": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "What changed and why, in one or two short sentences (at most 200 characters) written for the person who reads the \"Skill updated\" notice, e.g. \"Added the retry after an expired session and the export endpoint that held steady.\" Required when a background pass overwrites an existing skill (the update is rejected without it) and becomes that notice's body. Ignored on a create and on a user-directed edit."
|
|
43
|
+
},
|
|
40
44
|
"includes": {
|
|
41
45
|
"type": "array",
|
|
42
46
|
"items": { "type": "string" },
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
FFPROBE_TIMEOUT_MS,
|
|
20
20
|
spawnWithTimeout,
|
|
21
21
|
} from "../../../../util/spawn.js";
|
|
22
|
+
import { safeStringSlice } from "../../../../util/unicode.js";
|
|
22
23
|
|
|
23
24
|
const VIDEO_EXTENSIONS = new Set([
|
|
24
25
|
".mp4",
|
|
@@ -107,7 +108,9 @@ async function splitAudio(
|
|
|
107
108
|
signal,
|
|
108
109
|
);
|
|
109
110
|
if (result.exitCode !== 0) {
|
|
110
|
-
throw new Error(
|
|
111
|
+
throw new Error(
|
|
112
|
+
`Failed to split audio: ${safeStringSlice(result.stderr, 0, 300)}`,
|
|
113
|
+
);
|
|
111
114
|
}
|
|
112
115
|
const files = await readdir(chunkDir);
|
|
113
116
|
return files
|
|
@@ -167,7 +170,7 @@ async function toWav(
|
|
|
167
170
|
signal,
|
|
168
171
|
);
|
|
169
172
|
if (result.exitCode !== 0) {
|
|
170
|
-
throw new Error(`ffmpeg failed: ${result.stderr
|
|
173
|
+
throw new Error(`ffmpeg failed: ${safeStringSlice(result.stderr, 0, 500)}`);
|
|
171
174
|
}
|
|
172
175
|
return wavPath;
|
|
173
176
|
}
|
|
@@ -34,10 +34,7 @@ import {
|
|
|
34
34
|
type OAuthConnectionRow,
|
|
35
35
|
type OAuthProviderRow,
|
|
36
36
|
} from "../oauth/oauth-store.js";
|
|
37
|
-
import {
|
|
38
|
-
expectedScopesForStoredToken,
|
|
39
|
-
scopeDifference,
|
|
40
|
-
} from "../oauth/scope-utils.js";
|
|
37
|
+
import { missingScopesForStoredToken } from "../oauth/scope-utils.js";
|
|
41
38
|
import { credentialKey } from "../security/credential-key.js";
|
|
42
39
|
import {
|
|
43
40
|
getSecureKeyAsync,
|
|
@@ -294,26 +291,23 @@ async function checkConnection(
|
|
|
294
291
|
// token rather than the provider's bot-side `scope` parameter. A provider
|
|
295
292
|
// asking for user scopes as well stores the user token and records that
|
|
296
293
|
// token's grant, so the bot request names scopes that grant can never hold.
|
|
297
|
-
const
|
|
298
|
-
const expectedScopes = expectedScopesForStoredToken(
|
|
294
|
+
const missing = missingScopesForStoredToken(
|
|
299
295
|
safeJsonParse<string[]>(defaultScopesRaw, []),
|
|
300
296
|
safeJsonParse<Record<string, string> | undefined>(
|
|
301
297
|
authorizeParamsRaw,
|
|
302
298
|
undefined,
|
|
303
299
|
),
|
|
304
300
|
scopeSeparator ?? undefined,
|
|
301
|
+
safeJsonParse<string[]>(grantedScopesRaw, []),
|
|
305
302
|
);
|
|
306
|
-
if (
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
canAutoRecover: false,
|
|
315
|
-
};
|
|
316
|
-
}
|
|
303
|
+
if (missing.length > 0) {
|
|
304
|
+
return {
|
|
305
|
+
...base,
|
|
306
|
+
status: "missing_scopes",
|
|
307
|
+
details: `${provider} is missing required scopes: ${missing.join(", ")}. Features may not work correctly.`,
|
|
308
|
+
missingScopes: missing,
|
|
309
|
+
canAutoRecover: false,
|
|
310
|
+
};
|
|
317
311
|
}
|
|
318
312
|
|
|
319
313
|
// 4. Liveness ping
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
isModelNotFoundError,
|
|
31
31
|
isVisionNotSupportedError,
|
|
32
32
|
} from "../util/provider-error-patterns.js";
|
|
33
|
+
import { safeStringSlice } from "../util/unicode.js";
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* Classified conversation error ready for client emission.
|
|
@@ -580,7 +581,7 @@ function classifyCore(
|
|
|
580
581
|
const detailMatch = message.match(/API error \(\d+\):\s*(.+)/i);
|
|
581
582
|
const detail = detailMatch?.[1];
|
|
582
583
|
const suffix = detail
|
|
583
|
-
? `: ${detail.length > 200 ? detail
|
|
584
|
+
? `: ${detail.length > 200 ? safeStringSlice(detail, 0, 200) + "…" : detail}`
|
|
584
585
|
: "";
|
|
585
586
|
return {
|
|
586
587
|
code: "PROVIDER_API",
|
|
@@ -612,7 +613,7 @@ function extractProviderDetail(message: string): string | undefined {
|
|
|
612
613
|
if (!detail) {
|
|
613
614
|
return undefined;
|
|
614
615
|
}
|
|
615
|
-
return detail.length > 200 ? `${detail
|
|
616
|
+
return detail.length > 200 ? `${safeStringSlice(detail, 0, 200)}…` : detail;
|
|
616
617
|
}
|
|
617
618
|
|
|
618
619
|
/**
|
|
@@ -16,6 +16,7 @@ import { estimateContentBlockTokens } from "../context/token-estimator.js";
|
|
|
16
16
|
import { getSummaryFromContextMessage } from "../plugins/defaults/compaction/window-manager.js";
|
|
17
17
|
import { mediaSourceDescriptor } from "../providers/media-resolve.js";
|
|
18
18
|
import type { ContentBlock, Message } from "../providers/types.js";
|
|
19
|
+
import { safeStringSlice } from "../util/unicode.js";
|
|
19
20
|
|
|
20
21
|
export interface StripMediaOptions {
|
|
21
22
|
/** Token budget available for media in the latest user message. Keeps as
|
|
@@ -238,7 +239,7 @@ function fileBlockToStub(
|
|
|
238
239
|
const extracted = (block.extracted_text ?? "").trim();
|
|
239
240
|
const preview =
|
|
240
241
|
extracted.length > MAX_MEDIA_STUB_TEXT
|
|
241
|
-
? `${extracted
|
|
242
|
+
? `${safeStringSlice(extracted, 0, MAX_MEDIA_STUB_TEXT)}...`
|
|
242
243
|
: extracted;
|
|
243
244
|
return {
|
|
244
245
|
type: "text",
|
|
@@ -87,6 +87,7 @@ import { TERMINAL_STATUSES } from "../subagent/types.js";
|
|
|
87
87
|
import { canonicalizeInboundIdentity } from "../util/canonicalize-identity.js";
|
|
88
88
|
import { safeParseRecord } from "../util/json.js";
|
|
89
89
|
import { getLogger } from "../util/logger.js";
|
|
90
|
+
import { safeStringSlice } from "../util/unicode.js";
|
|
90
91
|
import { channelSupportsInlineOptions } from "./channel-ui-capability.js";
|
|
91
92
|
import { findConversationOrSubagent } from "./conversation-registry.js";
|
|
92
93
|
import {
|
|
@@ -575,7 +576,7 @@ function injectActiveSurfaceContext(
|
|
|
575
576
|
if (schema && schema !== '"{}"' && schema !== "{}") {
|
|
576
577
|
const truncatedSchema =
|
|
577
578
|
schema.length > MAX_SCHEMA_LENGTH
|
|
578
|
-
? schema
|
|
579
|
+
? safeStringSlice(schema, 0, MAX_SCHEMA_LENGTH) + "… (truncated)"
|
|
579
580
|
: schema;
|
|
580
581
|
lines.push("", `Data schema: ${truncatedSchema}`);
|
|
581
582
|
}
|
|
@@ -101,6 +101,7 @@ export {
|
|
|
101
101
|
type SurfaceShowPair,
|
|
102
102
|
type SurfaceStateEntry,
|
|
103
103
|
} from "./conversation-surface-state.js";
|
|
104
|
+
import { safeStringSlice } from "../util/unicode.js";
|
|
104
105
|
import type { HostAppControlInput } from "./message-types/host-app-control.js";
|
|
105
106
|
import type { UserMessageAttachment } from "./message-types/shared.js";
|
|
106
107
|
|
|
@@ -1487,7 +1488,10 @@ function handleDocumentContentChanged(
|
|
|
1487
1488
|
updateApp(appId, {
|
|
1488
1489
|
name: title || app.name,
|
|
1489
1490
|
description: `Document with ${wordCount ?? 0} words`,
|
|
1490
|
-
preview:
|
|
1491
|
+
preview:
|
|
1492
|
+
content === undefined
|
|
1493
|
+
? undefined
|
|
1494
|
+
: safeStringSlice(content, 0, 200),
|
|
1491
1495
|
htmlDefinition: updatedHtml,
|
|
1492
1496
|
});
|
|
1493
1497
|
|
|
@@ -10,6 +10,7 @@ import { join } from "node:path";
|
|
|
10
10
|
|
|
11
11
|
import { getLogger } from "../util/logger.js";
|
|
12
12
|
import { getWorkspaceDir } from "../util/platform.js";
|
|
13
|
+
import { safeStringSlice } from "../util/unicode.js";
|
|
13
14
|
|
|
14
15
|
const log = getLogger("dictation-profile-store");
|
|
15
16
|
|
|
@@ -130,7 +131,7 @@ function validateAndClampConfig(raw: unknown): DictationProfilesConfig {
|
|
|
130
131
|
{ profileId: profile.id },
|
|
131
132
|
`stylePrompt exceeds ${MAX_STYLE_PROMPT_LENGTH} chars, truncating`,
|
|
132
133
|
);
|
|
133
|
-
stylePrompt = stylePrompt
|
|
134
|
+
stylePrompt = safeStringSlice(stylePrompt, 0, MAX_STYLE_PROMPT_LENGTH);
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
// Validate dictionary entries
|
|
@@ -32,6 +32,7 @@ import { unwrapExternalContentForDisplay } from "../../security/untrusted-conten
|
|
|
32
32
|
import type { CredentialInjectionTemplate } from "../../tools/credentials/policy-types.js";
|
|
33
33
|
import { getLogger } from "../../util/logger.js";
|
|
34
34
|
import { joinWithSpacing } from "../../util/text-spacing.js";
|
|
35
|
+
import { safeStringSlice } from "../../util/unicode.js";
|
|
35
36
|
import { estimateBase64Bytes } from "../assistant-attachments.js";
|
|
36
37
|
import { conversationSupportsDynamicUi } from "../channel-ui-capability.js";
|
|
37
38
|
import { findConversation } from "../conversation-registry.js";
|
|
@@ -264,7 +265,7 @@ function clampAttachmentText(text: string): string {
|
|
|
264
265
|
if (text.length <= HISTORY_ATTACHMENT_TEXT_LIMIT) {
|
|
265
266
|
return text;
|
|
266
267
|
}
|
|
267
|
-
return `${text
|
|
268
|
+
return `${safeStringSlice(text, 0, HISTORY_ATTACHMENT_TEXT_LIMIT)}<truncated />`;
|
|
268
269
|
}
|
|
269
270
|
|
|
270
271
|
interface FileBlockMetadata {
|
|
@@ -82,6 +82,7 @@ import {
|
|
|
82
82
|
searchSkillsRegistry,
|
|
83
83
|
} from "../../skills/skillssh-registry.js";
|
|
84
84
|
import { getWorkspaceSkillsDir } from "../../util/platform.js";
|
|
85
|
+
import { safeStringSlice } from "../../util/unicode.js";
|
|
85
86
|
import { getConfigWatcher } from "../config-watcher.js";
|
|
86
87
|
import type {
|
|
87
88
|
SkillDetailResponse,
|
|
@@ -237,9 +238,11 @@ function heuristicDraft(body: string): {
|
|
|
237
238
|
const lines = body.split("\n").filter((l) => l.trim());
|
|
238
239
|
const firstLine = lines[0]?.trim() ?? "";
|
|
239
240
|
const name =
|
|
240
|
-
firstLine.replace(/^#+\s*/, "")
|
|
241
|
+
safeStringSlice(firstLine.replace(/^#+\s*/, ""), 0, 100) ||
|
|
242
|
+
"Untitled Skill";
|
|
241
243
|
const skillId = toSkillSlug(name) || "untitled-skill";
|
|
242
|
-
const description =
|
|
244
|
+
const description =
|
|
245
|
+
safeStringSlice(body.trim(), 0, 200) || "No description provided";
|
|
243
246
|
return { skillId, name, description, emoji: "\u{1F4DD}" };
|
|
244
247
|
}
|
|
245
248
|
|
|
@@ -1732,7 +1735,7 @@ export async function draftSkill(params: {
|
|
|
1732
1735
|
"- emoji: a single emoji character representing the skill",
|
|
1733
1736
|
"",
|
|
1734
1737
|
"Skill body:",
|
|
1735
|
-
body
|
|
1738
|
+
safeStringSlice(body, 0, 2000),
|
|
1736
1739
|
].join("\n");
|
|
1737
1740
|
|
|
1738
1741
|
const response = await provider.sendMessage([userMessage(prompt)], {
|