@ericsanchezok/synergy-util 3.0.24 → 3.1.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/LICENSE.codex +201 -0
- package/NOTICE +9 -0
- package/dist/activity.d.ts +9 -4
- package/dist/activity.js +20 -19
- package/dist/asset-reference.d.ts +15 -0
- package/dist/asset-reference.js +98 -0
- package/dist/atomic-file.d.ts +9 -0
- package/dist/atomic-file.js +86 -0
- package/dist/attachment-presentation.d.ts +26 -0
- package/dist/attachment-presentation.js +11 -0
- package/dist/capability.d.ts +1 -1
- package/dist/capability.js +5 -19
- package/dist/cli-command.d.ts +12 -0
- package/dist/cli-command.js +3 -0
- package/dist/encode.d.ts +3 -0
- package/dist/encode.js +7 -0
- package/dist/error.d.ts +36 -56
- package/dist/feature-config.d.ts +4 -0
- package/dist/feature-config.js +23 -0
- package/dist/features.d.ts +134 -0
- package/dist/features.js +195 -0
- package/dist/file-patch.d.ts +31 -0
- package/dist/file-patch.js +218 -0
- package/dist/filesystem-identity.d.ts +28 -0
- package/dist/filesystem-identity.js +71 -0
- package/dist/fn.d.ts +1 -1
- package/dist/fs-lock.d.ts +5 -1
- package/dist/fs-lock.js +14 -6
- package/dist/input-assistance.d.ts +51 -0
- package/dist/input-assistance.js +61 -0
- package/dist/installed-launcher.d.ts +18 -0
- package/dist/installed-launcher.js +39 -0
- package/dist/io-retry.d.ts +11 -0
- package/dist/io-retry.js +36 -0
- package/dist/json-value.d.ts +4 -0
- package/dist/json-value.js +12 -0
- package/dist/markdown-assets.d.ts +6 -0
- package/dist/markdown-assets.js +29 -0
- package/dist/markdown-link.d.ts +2 -0
- package/dist/markdown-link.js +8 -0
- package/dist/native-assets.d.ts +7 -0
- package/dist/native-assets.js +28 -0
- package/dist/network-error.d.ts +7 -0
- package/dist/network-error.js +111 -0
- package/dist/plugin-policy.d.ts +1 -1
- package/dist/process-group.d.ts +45 -0
- package/dist/process-group.js +156 -0
- package/dist/process-identity.js +5 -2
- package/dist/projection-patch.d.ts +9 -0
- package/dist/projection-patch.js +74 -0
- package/dist/reasoning-item.d.ts +1 -0
- package/dist/reasoning-item.js +16 -0
- package/dist/render-artifact.d.ts +352 -0
- package/dist/render-artifact.js +115 -0
- package/dist/render-ui.d.ts +202 -0
- package/dist/render-ui.js +208 -0
- package/dist/resource-reference.d.ts +73 -0
- package/dist/resource-reference.js +227 -0
- package/dist/retry.d.ts +4 -0
- package/dist/retry.js +56 -23
- package/dist/runtime-startup.d.ts +240 -2
- package/dist/runtime-startup.js +108 -9
- package/dist/terminal.d.ts +217 -0
- package/dist/terminal.js +111 -0
- package/dist/tool-display.d.ts +10 -0
- package/dist/tool-display.js +22 -1
- package/dist/tool-timeout.d.ts +21 -0
- package/dist/tool-timeout.js +1 -0
- package/dist/tool.d.ts +6 -7
- package/dist/workbench-view.d.ts +692 -0
- package/dist/workbench-view.js +90 -0
- package/dist/worker-plan.d.ts +39 -0
- package/dist/worker-plan.js +33 -0
- package/package.json +28 -4
package/dist/terminal.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { EOL } from "os";
|
|
3
|
+
import { NamedError } from "./error.js";
|
|
4
|
+
export var UI;
|
|
5
|
+
(function (UI) {
|
|
6
|
+
UI.CancelledError = NamedError.create("UICancelledError", z.void());
|
|
7
|
+
UI.Style = {
|
|
8
|
+
TEXT_HIGHLIGHT: "\x1b[96m",
|
|
9
|
+
TEXT_HIGHLIGHT_BOLD: "\x1b[96m\x1b[1m",
|
|
10
|
+
TEXT_DIM: "\x1b[90m",
|
|
11
|
+
TEXT_DIM_BOLD: "\x1b[90m\x1b[1m",
|
|
12
|
+
TEXT_NORMAL: "\x1b[0m",
|
|
13
|
+
TEXT_NORMAL_BOLD: "\x1b[1m",
|
|
14
|
+
TEXT_WARNING: "\x1b[93m",
|
|
15
|
+
TEXT_WARNING_BOLD: "\x1b[93m\x1b[1m",
|
|
16
|
+
TEXT_DANGER: "\x1b[91m",
|
|
17
|
+
TEXT_DANGER_BOLD: "\x1b[91m\x1b[1m",
|
|
18
|
+
TEXT_SUCCESS: "\x1b[92m",
|
|
19
|
+
TEXT_SUCCESS_BOLD: "\x1b[92m\x1b[1m",
|
|
20
|
+
TEXT_INFO: "\x1b[94m",
|
|
21
|
+
TEXT_INFO_BOLD: "\x1b[94m\x1b[1m",
|
|
22
|
+
};
|
|
23
|
+
function println(...message) {
|
|
24
|
+
print(...message);
|
|
25
|
+
Bun.stderr.write(EOL);
|
|
26
|
+
}
|
|
27
|
+
UI.println = println;
|
|
28
|
+
function print(...message) {
|
|
29
|
+
blank = false;
|
|
30
|
+
Bun.stderr.write(message.join(" "));
|
|
31
|
+
}
|
|
32
|
+
UI.print = print;
|
|
33
|
+
let blank = false;
|
|
34
|
+
function empty() {
|
|
35
|
+
if (blank)
|
|
36
|
+
return;
|
|
37
|
+
println("" + UI.Style.TEXT_NORMAL);
|
|
38
|
+
blank = true;
|
|
39
|
+
}
|
|
40
|
+
UI.empty = empty;
|
|
41
|
+
async function input(prompt) {
|
|
42
|
+
const readline = require("readline");
|
|
43
|
+
const rl = readline.createInterface({
|
|
44
|
+
input: process.stdin,
|
|
45
|
+
output: process.stdout,
|
|
46
|
+
});
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
rl.question(prompt, (answer) => {
|
|
49
|
+
rl.close();
|
|
50
|
+
resolve(answer.trim());
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
UI.input = input;
|
|
55
|
+
function error(message) {
|
|
56
|
+
println(UI.Style.TEXT_DANGER_BOLD + "Error: " + UI.Style.TEXT_NORMAL + message);
|
|
57
|
+
}
|
|
58
|
+
UI.error = error;
|
|
59
|
+
function markdown(text) {
|
|
60
|
+
return text;
|
|
61
|
+
}
|
|
62
|
+
UI.markdown = markdown;
|
|
63
|
+
function progressBar(opts) {
|
|
64
|
+
const width = opts.width ?? 24;
|
|
65
|
+
const ratio = Math.max(0, Math.min(1, Number.isFinite(opts.ratio) ? opts.ratio : 0));
|
|
66
|
+
const filled = Math.round(ratio * width);
|
|
67
|
+
const empty = Math.max(0, width - filled);
|
|
68
|
+
const filledChar = opts.filledChar ?? "■";
|
|
69
|
+
const emptyChar = opts.emptyChar ?? "·";
|
|
70
|
+
const filledStyle = opts.filledStyle ?? UI.Style.TEXT_INFO_BOLD;
|
|
71
|
+
const emptyStyle = opts.emptyStyle ?? UI.Style.TEXT_DIM;
|
|
72
|
+
const body = filledStyle + filledChar.repeat(filled) + emptyStyle + emptyChar.repeat(empty) + UI.Style.TEXT_NORMAL;
|
|
73
|
+
if (opts.brackets === false)
|
|
74
|
+
return body;
|
|
75
|
+
return UI.Style.TEXT_DIM + "[" + UI.Style.TEXT_NORMAL + body + UI.Style.TEXT_DIM + "]" + UI.Style.TEXT_NORMAL;
|
|
76
|
+
}
|
|
77
|
+
UI.progressBar = progressBar;
|
|
78
|
+
function card(opts) {
|
|
79
|
+
const DIM = UI.Style.TEXT_DIM;
|
|
80
|
+
const RESET = UI.Style.TEXT_NORMAL;
|
|
81
|
+
const ts = opts.titleStyle ?? UI.Style.TEXT_HIGHLIGHT_BOLD;
|
|
82
|
+
const labelCol = 3 + Math.max(...opts.rows.map((r) => r.label.length)) + 2;
|
|
83
|
+
const widths = [opts.minWidth ?? 0, 1 + opts.title.length, ...opts.rows.map((r) => labelCol + r.value.length)];
|
|
84
|
+
if (opts.description)
|
|
85
|
+
widths.push(1 + opts.description.length);
|
|
86
|
+
if (opts.footer)
|
|
87
|
+
widths.push(1 + opts.footer.length);
|
|
88
|
+
const w = Math.max(...widths);
|
|
89
|
+
const fill = (n) => " ".repeat(Math.max(0, n));
|
|
90
|
+
const blank = DIM + "│" + fill(w) + "│";
|
|
91
|
+
const lines = [];
|
|
92
|
+
lines.push(DIM + "┌" + "─".repeat(w) + "┐");
|
|
93
|
+
lines.push(DIM + "│" + ts + " " + opts.title + fill(w - 1 - opts.title.length) + DIM + "│");
|
|
94
|
+
if (opts.description) {
|
|
95
|
+
lines.push(DIM + "│" + RESET + " " + opts.description + fill(w - 1 - opts.description.length) + DIM + "│");
|
|
96
|
+
}
|
|
97
|
+
lines.push(blank);
|
|
98
|
+
for (const r of opts.rows) {
|
|
99
|
+
const vs = r.valueStyle ?? RESET;
|
|
100
|
+
const gap = fill(labelCol - 3 - r.label.length);
|
|
101
|
+
lines.push(DIM + "│" + RESET + " " + r.label + gap + vs + r.value + fill(w - labelCol - r.value.length) + DIM + "│");
|
|
102
|
+
}
|
|
103
|
+
lines.push(blank);
|
|
104
|
+
if (opts.footer) {
|
|
105
|
+
lines.push(DIM + "│" + RESET + " " + opts.footer + fill(w - 1 - opts.footer.length) + DIM + "│");
|
|
106
|
+
}
|
|
107
|
+
lines.push(DIM + "└" + "─".repeat(w) + "┘" + RESET);
|
|
108
|
+
return lines.join("\n");
|
|
109
|
+
}
|
|
110
|
+
UI.card = card;
|
|
111
|
+
})(UI || (UI = {}));
|
package/dist/tool-display.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export interface ToolIconSource {
|
|
2
|
+
src: string;
|
|
3
|
+
mimeType?: string;
|
|
4
|
+
sizes?: string[];
|
|
5
|
+
theme?: "light" | "dark";
|
|
6
|
+
}
|
|
7
|
+
export declare const MAX_TOOL_ICON_BYTES: number;
|
|
8
|
+
export declare function toolIconSources(value: unknown): ToolIconSource[];
|
|
1
9
|
export interface ToolMediaDisplay {
|
|
2
10
|
type: "image" | "video" | "audio";
|
|
3
11
|
actionLabel?: string;
|
|
@@ -7,6 +15,8 @@ export interface ToolMediaDisplay {
|
|
|
7
15
|
size?: "small" | "medium" | "large";
|
|
8
16
|
}
|
|
9
17
|
export interface ToolDisplay {
|
|
18
|
+
/** A registered host/plugin glyph or bounded image data from the tool owner. */
|
|
19
|
+
icon?: string | ToolIconSource[];
|
|
10
20
|
kind?: "default" | "media-generation";
|
|
11
21
|
toolCard?: "visible" | "hidden";
|
|
12
22
|
media?: ToolMediaDisplay;
|
package/dist/tool-display.js
CHANGED
|
@@ -1 +1,22 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const MAX_TOOL_ICON_BYTES = 64 * 1024;
|
|
2
|
+
export function toolIconSources(value) {
|
|
3
|
+
if (!Array.isArray(value))
|
|
4
|
+
return [];
|
|
5
|
+
return value.slice(0, 3).flatMap((item) => {
|
|
6
|
+
if (!item || typeof item !== "object" || typeof item.src !== "string")
|
|
7
|
+
return [];
|
|
8
|
+
if (item.src.length > Math.ceil(MAX_TOOL_ICON_BYTES / 3) * 4 + 64)
|
|
9
|
+
return [];
|
|
10
|
+
if (!/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/.test(item.src))
|
|
11
|
+
return [];
|
|
12
|
+
if (item.theme !== undefined && item.theme !== "light" && item.theme !== "dark")
|
|
13
|
+
return [];
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
src: item.src,
|
|
17
|
+
...(typeof item.mimeType === "string" ? { mimeType: item.mimeType } : {}),
|
|
18
|
+
...(item.theme ? { theme: item.theme } : {}),
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single definition of the tool-timeout contract shared by the runtime
|
|
3
|
+
* (which produces it on tool parts) and the shared UI (which renders it).
|
|
4
|
+
*
|
|
5
|
+
* It lives in `util` because that is the only workspace package both
|
|
6
|
+
* `harness` and `ui` already depend on; UI may not import runtime-private
|
|
7
|
+
* modules, and exposing this through the plugin API would turn an internal
|
|
8
|
+
* diagnostic bag into a versioned public contract.
|
|
9
|
+
*
|
|
10
|
+
* Field names and units are deliberately unchanged (`*Ms`): the metadata is
|
|
11
|
+
* persisted on tool parts, so renaming would strand the timeout information on
|
|
12
|
+
* every historical part. Seconds are the unit at the human- and agent-facing
|
|
13
|
+
* boundary only; the conversion happens there, not here.
|
|
14
|
+
*/
|
|
15
|
+
export type ToolTimeoutSource = "tool_timeout" | "search" | "fetch" | "download" | "wait" | "auto_background" | "question" | "vision" | "document_extract";
|
|
16
|
+
export interface ToolTimeoutMetadata {
|
|
17
|
+
toolTimeoutMs: number;
|
|
18
|
+
operationTimeoutMs?: number;
|
|
19
|
+
displayMs: number;
|
|
20
|
+
source: ToolTimeoutSource;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/tool.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AttachmentPresentation } from "./attachment-presentation";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import type { ToolDisplay } from "./tool-display.js";
|
|
3
4
|
import type { BunShell } from "./shell.js";
|
|
@@ -85,12 +86,7 @@ export type PluginToolAttachment = {
|
|
|
85
86
|
filename?: string;
|
|
86
87
|
url: string;
|
|
87
88
|
localPath?: string;
|
|
88
|
-
presentation?:
|
|
89
|
-
hidden?: boolean;
|
|
90
|
-
renderer?: "image" | "video" | "audio" | "thumbnail" | "file";
|
|
91
|
-
size?: "original" | "small" | "medium" | "large";
|
|
92
|
-
crop?: boolean;
|
|
93
|
-
};
|
|
89
|
+
presentation?: AttachmentPresentation;
|
|
94
90
|
model?: {
|
|
95
91
|
mode: "summary";
|
|
96
92
|
summary?: string;
|
|
@@ -119,6 +115,7 @@ export type ToolExposure = {
|
|
|
119
115
|
group: string;
|
|
120
116
|
title?: string;
|
|
121
117
|
description?: string;
|
|
118
|
+
/** @deprecated Put selection guidance in description; retained for Plugin API4 source compatibility. */
|
|
122
119
|
whenToExpand?: string;
|
|
123
120
|
} | {
|
|
124
121
|
mode: "search";
|
|
@@ -131,16 +128,18 @@ export declare function tool<Args extends z.ZodRawShape>(input: {
|
|
|
131
128
|
description: string;
|
|
132
129
|
exposure?: ToolExposure;
|
|
133
130
|
display?: ToolDisplay;
|
|
131
|
+
requiresWorkspace?: boolean;
|
|
134
132
|
args: Args;
|
|
135
133
|
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<string | ToolResult>;
|
|
136
134
|
}): {
|
|
137
135
|
description: string;
|
|
138
136
|
exposure?: ToolExposure;
|
|
139
137
|
display?: ToolDisplay;
|
|
138
|
+
requiresWorkspace?: boolean;
|
|
140
139
|
args: Args;
|
|
141
140
|
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<string | ToolResult>;
|
|
142
141
|
};
|
|
143
142
|
export declare namespace tool {
|
|
144
|
-
|
|
143
|
+
export { z as schema };
|
|
145
144
|
}
|
|
146
145
|
export type ToolDefinition = ReturnType<typeof tool>;
|