vanspod 0.4.15 → 0.5.1
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 +5 -5
- package/dist/classroomApp.js +185 -56
- package/dist/classroomKeyRejection.js +1 -1
- package/dist/codexWebSearch.js +1 -1
- package/dist/desktop.js +13 -3
- package/dist/deviceConnection.js +13 -2
- package/dist/html.js +12 -0
- package/dist/legacyMigration.js +10 -44
- package/dist/localCommands.js +82 -119
- package/dist/localToolApproval.js +81 -4
- package/dist/localTools.js +31 -8
- package/dist/modelStatus.js +14 -12
- package/dist/page.js +322 -132
- package/dist/platformStorage.js +1 -1
- package/dist/remoteAgentLog.js +126 -0
- package/dist/remoteAgentLogView.js +421 -0
- package/dist/saveImage.js +26 -0
- package/dist/secureStorage.js +17 -5
- package/dist/settingsActions.js +2 -10
- package/dist/start.js +86 -49
- package/dist/storageErrors.js +4 -5
- package/dist/trayChannel.js +25 -6
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/scripts/tray.ps1 +141 -11
package/dist/platformStorage.js
CHANGED
|
@@ -6,7 +6,7 @@ const secureStorage_1 = require("./secureStorage");
|
|
|
6
6
|
const windowsSecureStorage_1 = require("./windowsSecureStorage");
|
|
7
7
|
const legacyMigration_1 = require("./legacyMigration");
|
|
8
8
|
const storageLocation_1 = require("./storageLocation");
|
|
9
|
-
/** Read once; unsuccessful reads remain distinguishable until a successful new
|
|
9
|
+
/** Read once; unsuccessful reads remain distinguishable until a successful new connection. */
|
|
10
10
|
function createPersistentConnectionStorage(persistent) {
|
|
11
11
|
const memory = (0, secureStorage_1.createConnectionStorage)((0, secureStorage_1.createMemorySecureStorage)());
|
|
12
12
|
let temporary = false;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_LOG_TEXT = exports.MAX_LOG_ENTRIES = exports.APPROVAL_METHOD_LABELS = void 0;
|
|
4
|
+
exports.approvalMethod = approvalMethod;
|
|
5
|
+
exports.createRemoteAgentLog = createRemoteAgentLog;
|
|
6
|
+
const localCommands_1 = require("./localCommands");
|
|
7
|
+
exports.APPROVAL_METHOD_LABELS = {
|
|
8
|
+
none: "不需確認",
|
|
9
|
+
approved: "你允許了",
|
|
10
|
+
denied: "你拒絕了",
|
|
11
|
+
timeout: "時間到",
|
|
12
|
+
auto: "自動允許",
|
|
13
|
+
refused: "VansPod 拒絕",
|
|
14
|
+
cancelled: "Agent 取消了",
|
|
15
|
+
};
|
|
16
|
+
/** The approval method for how a Local Tool Approval ended. */
|
|
17
|
+
function approvalMethod(outcome) {
|
|
18
|
+
return outcome === "access_off" ? "refused" : outcome;
|
|
19
|
+
}
|
|
20
|
+
exports.MAX_LOG_ENTRIES = 200;
|
|
21
|
+
/** The longest text that an entry keeps, the same as the longest text that a Local Tool replies. */
|
|
22
|
+
exports.MAX_LOG_TEXT = 30_000;
|
|
23
|
+
const REFUSALS = ["no_project_folder", "outside_project_folder", "secret_file", "unknown_tool"];
|
|
24
|
+
function cutText(text) {
|
|
25
|
+
const chars = Array.from(text);
|
|
26
|
+
return chars.length <= exports.MAX_LOG_TEXT ? text : `${chars.slice(0, exports.MAX_LOG_TEXT).join("")}\n…(內容太長,紀錄只保留前 ${exports.MAX_LOG_TEXT.toLocaleString("en-US")} 個字元。)`;
|
|
27
|
+
}
|
|
28
|
+
/** The state of an entry that ended with `reply`. */
|
|
29
|
+
function endState(entry, reply) {
|
|
30
|
+
if (entry.approval === "denied" || entry.approval === "timeout")
|
|
31
|
+
return "denied";
|
|
32
|
+
if (entry.approval === "refused" || entry.approval === "cancelled")
|
|
33
|
+
return "refused";
|
|
34
|
+
if (!reply.ok)
|
|
35
|
+
return "error";
|
|
36
|
+
if (entry.tool === "bash") {
|
|
37
|
+
const result = reply.result;
|
|
38
|
+
if (result.timed_out)
|
|
39
|
+
return "timed_out";
|
|
40
|
+
if (result.stopped)
|
|
41
|
+
return "stopped";
|
|
42
|
+
return result.exit_code === 0 ? "done" : "error";
|
|
43
|
+
}
|
|
44
|
+
return "done";
|
|
45
|
+
}
|
|
46
|
+
function createRemoteAgentLog(options = {}) {
|
|
47
|
+
const bashTimeoutMs = options.bashTimeoutMs ?? localCommands_1.BASH_TIMEOUT_MS;
|
|
48
|
+
const entries = [];
|
|
49
|
+
const running = new Map();
|
|
50
|
+
const listeners = new Set();
|
|
51
|
+
let dropped = 0;
|
|
52
|
+
let nextId = 0;
|
|
53
|
+
const notify = () => {
|
|
54
|
+
for (const listener of [...listeners]) {
|
|
55
|
+
try {
|
|
56
|
+
listener();
|
|
57
|
+
}
|
|
58
|
+
catch { /* one listener must not stop the others */ }
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
list: () => entries.map(entry => ({ ...entry })).reverse(),
|
|
63
|
+
dropped: () => dropped,
|
|
64
|
+
stop(id) {
|
|
65
|
+
const stop = running.get(id);
|
|
66
|
+
if (!stop)
|
|
67
|
+
return false;
|
|
68
|
+
stop();
|
|
69
|
+
return true;
|
|
70
|
+
},
|
|
71
|
+
subscribe(listener) {
|
|
72
|
+
listeners.add(listener);
|
|
73
|
+
return () => { listeners.delete(listener); };
|
|
74
|
+
},
|
|
75
|
+
async record(tool, target, call) {
|
|
76
|
+
const entry = { id: `log-${++nextId}`, tool, target: cutText(target), startedAt: Date.now(), state: "running", approval: "none" };
|
|
77
|
+
entries.push(entry);
|
|
78
|
+
if (entries.length > exports.MAX_LOG_ENTRIES)
|
|
79
|
+
dropped += entries.splice(0, entries.length - exports.MAX_LOG_ENTRIES).length;
|
|
80
|
+
notify();
|
|
81
|
+
const logCall = {
|
|
82
|
+
target(next) { entry.target = cutText(next); notify(); },
|
|
83
|
+
async ask(approver, request, signal) {
|
|
84
|
+
entry.state = "waiting";
|
|
85
|
+
notify();
|
|
86
|
+
const outcome = await approver.request(request, signal);
|
|
87
|
+
entry.approval = approvalMethod(outcome);
|
|
88
|
+
entry.state = "running";
|
|
89
|
+
notify();
|
|
90
|
+
return outcome;
|
|
91
|
+
},
|
|
92
|
+
wrote(content, before, created) {
|
|
93
|
+
entry.written = { content: cutText(content), ...(before === undefined ? {} : { before: cutText(before) }), created };
|
|
94
|
+
},
|
|
95
|
+
runBash(bash, command, folder, signal) {
|
|
96
|
+
entry.state = "running";
|
|
97
|
+
return (0, localCommands_1.runBashCommand)(bash, command, folder, signal, {
|
|
98
|
+
timeoutMs: bashTimeoutMs,
|
|
99
|
+
stoppable(stop) { running.set(entry.id, stop); notify(); },
|
|
100
|
+
ended(end) {
|
|
101
|
+
running.delete(entry.id);
|
|
102
|
+
if (end.exitCode !== undefined)
|
|
103
|
+
entry.exitCode = end.exitCode;
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
let reply;
|
|
109
|
+
try {
|
|
110
|
+
reply = await call(logCall);
|
|
111
|
+
}
|
|
112
|
+
// The same answer that the Device connection sends for a Local Tool that throws.
|
|
113
|
+
catch (error) {
|
|
114
|
+
reply = { ok: false, error: "failed", message: `本機工具失敗:${error instanceof Error ? error.message : "原因不明"}。` };
|
|
115
|
+
}
|
|
116
|
+
running.delete(entry.id);
|
|
117
|
+
entry.reply = reply;
|
|
118
|
+
entry.endedAt = Date.now();
|
|
119
|
+
if (!reply.ok && entry.approval === "none" && REFUSALS.includes(reply.error))
|
|
120
|
+
entry.approval = "refused";
|
|
121
|
+
entry.state = endState(entry, reply);
|
|
122
|
+
notify();
|
|
123
|
+
return reply;
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REMOTE_AGENT_LOG_STYLES = exports.remoteAgentLogScript = exports.LOG_FILTERS = void 0;
|
|
4
|
+
exports.logListBlock = logListBlock;
|
|
5
|
+
exports.logFiltersBlock = logFiltersBlock;
|
|
6
|
+
exports.logListStatus = logListStatus;
|
|
7
|
+
exports.logDetailBlock = logDetailBlock;
|
|
8
|
+
exports.remoteAgentLogBlock = remoteAgentLogBlock;
|
|
9
|
+
exports.logEntryResponse = logEntryResponse;
|
|
10
|
+
// The Remote Agent Log on the 遠端 Agent page, layout C: the list on the left (newest first) and
|
|
11
|
+
// the details of the chosen entry on the right. The status poll redraws only the list; the page
|
|
12
|
+
// loads the details of one entry from GET /remote-agent-log-entry, so the poll stays small.
|
|
13
|
+
const html_1 = require("./html");
|
|
14
|
+
const lineChanges_1 = require("./lineChanges");
|
|
15
|
+
const localCommands_1 = require("./localCommands");
|
|
16
|
+
const remoteAgentLog_1 = require("./remoteAgentLog");
|
|
17
|
+
const TOOL_LABELS = {
|
|
18
|
+
local_status: "查看狀態",
|
|
19
|
+
list_files: "列出檔案",
|
|
20
|
+
read_file: "讀取檔案",
|
|
21
|
+
write_file: "寫入檔案",
|
|
22
|
+
bash: "執行指令",
|
|
23
|
+
save_image: "儲存圖片",
|
|
24
|
+
};
|
|
25
|
+
const toolLabel = (tool) => TOOL_LABELS[tool] ?? tool;
|
|
26
|
+
/** The tool group of each tool: the filter chips and the rows use it. */
|
|
27
|
+
const TOOL_GROUPS = {
|
|
28
|
+
local_status: "read",
|
|
29
|
+
list_files: "read",
|
|
30
|
+
read_file: "read",
|
|
31
|
+
write_file: "write",
|
|
32
|
+
bash: "bash",
|
|
33
|
+
save_image: "image",
|
|
34
|
+
};
|
|
35
|
+
const toolGroup = (tool) => TOOL_GROUPS[tool] ?? "other";
|
|
36
|
+
/** An entry that the student should look at: it failed, or it did not run. */
|
|
37
|
+
const needsAttention = (entry) => ["error", "denied", "refused", "timed_out", "stopped"].includes(entry.state);
|
|
38
|
+
/**
|
|
39
|
+
* The filter chips, in the order of the page. To add a chip, add one entry here.
|
|
40
|
+
* Each row lists the ids of the chips that it matches in data-log-filters; the page filters by that list.
|
|
41
|
+
*/
|
|
42
|
+
exports.LOG_FILTERS = [
|
|
43
|
+
{ id: "all", label: "全部", test: () => true },
|
|
44
|
+
{ id: "read", label: "讀取", test: entry => toolGroup(entry.tool) === "read" },
|
|
45
|
+
{ id: "write", label: "寫入", test: entry => toolGroup(entry.tool) === "write" },
|
|
46
|
+
{ id: "bash", label: "指令", test: entry => toolGroup(entry.tool) === "bash" },
|
|
47
|
+
{ id: "image", label: "圖片", test: entry => toolGroup(entry.tool) === "image" },
|
|
48
|
+
{ id: "auto", label: "自動允許", test: entry => entry.approval === "auto" },
|
|
49
|
+
{ id: "attention", label: "需要注意", test: needsAttention, alert: true },
|
|
50
|
+
];
|
|
51
|
+
const time = (ms) => new Date(ms).toLocaleTimeString("zh-TW", { hour12: false });
|
|
52
|
+
/** The state badge: its text and its color class. */
|
|
53
|
+
function badge(entry) {
|
|
54
|
+
const [text, tone] = (() => {
|
|
55
|
+
switch (entry.state) {
|
|
56
|
+
case "waiting": return ["等待確認", "run"];
|
|
57
|
+
case "running": return ["執行中", "run"];
|
|
58
|
+
case "done": return [entry.tool === "bash" ? "結束代碼 0" : "完成", "ok"];
|
|
59
|
+
case "error": return [entry.exitCode !== undefined ? `結束代碼 ${entry.exitCode}` : "失敗", "err"];
|
|
60
|
+
case "denied": return ["沒有執行", "warn"];
|
|
61
|
+
case "refused": return ["沒有執行", "warn"];
|
|
62
|
+
case "timed_out": return [`超過 ${localCommands_1.BASH_TIMEOUT_MS / 1000} 秒,已停止`, "warn"];
|
|
63
|
+
case "stopped": return ["已停止", "warn"];
|
|
64
|
+
}
|
|
65
|
+
})();
|
|
66
|
+
return `<span class="log-badge ${tone}">${(0, html_1.escapeHtml)(text)}</span>`;
|
|
67
|
+
}
|
|
68
|
+
function approvalTag(entry) {
|
|
69
|
+
return `<span class="log-approval ${entry.approval}">${(0, html_1.escapeHtml)(remoteAgentLog_1.APPROVAL_METHOD_LABELS[entry.approval])}</span>`;
|
|
70
|
+
}
|
|
71
|
+
/** The key that changes when the entry changes, so the page reloads the details only then. */
|
|
72
|
+
function entryKey(entry) {
|
|
73
|
+
return `${entry.id}:${entry.state}:${entry.approval}`;
|
|
74
|
+
}
|
|
75
|
+
function listKey(log) {
|
|
76
|
+
return `${log.dropped}|${log.entries.map(entryKey).join(",")}`;
|
|
77
|
+
}
|
|
78
|
+
function row(entry, selected) {
|
|
79
|
+
const target = entry.tool === "bash" ? `$ ${entry.target}` : entry.target;
|
|
80
|
+
const filters = exports.LOG_FILTERS.filter(filter => filter.test(entry)).map(filter => filter.id).join(" ");
|
|
81
|
+
return `<button type="button" class="log-row" data-log-entry="${(0, html_1.escapeHtml)(entry.id)}" data-entry-key="${(0, html_1.escapeHtml)(entryKey(entry))}"`
|
|
82
|
+
+ ` data-approval="${(0, html_1.escapeHtml)(entry.approval)}" data-tool-group="${(0, html_1.escapeHtml)(toolGroup(entry.tool))}" data-log-filters="${(0, html_1.escapeHtml)(filters)}" aria-selected="${selected}">`
|
|
83
|
+
+ `<span class="log-name">${(0, html_1.escapeHtml)(toolLabel(entry.tool))}</span>`
|
|
84
|
+
+ `<span class="log-right">${badge(entry)}<span>${(0, html_1.escapeHtml)(time(entry.startedAt))}</span></span>`
|
|
85
|
+
+ `<span class="log-target">${(0, html_1.escapeHtml)(Array.from(target).slice(0, 200).join(""))}</span></button>`;
|
|
86
|
+
}
|
|
87
|
+
/** The list. The newest entry is chosen until the student picks another one. */
|
|
88
|
+
function logListBlock(log) {
|
|
89
|
+
const rows = log.entries.map((entry, index) => row(entry, index === 0)).join("");
|
|
90
|
+
const empty = log.entries.length === 0 ? `<p class="hint log-empty">Agent 還沒有使用這台電腦。</p>` : "";
|
|
91
|
+
const none = `<p class="hint log-empty" data-log-none hidden>沒有符合的動作。</p>`;
|
|
92
|
+
const dropped = log.dropped > 0 ? `<p class="hint">較早的 ${log.dropped} 筆紀錄已經丟掉了,只留最新的 ${log.entries.length} 筆。</p>` : "";
|
|
93
|
+
return `<section class="tile log-list" role="listbox" aria-label="遠端 Agent 紀錄" data-log-list data-log-key="${(0, html_1.escapeHtml)(listKey(log))}">${dropped}${empty}${none}${rows}</section>`;
|
|
94
|
+
}
|
|
95
|
+
/** The filter chips, each with its count. A chip with alert turns red when its count is not 0. The page sets aria-pressed. */
|
|
96
|
+
function logFiltersBlock(log) {
|
|
97
|
+
const chips = exports.LOG_FILTERS.map(filter => {
|
|
98
|
+
const count = log.entries.filter(filter.test).length;
|
|
99
|
+
const tone = filter.alert && count > 0 ? " has-attention" : "";
|
|
100
|
+
return `<button type="button" class="log-filter${tone}" data-log-filter="${(0, html_1.escapeHtml)(filter.id)}" aria-pressed="${filter.id === "all"}">${(0, html_1.escapeHtml)(filter.label)}<span class="log-filter-count">${count}</span></button>`;
|
|
101
|
+
}).join("");
|
|
102
|
+
return `<div class="log-filters" data-log-filters>${chips}<span class="log-filters-space"></span><span class="hint">關掉 VansPod 就清除</span></div>`;
|
|
103
|
+
}
|
|
104
|
+
/** The status poll part of the log: the list and the filter chips, redrawn only when the key changes. */
|
|
105
|
+
function logListStatus(log) {
|
|
106
|
+
return { key: listKey(log), html: logListBlock(log), filters: logFiltersBlock(log) };
|
|
107
|
+
}
|
|
108
|
+
// ---------- details ----------
|
|
109
|
+
function pre(html) {
|
|
110
|
+
return `<pre class="log-term">${html}</pre>`;
|
|
111
|
+
}
|
|
112
|
+
function result(entry) {
|
|
113
|
+
return entry.reply?.ok ? entry.reply.result : undefined;
|
|
114
|
+
}
|
|
115
|
+
/** The refusal or the failure that the Agent received, when there is one. */
|
|
116
|
+
function refusal(entry) {
|
|
117
|
+
return entry.reply && !entry.reply.ok ? `<p class="log-refusal">${(0, html_1.escapeHtml)(entry.reply.message)}</p>` : "";
|
|
118
|
+
}
|
|
119
|
+
function note(value) {
|
|
120
|
+
return typeof value === "string" && value ? `<p class="hint">${(0, html_1.escapeHtml)(value)}</p>` : "";
|
|
121
|
+
}
|
|
122
|
+
function bashDetail(entry) {
|
|
123
|
+
const out = result(entry);
|
|
124
|
+
const stdout = typeof out?.stdout === "string" ? (0, html_1.escapeHtml)(out.stdout) : "";
|
|
125
|
+
const stderr = typeof out?.stderr === "string" && out.stderr ? `<span class="log-err">${(0, html_1.escapeHtml)(out.stderr)}</span>` : "";
|
|
126
|
+
const waiting = entry.state === "running" ? `<span class="log-dim">執行中…</span>` : entry.state === "waiting" ? `<span class="log-dim">等待你確認…</span>` : "";
|
|
127
|
+
const duration = entry.endedAt !== undefined && out ? `<p class="hint">花了 ${((entry.endedAt - entry.startedAt) / 1000).toFixed(1)} 秒・Agent 收到的就是這些輸出</p>` : "";
|
|
128
|
+
return `${pre(`<span class="log-cmd">${(0, html_1.escapeHtml)(entry.target)}</span>\n${stdout}${stderr}${waiting}`)}${duration}${note(out?.note)}${refusal(entry)}`;
|
|
129
|
+
}
|
|
130
|
+
function readDetail(entry) {
|
|
131
|
+
const out = result(entry);
|
|
132
|
+
if (typeof out?.content !== "string")
|
|
133
|
+
return refusal(entry);
|
|
134
|
+
const lines = out.content.replace(/\r\n/g, "\n").split("\n");
|
|
135
|
+
if (lines.length > 1 && lines[lines.length - 1] === "")
|
|
136
|
+
lines.pop();
|
|
137
|
+
return `${pre(lines.map((line, index) => `<span class="log-ln">${index + 1}</span>${(0, html_1.escapeHtml)(line)}`).join("\n"))}<p class="hint">Agent 讀到的內容</p>${note(out.note)}`;
|
|
138
|
+
}
|
|
139
|
+
function marked(lines) {
|
|
140
|
+
return lines.map(line => {
|
|
141
|
+
const tone = line.startsWith("+") ? "log-add" : line.startsWith("-") ? "log-del" : "log-dim";
|
|
142
|
+
return `<span class="${tone}">${(0, html_1.escapeHtml)(line)}</span>`;
|
|
143
|
+
}).join("\n");
|
|
144
|
+
}
|
|
145
|
+
function writeDetail(entry) {
|
|
146
|
+
const written = entry.written;
|
|
147
|
+
if (!written)
|
|
148
|
+
return refusal(entry);
|
|
149
|
+
const plus = (text) => text.replace(/\r\n/g, "\n").replace(/\n$/, "").split("\n").map(line => `+${line}`);
|
|
150
|
+
const body = written.created ? plus(written.content)
|
|
151
|
+
: written.before !== undefined ? (0, lineChanges_1.lineChanges)(written.before, written.content).split("\n")
|
|
152
|
+
: ["(原本不是文字檔,整個檔案換成下面的內容)", ...plus(written.content)];
|
|
153
|
+
const label = written.created ? "新檔案的內容" : "修改的行(- 刪掉,+ 加上)";
|
|
154
|
+
return `<p class="hint">${label}</p>${pre(marked(body))}${refusal(entry)}`;
|
|
155
|
+
}
|
|
156
|
+
function imageDetail(entry) {
|
|
157
|
+
const out = result(entry);
|
|
158
|
+
const saved = typeof out?.path === "string" ? out.path : undefined;
|
|
159
|
+
if (!saved)
|
|
160
|
+
return `${refusal(entry)}<p class="hint">這張圖片由 generate_image 產生。</p>`;
|
|
161
|
+
return `<img class="log-image" data-log-image src="/remote-agent-image?path=${encodeURIComponent(saved)}" alt="${(0, html_1.escapeHtml)(saved)}">`
|
|
162
|
+
+ `<p class="hint" data-log-image-missing hidden>檔案已經不在了</p>`
|
|
163
|
+
+ `<p class="hint">這張圖片由 generate_image 產生,頁面從磁碟讀取。</p>`;
|
|
164
|
+
}
|
|
165
|
+
function listDetail(entry) {
|
|
166
|
+
const out = result(entry);
|
|
167
|
+
if (!Array.isArray(out?.entries))
|
|
168
|
+
return refusal(entry);
|
|
169
|
+
const items = out.entries.map(item => `${String(item.name)}${item.type === "folder" ? "/" : ""}`);
|
|
170
|
+
return `${pre((0, html_1.escapeHtml)(items.join("\n") || "(空的資料夾)"))}${out.truncated ? `<p class="hint">項目太多,只回傳前 ${items.length} 個。</p>` : ""}`;
|
|
171
|
+
}
|
|
172
|
+
function statusDetail(entry) {
|
|
173
|
+
const out = result(entry);
|
|
174
|
+
if (!out)
|
|
175
|
+
return refusal(entry);
|
|
176
|
+
const shell = out.shell;
|
|
177
|
+
const rows = [
|
|
178
|
+
["作業系統", String(out.os ?? "")],
|
|
179
|
+
["Shell", shell ? `${shell.name ?? ""}${shell.available ? shell.path ? `(${shell.path})` : "" : "(找不到)"}` : ""],
|
|
180
|
+
["專案資料夾", typeof out.project_folder === "string" ? out.project_folder : "還沒選"],
|
|
181
|
+
["Python", typeof out.python === "string" ? out.python : "找不到"],
|
|
182
|
+
];
|
|
183
|
+
if (Array.isArray(out.entries))
|
|
184
|
+
rows.push(["最上層項目", `${out.entries.length} 個`]);
|
|
185
|
+
const dl = `<dl class="log-kv">${rows.map(([key, value]) => `<dt>${(0, html_1.escapeHtml)(key)}</dt><dd>${(0, html_1.escapeHtml)(value)}</dd>`).join("")}</dl>`;
|
|
186
|
+
return `${dl}${note(out.project_folder_note)}`;
|
|
187
|
+
}
|
|
188
|
+
function toolDetail(entry) {
|
|
189
|
+
switch (entry.tool) {
|
|
190
|
+
case "bash": return bashDetail(entry);
|
|
191
|
+
case "read_file": return readDetail(entry);
|
|
192
|
+
case "write_file": return writeDetail(entry);
|
|
193
|
+
case "save_image": return imageDetail(entry);
|
|
194
|
+
case "list_files": return listDetail(entry);
|
|
195
|
+
case "local_status": return statusDetail(entry);
|
|
196
|
+
default: return refusal(entry);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/** The details of one entry: the input, the result that the Agent received, and how it was approved. */
|
|
200
|
+
function logDetailBlock(entry) {
|
|
201
|
+
if (!entry)
|
|
202
|
+
return `<section class="tile log-detail" data-log-detail data-entry-id="" data-entry-key=""><p class="hint">點左邊的一筆紀錄,這裡會顯示詳細內容。</p></section>`;
|
|
203
|
+
const stop = entry.tool === "bash" && entry.state === "running"
|
|
204
|
+
? `<form method="post" action="/remote-agent-log-stop"><input type="hidden" name="id" value="${(0, html_1.escapeHtml)(entry.id)}"><button type="submit" class="remote-agent-log-stop">停止</button></form>`
|
|
205
|
+
: "";
|
|
206
|
+
const targetName = entry.tool === "bash" ? "指令" : "路徑";
|
|
207
|
+
const facts = `<dl class="log-kv"><dt>工具</dt><dd>${(0, html_1.escapeHtml)(entry.tool === "save_image" ? "save_image(由 generate_image 送來)" : entry.tool)}</dd>`
|
|
208
|
+
+ (entry.tool === "local_status" ? "" : `<dt>${targetName}</dt><dd>${(0, html_1.escapeHtml)(entry.target || "—")}</dd>`)
|
|
209
|
+
+ `<dt>時間</dt><dd>${(0, html_1.escapeHtml)(time(entry.startedAt))}</dd></dl>`;
|
|
210
|
+
return `<section class="tile log-detail" data-log-detail data-entry-id="${(0, html_1.escapeHtml)(entry.id)}" data-entry-key="${(0, html_1.escapeHtml)(entryKey(entry))}">`
|
|
211
|
+
+ `<h3>${(0, html_1.escapeHtml)(toolLabel(entry.tool))}<span class="log-detail-tags">${approvalTag(entry)}${badge(entry)}${stop}</span></h3>`
|
|
212
|
+
+ `${facts}${toolDetail(entry)}</section>`;
|
|
213
|
+
}
|
|
214
|
+
/** The list and the details, side by side. The details show the newest entry first. */
|
|
215
|
+
function remoteAgentLogBlock(log) {
|
|
216
|
+
return `<div class="log-head"><h3>遠端 Agent 紀錄</h3></div>${logFiltersBlock(log)}`
|
|
217
|
+
+ `<div class="log-split" data-log-split>${logListBlock(log)}${logDetailBlock(log.entries[0])}</div>`;
|
|
218
|
+
}
|
|
219
|
+
/** The answer of GET /remote-agent-log-entry?id=...: the details of one entry, or 404 when it is not in the log. */
|
|
220
|
+
function logEntryResponse(log, id) {
|
|
221
|
+
const entry = log?.entries.find(item => item.id === id);
|
|
222
|
+
return entry ? { status: 200, body: { id, key: entryKey(entry), html: logDetailBlock(entry) } } : { status: 404, body: { error: "這筆紀錄已經不在了。" } };
|
|
223
|
+
}
|
|
224
|
+
// The page picks an entry and keeps it after each redraw; until the student picks one, the newest is shown.
|
|
225
|
+
// The page also keeps the chosen filter chip. A redraw of the list (the status poll, a page action) goes
|
|
226
|
+
// through keepRemoteAgentLogPlace: when the student scrolled down, the row at the top of the view stays in
|
|
227
|
+
// its place, and a notice at the top of the list counts the new entries.
|
|
228
|
+
exports.remoteAgentLogScript = `
|
|
229
|
+
var pickedLogEntry = null;
|
|
230
|
+
var logFilter = "all";
|
|
231
|
+
var seenLogSeq = 0;
|
|
232
|
+
var LOG_AT_TOP = 8;
|
|
233
|
+
function logSeq(row) {
|
|
234
|
+
var match = /(\\d+)$/.exec(row.getAttribute("data-log-entry") || "");
|
|
235
|
+
return match ? Number(match[1]) : 0;
|
|
236
|
+
}
|
|
237
|
+
function logRows(list) { return Array.from(list.querySelectorAll("[data-log-entry]")); }
|
|
238
|
+
function newestLogSeq(list) { return logRows(list).reduce(function (newest, row) { return Math.max(newest, logSeq(row)); }, 0); }
|
|
239
|
+
function applyLogFilter() {
|
|
240
|
+
var filters = document.querySelector("[data-log-filters]");
|
|
241
|
+
if (filters) filters.querySelectorAll("[data-log-filter]").forEach(function (chip) {
|
|
242
|
+
chip.setAttribute("aria-pressed", String(chip.getAttribute("data-log-filter") === logFilter));
|
|
243
|
+
});
|
|
244
|
+
var list = document.querySelector("[data-log-list]");
|
|
245
|
+
if (!list) return;
|
|
246
|
+
var rows = logRows(list);
|
|
247
|
+
var shown = 0;
|
|
248
|
+
rows.forEach(function (row) {
|
|
249
|
+
var match = (row.getAttribute("data-log-filters") || "").split(" ").indexOf(logFilter) >= 0;
|
|
250
|
+
row.hidden = !match;
|
|
251
|
+
if (match) shown++;
|
|
252
|
+
});
|
|
253
|
+
var none = list.querySelector("[data-log-none]");
|
|
254
|
+
if (none) none.hidden = !(rows.length > 0 && shown === 0);
|
|
255
|
+
}
|
|
256
|
+
function showNewLogNotice(list) {
|
|
257
|
+
var old = list.querySelector("[data-log-new]");
|
|
258
|
+
if (old) old.remove();
|
|
259
|
+
var count = logRows(list).filter(function (row) { return !row.hidden && logSeq(row) > seenLogSeq; }).length;
|
|
260
|
+
if (count) list.insertAdjacentHTML("afterbegin", '<button type="button" class="log-new" data-log-new>↑ ' + count + ' 筆新的動作</button>');
|
|
261
|
+
}
|
|
262
|
+
function seeAllLogEntries(list) {
|
|
263
|
+
seenLogSeq = Math.max(seenLogSeq, newestLogSeq(list));
|
|
264
|
+
var notice = list.querySelector("[data-log-new]");
|
|
265
|
+
if (notice) notice.remove();
|
|
266
|
+
}
|
|
267
|
+
// The list and the details fill the window to its bottom, so the page itself does not get longer.
|
|
268
|
+
function fitRemoteAgentLog() {
|
|
269
|
+
var split = document.querySelector("[data-log-split]");
|
|
270
|
+
if (!split) return;
|
|
271
|
+
var top = split.getBoundingClientRect().top + window.scrollY;
|
|
272
|
+
split.style.setProperty("--log-height", Math.max(320, window.innerHeight - top - 16) + "px");
|
|
273
|
+
}
|
|
274
|
+
function keepRemoteAgentLogPlace(redraw) {
|
|
275
|
+
var list = document.querySelector("[data-log-list]");
|
|
276
|
+
var anchor = null;
|
|
277
|
+
if (list && list.scrollTop > LOG_AT_TOP) {
|
|
278
|
+
var top = logRows(list).find(function (row) { return !row.hidden && row.offsetTop + row.offsetHeight > list.scrollTop; });
|
|
279
|
+
if (top) anchor = { id: top.getAttribute("data-log-entry"), delta: top.offsetTop - list.scrollTop };
|
|
280
|
+
}
|
|
281
|
+
redraw();
|
|
282
|
+
applyLogFilter();
|
|
283
|
+
var next = document.querySelector("[data-log-list]");
|
|
284
|
+
if (next) {
|
|
285
|
+
if (!anchor) seenLogSeq = Math.max(seenLogSeq, newestLogSeq(next));
|
|
286
|
+
showNewLogNotice(next);
|
|
287
|
+
var same = anchor && logRows(next).find(function (row) { return row.getAttribute("data-log-entry") === anchor.id; });
|
|
288
|
+
if (same) next.scrollTop = same.offsetTop - anchor.delta;
|
|
289
|
+
}
|
|
290
|
+
fitRemoteAgentLog();
|
|
291
|
+
refreshRemoteAgentLog();
|
|
292
|
+
}
|
|
293
|
+
function replaceRemoteAgentLog(log) {
|
|
294
|
+
keepRemoteAgentLogPlace(function () {
|
|
295
|
+
var list = document.querySelector("[data-log-list]");
|
|
296
|
+
if (list) list.outerHTML = log.html;
|
|
297
|
+
var filters = document.querySelector("[data-log-filters]");
|
|
298
|
+
if (filters && log.filters) filters.outerHTML = log.filters;
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
async function loadLogDetail(id) {
|
|
302
|
+
try {
|
|
303
|
+
var response = await fetch("/remote-agent-log-entry?id=" + encodeURIComponent(id), { cache: "no-store" });
|
|
304
|
+
if (!response.ok) return;
|
|
305
|
+
var answer = await response.json();
|
|
306
|
+
var detail = document.querySelector("[data-log-detail]");
|
|
307
|
+
if (detail && answer.id === currentLogEntry()) detail.outerHTML = answer.html;
|
|
308
|
+
} catch (error) {}
|
|
309
|
+
}
|
|
310
|
+
function currentLogEntry() {
|
|
311
|
+
var list = document.querySelector("[data-log-list]");
|
|
312
|
+
if (!list) return null;
|
|
313
|
+
var rows = logRows(list).filter(function (row) { return !row.hidden; });
|
|
314
|
+
var picked = rows.find(function (row) { return row.getAttribute("data-log-entry") === pickedLogEntry; });
|
|
315
|
+
var shown = picked || rows[0];
|
|
316
|
+
return shown ? shown.getAttribute("data-log-entry") : null;
|
|
317
|
+
}
|
|
318
|
+
function refreshRemoteAgentLog() {
|
|
319
|
+
var list = document.querySelector("[data-log-list]");
|
|
320
|
+
if (!list) return;
|
|
321
|
+
var id = currentLogEntry();
|
|
322
|
+
var key = "";
|
|
323
|
+
list.querySelectorAll("[data-log-entry]").forEach(function (row) {
|
|
324
|
+
var chosen = row.getAttribute("data-log-entry") === id;
|
|
325
|
+
row.setAttribute("aria-selected", String(chosen));
|
|
326
|
+
if (chosen) key = row.getAttribute("data-entry-key") || "";
|
|
327
|
+
});
|
|
328
|
+
var detail = document.querySelector("[data-log-detail]");
|
|
329
|
+
if (id && detail && detail.getAttribute("data-entry-key") !== key) loadLogDetail(id);
|
|
330
|
+
}
|
|
331
|
+
document.addEventListener("click", function (event) {
|
|
332
|
+
var target = event.target && event.target.closest ? event.target : null;
|
|
333
|
+
if (!target) return;
|
|
334
|
+
var list = document.querySelector("[data-log-list]");
|
|
335
|
+
var chip = target.closest("[data-log-filter]");
|
|
336
|
+
if (chip && list) {
|
|
337
|
+
logFilter = chip.getAttribute("data-log-filter") || "all";
|
|
338
|
+
applyLogFilter();
|
|
339
|
+
list.scrollTop = 0;
|
|
340
|
+
seeAllLogEntries(list);
|
|
341
|
+
refreshRemoteAgentLog();
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (target.closest("[data-log-new]") && list) {
|
|
345
|
+
list.scrollTo({ top: 0, behavior: "smooth" });
|
|
346
|
+
seeAllLogEntries(list);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
var row = target.closest("[data-log-entry]");
|
|
350
|
+
if (!row) return;
|
|
351
|
+
pickedLogEntry = row.getAttribute("data-log-entry");
|
|
352
|
+
refreshRemoteAgentLog();
|
|
353
|
+
});
|
|
354
|
+
// The student is back at the top of the list: every entry is seen. A list that a redraw replaced
|
|
355
|
+
// can report scrollTop 0 late; that is not the student back at the top.
|
|
356
|
+
document.addEventListener("scroll", function (event) {
|
|
357
|
+
var list = event.target;
|
|
358
|
+
if (!list || !list.matches || !list.matches("[data-log-list]")) return;
|
|
359
|
+
if (!list.isConnected || list.scrollTop > LOG_AT_TOP) return;
|
|
360
|
+
seeAllLogEntries(list);
|
|
361
|
+
}, true);
|
|
362
|
+
window.addEventListener("resize", fitRemoteAgentLog);
|
|
363
|
+
(function () {
|
|
364
|
+
var list = document.querySelector("[data-log-list]");
|
|
365
|
+
if (list) seenLogSeq = newestLogSeq(list);
|
|
366
|
+
fitRemoteAgentLog();
|
|
367
|
+
})();
|
|
368
|
+
// A saved image that was moved or deleted: say so instead of a broken image.
|
|
369
|
+
document.addEventListener("error", function (event) {
|
|
370
|
+
var image = event.target;
|
|
371
|
+
if (!image || !image.matches || !image.matches("img[data-log-image]")) return;
|
|
372
|
+
image.hidden = true;
|
|
373
|
+
var missing = image.parentNode && image.parentNode.querySelector("[data-log-image-missing]");
|
|
374
|
+
if (missing) missing.hidden = false;
|
|
375
|
+
}, true);
|
|
376
|
+
`;
|
|
377
|
+
exports.REMOTE_AGENT_LOG_STYLES = `
|
|
378
|
+
.log-head { display: flex; align-items: baseline; gap: 12px; margin-top: 4px; }
|
|
379
|
+
.log-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
|
|
380
|
+
.log-filters-space { flex: 1; }
|
|
381
|
+
main button.log-filter { min-height: 0; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
|
|
382
|
+
main button.log-filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }
|
|
383
|
+
main button.log-filter.has-attention:not([aria-pressed="true"]) { color: light-dark(#c0362c, #ff7b72); border-color: color-mix(in srgb, light-dark(#c0362c, #ff7b72) 40%, transparent); }
|
|
384
|
+
.log-filter-count { opacity: .6; margin-left: 4px; font-variant-numeric: tabular-nums; }
|
|
385
|
+
main button.log-new { position: sticky; top: 4px; z-index: 2; align-self: center; flex-shrink: 0; min-height: 0; margin: 0 auto 6px; padding: 5px 14px; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent, #fff); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
|
|
386
|
+
.log-head h3 { margin: 0; font-size: 15px; }
|
|
387
|
+
.log-split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 12px; align-items: start; --log-ok: light-dark(#0a7d5c, #4ecb9d); --log-err: light-dark(#c0362c, #ff7b72); --log-warn: light-dark(#9a4a08, #fbbf24); --log-term: light-dark(#f6f7f9, #121214); --log-mono: Consolas, "Cascadia Mono", monospace; }
|
|
388
|
+
.remote-main .log-list { position: relative; padding: 6px; gap: 0; height: var(--log-height, 40rem); min-height: 320px; box-sizing: border-box; overflow: auto; }
|
|
389
|
+
.remote-main .log-list > * { flex-shrink: 0; }
|
|
390
|
+
.log-empty { padding: 10px; margin: 0; }
|
|
391
|
+
main button.log-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; width: 100%; min-height: 0; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
|
|
392
|
+
main button.log-row:hover { background: var(--modes); }
|
|
393
|
+
main button.log-row[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); }
|
|
394
|
+
.log-name { font-size: 13px; font-weight: 600; }
|
|
395
|
+
.log-right { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
|
|
396
|
+
.log-target { grid-column: 1 / 3; font-family: var(--log-mono); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
397
|
+
.log-badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--modes); color: var(--muted); }
|
|
398
|
+
.log-badge.ok { color: var(--log-ok); background: color-mix(in srgb, var(--log-ok) 13%, transparent); }
|
|
399
|
+
.log-approval.auto { color: light-dark(#7c3aed, #a78bfa); border-color: color-mix(in srgb, light-dark(#7c3aed, #a78bfa) 45%, transparent); }
|
|
400
|
+
.log-badge.err { color: var(--log-err); background: color-mix(in srgb, var(--log-err) 13%, transparent); }
|
|
401
|
+
.log-badge.warn { color: var(--log-warn); background: color-mix(in srgb, var(--log-warn) 14%, transparent); }
|
|
402
|
+
.log-badge.run { color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }
|
|
403
|
+
.log-approval { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
|
|
404
|
+
.remote-main .log-detail { max-height: var(--log-height, 40rem); min-height: 0; box-sizing: border-box; overflow: auto; }
|
|
405
|
+
.log-detail h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
406
|
+
.log-detail-tags { margin-left: auto; display: flex; gap: 6px; align-items: center; }
|
|
407
|
+
.log-detail form { display: inline; }
|
|
408
|
+
main button.remote-agent-log-stop { min-height: 0; padding: 2px 10px; }
|
|
409
|
+
.log-kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0; font-size: 13px; }
|
|
410
|
+
.log-kv dt { color: var(--muted); }
|
|
411
|
+
.log-kv dd { margin: 0; font-family: var(--log-mono); font-size: 12.5px; overflow-wrap: anywhere; }
|
|
412
|
+
.log-term { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--log-term); border: 1px solid var(--line); font-family: var(--log-mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; overflow: auto; }
|
|
413
|
+
.log-cmd { font-weight: 600; }
|
|
414
|
+
.log-cmd::before { content: "$ "; color: var(--accent); }
|
|
415
|
+
.log-err, .log-del { color: var(--log-err); }
|
|
416
|
+
.log-add { color: var(--log-ok); }
|
|
417
|
+
.log-dim { color: var(--muted); }
|
|
418
|
+
.log-ln { display: inline-block; width: 2.6em; margin-right: 10px; text-align: right; color: var(--muted); user-select: none; }
|
|
419
|
+
.log-refusal { margin: 0; font-size: 13px; color: var(--log-warn); }
|
|
420
|
+
.log-image { display: block; max-width: 100%; max-height: 24rem; border-radius: 8px; border: 1px solid var(--line); }
|
|
421
|
+
@media (max-width: 900px) { .log-split { grid-template-columns: 1fr; } }`;
|
package/dist/saveImage.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readProjectImage = readProjectImage;
|
|
6
7
|
exports.saveImage = saveImage;
|
|
7
8
|
// `save_image`: saves a generated image under `images/` in the Project Folder (ADR 0013).
|
|
8
9
|
// The Device-side contract is "save_image" in vans-mcp-server docs/device-relay-protocol.md.
|
|
@@ -68,6 +69,29 @@ function candidate(name, count) {
|
|
|
68
69
|
const extension = node_path_1.default.extname(name);
|
|
69
70
|
return `${name.slice(0, name.length - extension.length)}-${count}${extension}`;
|
|
70
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* A saved image for the 遠端 Agent page, read from the disk. Only an image file under `images/`
|
|
74
|
+
* in the Project Folder; anything else, or a file that is gone, is undefined.
|
|
75
|
+
*/
|
|
76
|
+
async function readProjectImage(projectFolder, requested) {
|
|
77
|
+
if (!projectFolder)
|
|
78
|
+
return undefined;
|
|
79
|
+
const target = await (0, projectPath_1.resolveProjectPath)(projectFolder, requested);
|
|
80
|
+
if (!target.ok || !target.relative.startsWith(`${IMAGE_FOLDER}/`))
|
|
81
|
+
return undefined;
|
|
82
|
+
const extension = node_path_1.default.extname(target.relative).toLowerCase();
|
|
83
|
+
const mimeType = Object.keys(EXTENSIONS).find(type => EXTENSIONS[type].includes(extension));
|
|
84
|
+
if (!mimeType)
|
|
85
|
+
return undefined;
|
|
86
|
+
try {
|
|
87
|
+
if (!(await promises_1.default.stat(target.absolute)).isFile())
|
|
88
|
+
return undefined;
|
|
89
|
+
return { bytes: await promises_1.default.readFile(target.absolute), mimeType };
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
71
95
|
async function saveImage(projectFolder, args, signal, context) {
|
|
72
96
|
const mimeType = args.mime_type;
|
|
73
97
|
if (typeof mimeType !== "string" || !Object.hasOwn(EXTENSIONS, mimeType)) {
|
|
@@ -83,6 +107,7 @@ async function saveImage(projectFolder, args, signal, context) {
|
|
|
83
107
|
const refusal = await (0, localToolApproval_1.askApproval)(context.approver, {
|
|
84
108
|
tool: "save_image",
|
|
85
109
|
title: `儲存圖片 ${IMAGE_FOLDER}/${name}`,
|
|
110
|
+
target: `${IMAGE_FOLDER}/${name}`,
|
|
86
111
|
body: approvalBody(bytes, mimeType),
|
|
87
112
|
folder: projectFolder,
|
|
88
113
|
}, signal, NOT_SAVED);
|
|
@@ -99,6 +124,7 @@ async function saveImage(projectFolder, args, signal, context) {
|
|
|
99
124
|
await promises_1.default.mkdir(node_path_1.default.dirname(target.absolute), { recursive: true });
|
|
100
125
|
// "wx" fails when the file exists, so a file made in the meantime is never overwritten.
|
|
101
126
|
await promises_1.default.writeFile(target.absolute, bytes, { flag: "wx" });
|
|
127
|
+
context.call.target(target.relative);
|
|
102
128
|
return { ok: true, result: { path: target.relative } };
|
|
103
129
|
}
|
|
104
130
|
catch (error) {
|