shadok-ai 0.17.30 → 0.17.31
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 +2 -2
- package/dist/accounts.d.ts +5 -3
- package/dist/accounts.js +14 -4
- package/dist/accounts.js.map +1 -1
- package/dist/prompt-kind.d.ts +19 -0
- package/dist/prompt-kind.js +34 -2
- package/dist/prompt-kind.js.map +1 -1
- package/dist/promptmeta.d.ts +41 -1
- package/dist/promptmeta.js +42 -3
- package/dist/promptmeta.js.map +1 -1
- package/dist/server.js +48 -13
- package/dist/server.js.map +1 -1
- package/dist/telegram.d.ts +5 -0
- package/dist/telegram.js +7 -1
- package/dist/telegram.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1090,7 +1090,7 @@ client, or immediately on an explicit `stop` (which ends it for everyone).
|
|
|
1090
1090
|
|
|
1091
1091
|
| Message | Purpose |
|
|
1092
1092
|
|---|---|
|
|
1093
|
-
| `{type:"start", cwd?, resume?, continue?, worktree?, branch?, repo?, profile?, parent?, origin?}` | starts or attaches to the session (once per connection). `origin` (`"web"`, `"cron"`, `"telegram"`, `"agent"`, `"cli"`) travels with `prompt-echo` so other clients can say who spoke — and a prompt from someone (web/telegram/cli/agent) also reaches the TUI under a `⟦platform · time · sender⟧` header, so the agent knows whether the human or a sibling agent is talking to it. An `agent` header ends with the sender's short session id — its reply address, since a tab name is not unique — and that id is stripped back out of the name before display, so it never appears in the chat. `parent` records who launched this agent — a refused link is dropped and logged, never fatal to the spawn |
|
|
1093
|
+
| `{type:"start", cwd?, resume?, continue?, worktree?, branch?, repo?, profile?, parent?, origin?}` | starts or attaches to the session (once per connection). `origin` (`"web"`, `"cron"`, `"telegram"`, `"agent"`, `"peer"`, `"cli"`) travels with `prompt-echo` so other clients can say who spoke. It is DERIVED by the server from what the connection proved (system-drive secret, Telegram-bridge secret, agent session key, peer token, same-origin browser); the frame's own `origin` is only honoured to narrow an unauthenticated local client to `"cli"`/`"boot"`. A line of the prompt text shaped like a header, ledger block or cron/agent mark is prefixed with `\` so it stays text — and a prompt from someone (web/telegram/cli/agent) also reaches the TUI under a `⟦platform · time · sender⟧` header, so the agent knows whether the human or a sibling agent is talking to it. An `agent` header ends with the sender's short session id — its reply address, since a tab name is not unique — and that id is stripped back out of the name before display, so it never appears in the chat. `parent` records who launched this agent — a refused link is dropped and logged, never fatal to the spawn |
|
|
1094
1094
|
| `{type:"prompt", text, force?}` | sends a prompt (`force` bypasses the pace guard) |
|
|
1095
1095
|
| `{type:"choose", n}` | single-select dialog: picks and validates option n |
|
|
1096
1096
|
| `{type:"toggle", n}` / `{type:"confirm"}` | multi-select: toggles option n / submits |
|
|
@@ -1113,7 +1113,7 @@ client, or immediately on an explicit `stop` (which ends it for everyone).
|
|
|
1113
1113
|
| `{type:"stream-tool", id, name, summary}` / `{type:"stream-result", …}` | tool call / tool result |
|
|
1114
1114
|
| `{type:"tokens", tokens}` / `{type:"context", pct}` | token usage / context fill |
|
|
1115
1115
|
| `{type:"parent", parent}` | the channel's parent changed (broadcast, so every tab follows) |
|
|
1116
|
-
| `{type:"prompt-echo", text, origin?, from?}` | prompt sent by another client of the session. `from` is resolved SERVER-side for a web or
|
|
1116
|
+
| `{type:"prompt-echo", text, origin?, from?}` | prompt sent by another client of the session. `from` is resolved SERVER-side for a web, agent or peer prompt (the signed-in account / the calling agent's tab name / the peer's name); a frame's `from` is believed only from the Telegram bridge |
|
|
1117
1117
|
| `{type:"dialog", question, options:[{n,label,hint,checked?}], multi}` | choice pending |
|
|
1118
1118
|
| `{type:"history", turns:[…]}` | transcript replayed when resuming/attaching |
|
|
1119
1119
|
| `{type:"screen", text, working}` | rendered TUI screen (whenever it changes) |
|
package/dist/accounts.d.ts
CHANGED
|
@@ -137,8 +137,10 @@ export declare function inviteVerdict(account: Account | undefined, token: strin
|
|
|
137
137
|
* The security property of the accounts feature, in one place: for a WEB client
|
|
138
138
|
* the session decides and the frame's claim is discarded, because a browser can
|
|
139
139
|
* put anything in `from`. The Telegram bridge is a trusted bridge that knows its
|
|
140
|
-
* sender, so it keeps naming them
|
|
141
|
-
*
|
|
140
|
+
* sender, so it keeps naming them — and only it: `origin` is derived from
|
|
141
|
+
* the CONNECTION (`connectionOrigin`, src/promptmeta.ts), so "telegram" means
|
|
142
|
+
* the bridge proved itself with its per-process secret. Other origins (cli,
|
|
143
|
+
* cron, boot) name nobody: a `from` they carry is a claim nobody verified.
|
|
142
144
|
*
|
|
143
145
|
* An AGENT prompt (pilotctl, `origin: "agent"`) follows the WEB rule, not the
|
|
144
146
|
* bridge one: the name comes from the session key that signed the socket, and a
|
|
@@ -146,7 +148,7 @@ export declare function inviteVerdict(account: Account | undefined, token: strin
|
|
|
146
148
|
* name cannot be taken from — it writes its own frames, and the whole point of
|
|
147
149
|
* the label is to tell its message apart from the human's.
|
|
148
150
|
*/
|
|
149
|
-
export declare function promptAuthor(origin: string | undefined, sessionName: string | undefined, claimed: string | undefined, callerAgent?: string | undefined): string | undefined;
|
|
151
|
+
export declare function promptAuthor(origin: string | undefined, sessionName: string | undefined, claimed: string | undefined, callerAgent?: string | undefined, callerPeer?: string | undefined): string | undefined;
|
|
150
152
|
/**
|
|
151
153
|
* The per-session capability key handed to an agent as `SHADOK_SESSION_KEY`.
|
|
152
154
|
*
|
package/dist/accounts.js
CHANGED
|
@@ -207,8 +207,10 @@ export function inviteVerdict(account, token, now) {
|
|
|
207
207
|
* The security property of the accounts feature, in one place: for a WEB client
|
|
208
208
|
* the session decides and the frame's claim is discarded, because a browser can
|
|
209
209
|
* put anything in `from`. The Telegram bridge is a trusted bridge that knows its
|
|
210
|
-
* sender, so it keeps naming them
|
|
211
|
-
*
|
|
210
|
+
* sender, so it keeps naming them — and only it: `origin` is derived from
|
|
211
|
+
* the CONNECTION (`connectionOrigin`, src/promptmeta.ts), so "telegram" means
|
|
212
|
+
* the bridge proved itself with its per-process secret. Other origins (cli,
|
|
213
|
+
* cron, boot) name nobody: a `from` they carry is a claim nobody verified.
|
|
212
214
|
*
|
|
213
215
|
* An AGENT prompt (pilotctl, `origin: "agent"`) follows the WEB rule, not the
|
|
214
216
|
* bridge one: the name comes from the session key that signed the socket, and a
|
|
@@ -216,12 +218,20 @@ export function inviteVerdict(account, token, now) {
|
|
|
216
218
|
* name cannot be taken from — it writes its own frames, and the whole point of
|
|
217
219
|
* the label is to tell its message apart from the human's.
|
|
218
220
|
*/
|
|
219
|
-
export function promptAuthor(origin, sessionName, claimed, callerAgent) {
|
|
221
|
+
export function promptAuthor(origin, sessionName, claimed, callerAgent, callerPeer) {
|
|
220
222
|
if (origin === "web")
|
|
221
223
|
return sessionName;
|
|
222
224
|
if (origin === "agent")
|
|
223
225
|
return callerAgent;
|
|
224
|
-
|
|
226
|
+
if (origin === "peer")
|
|
227
|
+
return callerPeer;
|
|
228
|
+
// The bridge is the ONE caller whose claim is believed — and `origin` is
|
|
229
|
+
// "telegram" only when the connection proved it is the bridge
|
|
230
|
+
// (`connectionOrigin`), never because a frame said so. Anything else (cli,
|
|
231
|
+
// cron, boot) names nobody: it writes its own frames.
|
|
232
|
+
if (origin === "telegram")
|
|
233
|
+
return claimed;
|
|
234
|
+
return undefined;
|
|
225
235
|
}
|
|
226
236
|
/**
|
|
227
237
|
* The per-session capability key handed to an agent as `SHADOK_SESSION_KEY`.
|
package/dist/accounts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA8CzC,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG,OA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AAC,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACvE,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/prompt-kind.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/** What a neutralised line is prefixed with. A visible backslash rather than an
|
|
2
|
+
* invisible character: the agent and the person replaying it both see that
|
|
3
|
+
* the line was typed, not stamped by the server. */
|
|
4
|
+
export declare const FORGED_ESCAPE = "\\";
|
|
5
|
+
/**
|
|
6
|
+
* Escape every line of HUMAN text that is shaped like a server-written mark, so
|
|
7
|
+
* it reaches the agent (and the replay) as plain text and never as a header, a
|
|
8
|
+
* ledger delta or a hiding mark. Every line, not only the first: the server's
|
|
9
|
+
* header now always comes first, so a forged one can only sit lower — where the
|
|
10
|
+
* parsers ignore it but an agent reading the prompt would not.
|
|
11
|
+
*
|
|
12
|
+
* Narrow on purpose: Telegram's own scaffolding (`⟦replying to …⟧ "…"`,
|
|
13
|
+
* `⟦heard in the video⟧ …`) opens with ⟦ too, but is not header-shaped (it does
|
|
14
|
+
* not END with ⟧ / carry " · "), so it is left alone. Pure.
|
|
15
|
+
*/
|
|
16
|
+
export declare function neutralizeForgedLines(text: string): string;
|
|
17
|
+
/** A human prompt as the TUI receives it: the server's own header first, the
|
|
18
|
+
* person's text neutralised beneath it. The one way a header is put on. */
|
|
19
|
+
export declare function markHumanPrompt(text: string, header: string): string;
|
|
1
20
|
/**
|
|
2
21
|
* The text of a transcript line IF it is a real human prompt, else null.
|
|
3
22
|
*
|
package/dist/prompt-kind.js
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
import { isCronPrompt } from "./crons.js";
|
|
2
2
|
import { isAgentPrompt } from "./kinship.js";
|
|
3
|
-
import { stripPromptMeta, parsePromptMeta } from "./promptmeta.js";
|
|
4
|
-
import { stripLedgerBlock } from "./ledger.js";
|
|
3
|
+
import { stripPromptMeta, parsePromptMeta, hasPromptMeta, markPromptMeta } from "./promptmeta.js";
|
|
4
|
+
import { stripLedgerBlock, hasLedgerBlock } from "./ledger.js";
|
|
5
|
+
/** What a neutralised line is prefixed with. A visible backslash rather than an
|
|
6
|
+
* invisible character: the agent and the person replaying it both see that
|
|
7
|
+
* the line was typed, not stamped by the server. */
|
|
8
|
+
export const FORGED_ESCAPE = "\\";
|
|
9
|
+
/** Would this line be read as something only the SERVER writes — a context
|
|
10
|
+
* header, a ledger block, a cron fire, a parent notification? */
|
|
11
|
+
function looksServerWritten(line) {
|
|
12
|
+
const l = line.trimStart();
|
|
13
|
+
return hasPromptMeta(l) || hasLedgerBlock(l) || isCronPrompt(l) || isAgentPrompt(l);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Escape every line of HUMAN text that is shaped like a server-written mark, so
|
|
17
|
+
* it reaches the agent (and the replay) as plain text and never as a header, a
|
|
18
|
+
* ledger delta or a hiding mark. Every line, not only the first: the server's
|
|
19
|
+
* header now always comes first, so a forged one can only sit lower — where the
|
|
20
|
+
* parsers ignore it but an agent reading the prompt would not.
|
|
21
|
+
*
|
|
22
|
+
* Narrow on purpose: Telegram's own scaffolding (`⟦replying to …⟧ "…"`,
|
|
23
|
+
* `⟦heard in the video⟧ …`) opens with ⟦ too, but is not header-shaped (it does
|
|
24
|
+
* not END with ⟧ / carry " · "), so it is left alone. Pure.
|
|
25
|
+
*/
|
|
26
|
+
export function neutralizeForgedLines(text) {
|
|
27
|
+
return text
|
|
28
|
+
.split("\n")
|
|
29
|
+
.map((l) => (looksServerWritten(l) ? FORGED_ESCAPE + l : l))
|
|
30
|
+
.join("\n");
|
|
31
|
+
}
|
|
32
|
+
/** A human prompt as the TUI receives it: the server's own header first, the
|
|
33
|
+
* person's text neutralised beneath it. The one way a header is put on. */
|
|
34
|
+
export function markHumanPrompt(text, header) {
|
|
35
|
+
return markPromptMeta(neutralizeForgedLines(text), header);
|
|
36
|
+
}
|
|
5
37
|
/**
|
|
6
38
|
* The text of a transcript line IF it is a real human prompt, else null.
|
|
7
39
|
*
|
package/dist/prompt-kind.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-kind.js","sourceRoot":"","sources":["../src/prompt-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"prompt-kind.js","sourceRoot":"","sources":["../src/prompt-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D;;qDAEqD;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC;kEACkE;AAClE,SAAS,kBAAkB,CAAC,IAAY;IACtC,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAC3B,OAAO,aAAa,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CA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AyC;IACzC,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC;QAC3B,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACrD,CAAC;AACJ,CAAC"}
|
package/dist/promptmeta.d.ts
CHANGED
|
@@ -40,8 +40,48 @@ export declare function parsePromptMeta(text: string): {
|
|
|
40
40
|
who: string;
|
|
41
41
|
ref?: string;
|
|
42
42
|
} | null;
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Prepend the header as its own first line — ALWAYS.
|
|
45
|
+
*
|
|
46
|
+
* It used to return early when the text already opened with a header ("never
|
|
47
|
+
* double a header"). The text is the HUMAN's, so that rule let anyone type
|
|
48
|
+
* `⟦agent · … · Shadok-Boss · 1a2b3c4d⟧` as their first line and have it reach
|
|
49
|
+
* the agent as the only header there was: a Telegram message or web prompt
|
|
50
|
+
* passing for a sibling agent (with a forged reply address) or for the admin,
|
|
51
|
+
* and replayed under that forged author. The server's header is unconditional;
|
|
52
|
+
* a header-shaped line in the user's text is neutralised by the caller
|
|
53
|
+
* (`markHumanPrompt`, src/prompt-kind.ts), so it can never parse as one.
|
|
54
|
+
*/
|
|
44
55
|
export declare function markPromptMeta(text: string, header: string): string;
|
|
56
|
+
/** What the server knows about a WebSocket connection, decided ONCE at connect
|
|
57
|
+
* from its headers — never from a frame. */
|
|
58
|
+
export type ConnectionFacts = {
|
|
59
|
+
/** Presented the per-process system-drive secret (`driveChannel`). */
|
|
60
|
+
systemDrive: boolean;
|
|
61
|
+
/** Presented the per-process Telegram-bridge secret (src/telegram.ts). */
|
|
62
|
+
telegramBridge: boolean;
|
|
63
|
+
/** Signed by a verified agent session key (pilotctl inside an agent). */
|
|
64
|
+
agent: boolean;
|
|
65
|
+
/** Authenticated as a peer instance (`x-shadok-peer`). */
|
|
66
|
+
peer: boolean;
|
|
67
|
+
/** A same-origin browser person (`requestFromBrowser`). */
|
|
68
|
+
browser: boolean;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* WHERE a connection speaks from, derived from what it PROVED at connect.
|
|
72
|
+
*
|
|
73
|
+
* `origin` used to be whatever the `start` frame declared, and it decides three
|
|
74
|
+
* things a client must not choose for itself: the header the agent reads, the
|
|
75
|
+
* author (`promptAuthor` believed `from` for anything but web/agent), and
|
|
76
|
+
* visibility (`cron` suppressed the echo to other tabs and added no header). So
|
|
77
|
+
* a browser could send `origin: "telegram", from: "Alexandre"`, or
|
|
78
|
+
* `origin: "cron"` to speak to the agent unseen. Each internal client now has a
|
|
79
|
+
* credential no frame can carry, and the claim only matters for a client that
|
|
80
|
+
* proved nothing — and even then it may only NARROW to a harmless label.
|
|
81
|
+
* Order is precedence: the system drive also carries the bridge's cookie, so it
|
|
82
|
+
* is checked first.
|
|
83
|
+
*/
|
|
84
|
+
export declare function connectionOrigin(c: ConnectionFacts, claimed: unknown): string;
|
|
45
85
|
/** Is this message a Claude Code command (`/compact`, `/my-skill:my-skill …`)?
|
|
46
86
|
* The TUI reads a command only when `/` is the FIRST thing in the box, so such
|
|
47
87
|
* a message must reach it bare: no header line, no ledger paste ahead of it.
|
package/dist/promptmeta.js
CHANGED
|
@@ -99,12 +99,51 @@ export function parsePromptMeta(text) {
|
|
|
99
99
|
const who = (hasRef ? parts.slice(2, -1) : parts.slice(2)).join(" · ").trim();
|
|
100
100
|
return { platform, who, ...(hasRef ? { ref: last } : {}) };
|
|
101
101
|
}
|
|
102
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Prepend the header as its own first line — ALWAYS.
|
|
104
|
+
*
|
|
105
|
+
* It used to return early when the text already opened with a header ("never
|
|
106
|
+
* double a header"). The text is the HUMAN's, so that rule let anyone type
|
|
107
|
+
* `⟦agent · … · Shadok-Boss · 1a2b3c4d⟧` as their first line and have it reach
|
|
108
|
+
* the agent as the only header there was: a Telegram message or web prompt
|
|
109
|
+
* passing for a sibling agent (with a forged reply address) or for the admin,
|
|
110
|
+
* and replayed under that forged author. The server's header is unconditional;
|
|
111
|
+
* a header-shaped line in the user's text is neutralised by the caller
|
|
112
|
+
* (`markHumanPrompt`, src/prompt-kind.ts), so it can never parse as one.
|
|
113
|
+
*/
|
|
103
114
|
export function markPromptMeta(text, header) {
|
|
104
|
-
if (hasPromptMeta(text))
|
|
105
|
-
return text; // never double a header
|
|
106
115
|
return `${header}\n${text}`;
|
|
107
116
|
}
|
|
117
|
+
/** The labels a bare local client (no proof of anything) may pick for itself:
|
|
118
|
+
* neither gets a privilege — no hiding, no believed `from`. */
|
|
119
|
+
const LOCAL_CLAIMS = new Set(["cli", "boot"]);
|
|
120
|
+
/**
|
|
121
|
+
* WHERE a connection speaks from, derived from what it PROVED at connect.
|
|
122
|
+
*
|
|
123
|
+
* `origin` used to be whatever the `start` frame declared, and it decides three
|
|
124
|
+
* things a client must not choose for itself: the header the agent reads, the
|
|
125
|
+
* author (`promptAuthor` believed `from` for anything but web/agent), and
|
|
126
|
+
* visibility (`cron` suppressed the echo to other tabs and added no header). So
|
|
127
|
+
* a browser could send `origin: "telegram", from: "Alexandre"`, or
|
|
128
|
+
* `origin: "cron"` to speak to the agent unseen. Each internal client now has a
|
|
129
|
+
* credential no frame can carry, and the claim only matters for a client that
|
|
130
|
+
* proved nothing — and even then it may only NARROW to a harmless label.
|
|
131
|
+
* Order is precedence: the system drive also carries the bridge's cookie, so it
|
|
132
|
+
* is checked first.
|
|
133
|
+
*/
|
|
134
|
+
export function connectionOrigin(c, claimed) {
|
|
135
|
+
if (c.systemDrive)
|
|
136
|
+
return "cron";
|
|
137
|
+
if (c.telegramBridge)
|
|
138
|
+
return "telegram";
|
|
139
|
+
if (c.agent)
|
|
140
|
+
return "agent";
|
|
141
|
+
if (c.peer)
|
|
142
|
+
return "peer";
|
|
143
|
+
if (c.browser)
|
|
144
|
+
return "web";
|
|
145
|
+
return typeof claimed === "string" && LOCAL_CLAIMS.has(claimed) ? claimed : "cli";
|
|
146
|
+
}
|
|
108
147
|
/** Is this message a Claude Code command (`/compact`, `/my-skill:my-skill …`)?
|
|
109
148
|
* The TUI reads a command only when `/` is the FIRST thing in the box, so such
|
|
110
149
|
* a message must reach it bare: no header line, no ledger paste ahead of it.
|
package/dist/promptmeta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptmeta.js","sourceRoot":"","sources":["../src/promptmeta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAC7B,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC;AAE9B,6EAA6E;AAC7E,MAAM,UAAU,UAAU,CAAC,EAAQ,EAAE,QAAiB;IACpD,IAAI,CAAC;QACH,6CAA6C;QAC7C,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;YACtC,QAAQ;YACR,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,KAAK;SACd,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzD,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,SAAS,GAAG,eAAe,CAAC;AAElC,+D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C,IAAI,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC;AAED;0BAC0B;AAC1B,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3C,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -58,7 +58,8 @@ import { HOME_SKILLS_BASE, rewriteSkillsBase } from "./skill-paths.js";
|
|
|
58
58
|
import { instanceKey } from "./paths.js";
|
|
59
59
|
import { peerFileFor, loadPeers, savePeers, peerFromToken, signPeerToken, newPeer, withSalts, redeemVerdict, redeemPeer, normPeerName, removePeer, ownedByPeer, peersOutFileFor, agentInvitePrompt, peerScope, } from "./peers.js";
|
|
60
60
|
import { loadCrons, saveCrons, upsertCron, removeCron, resolveCronId, nextRunFor, nextRunAfterFailure, isTransient, CRON_MAX_RETRIES, markCronPrompt, normalizeSchedule, onceAt, stateAfterFire, scheduleLabel, cronTimeZone, defaultTimeZone, systemTimeZone, isValidTimeZone, } from "./crons.js";
|
|
61
|
-
import { isSlashCommand,
|
|
61
|
+
import { isSlashCommand, promptMetaHeader, connectionOrigin } from "./promptmeta.js";
|
|
62
|
+
import { markHumanPrompt } from "./prompt-kind.js";
|
|
62
63
|
import { listCommands } from "./slash-commands.js";
|
|
63
64
|
import { runRefusal, isShellMode } from "./bang.js";
|
|
64
65
|
import { ledgerFileFor, scopeVisible, recordIntoTable, saveLedger, mintLedgerId, ensureLedgerFile, loadLedger, deltaSince, formatLedgerChunks, ledgerSeenFileFor, seenFor, recordSeen, } from "./ledger.js";
|
|
@@ -155,6 +156,23 @@ console.log(`deployment mode: ${DEPLOYMENT_MODE}`);
|
|
|
155
156
|
// it, and — unlike a client-settable field such as `origin` — a browser cannot
|
|
156
157
|
// claim it, which is why the exemption is gated on THIS and nothing else.
|
|
157
158
|
const SYSTEM_DRIVE_SECRET = randomBytes(32).toString("hex");
|
|
159
|
+
// The Telegram bridge's own proof, on the same terms (per-process, in memory,
|
|
160
|
+
// never sent anywhere but our loopback WS as `x-shadok-bridge`). It is what
|
|
161
|
+
// makes a connection's origin "telegram" — and so what lets its `from` (the
|
|
162
|
+
// Telegram sender) and its `voice` flag be believed (`connectionOrigin`). The
|
|
163
|
+
// bridge's cookie cannot serve: `driveChannel` presents the very same one, and
|
|
164
|
+
// with no password there is no cookie at all.
|
|
165
|
+
const TELEGRAM_BRIDGE_SECRET = randomBytes(32).toString("hex");
|
|
166
|
+
/** Does a request present `secret` in header `name`? Constant time, length-guarded. */
|
|
167
|
+
function presentsSecret(req, name, secret) {
|
|
168
|
+
const raw = req.headers[name];
|
|
169
|
+
const header = Array.isArray(raw) ? raw[0] : raw;
|
|
170
|
+
if (typeof header !== "string")
|
|
171
|
+
return false;
|
|
172
|
+
const a = Buffer.from(header);
|
|
173
|
+
const b = Buffer.from(secret);
|
|
174
|
+
return a.length === b.length && timingSafeEqual(a, b);
|
|
175
|
+
}
|
|
158
176
|
// The session cookie is derived DETERMINISTICALLY from the password (HMAC), not
|
|
159
177
|
// a per-login random token kept in memory. That way it survives a server
|
|
160
178
|
// restart — so an auto-update reload stays logged in instead of bouncing the
|
|
@@ -315,7 +333,7 @@ async function startFirstAgent() {
|
|
|
315
333
|
}
|
|
316
334
|
function restartTelegram() {
|
|
317
335
|
tgBridge.stop();
|
|
318
|
-
tgBridge = startTelegram(boundPort, tgCookie(), DEPLOYMENT_MODE === "multi-tenant", { mediaDirFor: mediaDirForSession, readAgentFile: readSessionFile });
|
|
336
|
+
tgBridge = startTelegram(boundPort, tgCookie(), DEPLOYMENT_MODE === "multi-tenant", { mediaDirFor: mediaDirForSession, readAgentFile: readSessionFile, bridgeSecret: TELEGRAM_BRIDGE_SECRET });
|
|
319
337
|
}
|
|
320
338
|
// ── Cron scheduler ───────────────────────────────────────────────────────────
|
|
321
339
|
// Scheduled per-channel prompts (monitoring/reporting). The server drives the
|
|
@@ -7181,13 +7199,20 @@ wss.on("connection", (ws, req) => {
|
|
|
7181
7199
|
const b = Buffer.from(SYSTEM_DRIVE_SECRET);
|
|
7182
7200
|
return a.length === b.length && timingSafeEqual(a, b);
|
|
7183
7201
|
})();
|
|
7202
|
+
// The Telegram bridge, proved the same way (its own secret, same compare).
|
|
7203
|
+
const isTelegramBridge = presentsSecret(req, "x-shadok-bridge", TELEGRAM_BRIDGE_SECRET);
|
|
7184
7204
|
// Who a respawn asked from this socket is credited to in the secret audit
|
|
7185
7205
|
// log. A function, not a value: `origin` is only known once `start` arrives.
|
|
7186
7206
|
const wsBy = () => spawnActor({ account: me?.name, origin, peer: callerPeer, agent: callerAgent?.name });
|
|
7187
7207
|
let session = null;
|
|
7188
|
-
// Where does this client come from
|
|
7189
|
-
//
|
|
7190
|
-
//
|
|
7208
|
+
// Where does this client come from (web, cron, telegram, agent, peer, cli…)?
|
|
7209
|
+
// It travels with the prompt echo — other clients must be able to SAY who
|
|
7210
|
+
// spoke — and it decides the header the agent reads, whether `from` is
|
|
7211
|
+
// believed, and whether the prompt is hidden. So it is DERIVED from what the
|
|
7212
|
+
// connection proved (`connectionOrigin`), never taken from the `start` frame:
|
|
7213
|
+
// a browser that declared `origin: "cron"` spoke to the agent unseen, and one
|
|
7214
|
+
// that declared `"telegram"` signed its prompt with any name it liked. The
|
|
7215
|
+
// frame's claim only ever narrows a bare local client to "cli"/"boot".
|
|
7191
7216
|
let origin;
|
|
7192
7217
|
const send = (msg) => {
|
|
7193
7218
|
if (ws.readyState === ws.OPEN)
|
|
@@ -7300,8 +7325,13 @@ wss.on("connection", (ws, req) => {
|
|
|
7300
7325
|
return fail("this shadok-ai instance is not signed in to Claude — sign in from the cockpit", "logged-out");
|
|
7301
7326
|
}
|
|
7302
7327
|
}
|
|
7303
|
-
|
|
7304
|
-
|
|
7328
|
+
origin = connectionOrigin({
|
|
7329
|
+
systemDrive: isSystemDrive,
|
|
7330
|
+
telegramBridge: isTelegramBridge,
|
|
7331
|
+
agent: !!callerAgent,
|
|
7332
|
+
peer: !!callerPeer && !callerAgent,
|
|
7333
|
+
browser: fromBrowser,
|
|
7334
|
+
}, msg.origin);
|
|
7305
7335
|
const cwd = msg.cwd?.trim() || process.cwd();
|
|
7306
7336
|
// Deterministic id: enforced with --session-id for a new session,
|
|
7307
7337
|
// known for a resume. NEVER derive it from the most recent file
|
|
@@ -7630,7 +7660,7 @@ wss.on("connection", (ws, req) => {
|
|
|
7630
7660
|
pendingSkills.set(id, ok);
|
|
7631
7661
|
}
|
|
7632
7662
|
}
|
|
7633
|
-
session = await createSession(id, effectiveCwd, args, worktree, profile, model, effort, spawnActor({ account: me?.name, origin
|
|
7663
|
+
session = await createSession(id, effectiveCwd, args, worktree, profile, model, effort, spawnActor({ account: me?.name, origin, peer: callerPeer, parent: parentAtStart, agent: callerAgent?.name }), dropUser, agentGroupId);
|
|
7634
7664
|
// One Live per agent (shared-ledger [5d8d]). We only reach here when
|
|
7635
7665
|
// there was no live session to attach to — but `existing` may be a
|
|
7636
7666
|
// RETIRED Live whose pilot has exited while viewers are still
|
|
@@ -7760,7 +7790,7 @@ wss.on("connection", (ws, req) => {
|
|
|
7760
7790
|
// browser is not: for a web client the SESSION decides, and whatever
|
|
7761
7791
|
// `from` the frame carried is discarded. An agent is not trusted
|
|
7762
7792
|
// either: its name comes from the key that signed the socket.
|
|
7763
|
-
const author = promptAuthor(origin, me?.name, msg.from, callerAgent?.name);
|
|
7793
|
+
const author = promptAuthor(origin, me?.name, msg.from, callerAgent?.name, callerPeer ?? undefined);
|
|
7764
7794
|
// Above the ideal pace, a prompt needs an explicit second click. The
|
|
7765
7795
|
// check lives here because this is the single door every user prompt
|
|
7766
7796
|
// goes through — including the pilotctl thin client.
|
|
@@ -7819,14 +7849,16 @@ wss.on("connection", (ws, req) => {
|
|
|
7819
7849
|
// A slash command goes in bare: anything ahead of the `/` makes the
|
|
7820
7850
|
// TUI read it as prose, and the agent never runs the command.
|
|
7821
7851
|
const command = isSlashCommand(text);
|
|
7822
|
-
if (!command &&
|
|
7852
|
+
if (!command &&
|
|
7853
|
+
(origin === "web" || origin === "telegram" || origin === "cli" || origin === "agent" || origin === "peer")) {
|
|
7823
7854
|
// A transcribed voice note says so IN the platform field rather than
|
|
7824
7855
|
// through a different `origin`: the gate just above matches the origin
|
|
7825
7856
|
// EXACTLY, so an origin of "telegram vocal" would drop the header
|
|
7826
7857
|
// entirely — losing the time and the sender to gain one word.
|
|
7827
7858
|
// `parsePromptMeta` reads the platform as the first field and the
|
|
7828
7859
|
// sender as everything past the time, so this widens neither.
|
|
7829
|
-
|
|
7860
|
+
// Only the bridge transcribes voice notes, so only it may say so.
|
|
7861
|
+
const platform = msg.voice === true && origin === "telegram" ? `${origin} vocal` : origin;
|
|
7830
7862
|
// An agent header ends with the sender's REPLY ADDRESS — its short
|
|
7831
7863
|
// session id — because a name is not an address: nothing makes tab
|
|
7832
7864
|
// names unique and every tool takes an id, so naming the sender was
|
|
@@ -7835,7 +7867,10 @@ wss.on("connection", (ws, req) => {
|
|
|
7835
7867
|
// rather than guessing). It is stripped back out by
|
|
7836
7868
|
// `parsePromptMeta`, so it never reaches the chat.
|
|
7837
7869
|
const ref = origin === "agent" ? callerAgent?.id.slice(0, 8) : undefined;
|
|
7838
|
-
|
|
7870
|
+
// ALWAYS the server's header, and the person's text neutralised
|
|
7871
|
+
// beneath it: a header-, ledger- or mark-shaped line they typed
|
|
7872
|
+
// stays text and can never pass for one the server wrote.
|
|
7873
|
+
submitText = markHumanPrompt(text, promptMetaHeader(platform, new Date(), author, defaultTimeZone(), ref));
|
|
7839
7874
|
}
|
|
7840
7875
|
// Push the ledger DELTA ahead of the message: rows changed since this
|
|
7841
7876
|
// agent last saw the ledger, so it learns what siblings resolved /
|
|
@@ -8623,7 +8658,7 @@ server.listen(port, HOST, () => {
|
|
|
8623
8658
|
// the internal auth cookie so it gets through the GUI password gate. The
|
|
8624
8659
|
// handle + bound port let /telegram restart it hot when the config changes.
|
|
8625
8660
|
boundPort = port;
|
|
8626
|
-
tgBridge = startTelegram(port, tgCookie(), DEPLOYMENT_MODE === "multi-tenant", { mediaDirFor: mediaDirForSession, readAgentFile: readSessionFile });
|
|
8661
|
+
tgBridge = startTelegram(port, tgCookie(), DEPLOYMENT_MODE === "multi-tenant", { mediaDirFor: mediaDirForSession, readAgentFile: readSessionFile, bridgeSecret: TELEGRAM_BRIDGE_SECRET });
|
|
8627
8662
|
if (GUI_PASSWORD)
|
|
8628
8663
|
console.log("gui: password protection ON");
|
|
8629
8664
|
// Cron scheduler: prime nextRun then tick every 30s (unref'd so it never
|