@cleocode/cleo 2026.4.116 → 2026.4.121
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/dist/cli/index.js +723 -201
- package/dist/cli/index.js.map +4 -4
- package/package.json +9 -9
package/dist/cli/index.js
CHANGED
|
@@ -608,6 +608,13 @@ var init_nexus = __esm({
|
|
|
608
608
|
}
|
|
609
609
|
});
|
|
610
610
|
|
|
611
|
+
// packages/contracts/src/operations/nexus-user-profile.ts
|
|
612
|
+
var init_nexus_user_profile = __esm({
|
|
613
|
+
"packages/contracts/src/operations/nexus-user-profile.ts"() {
|
|
614
|
+
"use strict";
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
|
|
611
618
|
// packages/contracts/src/operations/orchestrate.ts
|
|
612
619
|
var init_orchestrate = __esm({
|
|
613
620
|
"packages/contracts/src/operations/orchestrate.ts"() {
|
|
@@ -722,6 +729,7 @@ var init_operations = __esm({
|
|
|
722
729
|
init_lifecycle();
|
|
723
730
|
init_memory();
|
|
724
731
|
init_nexus();
|
|
732
|
+
init_nexus_user_profile();
|
|
725
733
|
init_orchestrate();
|
|
726
734
|
init_params();
|
|
727
735
|
init_release();
|
|
@@ -6713,6 +6721,157 @@ var init_registry = __esm({
|
|
|
6713
6721
|
params: []
|
|
6714
6722
|
},
|
|
6715
6723
|
// ---------------------------------------------------------------------------
|
|
6724
|
+
// T1080 — nexus.profile — user identity / preference profile (PSYCHE Wave 1)
|
|
6725
|
+
// ---------------------------------------------------------------------------
|
|
6726
|
+
// Query operations
|
|
6727
|
+
{
|
|
6728
|
+
gateway: "query",
|
|
6729
|
+
domain: "nexus",
|
|
6730
|
+
operation: "profile.view",
|
|
6731
|
+
description: "nexus.profile.view (query) \u2014 list all user-profile traits, optionally filtered by minimum confidence",
|
|
6732
|
+
tier: 1,
|
|
6733
|
+
idempotent: true,
|
|
6734
|
+
sessionRequired: false,
|
|
6735
|
+
requiredParams: [],
|
|
6736
|
+
params: [
|
|
6737
|
+
{
|
|
6738
|
+
name: "minConfidence",
|
|
6739
|
+
type: "number",
|
|
6740
|
+
required: false,
|
|
6741
|
+
description: "Minimum confidence threshold in [0.0, 1.0]. Defaults to 0.0."
|
|
6742
|
+
},
|
|
6743
|
+
{
|
|
6744
|
+
name: "includeSuperseded",
|
|
6745
|
+
type: "boolean",
|
|
6746
|
+
required: false,
|
|
6747
|
+
description: "Include superseded (deprecated) traits. Defaults to false."
|
|
6748
|
+
}
|
|
6749
|
+
]
|
|
6750
|
+
},
|
|
6751
|
+
{
|
|
6752
|
+
gateway: "query",
|
|
6753
|
+
domain: "nexus",
|
|
6754
|
+
operation: "profile.get",
|
|
6755
|
+
description: "nexus.profile.get (query) \u2014 fetch a single user-profile trait by key",
|
|
6756
|
+
tier: 1,
|
|
6757
|
+
idempotent: true,
|
|
6758
|
+
sessionRequired: false,
|
|
6759
|
+
requiredParams: ["traitKey"],
|
|
6760
|
+
params: [
|
|
6761
|
+
{
|
|
6762
|
+
name: "traitKey",
|
|
6763
|
+
type: "string",
|
|
6764
|
+
required: true,
|
|
6765
|
+
description: 'Trait key to retrieve (e.g. "prefers-zero-deps")',
|
|
6766
|
+
cli: { positional: true }
|
|
6767
|
+
}
|
|
6768
|
+
]
|
|
6769
|
+
},
|
|
6770
|
+
// Mutate operations
|
|
6771
|
+
{
|
|
6772
|
+
gateway: "mutate",
|
|
6773
|
+
domain: "nexus",
|
|
6774
|
+
operation: "profile.import",
|
|
6775
|
+
description: "nexus.profile.import (mutate) \u2014 import user-profile traits from a portable JSON file (default: ~/.cleo/user_profile.json)",
|
|
6776
|
+
tier: 1,
|
|
6777
|
+
idempotent: false,
|
|
6778
|
+
sessionRequired: false,
|
|
6779
|
+
requiredParams: [],
|
|
6780
|
+
params: [
|
|
6781
|
+
{
|
|
6782
|
+
name: "path",
|
|
6783
|
+
type: "string",
|
|
6784
|
+
required: false,
|
|
6785
|
+
description: "Absolute path to the JSON file. Defaults to ~/.cleo/user_profile.json."
|
|
6786
|
+
}
|
|
6787
|
+
]
|
|
6788
|
+
},
|
|
6789
|
+
{
|
|
6790
|
+
gateway: "mutate",
|
|
6791
|
+
domain: "nexus",
|
|
6792
|
+
operation: "profile.export",
|
|
6793
|
+
description: "nexus.profile.export (mutate) \u2014 export user-profile traits to a portable JSON file (default: ~/.cleo/user_profile.json)",
|
|
6794
|
+
tier: 1,
|
|
6795
|
+
idempotent: true,
|
|
6796
|
+
sessionRequired: false,
|
|
6797
|
+
requiredParams: [],
|
|
6798
|
+
params: [
|
|
6799
|
+
{
|
|
6800
|
+
name: "path",
|
|
6801
|
+
type: "string",
|
|
6802
|
+
required: false,
|
|
6803
|
+
description: "Absolute output path. Defaults to ~/.cleo/user_profile.json."
|
|
6804
|
+
}
|
|
6805
|
+
]
|
|
6806
|
+
},
|
|
6807
|
+
{
|
|
6808
|
+
gateway: "mutate",
|
|
6809
|
+
domain: "nexus",
|
|
6810
|
+
operation: "profile.reinforce",
|
|
6811
|
+
description: "nexus.profile.reinforce (mutate) \u2014 increment reinforcement count and boost confidence for a user-profile trait",
|
|
6812
|
+
tier: 1,
|
|
6813
|
+
idempotent: false,
|
|
6814
|
+
sessionRequired: false,
|
|
6815
|
+
requiredParams: ["traitKey"],
|
|
6816
|
+
params: [
|
|
6817
|
+
{
|
|
6818
|
+
name: "traitKey",
|
|
6819
|
+
type: "string",
|
|
6820
|
+
required: true,
|
|
6821
|
+
description: "Key of the trait to reinforce",
|
|
6822
|
+
cli: { positional: true }
|
|
6823
|
+
},
|
|
6824
|
+
{
|
|
6825
|
+
name: "source",
|
|
6826
|
+
type: "string",
|
|
6827
|
+
required: false,
|
|
6828
|
+
description: 'Source identifier for this reinforcement event. Defaults to "manual".'
|
|
6829
|
+
}
|
|
6830
|
+
]
|
|
6831
|
+
},
|
|
6832
|
+
{
|
|
6833
|
+
gateway: "mutate",
|
|
6834
|
+
domain: "nexus",
|
|
6835
|
+
operation: "profile.upsert",
|
|
6836
|
+
description: "nexus.profile.upsert (mutate) \u2014 create or update a user-profile trait in nexus.db",
|
|
6837
|
+
tier: 2,
|
|
6838
|
+
idempotent: false,
|
|
6839
|
+
sessionRequired: false,
|
|
6840
|
+
requiredParams: ["trait"],
|
|
6841
|
+
params: [
|
|
6842
|
+
{
|
|
6843
|
+
name: "trait",
|
|
6844
|
+
type: "string",
|
|
6845
|
+
required: true,
|
|
6846
|
+
description: "UserProfileTrait JSON object with traitKey, traitValue, confidence, source (accepted as JSON string at CLI boundary; parsed in dispatch handler)"
|
|
6847
|
+
}
|
|
6848
|
+
]
|
|
6849
|
+
},
|
|
6850
|
+
{
|
|
6851
|
+
gateway: "mutate",
|
|
6852
|
+
domain: "nexus",
|
|
6853
|
+
operation: "profile.supersede",
|
|
6854
|
+
description: "nexus.profile.supersede (mutate) \u2014 mark a user-profile trait as superseded by another (T1139 supersession prep)",
|
|
6855
|
+
tier: 2,
|
|
6856
|
+
idempotent: true,
|
|
6857
|
+
sessionRequired: false,
|
|
6858
|
+
requiredParams: ["oldKey", "newKey"],
|
|
6859
|
+
params: [
|
|
6860
|
+
{
|
|
6861
|
+
name: "oldKey",
|
|
6862
|
+
type: "string",
|
|
6863
|
+
required: true,
|
|
6864
|
+
description: "Trait key being deprecated"
|
|
6865
|
+
},
|
|
6866
|
+
{
|
|
6867
|
+
name: "newKey",
|
|
6868
|
+
type: "string",
|
|
6869
|
+
required: true,
|
|
6870
|
+
description: "Trait key that replaces the old one"
|
|
6871
|
+
}
|
|
6872
|
+
]
|
|
6873
|
+
},
|
|
6874
|
+
// ---------------------------------------------------------------------------
|
|
6716
6875
|
// sticky — Ephemeral notes for quick capture (T5282)
|
|
6717
6876
|
// ---------------------------------------------------------------------------
|
|
6718
6877
|
// Query operations
|
|
@@ -7619,13 +7778,25 @@ var init_registry = __esm({
|
|
|
7619
7778
|
});
|
|
7620
7779
|
|
|
7621
7780
|
// packages/cleo/src/dispatch/dispatcher.ts
|
|
7622
|
-
|
|
7781
|
+
import { getLogger, getProjectRoot } from "@cleocode/core";
|
|
7782
|
+
function isDialecticEvalAllowed(sessionId) {
|
|
7783
|
+
const last = _dialecticLastEvalMs.get(sessionId) ?? 0;
|
|
7784
|
+
const now = Date.now();
|
|
7785
|
+
if (now - last < DIALECTIC_RATE_LIMIT_MS) {
|
|
7786
|
+
return false;
|
|
7787
|
+
}
|
|
7788
|
+
_dialecticLastEvalMs.set(sessionId, now);
|
|
7789
|
+
return true;
|
|
7790
|
+
}
|
|
7791
|
+
var DIALECTIC_RATE_LIMIT_MS, _dialecticLastEvalMs, Dispatcher;
|
|
7623
7792
|
var init_dispatcher = __esm({
|
|
7624
7793
|
"packages/cleo/src/dispatch/dispatcher.ts"() {
|
|
7625
7794
|
"use strict";
|
|
7626
7795
|
init_meta();
|
|
7627
7796
|
init_pipeline();
|
|
7628
7797
|
init_registry();
|
|
7798
|
+
DIALECTIC_RATE_LIMIT_MS = 1e4;
|
|
7799
|
+
_dialecticLastEvalMs = /* @__PURE__ */ new Map();
|
|
7629
7800
|
Dispatcher = class {
|
|
7630
7801
|
handlers;
|
|
7631
7802
|
pipeline;
|
|
@@ -7704,6 +7875,35 @@ var init_dispatcher = __esm({
|
|
|
7704
7875
|
if (request.sessionId) {
|
|
7705
7876
|
response.meta.sessionId = request.sessionId;
|
|
7706
7877
|
}
|
|
7878
|
+
if (response.success && request.gateway === "mutate" && request.sessionId && isDialecticEvalAllowed(request.sessionId)) {
|
|
7879
|
+
const capturedRequest = request;
|
|
7880
|
+
const capturedSessionId = request.sessionId;
|
|
7881
|
+
setImmediate(() => {
|
|
7882
|
+
Promise.all([
|
|
7883
|
+
import("@cleocode/core/memory/dialectic-evaluator.js"),
|
|
7884
|
+
import("@cleocode/core/store/nexus-sqlite.js"),
|
|
7885
|
+
import("@cleocode/core/store/memory-sqlite.js")
|
|
7886
|
+
]).then(async ([{ evaluateDialectic, applyInsights }, { getNexusDb: getNexusDb2 }, { getBrainDb: getBrainDb3 }]) => {
|
|
7887
|
+
const projectRoot = getProjectRoot();
|
|
7888
|
+
const turn = {
|
|
7889
|
+
userMessage: `cleo ${capturedRequest.domain} ${capturedRequest.operation} ${JSON.stringify(capturedRequest.params ?? {})}`,
|
|
7890
|
+
systemResponse: `Operation succeeded in domain "${capturedRequest.domain}".`,
|
|
7891
|
+
activePeerId: capturedRequest.params?.["peerId"] ?? "global",
|
|
7892
|
+
sessionId: capturedSessionId
|
|
7893
|
+
};
|
|
7894
|
+
const insights = await evaluateDialectic(turn);
|
|
7895
|
+
const [nexusDb, brainDb] = await Promise.all([getNexusDb2(), getBrainDb3()]);
|
|
7896
|
+
await applyInsights(insights, nexusDb, brainDb, {
|
|
7897
|
+
sessionId: capturedSessionId,
|
|
7898
|
+
activePeerId: turn.activePeerId,
|
|
7899
|
+
projectRoot
|
|
7900
|
+
});
|
|
7901
|
+
}).catch((err) => {
|
|
7902
|
+
const log3 = getLogger("dialectic-hook");
|
|
7903
|
+
log3.warn({ err }, "dialectic-evaluator failed");
|
|
7904
|
+
});
|
|
7905
|
+
});
|
|
7906
|
+
}
|
|
7707
7907
|
return response;
|
|
7708
7908
|
}
|
|
7709
7909
|
};
|
|
@@ -7736,7 +7936,7 @@ var init_exit_codes2 = __esm({
|
|
|
7736
7936
|
});
|
|
7737
7937
|
|
|
7738
7938
|
// packages/cleo/src/dispatch/engines/_error.ts
|
|
7739
|
-
import { getLogger } from "@cleocode/core";
|
|
7939
|
+
import { getLogger as getLogger2 } from "@cleocode/core";
|
|
7740
7940
|
function logLevel(exitCode) {
|
|
7741
7941
|
if (exitCode === 0 || exitCode >= 100) return "debug";
|
|
7742
7942
|
if (exitCode === 1 || exitCode === 3) return "error";
|
|
@@ -7747,7 +7947,7 @@ function engineError(code, message, options) {
|
|
|
7747
7947
|
const level = logLevel(exitCode);
|
|
7748
7948
|
const isVitest = process.env["VITEST"] === "true";
|
|
7749
7949
|
if (!isVitest) {
|
|
7750
|
-
const logger =
|
|
7950
|
+
const logger = getLogger2("engine");
|
|
7751
7951
|
logger[level](
|
|
7752
7952
|
{ code, exitCode, ...options?.details && { details: options.details } },
|
|
7753
7953
|
message
|
|
@@ -9170,7 +9370,7 @@ import {
|
|
|
9170
9370
|
getEnrichedWaves,
|
|
9171
9371
|
getGlobalSignaldockDbPath,
|
|
9172
9372
|
getLifecycleStatus as getLifecycleStatus2,
|
|
9173
|
-
getLogger as
|
|
9373
|
+
getLogger as getLogger3,
|
|
9174
9374
|
orchestrationGetNextTask as getNextTask,
|
|
9175
9375
|
getParallelStatus,
|
|
9176
9376
|
orchestrationGetReadyTasks as getReadyTasks,
|
|
@@ -9635,7 +9835,8 @@ async function composeSpawnForTask(taskId, root, options = {}) {
|
|
|
9635
9835
|
protocol: options.protocol,
|
|
9636
9836
|
skipAtomicityCheck: options.skipAtomicityCheck ?? false,
|
|
9637
9837
|
worktreePath: options.worktreePath,
|
|
9638
|
-
worktreeBranch: options.worktreeBranch
|
|
9838
|
+
worktreeBranch: options.worktreeBranch,
|
|
9839
|
+
conduitSubscription: options.conduitSubscription
|
|
9639
9840
|
});
|
|
9640
9841
|
} finally {
|
|
9641
9842
|
db.close();
|
|
@@ -9668,11 +9869,27 @@ async function orchestrateSpawn(taskId, protocolType, projectRoot, tier, noWorkt
|
|
|
9668
9869
|
} catch {
|
|
9669
9870
|
activeSessionId = null;
|
|
9670
9871
|
}
|
|
9872
|
+
let conduitSubscription;
|
|
9873
|
+
const effectiveTierForConduit = tier ?? 1;
|
|
9874
|
+
if (effectiveTierForConduit >= 1) {
|
|
9875
|
+
try {
|
|
9876
|
+
const taskRecord = await accessor.loadSingleTask(taskId);
|
|
9877
|
+
if (taskRecord?.parentId) {
|
|
9878
|
+
const epicId = taskRecord.parentId;
|
|
9879
|
+
conduitSubscription = {
|
|
9880
|
+
epicId,
|
|
9881
|
+
waveId: Number.parseInt(taskId.replace(/\D/g, "").slice(-4) || "1", 10),
|
|
9882
|
+
peerId: `cleo-agent-${taskId.toLowerCase()}`
|
|
9883
|
+
};
|
|
9884
|
+
}
|
|
9885
|
+
} catch {
|
|
9886
|
+
}
|
|
9887
|
+
}
|
|
9671
9888
|
let sdkWorktreeResult = null;
|
|
9672
9889
|
let worktreePath;
|
|
9673
9890
|
let worktreeBranch;
|
|
9674
9891
|
if (noWorktree) {
|
|
9675
|
-
|
|
9892
|
+
getLogger3("engine:orchestrate").info(
|
|
9676
9893
|
{ taskId },
|
|
9677
9894
|
"T1140 --no-worktree: worktree provisioning skipped (audit logged)"
|
|
9678
9895
|
);
|
|
@@ -9693,7 +9910,7 @@ async function orchestrateSpawn(taskId, protocolType, projectRoot, tier, noWorkt
|
|
|
9693
9910
|
worktreePath = sdkWorktreeResult.path;
|
|
9694
9911
|
worktreeBranch = sdkWorktreeResult.branch;
|
|
9695
9912
|
} catch (wtErr) {
|
|
9696
|
-
|
|
9913
|
+
getLogger3("engine:orchestrate").warn(
|
|
9697
9914
|
{ taskId, err: wtErr },
|
|
9698
9915
|
`T1140 worktree creation failed for ${taskId} \u2014 spawning without isolation: ${wtErr instanceof Error ? wtErr.message : String(wtErr)}`
|
|
9699
9916
|
);
|
|
@@ -9704,7 +9921,8 @@ async function orchestrateSpawn(taskId, protocolType, projectRoot, tier, noWorkt
|
|
|
9704
9921
|
sessionId: activeSessionId,
|
|
9705
9922
|
protocol: protocolType,
|
|
9706
9923
|
worktreePath,
|
|
9707
|
-
worktreeBranch
|
|
9924
|
+
worktreeBranch,
|
|
9925
|
+
conduitSubscription
|
|
9708
9926
|
});
|
|
9709
9927
|
if (!payload.atomicity.allowed) {
|
|
9710
9928
|
return engineError(
|
|
@@ -12394,7 +12612,7 @@ import {
|
|
|
12394
12612
|
getActiveSession as getActiveSession2,
|
|
12395
12613
|
getIvtrState as getIvtrState2,
|
|
12396
12614
|
getLifecycleStatus as getLifecycleStatus3,
|
|
12397
|
-
getLogger as
|
|
12615
|
+
getLogger as getLogger4,
|
|
12398
12616
|
loadConfig,
|
|
12399
12617
|
predictImpact,
|
|
12400
12618
|
toCompact
|
|
@@ -12796,7 +13014,7 @@ async function taskCompleteStrict(projectRoot, taskId, notes) {
|
|
|
12796
13014
|
fix: `Advance the parent epic via 'cleo lifecycle complete ${task.parentId} ${epicStage}' and then the next stages. Lifecycle advancement automatically updates the parent epic's pipelineStage (ADR-051 Decision 5).`
|
|
12797
13015
|
});
|
|
12798
13016
|
}
|
|
12799
|
-
|
|
13017
|
+
getLogger4("engine:lifecycle").warn(
|
|
12800
13018
|
{
|
|
12801
13019
|
taskId,
|
|
12802
13020
|
parentEpicId: task.parentId,
|
|
@@ -14557,8 +14775,8 @@ import {
|
|
|
14557
14775
|
exportTasksPackage,
|
|
14558
14776
|
findAdrs,
|
|
14559
14777
|
getDefaultSnapshotPath,
|
|
14560
|
-
getLogger as
|
|
14561
|
-
getProjectRoot,
|
|
14778
|
+
getLogger as getLogger5,
|
|
14779
|
+
getProjectRoot as getProjectRoot2,
|
|
14562
14780
|
importSnapshot,
|
|
14563
14781
|
importTasks,
|
|
14564
14782
|
importTasksPackage,
|
|
@@ -14588,7 +14806,7 @@ var init_admin = __esm({
|
|
|
14588
14806
|
// Query
|
|
14589
14807
|
// -----------------------------------------------------------------------
|
|
14590
14808
|
async query(operation, params) {
|
|
14591
|
-
const projectRoot =
|
|
14809
|
+
const projectRoot = getProjectRoot2();
|
|
14592
14810
|
const startTime = Date.now();
|
|
14593
14811
|
try {
|
|
14594
14812
|
switch (operation) {
|
|
@@ -15094,7 +15312,7 @@ var init_admin = __esm({
|
|
|
15094
15312
|
return unsupportedOp("query", "admin", operation, startTime);
|
|
15095
15313
|
}
|
|
15096
15314
|
} catch (error) {
|
|
15097
|
-
|
|
15315
|
+
getLogger5("domain:admin").error(
|
|
15098
15316
|
{ gateway: "query", domain: "admin", operation, err: error },
|
|
15099
15317
|
error instanceof Error ? error.message : String(error)
|
|
15100
15318
|
);
|
|
@@ -15105,7 +15323,7 @@ var init_admin = __esm({
|
|
|
15105
15323
|
// Mutate
|
|
15106
15324
|
// -----------------------------------------------------------------------
|
|
15107
15325
|
async mutate(operation, params) {
|
|
15108
|
-
const projectRoot =
|
|
15326
|
+
const projectRoot = getProjectRoot2();
|
|
15109
15327
|
const startTime = Date.now();
|
|
15110
15328
|
try {
|
|
15111
15329
|
switch (operation) {
|
|
@@ -15554,7 +15772,7 @@ var init_admin = __esm({
|
|
|
15554
15772
|
return unsupportedOp("mutate", "admin", operation, startTime);
|
|
15555
15773
|
}
|
|
15556
15774
|
} catch (error) {
|
|
15557
|
-
|
|
15775
|
+
getLogger5("domain:admin").error(
|
|
15558
15776
|
{ gateway: "mutate", domain: "admin", operation, err: error },
|
|
15559
15777
|
error instanceof Error ? error.message : String(error)
|
|
15560
15778
|
);
|
|
@@ -15753,8 +15971,8 @@ var init_canon = __esm({
|
|
|
15753
15971
|
|
|
15754
15972
|
// packages/cleo/src/dispatch/domains/check.ts
|
|
15755
15973
|
import {
|
|
15756
|
-
getLogger as
|
|
15757
|
-
getProjectRoot as
|
|
15974
|
+
getLogger as getLogger6,
|
|
15975
|
+
getProjectRoot as getProjectRoot3,
|
|
15758
15976
|
getWorkflowComplianceReport,
|
|
15759
15977
|
paginate as paginate3,
|
|
15760
15978
|
revalidateEvidence,
|
|
@@ -15772,7 +15990,7 @@ var init_check = __esm({
|
|
|
15772
15990
|
// Query
|
|
15773
15991
|
// -----------------------------------------------------------------------
|
|
15774
15992
|
async query(operation, params) {
|
|
15775
|
-
const projectRoot =
|
|
15993
|
+
const projectRoot = getProjectRoot3();
|
|
15776
15994
|
const startTime = Date.now();
|
|
15777
15995
|
try {
|
|
15778
15996
|
switch (operation) {
|
|
@@ -16303,7 +16521,7 @@ var init_check = __esm({
|
|
|
16303
16521
|
}
|
|
16304
16522
|
} catch (error) {
|
|
16305
16523
|
const message = error instanceof Error ? error.message : String(error);
|
|
16306
|
-
|
|
16524
|
+
getLogger6("domain:check").error(
|
|
16307
16525
|
{ gateway: "query", domain: "check", operation, err: error },
|
|
16308
16526
|
message
|
|
16309
16527
|
);
|
|
@@ -16314,7 +16532,7 @@ var init_check = __esm({
|
|
|
16314
16532
|
// Mutate
|
|
16315
16533
|
// -----------------------------------------------------------------------
|
|
16316
16534
|
async mutate(operation, params) {
|
|
16317
|
-
const projectRoot =
|
|
16535
|
+
const projectRoot = getProjectRoot3();
|
|
16318
16536
|
const startTime = Date.now();
|
|
16319
16537
|
try {
|
|
16320
16538
|
switch (operation) {
|
|
@@ -16397,7 +16615,7 @@ var init_check = __esm({
|
|
|
16397
16615
|
}
|
|
16398
16616
|
} catch (error) {
|
|
16399
16617
|
const message = error instanceof Error ? error.message : String(error);
|
|
16400
|
-
|
|
16618
|
+
getLogger6("domain:check").error(
|
|
16401
16619
|
{ gateway: "mutate", domain: "check", operation, err: error },
|
|
16402
16620
|
message
|
|
16403
16621
|
);
|
|
@@ -17195,7 +17413,7 @@ import {
|
|
|
17195
17413
|
createAttachmentStoreV2,
|
|
17196
17414
|
generateDocsLlmsTxt,
|
|
17197
17415
|
getCleoDirAbsolute,
|
|
17198
|
-
getProjectRoot as
|
|
17416
|
+
getProjectRoot as getProjectRoot4,
|
|
17199
17417
|
resolveAttachmentBackend
|
|
17200
17418
|
} from "@cleocode/core/internal";
|
|
17201
17419
|
function inferOwnerType(ownerId) {
|
|
@@ -17300,7 +17518,7 @@ var init_docs = __esm({
|
|
|
17300
17518
|
);
|
|
17301
17519
|
}
|
|
17302
17520
|
const attach = params?.attach;
|
|
17303
|
-
const cwd =
|
|
17521
|
+
const cwd = getProjectRoot4();
|
|
17304
17522
|
const result = await generateDocsLlmsTxt({
|
|
17305
17523
|
ownerId: forId,
|
|
17306
17524
|
cwd
|
|
@@ -17380,7 +17598,7 @@ var init_docs = __esm({
|
|
|
17380
17598
|
startTime
|
|
17381
17599
|
);
|
|
17382
17600
|
}
|
|
17383
|
-
const cwd =
|
|
17601
|
+
const cwd = getProjectRoot4();
|
|
17384
17602
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
17385
17603
|
let storagePath;
|
|
17386
17604
|
if (metadata.attachment.kind === "local-file") {
|
|
@@ -17487,7 +17705,7 @@ var init_docs = __esm({
|
|
|
17487
17705
|
const meta = await store.put(bytes, attachment, ownerType, ownerId, attachedBy);
|
|
17488
17706
|
let backend = "legacy";
|
|
17489
17707
|
try {
|
|
17490
|
-
const v2 = createAttachmentStoreV2(
|
|
17708
|
+
const v2 = createAttachmentStoreV2(getProjectRoot4());
|
|
17491
17709
|
const v2Result = await v2.put(ownerId, {
|
|
17492
17710
|
name: absPath.split(/[\\/]/).pop() ?? meta.sha256.slice(0, 12),
|
|
17493
17711
|
data: new Uint8Array(bytes),
|
|
@@ -17499,7 +17717,7 @@ var init_docs = __esm({
|
|
|
17499
17717
|
}
|
|
17500
17718
|
import("@cleocode/core/internal").then(
|
|
17501
17719
|
({ ensureLlmtxtNode }) => ensureLlmtxtNode(
|
|
17502
|
-
|
|
17720
|
+
getProjectRoot4(),
|
|
17503
17721
|
meta.sha256,
|
|
17504
17722
|
`${ownerType}:${ownerId}`,
|
|
17505
17723
|
absPath.split("/").pop() ?? meta.sha256.slice(0, 12)
|
|
@@ -17532,7 +17750,7 @@ var init_docs = __esm({
|
|
|
17532
17750
|
const urlBytes = Buffer.from(url, "utf-8");
|
|
17533
17751
|
const meta = await store.put(urlBytes, attachment, ownerType, ownerId, attachedBy);
|
|
17534
17752
|
import("@cleocode/core/internal").then(
|
|
17535
|
-
({ ensureLlmtxtNode }) => ensureLlmtxtNode(
|
|
17753
|
+
({ ensureLlmtxtNode }) => ensureLlmtxtNode(getProjectRoot4(), meta.sha256, `${ownerType}:${ownerId}`, url)
|
|
17536
17754
|
).catch(() => {
|
|
17537
17755
|
});
|
|
17538
17756
|
const backend = "legacy";
|
|
@@ -17617,7 +17835,7 @@ var init_docs = __esm({
|
|
|
17617
17835
|
const blobPurged = derefResult.status === "removed";
|
|
17618
17836
|
const refCountAfter = derefResult.status === "derefd" ? derefResult.refCountAfter : 0;
|
|
17619
17837
|
try {
|
|
17620
|
-
const v2 = createAttachmentStoreV2(
|
|
17838
|
+
const v2 = createAttachmentStoreV2(getProjectRoot4());
|
|
17621
17839
|
await v2.remove(attachmentId, fromOwner);
|
|
17622
17840
|
} catch {
|
|
17623
17841
|
}
|
|
@@ -17658,7 +17876,7 @@ var init_docs = __esm({
|
|
|
17658
17876
|
});
|
|
17659
17877
|
|
|
17660
17878
|
// packages/cleo/src/dispatch/domains/intelligence.ts
|
|
17661
|
-
import { getAccessor as getAccessor8, getLogger as
|
|
17879
|
+
import { getAccessor as getAccessor8, getLogger as getLogger7, getProjectRoot as getProjectRoot5 } from "@cleocode/core";
|
|
17662
17880
|
import {
|
|
17663
17881
|
calculateTaskRisk,
|
|
17664
17882
|
extractPatternsFromHistory,
|
|
@@ -17678,7 +17896,7 @@ var init_intelligence = __esm({
|
|
|
17678
17896
|
// Query
|
|
17679
17897
|
// -----------------------------------------------------------------------
|
|
17680
17898
|
async query(operation, params) {
|
|
17681
|
-
const projectRoot =
|
|
17899
|
+
const projectRoot = getProjectRoot5();
|
|
17682
17900
|
const startTime = Date.now();
|
|
17683
17901
|
try {
|
|
17684
17902
|
switch (operation) {
|
|
@@ -17850,7 +18068,7 @@ var init_intelligence = __esm({
|
|
|
17850
18068
|
}
|
|
17851
18069
|
} catch (error) {
|
|
17852
18070
|
const message = error instanceof Error ? error.message : String(error);
|
|
17853
|
-
|
|
18071
|
+
getLogger7("domain:intelligence").error(
|
|
17854
18072
|
{ gateway: "query", domain: "intelligence", operation, err: error },
|
|
17855
18073
|
message
|
|
17856
18074
|
);
|
|
@@ -17878,7 +18096,7 @@ var init_intelligence = __esm({
|
|
|
17878
18096
|
});
|
|
17879
18097
|
|
|
17880
18098
|
// packages/cleo/src/dispatch/domains/memory.ts
|
|
17881
|
-
import { getLogger as
|
|
18099
|
+
import { getLogger as getLogger8, getProjectRoot as getProjectRoot6 } from "@cleocode/core";
|
|
17882
18100
|
import {
|
|
17883
18101
|
generateMemoryBridgeContent,
|
|
17884
18102
|
getBrainDb,
|
|
@@ -17904,7 +18122,7 @@ var init_memory2 = __esm({
|
|
|
17904
18122
|
// Query
|
|
17905
18123
|
// -----------------------------------------------------------------------
|
|
17906
18124
|
async query(operation, params) {
|
|
17907
|
-
const projectRoot =
|
|
18125
|
+
const projectRoot = getProjectRoot6();
|
|
17908
18126
|
const startTime = Date.now();
|
|
17909
18127
|
try {
|
|
17910
18128
|
switch (operation) {
|
|
@@ -18825,7 +19043,7 @@ var init_memory2 = __esm({
|
|
|
18825
19043
|
}
|
|
18826
19044
|
} catch (error) {
|
|
18827
19045
|
const message = error instanceof Error ? error.message : String(error);
|
|
18828
|
-
|
|
19046
|
+
getLogger8("domain:memory").error(
|
|
18829
19047
|
{ gateway: "query", domain: "memory", operation, err: error },
|
|
18830
19048
|
message
|
|
18831
19049
|
);
|
|
@@ -18836,7 +19054,7 @@ var init_memory2 = __esm({
|
|
|
18836
19054
|
// Mutate
|
|
18837
19055
|
// -----------------------------------------------------------------------
|
|
18838
19056
|
async mutate(operation, params) {
|
|
18839
|
-
const projectRoot =
|
|
19057
|
+
const projectRoot = getProjectRoot6();
|
|
18840
19058
|
const startTime = Date.now();
|
|
18841
19059
|
try {
|
|
18842
19060
|
switch (operation) {
|
|
@@ -19272,7 +19490,7 @@ var init_memory2 = __esm({
|
|
|
19272
19490
|
}
|
|
19273
19491
|
} catch (error) {
|
|
19274
19492
|
const message = error instanceof Error ? error.message : String(error);
|
|
19275
|
-
|
|
19493
|
+
getLogger8("domain:memory").error(
|
|
19276
19494
|
{ gateway: "mutate", domain: "memory", operation, err: error },
|
|
19277
19495
|
message
|
|
19278
19496
|
);
|
|
@@ -19359,10 +19577,15 @@ import {
|
|
|
19359
19577
|
nexusDiscoverRelated as discoverRelated,
|
|
19360
19578
|
executeTransfer,
|
|
19361
19579
|
exportSnapshot as exportSnapshot2,
|
|
19580
|
+
exportUserProfile,
|
|
19362
19581
|
formatAugmentResults,
|
|
19363
19582
|
getDefaultSnapshotPath as getDefaultSnapshotPath2,
|
|
19583
|
+
getNexusDb,
|
|
19364
19584
|
getSharingStatus,
|
|
19585
|
+
getUserProfileTrait,
|
|
19365
19586
|
importSnapshot as importSnapshot2,
|
|
19587
|
+
importUserProfile,
|
|
19588
|
+
listUserProfile,
|
|
19366
19589
|
nexusDeps,
|
|
19367
19590
|
nexusGetProject,
|
|
19368
19591
|
nexusInit,
|
|
@@ -19377,9 +19600,12 @@ import {
|
|
|
19377
19600
|
previewTransfer,
|
|
19378
19601
|
nexusReadRegistry as readRegistry,
|
|
19379
19602
|
readSnapshot as readSnapshot2,
|
|
19603
|
+
reinforceTrait,
|
|
19380
19604
|
resolveTask,
|
|
19381
19605
|
searchAcrossProjects,
|
|
19382
19606
|
setPermission,
|
|
19607
|
+
supersedeTrait,
|
|
19608
|
+
upsertUserProfileTrait,
|
|
19383
19609
|
validateSyntax,
|
|
19384
19610
|
writeSnapshot as writeSnapshot2
|
|
19385
19611
|
} from "@cleocode/core/internal";
|
|
@@ -19828,6 +20054,75 @@ async function nexusTaskSymbols(taskId, projectRoot) {
|
|
|
19828
20054
|
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
19829
20055
|
}
|
|
19830
20056
|
}
|
|
20057
|
+
async function nexusProfileView(minConfidence, includeSuperseded) {
|
|
20058
|
+
try {
|
|
20059
|
+
const nexusDb = await getNexusDb();
|
|
20060
|
+
const traits = await listUserProfile(nexusDb, { minConfidence, includeSuperseded });
|
|
20061
|
+
return engineSuccess({ traits, count: traits.length });
|
|
20062
|
+
} catch (error) {
|
|
20063
|
+
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
20064
|
+
}
|
|
20065
|
+
}
|
|
20066
|
+
async function nexusProfileGet(traitKey) {
|
|
20067
|
+
try {
|
|
20068
|
+
const nexusDb = await getNexusDb();
|
|
20069
|
+
const trait = await getUserProfileTrait(nexusDb, traitKey);
|
|
20070
|
+
return engineSuccess({ trait });
|
|
20071
|
+
} catch (error) {
|
|
20072
|
+
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
20073
|
+
}
|
|
20074
|
+
}
|
|
20075
|
+
async function nexusProfileImport(path5) {
|
|
20076
|
+
try {
|
|
20077
|
+
const result = await importUserProfile(path5);
|
|
20078
|
+
return engineSuccess(result);
|
|
20079
|
+
} catch (error) {
|
|
20080
|
+
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
20081
|
+
}
|
|
20082
|
+
}
|
|
20083
|
+
async function nexusProfileExport(path5) {
|
|
20084
|
+
try {
|
|
20085
|
+
const result = await exportUserProfile(path5);
|
|
20086
|
+
return engineSuccess(result);
|
|
20087
|
+
} catch (error) {
|
|
20088
|
+
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
20089
|
+
}
|
|
20090
|
+
}
|
|
20091
|
+
async function nexusProfileReinforce(traitKey, source) {
|
|
20092
|
+
try {
|
|
20093
|
+
const nexusDb = await getNexusDb();
|
|
20094
|
+
await reinforceTrait(nexusDb, traitKey, source ?? "manual");
|
|
20095
|
+
const updated = await getUserProfileTrait(nexusDb, traitKey);
|
|
20096
|
+
if (!updated) {
|
|
20097
|
+
return engineError("E_NOT_FOUND", `Trait not found: ${traitKey}`);
|
|
20098
|
+
}
|
|
20099
|
+
return engineSuccess({
|
|
20100
|
+
reinforcementCount: updated.reinforcementCount,
|
|
20101
|
+
confidence: updated.confidence
|
|
20102
|
+
});
|
|
20103
|
+
} catch (error) {
|
|
20104
|
+
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
20105
|
+
}
|
|
20106
|
+
}
|
|
20107
|
+
async function nexusProfileUpsert(trait) {
|
|
20108
|
+
try {
|
|
20109
|
+
const nexusDb = await getNexusDb();
|
|
20110
|
+
const existing = await getUserProfileTrait(nexusDb, trait.traitKey);
|
|
20111
|
+
await upsertUserProfileTrait(nexusDb, trait);
|
|
20112
|
+
return engineSuccess({ created: existing === null });
|
|
20113
|
+
} catch (error) {
|
|
20114
|
+
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
20115
|
+
}
|
|
20116
|
+
}
|
|
20117
|
+
async function nexusProfileSupersede(oldKey, newKey) {
|
|
20118
|
+
try {
|
|
20119
|
+
const nexusDb = await getNexusDb();
|
|
20120
|
+
await supersedeTrait(nexusDb, oldKey, newKey);
|
|
20121
|
+
return engineSuccess({ oldKey, newKey });
|
|
20122
|
+
} catch (error) {
|
|
20123
|
+
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
20124
|
+
}
|
|
20125
|
+
}
|
|
19831
20126
|
var init_nexus_engine = __esm({
|
|
19832
20127
|
"packages/cleo/src/dispatch/engines/nexus-engine.ts"() {
|
|
19833
20128
|
"use strict";
|
|
@@ -19838,9 +20133,9 @@ var init_nexus_engine = __esm({
|
|
|
19838
20133
|
// packages/cleo/src/dispatch/domains/nexus.ts
|
|
19839
20134
|
import {
|
|
19840
20135
|
getBrainNativeDb as getBrainNativeDb2,
|
|
19841
|
-
getLogger as
|
|
20136
|
+
getLogger as getLogger9,
|
|
19842
20137
|
getNexusNativeDb,
|
|
19843
|
-
getProjectRoot as
|
|
20138
|
+
getProjectRoot as getProjectRoot7
|
|
19844
20139
|
} from "@cleocode/core/internal";
|
|
19845
20140
|
async function handleTopEntries(operation, params, startTime) {
|
|
19846
20141
|
const rawLimit = params?.limit;
|
|
@@ -20013,8 +20308,8 @@ async function handleImpact(operation, params, startTime) {
|
|
|
20013
20308
|
const projectIdParam = params?.projectId;
|
|
20014
20309
|
const projectId = projectIdParam ?? Buffer.from(process.cwd()).toString("base64url").slice(0, 32);
|
|
20015
20310
|
try {
|
|
20016
|
-
const { getNexusDb } = await import("@cleocode/core/store/nexus-sqlite");
|
|
20017
|
-
await
|
|
20311
|
+
const { getNexusDb: getNexusDb2 } = await import("@cleocode/core/store/nexus-sqlite");
|
|
20312
|
+
await getNexusDb2();
|
|
20018
20313
|
const db = getNexusNativeDb();
|
|
20019
20314
|
if (!db) {
|
|
20020
20315
|
return wrapResult(
|
|
@@ -20200,7 +20495,7 @@ var init_nexus2 = __esm({
|
|
|
20200
20495
|
// Query
|
|
20201
20496
|
// -----------------------------------------------------------------------
|
|
20202
20497
|
async query(operation, params) {
|
|
20203
|
-
const projectRoot =
|
|
20498
|
+
const projectRoot = getProjectRoot7();
|
|
20204
20499
|
const startTime = Date.now();
|
|
20205
20500
|
try {
|
|
20206
20501
|
switch (operation) {
|
|
@@ -20556,11 +20851,33 @@ var init_nexus2 = __esm({
|
|
|
20556
20851
|
const result = await nexusTaskSymbols(taskId, projectRoot);
|
|
20557
20852
|
return wrapResult(result, "query", "nexus", operation, startTime);
|
|
20558
20853
|
}
|
|
20854
|
+
// T1080 — user-profile query verbs
|
|
20855
|
+
case "profile.view": {
|
|
20856
|
+
const minConfidence = params?.minConfidence;
|
|
20857
|
+
const includeSuperseded = params?.includeSuperseded;
|
|
20858
|
+
const result = await nexusProfileView(minConfidence, includeSuperseded);
|
|
20859
|
+
return wrapResult(result, "query", "nexus", operation, startTime);
|
|
20860
|
+
}
|
|
20861
|
+
case "profile.get": {
|
|
20862
|
+
const traitKey = params?.traitKey;
|
|
20863
|
+
if (!traitKey) {
|
|
20864
|
+
return errorResult(
|
|
20865
|
+
"query",
|
|
20866
|
+
"nexus",
|
|
20867
|
+
operation,
|
|
20868
|
+
"E_INVALID_INPUT",
|
|
20869
|
+
"traitKey is required",
|
|
20870
|
+
startTime
|
|
20871
|
+
);
|
|
20872
|
+
}
|
|
20873
|
+
const result = await nexusProfileGet(traitKey);
|
|
20874
|
+
return wrapResult(result, "query", "nexus", operation, startTime);
|
|
20875
|
+
}
|
|
20559
20876
|
default:
|
|
20560
20877
|
return unsupportedOp("query", "nexus", operation, startTime);
|
|
20561
20878
|
}
|
|
20562
20879
|
} catch (error) {
|
|
20563
|
-
|
|
20880
|
+
getLogger9("domain:nexus").error(
|
|
20564
20881
|
{ gateway: "query", operation, err: error },
|
|
20565
20882
|
error instanceof Error ? error.message : String(error)
|
|
20566
20883
|
);
|
|
@@ -20571,7 +20888,7 @@ var init_nexus2 = __esm({
|
|
|
20571
20888
|
// Mutate
|
|
20572
20889
|
// -----------------------------------------------------------------------
|
|
20573
20890
|
async mutate(operation, params) {
|
|
20574
|
-
const projectRoot =
|
|
20891
|
+
const projectRoot = getProjectRoot7();
|
|
20575
20892
|
const startTime = Date.now();
|
|
20576
20893
|
try {
|
|
20577
20894
|
switch (operation) {
|
|
@@ -20720,11 +21037,69 @@ var init_nexus2 = __esm({
|
|
|
20720
21037
|
const result = await nexusConduitScan(projectRoot);
|
|
20721
21038
|
return wrapResult(result, "mutate", "nexus", operation, startTime);
|
|
20722
21039
|
}
|
|
21040
|
+
// T1080 — user-profile mutate verbs
|
|
21041
|
+
case "profile.import": {
|
|
21042
|
+
const path5 = params?.path;
|
|
21043
|
+
const result = await nexusProfileImport(path5);
|
|
21044
|
+
return wrapResult(result, "mutate", "nexus", operation, startTime);
|
|
21045
|
+
}
|
|
21046
|
+
case "profile.export": {
|
|
21047
|
+
const path5 = params?.path;
|
|
21048
|
+
const result = await nexusProfileExport(path5);
|
|
21049
|
+
return wrapResult(result, "mutate", "nexus", operation, startTime);
|
|
21050
|
+
}
|
|
21051
|
+
case "profile.reinforce": {
|
|
21052
|
+
const traitKey = params?.traitKey;
|
|
21053
|
+
if (!traitKey) {
|
|
21054
|
+
return errorResult(
|
|
21055
|
+
"mutate",
|
|
21056
|
+
"nexus",
|
|
21057
|
+
operation,
|
|
21058
|
+
"E_INVALID_INPUT",
|
|
21059
|
+
"traitKey is required",
|
|
21060
|
+
startTime
|
|
21061
|
+
);
|
|
21062
|
+
}
|
|
21063
|
+
const source = params?.source;
|
|
21064
|
+
const result = await nexusProfileReinforce(traitKey, source);
|
|
21065
|
+
return wrapResult(result, "mutate", "nexus", operation, startTime);
|
|
21066
|
+
}
|
|
21067
|
+
case "profile.upsert": {
|
|
21068
|
+
const trait = params?.trait;
|
|
21069
|
+
if (!trait?.traitKey || !trait?.traitValue) {
|
|
21070
|
+
return errorResult(
|
|
21071
|
+
"mutate",
|
|
21072
|
+
"nexus",
|
|
21073
|
+
operation,
|
|
21074
|
+
"E_INVALID_INPUT",
|
|
21075
|
+
"trait.traitKey and trait.traitValue are required",
|
|
21076
|
+
startTime
|
|
21077
|
+
);
|
|
21078
|
+
}
|
|
21079
|
+
const result = await nexusProfileUpsert(trait);
|
|
21080
|
+
return wrapResult(result, "mutate", "nexus", operation, startTime);
|
|
21081
|
+
}
|
|
21082
|
+
case "profile.supersede": {
|
|
21083
|
+
const oldKey = params?.oldKey;
|
|
21084
|
+
const newKey = params?.newKey;
|
|
21085
|
+
if (!oldKey || !newKey) {
|
|
21086
|
+
return errorResult(
|
|
21087
|
+
"mutate",
|
|
21088
|
+
"nexus",
|
|
21089
|
+
operation,
|
|
21090
|
+
"E_INVALID_INPUT",
|
|
21091
|
+
"oldKey and newKey are required",
|
|
21092
|
+
startTime
|
|
21093
|
+
);
|
|
21094
|
+
}
|
|
21095
|
+
const result = await nexusProfileSupersede(oldKey, newKey);
|
|
21096
|
+
return wrapResult(result, "mutate", "nexus", operation, startTime);
|
|
21097
|
+
}
|
|
20723
21098
|
default:
|
|
20724
21099
|
return unsupportedOp("mutate", "nexus", operation, startTime);
|
|
20725
21100
|
}
|
|
20726
21101
|
} catch (error) {
|
|
20727
|
-
|
|
21102
|
+
getLogger9("domain:nexus").error(
|
|
20728
21103
|
{ gateway: "mutate", operation, err: error },
|
|
20729
21104
|
error instanceof Error ? error.message : String(error)
|
|
20730
21105
|
);
|
|
@@ -20769,7 +21144,10 @@ var init_nexus2 = __esm({
|
|
|
20769
21144
|
"wiki",
|
|
20770
21145
|
// T1117 — Contracts + ingestion bridges
|
|
20771
21146
|
"contracts-show",
|
|
20772
|
-
"task-symbols"
|
|
21147
|
+
"task-symbols",
|
|
21148
|
+
// T1080 — user-profile query verbs
|
|
21149
|
+
"profile.view",
|
|
21150
|
+
"profile.get"
|
|
20773
21151
|
],
|
|
20774
21152
|
mutate: [
|
|
20775
21153
|
"share.snapshot.export",
|
|
@@ -20784,7 +21162,13 @@ var init_nexus2 = __esm({
|
|
|
20784
21162
|
// T1117 — Contracts + ingestion bridges
|
|
20785
21163
|
"contracts-sync",
|
|
20786
21164
|
"contracts-link-tasks",
|
|
20787
|
-
"conduit-scan"
|
|
21165
|
+
"conduit-scan",
|
|
21166
|
+
// T1080 — user-profile mutate verbs
|
|
21167
|
+
"profile.import",
|
|
21168
|
+
"profile.export",
|
|
21169
|
+
"profile.reinforce",
|
|
21170
|
+
"profile.upsert",
|
|
21171
|
+
"profile.supersede"
|
|
20788
21172
|
]
|
|
20789
21173
|
};
|
|
20790
21174
|
}
|
|
@@ -20800,8 +21184,8 @@ import {
|
|
|
20800
21184
|
E_IVTR_MAX_RETRIES,
|
|
20801
21185
|
extractTypedGates,
|
|
20802
21186
|
getIvtrState as getIvtrState3,
|
|
20803
|
-
getLogger as
|
|
20804
|
-
getProjectRoot as
|
|
21187
|
+
getLogger as getLogger10,
|
|
21188
|
+
getProjectRoot as getProjectRoot8,
|
|
20805
21189
|
getTask,
|
|
20806
21190
|
loopBackIvtr,
|
|
20807
21191
|
releaseIvtr,
|
|
@@ -20822,7 +21206,7 @@ var init_ivtr = __esm({
|
|
|
20822
21206
|
"packages/cleo/src/dispatch/domains/ivtr.ts"() {
|
|
20823
21207
|
"use strict";
|
|
20824
21208
|
init_base();
|
|
20825
|
-
log =
|
|
21209
|
+
log = getLogger10("domain:ivtr");
|
|
20826
21210
|
IvtrHandler = class {
|
|
20827
21211
|
// -----------------------------------------------------------------------
|
|
20828
21212
|
// query — read-only
|
|
@@ -20849,7 +21233,7 @@ var init_ivtr = __esm({
|
|
|
20849
21233
|
startTime
|
|
20850
21234
|
);
|
|
20851
21235
|
}
|
|
20852
|
-
const cwd =
|
|
21236
|
+
const cwd = getProjectRoot8();
|
|
20853
21237
|
const state = await getIvtrState3(taskId, { cwd });
|
|
20854
21238
|
if (!state) {
|
|
20855
21239
|
return wrapResult(
|
|
@@ -20937,7 +21321,7 @@ var init_ivtr = __esm({
|
|
|
20937
21321
|
startTime
|
|
20938
21322
|
);
|
|
20939
21323
|
}
|
|
20940
|
-
const cwd =
|
|
21324
|
+
const cwd = getProjectRoot8();
|
|
20941
21325
|
const agentIdentity = params?.["agentIdentity"];
|
|
20942
21326
|
switch (operation) {
|
|
20943
21327
|
// ------------------------------------------------------------------
|
|
@@ -25370,8 +25754,8 @@ async function acquireDb() {
|
|
|
25370
25754
|
async function buildDefaultDispatcher() {
|
|
25371
25755
|
if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
|
|
25372
25756
|
const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await Promise.resolve().then(() => (init_engine(), engine_exports));
|
|
25373
|
-
const { getProjectRoot:
|
|
25374
|
-
const projectRoot =
|
|
25757
|
+
const { getProjectRoot: getProjectRoot29 } = await import("@cleocode/core/internal");
|
|
25758
|
+
const projectRoot = getProjectRoot29();
|
|
25375
25759
|
return {
|
|
25376
25760
|
async dispatch(input) {
|
|
25377
25761
|
try {
|
|
@@ -25782,8 +26166,8 @@ var init_playbook = __esm({
|
|
|
25782
26166
|
|
|
25783
26167
|
// packages/cleo/src/dispatch/domains/orchestrate.ts
|
|
25784
26168
|
import {
|
|
25785
|
-
getLogger as
|
|
25786
|
-
getProjectRoot as
|
|
26169
|
+
getLogger as getLogger11,
|
|
26170
|
+
getProjectRoot as getProjectRoot9,
|
|
25787
26171
|
instantiateTessera,
|
|
25788
26172
|
listTesseraTemplates,
|
|
25789
26173
|
paginate as paginate5,
|
|
@@ -25865,7 +26249,7 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
25865
26249
|
}
|
|
25866
26250
|
};
|
|
25867
26251
|
} catch (error) {
|
|
25868
|
-
|
|
26252
|
+
getLogger11("domain:orchestrate").error(
|
|
25869
26253
|
{ operation: "classify", err: error },
|
|
25870
26254
|
error instanceof Error ? error.message : String(error)
|
|
25871
26255
|
);
|
|
@@ -25940,7 +26324,7 @@ async function orchestrateFanout(items, projectRoot) {
|
|
|
25940
26324
|
}
|
|
25941
26325
|
};
|
|
25942
26326
|
} catch (error) {
|
|
25943
|
-
|
|
26327
|
+
getLogger11("domain:orchestrate").error(
|
|
25944
26328
|
{ operation: "fanout", err: error },
|
|
25945
26329
|
error instanceof Error ? error.message : String(error)
|
|
25946
26330
|
);
|
|
@@ -26017,7 +26401,7 @@ async function orchestrateAnalyzeParallelSafety(taskIds, projectRoot) {
|
|
|
26017
26401
|
}
|
|
26018
26402
|
};
|
|
26019
26403
|
} catch (error) {
|
|
26020
|
-
|
|
26404
|
+
getLogger11("domain:orchestrate").error(
|
|
26021
26405
|
{ operation: "analyze/parallel-safety", err: error },
|
|
26022
26406
|
error instanceof Error ? error.message : String(error)
|
|
26023
26407
|
);
|
|
@@ -26043,7 +26427,7 @@ async function handlePendingApprovals(startTime) {
|
|
|
26043
26427
|
}
|
|
26044
26428
|
};
|
|
26045
26429
|
} catch (error) {
|
|
26046
|
-
|
|
26430
|
+
getLogger11("domain:orchestrate").error(
|
|
26047
26431
|
{ operation: "pending", err: error },
|
|
26048
26432
|
error instanceof Error ? error.message : String(error)
|
|
26049
26433
|
);
|
|
@@ -26126,7 +26510,7 @@ async function handleApproveGate(params, startTime) {
|
|
|
26126
26510
|
startTime
|
|
26127
26511
|
);
|
|
26128
26512
|
}
|
|
26129
|
-
|
|
26513
|
+
getLogger11("domain:orchestrate").error({ operation: "approve", err: error }, message);
|
|
26130
26514
|
return handleErrorResult("mutate", "orchestrate", "approve", error, startTime);
|
|
26131
26515
|
}
|
|
26132
26516
|
}
|
|
@@ -26216,7 +26600,7 @@ async function handleRejectGate(params, startTime) {
|
|
|
26216
26600
|
startTime
|
|
26217
26601
|
);
|
|
26218
26602
|
}
|
|
26219
|
-
|
|
26603
|
+
getLogger11("domain:orchestrate").error({ operation: "reject", err: error }, message);
|
|
26220
26604
|
return handleErrorResult("mutate", "orchestrate", "reject", error, startTime);
|
|
26221
26605
|
}
|
|
26222
26606
|
}
|
|
@@ -26230,7 +26614,7 @@ async function handleWorktreeComplete(taskId, projectRoot, startTime) {
|
|
|
26230
26614
|
data: result
|
|
26231
26615
|
};
|
|
26232
26616
|
} catch (error) {
|
|
26233
|
-
|
|
26617
|
+
getLogger11("domain:orchestrate").error(
|
|
26234
26618
|
{ operation: "worktree.complete", taskId, err: error },
|
|
26235
26619
|
error instanceof Error ? error.message : String(error)
|
|
26236
26620
|
);
|
|
@@ -26248,7 +26632,7 @@ async function handleWorktreeCleanup(projectRoot, taskIds, startTime) {
|
|
|
26248
26632
|
data: result
|
|
26249
26633
|
};
|
|
26250
26634
|
} catch (error) {
|
|
26251
|
-
|
|
26635
|
+
getLogger11("domain:orchestrate").error(
|
|
26252
26636
|
{ operation: "worktree.cleanup", err: error },
|
|
26253
26637
|
error instanceof Error ? error.message : String(error)
|
|
26254
26638
|
);
|
|
@@ -26272,7 +26656,7 @@ var init_orchestrate2 = __esm({
|
|
|
26272
26656
|
// DomainHandler interface
|
|
26273
26657
|
// -----------------------------------------------------------------------
|
|
26274
26658
|
async query(operation, params) {
|
|
26275
|
-
const projectRoot =
|
|
26659
|
+
const projectRoot = getProjectRoot9();
|
|
26276
26660
|
const startTime = Date.now();
|
|
26277
26661
|
try {
|
|
26278
26662
|
switch (operation) {
|
|
@@ -26482,7 +26866,7 @@ var init_orchestrate2 = __esm({
|
|
|
26482
26866
|
);
|
|
26483
26867
|
}
|
|
26484
26868
|
} catch (error) {
|
|
26485
|
-
|
|
26869
|
+
getLogger11("domain:orchestrate").error(
|
|
26486
26870
|
{ gateway: "query", domain: "orchestrate", operation, err: error },
|
|
26487
26871
|
error instanceof Error ? error.message : String(error)
|
|
26488
26872
|
);
|
|
@@ -26490,7 +26874,7 @@ var init_orchestrate2 = __esm({
|
|
|
26490
26874
|
}
|
|
26491
26875
|
}
|
|
26492
26876
|
async mutate(operation, params) {
|
|
26493
|
-
const projectRoot =
|
|
26877
|
+
const projectRoot = getProjectRoot9();
|
|
26494
26878
|
const startTime = Date.now();
|
|
26495
26879
|
try {
|
|
26496
26880
|
switch (operation) {
|
|
@@ -26771,7 +27155,7 @@ var init_orchestrate2 = __esm({
|
|
|
26771
27155
|
);
|
|
26772
27156
|
}
|
|
26773
27157
|
} catch (error) {
|
|
26774
|
-
|
|
27158
|
+
getLogger11("domain:orchestrate").error(
|
|
26775
27159
|
{ gateway: "mutate", domain: "orchestrate", operation, err: error },
|
|
26776
27160
|
error instanceof Error ? error.message : String(error)
|
|
26777
27161
|
);
|
|
@@ -26840,8 +27224,8 @@ import {
|
|
|
26840
27224
|
createInstance,
|
|
26841
27225
|
describeChannel,
|
|
26842
27226
|
formatStageGuidance,
|
|
26843
|
-
getLogger as
|
|
26844
|
-
getProjectRoot as
|
|
27227
|
+
getLogger as getLogger12,
|
|
27228
|
+
getProjectRoot as getProjectRoot10,
|
|
26845
27229
|
isValidStage,
|
|
26846
27230
|
listChains,
|
|
26847
27231
|
paginate as paginate6,
|
|
@@ -26857,7 +27241,7 @@ var init_pipeline2 = __esm({
|
|
|
26857
27241
|
init_meta2();
|
|
26858
27242
|
PipelineHandler = class {
|
|
26859
27243
|
get projectRoot() {
|
|
26860
|
-
return
|
|
27244
|
+
return getProjectRoot10();
|
|
26861
27245
|
}
|
|
26862
27246
|
// -----------------------------------------------------------------------
|
|
26863
27247
|
// DomainHandler interface
|
|
@@ -26889,7 +27273,7 @@ var init_pipeline2 = __esm({
|
|
|
26889
27273
|
startTime
|
|
26890
27274
|
);
|
|
26891
27275
|
} catch (error) {
|
|
26892
|
-
|
|
27276
|
+
getLogger12("domain:pipeline").error(
|
|
26893
27277
|
{ gateway: "query", domain: "pipeline", operation, err: error },
|
|
26894
27278
|
error instanceof Error ? error.message : String(error)
|
|
26895
27279
|
);
|
|
@@ -26923,7 +27307,7 @@ var init_pipeline2 = __esm({
|
|
|
26923
27307
|
startTime
|
|
26924
27308
|
);
|
|
26925
27309
|
} catch (error) {
|
|
26926
|
-
|
|
27310
|
+
getLogger12("domain:pipeline").error(
|
|
26927
27311
|
{ gateway: "mutate", domain: "pipeline", operation, err: error },
|
|
26928
27312
|
error instanceof Error ? error.message : String(error)
|
|
26929
27313
|
);
|
|
@@ -27800,7 +28184,7 @@ var init_pipeline2 = __esm({
|
|
|
27800
28184
|
|
|
27801
28185
|
// packages/cleo/src/dispatch/domains/sentient.ts
|
|
27802
28186
|
import { join as join5 } from "node:path";
|
|
27803
|
-
import { getProjectRoot as
|
|
28187
|
+
import { getProjectRoot as getProjectRoot11 } from "@cleocode/core";
|
|
27804
28188
|
function safeParseJsonArray(json2) {
|
|
27805
28189
|
if (!json2) return [];
|
|
27806
28190
|
try {
|
|
@@ -27869,7 +28253,7 @@ var init_sentient = __esm({
|
|
|
27869
28253
|
// -----------------------------------------------------------------------
|
|
27870
28254
|
async query(operation, params) {
|
|
27871
28255
|
const startTime = Date.now();
|
|
27872
|
-
const projectRoot =
|
|
28256
|
+
const projectRoot = getProjectRoot11();
|
|
27873
28257
|
try {
|
|
27874
28258
|
switch (operation) {
|
|
27875
28259
|
case "propose.list": {
|
|
@@ -27919,7 +28303,7 @@ var init_sentient = __esm({
|
|
|
27919
28303
|
// -----------------------------------------------------------------------
|
|
27920
28304
|
async mutate(operation, params) {
|
|
27921
28305
|
const startTime = Date.now();
|
|
27922
|
-
const projectRoot =
|
|
28306
|
+
const projectRoot = getProjectRoot11();
|
|
27923
28307
|
try {
|
|
27924
28308
|
switch (operation) {
|
|
27925
28309
|
case "propose.accept": {
|
|
@@ -28195,6 +28579,13 @@ var init_typed = __esm({
|
|
|
28195
28579
|
});
|
|
28196
28580
|
|
|
28197
28581
|
// packages/cleo/src/dispatch/context/session-context.ts
|
|
28582
|
+
function resolveActivePeerId() {
|
|
28583
|
+
const envPeerId = process.env["CLEO_AGENT_PEER_ID"] ?? process.env["CLEO_AGENT_ID"] ?? null;
|
|
28584
|
+
if (envPeerId && envPeerId.trim().length > 0) {
|
|
28585
|
+
return envPeerId.trim();
|
|
28586
|
+
}
|
|
28587
|
+
return GLOBAL_PEER_ID;
|
|
28588
|
+
}
|
|
28198
28589
|
function bindSession(ctx) {
|
|
28199
28590
|
if (_context) {
|
|
28200
28591
|
throw new Error(
|
|
@@ -28204,7 +28595,8 @@ function bindSession(ctx) {
|
|
|
28204
28595
|
_context = {
|
|
28205
28596
|
...ctx,
|
|
28206
28597
|
agentPid: process.pid,
|
|
28207
|
-
boundAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
28598
|
+
boundAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
28599
|
+
activePeerId: ctx.activePeerId ?? resolveActivePeerId()
|
|
28208
28600
|
};
|
|
28209
28601
|
return _context;
|
|
28210
28602
|
}
|
|
@@ -28216,16 +28608,17 @@ function unbindSession() {
|
|
|
28216
28608
|
_context = null;
|
|
28217
28609
|
return prev;
|
|
28218
28610
|
}
|
|
28219
|
-
var _context;
|
|
28611
|
+
var _context, GLOBAL_PEER_ID;
|
|
28220
28612
|
var init_session_context = __esm({
|
|
28221
28613
|
"packages/cleo/src/dispatch/context/session-context.ts"() {
|
|
28222
28614
|
"use strict";
|
|
28223
28615
|
_context = null;
|
|
28616
|
+
GLOBAL_PEER_ID = "global";
|
|
28224
28617
|
}
|
|
28225
28618
|
});
|
|
28226
28619
|
|
|
28227
28620
|
// packages/cleo/src/dispatch/domains/session.ts
|
|
28228
|
-
import { getDb, getLogger as
|
|
28621
|
+
import { getDb, getLogger as getLogger13, getProjectRoot as getProjectRoot12, sessions } from "@cleocode/core/internal";
|
|
28229
28622
|
import { eq } from "drizzle-orm";
|
|
28230
28623
|
function envelopeToEngineResult(envelope) {
|
|
28231
28624
|
if (envelope.success) {
|
|
@@ -28256,7 +28649,7 @@ var init_session3 = __esm({
|
|
|
28256
28649
|
// Query ops
|
|
28257
28650
|
// -------------------------------------------------------------------------
|
|
28258
28651
|
status: async (_params) => {
|
|
28259
|
-
const projectRoot =
|
|
28652
|
+
const projectRoot = getProjectRoot12();
|
|
28260
28653
|
const result = await sessionStatus(projectRoot);
|
|
28261
28654
|
if (!result.success) {
|
|
28262
28655
|
return lafsError(
|
|
@@ -28271,7 +28664,7 @@ var init_session3 = __esm({
|
|
|
28271
28664
|
);
|
|
28272
28665
|
},
|
|
28273
28666
|
list: async (params) => {
|
|
28274
|
-
const projectRoot =
|
|
28667
|
+
const projectRoot = getProjectRoot12();
|
|
28275
28668
|
const result = await sessionList(projectRoot, {
|
|
28276
28669
|
active: params.active,
|
|
28277
28670
|
status: params.status,
|
|
@@ -28289,7 +28682,7 @@ var init_session3 = __esm({
|
|
|
28289
28682
|
},
|
|
28290
28683
|
// session.show absorbs debrief.show via include param (T5615)
|
|
28291
28684
|
show: async (params) => {
|
|
28292
|
-
const projectRoot =
|
|
28685
|
+
const projectRoot = getProjectRoot12();
|
|
28293
28686
|
if (!params.sessionId) {
|
|
28294
28687
|
return lafsError("E_INVALID_INPUT", "sessionId is required", "show");
|
|
28295
28688
|
}
|
|
@@ -28318,7 +28711,7 @@ var init_session3 = __esm({
|
|
|
28318
28711
|
return lafsSuccess(result.data, "show");
|
|
28319
28712
|
},
|
|
28320
28713
|
find: async (params) => {
|
|
28321
|
-
const projectRoot =
|
|
28714
|
+
const projectRoot = getProjectRoot12();
|
|
28322
28715
|
const result = await sessionFind(projectRoot, {
|
|
28323
28716
|
status: params.status,
|
|
28324
28717
|
scope: params.scope,
|
|
@@ -28335,7 +28728,7 @@ var init_session3 = __esm({
|
|
|
28335
28728
|
return lafsSuccess({ sessions: result.data ?? [] }, "find");
|
|
28336
28729
|
},
|
|
28337
28730
|
"decision.log": async (params) => {
|
|
28338
|
-
const projectRoot =
|
|
28731
|
+
const projectRoot = getProjectRoot12();
|
|
28339
28732
|
const result = await sessionDecisionLog(projectRoot, {
|
|
28340
28733
|
sessionId: params.sessionId,
|
|
28341
28734
|
taskId: params.taskId
|
|
@@ -28350,7 +28743,7 @@ var init_session3 = __esm({
|
|
|
28350
28743
|
return lafsSuccess(result.data ?? [], "decision.log");
|
|
28351
28744
|
},
|
|
28352
28745
|
"context.drift": async (params) => {
|
|
28353
|
-
const projectRoot =
|
|
28746
|
+
const projectRoot = getProjectRoot12();
|
|
28354
28747
|
const result = await sessionContextDrift(projectRoot, { sessionId: params.sessionId });
|
|
28355
28748
|
if (!result.success) {
|
|
28356
28749
|
return lafsError(
|
|
@@ -28365,7 +28758,7 @@ var init_session3 = __esm({
|
|
|
28365
28758
|
return lafsSuccess(result.data, "context.drift");
|
|
28366
28759
|
},
|
|
28367
28760
|
"handoff.show": async (params) => {
|
|
28368
|
-
const projectRoot =
|
|
28761
|
+
const projectRoot = getProjectRoot12();
|
|
28369
28762
|
let scopeFilter;
|
|
28370
28763
|
if (params.scope) {
|
|
28371
28764
|
if (params.scope === "global") {
|
|
@@ -28385,7 +28778,7 @@ var init_session3 = __esm({
|
|
|
28385
28778
|
return lafsSuccess(result.data ?? null, "handoff.show");
|
|
28386
28779
|
},
|
|
28387
28780
|
"briefing.show": async (params) => {
|
|
28388
|
-
const projectRoot =
|
|
28781
|
+
const projectRoot = getProjectRoot12();
|
|
28389
28782
|
const result = await sessionBriefing(projectRoot, {
|
|
28390
28783
|
maxNextTasks: params.maxNextTasks,
|
|
28391
28784
|
maxBugs: params.maxBugs,
|
|
@@ -28406,7 +28799,7 @@ var init_session3 = __esm({
|
|
|
28406
28799
|
// Mutate ops
|
|
28407
28800
|
// -------------------------------------------------------------------------
|
|
28408
28801
|
start: async (params) => {
|
|
28409
|
-
const projectRoot =
|
|
28802
|
+
const projectRoot = getProjectRoot12();
|
|
28410
28803
|
if (!params.scope) {
|
|
28411
28804
|
return lafsError("E_INVALID_INPUT", "scope is required", "start");
|
|
28412
28805
|
}
|
|
@@ -28433,7 +28826,7 @@ var init_session3 = __esm({
|
|
|
28433
28826
|
try {
|
|
28434
28827
|
await storeSessionOwnerAuthToken(projectRoot, sessionId, params.ownerAuthToken);
|
|
28435
28828
|
} catch (err) {
|
|
28436
|
-
|
|
28829
|
+
getLogger13("domain:session").warn(
|
|
28437
28830
|
{ sessionId, err },
|
|
28438
28831
|
"Failed to store owner_auth_token \u2014 override auth will not be available"
|
|
28439
28832
|
);
|
|
@@ -28451,7 +28844,7 @@ var init_session3 = __esm({
|
|
|
28451
28844
|
gradeMode: params.grade ?? false
|
|
28452
28845
|
});
|
|
28453
28846
|
} catch {
|
|
28454
|
-
|
|
28847
|
+
getLogger13("domain:session").warn(
|
|
28455
28848
|
{ sessionId },
|
|
28456
28849
|
"Session context already bound, skipping bindSession"
|
|
28457
28850
|
);
|
|
@@ -28459,7 +28852,7 @@ var init_session3 = __esm({
|
|
|
28459
28852
|
return lafsSuccess(sessionData, "start");
|
|
28460
28853
|
},
|
|
28461
28854
|
end: async (params) => {
|
|
28462
|
-
const projectRoot =
|
|
28855
|
+
const projectRoot = getProjectRoot12();
|
|
28463
28856
|
const endResult = await sessionEnd(projectRoot, params.note, {
|
|
28464
28857
|
sessionSummary: params.sessionSummary
|
|
28465
28858
|
});
|
|
@@ -28509,7 +28902,7 @@ var init_session3 = __esm({
|
|
|
28509
28902
|
return lafsSuccess(endResult.data, "end");
|
|
28510
28903
|
},
|
|
28511
28904
|
resume: async (params) => {
|
|
28512
|
-
const projectRoot =
|
|
28905
|
+
const projectRoot = getProjectRoot12();
|
|
28513
28906
|
if (!params.sessionId) {
|
|
28514
28907
|
return lafsError("E_INVALID_INPUT", "sessionId is required", "resume");
|
|
28515
28908
|
}
|
|
@@ -28527,7 +28920,7 @@ var init_session3 = __esm({
|
|
|
28527
28920
|
return lafsSuccess(result.data, "resume");
|
|
28528
28921
|
},
|
|
28529
28922
|
suspend: async (params) => {
|
|
28530
|
-
const projectRoot =
|
|
28923
|
+
const projectRoot = getProjectRoot12();
|
|
28531
28924
|
if (!params.sessionId) {
|
|
28532
28925
|
return lafsError("E_INVALID_INPUT", "sessionId is required", "suspend");
|
|
28533
28926
|
}
|
|
@@ -28545,7 +28938,7 @@ var init_session3 = __esm({
|
|
|
28545
28938
|
return lafsSuccess(result.data, "suspend");
|
|
28546
28939
|
},
|
|
28547
28940
|
gc: async (params) => {
|
|
28548
|
-
const projectRoot =
|
|
28941
|
+
const projectRoot = getProjectRoot12();
|
|
28549
28942
|
const result = await sessionGc(projectRoot, params.maxAgeDays);
|
|
28550
28943
|
if (!result.success) {
|
|
28551
28944
|
return lafsError(
|
|
@@ -28557,7 +28950,7 @@ var init_session3 = __esm({
|
|
|
28557
28950
|
return lafsSuccess(result.data ?? { orphaned: [], removed: [] }, "gc");
|
|
28558
28951
|
},
|
|
28559
28952
|
"record.decision": async (params) => {
|
|
28560
|
-
const projectRoot =
|
|
28953
|
+
const projectRoot = getProjectRoot12();
|
|
28561
28954
|
const result = await sessionRecordDecision(projectRoot, {
|
|
28562
28955
|
sessionId: params.sessionId,
|
|
28563
28956
|
taskId: params.taskId,
|
|
@@ -28578,7 +28971,7 @@ var init_session3 = __esm({
|
|
|
28578
28971
|
return lafsSuccess(result.data, "record.decision");
|
|
28579
28972
|
},
|
|
28580
28973
|
"record.assumption": async (params) => {
|
|
28581
|
-
const projectRoot =
|
|
28974
|
+
const projectRoot = getProjectRoot12();
|
|
28582
28975
|
const result = await sessionRecordAssumption(projectRoot, {
|
|
28583
28976
|
sessionId: params.sessionId,
|
|
28584
28977
|
taskId: params.taskId,
|
|
@@ -28640,7 +29033,7 @@ var init_session3 = __esm({
|
|
|
28640
29033
|
);
|
|
28641
29034
|
return wrapResult(envelopeToEngineResult(envelope), "query", "session", operation, startTime);
|
|
28642
29035
|
} catch (error) {
|
|
28643
|
-
|
|
29036
|
+
getLogger13("domain:session").error(
|
|
28644
29037
|
{ gateway: "query", domain: "session", operation, err: error },
|
|
28645
29038
|
error instanceof Error ? error.message : String(error)
|
|
28646
29039
|
);
|
|
@@ -28675,7 +29068,7 @@ var init_session3 = __esm({
|
|
|
28675
29068
|
startTime
|
|
28676
29069
|
);
|
|
28677
29070
|
} catch (error) {
|
|
28678
|
-
|
|
29071
|
+
getLogger13("domain:session").error(
|
|
28679
29072
|
{ gateway: "mutate", domain: "session", operation, err: error },
|
|
28680
29073
|
error instanceof Error ? error.message : String(error)
|
|
28681
29074
|
);
|
|
@@ -28818,7 +29211,7 @@ var init_sticky_engine = __esm({
|
|
|
28818
29211
|
});
|
|
28819
29212
|
|
|
28820
29213
|
// packages/cleo/src/dispatch/domains/sticky.ts
|
|
28821
|
-
import { getLogger as
|
|
29214
|
+
import { getLogger as getLogger14, getProjectRoot as getProjectRoot13, paginate as paginate7 } from "@cleocode/core";
|
|
28822
29215
|
var StickyHandler;
|
|
28823
29216
|
var init_sticky = __esm({
|
|
28824
29217
|
"packages/cleo/src/dispatch/domains/sticky.ts"() {
|
|
@@ -28831,7 +29224,7 @@ var init_sticky = __esm({
|
|
|
28831
29224
|
// Query
|
|
28832
29225
|
// -----------------------------------------------------------------------
|
|
28833
29226
|
async query(operation, params) {
|
|
28834
|
-
const projectRoot =
|
|
29227
|
+
const projectRoot = getProjectRoot13();
|
|
28835
29228
|
const startTime = Date.now();
|
|
28836
29229
|
try {
|
|
28837
29230
|
switch (operation) {
|
|
@@ -28887,7 +29280,7 @@ var init_sticky = __esm({
|
|
|
28887
29280
|
}
|
|
28888
29281
|
} catch (error) {
|
|
28889
29282
|
const message = error instanceof Error ? error.message : String(error);
|
|
28890
|
-
|
|
29283
|
+
getLogger14("domain:sticky").error(
|
|
28891
29284
|
{ gateway: "query", domain: "sticky", operation, err: error },
|
|
28892
29285
|
message
|
|
28893
29286
|
);
|
|
@@ -28898,7 +29291,7 @@ var init_sticky = __esm({
|
|
|
28898
29291
|
// Mutate
|
|
28899
29292
|
// -----------------------------------------------------------------------
|
|
28900
29293
|
async mutate(operation, params) {
|
|
28901
|
-
const projectRoot =
|
|
29294
|
+
const projectRoot = getProjectRoot13();
|
|
28902
29295
|
const startTime = Date.now();
|
|
28903
29296
|
try {
|
|
28904
29297
|
switch (operation) {
|
|
@@ -29017,7 +29410,7 @@ var init_sticky = __esm({
|
|
|
29017
29410
|
}
|
|
29018
29411
|
} catch (error) {
|
|
29019
29412
|
const message = error instanceof Error ? error.message : String(error);
|
|
29020
|
-
|
|
29413
|
+
getLogger14("domain:sticky").error(
|
|
29021
29414
|
{ gateway: "mutate", domain: "sticky", operation, err: error },
|
|
29022
29415
|
message
|
|
29023
29416
|
);
|
|
@@ -29038,7 +29431,7 @@ var init_sticky = __esm({
|
|
|
29038
29431
|
});
|
|
29039
29432
|
|
|
29040
29433
|
// packages/cleo/src/dispatch/domains/tasks.ts
|
|
29041
|
-
import { getLogger as
|
|
29434
|
+
import { getLogger as getLogger15, getProjectRoot as getProjectRoot14 } from "@cleocode/core";
|
|
29042
29435
|
var TasksHandler;
|
|
29043
29436
|
var init_tasks3 = __esm({
|
|
29044
29437
|
"packages/cleo/src/dispatch/domains/tasks.ts"() {
|
|
@@ -29050,7 +29443,7 @@ var init_tasks3 = __esm({
|
|
|
29050
29443
|
// Query
|
|
29051
29444
|
// -----------------------------------------------------------------------
|
|
29052
29445
|
async query(operation, params) {
|
|
29053
|
-
const projectRoot =
|
|
29446
|
+
const projectRoot = getProjectRoot14();
|
|
29054
29447
|
const startTime = Date.now();
|
|
29055
29448
|
try {
|
|
29056
29449
|
switch (operation) {
|
|
@@ -29220,7 +29613,7 @@ var init_tasks3 = __esm({
|
|
|
29220
29613
|
return unsupportedOp("query", "tasks", operation, startTime);
|
|
29221
29614
|
}
|
|
29222
29615
|
} catch (error) {
|
|
29223
|
-
|
|
29616
|
+
getLogger15("domain:tasks").error(
|
|
29224
29617
|
{ gateway: "query", domain: "tasks", operation, err: error },
|
|
29225
29618
|
error instanceof Error ? error.message : String(error)
|
|
29226
29619
|
);
|
|
@@ -29231,7 +29624,7 @@ var init_tasks3 = __esm({
|
|
|
29231
29624
|
// Mutate
|
|
29232
29625
|
// -----------------------------------------------------------------------
|
|
29233
29626
|
async mutate(operation, params) {
|
|
29234
|
-
const projectRoot =
|
|
29627
|
+
const projectRoot = getProjectRoot14();
|
|
29235
29628
|
const startTime = Date.now();
|
|
29236
29629
|
try {
|
|
29237
29630
|
switch (operation) {
|
|
@@ -29470,7 +29863,7 @@ var init_tasks3 = __esm({
|
|
|
29470
29863
|
return unsupportedOp("mutate", "tasks", operation, startTime);
|
|
29471
29864
|
}
|
|
29472
29865
|
} catch (error) {
|
|
29473
|
-
|
|
29866
|
+
getLogger15("domain:tasks").error(
|
|
29474
29867
|
{ gateway: "mutate", domain: "tasks", operation, err: error },
|
|
29475
29868
|
error instanceof Error ? error.message : String(error)
|
|
29476
29869
|
);
|
|
@@ -29526,7 +29919,7 @@ var init_tasks3 = __esm({
|
|
|
29526
29919
|
|
|
29527
29920
|
// packages/cleo/src/dispatch/engines/code-engine.ts
|
|
29528
29921
|
import { join as join6 } from "node:path";
|
|
29529
|
-
import { getProjectRoot as
|
|
29922
|
+
import { getProjectRoot as getProjectRoot15 } from "@cleocode/core";
|
|
29530
29923
|
async function codeOutline(params) {
|
|
29531
29924
|
const { smartOutline } = await import("@cleocode/core/internal");
|
|
29532
29925
|
const filePath = params?.file;
|
|
@@ -29535,7 +29928,7 @@ async function codeOutline(params) {
|
|
|
29535
29928
|
success: false,
|
|
29536
29929
|
error: { code: "E_INVALID_INPUT", message: "file parameter required" }
|
|
29537
29930
|
};
|
|
29538
|
-
const root =
|
|
29931
|
+
const root = getProjectRoot15();
|
|
29539
29932
|
const absPath = filePath.startsWith("/") ? filePath : join6(root, filePath);
|
|
29540
29933
|
return { success: true, data: smartOutline(absPath, root) };
|
|
29541
29934
|
}
|
|
@@ -29547,7 +29940,7 @@ async function codeSearch(params) {
|
|
|
29547
29940
|
success: false,
|
|
29548
29941
|
error: { code: "E_INVALID_INPUT", message: "query parameter required" }
|
|
29549
29942
|
};
|
|
29550
|
-
const root =
|
|
29943
|
+
const root = getProjectRoot15();
|
|
29551
29944
|
const opts = {
|
|
29552
29945
|
rootDir: root,
|
|
29553
29946
|
maxResults: params?.max ?? 20,
|
|
@@ -29567,7 +29960,7 @@ async function codeUnfold(params) {
|
|
|
29567
29960
|
success: false,
|
|
29568
29961
|
error: { code: "E_INVALID_INPUT", message: "file and symbol parameters required" }
|
|
29569
29962
|
};
|
|
29570
|
-
const root =
|
|
29963
|
+
const root = getProjectRoot15();
|
|
29571
29964
|
const absPath = filePath.startsWith("/") ? filePath : join6(root, filePath);
|
|
29572
29965
|
return { success: true, data: smartUnfold(absPath, symbol, root) };
|
|
29573
29966
|
}
|
|
@@ -29579,7 +29972,7 @@ async function codeParse(params) {
|
|
|
29579
29972
|
success: false,
|
|
29580
29973
|
error: { code: "E_INVALID_INPUT", message: "file parameter required" }
|
|
29581
29974
|
};
|
|
29582
|
-
const root =
|
|
29975
|
+
const root = getProjectRoot15();
|
|
29583
29976
|
const absPath = filePath.startsWith("/") ? filePath : join6(root, filePath);
|
|
29584
29977
|
return { success: true, data: parseFile(absPath, root) };
|
|
29585
29978
|
}
|
|
@@ -30111,7 +30504,7 @@ var init_tools_engine = __esm({
|
|
|
30111
30504
|
});
|
|
30112
30505
|
|
|
30113
30506
|
// packages/cleo/src/dispatch/domains/tools.ts
|
|
30114
|
-
import { getLogger as
|
|
30507
|
+
import { getLogger as getLogger16, getProjectRoot as getProjectRoot16 } from "@cleocode/core";
|
|
30115
30508
|
var ToolsHandler;
|
|
30116
30509
|
var init_tools = __esm({
|
|
30117
30510
|
"packages/cleo/src/dispatch/domains/tools.ts"() {
|
|
@@ -30123,7 +30516,7 @@ var init_tools = __esm({
|
|
|
30123
30516
|
init_routing();
|
|
30124
30517
|
ToolsHandler = class {
|
|
30125
30518
|
get projectRoot() {
|
|
30126
|
-
return
|
|
30519
|
+
return getProjectRoot16();
|
|
30127
30520
|
}
|
|
30128
30521
|
// -----------------------------------------------------------------------
|
|
30129
30522
|
// DomainHandler interface
|
|
@@ -30636,7 +31029,7 @@ var init_tools = __esm({
|
|
|
30636
31029
|
// -----------------------------------------------------------------------
|
|
30637
31030
|
handleError(gateway, domain, operation, error, startTime) {
|
|
30638
31031
|
const message = error instanceof Error ? error.message : String(error);
|
|
30639
|
-
|
|
31032
|
+
getLogger16("domain:tools").error({ gateway, domain, operation, err: error }, message);
|
|
30640
31033
|
return handleErrorResult(gateway, domain, operation, error, startTime);
|
|
30641
31034
|
}
|
|
30642
31035
|
};
|
|
@@ -30922,7 +31315,7 @@ var init_config = __esm({
|
|
|
30922
31315
|
});
|
|
30923
31316
|
|
|
30924
31317
|
// packages/cleo/src/dispatch/middleware/audit.ts
|
|
30925
|
-
import { getLogger as
|
|
31318
|
+
import { getLogger as getLogger17, getProjectInfoSync } from "@cleocode/core/internal";
|
|
30926
31319
|
import { queryAudit } from "@cleocode/core/internal";
|
|
30927
31320
|
function resolveProjectHash() {
|
|
30928
31321
|
if (cachedProjectHash !== void 0) return cachedProjectHash;
|
|
@@ -31044,7 +31437,7 @@ var init_audit = __esm({
|
|
|
31044
31437
|
"packages/cleo/src/dispatch/middleware/audit.ts"() {
|
|
31045
31438
|
"use strict";
|
|
31046
31439
|
init_config();
|
|
31047
|
-
log2 =
|
|
31440
|
+
log2 = getLogger17("audit");
|
|
31048
31441
|
}
|
|
31049
31442
|
});
|
|
31050
31443
|
|
|
@@ -31119,11 +31512,11 @@ var init_security = __esm({
|
|
|
31119
31512
|
});
|
|
31120
31513
|
|
|
31121
31514
|
// packages/cleo/src/dispatch/middleware/sanitizer.ts
|
|
31122
|
-
function createSanitizer(
|
|
31515
|
+
function createSanitizer(getProjectRoot29) {
|
|
31123
31516
|
return async (req, next) => {
|
|
31124
31517
|
if (req.params) {
|
|
31125
31518
|
try {
|
|
31126
|
-
const root =
|
|
31519
|
+
const root = getProjectRoot29 ? getProjectRoot29() : void 0;
|
|
31127
31520
|
req.params = sanitizeParams(req.params, root, {
|
|
31128
31521
|
domain: req.domain,
|
|
31129
31522
|
operation: req.operation
|
|
@@ -31248,7 +31641,7 @@ import { createRequire as createRequire2 } from "node:module";
|
|
|
31248
31641
|
import { dirname as dirname3, join as join8 } from "node:path";
|
|
31249
31642
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
31250
31643
|
import { catalog as catalog2, registerSkillLibraryFromPath } from "@cleocode/caamp";
|
|
31251
|
-
import { autoRecordDispatchTokenUsage, getProjectRoot as
|
|
31644
|
+
import { autoRecordDispatchTokenUsage, getProjectRoot as getProjectRoot17, hooks } from "@cleocode/core/internal";
|
|
31252
31645
|
function ensureCaampLibrary() {
|
|
31253
31646
|
if (catalog2.isCatalogAvailable()) return;
|
|
31254
31647
|
try {
|
|
@@ -31299,7 +31692,7 @@ function createCliDispatcher() {
|
|
|
31299
31692
|
middlewares: [
|
|
31300
31693
|
createSessionResolver(lookupCliSession),
|
|
31301
31694
|
// T4959: session identity first
|
|
31302
|
-
createSanitizer(() =>
|
|
31695
|
+
createSanitizer(() => getProjectRoot17()),
|
|
31303
31696
|
createFieldFilter(),
|
|
31304
31697
|
createAudit(),
|
|
31305
31698
|
// T4959: CLI now gets audit trail
|
|
@@ -31313,7 +31706,7 @@ function resetCliDispatcher() {
|
|
|
31313
31706
|
}
|
|
31314
31707
|
async function dispatchFromCli(gateway, domain, operation, params, outputOpts) {
|
|
31315
31708
|
const dispatcher = getCliDispatcher();
|
|
31316
|
-
const projectRoot =
|
|
31709
|
+
const projectRoot = getProjectRoot17();
|
|
31317
31710
|
const dispatchStart = Date.now();
|
|
31318
31711
|
hooks.dispatch("PromptSubmit", projectRoot, {
|
|
31319
31712
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -31351,7 +31744,7 @@ async function dispatchFromCli(gateway, domain, operation, params, outputOpts) {
|
|
|
31351
31744
|
operation,
|
|
31352
31745
|
sessionId: response.meta.sessionId,
|
|
31353
31746
|
requestId: response.meta.requestId,
|
|
31354
|
-
cwd:
|
|
31747
|
+
cwd: getProjectRoot17()
|
|
31355
31748
|
});
|
|
31356
31749
|
const opts = {
|
|
31357
31750
|
command: outputOpts?.command ?? operation,
|
|
@@ -31410,7 +31803,7 @@ function handleRawError(response, _opts) {
|
|
|
31410
31803
|
}
|
|
31411
31804
|
async function dispatchRaw(gateway, domain, operation, params) {
|
|
31412
31805
|
const dispatcher = getCliDispatcher();
|
|
31413
|
-
const projectRoot =
|
|
31806
|
+
const projectRoot = getProjectRoot17();
|
|
31414
31807
|
const dispatchStart = Date.now();
|
|
31415
31808
|
hooks.dispatch("PromptSubmit", projectRoot, {
|
|
31416
31809
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -31494,8 +31887,8 @@ import {
|
|
|
31494
31887
|
ensureConduitDb,
|
|
31495
31888
|
ensureGlobalSignaldockDb as ensureGlobalSignaldockDb2,
|
|
31496
31889
|
getGlobalSalt,
|
|
31497
|
-
getLogger as
|
|
31498
|
-
getProjectRoot as
|
|
31890
|
+
getLogger as getLogger18,
|
|
31891
|
+
getProjectRoot as getProjectRoot28,
|
|
31499
31892
|
migrateSignaldockToConduit,
|
|
31500
31893
|
needsSignaldockToConduitMigration,
|
|
31501
31894
|
validateGlobalSalt
|
|
@@ -35864,7 +36257,7 @@ var archiveStatsCommand = defineCommand({
|
|
|
35864
36257
|
});
|
|
35865
36258
|
|
|
35866
36259
|
// packages/cleo/src/cli/commands/backfill.ts
|
|
35867
|
-
import { backfillTasks, getProjectRoot as
|
|
36260
|
+
import { backfillTasks, getProjectRoot as getProjectRoot18, populateEmbeddings } from "@cleocode/core/internal";
|
|
35868
36261
|
init_renderers();
|
|
35869
36262
|
var backfillCommand = defineCommand({
|
|
35870
36263
|
meta: {
|
|
@@ -35893,7 +36286,7 @@ var backfillCommand = defineCommand({
|
|
|
35893
36286
|
}
|
|
35894
36287
|
},
|
|
35895
36288
|
async run({ args }) {
|
|
35896
|
-
const root =
|
|
36289
|
+
const root = getProjectRoot18();
|
|
35897
36290
|
if (args.embeddings) {
|
|
35898
36291
|
try {
|
|
35899
36292
|
let lastLine = "";
|
|
@@ -36382,9 +36775,9 @@ var exportCommand = defineCommand({
|
|
|
36382
36775
|
},
|
|
36383
36776
|
async run({ args }) {
|
|
36384
36777
|
const scope = args.scope;
|
|
36385
|
-
const { packBundle, getProjectRoot:
|
|
36778
|
+
const { packBundle, getProjectRoot: getProjectRoot29 } = await import("@cleocode/core/internal");
|
|
36386
36779
|
const includesProject = scope === "project" || scope === "all";
|
|
36387
|
-
const projectRoot = includesProject ?
|
|
36780
|
+
const projectRoot = includesProject ? getProjectRoot29() : void 0;
|
|
36388
36781
|
let passphrase;
|
|
36389
36782
|
if (args.encrypt === true) {
|
|
36390
36783
|
passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
|
|
@@ -36712,7 +37105,7 @@ import {
|
|
|
36712
37105
|
exportBrainAsJson,
|
|
36713
37106
|
getMemoryQualityReport,
|
|
36714
37107
|
getPlasticityStats,
|
|
36715
|
-
getProjectRoot as
|
|
37108
|
+
getProjectRoot as getProjectRoot19,
|
|
36716
37109
|
purgeBrainNoise,
|
|
36717
37110
|
runBrainMaintenance
|
|
36718
37111
|
} from "@cleocode/core/internal";
|
|
@@ -36745,7 +37138,7 @@ var maintenanceCommand = defineCommand({
|
|
|
36745
37138
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
36746
37139
|
},
|
|
36747
37140
|
async run({ args }) {
|
|
36748
|
-
const root =
|
|
37141
|
+
const root = getProjectRoot19();
|
|
36749
37142
|
const isJson = !!args.json;
|
|
36750
37143
|
if (!isJson) {
|
|
36751
37144
|
console.log("Running brain maintenance...");
|
|
@@ -36825,7 +37218,7 @@ var backfillCommand2 = defineCommand({
|
|
|
36825
37218
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
36826
37219
|
},
|
|
36827
37220
|
async run({ args }) {
|
|
36828
|
-
const root =
|
|
37221
|
+
const root = getProjectRoot19();
|
|
36829
37222
|
const isJson = !!args.json;
|
|
36830
37223
|
if (!isJson) {
|
|
36831
37224
|
console.log("Running brain graph back-fill...");
|
|
@@ -36880,7 +37273,7 @@ var purgeCommand = defineCommand({
|
|
|
36880
37273
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
36881
37274
|
},
|
|
36882
37275
|
async run({ args }) {
|
|
36883
|
-
const root =
|
|
37276
|
+
const root = getProjectRoot19();
|
|
36884
37277
|
const isJson = !!args.json;
|
|
36885
37278
|
if (!isJson) {
|
|
36886
37279
|
console.log("Running brain noise purge...");
|
|
@@ -36938,7 +37331,7 @@ var plasticityStatsCommand = defineCommand({
|
|
|
36938
37331
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
36939
37332
|
},
|
|
36940
37333
|
async run({ args }) {
|
|
36941
|
-
const root =
|
|
37334
|
+
const root = getProjectRoot19();
|
|
36942
37335
|
const isJson = !!args.json;
|
|
36943
37336
|
const limit = Number.parseInt(args.limit, 10) || 20;
|
|
36944
37337
|
try {
|
|
@@ -37011,7 +37404,7 @@ var qualityCommand = defineCommand({
|
|
|
37011
37404
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
37012
37405
|
},
|
|
37013
37406
|
async run({ args }) {
|
|
37014
|
-
const root =
|
|
37407
|
+
const root = getProjectRoot19();
|
|
37015
37408
|
const isJson = !!args.json;
|
|
37016
37409
|
try {
|
|
37017
37410
|
const report = await getMemoryQualityReport(root);
|
|
@@ -37088,7 +37481,7 @@ var exportCommand2 = defineCommand({
|
|
|
37088
37481
|
}
|
|
37089
37482
|
},
|
|
37090
37483
|
async run({ args }) {
|
|
37091
|
-
const root =
|
|
37484
|
+
const root = getProjectRoot19();
|
|
37092
37485
|
const format = args.format ?? "gexf";
|
|
37093
37486
|
if (format !== "gexf" && format !== "json") {
|
|
37094
37487
|
console.error(`Invalid format: ${format}. Use 'gexf' or 'json'.`);
|
|
@@ -38692,6 +39085,132 @@ var sendCommand2 = defineCommand({
|
|
|
38692
39085
|
);
|
|
38693
39086
|
}
|
|
38694
39087
|
});
|
|
39088
|
+
var publishCommand = defineCommand({
|
|
39089
|
+
meta: {
|
|
39090
|
+
name: "publish",
|
|
39091
|
+
description: "Publish a message to a Conduit topic (A2A)"
|
|
39092
|
+
},
|
|
39093
|
+
args: {
|
|
39094
|
+
topic: {
|
|
39095
|
+
type: "string",
|
|
39096
|
+
description: 'Topic name to publish to (e.g. "epic-T1149.wave-T1253")',
|
|
39097
|
+
required: true
|
|
39098
|
+
},
|
|
39099
|
+
kind: {
|
|
39100
|
+
type: "string",
|
|
39101
|
+
description: "Message kind: message | request | notify | subscribe (default: message)",
|
|
39102
|
+
default: "message"
|
|
39103
|
+
},
|
|
39104
|
+
payload: {
|
|
39105
|
+
type: "string",
|
|
39106
|
+
description: "Structured JSON payload to attach (optional)"
|
|
39107
|
+
},
|
|
39108
|
+
content: {
|
|
39109
|
+
type: "string",
|
|
39110
|
+
description: "Message content (defaults to the payload JSON when omitted)"
|
|
39111
|
+
},
|
|
39112
|
+
"agent-id": {
|
|
39113
|
+
type: "string",
|
|
39114
|
+
description: "Publishing agent ID (defaults to active agent)",
|
|
39115
|
+
alias: "a"
|
|
39116
|
+
}
|
|
39117
|
+
},
|
|
39118
|
+
async run({ args }) {
|
|
39119
|
+
const content = args.content ?? args.payload ?? "{}";
|
|
39120
|
+
let parsedPayload;
|
|
39121
|
+
if (args.payload) {
|
|
39122
|
+
try {
|
|
39123
|
+
parsedPayload = JSON.parse(args.payload);
|
|
39124
|
+
} catch {
|
|
39125
|
+
parsedPayload = { raw: args.payload };
|
|
39126
|
+
}
|
|
39127
|
+
}
|
|
39128
|
+
await dispatchFromCli(
|
|
39129
|
+
"mutate",
|
|
39130
|
+
"conduit",
|
|
39131
|
+
"publish",
|
|
39132
|
+
{
|
|
39133
|
+
topicName: args.topic,
|
|
39134
|
+
kind: args.kind,
|
|
39135
|
+
content,
|
|
39136
|
+
payload: parsedPayload,
|
|
39137
|
+
agentId: args["agent-id"]
|
|
39138
|
+
},
|
|
39139
|
+
{ command: "conduit publish" }
|
|
39140
|
+
);
|
|
39141
|
+
}
|
|
39142
|
+
});
|
|
39143
|
+
var subscribeCommand = defineCommand({
|
|
39144
|
+
meta: {
|
|
39145
|
+
name: "subscribe",
|
|
39146
|
+
description: "Subscribe agent to a Conduit topic (A2A)"
|
|
39147
|
+
},
|
|
39148
|
+
args: {
|
|
39149
|
+
topic: {
|
|
39150
|
+
type: "string",
|
|
39151
|
+
description: 'Topic name to subscribe to (e.g. "epic-T1149.coordination")',
|
|
39152
|
+
required: true
|
|
39153
|
+
},
|
|
39154
|
+
"agent-id": {
|
|
39155
|
+
type: "string",
|
|
39156
|
+
description: "Agent ID to subscribe (defaults to active agent)",
|
|
39157
|
+
alias: "a"
|
|
39158
|
+
}
|
|
39159
|
+
},
|
|
39160
|
+
async run({ args }) {
|
|
39161
|
+
await dispatchFromCli(
|
|
39162
|
+
"mutate",
|
|
39163
|
+
"conduit",
|
|
39164
|
+
"subscribe",
|
|
39165
|
+
{
|
|
39166
|
+
topicName: args.topic,
|
|
39167
|
+
agentId: args["agent-id"]
|
|
39168
|
+
},
|
|
39169
|
+
{ command: "conduit subscribe" }
|
|
39170
|
+
);
|
|
39171
|
+
}
|
|
39172
|
+
});
|
|
39173
|
+
var listenCommand = defineCommand({
|
|
39174
|
+
meta: {
|
|
39175
|
+
name: "listen",
|
|
39176
|
+
description: "One-shot poll for messages on a Conduit topic (A2A)"
|
|
39177
|
+
},
|
|
39178
|
+
args: {
|
|
39179
|
+
topic: {
|
|
39180
|
+
type: "string",
|
|
39181
|
+
description: 'Topic name to poll (e.g. "epic-T1149.wave-T1253")',
|
|
39182
|
+
required: true
|
|
39183
|
+
},
|
|
39184
|
+
limit: {
|
|
39185
|
+
type: "string",
|
|
39186
|
+
description: "Max messages to return (default: 50)",
|
|
39187
|
+
default: "50"
|
|
39188
|
+
},
|
|
39189
|
+
since: {
|
|
39190
|
+
type: "string",
|
|
39191
|
+
description: "Return only messages after this ISO 8601 timestamp (optional)"
|
|
39192
|
+
},
|
|
39193
|
+
"agent-id": {
|
|
39194
|
+
type: "string",
|
|
39195
|
+
description: "Agent ID to poll as (defaults to active agent)",
|
|
39196
|
+
alias: "a"
|
|
39197
|
+
}
|
|
39198
|
+
},
|
|
39199
|
+
async run({ args }) {
|
|
39200
|
+
await dispatchFromCli(
|
|
39201
|
+
"query",
|
|
39202
|
+
"conduit",
|
|
39203
|
+
"listen",
|
|
39204
|
+
{
|
|
39205
|
+
topicName: args.topic,
|
|
39206
|
+
limit: Number.parseInt(args.limit, 10),
|
|
39207
|
+
since: args.since,
|
|
39208
|
+
agentId: args["agent-id"]
|
|
39209
|
+
},
|
|
39210
|
+
{ command: "conduit listen" }
|
|
39211
|
+
);
|
|
39212
|
+
}
|
|
39213
|
+
});
|
|
38695
39214
|
var conduitCommand = defineCommand({
|
|
38696
39215
|
meta: { name: "conduit", description: "Manage Conduit inter-agent messaging" },
|
|
38697
39216
|
subCommands: {
|
|
@@ -38699,7 +39218,10 @@ var conduitCommand = defineCommand({
|
|
|
38699
39218
|
peek: peekCommand,
|
|
38700
39219
|
start: startCommand2,
|
|
38701
39220
|
stop: stopCommand2,
|
|
38702
|
-
send: sendCommand2
|
|
39221
|
+
send: sendCommand2,
|
|
39222
|
+
publish: publishCommand,
|
|
39223
|
+
subscribe: subscribeCommand,
|
|
39224
|
+
listen: listenCommand
|
|
38703
39225
|
},
|
|
38704
39226
|
async run({ cmd, rawArgs }) {
|
|
38705
39227
|
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
@@ -40152,7 +40674,7 @@ import {
|
|
|
40152
40674
|
exportDocument,
|
|
40153
40675
|
formatError as formatError5,
|
|
40154
40676
|
getAgentOutputsAbsolute,
|
|
40155
|
-
getProjectRoot as
|
|
40677
|
+
getProjectRoot as getProjectRoot20,
|
|
40156
40678
|
listDocVersions,
|
|
40157
40679
|
mergeDocs,
|
|
40158
40680
|
publishDocs,
|
|
@@ -40441,7 +40963,7 @@ var exportCommand4 = defineCommand({
|
|
|
40441
40963
|
const taskId = String(args.task);
|
|
40442
40964
|
const includeAttachments = args["include-attachments"] !== false;
|
|
40443
40965
|
const includeMemoryRefs = args["include-memory-refs"] === true;
|
|
40444
|
-
const projectRoot =
|
|
40966
|
+
const projectRoot = getProjectRoot20();
|
|
40445
40967
|
try {
|
|
40446
40968
|
const result = await exportDocument({
|
|
40447
40969
|
taskId,
|
|
@@ -40505,7 +41027,7 @@ var searchCommand = defineCommand({
|
|
|
40505
41027
|
}
|
|
40506
41028
|
},
|
|
40507
41029
|
async run({ args }) {
|
|
40508
|
-
const projectRoot =
|
|
41030
|
+
const projectRoot = getProjectRoot20();
|
|
40509
41031
|
try {
|
|
40510
41032
|
const result = await searchDocs(String(args.query), {
|
|
40511
41033
|
ownerId: args.owner ?? void 0,
|
|
@@ -40557,7 +41079,7 @@ var mergeCommand = defineCommand({
|
|
|
40557
41079
|
}
|
|
40558
41080
|
},
|
|
40559
41081
|
async run({ args }) {
|
|
40560
|
-
const projectRoot =
|
|
41082
|
+
const projectRoot = getProjectRoot20();
|
|
40561
41083
|
const rawStrategy = args.strategy ?? "three-way";
|
|
40562
41084
|
const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
|
|
40563
41085
|
try {
|
|
@@ -40608,7 +41130,7 @@ var graphCommand = defineCommand({
|
|
|
40608
41130
|
}
|
|
40609
41131
|
},
|
|
40610
41132
|
async run({ args }) {
|
|
40611
|
-
const projectRoot =
|
|
41133
|
+
const projectRoot = getProjectRoot20();
|
|
40612
41134
|
const fmt = args.format ?? "mermaid";
|
|
40613
41135
|
try {
|
|
40614
41136
|
const result = await buildDocsGraph({ ownerId: String(args.for), projectRoot });
|
|
@@ -40679,7 +41201,7 @@ var rankCommand = defineCommand({
|
|
|
40679
41201
|
}
|
|
40680
41202
|
},
|
|
40681
41203
|
async run({ args }) {
|
|
40682
|
-
const projectRoot =
|
|
41204
|
+
const projectRoot = getProjectRoot20();
|
|
40683
41205
|
try {
|
|
40684
41206
|
const result = await rankDocs({
|
|
40685
41207
|
ownerId: String(args.for),
|
|
@@ -40718,7 +41240,7 @@ var versionsCommand = defineCommand({
|
|
|
40718
41240
|
}
|
|
40719
41241
|
},
|
|
40720
41242
|
async run({ args }) {
|
|
40721
|
-
const projectRoot =
|
|
41243
|
+
const projectRoot = getProjectRoot20();
|
|
40722
41244
|
try {
|
|
40723
41245
|
const result = await listDocVersions({
|
|
40724
41246
|
ownerId: String(args.for),
|
|
@@ -40736,7 +41258,7 @@ var versionsCommand = defineCommand({
|
|
|
40736
41258
|
}
|
|
40737
41259
|
}
|
|
40738
41260
|
});
|
|
40739
|
-
var
|
|
41261
|
+
var publishCommand2 = defineCommand({
|
|
40740
41262
|
meta: {
|
|
40741
41263
|
name: "publish",
|
|
40742
41264
|
description: "Atomically publish an attachment from the docs SSoT to a git-tracked file path. Uses tmp-then-rename for atomicity. The --to path may be absolute or relative to project root."
|
|
@@ -40762,7 +41284,7 @@ var publishCommand = defineCommand({
|
|
|
40762
41284
|
}
|
|
40763
41285
|
},
|
|
40764
41286
|
async run({ args }) {
|
|
40765
|
-
const projectRoot =
|
|
41287
|
+
const projectRoot = getProjectRoot20();
|
|
40766
41288
|
try {
|
|
40767
41289
|
const result = await publishDocs({
|
|
40768
41290
|
ownerId: String(args.for),
|
|
@@ -40878,7 +41400,7 @@ var docsCommand = defineCommand({
|
|
|
40878
41400
|
graph: graphCommand,
|
|
40879
41401
|
rank: rankCommand,
|
|
40880
41402
|
versions: versionsCommand,
|
|
40881
|
-
publish:
|
|
41403
|
+
publish: publishCommand2,
|
|
40882
41404
|
sync: syncCommand3,
|
|
40883
41405
|
"gap-check": gapCheckCommand
|
|
40884
41406
|
},
|
|
@@ -41712,7 +42234,7 @@ init_src();
|
|
|
41712
42234
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
41713
42235
|
import { existsSync as existsSync10, mkdirSync as mkdirSync2, readFileSync as readFileSync11, writeFileSync as writeFileSync2 } from "node:fs";
|
|
41714
42236
|
import { dirname as dirname8, join as join15 } from "node:path";
|
|
41715
|
-
import { CleoError as CleoError4, formatError as formatError6, getConfigPath as getConfigPath2, getProjectRoot as
|
|
42237
|
+
import { CleoError as CleoError4, formatError as formatError6, getConfigPath as getConfigPath2, getProjectRoot as getProjectRoot21 } from "@cleocode/core";
|
|
41716
42238
|
init_renderers();
|
|
41717
42239
|
function getChangelogSource(cwd) {
|
|
41718
42240
|
const configPath = getConfigPath2(cwd);
|
|
@@ -41744,7 +42266,7 @@ function getDefaultOutputPath(platform) {
|
|
|
41744
42266
|
}
|
|
41745
42267
|
}
|
|
41746
42268
|
function getGitHubRepoSlug(cwd) {
|
|
41747
|
-
const projectRoot =
|
|
42269
|
+
const projectRoot = getProjectRoot21(cwd);
|
|
41748
42270
|
try {
|
|
41749
42271
|
const remoteUrl = execFileSync3("git", ["remote", "get-url", "origin"], {
|
|
41750
42272
|
cwd: projectRoot,
|
|
@@ -41870,7 +42392,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
41870
42392
|
const targetPlatform = args.platform;
|
|
41871
42393
|
const dryRun = args["dry-run"] === true;
|
|
41872
42394
|
const sourceFile = getChangelogSource();
|
|
41873
|
-
const sourcePath = join15(
|
|
42395
|
+
const sourcePath = join15(getProjectRoot21(), sourceFile);
|
|
41874
42396
|
if (!existsSync10(sourcePath)) {
|
|
41875
42397
|
throw new CleoError4(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
|
|
41876
42398
|
}
|
|
@@ -41883,7 +42405,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
41883
42405
|
const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
|
|
41884
42406
|
const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
|
|
41885
42407
|
if (!dryRun) {
|
|
41886
|
-
const fullPath = join15(
|
|
42408
|
+
const fullPath = join15(getProjectRoot21(), outputPath);
|
|
41887
42409
|
mkdirSync2(dirname8(fullPath), { recursive: true });
|
|
41888
42410
|
writeFileSync2(fullPath, content, "utf-8");
|
|
41889
42411
|
}
|
|
@@ -41904,7 +42426,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
41904
42426
|
limit
|
|
41905
42427
|
);
|
|
41906
42428
|
if (!dryRun) {
|
|
41907
|
-
const fullPath = join15(
|
|
42429
|
+
const fullPath = join15(getProjectRoot21(), platformConfig.path);
|
|
41908
42430
|
mkdirSync2(dirname8(fullPath), { recursive: true });
|
|
41909
42431
|
writeFileSync2(fullPath, content, "utf-8");
|
|
41910
42432
|
}
|
|
@@ -43320,7 +43842,7 @@ import { join as join16 } from "node:path";
|
|
|
43320
43842
|
import {
|
|
43321
43843
|
getBrainDb as getBrainDb2,
|
|
43322
43844
|
getBrainNativeDb as getBrainNativeDb3,
|
|
43323
|
-
getProjectRoot as
|
|
43845
|
+
getProjectRoot as getProjectRoot22,
|
|
43324
43846
|
runConsolidation,
|
|
43325
43847
|
triggerManualDream
|
|
43326
43848
|
} from "@cleocode/core/internal";
|
|
@@ -44229,7 +44751,7 @@ var consolidateCommand = defineCommand({
|
|
|
44229
44751
|
}
|
|
44230
44752
|
},
|
|
44231
44753
|
async run({ args }) {
|
|
44232
|
-
const root =
|
|
44754
|
+
const root = getProjectRoot22();
|
|
44233
44755
|
const isJson = !!args.json;
|
|
44234
44756
|
if (!isJson) {
|
|
44235
44757
|
console.log("Running memory consolidation (including tier promotion)...");
|
|
@@ -44294,7 +44816,7 @@ var dreamCommand = defineCommand({
|
|
|
44294
44816
|
}
|
|
44295
44817
|
},
|
|
44296
44818
|
async run({ args }) {
|
|
44297
|
-
const root =
|
|
44819
|
+
const root = getProjectRoot22();
|
|
44298
44820
|
const isJson = !!args.json;
|
|
44299
44821
|
if (!isJson) {
|
|
44300
44822
|
console.log("Triggering dream cycle (full consolidation including STDP plasticity)...");
|
|
@@ -44372,7 +44894,7 @@ var reflectCommand = defineCommand({
|
|
|
44372
44894
|
}
|
|
44373
44895
|
},
|
|
44374
44896
|
async run({ args }) {
|
|
44375
|
-
const root =
|
|
44897
|
+
const root = getProjectRoot22();
|
|
44376
44898
|
const isJson = !!args.json;
|
|
44377
44899
|
if (!isJson) {
|
|
44378
44900
|
console.log("Running Observer + Reflector pipeline...");
|
|
@@ -44457,7 +44979,7 @@ var dedupScanCommand = defineCommand({
|
|
|
44457
44979
|
}
|
|
44458
44980
|
},
|
|
44459
44981
|
async run({ args }) {
|
|
44460
|
-
const root =
|
|
44982
|
+
const root = getProjectRoot22();
|
|
44461
44983
|
const isJson = !!args.json;
|
|
44462
44984
|
if (!isJson) {
|
|
44463
44985
|
console.log("Scanning brain.db for duplicate entries...");
|
|
@@ -44617,7 +45139,7 @@ var importCommand3 = defineCommand({
|
|
|
44617
45139
|
const sourceDir = args.from ?? join16(homedir4(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
|
|
44618
45140
|
const isDryRun = !!args["dry-run"];
|
|
44619
45141
|
const isJson = !!args.json;
|
|
44620
|
-
const projectRoot =
|
|
45142
|
+
const projectRoot = getProjectRoot22();
|
|
44621
45143
|
const stateFile = join16(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
|
|
44622
45144
|
if (!existsSync11(sourceDir)) {
|
|
44623
45145
|
const msg = `Source directory not found: ${sourceDir}`;
|
|
@@ -44845,7 +45367,7 @@ var tierStatsCommand = defineCommand({
|
|
|
44845
45367
|
}
|
|
44846
45368
|
},
|
|
44847
45369
|
async run({ args }) {
|
|
44848
|
-
const root =
|
|
45370
|
+
const root = getProjectRoot22();
|
|
44849
45371
|
const isJson = !!args.json;
|
|
44850
45372
|
try {
|
|
44851
45373
|
await getBrainDb2(root);
|
|
@@ -44989,7 +45511,7 @@ var tierPromoteCommand = defineCommand({
|
|
|
44989
45511
|
}
|
|
44990
45512
|
},
|
|
44991
45513
|
async run({ args }) {
|
|
44992
|
-
const root =
|
|
45514
|
+
const root = getProjectRoot22();
|
|
44993
45515
|
const isJson = !!args.json;
|
|
44994
45516
|
const targetTier = args.to;
|
|
44995
45517
|
const reason = args.reason;
|
|
@@ -45135,7 +45657,7 @@ var tierDemoteCommand = defineCommand({
|
|
|
45135
45657
|
}
|
|
45136
45658
|
},
|
|
45137
45659
|
async run({ args }) {
|
|
45138
|
-
const root =
|
|
45660
|
+
const root = getProjectRoot22();
|
|
45139
45661
|
const isJson = !!args.json;
|
|
45140
45662
|
const targetTier = args.to;
|
|
45141
45663
|
const reason = args.reason;
|
|
@@ -45623,7 +46145,7 @@ var memoryCommand = defineCommand({
|
|
|
45623
46145
|
});
|
|
45624
46146
|
|
|
45625
46147
|
// packages/cleo/src/cli/commands/migrate-claude-mem.ts
|
|
45626
|
-
import { getProjectRoot as
|
|
46148
|
+
import { getProjectRoot as getProjectRoot23, migrateClaudeMem } from "@cleocode/core/internal";
|
|
45627
46149
|
import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
|
|
45628
46150
|
import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
|
|
45629
46151
|
init_cli();
|
|
@@ -45680,7 +46202,7 @@ var claudeMemCommand = defineCommand({
|
|
|
45680
46202
|
}
|
|
45681
46203
|
},
|
|
45682
46204
|
async run({ args }) {
|
|
45683
|
-
const root =
|
|
46205
|
+
const root = getProjectRoot23();
|
|
45684
46206
|
try {
|
|
45685
46207
|
const result = await migrateClaudeMem(root, {
|
|
45686
46208
|
sourcePath: args.source,
|
|
@@ -45729,7 +46251,7 @@ var manifestIngestCommand = defineCommand({
|
|
|
45729
46251
|
}
|
|
45730
46252
|
},
|
|
45731
46253
|
async run({ args }) {
|
|
45732
|
-
const projectRoot =
|
|
46254
|
+
const projectRoot = getProjectRoot23();
|
|
45733
46255
|
try {
|
|
45734
46256
|
const db = await getDb2(projectRoot);
|
|
45735
46257
|
const rcasdFlag = Boolean(args.rcasd);
|
|
@@ -46121,12 +46643,12 @@ var statusCommand7 = defineCommand({
|
|
|
46121
46643
|
const repoPath = args.path ? path3.resolve(args.path) : process.cwd();
|
|
46122
46644
|
const startTime = Date.now();
|
|
46123
46645
|
try {
|
|
46124
|
-
const [{ getNexusDb, nexusSchema }, { getIndexStats }] = await Promise.all([
|
|
46646
|
+
const [{ getNexusDb: getNexusDb2, nexusSchema }, { getIndexStats }] = await Promise.all([
|
|
46125
46647
|
import("@cleocode/core/store/nexus-sqlite"),
|
|
46126
46648
|
import("@cleocode/nexus/pipeline")
|
|
46127
46649
|
]);
|
|
46128
46650
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
46129
|
-
const db = await
|
|
46651
|
+
const db = await getNexusDb2();
|
|
46130
46652
|
const tables = {
|
|
46131
46653
|
nexusNodes: nexusSchema.nexusNodes,
|
|
46132
46654
|
nexusRelations: nexusSchema.nexusRelations
|
|
@@ -46678,8 +47200,8 @@ var clustersCommand = defineCommand({
|
|
|
46678
47200
|
const repoPath = args.path ? path3.resolve(args.path) : process.cwd();
|
|
46679
47201
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
46680
47202
|
try {
|
|
46681
|
-
const { getNexusDb, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
46682
|
-
const db = await
|
|
47203
|
+
const { getNexusDb: getNexusDb2, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
47204
|
+
const db = await getNexusDb2();
|
|
46683
47205
|
let rows = [];
|
|
46684
47206
|
try {
|
|
46685
47207
|
rows = db.select().from(nexusSchema.nexusNodes).all();
|
|
@@ -46795,8 +47317,8 @@ var flowsCommand = defineCommand({
|
|
|
46795
47317
|
const repoPath = args.path ? path3.resolve(args.path) : process.cwd();
|
|
46796
47318
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
46797
47319
|
try {
|
|
46798
|
-
const { getNexusDb, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
46799
|
-
const db = await
|
|
47320
|
+
const { getNexusDb: getNexusDb2, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
47321
|
+
const db = await getNexusDb2();
|
|
46800
47322
|
let rows = [];
|
|
46801
47323
|
try {
|
|
46802
47324
|
rows = db.select().from(nexusSchema.nexusNodes).all();
|
|
@@ -46923,8 +47445,8 @@ var contextCommand3 = defineCommand({
|
|
|
46923
47445
|
const symbolName = args.symbol;
|
|
46924
47446
|
const showContent = !!args.content;
|
|
46925
47447
|
try {
|
|
46926
|
-
const { getNexusDb, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
46927
|
-
const db = await
|
|
47448
|
+
const { getNexusDb: getNexusDb2, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
47449
|
+
const db = await getNexusDb2();
|
|
46928
47450
|
let allNodes = [];
|
|
46929
47451
|
try {
|
|
46930
47452
|
allNodes = db.select().from(nexusSchema.nexusNodes).all();
|
|
@@ -47204,8 +47726,8 @@ var impactCommand2 = defineCommand({
|
|
|
47204
47726
|
const maxDepth = Math.min(parseInt(args.depth, 10), 5);
|
|
47205
47727
|
const symbolName = args.symbol;
|
|
47206
47728
|
try {
|
|
47207
|
-
const { getNexusDb, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
47208
|
-
const db = await
|
|
47729
|
+
const { getNexusDb: getNexusDb2, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
47730
|
+
const db = await getNexusDb2();
|
|
47209
47731
|
let allNodes = [];
|
|
47210
47732
|
try {
|
|
47211
47733
|
allNodes = db.select().from(nexusSchema.nexusNodes).all();
|
|
@@ -47463,14 +47985,14 @@ var analyzeCommand3 = defineCommand({
|
|
|
47463
47985
|
);
|
|
47464
47986
|
}
|
|
47465
47987
|
try {
|
|
47466
|
-
const [{ getNexusDb, nexusSchema }, { runPipeline }, { getProjectRoot:
|
|
47988
|
+
const [{ getNexusDb: getNexusDb2, nexusSchema }, { runPipeline }, { getProjectRoot: getProjectRoot29 }, { eq: eq2 }] = await Promise.all([
|
|
47467
47989
|
import("@cleocode/core/store/nexus-sqlite"),
|
|
47468
47990
|
import("@cleocode/nexus/pipeline"),
|
|
47469
47991
|
import("@cleocode/core/internal"),
|
|
47470
47992
|
import("drizzle-orm")
|
|
47471
47993
|
]);
|
|
47472
47994
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
47473
|
-
const db = await
|
|
47995
|
+
const db = await getNexusDb2();
|
|
47474
47996
|
const tables = {
|
|
47475
47997
|
nexusNodes: nexusSchema.nexusNodes,
|
|
47476
47998
|
nexusRelations: nexusSchema.nexusRelations
|
|
@@ -47569,7 +48091,7 @@ var analyzeCommand3 = defineCommand({
|
|
|
47569
48091
|
`
|
|
47570
48092
|
);
|
|
47571
48093
|
}
|
|
47572
|
-
void
|
|
48094
|
+
void getProjectRoot29;
|
|
47573
48095
|
} catch (err) {
|
|
47574
48096
|
const msg = err instanceof Error ? err.message : String(err);
|
|
47575
48097
|
if (jsonOutput) {
|
|
@@ -47950,10 +48472,10 @@ var projectsScanCommand = defineCommand({
|
|
|
47950
48472
|
}
|
|
47951
48473
|
}
|
|
47952
48474
|
try {
|
|
47953
|
-
const { getNexusDb } = await import("@cleocode/core/store/nexus-sqlite");
|
|
48475
|
+
const { getNexusDb: getNexusDb2 } = await import("@cleocode/core/store/nexus-sqlite");
|
|
47954
48476
|
const { nexusAuditLog: auditTable } = await import("@cleocode/core/store/nexus-schema");
|
|
47955
48477
|
const { randomUUID: randomUUID6 } = await import("node:crypto");
|
|
47956
|
-
const db = await
|
|
48478
|
+
const db = await getNexusDb2();
|
|
47957
48479
|
await db.insert(auditTable).values({
|
|
47958
48480
|
id: randomUUID6(),
|
|
47959
48481
|
action: "projects.scan",
|
|
@@ -48149,11 +48671,11 @@ var projectsCleanCommand = defineCommand({
|
|
|
48149
48671
|
return false;
|
|
48150
48672
|
}
|
|
48151
48673
|
try {
|
|
48152
|
-
const { getNexusDb } = await import("@cleocode/core/store/nexus-sqlite");
|
|
48674
|
+
const { getNexusDb: getNexusDb2 } = await import("@cleocode/core/store/nexus-sqlite");
|
|
48153
48675
|
const { projectRegistry: regTable, nexusAuditLog: auditTable } = await import("@cleocode/core/store/nexus-schema");
|
|
48154
48676
|
const { randomUUID: randomUUID6 } = await import("node:crypto");
|
|
48155
48677
|
const { inArray } = await import("drizzle-orm");
|
|
48156
|
-
const db = await
|
|
48678
|
+
const db = await getNexusDb2();
|
|
48157
48679
|
const allRows = await db.select({
|
|
48158
48680
|
projectId: regTable.projectId,
|
|
48159
48681
|
projectPath: regTable.projectPath,
|
|
@@ -48453,8 +48975,8 @@ var exportCommand6 = defineCommand({
|
|
|
48453
48975
|
const outputFile = args.output;
|
|
48454
48976
|
const projectFilter = args.project;
|
|
48455
48977
|
try {
|
|
48456
|
-
const { getNexusDb, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
48457
|
-
const db = await
|
|
48978
|
+
const { getNexusDb: getNexusDb2, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
48979
|
+
const db = await getNexusDb2();
|
|
48458
48980
|
let allNodes = [];
|
|
48459
48981
|
let allRelations = [];
|
|
48460
48982
|
try {
|
|
@@ -48595,8 +49117,8 @@ var diffCommand = defineCommand({
|
|
|
48595
49117
|
);
|
|
48596
49118
|
} catch {
|
|
48597
49119
|
}
|
|
48598
|
-
const { getNexusDb, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
48599
|
-
const db = await
|
|
49120
|
+
const { getNexusDb: getNexusDb2, nexusSchema } = await import("@cleocode/core/store/nexus-sqlite");
|
|
49121
|
+
const db = await getNexusDb2();
|
|
48600
49122
|
let relationsBefore = 0;
|
|
48601
49123
|
let nodesBefore = 0;
|
|
48602
49124
|
try {
|
|
@@ -52004,14 +52526,14 @@ var reasonCommand = defineCommand({
|
|
|
52004
52526
|
});
|
|
52005
52527
|
|
|
52006
52528
|
// packages/cleo/src/cli/commands/refresh-memory.ts
|
|
52007
|
-
import { getProjectRoot as
|
|
52529
|
+
import { getProjectRoot as getProjectRoot24 } from "@cleocode/core";
|
|
52008
52530
|
var refreshMemoryCommand = defineCommand({
|
|
52009
52531
|
meta: {
|
|
52010
52532
|
name: "refresh-memory",
|
|
52011
52533
|
description: "Regenerate .cleo/memory-bridge.md from brain.db"
|
|
52012
52534
|
},
|
|
52013
52535
|
async run() {
|
|
52014
|
-
const projectDir =
|
|
52536
|
+
const projectDir = getProjectRoot24();
|
|
52015
52537
|
const { writeMemoryBridge } = await import("@cleocode/core/internal");
|
|
52016
52538
|
const result = await writeMemoryBridge(projectDir);
|
|
52017
52539
|
if (result.written) {
|
|
@@ -53116,7 +53638,7 @@ init_src();
|
|
|
53116
53638
|
import fs3 from "node:fs";
|
|
53117
53639
|
import path4 from "node:path";
|
|
53118
53640
|
import { CleoError as CleoError8, formatError as formatError10, getAccessor as getAccessor9 } from "@cleocode/core";
|
|
53119
|
-
import { getProjectRoot as
|
|
53641
|
+
import { getProjectRoot as getProjectRoot25 } from "@cleocode/core/internal";
|
|
53120
53642
|
init_cli();
|
|
53121
53643
|
init_paths();
|
|
53122
53644
|
init_renderers();
|
|
@@ -53230,7 +53752,7 @@ var finalizeCommand = defineCommand({
|
|
|
53230
53752
|
description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
|
|
53231
53753
|
},
|
|
53232
53754
|
async run() {
|
|
53233
|
-
const projectRoot =
|
|
53755
|
+
const projectRoot = getProjectRoot25();
|
|
53234
53756
|
const reportPath = path4.join(projectRoot, CLEO_DIR_NAME, RESTORE_CONFLICTS_MD);
|
|
53235
53757
|
if (!fs3.existsSync(reportPath)) {
|
|
53236
53758
|
console.log("No pending restore conflicts. Nothing to finalize.");
|
|
@@ -54941,7 +55463,7 @@ var sentientCommand = defineCommand({
|
|
|
54941
55463
|
});
|
|
54942
55464
|
|
|
54943
55465
|
// packages/cleo/src/cli/commands/sequence.ts
|
|
54944
|
-
import { getProjectRoot as
|
|
55466
|
+
import { getProjectRoot as getProjectRoot26 } from "@cleocode/core/internal";
|
|
54945
55467
|
init_cli();
|
|
54946
55468
|
init_renderers();
|
|
54947
55469
|
var showCommand12 = defineCommand({
|
|
@@ -54972,7 +55494,7 @@ var repairCommand = defineCommand({
|
|
|
54972
55494
|
meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
|
|
54973
55495
|
async run() {
|
|
54974
55496
|
const { systemSequenceRepair: systemSequenceRepair2 } = await Promise.resolve().then(() => (init_system_engine(), system_engine_exports));
|
|
54975
|
-
const projectRoot =
|
|
55497
|
+
const projectRoot = getProjectRoot26();
|
|
54976
55498
|
const result = await systemSequenceRepair2(projectRoot);
|
|
54977
55499
|
cliOutput(result, { command: "sequence", operation: "admin.sequence.repair" });
|
|
54978
55500
|
}
|
|
@@ -56799,7 +57321,7 @@ var tokenCommand = defineCommand({
|
|
|
56799
57321
|
// packages/cleo/src/cli/commands/transcript.ts
|
|
56800
57322
|
import { homedir as homedir5 } from "node:os";
|
|
56801
57323
|
import { join as join19 } from "node:path";
|
|
56802
|
-
import { getProjectRoot as
|
|
57324
|
+
import { getProjectRoot as getProjectRoot27 } from "@cleocode/core";
|
|
56803
57325
|
import {
|
|
56804
57326
|
parseDurationMs,
|
|
56805
57327
|
pruneTranscripts,
|
|
@@ -56827,7 +57349,7 @@ var scanCommand = defineCommand({
|
|
|
56827
57349
|
async run({ args }) {
|
|
56828
57350
|
if (args.pending) {
|
|
56829
57351
|
try {
|
|
56830
|
-
const projectRoot =
|
|
57352
|
+
const projectRoot = getProjectRoot27();
|
|
56831
57353
|
const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
56832
57354
|
const pending = await scanPendingTranscripts(projectRoot);
|
|
56833
57355
|
const envelope = { success: true, data: { count: pending.length, pending } };
|
|
@@ -56960,7 +57482,7 @@ var extractCommand = defineCommand({
|
|
|
56960
57482
|
async run({ args }) {
|
|
56961
57483
|
const tier = args.tier ?? "warm";
|
|
56962
57484
|
const dryRun = args["dry-run"] ?? false;
|
|
56963
|
-
const projectRoot =
|
|
57485
|
+
const projectRoot = getProjectRoot27();
|
|
56964
57486
|
try {
|
|
56965
57487
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
56966
57488
|
const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -57091,7 +57613,7 @@ var migrateCommand2 = defineCommand({
|
|
|
57091
57613
|
const dryRun = args["dry-run"] ?? false;
|
|
57092
57614
|
const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
|
|
57093
57615
|
const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
|
|
57094
|
-
const projectRoot =
|
|
57616
|
+
const projectRoot = getProjectRoot27();
|
|
57095
57617
|
try {
|
|
57096
57618
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
57097
57619
|
const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -58159,12 +58681,12 @@ subCommands["pipeline"] = phaseCommand;
|
|
|
58159
58681
|
} catch {
|
|
58160
58682
|
}
|
|
58161
58683
|
try {
|
|
58162
|
-
detectAndRemoveStrayProjectNexus(
|
|
58684
|
+
detectAndRemoveStrayProjectNexus(getProjectRoot28());
|
|
58163
58685
|
} catch {
|
|
58164
58686
|
}
|
|
58165
|
-
const _startupLog =
|
|
58687
|
+
const _startupLog = getLogger18("cli-startup");
|
|
58166
58688
|
try {
|
|
58167
|
-
const _projectRootForMigration =
|
|
58689
|
+
const _projectRootForMigration = getProjectRoot28();
|
|
58168
58690
|
if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
|
|
58169
58691
|
const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
|
|
58170
58692
|
if (migrationResult.status === "failed") {
|
|
@@ -58184,7 +58706,7 @@ subCommands["pipeline"] = phaseCommand;
|
|
|
58184
58706
|
}
|
|
58185
58707
|
}
|
|
58186
58708
|
try {
|
|
58187
|
-
ensureConduitDb(
|
|
58709
|
+
ensureConduitDb(getProjectRoot28());
|
|
58188
58710
|
} catch {
|
|
58189
58711
|
}
|
|
58190
58712
|
try {
|