overlord-cli 0.2610201032.0 → 0.2610231436.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connectors/VERSION +1 -1
- package/dist/connectors/adapters/antigravity/conformance-manifest.yaml +1 -1
- package/dist/connectors/adapters/antigravity/plugin.json +1 -1
- package/dist/connectors/adapters/claude/.claude-plugin/plugin.json +1 -1
- package/dist/connectors/adapters/claude/conformance-manifest.yaml +1 -1
- package/dist/connectors/adapters/codex/.codex-plugin/plugin.json +1 -1
- package/dist/connectors/adapters/codex/conformance-manifest.yaml +1 -1
- package/dist/connectors/adapters/cursor/.cursor-plugin/plugin.json +1 -1
- package/dist/connectors/adapters/cursor/conformance-manifest.yaml +1 -1
- package/dist/connectors/adapters/opencode/conformance-manifest.yaml +1 -1
- package/dist/connectors/adapters/pi/conformance-manifest.yaml +1 -1
- package/dist/connectors/core/README.md +5 -2
- package/dist/connectors/core/scripts/overlord-mcp.mjs +1073 -424
- package/dist/index.js +1210 -1195
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -471,6 +471,557 @@ var init_update = __esm({
|
|
|
471
471
|
}
|
|
472
472
|
});
|
|
473
473
|
|
|
474
|
+
// src/prompt.ts
|
|
475
|
+
async function promptLine({
|
|
476
|
+
message,
|
|
477
|
+
defaultValue,
|
|
478
|
+
nonInteractiveMessage
|
|
479
|
+
}) {
|
|
480
|
+
if (!process.stdin.isTTY) {
|
|
481
|
+
throw new CliError({ message: nonInteractiveMessage });
|
|
482
|
+
}
|
|
483
|
+
const { createInterface: createInterface3 } = await import("node:readline/promises");
|
|
484
|
+
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
485
|
+
try {
|
|
486
|
+
const suffix = defaultValue ? ` [${defaultValue}]` : "";
|
|
487
|
+
const answer = await rl.question(`${message}${suffix}: `);
|
|
488
|
+
return answer.trim() || defaultValue || "";
|
|
489
|
+
} finally {
|
|
490
|
+
rl.close();
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
var init_prompt = __esm({
|
|
494
|
+
"src/prompt.ts"() {
|
|
495
|
+
"use strict";
|
|
496
|
+
init_errors();
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
// ../database/dist/better-sqlite3-loader.js
|
|
501
|
+
var init_better_sqlite3_loader = __esm({
|
|
502
|
+
"../database/dist/better-sqlite3-loader.js"() {
|
|
503
|
+
"use strict";
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
// ../database/dist/constants.js
|
|
508
|
+
var init_constants = __esm({
|
|
509
|
+
"../database/dist/constants.js"() {
|
|
510
|
+
"use strict";
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// ../database/dist/ext-everhour-migration-runtime.js
|
|
515
|
+
var init_ext_everhour_migration_runtime = __esm({
|
|
516
|
+
"../database/dist/ext-everhour-migration-runtime.js"() {
|
|
517
|
+
"use strict";
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
// ../database/dist/local-paths.js
|
|
522
|
+
import os from "node:os";
|
|
523
|
+
import path2 from "node:path";
|
|
524
|
+
function resolveGlobalDataDir() {
|
|
525
|
+
const override = process.env.OVLD_HOME?.trim();
|
|
526
|
+
if (override)
|
|
527
|
+
return path2.resolve(override);
|
|
528
|
+
return path2.join(os.homedir(), GLOBAL_DATA_DIR_NAME);
|
|
529
|
+
}
|
|
530
|
+
function resolveGlobalDatabasePath() {
|
|
531
|
+
return path2.join(resolveGlobalDataDir(), GLOBAL_DATABASE_FILENAME);
|
|
532
|
+
}
|
|
533
|
+
var LOCAL_DATA_DIR, LOCAL_STORAGE_DIR, GLOBAL_DATA_DIR_NAME, GLOBAL_DATABASE_FILENAME;
|
|
534
|
+
var init_local_paths = __esm({
|
|
535
|
+
"../database/dist/local-paths.js"() {
|
|
536
|
+
"use strict";
|
|
537
|
+
LOCAL_DATA_DIR = "database/.local";
|
|
538
|
+
LOCAL_STORAGE_DIR = `${LOCAL_DATA_DIR}/storage`;
|
|
539
|
+
GLOBAL_DATA_DIR_NAME = ".ovld";
|
|
540
|
+
GLOBAL_DATABASE_FILENAME = "Overlord.sqlite";
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
// ../database/dist/migration-ledger.js
|
|
545
|
+
var init_migration_ledger = __esm({
|
|
546
|
+
"../database/dist/migration-ledger.js"() {
|
|
547
|
+
"use strict";
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
// ../database/dist/migration-files.js
|
|
552
|
+
var init_migration_files = __esm({
|
|
553
|
+
"../database/dist/migration-files.js"() {
|
|
554
|
+
"use strict";
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
// ../database/dist/next-status-type-migration-runtime.js
|
|
559
|
+
var init_next_status_type_migration_runtime = __esm({
|
|
560
|
+
"../database/dist/next-status-type-migration-runtime.js"() {
|
|
561
|
+
"use strict";
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
// ../packages/contract/dist/agent-launch-flags.js
|
|
566
|
+
function parseAgentLaunchFlagText(text) {
|
|
567
|
+
const trimmed7 = text.trim();
|
|
568
|
+
if (!trimmed7)
|
|
569
|
+
return null;
|
|
570
|
+
const eqIndex = trimmed7.indexOf("=");
|
|
571
|
+
if (eqIndex > 0 && trimmed7.startsWith("--")) {
|
|
572
|
+
const name = trimmed7.slice(0, eqIndex).trim();
|
|
573
|
+
const value2 = trimmed7.slice(eqIndex + 1).trim();
|
|
574
|
+
return name ? { name, value: value2.length > 0 ? value2 : null } : null;
|
|
575
|
+
}
|
|
576
|
+
const spaceIndex = trimmed7.indexOf(" ");
|
|
577
|
+
if (spaceIndex > 0 && trimmed7.startsWith("--")) {
|
|
578
|
+
const name = trimmed7.slice(0, spaceIndex).trim();
|
|
579
|
+
const value2 = trimmed7.slice(spaceIndex + 1).trim();
|
|
580
|
+
return name ? { name, value: value2.length > 0 ? value2 : null } : null;
|
|
581
|
+
}
|
|
582
|
+
return { name: trimmed7 };
|
|
583
|
+
}
|
|
584
|
+
function normalizeAgentLaunchFlags(input) {
|
|
585
|
+
if (!Array.isArray(input))
|
|
586
|
+
return [];
|
|
587
|
+
const flags = [];
|
|
588
|
+
for (const item of input) {
|
|
589
|
+
if (typeof item === "string") {
|
|
590
|
+
const parsed = parseAgentLaunchFlagText(item);
|
|
591
|
+
if (parsed)
|
|
592
|
+
flags.push(parsed);
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
if (!item || typeof item !== "object")
|
|
596
|
+
continue;
|
|
597
|
+
const record2 = item;
|
|
598
|
+
if (typeof record2.name !== "string")
|
|
599
|
+
continue;
|
|
600
|
+
const name = record2.name.trim();
|
|
601
|
+
if (!name)
|
|
602
|
+
continue;
|
|
603
|
+
const value2 = typeof record2.value === "string" ? record2.value.trim() || null : null;
|
|
604
|
+
flags.push({ name, value: value2 });
|
|
605
|
+
}
|
|
606
|
+
return flags;
|
|
607
|
+
}
|
|
608
|
+
function agentLaunchFlagsToArgv(flags) {
|
|
609
|
+
const argv = [];
|
|
610
|
+
for (const flag of flags) {
|
|
611
|
+
const name = flag.name.trim();
|
|
612
|
+
if (!name)
|
|
613
|
+
continue;
|
|
614
|
+
argv.push(name);
|
|
615
|
+
const value2 = flag.value?.trim();
|
|
616
|
+
if (value2) {
|
|
617
|
+
argv.push(value2);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return argv;
|
|
621
|
+
}
|
|
622
|
+
var init_agent_launch_flags = __esm({
|
|
623
|
+
"../packages/contract/dist/agent-launch-flags.js"() {
|
|
624
|
+
"use strict";
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
// ../packages/contract/dist/base-url.js
|
|
629
|
+
function normalizeBaseUrl(value2) {
|
|
630
|
+
return value2.replace(/\/+$/, "");
|
|
631
|
+
}
|
|
632
|
+
var init_base_url = __esm({
|
|
633
|
+
"../packages/contract/dist/base-url.js"() {
|
|
634
|
+
"use strict";
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
// ../packages/contract/dist/chat.js
|
|
639
|
+
var CHAT_DEFAULT_LIMITS, REPOSITORY_READ_DEFAULT_BOUNDS;
|
|
640
|
+
var init_chat = __esm({
|
|
641
|
+
"../packages/contract/dist/chat.js"() {
|
|
642
|
+
"use strict";
|
|
643
|
+
CHAT_DEFAULT_LIMITS = {
|
|
644
|
+
/** Fixed invariant, not configurable. */
|
|
645
|
+
unfinishedRunsPerThread: 1,
|
|
646
|
+
concurrentRunsPerOwner: 3,
|
|
647
|
+
toolCallsPerRun: 60,
|
|
648
|
+
/** Active processing, excluding time spent in `waiting_user`. */
|
|
649
|
+
activeProcessingMsPerRun: 10 * 60 * 1e3,
|
|
650
|
+
concurrentTargetReadsPerRun: 4,
|
|
651
|
+
/** Renewable worker lease on an attempt. */
|
|
652
|
+
attemptLeaseMs: 30 * 1e3,
|
|
653
|
+
/** Notification grace period before a candidate becomes due. */
|
|
654
|
+
notificationGraceMs: 5 * 1e3,
|
|
655
|
+
/** Foreground presence expiry; clients renew before it lapses. */
|
|
656
|
+
presenceTtlMs: 30 * 1e3,
|
|
657
|
+
/** Event replay retention: whichever bound is reached first advances the boundary. */
|
|
658
|
+
eventRetentionMs: 7 * 24 * 60 * 60 * 1e3,
|
|
659
|
+
eventRetentionCount: 5e3,
|
|
660
|
+
/** Bounded sanitized title used in notifications and lists. */
|
|
661
|
+
titleMaxChars: 80,
|
|
662
|
+
messageMaxChars: 16e3
|
|
663
|
+
};
|
|
664
|
+
REPOSITORY_READ_DEFAULT_BOUNDS = {
|
|
665
|
+
readFileBytes: 64 * 1024,
|
|
666
|
+
diffBytes: 128 * 1024,
|
|
667
|
+
searchBytes: 128 * 1024,
|
|
668
|
+
searchHits: 100,
|
|
669
|
+
timeoutMs: 30 * 1e3,
|
|
670
|
+
/** Per-Git-call budget on the target, below the queue deadline. */
|
|
671
|
+
targetCommandTimeoutMs: 20 * 1e3,
|
|
672
|
+
/** Files larger than this answer `oversized` with metadata only. */
|
|
673
|
+
readFileCeilingBytes: 8 * 1024 * 1024,
|
|
674
|
+
treeEntries: 500,
|
|
675
|
+
treeEntriesMax: 2e3,
|
|
676
|
+
statusEntriesPerClass: 1e3,
|
|
677
|
+
searchLineChars: 400,
|
|
678
|
+
searchQueryChars: 256,
|
|
679
|
+
diffPaths: 50,
|
|
680
|
+
concurrentReadsPerScope: 4
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
// ../packages/contract/dist/launch-variables.js
|
|
686
|
+
var LAUNCH_VARIABLES, LAUNCH_VARIABLE_NAMES;
|
|
687
|
+
var init_launch_variables = __esm({
|
|
688
|
+
"../packages/contract/dist/launch-variables.js"() {
|
|
689
|
+
"use strict";
|
|
690
|
+
LAUNCH_VARIABLES = [
|
|
691
|
+
{
|
|
692
|
+
name: "MISSION_ID",
|
|
693
|
+
description: "Mission display id for the launch (e.g. coo:359).",
|
|
694
|
+
example: "coo:359",
|
|
695
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
name: "OVERLORD_MISSION_ID",
|
|
699
|
+
description: "Same value as MISSION_ID \u2014 preferred Overlord-prefixed form.",
|
|
700
|
+
example: "coo:359",
|
|
701
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
name: "OVERLORD_OBJECTIVE_ID",
|
|
705
|
+
description: "Objective display id for the launch (e.g. coo:359.k7xm). Used to pin protocol attach.",
|
|
706
|
+
example: "coo:359.k7xm",
|
|
707
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
name: "OVERLORD_BACKEND_URL",
|
|
711
|
+
description: "Backend URL the agent CLI/MCP should call for this launch.",
|
|
712
|
+
example: "http://127.0.0.1:4310",
|
|
713
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
name: "OVERLORD_EXECUTION_REQUEST_ID",
|
|
717
|
+
description: "Execution-request id when the launch is runner-driven. Empty/absent for a bare `ovld launch`.",
|
|
718
|
+
example: "380e8a6a-ccf0-49f4-9761-f1c0ba02c39c",
|
|
719
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
name: "OVERLORD_WORKING_DIRECTORY",
|
|
723
|
+
description: "Absolute path the agent terminal cds into \u2014 the resolved execution-target checkout (or worktree).",
|
|
724
|
+
example: "/Users/you/src/overlord",
|
|
725
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
name: "OVERLORD_CONTEXT_FILE",
|
|
729
|
+
description: "Absolute path to the markdown briefing written for this launch under `.overlord/tmp/`.",
|
|
730
|
+
example: "/Users/you/src/overlord/.overlord/tmp/mission-coo-359.md",
|
|
731
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
name: "OVERLORD_TMPDIR",
|
|
735
|
+
description: "Private scratch directory for this launch (`.overlord/tmp/sessions/<objective>-<request>/`). Removed automatically when the session delivers; orphaned ones expire after 24h. Also mirrored as TMPDIR/TMP/TEMP.",
|
|
736
|
+
example: "/Users/you/src/overlord/.overlord/tmp/sessions/objective-coo-359-k7xm-4f1c",
|
|
737
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
name: "TMPDIR",
|
|
741
|
+
description: "Same path as OVERLORD_TMPDIR \u2014 standard temp-dir env name.",
|
|
742
|
+
example: "/Users/you/src/overlord/.overlord/tmp/sessions/objective-coo-359-k7xm-4f1c",
|
|
743
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
name: "TMP",
|
|
747
|
+
description: "Same path as OVERLORD_TMPDIR \u2014 Windows-style temp-dir alias.",
|
|
748
|
+
example: "/Users/you/src/overlord/.overlord/tmp/sessions/objective-coo-359-k7xm-4f1c",
|
|
749
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
name: "TEMP",
|
|
753
|
+
description: "Same path as OVERLORD_TMPDIR \u2014 Windows-style temp-dir alias.",
|
|
754
|
+
example: "/Users/you/src/overlord/.overlord/tmp/sessions/objective-coo-359-k7xm-4f1c",
|
|
755
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
name: "OVERLORD_PROJECT_RESOURCES",
|
|
759
|
+
description: "JSON array of every project resource for this execution target (resourceKey, path, state, flags, accessMode). Set only when the project has resources.",
|
|
760
|
+
example: '[{"resourceKey":"primary","path":"/repo/a","state":"ready","isPrimary":true,"accessMode":"read_write"}]',
|
|
761
|
+
availableAt: ["plan_build", "terminal_env"],
|
|
762
|
+
format: "JSON array"
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
name: "OVERLORD_PROJECT_RESOURCES_PATHS",
|
|
766
|
+
description: "Comma-separated absolute paths of connected project resources with explicit `:rw` or `:ro` permission suffixes (entries without a local path are omitted). `read_write` resources emit `:rw`; reference (`read`) resources emit `:ro`.",
|
|
767
|
+
example: "/repo/a:rw,/repo/b:ro",
|
|
768
|
+
availableAt: ["plan_build", "terminal_env"],
|
|
769
|
+
format: "comma-separated paths with :rw/:ro suffix"
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
name: "OVERLORD_PROJECT_RESOURCES_PATHS_CSV",
|
|
773
|
+
description: "Alias of OVERLORD_PROJECT_RESOURCES_PATHS, kept for backward compatibility. Same comma-separated `:rw`/`:ro`-suffixed paths. Useful for env vars that expect a CSV list (e.g. AGENT_POD_EXTRA_ALLOWED_PATHS).",
|
|
774
|
+
example: "/repo/a:rw,/repo/b:ro",
|
|
775
|
+
availableAt: ["plan_build", "terminal_env"],
|
|
776
|
+
format: "comma-separated paths with :rw/:ro suffix"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
name: "OVERLORD_PRIMARY_RESOURCE_PATH",
|
|
780
|
+
description: "Absolute path of the primary (or else current) project resource when connected locally; empty string otherwise.",
|
|
781
|
+
example: "/repo/a",
|
|
782
|
+
availableAt: ["plan_build", "terminal_env"]
|
|
783
|
+
}
|
|
784
|
+
];
|
|
785
|
+
LAUNCH_VARIABLE_NAMES = LAUNCH_VARIABLES.filter((variable) => variable.availableAt.includes("plan_build")).map((variable) => variable.name);
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
// ../packages/contract/dist/mission-reference.js
|
|
790
|
+
var init_mission_reference = __esm({
|
|
791
|
+
"../packages/contract/dist/mission-reference.js"() {
|
|
792
|
+
"use strict";
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
// ../packages/contract/dist/mission-search.js
|
|
797
|
+
var init_mission_search = __esm({
|
|
798
|
+
"../packages/contract/dist/mission-search.js"() {
|
|
799
|
+
"use strict";
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
// ../packages/contract/dist/notifications.js
|
|
804
|
+
var init_notifications = __esm({
|
|
805
|
+
"../packages/contract/dist/notifications.js"() {
|
|
806
|
+
"use strict";
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
|
|
810
|
+
// ../packages/contract/dist/objective-ref.js
|
|
811
|
+
function parseObjectiveRef(ref) {
|
|
812
|
+
const trimmed7 = ref.trim();
|
|
813
|
+
if (trimmed7.length === 0)
|
|
814
|
+
return { kind: "unknown", ref: trimmed7 };
|
|
815
|
+
if (UUID_RE.test(trimmed7))
|
|
816
|
+
return { kind: "uuid", id: trimmed7.toLowerCase() };
|
|
817
|
+
const display = DISPLAY_ID_RE.exec(trimmed7);
|
|
818
|
+
if (display) {
|
|
819
|
+
return {
|
|
820
|
+
kind: "display_id",
|
|
821
|
+
missionDisplayId: `${display[1]}:${display[2]}`,
|
|
822
|
+
displayKey: display[3].toLowerCase()
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
if (WRONG_SEPARATOR_COLON_RE.test(trimmed7)) {
|
|
826
|
+
return { kind: "wrong_separator", separator: ":", ref: trimmed7 };
|
|
827
|
+
}
|
|
828
|
+
if (WRONG_SEPARATOR_PIPE_RE.test(trimmed7)) {
|
|
829
|
+
return { kind: "wrong_separator", separator: "|", ref: trimmed7 };
|
|
830
|
+
}
|
|
831
|
+
if (WRONG_SEPARATOR_HYPHEN_RE.test(trimmed7)) {
|
|
832
|
+
return { kind: "wrong_separator", separator: "-", ref: trimmed7 };
|
|
833
|
+
}
|
|
834
|
+
if (MISSION_DISPLAY_ID_RE.test(trimmed7)) {
|
|
835
|
+
return { kind: "mission_id", missionDisplayId: trimmed7 };
|
|
836
|
+
}
|
|
837
|
+
if (BARE_KEY_RE.test(trimmed7)) {
|
|
838
|
+
return { kind: "display_key", displayKey: trimmed7.toLowerCase() };
|
|
839
|
+
}
|
|
840
|
+
return { kind: "unknown", ref: trimmed7 };
|
|
841
|
+
}
|
|
842
|
+
function missionDisplayIdFromObjectiveRef(ref) {
|
|
843
|
+
if (typeof ref !== "string" || ref.trim() === "")
|
|
844
|
+
return null;
|
|
845
|
+
const parsed = parseObjectiveRef(ref);
|
|
846
|
+
return parsed.kind === "display_id" ? parsed.missionDisplayId : null;
|
|
847
|
+
}
|
|
848
|
+
var UUID_RE, KEY_BODY, DISPLAY_ID_RE, MISSION_DISPLAY_ID_RE, WRONG_SEPARATOR_COLON_RE, WRONG_SEPARATOR_PIPE_RE, WRONG_SEPARATOR_HYPHEN_RE, BARE_KEY_RE;
|
|
849
|
+
var init_objective_ref = __esm({
|
|
850
|
+
"../packages/contract/dist/objective-ref.js"() {
|
|
851
|
+
"use strict";
|
|
852
|
+
UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
853
|
+
KEY_BODY = "[0-9a-hjkmnp-tv-z]{4,5}";
|
|
854
|
+
DISPLAY_ID_RE = new RegExp(`^(.+):(\\d+)\\.(${KEY_BODY})$`, "i");
|
|
855
|
+
MISSION_DISPLAY_ID_RE = /^([a-z0-9-]+):(\d+)$/i;
|
|
856
|
+
WRONG_SEPARATOR_COLON_RE = new RegExp(`^(.+):(\\d+):(${KEY_BODY})$`, "i");
|
|
857
|
+
WRONG_SEPARATOR_PIPE_RE = new RegExp(`^(.+):(\\d+)\\|(${KEY_BODY})$`, "i");
|
|
858
|
+
WRONG_SEPARATOR_HYPHEN_RE = new RegExp(`^(.+):(\\d+)-(${KEY_BODY})$`, "i");
|
|
859
|
+
BARE_KEY_RE = new RegExp(`^${KEY_BODY}$`, "i");
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
// ../packages/contract/dist/resource-paths.js
|
|
864
|
+
function accessModeToResourcePathPermission({ accessMode, isPrimary = false }) {
|
|
865
|
+
if (isPrimary)
|
|
866
|
+
return "rw";
|
|
867
|
+
return accessMode === "read" ? "ro" : "rw";
|
|
868
|
+
}
|
|
869
|
+
function formatResourcePathWithPermission({ path: path40, accessMode, isPrimary = false }) {
|
|
870
|
+
const trimmed7 = path40.trim();
|
|
871
|
+
if (!trimmed7)
|
|
872
|
+
return "";
|
|
873
|
+
const permission = accessModeToResourcePathPermission({ accessMode, isPrimary });
|
|
874
|
+
return `${trimmed7}:${permission}`;
|
|
875
|
+
}
|
|
876
|
+
function formatProjectResourcePathsFromManifest(projectResources) {
|
|
877
|
+
if (!Array.isArray(projectResources))
|
|
878
|
+
return "";
|
|
879
|
+
const paths = [];
|
|
880
|
+
for (const entry of projectResources) {
|
|
881
|
+
if (!entry || typeof entry !== "object")
|
|
882
|
+
continue;
|
|
883
|
+
const record2 = entry;
|
|
884
|
+
const path40 = typeof record2.path === "string" ? record2.path.trim() : "";
|
|
885
|
+
if (!path40)
|
|
886
|
+
continue;
|
|
887
|
+
paths.push(formatResourcePathWithPermission({
|
|
888
|
+
path: path40,
|
|
889
|
+
accessMode: typeof record2.accessMode === "string" ? record2.accessMode : null,
|
|
890
|
+
isPrimary: record2.isPrimary === true
|
|
891
|
+
}));
|
|
892
|
+
}
|
|
893
|
+
return paths.join(",");
|
|
894
|
+
}
|
|
895
|
+
var init_resource_paths = __esm({
|
|
896
|
+
"../packages/contract/dist/resource-paths.js"() {
|
|
897
|
+
"use strict";
|
|
898
|
+
}
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
// ../packages/contract/dist/search.js
|
|
902
|
+
var init_search = __esm({
|
|
903
|
+
"../packages/contract/dist/search.js"() {
|
|
904
|
+
"use strict";
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
// ../packages/contract/dist/index.js
|
|
909
|
+
var init_dist = __esm({
|
|
910
|
+
"../packages/contract/dist/index.js"() {
|
|
911
|
+
"use strict";
|
|
912
|
+
init_agent_launch_flags();
|
|
913
|
+
init_base_url();
|
|
914
|
+
init_chat();
|
|
915
|
+
init_launch_variables();
|
|
916
|
+
init_mission_reference();
|
|
917
|
+
init_mission_search();
|
|
918
|
+
init_notifications();
|
|
919
|
+
init_objective_ref();
|
|
920
|
+
init_resource_paths();
|
|
921
|
+
init_search();
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
// ../database/dist/objective-display-key.js
|
|
926
|
+
var init_objective_display_key = __esm({
|
|
927
|
+
"../database/dist/objective-display-key.js"() {
|
|
928
|
+
"use strict";
|
|
929
|
+
init_dist();
|
|
930
|
+
init_dist();
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
|
|
934
|
+
// ../database/dist/objective-display-key-migration-runtime.js
|
|
935
|
+
var init_objective_display_key_migration_runtime = __esm({
|
|
936
|
+
"../database/dist/objective-display-key-migration-runtime.js"() {
|
|
937
|
+
"use strict";
|
|
938
|
+
init_objective_display_key();
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
// ../database/dist/project-resources-resource-key-migration-runtime.js
|
|
943
|
+
var init_project_resources_resource_key_migration_runtime = __esm({
|
|
944
|
+
"../database/dist/project-resources-resource-key-migration-runtime.js"() {
|
|
945
|
+
"use strict";
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
// ../database/dist/project-statuses-migration-runtime.js
|
|
950
|
+
var init_project_statuses_migration_runtime = __esm({
|
|
951
|
+
"../database/dist/project-statuses-migration-runtime.js"() {
|
|
952
|
+
"use strict";
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
|
|
956
|
+
// ../database/dist/connection.js
|
|
957
|
+
var init_connection = __esm({
|
|
958
|
+
"../database/dist/connection.js"() {
|
|
959
|
+
"use strict";
|
|
960
|
+
init_better_sqlite3_loader();
|
|
961
|
+
init_constants();
|
|
962
|
+
init_ext_everhour_migration_runtime();
|
|
963
|
+
init_local_paths();
|
|
964
|
+
init_migration_ledger();
|
|
965
|
+
init_migration_files();
|
|
966
|
+
init_next_status_type_migration_runtime();
|
|
967
|
+
init_objective_display_key_migration_runtime();
|
|
968
|
+
init_project_resources_resource_key_migration_runtime();
|
|
969
|
+
init_project_statuses_migration_runtime();
|
|
970
|
+
}
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
// ../database/dist/adapter.js
|
|
974
|
+
var init_adapter = __esm({
|
|
975
|
+
"../database/dist/adapter.js"() {
|
|
976
|
+
"use strict";
|
|
977
|
+
init_connection();
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
// ../database/dist/client.js
|
|
982
|
+
var init_client = __esm({
|
|
983
|
+
"../database/dist/client.js"() {
|
|
984
|
+
"use strict";
|
|
985
|
+
init_connection();
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
// ../database/dist/migrate-postgres.js
|
|
990
|
+
var init_migrate_postgres = __esm({
|
|
991
|
+
"../database/dist/migrate-postgres.js"() {
|
|
992
|
+
"use strict";
|
|
993
|
+
init_constants();
|
|
994
|
+
init_ext_everhour_migration_runtime();
|
|
995
|
+
init_migration_ledger();
|
|
996
|
+
init_migration_files();
|
|
997
|
+
init_objective_display_key_migration_runtime();
|
|
998
|
+
init_project_statuses_migration_runtime();
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
|
|
1002
|
+
// ../database/dist/storage-seed.js
|
|
1003
|
+
var init_storage_seed = __esm({
|
|
1004
|
+
"../database/dist/storage-seed.js"() {
|
|
1005
|
+
"use strict";
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
// ../database/dist/index.js
|
|
1010
|
+
var init_dist2 = __esm({
|
|
1011
|
+
"../database/dist/index.js"() {
|
|
1012
|
+
"use strict";
|
|
1013
|
+
init_adapter();
|
|
1014
|
+
init_better_sqlite3_loader();
|
|
1015
|
+
init_client();
|
|
1016
|
+
init_connection();
|
|
1017
|
+
init_constants();
|
|
1018
|
+
init_local_paths();
|
|
1019
|
+
init_migrate_postgres();
|
|
1020
|
+
init_objective_display_key();
|
|
1021
|
+
init_storage_seed();
|
|
1022
|
+
}
|
|
1023
|
+
});
|
|
1024
|
+
|
|
474
1025
|
// ../node_modules/smol-toml/dist/date.js
|
|
475
1026
|
var DATE_TIME_RE, TomlDate;
|
|
476
1027
|
var init_date = __esm({
|
|
@@ -1205,7 +1756,7 @@ var init_stringify = __esm({
|
|
|
1205
1756
|
});
|
|
1206
1757
|
|
|
1207
1758
|
// ../node_modules/smol-toml/dist/index.js
|
|
1208
|
-
var
|
|
1759
|
+
var init_dist3 = __esm({
|
|
1209
1760
|
"../node_modules/smol-toml/dist/index.js"() {
|
|
1210
1761
|
init_parse();
|
|
1211
1762
|
init_stringify();
|
|
@@ -1259,7 +1810,7 @@ var init_agent_catalog = __esm({
|
|
|
1259
1810
|
|
|
1260
1811
|
// src/env.ts
|
|
1261
1812
|
import { existsSync as existsSync2, lstatSync, readFileSync as readFileSync2, readlinkSync } from "node:fs";
|
|
1262
|
-
import
|
|
1813
|
+
import path3 from "node:path";
|
|
1263
1814
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
1264
1815
|
function parseDotenv(src) {
|
|
1265
1816
|
const obj = {};
|
|
@@ -1292,7 +1843,7 @@ function isInstalledCliEntrypointPath(entrypointPath) {
|
|
|
1292
1843
|
const stat = lstatSync(entrypointPath);
|
|
1293
1844
|
if (!stat.isSymbolicLink()) return false;
|
|
1294
1845
|
const target = readlinkSync(entrypointPath);
|
|
1295
|
-
const resolvedTarget =
|
|
1846
|
+
const resolvedTarget = path3.isAbsolute(target) ? target : path3.resolve(path3.dirname(entrypointPath), target);
|
|
1296
1847
|
return isInstalledModulePath(resolvedTarget);
|
|
1297
1848
|
} catch {
|
|
1298
1849
|
return false;
|
|
@@ -1300,7 +1851,7 @@ function isInstalledCliEntrypointPath(entrypointPath) {
|
|
|
1300
1851
|
}
|
|
1301
1852
|
function detectCliEnvProfile() {
|
|
1302
1853
|
try {
|
|
1303
|
-
const moduleDir =
|
|
1854
|
+
const moduleDir = path3.dirname(fileURLToPath2(import.meta.url));
|
|
1304
1855
|
return isInstalledModulePath(moduleDir) || isInstalledCliEntrypointPath(process.argv[1] ?? "") ? "production" : "development";
|
|
1305
1856
|
} catch {
|
|
1306
1857
|
return "development";
|
|
@@ -1325,12 +1876,12 @@ function isTruthyEnv(value2) {
|
|
|
1325
1876
|
}
|
|
1326
1877
|
function loadEnvDefaults(dir, profile = "development") {
|
|
1327
1878
|
for (const file2 of resolveEnvFileNames(profile)) {
|
|
1328
|
-
const filePath =
|
|
1879
|
+
const filePath = path3.join(dir, file2);
|
|
1329
1880
|
if (!existsSync2(filePath)) continue;
|
|
1330
1881
|
const parsed = parseDotenv(readFileSync2(filePath, "utf8"));
|
|
1331
1882
|
for (const [key, value2] of Object.entries(parsed)) {
|
|
1332
1883
|
if (!process.env[key]?.trim()) {
|
|
1333
|
-
process.env[key] = normalizeEnvFileValue({ key, value: value2, baseDir:
|
|
1884
|
+
process.env[key] = normalizeEnvFileValue({ key, value: value2, baseDir: path3.dirname(filePath) });
|
|
1334
1885
|
}
|
|
1335
1886
|
}
|
|
1336
1887
|
}
|
|
@@ -1341,8 +1892,8 @@ function normalizeEnvFileValue({
|
|
|
1341
1892
|
baseDir
|
|
1342
1893
|
}) {
|
|
1343
1894
|
if (key !== "OVLD_HOME") return value2;
|
|
1344
|
-
if (!value2.trim() ||
|
|
1345
|
-
return
|
|
1895
|
+
if (!value2.trim() || path3.isAbsolute(value2)) return value2;
|
|
1896
|
+
return path3.resolve(baseDir, value2);
|
|
1346
1897
|
}
|
|
1347
1898
|
var explicitRuntimeKeys;
|
|
1348
1899
|
var init_env = __esm({
|
|
@@ -1375,8 +1926,8 @@ __export(config_exports, {
|
|
|
1375
1926
|
writeConfig: () => writeConfig
|
|
1376
1927
|
});
|
|
1377
1928
|
import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync3, writeFileSync } from "node:fs";
|
|
1378
|
-
import
|
|
1379
|
-
import
|
|
1929
|
+
import os2 from "node:os";
|
|
1930
|
+
import path4 from "node:path";
|
|
1380
1931
|
function normalizeBackendUrl(value2) {
|
|
1381
1932
|
const trimmed7 = value2.trim().replace(/\/+$/, "");
|
|
1382
1933
|
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed7)) {
|
|
@@ -1424,29 +1975,26 @@ function configFromToml(toml) {
|
|
|
1424
1975
|
function resolveProjectRoot(startDir = process.cwd()) {
|
|
1425
1976
|
const configPath = findConfigPath(startDir);
|
|
1426
1977
|
if (configPath) {
|
|
1427
|
-
return
|
|
1978
|
+
return path4.dirname(configPath);
|
|
1428
1979
|
}
|
|
1429
1980
|
return startDir;
|
|
1430
1981
|
}
|
|
1431
1982
|
function resolveRepoPath(relativePath, startDir = process.cwd()) {
|
|
1432
|
-
return
|
|
1983
|
+
return path4.resolve(resolveProjectRoot(startDir), relativePath);
|
|
1433
1984
|
}
|
|
1434
1985
|
function findConfigPath(startDir = process.cwd()) {
|
|
1435
|
-
let current =
|
|
1986
|
+
let current = path4.resolve(startDir);
|
|
1436
1987
|
while (true) {
|
|
1437
|
-
const candidate =
|
|
1988
|
+
const candidate = path4.join(current, "overlord.toml");
|
|
1438
1989
|
if (existsSync3(candidate)) return candidate;
|
|
1439
|
-
const parent =
|
|
1990
|
+
const parent = path4.dirname(current);
|
|
1440
1991
|
if (parent === current) break;
|
|
1441
1992
|
current = parent;
|
|
1442
1993
|
}
|
|
1443
1994
|
return null;
|
|
1444
1995
|
}
|
|
1445
|
-
function resolveGlobalDataDir() {
|
|
1446
|
-
return process.env.OVLD_HOME?.trim() || path3.join(os.homedir(), ".ovld");
|
|
1447
|
-
}
|
|
1448
1996
|
function resolveGlobalConfigPath() {
|
|
1449
|
-
return
|
|
1997
|
+
return path4.join(resolveGlobalDataDir(), "overlord.toml");
|
|
1450
1998
|
}
|
|
1451
1999
|
function findEffectiveConfigPath(startDir = process.cwd()) {
|
|
1452
2000
|
const localPath = findConfigPath(startDir);
|
|
@@ -1459,7 +2007,7 @@ function resolveConfigWritePath(startDir = process.cwd()) {
|
|
|
1459
2007
|
}
|
|
1460
2008
|
function loadConfig(configPath, envProfile = CLI_ENV_PROFILE) {
|
|
1461
2009
|
const resolvedPath = configPath ?? findEffectiveConfigPath();
|
|
1462
|
-
loadEnvDefaults(resolvedPath ?
|
|
2010
|
+
loadEnvDefaults(resolvedPath ? path4.dirname(resolvedPath) : process.cwd(), envProfile);
|
|
1463
2011
|
if (!resolvedPath || !existsSync3(resolvedPath)) {
|
|
1464
2012
|
return { ...DEFAULT_CONFIG };
|
|
1465
2013
|
}
|
|
@@ -1475,7 +2023,7 @@ function writeConfig({
|
|
|
1475
2023
|
message: "Refusing to write overlord.toml from inside a container. Configure the backend with the OVERLORD_BACKEND_URL environment variable instead (set OVERLORD_ALLOW_CONFIG_WRITE=1 to override)."
|
|
1476
2024
|
});
|
|
1477
2025
|
}
|
|
1478
|
-
mkdirSync(
|
|
2026
|
+
mkdirSync(path4.dirname(targetPath), { recursive: true });
|
|
1479
2027
|
const merged = { ...DEFAULT_CONFIG, ...config2 };
|
|
1480
2028
|
const contents = `# Overlord local instance configuration
|
|
1481
2029
|
instance_name = ${tomlString(merged.instanceName)}
|
|
@@ -1526,9 +2074,9 @@ function hasExplicitBackendConfig(config2) {
|
|
|
1526
2074
|
return Boolean(config2.backendUrl?.trim());
|
|
1527
2075
|
}
|
|
1528
2076
|
function expandTilde(input) {
|
|
1529
|
-
if (input === "~") return
|
|
1530
|
-
if (input.startsWith("~/") || input.startsWith(`~${
|
|
1531
|
-
return
|
|
2077
|
+
if (input === "~") return os2.homedir();
|
|
2078
|
+
if (input.startsWith("~/") || input.startsWith(`~${path4.sep}`)) {
|
|
2079
|
+
return path4.join(os2.homedir(), input.slice(2));
|
|
1532
2080
|
}
|
|
1533
2081
|
return input;
|
|
1534
2082
|
}
|
|
@@ -1536,19 +2084,19 @@ function resolveDatabasePath(config2, startDir = process.cwd()) {
|
|
|
1536
2084
|
const explicit = process.env.OVERLORD_SQLITE_PATH;
|
|
1537
2085
|
if (explicit && isExplicitRuntimeEnv("OVERLORD_SQLITE_PATH")) {
|
|
1538
2086
|
const expanded = expandTilde(explicit);
|
|
1539
|
-
return
|
|
2087
|
+
return path4.isAbsolute(expanded) ? expanded : path4.resolve(resolveProjectRoot(startDir), expanded);
|
|
1540
2088
|
}
|
|
1541
2089
|
if (config2.databasePath) {
|
|
1542
2090
|
const expanded = expandTilde(config2.databasePath);
|
|
1543
2091
|
const configPath = findConfigPath(startDir);
|
|
1544
|
-
const baseDir = configPath ?
|
|
1545
|
-
return
|
|
2092
|
+
const baseDir = configPath ? path4.dirname(configPath) : resolveProjectRoot(startDir);
|
|
2093
|
+
return path4.isAbsolute(expanded) ? expanded : path4.resolve(baseDir, expanded);
|
|
1546
2094
|
}
|
|
1547
2095
|
if (explicit) {
|
|
1548
2096
|
const expanded = expandTilde(explicit);
|
|
1549
|
-
return
|
|
2097
|
+
return path4.isAbsolute(expanded) ? expanded : path4.resolve(resolveProjectRoot(startDir), expanded);
|
|
1550
2098
|
}
|
|
1551
|
-
return
|
|
2099
|
+
return resolveGlobalDatabasePath();
|
|
1552
2100
|
}
|
|
1553
2101
|
function resolveBackendUrl(config2, envProfile = CLI_ENV_PROFILE) {
|
|
1554
2102
|
const override = process.env.OVERLORD_BACKEND_URL?.trim();
|
|
@@ -1574,7 +2122,8 @@ var CLI_ENV_PROFILE, DEFAULT_LOCAL_BACKEND_DIR, DEFAULT_LOCAL_BACKEND_DATABASE_P
|
|
|
1574
2122
|
var init_config = __esm({
|
|
1575
2123
|
"src/config.ts"() {
|
|
1576
2124
|
"use strict";
|
|
1577
|
-
|
|
2125
|
+
init_dist2();
|
|
2126
|
+
init_dist3();
|
|
1578
2127
|
init_agent_catalog();
|
|
1579
2128
|
init_env();
|
|
1580
2129
|
init_errors();
|
|
@@ -1611,9 +2160,9 @@ __export(auth_credentials_exports, {
|
|
|
1611
2160
|
writeStoredAuthCredentials: () => writeStoredAuthCredentials
|
|
1612
2161
|
});
|
|
1613
2162
|
import { chmodSync, existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
1614
|
-
import
|
|
2163
|
+
import path5 from "node:path";
|
|
1615
2164
|
function authCredentialsPath() {
|
|
1616
|
-
return
|
|
2165
|
+
return path5.join(resolveGlobalDataDir(), "auth.json");
|
|
1617
2166
|
}
|
|
1618
2167
|
function readStoredAuthCredentials() {
|
|
1619
2168
|
const filePath = authCredentialsPath();
|
|
@@ -1638,7 +2187,7 @@ function writeStoredAuthCredentials({
|
|
|
1638
2187
|
expiresAt = null
|
|
1639
2188
|
}) {
|
|
1640
2189
|
const filePath = authCredentialsPath();
|
|
1641
|
-
mkdirSync2(
|
|
2190
|
+
mkdirSync2(path5.dirname(filePath), { recursive: true });
|
|
1642
2191
|
const payload = {
|
|
1643
2192
|
type,
|
|
1644
2193
|
token,
|
|
@@ -1653,9 +2202,6 @@ function writeStoredAuthCredentials({
|
|
|
1653
2202
|
} catch {
|
|
1654
2203
|
}
|
|
1655
2204
|
}
|
|
1656
|
-
function normalizeBaseUrl(value2) {
|
|
1657
|
-
return value2.replace(/\/+$/, "");
|
|
1658
|
-
}
|
|
1659
2205
|
function clearStoredAuthCredentials() {
|
|
1660
2206
|
const filePath = authCredentialsPath();
|
|
1661
2207
|
if (!existsSync4(filePath)) return;
|
|
@@ -1677,6 +2223,7 @@ function resolveAuthBearerToken({
|
|
|
1677
2223
|
var init_auth_credentials = __esm({
|
|
1678
2224
|
"src/auth-credentials.ts"() {
|
|
1679
2225
|
"use strict";
|
|
2226
|
+
init_dist();
|
|
1680
2227
|
init_config();
|
|
1681
2228
|
}
|
|
1682
2229
|
});
|
|
@@ -1696,7 +2243,6 @@ __export(auth_login_exports, {
|
|
|
1696
2243
|
validateEmail: () => validateEmail
|
|
1697
2244
|
});
|
|
1698
2245
|
import { hostname } from "node:os";
|
|
1699
|
-
import { createInterface } from "node:readline/promises";
|
|
1700
2246
|
function normalizeEmail(email3) {
|
|
1701
2247
|
return email3.trim().toLowerCase();
|
|
1702
2248
|
}
|
|
@@ -1707,9 +2253,6 @@ function validateEmail(email3) {
|
|
|
1707
2253
|
}
|
|
1708
2254
|
return null;
|
|
1709
2255
|
}
|
|
1710
|
-
function normalizeBaseUrl2(value2) {
|
|
1711
|
-
return value2.replace(/\/+$/, "");
|
|
1712
|
-
}
|
|
1713
2256
|
function isBackendReachabilityError(error51) {
|
|
1714
2257
|
if (!(error51 instanceof CliError)) return false;
|
|
1715
2258
|
return error51.message.startsWith("Could not reach Overlord backend at ");
|
|
@@ -1717,7 +2260,7 @@ function isBackendReachabilityError(error51) {
|
|
|
1717
2260
|
async function probeBackendReachability({
|
|
1718
2261
|
backendUrl
|
|
1719
2262
|
}) {
|
|
1720
|
-
const baseUrl =
|
|
2263
|
+
const baseUrl = normalizeBaseUrl(backendUrl);
|
|
1721
2264
|
try {
|
|
1722
2265
|
const response = await fetch(`${baseUrl}/api/health`, {
|
|
1723
2266
|
method: "GET",
|
|
@@ -1735,29 +2278,12 @@ async function probeBackendReachability({
|
|
|
1735
2278
|
};
|
|
1736
2279
|
}
|
|
1737
2280
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
defaultValue
|
|
1741
|
-
}) {
|
|
1742
|
-
if (!process.stdin.isTTY) {
|
|
1743
|
-
throw new CliError({
|
|
1744
|
-
message: "Interactive login requires a TTY. Set OVERLORD_USER_TOKEN / OVLD_USER_TOKEN / USER_TOKEN for non-interactive use."
|
|
1745
|
-
});
|
|
1746
|
-
}
|
|
1747
|
-
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
1748
|
-
try {
|
|
1749
|
-
const suffix = defaultValue ? ` [${defaultValue}]` : "";
|
|
1750
|
-
const answer = await rl.question(`${message}${suffix}: `);
|
|
1751
|
-
return answer.trim() || defaultValue || "";
|
|
1752
|
-
} finally {
|
|
1753
|
-
rl.close();
|
|
1754
|
-
}
|
|
2281
|
+
function promptLine2(options) {
|
|
2282
|
+
return promptLine({ ...options, nonInteractiveMessage: NON_INTERACTIVE_MESSAGE });
|
|
1755
2283
|
}
|
|
1756
2284
|
async function promptPassword({ message }) {
|
|
1757
2285
|
if (!process.stdin.isTTY) {
|
|
1758
|
-
throw new CliError({
|
|
1759
|
-
message: "Interactive login requires a TTY. Set OVERLORD_USER_TOKEN / OVLD_USER_TOKEN / USER_TOKEN for non-interactive use."
|
|
1760
|
-
});
|
|
2286
|
+
throw new CliError({ message: NON_INTERACTIVE_MESSAGE });
|
|
1761
2287
|
}
|
|
1762
2288
|
process.stdout.write(`${message}: `);
|
|
1763
2289
|
const stdin = process.stdin;
|
|
@@ -1799,7 +2325,7 @@ async function promptAuthMethod() {
|
|
|
1799
2325
|
console.log("Choose how to authenticate:");
|
|
1800
2326
|
console.log(" 1. Email and password");
|
|
1801
2327
|
console.log(" 2. USER_TOKEN (generate one in Overlord Desktop: Settings > Tokens)");
|
|
1802
|
-
const answer = (await
|
|
2328
|
+
const answer = (await promptLine2({ message: "Selection", defaultValue: "1" })).toLowerCase();
|
|
1803
2329
|
if (answer === "2" || answer === "token" || answer === "user_token") return "user_token";
|
|
1804
2330
|
if (answer === "1" || answer === "password" || answer === "email") return "password";
|
|
1805
2331
|
throw new CliError({ message: "Selection must be 1 or 2." });
|
|
@@ -1825,7 +2351,7 @@ async function loginWithUserToken({
|
|
|
1825
2351
|
backendUrl,
|
|
1826
2352
|
token
|
|
1827
2353
|
}) {
|
|
1828
|
-
const normalizedBackendUrl =
|
|
2354
|
+
const normalizedBackendUrl = normalizeBaseUrl(backendUrl);
|
|
1829
2355
|
const trimmedToken = token.trim();
|
|
1830
2356
|
if (!trimmedToken) throw new CliError({ message: "USER_TOKEN is required." });
|
|
1831
2357
|
if (!trimmedToken.startsWith("out_")) {
|
|
@@ -1852,7 +2378,7 @@ async function validateBearerToken({
|
|
|
1852
2378
|
backendUrl,
|
|
1853
2379
|
token
|
|
1854
2380
|
}) {
|
|
1855
|
-
const baseUrl =
|
|
2381
|
+
const baseUrl = normalizeBaseUrl(backendUrl);
|
|
1856
2382
|
let response;
|
|
1857
2383
|
try {
|
|
1858
2384
|
response = await fetch(`${baseUrl}/api/meta`, {
|
|
@@ -1883,7 +2409,7 @@ async function createFullUserTokenFromSession({
|
|
|
1883
2409
|
sessionToken,
|
|
1884
2410
|
label = defaultCliLoginTokenLabel()
|
|
1885
2411
|
}) {
|
|
1886
|
-
const baseUrl =
|
|
2412
|
+
const baseUrl = normalizeBaseUrl(backendUrl);
|
|
1887
2413
|
let response;
|
|
1888
2414
|
try {
|
|
1889
2415
|
response = await fetch(`${baseUrl}/api/user-tokens`, {
|
|
@@ -1923,7 +2449,7 @@ async function signInWithEmailPassword({
|
|
|
1923
2449
|
const emailError = validateEmail(rawEmail);
|
|
1924
2450
|
if (emailError) throw new CliError({ message: emailError });
|
|
1925
2451
|
if (!password) throw new CliError({ message: "Password is required." });
|
|
1926
|
-
const baseUrl =
|
|
2452
|
+
const baseUrl = normalizeBaseUrl(backendUrl);
|
|
1927
2453
|
const email3 = normalizeEmail(rawEmail);
|
|
1928
2454
|
let response;
|
|
1929
2455
|
try {
|
|
@@ -1958,13 +2484,13 @@ async function runInteractiveAuthLogin({
|
|
|
1958
2484
|
passwordCredentialTarget = "session_bearer"
|
|
1959
2485
|
}) {
|
|
1960
2486
|
const method = await promptAuthMethod();
|
|
1961
|
-
const normalizedBackendUrl =
|
|
2487
|
+
const normalizedBackendUrl = normalizeBaseUrl(backendUrl);
|
|
1962
2488
|
const { authCredentialsPath: authCredentialsPath2 } = await Promise.resolve().then(() => (init_auth_credentials(), auth_credentials_exports));
|
|
1963
2489
|
if (method === "user_token") {
|
|
1964
|
-
const token = await
|
|
2490
|
+
const token = await promptLine2({ message: "Paste your USER_TOKEN" });
|
|
1965
2491
|
return loginWithUserToken({ backendUrl: normalizedBackendUrl, token });
|
|
1966
2492
|
}
|
|
1967
|
-
const email3 = await
|
|
2493
|
+
const email3 = await promptLine2({ message: "Email" });
|
|
1968
2494
|
const emailError = validateEmail(email3);
|
|
1969
2495
|
if (emailError) throw new CliError({ message: emailError });
|
|
1970
2496
|
const password = await promptPassword({ message: "Password" });
|
|
@@ -2007,11 +2533,15 @@ async function runInteractiveAuthLogin({
|
|
|
2007
2533
|
credentialsPath: authCredentialsPath2()
|
|
2008
2534
|
};
|
|
2009
2535
|
}
|
|
2536
|
+
var NON_INTERACTIVE_MESSAGE;
|
|
2010
2537
|
var init_auth_login = __esm({
|
|
2011
2538
|
"src/auth-login.ts"() {
|
|
2012
2539
|
"use strict";
|
|
2540
|
+
init_dist();
|
|
2013
2541
|
init_auth_credentials();
|
|
2014
2542
|
init_errors();
|
|
2543
|
+
init_prompt();
|
|
2544
|
+
NON_INTERACTIVE_MESSAGE = "Interactive login requires a TTY. Set OVERLORD_USER_TOKEN / OVLD_USER_TOKEN / USER_TOKEN for non-interactive use.";
|
|
2015
2545
|
}
|
|
2016
2546
|
});
|
|
2017
2547
|
|
|
@@ -2036,9 +2566,6 @@ function resolveExpiry(expiresAt) {
|
|
|
2036
2566
|
expired: msRemaining <= 0
|
|
2037
2567
|
};
|
|
2038
2568
|
}
|
|
2039
|
-
function normalizeBaseUrl3(value2) {
|
|
2040
|
-
return value2.replace(/\/+$/, "");
|
|
2041
|
-
}
|
|
2042
2569
|
function inferCredentialTypeFromToken(token) {
|
|
2043
2570
|
return token.startsWith("out_") ? "user_token" : "session_bearer";
|
|
2044
2571
|
}
|
|
@@ -2059,7 +2586,7 @@ function resolveAuthCredentialSource({
|
|
|
2059
2586
|
return { source: "none", type: null, credentialsPath: null };
|
|
2060
2587
|
}
|
|
2061
2588
|
const credentialsPath = authCredentialsPath();
|
|
2062
|
-
if (
|
|
2589
|
+
if (normalizeBaseUrl(stored.backendUrl) !== normalizeBaseUrl(backendUrl)) {
|
|
2063
2590
|
return {
|
|
2064
2591
|
source: "stored_mismatch",
|
|
2065
2592
|
type: stored.type,
|
|
@@ -2127,6 +2654,7 @@ async function resolveAuthStatus({
|
|
|
2127
2654
|
var init_auth_status = __esm({
|
|
2128
2655
|
"src/auth-status.ts"() {
|
|
2129
2656
|
"use strict";
|
|
2657
|
+
init_dist();
|
|
2130
2658
|
init_auth_credentials();
|
|
2131
2659
|
init_auth_login();
|
|
2132
2660
|
init_config();
|
|
@@ -2152,7 +2680,7 @@ var init_agent_binaries = __esm({
|
|
|
2152
2680
|
|
|
2153
2681
|
// src/connector-core-render.ts
|
|
2154
2682
|
import { existsSync as existsSync5, readFileSync as readFileSync5 } from "node:fs";
|
|
2155
|
-
import
|
|
2683
|
+
import path6 from "node:path";
|
|
2156
2684
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
2157
2685
|
function connectorCoreAgentSessionAction(relativePath) {
|
|
2158
2686
|
const match = /^scripts\/agent-session-([a-z]+)\.sh$/.exec(relativePath);
|
|
@@ -2163,11 +2691,11 @@ function connectorCoreAgentSessionAction(relativePath) {
|
|
|
2163
2691
|
function connectorCoreRoot() {
|
|
2164
2692
|
const override = process.env.OVERLORD_CONNECTORS_DIR;
|
|
2165
2693
|
if (override) {
|
|
2166
|
-
const candidate =
|
|
2694
|
+
const candidate = path6.join(path6.dirname(override), "core", "overlord-mission");
|
|
2167
2695
|
if (existsSync5(candidate)) return candidate;
|
|
2168
2696
|
}
|
|
2169
|
-
const packaged =
|
|
2170
|
-
|
|
2697
|
+
const packaged = path6.join(
|
|
2698
|
+
path6.dirname(fileURLToPath3(import.meta.url)),
|
|
2171
2699
|
"connectors",
|
|
2172
2700
|
"core",
|
|
2173
2701
|
"overlord-mission"
|
|
@@ -2175,16 +2703,16 @@ function connectorCoreRoot() {
|
|
|
2175
2703
|
if (existsSync5(packaged)) return packaged;
|
|
2176
2704
|
let dir = process.cwd();
|
|
2177
2705
|
while (true) {
|
|
2178
|
-
const candidate =
|
|
2706
|
+
const candidate = path6.join(dir, "connectors", "core", "overlord-mission");
|
|
2179
2707
|
if (existsSync5(candidate)) return candidate;
|
|
2180
|
-
const parent =
|
|
2708
|
+
const parent = path6.dirname(dir);
|
|
2181
2709
|
if (parent === dir) break;
|
|
2182
2710
|
dir = parent;
|
|
2183
2711
|
}
|
|
2184
2712
|
return resolveRepoPath("connectors/core/overlord-mission");
|
|
2185
2713
|
}
|
|
2186
2714
|
function connectorCoreScriptsRoot(coreRoot = connectorCoreRoot()) {
|
|
2187
|
-
return
|
|
2715
|
+
return path6.join(path6.dirname(coreRoot), "scripts");
|
|
2188
2716
|
}
|
|
2189
2717
|
function isConnectorCoreCaptureChangeHookPath({
|
|
2190
2718
|
adapterKey,
|
|
@@ -2208,7 +2736,7 @@ function stripMarkdownFrontmatter(text) {
|
|
|
2208
2736
|
return text.slice(end + 5);
|
|
2209
2737
|
}
|
|
2210
2738
|
function readConnectorCoreSkillBody(coreRoot = connectorCoreRoot()) {
|
|
2211
|
-
const coreSkillPath =
|
|
2739
|
+
const coreSkillPath = path6.join(coreRoot, "SKILL.md");
|
|
2212
2740
|
if (!existsSync5(coreSkillPath)) {
|
|
2213
2741
|
throw new CliError({
|
|
2214
2742
|
message: `Connector core skill missing at ${coreSkillPath}.`
|
|
@@ -2222,7 +2750,7 @@ function renderConnectorCoreScript({
|
|
|
2222
2750
|
substitutions,
|
|
2223
2751
|
coreRoot = connectorCoreRoot()
|
|
2224
2752
|
}) {
|
|
2225
|
-
const scriptPath =
|
|
2753
|
+
const scriptPath = path6.join(connectorCoreScriptsRoot(coreRoot), sourceName);
|
|
2226
2754
|
if (!existsSync5(scriptPath)) {
|
|
2227
2755
|
throw new CliError({ message: `Connector core ${label} missing at ${scriptPath}.` });
|
|
2228
2756
|
}
|
|
@@ -2265,7 +2793,7 @@ function readConnectorCoreReference({
|
|
|
2265
2793
|
message: `Not a connector core reference path: ${relativePath}`
|
|
2266
2794
|
});
|
|
2267
2795
|
}
|
|
2268
|
-
const referencePath =
|
|
2796
|
+
const referencePath = path6.join(coreRoot, "reference", path6.basename(relativePath));
|
|
2269
2797
|
if (!existsSync5(referencePath)) {
|
|
2270
2798
|
throw new CliError({
|
|
2271
2799
|
message: `Connector core reference missing at ${referencePath}.`
|
|
@@ -2279,7 +2807,7 @@ function renderConnectorMcpShim({
|
|
|
2279
2807
|
}) {
|
|
2280
2808
|
assertAdapterKey(adapterKey);
|
|
2281
2809
|
return renderConnectorCoreScript({
|
|
2282
|
-
sourceName:
|
|
2810
|
+
sourceName: path6.basename(CONNECTOR_CORE_MCP_SHIM_RELATIVE_PATH),
|
|
2283
2811
|
label: "MCP shim",
|
|
2284
2812
|
substitutions: [[CONNECTOR_ADAPTER_KEY_PLACEHOLDER, adapterKey]],
|
|
2285
2813
|
coreRoot
|
|
@@ -2320,27 +2848,27 @@ function managedFileSourceExists({
|
|
|
2320
2848
|
coreRoot = connectorCoreRoot()
|
|
2321
2849
|
}) {
|
|
2322
2850
|
if (isConnectorCoreReferencePath(relativePath)) {
|
|
2323
|
-
return existsSync5(
|
|
2851
|
+
return existsSync5(path6.join(coreRoot, "reference", path6.basename(relativePath)));
|
|
2324
2852
|
}
|
|
2325
2853
|
if (isConnectorCoreMcpShimPath(relativePath)) {
|
|
2326
2854
|
return existsSync5(
|
|
2327
|
-
|
|
2855
|
+
path6.join(
|
|
2328
2856
|
connectorCoreScriptsRoot(coreRoot),
|
|
2329
|
-
|
|
2857
|
+
path6.basename(CONNECTOR_CORE_MCP_SHIM_RELATIVE_PATH)
|
|
2330
2858
|
)
|
|
2331
2859
|
);
|
|
2332
2860
|
}
|
|
2333
2861
|
if (isConnectorCoreCaptureChangeHookPath({ adapterKey, relativePath })) {
|
|
2334
2862
|
return existsSync5(
|
|
2335
|
-
|
|
2863
|
+
path6.join(connectorCoreScriptsRoot(coreRoot), CONNECTOR_CORE_CAPTURE_CHANGE_HOOK_SOURCE)
|
|
2336
2864
|
);
|
|
2337
2865
|
}
|
|
2338
2866
|
if (connectorCoreAgentSessionAction(relativePath)) {
|
|
2339
2867
|
return existsSync5(
|
|
2340
|
-
|
|
2868
|
+
path6.join(connectorCoreScriptsRoot(coreRoot), CONNECTOR_CORE_AGENT_SESSION_HOOK_SOURCE)
|
|
2341
2869
|
);
|
|
2342
2870
|
}
|
|
2343
|
-
return existsSync5(
|
|
2871
|
+
return existsSync5(path6.join(sourceDir, relativePath));
|
|
2344
2872
|
}
|
|
2345
2873
|
function resolveManagedFileContents({
|
|
2346
2874
|
sourceDir,
|
|
@@ -2371,7 +2899,7 @@ function resolveManagedFileContents({
|
|
|
2371
2899
|
return Buffer.from(rendered, "utf8");
|
|
2372
2900
|
}
|
|
2373
2901
|
if (isConnectorCoreSkillPath(relativePath)) {
|
|
2374
|
-
const templatePath =
|
|
2902
|
+
const templatePath = path6.join(sourceDir, relativePath);
|
|
2375
2903
|
if (!existsSync5(templatePath)) {
|
|
2376
2904
|
throw new CliError({
|
|
2377
2905
|
message: `Adapter skill template missing at ${templatePath}.`
|
|
@@ -2383,7 +2911,7 @@ function resolveManagedFileContents({
|
|
|
2383
2911
|
});
|
|
2384
2912
|
return Buffer.from(rendered, "utf8");
|
|
2385
2913
|
}
|
|
2386
|
-
const sourcePath =
|
|
2914
|
+
const sourcePath = path6.join(sourceDir, relativePath);
|
|
2387
2915
|
if (!existsSync5(sourcePath)) {
|
|
2388
2916
|
throw new CliError({
|
|
2389
2917
|
message: `Declared managed file missing from connector source: ${relativePath}`
|
|
@@ -2440,8 +2968,8 @@ import {
|
|
|
2440
2968
|
statSync,
|
|
2441
2969
|
writeFileSync as writeFileSync3
|
|
2442
2970
|
} from "node:fs";
|
|
2443
|
-
import
|
|
2444
|
-
import
|
|
2971
|
+
import os3 from "node:os";
|
|
2972
|
+
import path7 from "node:path";
|
|
2445
2973
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
2446
2974
|
function escapeRegExp(value2) {
|
|
2447
2975
|
return value2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -2520,27 +3048,27 @@ function mergeCodexConfig(existingContent) {
|
|
|
2520
3048
|
function connectorsRoot() {
|
|
2521
3049
|
const override = process.env.OVERLORD_CONNECTORS_DIR;
|
|
2522
3050
|
if (override) return override;
|
|
2523
|
-
const packaged =
|
|
2524
|
-
|
|
3051
|
+
const packaged = path7.join(
|
|
3052
|
+
path7.dirname(fileURLToPath4(import.meta.url)),
|
|
2525
3053
|
"connectors",
|
|
2526
3054
|
"adapters"
|
|
2527
3055
|
);
|
|
2528
3056
|
if (existsSync6(packaged)) return packaged;
|
|
2529
3057
|
let dir = process.cwd();
|
|
2530
3058
|
while (true) {
|
|
2531
|
-
const candidate =
|
|
3059
|
+
const candidate = path7.join(dir, "connectors", "adapters");
|
|
2532
3060
|
if (existsSync6(candidate)) return candidate;
|
|
2533
|
-
const parent =
|
|
3061
|
+
const parent = path7.dirname(dir);
|
|
2534
3062
|
if (parent === dir) break;
|
|
2535
3063
|
dir = parent;
|
|
2536
3064
|
}
|
|
2537
3065
|
return resolveRepoPath("connectors/adapters");
|
|
2538
3066
|
}
|
|
2539
3067
|
function connectorDir(agentKey) {
|
|
2540
|
-
return
|
|
3068
|
+
return path7.join(connectorsRoot(), agentKey);
|
|
2541
3069
|
}
|
|
2542
3070
|
function manifestPath(agentKey) {
|
|
2543
|
-
return
|
|
3071
|
+
return path7.join(connectorDir(agentKey), "conformance-manifest.yaml");
|
|
2544
3072
|
}
|
|
2545
3073
|
function listAvailableConnectors() {
|
|
2546
3074
|
const root = connectorsRoot();
|
|
@@ -2628,24 +3156,24 @@ Available connectors: ${listAvailableConnectors().join(", ") || "(none)"}`
|
|
|
2628
3156
|
};
|
|
2629
3157
|
}
|
|
2630
3158
|
function resolveHome(home) {
|
|
2631
|
-
return home ?? process.env.OVERLORD_HOME ??
|
|
3159
|
+
return home ?? process.env.OVERLORD_HOME ?? os3.homedir();
|
|
2632
3160
|
}
|
|
2633
3161
|
function expandInstallPath(installPath, home) {
|
|
2634
3162
|
if (installPath === "~") return home;
|
|
2635
|
-
if (installPath.startsWith("~/")) return
|
|
3163
|
+
if (installPath.startsWith("~/")) return path7.join(home, installPath.slice(2));
|
|
2636
3164
|
return installPath;
|
|
2637
3165
|
}
|
|
2638
3166
|
function installStatePath(agentKey, home) {
|
|
2639
|
-
return
|
|
3167
|
+
return path7.join(home, ".ovld", "connectors", `${agentKey}.json`);
|
|
2640
3168
|
}
|
|
2641
3169
|
function sha256(contents) {
|
|
2642
3170
|
return createHash("sha256").update(contents).digest("hex");
|
|
2643
3171
|
}
|
|
2644
3172
|
function findOnPath(command) {
|
|
2645
3173
|
const pathEnv = process.env.PATH ?? "";
|
|
2646
|
-
for (const dir of pathEnv.split(
|
|
3174
|
+
for (const dir of pathEnv.split(path7.delimiter)) {
|
|
2647
3175
|
if (!dir) continue;
|
|
2648
|
-
const candidate =
|
|
3176
|
+
const candidate = path7.join(dir, command);
|
|
2649
3177
|
try {
|
|
2650
3178
|
if (statSync(candidate).isFile()) return true;
|
|
2651
3179
|
} catch {
|
|
@@ -2670,9 +3198,9 @@ function configureCursorHarness({
|
|
|
2670
3198
|
dryRun = false
|
|
2671
3199
|
}) {
|
|
2672
3200
|
const warnings = [];
|
|
2673
|
-
const cursorDir =
|
|
2674
|
-
const hooksPath =
|
|
2675
|
-
const settingsPath =
|
|
3201
|
+
const cursorDir = path7.join(home, ".cursor");
|
|
3202
|
+
const hooksPath = path7.join(cursorDir, "hooks.json");
|
|
3203
|
+
const settingsPath = path7.join(cursorDir, "settings.json");
|
|
2676
3204
|
const hooks = readJsonObject(hooksPath) ?? {
|
|
2677
3205
|
version: 1,
|
|
2678
3206
|
hooks: {}
|
|
@@ -2794,11 +3322,11 @@ function configureCodexHarness({
|
|
|
2794
3322
|
dryRun = false
|
|
2795
3323
|
}) {
|
|
2796
3324
|
const warnings = [];
|
|
2797
|
-
const marketplacePath =
|
|
2798
|
-
const rulesPath =
|
|
2799
|
-
const configPath =
|
|
2800
|
-
const legacyAgentsPath =
|
|
2801
|
-
const hooksPath =
|
|
3325
|
+
const marketplacePath = path7.join(home, ".agents", "plugins", "marketplace.json");
|
|
3326
|
+
const rulesPath = path7.join(home, ".codex", "rules", "default.rules");
|
|
3327
|
+
const configPath = path7.join(home, ".codex", "config.toml");
|
|
3328
|
+
const legacyAgentsPath = path7.join(home, ".codex", "AGENTS.md");
|
|
3329
|
+
const hooksPath = path7.join(installPath, ".codex-plugin", "hooks.json");
|
|
2802
3330
|
const currentMarketplace = readJsonObject(marketplacePath) ?? {
|
|
2803
3331
|
name: "overlord-local",
|
|
2804
3332
|
interface: { displayName: "Overlord Local Plugins" },
|
|
@@ -2830,7 +3358,7 @@ function configureCodexHarness({
|
|
|
2830
3358
|
);
|
|
2831
3359
|
return warnings;
|
|
2832
3360
|
}
|
|
2833
|
-
mkdirSync3(
|
|
3361
|
+
mkdirSync3(path7.dirname(marketplacePath), { recursive: true });
|
|
2834
3362
|
writeFileSync3(
|
|
2835
3363
|
marketplacePath,
|
|
2836
3364
|
`${JSON.stringify(
|
|
@@ -2847,7 +3375,7 @@ function configureCodexHarness({
|
|
|
2847
3375
|
`
|
|
2848
3376
|
);
|
|
2849
3377
|
const existingRules = existsSync6(rulesPath) ? readFileSync6(rulesPath, "utf8") : "";
|
|
2850
|
-
mkdirSync3(
|
|
3378
|
+
mkdirSync3(path7.dirname(rulesPath), { recursive: true });
|
|
2851
3379
|
writeFileSync3(rulesPath, mergeCodexRules(existingRules));
|
|
2852
3380
|
if (configurePermissions) {
|
|
2853
3381
|
const existingConfig = existsSync6(configPath) ? readFileSync6(configPath, "utf8") : "";
|
|
@@ -2884,10 +3412,10 @@ function configureClaudeHarness({
|
|
|
2884
3412
|
dryRun = false
|
|
2885
3413
|
}) {
|
|
2886
3414
|
const warnings = [];
|
|
2887
|
-
const marketplaceRoot =
|
|
2888
|
-
const marketplacePath =
|
|
2889
|
-
const relativeSource = `./${
|
|
2890
|
-
const configDir =
|
|
3415
|
+
const marketplaceRoot = path7.dirname(path7.dirname(installPath));
|
|
3416
|
+
const marketplacePath = path7.join(marketplaceRoot, ".claude-plugin", "marketplace.json");
|
|
3417
|
+
const relativeSource = `./${path7.relative(marketplaceRoot, installPath).split(path7.sep).join("/")}`;
|
|
3418
|
+
const configDir = path7.join(home, ".claude");
|
|
2891
3419
|
const marketplace = {
|
|
2892
3420
|
name: CLAUDE_MARKETPLACE_NAME,
|
|
2893
3421
|
owner: { name: "Cooperativ" },
|
|
@@ -2907,7 +3435,7 @@ function configureClaudeHarness({
|
|
|
2907
3435
|
);
|
|
2908
3436
|
return warnings;
|
|
2909
3437
|
}
|
|
2910
|
-
mkdirSync3(
|
|
3438
|
+
mkdirSync3(path7.dirname(marketplacePath), { recursive: true });
|
|
2911
3439
|
writeFileSync3(marketplacePath, `${JSON.stringify(marketplace, null, 2)}
|
|
2912
3440
|
`);
|
|
2913
3441
|
const runClaude = (args) => spawnSync("claude", args, {
|
|
@@ -2962,7 +3490,7 @@ function setupConnector({
|
|
|
2962
3490
|
}
|
|
2963
3491
|
const manifest = readConnectorManifest(agentKey);
|
|
2964
3492
|
const resolvedHome = resolveHome(home);
|
|
2965
|
-
const installPath = exportPath ?
|
|
3493
|
+
const installPath = exportPath ? path7.resolve(exportPath) : expandInstallPath(manifest.connector.installPath, resolvedHome);
|
|
2966
3494
|
const sourceDir = connectorDir(agentKey);
|
|
2967
3495
|
const warnings = [];
|
|
2968
3496
|
if (exportPath) {
|
|
@@ -2979,9 +3507,9 @@ function setupConnector({
|
|
|
2979
3507
|
const resolvedInstallPath = realpathSync(installPath);
|
|
2980
3508
|
for (const recorded of previousState.files) {
|
|
2981
3509
|
if (declaredFiles.has(recorded.path)) continue;
|
|
2982
|
-
const target =
|
|
3510
|
+
const target = path7.resolve(installPath, recorded.path);
|
|
2983
3511
|
const resolvedTarget = existsSync6(target) ? realpathSync(target) : target;
|
|
2984
|
-
if (!resolvedTarget.startsWith(`${resolvedInstallPath}${
|
|
3512
|
+
if (!resolvedTarget.startsWith(`${resolvedInstallPath}${path7.sep}`)) {
|
|
2985
3513
|
warnings.push(
|
|
2986
3514
|
`Refusing to remove obsolete managed path outside install root: ${recorded.path}`
|
|
2987
3515
|
);
|
|
@@ -3013,7 +3541,7 @@ function setupConnector({
|
|
|
3013
3541
|
warnings.push(message);
|
|
3014
3542
|
continue;
|
|
3015
3543
|
}
|
|
3016
|
-
const target =
|
|
3544
|
+
const target = path7.join(installPath, relativePath);
|
|
3017
3545
|
const executable = isExecutableManaged(relativePath);
|
|
3018
3546
|
const targetExists = existsSync6(target);
|
|
3019
3547
|
const unchanged = targetExists && sha256(readFileSync6(target)) === sha256(contents);
|
|
@@ -3025,7 +3553,7 @@ function setupConnector({
|
|
|
3025
3553
|
});
|
|
3026
3554
|
} else {
|
|
3027
3555
|
if (!unchanged) {
|
|
3028
|
-
mkdirSync3(
|
|
3556
|
+
mkdirSync3(path7.dirname(target), { recursive: true });
|
|
3029
3557
|
writeFileSync3(target, contents);
|
|
3030
3558
|
}
|
|
3031
3559
|
if (executable) {
|
|
@@ -3062,7 +3590,7 @@ function setupConnector({
|
|
|
3062
3590
|
}
|
|
3063
3591
|
if (!dryRun && !exportPath) {
|
|
3064
3592
|
const installedStateFiles = manifest.connector.managedFiles.map((relativePath) => {
|
|
3065
|
-
const target =
|
|
3593
|
+
const target = path7.join(installPath, relativePath);
|
|
3066
3594
|
if (!existsSync6(target)) return null;
|
|
3067
3595
|
return { path: relativePath, sha256: sha256(readFileSync6(target)) };
|
|
3068
3596
|
}).filter((entry) => entry !== null);
|
|
@@ -3075,7 +3603,7 @@ function setupConnector({
|
|
|
3075
3603
|
files: installedStateFiles
|
|
3076
3604
|
};
|
|
3077
3605
|
const statePath = installStatePath(agentKey, resolvedHome);
|
|
3078
|
-
mkdirSync3(
|
|
3606
|
+
mkdirSync3(path7.dirname(statePath), { recursive: true });
|
|
3079
3607
|
writeFileSync3(statePath, `${JSON.stringify(state, null, 2)}
|
|
3080
3608
|
`);
|
|
3081
3609
|
}
|
|
@@ -3143,7 +3671,7 @@ function inspectConnector({
|
|
|
3143
3671
|
}
|
|
3144
3672
|
const declared = new Set(manifest.connector.managedFiles);
|
|
3145
3673
|
for (const relativePath of manifest.connector.managedFiles) {
|
|
3146
|
-
const target =
|
|
3674
|
+
const target = path7.join(state.installPath, relativePath);
|
|
3147
3675
|
if (!existsSync6(target)) {
|
|
3148
3676
|
problems.push(`Missing managed file: ${relativePath}`);
|
|
3149
3677
|
continue;
|
|
@@ -3245,9 +3773,6 @@ var backend_client_exports = {};
|
|
|
3245
3773
|
__export(backend_client_exports, {
|
|
3246
3774
|
createBackendClient: () => createBackendClient
|
|
3247
3775
|
});
|
|
3248
|
-
function normalizeBaseUrl4(value2) {
|
|
3249
|
-
return value2.replace(/\/+$/, "");
|
|
3250
|
-
}
|
|
3251
3776
|
function resolveAuthHeaders({ baseUrl }) {
|
|
3252
3777
|
const fromEnv = process.env.OVERLORD_USER_TOKEN?.trim() || process.env.OVLD_USER_TOKEN?.trim() || process.env.USER_TOKEN?.trim();
|
|
3253
3778
|
if (fromEnv) {
|
|
@@ -3259,7 +3784,7 @@ function resolveAuthHeaders({ baseUrl }) {
|
|
|
3259
3784
|
}
|
|
3260
3785
|
const stored = readStoredAuthCredentials();
|
|
3261
3786
|
if (!stored) return { headers: {}, fromStored: false, storedCredentialBackendUrl: null };
|
|
3262
|
-
if (
|
|
3787
|
+
if (normalizeBaseUrl(stored.backendUrl) !== normalizeBaseUrl(baseUrl)) {
|
|
3263
3788
|
return { headers: {}, fromStored: false, storedCredentialBackendUrl: stored.backendUrl };
|
|
3264
3789
|
}
|
|
3265
3790
|
return {
|
|
@@ -3290,21 +3815,21 @@ function errorMessageFromJson2(value2) {
|
|
|
3290
3815
|
return parts.join(" \u2014 ");
|
|
3291
3816
|
}
|
|
3292
3817
|
function createBackendClient() {
|
|
3293
|
-
const baseUrl =
|
|
3818
|
+
const baseUrl = normalizeBaseUrl(resolveBackendUrl(loadConfig()));
|
|
3294
3819
|
const clientDevice = clientDeviceIdentity();
|
|
3295
3820
|
async function request({
|
|
3296
3821
|
method,
|
|
3297
|
-
path:
|
|
3822
|
+
path: path40,
|
|
3298
3823
|
body,
|
|
3299
3824
|
extraHeaders,
|
|
3300
3825
|
rawBody,
|
|
3301
3826
|
responseType = "json"
|
|
3302
3827
|
}) {
|
|
3303
|
-
const url2 = `${baseUrl}${
|
|
3828
|
+
const url2 = `${baseUrl}${path40.startsWith("/") ? path40 : `/${path40}`}`;
|
|
3304
3829
|
const auth = resolveAuthHeaders({ baseUrl });
|
|
3305
3830
|
if (auth.storedCredentialBackendUrl) {
|
|
3306
3831
|
throw new CliError({
|
|
3307
|
-
message: `Saved credentials are for ${
|
|
3832
|
+
message: `Saved credentials are for ${normalizeBaseUrl(auth.storedCredentialBackendUrl)}, but this CLI is configured for ${baseUrl}.
|
|
3308
3833
|
The backend URL may have changed. Run \`ovld auth login\` to sign in to the current backend.`
|
|
3309
3834
|
});
|
|
3310
3835
|
}
|
|
@@ -3336,14 +3861,14 @@ Start the Desktop/local backend or run \`ovld config set cloud <url>\`.
|
|
|
3336
3861
|
throw new CliError({ message: formatExecutionRequestAlreadyLinkedDiagnostic() });
|
|
3337
3862
|
}
|
|
3338
3863
|
if (response.status === 401 && auth.headers.Authorization) {
|
|
3339
|
-
const detail = errorMessageFromJson2(payload) ?? `Backend request failed: ${method} ${
|
|
3864
|
+
const detail = errorMessageFromJson2(payload) ?? `Backend request failed: ${method} ${path40} (${response.status})`;
|
|
3340
3865
|
throw new CliError({
|
|
3341
3866
|
message: `${detail}
|
|
3342
3867
|
` + (auth.fromStored ? "Your saved credentials were rejected. Run `ovld auth login` to sign in again." : "Run `ovld auth login` or refresh your USER_TOKEN environment variable.")
|
|
3343
3868
|
});
|
|
3344
3869
|
}
|
|
3345
3870
|
throw new CliError({
|
|
3346
|
-
message: errorMessageFromJson2(payload) ?? `Backend request failed: ${method} ${
|
|
3871
|
+
message: errorMessageFromJson2(payload) ?? `Backend request failed: ${method} ${path40} (${response.status})`
|
|
3347
3872
|
});
|
|
3348
3873
|
}
|
|
3349
3874
|
return payload;
|
|
@@ -3351,14 +3876,14 @@ Start the Desktop/local backend or run \`ovld config set cloud <url>\`.
|
|
|
3351
3876
|
return {
|
|
3352
3877
|
baseUrl,
|
|
3353
3878
|
health: () => request({ method: "GET", path: "/api/health" }),
|
|
3354
|
-
get: (
|
|
3355
|
-
getBytes: (
|
|
3356
|
-
post: ({ path:
|
|
3357
|
-
patch: ({ path:
|
|
3358
|
-
delete: (
|
|
3359
|
-
postRaw: ({ path:
|
|
3879
|
+
get: (path40) => request({ method: "GET", path: path40 }),
|
|
3880
|
+
getBytes: (path40) => request({ method: "GET", path: path40, responseType: "bytes" }),
|
|
3881
|
+
post: ({ path: path40, body }) => request({ method: "POST", path: path40, body }),
|
|
3882
|
+
patch: ({ path: path40, body }) => request({ method: "PATCH", path: path40, body }),
|
|
3883
|
+
delete: (path40) => request({ method: "DELETE", path: path40 }),
|
|
3884
|
+
postRaw: ({ path: path40, body, contentType, filename }) => request({
|
|
3360
3885
|
method: "POST",
|
|
3361
|
-
path:
|
|
3886
|
+
path: path40,
|
|
3362
3887
|
rawBody: body,
|
|
3363
3888
|
extraHeaders: {
|
|
3364
3889
|
"Content-Type": contentType || "application/octet-stream",
|
|
@@ -3370,6 +3895,7 @@ Start the Desktop/local backend or run \`ovld config set cloud <url>\`.
|
|
|
3370
3895
|
var init_backend_client = __esm({
|
|
3371
3896
|
"src/backend-client.ts"() {
|
|
3372
3897
|
"use strict";
|
|
3898
|
+
init_dist();
|
|
3373
3899
|
init_auth_credentials();
|
|
3374
3900
|
init_config();
|
|
3375
3901
|
init_device_identity2();
|
|
@@ -3593,7 +4119,7 @@ function terminalProfileToLaunchSettings(profile) {
|
|
|
3593
4119
|
var init_terminal_profile = __esm({
|
|
3594
4120
|
"src/terminal-profile.ts"() {
|
|
3595
4121
|
"use strict";
|
|
3596
|
-
|
|
4122
|
+
init_dist3();
|
|
3597
4123
|
init_config();
|
|
3598
4124
|
init_launch_settings();
|
|
3599
4125
|
init_terminal_launch_chord();
|
|
@@ -3631,27 +4157,11 @@ function shellQuote(value2) {
|
|
|
3631
4157
|
function launcherForApplicationName(appName) {
|
|
3632
4158
|
return `open -a ${shellQuote(appName.trim())} --args`;
|
|
3633
4159
|
}
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
defaultValue
|
|
3637
|
-
}) {
|
|
3638
|
-
if (!process.stdin.isTTY) {
|
|
3639
|
-
throw new CliError({
|
|
3640
|
-
message: "Interactive setup requires a TTY. Use `ovld config set ...` and `ovld agent-setup ...` for non-interactive setup."
|
|
3641
|
-
});
|
|
3642
|
-
}
|
|
3643
|
-
const { createInterface: createInterface5 } = await import("node:readline/promises");
|
|
3644
|
-
const rl = createInterface5({ input: process.stdin, output: process.stdout });
|
|
3645
|
-
try {
|
|
3646
|
-
const suffix = defaultValue ? ` [${defaultValue}]` : "";
|
|
3647
|
-
const answer = await rl.question(`${message}${suffix}: `);
|
|
3648
|
-
return answer.trim() || defaultValue || "";
|
|
3649
|
-
} finally {
|
|
3650
|
-
rl.close();
|
|
3651
|
-
}
|
|
4160
|
+
function promptLine3(options) {
|
|
4161
|
+
return promptLine({ ...options, nonInteractiveMessage: NON_INTERACTIVE_MESSAGE2 });
|
|
3652
4162
|
}
|
|
3653
4163
|
async function promptYesNo(message, defaultValue) {
|
|
3654
|
-
const answer = (await
|
|
4164
|
+
const answer = (await promptLine3({ message, defaultValue: defaultValue ? "Y" : "N" })).toLowerCase();
|
|
3655
4165
|
if (["y", "yes"].includes(answer)) return true;
|
|
3656
4166
|
if (["n", "no"].includes(answer)) return false;
|
|
3657
4167
|
throw new CliError({ message: "Answer yes or no." });
|
|
@@ -3660,9 +4170,9 @@ async function configureBackendForSetup() {
|
|
|
3660
4170
|
const targetPath = resolveConfigWritePath();
|
|
3661
4171
|
const current = loadConfig(targetPath);
|
|
3662
4172
|
printStepTitle("Step 1: Choose the backend the CLI should use.");
|
|
3663
|
-
const type = (await
|
|
4173
|
+
const type = (await promptLine3({ message: "Backend type (local/cloud)", defaultValue: current.backendMode })).toLowerCase();
|
|
3664
4174
|
if (type === "cloud") {
|
|
3665
|
-
const cloudUrl = await
|
|
4175
|
+
const cloudUrl = await promptLine3({
|
|
3666
4176
|
message: "Cloud backend URL",
|
|
3667
4177
|
defaultValue: current.backendMode === "cloud" ? current.backendUrl ?? void 0 : void 0
|
|
3668
4178
|
});
|
|
@@ -3687,7 +4197,7 @@ async function configureBackendForSetup() {
|
|
|
3687
4197
|
if (!hasDesktop) {
|
|
3688
4198
|
printLine(`Download Overlord Desktop: ${DESKTOP_DOWNLOAD_URL}`);
|
|
3689
4199
|
}
|
|
3690
|
-
const localUrl = await
|
|
4200
|
+
const localUrl = await promptLine3({
|
|
3691
4201
|
message: "Local backend URL",
|
|
3692
4202
|
defaultValue: current.backendUrl ?? DEFAULT_LOCAL_BACKEND_URL
|
|
3693
4203
|
});
|
|
@@ -3757,7 +4267,7 @@ async function configureAgentsForSetup() {
|
|
|
3757
4267
|
printLine("");
|
|
3758
4268
|
printStepTitle("Step 3: Configure agent connectors.");
|
|
3759
4269
|
printLine(`Available agents: ${available.join(", ")}`);
|
|
3760
|
-
const answer = await
|
|
4270
|
+
const answer = await promptLine3({
|
|
3761
4271
|
message: "Agents to configure (comma-separated, all, or none)",
|
|
3762
4272
|
defaultValue: "all"
|
|
3763
4273
|
});
|
|
@@ -3790,7 +4300,7 @@ async function promptTerminalLaunchChord({
|
|
|
3790
4300
|
CHORD_PRESETS.forEach((preset2, index) => {
|
|
3791
4301
|
printLine(` ${index + 1}. ${preset2.label}`);
|
|
3792
4302
|
});
|
|
3793
|
-
const answer = await
|
|
4303
|
+
const answer = await promptLine3({
|
|
3794
4304
|
message: "Split shortcut preset",
|
|
3795
4305
|
defaultValue: defaultValue ? "current" : "1"
|
|
3796
4306
|
});
|
|
@@ -3803,7 +4313,7 @@ async function promptTerminalLaunchChord({
|
|
|
3803
4313
|
if (preset?.chord) {
|
|
3804
4314
|
return preset.chord;
|
|
3805
4315
|
}
|
|
3806
|
-
const typed = await
|
|
4316
|
+
const typed = await promptLine3({
|
|
3807
4317
|
message: "Split shortcut (type, e.g. cmd+d)",
|
|
3808
4318
|
defaultValue: defaultValue ?? void 0
|
|
3809
4319
|
});
|
|
@@ -3827,7 +4337,7 @@ async function configureTerminalPlacementForSetup({
|
|
|
3827
4337
|
printLine(" 2. New tab");
|
|
3828
4338
|
printLine(" 3. Split pane (keyboard shortcut)");
|
|
3829
4339
|
const defaultPlacement = current.placement !== "window" || current.chord ? "current" : "1";
|
|
3830
|
-
const answer = await
|
|
4340
|
+
const answer = await promptLine3({
|
|
3831
4341
|
message: "Launch placement",
|
|
3832
4342
|
defaultValue: defaultPlacement
|
|
3833
4343
|
});
|
|
@@ -3893,7 +4403,7 @@ async function configureExecutionTargetForSetup({
|
|
|
3893
4403
|
printLine(' Skipped. Register it later with `ovld add-et --name "<name>"`.');
|
|
3894
4404
|
return { registered: false, reason: "declined" };
|
|
3895
4405
|
}
|
|
3896
|
-
const name = await
|
|
4406
|
+
const name = await promptLine3({ message: "Target name", defaultValue: hostname3() });
|
|
3897
4407
|
let result;
|
|
3898
4408
|
try {
|
|
3899
4409
|
result = asRecord(
|
|
@@ -3937,7 +4447,7 @@ async function configureTerminalForSetup({ runtime }) {
|
|
|
3937
4447
|
});
|
|
3938
4448
|
printLine(` ${TERMINAL_OPTIONS.length + 1}. Custom application name`);
|
|
3939
4449
|
printLine(` ${TERMINAL_OPTIONS.length + 2}. Inline in the current terminal`);
|
|
3940
|
-
const answer = await
|
|
4450
|
+
const answer = await promptLine3({
|
|
3941
4451
|
message: "Default terminal",
|
|
3942
4452
|
defaultValue: current.launcher ? "current" : "1"
|
|
3943
4453
|
});
|
|
@@ -3948,7 +4458,7 @@ async function configureTerminalForSetup({ runtime }) {
|
|
|
3948
4458
|
} else if (normalized === "inline" || normalized === String(TERMINAL_OPTIONS.length + 2)) {
|
|
3949
4459
|
terminalLauncher = null;
|
|
3950
4460
|
} else if (normalized === "custom" || normalized === String(TERMINAL_OPTIONS.length + 1)) {
|
|
3951
|
-
const appName = await
|
|
4461
|
+
const appName = await promptLine3({ message: "Terminal application name" });
|
|
3952
4462
|
if (!appName) throw new CliError({ message: "Terminal application name is required." });
|
|
3953
4463
|
terminalLauncher = launcherForApplicationName(appName);
|
|
3954
4464
|
} else {
|
|
@@ -4101,7 +4611,7 @@ async function runSetupCommand({
|
|
|
4101
4611
|
}
|
|
4102
4612
|
await runFullSetupCommand({ json: json2 });
|
|
4103
4613
|
}
|
|
4104
|
-
var DESKTOP_DOWNLOAD_URL, TERMINAL_OPTIONS, CHORD_PRESETS;
|
|
4614
|
+
var DESKTOP_DOWNLOAD_URL, TERMINAL_OPTIONS, NON_INTERACTIVE_MESSAGE2, CHORD_PRESETS;
|
|
4105
4615
|
var init_setup = __esm({
|
|
4106
4616
|
"src/setup.ts"() {
|
|
4107
4617
|
"use strict";
|
|
@@ -4112,6 +4622,7 @@ var init_setup = __esm({
|
|
|
4112
4622
|
init_connectors();
|
|
4113
4623
|
init_errors();
|
|
4114
4624
|
init_output();
|
|
4625
|
+
init_prompt();
|
|
4115
4626
|
init_runtime();
|
|
4116
4627
|
init_terminal_launch_chord();
|
|
4117
4628
|
init_terminal_profile();
|
|
@@ -4125,6 +4636,7 @@ var init_setup = __esm({
|
|
|
4125
4636
|
{ label: "Alacritty", launcher: "open -a 'Alacritty' --args" },
|
|
4126
4637
|
{ label: "Kitty", launcher: "open -a 'kitty' --args" }
|
|
4127
4638
|
];
|
|
4639
|
+
NON_INTERACTIVE_MESSAGE2 = "Interactive setup requires a TTY. Use `ovld config set ...` and `ovld agent-setup ...` for non-interactive setup.";
|
|
4128
4640
|
CHORD_PRESETS = [
|
|
4129
4641
|
{ label: "cmd+d (vertical split)", chord: "cmd+d" },
|
|
4130
4642
|
{ label: "cmd+shift+d (horizontal split)", chord: "cmd+shift+d" },
|
|
@@ -4369,12 +4881,12 @@ import {
|
|
|
4369
4881
|
rmSync as rmSync2,
|
|
4370
4882
|
unlinkSync as unlinkSync2
|
|
4371
4883
|
} from "node:fs";
|
|
4372
|
-
import
|
|
4884
|
+
import path8 from "node:path";
|
|
4373
4885
|
function projectTmpDir(workingDirectory) {
|
|
4374
|
-
return
|
|
4886
|
+
return path8.join(workingDirectory, ".overlord", "tmp");
|
|
4375
4887
|
}
|
|
4376
4888
|
function projectTmpSessionsDir(workingDirectory) {
|
|
4377
|
-
return
|
|
4889
|
+
return path8.join(projectTmpDir(workingDirectory), PROJECT_TMP_SESSIONS_DIRNAME);
|
|
4378
4890
|
}
|
|
4379
4891
|
function safeTmpNamePart(value2) {
|
|
4380
4892
|
return value2.replace(/[^a-zA-Z0-9_-]/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -4389,9 +4901,9 @@ function sessionScratchName({
|
|
|
4389
4901
|
return `${identity || "launch"}-${request || "launch"}`;
|
|
4390
4902
|
}
|
|
4391
4903
|
function isSessionScratchDir(workingDirectory, candidate) {
|
|
4392
|
-
const sessionsDir =
|
|
4393
|
-
const resolved =
|
|
4394
|
-
return
|
|
4904
|
+
const sessionsDir = path8.resolve(projectTmpSessionsDir(workingDirectory));
|
|
4905
|
+
const resolved = path8.resolve(candidate);
|
|
4906
|
+
return path8.dirname(resolved) === sessionsDir && path8.basename(resolved).length > 0;
|
|
4395
4907
|
}
|
|
4396
4908
|
function removeSessionScratch({
|
|
4397
4909
|
workingDirectory,
|
|
@@ -4409,9 +4921,9 @@ function removeSessionScratch({
|
|
|
4409
4921
|
}
|
|
4410
4922
|
}
|
|
4411
4923
|
if (contextFile?.trim()) {
|
|
4412
|
-
const tmpDir =
|
|
4413
|
-
const resolved =
|
|
4414
|
-
if (
|
|
4924
|
+
const tmpDir = path8.resolve(projectTmpDir(workingDirectory));
|
|
4925
|
+
const resolved = path8.resolve(contextFile);
|
|
4926
|
+
if (path8.dirname(resolved) === tmpDir && resolved.endsWith(".md")) {
|
|
4415
4927
|
try {
|
|
4416
4928
|
if (existsSync8(resolved)) {
|
|
4417
4929
|
unlinkSync2(resolved);
|
|
@@ -4450,7 +4962,7 @@ function pruneProjectTmpContents(workingDirectory, {
|
|
|
4450
4962
|
isSessionLive = () => false,
|
|
4451
4963
|
force = false
|
|
4452
4964
|
} = {}) {
|
|
4453
|
-
const overlordDir =
|
|
4965
|
+
const overlordDir = path8.join(workingDirectory, ".overlord");
|
|
4454
4966
|
if (!existsSync8(overlordDir)) {
|
|
4455
4967
|
return { warned: true, removedCount: 0, skippedCount: 0 };
|
|
4456
4968
|
}
|
|
@@ -4462,14 +4974,14 @@ function pruneProjectTmpContents(workingDirectory, {
|
|
|
4462
4974
|
let skippedCount = 0;
|
|
4463
4975
|
const entries = readdirSync2(tmpDir, { withFileTypes: true, encoding: "utf8" });
|
|
4464
4976
|
for (const entry of entries) {
|
|
4465
|
-
const target =
|
|
4977
|
+
const target = path8.join(tmpDir, entry.name);
|
|
4466
4978
|
if (entry.name === PROJECT_TMP_SESSIONS_DIRNAME && entry.isDirectory() && !force) {
|
|
4467
4979
|
for (const session of readdirSync2(target, { withFileTypes: true, encoding: "utf8" })) {
|
|
4468
4980
|
if (session.isDirectory() && isSessionLive(session.name)) {
|
|
4469
4981
|
skippedCount += 1;
|
|
4470
4982
|
continue;
|
|
4471
4983
|
}
|
|
4472
|
-
removeEntry(
|
|
4984
|
+
removeEntry(path8.join(target, session.name), session.isSymbolicLink());
|
|
4473
4985
|
removedCount += 1;
|
|
4474
4986
|
}
|
|
4475
4987
|
continue;
|
|
@@ -4494,7 +5006,7 @@ function pruneSessionDirs(sessionsDir, options) {
|
|
|
4494
5006
|
return;
|
|
4495
5007
|
}
|
|
4496
5008
|
for (const entry of entries) {
|
|
4497
|
-
const target =
|
|
5009
|
+
const target = path8.join(sessionsDir, entry.name);
|
|
4498
5010
|
if (entry.isDirectory() && options.isSessionLive(entry.name)) continue;
|
|
4499
5011
|
try {
|
|
4500
5012
|
const stats = lstatSync2(target);
|
|
@@ -4512,7 +5024,7 @@ function pruneChildren(directory, cutoff, sessions) {
|
|
|
4512
5024
|
return;
|
|
4513
5025
|
}
|
|
4514
5026
|
for (const entry of entries) {
|
|
4515
|
-
const target =
|
|
5027
|
+
const target = path8.join(directory, entry.name);
|
|
4516
5028
|
if (sessions && entry.isDirectory() && target === sessions.sessionsDir) {
|
|
4517
5029
|
pruneSessionDirs(target, sessions);
|
|
4518
5030
|
continue;
|
|
@@ -4562,7 +5074,7 @@ var init_project_tmp = __esm({
|
|
|
4562
5074
|
});
|
|
4563
5075
|
|
|
4564
5076
|
// ../packages/core/dist/service/agent-session/pure/evidence-path.js
|
|
4565
|
-
import
|
|
5077
|
+
import path9 from "node:path";
|
|
4566
5078
|
function hasControlCharacters(value2) {
|
|
4567
5079
|
for (let index = 0; index < value2.length; index += 1) {
|
|
4568
5080
|
const code = value2.charCodeAt(index);
|
|
@@ -4583,30 +5095,30 @@ function isExactEvidencePath(value2) {
|
|
|
4583
5095
|
if (value2.length === 0 || value2.length > MAX_EVIDENCE_PATH_LENGTH || value2 !== value2.trim() || hasUnsafePathCharacters(value2)) {
|
|
4584
5096
|
return false;
|
|
4585
5097
|
}
|
|
4586
|
-
const slashPath =
|
|
4587
|
-
if (
|
|
5098
|
+
const slashPath = path9.sep === "\\" ? value2.replace(/\\/g, "/") : value2;
|
|
5099
|
+
if (path9.posix.isAbsolute(slashPath) || /^[a-z]:/i.test(slashPath))
|
|
4588
5100
|
return false;
|
|
4589
5101
|
if (slashPath === "." || slashPath === ".." || slashPath.startsWith("../"))
|
|
4590
5102
|
return false;
|
|
4591
|
-
return
|
|
5103
|
+
return path9.posix.normalize(slashPath) === slashPath;
|
|
4592
5104
|
}
|
|
4593
5105
|
function reduceEvidencePath(rawPath, projectRoot) {
|
|
4594
|
-
if (typeof rawPath !== "string" || rawPath.length === 0 || rawPath.length > MAX_EVIDENCE_INPUT_LENGTH || rawPath !== rawPath.trim() || hasControlCharacters(rawPath) ||
|
|
5106
|
+
if (typeof rawPath !== "string" || rawPath.length === 0 || rawPath.length > MAX_EVIDENCE_INPUT_LENGTH || rawPath !== rawPath.trim() || hasControlCharacters(rawPath) || path9.sep === "/" && rawPath.includes("\\")) {
|
|
4595
5107
|
return null;
|
|
4596
5108
|
}
|
|
4597
|
-
const absolute =
|
|
5109
|
+
const absolute = path9.isAbsolute(rawPath);
|
|
4598
5110
|
if (!absolute && (/^[a-z]:[\\/]/i.test(rawPath) || rawPath.startsWith("\\\\")))
|
|
4599
5111
|
return null;
|
|
4600
5112
|
let relative = rawPath;
|
|
4601
5113
|
if (absolute) {
|
|
4602
|
-
if (!projectRoot || !
|
|
5114
|
+
if (!projectRoot || !path9.isAbsolute(projectRoot) || hasControlCharacters(projectRoot)) {
|
|
4603
5115
|
return null;
|
|
4604
5116
|
}
|
|
4605
|
-
if (
|
|
5117
|
+
if (path9.normalize(rawPath) !== rawPath)
|
|
4606
5118
|
return null;
|
|
4607
|
-
relative =
|
|
5119
|
+
relative = path9.relative(path9.normalize(projectRoot), rawPath);
|
|
4608
5120
|
}
|
|
4609
|
-
if (
|
|
5121
|
+
if (path9.sep === "\\")
|
|
4610
5122
|
relative = relative.replace(/\\/g, "/");
|
|
4611
5123
|
return isExactEvidencePath(relative) ? relative : null;
|
|
4612
5124
|
}
|
|
@@ -4635,7 +5147,7 @@ import {
|
|
|
4635
5147
|
unlinkSync as unlinkSync3,
|
|
4636
5148
|
writeFileSync as writeFileSync4
|
|
4637
5149
|
} from "node:fs";
|
|
4638
|
-
import
|
|
5150
|
+
import path10 from "node:path";
|
|
4639
5151
|
function sleepSync(milliseconds) {
|
|
4640
5152
|
Atomics.wait(sleepArray, 0, 0, milliseconds);
|
|
4641
5153
|
}
|
|
@@ -4674,7 +5186,7 @@ function readBoundedUtf8File(filePath, maxBytes) {
|
|
|
4674
5186
|
}
|
|
4675
5187
|
}
|
|
4676
5188
|
function canonicalDirectory(directory) {
|
|
4677
|
-
const resolved =
|
|
5189
|
+
const resolved = path10.resolve(directory);
|
|
4678
5190
|
try {
|
|
4679
5191
|
return realpathSync2(resolved);
|
|
4680
5192
|
} catch {
|
|
@@ -4686,7 +5198,7 @@ function ensureOwnerOnlyDirectory(directory) {
|
|
|
4686
5198
|
chmodSync3(directory, 448);
|
|
4687
5199
|
}
|
|
4688
5200
|
function writeOwnerOnlyFileAtomically(target, contents) {
|
|
4689
|
-
ensureOwnerOnlyDirectory(
|
|
5201
|
+
ensureOwnerOnlyDirectory(path10.dirname(target));
|
|
4690
5202
|
const temporary = `${target}.${randomUUID()}.tmp`;
|
|
4691
5203
|
try {
|
|
4692
5204
|
writeFileSync4(temporary, contents, { mode: 384 });
|
|
@@ -4788,7 +5300,7 @@ function recoverStaleLock(lockPath, staleAfterMs) {
|
|
|
4788
5300
|
}
|
|
4789
5301
|
}
|
|
4790
5302
|
function withLocalFileLock(target, action, options = {}) {
|
|
4791
|
-
ensureOwnerOnlyDirectory(
|
|
5303
|
+
ensureOwnerOnlyDirectory(path10.dirname(target));
|
|
4792
5304
|
const lockPath = `${target}.lock`;
|
|
4793
5305
|
const deadline = Date.now() + (options.timeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS);
|
|
4794
5306
|
const staleAfterMs = options.staleAfterMs ?? DEFAULT_STALE_LOCK_MS;
|
|
@@ -4860,14 +5372,14 @@ var init_local_file_storage = __esm({
|
|
|
4860
5372
|
// src/change-ledger.ts
|
|
4861
5373
|
import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
|
|
4862
5374
|
import { existsSync as existsSync10, realpathSync as realpathSync3, unlinkSync as unlinkSync4 } from "node:fs";
|
|
4863
|
-
import
|
|
5375
|
+
import path11 from "node:path";
|
|
4864
5376
|
function canonicalObjectiveId(objectiveId) {
|
|
4865
5377
|
return typeof objectiveId === "string" ? objectiveId.trim() : "";
|
|
4866
5378
|
}
|
|
4867
5379
|
function ledgerPath(input) {
|
|
4868
5380
|
const material = `${canonicalDirectory(input.workingDirectory)}\0${canonicalObjectiveId(input.objectiveId)}\0${input.sessionKey.trim()}`;
|
|
4869
5381
|
const key = createHash3("sha256").update(material).digest("hex");
|
|
4870
|
-
return
|
|
5382
|
+
return path11.join(resolveGlobalDataDir(), "change-ledgers", `${key}.json`);
|
|
4871
5383
|
}
|
|
4872
5384
|
function sessionKeyHash(sessionKey) {
|
|
4873
5385
|
return createHash3("sha256").update(sessionKey.trim()).digest("hex");
|
|
@@ -5015,7 +5527,7 @@ function compileIgnorePattern(rawPattern) {
|
|
|
5015
5527
|
}
|
|
5016
5528
|
}
|
|
5017
5529
|
function loadIgnoreRules(root) {
|
|
5018
|
-
const target =
|
|
5530
|
+
const target = path11.join(root, ".overlordignore");
|
|
5019
5531
|
if (!existsSync10(target)) return { rules: [], unavailable: false };
|
|
5020
5532
|
const contents = readBoundedUtf8File(target, MAX_IGNORE_FILE_BYTES);
|
|
5021
5533
|
if (contents === null) return { rules: [], unavailable: true };
|
|
@@ -5045,15 +5557,15 @@ function canonicalCandidate(absolutePath) {
|
|
|
5045
5557
|
let existing = absolutePath;
|
|
5046
5558
|
const suffix = [];
|
|
5047
5559
|
while (!existsSync10(existing)) {
|
|
5048
|
-
const parent =
|
|
5049
|
-
if (parent === existing) return
|
|
5050
|
-
suffix.unshift(
|
|
5560
|
+
const parent = path11.dirname(existing);
|
|
5561
|
+
if (parent === existing) return path11.resolve(absolutePath);
|
|
5562
|
+
suffix.unshift(path11.basename(existing));
|
|
5051
5563
|
existing = parent;
|
|
5052
5564
|
}
|
|
5053
5565
|
try {
|
|
5054
|
-
return
|
|
5566
|
+
return path11.resolve(realpathSync3(existing), ...suffix);
|
|
5055
5567
|
} catch {
|
|
5056
|
-
return
|
|
5568
|
+
return path11.resolve(absolutePath);
|
|
5057
5569
|
}
|
|
5058
5570
|
}
|
|
5059
5571
|
function normalizeWorkspacePath({
|
|
@@ -5064,20 +5576,20 @@ function normalizeWorkspacePath({
|
|
|
5064
5576
|
const trimmed7 = rawPath.trim();
|
|
5065
5577
|
if (trimmed7 !== rawPath) return { reason: "invalid_path" };
|
|
5066
5578
|
if (!trimmed7 || trimmed7.includes("\0")) return { reason: "invalid_path" };
|
|
5067
|
-
if (
|
|
5579
|
+
if (path11.sep === "/" && trimmed7.includes("\\")) return { reason: "invalid_path" };
|
|
5068
5580
|
if (trimmed7.length > root.length + MAX_EVIDENCE_PATH_LENGTH + 2) {
|
|
5069
5581
|
return { reason: "path_too_long" };
|
|
5070
5582
|
}
|
|
5071
5583
|
let candidate;
|
|
5072
5584
|
try {
|
|
5073
5585
|
candidate = canonicalCandidate(
|
|
5074
|
-
|
|
5586
|
+
path11.isAbsolute(trimmed7) ? path11.resolve(trimmed7) : path11.resolve(root, trimmed7)
|
|
5075
5587
|
);
|
|
5076
5588
|
} catch {
|
|
5077
5589
|
return { reason: "invalid_path" };
|
|
5078
5590
|
}
|
|
5079
|
-
const relative =
|
|
5080
|
-
if (!relative || relative === ".." || relative.startsWith("../") ||
|
|
5591
|
+
const relative = path11.relative(root, candidate).replace(/\\/g, "/");
|
|
5592
|
+
if (!relative || relative === ".." || relative.startsWith("../") || path11.isAbsolute(relative)) {
|
|
5081
5593
|
return { reason: "outside_workspace_path" };
|
|
5082
5594
|
}
|
|
5083
5595
|
if (relative.length > MAX_EVIDENCE_PATH_LENGTH) return { reason: "path_too_long" };
|
|
@@ -5258,7 +5770,7 @@ __export(active_objective_sessions_exports, {
|
|
|
5258
5770
|
});
|
|
5259
5771
|
import { createHash as createHash4 } from "node:crypto";
|
|
5260
5772
|
import { existsSync as existsSync11, readdirSync as readdirSync3 } from "node:fs";
|
|
5261
|
-
import
|
|
5773
|
+
import path12 from "node:path";
|
|
5262
5774
|
function normalizeIdentifier(value2) {
|
|
5263
5775
|
return typeof value2 === "string" ? value2.trim() : "";
|
|
5264
5776
|
}
|
|
@@ -5267,7 +5779,7 @@ function isValidIdentifier(value2) {
|
|
|
5267
5779
|
}
|
|
5268
5780
|
function manifestPath2(workingDirectory) {
|
|
5269
5781
|
const key = createHash4("sha256").update(canonicalDirectory(workingDirectory)).digest("hex");
|
|
5270
|
-
return
|
|
5782
|
+
return path12.join(resolveGlobalDataDir(), "active-objective-sessions", `${key}.json`);
|
|
5271
5783
|
}
|
|
5272
5784
|
function emptyManifest(workingDirectory) {
|
|
5273
5785
|
return {
|
|
@@ -5425,8 +5937,8 @@ function pathIsUnderWorkingDirectory({
|
|
|
5425
5937
|
workingDirectory
|
|
5426
5938
|
}) {
|
|
5427
5939
|
const root = canonicalDirectory(workingDirectory);
|
|
5428
|
-
const resolved =
|
|
5429
|
-
return resolved === root || resolved.startsWith(`${root}${
|
|
5940
|
+
const resolved = path12.resolve(absolutePath);
|
|
5941
|
+
return resolved === root || resolved.startsWith(`${root}${path12.sep}`);
|
|
5430
5942
|
}
|
|
5431
5943
|
function resolveWorkingDirectoryForObjective({
|
|
5432
5944
|
objectiveId,
|
|
@@ -5435,19 +5947,19 @@ function resolveWorkingDirectoryForObjective({
|
|
|
5435
5947
|
}) {
|
|
5436
5948
|
const requested = normalizeIdentifier(objectiveId);
|
|
5437
5949
|
if (!isValidIdentifier(requested)) return null;
|
|
5438
|
-
const candidate =
|
|
5950
|
+
const candidate = path12.resolve(candidateWorkingDirectory);
|
|
5439
5951
|
const local = readManifest(candidate);
|
|
5440
5952
|
if (local && resolveEntry(local.entries, requested)) {
|
|
5441
5953
|
return local.workingDirectory;
|
|
5442
5954
|
}
|
|
5443
5955
|
const matches = [];
|
|
5444
|
-
const root =
|
|
5956
|
+
const root = path12.join(resolveGlobalDataDir(), "active-objective-sessions");
|
|
5445
5957
|
try {
|
|
5446
5958
|
if (!existsSync11(root)) return null;
|
|
5447
5959
|
for (const name of readdirSync3(root).slice(0, MAX_ACTIVE_SESSION_MANIFEST_FILES)) {
|
|
5448
5960
|
if (!name.endsWith(".json")) continue;
|
|
5449
5961
|
try {
|
|
5450
|
-
const raw = readBoundedUtf8File(
|
|
5962
|
+
const raw = readBoundedUtf8File(path12.join(root, name), MAX_ACTIVE_SESSION_MANIFEST_BYTES);
|
|
5451
5963
|
if (raw === null) continue;
|
|
5452
5964
|
const value2 = JSON.parse(raw);
|
|
5453
5965
|
if (value2.schemaVersion !== 3 || typeof value2.workingDirectory !== "string" || !Array.isArray(value2.entries)) {
|
|
@@ -5468,7 +5980,7 @@ function resolveWorkingDirectoryForObjective({
|
|
|
5468
5980
|
}
|
|
5469
5981
|
if (matches.length === 0) return null;
|
|
5470
5982
|
if (matches.length === 1) return matches[0] ?? null;
|
|
5471
|
-
const absoluteHints = pathHints.filter((hint) => typeof hint === "string" &&
|
|
5983
|
+
const absoluteHints = pathHints.filter((hint) => typeof hint === "string" && path12.isAbsolute(hint)).map((hint) => path12.resolve(hint));
|
|
5472
5984
|
if (absoluteHints.length === 0) return null;
|
|
5473
5985
|
const hinted = matches.filter(
|
|
5474
5986
|
(workingDirectory) => absoluteHints.some(
|
|
@@ -6767,7 +7279,7 @@ __export(descriptor_exports, {
|
|
|
6767
7279
|
});
|
|
6768
7280
|
import { createHash as createHash5 } from "node:crypto";
|
|
6769
7281
|
import { existsSync as existsSync12, readFileSync as readFileSync9 } from "node:fs";
|
|
6770
|
-
import
|
|
7282
|
+
import path13 from "node:path";
|
|
6771
7283
|
function inspectInstalledDescriptor({
|
|
6772
7284
|
agentKey,
|
|
6773
7285
|
installPath
|
|
@@ -6792,7 +7304,7 @@ function inspectInstalledDescriptor({
|
|
|
6792
7304
|
if (!installPath) {
|
|
6793
7305
|
return { ...base, detail: "connector not installed \u2014 nothing to compare" };
|
|
6794
7306
|
}
|
|
6795
|
-
const descriptorPath =
|
|
7307
|
+
const descriptorPath = path13.join(installPath, INSTALLED_DESCRIPTOR_FILENAME);
|
|
6796
7308
|
if (!existsSync12(descriptorPath)) {
|
|
6797
7309
|
return {
|
|
6798
7310
|
...base,
|
|
@@ -6822,10 +7334,10 @@ var init_descriptor = __esm({
|
|
|
6822
7334
|
// src/active-mission.ts
|
|
6823
7335
|
import { createHash as createHash6 } from "node:crypto";
|
|
6824
7336
|
import { existsSync as existsSync13, mkdirSync as mkdirSync6, readFileSync as readFileSync10, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "node:fs";
|
|
6825
|
-
import
|
|
7337
|
+
import path14 from "node:path";
|
|
6826
7338
|
function pointerPath(workingDirectory) {
|
|
6827
|
-
const key = createHash6("sha256").update(
|
|
6828
|
-
return
|
|
7339
|
+
const key = createHash6("sha256").update(path14.resolve(workingDirectory)).digest("hex");
|
|
7340
|
+
return path14.join(resolveGlobalDataDir(), "active-mission", `${key}.json`);
|
|
6829
7341
|
}
|
|
6830
7342
|
function writeActiveMissionPointer({
|
|
6831
7343
|
workingDirectory,
|
|
@@ -6838,7 +7350,7 @@ function writeActiveMissionPointer({
|
|
|
6838
7350
|
const trimmedDisplay = displayId.trim();
|
|
6839
7351
|
if (!trimmedMission || !trimmedDisplay) return;
|
|
6840
7352
|
const filePath = pointerPath(workingDirectory);
|
|
6841
|
-
mkdirSync6(
|
|
7353
|
+
mkdirSync6(path14.dirname(filePath), { recursive: true });
|
|
6842
7354
|
const payload = {
|
|
6843
7355
|
missionId: trimmedMission,
|
|
6844
7356
|
displayId: trimmedDisplay,
|
|
@@ -6885,17 +7397,17 @@ var init_active_mission = __esm({
|
|
|
6885
7397
|
import { createHash as createHash7 } from "node:crypto";
|
|
6886
7398
|
import { existsSync as existsSync14, mkdirSync as mkdirSync7, readdirSync as readdirSync4, readFileSync as readFileSync11, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
6887
7399
|
import { homedir } from "node:os";
|
|
6888
|
-
import
|
|
7400
|
+
import path15 from "node:path";
|
|
6889
7401
|
function sessionCachePath({
|
|
6890
7402
|
agent,
|
|
6891
7403
|
missionId,
|
|
6892
7404
|
workingDirectory,
|
|
6893
7405
|
objectiveId
|
|
6894
7406
|
}) {
|
|
6895
|
-
const resolved =
|
|
7407
|
+
const resolved = path15.resolve(workingDirectory);
|
|
6896
7408
|
const material = objectiveId?.trim() ? `${resolved}\0${missionId}\0${agent}\0${objectiveId.trim()}` : `${resolved}\0${missionId}\0${agent}`;
|
|
6897
7409
|
const key = createHash7("sha256").update(material).digest("hex");
|
|
6898
|
-
return
|
|
7410
|
+
return path15.join(resolveGlobalDataDir(), "native-sessions", key);
|
|
6899
7411
|
}
|
|
6900
7412
|
function readCachedNativeSessionId({
|
|
6901
7413
|
agent,
|
|
@@ -6934,7 +7446,7 @@ function writeNativeSessionId({
|
|
|
6934
7446
|
externalSessionId
|
|
6935
7447
|
});
|
|
6936
7448
|
const write = (filePath) => {
|
|
6937
|
-
mkdirSync7(
|
|
7449
|
+
mkdirSync7(path15.dirname(filePath), { recursive: true });
|
|
6938
7450
|
writeFileSync6(filePath, payload, "utf8");
|
|
6939
7451
|
};
|
|
6940
7452
|
write(
|
|
@@ -6956,12 +7468,12 @@ function writeNativeSessionId({
|
|
|
6956
7468
|
}
|
|
6957
7469
|
}
|
|
6958
7470
|
function detectCodexSessionIdFromDisk(workingDirectory) {
|
|
6959
|
-
const sessionsDir =
|
|
7471
|
+
const sessionsDir = path15.join(homedir(), ".codex", "sessions");
|
|
6960
7472
|
if (!existsSync14(sessionsDir)) return void 0;
|
|
6961
7473
|
const candidates = [];
|
|
6962
7474
|
const visit = (dir) => {
|
|
6963
7475
|
for (const entry of readdirSync4(dir, { withFileTypes: true })) {
|
|
6964
|
-
const filePath =
|
|
7476
|
+
const filePath = path15.join(dir, entry.name);
|
|
6965
7477
|
if (entry.isDirectory()) {
|
|
6966
7478
|
visit(filePath);
|
|
6967
7479
|
continue;
|
|
@@ -6989,15 +7501,15 @@ function detectCodexSessionIdFromDisk(workingDirectory) {
|
|
|
6989
7501
|
const [firstLine = ""] = readFileSync11(candidate.filePath, "utf8").split(/\r?\n/, 1);
|
|
6990
7502
|
const obj = JSON.parse(firstLine);
|
|
6991
7503
|
const payload = obj.payload && typeof obj.payload === "object" ? obj.payload : obj;
|
|
6992
|
-
if (typeof payload.id === "string") nativeId = payload.id.match(
|
|
7504
|
+
if (typeof payload.id === "string") nativeId = payload.id.match(UUID_RE2)?.[0];
|
|
6993
7505
|
if (typeof payload.cwd === "string") cwd = payload.cwd;
|
|
6994
7506
|
} catch {
|
|
6995
7507
|
nativeId = void 0;
|
|
6996
7508
|
}
|
|
6997
|
-
nativeId ??=
|
|
7509
|
+
nativeId ??= path15.basename(candidate.filePath).match(UUID_RE2)?.[0];
|
|
6998
7510
|
if (!nativeId) continue;
|
|
6999
7511
|
fallback ??= nativeId;
|
|
7000
|
-
if (cwd &&
|
|
7512
|
+
if (cwd && path15.resolve(cwd) === path15.resolve(workingDirectory)) return nativeId;
|
|
7001
7513
|
}
|
|
7002
7514
|
return fallback;
|
|
7003
7515
|
}
|
|
@@ -7025,12 +7537,12 @@ function resolveNativeSessionId({
|
|
|
7025
7537
|
}
|
|
7026
7538
|
return cached2;
|
|
7027
7539
|
}
|
|
7028
|
-
var
|
|
7540
|
+
var UUID_RE2;
|
|
7029
7541
|
var init_native_session = __esm({
|
|
7030
7542
|
"src/native-session.ts"() {
|
|
7031
7543
|
"use strict";
|
|
7032
7544
|
init_config();
|
|
7033
|
-
|
|
7545
|
+
UUID_RE2 = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;
|
|
7034
7546
|
}
|
|
7035
7547
|
});
|
|
7036
7548
|
|
|
@@ -7110,13 +7622,13 @@ import {
|
|
|
7110
7622
|
rmSync as rmSync4,
|
|
7111
7623
|
writeFileSync as writeFileSync7
|
|
7112
7624
|
} from "node:fs";
|
|
7113
|
-
import
|
|
7625
|
+
import path16 from "node:path";
|
|
7114
7626
|
function credentialDir() {
|
|
7115
|
-
return
|
|
7627
|
+
return path16.join(resolveGlobalDataDir(), "agent-session-channels");
|
|
7116
7628
|
}
|
|
7117
7629
|
function credentialPath(channelId) {
|
|
7118
7630
|
const key = createHash8("sha256").update(channelId).digest("hex");
|
|
7119
|
-
return
|
|
7631
|
+
return path16.join(credentialDir(), key);
|
|
7120
7632
|
}
|
|
7121
7633
|
function writeChannelCredential({
|
|
7122
7634
|
channelId,
|
|
@@ -7177,9 +7689,9 @@ var sync_root_exports = {};
|
|
|
7177
7689
|
__export(sync_root_exports, {
|
|
7178
7690
|
detectCloudSyncRoot: () => detectCloudSyncRoot
|
|
7179
7691
|
});
|
|
7180
|
-
import
|
|
7692
|
+
import path17 from "node:path";
|
|
7181
7693
|
function detectCloudSyncRoot(dir) {
|
|
7182
|
-
const normalized =
|
|
7694
|
+
const normalized = path17.resolve(dir).split(path17.sep).join("/");
|
|
7183
7695
|
const segments = normalized.split("/").filter(Boolean);
|
|
7184
7696
|
for (const rule of RULES) {
|
|
7185
7697
|
if (rule.joined && rule.joined.test(normalized)) {
|
|
@@ -7254,27 +7766,11 @@ var management_exports = {};
|
|
|
7254
7766
|
__export(management_exports, {
|
|
7255
7767
|
runLocalCommand: () => runLocalCommand
|
|
7256
7768
|
});
|
|
7257
|
-
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
7258
7769
|
function isHttpUrl2(value2) {
|
|
7259
7770
|
return /^https?:\/\//i.test(value2.trim());
|
|
7260
7771
|
}
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
defaultValue
|
|
7264
|
-
}) {
|
|
7265
|
-
if (!process.stdin.isTTY) {
|
|
7266
|
-
throw new CliError({
|
|
7267
|
-
message: "Interactive backend configuration requires a TTY. Run `ovld config set local [url]` or `ovld config set cloud <url>`."
|
|
7268
|
-
});
|
|
7269
|
-
}
|
|
7270
|
-
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
7271
|
-
try {
|
|
7272
|
-
const suffix = defaultValue ? ` [${defaultValue}]` : "";
|
|
7273
|
-
const answer = await rl.question(`${message}${suffix}: `);
|
|
7274
|
-
return answer.trim() || defaultValue || "";
|
|
7275
|
-
} finally {
|
|
7276
|
-
rl.close();
|
|
7277
|
-
}
|
|
7772
|
+
function promptLine4(options) {
|
|
7773
|
+
return promptLine({ ...options, nonInteractiveMessage: NON_INTERACTIVE_MESSAGE3 });
|
|
7278
7774
|
}
|
|
7279
7775
|
async function configureBackendInteractive() {
|
|
7280
7776
|
const { DEFAULT_LOCAL_BACKEND_URL: DEFAULT_LOCAL_BACKEND_URL2, loadConfig: loadConfig2, resolveConfigWritePath: resolveConfigWritePath2, writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
@@ -7282,14 +7778,14 @@ async function configureBackendInteractive() {
|
|
|
7282
7778
|
console.log(
|
|
7283
7779
|
"Use local for a Desktop/local backend on this machine, or cloud for a hosted Overlord backend."
|
|
7284
7780
|
);
|
|
7285
|
-
const type = (await
|
|
7781
|
+
const type = (await promptLine4({
|
|
7286
7782
|
message: "Backend type (local/cloud)",
|
|
7287
7783
|
defaultValue: "local"
|
|
7288
7784
|
})).toLowerCase();
|
|
7289
7785
|
const targetPath = resolveConfigWritePath2();
|
|
7290
7786
|
const current = loadConfig2(targetPath);
|
|
7291
7787
|
if (type === "cloud") {
|
|
7292
|
-
const cloudUrl = await
|
|
7788
|
+
const cloudUrl = await promptLine4({ message: "Cloud backend URL" });
|
|
7293
7789
|
if (!cloudUrl) throw new CliError({ message: "Cloud backend URL is required." });
|
|
7294
7790
|
if (!isHttpUrl2(cloudUrl)) {
|
|
7295
7791
|
throw new CliError({
|
|
@@ -7305,7 +7801,7 @@ async function configureBackendInteractive() {
|
|
|
7305
7801
|
if (type !== "local") {
|
|
7306
7802
|
throw new CliError({ message: "Backend type must be `local` or `cloud`." });
|
|
7307
7803
|
}
|
|
7308
|
-
const localUrl = await
|
|
7804
|
+
const localUrl = await promptLine4({
|
|
7309
7805
|
message: "Local backend URL",
|
|
7310
7806
|
defaultValue: DEFAULT_LOCAL_BACKEND_URL2
|
|
7311
7807
|
});
|
|
@@ -7666,537 +8162,191 @@ async function runLocalCommand({
|
|
|
7666
8162
|
agentKey,
|
|
7667
8163
|
installPath: report.installed ? report.installPath : null
|
|
7668
8164
|
});
|
|
7669
|
-
checks.push({
|
|
7670
|
-
name: `harness-descriptor:${agentKey}`,
|
|
7671
|
-
ok: !descriptorReport.drift,
|
|
7672
|
-
required: false,
|
|
7673
|
-
detail: descriptorReport.detail
|
|
7674
|
-
});
|
|
7675
|
-
}
|
|
7676
|
-
{
|
|
7677
|
-
const { readActiveMissionPointer: readActiveMissionPointer3 } = await Promise.resolve().then(() => (init_binding(), binding_exports));
|
|
7678
|
-
const binding = readActiveMissionPointer3({ workingDirectory: process.cwd() });
|
|
7679
|
-
checks.push({
|
|
7680
|
-
name: "agent-session-binding",
|
|
7681
|
-
ok: true,
|
|
7682
|
-
required: false,
|
|
7683
|
-
detail: binding.detail
|
|
7684
|
-
});
|
|
7685
|
-
}
|
|
7686
|
-
{
|
|
7687
|
-
const { resolveChannelBootstrap: resolveChannelBootstrap2 } = await Promise.resolve().then(() => (init_channel(), channel_exports));
|
|
7688
|
-
const bootstrap = resolveChannelBootstrap2();
|
|
7689
|
-
checks.push({
|
|
7690
|
-
name: "agent-session-channel",
|
|
7691
|
-
ok: true,
|
|
7692
|
-
required: false,
|
|
7693
|
-
detail: bootstrap ? `channel ${bootstrap.channelId} (credential from ${bootstrap.source === "env" ? "the launch environment" : "the owner-only local cache"})` : "no session channel in this process \u2014 an unlaunched or manually started session carries no agent-session traffic, which is the silent default"
|
|
7694
|
-
});
|
|
7695
|
-
}
|
|
7696
|
-
{
|
|
7697
|
-
const pathMod = await import("node:path");
|
|
7698
|
-
const { authCredentialsPath: authCredentialsPath2 } = await Promise.resolve().then(() => (init_auth_credentials(), auth_credentials_exports));
|
|
7699
|
-
const { detectCloudSyncRoot: detectCloudSyncRoot2 } = await Promise.resolve().then(() => (init_sync_root(), sync_root_exports));
|
|
7700
|
-
const credentialsDir = pathMod.dirname(authCredentialsPath2());
|
|
7701
|
-
const syncMatch = detectCloudSyncRoot2(credentialsDir);
|
|
7702
|
-
checks.push({
|
|
7703
|
-
name: "credentials-sync-root",
|
|
7704
|
-
ok: syncMatch === null,
|
|
7705
|
-
required: false,
|
|
7706
|
-
detail: syncMatch === null ? `${credentialsDir} is not inside a known cloud-sync folder` : `${credentialsDir} is inside ${syncMatch.provider} (${syncMatch.matchedSegment}); the plaintext token is replicated to cloud storage. Relocate it with OVLD_HOME or exclude this folder from sync.`
|
|
7707
|
-
});
|
|
7708
|
-
}
|
|
7709
|
-
if (health.ok) {
|
|
7710
|
-
const { isLoopbackBackendUrl: isLoopbackBackendUrl2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
7711
|
-
const { readStoredAuthCredentials: readStoredAuthCredentials2 } = await Promise.resolve().then(() => (init_auth_credentials(), auth_credentials_exports));
|
|
7712
|
-
const { buildExecutionTargetMigrationDoctorCheck: buildExecutionTargetMigrationDoctorCheck2 } = await Promise.resolve().then(() => (init_execution_target_migration_doctor(), execution_target_migration_doctor_exports));
|
|
7713
|
-
const hasAuth = Boolean(
|
|
7714
|
-
process.env.OVERLORD_USER_TOKEN?.trim() || process.env.OVLD_USER_TOKEN?.trim() || process.env.USER_TOKEN?.trim()
|
|
7715
|
-
) || readStoredAuthCredentials2() !== null;
|
|
7716
|
-
if (hasAuth && !isLoopbackBackendUrl2(backend.baseUrl)) {
|
|
7717
|
-
try {
|
|
7718
|
-
const diagnostics = await backend.get("/api/diagnostics/execution-target-migration");
|
|
7719
|
-
const migrationCheck = buildExecutionTargetMigrationDoctorCheck2({ diagnostics });
|
|
7720
|
-
if (migrationCheck) checks.push(migrationCheck);
|
|
7721
|
-
} catch {
|
|
7722
|
-
}
|
|
7723
|
-
}
|
|
7724
|
-
}
|
|
7725
|
-
const allOk = checks.every((check2) => !check2.required || check2.ok);
|
|
7726
|
-
if (json2) {
|
|
7727
|
-
printJson({ ok: allOk, checks });
|
|
7728
|
-
} else {
|
|
7729
|
-
for (const check2 of checks) {
|
|
7730
|
-
const status = check2.ok ? "ok" : check2.required ? "fail" : "warn";
|
|
7731
|
-
console.log(`${status} ${check2.name}: ${check2.detail}`);
|
|
7732
|
-
}
|
|
7733
|
-
}
|
|
7734
|
-
if (!allOk) {
|
|
7735
|
-
throw new CliError({ message: "Doctor found problems. Fix the items above and retry." });
|
|
7736
|
-
}
|
|
7737
|
-
return;
|
|
7738
|
-
}
|
|
7739
|
-
default:
|
|
7740
|
-
throw new CliError({ message: `Unknown command: ${command}` });
|
|
7741
|
-
}
|
|
7742
|
-
}
|
|
7743
|
-
var init_management = __esm({
|
|
7744
|
-
"src/management.ts"() {
|
|
7745
|
-
"use strict";
|
|
7746
|
-
init_args();
|
|
7747
|
-
init_errors();
|
|
7748
|
-
init_output();
|
|
7749
|
-
}
|
|
7750
|
-
});
|
|
7751
|
-
|
|
7752
|
-
// src/serve.ts
|
|
7753
|
-
var serve_exports = {};
|
|
7754
|
-
__export(serve_exports, {
|
|
7755
|
-
runServeCommand: () => runServeCommand
|
|
7756
|
-
});
|
|
7757
|
-
import { spawn as spawn2 } from "node:child_process";
|
|
7758
|
-
import { existsSync as existsSync16 } from "node:fs";
|
|
7759
|
-
import path17 from "node:path";
|
|
7760
|
-
async function runServeCommand({ rest }) {
|
|
7761
|
-
const parsed = parseArgs(rest);
|
|
7762
|
-
const json2 = flagBoolean(parsed.flags, "--json");
|
|
7763
|
-
const { loadConfig: loadConfig2, resolveProjectRoot: resolveProjectRoot2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
7764
|
-
const config2 = loadConfig2();
|
|
7765
|
-
const projectRoot = resolveProjectRoot2();
|
|
7766
|
-
const host = flagValue(parsed.flags, "--host") ?? process.env.OVERLORD_WEB_HOST ?? config2.webHost;
|
|
7767
|
-
const port = flagValue(parsed.flags, "--port") ?? process.env.OVERLORD_WEB_PORT ?? String(config2.webPort);
|
|
7768
|
-
const dbPath = flagValue(parsed.flags, "--db") ?? process.env.OVERLORD_SQLITE_PATH;
|
|
7769
|
-
const resolved = resolveServerEntry(projectRoot);
|
|
7770
|
-
if (!resolved) {
|
|
7771
|
-
throw new CliError({
|
|
7772
|
-
message: `Could not find the Overlord web server to serve.
|
|
7773
|
-
Looked for ${path17.join(projectRoot, "backend", "dist-server", "index.cjs")} (built bundle) and ${path17.join(projectRoot, "backend", "index.ts")} (source).
|
|
7774
|
-
Run \`ovld serve\` from an OpenOverlord checkout, build the server bundle with \`yarn build:server:prod\`, or set OVERLORD_SERVER_ENTRY to the server entry file.`
|
|
7775
|
-
});
|
|
7776
|
-
}
|
|
7777
|
-
const env = {
|
|
7778
|
-
...process.env,
|
|
7779
|
-
OVERLORD_WEB_HOST: host,
|
|
7780
|
-
OVERLORD_WEB_PORT: String(port)
|
|
7781
|
-
};
|
|
7782
|
-
if (dbPath) env.OVERLORD_SQLITE_PATH = dbPath;
|
|
7783
|
-
if (json2) {
|
|
7784
|
-
printJson({
|
|
7785
|
-
ok: true,
|
|
7786
|
-
entry: resolved.entry,
|
|
7787
|
-
runtime: resolved.runtime,
|
|
7788
|
-
host,
|
|
7789
|
-
port: Number(port),
|
|
7790
|
-
databasePath: dbPath ?? null
|
|
7791
|
-
});
|
|
7792
|
-
} else {
|
|
7793
|
-
console.log(`Starting Overlord server (${resolved.runtime}) \u2192 http://${host}:${port}`);
|
|
7794
|
-
}
|
|
7795
|
-
await spawnServer({ ...resolved, env, cwd: projectRoot });
|
|
7796
|
-
}
|
|
7797
|
-
function resolveServerEntry(projectRoot) {
|
|
7798
|
-
const override = process.env.OVERLORD_SERVER_ENTRY?.trim();
|
|
7799
|
-
if (override) {
|
|
7800
|
-
const entry = path17.isAbsolute(override) ? override : path17.resolve(projectRoot, override);
|
|
7801
|
-
return { entry, runtime: override.endsWith(".ts") ? "tsx" : "node" };
|
|
7802
|
-
}
|
|
7803
|
-
const bundle = path17.join(projectRoot, "backend", "dist-server", "index.cjs");
|
|
7804
|
-
if (existsSync16(bundle)) return { entry: bundle, runtime: "node" };
|
|
7805
|
-
const source = path17.join(projectRoot, "backend", "index.ts");
|
|
7806
|
-
if (existsSync16(source)) return { entry: source, runtime: "tsx" };
|
|
7807
|
-
return null;
|
|
7808
|
-
}
|
|
7809
|
-
function spawnServer({
|
|
7810
|
-
entry,
|
|
7811
|
-
runtime,
|
|
7812
|
-
env,
|
|
7813
|
-
cwd
|
|
7814
|
-
}) {
|
|
7815
|
-
const args = runtime === "tsx" ? ["--import", "tsx", entry] : [entry];
|
|
7816
|
-
const child = spawn2(process.execPath, args, { cwd, env, stdio: "inherit" });
|
|
7817
|
-
const forward = (signal) => {
|
|
7818
|
-
if (!child.killed) child.kill(signal);
|
|
7819
|
-
};
|
|
7820
|
-
process.on("SIGINT", forward);
|
|
7821
|
-
process.on("SIGTERM", forward);
|
|
7822
|
-
return new Promise((resolve, reject) => {
|
|
7823
|
-
child.on("error", (error51) => {
|
|
7824
|
-
reject(
|
|
7825
|
-
new CliError({
|
|
7826
|
-
message: `Failed to start the Overlord server: ${error51 instanceof Error ? error51.message : String(error51)}`
|
|
7827
|
-
})
|
|
7828
|
-
);
|
|
7829
|
-
});
|
|
7830
|
-
child.on("close", (code, signal) => {
|
|
7831
|
-
process.off("SIGINT", forward);
|
|
7832
|
-
process.off("SIGTERM", forward);
|
|
7833
|
-
if (signal) {
|
|
7834
|
-
resolve();
|
|
7835
|
-
return;
|
|
7836
|
-
}
|
|
7837
|
-
if (code && code !== 0) {
|
|
7838
|
-
reject(new CliError({ message: `Overlord server exited with code ${code}.` }));
|
|
7839
|
-
return;
|
|
7840
|
-
}
|
|
7841
|
-
resolve();
|
|
7842
|
-
});
|
|
7843
|
-
});
|
|
7844
|
-
}
|
|
7845
|
-
var init_serve = __esm({
|
|
7846
|
-
"src/serve.ts"() {
|
|
7847
|
-
"use strict";
|
|
7848
|
-
init_args();
|
|
7849
|
-
init_errors();
|
|
7850
|
-
init_output();
|
|
7851
|
-
}
|
|
7852
|
-
});
|
|
7853
|
-
|
|
7854
|
-
// ../packages/contract/dist/agent-launch-flags.js
|
|
7855
|
-
function parseAgentLaunchFlagText(text) {
|
|
7856
|
-
const trimmed7 = text.trim();
|
|
7857
|
-
if (!trimmed7)
|
|
7858
|
-
return null;
|
|
7859
|
-
const eqIndex = trimmed7.indexOf("=");
|
|
7860
|
-
if (eqIndex > 0 && trimmed7.startsWith("--")) {
|
|
7861
|
-
const name = trimmed7.slice(0, eqIndex).trim();
|
|
7862
|
-
const value2 = trimmed7.slice(eqIndex + 1).trim();
|
|
7863
|
-
return name ? { name, value: value2.length > 0 ? value2 : null } : null;
|
|
7864
|
-
}
|
|
7865
|
-
const spaceIndex = trimmed7.indexOf(" ");
|
|
7866
|
-
if (spaceIndex > 0 && trimmed7.startsWith("--")) {
|
|
7867
|
-
const name = trimmed7.slice(0, spaceIndex).trim();
|
|
7868
|
-
const value2 = trimmed7.slice(spaceIndex + 1).trim();
|
|
7869
|
-
return name ? { name, value: value2.length > 0 ? value2 : null } : null;
|
|
7870
|
-
}
|
|
7871
|
-
return { name: trimmed7 };
|
|
7872
|
-
}
|
|
7873
|
-
function normalizeAgentLaunchFlags(input) {
|
|
7874
|
-
if (!Array.isArray(input))
|
|
7875
|
-
return [];
|
|
7876
|
-
const flags = [];
|
|
7877
|
-
for (const item of input) {
|
|
7878
|
-
if (typeof item === "string") {
|
|
7879
|
-
const parsed = parseAgentLaunchFlagText(item);
|
|
7880
|
-
if (parsed)
|
|
7881
|
-
flags.push(parsed);
|
|
7882
|
-
continue;
|
|
7883
|
-
}
|
|
7884
|
-
if (!item || typeof item !== "object")
|
|
7885
|
-
continue;
|
|
7886
|
-
const record2 = item;
|
|
7887
|
-
if (typeof record2.name !== "string")
|
|
7888
|
-
continue;
|
|
7889
|
-
const name = record2.name.trim();
|
|
7890
|
-
if (!name)
|
|
7891
|
-
continue;
|
|
7892
|
-
const value2 = typeof record2.value === "string" ? record2.value.trim() || null : null;
|
|
7893
|
-
flags.push({ name, value: value2 });
|
|
7894
|
-
}
|
|
7895
|
-
return flags;
|
|
7896
|
-
}
|
|
7897
|
-
function agentLaunchFlagsToArgv(flags) {
|
|
7898
|
-
const argv = [];
|
|
7899
|
-
for (const flag of flags) {
|
|
7900
|
-
const name = flag.name.trim();
|
|
7901
|
-
if (!name)
|
|
7902
|
-
continue;
|
|
7903
|
-
argv.push(name);
|
|
7904
|
-
const value2 = flag.value?.trim();
|
|
7905
|
-
if (value2) {
|
|
7906
|
-
argv.push(value2);
|
|
7907
|
-
}
|
|
7908
|
-
}
|
|
7909
|
-
return argv;
|
|
7910
|
-
}
|
|
7911
|
-
var init_agent_launch_flags = __esm({
|
|
7912
|
-
"../packages/contract/dist/agent-launch-flags.js"() {
|
|
7913
|
-
"use strict";
|
|
7914
|
-
}
|
|
7915
|
-
});
|
|
7916
|
-
|
|
7917
|
-
// ../packages/contract/dist/chat.js
|
|
7918
|
-
var CHAT_DEFAULT_LIMITS, REPOSITORY_READ_DEFAULT_BOUNDS;
|
|
7919
|
-
var init_chat = __esm({
|
|
7920
|
-
"../packages/contract/dist/chat.js"() {
|
|
7921
|
-
"use strict";
|
|
7922
|
-
CHAT_DEFAULT_LIMITS = {
|
|
7923
|
-
/** Fixed invariant, not configurable. */
|
|
7924
|
-
unfinishedRunsPerThread: 1,
|
|
7925
|
-
concurrentRunsPerOwner: 3,
|
|
7926
|
-
toolCallsPerRun: 60,
|
|
7927
|
-
/** Active processing, excluding time spent in `waiting_user`. */
|
|
7928
|
-
activeProcessingMsPerRun: 10 * 60 * 1e3,
|
|
7929
|
-
concurrentTargetReadsPerRun: 4,
|
|
7930
|
-
/** Renewable worker lease on an attempt. */
|
|
7931
|
-
attemptLeaseMs: 30 * 1e3,
|
|
7932
|
-
/** Notification grace period before a candidate becomes due. */
|
|
7933
|
-
notificationGraceMs: 5 * 1e3,
|
|
7934
|
-
/** Foreground presence expiry; clients renew before it lapses. */
|
|
7935
|
-
presenceTtlMs: 30 * 1e3,
|
|
7936
|
-
/** Event replay retention: whichever bound is reached first advances the boundary. */
|
|
7937
|
-
eventRetentionMs: 7 * 24 * 60 * 60 * 1e3,
|
|
7938
|
-
eventRetentionCount: 5e3,
|
|
7939
|
-
/** Bounded sanitized title used in notifications and lists. */
|
|
7940
|
-
titleMaxChars: 80,
|
|
7941
|
-
messageMaxChars: 16e3
|
|
7942
|
-
};
|
|
7943
|
-
REPOSITORY_READ_DEFAULT_BOUNDS = {
|
|
7944
|
-
readFileBytes: 64 * 1024,
|
|
7945
|
-
diffBytes: 128 * 1024,
|
|
7946
|
-
searchBytes: 128 * 1024,
|
|
7947
|
-
searchHits: 100,
|
|
7948
|
-
timeoutMs: 30 * 1e3,
|
|
7949
|
-
/** Per-Git-call budget on the target, below the queue deadline. */
|
|
7950
|
-
targetCommandTimeoutMs: 20 * 1e3,
|
|
7951
|
-
/** Files larger than this answer `oversized` with metadata only. */
|
|
7952
|
-
readFileCeilingBytes: 8 * 1024 * 1024,
|
|
7953
|
-
treeEntries: 500,
|
|
7954
|
-
treeEntriesMax: 2e3,
|
|
7955
|
-
statusEntriesPerClass: 1e3,
|
|
7956
|
-
searchLineChars: 400,
|
|
7957
|
-
searchQueryChars: 256,
|
|
7958
|
-
diffPaths: 50,
|
|
7959
|
-
concurrentReadsPerScope: 4
|
|
7960
|
-
};
|
|
7961
|
-
}
|
|
7962
|
-
});
|
|
7963
|
-
|
|
7964
|
-
// ../packages/contract/dist/launch-variables.js
|
|
7965
|
-
var LAUNCH_VARIABLES, LAUNCH_VARIABLE_NAMES;
|
|
7966
|
-
var init_launch_variables = __esm({
|
|
7967
|
-
"../packages/contract/dist/launch-variables.js"() {
|
|
7968
|
-
"use strict";
|
|
7969
|
-
LAUNCH_VARIABLES = [
|
|
7970
|
-
{
|
|
7971
|
-
name: "MISSION_ID",
|
|
7972
|
-
description: "Mission display id for the launch (e.g. coo:359).",
|
|
7973
|
-
example: "coo:359",
|
|
7974
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
7975
|
-
},
|
|
7976
|
-
{
|
|
7977
|
-
name: "OVERLORD_MISSION_ID",
|
|
7978
|
-
description: "Same value as MISSION_ID \u2014 preferred Overlord-prefixed form.",
|
|
7979
|
-
example: "coo:359",
|
|
7980
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
7981
|
-
},
|
|
7982
|
-
{
|
|
7983
|
-
name: "OVERLORD_OBJECTIVE_ID",
|
|
7984
|
-
description: "Objective display id for the launch (e.g. coo:359.k7xm). Used to pin protocol attach.",
|
|
7985
|
-
example: "coo:359.k7xm",
|
|
7986
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
7987
|
-
},
|
|
7988
|
-
{
|
|
7989
|
-
name: "OVERLORD_BACKEND_URL",
|
|
7990
|
-
description: "Backend URL the agent CLI/MCP should call for this launch.",
|
|
7991
|
-
example: "http://127.0.0.1:4310",
|
|
7992
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
7993
|
-
},
|
|
7994
|
-
{
|
|
7995
|
-
name: "OVERLORD_EXECUTION_REQUEST_ID",
|
|
7996
|
-
description: "Execution-request id when the launch is runner-driven. Empty/absent for a bare `ovld launch`.",
|
|
7997
|
-
example: "380e8a6a-ccf0-49f4-9761-f1c0ba02c39c",
|
|
7998
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
7999
|
-
},
|
|
8000
|
-
{
|
|
8001
|
-
name: "OVERLORD_WORKING_DIRECTORY",
|
|
8002
|
-
description: "Absolute path the agent terminal cds into \u2014 the resolved execution-target checkout (or worktree).",
|
|
8003
|
-
example: "/Users/you/src/overlord",
|
|
8004
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
8005
|
-
},
|
|
8006
|
-
{
|
|
8007
|
-
name: "OVERLORD_CONTEXT_FILE",
|
|
8008
|
-
description: "Absolute path to the markdown briefing written for this launch under `.overlord/tmp/`.",
|
|
8009
|
-
example: "/Users/you/src/overlord/.overlord/tmp/mission-coo-359.md",
|
|
8010
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
8011
|
-
},
|
|
8012
|
-
{
|
|
8013
|
-
name: "OVERLORD_TMPDIR",
|
|
8014
|
-
description: "Private scratch directory for this launch (`.overlord/tmp/sessions/<objective>-<request>/`). Removed automatically when the session delivers; orphaned ones expire after 24h. Also mirrored as TMPDIR/TMP/TEMP.",
|
|
8015
|
-
example: "/Users/you/src/overlord/.overlord/tmp/sessions/objective-coo-359-k7xm-4f1c",
|
|
8016
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
8017
|
-
},
|
|
8018
|
-
{
|
|
8019
|
-
name: "TMPDIR",
|
|
8020
|
-
description: "Same path as OVERLORD_TMPDIR \u2014 standard temp-dir env name.",
|
|
8021
|
-
example: "/Users/you/src/overlord/.overlord/tmp/sessions/objective-coo-359-k7xm-4f1c",
|
|
8022
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
8023
|
-
},
|
|
8024
|
-
{
|
|
8025
|
-
name: "TMP",
|
|
8026
|
-
description: "Same path as OVERLORD_TMPDIR \u2014 Windows-style temp-dir alias.",
|
|
8027
|
-
example: "/Users/you/src/overlord/.overlord/tmp/sessions/objective-coo-359-k7xm-4f1c",
|
|
8028
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
8029
|
-
},
|
|
8030
|
-
{
|
|
8031
|
-
name: "TEMP",
|
|
8032
|
-
description: "Same path as OVERLORD_TMPDIR \u2014 Windows-style temp-dir alias.",
|
|
8033
|
-
example: "/Users/you/src/overlord/.overlord/tmp/sessions/objective-coo-359-k7xm-4f1c",
|
|
8034
|
-
availableAt: ["plan_build", "terminal_env"]
|
|
8035
|
-
},
|
|
8036
|
-
{
|
|
8037
|
-
name: "OVERLORD_PROJECT_RESOURCES",
|
|
8038
|
-
description: "JSON array of every project resource for this execution target (resourceKey, path, state, flags, accessMode). Set only when the project has resources.",
|
|
8039
|
-
example: '[{"resourceKey":"primary","path":"/repo/a","state":"ready","isPrimary":true,"accessMode":"read_write"}]',
|
|
8040
|
-
availableAt: ["plan_build", "terminal_env"],
|
|
8041
|
-
format: "JSON array"
|
|
8042
|
-
},
|
|
8165
|
+
checks.push({
|
|
8166
|
+
name: `harness-descriptor:${agentKey}`,
|
|
8167
|
+
ok: !descriptorReport.drift,
|
|
8168
|
+
required: false,
|
|
8169
|
+
detail: descriptorReport.detail
|
|
8170
|
+
});
|
|
8171
|
+
}
|
|
8043
8172
|
{
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8173
|
+
const { readActiveMissionPointer: readActiveMissionPointer3 } = await Promise.resolve().then(() => (init_binding(), binding_exports));
|
|
8174
|
+
const binding = readActiveMissionPointer3({ workingDirectory: process.cwd() });
|
|
8175
|
+
checks.push({
|
|
8176
|
+
name: "agent-session-binding",
|
|
8177
|
+
ok: true,
|
|
8178
|
+
required: false,
|
|
8179
|
+
detail: binding.detail
|
|
8180
|
+
});
|
|
8181
|
+
}
|
|
8050
8182
|
{
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8183
|
+
const { resolveChannelBootstrap: resolveChannelBootstrap2 } = await Promise.resolve().then(() => (init_channel(), channel_exports));
|
|
8184
|
+
const bootstrap = resolveChannelBootstrap2();
|
|
8185
|
+
checks.push({
|
|
8186
|
+
name: "agent-session-channel",
|
|
8187
|
+
ok: true,
|
|
8188
|
+
required: false,
|
|
8189
|
+
detail: bootstrap ? `channel ${bootstrap.channelId} (credential from ${bootstrap.source === "env" ? "the launch environment" : "the owner-only local cache"})` : "no session channel in this process \u2014 an unlaunched or manually started session carries no agent-session traffic, which is the silent default"
|
|
8190
|
+
});
|
|
8191
|
+
}
|
|
8057
8192
|
{
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8193
|
+
const pathMod = await import("node:path");
|
|
8194
|
+
const { authCredentialsPath: authCredentialsPath2 } = await Promise.resolve().then(() => (init_auth_credentials(), auth_credentials_exports));
|
|
8195
|
+
const { detectCloudSyncRoot: detectCloudSyncRoot2 } = await Promise.resolve().then(() => (init_sync_root(), sync_root_exports));
|
|
8196
|
+
const credentialsDir = pathMod.dirname(authCredentialsPath2());
|
|
8197
|
+
const syncMatch = detectCloudSyncRoot2(credentialsDir);
|
|
8198
|
+
checks.push({
|
|
8199
|
+
name: "credentials-sync-root",
|
|
8200
|
+
ok: syncMatch === null,
|
|
8201
|
+
required: false,
|
|
8202
|
+
detail: syncMatch === null ? `${credentialsDir} is not inside a known cloud-sync folder` : `${credentialsDir} is inside ${syncMatch.provider} (${syncMatch.matchedSegment}); the plaintext token is replicated to cloud storage. Relocate it with OVLD_HOME or exclude this folder from sync.`
|
|
8203
|
+
});
|
|
8062
8204
|
}
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
});
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8205
|
+
if (health.ok) {
|
|
8206
|
+
const { isLoopbackBackendUrl: isLoopbackBackendUrl2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
8207
|
+
const { readStoredAuthCredentials: readStoredAuthCredentials2 } = await Promise.resolve().then(() => (init_auth_credentials(), auth_credentials_exports));
|
|
8208
|
+
const { buildExecutionTargetMigrationDoctorCheck: buildExecutionTargetMigrationDoctorCheck2 } = await Promise.resolve().then(() => (init_execution_target_migration_doctor(), execution_target_migration_doctor_exports));
|
|
8209
|
+
const hasAuth = Boolean(
|
|
8210
|
+
process.env.OVERLORD_USER_TOKEN?.trim() || process.env.OVLD_USER_TOKEN?.trim() || process.env.USER_TOKEN?.trim()
|
|
8211
|
+
) || readStoredAuthCredentials2() !== null;
|
|
8212
|
+
if (hasAuth && !isLoopbackBackendUrl2(backend.baseUrl)) {
|
|
8213
|
+
try {
|
|
8214
|
+
const diagnostics = await backend.get("/api/diagnostics/execution-target-migration");
|
|
8215
|
+
const migrationCheck = buildExecutionTargetMigrationDoctorCheck2({ diagnostics });
|
|
8216
|
+
if (migrationCheck) checks.push(migrationCheck);
|
|
8217
|
+
} catch {
|
|
8218
|
+
}
|
|
8219
|
+
}
|
|
8220
|
+
}
|
|
8221
|
+
const allOk = checks.every((check2) => !check2.required || check2.ok);
|
|
8222
|
+
if (json2) {
|
|
8223
|
+
printJson({ ok: allOk, checks });
|
|
8224
|
+
} else {
|
|
8225
|
+
for (const check2 of checks) {
|
|
8226
|
+
const status = check2.ok ? "ok" : check2.required ? "fail" : "warn";
|
|
8227
|
+
console.log(`${status} ${check2.name}: ${check2.detail}`);
|
|
8228
|
+
}
|
|
8229
|
+
}
|
|
8230
|
+
if (!allOk) {
|
|
8231
|
+
throw new CliError({ message: "Doctor found problems. Fix the items above and retry." });
|
|
8232
|
+
}
|
|
8233
|
+
return;
|
|
8234
|
+
}
|
|
8235
|
+
default:
|
|
8236
|
+
throw new CliError({ message: `Unknown command: ${command}` });
|
|
8072
8237
|
}
|
|
8073
|
-
}
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
"../packages/contract/dist/mission-search.js"() {
|
|
8238
|
+
}
|
|
8239
|
+
var NON_INTERACTIVE_MESSAGE3;
|
|
8240
|
+
var init_management = __esm({
|
|
8241
|
+
"src/management.ts"() {
|
|
8078
8242
|
"use strict";
|
|
8243
|
+
init_args();
|
|
8244
|
+
init_errors();
|
|
8245
|
+
init_output();
|
|
8246
|
+
init_prompt();
|
|
8247
|
+
NON_INTERACTIVE_MESSAGE3 = "Interactive backend configuration requires a TTY. Run `ovld config set local [url]` or `ovld config set cloud <url>`.";
|
|
8079
8248
|
}
|
|
8080
8249
|
});
|
|
8081
8250
|
|
|
8082
|
-
//
|
|
8083
|
-
var
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
}
|
|
8251
|
+
// src/serve.ts
|
|
8252
|
+
var serve_exports = {};
|
|
8253
|
+
__export(serve_exports, {
|
|
8254
|
+
runServeCommand: () => runServeCommand
|
|
8087
8255
|
});
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
const
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
if (WRONG_SEPARATOR_PIPE_RE.test(trimmed7)) {
|
|
8108
|
-
return { kind: "wrong_separator", separator: "|", ref: trimmed7 };
|
|
8109
|
-
}
|
|
8110
|
-
if (WRONG_SEPARATOR_HYPHEN_RE.test(trimmed7)) {
|
|
8111
|
-
return { kind: "wrong_separator", separator: "-", ref: trimmed7 };
|
|
8112
|
-
}
|
|
8113
|
-
if (MISSION_DISPLAY_ID_RE.test(trimmed7)) {
|
|
8114
|
-
return { kind: "mission_id", missionDisplayId: trimmed7 };
|
|
8256
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
8257
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
8258
|
+
import path18 from "node:path";
|
|
8259
|
+
async function runServeCommand({ rest }) {
|
|
8260
|
+
const parsed = parseArgs(rest);
|
|
8261
|
+
const json2 = flagBoolean(parsed.flags, "--json");
|
|
8262
|
+
const { loadConfig: loadConfig2, resolveProjectRoot: resolveProjectRoot2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
8263
|
+
const config2 = loadConfig2();
|
|
8264
|
+
const projectRoot = resolveProjectRoot2();
|
|
8265
|
+
const host = flagValue(parsed.flags, "--host") ?? process.env.OVERLORD_WEB_HOST ?? config2.webHost;
|
|
8266
|
+
const port = flagValue(parsed.flags, "--port") ?? process.env.OVERLORD_WEB_PORT ?? String(config2.webPort);
|
|
8267
|
+
const dbPath = flagValue(parsed.flags, "--db") ?? process.env.OVERLORD_SQLITE_PATH;
|
|
8268
|
+
const resolved = resolveServerEntry(projectRoot);
|
|
8269
|
+
if (!resolved) {
|
|
8270
|
+
throw new CliError({
|
|
8271
|
+
message: `Could not find the Overlord web server to serve.
|
|
8272
|
+
Looked for ${path18.join(projectRoot, "backend", "dist-server", "index.cjs")} (built bundle) and ${path18.join(projectRoot, "backend", "index.ts")} (source).
|
|
8273
|
+
Run \`ovld serve\` from an OpenOverlord checkout, build the server bundle with \`yarn build:server:prod\`, or set OVERLORD_SERVER_ENTRY to the server entry file.`
|
|
8274
|
+
});
|
|
8115
8275
|
}
|
|
8116
|
-
|
|
8117
|
-
|
|
8276
|
+
const env = {
|
|
8277
|
+
...process.env,
|
|
8278
|
+
OVERLORD_WEB_HOST: host,
|
|
8279
|
+
OVERLORD_WEB_PORT: String(port)
|
|
8280
|
+
};
|
|
8281
|
+
if (dbPath) env.OVERLORD_SQLITE_PATH = dbPath;
|
|
8282
|
+
if (json2) {
|
|
8283
|
+
printJson({
|
|
8284
|
+
ok: true,
|
|
8285
|
+
entry: resolved.entry,
|
|
8286
|
+
runtime: resolved.runtime,
|
|
8287
|
+
host,
|
|
8288
|
+
port: Number(port),
|
|
8289
|
+
databasePath: dbPath ?? null
|
|
8290
|
+
});
|
|
8291
|
+
} else {
|
|
8292
|
+
console.log(`Starting Overlord server (${resolved.runtime}) \u2192 http://${host}:${port}`);
|
|
8118
8293
|
}
|
|
8119
|
-
|
|
8120
|
-
}
|
|
8121
|
-
function missionDisplayIdFromObjectiveRef(ref) {
|
|
8122
|
-
if (typeof ref !== "string" || ref.trim() === "")
|
|
8123
|
-
return null;
|
|
8124
|
-
const parsed = parseObjectiveRef(ref);
|
|
8125
|
-
return parsed.kind === "display_id" ? parsed.missionDisplayId : null;
|
|
8294
|
+
await spawnServer({ ...resolved, env, cwd: projectRoot });
|
|
8126
8295
|
}
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
KEY_BODY = "[0-9a-hjkmnp-tv-z]{4,5}";
|
|
8133
|
-
DISPLAY_ID_RE = new RegExp(`^(.+):(\\d+)\\.(${KEY_BODY})$`, "i");
|
|
8134
|
-
MISSION_DISPLAY_ID_RE = /^([a-z0-9-]+):(\d+)$/i;
|
|
8135
|
-
WRONG_SEPARATOR_COLON_RE = new RegExp(`^(.+):(\\d+):(${KEY_BODY})$`, "i");
|
|
8136
|
-
WRONG_SEPARATOR_PIPE_RE = new RegExp(`^(.+):(\\d+)\\|(${KEY_BODY})$`, "i");
|
|
8137
|
-
WRONG_SEPARATOR_HYPHEN_RE = new RegExp(`^(.+):(\\d+)-(${KEY_BODY})$`, "i");
|
|
8138
|
-
BARE_KEY_RE = new RegExp(`^${KEY_BODY}$`, "i");
|
|
8296
|
+
function resolveServerEntry(projectRoot) {
|
|
8297
|
+
const override = process.env.OVERLORD_SERVER_ENTRY?.trim();
|
|
8298
|
+
if (override) {
|
|
8299
|
+
const entry = path18.isAbsolute(override) ? override : path18.resolve(projectRoot, override);
|
|
8300
|
+
return { entry, runtime: override.endsWith(".ts") ? "tsx" : "node" };
|
|
8139
8301
|
}
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
return "rw";
|
|
8146
|
-
return accessMode === "read" ? "ro" : "rw";
|
|
8147
|
-
}
|
|
8148
|
-
function formatResourcePathWithPermission({ path: path39, accessMode, isPrimary = false }) {
|
|
8149
|
-
const trimmed7 = path39.trim();
|
|
8150
|
-
if (!trimmed7)
|
|
8151
|
-
return "";
|
|
8152
|
-
const permission = accessModeToResourcePathPermission({ accessMode, isPrimary });
|
|
8153
|
-
return `${trimmed7}:${permission}`;
|
|
8302
|
+
const bundle = path18.join(projectRoot, "backend", "dist-server", "index.cjs");
|
|
8303
|
+
if (existsSync16(bundle)) return { entry: bundle, runtime: "node" };
|
|
8304
|
+
const source = path18.join(projectRoot, "backend", "index.ts");
|
|
8305
|
+
if (existsSync16(source)) return { entry: source, runtime: "tsx" };
|
|
8306
|
+
return null;
|
|
8154
8307
|
}
|
|
8155
|
-
function
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
if (!
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8308
|
+
function spawnServer({
|
|
8309
|
+
entry,
|
|
8310
|
+
runtime,
|
|
8311
|
+
env,
|
|
8312
|
+
cwd
|
|
8313
|
+
}) {
|
|
8314
|
+
const args = runtime === "tsx" ? ["--import", "tsx", entry] : [entry];
|
|
8315
|
+
const child = spawn2(process.execPath, args, { cwd, env, stdio: "inherit" });
|
|
8316
|
+
const forward = (signal) => {
|
|
8317
|
+
if (!child.killed) child.kill(signal);
|
|
8318
|
+
};
|
|
8319
|
+
process.on("SIGINT", forward);
|
|
8320
|
+
process.on("SIGTERM", forward);
|
|
8321
|
+
return new Promise((resolve, reject) => {
|
|
8322
|
+
child.on("error", (error51) => {
|
|
8323
|
+
reject(
|
|
8324
|
+
new CliError({
|
|
8325
|
+
message: `Failed to start the Overlord server: ${error51 instanceof Error ? error51.message : String(error51)}`
|
|
8326
|
+
})
|
|
8327
|
+
);
|
|
8328
|
+
});
|
|
8329
|
+
child.on("close", (code, signal) => {
|
|
8330
|
+
process.off("SIGINT", forward);
|
|
8331
|
+
process.off("SIGTERM", forward);
|
|
8332
|
+
if (signal) {
|
|
8333
|
+
resolve();
|
|
8334
|
+
return;
|
|
8335
|
+
}
|
|
8336
|
+
if (code && code !== 0) {
|
|
8337
|
+
reject(new CliError({ message: `Overlord server exited with code ${code}.` }));
|
|
8338
|
+
return;
|
|
8339
|
+
}
|
|
8340
|
+
resolve();
|
|
8341
|
+
});
|
|
8342
|
+
});
|
|
8173
8343
|
}
|
|
8174
|
-
var
|
|
8175
|
-
"
|
|
8176
|
-
"use strict";
|
|
8177
|
-
}
|
|
8178
|
-
});
|
|
8179
|
-
|
|
8180
|
-
// ../packages/contract/dist/search.js
|
|
8181
|
-
var init_search = __esm({
|
|
8182
|
-
"../packages/contract/dist/search.js"() {
|
|
8183
|
-
"use strict";
|
|
8184
|
-
}
|
|
8185
|
-
});
|
|
8186
|
-
|
|
8187
|
-
// ../packages/contract/dist/index.js
|
|
8188
|
-
var init_dist2 = __esm({
|
|
8189
|
-
"../packages/contract/dist/index.js"() {
|
|
8344
|
+
var init_serve = __esm({
|
|
8345
|
+
"src/serve.ts"() {
|
|
8190
8346
|
"use strict";
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
init_mission_reference();
|
|
8195
|
-
init_mission_search();
|
|
8196
|
-
init_notifications();
|
|
8197
|
-
init_objective_ref();
|
|
8198
|
-
init_resource_paths();
|
|
8199
|
-
init_search();
|
|
8347
|
+
init_args();
|
|
8348
|
+
init_errors();
|
|
8349
|
+
init_output();
|
|
8200
8350
|
}
|
|
8201
8351
|
});
|
|
8202
8352
|
|
|
@@ -8241,11 +8391,11 @@ function createChannelClient({
|
|
|
8241
8391
|
token
|
|
8242
8392
|
}) {
|
|
8243
8393
|
const root = `${baseUrl.replace(/\/+$/, "")}/api/agent-session-channels/v1`;
|
|
8244
|
-
async function request(method,
|
|
8394
|
+
async function request(method, path40, body, timeoutMs) {
|
|
8245
8395
|
const controller = new AbortController();
|
|
8246
8396
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
8247
8397
|
try {
|
|
8248
|
-
const response = await fetch(`${root}${
|
|
8398
|
+
const response = await fetch(`${root}${path40}`, {
|
|
8249
8399
|
method,
|
|
8250
8400
|
// The credential travels here and only here: an Authorization header on a request the
|
|
8251
8401
|
// CLI itself constructs. Not in the URL, which lands in access logs; not in the body,
|
|
@@ -8271,12 +8421,12 @@ function createChannelClient({
|
|
|
8271
8421
|
}
|
|
8272
8422
|
}
|
|
8273
8423
|
return {
|
|
8274
|
-
post: (
|
|
8275
|
-
get: (
|
|
8424
|
+
post: (path40, body, options) => request("POST", path40, body ?? {}, options?.timeoutMs ?? DEFAULT_TIMEOUT_MS),
|
|
8425
|
+
get: (path40, options) => request("GET", path40, void 0, options?.timeoutMs ?? DEFAULT_TIMEOUT_MS)
|
|
8276
8426
|
};
|
|
8277
8427
|
}
|
|
8278
8428
|
var DEFAULT_TIMEOUT_MS;
|
|
8279
|
-
var
|
|
8429
|
+
var init_client2 = __esm({
|
|
8280
8430
|
"src/agent-session/client.ts"() {
|
|
8281
8431
|
"use strict";
|
|
8282
8432
|
init_channel();
|
|
@@ -8371,9 +8521,9 @@ function reduceUrl(rawUrl) {
|
|
|
8371
8521
|
try {
|
|
8372
8522
|
const url2 = new URL(raw);
|
|
8373
8523
|
const hadQuery = url2.search !== "" || url2.hash !== "";
|
|
8374
|
-
const
|
|
8524
|
+
const path40 = url2.pathname === "/" ? "" : url2.pathname;
|
|
8375
8525
|
return {
|
|
8376
|
-
display: safeText(`${url2.protocol}//${url2.host}${
|
|
8526
|
+
display: safeText(`${url2.protocol}//${url2.host}${path40}`).text,
|
|
8377
8527
|
host: url2.host || null,
|
|
8378
8528
|
scheme: url2.protocol.replace(/:$/, ""),
|
|
8379
8529
|
hadQuery
|
|
@@ -8538,17 +8688,17 @@ var init_mcp = __esm({
|
|
|
8538
8688
|
function describeRead({ input, projectRoot }) {
|
|
8539
8689
|
const record2 = input && typeof input === "object" ? input : {};
|
|
8540
8690
|
const raw = typeof record2.file_path === "string" && record2.file_path || typeof record2.filePath === "string" && record2.filePath || typeof record2.path === "string" && record2.path || typeof record2.notebook_path === "string" && record2.notebook_path || null;
|
|
8541
|
-
const
|
|
8691
|
+
const path40 = reducePath(raw, projectRoot);
|
|
8542
8692
|
const markers = [
|
|
8543
|
-
|
|
8544
|
-
|
|
8693
|
+
path40?.outsideProject && "outside-project-directory",
|
|
8694
|
+
path40?.nonAscii && "non-ascii-path"
|
|
8545
8695
|
];
|
|
8546
|
-
if (
|
|
8696
|
+
if (path40 && /(^|\/)(\.env|\.npmrc|\.netrc|id_rsa|id_ed25519|credentials)(\.|$)/.test(path40.display)) {
|
|
8547
8697
|
markers.push("secret-adjacent");
|
|
8548
8698
|
}
|
|
8549
8699
|
return {
|
|
8550
8700
|
action: "Read a file",
|
|
8551
|
-
subject:
|
|
8701
|
+
subject: path40?.display ?? null,
|
|
8552
8702
|
detail: null,
|
|
8553
8703
|
riskMarkers: normalizeMarkers(markers)
|
|
8554
8704
|
};
|
|
@@ -8690,21 +8840,21 @@ function isOverwrite(record2) {
|
|
|
8690
8840
|
}
|
|
8691
8841
|
function describeWrite({ input, projectRoot }) {
|
|
8692
8842
|
const record2 = input && typeof input === "object" ? input : {};
|
|
8693
|
-
const
|
|
8843
|
+
const path40 = reducePath(readPath(record2), projectRoot);
|
|
8694
8844
|
const overwrite = isOverwrite(record2);
|
|
8695
8845
|
const bytes = byteLength(readContent(record2));
|
|
8696
8846
|
const markers = [
|
|
8697
8847
|
overwrite && "overwrites-existing",
|
|
8698
|
-
|
|
8699
|
-
|
|
8848
|
+
path40?.outsideProject && "outside-project-directory",
|
|
8849
|
+
path40?.nonAscii && "non-ascii-path"
|
|
8700
8850
|
];
|
|
8701
|
-
if (
|
|
8851
|
+
if (path40 && /(^|\/)(\.env|\.npmrc|\.netrc|id_rsa|id_ed25519|credentials)(\.|$)/.test(path40.display)) {
|
|
8702
8852
|
markers.push("secret-adjacent");
|
|
8703
8853
|
}
|
|
8704
8854
|
const detail = bytes === null ? overwrite ? "replacing existing text" : null : `${bytes} byte${bytes === 1 ? "" : "s"}${overwrite ? ", replacing existing text" : ""}`;
|
|
8705
8855
|
return {
|
|
8706
8856
|
action: overwrite ? "Overwrite a file" : "Write a file",
|
|
8707
|
-
subject:
|
|
8857
|
+
subject: path40?.display ?? null,
|
|
8708
8858
|
detail,
|
|
8709
8859
|
riskMarkers: normalizeMarkers(markers)
|
|
8710
8860
|
};
|
|
@@ -8910,16 +9060,16 @@ function readPath2(source, dotted) {
|
|
|
8910
9060
|
return current;
|
|
8911
9061
|
}
|
|
8912
9062
|
function firstString(source, paths) {
|
|
8913
|
-
for (const
|
|
8914
|
-
const value2 = readPath2(source,
|
|
9063
|
+
for (const path40 of paths ?? []) {
|
|
9064
|
+
const value2 = readPath2(source, path40);
|
|
8915
9065
|
if (typeof value2 === "string" && value2.trim() !== "")
|
|
8916
9066
|
return value2.trim();
|
|
8917
9067
|
}
|
|
8918
9068
|
return null;
|
|
8919
9069
|
}
|
|
8920
9070
|
function firstLiteralString(source, paths) {
|
|
8921
|
-
for (const
|
|
8922
|
-
const value2 = readPath2(source,
|
|
9071
|
+
for (const path40 of paths ?? []) {
|
|
9072
|
+
const value2 = readPath2(source, path40);
|
|
8923
9073
|
if (typeof value2 === "string" && value2.length > 0)
|
|
8924
9074
|
return value2;
|
|
8925
9075
|
}
|
|
@@ -9412,7 +9562,7 @@ var init_event = __esm({
|
|
|
9412
9562
|
init_codec();
|
|
9413
9563
|
init_local_file_storage();
|
|
9414
9564
|
init_bind();
|
|
9415
|
-
|
|
9565
|
+
init_client2();
|
|
9416
9566
|
init_codec_registry_generated();
|
|
9417
9567
|
MAX_AGENT_SESSION_PAYLOAD_BYTES = 1024 * 1024;
|
|
9418
9568
|
POST_TIMEOUT_MS = 3e3;
|
|
@@ -9471,8 +9621,8 @@ async function runAgentSessionInbox({
|
|
|
9471
9621
|
const scope = resolveAgentSessionScope({ agent, env });
|
|
9472
9622
|
if (!scope) return emptyResult("Empty");
|
|
9473
9623
|
const payload = payloadRaw === void 0 ? parseNativePayload(readBoundedStdin()) : parseNativePayload(payloadRaw);
|
|
9474
|
-
const
|
|
9475
|
-
if (
|
|
9624
|
+
const path40 = resolveInjectPath({ agent, payload });
|
|
9625
|
+
if (path40 === "unsupported") return emptyResult("Unsupported");
|
|
9476
9626
|
const baseUrl = env.OVERLORD_BACKEND_URL?.trim();
|
|
9477
9627
|
if (!baseUrl && !injectedClient) return emptyResult("Empty");
|
|
9478
9628
|
const client = injectedClient ?? createChannelClient({ baseUrl, channelId: scope.channelId, token: scope.token });
|
|
@@ -9486,15 +9636,15 @@ async function runAgentSessionInbox({
|
|
|
9486
9636
|
);
|
|
9487
9637
|
if (!claimed.ok || !claimed.value.input) return emptyResult("Empty");
|
|
9488
9638
|
const input = claimed.value.input;
|
|
9489
|
-
return await emitClaimedInput({ agent, path:
|
|
9639
|
+
return await emitClaimedInput({ agent, path: path40, input, client });
|
|
9490
9640
|
}
|
|
9491
9641
|
async function emitClaimedInput({
|
|
9492
9642
|
agent,
|
|
9493
|
-
path:
|
|
9643
|
+
path: path40,
|
|
9494
9644
|
input,
|
|
9495
9645
|
client
|
|
9496
9646
|
}) {
|
|
9497
|
-
if (
|
|
9647
|
+
if (path40 === "claude-mid-turn") {
|
|
9498
9648
|
const emitted = await client.post(`/inputs/${input.id}/emitted`, {
|
|
9499
9649
|
leaseId: input.leaseId,
|
|
9500
9650
|
deliveryOutcome: "delivered"
|
|
@@ -9509,7 +9659,7 @@ async function emitClaimedInput({
|
|
|
9509
9659
|
inputId: input.id
|
|
9510
9660
|
};
|
|
9511
9661
|
}
|
|
9512
|
-
if (
|
|
9662
|
+
if (path40 === "claude-turn-boundary") {
|
|
9513
9663
|
const emitted = await client.post(`/inputs/${input.id}/emitted`, {
|
|
9514
9664
|
leaseId: input.leaseId,
|
|
9515
9665
|
deliveryOutcome: "delivered"
|
|
@@ -9524,7 +9674,7 @@ async function emitClaimedInput({
|
|
|
9524
9674
|
inputId: input.id
|
|
9525
9675
|
};
|
|
9526
9676
|
}
|
|
9527
|
-
if (
|
|
9677
|
+
if (path40 === "cursor-turn-boundary") {
|
|
9528
9678
|
const emitted = await client.post(`/inputs/${input.id}/emitted`, {
|
|
9529
9679
|
leaseId: input.leaseId,
|
|
9530
9680
|
deliveryOutcome: "queued_turn_boundary"
|
|
@@ -9538,7 +9688,7 @@ async function emitClaimedInput({
|
|
|
9538
9688
|
inputId: input.id
|
|
9539
9689
|
};
|
|
9540
9690
|
}
|
|
9541
|
-
if (
|
|
9691
|
+
if (path40 === "codex-turn-boundary") {
|
|
9542
9692
|
const emitted = await client.post(`/inputs/${input.id}/emitted`, {
|
|
9543
9693
|
leaseId: input.leaseId,
|
|
9544
9694
|
deliveryOutcome: "delivered"
|
|
@@ -9553,7 +9703,7 @@ async function emitClaimedInput({
|
|
|
9553
9703
|
inputId: input.id
|
|
9554
9704
|
};
|
|
9555
9705
|
}
|
|
9556
|
-
if (
|
|
9706
|
+
if (path40 === "pi-mid-turn") {
|
|
9557
9707
|
return {
|
|
9558
9708
|
report: "Empty",
|
|
9559
9709
|
exitCode: 0,
|
|
@@ -9643,7 +9793,7 @@ var init_inbox = __esm({
|
|
|
9643
9793
|
"src/agent-session/inbox.ts"() {
|
|
9644
9794
|
"use strict";
|
|
9645
9795
|
init_bind();
|
|
9646
|
-
|
|
9796
|
+
init_client2();
|
|
9647
9797
|
init_event();
|
|
9648
9798
|
emptyResult = (report = "Empty") => ({
|
|
9649
9799
|
report,
|
|
@@ -9658,8 +9808,8 @@ var init_inbox = __esm({
|
|
|
9658
9808
|
|
|
9659
9809
|
// ../packages/core/dist/service/agent-session/pure/decision.js
|
|
9660
9810
|
function firstValue(source, paths) {
|
|
9661
|
-
for (const
|
|
9662
|
-
const value2 = readPath2(source,
|
|
9811
|
+
for (const path40 of paths ?? []) {
|
|
9812
|
+
const value2 = readPath2(source, path40);
|
|
9663
9813
|
if (value2 !== void 0 && value2 !== null)
|
|
9664
9814
|
return value2;
|
|
9665
9815
|
}
|
|
@@ -10026,7 +10176,7 @@ var init_request = __esm({
|
|
|
10026
10176
|
"use strict";
|
|
10027
10177
|
init_decision();
|
|
10028
10178
|
init_bind();
|
|
10029
|
-
|
|
10179
|
+
init_client2();
|
|
10030
10180
|
init_decision_codec_registry_generated();
|
|
10031
10181
|
init_event();
|
|
10032
10182
|
sleep2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -10249,10 +10399,10 @@ async function reconcileState({
|
|
|
10249
10399
|
}) {
|
|
10250
10400
|
let posted = 0;
|
|
10251
10401
|
let duplicates = 0;
|
|
10252
|
-
for (const
|
|
10402
|
+
for (const path40 of ["/permission", "/question"]) {
|
|
10253
10403
|
let entries;
|
|
10254
10404
|
try {
|
|
10255
|
-
const response = await doFetch(`${controlPlaneBaseUrl(port)}${
|
|
10405
|
+
const response = await doFetch(`${controlPlaneBaseUrl(port)}${path40}`, {
|
|
10256
10406
|
headers: authHeaders(password)
|
|
10257
10407
|
});
|
|
10258
10408
|
if (!response.ok) continue;
|
|
@@ -10262,7 +10412,7 @@ async function reconcileState({
|
|
|
10262
10412
|
continue;
|
|
10263
10413
|
}
|
|
10264
10414
|
for (const entry of entries) {
|
|
10265
|
-
if (
|
|
10415
|
+
if (path40 === "/permission") {
|
|
10266
10416
|
await syncOpenCodePermission({
|
|
10267
10417
|
client,
|
|
10268
10418
|
frame: { event: "permission.updated", data: JSON.stringify(entry) },
|
|
@@ -10379,7 +10529,7 @@ var init_sidecar = __esm({
|
|
|
10379
10529
|
"use strict";
|
|
10380
10530
|
init_codec();
|
|
10381
10531
|
init_bind();
|
|
10382
|
-
|
|
10532
|
+
init_client2();
|
|
10383
10533
|
init_codec_registry_generated();
|
|
10384
10534
|
init_inbox();
|
|
10385
10535
|
SIDECAR_BIND_ADDRESS = "127.0.0.1";
|
|
@@ -10698,13 +10848,13 @@ var STATUS_MARK;
|
|
|
10698
10848
|
var init_agent_session = __esm({
|
|
10699
10849
|
"src/agent-session/index.ts"() {
|
|
10700
10850
|
"use strict";
|
|
10701
|
-
|
|
10851
|
+
init_dist();
|
|
10702
10852
|
init_args();
|
|
10703
10853
|
init_errors();
|
|
10704
10854
|
init_native_session();
|
|
10705
10855
|
init_output();
|
|
10706
10856
|
init_bind();
|
|
10707
|
-
|
|
10857
|
+
init_client2();
|
|
10708
10858
|
init_descriptor();
|
|
10709
10859
|
init_event();
|
|
10710
10860
|
init_inbox();
|
|
@@ -10795,17 +10945,17 @@ var require_visit = __commonJS({
|
|
|
10795
10945
|
visit.BREAK = BREAK;
|
|
10796
10946
|
visit.SKIP = SKIP;
|
|
10797
10947
|
visit.REMOVE = REMOVE;
|
|
10798
|
-
function visit_(key, node, visitor,
|
|
10799
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
10948
|
+
function visit_(key, node, visitor, path40) {
|
|
10949
|
+
const ctrl = callVisitor(key, node, visitor, path40);
|
|
10800
10950
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
10801
|
-
replaceNode(key,
|
|
10802
|
-
return visit_(key, ctrl, visitor,
|
|
10951
|
+
replaceNode(key, path40, ctrl);
|
|
10952
|
+
return visit_(key, ctrl, visitor, path40);
|
|
10803
10953
|
}
|
|
10804
10954
|
if (typeof ctrl !== "symbol") {
|
|
10805
10955
|
if (identity.isCollection(node)) {
|
|
10806
|
-
|
|
10956
|
+
path40 = Object.freeze(path40.concat(node));
|
|
10807
10957
|
for (let i = 0; i < node.items.length; ++i) {
|
|
10808
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
10958
|
+
const ci = visit_(i, node.items[i], visitor, path40);
|
|
10809
10959
|
if (typeof ci === "number")
|
|
10810
10960
|
i = ci - 1;
|
|
10811
10961
|
else if (ci === BREAK)
|
|
@@ -10816,13 +10966,13 @@ var require_visit = __commonJS({
|
|
|
10816
10966
|
}
|
|
10817
10967
|
}
|
|
10818
10968
|
} else if (identity.isPair(node)) {
|
|
10819
|
-
|
|
10820
|
-
const ck = visit_("key", node.key, visitor,
|
|
10969
|
+
path40 = Object.freeze(path40.concat(node));
|
|
10970
|
+
const ck = visit_("key", node.key, visitor, path40);
|
|
10821
10971
|
if (ck === BREAK)
|
|
10822
10972
|
return BREAK;
|
|
10823
10973
|
else if (ck === REMOVE)
|
|
10824
10974
|
node.key = null;
|
|
10825
|
-
const cv = visit_("value", node.value, visitor,
|
|
10975
|
+
const cv = visit_("value", node.value, visitor, path40);
|
|
10826
10976
|
if (cv === BREAK)
|
|
10827
10977
|
return BREAK;
|
|
10828
10978
|
else if (cv === REMOVE)
|
|
@@ -10843,17 +10993,17 @@ var require_visit = __commonJS({
|
|
|
10843
10993
|
visitAsync.BREAK = BREAK;
|
|
10844
10994
|
visitAsync.SKIP = SKIP;
|
|
10845
10995
|
visitAsync.REMOVE = REMOVE;
|
|
10846
|
-
async function visitAsync_(key, node, visitor,
|
|
10847
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
10996
|
+
async function visitAsync_(key, node, visitor, path40) {
|
|
10997
|
+
const ctrl = await callVisitor(key, node, visitor, path40);
|
|
10848
10998
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
10849
|
-
replaceNode(key,
|
|
10850
|
-
return visitAsync_(key, ctrl, visitor,
|
|
10999
|
+
replaceNode(key, path40, ctrl);
|
|
11000
|
+
return visitAsync_(key, ctrl, visitor, path40);
|
|
10851
11001
|
}
|
|
10852
11002
|
if (typeof ctrl !== "symbol") {
|
|
10853
11003
|
if (identity.isCollection(node)) {
|
|
10854
|
-
|
|
11004
|
+
path40 = Object.freeze(path40.concat(node));
|
|
10855
11005
|
for (let i = 0; i < node.items.length; ++i) {
|
|
10856
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
11006
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path40);
|
|
10857
11007
|
if (typeof ci === "number")
|
|
10858
11008
|
i = ci - 1;
|
|
10859
11009
|
else if (ci === BREAK)
|
|
@@ -10864,13 +11014,13 @@ var require_visit = __commonJS({
|
|
|
10864
11014
|
}
|
|
10865
11015
|
}
|
|
10866
11016
|
} else if (identity.isPair(node)) {
|
|
10867
|
-
|
|
10868
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
11017
|
+
path40 = Object.freeze(path40.concat(node));
|
|
11018
|
+
const ck = await visitAsync_("key", node.key, visitor, path40);
|
|
10869
11019
|
if (ck === BREAK)
|
|
10870
11020
|
return BREAK;
|
|
10871
11021
|
else if (ck === REMOVE)
|
|
10872
11022
|
node.key = null;
|
|
10873
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
11023
|
+
const cv = await visitAsync_("value", node.value, visitor, path40);
|
|
10874
11024
|
if (cv === BREAK)
|
|
10875
11025
|
return BREAK;
|
|
10876
11026
|
else if (cv === REMOVE)
|
|
@@ -10897,23 +11047,23 @@ var require_visit = __commonJS({
|
|
|
10897
11047
|
}
|
|
10898
11048
|
return visitor;
|
|
10899
11049
|
}
|
|
10900
|
-
function callVisitor(key, node, visitor,
|
|
11050
|
+
function callVisitor(key, node, visitor, path40) {
|
|
10901
11051
|
if (typeof visitor === "function")
|
|
10902
|
-
return visitor(key, node,
|
|
11052
|
+
return visitor(key, node, path40);
|
|
10903
11053
|
if (identity.isMap(node))
|
|
10904
|
-
return visitor.Map?.(key, node,
|
|
11054
|
+
return visitor.Map?.(key, node, path40);
|
|
10905
11055
|
if (identity.isSeq(node))
|
|
10906
|
-
return visitor.Seq?.(key, node,
|
|
11056
|
+
return visitor.Seq?.(key, node, path40);
|
|
10907
11057
|
if (identity.isPair(node))
|
|
10908
|
-
return visitor.Pair?.(key, node,
|
|
11058
|
+
return visitor.Pair?.(key, node, path40);
|
|
10909
11059
|
if (identity.isScalar(node))
|
|
10910
|
-
return visitor.Scalar?.(key, node,
|
|
11060
|
+
return visitor.Scalar?.(key, node, path40);
|
|
10911
11061
|
if (identity.isAlias(node))
|
|
10912
|
-
return visitor.Alias?.(key, node,
|
|
11062
|
+
return visitor.Alias?.(key, node, path40);
|
|
10913
11063
|
return void 0;
|
|
10914
11064
|
}
|
|
10915
|
-
function replaceNode(key,
|
|
10916
|
-
const parent =
|
|
11065
|
+
function replaceNode(key, path40, node) {
|
|
11066
|
+
const parent = path40[path40.length - 1];
|
|
10917
11067
|
if (identity.isCollection(parent)) {
|
|
10918
11068
|
parent.items[key] = node;
|
|
10919
11069
|
} else if (identity.isPair(parent)) {
|
|
@@ -11523,10 +11673,10 @@ var require_Collection = __commonJS({
|
|
|
11523
11673
|
var createNode = require_createNode();
|
|
11524
11674
|
var identity = require_identity();
|
|
11525
11675
|
var Node = require_Node();
|
|
11526
|
-
function collectionFromPath(schema,
|
|
11676
|
+
function collectionFromPath(schema, path40, value2) {
|
|
11527
11677
|
let v = value2;
|
|
11528
|
-
for (let i =
|
|
11529
|
-
const k =
|
|
11678
|
+
for (let i = path40.length - 1; i >= 0; --i) {
|
|
11679
|
+
const k = path40[i];
|
|
11530
11680
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
11531
11681
|
const a = [];
|
|
11532
11682
|
a[k] = v;
|
|
@@ -11545,7 +11695,7 @@ var require_Collection = __commonJS({
|
|
|
11545
11695
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
11546
11696
|
});
|
|
11547
11697
|
}
|
|
11548
|
-
var isEmptyPath = (
|
|
11698
|
+
var isEmptyPath = (path40) => path40 == null || typeof path40 === "object" && !!path40[Symbol.iterator]().next().done;
|
|
11549
11699
|
var Collection = class extends Node.NodeBase {
|
|
11550
11700
|
constructor(type, schema) {
|
|
11551
11701
|
super(type);
|
|
@@ -11575,11 +11725,11 @@ var require_Collection = __commonJS({
|
|
|
11575
11725
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
11576
11726
|
* that already exists in the map.
|
|
11577
11727
|
*/
|
|
11578
|
-
addIn(
|
|
11579
|
-
if (isEmptyPath(
|
|
11728
|
+
addIn(path40, value2) {
|
|
11729
|
+
if (isEmptyPath(path40))
|
|
11580
11730
|
this.add(value2);
|
|
11581
11731
|
else {
|
|
11582
|
-
const [key, ...rest] =
|
|
11732
|
+
const [key, ...rest] = path40;
|
|
11583
11733
|
const node = this.get(key, true);
|
|
11584
11734
|
if (identity.isCollection(node))
|
|
11585
11735
|
node.addIn(rest, value2);
|
|
@@ -11593,8 +11743,8 @@ var require_Collection = __commonJS({
|
|
|
11593
11743
|
* Removes a value from the collection.
|
|
11594
11744
|
* @returns `true` if the item was found and removed.
|
|
11595
11745
|
*/
|
|
11596
|
-
deleteIn(
|
|
11597
|
-
const [key, ...rest] =
|
|
11746
|
+
deleteIn(path40) {
|
|
11747
|
+
const [key, ...rest] = path40;
|
|
11598
11748
|
if (rest.length === 0)
|
|
11599
11749
|
return this.delete(key);
|
|
11600
11750
|
const node = this.get(key, true);
|
|
@@ -11608,8 +11758,8 @@ var require_Collection = __commonJS({
|
|
|
11608
11758
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
11609
11759
|
* `true` (collections are always returned intact).
|
|
11610
11760
|
*/
|
|
11611
|
-
getIn(
|
|
11612
|
-
const [key, ...rest] =
|
|
11761
|
+
getIn(path40, keepScalar) {
|
|
11762
|
+
const [key, ...rest] = path40;
|
|
11613
11763
|
const node = this.get(key, true);
|
|
11614
11764
|
if (rest.length === 0)
|
|
11615
11765
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -11627,8 +11777,8 @@ var require_Collection = __commonJS({
|
|
|
11627
11777
|
/**
|
|
11628
11778
|
* Checks if the collection includes a value with the key `key`.
|
|
11629
11779
|
*/
|
|
11630
|
-
hasIn(
|
|
11631
|
-
const [key, ...rest] =
|
|
11780
|
+
hasIn(path40) {
|
|
11781
|
+
const [key, ...rest] = path40;
|
|
11632
11782
|
if (rest.length === 0)
|
|
11633
11783
|
return this.has(key);
|
|
11634
11784
|
const node = this.get(key, true);
|
|
@@ -11638,8 +11788,8 @@ var require_Collection = __commonJS({
|
|
|
11638
11788
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
11639
11789
|
* boolean to add/remove the item from the set.
|
|
11640
11790
|
*/
|
|
11641
|
-
setIn(
|
|
11642
|
-
const [key, ...rest] =
|
|
11791
|
+
setIn(path40, value2) {
|
|
11792
|
+
const [key, ...rest] = path40;
|
|
11643
11793
|
if (rest.length === 0) {
|
|
11644
11794
|
this.set(key, value2);
|
|
11645
11795
|
} else {
|
|
@@ -14154,9 +14304,9 @@ var require_Document = __commonJS({
|
|
|
14154
14304
|
this.contents.add(value2);
|
|
14155
14305
|
}
|
|
14156
14306
|
/** Adds a value to the document. */
|
|
14157
|
-
addIn(
|
|
14307
|
+
addIn(path40, value2) {
|
|
14158
14308
|
if (assertCollection(this.contents))
|
|
14159
|
-
this.contents.addIn(
|
|
14309
|
+
this.contents.addIn(path40, value2);
|
|
14160
14310
|
}
|
|
14161
14311
|
/**
|
|
14162
14312
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -14231,14 +14381,14 @@ var require_Document = __commonJS({
|
|
|
14231
14381
|
* Removes a value from the document.
|
|
14232
14382
|
* @returns `true` if the item was found and removed.
|
|
14233
14383
|
*/
|
|
14234
|
-
deleteIn(
|
|
14235
|
-
if (Collection.isEmptyPath(
|
|
14384
|
+
deleteIn(path40) {
|
|
14385
|
+
if (Collection.isEmptyPath(path40)) {
|
|
14236
14386
|
if (this.contents == null)
|
|
14237
14387
|
return false;
|
|
14238
14388
|
this.contents = null;
|
|
14239
14389
|
return true;
|
|
14240
14390
|
}
|
|
14241
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
14391
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path40) : false;
|
|
14242
14392
|
}
|
|
14243
14393
|
/**
|
|
14244
14394
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -14253,10 +14403,10 @@ var require_Document = __commonJS({
|
|
|
14253
14403
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
14254
14404
|
* `true` (collections are always returned intact).
|
|
14255
14405
|
*/
|
|
14256
|
-
getIn(
|
|
14257
|
-
if (Collection.isEmptyPath(
|
|
14406
|
+
getIn(path40, keepScalar) {
|
|
14407
|
+
if (Collection.isEmptyPath(path40))
|
|
14258
14408
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
14259
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
14409
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path40, keepScalar) : void 0;
|
|
14260
14410
|
}
|
|
14261
14411
|
/**
|
|
14262
14412
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -14267,10 +14417,10 @@ var require_Document = __commonJS({
|
|
|
14267
14417
|
/**
|
|
14268
14418
|
* Checks if the document includes a value at `path`.
|
|
14269
14419
|
*/
|
|
14270
|
-
hasIn(
|
|
14271
|
-
if (Collection.isEmptyPath(
|
|
14420
|
+
hasIn(path40) {
|
|
14421
|
+
if (Collection.isEmptyPath(path40))
|
|
14272
14422
|
return this.contents !== void 0;
|
|
14273
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
14423
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path40) : false;
|
|
14274
14424
|
}
|
|
14275
14425
|
/**
|
|
14276
14426
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -14287,13 +14437,13 @@ var require_Document = __commonJS({
|
|
|
14287
14437
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
14288
14438
|
* boolean to add/remove the item from the set.
|
|
14289
14439
|
*/
|
|
14290
|
-
setIn(
|
|
14291
|
-
if (Collection.isEmptyPath(
|
|
14440
|
+
setIn(path40, value2) {
|
|
14441
|
+
if (Collection.isEmptyPath(path40)) {
|
|
14292
14442
|
this.contents = value2;
|
|
14293
14443
|
} else if (this.contents == null) {
|
|
14294
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
14444
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path40), value2);
|
|
14295
14445
|
} else if (assertCollection(this.contents)) {
|
|
14296
|
-
this.contents.setIn(
|
|
14446
|
+
this.contents.setIn(path40, value2);
|
|
14297
14447
|
}
|
|
14298
14448
|
}
|
|
14299
14449
|
/**
|
|
@@ -16253,9 +16403,9 @@ var require_cst_visit = __commonJS({
|
|
|
16253
16403
|
visit.BREAK = BREAK;
|
|
16254
16404
|
visit.SKIP = SKIP;
|
|
16255
16405
|
visit.REMOVE = REMOVE;
|
|
16256
|
-
visit.itemAtPath = (cst,
|
|
16406
|
+
visit.itemAtPath = (cst, path40) => {
|
|
16257
16407
|
let item = cst;
|
|
16258
|
-
for (const [field, index] of
|
|
16408
|
+
for (const [field, index] of path40) {
|
|
16259
16409
|
const tok = item?.[field];
|
|
16260
16410
|
if (tok && "items" in tok) {
|
|
16261
16411
|
item = tok.items[index];
|
|
@@ -16264,23 +16414,23 @@ var require_cst_visit = __commonJS({
|
|
|
16264
16414
|
}
|
|
16265
16415
|
return item;
|
|
16266
16416
|
};
|
|
16267
|
-
visit.parentCollection = (cst,
|
|
16268
|
-
const parent = visit.itemAtPath(cst,
|
|
16269
|
-
const field =
|
|
16417
|
+
visit.parentCollection = (cst, path40) => {
|
|
16418
|
+
const parent = visit.itemAtPath(cst, path40.slice(0, -1));
|
|
16419
|
+
const field = path40[path40.length - 1][0];
|
|
16270
16420
|
const coll = parent?.[field];
|
|
16271
16421
|
if (coll && "items" in coll)
|
|
16272
16422
|
return coll;
|
|
16273
16423
|
throw new Error("Parent collection not found");
|
|
16274
16424
|
};
|
|
16275
|
-
function _visit(
|
|
16276
|
-
let ctrl = visitor(item,
|
|
16425
|
+
function _visit(path40, item, visitor) {
|
|
16426
|
+
let ctrl = visitor(item, path40);
|
|
16277
16427
|
if (typeof ctrl === "symbol")
|
|
16278
16428
|
return ctrl;
|
|
16279
16429
|
for (const field of ["key", "value"]) {
|
|
16280
16430
|
const token = item[field];
|
|
16281
16431
|
if (token && "items" in token) {
|
|
16282
16432
|
for (let i = 0; i < token.items.length; ++i) {
|
|
16283
|
-
const ci = _visit(Object.freeze(
|
|
16433
|
+
const ci = _visit(Object.freeze(path40.concat([[field, i]])), token.items[i], visitor);
|
|
16284
16434
|
if (typeof ci === "number")
|
|
16285
16435
|
i = ci - 1;
|
|
16286
16436
|
else if (ci === BREAK)
|
|
@@ -16291,10 +16441,10 @@ var require_cst_visit = __commonJS({
|
|
|
16291
16441
|
}
|
|
16292
16442
|
}
|
|
16293
16443
|
if (typeof ctrl === "function" && field === "key")
|
|
16294
|
-
ctrl = ctrl(item,
|
|
16444
|
+
ctrl = ctrl(item, path40);
|
|
16295
16445
|
}
|
|
16296
16446
|
}
|
|
16297
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
16447
|
+
return typeof ctrl === "function" ? ctrl(item, path40) : ctrl;
|
|
16298
16448
|
}
|
|
16299
16449
|
exports.visit = visit;
|
|
16300
16450
|
}
|
|
@@ -18053,20 +18203,20 @@ __export(contract_exports, {
|
|
|
18053
18203
|
validateManifest: () => validateManifest
|
|
18054
18204
|
});
|
|
18055
18205
|
import { existsSync as existsSync17, readFileSync as readFileSync13 } from "node:fs";
|
|
18056
|
-
import
|
|
18206
|
+
import path19 from "node:path";
|
|
18057
18207
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
18058
18208
|
function schemaPath() {
|
|
18059
|
-
const packaged =
|
|
18060
|
-
|
|
18209
|
+
const packaged = path19.join(
|
|
18210
|
+
path19.dirname(fileURLToPath5(import.meta.url)),
|
|
18061
18211
|
"contract",
|
|
18062
18212
|
"conformance-manifest.schema.yaml"
|
|
18063
18213
|
);
|
|
18064
18214
|
if (existsSync17(packaged)) return packaged;
|
|
18065
18215
|
let dir = process.cwd();
|
|
18066
18216
|
while (true) {
|
|
18067
|
-
const candidate =
|
|
18217
|
+
const candidate = path19.join(dir, "contract", "conformance-manifest.schema.yaml");
|
|
18068
18218
|
if (existsSync17(candidate)) return candidate;
|
|
18069
|
-
const parent =
|
|
18219
|
+
const parent = path19.dirname(dir);
|
|
18070
18220
|
if (parent === dir) break;
|
|
18071
18221
|
dir = parent;
|
|
18072
18222
|
}
|
|
@@ -18147,7 +18297,7 @@ function validateManifest(manifest) {
|
|
|
18147
18297
|
return validateAgainstSchema(manifest, schema, "$");
|
|
18148
18298
|
}
|
|
18149
18299
|
function readManifest2(manifestPathArg) {
|
|
18150
|
-
const resolved =
|
|
18300
|
+
const resolved = path19.resolve(process.cwd(), manifestPathArg);
|
|
18151
18301
|
if (!existsSync17(resolved)) {
|
|
18152
18302
|
throw new CliError({ message: `Manifest not found: ${manifestPathArg}` });
|
|
18153
18303
|
}
|
|
@@ -18220,7 +18370,7 @@ var init_util2 = __esm({
|
|
|
18220
18370
|
// ../packages/core/dist/service/local-target/project-metadata.js
|
|
18221
18371
|
import { execFileSync } from "node:child_process";
|
|
18222
18372
|
import { existsSync as existsSync18, mkdirSync as mkdirSync9, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "node:fs";
|
|
18223
|
-
import
|
|
18373
|
+
import path20 from "node:path";
|
|
18224
18374
|
function writeIfChanged(filePath, content) {
|
|
18225
18375
|
if (!existsSync18(filePath) || readFileSync14(filePath, "utf8") !== content) {
|
|
18226
18376
|
writeFileSync8(filePath, content);
|
|
@@ -18234,13 +18384,13 @@ function replaceManagedBlock(content, block) {
|
|
|
18234
18384
|
}
|
|
18235
18385
|
function ensureAgentInstructions(checkoutPath) {
|
|
18236
18386
|
for (const filename of ["AGENTS.md", "CLAUDE.md"]) {
|
|
18237
|
-
const instructionPath =
|
|
18387
|
+
const instructionPath = path20.join(checkoutPath, filename);
|
|
18238
18388
|
const existing = existsSync18(instructionPath) ? readFileSync14(instructionPath, "utf8") : "";
|
|
18239
18389
|
writeIfChanged(instructionPath, replaceManagedBlock(existing, PROJECT_METADATA_INSTRUCTION));
|
|
18240
18390
|
}
|
|
18241
18391
|
}
|
|
18242
18392
|
function ensureGitignore(checkoutPath) {
|
|
18243
|
-
const gitignorePath =
|
|
18393
|
+
const gitignorePath = path20.join(checkoutPath, ".gitignore");
|
|
18244
18394
|
const existing = existsSync18(gitignorePath) ? readFileSync14(gitignorePath, "utf8") : "";
|
|
18245
18395
|
const existingPatterns = new Set(existing.split(/\r?\n/).map((line) => line.trim().replace(/^\//, "")).filter(Boolean));
|
|
18246
18396
|
const additions = [".overlord/tmp/", ".overlord/logs/"].filter((pattern) => !existingPatterns.has(pattern));
|
|
@@ -18378,12 +18528,12 @@ function serializeProjectEntry(entry) {
|
|
|
18378
18528
|
};
|
|
18379
18529
|
}
|
|
18380
18530
|
function writeProjectJson({ directoryPath, projectId, projectName, resourceId, resourceKey, executionTargetId, isPrimary }) {
|
|
18381
|
-
const overlordDir =
|
|
18531
|
+
const overlordDir = path20.join(directoryPath, ".overlord");
|
|
18382
18532
|
mkdirSync9(overlordDir, { recursive: true });
|
|
18383
|
-
mkdirSync9(
|
|
18384
|
-
mkdirSync9(
|
|
18533
|
+
mkdirSync9(path20.join(overlordDir, "tmp"), { recursive: true });
|
|
18534
|
+
mkdirSync9(path20.join(overlordDir, "logs"), { recursive: true });
|
|
18385
18535
|
protectProjectMetadata(directoryPath);
|
|
18386
|
-
const projectJsonPath =
|
|
18536
|
+
const projectJsonPath = path20.join(overlordDir, "project.json");
|
|
18387
18537
|
const existing = parseProjectJson(projectJsonPath);
|
|
18388
18538
|
const existingProjects = existing?.projects ?? [];
|
|
18389
18539
|
const existingEntry = existingProjects.find((entry) => entry.projectId === projectId);
|
|
@@ -18446,7 +18596,7 @@ ${INSTRUCTION_BLOCK_END}`;
|
|
|
18446
18596
|
|
|
18447
18597
|
// ../packages/core/dist/repository/git-tree.js
|
|
18448
18598
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
18449
|
-
import
|
|
18599
|
+
import path21 from "node:path";
|
|
18450
18600
|
function runGit(cwd, args) {
|
|
18451
18601
|
try {
|
|
18452
18602
|
return execFileSync2("git", args, {
|
|
@@ -18469,17 +18619,17 @@ function gitPath(cwd, args) {
|
|
|
18469
18619
|
}
|
|
18470
18620
|
}
|
|
18471
18621
|
function addDirectoryAncestors(paths, filePath) {
|
|
18472
|
-
let parent =
|
|
18622
|
+
let parent = path21.posix.dirname(filePath);
|
|
18473
18623
|
while (parent !== "." && parent !== "/") {
|
|
18474
18624
|
paths.add(parent);
|
|
18475
|
-
parent =
|
|
18625
|
+
parent = path21.posix.dirname(parent);
|
|
18476
18626
|
}
|
|
18477
18627
|
}
|
|
18478
18628
|
function toEntry(entryPath, type) {
|
|
18479
|
-
const parentPath =
|
|
18629
|
+
const parentPath = path21.posix.dirname(entryPath);
|
|
18480
18630
|
return {
|
|
18481
18631
|
path: entryPath,
|
|
18482
|
-
name:
|
|
18632
|
+
name: path21.posix.basename(entryPath),
|
|
18483
18633
|
type,
|
|
18484
18634
|
parentPath: parentPath === "." ? null : parentPath,
|
|
18485
18635
|
depth: entryPath.split("/").length - 1
|
|
@@ -18491,7 +18641,7 @@ function compareEntries(a, b) {
|
|
|
18491
18641
|
return a.path < b.path ? -1 : 1;
|
|
18492
18642
|
}
|
|
18493
18643
|
function readRepositoryTree(rootPath, options = {}) {
|
|
18494
|
-
const resolvedRoot =
|
|
18644
|
+
const resolvedRoot = path21.resolve(rootPath);
|
|
18495
18645
|
const gitRoot = gitPath(resolvedRoot, ["rev-parse", "--show-toplevel"]);
|
|
18496
18646
|
if (!gitRoot) {
|
|
18497
18647
|
throw new RepositoryReadError("not_git_repository", `${resolvedRoot} is not inside a git repository.`);
|
|
@@ -18514,7 +18664,7 @@ function readRepositoryTree(rootPath, options = {}) {
|
|
|
18514
18664
|
const truncated = entries.length > maxEntries;
|
|
18515
18665
|
return {
|
|
18516
18666
|
rootPath: resolvedRoot,
|
|
18517
|
-
gitRoot:
|
|
18667
|
+
gitRoot: path21.resolve(gitRoot),
|
|
18518
18668
|
branch: gitPath(gitRoot, ["branch", "--show-current"]),
|
|
18519
18669
|
commit: gitPath(gitRoot, ["rev-parse", "--short", "HEAD"]),
|
|
18520
18670
|
entries: truncated ? entries.slice(0, maxEntries) : entries,
|
|
@@ -18644,11 +18794,11 @@ var init_terminal_profile_types2 = __esm({
|
|
|
18644
18794
|
// ../packages/core/dist/service/latch-discovery.js
|
|
18645
18795
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
18646
18796
|
import { existsSync as existsSync19, mkdirSync as mkdirSync10, readFileSync as readFileSync15, statSync as statSync4, writeFileSync as writeFileSync9 } from "node:fs";
|
|
18647
|
-
import
|
|
18648
|
-
import
|
|
18797
|
+
import os4 from "node:os";
|
|
18798
|
+
import path22 from "node:path";
|
|
18649
18799
|
function defaultLatchDiscoveryCachePath() {
|
|
18650
|
-
const home = process.env.OVLD_HOME?.trim() ||
|
|
18651
|
-
return
|
|
18800
|
+
const home = process.env.OVLD_HOME?.trim() || path22.join(os4.homedir(), ".ovld");
|
|
18801
|
+
return path22.join(home, LATCH_DISCOVERY_CACHE_FILENAME);
|
|
18652
18802
|
}
|
|
18653
18803
|
function trimmed2(value2) {
|
|
18654
18804
|
return typeof value2 === "string" && value2.trim() ? value2.trim() : null;
|
|
@@ -18749,20 +18899,20 @@ function resolveLatchExecutableOnPath(executable) {
|
|
|
18749
18899
|
return null;
|
|
18750
18900
|
}
|
|
18751
18901
|
}
|
|
18752
|
-
function resolveLatchExecutablePathFromEnvironment({ executable, homeDirectory =
|
|
18902
|
+
function resolveLatchExecutablePathFromEnvironment({ executable, homeDirectory = os4.homedir(), platform: platform2 = process.platform, resolveOnPath = resolveLatchExecutableOnPath, fileExists = existsSync19 }) {
|
|
18753
18903
|
const name = trimmed2(executable) ?? DEFAULT_LATCH_EXECUTABLE;
|
|
18754
|
-
if (
|
|
18755
|
-
return fileExists(name) ?
|
|
18904
|
+
if (path22.isAbsolute(name) || name.includes("/") || name.includes("\\")) {
|
|
18905
|
+
return fileExists(name) ? path22.resolve(name) : null;
|
|
18756
18906
|
}
|
|
18757
18907
|
const resolvedOnPath = resolveOnPath(name);
|
|
18758
18908
|
if (resolvedOnPath)
|
|
18759
18909
|
return resolvedOnPath;
|
|
18760
18910
|
const fallbacks = [
|
|
18761
|
-
|
|
18911
|
+
path22.join(homeDirectory, ".local", "bin", name),
|
|
18762
18912
|
...platform2 === "darwin" ? [`/opt/homebrew/bin/${name}`, `/usr/local/bin/${name}`] : []
|
|
18763
18913
|
];
|
|
18764
18914
|
const fallback = fallbacks.find(fileExists);
|
|
18765
|
-
return fallback ?
|
|
18915
|
+
return fallback ? path22.resolve(fallback) : null;
|
|
18766
18916
|
}
|
|
18767
18917
|
function resolveLatchExecutablePath(executable) {
|
|
18768
18918
|
return resolveLatchExecutablePathFromEnvironment({ executable });
|
|
@@ -18847,7 +18997,7 @@ function readLatchDiscoveryCacheFile(filePath) {
|
|
|
18847
18997
|
}
|
|
18848
18998
|
}
|
|
18849
18999
|
function writeLatchDiscoveryCacheFile({ filePath, cache: cache2 }) {
|
|
18850
|
-
mkdirSync10(
|
|
19000
|
+
mkdirSync10(path22.dirname(filePath), { recursive: true });
|
|
18851
19001
|
writeFileSync9(filePath, `${JSON.stringify(cache2, null, 2)}
|
|
18852
19002
|
`, { mode: 384 });
|
|
18853
19003
|
}
|
|
@@ -18938,8 +19088,8 @@ var init_latch_binary = __esm({
|
|
|
18938
19088
|
|
|
18939
19089
|
// ../packages/core/dist/service/latch-gateway.js
|
|
18940
19090
|
import { existsSync as existsSync21, readFileSync as readFileSync16 } from "node:fs";
|
|
18941
|
-
import
|
|
18942
|
-
import
|
|
19091
|
+
import os5 from "node:os";
|
|
19092
|
+
import path23 from "node:path";
|
|
18943
19093
|
function trimmed4(value2) {
|
|
18944
19094
|
return typeof value2 === "string" && value2.trim() ? value2.trim() : null;
|
|
18945
19095
|
}
|
|
@@ -18950,7 +19100,7 @@ function isLoopbackHostname(hostname7) {
|
|
|
18950
19100
|
return /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(host);
|
|
18951
19101
|
}
|
|
18952
19102
|
function latchHomeDirectory(env = process.env) {
|
|
18953
|
-
return trimmed4(env.LATCH_HOME) ??
|
|
19103
|
+
return trimmed4(env.LATCH_HOME) ?? path23.join(os5.homedir(), ".latch");
|
|
18954
19104
|
}
|
|
18955
19105
|
function resolveLatchGatewayConfig({ env = process.env, readFile = (filePath) => readFileSync16(filePath, "utf8"), fileExists = existsSync21 } = {}) {
|
|
18956
19106
|
const rawUrl = trimmed4(env.LATCH_GATEWAY_URL) ?? DEFAULT_LATCH_GATEWAY_URL;
|
|
@@ -18969,7 +19119,7 @@ function resolveLatchGatewayConfig({ env = process.env, readFile = (filePath) =>
|
|
|
18969
19119
|
const inlineToken = trimmed4(env.LATCH_GATEWAY_TOKEN);
|
|
18970
19120
|
if (inlineToken)
|
|
18971
19121
|
return { baseUrl: parsed.origin, token: inlineToken };
|
|
18972
|
-
const tokenFile = trimmed4(env.LATCH_SERVE_TOKEN_FILE) ??
|
|
19122
|
+
const tokenFile = trimmed4(env.LATCH_SERVE_TOKEN_FILE) ?? path23.join(latchHomeDirectory(env), LATCH_SERVE_TOKEN_FILENAME);
|
|
18973
19123
|
if (!fileExists(tokenFile)) {
|
|
18974
19124
|
throw new LatchGatewayError(`Latch's gateway token is missing (${tokenFile}). Start it with \`latch serve\`.`);
|
|
18975
19125
|
}
|
|
@@ -19087,15 +19237,15 @@ var init_latch_gateway = __esm({
|
|
|
19087
19237
|
});
|
|
19088
19238
|
|
|
19089
19239
|
// ../packages/core/dist/service/latch-launch.js
|
|
19090
|
-
import
|
|
19240
|
+
import path24 from "node:path";
|
|
19091
19241
|
function selectLatchAgentLaunch({ agent, argv, preCommand, preLaunchCommands, extensions, shell }) {
|
|
19092
19242
|
if (!extensions.includes(LATCH_AGENT_LAUNCH_EXTENSION))
|
|
19093
19243
|
return null;
|
|
19094
19244
|
if (agent !== "claude" && agent !== "codex")
|
|
19095
19245
|
return null;
|
|
19096
|
-
if (preCommand?.trim() || !
|
|
19246
|
+
if (preCommand?.trim() || !path24.isAbsolute(shell))
|
|
19097
19247
|
return null;
|
|
19098
|
-
if (
|
|
19248
|
+
if (path24.basename(argv[0] ?? "") !== agent)
|
|
19099
19249
|
return null;
|
|
19100
19250
|
const prelude = (preLaunchCommands ?? []).map((command) => command.trim()).filter(Boolean).join("; ");
|
|
19101
19251
|
return { agent, argv, ...prelude ? { prelude } : {} };
|
|
@@ -19113,7 +19263,7 @@ function formatObjectiveLatchDisplay({ objectiveDisplayId, objectiveTitle }) {
|
|
|
19113
19263
|
}
|
|
19114
19264
|
function buildLatchCreateManifest({ commandString, agentLaunch, shell = process.env.SHELL?.trim() || "/bin/bash", cwd, env, size = DEFAULT_LATCH_TERMINAL_SIZE, title, name, commandLabel, externalRunId }) {
|
|
19115
19265
|
const shellPath = trimmed5(shell) ?? "/bin/bash";
|
|
19116
|
-
if (agentLaunch &&
|
|
19266
|
+
if (agentLaunch && path24.basename(agentLaunch.argv[0] ?? "") !== agentLaunch.agent) {
|
|
19117
19267
|
throw new Error("Latch agent launch argv must start with the declared agent executable");
|
|
19118
19268
|
}
|
|
19119
19269
|
const cleanedEnv = {};
|
|
@@ -19877,20 +20027,20 @@ var init_git_run = __esm({
|
|
|
19877
20027
|
|
|
19878
20028
|
// ../packages/core/dist/service/local-target/worktree-git.js
|
|
19879
20029
|
import { existsSync as existsSync22, realpathSync as realpathSync4 } from "node:fs";
|
|
19880
|
-
import
|
|
19881
|
-
import
|
|
20030
|
+
import os6 from "node:os";
|
|
20031
|
+
import path25 from "node:path";
|
|
19882
20032
|
function resolveManagedWorktreeRoot() {
|
|
19883
20033
|
const override = process.env.OVERLORD_WORKTREE_ROOT?.trim();
|
|
19884
20034
|
if (override)
|
|
19885
|
-
return
|
|
20035
|
+
return path25.resolve(override);
|
|
19886
20036
|
const home = process.env.OVLD_HOME?.trim() || process.env.OVERLORD_HOME?.trim();
|
|
19887
|
-
return
|
|
20037
|
+
return path25.join(home ? path25.resolve(home) : path25.join(os6.homedir(), ".ovld"), "worktrees");
|
|
19888
20038
|
}
|
|
19889
20039
|
function resolveRealPath(targetPath) {
|
|
19890
20040
|
try {
|
|
19891
20041
|
return realpathSync4.native(targetPath);
|
|
19892
20042
|
} catch {
|
|
19893
|
-
return
|
|
20043
|
+
return path25.resolve(targetPath);
|
|
19894
20044
|
}
|
|
19895
20045
|
}
|
|
19896
20046
|
function worktreeIsDirty(worktreePath) {
|
|
@@ -19947,7 +20097,7 @@ function collectManagedWorktrees({ worktreeRoot, projects }) {
|
|
|
19947
20097
|
if (!currentPath)
|
|
19948
20098
|
return;
|
|
19949
20099
|
const resolved = resolveRealPath(currentPath);
|
|
19950
|
-
const underRoot = resolved === resolvedRoot || resolved.startsWith(resolvedRoot +
|
|
20100
|
+
const underRoot = resolved === resolvedRoot || resolved.startsWith(resolvedRoot + path25.sep);
|
|
19951
20101
|
if (underRoot && !seen.has(resolved)) {
|
|
19952
20102
|
seen.add(resolved);
|
|
19953
20103
|
entries.push({
|
|
@@ -19975,7 +20125,7 @@ function collectManagedWorktrees({ worktreeRoot, projects }) {
|
|
|
19975
20125
|
return entries;
|
|
19976
20126
|
}
|
|
19977
20127
|
function removeManagedWorktree({ path: worktreePath, primaryRepoPath, force }) {
|
|
19978
|
-
const target =
|
|
20128
|
+
const target = path25.resolve(worktreePath);
|
|
19979
20129
|
if (!force && worktreeIsDirty(target)) {
|
|
19980
20130
|
return {
|
|
19981
20131
|
removed: [],
|
|
@@ -19989,7 +20139,7 @@ function purgeManagedWorktrees({ entries }) {
|
|
|
19989
20139
|
const removed = [];
|
|
19990
20140
|
const skipped = [];
|
|
19991
20141
|
for (const entry of entries) {
|
|
19992
|
-
const target =
|
|
20142
|
+
const target = path25.resolve(entry.path);
|
|
19993
20143
|
if (worktreeIsDirty(target)) {
|
|
19994
20144
|
skipped.push({ path: target, reason: "uncommitted changes" });
|
|
19995
20145
|
continue;
|
|
@@ -20015,13 +20165,13 @@ var init_worktree_git = __esm({
|
|
|
20015
20165
|
|
|
20016
20166
|
// ../packages/core/dist/service/local-target/branch-actions-git.js
|
|
20017
20167
|
function resolveActionCheckout(input) {
|
|
20018
|
-
const
|
|
20168
|
+
const path40 = resolveBranchCheckoutPath({
|
|
20019
20169
|
repoPath: input.primaryRepoPath,
|
|
20020
20170
|
branchName: input.branchName,
|
|
20021
20171
|
worktreePathHint: input.worktreePath
|
|
20022
20172
|
});
|
|
20023
|
-
if (
|
|
20024
|
-
return { ok: true, path:
|
|
20173
|
+
if (path40)
|
|
20174
|
+
return { ok: true, path: path40 };
|
|
20025
20175
|
return {
|
|
20026
20176
|
ok: false,
|
|
20027
20177
|
code: "BRANCH_NO_WORKTREE",
|
|
@@ -20283,7 +20433,7 @@ var init_branch_observe_git = __esm({
|
|
|
20283
20433
|
|
|
20284
20434
|
// ../packages/core/dist/service/local-target/repository-paths.js
|
|
20285
20435
|
import { realpathSync as realpathSync5, statSync as statSync5 } from "node:fs";
|
|
20286
|
-
import
|
|
20436
|
+
import path26 from "node:path";
|
|
20287
20437
|
function normalizeRepositoryRelativePath(value2) {
|
|
20288
20438
|
if (value2 === void 0 || value2 === null)
|
|
20289
20439
|
return { ok: true, relativePath: "" };
|
|
@@ -20300,7 +20450,7 @@ function normalizeRepositoryRelativePath(value2) {
|
|
|
20300
20450
|
reason: "Absolute paths are not accepted; use a repository-relative path."
|
|
20301
20451
|
};
|
|
20302
20452
|
}
|
|
20303
|
-
const normalized =
|
|
20453
|
+
const normalized = path26.posix.normalize(slashed === "" ? "." : slashed).replace(/\/+$/, "");
|
|
20304
20454
|
if (normalized === "." || normalized === "")
|
|
20305
20455
|
return { ok: true, relativePath: "" };
|
|
20306
20456
|
if (normalized === ".." || normalized.startsWith("../")) {
|
|
@@ -20363,7 +20513,7 @@ function resolveContainedRepositoryPath(root, relative) {
|
|
|
20363
20513
|
} catch {
|
|
20364
20514
|
return { ok: false, outcome: "not_found", message: "The resource directory is not present." };
|
|
20365
20515
|
}
|
|
20366
|
-
const candidate =
|
|
20516
|
+
const candidate = path26.join(realRoot, ...checked.relativePath.split("/").filter(Boolean));
|
|
20367
20517
|
if (checked.relativePath && isSensitiveRepositoryPath(checked.relativePath)) {
|
|
20368
20518
|
return { ok: false, outcome: "denied", message: "This path is excluded as sensitive." };
|
|
20369
20519
|
}
|
|
@@ -20373,10 +20523,10 @@ function resolveContainedRepositoryPath(root, relative) {
|
|
|
20373
20523
|
} catch {
|
|
20374
20524
|
return { ok: false, outcome: "not_found", message: "No such path in the repository." };
|
|
20375
20525
|
}
|
|
20376
|
-
if (realCandidate !== realRoot && !realCandidate.startsWith(realRoot +
|
|
20526
|
+
if (realCandidate !== realRoot && !realCandidate.startsWith(realRoot + path26.sep)) {
|
|
20377
20527
|
return { ok: false, outcome: "denied", message: "The path resolves outside the repository." };
|
|
20378
20528
|
}
|
|
20379
|
-
const realRelative =
|
|
20529
|
+
const realRelative = path26.relative(realRoot, realCandidate).split(path26.sep).join("/");
|
|
20380
20530
|
if (realRelative && (isSensitiveRepositoryPath(realRelative) || realRelative.split("/").some((segment) => segment.toLowerCase() === ".git"))) {
|
|
20381
20531
|
return { ok: false, outcome: "denied", message: "This path is excluded as sensitive." };
|
|
20382
20532
|
}
|
|
@@ -21437,149 +21587,6 @@ var init_live_activity_jobs = __esm({
|
|
|
21437
21587
|
}
|
|
21438
21588
|
});
|
|
21439
21589
|
|
|
21440
|
-
// ../database/dist/better-sqlite3-loader.js
|
|
21441
|
-
var init_better_sqlite3_loader = __esm({
|
|
21442
|
-
"../database/dist/better-sqlite3-loader.js"() {
|
|
21443
|
-
"use strict";
|
|
21444
|
-
}
|
|
21445
|
-
});
|
|
21446
|
-
|
|
21447
|
-
// ../database/dist/constants.js
|
|
21448
|
-
var init_constants = __esm({
|
|
21449
|
-
"../database/dist/constants.js"() {
|
|
21450
|
-
"use strict";
|
|
21451
|
-
}
|
|
21452
|
-
});
|
|
21453
|
-
|
|
21454
|
-
// ../database/dist/ext-everhour-migration-runtime.js
|
|
21455
|
-
var init_ext_everhour_migration_runtime = __esm({
|
|
21456
|
-
"../database/dist/ext-everhour-migration-runtime.js"() {
|
|
21457
|
-
"use strict";
|
|
21458
|
-
}
|
|
21459
|
-
});
|
|
21460
|
-
|
|
21461
|
-
// ../database/dist/local-paths.js
|
|
21462
|
-
var LOCAL_DATA_DIR, LOCAL_STORAGE_DIR;
|
|
21463
|
-
var init_local_paths = __esm({
|
|
21464
|
-
"../database/dist/local-paths.js"() {
|
|
21465
|
-
"use strict";
|
|
21466
|
-
LOCAL_DATA_DIR = "database/.local";
|
|
21467
|
-
LOCAL_STORAGE_DIR = `${LOCAL_DATA_DIR}/storage`;
|
|
21468
|
-
}
|
|
21469
|
-
});
|
|
21470
|
-
|
|
21471
|
-
// ../database/dist/migration-ledger.js
|
|
21472
|
-
var init_migration_ledger = __esm({
|
|
21473
|
-
"../database/dist/migration-ledger.js"() {
|
|
21474
|
-
"use strict";
|
|
21475
|
-
}
|
|
21476
|
-
});
|
|
21477
|
-
|
|
21478
|
-
// ../database/dist/next-status-type-migration-runtime.js
|
|
21479
|
-
var init_next_status_type_migration_runtime = __esm({
|
|
21480
|
-
"../database/dist/next-status-type-migration-runtime.js"() {
|
|
21481
|
-
"use strict";
|
|
21482
|
-
}
|
|
21483
|
-
});
|
|
21484
|
-
|
|
21485
|
-
// ../database/dist/objective-display-key.js
|
|
21486
|
-
var init_objective_display_key = __esm({
|
|
21487
|
-
"../database/dist/objective-display-key.js"() {
|
|
21488
|
-
"use strict";
|
|
21489
|
-
init_dist2();
|
|
21490
|
-
init_dist2();
|
|
21491
|
-
}
|
|
21492
|
-
});
|
|
21493
|
-
|
|
21494
|
-
// ../database/dist/objective-display-key-migration-runtime.js
|
|
21495
|
-
var init_objective_display_key_migration_runtime = __esm({
|
|
21496
|
-
"../database/dist/objective-display-key-migration-runtime.js"() {
|
|
21497
|
-
"use strict";
|
|
21498
|
-
init_objective_display_key();
|
|
21499
|
-
}
|
|
21500
|
-
});
|
|
21501
|
-
|
|
21502
|
-
// ../database/dist/project-resources-resource-key-migration-runtime.js
|
|
21503
|
-
var init_project_resources_resource_key_migration_runtime = __esm({
|
|
21504
|
-
"../database/dist/project-resources-resource-key-migration-runtime.js"() {
|
|
21505
|
-
"use strict";
|
|
21506
|
-
}
|
|
21507
|
-
});
|
|
21508
|
-
|
|
21509
|
-
// ../database/dist/project-statuses-migration-runtime.js
|
|
21510
|
-
var init_project_statuses_migration_runtime = __esm({
|
|
21511
|
-
"../database/dist/project-statuses-migration-runtime.js"() {
|
|
21512
|
-
"use strict";
|
|
21513
|
-
}
|
|
21514
|
-
});
|
|
21515
|
-
|
|
21516
|
-
// ../database/dist/connection.js
|
|
21517
|
-
var init_connection = __esm({
|
|
21518
|
-
"../database/dist/connection.js"() {
|
|
21519
|
-
"use strict";
|
|
21520
|
-
init_better_sqlite3_loader();
|
|
21521
|
-
init_constants();
|
|
21522
|
-
init_ext_everhour_migration_runtime();
|
|
21523
|
-
init_local_paths();
|
|
21524
|
-
init_migration_ledger();
|
|
21525
|
-
init_next_status_type_migration_runtime();
|
|
21526
|
-
init_objective_display_key_migration_runtime();
|
|
21527
|
-
init_project_resources_resource_key_migration_runtime();
|
|
21528
|
-
init_project_statuses_migration_runtime();
|
|
21529
|
-
}
|
|
21530
|
-
});
|
|
21531
|
-
|
|
21532
|
-
// ../database/dist/adapter.js
|
|
21533
|
-
var init_adapter = __esm({
|
|
21534
|
-
"../database/dist/adapter.js"() {
|
|
21535
|
-
"use strict";
|
|
21536
|
-
init_connection();
|
|
21537
|
-
}
|
|
21538
|
-
});
|
|
21539
|
-
|
|
21540
|
-
// ../database/dist/client.js
|
|
21541
|
-
var init_client2 = __esm({
|
|
21542
|
-
"../database/dist/client.js"() {
|
|
21543
|
-
"use strict";
|
|
21544
|
-
init_connection();
|
|
21545
|
-
}
|
|
21546
|
-
});
|
|
21547
|
-
|
|
21548
|
-
// ../database/dist/migrate-postgres.js
|
|
21549
|
-
var init_migrate_postgres = __esm({
|
|
21550
|
-
"../database/dist/migrate-postgres.js"() {
|
|
21551
|
-
"use strict";
|
|
21552
|
-
init_constants();
|
|
21553
|
-
init_ext_everhour_migration_runtime();
|
|
21554
|
-
init_migration_ledger();
|
|
21555
|
-
init_objective_display_key_migration_runtime();
|
|
21556
|
-
init_project_statuses_migration_runtime();
|
|
21557
|
-
}
|
|
21558
|
-
});
|
|
21559
|
-
|
|
21560
|
-
// ../database/dist/storage-seed.js
|
|
21561
|
-
var init_storage_seed = __esm({
|
|
21562
|
-
"../database/dist/storage-seed.js"() {
|
|
21563
|
-
"use strict";
|
|
21564
|
-
}
|
|
21565
|
-
});
|
|
21566
|
-
|
|
21567
|
-
// ../database/dist/index.js
|
|
21568
|
-
var init_dist3 = __esm({
|
|
21569
|
-
"../database/dist/index.js"() {
|
|
21570
|
-
"use strict";
|
|
21571
|
-
init_adapter();
|
|
21572
|
-
init_better_sqlite3_loader();
|
|
21573
|
-
init_client2();
|
|
21574
|
-
init_connection();
|
|
21575
|
-
init_constants();
|
|
21576
|
-
init_local_paths();
|
|
21577
|
-
init_migrate_postgres();
|
|
21578
|
-
init_objective_display_key();
|
|
21579
|
-
init_storage_seed();
|
|
21580
|
-
}
|
|
21581
|
-
});
|
|
21582
|
-
|
|
21583
21590
|
// ../node_modules/zod/v4/core/core.js
|
|
21584
21591
|
// @__NO_SIDE_EFFECTS__
|
|
21585
21592
|
function $constructor(name, initializer3, params) {
|
|
@@ -21827,10 +21834,10 @@ function mergeDefs(...defs) {
|
|
|
21827
21834
|
function cloneDef(schema) {
|
|
21828
21835
|
return mergeDefs(schema._zod.def);
|
|
21829
21836
|
}
|
|
21830
|
-
function getElementAtPath(obj,
|
|
21831
|
-
if (!
|
|
21837
|
+
function getElementAtPath(obj, path40) {
|
|
21838
|
+
if (!path40)
|
|
21832
21839
|
return obj;
|
|
21833
|
-
return
|
|
21840
|
+
return path40.reduce((acc, key) => acc?.[key], obj);
|
|
21834
21841
|
}
|
|
21835
21842
|
function promiseAllObject(promisesObj) {
|
|
21836
21843
|
const keys = Object.keys(promisesObj);
|
|
@@ -22158,11 +22165,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
22158
22165
|
}
|
|
22159
22166
|
return false;
|
|
22160
22167
|
}
|
|
22161
|
-
function prefixIssues(
|
|
22168
|
+
function prefixIssues(path40, issues) {
|
|
22162
22169
|
return issues.map((iss) => {
|
|
22163
22170
|
var _a3;
|
|
22164
22171
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
22165
|
-
iss.path.unshift(
|
|
22172
|
+
iss.path.unshift(path40);
|
|
22166
22173
|
return iss;
|
|
22167
22174
|
});
|
|
22168
22175
|
}
|
|
@@ -22379,16 +22386,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
22379
22386
|
}
|
|
22380
22387
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
22381
22388
|
const fieldErrors = { _errors: [] };
|
|
22382
|
-
const processError = (error52,
|
|
22389
|
+
const processError = (error52, path40 = []) => {
|
|
22383
22390
|
for (const issue2 of error52.issues) {
|
|
22384
22391
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
22385
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
22392
|
+
issue2.errors.map((issues) => processError({ issues }, [...path40, ...issue2.path]));
|
|
22386
22393
|
} else if (issue2.code === "invalid_key") {
|
|
22387
|
-
processError({ issues: issue2.issues }, [...
|
|
22394
|
+
processError({ issues: issue2.issues }, [...path40, ...issue2.path]);
|
|
22388
22395
|
} else if (issue2.code === "invalid_element") {
|
|
22389
|
-
processError({ issues: issue2.issues }, [...
|
|
22396
|
+
processError({ issues: issue2.issues }, [...path40, ...issue2.path]);
|
|
22390
22397
|
} else {
|
|
22391
|
-
const fullpath = [...
|
|
22398
|
+
const fullpath = [...path40, ...issue2.path];
|
|
22392
22399
|
if (fullpath.length === 0) {
|
|
22393
22400
|
fieldErrors._errors.push(mapper(issue2));
|
|
22394
22401
|
} else {
|
|
@@ -22415,17 +22422,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
22415
22422
|
}
|
|
22416
22423
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
22417
22424
|
const result = { errors: [] };
|
|
22418
|
-
const processError = (error52,
|
|
22425
|
+
const processError = (error52, path40 = []) => {
|
|
22419
22426
|
var _a3, _b;
|
|
22420
22427
|
for (const issue2 of error52.issues) {
|
|
22421
22428
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
22422
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
22429
|
+
issue2.errors.map((issues) => processError({ issues }, [...path40, ...issue2.path]));
|
|
22423
22430
|
} else if (issue2.code === "invalid_key") {
|
|
22424
|
-
processError({ issues: issue2.issues }, [...
|
|
22431
|
+
processError({ issues: issue2.issues }, [...path40, ...issue2.path]);
|
|
22425
22432
|
} else if (issue2.code === "invalid_element") {
|
|
22426
|
-
processError({ issues: issue2.issues }, [...
|
|
22433
|
+
processError({ issues: issue2.issues }, [...path40, ...issue2.path]);
|
|
22427
22434
|
} else {
|
|
22428
|
-
const fullpath = [...
|
|
22435
|
+
const fullpath = [...path40, ...issue2.path];
|
|
22429
22436
|
if (fullpath.length === 0) {
|
|
22430
22437
|
result.errors.push(mapper(issue2));
|
|
22431
22438
|
continue;
|
|
@@ -22457,8 +22464,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
22457
22464
|
}
|
|
22458
22465
|
function toDotPath(_path) {
|
|
22459
22466
|
const segs = [];
|
|
22460
|
-
const
|
|
22461
|
-
for (const seg of
|
|
22467
|
+
const path40 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
22468
|
+
for (const seg of path40) {
|
|
22462
22469
|
if (typeof seg === "number")
|
|
22463
22470
|
segs.push(`[${seg}]`);
|
|
22464
22471
|
else if (typeof seg === "symbol")
|
|
@@ -35888,13 +35895,13 @@ function resolveRef2(ref, ctx) {
|
|
|
35888
35895
|
if (!ref.startsWith("#")) {
|
|
35889
35896
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
35890
35897
|
}
|
|
35891
|
-
const
|
|
35892
|
-
if (
|
|
35898
|
+
const path40 = ref.slice(1).split("/").filter(Boolean);
|
|
35899
|
+
if (path40.length === 0) {
|
|
35893
35900
|
return ctx.rootSchema;
|
|
35894
35901
|
}
|
|
35895
35902
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
35896
|
-
if (
|
|
35897
|
-
const key =
|
|
35903
|
+
if (path40[0] === defsKey) {
|
|
35904
|
+
const key = path40[1];
|
|
35898
35905
|
if (!key || !ctx.defs[key]) {
|
|
35899
35906
|
throw new Error(`Reference not found: ${ref}`);
|
|
35900
35907
|
}
|
|
@@ -36755,7 +36762,7 @@ var init_delivery_report = __esm({
|
|
|
36755
36762
|
var init_webhook_events = __esm({
|
|
36756
36763
|
"../packages/core/dist/service/webhook-events.js"() {
|
|
36757
36764
|
"use strict";
|
|
36758
|
-
|
|
36765
|
+
init_dist2();
|
|
36759
36766
|
init_delivery_report();
|
|
36760
36767
|
init_util2();
|
|
36761
36768
|
}
|
|
@@ -36799,7 +36806,7 @@ var init_requests = __esm({
|
|
|
36799
36806
|
var init_context = __esm({
|
|
36800
36807
|
"../packages/core/dist/service/context.js"() {
|
|
36801
36808
|
"use strict";
|
|
36802
|
-
|
|
36809
|
+
init_dist2();
|
|
36803
36810
|
init_errors2();
|
|
36804
36811
|
}
|
|
36805
36812
|
});
|
|
@@ -36921,7 +36928,7 @@ var init_local_target_mutation_runner = __esm({
|
|
|
36921
36928
|
});
|
|
36922
36929
|
|
|
36923
36930
|
// ../packages/core/dist/service/project-resource-key.js
|
|
36924
|
-
import
|
|
36931
|
+
import path27 from "node:path";
|
|
36925
36932
|
function deriveProjectResourceKey({ resourceKey, label, directoryPath }) {
|
|
36926
36933
|
const explicit = resourceKey?.trim();
|
|
36927
36934
|
if (explicit)
|
|
@@ -36929,7 +36936,7 @@ function deriveProjectResourceKey({ resourceKey, label, directoryPath }) {
|
|
|
36929
36936
|
const labelKey = label?.trim();
|
|
36930
36937
|
if (labelKey)
|
|
36931
36938
|
return slugify(labelKey);
|
|
36932
|
-
return slugify(
|
|
36939
|
+
return slugify(path27.basename(path27.resolve(directoryPath)));
|
|
36933
36940
|
}
|
|
36934
36941
|
var init_project_resource_key = __esm({
|
|
36935
36942
|
"../packages/core/dist/service/project-resource-key.js"() {
|
|
@@ -36939,7 +36946,7 @@ var init_project_resource_key = __esm({
|
|
|
36939
36946
|
});
|
|
36940
36947
|
|
|
36941
36948
|
// src/branch-planning.ts
|
|
36942
|
-
import
|
|
36949
|
+
import path28 from "node:path";
|
|
36943
36950
|
function stripCombiningMarks(value2) {
|
|
36944
36951
|
return value2.normalize("NFKD").replace(/[\u0300-\u036f]/g, "");
|
|
36945
36952
|
}
|
|
@@ -36972,7 +36979,7 @@ function missionWorktreePath({
|
|
|
36972
36979
|
branch
|
|
36973
36980
|
}) {
|
|
36974
36981
|
const key = resourceKey.trim() || "project";
|
|
36975
|
-
return
|
|
36982
|
+
return path28.join(worktreeRoot, projectSlug || "project", key, branchLeaf(branch));
|
|
36976
36983
|
}
|
|
36977
36984
|
function normalizeRemoteRef(ref) {
|
|
36978
36985
|
return ref.replace(/^origin\//, "").replace(/^refs\/heads\//, "").replace(/^refs\/remotes\/origin\//, "");
|
|
@@ -37088,7 +37095,7 @@ var init_branch_planning = __esm({
|
|
|
37088
37095
|
// src/branch-preparation.ts
|
|
37089
37096
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
37090
37097
|
import { existsSync as existsSync25, mkdirSync as mkdirSync11, statSync as statSync6 } from "node:fs";
|
|
37091
|
-
import
|
|
37098
|
+
import path29 from "node:path";
|
|
37092
37099
|
function runGit3(cwd, args, options = {}) {
|
|
37093
37100
|
try {
|
|
37094
37101
|
return execFileSync6("git", args, {
|
|
@@ -37109,7 +37116,7 @@ function lines(value2) {
|
|
|
37109
37116
|
function resolveGitRoot2(workingDirectory) {
|
|
37110
37117
|
const root = runGit3(workingDirectory, ["rev-parse", "--show-toplevel"]);
|
|
37111
37118
|
if (!root) throw new Error(`${workingDirectory} is not inside a git repository.`);
|
|
37112
|
-
return
|
|
37119
|
+
return path29.resolve(root);
|
|
37113
37120
|
}
|
|
37114
37121
|
function repoDefaultBranch(gitRoot) {
|
|
37115
37122
|
const symbolic = runGit3(gitRoot, ["symbolic-ref", "--short", "refs/remotes/origin/HEAD"], {
|
|
@@ -37269,7 +37276,7 @@ function ensureBranchRef(gitRoot, decision) {
|
|
|
37269
37276
|
}
|
|
37270
37277
|
function ensureWorktree(gitRoot, decision) {
|
|
37271
37278
|
ensureBranchRef(gitRoot, decision);
|
|
37272
|
-
mkdirSync11(
|
|
37279
|
+
mkdirSync11(path29.dirname(decision.worktreePath), { recursive: true });
|
|
37273
37280
|
if (existsSync25(decision.worktreePath)) {
|
|
37274
37281
|
if (!statSync6(decision.worktreePath).isDirectory()) {
|
|
37275
37282
|
throw new Error(`Worktree path exists and is not a directory: ${decision.worktreePath}`);
|
|
@@ -37458,7 +37465,7 @@ var PARALLEL_BLOCKING_OBJECTIVE_STATES, DEFAULT_PRIMARY_RESOURCE_KEY;
|
|
|
37458
37465
|
var init_branch_preparation = __esm({
|
|
37459
37466
|
"src/branch-preparation.ts"() {
|
|
37460
37467
|
"use strict";
|
|
37461
|
-
|
|
37468
|
+
init_dist();
|
|
37462
37469
|
init_worktree_git();
|
|
37463
37470
|
init_project_resource_key();
|
|
37464
37471
|
init_branch_planning();
|
|
@@ -37469,7 +37476,7 @@ var init_branch_preparation = __esm({
|
|
|
37469
37476
|
|
|
37470
37477
|
// src/capture-change.ts
|
|
37471
37478
|
import { realpathSync as realpathSync7 } from "node:fs";
|
|
37472
|
-
import
|
|
37479
|
+
import path30 from "node:path";
|
|
37473
37480
|
function exactProjectDirectory(value2) {
|
|
37474
37481
|
if (typeof value2 !== "string") return null;
|
|
37475
37482
|
if (!value2 || value2.length > 4096 || hasControlCharacters(value2)) return null;
|
|
@@ -37482,9 +37489,9 @@ function resolveHookWorkingDirectory({
|
|
|
37482
37489
|
}) {
|
|
37483
37490
|
for (const payloadPath of projectRootPaths ?? []) {
|
|
37484
37491
|
const projectDirectory = exactProjectDirectory(readPath2(payload, payloadPath));
|
|
37485
|
-
if (projectDirectory) return
|
|
37492
|
+
if (projectDirectory) return path30.resolve(projectDirectory);
|
|
37486
37493
|
}
|
|
37487
|
-
return
|
|
37494
|
+
return path30.resolve(fallbackCwd);
|
|
37488
37495
|
}
|
|
37489
37496
|
function withProjectRootFallback({
|
|
37490
37497
|
payload,
|
|
@@ -37505,8 +37512,8 @@ function collectAbsolutePathHints(payload) {
|
|
|
37505
37512
|
const visit = (value2, depth) => {
|
|
37506
37513
|
if (hints.length >= MAX_PATH_HINTS || depth > 4) return;
|
|
37507
37514
|
if (typeof value2 === "string") {
|
|
37508
|
-
if (
|
|
37509
|
-
hints.push(
|
|
37515
|
+
if (path30.isAbsolute(value2) && value2.length <= 4096 && !hasControlCharacters(value2)) {
|
|
37516
|
+
hints.push(path30.resolve(value2));
|
|
37510
37517
|
}
|
|
37511
37518
|
return;
|
|
37512
37519
|
}
|
|
@@ -37523,10 +37530,10 @@ function collectAbsolutePathHints(payload) {
|
|
|
37523
37530
|
return hints;
|
|
37524
37531
|
}
|
|
37525
37532
|
function isLexicallyInside({ parent, child }) {
|
|
37526
|
-
const relative =
|
|
37533
|
+
const relative = path30.relative(path30.normalize(parent), child);
|
|
37527
37534
|
if (relative === "") return true;
|
|
37528
|
-
if (
|
|
37529
|
-
return relative !== ".." && !relative.startsWith(`..${
|
|
37535
|
+
if (path30.isAbsolute(relative)) return false;
|
|
37536
|
+
return relative !== ".." && !relative.startsWith(`..${path30.sep}`);
|
|
37530
37537
|
}
|
|
37531
37538
|
function lexicalProjectRoot({
|
|
37532
37539
|
workingDirectory,
|
|
@@ -37546,7 +37553,7 @@ function lexicalProjectRoot({
|
|
|
37546
37553
|
}
|
|
37547
37554
|
} catch {
|
|
37548
37555
|
}
|
|
37549
|
-
const parent =
|
|
37556
|
+
const parent = path30.dirname(current);
|
|
37550
37557
|
if (parent === current) break;
|
|
37551
37558
|
current = parent;
|
|
37552
37559
|
}
|
|
@@ -37674,7 +37681,7 @@ var init_capture_change = __esm({
|
|
|
37674
37681
|
});
|
|
37675
37682
|
|
|
37676
37683
|
// src/discover-project-local.ts
|
|
37677
|
-
import
|
|
37684
|
+
import path31 from "node:path";
|
|
37678
37685
|
async function resolvePreferredExecutionTargetId({
|
|
37679
37686
|
backend,
|
|
37680
37687
|
workspaceId
|
|
@@ -37693,14 +37700,14 @@ function discoverProjectJsonFromFilesystem({
|
|
|
37693
37700
|
workingDirectory,
|
|
37694
37701
|
preferredExecutionTargetId
|
|
37695
37702
|
}) {
|
|
37696
|
-
let current =
|
|
37703
|
+
let current = path31.resolve(workingDirectory);
|
|
37697
37704
|
while (true) {
|
|
37698
|
-
const projectJsonPath =
|
|
37705
|
+
const projectJsonPath = path31.join(current, ".overlord", "project.json");
|
|
37699
37706
|
const links = readProjectJsonLinks(projectJsonPath, { preferredExecutionTargetId });
|
|
37700
37707
|
if (links.length > 0) {
|
|
37701
37708
|
return { resourcePath: current, links };
|
|
37702
37709
|
}
|
|
37703
|
-
const parent =
|
|
37710
|
+
const parent = path31.dirname(current);
|
|
37704
37711
|
if (parent === current) break;
|
|
37705
37712
|
current = parent;
|
|
37706
37713
|
}
|
|
@@ -37827,7 +37834,7 @@ async function discoverProjectOnClient({
|
|
|
37827
37834
|
const resolvedLocal = localWithTarget ?? local;
|
|
37828
37835
|
if (!resolvedLocal) {
|
|
37829
37836
|
throw new CliError({
|
|
37830
|
-
message: `No linked Overlord project found for ${
|
|
37837
|
+
message: `No linked Overlord project found for ${path31.resolve(workingDirectory)}. Run \`ovld add-cwd\` or \`ovld create-project\`.`
|
|
37831
37838
|
});
|
|
37832
37839
|
}
|
|
37833
37840
|
const selectedLink = selectPrimaryProjectLink(resolvedLocal.links);
|
|
@@ -37847,7 +37854,7 @@ async function discoverProjectOnClient({
|
|
|
37847
37854
|
}
|
|
37848
37855
|
if (!chosenProject || !chosenLink) {
|
|
37849
37856
|
throw new CliError({
|
|
37850
|
-
message: `No linked Overlord project found for ${
|
|
37857
|
+
message: `No linked Overlord project found for ${path31.resolve(workingDirectory)}. Run \`ovld add-cwd\` or \`ovld create-project\`.`
|
|
37851
37858
|
});
|
|
37852
37859
|
}
|
|
37853
37860
|
const accessible = resolvedLocal.links.length > 1 ? await listAccessibleProjects({ backend }) : [chosenProject];
|
|
@@ -37876,9 +37883,9 @@ var init_discover_project_local = __esm({
|
|
|
37876
37883
|
});
|
|
37877
37884
|
|
|
37878
37885
|
// src/latch-discovery.ts
|
|
37879
|
-
import
|
|
37886
|
+
import path32 from "node:path";
|
|
37880
37887
|
function latchDiscoveryCachePath(dataDir = resolveGlobalDataDir()) {
|
|
37881
|
-
return
|
|
37888
|
+
return path32.join(dataDir, LATCH_DISCOVERY_CACHE_FILENAME);
|
|
37882
37889
|
}
|
|
37883
37890
|
function discoverLatchOnThisDevice({
|
|
37884
37891
|
executionTargetId,
|
|
@@ -38043,10 +38050,10 @@ function primaryResourcePath(projectResources) {
|
|
|
38043
38050
|
for (const entry of projectResources) {
|
|
38044
38051
|
if (!entry || typeof entry !== "object") continue;
|
|
38045
38052
|
const record2 = entry;
|
|
38046
|
-
const
|
|
38047
|
-
if (!
|
|
38048
|
-
if (record2.isPrimary === true) return
|
|
38049
|
-
if (record2.isCurrent === true && !currentPath) currentPath =
|
|
38053
|
+
const path40 = typeof record2.path === "string" ? record2.path.trim() : "";
|
|
38054
|
+
if (!path40) continue;
|
|
38055
|
+
if (record2.isPrimary === true) return path40;
|
|
38056
|
+
if (record2.isCurrent === true && !currentPath) currentPath = path40;
|
|
38050
38057
|
}
|
|
38051
38058
|
return currentPath;
|
|
38052
38059
|
}
|
|
@@ -38083,7 +38090,7 @@ var PLACEHOLDER_PATTERN;
|
|
|
38083
38090
|
var init_pre_launch = __esm({
|
|
38084
38091
|
"src/pre-launch.ts"() {
|
|
38085
38092
|
"use strict";
|
|
38086
|
-
|
|
38093
|
+
init_dist();
|
|
38087
38094
|
PLACEHOLDER_PATTERN = /\{([A-Z0-9_]+)\}/g;
|
|
38088
38095
|
}
|
|
38089
38096
|
});
|
|
@@ -38423,7 +38430,7 @@ var init_terminal_launcher = __esm({
|
|
|
38423
38430
|
// src/launch.ts
|
|
38424
38431
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
38425
38432
|
import { chmodSync as chmodSync5, mkdirSync as mkdirSync12, writeFileSync as writeFileSync10 } from "node:fs";
|
|
38426
|
-
import
|
|
38433
|
+
import path33 from "node:path";
|
|
38427
38434
|
function interactiveLoginShellInvocation(command, configuredShell = process.env.SHELL) {
|
|
38428
38435
|
const shell = configuredShell?.trim() || "/bin/bash";
|
|
38429
38436
|
return { command: shell, args: ["-ilc", command] };
|
|
@@ -38554,7 +38561,7 @@ async function loadMissionContext({
|
|
|
38554
38561
|
const url2 = storageKey ? `${runtime.backend.baseUrl}/api/storage/attachments/${encodeURIComponent(storageKey)}` : null;
|
|
38555
38562
|
attachmentLines.push(`- [${label}] ${filename}${contentType}${url2 ? ` \u2014 ${url2}` : ""}`);
|
|
38556
38563
|
if (attachmentId) {
|
|
38557
|
-
const output = `./.overlord/tmp/attachment-${attachmentId}-${
|
|
38564
|
+
const output = `./.overlord/tmp/attachment-${attachmentId}-${path33.basename(filename)}`;
|
|
38558
38565
|
attachmentLines.push(
|
|
38559
38566
|
` Download: \`ovld protocol attachment-download-url --objective-id ${shellQuote2(label)} --attachment-id ${shellQuote2(attachmentId)} --output ${shellQuote2(output)}\``
|
|
38560
38567
|
);
|
|
@@ -38669,7 +38676,7 @@ function launchScriptPath({
|
|
|
38669
38676
|
executionRequestId
|
|
38670
38677
|
}) {
|
|
38671
38678
|
const requestPart = executionRequestId ? safeLaunchScriptPart(executionRequestId) : `${process.pid}`;
|
|
38672
|
-
return
|
|
38679
|
+
return path33.join(tmpDir, `launch-${safeLaunchScriptPart(displayId)}-${requestPart}.sh`);
|
|
38673
38680
|
}
|
|
38674
38681
|
async function buildLaunchPlan({
|
|
38675
38682
|
runtime,
|
|
@@ -38683,8 +38690,8 @@ async function buildLaunchPlan({
|
|
|
38683
38690
|
pruneStaleProjectTmp({ workingDirectory: options.workingDirectory, create: true });
|
|
38684
38691
|
const tmpDir = ensureProjectTmpDir(options.workingDirectory);
|
|
38685
38692
|
const contextFileStem = context.objectiveDisplayId ? `objective-${context.objectiveDisplayId.replace(/[^a-zA-Z0-9_-]/g, "-")}` : `mission-${context.displayId.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
38686
|
-
const contextFile =
|
|
38687
|
-
const sessionScratchDir =
|
|
38693
|
+
const contextFile = path33.join(tmpDir, `${contextFileStem}.md`);
|
|
38694
|
+
const sessionScratchDir = path33.join(
|
|
38688
38695
|
projectTmpSessionsDir(options.workingDirectory),
|
|
38689
38696
|
sessionScratchName({
|
|
38690
38697
|
missionDisplayId: context.displayId,
|
|
@@ -38951,7 +38958,7 @@ var AGENT_HISTORY_EXCLUDED_EVENT_TYPES, EXECUTION_DIRECTIVE;
|
|
|
38951
38958
|
var init_launch = __esm({
|
|
38952
38959
|
"src/launch.ts"() {
|
|
38953
38960
|
"use strict";
|
|
38954
|
-
|
|
38961
|
+
init_dist();
|
|
38955
38962
|
init_latch_launch();
|
|
38956
38963
|
init_channel();
|
|
38957
38964
|
init_agent_binaries();
|
|
@@ -38971,7 +38978,7 @@ var init_launch = __esm({
|
|
|
38971
38978
|
|
|
38972
38979
|
// src/launch-bootstrap.ts
|
|
38973
38980
|
import { existsSync as existsSync26, readdirSync as readdirSync5, readFileSync as readFileSync17, statSync as statSync7 } from "node:fs";
|
|
38974
|
-
import
|
|
38981
|
+
import path34 from "node:path";
|
|
38975
38982
|
function firstCapture(match) {
|
|
38976
38983
|
if (!match) return null;
|
|
38977
38984
|
const value2 = match[1] ?? match[2] ?? match[3] ?? null;
|
|
@@ -38999,7 +39006,7 @@ function recoverLaunchBootstrapFromProjectTmp({
|
|
|
38999
39006
|
try {
|
|
39000
39007
|
for (const name of readdirSync5(tmpDir)) {
|
|
39001
39008
|
if (!name.startsWith(prefix) || !name.endsWith(".sh")) continue;
|
|
39002
|
-
const filePath =
|
|
39009
|
+
const filePath = path34.join(tmpDir, name);
|
|
39003
39010
|
try {
|
|
39004
39011
|
const mtimeMs = statSync7(filePath).mtimeMs;
|
|
39005
39012
|
if (!newest || mtimeMs > newest.mtimeMs) {
|
|
@@ -39038,8 +39045,8 @@ var init_launch_bootstrap = __esm({
|
|
|
39038
39045
|
|
|
39039
39046
|
// src/org-setup.ts
|
|
39040
39047
|
import { readFileSync as readFileSync18 } from "node:fs";
|
|
39041
|
-
import
|
|
39042
|
-
import { createInterface
|
|
39048
|
+
import path35 from "node:path";
|
|
39049
|
+
import { createInterface } from "node:readline";
|
|
39043
39050
|
function suggestSlug(name) {
|
|
39044
39051
|
const cleaned = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
39045
39052
|
return cleaned.slice(0, 3) || "org";
|
|
@@ -39048,7 +39055,7 @@ function promptText({
|
|
|
39048
39055
|
question,
|
|
39049
39056
|
defaultValue
|
|
39050
39057
|
}) {
|
|
39051
|
-
const rl =
|
|
39058
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
39052
39059
|
const suffix = defaultValue ? ` [${defaultValue}]` : "";
|
|
39053
39060
|
return new Promise((resolve) => {
|
|
39054
39061
|
rl.question(`${question}${suffix}: `, (answer) => {
|
|
@@ -39117,12 +39124,12 @@ async function runOrgSetupCommand({
|
|
|
39117
39124
|
let logoWarning = null;
|
|
39118
39125
|
if (logoPath) {
|
|
39119
39126
|
try {
|
|
39120
|
-
const resolvedPath =
|
|
39127
|
+
const resolvedPath = path35.resolve(logoPath);
|
|
39121
39128
|
const bytes = readFileSync18(resolvedPath);
|
|
39122
39129
|
const stored = await runtime.backend.postRaw({
|
|
39123
39130
|
path: "/api/uploads/organization-images",
|
|
39124
39131
|
body: bytes,
|
|
39125
|
-
filename:
|
|
39132
|
+
filename: path35.basename(resolvedPath)
|
|
39126
39133
|
});
|
|
39127
39134
|
await runtime.backend.patch({
|
|
39128
39135
|
path: `/api/organizations/${encodeURIComponent(organization.id)}`,
|
|
@@ -39219,7 +39226,7 @@ Subcommands:
|
|
|
39219
39226
|
statuses List one project's ordered board columns
|
|
39220
39227
|
discuss-objective Mark a draft objective as submitted (does not start execution)
|
|
39221
39228
|
add-objectives Append ordered objectives to an existing mission
|
|
39222
|
-
update-objective Set auto-advance and/or instruction text on an objective
|
|
39229
|
+
update-objective Set title, auto-advance, and/or instruction text on an objective
|
|
39223
39230
|
delete-missions Confirmed bulk soft-delete of missions
|
|
39224
39231
|
delete-objectives Confirmed bulk soft-delete of objectives
|
|
39225
39232
|
create Create a draft mission without attaching
|
|
@@ -39367,6 +39374,9 @@ load-context:
|
|
|
39367
39374
|
--objective-id <id> Return this objective as the current one instead of
|
|
39368
39375
|
rediscovering the mission's active objective. Required
|
|
39369
39376
|
on a mission running objectives in parallel.
|
|
39377
|
+
Returns:
|
|
39378
|
+
Objective context includes assignedAgent, model, reasoningEffort, and resourceKey
|
|
39379
|
+
so an agent can confirm the selected agent, model/thinking level, and resource.
|
|
39370
39380
|
|
|
39371
39381
|
list-deliveries:
|
|
39372
39382
|
Purpose:
|
|
@@ -39650,17 +39660,22 @@ add-objectives:
|
|
|
39650
39660
|
|
|
39651
39661
|
update-objective:
|
|
39652
39662
|
Purpose:
|
|
39653
|
-
|
|
39663
|
+
Rewrite an objective title, queue or dequeue compatibility auto-advance,
|
|
39664
|
+
and/or edit instruction text on an existing objective.
|
|
39654
39665
|
Required:
|
|
39655
39666
|
--objective-id <id>
|
|
39656
39667
|
At least one of:
|
|
39668
|
+
--title <text>
|
|
39657
39669
|
--auto-advance or --no-auto-advance
|
|
39658
39670
|
--instruction-text <text> or --instruction-text-file <path|->
|
|
39659
39671
|
Rules:
|
|
39672
|
+
Title edits are allowed in any objective state. An empty title clears the
|
|
39673
|
+
custom title and restores instruction-derived presentation.
|
|
39660
39674
|
Instruction text may be edited only when the objective is in draft or future state.
|
|
39661
39675
|
Blank instruction text is allowed in those states.
|
|
39662
39676
|
Returns:
|
|
39663
|
-
The updated objective JSON
|
|
39677
|
+
The updated objective JSON, including assignedAgent, model, reasoningEffort,
|
|
39678
|
+
and resourceKey. autoAdvance is deprecated and derived from live queueEntry membership.
|
|
39664
39679
|
|
|
39665
39680
|
delete-missions:
|
|
39666
39681
|
Purpose:
|
|
@@ -40167,13 +40182,13 @@ var init_resource_observations = __esm({
|
|
|
40167
40182
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
40168
40183
|
import { existsSync as existsSync27, mkdirSync as mkdirSync13, readFileSync as readFileSync19, writeFileSync as writeFileSync11 } from "node:fs";
|
|
40169
40184
|
import { hostname as hostname6 } from "node:os";
|
|
40170
|
-
import
|
|
40185
|
+
import path36 from "node:path";
|
|
40171
40186
|
function envValue(name) {
|
|
40172
40187
|
const value2 = process.env[name]?.trim();
|
|
40173
40188
|
return value2 && value2.length > 0 ? value2 : null;
|
|
40174
40189
|
}
|
|
40175
40190
|
function runnerInstanceStatePath(dataDir = resolveGlobalDataDir()) {
|
|
40176
|
-
return
|
|
40191
|
+
return path36.join(dataDir, RUNNER_INSTANCE_STATE_FILENAME);
|
|
40177
40192
|
}
|
|
40178
40193
|
function resolveRunnerInstanceId(dataDir = resolveGlobalDataDir()) {
|
|
40179
40194
|
const pinned = envValue("OVERLORD_RUNNER_INSTANCE_ID");
|
|
@@ -40190,7 +40205,7 @@ function resolveRunnerInstanceId(dataDir = resolveGlobalDataDir()) {
|
|
|
40190
40205
|
}
|
|
40191
40206
|
const runnerInstanceId = randomUUID3();
|
|
40192
40207
|
try {
|
|
40193
|
-
mkdirSync13(
|
|
40208
|
+
mkdirSync13(path36.dirname(statePath), { recursive: true });
|
|
40194
40209
|
writeFileSync11(statePath, `${JSON.stringify({ runnerInstanceId }, null, 2)}
|
|
40195
40210
|
`, { mode: 384 });
|
|
40196
40211
|
} catch {
|
|
@@ -40242,15 +40257,15 @@ import {
|
|
|
40242
40257
|
statSync as statSync8,
|
|
40243
40258
|
writeFileSync as writeFileSync12
|
|
40244
40259
|
} from "node:fs";
|
|
40245
|
-
import
|
|
40246
|
-
import
|
|
40260
|
+
import os7 from "node:os";
|
|
40261
|
+
import path37 from "node:path";
|
|
40247
40262
|
import { promisify } from "node:util";
|
|
40248
40263
|
function writeServiceFile(filePath, contents) {
|
|
40249
40264
|
writeFileSync12(filePath, contents, { mode: 384 });
|
|
40250
40265
|
chmodSync6(filePath, 384);
|
|
40251
40266
|
}
|
|
40252
40267
|
function resolveRunnerEntryScript(argv = process.argv) {
|
|
40253
|
-
return argv[1] ?
|
|
40268
|
+
return argv[1] ? path37.resolve(argv[1]) : null;
|
|
40254
40269
|
}
|
|
40255
40270
|
function readRunnerExecutableFileIdentity(filePath, stat = statSync8) {
|
|
40256
40271
|
try {
|
|
@@ -40297,7 +40312,7 @@ function emptyRunnerServiceState() {
|
|
|
40297
40312
|
};
|
|
40298
40313
|
}
|
|
40299
40314
|
function runnerServiceStatePath(dataDir = resolveGlobalDataDir()) {
|
|
40300
|
-
return
|
|
40315
|
+
return path37.join(dataDir, RUNNER_SERVICE_STATE_FILENAME);
|
|
40301
40316
|
}
|
|
40302
40317
|
function readRunnerServiceState(dataDir = resolveGlobalDataDir()) {
|
|
40303
40318
|
const filePath = runnerServiceStatePath(dataDir);
|
|
@@ -40325,17 +40340,17 @@ function applyPollJitter(intervalMs, random = Math.random) {
|
|
|
40325
40340
|
}
|
|
40326
40341
|
function resolveOverlordAppInvocation({
|
|
40327
40342
|
platform: platform2 = process.platform,
|
|
40328
|
-
homedir: homedir2 =
|
|
40343
|
+
homedir: homedir2 = os7.homedir(),
|
|
40329
40344
|
exists = existsSync28
|
|
40330
40345
|
} = {}) {
|
|
40331
40346
|
if (platform2 !== "darwin") return null;
|
|
40332
40347
|
const appDirs = [
|
|
40333
40348
|
"/Applications/Overlord.app",
|
|
40334
|
-
|
|
40349
|
+
path37.join(homedir2, "Applications", "Overlord.app")
|
|
40335
40350
|
];
|
|
40336
40351
|
for (const appDir of appDirs) {
|
|
40337
|
-
const program =
|
|
40338
|
-
const script =
|
|
40352
|
+
const program = path37.join(appDir, "Contents", "MacOS", "Overlord");
|
|
40353
|
+
const script = path37.join(appDir, "Contents", "Resources", "cli", "bin", "ovld.mjs");
|
|
40339
40354
|
if (exists(program) && exists(script)) {
|
|
40340
40355
|
return { program, args: [script, "runner", "supervise"], runAsElectronNode: true };
|
|
40341
40356
|
}
|
|
@@ -40347,7 +40362,7 @@ function resolveOvldInvocation(argv = process.argv, execPath = process.execPath)
|
|
|
40347
40362
|
if (override) {
|
|
40348
40363
|
return { program: override, args: ["runner", "supervise"] };
|
|
40349
40364
|
}
|
|
40350
|
-
const scriptPath = argv[1] ?
|
|
40365
|
+
const scriptPath = argv[1] ? path37.resolve(argv[1]) : "";
|
|
40351
40366
|
if (process.env.ELECTRON_RUN_AS_NODE) {
|
|
40352
40367
|
return scriptPath ? { program: execPath, args: [scriptPath, "runner", "supervise"], runAsElectronNode: true } : { program: execPath, args: ["runner", "supervise"], runAsElectronNode: true };
|
|
40353
40368
|
}
|
|
@@ -40359,9 +40374,9 @@ function resolveOvldInvocation(argv = process.argv, execPath = process.execPath)
|
|
|
40359
40374
|
return { program: execPath, args: ["runner", "supervise"] };
|
|
40360
40375
|
}
|
|
40361
40376
|
function composeRunnerServicePath({
|
|
40362
|
-
homeDir =
|
|
40377
|
+
homeDir = os7.homedir()
|
|
40363
40378
|
} = {}) {
|
|
40364
|
-
const localBin =
|
|
40379
|
+
const localBin = path37.join(homeDir, ".local", "bin");
|
|
40365
40380
|
const dirs = [...RUNNER_SERVICE_PATH_PREFIX_DIRS, localBin, ...RUNNER_SERVICE_SYSTEM_PATH_DIRS];
|
|
40366
40381
|
return [...new Set(dirs)].join(":");
|
|
40367
40382
|
}
|
|
@@ -40389,7 +40404,7 @@ function runnerServiceReinstallHint({
|
|
|
40389
40404
|
installed,
|
|
40390
40405
|
publisher,
|
|
40391
40406
|
processType,
|
|
40392
|
-
path:
|
|
40407
|
+
path: path40
|
|
40393
40408
|
}) {
|
|
40394
40409
|
if (!installed) return null;
|
|
40395
40410
|
const hints = [];
|
|
@@ -40403,7 +40418,7 @@ function runnerServiceReinstallHint({
|
|
|
40403
40418
|
`This LaunchAgent is ProcessType=${processType}. App auto-update respawns the supervisor but does not rewrite ProcessType, so Apple Events to Terminal/iTerm stay App-Napped. Reinstall with \`ovld runner service install\` (or Desktop \u2192 Reinstall service) to switch to ${LAUNCHD_PROCESS_TYPE}.`
|
|
40404
40419
|
);
|
|
40405
40420
|
}
|
|
40406
|
-
if (
|
|
40421
|
+
if (path40 !== void 0 && path40 !== composeRunnerServicePath()) {
|
|
40407
40422
|
hints.push(
|
|
40408
40423
|
"This LaunchAgent PATH is not the deterministic prefix (`/opt/homebrew/bin:/usr/local/bin:$HOME/.local/bin` plus system dirs). App auto-update respawns the supervisor but does not rewrite PATH, so Latch/`open`/agent binaries spawned by the service may be missing. Reinstall with `ovld runner service install` (or Desktop \u2192 Reinstall service) to apply it."
|
|
40409
40424
|
);
|
|
@@ -40421,7 +40436,7 @@ function buildRunnerServiceEnv({
|
|
|
40421
40436
|
};
|
|
40422
40437
|
if (!isLoopbackBackendUrl(backendUrl)) env.OVERLORD_BACKEND_URL = backendUrl;
|
|
40423
40438
|
const home = overlordHome?.trim() || process.env.OVLD_HOME?.trim();
|
|
40424
|
-
if (home) env.OVLD_HOME =
|
|
40439
|
+
if (home) env.OVLD_HOME = path37.resolve(home);
|
|
40425
40440
|
const token = process.env.OVERLORD_USER_TOKEN?.trim() || process.env.OVLD_USER_TOKEN?.trim();
|
|
40426
40441
|
if (token) env.OVERLORD_USER_TOKEN = token;
|
|
40427
40442
|
if (runAsElectronNode || process.env.ELECTRON_RUN_AS_NODE) env.ELECTRON_RUN_AS_NODE = "1";
|
|
@@ -40460,9 +40475,9 @@ ${envEntries}
|
|
|
40460
40475
|
<key>KeepAlive</key>
|
|
40461
40476
|
<true/>
|
|
40462
40477
|
<key>StandardOutPath</key>
|
|
40463
|
-
<string>${xmlEscape(
|
|
40478
|
+
<string>${xmlEscape(path37.join(logDir, "runner-service.out.log"))}</string>
|
|
40464
40479
|
<key>StandardErrorPath</key>
|
|
40465
|
-
<string>${xmlEscape(
|
|
40480
|
+
<string>${xmlEscape(path37.join(logDir, "runner-service.err.log"))}</string>
|
|
40466
40481
|
<key>ProcessType</key>
|
|
40467
40482
|
<string>${LAUNCHD_PROCESS_TYPE}</string>
|
|
40468
40483
|
</dict>
|
|
@@ -40493,12 +40508,12 @@ WantedBy=default.target
|
|
|
40493
40508
|
`;
|
|
40494
40509
|
}
|
|
40495
40510
|
function launchAgentsDir() {
|
|
40496
|
-
return
|
|
40511
|
+
return path37.join(os7.homedir(), "Library", "LaunchAgents");
|
|
40497
40512
|
}
|
|
40498
40513
|
function systemdUserDir() {
|
|
40499
40514
|
const xdg = process.env.XDG_CONFIG_HOME?.trim();
|
|
40500
|
-
const base = xdg ?
|
|
40501
|
-
return
|
|
40515
|
+
const base = xdg ? path37.resolve(xdg) : path37.join(os7.homedir(), ".config");
|
|
40516
|
+
return path37.join(base, "systemd", "user");
|
|
40502
40517
|
}
|
|
40503
40518
|
async function runCommand(program, args) {
|
|
40504
40519
|
const { stdout } = await execFileAsync(program, args);
|
|
@@ -40550,7 +40565,7 @@ var init_runner_service = __esm({
|
|
|
40550
40565
|
this.exec = exec ?? ((args) => runCommand("launchctl", args));
|
|
40551
40566
|
}
|
|
40552
40567
|
unitPath() {
|
|
40553
|
-
return
|
|
40568
|
+
return path37.join(launchAgentsDir(), `${LAUNCHD_LABEL}.plist`);
|
|
40554
40569
|
}
|
|
40555
40570
|
uid() {
|
|
40556
40571
|
return process.getuid?.() ?? "";
|
|
@@ -40578,12 +40593,12 @@ var init_runner_service = __esm({
|
|
|
40578
40593
|
label: LAUNCHD_LABEL,
|
|
40579
40594
|
invocation: opts.invocation,
|
|
40580
40595
|
env: opts.env,
|
|
40581
|
-
logDir:
|
|
40596
|
+
logDir: path37.join(resolveGlobalDataDir(), "logs")
|
|
40582
40597
|
});
|
|
40583
40598
|
}
|
|
40584
40599
|
async install(opts) {
|
|
40585
40600
|
mkdirSync14(launchAgentsDir(), { recursive: true });
|
|
40586
|
-
mkdirSync14(
|
|
40601
|
+
mkdirSync14(path37.join(resolveGlobalDataDir(), "logs"), { recursive: true });
|
|
40587
40602
|
await this.runSteps(planLaunchdUnloadCommands({ uid: this.uid() }));
|
|
40588
40603
|
writeServiceFile(this.unitPath(), this.render(opts));
|
|
40589
40604
|
if (opts.autoStart) await this.start();
|
|
@@ -40624,7 +40639,7 @@ var init_runner_service = __esm({
|
|
|
40624
40639
|
kind = "systemd";
|
|
40625
40640
|
identifier = `${SYSTEMD_UNIT_NAME}.service`;
|
|
40626
40641
|
unitPath() {
|
|
40627
|
-
return
|
|
40642
|
+
return path37.join(systemdUserDir(), `${SYSTEMD_UNIT_NAME}.service`);
|
|
40628
40643
|
}
|
|
40629
40644
|
render(opts) {
|
|
40630
40645
|
return renderSystemdUnit(opts);
|
|
@@ -40671,7 +40686,7 @@ var init_runner_service = __esm({
|
|
|
40671
40686
|
});
|
|
40672
40687
|
|
|
40673
40688
|
// src/select-prompt.ts
|
|
40674
|
-
import { createInterface as
|
|
40689
|
+
import { createInterface as createInterface2 } from "node:readline";
|
|
40675
40690
|
function parseNumberedSelection(answer, count) {
|
|
40676
40691
|
const trimmed7 = answer.trim();
|
|
40677
40692
|
if (!/^\d+$/.test(trimmed7)) return null;
|
|
@@ -40697,7 +40712,7 @@ function promptForProject({
|
|
|
40697
40712
|
new Error("No projects available. Create one with `ovld create-project`.")
|
|
40698
40713
|
);
|
|
40699
40714
|
}
|
|
40700
|
-
const rl =
|
|
40715
|
+
const rl = createInterface2({ input, output });
|
|
40701
40716
|
const ask = (question) => new Promise((resolve) => rl.question(question, resolve));
|
|
40702
40717
|
const run = async () => {
|
|
40703
40718
|
while (true) {
|
|
@@ -40726,7 +40741,7 @@ var init_select_prompt = __esm({
|
|
|
40726
40741
|
// src/session-key.ts
|
|
40727
40742
|
import { createHash as createHash10 } from "node:crypto";
|
|
40728
40743
|
import { existsSync as existsSync29, opendirSync, rmSync as rmSync6 } from "node:fs";
|
|
40729
|
-
import
|
|
40744
|
+
import path38 from "node:path";
|
|
40730
40745
|
function sessionKeyCachePath({
|
|
40731
40746
|
missionId,
|
|
40732
40747
|
workingDirectory,
|
|
@@ -40735,7 +40750,7 @@ function sessionKeyCachePath({
|
|
|
40735
40750
|
const resolved = canonicalDirectory(workingDirectory);
|
|
40736
40751
|
const material = `${resolved}\0${missionId}\0${objectiveId.trim()}`;
|
|
40737
40752
|
const key = createHash10("sha256").update(material).digest("hex");
|
|
40738
|
-
return
|
|
40753
|
+
return path38.join(resolveGlobalDataDir(), "protocol-session-keys", key);
|
|
40739
40754
|
}
|
|
40740
40755
|
function readSessionKeyFile(filePath) {
|
|
40741
40756
|
try {
|
|
@@ -40760,7 +40775,7 @@ function writeSessionKeyFile({
|
|
|
40760
40775
|
filePath,
|
|
40761
40776
|
sessionKey
|
|
40762
40777
|
}) {
|
|
40763
|
-
ensureOwnerOnlyDirectory(
|
|
40778
|
+
ensureOwnerOnlyDirectory(path38.dirname(filePath));
|
|
40764
40779
|
const contents = JSON.stringify({ sessionKey, updatedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
40765
40780
|
if (Buffer.byteLength(contents, "utf8") > MAX_SESSION_KEY_CACHE_FILE_BYTES) return;
|
|
40766
40781
|
writeOwnerOnlyFileAtomically(filePath, contents);
|
|
@@ -40791,7 +40806,7 @@ function clearCachedSessionKey({
|
|
|
40791
40806
|
const files = /* @__PURE__ */ new Set();
|
|
40792
40807
|
const trimmedSessionKey = sessionKey?.trim();
|
|
40793
40808
|
if (trimmedSessionKey) {
|
|
40794
|
-
const cacheDir =
|
|
40809
|
+
const cacheDir = path38.join(resolveGlobalDataDir(), "protocol-session-keys");
|
|
40795
40810
|
if (existsSync29(cacheDir)) {
|
|
40796
40811
|
const directory = opendirSync(cacheDir);
|
|
40797
40812
|
let scanned = 0;
|
|
@@ -40806,7 +40821,7 @@ function clearCachedSessionKey({
|
|
|
40806
40821
|
}
|
|
40807
40822
|
scanned += 1;
|
|
40808
40823
|
if (!entry.isFile() || !/^[a-f0-9]{64}$/.test(entry.name)) continue;
|
|
40809
|
-
const filePath =
|
|
40824
|
+
const filePath = path38.join(cacheDir, entry.name);
|
|
40810
40825
|
if (readSessionKeyFile(filePath) === trimmedSessionKey) files.add(filePath);
|
|
40811
40826
|
}
|
|
40812
40827
|
} finally {
|
|
@@ -40856,7 +40871,7 @@ __export(commands_exports, {
|
|
|
40856
40871
|
shouldRefuseInlineRunnerLaunch: () => shouldRefuseInlineRunnerLaunch
|
|
40857
40872
|
});
|
|
40858
40873
|
import { readFileSync as readFileSync21, writeFileSync as writeFileSync13 } from "node:fs";
|
|
40859
|
-
import
|
|
40874
|
+
import path39 from "node:path";
|
|
40860
40875
|
function resourceAccessModeBody(value2) {
|
|
40861
40876
|
if (typeof value2 !== "string") return {};
|
|
40862
40877
|
const normalized = value2.trim().toLowerCase();
|
|
@@ -40948,7 +40963,7 @@ function deliveredBriefingPath({
|
|
|
40948
40963
|
const displayId = objectiveAliases.find((alias) => OBJECTIVE_DISPLAY_ID_RE.test(alias.trim()));
|
|
40949
40964
|
const stem = displayId ? `objective-${safeTmpNamePart(displayId.trim())}` : missionId.includes(":") && !missionId.includes(".") ? `mission-${safeTmpNamePart(missionId.trim())}` : null;
|
|
40950
40965
|
if (!stem) return null;
|
|
40951
|
-
const candidate =
|
|
40966
|
+
const candidate = path39.join(projectTmpDir(workingDirectory), `${stem}.md`);
|
|
40952
40967
|
return isSessionScratchDir(workingDirectory, candidate) ? null : candidate;
|
|
40953
40968
|
}
|
|
40954
40969
|
async function syncObjectiveLedger({
|
|
@@ -41738,7 +41753,7 @@ async function runManagementCommand({
|
|
|
41738
41753
|
}
|
|
41739
41754
|
case "add-cwd": {
|
|
41740
41755
|
const directory = flagValue(parsed.flags, "--directory") ?? process.cwd();
|
|
41741
|
-
const existingLinks = readProjectJsonLinks(
|
|
41756
|
+
const existingLinks = readProjectJsonLinks(path39.join(directory, ".overlord", "project.json"));
|
|
41742
41757
|
let projectId = flagValue(parsed.flags, "--project-id");
|
|
41743
41758
|
if (!projectId) {
|
|
41744
41759
|
const allProjects = await listAccessibleProjects({ backend: runtime.backend });
|
|
@@ -42221,13 +42236,13 @@ async function runManagementCommand({
|
|
|
42221
42236
|
rationales: `/api/missions/${encodeURIComponent(missionId)}/file-changes`,
|
|
42222
42237
|
deliveries: `/api/missions/${encodeURIComponent(missionId)}/deliveries`
|
|
42223
42238
|
};
|
|
42224
|
-
const
|
|
42225
|
-
if (!
|
|
42239
|
+
const path40 = sub ? pathBySub[sub] : void 0;
|
|
42240
|
+
if (!path40) {
|
|
42226
42241
|
throw new CliError({
|
|
42227
42242
|
message: "Usage: ovld mission context|events|deliveries|artifacts|rationales <missionId> [--json]"
|
|
42228
42243
|
});
|
|
42229
42244
|
}
|
|
42230
|
-
const result = await runtime.backend.get(
|
|
42245
|
+
const result = await runtime.backend.get(path40);
|
|
42231
42246
|
if (json2 || sub === "context") printJson(result);
|
|
42232
42247
|
else {
|
|
42233
42248
|
const items = missionEvidenceItems(result);
|
|
@@ -42692,7 +42707,7 @@ var SYNC_CHANGE_EVIDENCE_KEYS, OBJECTIVE_DISPLAY_ID_RE, PROTOCOL_FILE_FLAGS, SES
|
|
|
42692
42707
|
var init_commands = __esm({
|
|
42693
42708
|
"src/commands.ts"() {
|
|
42694
42709
|
"use strict";
|
|
42695
|
-
|
|
42710
|
+
init_dist();
|
|
42696
42711
|
init_project_metadata();
|
|
42697
42712
|
init_local_target_mutation_runner();
|
|
42698
42713
|
init_terminal_profile_types2();
|