@miraland-labs/conduit-bridge 0.16.15 → 0.16.16

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/checkout.js CHANGED
@@ -34,6 +34,18 @@ async function gitOriginUrl(workspace, exec) {
34
34
  return null;
35
35
  }
36
36
  }
37
+ /** A control-plane repository fingerprint needs a transport before Git can clone it. */
38
+ function cloneRepositoryUrl(repositoryUrl) {
39
+ const value = repositoryUrl.trim();
40
+ const slash = value.indexOf("/");
41
+ if (slash <= 0 || value.startsWith(".") || value.includes("\\") || /^[^/@\s]+@[^:]+:/.test(value))
42
+ return value;
43
+ const host = value.slice(0, slash);
44
+ const path = value.slice(slash + 1);
45
+ if (!host.includes(".") || /\s/.test(value) || path.split("/").filter(Boolean).length < 2)
46
+ return value;
47
+ return `https://${value}`;
48
+ }
37
49
  /**
38
50
  * Ensure `workspace` is a checkout of `repositoryUrl`.
39
51
  *
@@ -49,11 +61,12 @@ export async function ensureCheckout(workspace, repositoryUrl, deps = {}) {
49
61
  const wanted = normalizeRepositoryUrl(repositoryUrl);
50
62
  if (!wanted)
51
63
  throw new Error("ensure_checkout_invalid_url");
64
+ const cloneUrl = cloneRepositoryUrl(repositoryUrl);
52
65
  const exists = await pathExists(workspace, accessFn);
53
66
  if (!exists) {
54
67
  await mkdirFn(dirname(workspace), { recursive: true });
55
68
  try {
56
- await exec("git", ["clone", "--", repositoryUrl, workspace], {
69
+ await exec("git", ["clone", "--", cloneUrl, workspace], {
57
70
  timeout: 300_000,
58
71
  maxBuffer: 2_000_000,
59
72
  });
@@ -73,7 +86,7 @@ export async function ensureCheckout(workspace, repositoryUrl, deps = {}) {
73
86
  throw new Error("ensure_checkout_path_unreadable");
74
87
  if (entries.length === 0) {
75
88
  try {
76
- await exec("git", ["clone", "--", repositoryUrl, workspace], {
89
+ await exec("git", ["clone", "--", cloneUrl, workspace], {
77
90
  timeout: 300_000,
78
91
  maxBuffer: 2_000_000,
79
92
  });
package/dist/execution.js CHANGED
@@ -243,6 +243,7 @@ const taskDetailSchema = z.object({
243
243
  execution_mode: z.enum(["agent", "human"]).optional().default("agent"),
244
244
  execution_kind: z.enum(["authoring", "diagnosis"]).optional().default("authoring"),
245
245
  source_attempt_id: z.string().uuid().nullable().optional().default(null),
246
+ repair_mode: z.enum(["none", "briefed", "blind"]).optional().default("none"),
246
247
  });
247
248
  const taskSpecSchema = z.object({
248
249
  goal: z.string().optional(), scope: z.array(z.string()).optional(), boundaries: z.array(z.string()).optional(),
@@ -952,7 +953,7 @@ async function runClaimedAssignment(client, config, driver, workspace, brief, ta
952
953
  // A fresh attempt after a failed delivery must start clean: resuming a session whose last
953
954
  // turn already "finished" makes the agent reply conversationally without the report block.
954
955
  const resumeSessionId = options.forceResumeSessionId
955
- ?? (reworkFeedback ? config.sessions?.[taskId] : undefined);
956
+ ?? (reworkFeedback && task.repair_mode !== "briefed" ? config.sessions?.[taskId] : undefined);
956
957
  const result = await driver.run({
957
958
  prompt,
958
959
  workspace: attemptWorkspace,
package/dist/ops.js CHANGED
@@ -5,7 +5,7 @@
5
5
  import { spawnSync } from "node:child_process";
6
6
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
7
  import { homedir } from "node:os";
8
- import { dirname, join, resolve } from "node:path";
8
+ import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
9
9
  import { parseArgs } from "node:util";
10
10
  import { ConduitClient } from "./client.js";
11
11
  import { loadConfig } from "./config.js";
@@ -15,6 +15,7 @@ import { driverIdsFromDetectedLabels } from "./drivers.js";
15
15
  import { BRIDGE_PROTOCOL_VERSION, describePreflightIssue, runBridgePreflight } from "./preflight.js";
16
16
  import { applyRunnerToolPath, runnerServiceWorkspaceWarnings } from "./service.js";
17
17
  import { bridgeVersion } from "./version.js";
18
+ import { bootstrapManagedWorkspace } from "./workspace-bootstrap.js";
18
19
  export const OPS_VERBS = [
19
20
  "connect", "enroll", "install", "switch", "online", "offline", "status", "doctor", "disconnect", "uninstall",
20
21
  ];
@@ -529,19 +530,35 @@ export async function runOps(verb, argv = [], deps = {}) {
529
530
  }
530
531
  const workspace = resolve(expandOpsValue(installEnv.CONDUIT_WORKSPACE));
531
532
  const drivers = await (deps.resolveInstallDrivers ?? resolveInstallDrivers)(installEnv, installArgv);
532
- for (const id of drivers) {
533
- if (LOCAL_FUEL_DRIVERS.has(id))
534
- runBridge(["drivers", "fuel", id, "local"]);
535
- }
536
- runBridge(["drivers", "online", ...drivers]);
537
- applyRunnerToolPath();
538
533
  if (installEnv.CONDUIT_REPO) {
539
534
  const checkout = deps.ensureCheckout ?? ensureCheckout;
540
535
  const result = await checkout(workspace, installEnv.CONDUIT_REPO);
541
536
  console.log(result === "cloned"
542
537
  ? `Cloned ${installEnv.CONDUIT_REPO} into ${workspace}`
543
538
  : `Workspace already matches ${installEnv.CONDUIT_REPO}`);
539
+ const managedRoot = installEnv.CONDUIT_MANAGED_ROOT
540
+ ? resolve(expandOpsValue(installEnv.CONDUIT_MANAGED_ROOT))
541
+ : null;
542
+ const managedRelative = managedRoot ? relative(managedRoot, workspace) : "";
543
+ const managedCheckout = Boolean(managedRoot
544
+ && managedRelative
545
+ && managedRelative !== ".."
546
+ && !managedRelative.startsWith(`..${sep}`)
547
+ && !isAbsolute(managedRelative));
548
+ if (managedCheckout) {
549
+ const bootstrap = deps.bootstrapWorkspace ?? bootstrapManagedWorkspace;
550
+ const bootstrapResult = bootstrap(workspace);
551
+ if (bootstrapResult === "installed")
552
+ console.log(`Installed locked project dependencies in ${workspace}`);
553
+ }
544
554
  }
555
+ // Do not advertise an executable lane until a managed checkout has completed bootstrap.
556
+ for (const id of drivers) {
557
+ if (LOCAL_FUEL_DRIVERS.has(id))
558
+ runBridge(["drivers", "fuel", id, "local"]);
559
+ }
560
+ runBridge(["drivers", "online", ...drivers]);
561
+ applyRunnerToolPath();
545
562
  // A managed root is intentionally empty until the console assigns its first repository. It
546
563
  // still needs a resident runner, and `ops install` is also the recovery path after enrollment.
547
564
  const waitingOnManagedAssignment = Boolean(installEnv.CONDUIT_MANAGED_ROOT
@@ -0,0 +1,26 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { existsSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ function defaultRunner(command, args, workspace) {
5
+ const result = spawnSync(command, args, {
6
+ cwd: workspace,
7
+ env: process.env,
8
+ stdio: "inherit",
9
+ timeout: 10 * 60_000,
10
+ });
11
+ return { status: result.status, ...(result.error ? { error: result.error } : {}) };
12
+ }
13
+ /** Install locked JavaScript dependencies before a Conduit-managed checkout advertises readiness. */
14
+ export function bootstrapManagedWorkspace(workspace, run = defaultRunner) {
15
+ if (!existsSync(join(workspace, "package.json")))
16
+ return "not_applicable";
17
+ if (!existsSync(join(workspace, "package-lock.json"))) {
18
+ throw new Error("managed_workspace_bootstrap_package_lock_required");
19
+ }
20
+ const result = run("npm", ["ci", "--include=optional", "--no-audit", "--no-fund"], workspace);
21
+ if (result.error)
22
+ throw new Error(`managed_workspace_bootstrap_failed:${result.error.message}`);
23
+ if (result.status !== 0)
24
+ throw new Error(`managed_workspace_bootstrap_failed:exit_${result.status ?? "unknown"}`);
25
+ return "installed";
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miraland-labs/conduit-bridge",
3
- "version": "0.16.15",
3
+ "version": "0.16.16",
4
4
  "description": "Conduit Bridge CLI — join, connect, disconnect, multi-driver lanes, and run Claude Code / Codex / Cursor / OpenCode / Pi / Kiro / Antigravity / Grok Build agents for a Conduit organization",
5
5
  "type": "module",
6
6
  "bin": {