aegisone 1.0.6 → 1.0.9

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.
Files changed (222) hide show
  1. package/README.md +2 -2
  2. package/bin/aegis.js +5 -0
  3. package/install.ps1 +5 -0
  4. package/install.sh +5 -0
  5. package/package.json +1 -1
  6. package/scripts/bump.mjs +5 -0
  7. package/scripts/bundle.js +5 -0
  8. package/scripts/predist.mjs +9 -0
  9. package/src/child.js +5 -0
  10. package/src/dispatch.js +5 -0
  11. package/src/doctor.js +5 -0
  12. package/src/host.js +5 -0
  13. package/src/permissions.js +5 -0
  14. package/src/probes.js +5 -0
  15. package/src/release.js +19 -5
  16. package/vendor/cli/README.md +39 -1
  17. package/vendor/cli/bin/aegiscode.js +137 -0
  18. package/vendor/cli/package.json +1 -1
  19. package/vendor/cli/scripts/check.mjs +5 -0
  20. package/vendor/cli/scripts/demo.mjs +5 -0
  21. package/vendor/cli/scripts/predist.mjs +29 -2
  22. package/vendor/cli/scripts/runtests.mjs +5 -0
  23. package/vendor/cli/scripts/seal-gate.mjs +76 -0
  24. package/vendor/cli/src/agents.js +5 -0
  25. package/vendor/cli/src/app.js +79 -1
  26. package/vendor/cli/src/art.js +5 -0
  27. package/vendor/cli/src/autonomous.js +23 -0
  28. package/vendor/cli/src/caps.js +5 -0
  29. package/vendor/cli/src/chatflow.js +245 -32
  30. package/vendor/cli/src/checkpoint.js +5 -0
  31. package/vendor/cli/src/clipboard.js +5 -0
  32. package/vendor/cli/src/cloudsync.js +5 -0
  33. package/vendor/cli/src/commands.js +487 -4
  34. package/vendor/cli/src/config.js +5 -0
  35. package/vendor/cli/src/credentials.js +5 -0
  36. package/vendor/cli/src/deps.js +5 -0
  37. package/vendor/cli/src/devrun.js +5 -0
  38. package/vendor/cli/src/diff.js +5 -0
  39. package/vendor/cli/src/diffview.js +5 -0
  40. package/vendor/cli/src/engine.js +9 -2
  41. package/vendor/cli/src/entitlement.js +5 -0
  42. package/vendor/cli/src/events.js +15 -0
  43. package/vendor/cli/src/export.js +5 -0
  44. package/vendor/cli/src/fingerprint.js +5 -0
  45. package/vendor/cli/src/format.js +5 -0
  46. package/vendor/cli/src/fuzzy.js +5 -0
  47. package/vendor/cli/src/gate.js +12 -0
  48. package/vendor/cli/src/history.js +5 -0
  49. package/vendor/cli/src/init.js +5 -0
  50. package/vendor/cli/src/input.js +5 -0
  51. package/vendor/cli/src/keys.js +29 -2
  52. package/vendor/cli/src/limits.js +192 -0
  53. package/vendor/cli/src/markdown.js +5 -0
  54. package/vendor/cli/src/mcp.js +13 -0
  55. package/vendor/cli/src/models.js +5 -0
  56. package/vendor/cli/src/naming.js +5 -0
  57. package/vendor/cli/src/overlays.js +7 -2
  58. package/vendor/cli/src/panels.js +5 -0
  59. package/vendor/cli/src/permissions.js +56 -1
  60. package/vendor/cli/src/ping.js +5 -0
  61. package/vendor/cli/src/presence.js +5 -0
  62. package/vendor/cli/src/provenance.js +238 -0
  63. package/vendor/cli/src/provenance.lock.json +36 -0
  64. package/vendor/cli/src/render.js +5 -0
  65. package/vendor/cli/src/screen.js +5 -0
  66. package/vendor/cli/src/screens.js +166 -62
  67. package/vendor/cli/src/secret.js +5 -0
  68. package/vendor/cli/src/securefs.js +5 -0
  69. package/vendor/cli/src/settings.js +5 -0
  70. package/vendor/cli/src/shared.js +5 -0
  71. package/vendor/cli/src/sharedpaths.js +5 -0
  72. package/vendor/cli/src/signup.js +5 -0
  73. package/vendor/cli/src/summarize.js +5 -0
  74. package/vendor/cli/src/sysdiag.js +582 -0
  75. package/vendor/cli/src/system.js +5 -0
  76. package/vendor/cli/src/theme.js +5 -0
  77. package/vendor/cli/src/title.js +5 -0
  78. package/vendor/cli/src/todos.js +5 -0
  79. package/vendor/cli/src/tokens.js +5 -0
  80. package/vendor/cli/src/topup.js +5 -0
  81. package/vendor/cli/src/update.js +5 -0
  82. package/vendor/cli/vendor/client/aegis.js +27 -0
  83. package/vendor/cli/vendor/client/attest.js +5 -0
  84. package/vendor/cli/vendor/client/authorship-key.js +5 -0
  85. package/vendor/cli/vendor/client/auto-provision.js +5 -0
  86. package/vendor/cli/vendor/client/brain-catalog.js +5 -0
  87. package/vendor/cli/vendor/client/byok-catalog.js +48 -8
  88. package/vendor/cli/vendor/client/credentials.js +5 -0
  89. package/vendor/cli/vendor/client/device-fingerprint.js +5 -0
  90. package/vendor/cli/vendor/client/env-file.js +5 -0
  91. package/vendor/cli/vendor/client/fingerprint.js +5 -0
  92. package/vendor/cli/vendor/client/foreign-memory.js +5 -0
  93. package/vendor/cli/vendor/client/hooks.js +5 -0
  94. package/vendor/cli/vendor/client/model-discovery.js +332 -0
  95. package/vendor/cli/vendor/client/platform.js +5 -0
  96. package/vendor/cli/vendor/client/prefs.js +5 -0
  97. package/vendor/cli/vendor/client/presence-constants.js +5 -0
  98. package/vendor/cli/vendor/client/presence.js +5 -0
  99. package/vendor/cli/vendor/client/record-vault.js +5 -0
  100. package/vendor/cli/vendor/client/session-store.js +5 -0
  101. package/vendor/cli/vendor/client/topup.js +5 -0
  102. package/vendor/cli/vendor/client/touch.js +5 -0
  103. package/vendor/cli/vendor/client/update.js +5 -0
  104. package/vendor/cli/vendor/client/user-models.js +383 -0
  105. package/vendor/cli/vendor/desktop/lib/local/aegis-seal.mjs +5 -0
  106. package/vendor/cli/vendor/desktop/lib/local/agents.js +5 -0
  107. package/vendor/cli/vendor/desktop/lib/local/autonomous.js +86 -0
  108. package/vendor/cli/vendor/desktop/lib/local/context.js +5 -0
  109. package/vendor/cli/vendor/desktop/lib/local/covenant.js +5 -0
  110. package/vendor/cli/vendor/desktop/lib/local/engine.js +576 -14
  111. package/vendor/cli/vendor/desktop/lib/local/entitlement.js +5 -0
  112. package/vendor/cli/vendor/desktop/lib/local/git-scope.js +5 -0
  113. package/vendor/cli/vendor/desktop/lib/local/local.js +5 -0
  114. package/vendor/cli/vendor/desktop/lib/local/prompt.js +5 -0
  115. package/vendor/cli/vendor/desktop/lib/local/queue.js +5 -0
  116. package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +5 -0
  117. package/vendor/cli/vendor/desktop/lib/local/shell.js +88 -9
  118. package/vendor/cli/vendor/desktop/lib/local/tools.js +13 -6
  119. package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +5 -0
  120. package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +5 -0
  121. package/vendor/cli/vendor/desktop/lib/settings.js +5 -0
  122. package/vendor/cli/vendor/desktop/renderer/usage.js +73 -1
  123. package/vendor/cli/vendor/mcp/server.js +5 -0
  124. package/vendor/cli/vendor/mcp/tools.js +5 -0
  125. package/vendor/cli/vendor/tools/agent-gate.mjs +23 -0
  126. package/vendor/desktop/README.md +11 -0
  127. package/vendor/desktop/bin/aegis.js +5 -0
  128. package/vendor/desktop/lib/auto.js +5 -0
  129. package/vendor/desktop/lib/avatar/companion.js +5 -0
  130. package/vendor/desktop/lib/avatar/cosmetics.js +5 -0
  131. package/vendor/desktop/lib/avatar/events.js +5 -0
  132. package/vendor/desktop/lib/avatar/holder-turn.js +5 -0
  133. package/vendor/desktop/lib/avatar/holders.js +5 -0
  134. package/vendor/desktop/lib/avatar/identity.js +5 -0
  135. package/vendor/desktop/lib/avatar/level.js +5 -0
  136. package/vendor/desktop/lib/avatar/mirror.js +5 -0
  137. package/vendor/desktop/lib/avatar/persona.js +5 -0
  138. package/vendor/desktop/lib/avatar/profile.js +5 -0
  139. package/vendor/desktop/lib/avatar/register.js +5 -0
  140. package/vendor/desktop/lib/avatar/store.js +5 -0
  141. package/vendor/desktop/lib/avatar/tiers.js +5 -0
  142. package/vendor/desktop/lib/avatar/transfer.js +5 -0
  143. package/vendor/desktop/lib/avatar/turn.js +5 -0
  144. package/vendor/desktop/lib/avatar/voice.js +5 -0
  145. package/vendor/desktop/lib/avatar/xp.js +5 -0
  146. package/vendor/desktop/lib/deep-link.js +40 -1
  147. package/vendor/desktop/lib/fingerprint.js +5 -0
  148. package/vendor/desktop/lib/local/aegis-seal.mjs +5 -0
  149. package/vendor/desktop/lib/local/agents.js +5 -0
  150. package/vendor/desktop/lib/local/autonomous.js +86 -0
  151. package/vendor/desktop/lib/local/context.js +5 -0
  152. package/vendor/desktop/lib/local/covenant.js +5 -0
  153. package/vendor/desktop/lib/local/engine.js +576 -14
  154. package/vendor/desktop/lib/local/entitlement.js +5 -0
  155. package/vendor/desktop/lib/local/git-scope.js +5 -0
  156. package/vendor/desktop/lib/local/local.js +5 -0
  157. package/vendor/desktop/lib/local/prompt.js +5 -0
  158. package/vendor/desktop/lib/local/queue.js +5 -0
  159. package/vendor/desktop/lib/local/session-rounds.js +5 -0
  160. package/vendor/desktop/lib/local/shell.js +88 -9
  161. package/vendor/desktop/lib/local/telemetry.js +5 -0
  162. package/vendor/desktop/lib/local/tools.js +13 -6
  163. package/vendor/desktop/lib/local/turn-guard.js +5 -0
  164. package/vendor/desktop/lib/local/worktree-lock.js +5 -0
  165. package/vendor/desktop/lib/provider-key-mirror.js +5 -0
  166. package/vendor/desktop/lib/quick-launcher.js +5 -0
  167. package/vendor/desktop/lib/settings.js +5 -0
  168. package/vendor/desktop/lib/sync/memory-queue.js +5 -0
  169. package/vendor/desktop/lib/sync/persist-gate.js +5 -0
  170. package/vendor/desktop/lib/sync/sessions.js +5 -0
  171. package/vendor/desktop/lib/window-state.js +5 -0
  172. package/vendor/desktop/main.js +293 -6
  173. package/vendor/desktop/package.json +1 -1
  174. package/vendor/desktop/preload.js +32 -0
  175. package/vendor/desktop/renderer/app.js +506 -12
  176. package/vendor/desktop/renderer/avatar/assemble.js +5 -0
  177. package/vendor/desktop/renderer/avatar/avatar.css +7 -0
  178. package/vendor/desktop/renderer/avatar/avatar.js +5 -0
  179. package/vendor/desktop/renderer/avatar/cards.js +5 -0
  180. package/vendor/desktop/renderer/avatar/hud.js +5 -0
  181. package/vendor/desktop/renderer/avatar/machine.js +5 -0
  182. package/vendor/desktop/renderer/avatar/pane.js +5 -0
  183. package/vendor/desktop/renderer/avatar/parts.js +5 -0
  184. package/vendor/desktop/renderer/budget.js +5 -0
  185. package/vendor/desktop/renderer/diff.js +5 -0
  186. package/vendor/desktop/renderer/diffview.js +5 -0
  187. package/vendor/desktop/renderer/fingerprint.css +7 -0
  188. package/vendor/desktop/renderer/fingerprint.js +5 -0
  189. package/vendor/desktop/renderer/fonts/fonts.css +7 -0
  190. package/vendor/desktop/renderer/index.html +9 -2
  191. package/vendor/desktop/renderer/markdown.js +5 -0
  192. package/vendor/desktop/renderer/quick.css +7 -0
  193. package/vendor/desktop/renderer/quick.html +7 -0
  194. package/vendor/desktop/renderer/quick.js +5 -0
  195. package/vendor/desktop/renderer/stream-policy.js +5 -0
  196. package/vendor/desktop/renderer/style.css +39 -0
  197. package/vendor/desktop/renderer/transcript-view.js +5 -0
  198. package/vendor/desktop/renderer/usage.js +73 -1
  199. package/vendor/desktop/vendor/aegis.js +27 -0
  200. package/vendor/desktop/vendor/agent-gate.mjs +23 -0
  201. package/vendor/desktop/vendor/attest.js +5 -0
  202. package/vendor/desktop/vendor/authorship-key.js +5 -0
  203. package/vendor/desktop/vendor/auto-provision.js +5 -0
  204. package/vendor/desktop/vendor/brain-catalog.js +5 -0
  205. package/vendor/desktop/vendor/byok-catalog.js +48 -8
  206. package/vendor/desktop/vendor/credentials.js +5 -0
  207. package/vendor/desktop/vendor/device-fingerprint.js +5 -0
  208. package/vendor/desktop/vendor/env-file.js +5 -0
  209. package/vendor/desktop/vendor/fingerprint.js +5 -0
  210. package/vendor/desktop/vendor/foreign-memory.js +5 -0
  211. package/vendor/desktop/vendor/hooks.js +5 -0
  212. package/vendor/desktop/vendor/model-discovery.js +332 -0
  213. package/vendor/desktop/vendor/platform.js +5 -0
  214. package/vendor/desktop/vendor/prefs.js +5 -0
  215. package/vendor/desktop/vendor/presence-constants.js +5 -0
  216. package/vendor/desktop/vendor/presence.js +5 -0
  217. package/vendor/desktop/vendor/record-vault.js +5 -0
  218. package/vendor/desktop/vendor/session-store.js +5 -0
  219. package/vendor/desktop/vendor/topup.js +5 -0
  220. package/vendor/desktop/vendor/touch.js +5 -0
  221. package/vendor/desktop/vendor/update.js +5 -0
  222. package/vendor/desktop/vendor/user-models.js +383 -0
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -280,10 +285,34 @@ const SHELL_CACHE = new Map();
280
285
  function resolveSessionShell(options = {}) {
281
286
  const o = shellSeams(options);
282
287
  if (o.platform === 'win32') {
283
- const spec = platform.shellSpec({ platform: 'win32', env: o.env });
288
+ const cmdSpec = platform.shellSpec({ platform: 'win32', env: o.env });
284
289
  const powershell =
285
290
  platform.resolveExecutable('powershell', { platform: 'win32', env: o.env, exists: o.exists }) ||
286
291
  'powershell.exe';
292
+ // ONE-SHOT NOW SPEAKS THE SESSION'S DIALECT TOO (2026-02-14 report, item 1).
293
+ //
294
+ // This used to be `oneShot: cmdSpec` — PowerShell for the session, cmd.exe
295
+ // for every one-shot — and that mismatch is what made `exec` silently wrong
296
+ // mid-turn. When the live session died (sentinel timeout, killed child, a
297
+ // rejected stdin write) the degrade paths below run one-shot, so from that
298
+ // moment on every remaining command in the turn was parsed by cmd.exe while
299
+ // the model kept emitting PowerShell quoting. cmd.exe answers
300
+ // `'"Write-Output \"' is not recognized as an internal or external command`
301
+ // — localized, so on sv-SE it reads `Felaktig syntax för filnamn, katalognamn
302
+ // eller volymetikett`, which looks like a filesystem fault and not a shell
303
+ // change — and nothing in the tool result said the shell had switched.
304
+ //
305
+ // `-Command` accepts exactly the quoting the session accepts, so a
306
+ // degradation is now a transport change and not a language change. cmd.exe
307
+ // is no longer reachable from this path at all: if PowerShell cannot be
308
+ // resolved the spawn fails loudly (oneShotShell reports `error: …`) instead
309
+ // of quietly running the command in a shell that cannot read it.
310
+ const oneShot = {
311
+ cmd: powershell,
312
+ arg: '-Command',
313
+ kind: 'powershell',
314
+ source: 'powershell.exe',
315
+ };
287
316
  return {
288
317
  ok: true,
289
318
  cmd: powershell,
@@ -294,11 +323,16 @@ function resolveSessionShell(options = {}) {
294
323
  unsupported: null,
295
324
  caveat: null,
296
325
  error: null,
297
- // One-shot commands on Windows stay cmd.exe: that is what the pre-session
298
- // `exec` always used, and PowerShell is only the session's dialect.
299
- oneShot: spec,
326
+ oneShot,
300
327
  executed: [],
301
- tried: [{ candidate: powershell, ok: true, reason: 'the Windows default (PowerShell session, cmd.exe one-shot)' }],
328
+ tried: [
329
+ { candidate: powershell, ok: true, reason: 'the Windows default (PowerShell session AND one-shot)' },
330
+ {
331
+ candidate: cmdSpec.cmd,
332
+ ok: false,
333
+ reason: 'cmd.exe is never used for one-shot: it cannot parse the PowerShell quoting the session teaches',
334
+ },
335
+ ],
302
336
  };
303
337
  }
304
338
 
@@ -363,8 +397,11 @@ function oneShotShellSpec(options = {}) {
363
397
  return { ok: false, cmd: null, arg: null, kind: null, error: spec.error, spec };
364
398
  }
365
399
  if (spec.kind === 'powershell') {
366
- const cmdSpec = platform.shellSpec({ platform: 'win32', env: shellSeams(options).env });
367
- return { ok: true, cmd: cmdSpec.cmd, arg: cmdSpec.arg, kind: 'cmd', error: null, spec };
400
+ // The session's own one-shot spec (PowerShell `-Command`), so the `exec`
401
+ // tool's no-session path and this module's fallback cannot disagree about
402
+ // the dialect — which is exactly how cmd.exe used to sneak back in.
403
+ const shot = spec.oneShot || platform.shellSpec({ platform: 'win32', env: shellSeams(options).env });
404
+ return { ok: true, cmd: shot.cmd, arg: shot.arg, kind: shot.kind || 'powershell', error: null, spec };
368
405
  }
369
406
  return { ok: true, cmd: spec.cmd, arg: spec.arg, kind: 'posix-sh', error: null, spec };
370
407
  }
@@ -412,6 +449,10 @@ class ShellSession {
412
449
  this.buf = '';
413
450
  this.alive = false;
414
451
  this._pending = null; // resolver-scan for the in-flight command
452
+ this.cwd = cwd || process.cwd();
453
+ this.disposed = false; // an explicit dispose() must NOT be self-healed
454
+ this._respawns = 0; // one self-heal attempt per session, never a loop
455
+ this._degradedNoted = false; // the degrade marker is emitted once per session
415
456
  this.shellOptions = shellOptions || {};
416
457
  // Resolved BEFORE anything is spawned or written: `shell.kind` is what the
417
458
  // command framing below branches on, so an unverified `$SHELL` can never
@@ -485,7 +526,21 @@ class ShellSession {
485
526
  if (!this.alive && this.shellError) {
486
527
  return Promise.resolve({ content: this.shellError, isError: true });
487
528
  }
488
- return oneShotShell({ command, timeout, working_directory, shellOptions: this.shellOptions });
529
+ // SELF-HEAL BEFORE DEGRADING. The old path latched: once the live session
530
+ // died (a timeout kill, a child exit, a spawn error) every remaining
531
+ // command in the turn ran one-shot, and on Windows that one-shot used to
532
+ // be cmd.exe — so the agent stayed silently wrong for the rest of the
533
+ // turn. Re-probe and re-spawn ONCE instead, and only then fall through.
534
+ if (!this.alive && !this.disposed && this._respawns < 1) {
535
+ this._respawns += 1;
536
+ this.buf = '';
537
+ this.shell = resolveSessionShell(this.shellOptions);
538
+ this.shellError = this.shell.ok ? null : this.shell.error;
539
+ this._start(this.cwd);
540
+ if (this.alive) return this.run(command, { timeout, working_directory });
541
+ }
542
+ return oneShotShell({ command, timeout, working_directory, shellOptions: this.shellOptions })
543
+ .then((result) => this._noteDegraded(result, !this.alive ? 'the persistent session is not running' : 'no usable session dialect'));
489
544
  }
490
545
  let cmd = String(command || '');
491
546
 
@@ -557,7 +612,8 @@ class ShellSession {
557
612
  this.child.stdin.write(script);
558
613
  } catch {
559
614
  this.alive = false;
560
- oneShotShell({ command, timeout, working_directory, shellOptions: this.shellOptions }).then(finish);
615
+ oneShotShell({ command, timeout, working_directory, shellOptions: this.shellOptions })
616
+ .then((r) => finish(this._noteDegraded(r, 'the session stdin rejected the command')));
561
617
  return;
562
618
  }
563
619
  // Data may already be buffered (fast commands) — scan once now.
@@ -565,7 +621,30 @@ class ShellSession {
565
621
  });
566
622
  }
