@volter/teams 0.2.45 → 0.2.47

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 CHANGED
@@ -24,3 +24,10 @@ Public Node clients are `@volter/teams/http-client` (`TeamsClient`),
24
24
  `@volter/teams/event-client` (selected-context event client), and
25
25
  `@volter/teams/machine-door` (an admitted local/remote machine channel).
26
26
  Context credentials remain inside the custody adapter; consumers use its public client.
27
+
28
+ The launch journal's `Launches.find()` and `all()` retain a previously recorded
29
+ agent across older first-input outcomes that omitted it, only within the same
30
+ pane, kind and caller. A new issue or an explicit agent replacement/clear ends
31
+ that continuity. Latest outcome facts remain authoritative. The reader changes
32
+ no file or credential; [manual SDK reading and deployment limits](../../docs/evidence/launch-agent-retention-2026-10-09.md)
33
+ are recorded separately.
@@ -10,13 +10,27 @@ export function patternKill(command) {
10
10
  const text = String(command).replace(/\\\r?\n/g, '').replace(/\\([a-zA-Z-])/g, '$1').replace(/["']/g, '');
11
11
  const head = String.raw`(?:^|[;|&(\n{}]|\s-[a-zA-Z]*c\s+)\s*(?:(?:env|sudo|exec|command|xargs|nohup|do|then|else|!)\s+(?:--?[^\s;|&()]+\s+)*|[A-Za-z_][A-Za-z0-9_]*=[^\s;|&()]+\s+)*(?:[\w./-]+/)?`;
12
12
  return new RegExp(head + String.raw`(?:pkill|killall)(?=$|[\s;|&()])`).test(text) ||
13
- new RegExp(head + String.raw`pgrep\s+[^;|&\n)]*(?:--full\b|-[a-zA-Z]*f[a-zA-Z]*(?=$|\s))`).test(text);
13
+ new RegExp(head + String.raw`pgrep\s+[^;|&\n)]*(?:--full\b|-[a-zA-Z]*f[a-zA-Z]*(?=$|\s))`).test(text) ||
14
+ windowsPatternKill(text);
15
+ }
16
+ // Windows names a process by image, title or command line through its own tools (cmd, PowerShell, Git Bash's
17
+ // `//IM`): each such kill is refused as pkill is. A kill by PID (`taskkill /PID`, `Stop-Process -Id`) stays allowed.
18
+ function windowsPatternKill(text) {
19
+ return /\btaskkill(?:\.exe)?\b[^;|&\n]*\s(?:\/{1,2}|-)(?:im|fi)\b/i.test(text) ||
20
+ /(?:^|[^\w-])(?:Stop-Process|spps)\b[^;|\n]*\s-(?:N[a-z]*|ProcessName)\b/i.test(text) ||
21
+ // PowerShell's `kill` alias; Bash's own `kill -n <signal>` is not a name
22
+ /(?:^|[^\w-])kill\b[^;|\n]*\s-(?:Name|ProcessName)\b/i.test(text) ||
23
+ /\b(?:Get-Process|gps)\b(?![^|;\n]*\s-Id\b)[^|;\n]*\|\s*(?:Stop-Process|spps|kill)\b/i.test(text) ||
24
+ /\bwmic\b[^;|&\n]*\bprocess\b[^;|&\n]*\bwhere\b[^;|&\n]*\b(?:name|commandline|executablepath)\b/i.test(text) ||
25
+ /\bWin32_Process\b[^\n]*\b(?:Name|CommandLine|ExecutablePath)\b[^\n]*\b(?:Terminate|Remove-CimInstance|Remove-WmiObject|Stop-Process)\b/i.test(text);
14
26
  }
15
27
  const quote = value => `'${String(value).replaceAll("'", "'\\''")}'`;
16
28
  export function boardGuardArguments(kind, args, { cwd, enabled, node = process.execPath } = {}) {
17
29
  if (!enabled) return args;
18
30
  const command = `${quote(node)} ${quote(fileURLToPath(import.meta.url))}`;
19
- const hooks = [{ matcher: '^Bash$', hooks: [{ type: 'command', command, timeout: 10 }] }];
31
+ // Claude's exec form spawns the policy with no shell on every platform (Windows included, where its shell form
32
+ // runs Git Bash or PowerShell and the POSIX quoting above would not parse); its PowerShell tool is guarded as Bash is.
33
+ const hooks = [{ matcher: '^(Bash|PowerShell)$', hooks: [{ type: 'command', command: node, args: [fileURLToPath(import.meta.url)], timeout: 10 }] }];
20
34
  if (kind === 'claude-code') {
21
35
  const next = [...args], at = next.findIndex(arg => arg === '--settings' || arg.startsWith('--settings='));
22
36
  if (at < 0) return [...next, '--settings', JSON.stringify({ hooks: { PreToolUse: hooks } })];
@@ -30,6 +44,7 @@ export function boardGuardArguments(kind, args, { cwd, enabled, node = process.e
30
44
  // Native Codex rules cannot split substitutions such as kill $(pgrep -f …).
31
45
  // Its synchronous Bash hook can deny the entire command before execution.
32
46
  // This invocation enables and trusts the board-vetted command policy.
47
+ if (process.platform === 'win32') throw new Error('board process guard is unavailable for codex on Windows; no unguarded session was launched');
33
48
  const handler = `{ matcher = "^Bash$", hooks = [{ type = "command", command = ${JSON.stringify(command)}, timeout = 10 }] }`;
34
49
  // Codex's own flags go before any subcommand (`app-server`, `resume`) or prompt: after `app-server`, Codex
35
50
  // 0.159 refuses --dangerously-bypass-hook-trust and the worker never starts.
package/home.mjs CHANGED
@@ -191,25 +191,42 @@ export class AccountLog {
191
191
  }
192
192
  }
193
193
 
194
- /** launches.jsonl: appended before a launch is issued; the last record per key wins. */
194
+ /** Older first-input receipts omitted the launch's agent. Recover only that
195
+ * recorded identity, across the same pane/kind/caller, never across a new issue
196
+ * or an explicit replacement/clear. All other facts remain the latest record's. */
197
+ function launchWithRecordedAgent(previous, entry) {
198
+ if (previous?.agent && !Object.hasOwn(entry, 'agent') && Object.hasOwn(entry, 'inputDelivered')
199
+ && entry.status !== 'issued' && entry.pane && entry.pane === previous.pane
200
+ && entry.kind === previous.kind && entry.by === previous.by) {
201
+ return { ...entry, agent: previous.agent };
202
+ }
203
+ return entry;
204
+ }
205
+
206
+ /** launches.jsonl: appended before a launch is issued; latest facts per key,
207
+ * with the recorded agent retained across old first-input receipts. */
195
208
  export class Launches {
196
209
  constructor(path) { this.path = path; }
197
210
  record(entry) { appendFileSync(this.path, JSON.stringify({ t: Date.now(), ...entry }) + '\n', { mode: 0o600 }); }
198
211
  find(key) {
199
212
  if (!existsSync(this.path)) return null;
200
213
  const lines = readFileSync(this.path, 'utf8').trimEnd().split('\n').filter(Boolean);
201
- for (let i = lines.length - 1; i >= 0; i -= 1) {
202
- const entry = JSON.parse(lines[i]);
203
- if (entry.key === key) return entry;
214
+ let found = null;
215
+ for (const line of lines) {
216
+ const entry = JSON.parse(line);
217
+ if (entry.key === key) found = launchWithRecordedAgent(found, entry);
204
218
  }
205
- return null;
219
+ return found;
206
220
  }
207
221
  /** Every key's last record, newest first: what this node has launched for its callers. */
208
222
  all() {
209
223
  if (!existsSync(this.path)) return [];
210
224
  const lines = readFileSync(this.path, 'utf8').trimEnd().split('\n').filter(Boolean);
211
225
  const last = new Map();
212
- for (const line of lines) { const entry = JSON.parse(line); last.set(entry.key, entry); }
226
+ for (const line of lines) {
227
+ const entry = JSON.parse(line);
228
+ last.set(entry.key, launchWithRecordedAgent(last.get(entry.key), entry));
229
+ }
213
230
  return [...last.values()].sort((a, b) => b.t - a.t);
214
231
  }
215
232
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/teams",
3
- "version": "0.2.45",
3
+ "version": "0.2.47",
4
4
  "type": "module",
5
5
  "description": "Volter Teams, the neutral team plane: machine identity and daemon core, the local door and server link, admission from machine grants, product doors, and the Teams server's neutral routes (company RFC 0008).",
6
6
  "license": "MIT",