@sema-agent/cli 1.0.41 → 1.0.43
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/npm-shrinkwrap.json +14 -14
- package/package.json +5 -5
- package/sema.js +598 -605
package/sema.js
CHANGED
|
@@ -216993,7 +216993,7 @@ var require_filesystem = __commonJS({
|
|
|
216993
216993
|
var LDD_PATH = "/usr/bin/ldd";
|
|
216994
216994
|
var SELF_PATH = "/proc/self/exe";
|
|
216995
216995
|
var MAX_LENGTH = 2048;
|
|
216996
|
-
var
|
|
216996
|
+
var readFileSync55 = (path27) => {
|
|
216997
216997
|
const fd2 = fs15.openSync(path27, "r");
|
|
216998
216998
|
const buffer5 = Buffer.alloc(MAX_LENGTH);
|
|
216999
216999
|
const bytesRead = fs15.readSync(fd2, buffer5, 0, MAX_LENGTH, 0);
|
|
@@ -217018,7 +217018,7 @@ var require_filesystem = __commonJS({
|
|
|
217018
217018
|
module2.exports = {
|
|
217019
217019
|
LDD_PATH,
|
|
217020
217020
|
SELF_PATH,
|
|
217021
|
-
readFileSync:
|
|
217021
|
+
readFileSync: readFileSync55,
|
|
217022
217022
|
readFile: readFile59
|
|
217023
217023
|
};
|
|
217024
217024
|
}
|
|
@@ -217067,7 +217067,7 @@ var require_detect_libc = __commonJS({
|
|
|
217067
217067
|
"use strict";
|
|
217068
217068
|
var childProcess3 = __require("child_process");
|
|
217069
217069
|
var { isLinux: isLinux2, getReport: getReport2 } = require_process();
|
|
217070
|
-
var { LDD_PATH, SELF_PATH, readFile: readFile59, readFileSync:
|
|
217070
|
+
var { LDD_PATH, SELF_PATH, readFile: readFile59, readFileSync: readFileSync55 } = require_filesystem();
|
|
217071
217071
|
var { interpreterPath } = require_elf();
|
|
217072
217072
|
var cachedFamilyInterpreter;
|
|
217073
217073
|
var cachedFamilyFilesystem;
|
|
@@ -217159,7 +217159,7 @@ var require_detect_libc = __commonJS({
|
|
|
217159
217159
|
}
|
|
217160
217160
|
cachedFamilyFilesystem = null;
|
|
217161
217161
|
try {
|
|
217162
|
-
const lddContent =
|
|
217162
|
+
const lddContent = readFileSync55(LDD_PATH);
|
|
217163
217163
|
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
217164
217164
|
} catch (e) {
|
|
217165
217165
|
}
|
|
@@ -217184,7 +217184,7 @@ var require_detect_libc = __commonJS({
|
|
|
217184
217184
|
}
|
|
217185
217185
|
cachedFamilyInterpreter = null;
|
|
217186
217186
|
try {
|
|
217187
|
-
const selfContent =
|
|
217187
|
+
const selfContent = readFileSync55(SELF_PATH);
|
|
217188
217188
|
const path27 = interpreterPath(selfContent);
|
|
217189
217189
|
cachedFamilyInterpreter = familyFromInterpreterPath(path27);
|
|
217190
217190
|
} catch (e) {
|
|
@@ -217248,7 +217248,7 @@ var require_detect_libc = __commonJS({
|
|
|
217248
217248
|
}
|
|
217249
217249
|
cachedVersionFilesystem = null;
|
|
217250
217250
|
try {
|
|
217251
|
-
const lddContent =
|
|
217251
|
+
const lddContent = readFileSync55(LDD_PATH);
|
|
217252
217252
|
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
217253
217253
|
if (versionMatch) {
|
|
217254
217254
|
cachedVersionFilesystem = versionMatch[1];
|
|
@@ -244604,6 +244604,7 @@ var init_modelChannels = __esm({
|
|
|
244604
244604
|
var engineSideChannel_exports = {};
|
|
244605
244605
|
__export(engineSideChannel_exports, {
|
|
244606
244606
|
UTILITY_EXCLUDE_ALL_TOOLS: () => UTILITY_EXCLUDE_ALL_TOOLS,
|
|
244607
|
+
__resetSideQueryCapCacheForTest: () => __resetSideQueryCapCacheForTest,
|
|
244607
244608
|
engineSideChannelActive: () => engineSideChannelActive,
|
|
244608
244609
|
engineUtilityTask: () => engineUtilityTask,
|
|
244609
244610
|
engineUtilityText: () => engineUtilityText,
|
|
@@ -244613,6 +244614,56 @@ __export(engineSideChannel_exports, {
|
|
|
244613
244614
|
});
|
|
244614
244615
|
import { readFileSync as readFileSync23 } from "node:fs";
|
|
244615
244616
|
import { join as join73 } from "node:path";
|
|
244617
|
+
async function sideQueryCapable(client4, baseUrl, budget, signal) {
|
|
244618
|
+
const hit = sideQueryCapByBase.get(baseUrl);
|
|
244619
|
+
if (hit && (hit.ok || Date.now() - hit.at < CAP_FALSE_RETRY_TTL_MS)) return hit.ok;
|
|
244620
|
+
try {
|
|
244621
|
+
const caps = await withTimeoutSignal(
|
|
244622
|
+
Math.min(CAPS_PROBE_TIMEOUT_MS, budget.remaining()),
|
|
244623
|
+
signal,
|
|
244624
|
+
(s) => client4.capabilities({ signal: s })
|
|
244625
|
+
);
|
|
244626
|
+
const ok2 = caps.sideQuery === true;
|
|
244627
|
+
sideQueryCapByBase.set(baseUrl, { ok: ok2, at: Date.now() });
|
|
244628
|
+
return ok2;
|
|
244629
|
+
} catch {
|
|
244630
|
+
return false;
|
|
244631
|
+
}
|
|
244632
|
+
}
|
|
244633
|
+
function __resetSideQueryCapCacheForTest() {
|
|
244634
|
+
sideQueryCapByBase.clear();
|
|
244635
|
+
}
|
|
244636
|
+
async function withTimeoutSignal(timeoutMs, outer, fn2) {
|
|
244637
|
+
const controller = new AbortController();
|
|
244638
|
+
const timer2 = setTimeout(() => controller.abort(), timeoutMs);
|
|
244639
|
+
const onOuterAbort = () => controller.abort();
|
|
244640
|
+
if (outer?.aborted) controller.abort();
|
|
244641
|
+
else outer?.addEventListener("abort", onOuterAbort, { once: true });
|
|
244642
|
+
try {
|
|
244643
|
+
return await fn2(controller.signal);
|
|
244644
|
+
} finally {
|
|
244645
|
+
clearTimeout(timer2);
|
|
244646
|
+
outer?.removeEventListener("abort", onOuterAbort);
|
|
244647
|
+
}
|
|
244648
|
+
}
|
|
244649
|
+
function sideQueryTextOf(r) {
|
|
244650
|
+
const err8 = typeof r.errorMessage === "string" && r.errorMessage.trim() ? r.errorMessage : void 0;
|
|
244651
|
+
if (err8) throw new Error(`sema engine side-channel: ${err8}`);
|
|
244652
|
+
const text2 = typeof r.text === "string" ? r.text.trim() : "";
|
|
244653
|
+
if (!text2) throw new Error("sema engine side-channel: empty result");
|
|
244654
|
+
return text2;
|
|
244655
|
+
}
|
|
244656
|
+
function usageFromSideQuery(r) {
|
|
244657
|
+
if (r.usageMissing === true) return null;
|
|
244658
|
+
const u = r.usage;
|
|
244659
|
+
if (!u || typeof u !== "object") return null;
|
|
244660
|
+
return {
|
|
244661
|
+
input_tokens: u.input ?? 0,
|
|
244662
|
+
output_tokens: u.output ?? 0,
|
|
244663
|
+
cache_creation_input_tokens: u.cacheWrite ?? 0,
|
|
244664
|
+
cache_read_input_tokens: u.cacheRead ?? 0
|
|
244665
|
+
};
|
|
244666
|
+
}
|
|
244616
244667
|
function mintSideSessionId() {
|
|
244617
244668
|
return `side-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
244618
244669
|
}
|
|
@@ -244639,7 +244690,11 @@ async function resolvePoolModelRef(callerModel) {
|
|
|
244639
244690
|
return void 0;
|
|
244640
244691
|
}
|
|
244641
244692
|
}
|
|
244642
|
-
|
|
244693
|
+
function makeBudget(totalMs) {
|
|
244694
|
+
const start = Date.now();
|
|
244695
|
+
return { remaining: () => Math.max(1, totalMs - (Date.now() - start)) };
|
|
244696
|
+
}
|
|
244697
|
+
async function engineUtilityCall(opts) {
|
|
244643
244698
|
const baseUrl = process.env.SEMA_LIVE_BASEURL;
|
|
244644
244699
|
if (!baseUrl) return null;
|
|
244645
244700
|
const token = resolveEngineToken();
|
|
@@ -244649,77 +244704,39 @@ async function engineUtilityText(opts) {
|
|
|
244649
244704
|
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
244650
244705
|
});
|
|
244651
244706
|
if (!client4) throw new Error("sema engine side-channel: wire client unavailable");
|
|
244652
|
-
const cheap = process.env.MODEL_CHEAP_ID?.trim() || void 0;
|
|
244653
|
-
const
|
|
244707
|
+
const cheap = opts.cheapSlot ? process.env.MODEL_CHEAP_ID?.trim() || void 0 : void 0;
|
|
244708
|
+
const budget = makeBudget(opts.timeoutMs ?? SIDE_CHANNEL_TIMEOUT_MS);
|
|
244709
|
+
const firstModel = opts.modelRef ?? cheap;
|
|
244654
244710
|
const statusOf2 = (e) => {
|
|
244655
244711
|
const s = e?.status;
|
|
244656
244712
|
return typeof s === "number" ? s : void 0;
|
|
244657
244713
|
};
|
|
244658
|
-
const
|
|
244659
|
-
const
|
|
244660
|
-
|
|
244661
|
-
|
|
244662
|
-
|
|
244663
|
-
else opts.signal?.addEventListener("abort", onOuterAbort, { once: true });
|
|
244664
|
-
try {
|
|
244665
|
-
return await client4.tasks.submit(
|
|
244714
|
+
const tasksArm = async () => {
|
|
244715
|
+
const submit = (model) => withTimeoutSignal(
|
|
244716
|
+
budget.remaining(),
|
|
244717
|
+
opts.signal,
|
|
244718
|
+
(signal) => client4.tasks.submit(
|
|
244666
244719
|
{
|
|
244667
244720
|
objective: opts.objective,
|
|
244668
244721
|
sessionId: mintSideSessionId(),
|
|
244669
244722
|
// 独立 session:utility 提示词绝不进主会话历史
|
|
244670
244723
|
...model ? { model } : {},
|
|
244671
|
-
...opts.maxTokens ? { maxTokens: opts.maxTokens } : {}
|
|
244724
|
+
...opts.maxTokens ? { maxTokens: opts.maxTokens } : {},
|
|
244725
|
+
...opts.systemPrompt ? { systemPrompt: opts.systemPrompt } : {},
|
|
244726
|
+
...opts.excludeTools ? { excludeTools: [...opts.excludeTools] } : {}
|
|
244672
244727
|
},
|
|
244673
|
-
{ signal
|
|
244674
|
-
)
|
|
244675
|
-
} finally {
|
|
244676
|
-
clearTimeout(timer2);
|
|
244677
|
-
opts.signal?.removeEventListener("abort", onOuterAbort);
|
|
244678
|
-
}
|
|
244679
|
-
};
|
|
244680
|
-
const firstModel = opts.modelRef ?? cheap;
|
|
244681
|
-
let data;
|
|
244682
|
-
try {
|
|
244683
|
-
data = await submit(firstModel);
|
|
244684
|
-
} catch (e) {
|
|
244685
|
-
const status3 = statusOf2(e);
|
|
244686
|
-
if (opts.noFallback || status3 === void 0 || !firstModel || !CATALOG_GATE_STATUSES.has(status3)) throw e;
|
|
244687
|
-
logForDebugging(`[side-channel] engine ${status3} with model=${firstModel} \u2014 retrying on the default model`);
|
|
244688
|
-
data = await submit(void 0);
|
|
244689
|
-
}
|
|
244690
|
-
const text2 = typeof data.result === "string" ? data.result.trim() : "";
|
|
244691
|
-
if (!text2) throw new Error("sema engine side-channel: empty result");
|
|
244692
|
-
return text2;
|
|
244693
|
-
}
|
|
244694
|
-
async function engineUtilityTask(opts) {
|
|
244695
|
-
const baseUrl = process.env.SEMA_LIVE_BASEURL;
|
|
244696
|
-
if (!baseUrl) throw new Error("sema engine side-channel: not active");
|
|
244697
|
-
const token = resolveEngineToken();
|
|
244698
|
-
const client4 = makeEngineWireClient({
|
|
244699
|
-
baseUrl,
|
|
244700
|
-
...token ? { token } : {},
|
|
244701
|
-
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
244702
|
-
});
|
|
244703
|
-
if (!client4) throw new Error("sema engine side-channel: wire client unavailable");
|
|
244704
|
-
const timeoutMs = opts.timeoutMs ?? SIDE_CHANNEL_TIMEOUT_MS;
|
|
244705
|
-
const controller = new AbortController();
|
|
244706
|
-
const timer2 = setTimeout(() => controller.abort(), timeoutMs);
|
|
244707
|
-
const onOuterAbort = () => controller.abort();
|
|
244708
|
-
if (opts.signal?.aborted) controller.abort();
|
|
244709
|
-
else opts.signal?.addEventListener("abort", onOuterAbort, { once: true });
|
|
244710
|
-
try {
|
|
244711
|
-
const data = await client4.tasks.submit(
|
|
244712
|
-
{
|
|
244713
|
-
objective: opts.objective,
|
|
244714
|
-
sessionId: mintSideSessionId(),
|
|
244715
|
-
// 独立 session:utility 提示词绝不进主会话历史
|
|
244716
|
-
...opts.modelRef ? { model: opts.modelRef } : {},
|
|
244717
|
-
...opts.maxTokens ? { maxTokens: opts.maxTokens } : {},
|
|
244718
|
-
...opts.systemPrompt ? { systemPrompt: opts.systemPrompt } : {},
|
|
244719
|
-
...opts.excludeTools ? { excludeTools: [...opts.excludeTools] } : {}
|
|
244720
|
-
},
|
|
244721
|
-
{ signal: controller.signal, idempotencyKey: null }
|
|
244728
|
+
{ signal, idempotencyKey: null }
|
|
244729
|
+
)
|
|
244722
244730
|
);
|
|
244731
|
+
let data;
|
|
244732
|
+
try {
|
|
244733
|
+
data = await submit(firstModel);
|
|
244734
|
+
} catch (e) {
|
|
244735
|
+
const status3 = statusOf2(e);
|
|
244736
|
+
if (opts.noFallback || status3 === void 0 || !firstModel || !CATALOG_GATE_STATUSES.has(status3)) throw e;
|
|
244737
|
+
logForDebugging(`[side-channel] engine ${status3} with model=${firstModel} \u2014 retrying on the default model`);
|
|
244738
|
+
data = await submit(void 0);
|
|
244739
|
+
}
|
|
244723
244740
|
const text2 = typeof data.result === "string" ? data.result.trim() : "";
|
|
244724
244741
|
if (!text2) throw new Error("sema engine side-channel: empty result");
|
|
244725
244742
|
const st2 = data.stats;
|
|
@@ -244730,10 +244747,47 @@ async function engineUtilityTask(opts) {
|
|
|
244730
244747
|
cache_read_input_tokens: st2.cachedTokens ?? 0
|
|
244731
244748
|
} : null;
|
|
244732
244749
|
return { text: text2, usage };
|
|
244733
|
-
}
|
|
244734
|
-
|
|
244735
|
-
|
|
244750
|
+
};
|
|
244751
|
+
if (await sideQueryCapable(client4, baseUrl, budget, opts.signal)) {
|
|
244752
|
+
const query2 = (model) => withTimeoutSignal(
|
|
244753
|
+
budget.remaining(),
|
|
244754
|
+
opts.signal,
|
|
244755
|
+
(signal) => client4.sideQuery.query(
|
|
244756
|
+
{
|
|
244757
|
+
messages: [{ role: "user", content: opts.objective }],
|
|
244758
|
+
...model ? { model } : {},
|
|
244759
|
+
...opts.maxTokens ? { maxOutputTokens: opts.maxTokens } : {},
|
|
244760
|
+
...opts.systemPrompt ? { systemPrompt: opts.systemPrompt } : {}
|
|
244761
|
+
},
|
|
244762
|
+
{ signal }
|
|
244763
|
+
)
|
|
244764
|
+
);
|
|
244765
|
+
let r;
|
|
244766
|
+
try {
|
|
244767
|
+
r = await query2(firstModel);
|
|
244768
|
+
} catch (e) {
|
|
244769
|
+
const status3 = statusOf2(e);
|
|
244770
|
+
if (status3 !== void 0 && ENDPOINT_GONE_STATUSES.has(status3)) {
|
|
244771
|
+
sideQueryCapByBase.set(baseUrl, { ok: false, at: Date.now() });
|
|
244772
|
+
logForDebugging(`[side-channel] side-query endpoint gone (${status3}) \u2014 falling back to tasks`);
|
|
244773
|
+
return await tasksArm();
|
|
244774
|
+
}
|
|
244775
|
+
if (opts.noFallback || status3 === void 0 || !firstModel || !SIDEQUERY_MODEL_GATE_STATUSES.has(status3)) throw e;
|
|
244776
|
+
logForDebugging(`[side-channel] side-query ${status3} with model=${firstModel} \u2014 retrying on the default model`);
|
|
244777
|
+
r = await query2(void 0);
|
|
244778
|
+
}
|
|
244779
|
+
return { text: sideQueryTextOf(r), usage: usageFromSideQuery(r) };
|
|
244736
244780
|
}
|
|
244781
|
+
return await tasksArm();
|
|
244782
|
+
}
|
|
244783
|
+
async function engineUtilityText(opts) {
|
|
244784
|
+
const r = await engineUtilityCall({ ...opts, cheapSlot: true });
|
|
244785
|
+
return r === null ? null : r.text;
|
|
244786
|
+
}
|
|
244787
|
+
async function engineUtilityTask(opts) {
|
|
244788
|
+
const r = await engineUtilityCall(opts);
|
|
244789
|
+
if (r === null) throw new Error("sema engine side-channel: not active");
|
|
244790
|
+
return r;
|
|
244737
244791
|
}
|
|
244738
244792
|
function extractJsonObjectText(text2) {
|
|
244739
244793
|
const m2 = text2.match(/\{[\s\S]*\}/);
|
|
@@ -244751,14 +244805,19 @@ function jsonDisciplineSuffix(schema) {
|
|
|
244751
244805
|
Return ONLY a JSON object (no prose, no markdown code fences) that matches this JSON Schema:
|
|
244752
244806
|
${JSON.stringify(schema)}`;
|
|
244753
244807
|
}
|
|
244754
|
-
var SIDE_CHANNEL_TIMEOUT_MS, CATALOG_GATE_STATUSES, UTILITY_EXCLUDE_ALL_TOOLS;
|
|
244808
|
+
var SIDE_CHANNEL_TIMEOUT_MS, sideQueryCapByBase, CAPS_PROBE_TIMEOUT_MS, CAP_FALSE_RETRY_TTL_MS, CATALOG_GATE_STATUSES, SIDEQUERY_MODEL_GATE_STATUSES, ENDPOINT_GONE_STATUSES, UTILITY_EXCLUDE_ALL_TOOLS;
|
|
244755
244809
|
var init_engineSideChannel = __esm({
|
|
244756
244810
|
"build-src/src/sema/engineSideChannel.ts"() {
|
|
244757
244811
|
init_debug();
|
|
244758
244812
|
init_envUtils();
|
|
244759
244813
|
init_engineWireSdk();
|
|
244760
244814
|
SIDE_CHANNEL_TIMEOUT_MS = 6e4;
|
|
244815
|
+
sideQueryCapByBase = /* @__PURE__ */ new Map();
|
|
244816
|
+
CAPS_PROBE_TIMEOUT_MS = 5e3;
|
|
244817
|
+
CAP_FALSE_RETRY_TTL_MS = 5 * 6e4;
|
|
244761
244818
|
CATALOG_GATE_STATUSES = /* @__PURE__ */ new Set([400, 404, 422]);
|
|
244819
|
+
SIDEQUERY_MODEL_GATE_STATUSES = /* @__PURE__ */ new Set([400, 422]);
|
|
244820
|
+
ENDPOINT_GONE_STATUSES = /* @__PURE__ */ new Set([404, 405, 501]);
|
|
244762
244821
|
UTILITY_EXCLUDE_ALL_TOOLS = [
|
|
244763
244822
|
"Bash",
|
|
244764
244823
|
"PowerShell",
|
|
@@ -272356,14 +272415,16 @@ async function semaSideQueryViaEngine(opts, side) {
|
|
|
272356
272415
|
else if (opts.output_format?.schema) objective += side.jsonDisciplineSuffix(opts.output_format.schema);
|
|
272357
272416
|
const isModelValidation = opts.querySource === "model_validation";
|
|
272358
272417
|
const modelRef = await side.resolvePoolModelRef(opts.model) ?? (isModelValidation ? opts.model : void 0);
|
|
272359
|
-
const
|
|
272418
|
+
const r = await side.engineUtilityTask({
|
|
272360
272419
|
objective,
|
|
272361
272420
|
signal: opts.signal,
|
|
272362
272421
|
// validateModel 类 1-token ping 在任务语义下会空转 → 托底 16,verdict 仍由成功/失败承载
|
|
272363
272422
|
maxTokens: Math.max(16, opts.max_tokens ?? 1024),
|
|
272364
272423
|
modelRef,
|
|
272365
|
-
noFallback: isModelValidation
|
|
272366
|
-
|
|
272424
|
+
noFallback: isModelValidation,
|
|
272425
|
+
cheapSlot: true
|
|
272426
|
+
});
|
|
272427
|
+
const text2 = r.text;
|
|
272367
272428
|
const stamp2 = Date.now().toString(36);
|
|
272368
272429
|
let content;
|
|
272369
272430
|
if (forcedTool) {
|
|
@@ -272390,7 +272451,8 @@ async function semaSideQueryViaEngine(opts, side) {
|
|
|
272390
272451
|
content,
|
|
272391
272452
|
stop_reason: "end_turn",
|
|
272392
272453
|
stop_sequence: null,
|
|
272393
|
-
|
|
272454
|
+
// 对抗复审批 #3:verb 臂权威 usage / tasks 臂 TaskStats 映射;引擎无账时诚实零
|
|
272455
|
+
usage: r.usage ?? {
|
|
272394
272456
|
input_tokens: 0,
|
|
272395
272457
|
output_tokens: 0,
|
|
272396
272458
|
cache_creation_input_tokens: 0,
|
|
@@ -334040,9 +334102,9 @@ function streamingTailWrap(unstableSuffix) {
|
|
|
334040
334102
|
var import_compiler_runtime43, import_react43, import_jsx_runtime53, TOKEN_CACHE_MAX, tokenCache, MD_SYNTAX_RE;
|
|
334041
334103
|
var init_Markdown = __esm({
|
|
334042
334104
|
"build-src/src/components/Markdown.tsx"() {
|
|
334043
|
-
import_compiler_runtime43 = __toESM(require_compiler_runtime()
|
|
334105
|
+
import_compiler_runtime43 = __toESM(require_compiler_runtime());
|
|
334044
334106
|
init_marked_esm();
|
|
334045
|
-
import_react43 = __toESM(require_react()
|
|
334107
|
+
import_react43 = __toESM(require_react());
|
|
334046
334108
|
init_useSettings();
|
|
334047
334109
|
init_ink2();
|
|
334048
334110
|
init_cliHighlight();
|
|
@@ -334050,7 +334112,7 @@ var init_Markdown = __esm({
|
|
|
334050
334112
|
init_markdown();
|
|
334051
334113
|
init_messages4();
|
|
334052
334114
|
init_MarkdownTable();
|
|
334053
|
-
import_jsx_runtime53 = __toESM(require_jsx_runtime()
|
|
334115
|
+
import_jsx_runtime53 = __toESM(require_jsx_runtime());
|
|
334054
334116
|
TOKEN_CACHE_MAX = 500;
|
|
334055
334117
|
tokenCache = /* @__PURE__ */ new Map();
|
|
334056
334118
|
MD_SYNTAX_RE = /[#*`|[>\-_~]|\n\n|^\d+\. |\n\d+\. /;
|
|
@@ -355919,7 +355981,7 @@ function useClaudeAiLimits() {
|
|
|
355919
355981
|
var import_react64;
|
|
355920
355982
|
var init_claudeAiLimitsHook = __esm({
|
|
355921
355983
|
"build-src/src/services/claudeAiLimitsHook.ts"() {
|
|
355922
|
-
import_react64 = __toESM(require_react()
|
|
355984
|
+
import_react64 = __toESM(require_react());
|
|
355923
355985
|
init_claudeAiLimits();
|
|
355924
355986
|
}
|
|
355925
355987
|
});
|
|
@@ -399162,14 +399224,14 @@ var require_turndown_cjs = __commonJS({
|
|
|
399162
399224
|
} else if (node.nodeType === 1) {
|
|
399163
399225
|
replacement = replacementForNode.call(self2, node);
|
|
399164
399226
|
}
|
|
399165
|
-
return
|
|
399227
|
+
return join207(output, replacement);
|
|
399166
399228
|
}, "");
|
|
399167
399229
|
}
|
|
399168
399230
|
function postProcess(output) {
|
|
399169
399231
|
var self2 = this;
|
|
399170
399232
|
this.rules.forEach(function(rule) {
|
|
399171
399233
|
if (typeof rule.append === "function") {
|
|
399172
|
-
output =
|
|
399234
|
+
output = join207(output, rule.append(self2.options));
|
|
399173
399235
|
}
|
|
399174
399236
|
});
|
|
399175
399237
|
return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
@@ -399181,7 +399243,7 @@ var require_turndown_cjs = __commonJS({
|
|
|
399181
399243
|
if (whitespace.leading || whitespace.trailing) content = content.trim();
|
|
399182
399244
|
return whitespace.leading + rule.replacement(content, node, this.options) + whitespace.trailing;
|
|
399183
399245
|
}
|
|
399184
|
-
function
|
|
399246
|
+
function join207(output, replacement) {
|
|
399185
399247
|
var s1 = trimTrailingNewlines(output);
|
|
399186
399248
|
var s2 = trimLeadingNewlines(replacement);
|
|
399187
399249
|
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
@@ -434366,8 +434428,8 @@ Fix: run \`sema doctor\` to diagnose, or restart sema to retry.`,
|
|
|
434366
434428
|
const { hasOwnModelConfig: hasOwnModelConfig2, computeCcFallbackEnv: computeCcFallbackEnv2 } = await Promise.resolve().then(() => (init_ccConfigFallback(), ccConfigFallback_exports));
|
|
434367
434429
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
|
|
434368
434430
|
const { existsSync: existsSync36 } = await import("node:fs");
|
|
434369
|
-
const { join:
|
|
434370
|
-
const hasCatalog = existsSync36(
|
|
434431
|
+
const { join: join207 } = await import("node:path");
|
|
434432
|
+
const hasCatalog = existsSync36(join207(getClaudeConfigHomeDir3(), "config.d", "models.json"));
|
|
434371
434433
|
if (!hasOwnModelConfig2(process.env) && !hasCatalog && !computeCcFallbackEnv2(process.env)) {
|
|
434372
434434
|
yield createAssistantAPIErrorMessage({
|
|
434373
434435
|
content: `Model not configured \u2014 this message was NOT sent.
|
|
@@ -476641,88 +476703,18 @@ ${args ? "Additional user input: " + args : ""}
|
|
|
476641
476703
|
});
|
|
476642
476704
|
|
|
476643
476705
|
// build-src/src/sema/recapEngine.ts
|
|
476644
|
-
import { readFileSync as readFileSync29 } from "node:fs";
|
|
476645
|
-
import { join as join145 } from "node:path";
|
|
476646
476706
|
function getLastRecapEngineFailure() {
|
|
476647
476707
|
return lastFailure;
|
|
476648
476708
|
}
|
|
476649
|
-
function resolveEngineToken2() {
|
|
476650
|
-
const envToken = process.env.SEMA_LIVE_TOKEN ?? "";
|
|
476651
|
-
if (envToken) return envToken;
|
|
476652
|
-
try {
|
|
476653
|
-
return readFileSync29(join145(getClaudeConfigHomeDir(), "engine.token"), "utf-8").trim();
|
|
476654
|
-
} catch {
|
|
476655
|
-
return "";
|
|
476656
|
-
}
|
|
476657
|
-
}
|
|
476658
476709
|
async function recapViaEngine(objective, signal) {
|
|
476659
|
-
|
|
476660
|
-
if (!baseUrl) {
|
|
476710
|
+
if (!engineSideChannelActive()) {
|
|
476661
476711
|
lastFailure = "engine not running (no live wire)";
|
|
476662
476712
|
return null;
|
|
476663
476713
|
}
|
|
476664
|
-
const token = resolveEngineToken2();
|
|
476665
|
-
const cheap = process.env.MODEL_CHEAP_ID?.trim() || void 0;
|
|
476666
|
-
const client4 = makeEngineWireClient({
|
|
476667
|
-
baseUrl,
|
|
476668
|
-
...token ? { token } : {},
|
|
476669
|
-
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
476670
|
-
});
|
|
476671
|
-
if (!client4) {
|
|
476672
|
-
lastFailure = "engine not running (no live wire)";
|
|
476673
|
-
return null;
|
|
476674
|
-
}
|
|
476675
|
-
const statusOf2 = (e) => {
|
|
476676
|
-
const s = e?.status;
|
|
476677
|
-
return typeof s === "number" ? s : void 0;
|
|
476678
|
-
};
|
|
476679
|
-
const submit = async (model) => {
|
|
476680
|
-
const controller = new AbortController();
|
|
476681
|
-
const timer2 = setTimeout(() => controller.abort(), RECAP_TIMEOUT_MS);
|
|
476682
|
-
const onOuterAbort = () => controller.abort();
|
|
476683
|
-
if (signal.aborted) controller.abort();
|
|
476684
|
-
else signal.addEventListener("abort", onOuterAbort, { once: true });
|
|
476685
|
-
try {
|
|
476686
|
-
return await client4.tasks.submit(
|
|
476687
|
-
{
|
|
476688
|
-
objective,
|
|
476689
|
-
sessionId: `side-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`,
|
|
476690
|
-
...model ? { model } : {}
|
|
476691
|
-
},
|
|
476692
|
-
{ signal: controller.signal, idempotencyKey: null }
|
|
476693
|
-
);
|
|
476694
|
-
} finally {
|
|
476695
|
-
clearTimeout(timer2);
|
|
476696
|
-
signal.removeEventListener("abort", onOuterAbort);
|
|
476697
|
-
}
|
|
476698
|
-
};
|
|
476699
476714
|
try {
|
|
476700
|
-
|
|
476701
|
-
|
|
476702
|
-
|
|
476703
|
-
} catch (e) {
|
|
476704
|
-
const status3 = statusOf2(e);
|
|
476705
|
-
if (status3 === void 0) throw e;
|
|
476706
|
-
if (!cheap) {
|
|
476707
|
-
lastFailure = `engine returned ${status3}`;
|
|
476708
|
-
logForDebugging(`[recap] ${lastFailure}`);
|
|
476709
|
-
return null;
|
|
476710
|
-
}
|
|
476711
|
-
logForDebugging(`[recap] engine ${status3} with model=${cheap} \u2014 retrying on the default model`);
|
|
476712
|
-
try {
|
|
476713
|
-
data = await submit(void 0);
|
|
476714
|
-
} catch (e2) {
|
|
476715
|
-
const s2 = statusOf2(e2);
|
|
476716
|
-
if (s2 === void 0) throw e2;
|
|
476717
|
-
lastFailure = `engine returned ${s2}`;
|
|
476718
|
-
logForDebugging(`[recap] ${lastFailure}`);
|
|
476719
|
-
return null;
|
|
476720
|
-
}
|
|
476721
|
-
}
|
|
476722
|
-
const text2 = typeof data.result === "string" ? data.result.trim() : "";
|
|
476723
|
-
if (!text2) {
|
|
476724
|
-
lastFailure = "engine returned an empty result";
|
|
476725
|
-
logForDebugging(`[recap] ${lastFailure}`);
|
|
476715
|
+
const text2 = await engineUtilityText({ objective, signal, timeoutMs: RECAP_TIMEOUT_MS });
|
|
476716
|
+
if (text2 === null) {
|
|
476717
|
+
lastFailure = "engine not running (no live wire)";
|
|
476726
476718
|
return null;
|
|
476727
476719
|
}
|
|
476728
476720
|
lastFailure = null;
|
|
@@ -476732,6 +476724,17 @@ async function recapViaEngine(objective, signal) {
|
|
|
476732
476724
|
lastFailure = null;
|
|
476733
476725
|
return null;
|
|
476734
476726
|
}
|
|
476727
|
+
const status3 = err8?.status;
|
|
476728
|
+
if (typeof status3 === "number") {
|
|
476729
|
+
lastFailure = `engine returned ${status3}`;
|
|
476730
|
+
logForDebugging(`[recap] ${lastFailure}`);
|
|
476731
|
+
return null;
|
|
476732
|
+
}
|
|
476733
|
+
if (err8 instanceof Error && err8.message.includes("empty result")) {
|
|
476734
|
+
lastFailure = "engine returned an empty result";
|
|
476735
|
+
logForDebugging(`[recap] ${lastFailure}`);
|
|
476736
|
+
return null;
|
|
476737
|
+
}
|
|
476735
476738
|
const aborted2 = err8 instanceof Error && err8.name === "AbortError";
|
|
476736
476739
|
lastFailure = aborted2 ? `engine timed out after ${RECAP_TIMEOUT_MS / 1e3}s` : `engine unreachable (${err8 instanceof Error ? err8.message : String(err8)})`;
|
|
476737
476740
|
logForDebugging(`[recap] ${lastFailure}`);
|
|
@@ -476742,8 +476745,7 @@ var RECAP_TIMEOUT_MS, lastFailure;
|
|
|
476742
476745
|
var init_recapEngine = __esm({
|
|
476743
476746
|
"build-src/src/sema/recapEngine.ts"() {
|
|
476744
476747
|
init_debug();
|
|
476745
|
-
|
|
476746
|
-
init_engineWireSdk();
|
|
476748
|
+
init_engineSideChannel();
|
|
476747
476749
|
RECAP_TIMEOUT_MS = 2e4;
|
|
476748
476750
|
lastFailure = null;
|
|
476749
476751
|
}
|
|
@@ -476907,9 +476909,9 @@ __export(releaseNotes_exports, {
|
|
|
476907
476909
|
parseChangelog: () => parseChangelog
|
|
476908
476910
|
});
|
|
476909
476911
|
import { mkdir as mkdir38, readFile as readFile43, writeFile as writeFile41 } from "fs/promises";
|
|
476910
|
-
import { dirname as dirname67, join as
|
|
476912
|
+
import { dirname as dirname67, join as join145 } from "path";
|
|
476911
476913
|
function getChangelogCachePath() {
|
|
476912
|
-
return
|
|
476914
|
+
return join145(getClaudeConfigHomeDir(), "cache", "changelog.md");
|
|
476913
476915
|
}
|
|
476914
476916
|
function _resetChangelogCacheForTesting() {
|
|
476915
476917
|
changelogMemoryCache = null;
|
|
@@ -480436,13 +480438,13 @@ var init_sema_brand = __esm({
|
|
|
480436
480438
|
_doc: "Rendered as the 'What's new' feed (createWhatsNewFeed). Top version MUST be >= current app version (2.1.187) and newer than config.lastReleaseNotesSeen so the notes display and full-logo mode triggers. Pinned == app version (2.1.187) + lastReleaseNotesSeen (loginState.ts) so getRecentReleaseNotes()===[] \u2192 condensed logo (matches refs/chrome.empty-input.json).",
|
|
480437
480439
|
version: "2.1.187",
|
|
480438
480440
|
notes: [
|
|
480439
|
-
"
|
|
480440
|
-
"
|
|
480441
|
-
"
|
|
480441
|
+
"Utility channel now adapts live to engine upgrades/rollbacks \u2014 no restarts needed, no stuck calls",
|
|
480442
|
+
"Background utility calls enforce a single strict time budget (probe + retry + transport)",
|
|
480443
|
+
"Token usage from background utilities is now reported accurately (no more zeros in accounting)"
|
|
480442
480444
|
]
|
|
480443
480445
|
},
|
|
480444
|
-
productVersion: "1.0.
|
|
480445
|
-
announcement:
|
|
480446
|
+
productVersion: "1.0.43",
|
|
480447
|
+
announcement: "sema 1.0.43 \u2014 hardening for the new side-query channel: engine rollbacks/upgrades are now detected live (no stuck utilities), strict time budgets, and real token accounting flows through every background utility call."
|
|
480446
480448
|
};
|
|
480447
480449
|
}
|
|
480448
480450
|
});
|
|
@@ -483371,13 +483373,13 @@ var require_sema_brand = __commonJS({
|
|
|
483371
483373
|
_doc: "Rendered as the 'What's new' feed (createWhatsNewFeed). Top version MUST be >= current app version (2.1.187) and newer than config.lastReleaseNotesSeen so the notes display and full-logo mode triggers. Pinned == app version (2.1.187) + lastReleaseNotesSeen (loginState.ts) so getRecentReleaseNotes()===[] \u2192 condensed logo (matches refs/chrome.empty-input.json).",
|
|
483372
483374
|
version: "2.1.187",
|
|
483373
483375
|
notes: [
|
|
483374
|
-
"
|
|
483375
|
-
"
|
|
483376
|
-
"
|
|
483376
|
+
"Utility channel now adapts live to engine upgrades/rollbacks \u2014 no restarts needed, no stuck calls",
|
|
483377
|
+
"Background utility calls enforce a single strict time budget (probe + retry + transport)",
|
|
483378
|
+
"Token usage from background utilities is now reported accurately (no more zeros in accounting)"
|
|
483377
483379
|
]
|
|
483378
483380
|
},
|
|
483379
|
-
productVersion: "1.0.
|
|
483380
|
-
announcement:
|
|
483381
|
+
productVersion: "1.0.43",
|
|
483382
|
+
announcement: "sema 1.0.43 \u2014 hardening for the new side-query channel: engine rollbacks/upgrades are now detected live (no stuck utilities), strict time budgets, and real token accounting flows through every background utility call."
|
|
483381
483383
|
};
|
|
483382
483384
|
}
|
|
483383
483385
|
});
|
|
@@ -484512,7 +484514,7 @@ import {
|
|
|
484512
484514
|
realpathSync as realpathSync7,
|
|
484513
484515
|
writeFileSync as writeFileSync15
|
|
484514
484516
|
} from "node:fs";
|
|
484515
|
-
import { join as
|
|
484517
|
+
import { join as join146 } from "node:path";
|
|
484516
484518
|
function canonicalCwd() {
|
|
484517
484519
|
try {
|
|
484518
484520
|
return realpathSync7(process.cwd()).normalize("NFC");
|
|
@@ -484609,10 +484611,10 @@ async function pickSessions(items) {
|
|
|
484609
484611
|
});
|
|
484610
484612
|
}
|
|
484611
484613
|
function importSeedMarkerPath(dir, sessionId) {
|
|
484612
|
-
return
|
|
484614
|
+
return join146(dir, `${sessionId}${IMPORT_SEED_MARKER_SUFFIX}`);
|
|
484613
484615
|
}
|
|
484614
484616
|
function copySession(item, destDir) {
|
|
484615
|
-
const destJsonl =
|
|
484617
|
+
const destJsonl = join146(destDir, `${item.sessionId}.jsonl`);
|
|
484616
484618
|
if (existsSync18(destJsonl)) return { copied: false, sidecar: false };
|
|
484617
484619
|
copyFileSync4(item.filePath, destJsonl);
|
|
484618
484620
|
try {
|
|
@@ -484627,7 +484629,7 @@ function copySession(item, destDir) {
|
|
|
484627
484629
|
if (existsSync18(srcAnchors)) {
|
|
484628
484630
|
copyFileSync4(
|
|
484629
484631
|
srcAnchors,
|
|
484630
|
-
|
|
484632
|
+
join146(destDir, `${item.sessionId}.rewind-anchors.jsonl`)
|
|
484631
484633
|
);
|
|
484632
484634
|
sidecar2 = true;
|
|
484633
484635
|
}
|
|
@@ -484636,8 +484638,8 @@ function copySession(item, destDir) {
|
|
|
484636
484638
|
async function importSessionsHandler(opts) {
|
|
484637
484639
|
const cwd5 = canonicalCwd();
|
|
484638
484640
|
const slug = sanitizePath(cwd5);
|
|
484639
|
-
const srcDir = opts.from ? opts.from :
|
|
484640
|
-
const destDir =
|
|
484641
|
+
const srcDir = opts.from ? opts.from : join146(homedir38(), LEGACY_DIR, "projects", slug);
|
|
484642
|
+
const destDir = join146(getProjectsDir(), slug);
|
|
484641
484643
|
let srcReal = srcDir;
|
|
484642
484644
|
try {
|
|
484643
484645
|
srcReal = realpathSync7(srcDir);
|
|
@@ -484759,7 +484761,7 @@ var init_importSessions = __esm({
|
|
|
484759
484761
|
// build-src/src/sema/ccImport.ts
|
|
484760
484762
|
import { existsSync as existsSync19, mkdirSync as mkdirSync16, realpathSync as realpathSync8 } from "node:fs";
|
|
484761
484763
|
import { homedir as homedir39 } from "node:os";
|
|
484762
|
-
import { join as
|
|
484764
|
+
import { join as join147 } from "node:path";
|
|
484763
484765
|
function markCcImportLog(log2) {
|
|
484764
484766
|
;
|
|
484765
484767
|
log2[CC_IMPORT_MARK] = true;
|
|
@@ -484779,9 +484781,9 @@ function canonicalize2(p) {
|
|
|
484779
484781
|
}
|
|
484780
484782
|
}
|
|
484781
484783
|
function ccProjectsDirFor(cwd5) {
|
|
484782
|
-
const base =
|
|
484784
|
+
const base = join147(homedir39(), LEGACY_DIR2, "projects");
|
|
484783
484785
|
for (const candidate of [cwd5, canonicalize2(cwd5)]) {
|
|
484784
|
-
const dir =
|
|
484786
|
+
const dir = join147(base, sanitizePath(candidate));
|
|
484785
484787
|
if (existsSync19(dir)) return dir;
|
|
484786
484788
|
}
|
|
484787
484789
|
return null;
|
|
@@ -484799,7 +484801,7 @@ async function listCcImportableSessions(cwd5) {
|
|
|
484799
484801
|
}
|
|
484800
484802
|
const items = await listImportable(srcDir);
|
|
484801
484803
|
return items.filter(
|
|
484802
|
-
(i) => !existsSync19(
|
|
484804
|
+
(i) => !existsSync19(join147(destDir, `${i.sessionId}.jsonl`))
|
|
484803
484805
|
);
|
|
484804
484806
|
} catch {
|
|
484805
484807
|
return [];
|
|
@@ -484845,7 +484847,7 @@ function importCcSessionToProject(item, cwd5) {
|
|
|
484845
484847
|
const destDir = getProjectDir3(cwd5);
|
|
484846
484848
|
mkdirSync16(destDir, { recursive: true });
|
|
484847
484849
|
copySession(item, destDir);
|
|
484848
|
-
return
|
|
484850
|
+
return join147(destDir, `${item.sessionId}.jsonl`);
|
|
484849
484851
|
}
|
|
484850
484852
|
var LEGACY_DIR2, CC_SOURCE_BRAND, CC_IMPORT_ENTRY_ID, CC_IMPORT_MARK;
|
|
484851
484853
|
var init_ccImport = __esm({
|
|
@@ -487634,7 +487636,7 @@ var init_share = __esm({
|
|
|
487634
487636
|
|
|
487635
487637
|
// build-src/src/components/skills/SkillsMenu.tsx
|
|
487636
487638
|
import { existsSync as existsSync20, mkdirSync as mkdirSync17, renameSync as renameSync8 } from "node:fs";
|
|
487637
|
-
import { basename as basename45, dirname as dirname68, join as
|
|
487639
|
+
import { basename as basename45, dirname as dirname68, join as join148 } from "node:path";
|
|
487638
487640
|
function skillSourceDisplayName(source) {
|
|
487639
487641
|
switch (source) {
|
|
487640
487642
|
case "mcp":
|
|
@@ -487796,12 +487798,12 @@ function SkillsMenu({ onExit: onExit2, commands }) {
|
|
|
487796
487798
|
if (!skill?.skillRoot) return;
|
|
487797
487799
|
try {
|
|
487798
487800
|
const skillsDir = dirname68(skill.skillRoot);
|
|
487799
|
-
const removedDir =
|
|
487801
|
+
const removedDir = join148(
|
|
487800
487802
|
dirname68(skillsDir),
|
|
487801
487803
|
`skills-removed-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}`
|
|
487802
487804
|
);
|
|
487803
487805
|
mkdirSync17(removedDir, { recursive: true });
|
|
487804
|
-
let target =
|
|
487806
|
+
let target = join148(removedDir, basename45(skill.skillRoot));
|
|
487805
487807
|
if (existsSync20(target)) target = `${target}-${Date.now()}`;
|
|
487806
487808
|
renameSync8(skill.skillRoot, target);
|
|
487807
487809
|
const nameStillPresent = skills2.some(
|
|
@@ -499771,16 +499773,16 @@ var init_dist8 = __esm({
|
|
|
499771
499773
|
});
|
|
499772
499774
|
|
|
499773
499775
|
// build-src/src/sema/collabTemplates.ts
|
|
499774
|
-
import { readFileSync as
|
|
499775
|
-
import { join as
|
|
499776
|
+
import { readFileSync as readFileSync29 } from "node:fs";
|
|
499777
|
+
import { join as join149 } from "node:path";
|
|
499776
499778
|
function collabConfigPath(configHome) {
|
|
499777
|
-
return
|
|
499779
|
+
return join149(configHome, "config.d", "collab.json");
|
|
499778
499780
|
}
|
|
499779
499781
|
function readCatalog(configHome) {
|
|
499780
|
-
const path27 =
|
|
499782
|
+
const path27 = join149(configHome, "config.d", "models.json");
|
|
499781
499783
|
let raw2;
|
|
499782
499784
|
try {
|
|
499783
|
-
raw2 =
|
|
499785
|
+
raw2 = readFileSync29(path27, "utf-8");
|
|
499784
499786
|
} catch {
|
|
499785
499787
|
return { names: /* @__PURE__ */ new Set(), ok: false, note: "\u6A21\u578B\u76EE\u5F55\u4E0D\u53EF\u7528(models.json \u7F3A\u5931)\u2014\u2014\u60AC\u7A7A\u68C0\u6D4B\u8DF3\u8FC7" };
|
|
499786
499788
|
}
|
|
@@ -499803,7 +499805,7 @@ function readCollabTemplates(configHome) {
|
|
|
499803
499805
|
const path27 = collabConfigPath(configHome);
|
|
499804
499806
|
let raw2;
|
|
499805
499807
|
try {
|
|
499806
|
-
raw2 =
|
|
499808
|
+
raw2 = readFileSync29(path27, "utf-8");
|
|
499807
499809
|
} catch {
|
|
499808
499810
|
return { templates: [], path: path27 };
|
|
499809
499811
|
}
|
|
@@ -500038,7 +500040,7 @@ __export(thinkback_exports, {
|
|
|
500038
500040
|
playAnimation: () => playAnimation
|
|
500039
500041
|
});
|
|
500040
500042
|
import { readFile as readFile44 } from "fs/promises";
|
|
500041
|
-
import { join as
|
|
500043
|
+
import { join as join150 } from "path";
|
|
500042
500044
|
function getMarketplaceName() {
|
|
500043
500045
|
return false ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
|
|
500044
500046
|
}
|
|
@@ -500056,15 +500058,15 @@ async function getThinkbackSkillDir() {
|
|
|
500056
500058
|
if (!thinkbackPlugin) {
|
|
500057
500059
|
return null;
|
|
500058
500060
|
}
|
|
500059
|
-
const skillDir =
|
|
500061
|
+
const skillDir = join150(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
500060
500062
|
if (await pathExists(skillDir)) {
|
|
500061
500063
|
return skillDir;
|
|
500062
500064
|
}
|
|
500063
500065
|
return null;
|
|
500064
500066
|
}
|
|
500065
500067
|
async function playAnimation(skillDir) {
|
|
500066
|
-
const dataPath =
|
|
500067
|
-
const playerPath =
|
|
500068
|
+
const dataPath = join150(skillDir, "year_in_review.js");
|
|
500069
|
+
const playerPath = join150(skillDir, "player.js");
|
|
500068
500070
|
try {
|
|
500069
500071
|
await readFile44(dataPath);
|
|
500070
500072
|
} catch (e) {
|
|
@@ -500113,7 +500115,7 @@ async function playAnimation(skillDir) {
|
|
|
500113
500115
|
} finally {
|
|
500114
500116
|
inkInstance.exitAlternateScreen();
|
|
500115
500117
|
}
|
|
500116
|
-
const htmlPath =
|
|
500118
|
+
const htmlPath = join150(skillDir, "year_in_review.html");
|
|
500117
500119
|
if (await pathExists(htmlPath)) {
|
|
500118
500120
|
const platform4 = getPlatform();
|
|
500119
500121
|
const openCmd = platform4 === "macos" ? "open" : platform4 === "windows" ? "start" : "xdg-open";
|
|
@@ -500414,7 +500416,7 @@ function ThinkbackFlow(t0) {
|
|
|
500414
500416
|
if (!skillDir) {
|
|
500415
500417
|
return;
|
|
500416
500418
|
}
|
|
500417
|
-
const dataPath =
|
|
500419
|
+
const dataPath = join150(skillDir, "year_in_review.js");
|
|
500418
500420
|
pathExists(dataPath).then((exists) => {
|
|
500419
500421
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
500420
500422
|
setHasGenerated(exists);
|
|
@@ -500574,7 +500576,7 @@ var thinkback_play_exports = {};
|
|
|
500574
500576
|
__export(thinkback_play_exports, {
|
|
500575
500577
|
call: () => call45
|
|
500576
500578
|
});
|
|
500577
|
-
import { join as
|
|
500579
|
+
import { join as join151 } from "path";
|
|
500578
500580
|
function getPluginId2() {
|
|
500579
500581
|
const marketplaceName = process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
|
|
500580
500582
|
return `thinkback@${marketplaceName}`;
|
|
@@ -500596,7 +500598,7 @@ async function call45() {
|
|
|
500596
500598
|
value: "Thinkback plugin installation path not found."
|
|
500597
500599
|
};
|
|
500598
500600
|
}
|
|
500599
|
-
const skillDir =
|
|
500601
|
+
const skillDir = join151(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
500600
500602
|
const result = await playAnimation(skillDir);
|
|
500601
500603
|
return { type: "text", value: result.message };
|
|
500602
500604
|
}
|
|
@@ -506536,7 +506538,7 @@ var init_types20 = __esm({
|
|
|
506536
506538
|
|
|
506537
506539
|
// build-src/src/components/agents/agentFileUtils.ts
|
|
506538
506540
|
import { mkdir as mkdir40, open as open16, unlink as unlink22 } from "fs/promises";
|
|
506539
|
-
import { join as
|
|
506541
|
+
import { join as join152 } from "path";
|
|
506540
506542
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color4, model, memory2, effort) {
|
|
506541
506543
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\\\n");
|
|
506542
506544
|
const isAllTools = tools === void 0 || tools.length === 1 && tools[0] === "*";
|
|
@@ -506563,23 +506565,23 @@ function getAgentDirectoryPath(location) {
|
|
|
506563
506565
|
case "flagSettings":
|
|
506564
506566
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
506565
506567
|
case "userSettings":
|
|
506566
|
-
return
|
|
506568
|
+
return join152(getClaudeConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
506567
506569
|
case "projectSettings":
|
|
506568
|
-
return
|
|
506570
|
+
return join152(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
506569
506571
|
case "policySettings":
|
|
506570
|
-
return
|
|
506572
|
+
return join152(
|
|
506571
506573
|
getManagedFilePath(),
|
|
506572
506574
|
AGENT_PATHS.FOLDER_NAME,
|
|
506573
506575
|
AGENT_PATHS.AGENTS_DIR
|
|
506574
506576
|
);
|
|
506575
506577
|
case "localSettings":
|
|
506576
|
-
return
|
|
506578
|
+
return join152(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
506577
506579
|
}
|
|
506578
506580
|
}
|
|
506579
506581
|
function getRelativeAgentDirectoryPath(location) {
|
|
506580
506582
|
switch (location) {
|
|
506581
506583
|
case "projectSettings":
|
|
506582
|
-
return
|
|
506584
|
+
return join152(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
506583
506585
|
default:
|
|
506584
506586
|
return getAgentDirectoryPath(location);
|
|
506585
506587
|
}
|
|
@@ -506593,7 +506595,7 @@ function getActualAgentFilePath(agent) {
|
|
|
506593
506595
|
}
|
|
506594
506596
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
506595
506597
|
const filename = agent.filename || agent.agentType;
|
|
506596
|
-
return
|
|
506598
|
+
return join152(dirPath, `${filename}.md`);
|
|
506597
506599
|
}
|
|
506598
506600
|
function getActualRelativeAgentFilePath(agent) {
|
|
506599
506601
|
if (isBuiltInAgent(agent)) {
|
|
@@ -506607,7 +506609,7 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
506607
506609
|
}
|
|
506608
506610
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
506609
506611
|
const filename = agent.filename || agent.agentType;
|
|
506610
|
-
return
|
|
506612
|
+
return join152(dirPath, `${filename}.md`);
|
|
506611
506613
|
}
|
|
506612
506614
|
async function updateAgentFile(agent, newWhenToUse, newTools, newSystemPrompt, newColor, newModel, newMemory, newEffort) {
|
|
506613
506615
|
if (agent.source === "built-in") {
|
|
@@ -510027,7 +510029,7 @@ var init_rewind2 = __esm({
|
|
|
510027
510029
|
// build-src/src/utils/heapDumpService.ts
|
|
510028
510030
|
import { createWriteStream as createWriteStream4, writeFileSync as writeFileSync16 } from "fs";
|
|
510029
510031
|
import { readdir as readdir26, readFile as readFile46, writeFile as writeFile43 } from "fs/promises";
|
|
510030
|
-
import { join as
|
|
510032
|
+
import { join as join153 } from "path";
|
|
510031
510033
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
510032
510034
|
import {
|
|
510033
510035
|
getHeapSnapshot,
|
|
@@ -510149,8 +510151,8 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
510149
510151
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
510150
510152
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
510151
510153
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
510152
|
-
const heapPath =
|
|
510153
|
-
const diagPath =
|
|
510154
|
+
const heapPath = join153(dumpDir, heapFilename);
|
|
510155
|
+
const diagPath = join153(dumpDir, diagFilename);
|
|
510154
510156
|
await writeFile43(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
510155
510157
|
mode: 384
|
|
510156
510158
|
});
|
|
@@ -511823,7 +511825,7 @@ var init_sandbox_toggle2 = __esm({
|
|
|
511823
511825
|
|
|
511824
511826
|
// build-src/src/utils/claudeInChrome/setupPortable.ts
|
|
511825
511827
|
import { readdir as readdir27 } from "fs/promises";
|
|
511826
|
-
import { join as
|
|
511828
|
+
import { join as join154 } from "path";
|
|
511827
511829
|
function getExtensionIds() {
|
|
511828
511830
|
return process.env.USER_TYPE === "ant" ? [PROD_EXTENSION_ID, DEV_EXTENSION_ID, ANT_EXTENSION_ID] : [PROD_EXTENSION_ID];
|
|
511829
511831
|
}
|
|
@@ -511853,7 +511855,7 @@ async function detectExtensionInstallationPortable(browserPaths, log2) {
|
|
|
511853
511855
|
}
|
|
511854
511856
|
for (const profile of profileDirs) {
|
|
511855
511857
|
for (const extensionId of extensionIds) {
|
|
511856
|
-
const extensionPath =
|
|
511858
|
+
const extensionPath = join154(
|
|
511857
511859
|
browserBasePath,
|
|
511858
511860
|
profile,
|
|
511859
511861
|
"Extensions",
|
|
@@ -511890,7 +511892,7 @@ var init_setupPortable = __esm({
|
|
|
511890
511892
|
// build-src/src/utils/claudeInChrome/setup.ts
|
|
511891
511893
|
import { chmod as chmod12, mkdir as mkdir41, readFile as readFile47, writeFile as writeFile44 } from "fs/promises";
|
|
511892
511894
|
import { homedir as homedir40 } from "os";
|
|
511893
|
-
import { join as
|
|
511895
|
+
import { join as join155 } from "path";
|
|
511894
511896
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
511895
511897
|
function shouldEnableClaudeInChrome(chromeFlag) {
|
|
511896
511898
|
if (getIsNonInteractiveSession() && chromeFlag !== true) {
|
|
@@ -511956,8 +511958,8 @@ function setupClaudeInChrome() {
|
|
|
511956
511958
|
};
|
|
511957
511959
|
} else {
|
|
511958
511960
|
const __filename3 = fileURLToPath8(import.meta.url);
|
|
511959
|
-
const __dirname2 =
|
|
511960
|
-
const cliPath =
|
|
511961
|
+
const __dirname2 = join155(__filename3, "..");
|
|
511962
|
+
const cliPath = join155(__dirname2, "cli.js");
|
|
511961
511963
|
void createWrapperScript(
|
|
511962
511964
|
`"${process.execPath}" "${cliPath}" --chrome-native-host`
|
|
511963
511965
|
).then(
|
|
@@ -511988,8 +511990,8 @@ function getNativeMessagingHostsDirs() {
|
|
|
511988
511990
|
const platform4 = getPlatform();
|
|
511989
511991
|
if (platform4 === "windows") {
|
|
511990
511992
|
const home = homedir40();
|
|
511991
|
-
const appData = process.env.APPDATA ||
|
|
511992
|
-
return [
|
|
511993
|
+
const appData = process.env.APPDATA || join155(home, "AppData", "Local");
|
|
511994
|
+
return [join155(appData, "Sema", "ChromeNativeHost")];
|
|
511993
511995
|
}
|
|
511994
511996
|
return getAllNativeMessagingHostsDirs().map(({ path: path27 }) => path27);
|
|
511995
511997
|
}
|
|
@@ -512017,7 +512019,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
512017
512019
|
const manifestContent = jsonStringify(manifest, null, 2);
|
|
512018
512020
|
let anyManifestUpdated = false;
|
|
512019
512021
|
for (const manifestDir of manifestDirs) {
|
|
512020
|
-
const manifestPath =
|
|
512022
|
+
const manifestPath = join155(manifestDir, NATIVE_HOST_MANIFEST_NAME);
|
|
512021
512023
|
const existingContent = await readFile47(manifestPath, "utf-8").catch(
|
|
512022
512024
|
() => null
|
|
512023
512025
|
);
|
|
@@ -512038,7 +512040,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
512038
512040
|
}
|
|
512039
512041
|
}
|
|
512040
512042
|
if (getPlatform() === "windows") {
|
|
512041
|
-
const manifestPath =
|
|
512043
|
+
const manifestPath = join155(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
|
|
512042
512044
|
registerWindowsNativeHosts(manifestPath);
|
|
512043
512045
|
}
|
|
512044
512046
|
if (anyManifestUpdated) {
|
|
@@ -512086,8 +512088,8 @@ function registerWindowsNativeHosts(manifestPath) {
|
|
|
512086
512088
|
}
|
|
512087
512089
|
async function createWrapperScript(command8) {
|
|
512088
512090
|
const platform4 = getPlatform();
|
|
512089
|
-
const chromeDir =
|
|
512090
|
-
const wrapperPath = platform4 === "windows" ?
|
|
512091
|
+
const chromeDir = join155(getClaudeConfigHomeDir(), "chrome");
|
|
512092
|
+
const wrapperPath = platform4 === "windows" ? join155(chromeDir, "chrome-native-host.bat") : join155(chromeDir, "chrome-native-host");
|
|
512091
512093
|
const scriptContent = platform4 === "windows" ? `@echo off
|
|
512092
512094
|
REM Chrome native host wrapper script
|
|
512093
512095
|
REM Generated by Sema - do not edit manually
|
|
@@ -512751,7 +512753,7 @@ var init_cmd_advisor = __esm({
|
|
|
512751
512753
|
// build-src/src/skills/bundledSkills.ts
|
|
512752
512754
|
import { constants as fsConstants5 } from "fs";
|
|
512753
512755
|
import { mkdir as mkdir42, open as open17 } from "fs/promises";
|
|
512754
|
-
import { dirname as dirname69, isAbsolute as isAbsolute30, join as
|
|
512756
|
+
import { dirname as dirname69, isAbsolute as isAbsolute30, join as join156, normalize as normalize15, sep as pathSep2 } from "path";
|
|
512755
512757
|
function registerBundledSkill(definition) {
|
|
512756
512758
|
const { files: files2 } = definition;
|
|
512757
512759
|
let skillRoot;
|
|
@@ -512806,7 +512808,7 @@ function getBundledSkills() {
|
|
|
512806
512808
|
return [...bundledSkills];
|
|
512807
512809
|
}
|
|
512808
512810
|
function getBundledSkillExtractDir(skillName) {
|
|
512809
|
-
return
|
|
512811
|
+
return join156(getBundledSkillsRoot(), skillName);
|
|
512810
512812
|
}
|
|
512811
512813
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
512812
512814
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -512850,7 +512852,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
512850
512852
|
if (isAbsolute30(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
512851
512853
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
512852
512854
|
}
|
|
512853
|
-
return
|
|
512855
|
+
return join156(baseDir, normalized);
|
|
512854
512856
|
}
|
|
512855
512857
|
function prependBaseDir(blocks, baseDir) {
|
|
512856
512858
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -513203,7 +513205,7 @@ var init_exit2 = __esm({
|
|
|
513203
513205
|
});
|
|
513204
513206
|
|
|
513205
513207
|
// build-src/src/components/ExportDialog.tsx
|
|
513206
|
-
import { join as
|
|
513208
|
+
import { join as join157 } from "path";
|
|
513207
513209
|
function ExportDialog({
|
|
513208
513210
|
content,
|
|
513209
513211
|
defaultFilename,
|
|
@@ -513235,7 +513237,7 @@ function ExportDialog({
|
|
|
513235
513237
|
};
|
|
513236
513238
|
const handleFilenameSubmit = () => {
|
|
513237
513239
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
513238
|
-
const filepath =
|
|
513240
|
+
const filepath = join157(getCwd(), finalFilename);
|
|
513239
513241
|
try {
|
|
513240
513242
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
513241
513243
|
encoding: "utf-8",
|
|
@@ -513383,7 +513385,7 @@ __export(export_exports, {
|
|
|
513383
513385
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
513384
513386
|
sanitizeFilename: () => sanitizeFilename
|
|
513385
513387
|
});
|
|
513386
|
-
import { join as
|
|
513388
|
+
import { join as join158 } from "path";
|
|
513387
513389
|
function formatTimestamp(date5) {
|
|
513388
513390
|
const year = date5.getFullYear();
|
|
513389
513391
|
const month = String(date5.getMonth() + 1).padStart(2, "0");
|
|
@@ -513426,7 +513428,7 @@ async function call66(onDone, context3, args) {
|
|
|
513426
513428
|
const filename = args.trim();
|
|
513427
513429
|
if (filename) {
|
|
513428
513430
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
513429
|
-
const filepath =
|
|
513431
|
+
const filepath = join158(getCwd(), finalFilename);
|
|
513430
513432
|
try {
|
|
513431
513433
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
513432
513434
|
encoding: "utf-8",
|
|
@@ -513479,8 +513481,8 @@ var init_export2 = __esm({
|
|
|
513479
513481
|
});
|
|
513480
513482
|
|
|
513481
513483
|
// build-src/src/sema/modelCtxOverride.ts
|
|
513482
|
-
import { existsSync as existsSync22, readFileSync as
|
|
513483
|
-
import { join as
|
|
513484
|
+
import { existsSync as existsSync22, readFileSync as readFileSync30, writeFileSync as writeFileSync17 } from "node:fs";
|
|
513485
|
+
import { join as join159 } from "node:path";
|
|
513484
513486
|
function nextStep(current3, steps) {
|
|
513485
513487
|
if (typeof current3 === "number") {
|
|
513486
513488
|
const i = steps.findIndex((v2) => v2 === current3);
|
|
@@ -513497,7 +513499,7 @@ function fmtCtxShort(n2) {
|
|
|
513497
513499
|
return `${n2 % 1e3 === 0 ? n2 / 1e3 : Math.round(n2 / 1024)}K`;
|
|
513498
513500
|
}
|
|
513499
513501
|
function configDModelsPath() {
|
|
513500
|
-
return
|
|
513502
|
+
return join159(getClaudeConfigHomeDir(), "config.d", "models.json");
|
|
513501
513503
|
}
|
|
513502
513504
|
function envKeyFor(name, field) {
|
|
513503
513505
|
if (process.env.MODEL_ID && process.env.MODEL_ID === name) return ENV_KEYS[field].main;
|
|
@@ -513517,7 +513519,7 @@ function applyModelOverride(modelName, field, value) {
|
|
|
513517
513519
|
try {
|
|
513518
513520
|
const path27 = configDModelsPath();
|
|
513519
513521
|
if (existsSync22(path27)) {
|
|
513520
|
-
const n2 = normalizeModelsDocShape(JSON.parse(
|
|
513522
|
+
const n2 = normalizeModelsDocShape(JSON.parse(readFileSync30(path27, "utf-8")));
|
|
513521
513523
|
const doc = n2?.doc ?? {};
|
|
513522
513524
|
const row2 = (doc.models ?? []).find((m2) => m2.id === name || m2.name === name);
|
|
513523
513525
|
if (row2) {
|
|
@@ -513555,7 +513557,7 @@ function readModelConfigOverride(modelName, field) {
|
|
|
513555
513557
|
try {
|
|
513556
513558
|
const path27 = configDModelsPath();
|
|
513557
513559
|
if (!existsSync22(path27)) return null;
|
|
513558
|
-
const n2 = normalizeModelsDocShape(JSON.parse(
|
|
513560
|
+
const n2 = normalizeModelsDocShape(JSON.parse(readFileSync30(path27, "utf-8")));
|
|
513559
513561
|
const doc = n2?.doc ?? {};
|
|
513560
513562
|
const row2 = (doc.models ?? []).find((m2) => m2.id === name || m2.name === name);
|
|
513561
513563
|
const v2 = row2?.[field];
|
|
@@ -515914,7 +515916,7 @@ import {
|
|
|
515914
515916
|
writeFile as writeFile45
|
|
515915
515917
|
} from "fs/promises";
|
|
515916
515918
|
import { tmpdir as tmpdir13 } from "os";
|
|
515917
|
-
import { extname as extname14, join as
|
|
515919
|
+
import { extname as extname14, join as join160 } from "path";
|
|
515918
515920
|
function getAnalysisModel() {
|
|
515919
515921
|
return getDefaultOpusModel();
|
|
515920
515922
|
}
|
|
@@ -515922,13 +515924,13 @@ function getInsightsModel() {
|
|
|
515922
515924
|
return getDefaultOpusModel();
|
|
515923
515925
|
}
|
|
515924
515926
|
function getDataDir() {
|
|
515925
|
-
return
|
|
515927
|
+
return join160(getClaudeConfigHomeDir(), "usage-data");
|
|
515926
515928
|
}
|
|
515927
515929
|
function getFacetsDir() {
|
|
515928
|
-
return
|
|
515930
|
+
return join160(getDataDir(), "facets");
|
|
515929
515931
|
}
|
|
515930
515932
|
function getSessionMetaDir() {
|
|
515931
|
-
return
|
|
515933
|
+
return join160(getDataDir(), "session-meta");
|
|
515932
515934
|
}
|
|
515933
515935
|
function getLanguageFromPath(filePath) {
|
|
515934
515936
|
const ext = extname14(filePath).toLowerCase();
|
|
@@ -516265,7 +516267,7 @@ async function formatTranscriptWithSummarization(log2) {
|
|
|
516265
516267
|
return header + summaries.join("\n\n---\n\n");
|
|
516266
516268
|
}
|
|
516267
516269
|
async function loadCachedFacets(sessionId) {
|
|
516268
|
-
const facetPath =
|
|
516270
|
+
const facetPath = join160(getFacetsDir(), `${sessionId}.json`);
|
|
516269
516271
|
try {
|
|
516270
516272
|
const content = await readFile48(facetPath, { encoding: "utf-8" });
|
|
516271
516273
|
const parsed = jsonParse(content);
|
|
@@ -516286,14 +516288,14 @@ async function saveFacets(facets) {
|
|
|
516286
516288
|
await mkdir43(getFacetsDir(), { recursive: true });
|
|
516287
516289
|
} catch {
|
|
516288
516290
|
}
|
|
516289
|
-
const facetPath =
|
|
516291
|
+
const facetPath = join160(getFacetsDir(), `${facets.session_id}.json`);
|
|
516290
516292
|
await writeFile45(facetPath, jsonStringify(facets, null, 2), {
|
|
516291
516293
|
encoding: "utf-8",
|
|
516292
516294
|
mode: 384
|
|
516293
516295
|
});
|
|
516294
516296
|
}
|
|
516295
516297
|
async function loadCachedSessionMeta(sessionId) {
|
|
516296
|
-
const metaPath =
|
|
516298
|
+
const metaPath = join160(getSessionMetaDir(), `${sessionId}.json`);
|
|
516297
516299
|
try {
|
|
516298
516300
|
const content = await readFile48(metaPath, { encoding: "utf-8" });
|
|
516299
516301
|
return jsonParse(content);
|
|
@@ -516306,7 +516308,7 @@ async function saveSessionMeta(meta3) {
|
|
|
516306
516308
|
await mkdir43(getSessionMetaDir(), { recursive: true });
|
|
516307
516309
|
} catch {
|
|
516308
516310
|
}
|
|
516309
|
-
const metaPath =
|
|
516311
|
+
const metaPath = join160(getSessionMetaDir(), `${meta3.session_id}.json`);
|
|
516310
516312
|
await writeFile45(metaPath, jsonStringify(meta3, null, 2), {
|
|
516311
516313
|
encoding: "utf-8",
|
|
516312
516314
|
mode: 384
|
|
@@ -517404,7 +517406,7 @@ async function scanAllSessions() {
|
|
|
517404
517406
|
} catch {
|
|
517405
517407
|
return [];
|
|
517406
517408
|
}
|
|
517407
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
517409
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join160(projectsDir, dirent.name));
|
|
517408
517410
|
const allSessions = [];
|
|
517409
517411
|
for (let i = 0; i < projectDirs.length; i++) {
|
|
517410
517412
|
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i]);
|
|
@@ -517426,7 +517428,7 @@ async function scanAllSessions() {
|
|
|
517426
517428
|
async function generateUsageReport(options) {
|
|
517427
517429
|
let remoteStats;
|
|
517428
517430
|
if (process.env.USER_TYPE === "ant" && options?.collectRemote) {
|
|
517429
|
-
const destDir =
|
|
517431
|
+
const destDir = join160(getClaudeConfigHomeDir(), "projects");
|
|
517430
517432
|
const { hosts, totalCopied } = await collectAllRemoteHostData(destDir);
|
|
517431
517433
|
remoteStats = { hosts, totalCopied };
|
|
517432
517434
|
}
|
|
@@ -517572,7 +517574,7 @@ async function generateUsageReport(options) {
|
|
|
517572
517574
|
await mkdir43(getDataDir(), { recursive: true });
|
|
517573
517575
|
} catch {
|
|
517574
517576
|
}
|
|
517575
|
-
const htmlPath =
|
|
517577
|
+
const htmlPath = join160(getDataDir(), "report.html");
|
|
517576
517578
|
await writeFile45(htmlPath, htmlReport, {
|
|
517577
517579
|
encoding: "utf-8",
|
|
517578
517580
|
mode: 384
|
|
@@ -517641,7 +517643,7 @@ var init_insights = __esm({
|
|
|
517641
517643
|
} : async () => 0;
|
|
517642
517644
|
collectFromRemoteHost = process.env.USER_TYPE === "ant" ? async (homespace, destDir) => {
|
|
517643
517645
|
const result = { copied: 0, skipped: 0 };
|
|
517644
|
-
const tempDir = await mkdtemp(
|
|
517646
|
+
const tempDir = await mkdtemp(join160(tmpdir13(), "claude-hs-"));
|
|
517645
517647
|
try {
|
|
517646
517648
|
const scpResult = await execFileNoThrow(
|
|
517647
517649
|
"scp",
|
|
@@ -517651,7 +517653,7 @@ var init_insights = __esm({
|
|
|
517651
517653
|
if (scpResult.code !== 0) {
|
|
517652
517654
|
return result;
|
|
517653
517655
|
}
|
|
517654
|
-
const projectsDir =
|
|
517656
|
+
const projectsDir = join160(tempDir, "projects");
|
|
517655
517657
|
let projectDirents;
|
|
517656
517658
|
try {
|
|
517657
517659
|
projectDirents = await readdir28(projectsDir, { withFileTypes: true });
|
|
@@ -517661,10 +517663,10 @@ var init_insights = __esm({
|
|
|
517661
517663
|
await Promise.all(
|
|
517662
517664
|
projectDirents.map(async (dirent) => {
|
|
517663
517665
|
const projectName = dirent.name;
|
|
517664
|
-
const projectPath =
|
|
517666
|
+
const projectPath = join160(projectsDir, projectName);
|
|
517665
517667
|
if (!dirent.isDirectory()) return;
|
|
517666
517668
|
const destProjectName = `${projectName}__${homespace}`;
|
|
517667
|
-
const destProjectPath =
|
|
517669
|
+
const destProjectPath = join160(destDir, destProjectName);
|
|
517668
517670
|
try {
|
|
517669
517671
|
await mkdir43(destProjectPath, { recursive: true });
|
|
517670
517672
|
} catch {
|
|
@@ -517679,8 +517681,8 @@ var init_insights = __esm({
|
|
|
517679
517681
|
files2.map(async (fileDirent) => {
|
|
517680
517682
|
const fileName = fileDirent.name;
|
|
517681
517683
|
if (!fileName.endsWith(".jsonl")) return;
|
|
517682
|
-
const srcFile =
|
|
517683
|
-
const destFile =
|
|
517684
|
+
const srcFile = join160(projectPath, fileName);
|
|
517685
|
+
const destFile = join160(destProjectPath, fileName);
|
|
517684
517686
|
try {
|
|
517685
517687
|
await copyFile9(srcFile, destFile, fsConstants6.COPYFILE_EXCL);
|
|
517686
517688
|
result.copied++;
|
|
@@ -518703,7 +518705,7 @@ import {
|
|
|
518703
518705
|
fsyncSync as fsyncSync6,
|
|
518704
518706
|
mkdirSync as mkdirSync18,
|
|
518705
518707
|
openSync as openSync9,
|
|
518706
|
-
readFileSync as
|
|
518708
|
+
readFileSync as readFileSync31,
|
|
518707
518709
|
writeSync as writeSync4
|
|
518708
518710
|
} from "fs";
|
|
518709
518711
|
import { dirname as dirname70 } from "path";
|
|
@@ -518766,7 +518768,7 @@ function recordTurnJournalEntry(journalPath, entry, lockTargetPath) {
|
|
|
518766
518768
|
function readTurnJournal(journalPath) {
|
|
518767
518769
|
let raw2;
|
|
518768
518770
|
try {
|
|
518769
|
-
raw2 =
|
|
518771
|
+
raw2 = readFileSync31(journalPath, "utf8");
|
|
518770
518772
|
} catch {
|
|
518771
518773
|
return [];
|
|
518772
518774
|
}
|
|
@@ -518946,7 +518948,7 @@ import {
|
|
|
518946
518948
|
unlink as unlink24,
|
|
518947
518949
|
writeFile as writeFile46
|
|
518948
518950
|
} from "fs/promises";
|
|
518949
|
-
import { basename as basename46, dirname as dirname71, isAbsolute as isAbsolute31, join as
|
|
518951
|
+
import { basename as basename46, dirname as dirname71, isAbsolute as isAbsolute31, join as join161, relative as relative27 } from "path";
|
|
518950
518952
|
function isTranscriptMessage(entry) {
|
|
518951
518953
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
518952
518954
|
}
|
|
@@ -518960,30 +518962,30 @@ function isEphemeralToolProgress(dataType) {
|
|
|
518960
518962
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
518961
518963
|
}
|
|
518962
518964
|
function getProjectsDir2() {
|
|
518963
|
-
return
|
|
518965
|
+
return join161(getClaudeConfigHomeDir(), "projects");
|
|
518964
518966
|
}
|
|
518965
518967
|
function getTranscriptPath() {
|
|
518966
518968
|
const projectDir2 = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
518967
|
-
return
|
|
518969
|
+
return join161(projectDir2, `${getSessionId()}.jsonl`);
|
|
518968
518970
|
}
|
|
518969
518971
|
function getTurnJournalPath() {
|
|
518970
518972
|
const projectDir2 = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
518971
|
-
return
|
|
518973
|
+
return join161(projectDir2, `${getSessionId()}.turn-journal.jsonl`);
|
|
518972
518974
|
}
|
|
518973
518975
|
function getRewindAnchorSidecarPath() {
|
|
518974
518976
|
const projectDir2 = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
518975
|
-
return
|
|
518977
|
+
return join161(projectDir2, `${getSessionId()}.rewind-anchors.jsonl`);
|
|
518976
518978
|
}
|
|
518977
518979
|
function getSessionMapPath() {
|
|
518978
518980
|
const projectDir2 = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
518979
|
-
return
|
|
518981
|
+
return join161(projectDir2, `${getSessionId()}.session-map.json`);
|
|
518980
518982
|
}
|
|
518981
518983
|
function getTranscriptPathForSession(sessionId) {
|
|
518982
518984
|
if (sessionId === getSessionId()) {
|
|
518983
518985
|
return getTranscriptPath();
|
|
518984
518986
|
}
|
|
518985
518987
|
const projectDir2 = getProjectDir3(getOriginalCwd());
|
|
518986
|
-
return
|
|
518988
|
+
return join161(projectDir2, `${sessionId}.jsonl`);
|
|
518987
518989
|
}
|
|
518988
518990
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
518989
518991
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -518995,8 +518997,8 @@ function getAgentTranscriptPath(agentId) {
|
|
|
518995
518997
|
const projectDir2 = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
518996
518998
|
const sessionId = getSessionId();
|
|
518997
518999
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
518998
|
-
const base = subdir ?
|
|
518999
|
-
return
|
|
519000
|
+
const base = subdir ? join161(projectDir2, sessionId, "subagents", subdir) : join161(projectDir2, sessionId, "subagents");
|
|
519001
|
+
return join161(base, `agent-${agentId}.jsonl`);
|
|
519000
519002
|
}
|
|
519001
519003
|
function getAgentMetadataPath(agentId) {
|
|
519002
519004
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
@@ -519018,10 +519020,10 @@ async function readAgentMetadata(agentId) {
|
|
|
519018
519020
|
}
|
|
519019
519021
|
function getRemoteAgentsDir() {
|
|
519020
519022
|
const projectDir2 = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
519021
|
-
return
|
|
519023
|
+
return join161(projectDir2, getSessionId(), "remote-agents");
|
|
519022
519024
|
}
|
|
519023
519025
|
function getRemoteAgentMetadataPath(taskId) {
|
|
519024
|
-
return
|
|
519026
|
+
return join161(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
519025
519027
|
}
|
|
519026
519028
|
async function writeRemoteAgentMetadata(taskId, metadata2) {
|
|
519027
519029
|
const path27 = getRemoteAgentMetadataPath(taskId);
|
|
@@ -519060,7 +519062,7 @@ async function listRemoteAgentMetadata() {
|
|
|
519060
519062
|
for (const entry of entries) {
|
|
519061
519063
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json")) continue;
|
|
519062
519064
|
try {
|
|
519063
|
-
const raw2 = await readFile49(
|
|
519065
|
+
const raw2 = await readFile49(join161(dir, entry.name), "utf-8");
|
|
519064
519066
|
results.push(JSON.parse(raw2));
|
|
519065
519067
|
} catch (e) {
|
|
519066
519068
|
logForDebugging(
|
|
@@ -519072,7 +519074,7 @@ async function listRemoteAgentMetadata() {
|
|
|
519072
519074
|
}
|
|
519073
519075
|
function sessionIdExists(sessionId) {
|
|
519074
519076
|
const projectDir2 = getProjectDir3(getOriginalCwd());
|
|
519075
|
-
const sessionFile =
|
|
519077
|
+
const sessionFile = join161(projectDir2, `${sessionId}.jsonl`);
|
|
519076
519078
|
const fs15 = getFsImplementation();
|
|
519077
519079
|
try {
|
|
519078
519080
|
fs15.statSync(sessionFile);
|
|
@@ -520588,7 +520590,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
520588
520590
|
};
|
|
520589
520591
|
}
|
|
520590
520592
|
async function loadSessionFile(sessionId) {
|
|
520591
|
-
const sessionFile =
|
|
520593
|
+
const sessionFile = join161(
|
|
520592
520594
|
getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()),
|
|
520593
520595
|
`${sessionId}.jsonl`
|
|
520594
520596
|
);
|
|
@@ -520680,7 +520682,7 @@ async function loadAllProjectsMessageLogsFull(limit2) {
|
|
|
520680
520682
|
} catch {
|
|
520681
520683
|
return [];
|
|
520682
520684
|
}
|
|
520683
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
520685
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join161(projectsDir, dirent.name));
|
|
520684
520686
|
const logsPerProject = await Promise.all(
|
|
520685
520687
|
projectDirs.map((projectDir2) => getLogsWithoutIndex(projectDir2, limit2))
|
|
520686
520688
|
);
|
|
@@ -520707,7 +520709,7 @@ async function loadAllProjectsMessageLogsProgressive(limit2, initialEnrichCount
|
|
|
520707
520709
|
} catch {
|
|
520708
520710
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
520709
520711
|
}
|
|
520710
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
520712
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join161(projectsDir, dirent.name));
|
|
520711
520713
|
const rawLogs = [];
|
|
520712
520714
|
for (const projectDir2 of projectDirs) {
|
|
520713
520715
|
rawLogs.push(...await getSessionFilesLite(projectDir2, limit2));
|
|
@@ -520780,7 +520782,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit2) {
|
|
|
520780
520782
|
seenDirs.add(dirName);
|
|
520781
520783
|
allLogs.push(
|
|
520782
520784
|
...await getSessionFilesLite(
|
|
520783
|
-
|
|
520785
|
+
join161(projectsDir, dirent.name),
|
|
520784
520786
|
void 0,
|
|
520785
520787
|
wtPath
|
|
520786
520788
|
)
|
|
@@ -520863,7 +520865,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
520863
520865
|
return transcripts;
|
|
520864
520866
|
}
|
|
520865
520867
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
520866
|
-
const subagentsDir =
|
|
520868
|
+
const subagentsDir = join161(
|
|
520867
520869
|
getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()),
|
|
520868
520870
|
getSessionId(),
|
|
520869
520871
|
"subagents"
|
|
@@ -521003,7 +521005,7 @@ async function getSessionFilesWithMtime(projectDir2) {
|
|
|
521003
521005
|
if (!dirent.isFile() || !dirent.name.endsWith(".jsonl")) continue;
|
|
521004
521006
|
const sessionId = validateUuid(basename46(dirent.name, ".jsonl"));
|
|
521005
521007
|
if (!sessionId) continue;
|
|
521006
|
-
candidates.push({ sessionId, filePath:
|
|
521008
|
+
candidates.push({ sessionId, filePath: join161(projectDir2, dirent.name) });
|
|
521007
521009
|
}
|
|
521008
521010
|
await Promise.all(
|
|
521009
521011
|
candidates.map(async ({ sessionId, filePath }) => {
|
|
@@ -521417,7 +521419,7 @@ var init_sessionStorage = __esm({
|
|
|
521417
521419
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
521418
521420
|
agentTranscriptSubdirs = /* @__PURE__ */ new Map();
|
|
521419
521421
|
getProjectDir3 = memoize_default((projectDir2) => {
|
|
521420
|
-
return
|
|
521422
|
+
return join161(getProjectsDir2(), sanitizePath(projectDir2));
|
|
521421
521423
|
});
|
|
521422
521424
|
project = null;
|
|
521423
521425
|
cleanupRegistered5 = false;
|
|
@@ -522352,13 +522354,13 @@ var init_memdir = __esm({
|
|
|
522352
522354
|
});
|
|
522353
522355
|
|
|
522354
522356
|
// build-src/src/tools/AgentTool/agentMemory.ts
|
|
522355
|
-
import { join as
|
|
522357
|
+
import { join as join162, normalize as normalize16, sep as sep33 } from "path";
|
|
522356
522358
|
function sanitizeAgentTypeForPath(agentType) {
|
|
522357
522359
|
return agentType.replace(/:/g, "-");
|
|
522358
522360
|
}
|
|
522359
522361
|
function getLocalAgentMemoryDir(dirName) {
|
|
522360
522362
|
if (process.env.SEMA_CODE_REMOTE_MEMORY_DIR) {
|
|
522361
|
-
return
|
|
522363
|
+
return join162(
|
|
522362
522364
|
process.env.SEMA_CODE_REMOTE_MEMORY_DIR,
|
|
522363
522365
|
"projects",
|
|
522364
522366
|
sanitizePath(
|
|
@@ -522368,36 +522370,36 @@ function getLocalAgentMemoryDir(dirName) {
|
|
|
522368
522370
|
dirName
|
|
522369
522371
|
) + sep33;
|
|
522370
522372
|
}
|
|
522371
|
-
return
|
|
522373
|
+
return join162(getCwd(), ".sema", "agent-memory-local", dirName) + sep33;
|
|
522372
522374
|
}
|
|
522373
522375
|
function getAgentMemoryDir(agentType, scope) {
|
|
522374
522376
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
522375
522377
|
switch (scope) {
|
|
522376
522378
|
case "project":
|
|
522377
|
-
return
|
|
522379
|
+
return join162(getCwd(), ".sema", "agent-memory", dirName) + sep33;
|
|
522378
522380
|
case "local":
|
|
522379
522381
|
return getLocalAgentMemoryDir(dirName);
|
|
522380
522382
|
case "user":
|
|
522381
|
-
return
|
|
522383
|
+
return join162(getMemoryBaseDir(), "agent-memory", dirName) + sep33;
|
|
522382
522384
|
}
|
|
522383
522385
|
}
|
|
522384
522386
|
function isAgentMemoryPath(absolutePath) {
|
|
522385
522387
|
const normalizedPath = normalize16(absolutePath);
|
|
522386
522388
|
const memoryBase = getMemoryBaseDir();
|
|
522387
|
-
if (normalizedPath.startsWith(
|
|
522389
|
+
if (normalizedPath.startsWith(join162(memoryBase, "agent-memory") + sep33)) {
|
|
522388
522390
|
return true;
|
|
522389
522391
|
}
|
|
522390
|
-
if (normalizedPath.startsWith(
|
|
522392
|
+
if (normalizedPath.startsWith(join162(getCwd(), ".sema", "agent-memory") + sep33)) {
|
|
522391
522393
|
return true;
|
|
522392
522394
|
}
|
|
522393
522395
|
if (process.env.SEMA_CODE_REMOTE_MEMORY_DIR) {
|
|
522394
522396
|
if (normalizedPath.includes(sep33 + "agent-memory-local" + sep33) && normalizedPath.startsWith(
|
|
522395
|
-
|
|
522397
|
+
join162(process.env.SEMA_CODE_REMOTE_MEMORY_DIR, "projects") + sep33
|
|
522396
522398
|
)) {
|
|
522397
522399
|
return true;
|
|
522398
522400
|
}
|
|
522399
522401
|
} else if (normalizedPath.startsWith(
|
|
522400
|
-
|
|
522402
|
+
join162(getCwd(), ".sema", "agent-memory-local") + sep33
|
|
522401
522403
|
)) {
|
|
522402
522404
|
return true;
|
|
522403
522405
|
}
|
|
@@ -522406,7 +522408,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
522406
522408
|
function getMemoryScopeDisplay(memory2) {
|
|
522407
522409
|
switch (memory2) {
|
|
522408
522410
|
case "user":
|
|
522409
|
-
return `User (${
|
|
522411
|
+
return `User (${join162(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
522410
522412
|
case "project":
|
|
522411
522413
|
return "Project (.sema/agent-memory/)";
|
|
522412
522414
|
case "local":
|
|
@@ -522451,7 +522453,7 @@ var init_agentMemory = __esm({
|
|
|
522451
522453
|
// build-src/src/utils/permissions/filesystem.ts
|
|
522452
522454
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
522453
522455
|
import { homedir as homedir41, tmpdir as tmpdir14 } from "os";
|
|
522454
|
-
import { join as
|
|
522456
|
+
import { join as join163, normalize as normalize17, posix as posix8, sep as sep34 } from "path";
|
|
522455
522457
|
function normalizeCaseForComparison2(path27) {
|
|
522456
522458
|
return path27.toLowerCase();
|
|
522457
522459
|
}
|
|
@@ -522460,11 +522462,11 @@ function getClaudeSkillScope(filePath) {
|
|
|
522460
522462
|
const absolutePathLower = normalizeCaseForComparison2(absolutePath);
|
|
522461
522463
|
const bases = [
|
|
522462
522464
|
{
|
|
522463
|
-
dir: expandPath(
|
|
522465
|
+
dir: expandPath(join163(getOriginalCwd(), ".sema", "skills")),
|
|
522464
522466
|
prefix: "/.sema/skills/"
|
|
522465
522467
|
},
|
|
522466
522468
|
{
|
|
522467
|
-
dir: expandPath(
|
|
522469
|
+
dir: expandPath(join163(homedir41(), ".sema", "skills")),
|
|
522468
522470
|
prefix: "~/.sema/skills/"
|
|
522469
522471
|
}
|
|
522470
522472
|
];
|
|
@@ -522521,21 +522523,21 @@ function isClaudeConfigFilePath(filePath) {
|
|
|
522521
522523
|
if (isClaudeSettingsPath(filePath)) {
|
|
522522
522524
|
return true;
|
|
522523
522525
|
}
|
|
522524
|
-
const commandsDir =
|
|
522525
|
-
const agentsDir =
|
|
522526
|
-
const skillsDir =
|
|
522526
|
+
const commandsDir = join163(getOriginalCwd(), ".sema", "commands");
|
|
522527
|
+
const agentsDir = join163(getOriginalCwd(), ".sema", "agents");
|
|
522528
|
+
const skillsDir = join163(getOriginalCwd(), ".sema", "skills");
|
|
522527
522529
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
522528
522530
|
}
|
|
522529
522531
|
function isSessionPlanFile(absolutePath) {
|
|
522530
|
-
const expectedPrefix =
|
|
522532
|
+
const expectedPrefix = join163(getPlansDirectory(), getPlanSlug());
|
|
522531
522533
|
const normalizedPath = normalize17(absolutePath);
|
|
522532
522534
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
522533
522535
|
}
|
|
522534
522536
|
function getSessionMemoryDir() {
|
|
522535
|
-
return
|
|
522537
|
+
return join163(getProjectDir3(getCwd()), getSessionId(), "session-memory") + sep34;
|
|
522536
522538
|
}
|
|
522537
522539
|
function getSessionMemoryPath() {
|
|
522538
|
-
return
|
|
522540
|
+
return join163(getSessionMemoryDir(), "summary.md");
|
|
522539
522541
|
}
|
|
522540
522542
|
function isSessionMemoryPath(absolutePath) {
|
|
522541
522543
|
const normalizedPath = normalize17(absolutePath);
|
|
@@ -522557,10 +522559,10 @@ function getClaudeTempDirName() {
|
|
|
522557
522559
|
return `claude-${uid}`;
|
|
522558
522560
|
}
|
|
522559
522561
|
function getProjectTempDir() {
|
|
522560
|
-
return
|
|
522562
|
+
return join163(getClaudeTempDir(), sanitizePath(getOriginalCwd())) + sep34;
|
|
522561
522563
|
}
|
|
522562
522564
|
function getScratchpadDir() {
|
|
522563
|
-
return
|
|
522565
|
+
return join163(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
522564
522566
|
}
|
|
522565
522567
|
async function ensureScratchpadDir() {
|
|
522566
522568
|
if (!isScratchpadEnabled()) {
|
|
@@ -523212,7 +523214,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
523212
523214
|
if (false) {
|
|
523213
523215
|
const jobDir = process.env.SEMA_JOB_DIR;
|
|
523214
523216
|
if (jobDir) {
|
|
523215
|
-
const jobsRoot =
|
|
523217
|
+
const jobsRoot = join163(getClaudeConfigHomeDir(), "jobs");
|
|
523216
523218
|
const jobDirForms = getPathsForPermissionCheck(jobDir).map(normalize17);
|
|
523217
523219
|
const jobsRootForms = getPathsForPermissionCheck(jobsRoot).map(normalize17);
|
|
523218
523220
|
const isUnderJobsRoot = jobDirForms.every(
|
|
@@ -523257,7 +523259,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
523257
523259
|
}
|
|
523258
523260
|
};
|
|
523259
523261
|
}
|
|
523260
|
-
if (normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(
|
|
523262
|
+
if (normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(join163(getOriginalCwd(), ".sema", "launch.json"))) {
|
|
523261
523263
|
return {
|
|
523262
523264
|
behavior: "allow",
|
|
523263
523265
|
updatedInput: input,
|
|
@@ -523354,7 +523356,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
523354
523356
|
}
|
|
523355
523357
|
};
|
|
523356
523358
|
}
|
|
523357
|
-
const tasksDir =
|
|
523359
|
+
const tasksDir = join163(getClaudeConfigHomeDir(), "tasks") + sep34;
|
|
523358
523360
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
523359
523361
|
return {
|
|
523360
523362
|
behavior: "allow",
|
|
@@ -523365,7 +523367,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
523365
523367
|
}
|
|
523366
523368
|
};
|
|
523367
523369
|
}
|
|
523368
|
-
const teamsReadDir =
|
|
523370
|
+
const teamsReadDir = join163(getClaudeConfigHomeDir(), "teams") + sep34;
|
|
523369
523371
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
523370
523372
|
return {
|
|
523371
523373
|
behavior: "allow",
|
|
@@ -523441,12 +523443,12 @@ var init_filesystem = __esm({
|
|
|
523441
523443
|
resolvedBaseTmpDir = fs15.realpathSync(baseTmpDir);
|
|
523442
523444
|
} catch {
|
|
523443
523445
|
}
|
|
523444
|
-
return
|
|
523446
|
+
return join163(resolvedBaseTmpDir, getClaudeTempDirName()) + sep34;
|
|
523445
523447
|
});
|
|
523446
523448
|
getBundledSkillsRoot = memoize_default(
|
|
523447
523449
|
function getBundledSkillsRoot2() {
|
|
523448
523450
|
const nonce = randomBytes20(16).toString("hex");
|
|
523449
|
-
return
|
|
523451
|
+
return join163(getClaudeTempDir(), "bundled-skills", "2.1.88", nonce);
|
|
523450
523452
|
}
|
|
523451
523453
|
);
|
|
523452
523454
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
@@ -523462,10 +523464,10 @@ import {
|
|
|
523462
523464
|
symlink as symlink4,
|
|
523463
523465
|
unlink as unlink25
|
|
523464
523466
|
} from "fs/promises";
|
|
523465
|
-
import { join as
|
|
523467
|
+
import { join as join164 } from "path";
|
|
523466
523468
|
function getTaskOutputDir() {
|
|
523467
523469
|
if (_taskOutputDir === void 0) {
|
|
523468
|
-
_taskOutputDir =
|
|
523470
|
+
_taskOutputDir = join164(getProjectTempDir(), getSessionId(), "tasks");
|
|
523469
523471
|
}
|
|
523470
523472
|
return _taskOutputDir;
|
|
523471
523473
|
}
|
|
@@ -523473,7 +523475,7 @@ async function ensureOutputDir() {
|
|
|
523473
523475
|
await mkdir45(getTaskOutputDir(), { recursive: true });
|
|
523474
523476
|
}
|
|
523475
523477
|
function getTaskOutputPath(taskId) {
|
|
523476
|
-
return
|
|
523478
|
+
return join164(getTaskOutputDir(), `${taskId}.output`);
|
|
523477
523479
|
}
|
|
523478
523480
|
function track(p) {
|
|
523479
523481
|
_pendingOps.add(p);
|
|
@@ -528206,7 +528208,7 @@ import {
|
|
|
528206
528208
|
symlink as symlink5,
|
|
528207
528209
|
utimes as utimes2
|
|
528208
528210
|
} from "fs/promises";
|
|
528209
|
-
import { basename as basename48, dirname as dirname72, join as
|
|
528211
|
+
import { basename as basename48, dirname as dirname72, join as join165 } from "path";
|
|
528210
528212
|
function validateWorktreeSlug(slug) {
|
|
528211
528213
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
528212
528214
|
throw new Error(
|
|
@@ -528238,8 +528240,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
528238
528240
|
);
|
|
528239
528241
|
continue;
|
|
528240
528242
|
}
|
|
528241
|
-
const sourcePath =
|
|
528242
|
-
const destPath =
|
|
528243
|
+
const sourcePath = join165(repoRootPath, dir);
|
|
528244
|
+
const destPath = join165(worktreePath, dir);
|
|
528243
528245
|
try {
|
|
528244
528246
|
await symlink5(sourcePath, destPath, "dir");
|
|
528245
528247
|
logForDebugging(
|
|
@@ -528268,7 +528270,7 @@ function generateTmuxSessionName(repoPath, branch2) {
|
|
|
528268
528270
|
return combined.replace(/[/.]/g, "_");
|
|
528269
528271
|
}
|
|
528270
528272
|
function worktreesDir(repoRoot2) {
|
|
528271
|
-
return
|
|
528273
|
+
return join165(repoRoot2, ".sema", "worktrees");
|
|
528272
528274
|
}
|
|
528273
528275
|
function flattenSlug(slug) {
|
|
528274
528276
|
return slug.replaceAll("/", "+");
|
|
@@ -528277,7 +528279,7 @@ function worktreeBranchName(slug) {
|
|
|
528277
528279
|
return `worktree-${flattenSlug(slug)}`;
|
|
528278
528280
|
}
|
|
528279
528281
|
function worktreePathFor(repoRoot2, slug) {
|
|
528280
|
-
return
|
|
528282
|
+
return join165(worktreesDir(repoRoot2), flattenSlug(slug));
|
|
528281
528283
|
}
|
|
528282
528284
|
async function getOrCreateWorktree(repoRoot2, slug, options) {
|
|
528283
528285
|
const worktreePath = worktreePathFor(repoRoot2, slug);
|
|
@@ -528386,7 +528388,7 @@ async function getOrCreateWorktree(repoRoot2, slug, options) {
|
|
|
528386
528388
|
async function copyWorktreeIncludeFiles(repoRoot2, worktreePath) {
|
|
528387
528389
|
let includeContent;
|
|
528388
528390
|
try {
|
|
528389
|
-
includeContent = await readFile50(
|
|
528391
|
+
includeContent = await readFile50(join165(repoRoot2, ".worktreeinclude"), "utf-8");
|
|
528390
528392
|
} catch {
|
|
528391
528393
|
return [];
|
|
528392
528394
|
}
|
|
@@ -528444,8 +528446,8 @@ async function copyWorktreeIncludeFiles(repoRoot2, worktreePath) {
|
|
|
528444
528446
|
}
|
|
528445
528447
|
const copied = [];
|
|
528446
528448
|
for (const relativePath2 of files2) {
|
|
528447
|
-
const srcPath =
|
|
528448
|
-
const destPath =
|
|
528449
|
+
const srcPath = join165(repoRoot2, relativePath2);
|
|
528450
|
+
const destPath = join165(worktreePath, relativePath2);
|
|
528449
528451
|
try {
|
|
528450
528452
|
await mkdir46(dirname72(destPath), { recursive: true });
|
|
528451
528453
|
await copyFile10(srcPath, destPath);
|
|
@@ -528466,9 +528468,9 @@ async function copyWorktreeIncludeFiles(repoRoot2, worktreePath) {
|
|
|
528466
528468
|
}
|
|
528467
528469
|
async function performPostCreationSetup(repoRoot2, worktreePath) {
|
|
528468
528470
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
528469
|
-
const sourceSettingsLocal =
|
|
528471
|
+
const sourceSettingsLocal = join165(repoRoot2, localSettingsRelativePath);
|
|
528470
528472
|
try {
|
|
528471
|
-
const destSettingsLocal =
|
|
528473
|
+
const destSettingsLocal = join165(worktreePath, localSettingsRelativePath);
|
|
528472
528474
|
await mkdirRecursive(dirname72(destSettingsLocal));
|
|
528473
528475
|
await copyFile10(sourceSettingsLocal, destSettingsLocal);
|
|
528474
528476
|
logForDebugging(
|
|
@@ -528483,8 +528485,8 @@ async function performPostCreationSetup(repoRoot2, worktreePath) {
|
|
|
528483
528485
|
);
|
|
528484
528486
|
}
|
|
528485
528487
|
}
|
|
528486
|
-
const huskyPath =
|
|
528487
|
-
const gitHooksPath =
|
|
528488
|
+
const huskyPath = join165(repoRoot2, ".husky");
|
|
528489
|
+
const gitHooksPath = join165(repoRoot2, ".git", "hooks");
|
|
528488
528490
|
let hooksPath = null;
|
|
528489
528491
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
528490
528492
|
try {
|
|
@@ -528524,7 +528526,7 @@ async function performPostCreationSetup(repoRoot2, worktreePath) {
|
|
|
528524
528526
|
}
|
|
528525
528527
|
await copyWorktreeIncludeFiles(repoRoot2, worktreePath);
|
|
528526
528528
|
if (false) {
|
|
528527
|
-
const worktreeHooksDir = hooksPath === huskyPath ?
|
|
528529
|
+
const worktreeHooksDir = hooksPath === huskyPath ? join165(worktreePath, ".husky") : void 0;
|
|
528528
528530
|
void null.then(
|
|
528529
528531
|
(m2) => m2.installPrepareCommitMsgHook(worktreePath, worktreeHooksDir).catch((error51) => {
|
|
528530
528532
|
logForDebugging(
|
|
@@ -528819,7 +528821,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
|
|
|
528819
528821
|
if (!EPHEMERAL_WORKTREE_PATTERNS.some((p) => p.test(slug))) {
|
|
528820
528822
|
continue;
|
|
528821
528823
|
}
|
|
528822
|
-
const worktreePath =
|
|
528824
|
+
const worktreePath = join165(dir, slug);
|
|
528823
528825
|
if (currentPath === worktreePath) {
|
|
528824
528826
|
continue;
|
|
528825
528827
|
}
|
|
@@ -530590,16 +530592,20 @@ async function semaEngineNonStreamingLeg({
|
|
|
530590
530592
|
if (options.outputFormat?.schema) {
|
|
530591
530593
|
objective += side.jsonDisciplineSuffix(options.outputFormat.schema);
|
|
530592
530594
|
}
|
|
530593
|
-
const
|
|
530595
|
+
const r = await side.engineUtilityTask({
|
|
530594
530596
|
objective,
|
|
530595
530597
|
signal,
|
|
530596
530598
|
maxTokens: options.maxOutputTokensOverride,
|
|
530599
|
+
cheapSlot: true,
|
|
530597
530600
|
// 池内模型透传(A2 兜底):queryWithModel/advisor 显式选池模型时按所选路由;CC 名走 cheap/默认
|
|
530598
530601
|
modelRef: await side.resolvePoolModelRef(options.model)
|
|
530599
530602
|
});
|
|
530600
|
-
|
|
530603
|
+
const text2 = r.text;
|
|
530601
530604
|
const content = options.outputFormat?.schema ? side.extractJsonObjectText(text2) ?? text2 : text2;
|
|
530602
|
-
return createAssistantMessage({
|
|
530605
|
+
return createAssistantMessage({
|
|
530606
|
+
content,
|
|
530607
|
+
...r.usage ? { usage: r.usage } : {}
|
|
530608
|
+
});
|
|
530603
530609
|
}
|
|
530604
530610
|
async function queryModelWithoutStreaming({
|
|
530605
530611
|
messages,
|
|
@@ -535345,7 +535351,7 @@ __export(markdownConfigLoader_exports, {
|
|
|
535345
535351
|
import { statSync as statSync11 } from "fs";
|
|
535346
535352
|
import { lstat as lstat6, readdir as readdir31, readFile as readFile51, realpath as realpath12, stat as stat45 } from "fs/promises";
|
|
535347
535353
|
import { homedir as homedir42 } from "os";
|
|
535348
|
-
import { dirname as dirname73, join as
|
|
535354
|
+
import { dirname as dirname73, join as join166, resolve as resolve44, sep as sep35 } from "path";
|
|
535349
535355
|
function extractDescriptionFromMarkdown(content, defaultDescription = "Custom item") {
|
|
535350
535356
|
const lines = content.split("\n");
|
|
535351
535357
|
for (const line of lines) {
|
|
@@ -535436,7 +535442,7 @@ function getProjectDirsUpToHome(subdir, cwd5) {
|
|
|
535436
535442
|
if (normalizePathForComparison(current3) === normalizePathForComparison(home)) {
|
|
535437
535443
|
break;
|
|
535438
535444
|
}
|
|
535439
|
-
const claudeSubdir =
|
|
535445
|
+
const claudeSubdir = join166(current3, ".sema", subdir);
|
|
535440
535446
|
try {
|
|
535441
535447
|
statSync11(claudeSubdir);
|
|
535442
535448
|
dirs.push(claudeSubdir);
|
|
@@ -535484,7 +535490,7 @@ async function findMarkdownFilesNative(dir, signal) {
|
|
|
535484
535490
|
if (signal.aborted) {
|
|
535485
535491
|
break;
|
|
535486
535492
|
}
|
|
535487
|
-
const fullPath =
|
|
535493
|
+
const fullPath = join166(currentDir, entry.name);
|
|
535488
535494
|
try {
|
|
535489
535495
|
if (entry.isSymbolicLink()) {
|
|
535490
535496
|
try {
|
|
@@ -535590,20 +535596,20 @@ var init_markdownConfigLoader = __esm({
|
|
|
535590
535596
|
loadMarkdownFilesForSubdir = memoize_default(
|
|
535591
535597
|
async function(subdir, cwd5) {
|
|
535592
535598
|
const searchStartTime = Date.now();
|
|
535593
|
-
const userDir =
|
|
535594
|
-
const managedDir =
|
|
535599
|
+
const userDir = join166(getClaudeConfigHomeDir(), subdir);
|
|
535600
|
+
const managedDir = join166(getManagedFilePath(), ".sema", subdir);
|
|
535595
535601
|
const projectDirs = getProjectDirsUpToHome(subdir, cwd5);
|
|
535596
535602
|
const gitRoot = findGitRoot(cwd5);
|
|
535597
535603
|
const canonicalRoot = findCanonicalGitRoot(cwd5);
|
|
535598
535604
|
if (gitRoot && canonicalRoot && canonicalRoot !== gitRoot) {
|
|
535599
535605
|
const worktreeSubdir = normalizePathForComparison(
|
|
535600
|
-
|
|
535606
|
+
join166(gitRoot, ".sema", subdir)
|
|
535601
535607
|
);
|
|
535602
535608
|
const worktreeHasSubdir = projectDirs.some(
|
|
535603
535609
|
(dir) => normalizePathForComparison(dir) === worktreeSubdir
|
|
535604
535610
|
);
|
|
535605
535611
|
if (!worktreeHasSubdir) {
|
|
535606
|
-
const mainClaudeSubdir =
|
|
535612
|
+
const mainClaudeSubdir = join166(canonicalRoot, ".sema", subdir);
|
|
535607
535613
|
if (!projectDirs.includes(mainClaudeSubdir)) {
|
|
535608
535614
|
projectDirs.push(mainClaudeSubdir);
|
|
535609
535615
|
}
|
|
@@ -556971,6 +556977,14 @@ var init_degrading = __esm({
|
|
|
556971
556977
|
}
|
|
556972
556978
|
});
|
|
556973
556979
|
|
|
556980
|
+
// node_modules/@sema-agent/core/dist/core/side-query.js
|
|
556981
|
+
var init_side_query = __esm({
|
|
556982
|
+
"node_modules/@sema-agent/core/dist/core/side-query.js"() {
|
|
556983
|
+
init_roles();
|
|
556984
|
+
init_degrading();
|
|
556985
|
+
}
|
|
556986
|
+
});
|
|
556987
|
+
|
|
556974
556988
|
// node_modules/@sema-agent/core/dist/core/runner/usage-accounting.js
|
|
556975
556989
|
var init_usage_accounting = __esm({
|
|
556976
556990
|
"node_modules/@sema-agent/core/dist/core/runner/usage-accounting.js"() {
|
|
@@ -557131,7 +557145,7 @@ var init_auto_mode_prompt = __esm({
|
|
|
557131
557145
|
|
|
557132
557146
|
// node_modules/@sema-agent/core/dist/core/mcp.js
|
|
557133
557147
|
import { tmpdir as tmpdir15 } from "node:os";
|
|
557134
|
-
import { join as
|
|
557148
|
+
import { join as join167 } from "node:path";
|
|
557135
557149
|
var MCP_IMAGE_MAX_BASE64, IMAGE_TARGET_RAW_SIZE3, MCP_BLOB_DIR;
|
|
557136
557150
|
var init_mcp5 = __esm({
|
|
557137
557151
|
"node_modules/@sema-agent/core/dist/core/mcp.js"() {
|
|
@@ -557143,7 +557157,7 @@ var init_mcp5 = __esm({
|
|
|
557143
557157
|
init_untrusted_text();
|
|
557144
557158
|
MCP_IMAGE_MAX_BASE64 = 5 * 1024 * 1024;
|
|
557145
557159
|
IMAGE_TARGET_RAW_SIZE3 = MCP_IMAGE_MAX_BASE64 * 3 / 4;
|
|
557146
|
-
MCP_BLOB_DIR =
|
|
557160
|
+
MCP_BLOB_DIR = join167(tmpdir15(), "sema-mcp-blobs");
|
|
557147
557161
|
}
|
|
557148
557162
|
});
|
|
557149
557163
|
|
|
@@ -557863,6 +557877,7 @@ var init_runtask = __esm({
|
|
|
557863
557877
|
init_degrading();
|
|
557864
557878
|
init_status_sink();
|
|
557865
557879
|
init_roles();
|
|
557880
|
+
init_side_query();
|
|
557866
557881
|
init_prompt_suggestions();
|
|
557867
557882
|
init_memory_consolidation();
|
|
557868
557883
|
init_consolidate_scope();
|
|
@@ -558808,6 +558823,7 @@ var init_dist9 = __esm({
|
|
|
558808
558823
|
init_builtin_workflows();
|
|
558809
558824
|
init_workflow();
|
|
558810
558825
|
init_run_workflow_tool();
|
|
558826
|
+
init_side_query();
|
|
558811
558827
|
init_present_plan_tool();
|
|
558812
558828
|
init_workflow_run_store();
|
|
558813
558829
|
init_workflow_run_store2();
|
|
@@ -563360,11 +563376,11 @@ __export(fullscreenDefault_exports, {
|
|
|
563360
563376
|
applyFullscreenDefault: () => applyFullscreenDefault,
|
|
563361
563377
|
readFullscreenDefault: () => readFullscreenDefault
|
|
563362
563378
|
});
|
|
563363
|
-
import { readFileSync as
|
|
563364
|
-
import { join as
|
|
563379
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
563380
|
+
import { join as join168 } from "path";
|
|
563365
563381
|
function readFullscreenDefault(cwd5 = process.cwd()) {
|
|
563366
563382
|
try {
|
|
563367
|
-
const raw2 =
|
|
563383
|
+
const raw2 = readFileSync32(join168(cwd5, "config", "sema.shell.json"), "utf8");
|
|
563368
563384
|
const cfg = JSON.parse(raw2);
|
|
563369
563385
|
if (typeof cfg.fullscreen === "boolean") return cfg.fullscreen;
|
|
563370
563386
|
} catch {
|
|
@@ -563982,7 +563998,7 @@ __export(upstreamproxy_exports, {
|
|
|
563982
563998
|
});
|
|
563983
563999
|
import { mkdir as mkdir47, readFile as readFile52, unlink as unlink26, writeFile as writeFile47 } from "fs/promises";
|
|
563984
564000
|
import { homedir as homedir43 } from "os";
|
|
563985
|
-
import { join as
|
|
564001
|
+
import { join as join169 } from "path";
|
|
563986
564002
|
async function initUpstreamProxy(opts) {
|
|
563987
564003
|
if (!isEnvTruthy(process.env.SEMA_CODE_REMOTE)) {
|
|
563988
564004
|
return state2;
|
|
@@ -564006,7 +564022,7 @@ async function initUpstreamProxy(opts) {
|
|
|
564006
564022
|
}
|
|
564007
564023
|
setNonDumpable();
|
|
564008
564024
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
|
|
564009
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
564025
|
+
const caBundlePath = opts?.caBundlePath ?? join169(homedir43(), ".ccr", "ca-bundle.crt");
|
|
564010
564026
|
const caOk = await downloadCaBundle(
|
|
564011
564027
|
baseUrl,
|
|
564012
564028
|
opts?.systemCaPath ?? SYSTEM_CA_BUNDLE,
|
|
@@ -564123,7 +564139,7 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
564123
564139
|
}
|
|
564124
564140
|
const ccrCa = await resp.text();
|
|
564125
564141
|
const systemCa = await readFile52(systemCaPath, "utf8").catch(() => "");
|
|
564126
|
-
await mkdir47(
|
|
564142
|
+
await mkdir47(join169(outPath, ".."), { recursive: true });
|
|
564127
564143
|
await writeFile47(outPath, systemCa + "\n" + ccrCa, "utf8");
|
|
564128
564144
|
return true;
|
|
564129
564145
|
} catch (err8) {
|
|
@@ -575369,7 +575385,7 @@ var init_ShowInIDEPrompt = __esm({
|
|
|
575369
575385
|
|
|
575370
575386
|
// build-src/src/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
575371
575387
|
import { homedir as homedir44 } from "os";
|
|
575372
|
-
import { basename as basename53, join as
|
|
575388
|
+
import { basename as basename53, join as join170, sep as sep36 } from "path";
|
|
575373
575389
|
function isInClaudeFolder(filePath) {
|
|
575374
575390
|
const absolutePath = expandPath(filePath);
|
|
575375
575391
|
const claudeFolderPath = expandPath(`${getOriginalCwd()}/.claude`);
|
|
@@ -575380,7 +575396,7 @@ function isInClaudeFolder(filePath) {
|
|
|
575380
575396
|
}
|
|
575381
575397
|
function isInGlobalClaudeFolder(filePath) {
|
|
575382
575398
|
const absolutePath = expandPath(filePath);
|
|
575383
|
-
const globalClaudeFolderPath =
|
|
575399
|
+
const globalClaudeFolderPath = join170(homedir44(), ".sema");
|
|
575384
575400
|
const normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath);
|
|
575385
575401
|
const normalizedGlobalClaudeFolderPath = normalizeCaseForComparison2(globalClaudeFolderPath);
|
|
575386
575402
|
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep36.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
|
|
@@ -580570,9 +580586,9 @@ var init_WebFetchPermissionRequest = __esm({
|
|
|
580570
580586
|
});
|
|
580571
580587
|
|
|
580572
580588
|
// build-src/src/components/permissions/EngineWorkflowPermissionRequest.tsx
|
|
580573
|
-
import { mkdtempSync as mkdtempSync3, readFileSync as
|
|
580589
|
+
import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync33, writeFileSync as writeFileSync18 } from "node:fs";
|
|
580574
580590
|
import { tmpdir as tmpdir16 } from "node:os";
|
|
580575
|
-
import { join as
|
|
580591
|
+
import { join as join171 } from "node:path";
|
|
580576
580592
|
function parseWorkflowScriptPreview(script) {
|
|
580577
580593
|
if (!script) return { phases: [] };
|
|
580578
580594
|
const out6 = { phases: [] };
|
|
@@ -580627,15 +580643,15 @@ function EngineWorkflowPermissionRequest({
|
|
|
580627
580643
|
(ch2, key) => {
|
|
580628
580644
|
if (!(key.ctrl && (ch2 === "g" || ch2 === "\x07"))) return;
|
|
580629
580645
|
try {
|
|
580630
|
-
const dir = mkdtempSync3(
|
|
580631
|
-
const file2 =
|
|
580646
|
+
const dir = mkdtempSync3(join171(tmpdir16(), "sema-wf-edit-"));
|
|
580647
|
+
const file2 = join171(dir, "workflow-script.mjs");
|
|
580632
580648
|
writeFileSync18(file2, effectiveScript ?? "");
|
|
580633
580649
|
const ok2 = openFileInExternalEditor(file2);
|
|
580634
580650
|
if (!ok2) {
|
|
580635
580651
|
setEditNote("editor unavailable \u2014 set a terminal $EDITOR (vim/nano/\u2026)");
|
|
580636
580652
|
return;
|
|
580637
580653
|
}
|
|
580638
|
-
const next =
|
|
580654
|
+
const next = readFileSync33(file2, "utf8");
|
|
580639
580655
|
if (next !== (effectiveScript ?? "")) {
|
|
580640
580656
|
setEditedScript(next);
|
|
580641
580657
|
setEditNote('script edited \u2014 "Yes, run it" runs the edited script');
|
|
@@ -597720,9 +597736,9 @@ function initSkillImprovement() {
|
|
|
597720
597736
|
}
|
|
597721
597737
|
async function applySkillImprovement(skillName, updates) {
|
|
597722
597738
|
if (!skillName) return;
|
|
597723
|
-
const { join:
|
|
597739
|
+
const { join: join207 } = await import("path");
|
|
597724
597740
|
const fs15 = await import("fs/promises");
|
|
597725
|
-
const filePath =
|
|
597741
|
+
const filePath = join207(getCwd(), ".sema", "skills", skillName, "SKILL.md");
|
|
597726
597742
|
let currentContent;
|
|
597727
597743
|
try {
|
|
597728
597744
|
currentContent = await fs15.readFile(filePath, "utf-8");
|
|
@@ -598262,7 +598278,7 @@ var init_autoDream = __esm({
|
|
|
598262
598278
|
// build-src/src/utils/cleanup.ts
|
|
598263
598279
|
import * as fs14 from "fs/promises";
|
|
598264
598280
|
import { homedir as homedir45 } from "os";
|
|
598265
|
-
import { join as
|
|
598281
|
+
import { join as join172 } from "path";
|
|
598266
598282
|
function getCleanupPeriodDays() {
|
|
598267
598283
|
const settings2 = getSettings_DEPRECATED() || {};
|
|
598268
598284
|
return settings2.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -598289,7 +598305,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
598289
598305
|
try {
|
|
598290
598306
|
const timestamp = convertFileNameToDate(file2.name);
|
|
598291
598307
|
if (timestamp < cutoffDate) {
|
|
598292
|
-
await getFsImplementation().unlink(
|
|
598308
|
+
await getFsImplementation().unlink(join172(dirPath, file2.name));
|
|
598293
598309
|
if (isMessagePath) {
|
|
598294
598310
|
result.messages++;
|
|
598295
598311
|
} else {
|
|
@@ -598322,7 +598338,7 @@ async function cleanupOldMessageFiles() {
|
|
|
598322
598338
|
}
|
|
598323
598339
|
const mcpLogDirs = dirents.filter(
|
|
598324
598340
|
(dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")
|
|
598325
|
-
).map((dirent) =>
|
|
598341
|
+
).map((dirent) => join172(baseCachePath, dirent.name));
|
|
598326
598342
|
for (const mcpLogDir of mcpLogDirs) {
|
|
598327
598343
|
result = addCleanupResults(
|
|
598328
598344
|
result,
|
|
@@ -598364,7 +598380,7 @@ async function cleanupOldSessionFiles() {
|
|
|
598364
598380
|
}
|
|
598365
598381
|
for (const projectDirent of projectDirents) {
|
|
598366
598382
|
if (!projectDirent.isDirectory()) continue;
|
|
598367
|
-
const projectDir2 =
|
|
598383
|
+
const projectDir2 = join172(projectsDir, projectDirent.name);
|
|
598368
598384
|
let entries;
|
|
598369
598385
|
try {
|
|
598370
598386
|
entries = await fsImpl.readdir(projectDir2);
|
|
@@ -598378,14 +598394,14 @@ async function cleanupOldSessionFiles() {
|
|
|
598378
598394
|
continue;
|
|
598379
598395
|
}
|
|
598380
598396
|
try {
|
|
598381
|
-
if (await unlinkIfOld(
|
|
598397
|
+
if (await unlinkIfOld(join172(projectDir2, entry.name), cutoffDate, fsImpl)) {
|
|
598382
598398
|
result.messages++;
|
|
598383
598399
|
}
|
|
598384
598400
|
} catch {
|
|
598385
598401
|
result.errors++;
|
|
598386
598402
|
}
|
|
598387
598403
|
} else if (entry.isDirectory()) {
|
|
598388
|
-
const sessionDir =
|
|
598404
|
+
const sessionDir = join172(projectDir2, entry.name);
|
|
598389
598405
|
result = addCleanupResults(
|
|
598390
598406
|
result,
|
|
598391
598407
|
await cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl)
|
|
@@ -598403,7 +598419,7 @@ async function cleanupOldSessionFiles() {
|
|
|
598403
598419
|
}
|
|
598404
598420
|
async function cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl) {
|
|
598405
598421
|
const result = { messages: 0, errors: 0 };
|
|
598406
|
-
const toolResultsDir =
|
|
598422
|
+
const toolResultsDir = join172(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
598407
598423
|
let toolDirs;
|
|
598408
598424
|
try {
|
|
598409
598425
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -598414,7 +598430,7 @@ async function cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl) {
|
|
|
598414
598430
|
if (toolEntry.isFile()) {
|
|
598415
598431
|
try {
|
|
598416
598432
|
if (await unlinkIfOld(
|
|
598417
|
-
|
|
598433
|
+
join172(toolResultsDir, toolEntry.name),
|
|
598418
598434
|
cutoffDate,
|
|
598419
598435
|
fsImpl
|
|
598420
598436
|
)) {
|
|
@@ -598424,7 +598440,7 @@ async function cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl) {
|
|
|
598424
598440
|
result.errors++;
|
|
598425
598441
|
}
|
|
598426
598442
|
} else if (toolEntry.isDirectory()) {
|
|
598427
|
-
const toolDirPath =
|
|
598443
|
+
const toolDirPath = join172(toolResultsDir, toolEntry.name);
|
|
598428
598444
|
let toolFiles;
|
|
598429
598445
|
try {
|
|
598430
598446
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -598434,7 +598450,7 @@ async function cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl) {
|
|
|
598434
598450
|
for (const tf of toolFiles) {
|
|
598435
598451
|
if (!tf.isFile()) continue;
|
|
598436
598452
|
try {
|
|
598437
|
-
if (await unlinkIfOld(
|
|
598453
|
+
if (await unlinkIfOld(join172(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
598438
598454
|
result.messages++;
|
|
598439
598455
|
}
|
|
598440
598456
|
} catch {
|
|
@@ -598449,7 +598465,7 @@ async function cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl) {
|
|
|
598449
598465
|
}
|
|
598450
598466
|
async function cleanupSubagentsUnderSession(sessionDir, cutoffDate, fsImpl) {
|
|
598451
598467
|
const result = { messages: 0, errors: 0 };
|
|
598452
|
-
const subagentsDir =
|
|
598468
|
+
const subagentsDir = join172(sessionDir, "subagents");
|
|
598453
598469
|
let entries;
|
|
598454
598470
|
try {
|
|
598455
598471
|
entries = await fsImpl.readdir(subagentsDir);
|
|
@@ -598459,14 +598475,14 @@ async function cleanupSubagentsUnderSession(sessionDir, cutoffDate, fsImpl) {
|
|
|
598459
598475
|
for (const entry of entries) {
|
|
598460
598476
|
if (entry.isFile()) {
|
|
598461
598477
|
try {
|
|
598462
|
-
if (await unlinkIfOld(
|
|
598478
|
+
if (await unlinkIfOld(join172(subagentsDir, entry.name), cutoffDate, fsImpl)) {
|
|
598463
598479
|
result.messages++;
|
|
598464
598480
|
}
|
|
598465
598481
|
} catch {
|
|
598466
598482
|
result.errors++;
|
|
598467
598483
|
}
|
|
598468
598484
|
} else if (entry.isDirectory()) {
|
|
598469
|
-
const subDir =
|
|
598485
|
+
const subDir = join172(subagentsDir, entry.name);
|
|
598470
598486
|
let subEntries;
|
|
598471
598487
|
try {
|
|
598472
598488
|
subEntries = await fsImpl.readdir(subDir);
|
|
@@ -598477,7 +598493,7 @@ async function cleanupSubagentsUnderSession(sessionDir, cutoffDate, fsImpl) {
|
|
|
598477
598493
|
if (subEntry.isFile()) {
|
|
598478
598494
|
try {
|
|
598479
598495
|
if (await unlinkIfOld(
|
|
598480
|
-
|
|
598496
|
+
join172(subDir, subEntry.name),
|
|
598481
598497
|
cutoffDate,
|
|
598482
598498
|
fsImpl
|
|
598483
598499
|
)) {
|
|
@@ -598487,7 +598503,7 @@ async function cleanupSubagentsUnderSession(sessionDir, cutoffDate, fsImpl) {
|
|
|
598487
598503
|
result.errors++;
|
|
598488
598504
|
}
|
|
598489
598505
|
} else if (subEntry.isDirectory()) {
|
|
598490
|
-
const runDir =
|
|
598506
|
+
const runDir = join172(subDir, subEntry.name);
|
|
598491
598507
|
let runFiles;
|
|
598492
598508
|
try {
|
|
598493
598509
|
runFiles = await fsImpl.readdir(runDir);
|
|
@@ -598497,7 +598513,7 @@ async function cleanupSubagentsUnderSession(sessionDir, cutoffDate, fsImpl) {
|
|
|
598497
598513
|
for (const rf of runFiles) {
|
|
598498
598514
|
if (!rf.isFile()) continue;
|
|
598499
598515
|
try {
|
|
598500
|
-
if (await unlinkIfOld(
|
|
598516
|
+
if (await unlinkIfOld(join172(runDir, rf.name), cutoffDate, fsImpl)) {
|
|
598501
598517
|
result.messages++;
|
|
598502
598518
|
}
|
|
598503
598519
|
} catch {
|
|
@@ -598526,7 +598542,7 @@ async function cleanupSingleDirectory(dirPath, extension2, removeEmptyDir = true
|
|
|
598526
598542
|
for (const dirent of dirents) {
|
|
598527
598543
|
if (!dirent.isFile() || !dirent.name.endsWith(extension2)) continue;
|
|
598528
598544
|
try {
|
|
598529
|
-
if (await unlinkIfOld(
|
|
598545
|
+
if (await unlinkIfOld(join172(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
598530
598546
|
result.messages++;
|
|
598531
598547
|
}
|
|
598532
598548
|
} catch {
|
|
@@ -598539,7 +598555,7 @@ async function cleanupSingleDirectory(dirPath, extension2, removeEmptyDir = true
|
|
|
598539
598555
|
return result;
|
|
598540
598556
|
}
|
|
598541
598557
|
function cleanupOldPlanFiles() {
|
|
598542
|
-
const plansDir =
|
|
598558
|
+
const plansDir = join172(getClaudeConfigHomeDir(), "plans");
|
|
598543
598559
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
598544
598560
|
}
|
|
598545
598561
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -598548,14 +598564,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
598548
598564
|
const fsImpl = getFsImplementation();
|
|
598549
598565
|
try {
|
|
598550
598566
|
const configDir = getClaudeConfigHomeDir();
|
|
598551
|
-
const fileHistoryStorageDir =
|
|
598567
|
+
const fileHistoryStorageDir = join172(configDir, "file-history");
|
|
598552
598568
|
let dirents;
|
|
598553
598569
|
try {
|
|
598554
598570
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
598555
598571
|
} catch {
|
|
598556
598572
|
return result;
|
|
598557
598573
|
}
|
|
598558
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
598574
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join172(fileHistoryStorageDir, dirent.name));
|
|
598559
598575
|
await Promise.all(
|
|
598560
598576
|
fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
598561
598577
|
try {
|
|
@@ -598584,14 +598600,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
598584
598600
|
const fsImpl = getFsImplementation();
|
|
598585
598601
|
try {
|
|
598586
598602
|
const configDir = getClaudeConfigHomeDir();
|
|
598587
|
-
const sessionEnvBaseDir =
|
|
598603
|
+
const sessionEnvBaseDir = join172(configDir, "session-env");
|
|
598588
598604
|
let dirents;
|
|
598589
598605
|
try {
|
|
598590
598606
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
598591
598607
|
} catch {
|
|
598592
598608
|
return result;
|
|
598593
598609
|
}
|
|
598594
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
598610
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join172(sessionEnvBaseDir, dirent.name));
|
|
598595
598611
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
598596
598612
|
try {
|
|
598597
598613
|
const stats3 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -598642,7 +598658,7 @@ async function cleanupOldDebugLogs() {
|
|
|
598642
598658
|
const cutoffDate = getCutoffDate();
|
|
598643
598659
|
const result = { messages: 0, errors: 0 };
|
|
598644
598660
|
const fsImpl = getFsImplementation();
|
|
598645
|
-
const debugDir =
|
|
598661
|
+
const debugDir = join172(getClaudeConfigHomeDir(), "debug");
|
|
598646
598662
|
let dirents;
|
|
598647
598663
|
try {
|
|
598648
598664
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -598654,7 +598670,7 @@ async function cleanupOldDebugLogs() {
|
|
|
598654
598670
|
continue;
|
|
598655
598671
|
}
|
|
598656
598672
|
try {
|
|
598657
|
-
if (await unlinkIfOld(
|
|
598673
|
+
if (await unlinkIfOld(join172(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
598658
598674
|
result.messages++;
|
|
598659
598675
|
}
|
|
598660
598676
|
} catch {
|
|
@@ -598664,7 +598680,7 @@ async function cleanupOldDebugLogs() {
|
|
|
598664
598680
|
return result;
|
|
598665
598681
|
}
|
|
598666
598682
|
async function cleanupNpmCacheForAnthropicPackages() {
|
|
598667
|
-
const markerPath =
|
|
598683
|
+
const markerPath = join172(getClaudeConfigHomeDir(), ".npm-cache-cleanup");
|
|
598668
598684
|
try {
|
|
598669
598685
|
const stat55 = await fs14.stat(markerPath);
|
|
598670
598686
|
if (Date.now() - stat55.mtimeMs < ONE_DAY_MS2) {
|
|
@@ -598680,7 +598696,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
598680
598696
|
return;
|
|
598681
598697
|
}
|
|
598682
598698
|
logForDebugging("npm cache cleanup: starting");
|
|
598683
|
-
const npmCachePath =
|
|
598699
|
+
const npmCachePath = join172(homedir45(), ".npm", "_cacache");
|
|
598684
598700
|
const NPM_CACHE_RETENTION_COUNT = 5;
|
|
598685
598701
|
const startTime = Date.now();
|
|
598686
598702
|
try {
|
|
@@ -598740,7 +598756,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
598740
598756
|
}
|
|
598741
598757
|
}
|
|
598742
598758
|
async function cleanupOldVersionsThrottled() {
|
|
598743
|
-
const markerPath =
|
|
598759
|
+
const markerPath = join172(getClaudeConfigHomeDir(), ".version-cleanup");
|
|
598744
598760
|
try {
|
|
598745
598761
|
const stat55 = await fs14.stat(markerPath);
|
|
598746
598762
|
if (Date.now() - stat55.mtimeMs < ONE_DAY_MS2) {
|
|
@@ -600823,8 +600839,6 @@ var init_useCanUseTool = __esm({
|
|
|
600823
600839
|
});
|
|
600824
600840
|
|
|
600825
600841
|
// build-src/src/sema/sessionAutoTitle.ts
|
|
600826
|
-
import { readFileSync as readFileSync35 } from "node:fs";
|
|
600827
|
-
import { join as join174 } from "node:path";
|
|
600828
600842
|
function maybeGenerateSessionTitle(sessionContent) {
|
|
600829
600843
|
if (attempted) return;
|
|
600830
600844
|
if (!process.env.SEMA_LIVE_BASEURL) {
|
|
@@ -600853,65 +600867,44 @@ function maybeGenerateSessionTitle(sessionContent) {
|
|
|
600853
600867
|
});
|
|
600854
600868
|
}
|
|
600855
600869
|
async function generateAndSave(snippet) {
|
|
600856
|
-
|
|
600857
|
-
if (!baseUrl) return;
|
|
600858
|
-
let token = process.env.SEMA_LIVE_TOKEN ?? "";
|
|
600859
|
-
if (!token) {
|
|
600860
|
-
try {
|
|
600861
|
-
token = readFileSync35(join174(getClaudeConfigHomeDir(), "engine.token"), "utf-8").trim();
|
|
600862
|
-
} catch {
|
|
600863
|
-
}
|
|
600864
|
-
}
|
|
600870
|
+
if (!engineSideChannelActive()) return;
|
|
600865
600871
|
const objective = `${TITLE_PROMPT}
|
|
600866
600872
|
|
|
600867
600873
|
<session>
|
|
600868
600874
|
${snippet}
|
|
600869
600875
|
</session>`;
|
|
600870
|
-
|
|
600871
|
-
baseUrl,
|
|
600872
|
-
...token ? { token } : {},
|
|
600873
|
-
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
600874
|
-
});
|
|
600875
|
-
if (!client4) return;
|
|
600876
|
-
const controller = new AbortController();
|
|
600877
|
-
const timer2 = setTimeout(() => controller.abort(), 6e4);
|
|
600876
|
+
let text2;
|
|
600878
600877
|
try {
|
|
600879
|
-
|
|
600880
|
-
|
|
600881
|
-
|
|
600882
|
-
|
|
600883
|
-
|
|
600884
|
-
|
|
600885
|
-
} catch (e) {
|
|
600886
|
-
const status3 = e?.status;
|
|
600887
|
-
if (typeof status3 === "number") {
|
|
600888
|
-
logForDebugging(`[auto-title] engine ${status3}`);
|
|
600889
|
-
return;
|
|
600890
|
-
}
|
|
600891
|
-
throw e;
|
|
600878
|
+
text2 = await engineUtilityText({ objective, timeoutMs: 6e4 }) ?? "";
|
|
600879
|
+
} catch (e) {
|
|
600880
|
+
const status3 = e?.status;
|
|
600881
|
+
if (typeof status3 === "number") {
|
|
600882
|
+
logForDebugging(`[auto-title] engine ${status3}`);
|
|
600883
|
+
return;
|
|
600892
600884
|
}
|
|
600893
|
-
|
|
600894
|
-
|
|
600895
|
-
const title = m2 ? JSON.parse(`"${m2[1]}"`) : "";
|
|
600896
|
-
if (typeof title !== "string" || !title.trim() || title.length > 120) {
|
|
600897
|
-
logForDebugging(`[auto-title] unparsable result (${text2.slice(0, 80)})`);
|
|
600885
|
+
if (e instanceof Error && e.message.includes("empty result")) {
|
|
600886
|
+
logForDebugging("[auto-title] unparsable result (empty)");
|
|
600898
600887
|
return;
|
|
600899
600888
|
}
|
|
600900
|
-
|
|
600901
|
-
await saveCustomTitle(getSessionId(), title.trim(), void 0, "auto");
|
|
600902
|
-
logForDebugging(`[auto-title] saved: ${title.trim()}`);
|
|
600903
|
-
} finally {
|
|
600904
|
-
clearTimeout(timer2);
|
|
600889
|
+
throw e;
|
|
600905
600890
|
}
|
|
600891
|
+
const m2 = text2.match(/\{[^{}]*"title"\s*:\s*"((?:[^"\\]|\\.)*)"[^{}]*\}/);
|
|
600892
|
+
const title = m2 ? JSON.parse(`"${m2[1]}"`) : "";
|
|
600893
|
+
if (typeof title !== "string" || !title.trim() || title.length > 120) {
|
|
600894
|
+
logForDebugging(`[auto-title] unparsable result (${text2.slice(0, 80)})`);
|
|
600895
|
+
return;
|
|
600896
|
+
}
|
|
600897
|
+
if (getCurrentSessionTitle(getSessionId())) return;
|
|
600898
|
+
await saveCustomTitle(getSessionId(), title.trim(), void 0, "auto");
|
|
600899
|
+
logForDebugging(`[auto-title] saved: ${title.trim()}`);
|
|
600906
600900
|
}
|
|
600907
600901
|
var attempted, TITLE_PROMPT;
|
|
600908
600902
|
var init_sessionAutoTitle = __esm({
|
|
600909
600903
|
"build-src/src/sema/sessionAutoTitle.ts"() {
|
|
600910
600904
|
init_state();
|
|
600911
600905
|
init_debug();
|
|
600912
|
-
init_envUtils();
|
|
600913
600906
|
init_sessionStorage();
|
|
600914
|
-
|
|
600907
|
+
init_engineSideChannel();
|
|
600915
600908
|
attempted = false;
|
|
600916
600909
|
TITLE_PROMPT = `Generate a concise, sentence-case title (3-7 words) that captures the main topic or goal of this coding session. The title should be clear enough that the user recognizes the session in a list. Use sentence case: capitalize only the first word and proper nouns.
|
|
600917
600910
|
|
|
@@ -602789,7 +602782,7 @@ __export(asciicast_exports, {
|
|
|
602789
602782
|
renameRecordingForSession: () => renameRecordingForSession
|
|
602790
602783
|
});
|
|
602791
602784
|
import { appendFile as appendFile5, rename as rename14 } from "fs/promises";
|
|
602792
|
-
import { basename as basename63, dirname as dirname74, join as
|
|
602785
|
+
import { basename as basename63, dirname as dirname74, join as join174 } from "path";
|
|
602793
602786
|
function getRecordFilePath() {
|
|
602794
602787
|
if (recordingState.filePath !== null) {
|
|
602795
602788
|
return recordingState.filePath;
|
|
@@ -602800,10 +602793,10 @@ function getRecordFilePath() {
|
|
|
602800
602793
|
if (!isEnvTruthy(process.env.SEMA_CODE_TERMINAL_RECORDING)) {
|
|
602801
602794
|
return null;
|
|
602802
602795
|
}
|
|
602803
|
-
const projectsDir =
|
|
602804
|
-
const projectDir2 =
|
|
602796
|
+
const projectsDir = join174(getClaudeConfigHomeDir(), "projects");
|
|
602797
|
+
const projectDir2 = join174(projectsDir, sanitizePath(getOriginalCwd()));
|
|
602805
602798
|
recordingState.timestamp = Date.now();
|
|
602806
|
-
recordingState.filePath =
|
|
602799
|
+
recordingState.filePath = join174(
|
|
602807
602800
|
projectDir2,
|
|
602808
602801
|
`${getSessionId()}-${recordingState.timestamp}.cast`
|
|
602809
602802
|
);
|
|
@@ -602815,13 +602808,13 @@ function _resetRecordingStateForTesting() {
|
|
|
602815
602808
|
}
|
|
602816
602809
|
function getSessionRecordingPaths() {
|
|
602817
602810
|
const sessionId = getSessionId();
|
|
602818
|
-
const projectsDir =
|
|
602819
|
-
const projectDir2 =
|
|
602811
|
+
const projectsDir = join174(getClaudeConfigHomeDir(), "projects");
|
|
602812
|
+
const projectDir2 = join174(projectsDir, sanitizePath(getOriginalCwd()));
|
|
602820
602813
|
try {
|
|
602821
602814
|
const entries = getFsImplementation().readdirSync(projectDir2);
|
|
602822
602815
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
602823
602816
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
602824
|
-
return files2.map((f) =>
|
|
602817
|
+
return files2.map((f) => join174(projectDir2, f));
|
|
602825
602818
|
} catch {
|
|
602826
602819
|
return [];
|
|
602827
602820
|
}
|
|
@@ -602831,9 +602824,9 @@ async function renameRecordingForSession() {
|
|
|
602831
602824
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
602832
602825
|
return;
|
|
602833
602826
|
}
|
|
602834
|
-
const projectsDir =
|
|
602835
|
-
const projectDir2 =
|
|
602836
|
-
const newPath =
|
|
602827
|
+
const projectsDir = join174(getClaudeConfigHomeDir(), "projects");
|
|
602828
|
+
const projectDir2 = join174(projectsDir, sanitizePath(getOriginalCwd()));
|
|
602829
|
+
const newPath = join174(
|
|
602837
602830
|
projectDir2,
|
|
602838
602831
|
`${getSessionId()}-${recordingState.timestamp}.cast`
|
|
602839
602832
|
);
|
|
@@ -602964,7 +602957,7 @@ __export(sessionAutoSync_exports, {
|
|
|
602964
602957
|
maybeQueueAutoSyncPushAfterTurn: () => maybeQueueAutoSyncPushAfterTurn,
|
|
602965
602958
|
onAutoSyncEvent: () => onAutoSyncEvent
|
|
602966
602959
|
});
|
|
602967
|
-
import { readFileSync as
|
|
602960
|
+
import { readFileSync as readFileSync34 } from "node:fs";
|
|
602968
602961
|
function onAutoSyncEvent(cb) {
|
|
602969
602962
|
listener3 = cb;
|
|
602970
602963
|
for (const ev of pendingEvents2) cb(ev);
|
|
@@ -603005,7 +602998,7 @@ async function projectAutoSyncEnabled() {
|
|
|
603005
602998
|
const { getSettingsFilePathForSource: getSettingsFilePathForSource2 } = await Promise.resolve().then(() => (init_settings2(), settings_exports));
|
|
603006
602999
|
const path27 = getSettingsFilePathForSource2("localSettings");
|
|
603007
603000
|
if (!path27) return false;
|
|
603008
|
-
const doc = JSON.parse(
|
|
603001
|
+
const doc = JSON.parse(readFileSync34(path27, "utf8"));
|
|
603009
603002
|
return doc?.[AUTO_SYNC_SETTINGS_KEY] === true;
|
|
603010
603003
|
} catch {
|
|
603011
603004
|
return false;
|
|
@@ -606506,7 +606499,7 @@ var init_useChromeExtensionNotification = __esm({
|
|
|
606506
606499
|
});
|
|
606507
606500
|
|
|
606508
606501
|
// build-src/src/utils/plugins/officialMarketplaceStartupCheck.ts
|
|
606509
|
-
import { join as
|
|
606502
|
+
import { join as join175 } from "path";
|
|
606510
606503
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
606511
606504
|
return isEnvTruthy(
|
|
606512
606505
|
process.env.SEMA_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL
|
|
@@ -606597,7 +606590,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
606597
606590
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
606598
606591
|
}
|
|
606599
606592
|
const cacheDir = getMarketplacesCacheDir();
|
|
606600
|
-
const installLocation =
|
|
606593
|
+
const installLocation = join175(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
606601
606594
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(
|
|
606602
606595
|
installLocation,
|
|
606603
606596
|
cacheDir
|
|
@@ -609353,8 +609346,8 @@ function _temp161() {
|
|
|
609353
609346
|
var import_compiler_runtime316, import_react314, SETTINGS_ERRORS_NOTIFICATION_KEY;
|
|
609354
609347
|
var init_useSettingsErrors = __esm({
|
|
609355
609348
|
"build-src/src/hooks/notifs/useSettingsErrors.tsx"() {
|
|
609356
|
-
import_compiler_runtime316 = __toESM(require_compiler_runtime()
|
|
609357
|
-
import_react314 = __toESM(require_react()
|
|
609349
|
+
import_compiler_runtime316 = __toESM(require_compiler_runtime());
|
|
609350
|
+
import_react314 = __toESM(require_react());
|
|
609358
609351
|
init_notifications();
|
|
609359
609352
|
init_state();
|
|
609360
609353
|
init_allErrors();
|
|
@@ -610007,7 +610000,7 @@ var init_usePluginRecommendationBase = __esm({
|
|
|
610007
610000
|
});
|
|
610008
610001
|
|
|
610009
610002
|
// build-src/src/hooks/useLspPluginRecommendation.tsx
|
|
610010
|
-
import { extname as extname16, join as
|
|
610003
|
+
import { extname as extname16, join as join176 } from "path";
|
|
610011
610004
|
function useLspPluginRecommendation() {
|
|
610012
610005
|
const $3 = (0, import_compiler_runtime320.c)(12);
|
|
610013
610006
|
const trackedFiles = useAppState(_temp164);
|
|
@@ -610092,7 +610085,7 @@ function useLspPluginRecommendation() {
|
|
|
610092
610085
|
case "yes": {
|
|
610093
610086
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
610094
610087
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
610095
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
610088
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join176(pluginData.marketplaceInstallLocation, pluginData.entry.source) : void 0;
|
|
610096
610089
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", void 0, localSourcePath);
|
|
610097
610090
|
const settings2 = getSettingsForSource("userSettings");
|
|
610098
610091
|
updateSettingsForSource("userSettings", {
|
|
@@ -612873,7 +612866,7 @@ __export(REPL_exports, {
|
|
|
612873
612866
|
REPL: () => REPL
|
|
612874
612867
|
});
|
|
612875
612868
|
import { spawnSync as spawnSync11 } from "child_process";
|
|
612876
|
-
import { dirname as dirname76, join as
|
|
612869
|
+
import { dirname as dirname76, join as join177 } from "path";
|
|
612877
612870
|
import { tmpdir as tmpdir17 } from "os";
|
|
612878
612871
|
import { writeFile as writeFile49 } from "fs/promises";
|
|
612879
612872
|
import { randomUUID as randomUUID51 } from "crypto";
|
|
@@ -615838,7 +615831,7 @@ Note: ctrl + z now suspends Sema, ctrl + _ undoes input.
|
|
|
615838
615831
|
const w2 = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
615839
615832
|
const raw2 = await renderMessagesToPlainText(deferredMessages, tools, w2);
|
|
615840
615833
|
const text2 = raw2.replace(/[ \t]+$/gm, "");
|
|
615841
|
-
const path27 =
|
|
615834
|
+
const path27 = join177(tmpdir17(), `cc-transcript-${Date.now()}.txt`);
|
|
615842
615835
|
await writeFile49(path27, text2);
|
|
615843
615836
|
const opened = openFileInExternalEditor(path27);
|
|
615844
615837
|
setStatus(opened ? `opening ${path27}` : `wrote ${path27} \xB7 no $VISUAL/$EDITOR set`);
|
|
@@ -620263,8 +620256,8 @@ IMPORTANT: Start by calling mcp__claude-in-chrome__tabs_context_mcp to get infor
|
|
|
620263
620256
|
});
|
|
620264
620257
|
|
|
620265
620258
|
// build-src/src/sema/engineReportFindingsFace.ts
|
|
620266
|
-
import { existsSync as existsSync24, readFileSync as
|
|
620267
|
-
import { basename as basename64, dirname as dirname78, join as
|
|
620259
|
+
import { existsSync as existsSync24, readFileSync as readFileSync35 } from "fs";
|
|
620260
|
+
import { basename as basename64, dirname as dirname78, join as join178 } from "path";
|
|
620268
620261
|
function isLiveEngineSession() {
|
|
620269
620262
|
return typeof process.env.SEMA_LIVE_BASEURL === "string" && process.env.SEMA_LIVE_BASEURL.length > 0;
|
|
620270
620263
|
}
|
|
@@ -620282,18 +620275,18 @@ function localEngineCoreVersion() {
|
|
|
620282
620275
|
const entry = resolveEngineEntry();
|
|
620283
620276
|
if (!entry) return void 0;
|
|
620284
620277
|
const candidates = [
|
|
620285
|
-
|
|
620286
|
-
|
|
620278
|
+
join178(entry.cwd, "node_modules", "@sema-agent", "core", "package.json"),
|
|
620279
|
+
join178(entry.cwd, "node_modules", "@sema-ai", "core", "package.json")
|
|
620287
620280
|
];
|
|
620288
620281
|
const parent2 = dirname78(entry.cwd);
|
|
620289
620282
|
if (basename64(parent2) === "@sema-agent" || basename64(parent2) === "@sema-ai") {
|
|
620290
|
-
candidates.push(
|
|
620291
|
-
candidates.push(
|
|
620283
|
+
candidates.push(join178(parent2, "core", "package.json"));
|
|
620284
|
+
candidates.push(join178(dirname78(parent2), "@sema-agent", "core", "package.json"));
|
|
620292
620285
|
}
|
|
620293
620286
|
for (const p of candidates) {
|
|
620294
620287
|
try {
|
|
620295
620288
|
if (!existsSync24(p)) continue;
|
|
620296
|
-
const pkg = JSON.parse(
|
|
620289
|
+
const pkg = JSON.parse(readFileSync35(p, "utf8"));
|
|
620297
620290
|
if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
|
|
620298
620291
|
} catch {
|
|
620299
620292
|
}
|
|
@@ -621891,8 +621884,8 @@ __export(semaUpdater_exports, {
|
|
|
621891
621884
|
startSemaAutoUpdate: () => startSemaAutoUpdate
|
|
621892
621885
|
});
|
|
621893
621886
|
import { execFile as execFile7 } from "node:child_process";
|
|
621894
|
-
import { readFileSync as
|
|
621895
|
-
import { join as
|
|
621887
|
+
import { readFileSync as readFileSync36, realpathSync as realpathSync9 } from "node:fs";
|
|
621888
|
+
import { join as join179 } from "node:path";
|
|
621896
621889
|
function updateRegistry() {
|
|
621897
621890
|
const r = process.env.SEMA_UPDATE_REGISTRY?.trim();
|
|
621898
621891
|
const base = r && /^https?:\/\//.test(r) ? r : DEFAULT_REGISTRY;
|
|
@@ -621908,7 +621901,7 @@ function realArgv1() {
|
|
|
621908
621901
|
function installedPkgRoot() {
|
|
621909
621902
|
const p = realArgv1();
|
|
621910
621903
|
for (const name of KNOWN_PKGS) {
|
|
621911
|
-
const seg =
|
|
621904
|
+
const seg = join179("node_modules", ...name.split("/"));
|
|
621912
621905
|
const rootIdx = p.indexOf(seg);
|
|
621913
621906
|
if (rootIdx >= 0) return p.slice(0, rootIdx + seg.length);
|
|
621914
621907
|
}
|
|
@@ -621921,7 +621914,7 @@ function installedPkgName() {
|
|
|
621921
621914
|
try {
|
|
621922
621915
|
const root2 = installedPkgRoot();
|
|
621923
621916
|
if (root2) {
|
|
621924
|
-
const pkg = JSON.parse(
|
|
621917
|
+
const pkg = JSON.parse(readFileSync36(join179(root2, "package.json"), "utf8"));
|
|
621925
621918
|
if (typeof pkg.name === "string" && pkg.name.length > 0) return pkg.name;
|
|
621926
621919
|
}
|
|
621927
621920
|
} catch {
|
|
@@ -621932,7 +621925,7 @@ function installedVersion() {
|
|
|
621932
621925
|
try {
|
|
621933
621926
|
const pkgRoot = installedPkgRoot();
|
|
621934
621927
|
if (!pkgRoot) return null;
|
|
621935
|
-
const pkg = JSON.parse(
|
|
621928
|
+
const pkg = JSON.parse(readFileSync36(join179(pkgRoot, "package.json"), "utf8"));
|
|
621936
621929
|
return typeof pkg.version === "string" ? pkg.version : null;
|
|
621937
621930
|
} catch {
|
|
621938
621931
|
return null;
|
|
@@ -621942,7 +621935,7 @@ function installedEngineVersion() {
|
|
|
621942
621935
|
try {
|
|
621943
621936
|
const pkgRoot = installedPkgRoot();
|
|
621944
621937
|
if (!pkgRoot) return null;
|
|
621945
|
-
const pkg = JSON.parse(
|
|
621938
|
+
const pkg = JSON.parse(readFileSync36(join179(pkgRoot, "package.json"), "utf8"));
|
|
621946
621939
|
return typeof pkg.semaEngineVersion === "string" && pkg.semaEngineVersion.length > 0 ? pkg.semaEngineVersion : null;
|
|
621947
621940
|
} catch {
|
|
621948
621941
|
return null;
|
|
@@ -621951,7 +621944,7 @@ function installedEngineVersion() {
|
|
|
621951
621944
|
function npmrcToken() {
|
|
621952
621945
|
try {
|
|
621953
621946
|
const host = new URL(updateRegistry()).host;
|
|
621954
|
-
const rc =
|
|
621947
|
+
const rc = readFileSync36(join179(process.env.HOME ?? "", ".npmrc"), "utf8");
|
|
621955
621948
|
for (const line of rc.split("\n")) {
|
|
621956
621949
|
const m2 = line.match(/^\s*\/\/([^/]+)[^:]*:_authToken=(.+)$/);
|
|
621957
621950
|
if (m2 && m2[1] === host) return m2[2].trim();
|
|
@@ -622039,7 +622032,7 @@ var init_semaUpdater = __esm({
|
|
|
622039
622032
|
});
|
|
622040
622033
|
|
|
622041
622034
|
// build-src/src/commands/doctor/semaSections.tsx
|
|
622042
|
-
import { existsSync as existsSync25, readFileSync as
|
|
622035
|
+
import { existsSync as existsSync25, readFileSync as readFileSync37 } from "node:fs";
|
|
622043
622036
|
function SemaVersionLines({
|
|
622044
622037
|
installationType,
|
|
622045
622038
|
ccVersion
|
|
@@ -622112,7 +622105,7 @@ function mergedModelEnv() {
|
|
|
622112
622105
|
const out6 = {};
|
|
622113
622106
|
try {
|
|
622114
622107
|
const sj = JSON.parse(
|
|
622115
|
-
|
|
622108
|
+
readFileSync37(`${getClaudeConfigHomeDir()}/settings.json`, "utf8")
|
|
622116
622109
|
);
|
|
622117
622110
|
if (sj?.env) {
|
|
622118
622111
|
for (const [k2, v2] of Object.entries(sj.env)) if (typeof v2 === "string") out6[k2] = v2;
|
|
@@ -622180,7 +622173,7 @@ async function collectEngineRows() {
|
|
|
622180
622173
|
let anchor = null;
|
|
622181
622174
|
try {
|
|
622182
622175
|
if (existsSync25(portFilePath)) {
|
|
622183
|
-
const parsed = JSON.parse(
|
|
622176
|
+
const parsed = JSON.parse(readFileSync37(portFilePath, "utf8"));
|
|
622184
622177
|
if (typeof parsed.port === "number" && typeof parsed.pid === "number") anchor = parsed;
|
|
622185
622178
|
}
|
|
622186
622179
|
} catch {
|
|
@@ -622224,7 +622217,7 @@ async function collectEngineRows() {
|
|
|
622224
622217
|
const tokenPath = getEngineTokenFilePath();
|
|
622225
622218
|
let hasToken = false;
|
|
622226
622219
|
try {
|
|
622227
|
-
hasToken = existsSync25(tokenPath) &&
|
|
622220
|
+
hasToken = existsSync25(tokenPath) && readFileSync37(tokenPath, "utf8").trim().length > 0;
|
|
622228
622221
|
} catch {
|
|
622229
622222
|
}
|
|
622230
622223
|
if (anchor && isProcessAlive(anchor.pid ?? -1)) {
|
|
@@ -625128,12 +625121,12 @@ var init_createDirectConnectSession = __esm({
|
|
|
625128
625121
|
});
|
|
625129
625122
|
|
|
625130
625123
|
// build-src/src/utils/errorLogSink.ts
|
|
625131
|
-
import { dirname as dirname79, join as
|
|
625124
|
+
import { dirname as dirname79, join as join180 } from "path";
|
|
625132
625125
|
function getErrorsPath() {
|
|
625133
|
-
return
|
|
625126
|
+
return join180(CACHE_PATHS.errors(), DATE2 + ".jsonl");
|
|
625134
625127
|
}
|
|
625135
625128
|
function getMCPLogsPath(serverName) {
|
|
625136
|
-
return
|
|
625129
|
+
return join180(CACHE_PATHS.mcpLogs(serverName), DATE2 + ".jsonl");
|
|
625137
625130
|
}
|
|
625138
625131
|
function createJsonlWriter(options) {
|
|
625139
625132
|
const writer = createBufferedWriter(options);
|
|
@@ -625499,7 +625492,7 @@ var init_sessionMemory = __esm({
|
|
|
625499
625492
|
// build-src/src/utils/iTermBackup.ts
|
|
625500
625493
|
import { copyFile as copyFile11, stat as stat49 } from "fs/promises";
|
|
625501
625494
|
import { homedir as homedir46 } from "os";
|
|
625502
|
-
import { join as
|
|
625495
|
+
import { join as join181 } from "path";
|
|
625503
625496
|
function markITerm2SetupComplete() {
|
|
625504
625497
|
saveGlobalConfig((current3) => ({
|
|
625505
625498
|
...current3,
|
|
@@ -625514,7 +625507,7 @@ function getIterm2RecoveryInfo() {
|
|
|
625514
625507
|
};
|
|
625515
625508
|
}
|
|
625516
625509
|
function getITerm2PlistPath() {
|
|
625517
|
-
return
|
|
625510
|
+
return join181(
|
|
625518
625511
|
homedir46(),
|
|
625519
625512
|
"Library",
|
|
625520
625513
|
"Preferences",
|
|
@@ -629613,7 +629606,7 @@ __export(skillsWire_exports, {
|
|
|
629613
629606
|
skillCommandsToSpecs: () => skillCommandsToSpecs,
|
|
629614
629607
|
toCappedSpec: () => toCappedSpec
|
|
629615
629608
|
});
|
|
629616
|
-
import { join as
|
|
629609
|
+
import { join as join182 } from "path";
|
|
629617
629610
|
async function loadSkillSpecs(cwd5) {
|
|
629618
629611
|
const [dir, plugin2] = await Promise.all([
|
|
629619
629612
|
getSkillDirCommands(cwd5).catch(() => []),
|
|
@@ -629631,7 +629624,7 @@ async function loadSkillSpecs(cwd5) {
|
|
|
629631
629624
|
await Promise.all(
|
|
629632
629625
|
roots.map(async (root2) => {
|
|
629633
629626
|
try {
|
|
629634
|
-
const raw2 = await fs15.readFile(
|
|
629627
|
+
const raw2 = await fs15.readFile(join182(root2, "SKILL.md"), { encoding: "utf-8" });
|
|
629635
629628
|
const body = parseFrontmatter(raw2).content.trim();
|
|
629636
629629
|
if (body) bodyByRoot.set(root2, body);
|
|
629637
629630
|
} catch {
|
|
@@ -631723,7 +631716,7 @@ var init_idleTimeout = __esm({
|
|
|
631723
631716
|
// build-src/src/bridge/inboundAttachments.ts
|
|
631724
631717
|
import { randomUUID as randomUUID54 } from "crypto";
|
|
631725
631718
|
import { mkdir as mkdir48, writeFile as writeFile51 } from "fs/promises";
|
|
631726
|
-
import { basename as basename65, join as
|
|
631719
|
+
import { basename as basename65, join as join183 } from "path";
|
|
631727
631720
|
function debug(msg) {
|
|
631728
631721
|
logForDebugging(`[bridge:inbound-attach] ${msg}`);
|
|
631729
631722
|
}
|
|
@@ -631739,7 +631732,7 @@ function sanitizeFileName(name) {
|
|
|
631739
631732
|
return base || "attachment";
|
|
631740
631733
|
}
|
|
631741
631734
|
function uploadsDir() {
|
|
631742
|
-
return
|
|
631735
|
+
return join183(getClaudeConfigHomeDir(), "uploads", getSessionId());
|
|
631743
631736
|
}
|
|
631744
631737
|
async function resolveOne(att) {
|
|
631745
631738
|
const token = getBridgeAccessToken();
|
|
@@ -631768,7 +631761,7 @@ async function resolveOne(att) {
|
|
|
631768
631761
|
const safeName = sanitizeFileName(att.file_name);
|
|
631769
631762
|
const prefix = (att.file_uuid.slice(0, 8) || randomUUID54().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
631770
631763
|
const dir = uploadsDir();
|
|
631771
|
-
const outPath =
|
|
631764
|
+
const outPath = join183(dir, `${prefix}-${safeName}`);
|
|
631772
631765
|
try {
|
|
631773
631766
|
await mkdir48(dir, { recursive: true });
|
|
631774
631767
|
await writeFile51(outPath, data);
|
|
@@ -631970,7 +631963,7 @@ var init_sessionUrl = __esm({
|
|
|
631970
631963
|
|
|
631971
631964
|
// build-src/src/utils/plugins/zipCacheAdapters.ts
|
|
631972
631965
|
import { readFile as readFile54 } from "fs/promises";
|
|
631973
|
-
import { join as
|
|
631966
|
+
import { join as join184 } from "path";
|
|
631974
631967
|
async function readZipCacheKnownMarketplaces() {
|
|
631975
631968
|
try {
|
|
631976
631969
|
const content = await readFile54(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
@@ -632001,13 +631994,13 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
632001
631994
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
632002
631995
|
if (content !== null) {
|
|
632003
631996
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
632004
|
-
await atomicWriteToZipCache(
|
|
631997
|
+
await atomicWriteToZipCache(join184(zipCachePath, relPath), content);
|
|
632005
631998
|
}
|
|
632006
631999
|
}
|
|
632007
632000
|
async function readMarketplaceJsonContent(dir) {
|
|
632008
632001
|
const candidates = [
|
|
632009
|
-
|
|
632010
|
-
|
|
632002
|
+
join184(dir, ".claude-plugin", "marketplace.json"),
|
|
632003
|
+
join184(dir, "marketplace.json"),
|
|
632011
632004
|
dir
|
|
632012
632005
|
// For URL sources, installLocation IS the marketplace JSON file
|
|
632013
632006
|
];
|
|
@@ -632592,9 +632585,9 @@ __export(bridgePointer_exports, {
|
|
|
632592
632585
|
writeBridgePointer: () => writeBridgePointer
|
|
632593
632586
|
});
|
|
632594
632587
|
import { mkdir as mkdir49, readFile as readFile55, stat as stat50, unlink as unlink27, writeFile as writeFile52 } from "fs/promises";
|
|
632595
|
-
import { dirname as dirname80, join as
|
|
632588
|
+
import { dirname as dirname80, join as join185 } from "path";
|
|
632596
632589
|
function getBridgePointerPath(dir) {
|
|
632597
|
-
return
|
|
632590
|
+
return join185(getProjectsDir(), sanitizePath(dir), "bridge-pointer.json");
|
|
632598
632591
|
}
|
|
632599
632592
|
async function writeBridgePointer(dir, pointer) {
|
|
632600
632593
|
const path27 = getBridgePointerPath(dir);
|
|
@@ -639914,7 +639907,7 @@ __export(claudeDesktop_exports, {
|
|
|
639914
639907
|
});
|
|
639915
639908
|
import { readdir as readdir32, readFile as readFile57, stat as stat52 } from "fs/promises";
|
|
639916
639909
|
import { homedir as homedir47 } from "os";
|
|
639917
|
-
import { join as
|
|
639910
|
+
import { join as join186 } from "path";
|
|
639918
639911
|
async function getClaudeDesktopConfigPath() {
|
|
639919
639912
|
const platform4 = getPlatform();
|
|
639920
639913
|
if (!SUPPORTED_PLATFORMS.includes(platform4)) {
|
|
@@ -639923,7 +639916,7 @@ async function getClaudeDesktopConfigPath() {
|
|
|
639923
639916
|
);
|
|
639924
639917
|
}
|
|
639925
639918
|
if (platform4 === "macos") {
|
|
639926
|
-
return
|
|
639919
|
+
return join186(
|
|
639927
639920
|
homedir47(),
|
|
639928
639921
|
"Library",
|
|
639929
639922
|
"Application Support",
|
|
@@ -639949,7 +639942,7 @@ async function getClaudeDesktopConfigPath() {
|
|
|
639949
639942
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
639950
639943
|
continue;
|
|
639951
639944
|
}
|
|
639952
|
-
const potentialConfigPath =
|
|
639945
|
+
const potentialConfigPath = join186(
|
|
639953
639946
|
usersDir,
|
|
639954
639947
|
user.name,
|
|
639955
639948
|
"AppData",
|
|
@@ -640484,7 +640477,7 @@ __export(engineBgProbe_exports, {
|
|
|
640484
640477
|
evaluateBgSwitchGate: () => evaluateBgSwitchGate,
|
|
640485
640478
|
probeEngineActiveBgTasksForCli: () => probeEngineActiveBgTasksForCli
|
|
640486
640479
|
});
|
|
640487
|
-
import { readFileSync as
|
|
640480
|
+
import { readFileSync as readFileSync38 } from "node:fs";
|
|
640488
640481
|
async function drainFleetSnapshot(baseUrl, authToken) {
|
|
640489
640482
|
const { AgentClient: AgentClient6 } = await import("@sema-agent/sdk");
|
|
640490
640483
|
const client4 = new AgentClient6({ baseUrl, authToken, principal: "anon:shell-live" });
|
|
@@ -640543,7 +640536,7 @@ async function probeEngineActiveBgTasksForCli(deps2) {
|
|
|
640543
640536
|
const { getEnginePortFilePath: getEnginePortFilePath2, getEngineTokenFilePath: getEngineTokenFilePath2, isProcessAlive: isProcessAlive2, probeHealth: probeHealth2 } = await Promise.resolve().then(() => (init_engineLifecycleManager(), engineLifecycleManager_exports));
|
|
640544
640537
|
let anchor = null;
|
|
640545
640538
|
try {
|
|
640546
|
-
const parsed = JSON.parse(
|
|
640539
|
+
const parsed = JSON.parse(readFileSync38(getEnginePortFilePath2(), "utf8"));
|
|
640547
640540
|
if (typeof parsed.port === "number" && typeof parsed.pid === "number") anchor = parsed;
|
|
640548
640541
|
} catch {
|
|
640549
640542
|
}
|
|
@@ -640555,7 +640548,7 @@ async function probeEngineActiveBgTasksForCli(deps2) {
|
|
|
640555
640548
|
}
|
|
640556
640549
|
let token = { mode: "loopback-unauthed" };
|
|
640557
640550
|
try {
|
|
640558
|
-
const t2 =
|
|
640551
|
+
const t2 = readFileSync38(getEngineTokenFilePath2(), "utf8").trim();
|
|
640559
640552
|
if (t2) token = t2;
|
|
640560
640553
|
} catch {
|
|
640561
640554
|
}
|
|
@@ -642142,9 +642135,9 @@ __export(tlsTrust_exports, {
|
|
|
642142
642135
|
});
|
|
642143
642136
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
642144
642137
|
import { X509Certificate } from "node:crypto";
|
|
642145
|
-
import { existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as
|
|
642138
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync39, writeFileSync as writeFileSync19 } from "node:fs";
|
|
642146
642139
|
import { homedir as homedir48 } from "node:os";
|
|
642147
|
-
import { join as
|
|
642140
|
+
import { join as join187 } from "node:path";
|
|
642148
642141
|
function isCertError(detail) {
|
|
642149
642142
|
return /UNABLE_TO_GET_ISSUER_CERT|SELF_SIGNED_CERT|UNABLE_TO_VERIFY_LEAF|CERT_UNTRUSTED|DEPTH_ZERO_SELF_SIGNED|CERT_HAS_EXPIRED|ERR_TLS_CERT/i.test(
|
|
642150
642143
|
detail
|
|
@@ -642192,7 +642185,7 @@ async function injectDispatcher(extra) {
|
|
|
642192
642185
|
}
|
|
642193
642186
|
const ca = [...tls.rootCertificates, ...extra];
|
|
642194
642187
|
try {
|
|
642195
|
-
ca.push(
|
|
642188
|
+
ca.push(readFileSync39(process.env.NODE_EXTRA_CA_CERTS, "utf8"));
|
|
642196
642189
|
} catch {
|
|
642197
642190
|
}
|
|
642198
642191
|
const opts = {
|
|
@@ -642210,7 +642203,7 @@ async function injectDispatcher(extra) {
|
|
|
642210
642203
|
async function applyPersistedTlsTrust() {
|
|
642211
642204
|
try {
|
|
642212
642205
|
if (!existsSync26(CA_PATH)) return false;
|
|
642213
|
-
const raw2 =
|
|
642206
|
+
const raw2 = readFileSync39(CA_PATH, "utf8");
|
|
642214
642207
|
if (!raw2.includes("BEGIN CERTIFICATE")) return false;
|
|
642215
642208
|
const kept = filterCaCertificates(raw2);
|
|
642216
642209
|
if (kept.length === 0) return false;
|
|
@@ -642238,7 +642231,7 @@ async function applySystemTlsTrust() {
|
|
|
642238
642231
|
}
|
|
642239
642232
|
const kept = filterCaCertificates(pem);
|
|
642240
642233
|
if (kept.length === 0) return false;
|
|
642241
|
-
mkdirSync19(
|
|
642234
|
+
mkdirSync19(join187(homedir48(), ".sema"), { recursive: true });
|
|
642242
642235
|
writeFileSync19(CA_PATH, kept.join("\n") + "\n");
|
|
642243
642236
|
await injectDispatcher(kept);
|
|
642244
642237
|
return true;
|
|
@@ -642249,7 +642242,7 @@ async function applySystemTlsTrust() {
|
|
|
642249
642242
|
var CA_PATH, builtinRootBodies;
|
|
642250
642243
|
var init_tlsTrust = __esm({
|
|
642251
642244
|
"build-src/src/sema/tlsTrust.ts"() {
|
|
642252
|
-
CA_PATH =
|
|
642245
|
+
CA_PATH = join187(homedir48(), ".sema", "extra-ca.pem");
|
|
642253
642246
|
}
|
|
642254
642247
|
});
|
|
642255
642248
|
|
|
@@ -642260,11 +642253,11 @@ __export(printModeEngine_exports, {
|
|
|
642260
642253
|
ensurePrintModeEngine: () => ensurePrintModeEngine,
|
|
642261
642254
|
reclaimOneShotEngine: () => reclaimOneShotEngine
|
|
642262
642255
|
});
|
|
642263
|
-
import { readFileSync as
|
|
642264
|
-
import { join as
|
|
642256
|
+
import { readFileSync as readFileSync40, unlinkSync as unlinkSync8 } from "node:fs";
|
|
642257
|
+
import { join as join188 } from "node:path";
|
|
642265
642258
|
function seedUserSettingsEnv() {
|
|
642266
642259
|
try {
|
|
642267
|
-
const raw2 =
|
|
642260
|
+
const raw2 = readFileSync40(join188(getClaudeConfigHomeDir(), "settings.json"), "utf8");
|
|
642268
642261
|
const sj = JSON.parse(raw2);
|
|
642269
642262
|
if (sj?.env && typeof sj.env === "object") {
|
|
642270
642263
|
for (const [k2, v2] of Object.entries(sj.env)) {
|
|
@@ -642381,7 +642374,7 @@ function reclaimOneShotEngine(pid, api2, label = "one-shot") {
|
|
|
642381
642374
|
}
|
|
642382
642375
|
try {
|
|
642383
642376
|
const portPath = api2.getEnginePortFilePath();
|
|
642384
|
-
const cur = JSON.parse(
|
|
642377
|
+
const cur = JSON.parse(readFileSync40(portPath, "utf8"));
|
|
642385
642378
|
if (cur && cur.pid === pid) {
|
|
642386
642379
|
unlinkSync8(portPath);
|
|
642387
642380
|
try {
|
|
@@ -642544,8 +642537,8 @@ __export(cloudSessions_exports, {
|
|
|
642544
642537
|
cloudSessionPush: () => cloudSessionPush,
|
|
642545
642538
|
cloudSyncCommand: () => cloudSyncCommand
|
|
642546
642539
|
});
|
|
642547
|
-
import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as
|
|
642548
|
-
import { join as
|
|
642540
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync41, writeFileSync as writeFileSync20, copyFileSync as copyFileSync5 } from "node:fs";
|
|
642541
|
+
import { join as join189 } from "node:path";
|
|
642549
642542
|
import { realpathSync as realpathSync10 } from "node:fs";
|
|
642550
642543
|
function fail3(e) {
|
|
642551
642544
|
err5(`Error: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -642559,7 +642552,7 @@ function canonicalCwd2() {
|
|
|
642559
642552
|
}
|
|
642560
642553
|
}
|
|
642561
642554
|
function projectDir() {
|
|
642562
|
-
return
|
|
642555
|
+
return join189(getProjectsDir(), sanitizePath(canonicalCwd2()));
|
|
642563
642556
|
}
|
|
642564
642557
|
async function refuseIfTurnInflight2() {
|
|
642565
642558
|
const { activeTurnInflight: activeTurnInflight2 } = await Promise.resolve().then(() => (init_turnInflightMarker(), turnInflightMarker_exports));
|
|
@@ -642668,7 +642661,7 @@ async function engineIdForShellSession(shellSessionId) {
|
|
|
642668
642661
|
try {
|
|
642669
642662
|
const { SessionIdMapping: SessionIdMapping2 } = await Promise.resolve().then(() => (init_sessionIdMapping(), sessionIdMapping_exports));
|
|
642670
642663
|
const map2 = new SessionIdMapping2();
|
|
642671
|
-
map2.setPath(
|
|
642664
|
+
map2.setPath(join189(projectDir(), `${shellSessionId}.session-map.json`));
|
|
642672
642665
|
const rec = map2.read();
|
|
642673
642666
|
const engineId = rec?.engines?.local?.engineSessionId ?? rec?.engineSessionId;
|
|
642674
642667
|
return typeof engineId === "string" && engineId.length > 0 ? engineId : null;
|
|
@@ -642694,7 +642687,7 @@ async function recordSyncWatermark(shellSessionId, engineSessionId, peer, leafId
|
|
|
642694
642687
|
try {
|
|
642695
642688
|
const { SessionIdMapping: SessionIdMapping2, engineNamespaceKeyFor: engineNamespaceKeyFor2 } = await Promise.resolve().then(() => (init_sessionIdMapping(), sessionIdMapping_exports));
|
|
642696
642689
|
const map2 = new SessionIdMapping2();
|
|
642697
|
-
map2.setPath(
|
|
642690
|
+
map2.setPath(join189(projectDir(), `${shellSessionId}.session-map.json`));
|
|
642698
642691
|
map2.persistEngineEntry(
|
|
642699
642692
|
engineNamespaceKeyFor2(peer.baseUrl),
|
|
642700
642693
|
{
|
|
@@ -642731,7 +642724,7 @@ async function cloudSessionPush(sessionIdArg, opts = {}) {
|
|
|
642731
642724
|
const shellId = await resolveSessionId(sessionIdArg);
|
|
642732
642725
|
const engineId = await engineIdForShellSession(shellId);
|
|
642733
642726
|
if (!engineId) {
|
|
642734
|
-
const marker =
|
|
642727
|
+
const marker = join189(projectDir(), `${shellId}.import-seed.json`);
|
|
642735
642728
|
err5(`Error: no engine-side record for session ${shellId} \u2014 there is nothing to push.`);
|
|
642736
642729
|
if (existsSync27(marker)) {
|
|
642737
642730
|
err5(" This session was imported from Sema and has not run a turn here yet.");
|
|
@@ -642832,7 +642825,7 @@ async function cloudSessionPull(sessionIdArg, opts = {}) {
|
|
|
642832
642825
|
const { syncEntriesToTranscriptLines: syncEntriesToTranscriptLines2, selectEntriesByIds: selectEntriesByIds2, lastLineUuid: lastLineUuid2 } = await Promise.resolve().then(() => (init_sessionSyncTranscript(), sessionSyncTranscript_exports));
|
|
642833
642826
|
const destDir = projectDir();
|
|
642834
642827
|
mkdirSync20(destDir, { recursive: true });
|
|
642835
|
-
const jsonlPath =
|
|
642828
|
+
const jsonlPath = join189(destDir, `${id}.jsonl`);
|
|
642836
642829
|
const cwd5 = canonicalCwd2();
|
|
642837
642830
|
const version4 = "0.0.0-sync";
|
|
642838
642831
|
let appended = 0;
|
|
@@ -642845,7 +642838,7 @@ async function cloudSessionPull(sessionIdArg, opts = {}) {
|
|
|
642845
642838
|
} else {
|
|
642846
642839
|
const plan2 = engineHalf?.plan;
|
|
642847
642840
|
if (plan2 && plan2.relation === "fast_forward") {
|
|
642848
|
-
const body =
|
|
642841
|
+
const body = readFileSync41(jsonlPath, "utf8");
|
|
642849
642842
|
const known = /* @__PURE__ */ new Set();
|
|
642850
642843
|
for (const line of body.split("\n")) {
|
|
642851
642844
|
try {
|
|
@@ -642988,7 +642981,7 @@ async function cloudSyncCommand(action2, opts = {}) {
|
|
|
642988
642981
|
}
|
|
642989
642982
|
const { SessionIdMapping: SessionIdMapping2 } = await Promise.resolve().then(() => (init_sessionIdMapping(), sessionIdMapping_exports));
|
|
642990
642983
|
const map2 = new SessionIdMapping2();
|
|
642991
|
-
map2.setPath(
|
|
642984
|
+
map2.setPath(join189(projectDir(), `${id}.session-map.json`));
|
|
642992
642985
|
if (action2 === "status") {
|
|
642993
642986
|
await printSyncStatus(id, map2.read());
|
|
642994
642987
|
return;
|
|
@@ -643006,7 +642999,7 @@ async function cloudSyncCommand(action2, opts = {}) {
|
|
|
643006
642999
|
if (shellId) {
|
|
643007
643000
|
const { SessionIdMapping: SessionIdMapping2 } = await Promise.resolve().then(() => (init_sessionIdMapping(), sessionIdMapping_exports));
|
|
643008
643001
|
const map2 = new SessionIdMapping2();
|
|
643009
|
-
map2.setPath(
|
|
643002
|
+
map2.setPath(join189(projectDir(), `${shellId}.session-map.json`));
|
|
643010
643003
|
rec = map2.read();
|
|
643011
643004
|
}
|
|
643012
643005
|
await printSyncStatus(shellId, rec);
|
|
@@ -643140,8 +643133,8 @@ __export(cloudResources_exports, {
|
|
|
643140
643133
|
cloudResourceSync: () => cloudResourceSync
|
|
643141
643134
|
});
|
|
643142
643135
|
import { createHash as createHash26 } from "node:crypto";
|
|
643143
|
-
import { existsSync as existsSync28, readdirSync as readdirSync11, readFileSync as
|
|
643144
|
-
import { basename as basename66, dirname as dirname82, isAbsolute as isAbsolute33, join as
|
|
643136
|
+
import { existsSync as existsSync28, readdirSync as readdirSync11, readFileSync as readFileSync42, statSync as statSync13 } from "node:fs";
|
|
643137
|
+
import { basename as basename66, dirname as dirname82, isAbsolute as isAbsolute33, join as join190, resolve as resolve47 } from "node:path";
|
|
643145
643138
|
function fail4(e) {
|
|
643146
643139
|
err6(`Error: ${e instanceof Error ? e.message : String(e)}`);
|
|
643147
643140
|
process.exit(1);
|
|
@@ -643512,10 +643505,10 @@ function stableStringify(v2) {
|
|
|
643512
643505
|
}
|
|
643513
643506
|
async function readLocalModels() {
|
|
643514
643507
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
|
|
643515
|
-
const path27 =
|
|
643508
|
+
const path27 = join190(getClaudeConfigHomeDir3(), "config.d", "models.json");
|
|
643516
643509
|
try {
|
|
643517
643510
|
const { normalizeModelsDocShape: normalizeModelsDocShape2 } = await Promise.resolve().then(() => (init_modelsDocShape(), modelsDocShape_exports));
|
|
643518
|
-
const doc = normalizeModelsDocShape2(JSON.parse(
|
|
643511
|
+
const doc = normalizeModelsDocShape2(JSON.parse(readFileSync42(path27, "utf-8")))?.doc ?? {};
|
|
643519
643512
|
const models = asArr3(doc.models).map(asRec3).filter((m2) => !!m2);
|
|
643520
643513
|
if (models.length > 0) return models;
|
|
643521
643514
|
} catch {
|
|
@@ -643580,7 +643573,7 @@ async function loadLocalModelEntries() {
|
|
|
643580
643573
|
async function readLocalModelRoles() {
|
|
643581
643574
|
try {
|
|
643582
643575
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
|
|
643583
|
-
const doc = JSON.parse(
|
|
643576
|
+
const doc = JSON.parse(readFileSync42(join190(getClaudeConfigHomeDir3(), "config.d", "models.json"), "utf-8"));
|
|
643584
643577
|
return asRec3(doc.roles);
|
|
643585
643578
|
} catch {
|
|
643586
643579
|
return void 0;
|
|
@@ -643668,7 +643661,7 @@ async function loadLocalMcpEntries() {
|
|
|
643668
643661
|
function readMcpFromFile(path27) {
|
|
643669
643662
|
let doc;
|
|
643670
643663
|
try {
|
|
643671
|
-
doc = JSON.parse(
|
|
643664
|
+
doc = JSON.parse(readFileSync42(resolve47(path27), "utf-8"));
|
|
643672
643665
|
} catch (e) {
|
|
643673
643666
|
return { error: `cannot read/parse ${path27}: ${e instanceof Error ? e.message : String(e)}` };
|
|
643674
643667
|
}
|
|
@@ -643693,13 +643686,13 @@ function readMcpFromFile(path27) {
|
|
|
643693
643686
|
async function skillRoots() {
|
|
643694
643687
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
|
|
643695
643688
|
const { getProjectDirsUpToHome: getProjectDirsUpToHome2 } = await Promise.resolve().then(() => (init_markdownConfigLoader(), markdownConfigLoader_exports));
|
|
643696
|
-
return [...getProjectDirsUpToHome2("skills", process.cwd()),
|
|
643689
|
+
return [...getProjectDirsUpToHome2("skills", process.cwd()), join190(getClaudeConfigHomeDir3(), "skills")];
|
|
643697
643690
|
}
|
|
643698
643691
|
async function resolveSkillFile(target) {
|
|
643699
643692
|
const tryFile = (p) => {
|
|
643700
643693
|
try {
|
|
643701
643694
|
if (!existsSync28(p)) return null;
|
|
643702
|
-
return statSync13(p).isDirectory() ? existsSync28(
|
|
643695
|
+
return statSync13(p).isDirectory() ? existsSync28(join190(p, "SKILL.md")) ? join190(p, "SKILL.md") : null : p;
|
|
643703
643696
|
} catch {
|
|
643704
643697
|
return null;
|
|
643705
643698
|
}
|
|
@@ -643712,7 +643705,7 @@ async function resolveSkillFile(target) {
|
|
|
643712
643705
|
}
|
|
643713
643706
|
const roots = await skillRoots();
|
|
643714
643707
|
for (const root2 of roots) {
|
|
643715
|
-
const f = tryFile(
|
|
643708
|
+
const f = tryFile(join190(root2, target));
|
|
643716
643709
|
if (f) return { file: f, fallbackName: target };
|
|
643717
643710
|
}
|
|
643718
643711
|
return { error: `no skill named '${target}' in the project or user skills directories (${roots.join(", ") || "none found"}) \u2014 pass a path to install from elsewhere` };
|
|
@@ -643720,7 +643713,7 @@ async function resolveSkillFile(target) {
|
|
|
643720
643713
|
async function readSkillEntry(file2, fallbackName) {
|
|
643721
643714
|
let raw2;
|
|
643722
643715
|
try {
|
|
643723
|
-
raw2 =
|
|
643716
|
+
raw2 = readFileSync42(file2, "utf-8");
|
|
643724
643717
|
} catch (e) {
|
|
643725
643718
|
return { name: fallbackName, display: fallbackName, entry: null, notes: [], skipReason: `cannot read ${file2}: ${e instanceof Error ? e.message : String(e)}` };
|
|
643726
643719
|
}
|
|
@@ -643753,7 +643746,7 @@ async function loadLocalSkillEntries() {
|
|
|
643753
643746
|
try {
|
|
643754
643747
|
dirs = readdirSync11(root2).filter((d4) => {
|
|
643755
643748
|
try {
|
|
643756
|
-
return statSync13(
|
|
643749
|
+
return statSync13(join190(root2, d4)).isDirectory() && existsSync28(join190(root2, d4, "SKILL.md"));
|
|
643757
643750
|
} catch {
|
|
643758
643751
|
return false;
|
|
643759
643752
|
}
|
|
@@ -643762,7 +643755,7 @@ async function loadLocalSkillEntries() {
|
|
|
643762
643755
|
continue;
|
|
643763
643756
|
}
|
|
643764
643757
|
for (const d4 of dirs) {
|
|
643765
|
-
const e = await readSkillEntry(
|
|
643758
|
+
const e = await readSkillEntry(join190(root2, d4, "SKILL.md"), d4);
|
|
643766
643759
|
if (!byName2.has(e.name)) byName2.set(e.name, e);
|
|
643767
643760
|
}
|
|
643768
643761
|
}
|
|
@@ -644495,7 +644488,7 @@ import { execFileSync as execFileSync6, spawn as spawn14 } from "child_process";
|
|
|
644495
644488
|
import { existsSync as existsSync29, statSync as statSync14 } from "fs";
|
|
644496
644489
|
import { createRequire as createRequire4 } from "module";
|
|
644497
644490
|
import { createInterface as createInterface3 } from "readline";
|
|
644498
|
-
import { dirname as dirname83, join as
|
|
644491
|
+
import { dirname as dirname83, join as join191, resolve as resolve48 } from "path";
|
|
644499
644492
|
function fail5(e) {
|
|
644500
644493
|
err7(`Error: ${e instanceof Error ? e.message : String(e)}`);
|
|
644501
644494
|
process.exit(1);
|
|
@@ -644513,15 +644506,15 @@ function npmEngineLocalCandidates() {
|
|
|
644513
644506
|
const candidates = [];
|
|
644514
644507
|
for (const pkg of ENGINE_NPM_PACKAGES) {
|
|
644515
644508
|
try {
|
|
644516
|
-
const req = createRequire4(
|
|
644517
|
-
candidates.push(
|
|
644509
|
+
const req = createRequire4(join191(process.cwd(), "__sema_resolve__.js"));
|
|
644510
|
+
candidates.push(join191(dirname83(req.resolve(`${pkg}/package.json`)), ENGINE_REL_PATH));
|
|
644518
644511
|
} catch {
|
|
644519
644512
|
}
|
|
644520
644513
|
}
|
|
644521
644514
|
let dir = process.cwd();
|
|
644522
644515
|
for (; ; ) {
|
|
644523
644516
|
for (const pkg of ENGINE_NPM_PACKAGES) {
|
|
644524
|
-
candidates.push(
|
|
644517
|
+
candidates.push(join191(dir, "node_modules", pkg, ENGINE_REL_PATH));
|
|
644525
644518
|
}
|
|
644526
644519
|
const parent2 = dirname83(dir);
|
|
644527
644520
|
if (parent2 === dir) break;
|
|
@@ -644532,7 +644525,7 @@ function npmEngineLocalCandidates() {
|
|
|
644532
644525
|
function npmEngineGlobalCandidates() {
|
|
644533
644526
|
try {
|
|
644534
644527
|
const globalRoot = execFileSync6("npm", ["root", "-g"], { encoding: "utf8", timeout: 1e4 }).trim();
|
|
644535
|
-
return globalRoot ? ENGINE_NPM_PACKAGES.map((pkg) =>
|
|
644528
|
+
return globalRoot ? ENGINE_NPM_PACKAGES.map((pkg) => join191(globalRoot, pkg, ENGINE_REL_PATH)) : [];
|
|
644536
644529
|
} catch {
|
|
644537
644530
|
return [];
|
|
644538
644531
|
}
|
|
@@ -644542,9 +644535,9 @@ function resolveEnginePath(engineFlag) {
|
|
|
644542
644535
|
for (const base of [engineFlag, process.env.SEMA_UP_ENGINE]) {
|
|
644543
644536
|
if (!base) continue;
|
|
644544
644537
|
const abs = resolve48(base);
|
|
644545
|
-
explicit.push(abs,
|
|
644538
|
+
explicit.push(abs, join191(abs, "sema-up.sh"));
|
|
644546
644539
|
}
|
|
644547
|
-
return firstExistingFile(explicit) ?? firstExistingFile(npmEngineLocalCandidates()) ?? firstExistingFile(npmEngineGlobalCandidates()) ?? firstExistingFile([
|
|
644540
|
+
return firstExistingFile(explicit) ?? firstExistingFile(npmEngineLocalCandidates()) ?? firstExistingFile(npmEngineGlobalCandidates()) ?? firstExistingFile([join191(process.cwd(), "deploy", "sema-up", "sema-up.sh")]);
|
|
644548
644541
|
}
|
|
644549
644542
|
async function promptQuestion(reader, q2) {
|
|
644550
644543
|
out5("");
|
|
@@ -644814,7 +644807,7 @@ var init_cloudOps = __esm({
|
|
|
644814
644807
|
err7 = (line) => process.stderr.write(`${line}
|
|
644815
644808
|
`);
|
|
644816
644809
|
ENGINE_NPM_PACKAGES = ["@sema-agent/server", "@sema-ai/server"];
|
|
644817
|
-
ENGINE_REL_PATH =
|
|
644810
|
+
ENGINE_REL_PATH = join191("deploy", "sema-up", "sema-up.sh");
|
|
644818
644811
|
AnswerReader = class {
|
|
644819
644812
|
queue = [];
|
|
644820
644813
|
waiter;
|
|
@@ -646640,7 +646633,7 @@ var Doctor_exports = {};
|
|
|
646640
646633
|
__export(Doctor_exports, {
|
|
646641
646634
|
Doctor: () => Doctor
|
|
646642
646635
|
});
|
|
646643
|
-
import { join as
|
|
646636
|
+
import { join as join192 } from "path";
|
|
646644
646637
|
function Doctor(t0) {
|
|
646645
646638
|
const $3 = (0, import_compiler_runtime346.c)(84);
|
|
646646
646639
|
const {
|
|
@@ -646710,8 +646703,8 @@ function Doctor(t0) {
|
|
|
646710
646703
|
t5 = () => {
|
|
646711
646704
|
getDoctorDiagnostic().then(setDiagnostic);
|
|
646712
646705
|
(async () => {
|
|
646713
|
-
const userAgentsDir =
|
|
646714
|
-
const projectAgentsDir =
|
|
646706
|
+
const userAgentsDir = join192(getClaudeConfigHomeDir(), "agents");
|
|
646707
|
+
const projectAgentsDir = join192(getOriginalCwd(), ".sema", "agents");
|
|
646715
646708
|
const {
|
|
646716
646709
|
activeAgents,
|
|
646717
646710
|
allAgents,
|
|
@@ -646734,7 +646727,7 @@ function Doctor(t0) {
|
|
|
646734
646727
|
}, async () => toolPermissionContext);
|
|
646735
646728
|
setContextWarnings(warnings);
|
|
646736
646729
|
if (isPidBasedLockingEnabled()) {
|
|
646737
|
-
const locksDir =
|
|
646730
|
+
const locksDir = join192(getXDGStateHome(), "claude", "locks");
|
|
646738
646731
|
const staleLocksCleaned = cleanupStaleLocks(locksDir);
|
|
646739
646732
|
const locks = getAllLockInfo(locksDir);
|
|
646740
646733
|
setVersionLockInfo({
|
|
@@ -648569,17 +648562,17 @@ import {
|
|
|
648569
648562
|
existsSync as existsSync30,
|
|
648570
648563
|
mkdirSync as mkdirSync21,
|
|
648571
648564
|
readdirSync as readdirSync12,
|
|
648572
|
-
readFileSync as
|
|
648565
|
+
readFileSync as readFileSync43,
|
|
648573
648566
|
statSync as statSync15
|
|
648574
648567
|
} from "node:fs";
|
|
648575
|
-
import { dirname as dirname85, join as
|
|
648568
|
+
import { dirname as dirname85, join as join193, relative as relative36 } from "node:path";
|
|
648576
648569
|
function display(p) {
|
|
648577
648570
|
const home = homedir50();
|
|
648578
648571
|
return p.startsWith(home) ? "~" + p.slice(home.length) : p;
|
|
648579
648572
|
}
|
|
648580
648573
|
function filesEqual(a, b3) {
|
|
648581
648574
|
try {
|
|
648582
|
-
return
|
|
648575
|
+
return readFileSync43(a).equals(readFileSync43(b3));
|
|
648583
648576
|
} catch {
|
|
648584
648577
|
return false;
|
|
648585
648578
|
}
|
|
@@ -648652,7 +648645,7 @@ function syncPlainFile(src, dest, label, opts, report) {
|
|
|
648652
648645
|
}
|
|
648653
648646
|
function syncJsonFile(src, dest, label, opts, report) {
|
|
648654
648647
|
if (!existsSync30(src)) return;
|
|
648655
|
-
const srcText =
|
|
648648
|
+
const srcText = readFileSync43(src, "utf-8");
|
|
648656
648649
|
if (!existsSync30(dest)) {
|
|
648657
648650
|
if (!opts.dryRun) {
|
|
648658
648651
|
ensureDir2(dest);
|
|
@@ -648661,7 +648654,7 @@ function syncJsonFile(src, dest, label, opts, report) {
|
|
|
648661
648654
|
recordAction(report, { action: "copy", label });
|
|
648662
648655
|
return;
|
|
648663
648656
|
}
|
|
648664
|
-
const destText =
|
|
648657
|
+
const destText = readFileSync43(dest, "utf-8");
|
|
648665
648658
|
if (Buffer.from(srcText).equals(Buffer.from(destText))) {
|
|
648666
648659
|
recordAction(report, { action: "same", label });
|
|
648667
648660
|
return;
|
|
@@ -648716,8 +648709,8 @@ function syncTree(srcDir, destDir, labelBase, opts, report) {
|
|
|
648716
648709
|
return;
|
|
648717
648710
|
}
|
|
648718
648711
|
for (const name of readdirSync12(srcDir)) {
|
|
648719
|
-
const srcChild =
|
|
648720
|
-
const destChild =
|
|
648712
|
+
const srcChild = join193(srcDir, name);
|
|
648713
|
+
const destChild = join193(destDir, name);
|
|
648721
648714
|
let childStat;
|
|
648722
648715
|
try {
|
|
648723
648716
|
childStat = statSync15(srcChild);
|
|
@@ -648756,12 +648749,12 @@ function syncRoot(srcRoot, destRoot, manifest, scopeLabel, opts, report) {
|
|
|
648756
648749
|
return;
|
|
648757
648750
|
}
|
|
648758
648751
|
for (const dir of manifest.dirs) {
|
|
648759
|
-
syncTree(
|
|
648752
|
+
syncTree(join193(srcRoot, dir), join193(destRoot, dir), dir, opts, report);
|
|
648760
648753
|
}
|
|
648761
648754
|
for (const file2 of manifest.plainFiles) {
|
|
648762
648755
|
syncPlainFile(
|
|
648763
|
-
|
|
648764
|
-
|
|
648756
|
+
join193(srcRoot, file2),
|
|
648757
|
+
join193(destRoot, file2),
|
|
648765
648758
|
file2,
|
|
648766
648759
|
opts,
|
|
648767
648760
|
report
|
|
@@ -648769,8 +648762,8 @@ function syncRoot(srcRoot, destRoot, manifest, scopeLabel, opts, report) {
|
|
|
648769
648762
|
}
|
|
648770
648763
|
for (const file2 of manifest.jsonFiles) {
|
|
648771
648764
|
syncJsonFile(
|
|
648772
|
-
|
|
648773
|
-
|
|
648765
|
+
join193(srcRoot, file2),
|
|
648766
|
+
join193(destRoot, file2),
|
|
648774
648767
|
file2,
|
|
648775
648768
|
opts,
|
|
648776
648769
|
report
|
|
@@ -648804,7 +648797,7 @@ async function configSyncHandler(opts) {
|
|
|
648804
648797
|
const dryTag = opts.dryRun ? source_default.yellow(" [dry-run]") : "";
|
|
648805
648798
|
process.stdout.write(source_default.bold(`sema config sync${dryTag}
|
|
648806
648799
|
`));
|
|
648807
|
-
const userSrc =
|
|
648800
|
+
const userSrc = join193(homedir50(), LEGACY_DIR3);
|
|
648808
648801
|
const userDest = getClaudeConfigHomeDir();
|
|
648809
648802
|
process.stdout.write(
|
|
648810
648803
|
source_default.bold(`
|
|
@@ -648824,15 +648817,15 @@ user: ${display(userSrc)} \u2192 ${display(userDest)}
|
|
|
648824
648817
|
opts,
|
|
648825
648818
|
report
|
|
648826
648819
|
);
|
|
648827
|
-
const globalSrc =
|
|
648820
|
+
const globalSrc = join193(homedir50(), LEGACY_GLOBAL_FILE);
|
|
648828
648821
|
const globalDest = getGlobalClaudeFile();
|
|
648829
648822
|
if (existsSync30(globalSrc) && globalSrc !== globalDest) {
|
|
648830
648823
|
syncJsonFile(globalSrc, globalDest, display(globalDest), opts, report);
|
|
648831
648824
|
}
|
|
648832
648825
|
flushEntries(report, userStart, opts);
|
|
648833
648826
|
if (opts.project) {
|
|
648834
|
-
const projSrc =
|
|
648835
|
-
const projDest =
|
|
648827
|
+
const projSrc = join193(process.cwd(), LEGACY_DIR3);
|
|
648828
|
+
const projDest = join193(process.cwd(), ".sema");
|
|
648836
648829
|
process.stdout.write(
|
|
648837
648830
|
source_default.bold(
|
|
648838
648831
|
`
|
|
@@ -648938,9 +648931,9 @@ __export(importCredentials_exports, {
|
|
|
648938
648931
|
importCredentialsHandler: () => importCredentialsHandler
|
|
648939
648932
|
});
|
|
648940
648933
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
648941
|
-
import { readFileSync as
|
|
648934
|
+
import { readFileSync as readFileSync44 } from "node:fs";
|
|
648942
648935
|
import { homedir as homedir51, userInfo as userInfo4 } from "node:os";
|
|
648943
|
-
import { join as
|
|
648936
|
+
import { join as join194 } from "node:path";
|
|
648944
648937
|
function readCcKeychain() {
|
|
648945
648938
|
if (process.platform !== "darwin") return null;
|
|
648946
648939
|
try {
|
|
@@ -648956,13 +648949,13 @@ function readCcKeychain() {
|
|
|
648956
648949
|
}
|
|
648957
648950
|
function readCcFile(ccRoot) {
|
|
648958
648951
|
try {
|
|
648959
|
-
return JSON.parse(
|
|
648952
|
+
return JSON.parse(readFileSync44(join194(ccRoot, ".credentials.json"), "utf-8"));
|
|
648960
648953
|
} catch {
|
|
648961
648954
|
return null;
|
|
648962
648955
|
}
|
|
648963
648956
|
}
|
|
648964
648957
|
async function importCredentialsHandler(opts) {
|
|
648965
|
-
const ccRoot = opts.from ??
|
|
648958
|
+
const ccRoot = opts.from ?? join194(homedir51(), LEGACY_DIR4);
|
|
648966
648959
|
const fromKeychain = readCcKeychain();
|
|
648967
648960
|
const fromFile = readCcFile(ccRoot);
|
|
648968
648961
|
if (!fromKeychain && !fromFile) {
|
|
@@ -649038,9 +649031,9 @@ var init_importCredentials = __esm({
|
|
|
649038
649031
|
});
|
|
649039
649032
|
|
|
649040
649033
|
// build-src/src/sema/config/mcpChannels.ts
|
|
649041
|
-
import { readFileSync as
|
|
649034
|
+
import { readFileSync as readFileSync45 } from "node:fs";
|
|
649042
649035
|
import { homedir as homedir52 } from "node:os";
|
|
649043
|
-
import { join as
|
|
649036
|
+
import { join as join195 } from "node:path";
|
|
649044
649037
|
function mcpTransportOf(config4) {
|
|
649045
649038
|
const c2 = config4;
|
|
649046
649039
|
if (c2?.type) return c2.type;
|
|
@@ -649070,7 +649063,7 @@ function userScopeMcpNames() {
|
|
|
649070
649063
|
}
|
|
649071
649064
|
function readJsoncSafe(path27) {
|
|
649072
649065
|
try {
|
|
649073
|
-
const raw2 = parse5(
|
|
649066
|
+
const raw2 = parse5(readFileSync45(path27, "utf-8"), [], { allowTrailingComma: true });
|
|
649074
649067
|
return raw2 && typeof raw2 === "object" ? raw2 : null;
|
|
649075
649068
|
} catch {
|
|
649076
649069
|
return null;
|
|
@@ -649094,14 +649087,14 @@ function externalEntryToConfig(e) {
|
|
|
649094
649087
|
}
|
|
649095
649088
|
function detectMcpChannels() {
|
|
649096
649089
|
const out6 = [];
|
|
649097
|
-
const ccRoot = process.env.SEMA_CC_ROOT ||
|
|
649090
|
+
const ccRoot = process.env.SEMA_CC_ROOT || join195(homedir52(), CC_DIR4);
|
|
649098
649091
|
const merged = {};
|
|
649099
|
-
const settings2 = readJsoncSafe(
|
|
649092
|
+
const settings2 = readJsoncSafe(join195(ccRoot, "settings.json"));
|
|
649100
649093
|
const settingsServers = settings2?.mcpServers;
|
|
649101
649094
|
if (settingsServers && typeof settingsServers === "object") {
|
|
649102
649095
|
Object.assign(merged, settingsServers);
|
|
649103
649096
|
}
|
|
649104
|
-
const globalDoc = readJsoncSafe(
|
|
649097
|
+
const globalDoc = readJsoncSafe(join195(homedir52(), CC_GLOBAL_FILE2));
|
|
649105
649098
|
const globalServers = globalDoc?.mcpServers;
|
|
649106
649099
|
if (globalServers && typeof globalServers === "object") {
|
|
649107
649100
|
Object.assign(merged, globalServers);
|
|
@@ -649536,17 +649529,17 @@ var init_navStack = __esm({
|
|
|
649536
649529
|
});
|
|
649537
649530
|
|
|
649538
649531
|
// build-src/src/sema/config/skillsChannels.ts
|
|
649539
|
-
import { existsSync as existsSync31, mkdirSync as mkdirSync22, readdirSync as readdirSync13, readFileSync as
|
|
649540
|
-
import { basename as basename68, dirname as dirname86, join as
|
|
649532
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync22, readdirSync as readdirSync13, readFileSync as readFileSync46, realpathSync as realpathSync11, renameSync as renameSync9, statSync as statSync16 } from "node:fs";
|
|
649533
|
+
import { basename as basename68, dirname as dirname86, join as join196 } from "node:path";
|
|
649541
649534
|
function skillsDirFor(source) {
|
|
649542
|
-
return source === "user" ?
|
|
649535
|
+
return source === "user" ? join196(getClaudeConfigHomeDir(), "skills") : join196(getCwd(), ".sema", "skills");
|
|
649543
649536
|
}
|
|
649544
649537
|
function readSkillMeta(mdPath, name) {
|
|
649545
649538
|
let description;
|
|
649546
649539
|
let whenToUse;
|
|
649547
649540
|
let mtimeMs;
|
|
649548
649541
|
try {
|
|
649549
|
-
const { frontmatter: frontmatter2 } = parseFrontmatter(
|
|
649542
|
+
const { frontmatter: frontmatter2 } = parseFrontmatter(readFileSync46(mdPath, "utf-8"));
|
|
649550
649543
|
if (typeof frontmatter2.description === "string") description = frontmatter2.description;
|
|
649551
649544
|
if (typeof frontmatter2.when_to_use === "string") whenToUse = frontmatter2.when_to_use;
|
|
649552
649545
|
} catch {
|
|
@@ -649598,10 +649591,10 @@ function listInstalledSkills() {
|
|
|
649598
649591
|
continue;
|
|
649599
649592
|
}
|
|
649600
649593
|
for (const entry of entries.sort()) {
|
|
649601
|
-
const p =
|
|
649594
|
+
const p = join196(dir, entry);
|
|
649602
649595
|
try {
|
|
649603
649596
|
if (statSync16(p).isDirectory()) {
|
|
649604
|
-
const md3 =
|
|
649597
|
+
const md3 = join196(p, "SKILL.md");
|
|
649605
649598
|
out6.push({ name: entry, source, root: p, ...readSkillMeta(md3, entry) });
|
|
649606
649599
|
} else if (entry.endsWith(".md")) {
|
|
649607
649600
|
const name = entry.replace(/\.md$/, "");
|
|
@@ -649617,12 +649610,12 @@ function listInstalledSkills() {
|
|
|
649617
649610
|
function removeSkillWithBackup(skill) {
|
|
649618
649611
|
try {
|
|
649619
649612
|
const skillsDir = dirname86(skill.root);
|
|
649620
|
-
const removedDir =
|
|
649613
|
+
const removedDir = join196(
|
|
649621
649614
|
dirname86(skillsDir),
|
|
649622
649615
|
`skills-removed-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}`
|
|
649623
649616
|
);
|
|
649624
649617
|
mkdirSync22(removedDir, { recursive: true });
|
|
649625
|
-
let target =
|
|
649618
|
+
let target = join196(removedDir, basename68(skill.root));
|
|
649626
649619
|
if (existsSync31(target)) target = `${target}-${Date.now()}`;
|
|
649627
649620
|
renameSync9(skill.root, target);
|
|
649628
649621
|
const nameStillPresent = listInstalledSkills().some((s) => s.name === skill.name);
|
|
@@ -649695,12 +649688,12 @@ var init_skillsChannels = __esm({
|
|
|
649695
649688
|
});
|
|
649696
649689
|
|
|
649697
649690
|
// build-src/src/sema/config/EngineScreen.tsx
|
|
649698
|
-
import { readFileSync as
|
|
649699
|
-
import { join as
|
|
649691
|
+
import { readFileSync as readFileSync47 } from "node:fs";
|
|
649692
|
+
import { join as join197 } from "node:path";
|
|
649700
649693
|
function settingsEnv3() {
|
|
649701
649694
|
try {
|
|
649702
649695
|
const sj = JSON.parse(
|
|
649703
|
-
|
|
649696
|
+
readFileSync47(join197(getClaudeConfigHomeDir(), "settings.json"), "utf8")
|
|
649704
649697
|
);
|
|
649705
649698
|
const out6 = {};
|
|
649706
649699
|
if (sj?.env) {
|
|
@@ -650482,9 +650475,9 @@ var init_SkillsHub = __esm({
|
|
|
650482
650475
|
});
|
|
650483
650476
|
|
|
650484
650477
|
// build-src/src/sema/config/PluginsHub.tsx
|
|
650485
|
-
import { readFileSync as
|
|
650478
|
+
import { readFileSync as readFileSync48 } from "node:fs";
|
|
650486
650479
|
import { homedir as homedir53 } from "node:os";
|
|
650487
|
-
import { join as
|
|
650480
|
+
import { join as join198 } from "node:path";
|
|
650488
650481
|
function listInstalledPluginRows() {
|
|
650489
650482
|
let plugins = {};
|
|
650490
650483
|
try {
|
|
@@ -650510,16 +650503,16 @@ function listInstalledPluginRows() {
|
|
|
650510
650503
|
}
|
|
650511
650504
|
function readJsonSafe(path27) {
|
|
650512
650505
|
try {
|
|
650513
|
-
const raw2 = JSON.parse(
|
|
650506
|
+
const raw2 = JSON.parse(readFileSync48(path27, "utf-8"));
|
|
650514
650507
|
return raw2 && typeof raw2 === "object" ? raw2 : null;
|
|
650515
650508
|
} catch {
|
|
650516
650509
|
return null;
|
|
650517
650510
|
}
|
|
650518
650511
|
}
|
|
650519
650512
|
function detectCcPlugins() {
|
|
650520
|
-
const ccRoot = process.env.SEMA_CC_ROOT ||
|
|
650513
|
+
const ccRoot = process.env.SEMA_CC_ROOT || join198(homedir53(), CC_DIR5);
|
|
650521
650514
|
const byId = /* @__PURE__ */ new Map();
|
|
650522
|
-
const installedDoc = readJsonSafe(
|
|
650515
|
+
const installedDoc = readJsonSafe(join198(ccRoot, "plugins", "installed_plugins.json"));
|
|
650523
650516
|
const pluginsField = installedDoc?.plugins;
|
|
650524
650517
|
if (pluginsField && typeof pluginsField === "object") {
|
|
650525
650518
|
for (const [id, v2] of Object.entries(pluginsField)) {
|
|
@@ -650527,7 +650520,7 @@ function detectCcPlugins() {
|
|
|
650527
650520
|
byId.set(id, { id, version: entry?.version });
|
|
650528
650521
|
}
|
|
650529
650522
|
}
|
|
650530
|
-
const settings2 = readJsonSafe(
|
|
650523
|
+
const settings2 = readJsonSafe(join198(ccRoot, "settings.json"));
|
|
650531
650524
|
const enabled = settings2?.enabledPlugins;
|
|
650532
650525
|
if (enabled && typeof enabled === "object") {
|
|
650533
650526
|
for (const [id, on] of Object.entries(enabled)) {
|
|
@@ -650535,7 +650528,7 @@ function detectCcPlugins() {
|
|
|
650535
650528
|
byId.set(id, { ...cur, enabledInCc: on !== false });
|
|
650536
650529
|
}
|
|
650537
650530
|
}
|
|
650538
|
-
const mkts = readJsonSafe(
|
|
650531
|
+
const mkts = readJsonSafe(join198(ccRoot, "plugins", "known_marketplaces.json"));
|
|
650539
650532
|
const marketplaces = mkts ? Object.keys(mkts) : [];
|
|
650540
650533
|
return { plugins: [...byId.values()].sort((a, b3) => a.id.localeCompare(b3.id)), marketplaces };
|
|
650541
650534
|
}
|
|
@@ -652945,7 +652938,7 @@ __export(main_exports, {
|
|
|
652945
652938
|
main: () => main,
|
|
652946
652939
|
startDeferredPrefetches: () => startDeferredPrefetches
|
|
652947
652940
|
});
|
|
652948
|
-
import { readFileSync as
|
|
652941
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
652949
652942
|
import { resolve as resolve51 } from "path";
|
|
652950
652943
|
function logManagedSettings() {
|
|
652951
652944
|
try {
|
|
@@ -653112,7 +653105,7 @@ function loadSettingsFromFlag(settingsFile) {
|
|
|
653112
653105
|
resolvedPath: resolvedSettingsPath
|
|
653113
653106
|
} = safeResolvePath(getFsImplementation(), settingsFile);
|
|
653114
653107
|
try {
|
|
653115
|
-
|
|
653108
|
+
readFileSync49(resolvedSettingsPath, "utf8");
|
|
653116
653109
|
} catch (e) {
|
|
653117
653110
|
if (isENOENT(e)) {
|
|
653118
653111
|
process.stderr.write(source_default.red(`Error: Settings file not found: ${resolvedSettingsPath}
|
|
@@ -653689,7 +653682,7 @@ ${getTmuxInstallInstructions2()}
|
|
|
653689
653682
|
}
|
|
653690
653683
|
try {
|
|
653691
653684
|
const filePath = resolve51(options.systemPromptFile);
|
|
653692
|
-
systemPrompt =
|
|
653685
|
+
systemPrompt = readFileSync49(filePath, "utf8");
|
|
653693
653686
|
} catch (error51) {
|
|
653694
653687
|
const code2 = getErrnoCode(error51);
|
|
653695
653688
|
if (code2 === "ENOENT") {
|
|
@@ -653710,7 +653703,7 @@ ${getTmuxInstallInstructions2()}
|
|
|
653710
653703
|
}
|
|
653711
653704
|
try {
|
|
653712
653705
|
const filePath = resolve51(options.appendSystemPromptFile);
|
|
653713
|
-
appendSystemPrompt =
|
|
653706
|
+
appendSystemPrompt = readFileSync49(filePath, "utf8");
|
|
653714
653707
|
} catch (error51) {
|
|
653715
653708
|
const code2 = getErrnoCode(error51);
|
|
653716
653709
|
if (code2 === "ENOENT") {
|
|
@@ -655597,7 +655590,7 @@ Auth: unix socket -R \u2192 local proxy`, "info");
|
|
|
655597
655590
|
pendingHookMessages
|
|
655598
655591
|
}, renderAndRun);
|
|
655599
655592
|
}
|
|
655600
|
-
}).version("sema 1.0.
|
|
655593
|
+
}).version("sema 1.0.43", "-v, --version", "Output the version number");
|
|
655601
655594
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
655602
655595
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
655603
655596
|
if (canUserConfigureAdvisor()) {
|
|
@@ -659101,14 +659094,14 @@ __export(claudeImportHint_exports, {
|
|
|
659101
659094
|
});
|
|
659102
659095
|
import { existsSync as existsSync32 } from "node:fs";
|
|
659103
659096
|
import { homedir as homedir55 } from "node:os";
|
|
659104
|
-
import { join as
|
|
659097
|
+
import { join as join199 } from "node:path";
|
|
659105
659098
|
function shouldShowClaudeImportHint() {
|
|
659106
659099
|
try {
|
|
659107
659100
|
const claudeEnvKey = "CLAUDE_CONFIG_DIR";
|
|
659108
659101
|
if (process.env.SEMA_CONFIG_DIR || process.env[claudeEnvKey]) return false;
|
|
659109
|
-
const legacyDir =
|
|
659102
|
+
const legacyDir = join199(homedir55(), ".claude");
|
|
659110
659103
|
if (!existsSync32(legacyDir)) return false;
|
|
659111
|
-
if (existsSync32(
|
|
659104
|
+
if (existsSync32(join199(homedir55(), ".sema"))) return false;
|
|
659112
659105
|
if (getGlobalConfig().hasSeenClaudeImportHint) return false;
|
|
659113
659106
|
return true;
|
|
659114
659107
|
} catch {
|
|
@@ -659144,15 +659137,15 @@ var semaSettingsSeed_exports = {};
|
|
|
659144
659137
|
__export(semaSettingsSeed_exports, {
|
|
659145
659138
|
seedSemaSettings: () => seedSemaSettings
|
|
659146
659139
|
});
|
|
659147
|
-
import { existsSync as existsSync33, mkdirSync as mkdirSync23, readFileSync as
|
|
659148
|
-
import { dirname as dirname87, join as
|
|
659140
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync23, readFileSync as readFileSync50, writeFileSync as writeFileSync21 } from "node:fs";
|
|
659141
|
+
import { dirname as dirname87, join as join200 } from "node:path";
|
|
659149
659142
|
function seedSemaSettings() {
|
|
659150
|
-
const file2 =
|
|
659143
|
+
const file2 = join200(getClaudeConfigHomeDir(), "settings.json");
|
|
659151
659144
|
let current3 = {};
|
|
659152
659145
|
let parsedOk = false;
|
|
659153
659146
|
try {
|
|
659154
659147
|
if (existsSync33(file2)) {
|
|
659155
|
-
const parsed = JSON.parse(
|
|
659148
|
+
const parsed = JSON.parse(readFileSync50(file2, "utf8"));
|
|
659156
659149
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
659157
659150
|
current3 = parsed;
|
|
659158
659151
|
parsedOk = true;
|
|
@@ -659461,12 +659454,12 @@ var init_local_load = __esm({
|
|
|
659461
659454
|
});
|
|
659462
659455
|
|
|
659463
659456
|
// node_modules/@sema-agent/registry-core/dist/scheduler-store-node.js
|
|
659464
|
-
import { mkdirSync as mkdirSync24, readFileSync as
|
|
659457
|
+
import { mkdirSync as mkdirSync24, readFileSync as readFileSync51, writeFileSync as writeFileSync22, renameSync as renameSync10 } from "node:fs";
|
|
659465
659458
|
import { dirname as dirname88 } from "node:path";
|
|
659466
659459
|
import { randomBytes as randomBytes25, createHash as createHash27 } from "node:crypto";
|
|
659467
659460
|
function loadSchedulerStore(path27) {
|
|
659468
659461
|
try {
|
|
659469
|
-
return parseSchedulerStore(
|
|
659462
|
+
return parseSchedulerStore(readFileSync51(path27, "utf-8"));
|
|
659470
659463
|
} catch {
|
|
659471
659464
|
return [];
|
|
659472
659465
|
}
|
|
@@ -659481,7 +659474,7 @@ function mutateSchedulerStore(path27, fn2, opts) {
|
|
|
659481
659474
|
const maxRetries = Math.max(0, opts?.retries ?? 5);
|
|
659482
659475
|
const rawOf = () => {
|
|
659483
659476
|
try {
|
|
659484
|
-
return
|
|
659477
|
+
return readFileSync51(path27, "utf-8");
|
|
659485
659478
|
} catch {
|
|
659486
659479
|
return null;
|
|
659487
659480
|
}
|
|
@@ -659545,10 +659538,10 @@ var init_firePrompt = __esm({
|
|
|
659545
659538
|
});
|
|
659546
659539
|
|
|
659547
659540
|
// build-src/src/sema/scheduler/schedulerDaemonWire.ts
|
|
659548
|
-
import { join as
|
|
659541
|
+
import { join as join201 } from "node:path";
|
|
659549
659542
|
import { homedir as homedir56 } from "node:os";
|
|
659550
659543
|
function schedulerStorePath() {
|
|
659551
|
-
return
|
|
659544
|
+
return join201(process.env.SEMA_CONFIG_DIR ?? join201(homedir56(), ".sema"), "scheduled_tasks.json");
|
|
659552
659545
|
}
|
|
659553
659546
|
function fileSchedulerStoreIO(storePath) {
|
|
659554
659547
|
return {
|
|
@@ -659567,8 +659560,8 @@ var init_schedulerDaemonWire = __esm({
|
|
|
659567
659560
|
});
|
|
659568
659561
|
|
|
659569
659562
|
// build-src/src/sema/scheduler/sessionReap.ts
|
|
659570
|
-
import { mkdirSync as mkdirSync25, readdirSync as readdirSync14, readFileSync as
|
|
659571
|
-
import { dirname as dirname89, join as
|
|
659563
|
+
import { mkdirSync as mkdirSync25, readdirSync as readdirSync14, readFileSync as readFileSync52, unlinkSync as unlinkSync9, writeFileSync as writeFileSync23 } from "node:fs";
|
|
659564
|
+
import { dirname as dirname89, join as join202 } from "node:path";
|
|
659572
659565
|
function isSessionLifetimeRecord(r) {
|
|
659573
659566
|
return r.lifetime === "session";
|
|
659574
659567
|
}
|
|
@@ -659599,7 +659592,7 @@ function reapSessionRecords(io, departedSessionIds) {
|
|
|
659599
659592
|
return reaped.map((r) => r.id);
|
|
659600
659593
|
}
|
|
659601
659594
|
function schedulerClaimsDir(storePath) {
|
|
659602
|
-
return
|
|
659595
|
+
return join202(dirname89(storePath), "scheduler-claims");
|
|
659603
659596
|
}
|
|
659604
659597
|
function pidAlive3(pid) {
|
|
659605
659598
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
@@ -659612,10 +659605,10 @@ function pidAlive3(pid) {
|
|
|
659612
659605
|
}
|
|
659613
659606
|
function writeSchedulerClaim(storePath, sessionIds, pid = process.pid) {
|
|
659614
659607
|
const dir = schedulerClaimsDir(storePath);
|
|
659615
|
-
const file2 =
|
|
659608
|
+
const file2 = join202(dir, `${pid}.json`);
|
|
659616
659609
|
const ids = [...new Set(sessionIds.filter((id) => typeof id === "string" && id.length > 0))].sort();
|
|
659617
659610
|
try {
|
|
659618
|
-
const prev = JSON.parse(
|
|
659611
|
+
const prev = JSON.parse(readFileSync52(file2, "utf8"));
|
|
659619
659612
|
if (Array.isArray(prev.sessionIds) && prev.sessionIds.join("\n") === ids.join("\n")) return;
|
|
659620
659613
|
} catch {
|
|
659621
659614
|
}
|
|
@@ -659624,7 +659617,7 @@ function writeSchedulerClaim(storePath, sessionIds, pid = process.pid) {
|
|
|
659624
659617
|
}
|
|
659625
659618
|
function removeSchedulerClaim(storePath, pid = process.pid) {
|
|
659626
659619
|
try {
|
|
659627
|
-
unlinkSync9(
|
|
659620
|
+
unlinkSync9(join202(schedulerClaimsDir(storePath), `${pid}.json`));
|
|
659628
659621
|
} catch {
|
|
659629
659622
|
}
|
|
659630
659623
|
}
|
|
@@ -659644,7 +659637,7 @@ function readAliveClaimedSessionIds(storePath, opts = {}) {
|
|
|
659644
659637
|
if (!alive(pid)) {
|
|
659645
659638
|
if (opts.cleanupDead) {
|
|
659646
659639
|
try {
|
|
659647
|
-
unlinkSync9(
|
|
659640
|
+
unlinkSync9(join202(dir, f));
|
|
659648
659641
|
} catch {
|
|
659649
659642
|
}
|
|
659650
659643
|
}
|
|
@@ -659652,7 +659645,7 @@ function readAliveClaimedSessionIds(storePath, opts = {}) {
|
|
|
659652
659645
|
}
|
|
659653
659646
|
if (pid === opts.excludePid) continue;
|
|
659654
659647
|
try {
|
|
659655
|
-
const c2 = JSON.parse(
|
|
659648
|
+
const c2 = JSON.parse(readFileSync52(join202(dir, f), "utf8"));
|
|
659656
659649
|
if (Array.isArray(c2.sessionIds)) {
|
|
659657
659650
|
for (const id of c2.sessionIds) if (typeof id === "string" && id.length > 0) out6.add(id);
|
|
659658
659651
|
}
|
|
@@ -659980,7 +659973,7 @@ __export(loginState_exports, {
|
|
|
659980
659973
|
seedMockLoginState: () => seedMockLoginState,
|
|
659981
659974
|
seedProjectOnboardingState: () => seedProjectOnboardingState
|
|
659982
659975
|
});
|
|
659983
|
-
import { join as
|
|
659976
|
+
import { join as join203 } from "path";
|
|
659984
659977
|
import { mkdir as mkdir50, writeFile as writeFile53 } from "fs/promises";
|
|
659985
659978
|
function osDisplayName() {
|
|
659986
659979
|
try {
|
|
@@ -660049,8 +660042,8 @@ async function seedMockLoginState() {
|
|
|
660049
660042
|
}
|
|
660050
660043
|
try {
|
|
660051
660044
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
|
|
660052
|
-
const cachePath =
|
|
660053
|
-
await mkdir50(
|
|
660045
|
+
const cachePath = join203(getClaudeConfigHomeDir3(), "cache", "changelog.md");
|
|
660046
|
+
await mkdir50(join203(getClaudeConfigHomeDir3(), "cache"), { recursive: true });
|
|
660054
660047
|
await writeFile53(cachePath, buildChangelogMarkdown(BRAND3.whatsNew), { encoding: "utf-8" });
|
|
660055
660048
|
const { getStoredChangelog: getStoredChangelog2, _resetChangelogCacheForTesting: _resetChangelogCacheForTesting2 } = await Promise.resolve().then(() => (init_releaseNotes(), releaseNotes_exports));
|
|
660056
660049
|
_resetChangelogCacheForTesting2();
|
|
@@ -660903,7 +660896,7 @@ __export(agentsHotReload_exports, {
|
|
|
660903
660896
|
stopAgentsHotReload: () => stopAgentsHotReload
|
|
660904
660897
|
});
|
|
660905
660898
|
import { watch as watch3, existsSync as existsSync35 } from "node:fs";
|
|
660906
|
-
import { join as
|
|
660899
|
+
import { join as join204 } from "node:path";
|
|
660907
660900
|
async function reloadAgentDefinitions(cwd5) {
|
|
660908
660901
|
try {
|
|
660909
660902
|
const { clearAgentDefinitionsCache: clearAgentDefinitionsCache2, getAgentDefinitionsWithOverrides: getAgentDefinitionsWithOverrides2 } = await Promise.resolve().then(() => (init_loadAgentsDir(), loadAgentsDir_exports));
|
|
@@ -660940,7 +660933,7 @@ async function startAgentsHotReload(cwd5) {
|
|
|
660940
660933
|
}
|
|
660941
660934
|
try {
|
|
660942
660935
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
|
|
660943
|
-
const userDir =
|
|
660936
|
+
const userDir = join204(getClaudeConfigHomeDir3(), "agents");
|
|
660944
660937
|
if (existsSync35(userDir)) dirs.add(userDir);
|
|
660945
660938
|
} catch (e) {
|
|
660946
660939
|
if (process.env.SEMA_DEBUG) console.error("[sema] agents hot-reload user-dir scan soft-failed:", e);
|
|
@@ -661018,7 +661011,7 @@ __export(mcpFill_exports, {
|
|
|
661018
661011
|
loadCanonicalMcpClients: () => loadCanonicalMcpClients
|
|
661019
661012
|
});
|
|
661020
661013
|
import { homedir as homedir57 } from "os";
|
|
661021
|
-
import { readFileSync as
|
|
661014
|
+
import { readFileSync as readFileSync53 } from "fs";
|
|
661022
661015
|
function builtinDynamicConfig(command8) {
|
|
661023
661016
|
return { type: "stdio", command: command8, args: [], scope: "dynamic" };
|
|
661024
661017
|
}
|
|
@@ -661035,7 +661028,7 @@ function canonicalGlobalConfigFile() {
|
|
|
661035
661028
|
}
|
|
661036
661029
|
async function loadCanonicalMcpClients() {
|
|
661037
661030
|
try {
|
|
661038
|
-
const raw2 =
|
|
661031
|
+
const raw2 = readFileSync53(canonicalGlobalConfigFile(), "utf8");
|
|
661039
661032
|
const parsed = JSON.parse(raw2);
|
|
661040
661033
|
const mcpServers = parsed?.mcpServers;
|
|
661041
661034
|
if (!mcpServers || typeof mcpServers !== "object" || Object.keys(mcpServers).length === 0) {
|
|
@@ -661305,14 +661298,14 @@ var synthApprovalProbe_exports = {};
|
|
|
661305
661298
|
__export(synthApprovalProbe_exports, {
|
|
661306
661299
|
armSynthToolApprovalProbe: () => armSynthToolApprovalProbe
|
|
661307
661300
|
});
|
|
661308
|
-
import { writeFileSync as writeFileSync24, readFileSync as
|
|
661301
|
+
import { writeFileSync as writeFileSync24, readFileSync as readFileSync54 } from "node:fs";
|
|
661309
661302
|
function armSynthToolApprovalProbe() {
|
|
661310
661303
|
const specPath = process.env.SEMA_SYNTH_TOOL_APPROVAL;
|
|
661311
661304
|
if (!specPath) return;
|
|
661312
661305
|
const outPath = process.env.SEMA_SYNTH_TOOL_APPROVAL_OUT || `${specPath}.out.json`;
|
|
661313
661306
|
let spec;
|
|
661314
661307
|
try {
|
|
661315
|
-
spec = JSON.parse(
|
|
661308
|
+
spec = JSON.parse(readFileSync54(specPath, "utf8"));
|
|
661316
661309
|
} catch (e) {
|
|
661317
661310
|
logForDebugging(`synthApprovalProbe: spec unreadable (${String(e)}) \u2014 probe disarmed`);
|
|
661318
661311
|
return;
|
|
@@ -661383,7 +661376,7 @@ __export(workerScreen_exports, {
|
|
|
661383
661376
|
});
|
|
661384
661377
|
import { writeFileSync as writeFileSync25 } from "fs";
|
|
661385
661378
|
import { writeFile as writeFile54 } from "fs/promises";
|
|
661386
|
-
import { join as
|
|
661379
|
+
import { join as join205 } from "path";
|
|
661387
661380
|
function clampDims(c2, r) {
|
|
661388
661381
|
return {
|
|
661389
661382
|
c: Number.isFinite(c2) && c2 >= 20 ? Math.min(c2, 1e3) : 80,
|
|
@@ -661477,7 +661470,7 @@ function installWorkerVirtualTerminal(config4) {
|
|
|
661477
661470
|
}
|
|
661478
661471
|
const jobDir = config4.jobDir;
|
|
661479
661472
|
if (jobDir) {
|
|
661480
|
-
const screenPath =
|
|
661473
|
+
const screenPath = join205(jobDir, "screen.txt");
|
|
661481
661474
|
let lastWritten = "";
|
|
661482
661475
|
const flush = async () => {
|
|
661483
661476
|
const lines = snapshotLines();
|
|
@@ -661627,7 +661620,7 @@ import { spawn as spawn15 } from "child_process";
|
|
|
661627
661620
|
import { appendFileSync as appendFileSync7, createWriteStream as createWriteStream5 } from "fs";
|
|
661628
661621
|
import { chmod as chmod13, mkdir as mkdir51, readFile as readFile58, readdir as readdir33, rename as rename15, stat as stat54, unlink as unlink28 } from "fs/promises";
|
|
661629
661622
|
import { createConnection as createConnection4, createServer as createServer9 } from "net";
|
|
661630
|
-
import { dirname as dirname90, join as
|
|
661623
|
+
import { dirname as dirname90, join as join206 } from "path";
|
|
661631
661624
|
function probeSocketAlive(sockPath, timeoutMs = 1500) {
|
|
661632
661625
|
return (async () => {
|
|
661633
661626
|
const info = await readDaemonInfo();
|
|
@@ -661904,7 +661897,7 @@ var init_main4 = __esm({
|
|
|
661904
661897
|
});
|
|
661905
661898
|
this.logLine(`[daemon] supervisor up pid=${process.pid} origin=${this.origin}`);
|
|
661906
661899
|
await this.recoverJobs();
|
|
661907
|
-
await mkdir51(
|
|
661900
|
+
await mkdir51(join206(getDispatchDir(), "rejected"), { recursive: true, mode: 448 });
|
|
661908
661901
|
} catch (e) {
|
|
661909
661902
|
this.server?.close();
|
|
661910
661903
|
this.server = null;
|
|
@@ -662535,7 +662528,7 @@ var init_main4 = __esm({
|
|
|
662535
662528
|
return;
|
|
662536
662529
|
}
|
|
662537
662530
|
for (const f of files2) {
|
|
662538
|
-
const p =
|
|
662531
|
+
const p = join206(dir, f);
|
|
662539
662532
|
let size = 0;
|
|
662540
662533
|
try {
|
|
662541
662534
|
size = (await stat54(p)).size;
|
|
@@ -662551,7 +662544,7 @@ var init_main4 = __esm({
|
|
|
662551
662544
|
}
|
|
662552
662545
|
}
|
|
662553
662546
|
if (!payload2?.job) {
|
|
662554
|
-
await rename15(p,
|
|
662547
|
+
await rename15(p, join206(dir, "rejected", f)).catch(() => unlink28(p).catch(() => {
|
|
662555
662548
|
}));
|
|
662556
662549
|
this.logLine(`[daemon] rejected file dispatch ${f}`);
|
|
662557
662550
|
continue;
|
|
@@ -664633,12 +664626,12 @@ async function launchReplProduction() {
|
|
|
664633
664626
|
if (process.env.SEMA_QUESTION_FIXTURE) {
|
|
664634
664627
|
try {
|
|
664635
664628
|
const fixturePath = process.env.SEMA_QUESTION_FIXTURE;
|
|
664636
|
-
const { readFileSync:
|
|
664629
|
+
const { readFileSync: readFileSync55 } = await import("node:fs");
|
|
664637
664630
|
const { publishQuestionFrame: publishQuestionFrame2 } = await Promise.resolve().then(() => (init_liveQuestionStore(), liveQuestionStore_exports));
|
|
664638
664631
|
for (const delayMs of [3e3, 6e3, 9e3, 12e3, 15e3]) {
|
|
664639
664632
|
setTimeout(() => {
|
|
664640
664633
|
try {
|
|
664641
|
-
const frame = JSON.parse(
|
|
664634
|
+
const frame = JSON.parse(readFileSync55(fixturePath, "utf8"));
|
|
664642
664635
|
publishQuestionFrame2(frame);
|
|
664643
664636
|
try {
|
|
664644
664637
|
__require("node:fs").appendFileSync(`${fixturePath}.probe`, `published @${delayMs}
|