567
623
 
624
+ /**
625
+ * Mark a result that came from the one-shot fallback rather than the live
626
+ * session, so the model is TOLD the shell changed and can stop trusting its
627
+ * quoting contract.
628
+ *
629
+ * The 2026-02-14 report's worst finding was precisely that this happened
630
+ * silently: "nothing in the result tells the agent the shell changed" while
631
+ * the agent "degrades to a one-shot cmd.exe — and stays there for the
632
+ * remainder of the turn", so it kept emitting PowerShell quoting, got
633
+ * localized cmd.exe syntax errors, and finally blamed the user's machine.
634
+ * Emitted ONCE per session so a degraded turn stays readable.
635
+ */
636
+ _noteDegraded(result, reason) {
637
+ const r = result && typeof result === 'object' ? result : { content: String(result == null ? '' : result), isError: true };
638
+ if (this._degradedNoted) return r;
639
+ this._degradedNoted = true;
640
+ const via = this.shell && this.shell.cmd ? this.shell.cmd : 'unknown shell';
641
+ const was = this.shell && this.shell.kind ? this.shell.kind : 'none';
642
+ const marker = `[shell_degraded] ran one-shot via ${via} (${reason}); session dialect was ${was} — quoting contracts may differ`;
643
+ return { ...r, content: `${marker}\n${r.content || ''}` };
644
+ }
645
+
568
646
  dispose() {
647
+ this.disposed = true;
569
648
  this.alive = false;
570
649
  if (this.child) {
571
650
  try { this.child.stdin.end(); } catch { /* already gone */ }
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -816,12 +821,14 @@ function execOneShot({ command, cwd, timeout, maxBuffer } = {}) {
816
821
  return new Promise((resolve) => {
817
822
  const limit = Math.min(Number(maxBuffer) || EXEC_MAX_BUFFER, EXEC_MAX_BUFFER);
818
823
  const ms = Math.min(Number(timeout) || EXEC_TIMEOUT_DEFAULT, EXEC_TIMEOUT_CAP);
819
- // Shell to run `exec` in: cmd.exe on Windows, a PROBED POSIX sh/bash
820
- // elsewhere. The choice, the platform seam that makes its win32 half
821
- // testable on Linux and the fish/csh/nu refusal all live in
822
- // client/platform.js + shell.js (Phase 30.1/30.3) — there is no second copy
823
- // of that decision here, and an unverifiable shell is REPORTED rather than
824
- // used.
824
+ // Shell to run `exec` in: PowerShell on Windows (both the persistent
825
+ // session AND the one-shot path — they must agree, or a session that dies
826
+ // mid-turn silently switches the quoting contract; see shell.js
827
+ // resolveSessionShell), a PROBED POSIX sh/bash elsewhere. The choice, the
828
+ // platform seam that makes its win32 half testable on Linux and the
829
+ // fish/csh/nu refusal all live in client/platform.js + shell.js (Phase
830
+ // 30.1/30.3) — there is no second copy of that decision here, and an
831
+ // unverifiable shell is REPORTED rather than used.
825
832
  const spec = shells.oneShotShellSpec();
826
833
  if (!spec.ok) {
827
834
  resolve(fail(spec.error));
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
1
6
  'use strict';
2
7
 
3
8
  /**