@pleri/olam-cli 0.1.207 → 0.1.209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-digests.json +8 -8
- package/dist/index.js +1821 -1307
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +304 -214
- package/hermes-bundle/version.json +1 -1
- package/host-cp/k8s/manifests/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/auth-service/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/kg-service/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/mcp-auth-service/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/memory-service/50-deployment.yaml +1 -1
- package/memory-hooks/agentmemory-classify-queue.mjs +4 -0
- package/memory-hooks/agentmemory-recall-trigger.mjs +4 -0
- package/memory-hooks/agentmemory-session-recall.js +27 -0
- package/package.json +1 -1
package/dist/mcp-server.js
CHANGED
|
@@ -10908,24 +10908,62 @@ var require_dist = __commonJS({
|
|
|
10908
10908
|
}
|
|
10909
10909
|
});
|
|
10910
10910
|
|
|
10911
|
+
// ../core/dist/paths/olam-paths.js
|
|
10912
|
+
import { homedir } from "node:os";
|
|
10913
|
+
import { join as join2 } from "node:path";
|
|
10914
|
+
function olamHome() {
|
|
10915
|
+
const fromEnv = process.env["OLAM_HOME"];
|
|
10916
|
+
if (fromEnv && fromEnv.length > 0)
|
|
10917
|
+
return fromEnv;
|
|
10918
|
+
return join2(homedir(), ".olam");
|
|
10919
|
+
}
|
|
10920
|
+
function claudeDir() {
|
|
10921
|
+
const fromEnv = process.env["OLAM_CLAUDE_DIR"];
|
|
10922
|
+
if (fromEnv && fromEnv.length > 0)
|
|
10923
|
+
return fromEnv;
|
|
10924
|
+
return join2(homedir(), ".claude");
|
|
10925
|
+
}
|
|
10926
|
+
function globalConfigPath() {
|
|
10927
|
+
const override = process.env["OLAM_GLOBAL_CONFIG_PATH"];
|
|
10928
|
+
if (override && override.length > 0)
|
|
10929
|
+
return override;
|
|
10930
|
+
return join2(olamHome(), "config.json");
|
|
10931
|
+
}
|
|
10932
|
+
function stateDir() {
|
|
10933
|
+
const override = process.env["OLAM_STATE_DIR"];
|
|
10934
|
+
if (override && override.length > 0)
|
|
10935
|
+
return override;
|
|
10936
|
+
return join2(olamHome(), "state");
|
|
10937
|
+
}
|
|
10938
|
+
function skillSourcesDir() {
|
|
10939
|
+
const override = process.env["OLAM_SKILL_SOURCES_DIR"];
|
|
10940
|
+
if (override && override.length > 0)
|
|
10941
|
+
return override;
|
|
10942
|
+
return join2(stateDir(), "skill-sources");
|
|
10943
|
+
}
|
|
10944
|
+
var init_olam_paths = __esm({
|
|
10945
|
+
"../core/dist/paths/olam-paths.js"() {
|
|
10946
|
+
"use strict";
|
|
10947
|
+
}
|
|
10948
|
+
});
|
|
10949
|
+
|
|
10911
10950
|
// ../core/dist/secrets/paths.js
|
|
10912
10951
|
import * as fs2 from "node:fs";
|
|
10913
|
-
import * as os from "node:os";
|
|
10914
10952
|
import * as path2 from "node:path";
|
|
10915
|
-
function
|
|
10916
|
-
return
|
|
10953
|
+
function olamHome2() {
|
|
10954
|
+
return olamHome();
|
|
10917
10955
|
}
|
|
10918
10956
|
function canonicalSecretPath(name) {
|
|
10919
|
-
return path2.join(
|
|
10957
|
+
return path2.join(olamHome2(), "secrets", name);
|
|
10920
10958
|
}
|
|
10921
10959
|
function ensureSecretsDir() {
|
|
10922
|
-
fs2.mkdirSync(path2.join(
|
|
10960
|
+
fs2.mkdirSync(path2.join(olamHome2(), "secrets"), { recursive: true, mode: 448 });
|
|
10923
10961
|
}
|
|
10924
10962
|
function resolveSecretPath(name) {
|
|
10925
10963
|
const newPath = canonicalSecretPath(name);
|
|
10926
10964
|
if (fs2.existsSync(newPath))
|
|
10927
10965
|
return newPath;
|
|
10928
|
-
const oldPath = path2.join(
|
|
10966
|
+
const oldPath = path2.join(olamHome2(), name);
|
|
10929
10967
|
if (fs2.existsSync(oldPath)) {
|
|
10930
10968
|
if (!_warnedNames.has(name)) {
|
|
10931
10969
|
_warnedNames.add(name);
|
|
@@ -10942,6 +10980,7 @@ var _warnedNames;
|
|
|
10942
10980
|
var init_paths = __esm({
|
|
10943
10981
|
"../core/dist/secrets/paths.js"() {
|
|
10944
10982
|
"use strict";
|
|
10983
|
+
init_olam_paths();
|
|
10945
10984
|
_warnedNames = /* @__PURE__ */ new Set();
|
|
10946
10985
|
}
|
|
10947
10986
|
});
|
|
@@ -11048,7 +11087,7 @@ var init_version2 = __esm({
|
|
|
11048
11087
|
|
|
11049
11088
|
// ../core/dist/world/repo-manifest.js
|
|
11050
11089
|
import { existsSync as existsSync5, lstatSync, readFileSync as readFileSync3 } from "node:fs";
|
|
11051
|
-
import { join as
|
|
11090
|
+
import { join as join6, resolve as resolve3, sep } from "node:path";
|
|
11052
11091
|
import YAML from "yaml";
|
|
11053
11092
|
function bootstrapStepCmd(entry) {
|
|
11054
11093
|
return typeof entry === "string" ? entry : entry.cmd;
|
|
@@ -11112,8 +11151,8 @@ function isPlainObject3(value) {
|
|
|
11112
11151
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
11113
11152
|
}
|
|
11114
11153
|
function loadRepoManifest(repoDir) {
|
|
11115
|
-
const olamPath =
|
|
11116
|
-
const adbPath =
|
|
11154
|
+
const olamPath = join6(repoDir, ".olam.yaml");
|
|
11155
|
+
const adbPath = join6(repoDir, ".adb.yaml");
|
|
11117
11156
|
let manifestPath2;
|
|
11118
11157
|
let source;
|
|
11119
11158
|
if (existsSync5(olamPath)) {
|
|
@@ -11354,13 +11393,13 @@ var init_repo_manifest = __esm({
|
|
|
11354
11393
|
});
|
|
11355
11394
|
|
|
11356
11395
|
// ../core/dist/util/path.js
|
|
11357
|
-
import * as
|
|
11396
|
+
import * as os3 from "node:os";
|
|
11358
11397
|
import * as path6 from "node:path";
|
|
11359
11398
|
function resolveTildePath(p) {
|
|
11360
11399
|
if (p === "~")
|
|
11361
|
-
return
|
|
11400
|
+
return os3.homedir();
|
|
11362
11401
|
if (p.startsWith("~/"))
|
|
11363
|
-
return path6.join(
|
|
11402
|
+
return path6.join(os3.homedir(), p.slice(2));
|
|
11364
11403
|
if (p.startsWith("~")) {
|
|
11365
11404
|
throw new Error(`[path] POSIX "~user" syntax is not supported (got "${p}"). Use "~/..." for the operator's home or an absolute path.`);
|
|
11366
11405
|
}
|
|
@@ -11376,14 +11415,14 @@ var init_path = __esm({
|
|
|
11376
11415
|
|
|
11377
11416
|
// ../core/dist/workspace/store.js
|
|
11378
11417
|
import * as fs5 from "node:fs";
|
|
11379
|
-
import * as
|
|
11418
|
+
import * as os4 from "node:os";
|
|
11380
11419
|
import * as path7 from "node:path";
|
|
11381
11420
|
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
11382
11421
|
function workspacesDir() {
|
|
11383
11422
|
const override = process.env["OLAM_WORKSPACES_DIR"];
|
|
11384
11423
|
if (override && override.length > 0)
|
|
11385
11424
|
return override;
|
|
11386
|
-
return path7.join(
|
|
11425
|
+
return path7.join(os4.homedir(), ".olam", "workspaces");
|
|
11387
11426
|
}
|
|
11388
11427
|
function validateName(name) {
|
|
11389
11428
|
if (!WORKSPACE_NAME_PATTERN.test(name)) {
|
|
@@ -11752,7 +11791,7 @@ var init_volume = __esm({
|
|
|
11752
11791
|
|
|
11753
11792
|
// ../adapters/dist/shared/anthropic-base-url.js
|
|
11754
11793
|
import * as fs6 from "node:fs";
|
|
11755
|
-
import * as
|
|
11794
|
+
import * as os5 from "node:os";
|
|
11756
11795
|
import * as path8 from "node:path";
|
|
11757
11796
|
function normalizeAnthropicBaseUrl(raw) {
|
|
11758
11797
|
if (!raw)
|
|
@@ -11780,7 +11819,7 @@ function readAnthropicBaseUrl() {
|
|
|
11780
11819
|
if (fromOlamEnv && fromOlamEnv.length > 0) {
|
|
11781
11820
|
return normalizeAnthropicBaseUrl(fromOlamEnv.trim());
|
|
11782
11821
|
}
|
|
11783
|
-
const file2 = path8.join(
|
|
11822
|
+
const file2 = path8.join(os5.homedir(), ".olam", "anthropic-base-url");
|
|
11784
11823
|
try {
|
|
11785
11824
|
const content = fs6.readFileSync(file2, "utf-8").trim();
|
|
11786
11825
|
if (content.length > 0)
|
|
@@ -12458,7 +12497,7 @@ var init_loader = __esm({
|
|
|
12458
12497
|
|
|
12459
12498
|
// ../adapters/dist/docker/container.js
|
|
12460
12499
|
import * as fs9 from "node:fs";
|
|
12461
|
-
import * as
|
|
12500
|
+
import * as os6 from "node:os";
|
|
12462
12501
|
import * as path10 from "node:path";
|
|
12463
12502
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
12464
12503
|
function readAuthSecret() {
|
|
@@ -12476,7 +12515,7 @@ function readHostCpToken() {
|
|
|
12476
12515
|
const fromEnv = process.env["OLAM_HOST_CP_TOKEN"];
|
|
12477
12516
|
if (fromEnv && fromEnv.length > 0)
|
|
12478
12517
|
return fromEnv;
|
|
12479
|
-
const file2 = path10.join(
|
|
12518
|
+
const file2 = path10.join(os6.homedir(), ".olam", "host-cp.token");
|
|
12480
12519
|
try {
|
|
12481
12520
|
return fs9.readFileSync(file2, "utf-8").trim();
|
|
12482
12521
|
} catch {
|
|
@@ -12499,9 +12538,9 @@ function isKubernetesServiceSubstrate() {
|
|
|
12499
12538
|
}
|
|
12500
12539
|
function expandHome(p) {
|
|
12501
12540
|
if (p.startsWith("~/"))
|
|
12502
|
-
return path10.join(
|
|
12541
|
+
return path10.join(os6.homedir(), p.slice(2));
|
|
12503
12542
|
if (p === "~")
|
|
12504
|
-
return
|
|
12543
|
+
return os6.homedir();
|
|
12505
12544
|
return p;
|
|
12506
12545
|
}
|
|
12507
12546
|
function readCloudMemorySecretAtPath(secretRef) {
|
|
@@ -12743,7 +12782,7 @@ var init_container = __esm({
|
|
|
12743
12782
|
...env
|
|
12744
12783
|
};
|
|
12745
12784
|
const envList = Object.entries(worldEnv).map(([k, v]) => `${k}=${v}`);
|
|
12746
|
-
const olamHomeDir = process.env["HOME"] ??
|
|
12785
|
+
const olamHomeDir = process.env["HOME"] ?? os6.homedir();
|
|
12747
12786
|
const hostWorkspacesDir = `${olamHomeDir}/.olam/workspaces`;
|
|
12748
12787
|
const binds = [
|
|
12749
12788
|
"/var/run/docker.sock:/var/run/docker.sock",
|
|
@@ -14245,19 +14284,19 @@ var init_schema4 = __esm({
|
|
|
14245
14284
|
|
|
14246
14285
|
// ../core/dist/global-config/store.js
|
|
14247
14286
|
import * as fs13 from "node:fs";
|
|
14248
|
-
import * as
|
|
14287
|
+
import * as os8 from "node:os";
|
|
14249
14288
|
import * as path16 from "node:path";
|
|
14250
|
-
function
|
|
14289
|
+
function globalConfigPath2() {
|
|
14251
14290
|
const override = process.env["OLAM_GLOBAL_CONFIG_PATH"];
|
|
14252
14291
|
if (override && override.length > 0)
|
|
14253
14292
|
return override;
|
|
14254
14293
|
if (process.env["VITEST"]) {
|
|
14255
|
-
return path16.join(
|
|
14294
|
+
return path16.join(os8.tmpdir(), `olam-vitest-global-config-${process.pid}.json`);
|
|
14256
14295
|
}
|
|
14257
|
-
return
|
|
14296
|
+
return globalConfigPath();
|
|
14258
14297
|
}
|
|
14259
14298
|
function readGlobalConfig() {
|
|
14260
|
-
const configPath =
|
|
14299
|
+
const configPath = globalConfigPath2();
|
|
14261
14300
|
if (!fs13.existsSync(configPath)) {
|
|
14262
14301
|
return { ...DEFAULT_GLOBAL_CONFIG };
|
|
14263
14302
|
}
|
|
@@ -14369,7 +14408,7 @@ function migrateSchemaVersion(parsed) {
|
|
|
14369
14408
|
return { value: { ...obj, schemaVersion: 1 }, changed: true };
|
|
14370
14409
|
}
|
|
14371
14410
|
function writeGlobalConfig(config2) {
|
|
14372
|
-
const configPath =
|
|
14411
|
+
const configPath = globalConfigPath2();
|
|
14373
14412
|
const validated = GlobalConfigSchema.parse(config2);
|
|
14374
14413
|
const dir = path16.dirname(configPath);
|
|
14375
14414
|
fs13.mkdirSync(dir, { recursive: true });
|
|
@@ -14383,6 +14422,7 @@ var init_store2 = __esm({
|
|
|
14383
14422
|
"use strict";
|
|
14384
14423
|
init_schema4();
|
|
14385
14424
|
init_schema3();
|
|
14425
|
+
init_olam_paths();
|
|
14386
14426
|
quarantineSink = (configPath, report) => {
|
|
14387
14427
|
if (report.drops.length === 0)
|
|
14388
14428
|
return;
|
|
@@ -14410,11 +14450,11 @@ var init_store2 = __esm({
|
|
|
14410
14450
|
|
|
14411
14451
|
// ../core/dist/global-config/repos.js
|
|
14412
14452
|
import * as fs14 from "node:fs";
|
|
14413
|
-
import * as
|
|
14453
|
+
import * as os9 from "node:os";
|
|
14414
14454
|
import * as path17 from "node:path";
|
|
14415
14455
|
function expandPath(p) {
|
|
14416
14456
|
if (p === "~" || p.startsWith("~/")) {
|
|
14417
|
-
return path17.join(
|
|
14457
|
+
return path17.join(os9.homedir(), p.slice(1));
|
|
14418
14458
|
}
|
|
14419
14459
|
return p;
|
|
14420
14460
|
}
|
|
@@ -14694,13 +14734,11 @@ var init_bridge = __esm({
|
|
|
14694
14734
|
// ../core/dist/skill-sources/trust-audit-log.js
|
|
14695
14735
|
import * as fs16 from "node:fs";
|
|
14696
14736
|
import * as path18 from "node:path";
|
|
14697
|
-
import * as os11 from "node:os";
|
|
14698
14737
|
function skillSourcesAuditLogPath() {
|
|
14699
14738
|
const override = process.env["OLAM_SKILL_SOURCES_AUDIT_LOG_PATH"];
|
|
14700
14739
|
if (override && override.length > 0)
|
|
14701
14740
|
return override;
|
|
14702
|
-
|
|
14703
|
-
return path18.join(stateDir, SKILL_SOURCES_AUDIT_LOG_FILENAME);
|
|
14741
|
+
return path18.join(stateDir(), SKILL_SOURCES_AUDIT_LOG_FILENAME);
|
|
14704
14742
|
}
|
|
14705
14743
|
function appendTrustAudit(entry) {
|
|
14706
14744
|
const candidate = {
|
|
@@ -14744,6 +14782,7 @@ var init_trust_audit_log = __esm({
|
|
|
14744
14782
|
"../core/dist/skill-sources/trust-audit-log.js"() {
|
|
14745
14783
|
"use strict";
|
|
14746
14784
|
init_v3();
|
|
14785
|
+
init_olam_paths();
|
|
14747
14786
|
SKILL_SOURCES_AUDIT_LOG_FILENAME = "skill-sources-audit.log";
|
|
14748
14787
|
TrustActionSchema = external_exports2.enum([
|
|
14749
14788
|
"added",
|
|
@@ -14773,13 +14812,9 @@ var init_trust_audit_log = __esm({
|
|
|
14773
14812
|
// ../core/dist/skill-sources/clone.js
|
|
14774
14813
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
14775
14814
|
import * as fs17 from "node:fs";
|
|
14776
|
-
import * as os12 from "node:os";
|
|
14777
14815
|
import * as path19 from "node:path";
|
|
14778
14816
|
function skillSourcesRootDir() {
|
|
14779
|
-
|
|
14780
|
-
if (override && override.length > 0)
|
|
14781
|
-
return override;
|
|
14782
|
-
return path19.join(os12.homedir(), ".olam", "state", "skill-sources");
|
|
14817
|
+
return skillSourcesDir();
|
|
14783
14818
|
}
|
|
14784
14819
|
function skillSourceClonePath(id) {
|
|
14785
14820
|
return path19.join(skillSourcesRootDir(), id);
|
|
@@ -14845,6 +14880,7 @@ var SkillSourceGitError;
|
|
|
14845
14880
|
var init_clone = __esm({
|
|
14846
14881
|
"../core/dist/skill-sources/clone.js"() {
|
|
14847
14882
|
"use strict";
|
|
14883
|
+
init_olam_paths();
|
|
14848
14884
|
SkillSourceGitError = class extends Error {
|
|
14849
14885
|
op;
|
|
14850
14886
|
gitUrl;
|
|
@@ -15407,10 +15443,9 @@ var init_merge_settings = __esm({
|
|
|
15407
15443
|
// ../core/dist/skill-sources/hook-install.js
|
|
15408
15444
|
import * as fs22 from "node:fs";
|
|
15409
15445
|
import * as path23 from "node:path";
|
|
15410
|
-
import * as os13 from "node:os";
|
|
15411
15446
|
function settingsPathFor(scope, cwd) {
|
|
15412
15447
|
if (scope === "user") {
|
|
15413
|
-
return path23.join(
|
|
15448
|
+
return path23.join(claudeDir(), "settings.json");
|
|
15414
15449
|
}
|
|
15415
15450
|
return path23.join(cwd ?? process.cwd(), ".claude", "settings.json");
|
|
15416
15451
|
}
|
|
@@ -15478,6 +15513,7 @@ function isSkillsHookInstalled(filePath) {
|
|
|
15478
15513
|
var init_hook_install = __esm({
|
|
15479
15514
|
"../core/dist/skill-sources/hook-install.js"() {
|
|
15480
15515
|
"use strict";
|
|
15516
|
+
init_olam_paths();
|
|
15481
15517
|
init_merge_settings();
|
|
15482
15518
|
init_hook_template();
|
|
15483
15519
|
}
|
|
@@ -15485,19 +15521,19 @@ var init_hook_install = __esm({
|
|
|
15485
15521
|
|
|
15486
15522
|
// ../core/dist/skill-sources/migration-snapshot.js
|
|
15487
15523
|
import * as fs23 from "node:fs";
|
|
15488
|
-
import * as
|
|
15524
|
+
import * as os10 from "node:os";
|
|
15489
15525
|
import * as path24 from "node:path";
|
|
15490
15526
|
function claudeDirInternal() {
|
|
15491
15527
|
const override = process.env["OLAM_CLAUDE_DIR"];
|
|
15492
15528
|
if (override && override.length > 0)
|
|
15493
15529
|
return override;
|
|
15494
|
-
return path24.join(
|
|
15530
|
+
return path24.join(os10.homedir(), ".claude");
|
|
15495
15531
|
}
|
|
15496
15532
|
function migrationSnapshotsDir() {
|
|
15497
15533
|
const override = process.env["OLAM_MIGRATION_SNAPSHOTS_DIR"];
|
|
15498
15534
|
if (override && override.length > 0)
|
|
15499
15535
|
return override;
|
|
15500
|
-
return path24.join(
|
|
15536
|
+
return path24.join(os10.homedir(), ".olam", "state", "migration-snapshots");
|
|
15501
15537
|
}
|
|
15502
15538
|
function listToolboxManagedSymlinks(toolboxPath) {
|
|
15503
15539
|
const claude = claudeDirInternal();
|
|
@@ -15870,13 +15906,13 @@ var init_shim_targets = __esm({
|
|
|
15870
15906
|
|
|
15871
15907
|
// ../core/dist/skill-sync/symlink-deployer.js
|
|
15872
15908
|
import * as fs25 from "node:fs";
|
|
15873
|
-
import * as
|
|
15909
|
+
import * as os11 from "node:os";
|
|
15874
15910
|
import * as path26 from "node:path";
|
|
15875
|
-
function
|
|
15911
|
+
function claudeDir2() {
|
|
15876
15912
|
const override = process.env["OLAM_CLAUDE_DIR"];
|
|
15877
15913
|
if (override && override.length > 0)
|
|
15878
15914
|
return override;
|
|
15879
|
-
return path26.join(
|
|
15915
|
+
return path26.join(os11.homedir(), ".claude");
|
|
15880
15916
|
}
|
|
15881
15917
|
function bucketFor(kind) {
|
|
15882
15918
|
switch (kind) {
|
|
@@ -16007,7 +16043,7 @@ function linkIfNeeded(target, link) {
|
|
|
16007
16043
|
return { created: true, shadowBackup: backup };
|
|
16008
16044
|
}
|
|
16009
16045
|
function deployArtifacts(artifacts, opts) {
|
|
16010
|
-
const claude =
|
|
16046
|
+
const claude = claudeDir2();
|
|
16011
16047
|
for (const bucket of BUCKETS) {
|
|
16012
16048
|
fs25.mkdirSync(path26.join(claude, bucket), { recursive: true });
|
|
16013
16049
|
}
|
|
@@ -16270,8 +16306,8 @@ var init_model_router = __esm({
|
|
|
16270
16306
|
|
|
16271
16307
|
// ../core/dist/meta-hooks/model-router-deploy.js
|
|
16272
16308
|
import { existsSync as existsSync32, mkdirSync as mkdirSync16, readFileSync as readFileSync23, writeFileSync as writeFileSync15 } from "node:fs";
|
|
16273
|
-
import { homedir as
|
|
16274
|
-
import { dirname as dirname13, join as
|
|
16309
|
+
import { homedir as homedir14 } from "node:os";
|
|
16310
|
+
import { dirname as dirname13, join as join30, resolve as resolve7 } from "node:path";
|
|
16275
16311
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
16276
16312
|
function resolveModelRouterSourcePath() {
|
|
16277
16313
|
const here = dirname13(fileURLToPath3(import.meta.url));
|
|
@@ -16291,8 +16327,8 @@ function resolveModelRouterSourcePath() {
|
|
|
16291
16327
|
return candidates[0];
|
|
16292
16328
|
}
|
|
16293
16329
|
function deployModelRouterScript(opts = {}) {
|
|
16294
|
-
const targetDir = opts.targetDir ??
|
|
16295
|
-
const targetPath =
|
|
16330
|
+
const targetDir = opts.targetDir ?? join30(homedir14(), ".claude", "hooks");
|
|
16331
|
+
const targetPath = join30(targetDir, MODEL_ROUTER_SCRIPT_BASENAME);
|
|
16296
16332
|
const sourcePath = opts.sourcePath ?? resolveModelRouterSourcePath();
|
|
16297
16333
|
if (!existsSync32(sourcePath)) {
|
|
16298
16334
|
return { basename: MODEL_ROUTER_SCRIPT_BASENAME, action: "source-missing", targetPath };
|
|
@@ -16331,7 +16367,7 @@ var init_meta_hooks = __esm({
|
|
|
16331
16367
|
|
|
16332
16368
|
// ../core/dist/skill-sync/settings-merger.js
|
|
16333
16369
|
import * as fs29 from "node:fs";
|
|
16334
|
-
import * as
|
|
16370
|
+
import * as os12 from "node:os";
|
|
16335
16371
|
import * as path27 from "node:path";
|
|
16336
16372
|
function claudeSettingsPath() {
|
|
16337
16373
|
const override = process.env["OLAM_CLAUDE_SETTINGS_PATH"];
|
|
@@ -16343,13 +16379,13 @@ function claudeDirInternal2() {
|
|
|
16343
16379
|
const override = process.env["OLAM_CLAUDE_DIR"];
|
|
16344
16380
|
if (override && override.length > 0)
|
|
16345
16381
|
return override;
|
|
16346
|
-
return path27.join(
|
|
16382
|
+
return path27.join(os12.homedir(), ".claude");
|
|
16347
16383
|
}
|
|
16348
16384
|
function settingsBackupDir() {
|
|
16349
16385
|
const override = process.env["OLAM_SETTINGS_BACKUP_DIR"];
|
|
16350
16386
|
if (override && override.length > 0)
|
|
16351
16387
|
return override;
|
|
16352
|
-
return path27.join(
|
|
16388
|
+
return path27.join(os12.homedir(), ".olam", "state", "settings-backups");
|
|
16353
16389
|
}
|
|
16354
16390
|
function dedupeByMatcher(entries) {
|
|
16355
16391
|
const map2 = /* @__PURE__ */ new Map();
|
|
@@ -16625,8 +16661,12 @@ var init_per_project_override = __esm({
|
|
|
16625
16661
|
|
|
16626
16662
|
// ../core/dist/lib/file-lock.js
|
|
16627
16663
|
import * as fs31 from "node:fs";
|
|
16628
|
-
import * as
|
|
16664
|
+
import * as os13 from "node:os";
|
|
16629
16665
|
import * as path29 from "node:path";
|
|
16666
|
+
function mintToken2() {
|
|
16667
|
+
tokenCounter += 1;
|
|
16668
|
+
return `${process.pid}-${tokenCounter}-${Math.random().toString(36).slice(2, 10)}`;
|
|
16669
|
+
}
|
|
16630
16670
|
function defaultIsPidAlive(pid) {
|
|
16631
16671
|
try {
|
|
16632
16672
|
process.kill(pid, 0);
|
|
@@ -16651,43 +16691,69 @@ function readLockMeta(lockPath) {
|
|
|
16651
16691
|
return void 0;
|
|
16652
16692
|
}
|
|
16653
16693
|
function isLockStale(meta3, opts) {
|
|
16654
|
-
if (meta3.hostname !==
|
|
16694
|
+
if (meta3.hostname !== os13.hostname()) {
|
|
16655
16695
|
return opts.now - meta3.timestamp > opts.staleLockMs * 2;
|
|
16656
16696
|
}
|
|
16657
16697
|
if (!opts.isPidAlive(meta3.pid))
|
|
16658
16698
|
return true;
|
|
16659
16699
|
return opts.now - meta3.timestamp > opts.staleLockMs;
|
|
16660
16700
|
}
|
|
16701
|
+
function sameAcquisition(a, b) {
|
|
16702
|
+
if (a.token !== void 0 && b.token !== void 0)
|
|
16703
|
+
return a.token === b.token;
|
|
16704
|
+
return a.pid === b.pid && a.timestamp === b.timestamp;
|
|
16705
|
+
}
|
|
16706
|
+
function createLockFile(lockPath, meta3) {
|
|
16707
|
+
const fd = fs31.openSync(lockPath, "wx", 384);
|
|
16708
|
+
try {
|
|
16709
|
+
fs31.writeSync(fd, JSON.stringify(meta3));
|
|
16710
|
+
fs31.fsyncSync(fd);
|
|
16711
|
+
} finally {
|
|
16712
|
+
fs31.closeSync(fd);
|
|
16713
|
+
}
|
|
16714
|
+
}
|
|
16661
16715
|
function tryAcquireOnce(lockPath, meta3, opts) {
|
|
16716
|
+
fs31.mkdirSync(path29.dirname(lockPath), { recursive: true });
|
|
16662
16717
|
try {
|
|
16663
|
-
|
|
16664
|
-
const fd = fs31.openSync(lockPath, "wx", 384);
|
|
16665
|
-
try {
|
|
16666
|
-
fs31.writeSync(fd, JSON.stringify(meta3));
|
|
16667
|
-
} finally {
|
|
16668
|
-
fs31.closeSync(fd);
|
|
16669
|
-
}
|
|
16718
|
+
createLockFile(lockPath, meta3);
|
|
16670
16719
|
return true;
|
|
16671
16720
|
} catch (err) {
|
|
16672
16721
|
const code = err.code;
|
|
16673
16722
|
if (code !== "EEXIST")
|
|
16674
16723
|
throw err;
|
|
16675
|
-
|
|
16676
|
-
|
|
16677
|
-
|
|
16678
|
-
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16724
|
+
}
|
|
16725
|
+
const existing = readLockMeta(lockPath);
|
|
16726
|
+
if (existing === void 0) {
|
|
16727
|
+
let mtimeMs;
|
|
16728
|
+
try {
|
|
16729
|
+
mtimeMs = fs31.statSync(lockPath).mtimeMs;
|
|
16730
|
+
} catch {
|
|
16731
|
+
mtimeMs = 0;
|
|
16682
16732
|
}
|
|
16683
|
-
|
|
16684
|
-
|
|
16685
|
-
|
|
16686
|
-
} catch {
|
|
16687
|
-
}
|
|
16688
|
-
return tryAcquireOnce(lockPath, meta3, opts);
|
|
16733
|
+
const graceMs = Math.min(2e3, opts.staleLockMs);
|
|
16734
|
+
if (mtimeMs !== 0 && opts.now - mtimeMs <= graceMs) {
|
|
16735
|
+
return false;
|
|
16689
16736
|
}
|
|
16737
|
+
} else if (!isLockStale(existing, opts)) {
|
|
16690
16738
|
return false;
|
|
16739
|
+
} else {
|
|
16740
|
+
const recheck = readLockMeta(lockPath);
|
|
16741
|
+
if (recheck !== void 0 && (!sameAcquisition(existing, recheck) || !isLockStale(recheck, opts))) {
|
|
16742
|
+
return false;
|
|
16743
|
+
}
|
|
16744
|
+
}
|
|
16745
|
+
try {
|
|
16746
|
+
fs31.unlinkSync(lockPath);
|
|
16747
|
+
} catch {
|
|
16748
|
+
}
|
|
16749
|
+
try {
|
|
16750
|
+
createLockFile(lockPath, meta3);
|
|
16751
|
+
return true;
|
|
16752
|
+
} catch (err) {
|
|
16753
|
+
const code = err.code;
|
|
16754
|
+
if (code === "EEXIST")
|
|
16755
|
+
return false;
|
|
16756
|
+
throw err;
|
|
16691
16757
|
}
|
|
16692
16758
|
}
|
|
16693
16759
|
async function acquireFileLock(lockDir, options = {}) {
|
|
@@ -16697,20 +16763,35 @@ async function acquireFileLock(lockDir, options = {}) {
|
|
|
16697
16763
|
const staleLockMs = options.staleLockMs ?? DEFAULT_STALE_LOCK_MS;
|
|
16698
16764
|
const now = options.now ?? Date.now;
|
|
16699
16765
|
const isPidAlive2 = options.isPidAlive ?? defaultIsPidAlive;
|
|
16766
|
+
const ownToken = mintToken2();
|
|
16700
16767
|
const deadline = now() + acquireTimeoutMs;
|
|
16701
16768
|
let backoffMs = 25;
|
|
16702
16769
|
while (true) {
|
|
16703
16770
|
const meta3 = {
|
|
16771
|
+
token: ownToken,
|
|
16704
16772
|
pid: process.pid,
|
|
16705
|
-
hostname:
|
|
16773
|
+
hostname: os13.hostname(),
|
|
16706
16774
|
timestamp: now(),
|
|
16707
16775
|
...options.reason ? { reason: options.reason } : {}
|
|
16708
16776
|
};
|
|
16709
16777
|
const acquired = tryAcquireOnce(lockPath, meta3, { now: now(), staleLockMs, isPidAlive: isPidAlive2 });
|
|
16710
16778
|
if (acquired) {
|
|
16779
|
+
let released = false;
|
|
16711
16780
|
return {
|
|
16712
16781
|
lockPath,
|
|
16782
|
+
// Ownership-checked release: only unlink if WE still own the file.
|
|
16783
|
+
// A holder that overran its lease and was stolen must not delete
|
|
16784
|
+
// the new holder's lock. Idempotent (safe to call twice).
|
|
16713
16785
|
release: () => {
|
|
16786
|
+
if (released)
|
|
16787
|
+
return;
|
|
16788
|
+
released = true;
|
|
16789
|
+
const current = readLockMeta(lockPath);
|
|
16790
|
+
if (current === void 0)
|
|
16791
|
+
return;
|
|
16792
|
+
const isOurs = current.token !== void 0 ? current.token === ownToken : current.pid === process.pid;
|
|
16793
|
+
if (!isOurs)
|
|
16794
|
+
return;
|
|
16714
16795
|
try {
|
|
16715
16796
|
fs31.unlinkSync(lockPath);
|
|
16716
16797
|
} catch {
|
|
@@ -16723,7 +16804,8 @@ async function acquireFileLock(lockDir, options = {}) {
|
|
|
16723
16804
|
const held = existing ? `(held by pid ${existing.pid} on ${existing.hostname}, since ${new Date(existing.timestamp).toISOString()})` : "(holder unknown)";
|
|
16724
16805
|
throw new FileLockError(`failed to acquire file lock at ${lockPath} within ${acquireTimeoutMs}ms ${held}`);
|
|
16725
16806
|
}
|
|
16726
|
-
|
|
16807
|
+
const jittered = backoffMs * (0.5 + Math.random());
|
|
16808
|
+
await sleep3(Math.min(jittered, 200));
|
|
16727
16809
|
backoffMs = Math.min(backoffMs * 2, 200);
|
|
16728
16810
|
}
|
|
16729
16811
|
}
|
|
@@ -16735,7 +16817,7 @@ async function withFileLock(lockDir, fn, options) {
|
|
|
16735
16817
|
release();
|
|
16736
16818
|
}
|
|
16737
16819
|
}
|
|
16738
|
-
var DEFAULT_LOCK_FILENAME, DEFAULT_ACQUIRE_TIMEOUT_MS, DEFAULT_STALE_LOCK_MS, FileLockError;
|
|
16820
|
+
var DEFAULT_LOCK_FILENAME, DEFAULT_ACQUIRE_TIMEOUT_MS, DEFAULT_STALE_LOCK_MS, FileLockError, tokenCounter;
|
|
16739
16821
|
var init_file_lock = __esm({
|
|
16740
16822
|
"../core/dist/lib/file-lock.js"() {
|
|
16741
16823
|
"use strict";
|
|
@@ -16748,6 +16830,7 @@ var init_file_lock = __esm({
|
|
|
16748
16830
|
this.name = "FileLockError";
|
|
16749
16831
|
}
|
|
16750
16832
|
};
|
|
16833
|
+
tokenCounter = 0;
|
|
16751
16834
|
}
|
|
16752
16835
|
});
|
|
16753
16836
|
|
|
@@ -16919,11 +17002,11 @@ var init_overlay_scan = __esm({
|
|
|
16919
17002
|
|
|
16920
17003
|
// ../core/dist/skill-sync/settings-json-lock.js
|
|
16921
17004
|
import * as fs33 from "node:fs";
|
|
16922
|
-
import * as
|
|
17005
|
+
import * as os14 from "node:os";
|
|
16923
17006
|
import * as path31 from "node:path";
|
|
16924
17007
|
function defaultSettingsJsonLockPath() {
|
|
16925
|
-
const
|
|
16926
|
-
return path31.join(
|
|
17008
|
+
const stateDir2 = process.env["OLAM_STATE_DIR"] ?? path31.join(os14.homedir(), ".olam", "state");
|
|
17009
|
+
return path31.join(stateDir2, SETTINGS_JSON_LOCK_FILENAME);
|
|
16927
17010
|
}
|
|
16928
17011
|
function defaultIsPidAlive2(pid) {
|
|
16929
17012
|
try {
|
|
@@ -16952,7 +17035,7 @@ function isLockStale2(meta3, opts) {
|
|
|
16952
17035
|
const ageMs = opts.now - meta3.timestamp;
|
|
16953
17036
|
if (ageMs < opts.staleLockMs / 2)
|
|
16954
17037
|
return false;
|
|
16955
|
-
if (meta3.hostname !==
|
|
17038
|
+
if (meta3.hostname !== os14.hostname()) {
|
|
16956
17039
|
return ageMs > opts.staleLockMs * 2;
|
|
16957
17040
|
}
|
|
16958
17041
|
if (!opts.isPidAlive(meta3.pid))
|
|
@@ -17009,7 +17092,7 @@ async function acquireSettingsJsonLock(options = {}) {
|
|
|
17009
17092
|
while (true) {
|
|
17010
17093
|
const meta3 = {
|
|
17011
17094
|
pid: process.pid,
|
|
17012
|
-
hostname:
|
|
17095
|
+
hostname: os14.hostname(),
|
|
17013
17096
|
timestamp: now(),
|
|
17014
17097
|
...options.reason ? { reason: options.reason } : {}
|
|
17015
17098
|
};
|
|
@@ -17123,13 +17206,13 @@ var init_services_status = __esm({
|
|
|
17123
17206
|
// ../core/dist/skill-sources/meta-hooks-migration-snapshot.js
|
|
17124
17207
|
import * as crypto5 from "node:crypto";
|
|
17125
17208
|
import * as fs34 from "node:fs";
|
|
17126
|
-
import * as
|
|
17209
|
+
import * as os15 from "node:os";
|
|
17127
17210
|
import * as path32 from "node:path";
|
|
17128
17211
|
function migrationSnapshotsDir2() {
|
|
17129
17212
|
const override = process.env["OLAM_MIGRATION_SNAPSHOTS_DIR"];
|
|
17130
17213
|
if (override && override.length > 0)
|
|
17131
17214
|
return override;
|
|
17132
|
-
return path32.join(
|
|
17215
|
+
return path32.join(os15.homedir(), ".olam", "state", "migration-snapshots");
|
|
17133
17216
|
}
|
|
17134
17217
|
function writeMetaHooksSnapshot(originalSettings) {
|
|
17135
17218
|
const snapshot = {
|
|
@@ -17434,7 +17517,7 @@ var init_meta_hook_injector = __esm({
|
|
|
17434
17517
|
|
|
17435
17518
|
// ../core/dist/lib/markdown-merger.js
|
|
17436
17519
|
import { createHash as createHash5 } from "node:crypto";
|
|
17437
|
-
import { readFileSync as readFileSync31, existsSync as existsSync38, statSync as
|
|
17520
|
+
import { readFileSync as readFileSync31, existsSync as existsSync38, statSync as statSync10 } from "node:fs";
|
|
17438
17521
|
function parseFrontmatter(text) {
|
|
17439
17522
|
const match = FM_RE2.exec(text);
|
|
17440
17523
|
if (match === null)
|
|
@@ -17563,7 +17646,7 @@ function mergeMarkdown(upstreamText, overlayText, labelForError, upstreamPath, o
|
|
|
17563
17646
|
return { merged: fmBlock !== "" ? fmBlock + mergedBody : mergedBody };
|
|
17564
17647
|
}
|
|
17565
17648
|
function sha256OfPath(p) {
|
|
17566
|
-
if (!existsSync38(p) || !
|
|
17649
|
+
if (!existsSync38(p) || !statSync10(p).isFile())
|
|
17567
17650
|
return "MISSING";
|
|
17568
17651
|
return createHash5("sha256").update(readFileSync31(p)).digest("hex");
|
|
17569
17652
|
}
|
|
@@ -17580,9 +17663,9 @@ var init_markdown_merger = __esm({
|
|
|
17580
17663
|
import * as fs35 from "node:fs";
|
|
17581
17664
|
import * as path33 from "node:path";
|
|
17582
17665
|
function materializeMergedSkill(opts) {
|
|
17583
|
-
const { sourceId, sourcePath, deployBasename, mergedContent, claudeDir:
|
|
17584
|
-
const managedDir = path33.join(
|
|
17585
|
-
const sourceRoot = path33.resolve(path33.join(
|
|
17666
|
+
const { sourceId, sourcePath, deployBasename, mergedContent, claudeDir: claudeDir3 } = opts;
|
|
17667
|
+
const managedDir = path33.join(claudeDir3, ".olam-merged", sourceId, deployBasename);
|
|
17668
|
+
const sourceRoot = path33.resolve(path33.join(claudeDir3, ".olam-merged", sourceId));
|
|
17586
17669
|
const managedResolved = path33.resolve(managedDir);
|
|
17587
17670
|
if (!(managedResolved === sourceRoot || managedResolved.startsWith(sourceRoot + path33.sep))) {
|
|
17588
17671
|
throw new Error(`[managed-merge] refusing to materialize: deployBasename "${deployBasename}" escapes managed root "${sourceRoot}" (resolved to "${managedResolved}")`);
|
|
@@ -17621,8 +17704,8 @@ function materializeMergedSkill(opts) {
|
|
|
17621
17704
|
}
|
|
17622
17705
|
return managedDir;
|
|
17623
17706
|
}
|
|
17624
|
-
function cleanMergedDir(
|
|
17625
|
-
fs35.rmSync(path33.join(
|
|
17707
|
+
function cleanMergedDir(claudeDir3) {
|
|
17708
|
+
fs35.rmSync(path33.join(claudeDir3, ".olam-merged"), { recursive: true, force: true });
|
|
17626
17709
|
}
|
|
17627
17710
|
var init_managed_merge = __esm({
|
|
17628
17711
|
"../core/dist/skill-sync/managed-merge.js"() {
|
|
@@ -17742,7 +17825,7 @@ function buildSourcePrefixMap(sources) {
|
|
|
17742
17825
|
registeredPrefixes: Array.from(prefixes)
|
|
17743
17826
|
};
|
|
17744
17827
|
}
|
|
17745
|
-
function applyPrefixRewrites(baseArtifacts, sourceMap,
|
|
17828
|
+
function applyPrefixRewrites(baseArtifacts, sourceMap, claudeDir3, dryRun) {
|
|
17746
17829
|
const result = { rewrittenCount: 0, entries: [] };
|
|
17747
17830
|
for (const artifact of baseArtifacts) {
|
|
17748
17831
|
if (artifact.kind !== "skill" && artifact.kind !== "agent")
|
|
@@ -17783,7 +17866,7 @@ function applyPrefixRewrites(baseArtifacts, sourceMap, claudeDir2, dryRun) {
|
|
|
17783
17866
|
sourcePath: artifact.sourcePath,
|
|
17784
17867
|
deployBasename: renamed,
|
|
17785
17868
|
mergedContent: rewritten,
|
|
17786
|
-
claudeDir:
|
|
17869
|
+
claudeDir: claudeDir3
|
|
17787
17870
|
});
|
|
17788
17871
|
artifact.sourcePath = managedDir;
|
|
17789
17872
|
artifact.deployBasename = renamed;
|
|
@@ -17834,10 +17917,10 @@ var init_prefix_deploy = __esm({
|
|
|
17834
17917
|
|
|
17835
17918
|
// ../core/dist/skill-sync/resolve-source-config.js
|
|
17836
17919
|
import { readFileSync as readFileSync33, existsSync as existsSync39 } from "node:fs";
|
|
17837
|
-
import { join as
|
|
17920
|
+
import { join as join39 } from "node:path";
|
|
17838
17921
|
import { parse as parseYaml4 } from "yaml";
|
|
17839
17922
|
function sourceConfigPath(clonePath) {
|
|
17840
|
-
return
|
|
17923
|
+
return join39(clonePath, "shared", "source-config.yaml");
|
|
17841
17924
|
}
|
|
17842
17925
|
function readSourceConfig(clonePath, sourceId) {
|
|
17843
17926
|
const path62 = sourceConfigPath(clonePath);
|
|
@@ -17941,13 +18024,13 @@ var init_resolve_source_config = __esm({
|
|
|
17941
18024
|
|
|
17942
18025
|
// ../core/dist/skill-sync/engine.js
|
|
17943
18026
|
import * as fs37 from "node:fs";
|
|
17944
|
-
import * as
|
|
18027
|
+
import * as os16 from "node:os";
|
|
17945
18028
|
import * as path35 from "node:path";
|
|
17946
18029
|
function resolveAtlasUser(override) {
|
|
17947
18030
|
if (override)
|
|
17948
18031
|
return override;
|
|
17949
|
-
const
|
|
17950
|
-
const f = path35.join(
|
|
18032
|
+
const claudeDir3 = process.env["OLAM_CLAUDE_DIR"] || path35.join(os16.homedir(), ".claude");
|
|
18033
|
+
const f = path35.join(claudeDir3, ".atlas-user");
|
|
17951
18034
|
if (fs37.existsSync(f)) {
|
|
17952
18035
|
return fs37.readFileSync(f, "utf-8").trim() || void 0;
|
|
17953
18036
|
}
|
|
@@ -18093,11 +18176,11 @@ async function syncSkills(opts = {}) {
|
|
|
18093
18176
|
}
|
|
18094
18177
|
const willMutateManagedDir = !opts.dryRun && (memberOverlaysEnabled && overlayArtifacts.length > 0 || hasPrefixRewrites);
|
|
18095
18178
|
if (willMutateManagedDir) {
|
|
18096
|
-
const claude =
|
|
18179
|
+
const claude = claudeDir2();
|
|
18097
18180
|
cleanMergedDir(claude);
|
|
18098
18181
|
}
|
|
18099
18182
|
if (memberOverlaysEnabled && overlayArtifacts.length > 0 && !opts.dryRun) {
|
|
18100
|
-
const claude =
|
|
18183
|
+
const claude = claudeDir2();
|
|
18101
18184
|
for (const overlay of overlayArtifacts) {
|
|
18102
18185
|
if (!overlay.targetKind)
|
|
18103
18186
|
continue;
|
|
@@ -18137,7 +18220,7 @@ async function syncSkills(opts = {}) {
|
|
|
18137
18220
|
}
|
|
18138
18221
|
const hookFiles = projectFilteredArtifacts.filter((a) => a.kind === "hook").map((a) => a.sourcePath);
|
|
18139
18222
|
const permissionFiles = projectFilteredArtifacts.filter((a) => a.kind === "permission").map((a) => a.sourcePath);
|
|
18140
|
-
const claudeDirForRewrites =
|
|
18223
|
+
const claudeDirForRewrites = claudeDir2();
|
|
18141
18224
|
const prefixRewriteResult = applyPrefixRewrites(baseArtifacts, sourcePrefixMap, claudeDirForRewrites, opts.dryRun === true);
|
|
18142
18225
|
const prefixCollisions = detectPrefixCollisions(effectiveSources);
|
|
18143
18226
|
if (!opts.dryRun) {
|
|
@@ -18174,7 +18257,7 @@ async function syncSkills(opts = {}) {
|
|
|
18174
18257
|
summary.collisions = detectCollisions(baseArtifacts).collisions;
|
|
18175
18258
|
return summary;
|
|
18176
18259
|
}
|
|
18177
|
-
const claudeDirPath = process.env["OLAM_CLAUDE_DIR"] || path35.join(
|
|
18260
|
+
const claudeDirPath = process.env["OLAM_CLAUDE_DIR"] || path35.join(os16.homedir(), ".claude");
|
|
18178
18261
|
const overlayReferences = scanOverlayReferences(claudeDirPath, SHIM_TARGETS.map((t) => t.basename));
|
|
18179
18262
|
summary.deploy = deployArtifacts(baseArtifacts, {
|
|
18180
18263
|
installedOlamVersion,
|
|
@@ -18273,7 +18356,7 @@ async function injectMetaHooksIntoSettings(opts) {
|
|
|
18273
18356
|
if (modelRouterTargeted) {
|
|
18274
18357
|
try {
|
|
18275
18358
|
scriptDeploy = deployModelRouterScript({
|
|
18276
|
-
targetDir: path35.join(
|
|
18359
|
+
targetDir: path35.join(claudeDir2(), "hooks")
|
|
18277
18360
|
});
|
|
18278
18361
|
} catch (err) {
|
|
18279
18362
|
scriptDeploy = {
|
|
@@ -18327,7 +18410,7 @@ var init_engine = __esm({
|
|
|
18327
18410
|
import * as fs38 from "node:fs";
|
|
18328
18411
|
import * as path36 from "node:path";
|
|
18329
18412
|
function listShadowBackups(opts = {}) {
|
|
18330
|
-
const claude = opts.claudeDirOverride ??
|
|
18413
|
+
const claude = opts.claudeDirOverride ?? claudeDir2();
|
|
18331
18414
|
const now = opts.now ?? Date.now();
|
|
18332
18415
|
const out = [];
|
|
18333
18416
|
for (const bucket of SHADOW_BACKUP_BUCKETS) {
|
|
@@ -18461,15 +18544,15 @@ var init_shadow_backup_manager = __esm({
|
|
|
18461
18544
|
// ../core/dist/skill-sources/doctor-checks.js
|
|
18462
18545
|
import * as fs39 from "node:fs";
|
|
18463
18546
|
import * as path37 from "node:path";
|
|
18464
|
-
import * as
|
|
18547
|
+
import * as os17 from "node:os";
|
|
18465
18548
|
function claudeDirInternal3() {
|
|
18466
18549
|
const override = process.env["OLAM_CLAUDE_DIR"];
|
|
18467
18550
|
if (override && override.length > 0)
|
|
18468
18551
|
return override;
|
|
18469
|
-
return path37.join(
|
|
18552
|
+
return path37.join(os17.homedir(), ".claude");
|
|
18470
18553
|
}
|
|
18471
18554
|
function checkStateFileParse() {
|
|
18472
|
-
const filePath =
|
|
18555
|
+
const filePath = globalConfigPath2();
|
|
18473
18556
|
const result = {
|
|
18474
18557
|
name: "state-parse",
|
|
18475
18558
|
healthy: true,
|
|
@@ -18709,8 +18792,8 @@ function checkMemberNameMissing() {
|
|
|
18709
18792
|
result.details = ["(atlas-toolbox source not registered \u2014 check not applicable)"];
|
|
18710
18793
|
return result;
|
|
18711
18794
|
}
|
|
18712
|
-
const
|
|
18713
|
-
const atlasUserPath = path37.join(
|
|
18795
|
+
const claudeDir3 = claudeDirInternal3();
|
|
18796
|
+
const atlasUserPath = path37.join(claudeDir3, ".atlas-user");
|
|
18714
18797
|
const value = fs39.existsSync(atlasUserPath) ? fs39.readFileSync(atlasUserPath, "utf-8").trim() : "";
|
|
18715
18798
|
if (value.length > 0) {
|
|
18716
18799
|
result.details = [`atlas-user: ${value}`];
|
|
@@ -18735,8 +18818,8 @@ function checkMemberNameMissing() {
|
|
|
18735
18818
|
return result;
|
|
18736
18819
|
}
|
|
18737
18820
|
function checkMemberOverlayDrift() {
|
|
18738
|
-
const
|
|
18739
|
-
const atlasUserPath = path37.join(
|
|
18821
|
+
const claudeDir3 = claudeDirInternal3();
|
|
18822
|
+
const atlasUserPath = path37.join(claudeDir3, ".atlas-user");
|
|
18740
18823
|
const atlasUser = fs39.existsSync(atlasUserPath) ? fs39.readFileSync(atlasUserPath, "utf-8").trim() : "";
|
|
18741
18824
|
if (atlasUser.length === 0) {
|
|
18742
18825
|
return [];
|
|
@@ -18753,7 +18836,7 @@ function checkMemberOverlayDrift() {
|
|
|
18753
18836
|
const clonePath = skillSourceClonePath(atlasSource.id);
|
|
18754
18837
|
const results = [];
|
|
18755
18838
|
for (const kind of ["skills", "agents"]) {
|
|
18756
|
-
const localRoot = path37.join(
|
|
18839
|
+
const localRoot = path37.join(claudeDir3, `${kind}.overrides`);
|
|
18757
18840
|
if (!fs39.existsSync(localRoot))
|
|
18758
18841
|
continue;
|
|
18759
18842
|
let entries;
|
|
@@ -18856,7 +18939,7 @@ function detectPullDeployDrift(opts) {
|
|
|
18856
18939
|
prefixEntry.prefixScope = eff.prefixScope;
|
|
18857
18940
|
if (eff.prefixTarget !== void 0)
|
|
18858
18941
|
prefixEntry.prefixTarget = eff.prefixTarget;
|
|
18859
|
-
applyPrefixRewrites(artifacts, buildSourcePrefixMap([prefixEntry]),
|
|
18942
|
+
applyPrefixRewrites(artifacts, buildSourcePrefixMap([prefixEntry]), claudeDir2(), true);
|
|
18860
18943
|
const cloneByKind = {
|
|
18861
18944
|
skill: /* @__PURE__ */ new Set(),
|
|
18862
18945
|
agent: /* @__PURE__ */ new Set(),
|
|
@@ -18874,7 +18957,7 @@ function detectPullDeployDrift(opts) {
|
|
|
18874
18957
|
const kind = artifact.kind;
|
|
18875
18958
|
cloneByKind[kind].add(artifact.deployBasename);
|
|
18876
18959
|
}
|
|
18877
|
-
const claude =
|
|
18960
|
+
const claude = claudeDir2();
|
|
18878
18961
|
const perKind = {
|
|
18879
18962
|
skill: { added: [], removed: [] },
|
|
18880
18963
|
agent: { added: [], removed: [] },
|
|
@@ -18958,7 +19041,7 @@ __export(skill_sources_exports, {
|
|
|
18958
19041
|
checkOrphanedSnapshots: () => checkOrphanedSnapshots,
|
|
18959
19042
|
checkSentinelDrift: () => checkSentinelDrift,
|
|
18960
19043
|
checkStateFileParse: () => checkStateFileParse,
|
|
18961
|
-
claudeDir: () =>
|
|
19044
|
+
claudeDir: () => claudeDir2,
|
|
18962
19045
|
claudeSettingsPath: () => claudeSettingsPath,
|
|
18963
19046
|
cloneSkillSource: () => cloneSkillSource,
|
|
18964
19047
|
computeSkillsHookUninstall: () => computeUninstall,
|
|
@@ -39876,7 +39959,7 @@ __export(auth_exports, {
|
|
|
39876
39959
|
init_paths();
|
|
39877
39960
|
import * as crypto from "node:crypto";
|
|
39878
39961
|
import * as fs3 from "node:fs";
|
|
39879
|
-
import * as
|
|
39962
|
+
import * as os from "node:os";
|
|
39880
39963
|
import * as path3 from "node:path";
|
|
39881
39964
|
var SECRET_ENV_VAR = "OLAM_AUTH_SECRET";
|
|
39882
39965
|
var SECRET_NAME = "auth-secret";
|
|
@@ -40459,7 +40542,7 @@ __export(pr_exports, {
|
|
|
40459
40542
|
// ../core/dist/world/registry.js
|
|
40460
40543
|
import { createRequire } from "node:module";
|
|
40461
40544
|
import * as net from "node:net";
|
|
40462
|
-
import * as
|
|
40545
|
+
import * as os2 from "node:os";
|
|
40463
40546
|
import * as path5 from "node:path";
|
|
40464
40547
|
import * as fs4 from "node:fs";
|
|
40465
40548
|
var _require = createRequire(import.meta.url);
|
|
@@ -40572,7 +40655,7 @@ CREATE TABLE IF NOT EXISTS meta (
|
|
|
40572
40655
|
var WorldRegistry = class {
|
|
40573
40656
|
db;
|
|
40574
40657
|
constructor(dbPath) {
|
|
40575
|
-
const resolvedPath = dbPath ?? path5.join(
|
|
40658
|
+
const resolvedPath = dbPath ?? path5.join(os2.homedir(), ".olam", "worlds.db");
|
|
40576
40659
|
if (resolvedPath !== ":memory:") {
|
|
40577
40660
|
fs4.mkdirSync(path5.dirname(resolvedPath), { recursive: true });
|
|
40578
40661
|
}
|
|
@@ -41037,9 +41120,9 @@ function register3(server, _ctx, _initError) {
|
|
|
41037
41120
|
}
|
|
41038
41121
|
try {
|
|
41039
41122
|
const { default: fs62 } = await import("node:fs");
|
|
41040
|
-
const { default:
|
|
41123
|
+
const { default: os32 } = await import("node:os");
|
|
41041
41124
|
const { default: path62 } = await import("node:path");
|
|
41042
|
-
const tokenPath = path62.join(
|
|
41125
|
+
const tokenPath = path62.join(os32.homedir(), ".olam", "host-cp.token");
|
|
41043
41126
|
if (fs62.existsSync(tokenPath)) {
|
|
41044
41127
|
const token = fs62.readFileSync(tokenPath, "utf-8").trim();
|
|
41045
41128
|
await fetch("http://127.0.0.1:19000/api/admin/world-pr", {
|
|
@@ -41290,7 +41373,7 @@ import { execFile } from "node:child_process";
|
|
|
41290
41373
|
import { promisify } from "node:util";
|
|
41291
41374
|
import { readFileSync as readFileSync5, existsSync as existsSync7, statSync } from "node:fs";
|
|
41292
41375
|
import { homedir as homedir5 } from "node:os";
|
|
41293
|
-
import { join as
|
|
41376
|
+
import { join as join9 } from "node:path";
|
|
41294
41377
|
var execFileP = promisify(execFile);
|
|
41295
41378
|
async function tarSkillsDir(skillsDir) {
|
|
41296
41379
|
if (!existsSync7(skillsDir) || !statSync(skillsDir).isDirectory()) {
|
|
@@ -41356,10 +41439,10 @@ function readOptional(path62) {
|
|
|
41356
41439
|
}
|
|
41357
41440
|
async function syncProfileToCloudflare(opts) {
|
|
41358
41441
|
const home = opts.homeDir ?? homedir5();
|
|
41359
|
-
const skillsDir =
|
|
41360
|
-
const claudeJsonPath =
|
|
41361
|
-
const claudeMdPath =
|
|
41362
|
-
const agentsMdPath =
|
|
41442
|
+
const skillsDir = join9(home, ".claude", "skills");
|
|
41443
|
+
const claudeJsonPath = join9(home, ".claude.json");
|
|
41444
|
+
const claudeMdPath = join9(home, ".claude", "CLAUDE.md");
|
|
41445
|
+
const agentsMdPath = join9(home, ".claude", "AGENTS.md");
|
|
41363
41446
|
const form = new FormData();
|
|
41364
41447
|
const skillsBuf = await tarSkillsDir(skillsDir);
|
|
41365
41448
|
if (skillsBuf) {
|
|
@@ -41583,10 +41666,10 @@ async function selectComputeProvider(config2, env) {
|
|
|
41583
41666
|
function createCloudflareProvider(CloudflareProviderClass, config2, env) {
|
|
41584
41667
|
const resolved = resolveCloudflareCallerConfig(config2, env);
|
|
41585
41668
|
warnOnWorkerPylonMismatch(resolved.workerUrl, resolved.pylonOrgUrl);
|
|
41586
|
-
const
|
|
41669
|
+
const mintToken3 = buildMintTokenForResolvedConfig(resolved);
|
|
41587
41670
|
return new CloudflareProviderClass({
|
|
41588
41671
|
workerUrl: resolved.workerUrl,
|
|
41589
|
-
mintToken:
|
|
41672
|
+
mintToken: mintToken3,
|
|
41590
41673
|
cfAccessClientId: resolved.cfAccessClientId,
|
|
41591
41674
|
cfAccessClientSecret: resolved.cfAccessClientSecret
|
|
41592
41675
|
});
|
|
@@ -41954,8 +42037,8 @@ function register5(server, ctx, initError) {
|
|
|
41954
42037
|
}
|
|
41955
42038
|
if (resolved) {
|
|
41956
42039
|
try {
|
|
41957
|
-
const
|
|
41958
|
-
const authToken = await
|
|
42040
|
+
const mintToken3 = createMintTokenForCtx(resolved);
|
|
42041
|
+
const authToken = await mintToken3();
|
|
41959
42042
|
await syncProfileToCloudflare({
|
|
41960
42043
|
workerUrl: resolved.workerUrl,
|
|
41961
42044
|
authToken,
|
|
@@ -42511,7 +42594,7 @@ var ThoughtLocalStore = class {
|
|
|
42511
42594
|
// ../core/dist/world/env-setup.js
|
|
42512
42595
|
import * as crypto2 from "node:crypto";
|
|
42513
42596
|
import * as fs10 from "node:fs";
|
|
42514
|
-
import * as
|
|
42597
|
+
import * as os7 from "node:os";
|
|
42515
42598
|
import * as path12 from "node:path";
|
|
42516
42599
|
import { globSync } from "node:fs";
|
|
42517
42600
|
|
|
@@ -42601,7 +42684,7 @@ function generateHooksConfig(hookServerUrl = DEFAULT_HOOK_SERVER_URL) {
|
|
|
42601
42684
|
// ../core/dist/world/env-setup.js
|
|
42602
42685
|
var DEFAULT_CLAUDE_MODEL = "claude-opus-4-7";
|
|
42603
42686
|
function copyClaudeConfig(workspacePath, homeDir, configCtx) {
|
|
42604
|
-
const sourceClaudeDir = path12.join(homeDir ??
|
|
42687
|
+
const sourceClaudeDir = path12.join(homeDir ?? os7.homedir(), ".claude");
|
|
42605
42688
|
const destClaudeDir = path12.join(workspacePath, ".claude-host-config");
|
|
42606
42689
|
void configCtx;
|
|
42607
42690
|
if (!fs10.existsSync(sourceClaudeDir))
|
|
@@ -42647,7 +42730,7 @@ function copyClaudeConfig(workspacePath, homeDir, configCtx) {
|
|
|
42647
42730
|
copyDirRecursive(scriptsDir, path12.join(destClaudeDir, "scripts"));
|
|
42648
42731
|
}
|
|
42649
42732
|
applyProjectClaudeOverlay(workspacePath, destClaudeDir);
|
|
42650
|
-
writeStrippedMcpServersSnapshot(homeDir ??
|
|
42733
|
+
writeStrippedMcpServersSnapshot(homeDir ?? os7.homedir(), workspacePath, destClaudeDir);
|
|
42651
42734
|
}
|
|
42652
42735
|
function applyProjectClaudeOverlay(workspacePath, destClaudeDir) {
|
|
42653
42736
|
const projectClaudeDir = path12.join(workspacePath, ".claude");
|
|
@@ -44480,12 +44563,12 @@ __export(capture_view_exports, {
|
|
|
44480
44563
|
});
|
|
44481
44564
|
init_v3();
|
|
44482
44565
|
import { mkdir } from "node:fs/promises";
|
|
44483
|
-
import { join as
|
|
44566
|
+
import { join as join16, resolve as resolvePath } from "node:path";
|
|
44484
44567
|
|
|
44485
44568
|
// ../mcp-server/src/tools/_capture/manifest.ts
|
|
44486
44569
|
import { createHash as createHash3 } from "node:crypto";
|
|
44487
44570
|
import { readFile, writeFile } from "node:fs/promises";
|
|
44488
|
-
import { basename as basename2, join as
|
|
44571
|
+
import { basename as basename2, join as join15 } from "node:path";
|
|
44489
44572
|
function redactUrl(url3) {
|
|
44490
44573
|
if (url3.startsWith("world://")) return url3;
|
|
44491
44574
|
let parsed;
|
|
@@ -44528,7 +44611,7 @@ async function writeManifest(args) {
|
|
|
44528
44611
|
capturedAt: args.capturedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
44529
44612
|
shots: entries
|
|
44530
44613
|
};
|
|
44531
|
-
const path62 =
|
|
44614
|
+
const path62 = join15(args.outDir, "manifest.json");
|
|
44532
44615
|
await writeFile(path62, `${JSON.stringify(manifest, null, 2)}
|
|
44533
44616
|
`, "utf8");
|
|
44534
44617
|
return { path: path62, manifest };
|
|
@@ -45326,7 +45409,7 @@ function releaseLaunchSlot() {
|
|
|
45326
45409
|
function resolveShootsRoot() {
|
|
45327
45410
|
const fromEnv = process.env.OLAM_SHOOTS_ROOT;
|
|
45328
45411
|
if (fromEnv && fromEnv.length > 0) return resolvePath(fromEnv);
|
|
45329
|
-
return resolvePath(
|
|
45412
|
+
return resolvePath(join16(process.cwd(), ".olam", "shoots"));
|
|
45330
45413
|
}
|
|
45331
45414
|
function isUnderRoot(absPath, root) {
|
|
45332
45415
|
if (absPath === root) return true;
|
|
@@ -45627,7 +45710,7 @@ async function runShot(browser, shot, outDir, format, jpegQuality, allowEval, as
|
|
|
45627
45710
|
await page.waitForTimeout(shot.afterLoadMs);
|
|
45628
45711
|
}
|
|
45629
45712
|
const ext = format === "jpeg" ? "jpg" : "png";
|
|
45630
|
-
const path62 =
|
|
45713
|
+
const path62 = join16(outDir, `${shot.name}.${ext}`);
|
|
45631
45714
|
await page.screenshot({
|
|
45632
45715
|
path: path62,
|
|
45633
45716
|
type: format,
|
|
@@ -45941,17 +46024,17 @@ var webTaskShape = external_exports2.object(webTaskInput);
|
|
|
45941
46024
|
import { spawn as spawn3 } from "node:child_process";
|
|
45942
46025
|
import { existsSync as existsSync14 } from "node:fs";
|
|
45943
46026
|
import { homedir as homedir9 } from "node:os";
|
|
45944
|
-
import { join as
|
|
46027
|
+
import { join as join17 } from "node:path";
|
|
45945
46028
|
var WEBWRIGHT_SETUP_COMMAND = "olam webwright setup";
|
|
45946
46029
|
function resolveVenvPath(cfg) {
|
|
45947
46030
|
if (cfg?.venvPath && cfg.venvPath.length > 0) return cfg.venvPath;
|
|
45948
|
-
return
|
|
46031
|
+
return join17(homedir9(), ".olam", "venvs", "webwright");
|
|
45949
46032
|
}
|
|
45950
46033
|
function resolveConfigDir(cfg) {
|
|
45951
46034
|
if (cfg?.configDir && cfg.configDir.length > 0) {
|
|
45952
46035
|
return existsSync14(cfg.configDir) ? cfg.configDir : null;
|
|
45953
46036
|
}
|
|
45954
|
-
const candidate =
|
|
46037
|
+
const candidate = join17(
|
|
45955
46038
|
homedir9(),
|
|
45956
46039
|
".claude",
|
|
45957
46040
|
"plugins",
|
|
@@ -45969,9 +46052,9 @@ function isWebwrightEnabled(cfg) {
|
|
|
45969
46052
|
return cfg?.enabled === true;
|
|
45970
46053
|
}
|
|
45971
46054
|
function venvPython(venvPath) {
|
|
45972
|
-
const posix =
|
|
46055
|
+
const posix = join17(venvPath, "bin", "python");
|
|
45973
46056
|
if (existsSync14(posix)) return posix;
|
|
45974
|
-
const win =
|
|
46057
|
+
const win = join17(venvPath, "Scripts", "python.exe");
|
|
45975
46058
|
if (existsSync14(win)) return win;
|
|
45976
46059
|
return null;
|
|
45977
46060
|
}
|
|
@@ -46057,12 +46140,12 @@ import { spawn as spawn4 } from "node:child_process";
|
|
|
46057
46140
|
import { mkdir as mkdir2, mkdtemp, readFile as readFile3, readdir, rm, writeFile as writeFile2 } from "node:fs/promises";
|
|
46058
46141
|
import { existsSync as existsSync15 } from "node:fs";
|
|
46059
46142
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
46060
|
-
import { join as
|
|
46143
|
+
import { join as join19, resolve as resolvePath2 } from "node:path";
|
|
46061
46144
|
|
|
46062
46145
|
// ../mcp-server/src/tools/_web_task/model-config.ts
|
|
46063
46146
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
46064
46147
|
import { homedir as homedir10 } from "node:os";
|
|
46065
|
-
import { join as
|
|
46148
|
+
import { join as join18 } from "node:path";
|
|
46066
46149
|
var PLACEHOLDER_ANTHROPIC_API_KEY = "olam-vault-routed-placeholder-stripped-by-proxy";
|
|
46067
46150
|
var DEFAULT_WEB_TASK_MODEL = "claude-opus-4-7";
|
|
46068
46151
|
var AnthropicBaseUrlMissingError = class extends Error {
|
|
@@ -46077,7 +46160,7 @@ async function resolveVaultBaseUrl(opts = {}) {
|
|
|
46077
46160
|
const env = opts.env ?? process.env;
|
|
46078
46161
|
const fromEnv = env.OLAM_ANTHROPIC_BASE_URL;
|
|
46079
46162
|
if (fromEnv && fromEnv.trim().length > 0) return fromEnv.trim();
|
|
46080
|
-
const file2 = opts.baseUrlFile ??
|
|
46163
|
+
const file2 = opts.baseUrlFile ?? join18(homedir10(), ".olam", "anthropic-base-url");
|
|
46081
46164
|
let raw;
|
|
46082
46165
|
try {
|
|
46083
46166
|
raw = await readFile2(file2, "utf-8");
|
|
@@ -46127,7 +46210,7 @@ var WebTaskSpawnError = class extends Error {
|
|
|
46127
46210
|
function resolveWebTaskRoot() {
|
|
46128
46211
|
const fromEnv = process.env.OLAM_WEB_TASK_ROOT;
|
|
46129
46212
|
if (fromEnv && fromEnv.length > 0) return resolvePath2(fromEnv);
|
|
46130
|
-
return resolvePath2(
|
|
46213
|
+
return resolvePath2(join19(process.cwd(), ".olam", "web-tasks"));
|
|
46131
46214
|
}
|
|
46132
46215
|
function isUnderRoot2(absPath, root) {
|
|
46133
46216
|
if (absPath === root) return true;
|
|
@@ -46190,7 +46273,7 @@ async function runWebwright(pythonPath, args, spawnEnv, timeoutMs, deps) {
|
|
|
46190
46273
|
});
|
|
46191
46274
|
}
|
|
46192
46275
|
async function locateRunDir(outDir) {
|
|
46193
|
-
if (existsSync15(
|
|
46276
|
+
if (existsSync15(join19(outDir, "trajectory.json"))) return outDir;
|
|
46194
46277
|
let entries = [];
|
|
46195
46278
|
try {
|
|
46196
46279
|
entries = await readdir(outDir);
|
|
@@ -46199,8 +46282,8 @@ async function locateRunDir(outDir) {
|
|
|
46199
46282
|
}
|
|
46200
46283
|
const candidates = [];
|
|
46201
46284
|
for (const name of entries) {
|
|
46202
|
-
const sub =
|
|
46203
|
-
if (existsSync15(
|
|
46285
|
+
const sub = join19(outDir, name);
|
|
46286
|
+
if (existsSync15(join19(sub, "trajectory.json"))) candidates.push({ dir: sub });
|
|
46204
46287
|
}
|
|
46205
46288
|
if (candidates.length === 0) return outDir;
|
|
46206
46289
|
candidates.sort((a, b) => a.dir < b.dir ? 1 : -1);
|
|
@@ -46213,14 +46296,14 @@ async function collectScreenshots(runDir) {
|
|
|
46213
46296
|
} catch {
|
|
46214
46297
|
return [];
|
|
46215
46298
|
}
|
|
46216
|
-
const shots = entries.filter((n) => /\.(png|jpe?g)$/i.test(n)).sort().map((n, i) => ({ step: i, path:
|
|
46299
|
+
const shots = entries.filter((n) => /\.(png|jpe?g)$/i.test(n)).sort().map((n, i) => ({ step: i, path: join19(runDir, n) }));
|
|
46217
46300
|
return shots;
|
|
46218
46301
|
}
|
|
46219
46302
|
async function readTrajectoryFacts(runDir, stdoutTail) {
|
|
46220
46303
|
let answer = null;
|
|
46221
46304
|
let modelCalls = null;
|
|
46222
46305
|
try {
|
|
46223
|
-
const raw = await readFile3(
|
|
46306
|
+
const raw = await readFile3(join19(runDir, "trajectory.json"), "utf-8");
|
|
46224
46307
|
const parsed = JSON.parse(raw);
|
|
46225
46308
|
answer = extractFinalAnswer(parsed);
|
|
46226
46309
|
modelCalls = extractModelCalls(parsed);
|
|
@@ -46353,11 +46436,11 @@ async function runSpawnExecutor(spec, ctx, provision, deps = { spawn: spawn4 })
|
|
|
46353
46436
|
} catch (err) {
|
|
46354
46437
|
throw new WebTaskSpawnError("vault_base_url_missing", err.message);
|
|
46355
46438
|
}
|
|
46356
|
-
const tmpDirRoot = await mkdtemp(
|
|
46357
|
-
const modelYamlPath =
|
|
46439
|
+
const tmpDirRoot = await mkdtemp(join19(tmpdir2(), "olam-web-task-"));
|
|
46440
|
+
const modelYamlPath = join19(tmpDirRoot, "model_olam.yaml");
|
|
46358
46441
|
await writeFile2(modelYamlPath, modelYaml.yaml, "utf-8");
|
|
46359
46442
|
try {
|
|
46360
|
-
const baseYaml =
|
|
46443
|
+
const baseYaml = join19(provision.configDir, "base.yaml");
|
|
46361
46444
|
const args = [
|
|
46362
46445
|
"-m",
|
|
46363
46446
|
"webwright.run.cli",
|
|
@@ -46411,10 +46494,10 @@ ${tail}` : ""}`
|
|
|
46411
46494
|
);
|
|
46412
46495
|
}
|
|
46413
46496
|
const runDir = await locateRunDir(absOutDir);
|
|
46414
|
-
const trajectoryPath =
|
|
46497
|
+
const trajectoryPath = join19(runDir, "trajectory.json");
|
|
46415
46498
|
const screenshots = await collectScreenshots(runDir);
|
|
46416
46499
|
const facts = await readTrajectoryFacts(runDir, outcome.stdout);
|
|
46417
|
-
const scriptPath = existsSync15(
|
|
46500
|
+
const scriptPath = existsSync15(join19(runDir, "final_script.py")) ? join19(runDir, "final_script.py") : void 0;
|
|
46418
46501
|
return {
|
|
46419
46502
|
result: facts.answer,
|
|
46420
46503
|
trajectoryPath,
|
|
@@ -46968,9 +47051,9 @@ var HOST_CP_URL = "http://127.0.0.1:19000";
|
|
|
46968
47051
|
async function readHostCpToken2() {
|
|
46969
47052
|
try {
|
|
46970
47053
|
const { default: fs62 } = await import("node:fs");
|
|
46971
|
-
const { default:
|
|
47054
|
+
const { default: os32 } = await import("node:os");
|
|
46972
47055
|
const { default: path62 } = await import("node:path");
|
|
46973
|
-
const tp = path62.join(
|
|
47056
|
+
const tp = path62.join(os32.homedir(), ".olam", "host-cp.token");
|
|
46974
47057
|
if (!fs62.existsSync(tp)) return { token: null };
|
|
46975
47058
|
return { token: fs62.readFileSync(tp, "utf-8").trim() };
|
|
46976
47059
|
} catch {
|
|
@@ -47332,7 +47415,7 @@ __export(process_port_exports, {
|
|
|
47332
47415
|
resolveHostCpToken: () => resolveHostCpToken
|
|
47333
47416
|
});
|
|
47334
47417
|
import fs41 from "node:fs";
|
|
47335
|
-
import
|
|
47418
|
+
import os18 from "node:os";
|
|
47336
47419
|
import path39 from "node:path";
|
|
47337
47420
|
|
|
47338
47421
|
// ../skill-runtime/dist/skills/process-list.js
|
|
@@ -47378,7 +47461,7 @@ var HOST_CP_BASE = "http://127.0.0.1:19000";
|
|
|
47378
47461
|
function resolveHostCpToken() {
|
|
47379
47462
|
const envToken = process.env["OLAM_HOST_CP_TOKEN"];
|
|
47380
47463
|
if (envToken) return envToken;
|
|
47381
|
-
const tokenPath = path39.join(
|
|
47464
|
+
const tokenPath = path39.join(os18.homedir(), ".olam", "host-cp.token");
|
|
47382
47465
|
if (fs41.existsSync(tokenPath)) return fs41.readFileSync(tokenPath, "utf-8").trim();
|
|
47383
47466
|
return null;
|
|
47384
47467
|
}
|
|
@@ -47977,7 +48060,7 @@ function fail2(err, hint) {
|
|
|
47977
48060
|
};
|
|
47978
48061
|
}
|
|
47979
48062
|
function listDeployed() {
|
|
47980
|
-
const dir =
|
|
48063
|
+
const dir = claudeDir2();
|
|
47981
48064
|
const sources = listSkillSources();
|
|
47982
48065
|
const sourcePaths = new Map(
|
|
47983
48066
|
sources.map((s) => [skillSourceClonePath(s.id), s.id])
|
|
@@ -48080,13 +48163,13 @@ function deriveModeId(name, taken) {
|
|
|
48080
48163
|
// ../core/dist/ree-modes/store.js
|
|
48081
48164
|
init_skill_sources();
|
|
48082
48165
|
import * as fs44 from "node:fs";
|
|
48083
|
-
import * as
|
|
48166
|
+
import * as os20 from "node:os";
|
|
48084
48167
|
import * as path42 from "node:path";
|
|
48085
48168
|
|
|
48086
48169
|
// ../core/dist/ree-modes/registry.js
|
|
48087
48170
|
init_v3();
|
|
48088
48171
|
import * as fs43 from "node:fs";
|
|
48089
|
-
import * as
|
|
48172
|
+
import * as os19 from "node:os";
|
|
48090
48173
|
import * as path41 from "node:path";
|
|
48091
48174
|
var CadenceStatusSchema = external_exports2.enum(["running", "stopped"]);
|
|
48092
48175
|
var CadenceEntrySchema = external_exports2.object({
|
|
@@ -48109,7 +48192,7 @@ function olamRootDir() {
|
|
|
48109
48192
|
const override = process.env["OLAM_STATE_DIR"];
|
|
48110
48193
|
if (override && override.length > 0)
|
|
48111
48194
|
return override;
|
|
48112
|
-
return path41.join(
|
|
48195
|
+
return path41.join(os19.homedir(), ".olam");
|
|
48113
48196
|
}
|
|
48114
48197
|
function cadenceRegistryPath() {
|
|
48115
48198
|
return path41.join(olamRootDir(), "ree-cadences.json");
|
|
@@ -48176,7 +48259,7 @@ function claudeRootDir() {
|
|
|
48176
48259
|
const override = process.env["OLAM_CLAUDE_DIR"];
|
|
48177
48260
|
if (override && override.length > 0)
|
|
48178
48261
|
return override;
|
|
48179
|
-
return path42.join(
|
|
48262
|
+
return path42.join(os20.homedir(), ".claude");
|
|
48180
48263
|
}
|
|
48181
48264
|
function localModesDir() {
|
|
48182
48265
|
return path42.join(claudeRootDir(), "ree-modes.local");
|
|
@@ -48557,13 +48640,13 @@ __export(skills_search_exports, {
|
|
|
48557
48640
|
register: () => register28
|
|
48558
48641
|
});
|
|
48559
48642
|
import * as path45 from "node:path";
|
|
48560
|
-
import * as
|
|
48643
|
+
import * as os22 from "node:os";
|
|
48561
48644
|
|
|
48562
48645
|
// ../mcp-server/src/lib/skills-index.mjs
|
|
48563
48646
|
import { createRequire as createRequire5 } from "node:module";
|
|
48564
48647
|
import * as fs46 from "node:fs";
|
|
48565
48648
|
import * as path44 from "node:path";
|
|
48566
|
-
import * as
|
|
48649
|
+
import * as os21 from "node:os";
|
|
48567
48650
|
var VECTOR_DIM = 256;
|
|
48568
48651
|
var SCHEMA_VERSION3 = "1";
|
|
48569
48652
|
var SCHEMA_KEY = "skills_index_schema_version";
|
|
@@ -48694,8 +48777,8 @@ function searchIndex(dbPath, query, k = 5) {
|
|
|
48694
48777
|
db.close();
|
|
48695
48778
|
}
|
|
48696
48779
|
}
|
|
48697
|
-
var DEFAULT_DB_PATH = path44.join(
|
|
48698
|
-
var DEFAULT_SOURCE_DIR = path44.join(
|
|
48780
|
+
var DEFAULT_DB_PATH = path44.join(os21.homedir(), ".olam", "skills.vec.db");
|
|
48781
|
+
var DEFAULT_SOURCE_DIR = path44.join(os21.homedir(), ".claude", "skills");
|
|
48699
48782
|
|
|
48700
48783
|
// ../skill-runtime/dist/skills/skills-search.js
|
|
48701
48784
|
init_v3();
|
|
@@ -48714,7 +48797,7 @@ var skillsSearchSkill = defineSkill({
|
|
|
48714
48797
|
function defaultDbPath() {
|
|
48715
48798
|
const override = process.env["SKILLS_INDEX_PATH"];
|
|
48716
48799
|
if (override) return override;
|
|
48717
|
-
return path45.join(
|
|
48800
|
+
return path45.join(os22.homedir(), ".olam", "skills.vec.db");
|
|
48718
48801
|
}
|
|
48719
48802
|
function asMessage10(err) {
|
|
48720
48803
|
return err instanceof Error ? err.message : String(err);
|
|
@@ -48990,7 +49073,7 @@ __export(kg_install_hook_exports, {
|
|
|
48990
49073
|
init_merge_settings();
|
|
48991
49074
|
import * as fs47 from "node:fs";
|
|
48992
49075
|
import * as path46 from "node:path";
|
|
48993
|
-
import * as
|
|
49076
|
+
import * as os23 from "node:os";
|
|
48994
49077
|
|
|
48995
49078
|
// ../core/dist/kg/hook-template.js
|
|
48996
49079
|
var KG_HOOK_SENTINEL = "kg-service-v3-classifier-hook";
|
|
@@ -49086,7 +49169,7 @@ var kgInstallHookSkill = defineSkill({
|
|
|
49086
49169
|
// ../mcp-server/src/tools/kg-install-hook.ts
|
|
49087
49170
|
function settingsPathFor2(scope, projectPath) {
|
|
49088
49171
|
if (scope === "user") {
|
|
49089
|
-
return path46.join(
|
|
49172
|
+
return path46.join(os23.homedir(), ".claude", "settings.json");
|
|
49090
49173
|
}
|
|
49091
49174
|
const root = projectPath ?? process.cwd();
|
|
49092
49175
|
return path46.join(root, ".claude", "settings.json");
|
|
@@ -49156,7 +49239,7 @@ __export(kg_uninstall_hook_exports, {
|
|
|
49156
49239
|
});
|
|
49157
49240
|
import * as fs48 from "node:fs";
|
|
49158
49241
|
import * as path47 from "node:path";
|
|
49159
|
-
import * as
|
|
49242
|
+
import * as os24 from "node:os";
|
|
49160
49243
|
|
|
49161
49244
|
// ../skill-runtime/dist/skills/kg-uninstall-hook.js
|
|
49162
49245
|
init_v3();
|
|
@@ -49178,7 +49261,7 @@ var kgUninstallHookSkill = defineSkill({
|
|
|
49178
49261
|
// ../mcp-server/src/tools/kg-uninstall-hook.ts
|
|
49179
49262
|
function settingsPathFor3(scope, projectPath) {
|
|
49180
49263
|
if (scope === "user") {
|
|
49181
|
-
return path47.join(
|
|
49264
|
+
return path47.join(os24.homedir(), ".claude", "settings.json");
|
|
49182
49265
|
}
|
|
49183
49266
|
const root = projectPath ?? process.cwd();
|
|
49184
49267
|
return path47.join(root, ".claude", "settings.json");
|
|
@@ -50008,11 +50091,11 @@ function registerAllTools(server, ctx, initError) {
|
|
|
50008
50091
|
|
|
50009
50092
|
// ../mcp-server/src/resources/chunks.ts
|
|
50010
50093
|
import fs49 from "node:fs";
|
|
50011
|
-
import
|
|
50094
|
+
import os25 from "node:os";
|
|
50012
50095
|
import path48 from "node:path";
|
|
50013
50096
|
var DEFAULT_HOST_CP_URL = "http://127.0.0.1:19000";
|
|
50014
50097
|
var DEFAULT_PLAN_CHAT_SECRET_PATH = path48.join(
|
|
50015
|
-
|
|
50098
|
+
os25.homedir(),
|
|
50016
50099
|
".olam",
|
|
50017
50100
|
"plan-chat-secret"
|
|
50018
50101
|
);
|
|
@@ -51801,7 +51884,7 @@ init_loader();
|
|
|
51801
51884
|
import * as crypto8 from "node:crypto";
|
|
51802
51885
|
import { execSync as execSync6, spawnSync as spawnSync4 } from "node:child_process";
|
|
51803
51886
|
import * as fs59 from "node:fs";
|
|
51804
|
-
import * as
|
|
51887
|
+
import * as os30 from "node:os";
|
|
51805
51888
|
import * as path59 from "node:path";
|
|
51806
51889
|
|
|
51807
51890
|
// ../core/dist/world/state.js
|
|
@@ -52025,8 +52108,8 @@ import * as fs51 from "node:fs";
|
|
|
52025
52108
|
import * as path50 from "node:path";
|
|
52026
52109
|
|
|
52027
52110
|
// ../core/dist/kg/storage-paths.js
|
|
52028
|
-
import { homedir as
|
|
52029
|
-
import { join as
|
|
52111
|
+
import { homedir as homedir26 } from "node:os";
|
|
52112
|
+
import { join as join53, resolve as resolve11 } from "node:path";
|
|
52030
52113
|
|
|
52031
52114
|
// ../core/dist/world/workspace-name.js
|
|
52032
52115
|
var InvalidWorkspaceNameError = class extends Error {
|
|
@@ -52046,14 +52129,14 @@ function validateWorkspaceName(name) {
|
|
|
52046
52129
|
}
|
|
52047
52130
|
|
|
52048
52131
|
// ../core/dist/kg/storage-paths.js
|
|
52049
|
-
function
|
|
52050
|
-
return process.env.OLAM_HOME ??
|
|
52132
|
+
function olamHome3() {
|
|
52133
|
+
return process.env.OLAM_HOME ?? join53(homedir26(), ".olam");
|
|
52051
52134
|
}
|
|
52052
52135
|
function kgRoot() {
|
|
52053
|
-
return
|
|
52136
|
+
return join53(olamHome3(), "kg");
|
|
52054
52137
|
}
|
|
52055
52138
|
function worldsRoot() {
|
|
52056
|
-
return
|
|
52139
|
+
return join53(olamHome3(), "worlds");
|
|
52057
52140
|
}
|
|
52058
52141
|
function assertWithinPrefix(path62, prefix, label) {
|
|
52059
52142
|
if (!path62.startsWith(prefix + "/")) {
|
|
@@ -52063,12 +52146,12 @@ function assertWithinPrefix(path62, prefix, label) {
|
|
|
52063
52146
|
function kgPristinePath(workspace) {
|
|
52064
52147
|
validateWorkspaceName(workspace);
|
|
52065
52148
|
const root = kgRoot();
|
|
52066
|
-
const path62 = resolve11(
|
|
52149
|
+
const path62 = resolve11(join53(root, workspace));
|
|
52067
52150
|
assertWithinPrefix(path62, root, "kgPristinePath");
|
|
52068
52151
|
return path62;
|
|
52069
52152
|
}
|
|
52070
52153
|
var KG_PATHS_INTERNALS = Object.freeze({
|
|
52071
|
-
olamHome:
|
|
52154
|
+
olamHome: olamHome3,
|
|
52072
52155
|
kgRoot,
|
|
52073
52156
|
worldsRoot
|
|
52074
52157
|
});
|
|
@@ -52161,11 +52244,11 @@ function createWorldOverlay(opts) {
|
|
|
52161
52244
|
// ../core/dist/world/baseline-diff.js
|
|
52162
52245
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
52163
52246
|
import * as fs52 from "node:fs";
|
|
52164
|
-
import * as
|
|
52247
|
+
import * as os26 from "node:os";
|
|
52165
52248
|
import * as path51 from "node:path";
|
|
52166
52249
|
var DEFAULT_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
|
|
52167
|
-
function expandHome2(p,
|
|
52168
|
-
return p.replace(/^~(?=$|\/|\\)/,
|
|
52250
|
+
function expandHome2(p, homedir33) {
|
|
52251
|
+
return p.replace(/^~(?=$|\/|\\)/, homedir33());
|
|
52169
52252
|
}
|
|
52170
52253
|
function sanitizeRepoFilename(name) {
|
|
52171
52254
|
const sanitized = name.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
@@ -52188,7 +52271,7 @@ ${stderr}`;
|
|
|
52188
52271
|
}
|
|
52189
52272
|
function snapshotBaselineDiff(repos, workspacePath, deps = {}) {
|
|
52190
52273
|
const exec = deps.exec ?? ((cmd, args, opts) => execFileSync7(cmd, args, opts));
|
|
52191
|
-
const
|
|
52274
|
+
const homedir33 = deps.homedir ?? (() => os26.homedir());
|
|
52192
52275
|
const baselineDir = path51.join(workspacePath, ".olam", "baseline");
|
|
52193
52276
|
try {
|
|
52194
52277
|
fs52.mkdirSync(baselineDir, { recursive: true });
|
|
@@ -52204,7 +52287,7 @@ function snapshotBaselineDiff(repos, workspacePath, deps = {}) {
|
|
|
52204
52287
|
continue;
|
|
52205
52288
|
const filename = `${sanitizeRepoFilename(repo.name)}.diff`;
|
|
52206
52289
|
const outPath = path51.join(baselineDir, filename);
|
|
52207
|
-
const repoPath = expandHome2(repo.path,
|
|
52290
|
+
const repoPath = expandHome2(repo.path, homedir33);
|
|
52208
52291
|
if (!fs52.existsSync(repoPath)) {
|
|
52209
52292
|
writeBaselineFile(outPath, `# repo: ${repo.name}
|
|
52210
52293
|
# (skipped: path ${repoPath} does not exist)
|
|
@@ -52340,7 +52423,7 @@ function extractStderr(err) {
|
|
|
52340
52423
|
}
|
|
52341
52424
|
function carryUncommittedEdits(repos, workspacePath, deps = {}) {
|
|
52342
52425
|
const exec = deps.exec ?? ((cmd, args, opts) => execFileSync7(cmd, args, opts));
|
|
52343
|
-
const
|
|
52426
|
+
const homedir33 = deps.homedir ?? (() => os26.homedir());
|
|
52344
52427
|
const existsSync61 = deps.existsSync ?? ((p) => fs52.existsSync(p));
|
|
52345
52428
|
const copyFileSync10 = deps.copyFileSync ?? ((src, dest) => fs52.copyFileSync(src, dest));
|
|
52346
52429
|
const mkdirSync34 = deps.mkdirSync ?? ((dirPath, opts) => {
|
|
@@ -52350,7 +52433,7 @@ function carryUncommittedEdits(repos, workspacePath, deps = {}) {
|
|
|
52350
52433
|
for (const repo of repos) {
|
|
52351
52434
|
if (!repo.path)
|
|
52352
52435
|
continue;
|
|
52353
|
-
const repoPath = expandHome2(repo.path,
|
|
52436
|
+
const repoPath = expandHome2(repo.path, homedir33);
|
|
52354
52437
|
const worktreePath = path51.join(workspacePath, repo.name);
|
|
52355
52438
|
if (!existsSync61(repoPath))
|
|
52356
52439
|
continue;
|
|
@@ -52454,10 +52537,10 @@ var WORLD_CLAUDE_MD = '# Olam World: {{worldName}}\n\n{{taskBlock}}\n\n## Enviro
|
|
|
52454
52537
|
// ../core/dist/world/context-injection.js
|
|
52455
52538
|
function injectWorldContext(opts) {
|
|
52456
52539
|
const { world } = opts;
|
|
52457
|
-
const
|
|
52458
|
-
fs53.mkdirSync(
|
|
52540
|
+
const claudeDir3 = path52.join(world.workspacePath, ".claude");
|
|
52541
|
+
fs53.mkdirSync(claudeDir3, { recursive: true });
|
|
52459
52542
|
const content = WORLD_CLAUDE_MD.replace("{{worldName}}", world.name).replace("{{worldId}}", world.id).replace("{{branch}}", world.branch).replace("{{taskBlock}}", buildTaskBlock(opts)).replace("{{reposList}}", buildReposList(world)).replace("{{servicesLine}}", buildServicesLine(opts.services)).replace("{{pleriPlaneLine}}", buildPleriPlaneLine(opts.pleriPlaneUrl)).replace("{{planFileBlock}}", buildPlanFileBlock(world)).replace("{{extraContextBlock}}", buildExtraContextBlock(opts.claudeMdExtra));
|
|
52460
|
-
fs53.writeFileSync(path52.join(
|
|
52543
|
+
fs53.writeFileSync(path52.join(claudeDir3, "CLAUDE.md"), content);
|
|
52461
52544
|
writeOlamDocs(world.workspacePath);
|
|
52462
52545
|
}
|
|
52463
52546
|
function buildTaskBlock(opts) {
|
|
@@ -53120,12 +53203,12 @@ init_repo_manifest();
|
|
|
53120
53203
|
// ../core/dist/world/snapshot.js
|
|
53121
53204
|
import * as crypto7 from "node:crypto";
|
|
53122
53205
|
import * as fs54 from "node:fs";
|
|
53123
|
-
import * as
|
|
53206
|
+
import * as os27 from "node:os";
|
|
53124
53207
|
import * as path53 from "node:path";
|
|
53125
53208
|
import { execFileSync as execFileSync8, spawn as spawn5 } from "node:child_process";
|
|
53126
53209
|
import { gunzipSync } from "node:zlib";
|
|
53127
53210
|
function snapshotsDir() {
|
|
53128
|
-
return process.env["OLAM_SNAPSHOTS_DIR"] ?? path53.join(
|
|
53211
|
+
return process.env["OLAM_SNAPSHOTS_DIR"] ?? path53.join(os27.homedir(), ".olam", "snapshots");
|
|
53129
53212
|
}
|
|
53130
53213
|
function snapshotKindDirByWorkspace(workspace, arch, kind) {
|
|
53131
53214
|
return path53.join(snapshotsDir(), "by-workspace", workspace, arch, kind);
|
|
@@ -53850,7 +53933,7 @@ async function autoDispatchTask(opts) {
|
|
|
53850
53933
|
|
|
53851
53934
|
// ../core/dist/world/wiki-injection-loader.js
|
|
53852
53935
|
import * as fs56 from "node:fs";
|
|
53853
|
-
import * as
|
|
53936
|
+
import * as os28 from "node:os";
|
|
53854
53937
|
import * as path56 from "node:path";
|
|
53855
53938
|
var WIKI_INJECTION_FLAG = "OLAM_WIKI_INJECTION";
|
|
53856
53939
|
var WIKI_PATH_ENV = "OLAM_WIKI_PATH";
|
|
@@ -53864,7 +53947,7 @@ function wikiBlobPath() {
|
|
|
53864
53947
|
const override = process.env[WIKI_PATH_ENV];
|
|
53865
53948
|
if (override && override.length > 0)
|
|
53866
53949
|
return override;
|
|
53867
|
-
return path56.join(
|
|
53950
|
+
return path56.join(os28.homedir(), ".olam", "wiki.json");
|
|
53868
53951
|
}
|
|
53869
53952
|
function defaultReadBlob() {
|
|
53870
53953
|
const p = wikiBlobPath();
|
|
@@ -53911,11 +53994,11 @@ init_bridge();
|
|
|
53911
53994
|
|
|
53912
53995
|
// ../core/dist/global-config/runbook-resolver.js
|
|
53913
53996
|
import * as fs57 from "node:fs";
|
|
53914
|
-
import * as
|
|
53997
|
+
import * as os29 from "node:os";
|
|
53915
53998
|
import * as path57 from "node:path";
|
|
53916
53999
|
function expandTilde(p) {
|
|
53917
54000
|
if (p === "~" || p.startsWith("~/")) {
|
|
53918
|
-
return path57.join(
|
|
54001
|
+
return path57.join(os29.homedir(), p.slice(1));
|
|
53919
54002
|
}
|
|
53920
54003
|
return p;
|
|
53921
54004
|
}
|
|
@@ -54658,7 +54741,7 @@ ${detail}`);
|
|
|
54658
54741
|
runbookSeeds = resolved.seeds;
|
|
54659
54742
|
}
|
|
54660
54743
|
const worldId = generateWorldId();
|
|
54661
|
-
const workspacePath = path59.join(
|
|
54744
|
+
const workspacePath = path59.join(os30.homedir(), ".olam", "worlds", worldId);
|
|
54662
54745
|
const portOffset = this.registry.getNextPortOffset();
|
|
54663
54746
|
const branch = opts.branchName ?? `olam/${worldId}`;
|
|
54664
54747
|
const repos = await this.resolveReposWithWorkspace(opts);
|
|
@@ -54740,7 +54823,7 @@ ${detail}`);
|
|
|
54740
54823
|
for (const repo of repos) {
|
|
54741
54824
|
if (!repo.path)
|
|
54742
54825
|
continue;
|
|
54743
|
-
const sourceRoot = repo.path.replace(/^~/,
|
|
54826
|
+
const sourceRoot = repo.path.replace(/^~/, os30.homedir());
|
|
54744
54827
|
const worktreeRoot = path59.join(workspacePath, repo.name);
|
|
54745
54828
|
if (!fs59.existsSync(sourceRoot) || !fs59.existsSync(worktreeRoot))
|
|
54746
54829
|
continue;
|
|
@@ -54956,7 +55039,7 @@ ${detail}`);
|
|
|
54956
55039
|
const worldEnv = {};
|
|
54957
55040
|
if (opts.task)
|
|
54958
55041
|
worldEnv.OLAM_TASK = opts.task;
|
|
54959
|
-
const r2CredsPath = path59.join(
|
|
55042
|
+
const r2CredsPath = path59.join(os30.homedir(), ".olam", "r2-credentials.json");
|
|
54960
55043
|
if (fs59.existsSync(r2CredsPath)) {
|
|
54961
55044
|
try {
|
|
54962
55045
|
const r2Raw = fs59.readFileSync(r2CredsPath, "utf-8").trim();
|
|
@@ -54976,7 +55059,7 @@ ${detail}`);
|
|
|
54976
55059
|
} catch {
|
|
54977
55060
|
}
|
|
54978
55061
|
}
|
|
54979
|
-
const keysYamlPath = path59.join(
|
|
55062
|
+
const keysYamlPath = path59.join(os30.homedir(), ".olam", "keys.yaml");
|
|
54980
55063
|
if (fs59.existsSync(keysYamlPath)) {
|
|
54981
55064
|
try {
|
|
54982
55065
|
const keysRaw = fs59.readFileSync(keysYamlPath, "utf-8").trim();
|
|
@@ -56844,9 +56927,9 @@ function createDashboardServer(opts) {
|
|
|
56844
56927
|
|
|
56845
56928
|
// ../core/dist/dashboard/state.js
|
|
56846
56929
|
import * as fs61 from "node:fs";
|
|
56847
|
-
import * as
|
|
56930
|
+
import * as os31 from "node:os";
|
|
56848
56931
|
import * as path61 from "node:path";
|
|
56849
|
-
var STATE_PATH = path61.join(
|
|
56932
|
+
var STATE_PATH = path61.join(os31.homedir(), ".olam", "dashboard.json");
|
|
56850
56933
|
function saveDashboardState(state) {
|
|
56851
56934
|
fs61.mkdirSync(path61.dirname(STATE_PATH), { recursive: true });
|
|
56852
56935
|
fs61.writeFileSync(STATE_PATH, JSON.stringify(state, null, 2));
|
|
@@ -57141,8 +57224,8 @@ var PleriClient = class {
|
|
|
57141
57224
|
};
|
|
57142
57225
|
|
|
57143
57226
|
// ../mcp-server/src/env-loader.ts
|
|
57144
|
-
import { readFileSync as readFileSync47, existsSync as existsSync60, statSync as
|
|
57145
|
-
import { join as
|
|
57227
|
+
import { readFileSync as readFileSync47, existsSync as existsSync60, statSync as statSync16 } from "node:fs";
|
|
57228
|
+
import { join as join65, dirname as dirname31, resolve as resolve15 } from "node:path";
|
|
57146
57229
|
var PROJECT_MARKERS = [
|
|
57147
57230
|
".olam/config.yaml",
|
|
57148
57231
|
".olam/config.yml",
|
|
@@ -57154,9 +57237,9 @@ function findProjectRoot2(startDir) {
|
|
|
57154
57237
|
const root = resolve15("/");
|
|
57155
57238
|
while (true) {
|
|
57156
57239
|
for (const marker of PROJECT_MARKERS) {
|
|
57157
|
-
if (existsSync60(
|
|
57240
|
+
if (existsSync60(join65(dir, marker))) return dir;
|
|
57158
57241
|
}
|
|
57159
|
-
const pkg =
|
|
57242
|
+
const pkg = join65(dir, "package.json");
|
|
57160
57243
|
if (existsSync60(pkg)) {
|
|
57161
57244
|
try {
|
|
57162
57245
|
const json2 = JSON.parse(readFileSync47(pkg, "utf8"));
|
|
@@ -57196,8 +57279,8 @@ function loadProjectEnv(startDir = process.cwd()) {
|
|
|
57196
57279
|
const filesRead = [];
|
|
57197
57280
|
const merged = {};
|
|
57198
57281
|
for (const name of [".env", ".env.local"]) {
|
|
57199
|
-
const p =
|
|
57200
|
-
if (existsSync60(p) &&
|
|
57282
|
+
const p = join65(root, name);
|
|
57283
|
+
if (existsSync60(p) && statSync16(p).isFile()) {
|
|
57201
57284
|
Object.assign(merged, parseEnvFile(p));
|
|
57202
57285
|
filesRead.push(p);
|
|
57203
57286
|
}
|
|
@@ -57272,6 +57355,13 @@ async function main() {
|
|
|
57272
57355
|
const transport = new StdioServerTransport();
|
|
57273
57356
|
await server.connect(transport);
|
|
57274
57357
|
logger.info("Olam MCP server running on stdio transport");
|
|
57358
|
+
const shutdown = (reason) => {
|
|
57359
|
+
logger.info("Olam MCP client disconnected; shutting down", { reason });
|
|
57360
|
+
process.exit(0);
|
|
57361
|
+
};
|
|
57362
|
+
process.stdin.once("end", () => shutdown("stdin end"));
|
|
57363
|
+
process.stdin.once("close", () => shutdown("stdin close"));
|
|
57364
|
+
process.stdin.resume();
|
|
57275
57365
|
}
|
|
57276
57366
|
main().catch((error51) => {
|
|
57277
57367
|
logger.error("Fatal error starting Olam MCP server", {
|