aegiscode 6.8.25 → 6.8.28
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/package.json +1 -1
- package/src/app.js +32 -1
- package/src/chatflow.js +135 -8
- package/src/clipboard.js +349 -66
- package/src/events.js +50 -0
- package/src/history.js +85 -3
- package/src/keys.js +12 -0
- package/src/naming.js +226 -0
- package/vendor/client/platform.js +130 -0
- package/vendor/client/session-store.js +32 -1
- package/vendor/desktop/lib/local/engine.js +78 -3
- package/vendor/desktop/lib/local/prompt.js +86 -2
- package/vendor/desktop/lib/local/tools.js +4 -1
|
@@ -95,6 +95,30 @@ try {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* The module that decides where this install's data directory IS
|
|
100
|
+
* (`$AEGISCODE_HOME`, else `~/.aegiscode`) — the same two-layout resolution as
|
|
101
|
+
* `platformLib` above, and for the same reason: the environment block must
|
|
102
|
+
* state the path this machine actually writes, not a path this file guessed.
|
|
103
|
+
*
|
|
104
|
+
* Reported live (DeepSeek, Windows, 2026-10-04): asked to check the AEGIS data
|
|
105
|
+
* directory, the model produced `C:\Users\Dator.aegiscode` — the home directory
|
|
106
|
+
* with the separator EATEN — and then ran
|
|
107
|
+
* `Get-ChildItem -Filter aegis -Recurse -Depth 2` over the whole profile when
|
|
108
|
+
* that path came back empty. Nothing in the prompt had ever named the real
|
|
109
|
+
* directory, so building it from the home directory was the only move it had.
|
|
110
|
+
*/
|
|
111
|
+
let credentialsLib = null;
|
|
112
|
+
try {
|
|
113
|
+
credentialsLib = require('../../../client/credentials.js');
|
|
114
|
+
} catch {
|
|
115
|
+
try {
|
|
116
|
+
credentialsLib = require('../../vendor/credentials.js');
|
|
117
|
+
} catch {
|
|
118
|
+
credentialsLib = null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
98
122
|
/**
|
|
99
123
|
* The environment facts the model needs to stop asking which OS it is on.
|
|
100
124
|
*
|
|
@@ -167,11 +191,54 @@ function hostEnv(base = {}, supplied = {}, payload = null) {
|
|
|
167
191
|
} catch {
|
|
168
192
|
/* no desktop line */
|
|
169
193
|
}
|
|
194
|
+
// The data directory (`$AEGISCODE_HOME`, else `~/.aegiscode`), read from the
|
|
195
|
+
// module every host already resolves it through. Stated rather than left to
|
|
196
|
+
// be built from `homedir`: a model that concatenates home + ".aegiscode"
|
|
197
|
+
// itself is one dropped separator away from `Dator.aegiscode`, a path that
|
|
198
|
+
// does not exist, and it has no way to tell the difference from the answer.
|
|
199
|
+
let dataDir = b.dataDir;
|
|
200
|
+
try {
|
|
201
|
+
if (!dataDir && credentialsLib) dataDir = credentialsLib.aegisHome();
|
|
202
|
+
} catch {
|
|
203
|
+
/* no data-directory line */
|
|
204
|
+
}
|
|
205
|
+
// The user's own locale, from the module that already resolves home and
|
|
206
|
+
// Desktop (client/platform.js appLocale). Stated for the same reason the
|
|
207
|
+
// Desktop path is: it is a fact about THIS machine that the model cannot
|
|
208
|
+
// derive from `platform: win32`, and until it is stated the model mirrors
|
|
209
|
+
// whatever language the message arrived in and defaults to the prompt's
|
|
210
|
+
// English otherwise — so a Swedish user had no way to stop being greeted in
|
|
211
|
+
// English, and a one-word request ("städa") had no language to be read in.
|
|
212
|
+
// Best-effort: a failed probe simply omits the line.
|
|
213
|
+
let locale = b.locale;
|
|
214
|
+
let localeName = b.localeName;
|
|
215
|
+
try {
|
|
216
|
+
if (!locale && platformLib && typeof platformLib.appLocale === 'function') {
|
|
217
|
+
locale = platformLib.appLocale();
|
|
218
|
+
}
|
|
219
|
+
if (locale && !localeName && platformLib && typeof platformLib.languageName === 'function') {
|
|
220
|
+
localeName = platformLib.languageName(locale);
|
|
221
|
+
}
|
|
222
|
+
} catch {
|
|
223
|
+
/* no locale line */
|
|
224
|
+
}
|
|
170
225
|
return {
|
|
171
226
|
platform: pick('platform', b.platform || process.platform),
|
|
172
227
|
arch: pick('arch', b.arch || process.arch),
|
|
173
228
|
homedir: pick('homedir', homedir),
|
|
174
229
|
desktopdir: pick('desktopdir', desktopdir),
|
|
230
|
+
dataDir: pick('dataDir', dataDir),
|
|
231
|
+
locale: pick('locale', locale),
|
|
232
|
+
localeName: pick('localeName', localeName),
|
|
233
|
+
// Durable language EVIDENCE, which is a different thing from `locale` and is
|
|
234
|
+
// passed through rather than probed: `locale` is where the machine is set
|
|
235
|
+
// up, this is what the holder's own saved writing is in. A host that has
|
|
236
|
+
// folded the avatar profile (lib/avatar/profile.js foldLanguage, which
|
|
237
|
+
// already emits "writes durably in Swedish (sv), so reply in Swedish unless
|
|
238
|
+
// asked otherwise") hands the facets in here; a host with no avatar passes
|
|
239
|
+
// nothing and gets the exact pre-locale turn. Shapes: a `{ code, name }`,
|
|
240
|
+
// a `{ key, value }` facet, or a bare string.
|
|
241
|
+
languages: pick('languages', b.languages),
|
|
175
242
|
cwd: pick('cwd', cwd),
|
|
176
243
|
shell: pick('shell', shellName),
|
|
177
244
|
shellKind: pick('shellKind', shellKind),
|
|
@@ -1486,12 +1553,20 @@ function createLocalEngine({
|
|
|
1486
1553
|
// and always disposed when the turn ends.
|
|
1487
1554
|
let shell = null;
|
|
1488
1555
|
const getShell = () => shell || (shell = new ShellSession({ cwd: envFor(payload).cwd }));
|
|
1489
|
-
const toolCtx = { getShell, signal };
|
|
1490
1556
|
// The turn's working directory. It rides on every tool frame because a
|
|
1491
1557
|
// tool row's args are the command or the path — never the directory the
|
|
1492
1558
|
// command runs in — which left "where is it working in" unanswerable from
|
|
1493
|
-
// the transcript.
|
|
1494
|
-
|
|
1559
|
+
// the transcript. It also has to ride on `toolCtx`, which is what
|
|
1560
|
+
// normalizeArgs (tools.js) actually resolves a RELATIVE readFile/writeFile/
|
|
1561
|
+
// editFile/listDir/glob/grep path against — omitting `cwd` here meant that
|
|
1562
|
+
// resolution fell back to the HOST PROCESS's own cwd (the Electron install
|
|
1563
|
+
// dir off Linux, per baseDir()'s comment in tools.js, which fixed this for
|
|
1564
|
+
// the no-path default but never for a path the model actually supplied).
|
|
1565
|
+
// `desktopdir` rides the same way so resolvePath can correct a model's
|
|
1566
|
+
// literal "Desktop" guess to the real one (platform.js's own alias fix).
|
|
1567
|
+
const turnEnv = envFor(payload);
|
|
1568
|
+
const turnCwd = turnEnv.cwd;
|
|
1569
|
+
const toolCtx = { getShell, signal, cwd: turnCwd, desktopdir: turnEnv.desktopdir };
|
|
1495
1570
|
|
|
1496
1571
|
try {
|
|
1497
1572
|
// byok's settings row lives under the provider named IN THE MODEL id
|
|
@@ -70,16 +70,86 @@ const TOOL_LINE =
|
|
|
70
70
|
'across calls within the turn, like a real terminal. task spawns a specialist subagent ' +
|
|
71
71
|
'(its own tool loop, same model) for a focused, self-contained piece of work.';
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* One durable-language entry as a sentence fragment, accepting the three shapes
|
|
75
|
+
* a host can hand in without this file growing a dependency on the avatar
|
|
76
|
+
* module that produces them: a bare string, `{ code, name }`, or a folded
|
|
77
|
+
* profile facet `{ key, value }` (whose `value` is already prose —
|
|
78
|
+
* "writes durably in Swedish (sv), so reply in Swedish unless asked otherwise" —
|
|
79
|
+
* and is preferred as-is rather than re-rendered into something longer).
|
|
80
|
+
*/
|
|
81
|
+
function languageLine(entry) {
|
|
82
|
+
if (typeof entry === 'string') return entry.trim();
|
|
83
|
+
if (!entry || typeof entry !== 'object') return '';
|
|
84
|
+
if (typeof entry.value === 'string' && entry.value.trim()) return entry.value.trim();
|
|
85
|
+
const name = typeof entry.name === 'string' ? entry.name.trim() : '';
|
|
86
|
+
const code = typeof entry.code === 'string' ? entry.code.trim() : typeof entry.key === 'string' ? entry.key.trim() : '';
|
|
87
|
+
if (name && code) return `${name} (${code})`;
|
|
88
|
+
return name || code;
|
|
89
|
+
}
|
|
90
|
+
|
|
73
91
|
/**
|
|
74
92
|
* Render the environment preamble. Everything is optional: a missing field is
|
|
75
93
|
* simply omitted, so a headless caller can build a persona with nothing but
|
|
76
94
|
* the identity block.
|
|
77
95
|
*/
|
|
78
96
|
function environmentPreamble(env = {}) {
|
|
79
|
-
const {
|
|
80
|
-
|
|
97
|
+
const {
|
|
98
|
+
platform,
|
|
99
|
+
arch,
|
|
100
|
+
homedir,
|
|
101
|
+
desktopdir,
|
|
102
|
+
dataDir,
|
|
103
|
+
locale,
|
|
104
|
+
localeName,
|
|
105
|
+
languages,
|
|
106
|
+
cwd,
|
|
107
|
+
shell,
|
|
108
|
+
shellKind,
|
|
109
|
+
roots,
|
|
110
|
+
appVersion,
|
|
111
|
+
model,
|
|
112
|
+
} = env || {};
|
|
81
113
|
const bits = [];
|
|
82
114
|
if (platform) bits.push(`platform: ${platform}${arch ? ` (${arch})` : ''}`);
|
|
115
|
+
// The other half of "who and where is this machine": the platform line says
|
|
116
|
+
// what it runs, this says what language its user is in. It was the ONE
|
|
117
|
+
// environment fact a turn never carried, and the consequence was visible —
|
|
118
|
+
// the model mirrored whatever language the message arrived in and otherwise
|
|
119
|
+
// fell back to this prompt's English, so a Swedish user could not stop being
|
|
120
|
+
// greeted in English and a one-word request ("städa") arrived with no
|
|
121
|
+
// language to be read in.
|
|
122
|
+
if (locale) {
|
|
123
|
+
const base = String(locale).split('-')[0].toLowerCase();
|
|
124
|
+
const name = localeName ? ` (${localeName})` : '';
|
|
125
|
+
// The instruction is only load-bearing for a NON-English host: English is
|
|
126
|
+
// this prompt's own language, so "reply in English" would be noise that
|
|
127
|
+
// competes with whatever language the request is actually written in.
|
|
128
|
+
bits.push(
|
|
129
|
+
base === 'en'
|
|
130
|
+
? `locale: ${locale}${name}`
|
|
131
|
+
: `locale: ${locale}${name} — the user's own machine and account run in this language, ` +
|
|
132
|
+
'so expect requests written in it and answer in the language the user writes to you ' +
|
|
133
|
+
'in. Use this to resolve an otherwise ambiguous request (a bare path, a pasted ' +
|
|
134
|
+
'error, a one-word command) — never to override a request written in another language.'
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
// Durable EVIDENCE, which is deliberately a separate line from `locale`: one
|
|
138
|
+
// is how the machine is configured, the other is what the user's own saved
|
|
139
|
+
// writing is in, and they can disagree (an English-configured machine used by
|
|
140
|
+
// someone who writes Swedish all day). The request in front of the model
|
|
141
|
+
// still outranks both, so the line says so rather than reading as an order to
|
|
142
|
+
// switch languages.
|
|
143
|
+
const langLines = (Array.isArray(languages) ? languages : [])
|
|
144
|
+
.map((entry) => languageLine(entry))
|
|
145
|
+
.filter(Boolean);
|
|
146
|
+
if (langLines.length) {
|
|
147
|
+
bits.push(
|
|
148
|
+
`recorded language evidence from the user's own saved writing: ${langLines.join('; ')} — ` +
|
|
149
|
+
'the language of the request in front of you always wins; this is evidence, not an ' +
|
|
150
|
+
'instruction to switch'
|
|
151
|
+
);
|
|
152
|
+
}
|
|
83
153
|
if (homedir) bits.push(`home directory: ${homedir}`);
|
|
84
154
|
// Named explicitly because `~/Desktop` is a GUESS that is wrong on two of the
|
|
85
155
|
// three platforms this app ships to: OneDrive folder redirection moves it on
|
|
@@ -93,6 +163,20 @@ function environmentPreamble(env = {}) {
|
|
|
93
163
|
'called "Desktop" there',
|
|
94
164
|
);
|
|
95
165
|
}
|
|
166
|
+
// Same failure mode as the desktop line, one directory over, and reported
|
|
167
|
+
// live: asked about the AEGIS data directory, DeepSeek emitted
|
|
168
|
+
// `C:\Users\Dator.aegiscode` — the home directory with the separator dropped —
|
|
169
|
+
// got an empty listing, and concluded the store did not exist. The path is
|
|
170
|
+
// given verbatim AND the wrong form is named, because a model reading a
|
|
171
|
+
// missing path cannot tell a typo from an empty directory.
|
|
172
|
+
if (dataDir) {
|
|
173
|
+
bits.push(
|
|
174
|
+
`AEGIS data directory: ${dataDir} — this is the store itself (config, sessions, ` +
|
|
175
|
+
'credentials, queue). Use this exact path; do NOT append it to the home directory ' +
|
|
176
|
+
'yourself, because a dropped separator ("C:\\Users\\you.aegiscode") names a path that ' +
|
|
177
|
+
'does not exist and looks like an empty directory rather than a mistake',
|
|
178
|
+
);
|
|
179
|
+
}
|
|
96
180
|
if (cwd) bits.push(`working directory: ${cwd}`);
|
|
97
181
|
if (shell) bits.push(`exec shell: ${shell}${shellKind ? ` (${shellKind})` : ''}`);
|
|
98
182
|
if (model) bits.push(`model: ${model}`);
|
|
@@ -375,7 +375,10 @@ function normalizeArgs(name, args, ctx = {}) {
|
|
|
375
375
|
for (const key of keys) {
|
|
376
376
|
const value = input[key];
|
|
377
377
|
if (typeof value !== 'string' || !value.trim()) continue; // absent → the executor's default
|
|
378
|
-
const res = platform.resolvePath(value, {
|
|
378
|
+
const res = platform.resolvePath(value, {
|
|
379
|
+
cwd: ctx && ctx.cwd ? ctx.cwd : undefined,
|
|
380
|
+
desktopdir: ctx && ctx.desktopdir ? ctx.desktopdir : undefined,
|
|
381
|
+
});
|
|
379
382
|
if (!res.ok) return { ok: false, args: input, error: `${name}: ${key} — ${res.error}` };
|
|
380
383
|
if (res.path !== value) {
|
|
381
384
|
if (out === input) out = { ...input };
|