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.
- package/README.md +2 -2
- package/bin/aegis.js +5 -0
- package/install.ps1 +5 -0
- package/install.sh +5 -0
- package/package.json +1 -1
- package/scripts/bump.mjs +5 -0
- package/scripts/bundle.js +5 -0
- package/scripts/predist.mjs +9 -0
- package/src/child.js +5 -0
- package/src/dispatch.js +5 -0
- package/src/doctor.js +5 -0
- package/src/host.js +5 -0
- package/src/permissions.js +5 -0
- package/src/probes.js +5 -0
- package/src/release.js +19 -5
- package/vendor/cli/README.md +39 -1
- package/vendor/cli/bin/aegiscode.js +137 -0
- package/vendor/cli/package.json +1 -1
- package/vendor/cli/scripts/check.mjs +5 -0
- package/vendor/cli/scripts/demo.mjs +5 -0
- package/vendor/cli/scripts/predist.mjs +29 -2
- package/vendor/cli/scripts/runtests.mjs +5 -0
- package/vendor/cli/scripts/seal-gate.mjs +76 -0
- package/vendor/cli/src/agents.js +5 -0
- package/vendor/cli/src/app.js +79 -1
- package/vendor/cli/src/art.js +5 -0
- package/vendor/cli/src/autonomous.js +23 -0
- package/vendor/cli/src/caps.js +5 -0
- package/vendor/cli/src/chatflow.js +245 -32
- package/vendor/cli/src/checkpoint.js +5 -0
- package/vendor/cli/src/clipboard.js +5 -0
- package/vendor/cli/src/cloudsync.js +5 -0
- package/vendor/cli/src/commands.js +487 -4
- package/vendor/cli/src/config.js +5 -0
- package/vendor/cli/src/credentials.js +5 -0
- package/vendor/cli/src/deps.js +5 -0
- package/vendor/cli/src/devrun.js +5 -0
- package/vendor/cli/src/diff.js +5 -0
- package/vendor/cli/src/diffview.js +5 -0
- package/vendor/cli/src/engine.js +9 -2
- package/vendor/cli/src/entitlement.js +5 -0
- package/vendor/cli/src/events.js +15 -0
- package/vendor/cli/src/export.js +5 -0
- package/vendor/cli/src/fingerprint.js +5 -0
- package/vendor/cli/src/format.js +5 -0
- package/vendor/cli/src/fuzzy.js +5 -0
- package/vendor/cli/src/gate.js +12 -0
- package/vendor/cli/src/history.js +5 -0
- package/vendor/cli/src/init.js +5 -0
- package/vendor/cli/src/input.js +5 -0
- package/vendor/cli/src/keys.js +29 -2
- package/vendor/cli/src/limits.js +192 -0
- package/vendor/cli/src/markdown.js +5 -0
- package/vendor/cli/src/mcp.js +13 -0
- package/vendor/cli/src/models.js +5 -0
- package/vendor/cli/src/naming.js +5 -0
- package/vendor/cli/src/overlays.js +7 -2
- package/vendor/cli/src/panels.js +5 -0
- package/vendor/cli/src/permissions.js +56 -1
- package/vendor/cli/src/ping.js +5 -0
- package/vendor/cli/src/presence.js +5 -0
- package/vendor/cli/src/provenance.js +238 -0
- package/vendor/cli/src/provenance.lock.json +36 -0
- package/vendor/cli/src/render.js +5 -0
- package/vendor/cli/src/screen.js +5 -0
- package/vendor/cli/src/screens.js +166 -62
- package/vendor/cli/src/secret.js +5 -0
- package/vendor/cli/src/securefs.js +5 -0
- package/vendor/cli/src/settings.js +5 -0
- package/vendor/cli/src/shared.js +5 -0
- package/vendor/cli/src/sharedpaths.js +5 -0
- package/vendor/cli/src/signup.js +5 -0
- package/vendor/cli/src/summarize.js +5 -0
- package/vendor/cli/src/sysdiag.js +582 -0
- package/vendor/cli/src/system.js +5 -0
- package/vendor/cli/src/theme.js +5 -0
- package/vendor/cli/src/title.js +5 -0
- package/vendor/cli/src/todos.js +5 -0
- package/vendor/cli/src/tokens.js +5 -0
- package/vendor/cli/src/topup.js +5 -0
- package/vendor/cli/src/update.js +5 -0
- package/vendor/cli/vendor/client/aegis.js +27 -0
- package/vendor/cli/vendor/client/attest.js +5 -0
- package/vendor/cli/vendor/client/authorship-key.js +5 -0
- package/vendor/cli/vendor/client/auto-provision.js +5 -0
- package/vendor/cli/vendor/client/brain-catalog.js +5 -0
- package/vendor/cli/vendor/client/byok-catalog.js +48 -8
- package/vendor/cli/vendor/client/credentials.js +5 -0
- package/vendor/cli/vendor/client/device-fingerprint.js +5 -0
- package/vendor/cli/vendor/client/env-file.js +5 -0
- package/vendor/cli/vendor/client/fingerprint.js +5 -0
- package/vendor/cli/vendor/client/foreign-memory.js +5 -0
- package/vendor/cli/vendor/client/hooks.js +5 -0
- package/vendor/cli/vendor/client/model-discovery.js +332 -0
- package/vendor/cli/vendor/client/platform.js +5 -0
- package/vendor/cli/vendor/client/prefs.js +5 -0
- package/vendor/cli/vendor/client/presence-constants.js +5 -0
- package/vendor/cli/vendor/client/presence.js +5 -0
- package/vendor/cli/vendor/client/record-vault.js +5 -0
- package/vendor/cli/vendor/client/session-store.js +5 -0
- package/vendor/cli/vendor/client/topup.js +5 -0
- package/vendor/cli/vendor/client/touch.js +5 -0
- package/vendor/cli/vendor/client/update.js +5 -0
- package/vendor/cli/vendor/client/user-models.js +383 -0
- package/vendor/cli/vendor/desktop/lib/local/aegis-seal.mjs +5 -0
- package/vendor/cli/vendor/desktop/lib/local/agents.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/autonomous.js +86 -0
- package/vendor/cli/vendor/desktop/lib/local/context.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/covenant.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/engine.js +576 -14
- package/vendor/cli/vendor/desktop/lib/local/entitlement.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/git-scope.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/local.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/prompt.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/queue.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/shell.js +88 -9
- package/vendor/cli/vendor/desktop/lib/local/tools.js +13 -6
- package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +5 -0
- package/vendor/cli/vendor/desktop/lib/settings.js +5 -0
- package/vendor/cli/vendor/desktop/renderer/usage.js +73 -1
- package/vendor/cli/vendor/mcp/server.js +5 -0
- package/vendor/cli/vendor/mcp/tools.js +5 -0
- package/vendor/cli/vendor/tools/agent-gate.mjs +23 -0
- package/vendor/desktop/README.md +11 -0
- package/vendor/desktop/bin/aegis.js +5 -0
- package/vendor/desktop/lib/auto.js +5 -0
- package/vendor/desktop/lib/avatar/companion.js +5 -0
- package/vendor/desktop/lib/avatar/cosmetics.js +5 -0
- package/vendor/desktop/lib/avatar/events.js +5 -0
- package/vendor/desktop/lib/avatar/holder-turn.js +5 -0
- package/vendor/desktop/lib/avatar/holders.js +5 -0
- package/vendor/desktop/lib/avatar/identity.js +5 -0
- package/vendor/desktop/lib/avatar/level.js +5 -0
- package/vendor/desktop/lib/avatar/mirror.js +5 -0
- package/vendor/desktop/lib/avatar/persona.js +5 -0
- package/vendor/desktop/lib/avatar/profile.js +5 -0
- package/vendor/desktop/lib/avatar/register.js +5 -0
- package/vendor/desktop/lib/avatar/store.js +5 -0
- package/vendor/desktop/lib/avatar/tiers.js +5 -0
- package/vendor/desktop/lib/avatar/transfer.js +5 -0
- package/vendor/desktop/lib/avatar/turn.js +5 -0
- package/vendor/desktop/lib/avatar/voice.js +5 -0
- package/vendor/desktop/lib/avatar/xp.js +5 -0
- package/vendor/desktop/lib/deep-link.js +40 -1
- package/vendor/desktop/lib/fingerprint.js +5 -0
- package/vendor/desktop/lib/local/aegis-seal.mjs +5 -0
- package/vendor/desktop/lib/local/agents.js +5 -0
- package/vendor/desktop/lib/local/autonomous.js +86 -0
- package/vendor/desktop/lib/local/context.js +5 -0
- package/vendor/desktop/lib/local/covenant.js +5 -0
- package/vendor/desktop/lib/local/engine.js +576 -14
- package/vendor/desktop/lib/local/entitlement.js +5 -0
- package/vendor/desktop/lib/local/git-scope.js +5 -0
- package/vendor/desktop/lib/local/local.js +5 -0
- package/vendor/desktop/lib/local/prompt.js +5 -0
- package/vendor/desktop/lib/local/queue.js +5 -0
- package/vendor/desktop/lib/local/session-rounds.js +5 -0
- package/vendor/desktop/lib/local/shell.js +88 -9
- package/vendor/desktop/lib/local/telemetry.js +5 -0
- package/vendor/desktop/lib/local/tools.js +13 -6
- package/vendor/desktop/lib/local/turn-guard.js +5 -0
- package/vendor/desktop/lib/local/worktree-lock.js +5 -0
- package/vendor/desktop/lib/provider-key-mirror.js +5 -0
- package/vendor/desktop/lib/quick-launcher.js +5 -0
- package/vendor/desktop/lib/settings.js +5 -0
- package/vendor/desktop/lib/sync/memory-queue.js +5 -0
- package/vendor/desktop/lib/sync/persist-gate.js +5 -0
- package/vendor/desktop/lib/sync/sessions.js +5 -0
- package/vendor/desktop/lib/window-state.js +5 -0
- package/vendor/desktop/main.js +293 -6
- package/vendor/desktop/package.json +1 -1
- package/vendor/desktop/preload.js +32 -0
- package/vendor/desktop/renderer/app.js +506 -12
- package/vendor/desktop/renderer/avatar/assemble.js +5 -0
- package/vendor/desktop/renderer/avatar/avatar.css +7 -0
- package/vendor/desktop/renderer/avatar/avatar.js +5 -0
- package/vendor/desktop/renderer/avatar/cards.js +5 -0
- package/vendor/desktop/renderer/avatar/hud.js +5 -0
- package/vendor/desktop/renderer/avatar/machine.js +5 -0
- package/vendor/desktop/renderer/avatar/pane.js +5 -0
- package/vendor/desktop/renderer/avatar/parts.js +5 -0
- package/vendor/desktop/renderer/budget.js +5 -0
- package/vendor/desktop/renderer/diff.js +5 -0
- package/vendor/desktop/renderer/diffview.js +5 -0
- package/vendor/desktop/renderer/fingerprint.css +7 -0
- package/vendor/desktop/renderer/fingerprint.js +5 -0
- package/vendor/desktop/renderer/fonts/fonts.css +7 -0
- package/vendor/desktop/renderer/index.html +9 -2
- package/vendor/desktop/renderer/markdown.js +5 -0
- package/vendor/desktop/renderer/quick.css +7 -0
- package/vendor/desktop/renderer/quick.html +7 -0
- package/vendor/desktop/renderer/quick.js +5 -0
- package/vendor/desktop/renderer/stream-policy.js +5 -0
- package/vendor/desktop/renderer/style.css +39 -0
- package/vendor/desktop/renderer/transcript-view.js +5 -0
- package/vendor/desktop/renderer/usage.js +73 -1
- package/vendor/desktop/vendor/aegis.js +27 -0
- package/vendor/desktop/vendor/agent-gate.mjs +23 -0
- package/vendor/desktop/vendor/attest.js +5 -0
- package/vendor/desktop/vendor/authorship-key.js +5 -0
- package/vendor/desktop/vendor/auto-provision.js +5 -0
- package/vendor/desktop/vendor/brain-catalog.js +5 -0
- package/vendor/desktop/vendor/byok-catalog.js +48 -8
- package/vendor/desktop/vendor/credentials.js +5 -0
- package/vendor/desktop/vendor/device-fingerprint.js +5 -0
- package/vendor/desktop/vendor/env-file.js +5 -0
- package/vendor/desktop/vendor/fingerprint.js +5 -0
- package/vendor/desktop/vendor/foreign-memory.js +5 -0
- package/vendor/desktop/vendor/hooks.js +5 -0
- package/vendor/desktop/vendor/model-discovery.js +332 -0
- package/vendor/desktop/vendor/platform.js +5 -0
- package/vendor/desktop/vendor/prefs.js +5 -0
- package/vendor/desktop/vendor/presence-constants.js +5 -0
- package/vendor/desktop/vendor/presence.js +5 -0
- package/vendor/desktop/vendor/record-vault.js +5 -0
- package/vendor/desktop/vendor/session-store.js +5 -0
- package/vendor/desktop/vendor/topup.js +5 -0
- package/vendor/desktop/vendor/touch.js +5 -0
- package/vendor/desktop/vendor/update.js +5 -0
- 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
|
|
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
|
-
|
|
298
|
-
// `exec` always used, and PowerShell is only the session's dialect.
|
|
299
|
-
oneShot: spec,
|
|
326
|
+
oneShot,
|
|
300
327
|
executed: [],
|
|
301
|
-
tried: [
|
|
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
|
-
|
|
367
|
-
|
|
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
|
-
|
|
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 })
|
|
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:
|
|
820
|
-
//
|
|
821
|
-
//
|
|
822
|
-
//
|
|
823
|
-
//
|
|
824
|
-
//
|
|
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
|
/**
|