shadok-ai 0.17.14 → 0.17.16
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 -2
- package/context/pilot-prompt.md +3 -2
- package/dist/agent-login.js +8 -1
- package/dist/agent-login.js.map +1 -1
- package/package.json +1 -1
- package/public/bang.js +15 -7
package/README.md
CHANGED
|
@@ -223,8 +223,11 @@ Enter to skip; you can add it later from the web UI).
|
|
|
223
223
|
- **Run the command an agent asks you to** — when an agent writes `! cmd` for
|
|
224
224
|
you to run (typically because it cannot), a ▶ run button sits right on that
|
|
225
225
|
command's code block, beside its copy button — so it runs where it was
|
|
226
|
-
written, not in a list below.
|
|
227
|
-
|
|
226
|
+
written, not in a list below. On a line of its own the space is optional, so
|
|
227
|
+
`!/path/to/script.sh` gets the button just like `! /path/to/script.sh`. (An
|
|
228
|
+
inline `` `! cmd` `` with no block of its own still gets a button under the
|
|
229
|
+
message — there the space is required, so a stray `` `!important` `` in prose
|
|
230
|
+
is never mistaken for a command.) It runs in the agent's shell after
|
|
228
231
|
a confirmation showing the exact command, and is refused for anything but your
|
|
229
232
|
browser, since shell mode sits outside the agent's guardrails. The command and
|
|
230
233
|
its output stay in the chat, reload included — as does one you typed yourself
|
package/context/pilot-prompt.md
CHANGED
|
@@ -55,8 +55,9 @@ Claude Code sessions in parallel. A human pilots you from a browser chat
|
|
|
55
55
|
(`claude auth login`, `gcloud auth login`), a step that needs their own
|
|
56
56
|
credentials or presence — prefix the command with `!` so the cockpit puts a
|
|
57
57
|
one-click ▶ run button on it. Two shapes work, and you must use one of them:
|
|
58
|
-
inline `` `! cmd`
|
|
59
|
-
|
|
58
|
+
inline `` `! cmd` `` (keep the space there), or a line that is *exactly* the
|
|
59
|
+
command on its own — `! cmd` or `!cmd`, the space is optional on a standalone
|
|
60
|
+
line — which in a fenced block gets the button right on that block. Writing the command
|
|
60
61
|
without the leading `!` — "run `claude auth login`" — gives them only text to
|
|
61
62
|
copy out and run elsewhere, which is the friction this removes, so put the `!`
|
|
62
63
|
every time you tell the human to run something. It runs in your shell, after a
|
package/dist/agent-login.js
CHANGED
|
@@ -73,7 +73,14 @@ function tmux(args, input) {
|
|
|
73
73
|
}
|
|
74
74
|
function capture(session) {
|
|
75
75
|
try {
|
|
76
|
-
|
|
76
|
+
// `-J` rejoins visually WRAPPED lines. The login OAuth URL (the full
|
|
77
|
+
// claude.ai scope set) is long enough to wrap the pane, and without `-J`
|
|
78
|
+
// `capture-pane` returns the wrap as two lines — so `parseSetupTokenUrl`'s
|
|
79
|
+
// `\S+` stops at the newline and hands back a TRUNCATED URL (no `state`, no
|
|
80
|
+
// `code_challenge_method`), which claude.com rejects as an invalid OAuth
|
|
81
|
+
// request. Width alone is not a safe fix (a longer URL wraps again); `-J`
|
|
82
|
+
// reassembles whatever the width.
|
|
83
|
+
return tmux(["capture-pane", "-t", session, "-p", "-J"]);
|
|
77
84
|
}
|
|
78
85
|
catch {
|
|
79
86
|
return "";
|
package/dist/agent-login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-login.js","sourceRoot":"","sources":["../src/agent-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,kFAAkF;AAClF,MAAM,YAAY,GAAG,EAAE,GAAG,MAAM,CAAC;AACjC,gEAAgE;AAChE,MAAM,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AAC,GAAG,CAAC,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,uCAAuC,EAAE,CAAC;AACvE,CAAC"}
|
package/package.json
CHANGED
package/public/bang.js
CHANGED
|
@@ -14,11 +14,18 @@ export const MAX_BANG_PER_MESSAGE = 5;
|
|
|
14
14
|
* Two shapes, both how an agent actually writes them:
|
|
15
15
|
* - inline code: `! ssh ubuntu@host 'docker exec …'`
|
|
16
16
|
* - a line of its own, usually inside a fenced block: `! claude --version`
|
|
17
|
+
* or, as Claude Code's own bash mode spells it, with no space: `!/path/x.sh`
|
|
17
18
|
*
|
|
18
19
|
* Deliberately NOT a bare `!` anywhere in prose ("Done!", "! important"): a
|
|
19
20
|
* command is only recognised where an agent marks it as one — inline code, or a
|
|
20
21
|
* line that is nothing but the command. And never across lines: shell mode
|
|
21
22
|
* reads ONE line, so a multi-line block gets no button rather than a glued one.
|
|
23
|
+
*
|
|
24
|
+
* The space after `!` is OPTIONAL only for a STANDALONE line: `!/tmp/run.sh`
|
|
25
|
+
* (no space, as an agent copies it from Claude Code's bash mode) is a command,
|
|
26
|
+
* while a whole line that is only `!important` as prose is implausible. Inline
|
|
27
|
+
* code KEEPS the space (`` `! cmd` ``): `` `!important` `` (CSS) and `` `!=` ``
|
|
28
|
+
* are real in a technical chat, and the space is what tells them from a command.
|
|
22
29
|
*/
|
|
23
30
|
export function bangCommands(text) {
|
|
24
31
|
const out = [];
|
|
@@ -27,11 +34,12 @@ export function bangCommands(text) {
|
|
|
27
34
|
if (cmd && !out.includes(cmd) && out.length < MAX_BANG_PER_MESSAGE) out.push(cmd);
|
|
28
35
|
};
|
|
29
36
|
const src = String(text || "");
|
|
30
|
-
// Inline code first: `! cmd`
|
|
37
|
+
// Inline code first: `! cmd` — the space is REQUIRED here (see the note above).
|
|
31
38
|
for (const m of src.matchAll(/`!\s+([^`\n]+)`/g)) add(m[1]);
|
|
32
|
-
// Then whole lines: "! cmd" on its own line (fenced block or bare)
|
|
39
|
+
// Then whole lines: "! cmd" on its own line (fenced block or bare); the space
|
|
40
|
+
// is optional, so `!/path/to/x.sh` is recognised like `! /path/to/x.sh`.
|
|
33
41
|
for (const line of src.split("\n")) {
|
|
34
|
-
const m = /^\s*!\s
|
|
42
|
+
const m = /^\s*!\s*(\S.*)$/.exec(line);
|
|
35
43
|
if (m && !/^`/.test(line.trim())) add(m[1].replace(/`+$/, ""));
|
|
36
44
|
}
|
|
37
45
|
return out;
|
|
@@ -43,13 +51,13 @@ export function bangCommands(text) {
|
|
|
43
51
|
* A code block earns an inline "run" button only when it is EXACTLY one `! cmd`
|
|
44
52
|
* line: shell mode reads one line, so a multi-line block is not one runnable
|
|
45
53
|
* command, and a block of prose is not a command at all. Mirrors the line rule
|
|
46
|
-
* of bangCommands (the
|
|
47
|
-
* never disagree about what is runnable — the inline
|
|
48
|
-
* row offer the same command, spelled the same way.
|
|
54
|
+
* of bangCommands (the `!` marker with an OPTIONAL space, trailing backticks
|
|
55
|
+
* trimmed) so the two can never disagree about what is runnable — the inline
|
|
56
|
+
* button and the fallback row offer the same command, spelled the same way.
|
|
49
57
|
*/
|
|
50
58
|
export function blockCommand(codeText) {
|
|
51
59
|
const t = String(codeText == null ? "" : codeText).replace(/\s+$/, "");
|
|
52
60
|
if (!t || /\n/.test(t)) return null;
|
|
53
|
-
const m = /^\s*!\s
|
|
61
|
+
const m = /^\s*!\s*(\S.*)$/.exec(t);
|
|
54
62
|
return m ? m[1].replace(/`+$/, "").trim() : null;
|
|
55
63
|
}
|