evolcore 0.0.33 → 0.0.35-test.0
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/CHANGELOG.md +59 -0
- package/bin/ec.js +3 -2
- package/bin/install-codex-managed-hooks.mjs +38 -4
- package/dist/agents/baseagent-availability.js +20 -36
- package/dist/agents/claude-runner.js +93 -14
- package/dist/agents/codex/diagnostics.js +79 -22
- package/dist/agents/codex-runner.js +245 -47
- package/dist/agents/ecagent-runner.js +90 -27
- package/dist/agents/runner-types.js +5 -6
- package/dist/aun/aid/agentmd.js +13 -2
- package/dist/aun/aid/client.js +1 -1
- package/dist/aun/aid/identity.js +1 -1
- package/dist/aun/msg/managed-operation.js +16 -0
- package/dist/aun/msg/p2p.js +18 -2
- package/dist/channels/aun.js +123 -7
- package/dist/channels/daemon.js +6 -3
- package/dist/cli/aun-commands.js +39 -14
- package/dist/cli/ctl-command.js +3 -1
- package/dist/cli/daemon-commands.js +130 -23
- package/dist/cli/fs-command.js +2 -1
- package/dist/cli/getmeta-command.js +211 -0
- package/dist/cli/index.js +26 -6
- package/dist/cli/integrity-command.js +196 -0
- package/dist/cli/managed-command-guard.js +3 -0
- package/dist/cli/memory-command.js +200 -156
- package/dist/cli/thread-command.js +17 -7
- package/dist/cli/trigger-command.js +6 -1
- package/dist/config/config-field-policy.js +4 -0
- package/dist/config/config-manager.js +19 -0
- package/dist/config/contact-book-store.js +5 -0
- package/dist/config/resolved-config-op.js +25 -8
- package/dist/config/role-service.js +13 -0
- package/dist/config/runtime-env.js +16 -0
- package/dist/config-store.js +30 -0
- package/dist/core/audit/log-integrity.js +3 -1
- package/dist/core/auth/agent-delegation.js +108 -35
- package/dist/core/auth/delegation-diagnostics.js +414 -0
- package/dist/core/auth/operation-authorizer.js +22 -3
- package/dist/core/auth/operation-catalog.js +16 -0
- package/dist/core/channel-runtime.js +1 -1
- package/dist/core/command/agent-control.js +18 -26
- package/dist/core/command/command-handler.js +145 -5
- package/dist/core/command/daemon-diagnostics.js +1 -0
- package/dist/core/command/menu-catalog.js +3 -0
- package/dist/core/command/menu-handler.js +24 -7
- package/dist/core/command/menu-protocol.js +1 -0
- package/dist/core/command/slash-handler.js +2 -0
- package/dist/core/command/topic-slash.js +4 -7
- package/dist/core/daemon-bootstrap.js +4 -7
- package/dist/core/event-catalog.js +14 -0
- package/dist/core/file-integrity/read.js +61 -0
- package/dist/core/file-integrity/store.js +262 -0
- package/dist/core/ipc-registration.js +47 -2
- package/dist/core/memory/batch-meta.js +133 -0
- package/dist/core/memory/consolidation-context.js +132 -28
- package/dist/core/memory/consolidation-ops-records.js +14 -16
- package/dist/core/memory/consolidation-trigger.js +15 -7
- package/dist/core/memory/consolidation.js +146 -26
- package/dist/core/memory/index-manager.js +19 -28
- package/dist/core/memory/memory-admin.js +19 -14
- package/dist/core/memory/memory-document.js +53 -9
- package/dist/core/memory/memory-writer.js +50 -19
- package/dist/core/message/aun-ipc-sender.js +19 -1
- package/dist/core/message/im-renderer.js +20 -4
- package/dist/core/message/message-bridge.js +5 -4
- package/dist/core/message/message-log.js +1 -0
- package/dist/core/message/peer-mode.js +17 -0
- package/dist/core/message/response-engine.js +598 -50
- package/dist/core/permission/ec-command-parser.js +169 -44
- package/dist/core/permission/protected-paths.js +5 -1
- package/dist/core/permission/readonly-shell-query.js +43 -5
- package/dist/core/permission/session-path-grants.js +334 -0
- package/dist/core/permission/tool-canonical.js +226 -0
- package/dist/core/permission/tool-policy.js +60 -62
- package/dist/core/relation/peer-identity.js +87 -12
- package/dist/core/role/runtime-policy.js +21 -10
- package/dist/core/session/session-fs-store.js +123 -8
- package/dist/core/session/session-manager.js +131 -6
- package/dist/core/session/session-title.js +26 -1
- package/dist/core/skill/index-generator.js +17 -3
- package/dist/core/system-session/grants.js +40 -0
- package/dist/core/system-session/memory.js +289 -0
- package/dist/core/system-session/registry.js +74 -0
- package/dist/core/system-session/types.js +14 -0
- package/dist/core/thread/command-parser.js +6 -1
- package/dist/core/thread/ipc-operation.js +33 -16
- package/dist/core/thread/thread-operation.js +62 -24
- package/dist/core/thread/thread-service.js +258 -51
- package/dist/eck/kit-renderer.js +7 -2
- package/dist/eck/manifest-engine.js +24 -4
- package/dist/index.js +11 -2
- package/dist/ipc.js +51 -40
- package/dist/paths.js +70 -0
- package/dist/stats/billing.js +20 -8
- package/dist/trigger/feedback.js +6 -1
- package/dist/trigger/parser.js +8 -1
- package/dist/trigger/system-definitions.js +3 -3
- package/dist/utils/cross-platform.js +17 -5
- package/dist/utils/error-dict.json +18 -4
- package/dist/utils/error-utils.js +121 -0
- package/dist/utils/instance-registry.js +13 -8
- package/dist/utils/log-writer.js +12 -0
- package/dist/utils/process-introspect.js +11 -0
- package/kits/docs/context-assembly.md +0 -1
- package/kits/docs/evolcore/agent-create.md +5 -4
- package/kits/docs/evolcore/agent.md +2 -2
- package/kits/docs/evolcore/config.md +2 -2
- package/kits/docs/evolcore/ctl.md +2 -2
- package/kits/docs/evolcore/ec-capabilities.md +1 -1
- package/kits/docs/evolcore/fs-architecture.md +9 -10
- package/kits/docs/evolcore/fs.md +2 -2
- package/kits/docs/evolcore/group-collaboration.md +3 -3
- package/kits/docs/evolcore/group.md +14 -12
- package/kits/docs/evolcore/memory-architecture.md +4 -5
- package/kits/docs/evolcore/memory-consolidation.md +19 -16
- package/kits/docs/evolcore/memory-tags.md +3 -1
- package/kits/docs/evolcore/memory.md +24 -12
- package/kits/docs/evolcore/model.md +16 -0
- package/kits/docs/evolcore/msg.md +7 -7
- package/kits/docs/evolcore/stats.md +1 -1
- package/kits/docs/evolcore/thread-chain.md +30 -14
- package/kits/docs/prompt-loading-architecture.md +0 -1
- package/kits/eck_manifest.auxiliary.json +9 -0
- package/kits/eck_manifest.json +20 -20
- package/kits/eck_manifest.memory.json +20 -12
- package/kits/rules/01-overview.md +11 -0
- package/kits/rules/03-identity.md +6 -3
- package/kits/rules/06-channel.md +1 -1
- package/kits/rules/07-memory-and-thread.md +13 -16
- package/kits/schemas/_meta.json +7 -1
- package/kits/schemas/agent-config.schema.13.json +1 -1
- package/kits/schemas/daemon.schema.7.json +140 -0
- package/kits/skills/ec-group/SKILL.md +8 -5
- package/kits/skills/ec-skill/scripts/cli.mjs +1 -1
- package/kits/skills/ec-skill/scripts/skill.mjs +1 -1
- package/kits/skills/thread-ops/SKILL.md +18 -18
- package/kits/templates/memory-consolidation/forget.md +2 -2
- package/kits/templates/memory-consolidation/generalize.md +4 -4
- package/kits/templates/memory-consolidation/notes.md +12 -12
- package/kits/templates/memory-consolidation/profile.md +3 -3
- package/kits/templates/memory-consolidation/promote.md +3 -3
- package/kits/templates/memory-consolidation/workflow.md +42 -7
- package/kits/templates/message-fragments/handoff-request-to-target.md +1 -1
- package/kits/templates/system-fragments/bash-description.md +9 -0
- package/kits/templates/system-fragments/bootstrap.md +4 -3
- package/kits/templates/system-fragments/channel.md +2 -2
- package/kits/templates/system-fragments/memory.md +16 -9
- package/kits/templates/system-fragments/reply.md +6 -6
- package/kits/templates/system-fragments/session.md +1 -1
- package/package.json +4 -3
- package/dist/core/memory/memory-session-policy.js +0 -41
- package/dist/core/memory/memory-signature.js +0 -257
|
@@ -3,8 +3,10 @@ import os from 'node:os';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { spawnSync } from 'node:child_process';
|
|
5
5
|
import { createHash } from 'node:crypto';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
6
8
|
import { parse as parseToml } from 'smol-toml';
|
|
7
|
-
|
|
9
|
+
import { TARGET_PACKAGE_ROOT_ENV } from '../../product.js';
|
|
8
10
|
export function checkCodexProjectPath(value, options = {}) {
|
|
9
11
|
const configured = typeof value === 'string' ? value.trim() : '';
|
|
10
12
|
if (!configured) {
|
|
@@ -65,12 +67,6 @@ function decodeProbeOutput(buffer) {
|
|
|
65
67
|
return new TextDecoder('gb18030').decode(buffer);
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
|
-
function windowsCommandArg(value) {
|
|
69
|
-
return '"' + value.replaceAll('"', '\\"') + '"';
|
|
70
|
-
}
|
|
71
|
-
function expectedWindowsHookCommand(nodePath, hookPath) {
|
|
72
|
-
return windowsCommandArg(nodePath) + ' ' + windowsCommandArg(hookPath) + ' %EVOLCORE_INSTANCE_SOCKET%';
|
|
73
|
-
}
|
|
74
70
|
/**
|
|
75
71
|
* Run synthetic Windows shell probes for the managed Codex hook.
|
|
76
72
|
*
|
|
@@ -104,13 +100,20 @@ export function runCodexHookLaunchDiagnostic(options = {}) {
|
|
|
104
100
|
throw new Error('No Windows managed hook directory configured.');
|
|
105
101
|
const managedDir = path.resolve(options.managedDir || configuredDir);
|
|
106
102
|
const hookPath = path.join(managedDir, 'pre-tool-use.mjs');
|
|
107
|
-
|
|
103
|
+
let expected;
|
|
108
104
|
const handlers = Array.isArray(config.hooks?.PreToolUse)
|
|
109
105
|
? config.hooks.PreToolUse.flatMap((group) => group?.hooks || [])
|
|
110
106
|
: [];
|
|
111
|
-
const handler = handlers.find((item) =>
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
const handler = handlers.find((item) => {
|
|
108
|
+
if (item?.type !== 'command' || item.async === true)
|
|
109
|
+
return false;
|
|
110
|
+
const command = parseManagedCommand(item.command_windows ?? item.commandWindows, hookPath);
|
|
111
|
+
if (!command || !sameRuntimePath(command.nodePath, nodePath, options.platform ?? process.platform))
|
|
112
|
+
return false;
|
|
113
|
+
expected = item.command_windows ?? item.commandWindows;
|
|
114
|
+
return true;
|
|
115
|
+
});
|
|
116
|
+
if (!handler || !expected || /[\r\n%;&|<>]/.test(nodePath + hookPath)) {
|
|
114
117
|
throw new Error('Managed command differs from the expected EvolCore command for this Node path; no hooks executed.');
|
|
115
118
|
}
|
|
116
119
|
fs.mkdirSync(path.dirname(output), { recursive: true, mode: 0o700 });
|
|
@@ -202,9 +205,34 @@ function samePackageRoot(embedded, expected) {
|
|
|
202
205
|
};
|
|
203
206
|
return normalize(embedded) === normalize(expected) || resolved(embedded) === resolved(expected);
|
|
204
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Windows accepts an executable path without its `.exe` suffix. Older
|
|
210
|
+
* installations may therefore bind `...\\node` while the current Node
|
|
211
|
+
* process reports `...\\node.exe`; these are the same runtime and must not
|
|
212
|
+
* trigger an elevated repair on every startup.
|
|
213
|
+
*/
|
|
214
|
+
function sameRuntimePath(embedded, expected, platform) {
|
|
215
|
+
if (samePackageRoot(embedded, expected))
|
|
216
|
+
return true;
|
|
217
|
+
if (platform !== 'win32' || !embedded)
|
|
218
|
+
return false;
|
|
219
|
+
const appendExe = (value) => path.extname(value) ? value : `${value}.exe`;
|
|
220
|
+
return samePackageRoot(appendExe(embedded), expected)
|
|
221
|
+
|| samePackageRoot(embedded, appendExe(expected));
|
|
222
|
+
}
|
|
205
223
|
function normalizedPath(value) {
|
|
206
224
|
return path.normalize(String(value || '')).replace(/[\\/]+$/, '').toLowerCase();
|
|
207
225
|
}
|
|
226
|
+
function parseManagedCommand(value, hookPath) {
|
|
227
|
+
if (typeof value !== 'string')
|
|
228
|
+
return null;
|
|
229
|
+
const match = /^"([^"\r\n]+)"\s+"([^"\r\n]+)"\s+%EVOLCORE_INSTANCE_SOCKET%$/i.exec(value.trim());
|
|
230
|
+
if (!match || !path.isAbsolute(match[1]) || /[%!]/.test(match[1] + match[2]))
|
|
231
|
+
return null;
|
|
232
|
+
if (normalizedPath(match[2]) !== normalizedPath(hookPath))
|
|
233
|
+
return null;
|
|
234
|
+
return { nodePath: match[1] };
|
|
235
|
+
}
|
|
208
236
|
function runtimeFileMayExist(file) {
|
|
209
237
|
try {
|
|
210
238
|
return fs.statSync(file).isFile();
|
|
@@ -213,9 +241,6 @@ function runtimeFileMayExist(file) {
|
|
|
213
241
|
return !['ENOENT', 'ENOTDIR'].includes(error?.code || '');
|
|
214
242
|
}
|
|
215
243
|
}
|
|
216
|
-
function managedBinding(source, launcher, hookPath) {
|
|
217
|
-
return managedHookInstaller.managedBinding(source, launcher, hookPath);
|
|
218
|
-
}
|
|
219
244
|
/** Read-only inspection of the machine-wide Windows Codex managed hook. */
|
|
220
245
|
export function inspectCodexManagedHook(options = {}) {
|
|
221
246
|
const paths = codexManagedHookPaths(options);
|
|
@@ -224,6 +249,21 @@ export function inspectCodexManagedHook(options = {}) {
|
|
|
224
249
|
const requirements = path.resolve(options.requirements || paths.requirements);
|
|
225
250
|
const managedDir = path.resolve(options.managedDir || paths.managedDir);
|
|
226
251
|
const hookPath = path.join(managedDir, 'pre-tool-use.mjs');
|
|
252
|
+
let managedHookInstaller;
|
|
253
|
+
try {
|
|
254
|
+
const installer = fileURLToPath(new URL('../../../bin/install-codex-managed-hooks.mjs', import.meta.url));
|
|
255
|
+
managedHookInstaller = createRequire(import.meta.url)(installer);
|
|
256
|
+
if (typeof managedHookInstaller.managedBinding !== 'function') {
|
|
257
|
+
throw new Error('managedBinding export is unavailable');
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
262
|
+
return {
|
|
263
|
+
status: 'unsafe', requirements, managedDir, hookPath,
|
|
264
|
+
reason: `managed-hook installer could not be loaded: ${detail}`,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
227
267
|
const configDirState = realDirectoryState(path.dirname(requirements));
|
|
228
268
|
const managedDirState = realDirectoryState(managedDir);
|
|
229
269
|
if ([configDirState, managedDirState].includes('unsafe')) {
|
|
@@ -286,9 +326,9 @@ export function inspectCodexManagedHook(options = {}) {
|
|
|
286
326
|
catch (error) {
|
|
287
327
|
return { status: 'unavailable', requirements, managedDir, hookPath, reason: error instanceof Error ? error.message : String(error) };
|
|
288
328
|
}
|
|
289
|
-
const expectedPackageRoot = path.resolve(options.packageRoot || process.cwd());
|
|
329
|
+
const expectedPackageRoot = path.resolve(process.env[TARGET_PACKAGE_ROOT_ENV] || options.packageRoot || process.cwd());
|
|
290
330
|
try {
|
|
291
|
-
const binding = managedBinding(source, launcher, hookPath);
|
|
331
|
+
const binding = managedHookInstaller.managedBinding(source, launcher, hookPath);
|
|
292
332
|
if (!binding || config.allow_managed_hooks_only !== true || config.features?.hooks !== true
|
|
293
333
|
|| normalizedPath(config.hooks?.windows_managed_dir) !== normalizedPath(managedDir)
|
|
294
334
|
|| (config.hooks?.managed_dir !== undefined
|
|
@@ -297,7 +337,7 @@ export function inspectCodexManagedHook(options = {}) {
|
|
|
297
337
|
}
|
|
298
338
|
const { embeddedPackageRoot, managedNodePath } = binding;
|
|
299
339
|
const packageMatches = samePackageRoot(embeddedPackageRoot, expectedPackageRoot);
|
|
300
|
-
const nodeMatches =
|
|
340
|
+
const nodeMatches = sameRuntimePath(managedNodePath, options.nodePath || process.execPath, options.platform ?? process.platform);
|
|
301
341
|
const repairFingerprint = createHash('sha256').update(source).update('\0').update(launcher).digest('hex');
|
|
302
342
|
if (packageMatches && nodeMatches)
|
|
303
343
|
return { status: 'installed', requirements, managedDir, hookPath };
|
|
@@ -356,9 +396,10 @@ export async function ensureCodexManagedHook(options) {
|
|
|
356
396
|
});
|
|
357
397
|
if (!paths)
|
|
358
398
|
return { status: 'skipped', reason: 'Windows managed hooks are not applicable on this platform' };
|
|
399
|
+
const packageRoot = process.env[TARGET_PACKAGE_ROOT_ENV] || options.packageRoot;
|
|
359
400
|
const inspectOptions = {
|
|
360
401
|
platform: platformName,
|
|
361
|
-
packageRoot
|
|
402
|
+
packageRoot,
|
|
362
403
|
requirements: options.requirements || paths.requirements,
|
|
363
404
|
managedDir: options.managedDir || paths.managedDir,
|
|
364
405
|
programData: options.programData,
|
|
@@ -388,7 +429,9 @@ export async function ensureCodexManagedHook(options) {
|
|
|
388
429
|
|| rechecked.repairAmbiguous !== state.repairAmbiguous) {
|
|
389
430
|
return { ...rechecked, repaired: false, error: 'managed-hook state changed during the startup check; retry to confirm the current binding' };
|
|
390
431
|
}
|
|
391
|
-
const installer =
|
|
432
|
+
const installer = process.env[TARGET_PACKAGE_ROOT_ENV]
|
|
433
|
+
? fileURLToPath(new URL('../../../bin/install-codex-managed-hooks.mjs', import.meta.url))
|
|
434
|
+
: path.join(path.resolve(packageRoot), 'bin', 'install-codex-managed-hooks.mjs');
|
|
392
435
|
if (!fs.existsSync(installer)) {
|
|
393
436
|
return { ...state, repaired: false, error: `managed-hook installer is missing: ${installer}` };
|
|
394
437
|
}
|
|
@@ -412,15 +455,29 @@ export async function ensureCodexManagedHook(options) {
|
|
|
412
455
|
if (result.error)
|
|
413
456
|
return { ok: false, detail: result.error.message };
|
|
414
457
|
if (result.status !== 0) {
|
|
415
|
-
const
|
|
416
|
-
|
|
458
|
+
const stderrDetail = (result.stderr || '').replace(/#<\s*CLIXML[\s\S]*?<\/Objs>\s*/gi, '').trim();
|
|
459
|
+
// The elevated child process runs in a separate window and its stderr is
|
|
460
|
+
// not captured through the Start-Process pipe. Read the structured failure
|
|
461
|
+
// record the installer writes to ProgramData before exiting.
|
|
462
|
+
let fileDetail;
|
|
463
|
+
try {
|
|
464
|
+
const failurePath = path.join(path.dirname(path.resolve(inspectOptions.requirements || paths.requirements)), '.evolcore-install-failure.json');
|
|
465
|
+
const raw = fs.readFileSync(failurePath, 'utf8');
|
|
466
|
+
const parsed = JSON.parse(raw);
|
|
467
|
+
if (typeof parsed.message === 'string' && parsed.message)
|
|
468
|
+
fileDetail = parsed.message;
|
|
469
|
+
fs.rmSync(failurePath, { force: true });
|
|
470
|
+
}
|
|
471
|
+
catch { /* best-effort */ }
|
|
472
|
+
const detail = fileDetail || stderrDetail || `installer exited with code ${result.status}`;
|
|
473
|
+
return { ok: false, detail };
|
|
417
474
|
}
|
|
418
475
|
return { ok: true };
|
|
419
476
|
});
|
|
420
477
|
options.onInstallRequired?.(state);
|
|
421
478
|
let elevated;
|
|
422
479
|
try {
|
|
423
|
-
elevated = runElevated(installer, path.resolve(
|
|
480
|
+
elevated = runElevated(installer, path.resolve(packageRoot));
|
|
424
481
|
}
|
|
425
482
|
catch (error) {
|
|
426
483
|
elevated = { ok: false, detail: error instanceof Error ? error.message : String(error) };
|