viewable-one 0.12.1 → 0.12.3
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/CHANGELOG.md +71 -1
- package/README.md +31 -48
- package/SPAWN.md +136 -79
- package/glytch.mjs +41 -10
- package/lib/acp.mjs +152 -150
- package/lib/admission.mjs +25 -5
- package/lib/agent-selection.mjs +5 -4
- package/lib/agents.mjs +68 -24
- package/lib/answerTag.mjs +47 -0
- package/lib/atomic.mjs +1 -16
- package/lib/auth.mjs +172 -52
- package/lib/authenticatedHttp.mjs +10 -3
- package/lib/boardside.mjs +28 -12
- package/lib/child.mjs +129 -116
- package/lib/claudeModels.mjs +168 -0
- package/lib/codex-rpc.mjs +2 -2
- package/lib/codex.mjs +50 -50
- package/lib/codexApps.mjs +17 -3
- package/lib/codexToolInputs.mjs +98 -22
- package/lib/codingChecks.mjs +8 -4
- package/lib/conversationRules.mjs +47 -7
- package/lib/detect.mjs +39 -24
- package/lib/devserver.mjs +30 -19
- package/lib/doctor.mjs +10 -8
- package/lib/folderReads.mjs +96 -0
- package/lib/followUps.mjs +170 -0
- package/lib/hosted.mjs +13 -4
- package/lib/init-connect.mjs +29 -10
- package/lib/lateResume.mjs +135 -0
- package/lib/logindaemon.mjs +129 -49
- package/lib/logs.mjs +2 -2
- package/lib/mcpjson.mjs +35 -2
- package/lib/memberPreview.mjs +22 -14
- package/lib/multiwatch.mjs +28 -41
- package/lib/pagePictures.mjs +15 -12
- package/lib/pageRoutes.mjs +5 -2
- package/lib/paths.mjs +3 -3
- package/lib/permissionAsk.mjs +344 -61
- package/lib/previewGateway.mjs +4 -3
- package/lib/procs.mjs +73 -2
- package/lib/refusal.mjs +0 -2
- package/lib/registry.mjs +7 -7
- package/lib/repomap.mjs +4 -3
- package/lib/restartPass.mjs +39 -11
- package/lib/rowsAnswers.mjs +52 -69
- package/lib/rowsEvents.mjs +20 -2
- package/lib/runner-health.mjs +29 -5
- package/lib/runner.mjs +161 -1347
- package/lib/runnerAdmission.mjs +6 -12
- package/lib/runnerApi.mjs +20 -11
- package/lib/runnerBeat.mjs +384 -0
- package/lib/runnerCompletion.mjs +5 -2
- package/lib/runnerExecute.mjs +227 -0
- package/lib/runnerGates.mjs +338 -0
- package/lib/runnerLaunch.mjs +351 -0
- package/lib/runnerLease.mjs +31 -9
- package/lib/runnerOps.mjs +217 -0
- package/lib/runnerPace.mjs +10 -6
- package/lib/runnerRecovery.mjs +457 -0
- package/lib/runnerRegister.mjs +29 -8
- package/lib/runnerSettlement.mjs +43 -16
- package/lib/runnerWorkspace.mjs +19 -4
- package/lib/spawn.mjs +0 -5
- package/lib/sync.mjs +28 -16
- package/lib/uninstall-project.mjs +12 -11
- package/lib/uninstall.mjs +32 -25
- package/lib/update.mjs +4 -4
- package/lib/{glytchFolder.mjs → viewableFolder.mjs} +22 -16
- package/lib/worktree.mjs +83 -26
- package/lib/writePolicy.mjs +90 -10
- package/package.json +2 -2
package/lib/worktree.mjs
CHANGED
|
@@ -231,13 +231,17 @@ async function acquireRepoLock(root) {
|
|
|
231
231
|
|
|
232
232
|
/** Wrap a worktree operation with the repo lock, both halves. In-process
|
|
233
233
|
* first, so a queue of callers inside this process waits on a promise rather
|
|
234
|
-
* than on a directory.
|
|
235
|
-
|
|
234
|
+
* than on a directory. Preparation may supply check/own: check cancellation
|
|
235
|
+
* after each lock wait, then own the started mutation through its result.
|
|
236
|
+
* Callers must not treat the queued lock wait itself as an owned mutation. */
|
|
237
|
+
export async function withRepoLock(root, fn, log = () => {}, lifecycle = {}) {
|
|
236
238
|
const release = await acquireRepoLock(root);
|
|
237
239
|
let releaseFile = null;
|
|
238
240
|
try {
|
|
241
|
+
lifecycle.check?.();
|
|
239
242
|
releaseFile = await acquireFileLock(root, log);
|
|
240
|
-
|
|
243
|
+
lifecycle.check?.();
|
|
244
|
+
return await (lifecycle.own ? lifecycle.own(fn) : fn());
|
|
241
245
|
} finally {
|
|
242
246
|
if (releaseFile) await releaseFile();
|
|
243
247
|
release();
|
|
@@ -616,10 +620,10 @@ async function cleanWorktreeImpl(root, made, log = () => {}, wroteFiles = []) {
|
|
|
616
620
|
if (!(await registeredWorktree(root, made.path))) return { removed: false, detail: "KEPT: worktree ownership could not be verified." };
|
|
617
621
|
|
|
618
622
|
const dirty = await git(["status", "--porcelain"], made.path);
|
|
619
|
-
const
|
|
620
|
-
const commits =
|
|
621
|
-
? await git(["log", "--oneline", `${
|
|
622
|
-
: { ok: false, detail:
|
|
623
|
+
const start = await startOf(made.branch, root);
|
|
624
|
+
const commits = start
|
|
625
|
+
? await git(["log", "--oneline", `${start}..HEAD`], made.path)
|
|
626
|
+
: { ok: false, detail: "Could not establish the worktree base." };
|
|
623
627
|
// Failed inspection is not evidence that this tree contains no work.
|
|
624
628
|
if (!dirty.ok || !commits.ok) {
|
|
625
629
|
const detail = `KEPT: could not verify worktree changes: ${!dirty.ok ? dirty.detail : commits.detail}`;
|
|
@@ -682,7 +686,7 @@ async function cleanWorktreeImpl(root, made, log = () => {}, wroteFiles = []) {
|
|
|
682
686
|
* editing a tracked file to make itself comfortable. */
|
|
683
687
|
async function ensureIgnored(root, log = () => {}) {
|
|
684
688
|
const missing = [];
|
|
685
|
-
for (const [file, pattern] of [[".claude/worktrees", ".claude/worktrees/"], [".glytch-server.json", "/.glytch-server.json"], [".glytch-page.json", "/.glytch-page.json"]]) {
|
|
689
|
+
for (const [file, pattern] of [[".claude/worktrees", ".claude/worktrees/"], [".viewable-server.json", "/.viewable-server.json"], [".viewable-page.json", "/.viewable-page.json"], [".glytch-server.json", "/.glytch-server.json"], [".glytch-page.json", "/.glytch-page.json"]]) {
|
|
686
690
|
const ignored = await git(["check-ignore", "-q", file], root);
|
|
687
691
|
if (!ignored.ok) missing.push(pattern);
|
|
688
692
|
}
|
|
@@ -757,10 +761,23 @@ async function reuseWorktreeImpl(root, existingPath, log = () => {}) {
|
|
|
757
761
|
};
|
|
758
762
|
}
|
|
759
763
|
|
|
764
|
+
/** The commit the worktree was cut from, or null when git cannot say.
|
|
765
|
+
*
|
|
766
|
+
* Against the repo's default branch, the ref every worktree is cut from
|
|
767
|
+
* (makeWorktreeImpl), never the folder's current HEAD: the folder's HEAD can
|
|
768
|
+
* be a detached commit far from where the run started, and the merge-base
|
|
769
|
+
* with it reached back past the run's start, so a run that changed nothing
|
|
770
|
+
* reported "Changed 270 files" (#3894). HEAD is the fallback only when
|
|
771
|
+
* neither main nor master exists. */
|
|
772
|
+
async function startOf(branch, root) {
|
|
773
|
+
const defaultBranch = await defaultBranchOf(root);
|
|
774
|
+
const merge = await git(["merge-base", branch, defaultBranch ?? "HEAD"], root);
|
|
775
|
+
return merge.ok && merge.stdout.trim() ? merge.stdout.trim() : null;
|
|
776
|
+
}
|
|
777
|
+
|
|
760
778
|
/** The commit the worktree started from, for counting what the session added. */
|
|
761
779
|
async function baseOf(made, root) {
|
|
762
|
-
|
|
763
|
-
return merge.ok && merge.stdout.trim() ? merge.stdout.trim() : "HEAD";
|
|
780
|
+
return (await startOf(made.branch, root)) ?? "HEAD";
|
|
764
781
|
}
|
|
765
782
|
|
|
766
783
|
// ---------- post-session worktree operations ----------
|
|
@@ -783,7 +800,7 @@ async function identityArgs(cwd) {
|
|
|
783
800
|
const name = await git(["config", "user.name"], cwd);
|
|
784
801
|
return [
|
|
785
802
|
...(name.ok && name.stdout.trim() ? [] : ["-c", "user.name=Viewable"]),
|
|
786
|
-
...(email.ok && email.stdout.trim() ? [] : ["-c", "user.email=
|
|
803
|
+
...(email.ok && email.stdout.trim() ? [] : ["-c", "user.email=viewable@localhost"]),
|
|
787
804
|
];
|
|
788
805
|
}
|
|
789
806
|
|
|
@@ -880,12 +897,15 @@ async function mergeWorktreeImpl(root, worktreePath, log = () => {}) {
|
|
|
880
897
|
// only its index entry, even if the disk copy changed since staging; leave
|
|
881
898
|
// the live preview file intact. Do this before status so a clean tracked
|
|
882
899
|
// record produces a deletion commit too.
|
|
883
|
-
const untrack = await git(["rm", "--cached", "--force", "--ignore-unmatch", "--", ".glytch-server.json", ".glytch-page.json"], worktreePath);
|
|
900
|
+
const untrack = await git(["rm", "--cached", "--force", "--ignore-unmatch", "--", ".viewable-server.json", ".viewable-page.json", ".glytch-server.json", ".glytch-page.json"], worktreePath);
|
|
884
901
|
if (!untrack.ok) return { ok: false, detail: `Could not commit what the session left: ${untrack.detail}` };
|
|
885
|
-
const leftovers = await git(["status", "--porcelain"], worktreePath);
|
|
902
|
+
const leftovers = await git(["status", "--porcelain", "-z", "--untracked-files=all"], worktreePath);
|
|
886
903
|
if (!leftovers.ok) return { ok: false, detail: `Could not read the copy: ${leftovers.detail}` };
|
|
887
904
|
if (leftovers.stdout.trim() !== "") {
|
|
888
|
-
|
|
905
|
+
// The same cache exclusion the "Changed N files" count uses (#3894), so Keep
|
|
906
|
+
// never commits what the screen did not count.
|
|
907
|
+
const cacheExcludes = cachePathspecs(statusEntries(leftovers.stdout));
|
|
908
|
+
const add = await git(["add", "-A", "--", ".", ":(exclude)node_modules", ...cacheExcludes, ":(top,exclude,glob)[.]viewable-server.json", ":(top,exclude,glob)[.]viewable-page.json", ":(top,exclude,glob)[.]glytch-server.json", ":(top,exclude,glob)[.]glytch-page.json"], worktreePath);
|
|
889
909
|
const staged = add.ok ? await git(["diff", "--cached", "--quiet"], worktreePath) : add;
|
|
890
910
|
if (!add.ok) return { ok: false, detail: `Could not commit what the session left: ${add.detail}` };
|
|
891
911
|
if (staged.code === 1) {
|
|
@@ -980,7 +1000,7 @@ async function mergeWorktreeImpl(root, worktreePath, log = () => {}) {
|
|
|
980
1000
|
* aside under a name of our own, fast-forward to the merge, put them back.
|
|
981
1001
|
* Any step that fails puts everything back as it was. */
|
|
982
1002
|
async function landOnCheckout(root, base, merged, log) {
|
|
983
|
-
const tag = `
|
|
1003
|
+
const tag = `viewable keep ${Date.now()}`;
|
|
984
1004
|
const dirty = await git(["status", "--porcelain", "--untracked-files=no"], root);
|
|
985
1005
|
let saved = null;
|
|
986
1006
|
if (dirty.ok && dirty.stdout.trim() !== "") {
|
|
@@ -1092,16 +1112,53 @@ export async function changedFiles(worktreePath, root) {
|
|
|
1092
1112
|
async function uncommittedFiles(worktreePath) {
|
|
1093
1113
|
const status = await git(["status", "--porcelain", "-z", "--untracked-files=all"], worktreePath);
|
|
1094
1114
|
if (!status.ok) return [];
|
|
1095
|
-
|
|
1096
|
-
|
|
1115
|
+
return statusEntries(status.stdout)
|
|
1116
|
+
.filter((e) => e.path !== "node_modules" && !isUntrackedCache(e))
|
|
1117
|
+
.map((e) => e.path);
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/** `git status --porcelain -z` as { code, path } entries. A rename or copy is
|
|
1121
|
+
* followed by its old path, which is not a second file. */
|
|
1122
|
+
function statusEntries(stdout) {
|
|
1123
|
+
const parts = stdout.split("\0");
|
|
1124
|
+
const entries = [];
|
|
1097
1125
|
for (let i = 0; i < parts.length; i++) {
|
|
1098
1126
|
const entry = parts[i];
|
|
1099
1127
|
if (entry.length < 4) continue;
|
|
1100
|
-
|
|
1101
|
-
// A rename or copy is followed by its old path, which is not a second file.
|
|
1128
|
+
entries.push({ code: entry.slice(0, 2), path: entry.slice(3) });
|
|
1102
1129
|
if (entry[0] === "R" || entry[0] === "C") i++;
|
|
1103
1130
|
}
|
|
1104
|
-
return
|
|
1131
|
+
return entries;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/** Folders a download or a tool fills on its own: Python environments and
|
|
1135
|
+
* caches, package caches, notebook checkpoints. Untracked files in them are
|
|
1136
|
+
* not the session's changes, so they neither count toward "Changed N files"
|
|
1137
|
+
* nor go into Keep's commit (#3894). One list, one rule, for both. A file git
|
|
1138
|
+
* already tracks there is the session's, whatever the folder is called. */
|
|
1139
|
+
const CACHE_DIRS = new Set([
|
|
1140
|
+
".venv", "venv", "__pycache__", ".cache", ".npm", ".pnpm-store", ".yarn",
|
|
1141
|
+
".pytest_cache", ".mypy_cache", ".ruff_cache", ".ipynb_checkpoints", ".tox",
|
|
1142
|
+
"site-packages", "node_modules",
|
|
1143
|
+
]);
|
|
1144
|
+
const isCachePath = (path) =>
|
|
1145
|
+
path.split("/").some((part, i, parts) => (i < parts.length - 1 && CACHE_DIRS.has(part)) || part === ".DS_Store");
|
|
1146
|
+
const isUntrackedCache = (entry) => entry.code === "??" && isCachePath(entry.path);
|
|
1147
|
+
|
|
1148
|
+
/** Pathspecs that keep `git add -A` away from the untracked cache files: one
|
|
1149
|
+
* per cache folder, or per file when git tracks a changed file inside that
|
|
1150
|
+
* folder (a folder exclude would hide that change too). */
|
|
1151
|
+
function cachePathspecs(entries) {
|
|
1152
|
+
const tracked = entries.filter((e) => e.code !== "??").map((e) => e.path);
|
|
1153
|
+
const specs = new Set();
|
|
1154
|
+
for (const entry of entries.filter(isUntrackedCache)) {
|
|
1155
|
+
const parts = entry.path.split("/");
|
|
1156
|
+
const at = parts.findIndex((part, i) => i < parts.length - 1 && CACHE_DIRS.has(part));
|
|
1157
|
+
const folder = at === -1 ? null : parts.slice(0, at + 1).join("/");
|
|
1158
|
+
const shared = folder !== null && tracked.some((t) => t.startsWith(`${folder}/`));
|
|
1159
|
+
specs.add(`:(top,exclude,literal)${folder === null || shared ? entry.path : folder}`);
|
|
1160
|
+
}
|
|
1161
|
+
return [...specs];
|
|
1105
1162
|
}
|
|
1106
1163
|
|
|
1107
1164
|
// LOCKED WRAPPERS for the five mutation functions. Git mutations on the same
|
|
@@ -1109,23 +1166,23 @@ async function uncommittedFiles(worktreePath) {
|
|
|
1109
1166
|
// mergeWorktree calls on the same root are guaranteed to run sequentially, order
|
|
1110
1167
|
// preserved. Reads (branchOfWorktree, worktreeSummary)
|
|
1111
1168
|
// stay unlocked.
|
|
1112
|
-
export async function makeWorktree(root, id, log = () => {}, title = "") {
|
|
1113
|
-
return withRepoLock(root, () => makeWorktreeImpl(root, id, log, title), log);
|
|
1169
|
+
export async function makeWorktree(root, id, log = () => {}, title = "", lifecycle) {
|
|
1170
|
+
return withRepoLock(root, () => makeWorktreeImpl(root, id, log, title), log, lifecycle);
|
|
1114
1171
|
}
|
|
1115
1172
|
|
|
1116
1173
|
/** The chat tree's mint takes the repo lock like every other git mutation:
|
|
1117
1174
|
* two rooms' first messages to the same agent, typed at once, are two
|
|
1118
1175
|
* `worktree add` calls for one path. */
|
|
1119
|
-
export async function makeChatWorktree(root, path, log = () => {}) {
|
|
1120
|
-
return withRepoLock(root, () => makeChatWorktreeImpl(root, path, log), log);
|
|
1176
|
+
export async function makeChatWorktree(root, path, log = () => {}, lifecycle) {
|
|
1177
|
+
return withRepoLock(root, () => makeChatWorktreeImpl(root, path, log), log, lifecycle);
|
|
1121
1178
|
}
|
|
1122
1179
|
|
|
1123
1180
|
export async function cleanWorktree(root, made, log = () => {}, wroteFiles = []) {
|
|
1124
1181
|
return withRepoLock(root, () => cleanWorktreeImpl(root, made, log, wroteFiles), log);
|
|
1125
1182
|
}
|
|
1126
1183
|
|
|
1127
|
-
export async function reuseWorktree(root, existingPath, log = () => {}) {
|
|
1128
|
-
return withRepoLock(root, () => reuseWorktreeImpl(root, existingPath, log), log);
|
|
1184
|
+
export async function reuseWorktree(root, existingPath, log = () => {}, lifecycle) {
|
|
1185
|
+
return withRepoLock(root, () => reuseWorktreeImpl(root, existingPath, log), log, lifecycle);
|
|
1129
1186
|
}
|
|
1130
1187
|
|
|
1131
1188
|
export async function mergeWorktree(root, worktreePath, log = () => {}) {
|
package/lib/writePolicy.mjs
CHANGED
|
@@ -7,21 +7,94 @@
|
|
|
7
7
|
// no value imports of its own, so this is its transpile and nothing else: the
|
|
8
8
|
// rule is written once, where it belongs, and both the app and this function
|
|
9
9
|
// read the same one.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// What a call does, read from its own words: the tool's name and every
|
|
11
|
+
// action it is given; the strictest verb in each decides it (verbOf below).
|
|
12
|
+
// A tool's own label is a claim, never a grant (#5111): it only adds an ask.
|
|
13
|
+
const READS = new Set(["get", "list", "search", "find", "fetch", "read", "query", "retrieve", "lookup", "describe", "view", "show", "count", "explore", "inspect", "preview", "browse"]);
|
|
14
|
+
// A plain create or edit: Always allow may cover it when the tool also says
|
|
15
|
+
// it is a write that is not destructive.
|
|
16
|
+
const PLAIN = new Set(["create", "add", "new", "update", "edit", "modify", "change", "insert", "append", "save", "set", "write", "put", "patch", "upsert",
|
|
17
|
+
"comment", "reply", "assign", "unassign", "rename", "label", "tag", "attach", "link", "unlink", "mark", "close", "reopen", "resolve", "complete", "transition",
|
|
18
|
+
"copy", "duplicate", "clone", "upload", "star", "unstar", "pin", "unpin", "react", "follow", "unfollow", "subscribe", "unsubscribe"]);
|
|
19
|
+
// Every other change: never a read, never covered by Always allow.
|
|
20
|
+
const CHANGES = new Set(["delete", "remove", "destroy", "erase", "send", "post", "publish", "merge", "deploy", "archive", "trash", "cancel", "refund", "charge", "pay",
|
|
21
|
+
"transfer", "invite", "share", "execute", "exec", "run", "invoke", "apply", "submit", "approve", "revoke", "grant", "enable", "disable", "start", "stop", "restart",
|
|
22
|
+
"trigger", "lock", "unlock", "install", "uninstall", "push", "fork", "move", "schedule", "buy", "purchase", "sell", "withdraw", "deposit", "void", "capture",
|
|
23
|
+
"finalize", "sync", "reset", "clear", "purge", "wipe", "drop", "truncate", "overwrite", "block", "unblock", "ban", "kick", "mutate", "import", "replace",
|
|
24
|
+
"dismiss", "convert", "restore", "accept", "decline", "reject", "generate", "make", "detach"]);
|
|
25
|
+
const STRICTNESS = ["change", "plain", "read"];
|
|
26
|
+
/** The strictest verb across every word of one text: a change anywhere wins,
|
|
27
|
+
* then a plain change, then a read ("get_or_create_board" is plain,
|
|
28
|
+
* "list_item_delete" a change). No verb at all is unknown. */
|
|
29
|
+
function verbOf(text) {
|
|
30
|
+
const words = new Set(text.replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().split(/[^a-z0-9]+/));
|
|
31
|
+
const found = new Set();
|
|
32
|
+
for (const word of words) {
|
|
33
|
+
if (CHANGES.has(word))
|
|
34
|
+
found.add("change");
|
|
35
|
+
else if (PLAIN.has(word))
|
|
36
|
+
found.add("plain");
|
|
37
|
+
else if (READS.has(word))
|
|
38
|
+
found.add("read");
|
|
39
|
+
}
|
|
40
|
+
return STRICTNESS.find((verb) => found.has(verb)) ?? "unknown";
|
|
41
|
+
}
|
|
42
|
+
// The words writeRisk reads as a risk.
|
|
43
|
+
const MONEY = /refund|payment|charge|transfer|payout|invoice|subscription/;
|
|
44
|
+
const SENDING = /send|email|message|slack.*post/;
|
|
45
|
+
const DELETING = /delet|remov|destroy|archive|cancel|\breplace_content\b/;
|
|
46
|
+
const PUBLISHING = /publish|release/;
|
|
47
|
+
const MERGING = /merge/;
|
|
48
|
+
const DEPLOYING = /deploy/;
|
|
49
|
+
/** Every action a call is given: each of method, action, command and
|
|
50
|
+
* operation, never just the first one set (#5111). */
|
|
51
|
+
function actionTexts(args) {
|
|
52
|
+
return [args.method, args.action, args.command, args.operation].filter((value) => typeof value === "string");
|
|
53
|
+
}
|
|
54
|
+
/** What each of the call's texts (its name, then every action) does. */
|
|
55
|
+
function callVerbs(name, args) {
|
|
56
|
+
return [name, ...actionTexts(args)].map(verbOf);
|
|
57
|
+
}
|
|
58
|
+
/** Whether this call only reads, so it runs with no ask. Only a tool that
|
|
59
|
+
* labels itself read-only can (MCP readOnlyHint; absent means "may write"),
|
|
60
|
+
* and the label never wins over what the call says it does: a name or
|
|
61
|
+
* action that names a change, a destructive flag, or an archive or trash
|
|
62
|
+
* flag makes it a write that asks like any other (#5111). Generic: no app
|
|
63
|
+
* is named (#4419). */
|
|
64
|
+
export function readsOnly(name, args = {}, hints) {
|
|
65
|
+
if (hints?.readOnlyHint !== true || hints.destructiveHint === true)
|
|
66
|
+
return false;
|
|
67
|
+
if (args.archived === true || args.in_trash === true)
|
|
68
|
+
return false;
|
|
69
|
+
return !callVerbs(name, args).some((verb) => verb !== "read");
|
|
70
|
+
}
|
|
71
|
+
export function writeRisk(provider, name, args = {}, hints) {
|
|
72
|
+
const words = `${name.replace(/([a-z])([A-Z])/g, "$1_$2")} ${actionTexts(args).join(" ")}`.toLowerCase();
|
|
73
|
+
if (provider === "stripe" || MONEY.test(words))
|
|
13
74
|
return "money";
|
|
14
|
-
if (
|
|
75
|
+
if (SENDING.test(words))
|
|
15
76
|
return "sending";
|
|
16
|
-
if (args.archived === true || args.in_trash === true ||
|
|
77
|
+
if (args.archived === true || args.in_trash === true || DELETING.test(words))
|
|
17
78
|
return "deleting";
|
|
18
|
-
|
|
79
|
+
// The tool's own destructive flag adds an ask every time (Allow and Not
|
|
80
|
+
// this only), in any app. Its own flag is not "deleting": a create tool
|
|
81
|
+
// may carry it (#4571). A tool with no hints stays open-ended below (#4436).
|
|
82
|
+
if (hints?.destructiveHint === true)
|
|
83
|
+
return "destructive";
|
|
84
|
+
if (PUBLISHING.test(words))
|
|
19
85
|
return "publishing";
|
|
20
|
-
if (
|
|
86
|
+
if (MERGING.test(words))
|
|
21
87
|
return "merging";
|
|
22
|
-
if (
|
|
88
|
+
if (DEPLOYING.test(words))
|
|
23
89
|
return "deploying";
|
|
24
|
-
//
|
|
90
|
+
// A write that says it is not destructive is ordinary only when its own
|
|
91
|
+
// words name a plain create or edit: the label alone never lets Always
|
|
92
|
+
// allow skip the ask (#5111).
|
|
93
|
+
if (hints?.readOnlyHint === false && hints.destructiveHint === false) {
|
|
94
|
+
if (callVerbs(name, args).every((verb) => verb === "plain"))
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
// A small reviewed list. Any other is open-ended.
|
|
25
98
|
if (provider === "linear" && ["create_issue", "update_issue", "save_issue"].includes(name))
|
|
26
99
|
return null;
|
|
27
100
|
if (provider === "notion" && ["notion-create-pages", "create_pages"].includes(name))
|
|
@@ -35,11 +108,18 @@ export function writeRisk(provider, name, args = {}) {
|
|
|
35
108
|
return null;
|
|
36
109
|
return "open-ended";
|
|
37
110
|
}
|
|
111
|
+
/** The one line under the ask that says why it asks every time, or "" when
|
|
112
|
+
* there is no plainer reason than the ask's own "Asks every time": a tool
|
|
113
|
+
* that only flags itself destructive names no act of its own (#4571). */
|
|
38
114
|
export function riskReason(risk) {
|
|
39
115
|
if (risk === "money")
|
|
40
116
|
return "Money moves, so this asks every time.";
|
|
117
|
+
if (risk === "destructive")
|
|
118
|
+
return "";
|
|
41
119
|
return `${risk === "open-ended" ? "Open-ended tools ask" : risk[0].toUpperCase() + risk.slice(1) + " asks"} every time.`;
|
|
42
120
|
}
|
|
121
|
+
/** Every connected app may write, after the same approval; what asks every
|
|
122
|
+
* time comes from writeRisk (#4436). */
|
|
43
123
|
export function writesSupported(provider) {
|
|
44
|
-
return
|
|
124
|
+
return provider.trim() !== "";
|
|
45
125
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viewable-one",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"description": "Run coding agents from the Viewable board. Connects your machine to app.viewable.one, launches a session in its own worktree when you press Run, and streams what it does back to the canvas.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"//scripts": "NO postinstall since 2026-09-14. It ran lib/installCloudflared.mjs to pre-fetch the cloudflared binary, which is only ever needed by a SHARED PREVIEW - so every install of the runner paid for a download most machines never use, and printed a warning line when it failed (reported through the app's feedback as an npm warning on install). lib/previewTunnel.mjs already calls ensureCloudflared lazily and reports its own failure in words a person can act on, so the fetch happens the first time a preview is actually shared and not before. prepublishOnly is NOT the test suite, on purpose: it used to be `node --test`, and a filesystem-race test that only misbehaves in one shell blocked about ten releases without ever catching a real defect in one. The suite runs in `npm run verify` and as its own step in the release workflow, both of which stop a publish. scripts/prepublish.mjs checks what is only true of the artifact and cannot answer differently twice.",
|
|
56
56
|
"scripts": {
|
|
57
|
-
"test": "node
|
|
57
|
+
"test": "node ../scripts/test-bridge.mjs",
|
|
58
58
|
"prepublishOnly": "node scripts/prepublish.mjs"
|
|
59
59
|
}
|
|
60
60
|
}
|