zam-core 0.10.11 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/app.js +176 -7
- package/dist/cli/app.js.map +1 -1
- package/dist/cli/commands/mcp.js +1083 -397
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/copilot-extension/host.bundle.js +1 -1
- package/dist/copilot-extension/manifest.json +1 -1
- package/dist/copilot-extension/mcp-client.bundle.mjs +1 -1
- package/dist/index.d.ts +98 -2
- package/dist/index.js +139 -3
- package/dist/index.js.map +1 -1
- package/dist/ui/graph-panel.html +157 -54
- package/dist/ui/recall-panel.html +153 -50
- package/dist/ui/settings-panel.html +154 -49
- package/dist/ui/studio-panel.html +179 -72
- package/dist/vscode-extension/ZAM_Companion_0.11.0.vsix +0 -0
- package/dist/vscode-extension/extension.cjs +51 -44
- package/dist/vscode-extension/manifest.json +2 -2
- package/package.json +1 -1
- package/dist/vscode-extension/ZAM_Companion_0.10.11.vsix +0 -0
package/dist/cli/app.js
CHANGED
|
@@ -810,6 +810,14 @@ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as rea
|
|
|
810
810
|
import { createRequire } from "module";
|
|
811
811
|
import { homedir as homedir2 } from "os";
|
|
812
812
|
import { dirname as dirname2, join as join2 } from "path";
|
|
813
|
+
function require2(id) {
|
|
814
|
+
if (!nodeRequire) {
|
|
815
|
+
nodeRequire = createRequire(
|
|
816
|
+
typeof __filename === "string" ? __filename : import.meta.url
|
|
817
|
+
);
|
|
818
|
+
}
|
|
819
|
+
return nodeRequire(id);
|
|
820
|
+
}
|
|
813
821
|
function isRemoteDatabasePath(dbPath) {
|
|
814
822
|
return /^(libsql|https?|wss?):\/\//i.test(dbPath);
|
|
815
823
|
}
|
|
@@ -1133,7 +1141,7 @@ async function runMigrations(db) {
|
|
|
1133
1141
|
);
|
|
1134
1142
|
}
|
|
1135
1143
|
}
|
|
1136
|
-
var DEFAULT_DB_DIR, DEFAULT_DB_PATH,
|
|
1144
|
+
var DEFAULT_DB_DIR, DEFAULT_DB_PATH, nodeRequire, TRANSIENT_REMOTE_ERROR_PATTERNS;
|
|
1137
1145
|
var init_connection = __esm({
|
|
1138
1146
|
"src/kernel/db/connection.ts"() {
|
|
1139
1147
|
"use strict";
|
|
@@ -1143,7 +1151,6 @@ var init_connection = __esm({
|
|
|
1143
1151
|
init_sync_adapter();
|
|
1144
1152
|
DEFAULT_DB_DIR = join2(homedir2(), ".zam");
|
|
1145
1153
|
DEFAULT_DB_PATH = join2(DEFAULT_DB_DIR, "zam.db");
|
|
1146
|
-
require2 = createRequire(import.meta.url);
|
|
1147
1154
|
TRANSIENT_REMOTE_ERROR_PATTERNS = [
|
|
1148
1155
|
/status=5\d\d/i,
|
|
1149
1156
|
/websocket/i,
|
|
@@ -5976,7 +5983,14 @@ var init_i18n = __esm({
|
|
|
5976
5983
|
});
|
|
5977
5984
|
|
|
5978
5985
|
// src/kernel/system/install-config.ts
|
|
5979
|
-
import {
|
|
5986
|
+
import {
|
|
5987
|
+
existsSync as existsSync8,
|
|
5988
|
+
mkdirSync as mkdirSync7,
|
|
5989
|
+
readFileSync as readFileSync8,
|
|
5990
|
+
renameSync,
|
|
5991
|
+
unlinkSync,
|
|
5992
|
+
writeFileSync as writeFileSync5
|
|
5993
|
+
} from "fs";
|
|
5980
5994
|
import { homedir as homedir6 } from "os";
|
|
5981
5995
|
import { dirname as dirname4, join as join9 } from "path";
|
|
5982
5996
|
import { ulid as ulid9 } from "ulid";
|
|
@@ -6004,8 +6018,19 @@ function loadInstallConfig(path = defaultConfigPath()) {
|
|
|
6004
6018
|
function saveInstallConfig(config, path = defaultConfigPath()) {
|
|
6005
6019
|
const dir = dirname4(path);
|
|
6006
6020
|
if (!existsSync8(dir)) mkdirSync7(dir, { recursive: true });
|
|
6007
|
-
|
|
6021
|
+
const tempPath = join9(dir, `.config-${process.pid}-${Date.now()}.tmp`);
|
|
6022
|
+
writeFileSync5(tempPath, `${JSON.stringify(config, null, 2)}
|
|
6008
6023
|
`, "utf-8");
|
|
6024
|
+
try {
|
|
6025
|
+
renameSync(tempPath, path);
|
|
6026
|
+
} catch (error) {
|
|
6027
|
+
try {
|
|
6028
|
+
unlinkSync(path);
|
|
6029
|
+
renameSync(tempPath, path);
|
|
6030
|
+
} catch {
|
|
6031
|
+
throw error;
|
|
6032
|
+
}
|
|
6033
|
+
}
|
|
6009
6034
|
}
|
|
6010
6035
|
function getInstallMode(path = defaultConfigPath()) {
|
|
6011
6036
|
return loadInstallConfig(path).mode ?? "developer";
|
|
@@ -6143,6 +6168,105 @@ function setAgentConnectAutoDone(done, path = defaultConfigPath()) {
|
|
|
6143
6168
|
}
|
|
6144
6169
|
saveInstallConfig(config, path);
|
|
6145
6170
|
}
|
|
6171
|
+
function getMachineCompanionConfig(path = defaultConfigPath()) {
|
|
6172
|
+
const raw = loadInstallConfig(path).companion;
|
|
6173
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
|
|
6174
|
+
const result = {};
|
|
6175
|
+
if (typeof raw.selectedUserId === "string") {
|
|
6176
|
+
result.selectedUserId = raw.selectedUserId;
|
|
6177
|
+
}
|
|
6178
|
+
if (typeof raw.selectedEvaluatorId === "string") {
|
|
6179
|
+
result.selectedEvaluatorId = raw.selectedEvaluatorId;
|
|
6180
|
+
}
|
|
6181
|
+
if (typeof raw.selectedVscodeModelId === "string") {
|
|
6182
|
+
result.selectedVscodeModelId = raw.selectedVscodeModelId;
|
|
6183
|
+
}
|
|
6184
|
+
if (raw.collapsed && typeof raw.collapsed === "object" && !Array.isArray(raw.collapsed)) {
|
|
6185
|
+
const collapsed = {};
|
|
6186
|
+
for (const [surface, value] of Object.entries(raw.collapsed)) {
|
|
6187
|
+
if (typeof value === "boolean") collapsed[surface] = value;
|
|
6188
|
+
}
|
|
6189
|
+
result.collapsed = collapsed;
|
|
6190
|
+
}
|
|
6191
|
+
return result;
|
|
6192
|
+
}
|
|
6193
|
+
function saveMachineCompanionConfig(companion, path = defaultConfigPath()) {
|
|
6194
|
+
const config = loadInstallConfig(path);
|
|
6195
|
+
config.companion = companion;
|
|
6196
|
+
saveInstallConfig(config, path);
|
|
6197
|
+
}
|
|
6198
|
+
function updateMachineCompanionConfig(update, path = defaultConfigPath()) {
|
|
6199
|
+
const companion = getMachineCompanionConfig(path);
|
|
6200
|
+
if ("selectedUserId" in update) {
|
|
6201
|
+
if (update.selectedUserId) {
|
|
6202
|
+
companion.selectedUserId = update.selectedUserId;
|
|
6203
|
+
} else {
|
|
6204
|
+
delete companion.selectedUserId;
|
|
6205
|
+
}
|
|
6206
|
+
}
|
|
6207
|
+
if ("selectedEvaluatorId" in update) {
|
|
6208
|
+
if (update.selectedEvaluatorId) {
|
|
6209
|
+
companion.selectedEvaluatorId = update.selectedEvaluatorId;
|
|
6210
|
+
} else {
|
|
6211
|
+
delete companion.selectedEvaluatorId;
|
|
6212
|
+
}
|
|
6213
|
+
}
|
|
6214
|
+
if (update.collapsed) {
|
|
6215
|
+
companion.collapsed = {
|
|
6216
|
+
...companion.collapsed ?? {},
|
|
6217
|
+
[update.collapsed.surface]: update.collapsed.value
|
|
6218
|
+
};
|
|
6219
|
+
}
|
|
6220
|
+
saveMachineCompanionConfig(companion, path);
|
|
6221
|
+
return companion;
|
|
6222
|
+
}
|
|
6223
|
+
function getCompanionSelectedUserId(path = defaultConfigPath()) {
|
|
6224
|
+
return getMachineCompanionConfig(path).selectedUserId;
|
|
6225
|
+
}
|
|
6226
|
+
function setCompanionSelectedUserId(userId, path = defaultConfigPath()) {
|
|
6227
|
+
const companion = getMachineCompanionConfig(path);
|
|
6228
|
+
if (userId) {
|
|
6229
|
+
companion.selectedUserId = userId;
|
|
6230
|
+
} else {
|
|
6231
|
+
delete companion.selectedUserId;
|
|
6232
|
+
}
|
|
6233
|
+
saveMachineCompanionConfig(companion, path);
|
|
6234
|
+
}
|
|
6235
|
+
function getCompanionSelectedEvaluatorId(path = defaultConfigPath()) {
|
|
6236
|
+
return getMachineCompanionConfig(path).selectedEvaluatorId;
|
|
6237
|
+
}
|
|
6238
|
+
function setCompanionSelectedEvaluatorId(evaluatorId, path = defaultConfigPath()) {
|
|
6239
|
+
const companion = getMachineCompanionConfig(path);
|
|
6240
|
+
if (evaluatorId) {
|
|
6241
|
+
companion.selectedEvaluatorId = evaluatorId;
|
|
6242
|
+
} else {
|
|
6243
|
+
delete companion.selectedEvaluatorId;
|
|
6244
|
+
}
|
|
6245
|
+
saveMachineCompanionConfig(companion, path);
|
|
6246
|
+
}
|
|
6247
|
+
function getCompanionSelectedVscodeModelId(path = defaultConfigPath()) {
|
|
6248
|
+
return getMachineCompanionConfig(path).selectedVscodeModelId;
|
|
6249
|
+
}
|
|
6250
|
+
function setCompanionSelectedVscodeModelId(modelId, path = defaultConfigPath()) {
|
|
6251
|
+
const companion = getMachineCompanionConfig(path);
|
|
6252
|
+
if (modelId) {
|
|
6253
|
+
companion.selectedVscodeModelId = modelId;
|
|
6254
|
+
} else {
|
|
6255
|
+
delete companion.selectedVscodeModelId;
|
|
6256
|
+
}
|
|
6257
|
+
saveMachineCompanionConfig(companion, path);
|
|
6258
|
+
}
|
|
6259
|
+
function getCompanionCollapsed(path = defaultConfigPath()) {
|
|
6260
|
+
return getMachineCompanionConfig(path).collapsed ?? {};
|
|
6261
|
+
}
|
|
6262
|
+
function setCompanionCollapsed(surface, collapsed, path = defaultConfigPath()) {
|
|
6263
|
+
const companion = getMachineCompanionConfig(path);
|
|
6264
|
+
companion.collapsed = {
|
|
6265
|
+
...companion.collapsed ?? {},
|
|
6266
|
+
[surface]: collapsed
|
|
6267
|
+
};
|
|
6268
|
+
saveMachineCompanionConfig(companion, path);
|
|
6269
|
+
}
|
|
6146
6270
|
function getLastRepairedVersion(path = defaultConfigPath()) {
|
|
6147
6271
|
return loadInstallConfig(path).lastRepairedVersion;
|
|
6148
6272
|
}
|
|
@@ -6859,6 +6983,10 @@ __export(kernel_exports, {
|
|
|
6859
6983
|
getCard: () => getCard,
|
|
6860
6984
|
getCardById: () => getCardById,
|
|
6861
6985
|
getCardDeletionImpact: () => getCardDeletionImpact,
|
|
6986
|
+
getCompanionCollapsed: () => getCompanionCollapsed,
|
|
6987
|
+
getCompanionSelectedEvaluatorId: () => getCompanionSelectedEvaluatorId,
|
|
6988
|
+
getCompanionSelectedUserId: () => getCompanionSelectedUserId,
|
|
6989
|
+
getCompanionSelectedVscodeModelId: () => getCompanionSelectedVscodeModelId,
|
|
6862
6990
|
getConfiguredWorkspaces: () => getConfiguredWorkspaces,
|
|
6863
6991
|
getDatabaseTargetInfo: () => getDatabaseTargetInfo,
|
|
6864
6992
|
getDefaultDbPath: () => getDefaultDbPath,
|
|
@@ -6876,6 +7004,7 @@ __export(kernel_exports, {
|
|
|
6876
7004
|
getLastRepairedVersion: () => getLastRepairedVersion,
|
|
6877
7005
|
getMachineAiConfig: () => getMachineAiConfig,
|
|
6878
7006
|
getMachineAiModels: () => getMachineAiModels,
|
|
7007
|
+
getMachineCompanionConfig: () => getMachineCompanionConfig,
|
|
6879
7008
|
getMonitorDir: () => getMonitorDir,
|
|
6880
7009
|
getMonitorLogStats: () => getMonitorLogStats,
|
|
6881
7010
|
getMonitorPath: () => getMonitorPath,
|
|
@@ -6961,12 +7090,17 @@ __export(kernel_exports, {
|
|
|
6961
7090
|
saveInstallConfig: () => saveInstallConfig,
|
|
6962
7091
|
saveMachineAiConfig: () => saveMachineAiConfig,
|
|
6963
7092
|
saveMachineAiModels: () => saveMachineAiModels,
|
|
7093
|
+
saveMachineCompanionConfig: () => saveMachineCompanionConfig,
|
|
6964
7094
|
searchTokensHybrid: () => searchTokensHybrid,
|
|
6965
7095
|
serializeGoal: () => serializeGoal,
|
|
6966
7096
|
setADOCredentials: () => setADOCredentials,
|
|
6967
7097
|
setActiveWorkspaceContext: () => setActiveWorkspaceContext,
|
|
6968
7098
|
setActiveWorkspaceId: () => setActiveWorkspaceId,
|
|
6969
7099
|
setAgentConnectAutoDone: () => setAgentConnectAutoDone,
|
|
7100
|
+
setCompanionCollapsed: () => setCompanionCollapsed,
|
|
7101
|
+
setCompanionSelectedEvaluatorId: () => setCompanionSelectedEvaluatorId,
|
|
7102
|
+
setCompanionSelectedUserId: () => setCompanionSelectedUserId,
|
|
7103
|
+
setCompanionSelectedVscodeModelId: () => setCompanionSelectedVscodeModelId,
|
|
6970
7104
|
setInstallChannel: () => setInstallChannel,
|
|
6971
7105
|
setInstallMode: () => setInstallMode,
|
|
6972
7106
|
setLastRepairedVersion: () => setLastRepairedVersion,
|
|
@@ -6987,6 +7121,7 @@ __export(kernel_exports, {
|
|
|
6987
7121
|
updateCard: () => updateCard,
|
|
6988
7122
|
updateGoalStatus: () => updateGoalStatus,
|
|
6989
7123
|
updateKnowledgeContext: () => updateKnowledgeContext,
|
|
7124
|
+
updateMachineCompanionConfig: () => updateMachineCompanionConfig,
|
|
6990
7125
|
updateToken: () => updateToken,
|
|
6991
7126
|
upsertConfiguredWorkspace: () => upsertConfiguredWorkspace,
|
|
6992
7127
|
upsertTokenEmbedding: () => upsertTokenEmbedding,
|
|
@@ -7075,7 +7210,7 @@ import {
|
|
|
7075
7210
|
accessSync,
|
|
7076
7211
|
constants,
|
|
7077
7212
|
existsSync as existsSync11,
|
|
7078
|
-
unlinkSync,
|
|
7213
|
+
unlinkSync as unlinkSync2,
|
|
7079
7214
|
writeFileSync as writeFileSync6
|
|
7080
7215
|
} from "fs";
|
|
7081
7216
|
import { tmpdir } from "os";
|
|
@@ -7222,7 +7357,7 @@ Run this manually in a new terminal:
|
|
|
7222
7357
|
}
|
|
7223
7358
|
} finally {
|
|
7224
7359
|
try {
|
|
7225
|
-
|
|
7360
|
+
unlinkSync2(tmpFile);
|
|
7226
7361
|
} catch {
|
|
7227
7362
|
}
|
|
7228
7363
|
}
|
|
@@ -7920,6 +8055,24 @@ function planVscodeExtensionInstall(options) {
|
|
|
7920
8055
|
launch: { command: options.zamPath, args: ["mcp"] }
|
|
7921
8056
|
};
|
|
7922
8057
|
}
|
|
8058
|
+
function compareVersions2(a, b) {
|
|
8059
|
+
const parse = (value) => value.split(".").map((part) => Number.parseInt(part, 10) || 0);
|
|
8060
|
+
const [aParts, bParts] = [parse(a), parse(b)];
|
|
8061
|
+
for (let i = 0; i < Math.max(aParts.length, bParts.length); i += 1) {
|
|
8062
|
+
const diff = (aParts[i] ?? 0) - (bParts[i] ?? 0);
|
|
8063
|
+
if (diff !== 0) return diff;
|
|
8064
|
+
}
|
|
8065
|
+
return 0;
|
|
8066
|
+
}
|
|
8067
|
+
function installedCompanionVersion(codePath, query) {
|
|
8068
|
+
try {
|
|
8069
|
+
const output = query(codePath, ["--list-extensions", "--show-versions"]);
|
|
8070
|
+
const match = output.match(/^zam-os\.zam-companion@(\S+)$/im);
|
|
8071
|
+
return match ? match[1] : null;
|
|
8072
|
+
} catch {
|
|
8073
|
+
return null;
|
|
8074
|
+
}
|
|
8075
|
+
}
|
|
7923
8076
|
function installVscodeExtension(options) {
|
|
7924
8077
|
const plan = planVscodeExtensionInstall(options);
|
|
7925
8078
|
if (options.dryRun) return { ...plan, action: "planned" };
|
|
@@ -7943,6 +8096,18 @@ function installVscodeExtension(options) {
|
|
|
7943
8096
|
shell: invocation.shell
|
|
7944
8097
|
});
|
|
7945
8098
|
});
|
|
8099
|
+
const query = options.query ?? ((command, args) => {
|
|
8100
|
+
const invocation = buildVscodeCliInvocation(command, args);
|
|
8101
|
+
return execFileSync3(invocation.command, invocation.args, {
|
|
8102
|
+
stdio: "pipe",
|
|
8103
|
+
shell: invocation.shell,
|
|
8104
|
+
encoding: "utf8"
|
|
8105
|
+
});
|
|
8106
|
+
});
|
|
8107
|
+
const installed = installedCompanionVersion(plan.codePath, query);
|
|
8108
|
+
if (installed && compareVersions2(plan.version, installed) < 0) {
|
|
8109
|
+
return { ...plan, action: "kept-newer" };
|
|
8110
|
+
}
|
|
7946
8111
|
run(plan.codePath, ["--install-extension", plan.vsixPath, "--force"]);
|
|
7947
8112
|
if (changed) {
|
|
7948
8113
|
mkdirSync9(dirname6(plan.launchConfigPath), { recursive: true });
|
|
@@ -8115,12 +8280,16 @@ function performAgentConnect(opts = {}, deps = {}) {
|
|
|
8115
8280
|
skills
|
|
8116
8281
|
};
|
|
8117
8282
|
}
|
|
8283
|
+
var INSPECTED_HARNESSES = [
|
|
8284
|
+
...USER_SCOPED_CONNECT_HARNESSES,
|
|
8285
|
+
"claude-code"
|
|
8286
|
+
];
|
|
8118
8287
|
function inspectConnectHarnesses(deps = {}) {
|
|
8119
8288
|
const d = resolveDeps(deps);
|
|
8120
8289
|
const foundZam = d.findZam();
|
|
8121
8290
|
const zamPath = foundZam ?? "zam";
|
|
8122
8291
|
const installed = new Set(d.detect());
|
|
8123
|
-
const harnesses =
|
|
8292
|
+
const harnesses = INSPECTED_HARNESSES.map((harness) => {
|
|
8124
8293
|
const status = {
|
|
8125
8294
|
harness,
|
|
8126
8295
|
label: CONNECT_HARNESS_LABELS[harness],
|