@uncarved/jade 0.2.0 → 0.3.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/README.md +277 -0
- package/assets/logo.svg +1 -0
- package/bin/jade.js +15 -0
- package/dist/api.d.ts +5 -250
- package/dist/api.js +5 -7
- package/dist/api.js.map +1 -1
- package/dist/fetch.d.ts +8 -0
- package/dist/fetch.js +19 -17
- package/dist/fetch.js.map +1 -1
- package/dist/host.d.ts +12 -1
- package/dist/host.js +49 -1
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +28 -5
- package/dist/main.js.map +1 -1
- package/dist/remote.js +4 -0
- package/dist/remote.js.map +1 -1
- package/dist/session.d.ts +2 -0
- package/dist/session.js +133 -13
- package/dist/session.js.map +1 -1
- package/dist/source.d.ts +2 -10
- package/dist/source.js.map +1 -1
- package/dist/update.d.ts +8 -20
- package/dist/update.js +12 -1
- package/dist/update.js.map +1 -1
- package/package.json +6 -4
- package/plugins/approval/index.ts +246 -84
- package/plugins/approval/plugin.json +5 -1
- package/plugins/approval/policy.ts +27 -6
- package/plugins/approval/review.ts +1 -1
- package/plugins/ask/index.ts +2 -2
- package/plugins/budget/index.ts +1 -1
- package/plugins/checks/checks.ts +3 -2
- package/plugins/checks/index.ts +2 -5
- package/plugins/commands/index.ts +2 -44
- package/plugins/compact/compact.ts +15 -4
- package/plugins/compact/index.ts +13 -16
- package/plugins/continue/index.ts +1 -1
- package/plugins/cost/index.ts +143 -0
- package/plugins/cost/plugin.json +13 -0
- package/plugins/custom-commands/index.ts +85 -0
- package/plugins/custom-commands/plugin.json +8 -0
- package/plugins/editor/index.ts +88 -0
- package/plugins/editor/plugin.json +17 -0
- package/plugins/fs/fs.ts +110 -17
- package/plugins/fs/grep.ts +41 -11
- package/plugins/fs/index.ts +9 -7
- package/plugins/fs/renderers.ts +1 -1
- package/plugins/hooks/index.ts +152 -0
- package/plugins/hooks/plugin.json +14 -0
- package/plugins/keys/index.ts +2 -18
- package/plugins/mcp/index.ts +40 -12
- package/plugins/mcp/install.ts +139 -0
- package/plugins/mcp/mcp.ts +2 -1
- package/plugins/mcp/plugin.json +1 -1
- package/plugins/mcp/project.ts +37 -1
- package/plugins/memory/index.ts +4 -9
- package/plugins/memory/plugin.json +1 -1
- package/plugins/mentions/index.ts +33 -13
- package/plugins/models/configure.ts +258 -150
- package/plugins/models/context.ts +2 -2
- package/plugins/models/index.ts +50 -42
- package/plugins/models/plugin.json +1 -1
- package/plugins/models/provider.ts +22 -4
- package/plugins/models/saved.ts +8 -4
- package/plugins/modes/index.ts +2 -17
- package/plugins/plugins/index.ts +2 -2
- package/plugins/print/index.ts +60 -12
- package/plugins/print/plugin.json +1 -0
- package/plugins/prompts/index.ts +50 -14
- package/plugins/{memory → prompts}/notes.ts +21 -9
- package/plugins/prompts/plugin.json +8 -2
- package/plugins/prompts/prompts.ts +14 -8
- package/plugins/prompts/results.ts +63 -0
- package/plugins/prompts/sys.ts +16 -4
- package/plugins/renderers/index.ts +2 -43
- package/plugins/repeats/index.ts +1 -1
- package/plugins/schedule/index.ts +2 -2
- package/plugins/scratch/index.ts +2 -3
- package/plugins/screenshot/index.ts +26 -13
- package/plugins/screenshot/plugin.json +1 -1
- package/plugins/sessions/index.ts +2 -17
- package/plugins/shell/index.ts +56 -6
- package/plugins/shell/plugin.json +3 -1
- package/plugins/shell/renderers.ts +1 -1
- package/plugins/shell/service.ts +2 -13
- package/plugins/shell/shell.ts +31 -16
- package/plugins/skills/index.ts +172 -37
- package/plugins/skills/install.ts +212 -0
- package/plugins/skills/plugin.json +3 -2
- package/plugins/skills/project.ts +38 -1
- package/plugins/skills/skills.ts +28 -9
- package/plugins/steer/index.ts +142 -0
- package/plugins/steer/plugin.json +8 -0
- package/plugins/suggest/index.ts +16 -11
- package/plugins/suggest/plugin.json +1 -1
- package/plugins/task/index.ts +8 -16
- package/plugins/task/plugin.json +9 -2
- package/plugins/task/subagent.ts +119 -15
- package/plugins/todo/index.ts +4 -4
- package/plugins/tui/editor.ts +10 -2
- package/plugins/tui/frontend.ts +130 -25
- package/plugins/tui/index.ts +3 -8
- package/plugins/tui/markdown.ts +51 -6
- package/plugins/tui/mascot.ts +505 -0
- package/plugins/tui/mentions.ts +48 -8
- package/plugins/tui/plugin.json +2 -2
- package/plugins/tui/screen.ts +6 -0
- package/plugins/tui/transcript.ts +22 -3
- package/plugins/tui/tui.ts +323 -95
- package/plugins/tui/vendor.ts +16 -0
- package/plugins/undo/checkpoint.ts +26 -2
- package/plugins/undo/index.ts +86 -24
- package/plugins/undo/plugin.json +8 -2
- package/plugins/undo/snapshot.ts +129 -0
- package/plugins/update/index.ts +11 -15
- package/plugins/update/plugin.json +2 -1
- package/plugins/web/index.ts +2 -5
- package/plugins/web/renderers.ts +1 -1
- package/plugins/web/web.ts +6 -5
- package/plugins-dist/approval/index.js +232 -50
- package/plugins-dist/approval/plugin.json +5 -1
- package/plugins-dist/approval/policy.js +27 -5
- package/plugins-dist/ask/index.js +1 -1
- package/plugins-dist/budget/index.js +1 -1
- package/plugins-dist/checks/checks.js +2 -1
- package/plugins-dist/checks/index.js +1 -1
- package/plugins-dist/commands/index.js +1 -1
- package/plugins-dist/compact/compact.js +13 -2
- package/plugins-dist/compact/index.js +12 -8
- package/plugins-dist/continue/index.js +1 -1
- package/plugins-dist/cost/index.js +135 -0
- package/plugins-dist/cost/plugin.json +16 -0
- package/plugins-dist/custom-commands/index.js +86 -0
- package/plugins-dist/custom-commands/plugin.json +12 -0
- package/plugins-dist/editor/index.js +89 -0
- package/plugins-dist/editor/plugin.json +21 -0
- package/plugins-dist/fs/fs.js +106 -17
- package/plugins-dist/fs/grep.js +40 -12
- package/plugins-dist/fs/index.js +8 -5
- package/plugins-dist/hooks/index.js +145 -0
- package/plugins-dist/hooks/plugin.json +19 -0
- package/plugins-dist/keys/index.js +1 -1
- package/plugins-dist/mcp/index.js +41 -9
- package/plugins-dist/mcp/install.js +160 -0
- package/plugins-dist/mcp/mcp.js +2 -1
- package/plugins-dist/mcp/plugin.json +2 -1
- package/plugins-dist/mcp/project.js +42 -1
- package/plugins-dist/memory/index.js +3 -5
- package/plugins-dist/memory/plugin.json +1 -1
- package/plugins-dist/mentions/index.js +29 -11
- package/plugins-dist/models/configure.js +252 -151
- package/plugins-dist/models/context.js +2 -2
- package/plugins-dist/models/index.js +53 -16
- package/plugins-dist/models/plugin.json +1 -1
- package/plugins-dist/models/provider.js +4 -2
- package/plugins-dist/models/saved.js +9 -4
- package/plugins-dist/modes/index.js +1 -1
- package/plugins-dist/plugins/index.js +1 -1
- package/plugins-dist/print/index.js +62 -9
- package/plugins-dist/print/plugin.json +3 -0
- package/plugins-dist/prompts/index.js +49 -2
- package/plugins-dist/{memory → prompts}/notes.js +10 -7
- package/plugins-dist/prompts/plugin.json +8 -2
- package/plugins-dist/prompts/prompts.js +13 -8
- package/plugins-dist/prompts/results.js +60 -0
- package/plugins-dist/prompts/sys.js +15 -3
- package/plugins-dist/renderers/index.js +1 -1
- package/plugins-dist/repeats/index.js +1 -1
- package/plugins-dist/schedule/index.js +1 -1
- package/plugins-dist/scratch/index.js +1 -1
- package/plugins-dist/screenshot/index.js +25 -11
- package/plugins-dist/screenshot/plugin.json +1 -1
- package/plugins-dist/sessions/index.js +1 -1
- package/plugins-dist/shell/index.js +55 -3
- package/plugins-dist/shell/plugin.json +3 -1
- package/plugins-dist/shell/shell.js +26 -8
- package/plugins-dist/skills/index.js +184 -35
- package/plugins-dist/skills/install.js +178 -0
- package/plugins-dist/skills/plugin.json +6 -2
- package/plugins-dist/skills/project.js +43 -1
- package/plugins-dist/skills/skills.js +27 -10
- package/plugins-dist/steer/index.js +135 -0
- package/plugins-dist/steer/plugin.json +12 -0
- package/plugins-dist/suggest/index.js +15 -9
- package/plugins-dist/suggest/plugin.json +1 -1
- package/plugins-dist/task/index.js +7 -4
- package/plugins-dist/task/plugin.json +10 -2
- package/plugins-dist/task/subagent.js +106 -15
- package/plugins-dist/todo/index.js +3 -3
- package/plugins-dist/tui/editor.js +7 -2
- package/plugins-dist/tui/frontend.js +135 -18
- package/plugins-dist/tui/index.js +2 -1
- package/plugins-dist/tui/markdown.js +48 -6
- package/plugins-dist/tui/mascot.js +439 -0
- package/plugins-dist/tui/mentions.js +44 -6
- package/plugins-dist/tui/plugin.json +3 -2
- package/plugins-dist/tui/screen.js +2 -0
- package/plugins-dist/tui/transcript.js +19 -2
- package/plugins-dist/tui/tui.js +303 -83
- package/plugins-dist/tui/vendor.js +13822 -0
- package/plugins-dist/undo/checkpoint.js +28 -1
- package/plugins-dist/undo/index.js +92 -22
- package/plugins-dist/undo/plugin.json +10 -3
- package/plugins-dist/undo/snapshot.js +111 -0
- package/plugins-dist/update/index.js +9 -10
- package/plugins-dist/update/plugin.json +4 -1
- package/plugins-dist/web/index.js +1 -1
- package/plugins-dist/web/web.js +6 -5
- package/sdk/python/__pycache__/jade_plugin.cpython-312.pyc +0 -0
- package/sdk/python/jade_plugin.py +8 -0
- package/src/api.ts +7 -262
- package/src/fetch.ts +18 -16
- package/src/host.ts +49 -1
- package/src/index.ts +1 -1
- package/src/main.ts +25 -6
- package/src/remote.ts +2 -0
- package/src/session.ts +134 -15
- package/src/source.ts +2 -11
- package/src/update.ts +16 -10
- package/plugins/undo/notes.ts +0 -43
- package/plugins-dist/undo/notes.js +0 -36
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// 只负责显示和统计,不驱动运行时;前端(frontend.ts)用 lastEnd、turnFailed 决定接下来做什么。
|
|
5
5
|
|
|
6
6
|
import type { Block, EventDataMap, LogEvent, PendingCall, Runtime, TurnEndReason, Usage } from "uncarved";
|
|
7
|
-
import type { EventRenderer, ToolRenderer } from "
|
|
7
|
+
import type { EventRenderer, ToolRenderer } from "@uncarved/jade-api/services";
|
|
8
8
|
import { clip, clipStyled, detailsOf, preview, summarize } from "./render.ts";
|
|
9
9
|
import { bold, cyan, dim, green, red, yellow, type Screen } from "./screen.ts";
|
|
10
10
|
|
|
@@ -19,6 +19,8 @@ export interface TranscriptOptions {
|
|
|
19
19
|
contextWindow(): number;
|
|
20
20
|
/** 自动压缩的阈值(状态栏显示用) */
|
|
21
21
|
compactAt?(): number;
|
|
22
|
+
/** 每次回复的输出上限(回复被截断时的提示用);没有时说是服务的默认值 */
|
|
23
|
+
maxTokens?(): number | undefined;
|
|
22
24
|
/** 上一轮失败后能否用 /retry 重新请求 */
|
|
23
25
|
canRetry(): boolean;
|
|
24
26
|
/** 插件为自己的工具注册的显示方式(随会话的插件实例变) */
|
|
@@ -159,6 +161,8 @@ export function transcript(opts: TranscriptOptions): Transcript {
|
|
|
159
161
|
};
|
|
160
162
|
/** 有 result renderer 的调用的参数,结果出来时交给它 */
|
|
161
163
|
const inputs = new Map<string, unknown>();
|
|
164
|
+
/** 等人工审批的调用的参数,回答(input.received)来了按它显示 */
|
|
165
|
+
const asks = new Map<string, unknown>();
|
|
162
166
|
|
|
163
167
|
/** 出过错的 renderer(插件 + 工具),只提示一次 */
|
|
164
168
|
const failed = new Set<string>();
|
|
@@ -221,6 +225,7 @@ export function transcript(opts: TranscriptOptions): Transcript {
|
|
|
221
225
|
calls.clear();
|
|
222
226
|
befores.clear();
|
|
223
227
|
inputs.clear();
|
|
228
|
+
asks.clear();
|
|
224
229
|
self.lastEnd = undefined;
|
|
225
230
|
},
|
|
226
231
|
};
|
|
@@ -312,7 +317,10 @@ export function transcript(opts: TranscriptOptions): Transcript {
|
|
|
312
317
|
const full = details(name, d.input);
|
|
313
318
|
if (full) calls.set(d.toolUseId, full);
|
|
314
319
|
if (opts.renderer?.(name)?.renderer.result) inputs.set(d.toolUseId, d.input);
|
|
315
|
-
if (d.decision === "ask")
|
|
320
|
+
if (d.decision === "ask") {
|
|
321
|
+
asks.set(d.toolUseId, d.input);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
316
324
|
// 执行前交给 renderer 的 before(例如按文件当时的内容算 diff);重新显示历史时文件已经变了,不调用
|
|
317
325
|
if (d.decision === "allow" && !replaying) {
|
|
318
326
|
const before = customSync(name, (r) => r.before?.(d.input));
|
|
@@ -338,6 +346,15 @@ export function transcript(opts: TranscriptOptions): Transcript {
|
|
|
338
346
|
}
|
|
339
347
|
return;
|
|
340
348
|
}
|
|
349
|
+
case "input.received": {
|
|
350
|
+
// 对等待审批的调用的回答:和关卡直接决定的一样显示
|
|
351
|
+
const d = e.data as EventDataMap["input.received"];
|
|
352
|
+
if (d.kind !== "approval") return;
|
|
353
|
+
const input = asks.get(d.toolUseId);
|
|
354
|
+
asks.delete(d.toolUseId);
|
|
355
|
+
const decided: EventDataMap["tool.decided"] = { toolUseId: d.toolUseId, decision: d.approved ? "allow" : "deny", input, ...(d.approved ? {} : { reason: d.reason }) };
|
|
356
|
+
return renderEvent({ ...e, type: "tool.decided", data: decided });
|
|
357
|
+
}
|
|
341
358
|
case "tool.completed": {
|
|
342
359
|
const d = e.data as EventDataMap["tool.completed"];
|
|
343
360
|
void countUsage(e);
|
|
@@ -391,7 +408,9 @@ export function transcript(opts: TranscriptOptions): Transcript {
|
|
|
391
408
|
if (d.reason === "stopped") screen.log(yellow("[stopped: step budget for this turn used up; send a message to continue]"));
|
|
392
409
|
else if (d.reason === "aborted") screen.log(yellow("[interrupted]"));
|
|
393
410
|
else if (d.reason === "max_tokens") {
|
|
394
|
-
|
|
411
|
+
// 不读 process.env:写在 $JADE_HOME/.env 里的只有 models 插件知道
|
|
412
|
+
const max = opts.maxTokens?.();
|
|
413
|
+
const limit = max ? `${max} tokens` : "the provider's default";
|
|
395
414
|
screen.log(yellow(`[reply cut off at the output limit (${limit}); raise it with /model if this keeps happening]`));
|
|
396
415
|
} else if (d.reason !== "end") screen.log(yellow(`[turn ended: ${d.reason}${d.error ? ` — ${d.error}` : ""}]`));
|
|
397
416
|
if (self.turnFailed && !replaying && opts.canRetry()) screen.log(dim("[send /retry to request again without adding a message]"));
|