xkzoom 1.5.3 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/dist/{chunk-LJF6JSJB.mjs → chunk-2NBVNRMZ.mjs} +1 -1
- package/dist/{chunk-DB4XTPJF.mjs → chunk-3K6WOVYD.mjs} +2 -2
- package/dist/{chunk-T5ZCLYLJ.mjs → chunk-4BCLMOYG.mjs} +1 -1
- package/dist/{chunk-I7O5UR24.mjs → chunk-5IAQOOZ2.mjs} +5 -5
- package/dist/{chunk-KI7AMK7P.mjs → chunk-64QYTQH7.mjs} +2 -2
- package/dist/{chunk-SQHTVHQ7.mjs → chunk-6VSIGHGI.mjs} +7 -7
- package/dist/{chunk-QADC4VKT.mjs → chunk-CRYBNNZU.mjs} +10 -10
- package/dist/{chunk-FKCGJ3BF.mjs → chunk-DZDEUZD2.mjs} +12 -12
- package/dist/{chunk-QSQ274C6.mjs → chunk-EBVVOJVN.mjs} +2 -2
- package/dist/{chunk-W7OJPFTN.mjs → chunk-FAB2ZZYB.mjs} +2 -2
- package/dist/{chunk-Q33JD64H.mjs → chunk-FCK6QFJB.mjs} +1 -1
- package/dist/{chunk-RZW4EEPW.mjs → chunk-G4JWJKD7.mjs} +13 -13
- package/dist/{chunk-MVKCMXBY.mjs → chunk-H7DNHHNA.mjs} +1 -1
- package/dist/{chunk-ESYRDWFO.mjs → chunk-HVDIL2V7.mjs} +1 -1
- package/dist/{chunk-PJKLQF3K.mjs → chunk-INFZEMQK.mjs} +1 -1
- package/dist/{chunk-WNI5ZPQY.mjs → chunk-JK5ZK32E.mjs} +3 -3
- package/dist/{chunk-AJNXWGX2.mjs → chunk-LJ6RMHC6.mjs} +1 -1
- package/dist/{chunk-WGLYR2YT.mjs → chunk-LKHL3NCW.mjs} +1 -1
- package/dist/{chunk-PS6X3CND.mjs → chunk-LKSRZTSL.mjs} +1 -0
- package/dist/{chunk-FAJHYXNU.mjs → chunk-LMIEVEGA.mjs} +1 -1
- package/dist/{chunk-COYZO24J.mjs → chunk-MCD5TOFD.mjs} +1 -1
- package/dist/{chunk-MI6GFOCU.mjs → chunk-MFIBP6MD.mjs} +3 -3
- package/dist/{chunk-THN36GA5.mjs → chunk-MLHV7EMJ.mjs} +32 -32
- package/dist/{chunk-ZMQ3UOGP.mjs → chunk-MMWLRPKT.mjs} +13 -1
- package/dist/{chunk-I4LMW3IM.mjs → chunk-MTRG3ZME.mjs} +11 -11
- package/dist/{chunk-6LKZYMIW.mjs → chunk-N6VFFREI.mjs} +28 -28
- package/dist/{chunk-5VR6UOGC.mjs → chunk-ND44D2ZA.mjs} +1 -1
- package/dist/{chunk-3EV63LAA.mjs → chunk-O7MFL7L4.mjs} +7 -7
- package/dist/{chunk-QYXYVBTO.mjs → chunk-OMLMLZUY.mjs} +1 -1
- package/dist/{chunk-B4YKXZ5W.mjs → chunk-OQMIECO2.mjs} +1 -1
- package/dist/{chunk-IVR74IXK.mjs → chunk-P4WX5RWE.mjs} +14 -14
- package/dist/{chunk-6EI5MFLD.mjs → chunk-PN6I6DTV.mjs} +1 -1
- package/dist/{chunk-LSQ47CLM.mjs → chunk-QEED7NAG.mjs} +27 -27
- package/dist/{chunk-QSHIFD37.mjs → chunk-SKQOHRBI.mjs} +2 -2
- package/dist/{chunk-WV6OKJ4J.mjs → chunk-SLBCSYGP.mjs} +1 -1
- package/dist/{chunk-PBBRBETA.mjs → chunk-TNBK63NV.mjs} +1 -1
- package/dist/{chunk-3FF266OG.mjs → chunk-U6ONSC6B.mjs} +1 -1
- package/dist/{chunk-CQAQRU4P.mjs → chunk-UAUV2GYH.mjs} +61 -61
- package/dist/{chunk-VWAUDB4X.mjs → chunk-UFURP7VS.mjs} +1 -1
- package/dist/{chunk-LXEKUNXI.mjs → chunk-UPD527M4.mjs} +1 -1
- package/dist/{chunk-M6VHS3HQ.mjs → chunk-W6JEB555.mjs} +2 -2
- package/dist/{chunk-3LR4CLDE.mjs → chunk-WOHFGPTL.mjs} +1 -1
- package/dist/{chunk-X7P6B2LK.mjs → chunk-XADONCIM.mjs} +1 -1
- package/dist/{chunk-DBYEZK64.mjs → chunk-XDR276NG.mjs} +1 -1
- package/dist/{chunk-37LYF6K2.mjs → chunk-YFKOQIA7.mjs} +1 -1
- package/dist/{chunk-BN273XTH.mjs → chunk-YKACMPVT.mjs} +1 -1
- package/dist/{chunk-D3N7EHB2.mjs → chunk-YSLLUNNZ.mjs} +9 -9
- package/dist/chunk-YTBKWX7J.mjs +102 -0
- package/dist/{chunk-C5VQPAOA.mjs → chunk-YW5STVWH.mjs} +1 -1
- package/dist/{chunk-WRRJFJ2N.mjs → chunk-ZE6GJFY7.mjs} +1 -1
- package/dist/index.js +262 -162
- package/dist/index.mjs +104 -103
- package/dist/mobile/action-planner.mjs +55 -55
- package/dist/mobile/agent-capabilities.mjs +55 -55
- package/dist/mobile/agents-watch.js +346 -0
- package/dist/mobile/agents-watch.mjs +13 -0
- package/dist/mobile/anthropic-messages-turn-runner.mjs +65 -65
- package/dist/mobile/anthropic-owned-tool-executor.mjs +64 -64
- package/dist/mobile/api.mjs +28 -28
- package/dist/mobile/auth.mjs +1 -1
- package/dist/mobile/bucket-events/emit-bucket-frame.js +327 -0
- package/dist/mobile/bucket-events/emit-bucket-frame.mjs +8 -3
- package/dist/mobile/bucket-events/register-bucket-gateway-bridge.js +320 -3
- package/dist/mobile/bucket-events/register-bucket-gateway-bridge.mjs +9 -4
- package/dist/mobile/channel.mjs +2 -2
- package/dist/mobile/context-compact/compact-artifact-enrich.mjs +4 -4
- package/dist/mobile/context-compact/compact-artifact-writer.mjs +1 -1
- package/dist/mobile/context-compact/compact-engine-artifacts.mjs +2 -2
- package/dist/mobile/context-compact/compact-memory-distill-job.mjs +2 -2
- package/dist/mobile/context-compact/compact-orchestrator.mjs +11 -11
- package/dist/mobile/context-compact/compact-resume-prefetch.mjs +1 -1
- package/dist/mobile/context-compact/compact-summarizer-engine-artifact.mjs +5 -5
- package/dist/mobile/context-compact/compact-summarizer.mjs +3 -3
- package/dist/mobile/context-compact/runtime-compact-hook.mjs +59 -59
- package/dist/mobile/group/conductor-plan-llm.mjs +3 -3
- package/dist/mobile/group/execution-plan.mjs +2 -2
- package/dist/mobile/group/floor-state-store.mjs +3 -3
- package/dist/mobile/group/group-api-handlers.mjs +16 -16
- package/dist/mobile/group/group-session.mjs +4 -4
- package/dist/mobile/group/index.mjs +13 -13
- package/dist/mobile/group/orchestrator.mjs +9 -9
- package/dist/mobile/group/plan-runtime.mjs +5 -5
- package/dist/mobile/group/runtime-integration.mjs +14 -14
- package/dist/mobile/index.js +277 -155
- package/dist/mobile/index.mjs +101 -100
- package/dist/mobile/memory-runtime-v2/eval-runner.mjs +6 -6
- package/dist/mobile/memory-runtime-v2/evidence-plan.mjs +9 -9
- package/dist/mobile/memory-runtime-v2/index.mjs +31 -31
- package/dist/mobile/memory-runtime-v2/memory-control-plane.mjs +9 -9
- package/dist/mobile/memory-runtime-v2/memory-readiness.mjs +9 -9
- package/dist/mobile/memory-runtime-v2/orchestrator.mjs +4 -4
- package/dist/mobile/memory-runtime-v2/public-api.mjs +12 -12
- package/dist/mobile/native-reply-system-prompt-layers.mjs +56 -56
- package/dist/mobile/openai-completions-turn-runner.mjs +65 -65
- package/dist/mobile/reply-dispatch-warmup.mjs +3 -3
- package/dist/mobile/runtime.js +160 -39
- package/dist/mobile/runtime.mjs +100 -99
- package/dist/mobile/session-dispatch/mobile-session-agent-event-bridge.mjs +1 -1
- package/dist/mobile/stream-inbound/mobile-text-stream-pipeline.mjs +4 -4
- package/dist/mobile/tool-use-input-normalize.mjs +58 -58
- package/dist/mobile/tools/mobile-compact-tool-bridge.mjs +58 -58
- package/dist/mobile/types.js +1 -0
- package/dist/mobile/types.mjs +1 -1
- package/dist/mobile/websocket.js +327 -0
- package/dist/mobile/websocket.mjs +7 -2
- package/dist/owned-tools/agents-list.mjs +1 -1
- package/dist/owned-tools/ceo-decision.mjs +4 -4
- package/dist/owned-tools/ceo-redirect.mjs +15 -15
- package/dist/owned-tools/compact/execute.mjs +56 -56
- package/dist/owned-tools/compact/gateway-tool-factory.mjs +57 -57
- package/dist/owned-tools/compact/registry.mjs +55 -55
- package/dist/owned-tools/context-compact.mjs +24 -24
- package/dist/owned-tools/groups-history.mjs +1 -1
- package/dist/owned-tools/handoff.mjs +4 -4
- package/dist/owned-tools/media-asset-library.mjs +1 -1
- package/dist/owned-tools/memory-control.mjs +11 -11
- package/dist/owned-tools/memory-runtime-eval.mjs +10 -10
- package/dist/owned-tools/message.mjs +3 -3
- package/dist/owned-tools/owned-reply.mjs +1 -1
- package/dist/owned-tools/providers/minimax-files.mjs +2 -2
- package/dist/owned-tools/providers/minimax-video-generate.mjs +3 -3
- package/dist/owned-tools/providers/minimax-voice.mjs +3 -3
- package/dist/owned-tools/register-owned-providers.mjs +5 -5
- package/dist/owned-tools/registry.mjs +54 -54
- package/dist/owned-tools/router.mjs +55 -55
- package/dist/owned-tools/runtime-bridge.mjs +56 -56
- package/dist/owned-tools/runtime-data.mjs +1 -1
- package/dist/owned-tools/session-status.mjs +1 -1
- package/dist/owned-tools/sessions-history-resolver.mjs +1 -1
- package/dist/owned-tools/sessions-history.mjs +1 -1
- package/dist/owned-tools/sessions-list.mjs +1 -1
- package/dist/owned-tools/sessions-send.mjs +1 -1
- package/dist/owned-tools/skills-create.mjs +1 -1
- package/dist/owned-tools/subagents.mjs +1 -1
- package/dist/owned-tools/tool-contract-prompt.mjs +55 -55
- package/dist/owned-tools/tool-result-envelope.mjs +57 -57
- package/dist/owned-tools/tool-usage-guide.mjs +54 -54
- package/dist/owned-tools/tts.mjs +1 -1
- package/dist/project-pipeline/handlers.mjs +15 -15
- package/dist/project-pipeline/index.mjs +15 -15
- package/package.json +2 -2
- package/gateway-core/README.md +0 -6
- package/dist/{chunk-IGJFAE72.mjs → chunk-2PWU4VN6.mjs} +3 -3
- package/dist/{chunk-H6LMX5G5.mjs → chunk-522D52FC.mjs} +3 -3
- package/dist/{chunk-QSUD6TNR.mjs → chunk-5U4JST47.mjs} +4 -4
- package/dist/{chunk-PX55IRYL.mjs → chunk-F5KN3REF.mjs} +4 -4
- package/dist/{chunk-N3YQ5IL6.mjs → chunk-NUXJHSSQ.mjs} +11 -11
- package/dist/{chunk-7MOQ462O.mjs → chunk-WQFYA2BW.mjs} +3 -3
- package/dist/{chunk-J74WVZGF.mjs → chunk-XNQJRIGR.mjs} +9 -9
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/mobile/bucket-events/emit-bucket-frame.ts
|
|
@@ -98,6 +108,315 @@ function validateMobileAuth(config, token) {
|
|
|
98
108
|
|
|
99
109
|
// src/mobile/websocket.ts
|
|
100
110
|
var import_ws = require("ws");
|
|
111
|
+
|
|
112
|
+
// src/mobile/agents-watch.ts
|
|
113
|
+
var import_node_fs2 = require("fs");
|
|
114
|
+
|
|
115
|
+
// src/path/root.ts
|
|
116
|
+
var import_memoize = __toESM(require("lodash-es/memoize.js"));
|
|
117
|
+
var import_os2 = require("os");
|
|
118
|
+
var import_path3 = require("path");
|
|
119
|
+
|
|
120
|
+
// src/path/state-dir.ts
|
|
121
|
+
var import_node_fs = require("fs");
|
|
122
|
+
var import_node_os = require("os");
|
|
123
|
+
var import_node_path = require("path");
|
|
124
|
+
|
|
125
|
+
// src/utils/path.ts
|
|
126
|
+
var import_path = require("path");
|
|
127
|
+
var import_os = require("os");
|
|
128
|
+
function validateRootPath(raw, expandTilde = true) {
|
|
129
|
+
if (!raw || raw.trim().length === 0) {
|
|
130
|
+
return { valid: false, reason: "Path is empty" };
|
|
131
|
+
}
|
|
132
|
+
let candidate = raw.trim();
|
|
133
|
+
if (expandTilde && (candidate.startsWith("~/") || candidate.startsWith("~\\"))) {
|
|
134
|
+
const rest = candidate.slice(2);
|
|
135
|
+
const restNorm = (0, import_path.normalize)(rest || ".");
|
|
136
|
+
if (restNorm === "." || restNorm === "..") {
|
|
137
|
+
return { valid: false, reason: "Cannot expand to home or parent directory" };
|
|
138
|
+
}
|
|
139
|
+
candidate = (0, import_path.join)((0, import_os.homedir)(), rest);
|
|
140
|
+
}
|
|
141
|
+
const normalized = (0, import_path.normalize)(candidate).replace(/[/\\]+$/, "");
|
|
142
|
+
if (!(0, import_path.isAbsolute)(normalized)) {
|
|
143
|
+
return { valid: false, reason: "Path must be absolute" };
|
|
144
|
+
}
|
|
145
|
+
if (normalized.length < 3) {
|
|
146
|
+
return { valid: false, reason: "Path too short" };
|
|
147
|
+
}
|
|
148
|
+
if (/^[A-Za-z]:$/.test(normalized)) {
|
|
149
|
+
return { valid: false, reason: "Cannot use drive root directly" };
|
|
150
|
+
}
|
|
151
|
+
if (normalized.startsWith("\\\\") || normalized.startsWith("//")) {
|
|
152
|
+
return { valid: false, reason: "UNC network paths not supported" };
|
|
153
|
+
}
|
|
154
|
+
if (normalized.includes("\0")) {
|
|
155
|
+
return { valid: false, reason: "Path contains null byte" };
|
|
156
|
+
}
|
|
157
|
+
const normalizedWithSep = normalized + import_path.sep;
|
|
158
|
+
return { valid: true, normalizedPath: normalizedWithSep.normalize("NFC") };
|
|
159
|
+
}
|
|
160
|
+
function checkPortableMarker(dir) {
|
|
161
|
+
const fs = require("fs");
|
|
162
|
+
const path = require("path");
|
|
163
|
+
const markerPath = path.join(dir, ".xkzoom_portable");
|
|
164
|
+
try {
|
|
165
|
+
return fs.existsSync(markerPath) && fs.statSync(markerPath).isFile();
|
|
166
|
+
} catch {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// src/path/state-dir.ts
|
|
172
|
+
var XKZOOM_STATE_ROOT_MARKER = "xkzoom-state-root.json";
|
|
173
|
+
var LEGACY_ENV_EXACT_KEYS = /* @__PURE__ */ new Set([
|
|
174
|
+
["OPEN", "CLAW"].join(""),
|
|
175
|
+
["XKZOOM", "ROOT"].join("_"),
|
|
176
|
+
["XK", "ZOOM", "ROOT"].join("_")
|
|
177
|
+
]);
|
|
178
|
+
var LEGACY_ENV_PREFIXES = [
|
|
179
|
+
["OPEN", "CLAW_"].join(""),
|
|
180
|
+
["XKZOOM_", "DO", "NOR_"].join("")
|
|
181
|
+
];
|
|
182
|
+
function isLegacyGatewayEnvKey(key) {
|
|
183
|
+
return LEGACY_ENV_EXACT_KEYS.has(key) || LEGACY_ENV_PREFIXES.some((prefix) => key.startsWith(prefix));
|
|
184
|
+
}
|
|
185
|
+
function findLegacyGatewayEnvKeys(env = process.env) {
|
|
186
|
+
return Object.keys(env).filter((key) => {
|
|
187
|
+
const value = env[key];
|
|
188
|
+
return value != null && String(value).trim() && isLegacyGatewayEnvKey(key);
|
|
189
|
+
}).sort();
|
|
190
|
+
}
|
|
191
|
+
function assertNoLegacyGatewayEnv(env = process.env) {
|
|
192
|
+
const hits = findLegacyGatewayEnvKeys(env);
|
|
193
|
+
if (hits.length > 0) {
|
|
194
|
+
throw new Error(
|
|
195
|
+
`[XKZOOM] retired gateway environment variables are no longer supported: ${hits.join(", ")}. Use XKZOOM_STATE_DIR for the state root and remove retired runtime fallback environment variables.`
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function normalizeTrailingSep(raw) {
|
|
200
|
+
const n = (0, import_node_path.normalize)(raw.trim()).replace(/[/\\]+$/, "");
|
|
201
|
+
return n.length ? n + import_node_path.sep : raw;
|
|
202
|
+
}
|
|
203
|
+
function isPlausibleDirectory(absPath) {
|
|
204
|
+
if (!absPath || absPath.length < 4) return false;
|
|
205
|
+
if (!(0, import_node_path.isAbsolute)(absPath)) return false;
|
|
206
|
+
if (/^[A-Za-z]:$/.test(absPath)) return false;
|
|
207
|
+
if (absPath.startsWith("\\\\") || absPath.startsWith("//")) return false;
|
|
208
|
+
if (absPath.includes("\0")) return false;
|
|
209
|
+
try {
|
|
210
|
+
if (!(0, import_node_fs.existsSync)(absPath)) return false;
|
|
211
|
+
return (0, import_node_fs.statSync)(absPath).isDirectory();
|
|
212
|
+
} catch {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function expandHomePath(raw, userHome) {
|
|
217
|
+
return raw.startsWith("~/") || raw.startsWith("~\\") ? (0, import_node_path.join)(userHome, raw.slice(2)) : raw;
|
|
218
|
+
}
|
|
219
|
+
function readRedirectFromHomeStub(userHome) {
|
|
220
|
+
const stub = (0, import_node_path.join)(userHome, ".xkzoom");
|
|
221
|
+
const marker = (0, import_node_path.join)(stub, XKZOOM_STATE_ROOT_MARKER);
|
|
222
|
+
if (!(0, import_node_fs.existsSync)(marker)) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
try {
|
|
226
|
+
const parsed = JSON.parse((0, import_node_fs.readFileSync)(marker, "utf8"));
|
|
227
|
+
const target = typeof parsed.stateRoot === "string" ? parsed.stateRoot.trim() : "";
|
|
228
|
+
if (!target) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
const expanded = expandHomePath(target, userHome);
|
|
232
|
+
const v = validateRootPath(expanded, true);
|
|
233
|
+
if (!v.valid || !v.normalizedPath) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
const dir = v.normalizedPath.replace(/[/\\]+$/, "");
|
|
237
|
+
return isPlausibleDirectory(dir) ? normalizeTrailingSep(dir) : null;
|
|
238
|
+
} catch {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function resolveDefaultStateDirAfterEnv(userHome = (0, import_node_os.homedir)()) {
|
|
243
|
+
const redirected = readRedirectFromHomeStub(userHome);
|
|
244
|
+
if (redirected) {
|
|
245
|
+
const p = redirected.endsWith(import_node_path.sep) ? redirected : redirected + import_node_path.sep;
|
|
246
|
+
return { rootPath: p, source: "redirect" };
|
|
247
|
+
}
|
|
248
|
+
const fallback = (0, import_node_path.join)(userHome, ".xkzoom") + import_node_path.sep;
|
|
249
|
+
return { rootPath: fallback, source: "default" };
|
|
250
|
+
}
|
|
251
|
+
function resolveXkzoomStateDirForProcess(userHome = (0, import_node_os.homedir)()) {
|
|
252
|
+
assertNoLegacyGatewayEnv(process.env);
|
|
253
|
+
const explicit = process.env.XKZOOM_STATE_DIR?.trim();
|
|
254
|
+
if (explicit) {
|
|
255
|
+
const expanded = expandHomePath(explicit, userHome);
|
|
256
|
+
const v = validateRootPath(expanded, true);
|
|
257
|
+
if (v.valid && v.normalizedPath) {
|
|
258
|
+
return v.normalizedPath;
|
|
259
|
+
}
|
|
260
|
+
throw new Error(`Invalid XKZOOM_STATE_DIR: ${v.valid ? "unknown" : v.reason}`);
|
|
261
|
+
}
|
|
262
|
+
return resolveDefaultStateDirAfterEnv(userHome).rootPath;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// src/path/root.ts
|
|
266
|
+
function rootResolutionCacheKey() {
|
|
267
|
+
return [
|
|
268
|
+
process.env.XKZOOM_STATE_DIR?.trim() ?? "",
|
|
269
|
+
process.cwd()
|
|
270
|
+
].join("\0");
|
|
271
|
+
}
|
|
272
|
+
var getXkRootMemoized = (0, import_memoize.default)(() => {
|
|
273
|
+
assertNoLegacyGatewayEnv(process.env);
|
|
274
|
+
const envStateDir = process.env.XKZOOM_STATE_DIR?.trim();
|
|
275
|
+
if (envStateDir) {
|
|
276
|
+
return {
|
|
277
|
+
rootPath: resolveXkzoomStateDirForProcess((0, import_os2.homedir)()),
|
|
278
|
+
isPortable: false,
|
|
279
|
+
source: "env"
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const cwd = process.cwd();
|
|
283
|
+
if (checkPortableMarker(cwd)) {
|
|
284
|
+
return {
|
|
285
|
+
rootPath: cwd.endsWith("/") || cwd.endsWith("\\") ? cwd : cwd + import_path3.sep,
|
|
286
|
+
isPortable: true,
|
|
287
|
+
source: "portable"
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
const meta = resolveDefaultStateDirAfterEnv((0, import_os2.homedir)());
|
|
291
|
+
return {
|
|
292
|
+
rootPath: meta.rootPath,
|
|
293
|
+
isPortable: false,
|
|
294
|
+
source: meta.source
|
|
295
|
+
};
|
|
296
|
+
}, rootResolutionCacheKey);
|
|
297
|
+
function getXkRoot() {
|
|
298
|
+
return getXkRootMemoized();
|
|
299
|
+
}
|
|
300
|
+
function getXkRootPath() {
|
|
301
|
+
return getXkRoot().rootPath;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// src/path/resolver.ts
|
|
305
|
+
var import_path5 = require("path");
|
|
306
|
+
function resolveXkPath(...segments) {
|
|
307
|
+
const root = getXkRootPath();
|
|
308
|
+
return (0, import_path5.normalize)((0, import_path5.join)(root, ...segments));
|
|
309
|
+
}
|
|
310
|
+
var standardPaths = {
|
|
311
|
+
/** 全局共享记忆 */
|
|
312
|
+
memory: () => resolveXkPath("memory"),
|
|
313
|
+
/** 全局共享技能 */
|
|
314
|
+
skills: () => resolveXkPath("skills"),
|
|
315
|
+
/** 多 Agent 根目录(其下为 `<agentId>/` per-agent 子目录,单 agent 路径用 {@link resolveAgentDir}) */
|
|
316
|
+
agents: () => resolveXkPath("agents"),
|
|
317
|
+
/** 全局会话历史 */
|
|
318
|
+
sessions: () => resolveXkPath("sessions"),
|
|
319
|
+
/** 临时缓存 */
|
|
320
|
+
cache: () => resolveXkPath("cache"),
|
|
321
|
+
/** 全局配置 */
|
|
322
|
+
config: () => resolveXkPath("config"),
|
|
323
|
+
/** 项目默认存储 */
|
|
324
|
+
projects: () => resolveXkPath("projects"),
|
|
325
|
+
/** Legacy 顶层工作区(迁移期保留;新建 agent 一律用 {@link resolveAgentWorkspace}) */
|
|
326
|
+
workspace: () => resolveXkPath("workspace"),
|
|
327
|
+
/** 开发日志 */
|
|
328
|
+
devLog: () => resolveXkPath("dev-log"),
|
|
329
|
+
/** 系统提示词 */
|
|
330
|
+
systemPrompts: () => resolveXkPath("system-prompts")
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
// src/mobile/agents-watch.ts
|
|
334
|
+
var DEBOUNCE_MS = 400;
|
|
335
|
+
var agentsDirWatcher = null;
|
|
336
|
+
var stateRootWatcher = null;
|
|
337
|
+
var debounceTimer = null;
|
|
338
|
+
var started = false;
|
|
339
|
+
function normalizeRel(filename) {
|
|
340
|
+
return (filename ?? "").replace(/\\/g, "/");
|
|
341
|
+
}
|
|
342
|
+
function isRelevantAgentsPath(filename) {
|
|
343
|
+
const rel = normalizeRel(filename);
|
|
344
|
+
if (!rel) {
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
if (!rel.includes("/")) {
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
return rel.endsWith("/IDENTITY.md");
|
|
351
|
+
}
|
|
352
|
+
function startAgentsChangeWatch(onChange) {
|
|
353
|
+
if (started) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
started = true;
|
|
357
|
+
const fire = () => {
|
|
358
|
+
if (debounceTimer) {
|
|
359
|
+
clearTimeout(debounceTimer);
|
|
360
|
+
}
|
|
361
|
+
debounceTimer = setTimeout(() => {
|
|
362
|
+
debounceTimer = null;
|
|
363
|
+
try {
|
|
364
|
+
onChange();
|
|
365
|
+
} catch {
|
|
366
|
+
}
|
|
367
|
+
}, DEBOUNCE_MS);
|
|
368
|
+
};
|
|
369
|
+
try {
|
|
370
|
+
const agentsDir = standardPaths.agents();
|
|
371
|
+
if ((0, import_node_fs2.existsSync)(agentsDir)) {
|
|
372
|
+
agentsDirWatcher = (0, import_node_fs2.watch)(agentsDir, { recursive: true }, (_event, filename) => {
|
|
373
|
+
if (isRelevantAgentsPath(filename)) {
|
|
374
|
+
fire();
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
agentsDirWatcher.on("error", () => {
|
|
378
|
+
});
|
|
379
|
+
agentsDirWatcher.unref();
|
|
380
|
+
}
|
|
381
|
+
} catch {
|
|
382
|
+
agentsDirWatcher = null;
|
|
383
|
+
}
|
|
384
|
+
try {
|
|
385
|
+
const stateRoot = getXkRootPath();
|
|
386
|
+
if ((0, import_node_fs2.existsSync)(stateRoot)) {
|
|
387
|
+
stateRootWatcher = (0, import_node_fs2.watch)(stateRoot, { recursive: false }, (_event, filename) => {
|
|
388
|
+
const rel = normalizeRel(filename);
|
|
389
|
+
if (!rel || rel === "xkzoom.json") {
|
|
390
|
+
fire();
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
stateRootWatcher.on("error", () => {
|
|
394
|
+
});
|
|
395
|
+
stateRootWatcher.unref();
|
|
396
|
+
}
|
|
397
|
+
} catch {
|
|
398
|
+
stateRootWatcher = null;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function stopAgentsChangeWatch() {
|
|
402
|
+
started = false;
|
|
403
|
+
if (debounceTimer) {
|
|
404
|
+
clearTimeout(debounceTimer);
|
|
405
|
+
debounceTimer = null;
|
|
406
|
+
}
|
|
407
|
+
try {
|
|
408
|
+
agentsDirWatcher?.close();
|
|
409
|
+
} catch {
|
|
410
|
+
}
|
|
411
|
+
try {
|
|
412
|
+
stateRootWatcher?.close();
|
|
413
|
+
} catch {
|
|
414
|
+
}
|
|
415
|
+
agentsDirWatcher = null;
|
|
416
|
+
stateRootWatcher = null;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// src/mobile/websocket.ts
|
|
101
420
|
var PENDING_REPLY_TTL_MS = 6e5;
|
|
102
421
|
var PENDING_REPLY_MAX_PER_CONV = 50;
|
|
103
422
|
var HEARTBEAT_INTERVAL_MS = 15e3;
|
|
@@ -660,6 +979,7 @@ var MobileWebSocketServer = class {
|
|
|
660
979
|
}
|
|
661
980
|
}
|
|
662
981
|
close() {
|
|
982
|
+
stopAgentsChangeWatch();
|
|
663
983
|
this.connections.forEach((ws) => ws.close());
|
|
664
984
|
this.connections.clear();
|
|
665
985
|
this.conversationTargets.clear();
|
|
@@ -683,6 +1003,13 @@ var wssInstance = null;
|
|
|
683
1003
|
function getMobileWebSocketServer() {
|
|
684
1004
|
if (!wssInstance) {
|
|
685
1005
|
wssInstance = new MobileWebSocketServer();
|
|
1006
|
+
startAgentsChangeWatch(() => {
|
|
1007
|
+
wssInstance?.broadcast({
|
|
1008
|
+
type: "agents_changed" /* AGENTS_CHANGED */,
|
|
1009
|
+
data: {},
|
|
1010
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1011
|
+
});
|
|
1012
|
+
});
|
|
686
1013
|
}
|
|
687
1014
|
return wssInstance;
|
|
688
1015
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
broadcastBucketFrame
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-FCK6QFJB.mjs";
|
|
4
|
+
import "../../chunk-MMWLRPKT.mjs";
|
|
5
5
|
import "../../chunk-FU5NWQEP.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-YTBKWX7J.mjs";
|
|
7
|
+
import "../../chunk-LKSRZTSL.mjs";
|
|
8
|
+
import "../../chunk-73YFGE5V.mjs";
|
|
9
|
+
import "../../chunk-LMB7TNJB.mjs";
|
|
10
|
+
import "../../chunk-7Y5EWBLN.mjs";
|
|
11
|
+
import "../../chunk-SP7HKWOH.mjs";
|
|
7
12
|
import "../../chunk-HEBXNMVQ.mjs";
|
|
8
13
|
export {
|
|
9
14
|
broadcastBucketFrame
|