@amaster.ai/employee-runtime-connector 0.1.1-beta.263 → 0.1.1-beta.265

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -95,21 +95,42 @@ It does not expose WorkBuddy experts, projects, Office integrations, marketplace
95
95
  connectors, or Pi's `final_model_context_attestation_v1`. The connector creates a
96
96
  private per-run CodeBuddy home, supplies one strict MirrorX MCP definition, uses an
97
97
  exact native-tool allowlist, and preserves only an authority-bound native session
98
- rollout. It never inherits the user's ordinary `.codebuddy` or WorkBuddy profile.
98
+ rollout. It never inherits the user's ordinary `.codebuddy` settings, memory,
99
+ projects, MCP servers, workflows, or marketplace state. When no dedicated provider
100
+ credential is configured, it reuses only the current OS user's WorkBuddy desktop
101
+ login through a bounded encrypted-file snapshot inside the private home. The
102
+ connector copies only the active authentication id's `workbuddy-desktop.info`
103
+ opaque encrypted bytes without decrypting, parsing, logging, or serializing token
104
+ fields. Locks, logout markers, and backups are coordination/history state rather
105
+ than authentication inputs and are not copied; any logout-marker directory entry,
106
+ including a dangling symlink, makes the desktop session unavailable. CodeBuddy can
107
+ mutate only the private snapshot.
99
108
 
100
109
  This executor is off by default. Enable discovery with
101
110
  `AMASTER_ENABLE_CODEBUDDY_EXECUTOR=true`. `AMASTER_CODEBUDDY_COMMAND` can select an
102
111
  explicit CLI; on macOS the gated discovery path can also find the CLI bundled in
103
112
  `/Applications/WorkBuddy.app`. The Server task-session snapshot owns the model for
104
113
  current commands; `AMASTER_CODEBUDDY_MODEL` is only a compatibility fallback for
105
- older commands without that snapshot. The daemon environment or a Server-issued
106
- command environment must provide exactly one of `CODEBUDDY_API_KEY` or
107
- `CODEBUDDY_AUTH_TOKEN`; ordinary host login state is not a credential source.
108
- Command-scoped values override same-name daemon values. Provider routing may additionally use the supported
114
+ older commands without that snapshot. Authentication resolves in two fail-closed
115
+ modes: exactly one explicitly configured `CODEBUDDY_API_KEY` or
116
+ `CODEBUDDY_AUTH_TOKEN` wins, otherwise the current OS user's WorkBuddy desktop login
117
+ must be present. Desktop login reuse validates the complete source path chain and
118
+ opens it with no-follow file descriptors before materializing the private snapshot;
119
+ all run configuration and native sessions stay isolated. The snapshot is currently
120
+ supported on macOS and Linux, including Linux `XDG_DATA_HOME`; Windows
121
+ continues to require an explicit provider credential until an ACL-equivalent safety
122
+ check exists. If command scope supplies either auth variable, that complete auth
123
+ scope overrides daemon auth; two methods in the selected scope fail closed. Provider routing may additionally use the supported
109
124
  `CODEBUDDY_INTERNET_ENVIRONMENT`, `CODEBUDDY_BASE_URL`, or proxy variables. Secret
110
125
  values remain run-scoped and must never be placed in arguments, logs, connector
111
126
  metadata, or committed configuration.
112
127
 
128
+ Heartbeat readiness is explicitly a fresh `daemon_default` diagnostic, not command
129
+ admission: a later command may supply its own complete auth scope. The source
130
+ metadata check intentionally runs on each heartbeat so logout and permission changes
131
+ are observed immediately; the measured local cost is about 0.03 ms per check, so it
132
+ is not cached.
133
+
113
134
  This is an intentional compatibility break for the not-yet-public context-governance contract. There is no historical command migration, dual-read, or fallback from a new Server-issued envelope to an unproved executor path.
114
135
 
115
136
  ## Contracted Pi model calls
@@ -10116,6 +10116,7 @@ var goalCriterionProgressReadModelSchema = external_exports.object({
10116
10116
  relatedDemands: external_exports.array(goalCriterionRelatedWorkSchema).max(20),
10117
10117
  relatedTasks: external_exports.array(goalCriterionRelatedWorkSchema).max(20),
10118
10118
  decisionRevision: external_exports.number().int().nonnegative().nullable(),
10119
+ attentionItemKey: external_exports.string().min(1).nullable().optional(),
10119
10120
  expectedDecisionToken: sha256Schema5.nullable(),
10120
10121
  snoozedUntil: external_exports.string().datetime().nullable()
10121
10122
  }).strict();
@@ -12420,6 +12421,13 @@ var reconcilePendingCheckboxSelectionBoundsSchema = external_exports.object({
12420
12421
  });
12421
12422
  }
12422
12423
  });
12424
+ var reconcilePendingInteractionSettlementPurposeSchema = external_exports.object({
12425
+ expectedIssueExecutionEpoch: external_exports.number().int().nonnegative(),
12426
+ expectedResolutionRevision: external_exports.number().int().nonnegative(),
12427
+ expectedPurposeCode: external_exports.string().trim().min(1).max(200),
12428
+ targetPurposeCode: external_exports.enum(ISSUE_THREAD_INTERACTION_SETTLEMENT_PURPOSE_CODES),
12429
+ reason: external_exports.string().trim().min(1).max(1e3)
12430
+ }).strict();
12423
12431
  var rejectIssueThreadInteractionSchema = external_exports.object({
12424
12432
  outcome: external_exports.enum(["rejected", "changes_requested"]).optional(),
12425
12433
  reason: external_exports.string().trim().max(4e3).optional()
@@ -14537,6 +14545,11 @@ var inboxActionCountSchema = external_exports.discriminatedUnion("kind", [
14537
14545
  ])
14538
14546
  }).strict()
14539
14547
  ]);
14548
+ var inboxGoalAttentionSummarySchema = external_exports.object({
14549
+ attentionItemCount: external_exports.number().int().nonnegative(),
14550
+ count: inboxActionCountSchema,
14551
+ byGoalId: external_exports.record(external_exports.string().uuid(), external_exports.number().int().positive())
14552
+ }).strict();
14540
14553
  var inboxActionItemSchema = external_exports.object({
14541
14554
  itemKey: external_exports.string().min(1),
14542
14555
  itemRevision: external_exports.string().min(1),
@@ -14563,6 +14576,7 @@ var inboxActionItemSchema = external_exports.object({
14563
14576
  label: external_exports.string().min(1)
14564
14577
  }).strict(),
14565
14578
  resourceId: external_exports.string().min(1),
14579
+ goalId: external_exports.string().uuid().nullable().optional(),
14566
14580
  issueId: external_exports.string().uuid().nullable(),
14567
14581
  issueIdentifier: external_exports.string().nullable(),
14568
14582
  issueStatus: external_exports.string().nullable(),
@@ -14593,6 +14607,8 @@ var inboxActionItemsResponseSchema = external_exports.object({
14593
14607
  governance: external_exports.number().int().nonnegative()
14594
14608
  }).strict(),
14595
14609
  count: inboxActionCountSchema,
14610
+ goalAttention: inboxGoalAttentionSummarySchema.optional(),
14611
+ scopedItemKeys: external_exports.array(external_exports.string().min(1)).optional(),
14596
14612
  nextCursor: external_exports.string().min(1).nullable()
14597
14613
  }).strict();
14598
14614
 
@@ -18334,7 +18350,7 @@ var oriaRunnerDeliverySchema = external_exports.object({
18334
18350
 
18335
18351
  // src/amaster-runtime-daemon.mjs
18336
18352
  import { chmodSync as chmodSync9, copyFileSync as copyFileSync3, existsSync as existsSync19, lstatSync as lstatSync12, mkdirSync as mkdirSync11, mkdtempSync as mkdtempSync3, readFileSync as readFileSync20, readdirSync as readdirSync12, realpathSync as realpathSync11, renameSync as renameSync10, rmSync as rmSync11, statSync as statSync13, symlinkSync as symlinkSync2, unlinkSync as unlinkSync4, writeFileSync as writeFileSync13 } from "node:fs";
18337
- import { arch as arch4, homedir as homedir4, hostname as hostname2, platform as platform4, tmpdir } from "node:os";
18353
+ import { arch as arch4, homedir as homedir5, hostname as hostname2, platform as platform4, tmpdir } from "node:os";
18338
18354
  import { basename as basename10, delimiter as delimiter4, dirname as dirname13, extname as extname3, isAbsolute as isAbsolute13, join as join20, relative as relative9, resolve as resolve18 } from "node:path";
18339
18355
  import { spawn as spawn2, spawnSync as spawnSync5 } from "node:child_process";
18340
18356
 
@@ -19810,7 +19826,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
19810
19826
  }
19811
19827
  return ptr;
19812
19828
  }
19813
- function skipUntil(str, ptr, sep4, end, banNewLines = false) {
19829
+ function skipUntil(str, ptr, sep5, end, banNewLines = false) {
19814
19830
  if (!end) {
19815
19831
  ptr = indexOfNewline(str, ptr);
19816
19832
  return ptr < 0 ? str.length : ptr;
@@ -19819,7 +19835,7 @@ function skipUntil(str, ptr, sep4, end, banNewLines = false) {
19819
19835
  let c = str[i];
19820
19836
  if (c === "#") {
19821
19837
  i = indexOfNewline(str, i);
19822
- } else if (c === sep4) {
19838
+ } else if (c === sep5) {
19823
19839
  return i + 1;
19824
19840
  } else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
19825
19841
  return i;
@@ -21271,14 +21287,32 @@ function reconcileManagedCodexMcpProfiles(rootPath, options = {}) {
21271
21287
 
21272
21288
  // src/amaster-runtime-daemon/codebuddy-managed-mcp-profile.mjs
21273
21289
  import { createHash as createHash5 } from "node:crypto";
21274
- import { chmodSync as chmodSync6, existsSync as existsSync7, lstatSync as lstatSync6, mkdirSync as mkdirSync4, readFileSync as readFileSync7, readdirSync as readdirSync3, realpathSync as realpathSync4, rmSync as rmSync5, statSync as statSync5, writeFileSync as writeFileSync6 } from "node:fs";
21275
- import { arch as arch2, platform as platform2 } from "node:os";
21276
- import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute5, join as join8, relative as relative3, resolve as resolve7 } from "node:path";
21290
+ import {
21291
+ chmodSync as chmodSync6,
21292
+ closeSync,
21293
+ constants as fsConstants,
21294
+ existsSync as existsSync7,
21295
+ fstatSync,
21296
+ lstatSync as lstatSync6,
21297
+ mkdirSync as mkdirSync4,
21298
+ openSync,
21299
+ readFileSync as readFileSync7,
21300
+ readdirSync as readdirSync3,
21301
+ realpathSync as realpathSync4,
21302
+ rmSync as rmSync5,
21303
+ statSync as statSync5,
21304
+ writeFileSync as writeFileSync6
21305
+ } from "node:fs";
21306
+ import { arch as arch2, homedir as homedir3, platform as platform2 } from "node:os";
21307
+ import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute5, join as join8, parse as parse2, relative as relative3, resolve as resolve7, sep as sep2 } from "node:path";
21277
21308
  var SUPPORTED_SCHEMA_VERSION2 = "amaster.governed-mcp.v1";
21278
21309
  var SUPPORTED_SERVER_NAME2 = "amaster";
21279
21310
  var PROFILE_MARKER2 = ".mirrorx-managed-codebuddy-profile.json";
21280
21311
  var SESSION_ROLLOUT_MARKER2 = ".mirrorx-codebuddy-session-rollout.json";
21281
21312
  var DEFAULT_SESSION_ROLLOUT_TTL_MS2 = 24 * 60 * 60 * 1e3;
21313
+ var CODEBUDDY_DESKTOP_AUTH_SOURCE = "workbuddy_desktop_session";
21314
+ var CODEBUDDY_WORKBUDDY_AUTH_FILE = "workbuddy-desktop.info";
21315
+ var MAX_CODEBUDDY_DESKTOP_AUTH_BYTES = 4 * 1024 * 1024;
21282
21316
  var CODEBUDDY_NATIVE_TOOLS = [
21283
21317
  "Bash",
21284
21318
  "Edit",
@@ -21369,6 +21403,187 @@ function within3(candidate, root) {
21369
21403
  const rel = relative3(root, candidate);
21370
21404
  return rel === "" || !rel.startsWith("..") && !isAbsolute5(rel);
21371
21405
  }
21406
+ function codebuddyIsolatedAuthRelativePath(targetPlatform = platform2()) {
21407
+ if (targetPlatform === "darwin") {
21408
+ return join8("Library", "Application Support", "CodeBuddyExtension", "Data", "Public", "auth");
21409
+ }
21410
+ if (targetPlatform === "linux") {
21411
+ return join8(".local", "share", "CodeBuddyExtension", "Data", "Public", "auth");
21412
+ }
21413
+ throw new Error(`codebuddy_managed_mcp_desktop_auth_unsupported: platform ${targetPlatform} is not supported`);
21414
+ }
21415
+ function codebuddyDesktopAuthDirectory(sourceHome, sourceEnv, targetPlatform) {
21416
+ if (targetPlatform === "darwin") {
21417
+ return join8(sourceHome, codebuddyIsolatedAuthRelativePath(targetPlatform));
21418
+ }
21419
+ if (targetPlatform === "linux") {
21420
+ const xdgDataHome = typeof sourceEnv?.XDG_DATA_HOME === "string" ? sourceEnv.XDG_DATA_HOME.trim() : "";
21421
+ if (xdgDataHome) {
21422
+ if (!isAbsolute5(xdgDataHome)) {
21423
+ throw new Error("codebuddy_managed_mcp_desktop_auth_xdg_invalid: XDG_DATA_HOME must be absolute");
21424
+ }
21425
+ const resolvedXdgDataHome = resolve7(xdgDataHome);
21426
+ const canonicalXdgDataHome = existsSync7(resolvedXdgDataHome) ? realpathSync4(resolvedXdgDataHome) : resolvedXdgDataHome;
21427
+ return join8(canonicalXdgDataHome, "CodeBuddyExtension", "Data", "Public", "auth");
21428
+ }
21429
+ return join8(sourceHome, codebuddyIsolatedAuthRelativePath(targetPlatform));
21430
+ }
21431
+ throw new Error(`codebuddy_managed_mcp_desktop_auth_unsupported: platform ${targetPlatform} is not supported`);
21432
+ }
21433
+ function absolutePathChain(path) {
21434
+ const absolute = resolve7(path);
21435
+ const root = parse2(absolute).root;
21436
+ const components = relative3(root, absolute).split(sep2).filter(Boolean);
21437
+ const chain = [root];
21438
+ for (const component of components) chain.push(join8(chain.at(-1), component));
21439
+ return chain;
21440
+ }
21441
+ function sameFileIdentity(left, right) {
21442
+ return left.dev === right.dev && left.ino === right.ino;
21443
+ }
21444
+ function sameTrustedFileMetadata(left, right) {
21445
+ return sameFileIdentity(left, right) && left.uid === right.uid && (left.mode & 4095) === (right.mode & 4095);
21446
+ }
21447
+ function lstatIfPresent(path) {
21448
+ try {
21449
+ return lstatSync6(path);
21450
+ } catch (error) {
21451
+ if (error && typeof error === "object" && error.code === "ENOENT") return null;
21452
+ throw error;
21453
+ }
21454
+ }
21455
+ function inspectCodebuddyDesktopAuthDirectory(sourceHome = homedir3(), sourceEnv = process.env, targetPlatform = platform2()) {
21456
+ try {
21457
+ const resolvedSourceHome = realpathSync4(resolve7(nonEmpty2(sourceHome, "desktopHome")));
21458
+ const sourceAuthDir = codebuddyDesktopAuthDirectory(resolvedSourceHome, sourceEnv, targetPlatform);
21459
+ if (!lstatIfPresent(sourceAuthDir)) {
21460
+ return { available: false, source: CODEBUDDY_DESKTOP_AUTH_SOURCE, reasonCode: "desktop_auth_directory_missing" };
21461
+ }
21462
+ const sourceAuthFile = join8(sourceAuthDir, CODEBUDDY_WORKBUDDY_AUTH_FILE);
21463
+ if (!lstatIfPresent(sourceAuthFile)) {
21464
+ return { available: false, source: CODEBUDDY_DESKTOP_AUTH_SOURCE, reasonCode: "desktop_login_missing" };
21465
+ }
21466
+ if (lstatIfPresent(`${sourceAuthFile}.logged-out`)) {
21467
+ return { available: false, source: CODEBUDDY_DESKTOP_AUTH_SOURCE, reasonCode: "desktop_login_missing" };
21468
+ }
21469
+ const chain = absolutePathChain(sourceAuthFile);
21470
+ const currentUid = typeof process.getuid === "function" ? process.getuid() : null;
21471
+ const pathChain = [];
21472
+ for (const candidate of chain) {
21473
+ const candidateStat = lstatSync6(candidate);
21474
+ const isAuthFile = candidate === sourceAuthFile;
21475
+ const isAuthDir = candidate === sourceAuthDir;
21476
+ if (candidateStat.isSymbolicLink() || (isAuthFile ? !candidateStat.isFile() : !candidateStat.isDirectory())) {
21477
+ return {
21478
+ available: false,
21479
+ source: CODEBUDDY_DESKTOP_AUTH_SOURCE,
21480
+ reasonCode: isAuthFile ? "desktop_auth_file_unsafe" : isAuthDir ? "desktop_auth_directory_unsafe" : "desktop_auth_ancestor_unsafe"
21481
+ };
21482
+ }
21483
+ const ownerAllowed = currentUid === null || candidateStat.uid === currentUid || !isAuthFile && !isAuthDir && candidateStat.uid === 0;
21484
+ if (!ownerAllowed) {
21485
+ return {
21486
+ available: false,
21487
+ source: CODEBUDDY_DESKTOP_AUTH_SOURCE,
21488
+ reasonCode: isAuthFile ? "desktop_auth_file_owner_mismatch" : isAuthDir ? "desktop_auth_owner_mismatch" : "desktop_auth_ancestor_owner_mismatch"
21489
+ };
21490
+ }
21491
+ const stickyRootOwnedDirectory = !isAuthFile && !isAuthDir && candidateStat.uid === 0 && (candidateStat.mode & 512) !== 0;
21492
+ if ((candidateStat.mode & 18) !== 0 && !stickyRootOwnedDirectory) {
21493
+ return {
21494
+ available: false,
21495
+ source: CODEBUDDY_DESKTOP_AUTH_SOURCE,
21496
+ reasonCode: isAuthFile ? "desktop_auth_file_writable_by_others" : isAuthDir ? "desktop_auth_directory_writable_by_others" : "desktop_auth_ancestor_writable_by_others"
21497
+ };
21498
+ }
21499
+ pathChain.push({ path: candidate, stat: candidateStat });
21500
+ }
21501
+ const sourceAuthFileStat = pathChain.at(-1).stat;
21502
+ if (sourceAuthFileStat.size <= 0 || sourceAuthFileStat.size > MAX_CODEBUDDY_DESKTOP_AUTH_BYTES) {
21503
+ return { available: false, source: CODEBUDDY_DESKTOP_AUTH_SOURCE, reasonCode: "desktop_auth_file_size_invalid" };
21504
+ }
21505
+ return {
21506
+ available: true,
21507
+ source: CODEBUDDY_DESKTOP_AUTH_SOURCE,
21508
+ sourceAuthDir,
21509
+ sourceAuthFile,
21510
+ pathChain,
21511
+ authFileCount: 1
21512
+ };
21513
+ } catch (error) {
21514
+ return {
21515
+ available: false,
21516
+ source: CODEBUDDY_DESKTOP_AUTH_SOURCE,
21517
+ reasonCode: error instanceof Error ? error.message.startsWith("codebuddy_managed_mcp_desktop_auth_unsupported:") ? "desktop_auth_platform_unsupported" : error.message.startsWith("codebuddy_managed_mcp_desktop_auth_xdg_invalid:") ? "desktop_auth_xdg_data_home_invalid" : "desktop_auth_inspection_failed" : "desktop_auth_inspection_failed"
21518
+ };
21519
+ }
21520
+ }
21521
+ function inspectCodebuddyDesktopAuthReadiness(sourceHome = homedir3(), sourceEnv = process.env, targetPlatform = platform2()) {
21522
+ const inspected = inspectCodebuddyDesktopAuthDirectory(sourceHome, sourceEnv, targetPlatform);
21523
+ return {
21524
+ available: inspected.available,
21525
+ source: inspected.source,
21526
+ ...inspected.available ? { authFileCount: inspected.authFileCount } : { reasonCode: inspected.reasonCode }
21527
+ };
21528
+ }
21529
+ function snapshotCodebuddyDesktopAuth(sourceHome, sourceEnv, isolatedHome) {
21530
+ const inspected = inspectCodebuddyDesktopAuthDirectory(sourceHome, sourceEnv);
21531
+ if (!inspected.available) {
21532
+ throw new Error(
21533
+ `codebuddy_managed_mcp_desktop_auth_missing: ${inspected.reasonCode}; sign in to WorkBuddy Desktop or configure exactly one of CODEBUDDY_API_KEY and CODEBUDDY_AUTH_TOKEN`
21534
+ );
21535
+ }
21536
+ const openDescriptors = [];
21537
+ let authSnapshot = null;
21538
+ try {
21539
+ for (const [index, entry] of inspected.pathChain.entries()) {
21540
+ const isAuthFile = index === inspected.pathChain.length - 1;
21541
+ const flags = fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW | (isAuthFile ? 0 : fsConstants.O_DIRECTORY);
21542
+ const fd = openSync(entry.path, flags);
21543
+ openDescriptors.push(fd);
21544
+ const openedStat = fstatSync(fd);
21545
+ if (!sameTrustedFileMetadata(openedStat, entry.stat)) {
21546
+ throw new Error("codebuddy_managed_mcp_desktop_auth_changed: source path changed during validation");
21547
+ }
21548
+ if (isAuthFile) {
21549
+ if (!openedStat.isFile() || openedStat.size <= 0 || openedStat.size > MAX_CODEBUDDY_DESKTOP_AUTH_BYTES) {
21550
+ throw new Error("codebuddy_managed_mcp_desktop_auth_unsafe: source auth file is invalid");
21551
+ }
21552
+ authSnapshot = readFileSync7(fd);
21553
+ const afterReadStat = fstatSync(fd);
21554
+ if (!sameTrustedFileMetadata(openedStat, afterReadStat) || openedStat.size !== afterReadStat.size || openedStat.mtimeMs !== afterReadStat.mtimeMs || authSnapshot.length !== openedStat.size) {
21555
+ throw new Error("codebuddy_managed_mcp_desktop_auth_changed: source auth file changed during snapshot");
21556
+ }
21557
+ }
21558
+ }
21559
+ for (const entry of inspected.pathChain) {
21560
+ const currentStat = lstatSync6(entry.path);
21561
+ if (currentStat.isSymbolicLink() || !sameTrustedFileMetadata(currentStat, entry.stat)) {
21562
+ throw new Error("codebuddy_managed_mcp_desktop_auth_changed: source path changed during snapshot");
21563
+ }
21564
+ }
21565
+ if (lstatIfPresent(`${inspected.sourceAuthFile}.logged-out`)) {
21566
+ throw new Error("codebuddy_managed_mcp_desktop_auth_changed: desktop session logged out during snapshot");
21567
+ }
21568
+ const targetAuthDir = join8(isolatedHome, codebuddyIsolatedAuthRelativePath());
21569
+ privateDir(targetAuthDir);
21570
+ const targetAuthFile = join8(targetAuthDir, CODEBUDDY_WORKBUDDY_AUTH_FILE);
21571
+ privateFile(targetAuthFile, authSnapshot);
21572
+ return {
21573
+ authMode: CODEBUDDY_DESKTOP_AUTH_SOURCE,
21574
+ targetAuthDir,
21575
+ targetAuthFile
21576
+ };
21577
+ } finally {
21578
+ if (authSnapshot) authSnapshot.fill(0);
21579
+ for (const fd of openDescriptors.reverse()) {
21580
+ try {
21581
+ closeSync(fd);
21582
+ } catch {
21583
+ }
21584
+ }
21585
+ }
21586
+ }
21372
21587
  function findCodebuddySession(configDir, sessionId) {
21373
21588
  const projectsRoot = join8(configDir, "projects");
21374
21589
  if (!existsSync7(projectsRoot)) {
@@ -21460,16 +21675,56 @@ function buildIsolatedEnvironment2(baseEnv, commandEnv) {
21460
21675
  }
21461
21676
  return env;
21462
21677
  }
21678
+ function codebuddyAuthSelection(baseEnv, commandEnv) {
21679
+ const scopes = [
21680
+ { name: "command_env", value: record5(commandEnv) },
21681
+ { name: "daemon_env", value: record5(baseEnv) }
21682
+ ];
21683
+ for (const scope of scopes) {
21684
+ const apiKey = typeof scope.value.CODEBUDDY_API_KEY === "string" ? scope.value.CODEBUDDY_API_KEY.trim() : "";
21685
+ const authToken = typeof scope.value.CODEBUDDY_AUTH_TOKEN === "string" ? scope.value.CODEBUDDY_AUTH_TOKEN.trim() : "";
21686
+ if (!apiKey && !authToken) continue;
21687
+ const sources = [
21688
+ ...apiKey ? ["CODEBUDDY_API_KEY"] : [],
21689
+ ...authToken ? ["CODEBUDDY_AUTH_TOKEN"] : []
21690
+ ];
21691
+ return {
21692
+ scope: scope.name,
21693
+ apiKey,
21694
+ authToken,
21695
+ sources,
21696
+ conflict: sources.length > 1,
21697
+ authMode: apiKey && !authToken ? "api_key" : authToken && !apiKey ? "oauth_token" : null
21698
+ };
21699
+ }
21700
+ return {
21701
+ scope: null,
21702
+ apiKey: "",
21703
+ authToken: "",
21704
+ sources: [],
21705
+ conflict: false,
21706
+ authMode: null
21707
+ };
21708
+ }
21709
+ function inspectCodebuddyProviderAuthReadiness(baseEnv = process.env, commandEnv = {}) {
21710
+ const selected = codebuddyAuthSelection(baseEnv, commandEnv);
21711
+ return {
21712
+ present: selected.sources.length > 0,
21713
+ conflict: selected.conflict,
21714
+ ...selected.sources.length > 0 ? { sources: selected.sources, scope: selected.scope } : {},
21715
+ ...selected.authMode ? { authMode: selected.authMode } : {}
21716
+ };
21717
+ }
21463
21718
  function codebuddyProviderEnvironment(baseEnv, commandEnv) {
21464
21719
  const source = { ...record5(baseEnv), ...record5(commandEnv) };
21465
- const apiKey = typeof source.CODEBUDDY_API_KEY === "string" ? source.CODEBUDDY_API_KEY.trim() : "";
21466
- const authToken = typeof source.CODEBUDDY_AUTH_TOKEN === "string" ? source.CODEBUDDY_AUTH_TOKEN.trim() : "";
21467
- if (!apiKey && !authToken) {
21468
- throw new Error("codebuddy_managed_mcp_auth_missing: configure CODEBUDDY_API_KEY or CODEBUDDY_AUTH_TOKEN in the agent runtime environment");
21469
- }
21470
- if (apiKey && authToken) {
21720
+ const selectedAuth = codebuddyAuthSelection(baseEnv, commandEnv);
21721
+ if (selectedAuth.conflict) {
21471
21722
  throw new Error("codebuddy_managed_mcp_auth_conflict: configure only one CodeBuddy authentication method");
21472
21723
  }
21724
+ delete source.CODEBUDDY_API_KEY;
21725
+ delete source.CODEBUDDY_AUTH_TOKEN;
21726
+ if (selectedAuth.apiKey) source.CODEBUDDY_API_KEY = selectedAuth.apiKey;
21727
+ if (selectedAuth.authToken) source.CODEBUDDY_AUTH_TOKEN = selectedAuth.authToken;
21473
21728
  const env = {};
21474
21729
  for (const [key, value] of Object.entries(source)) {
21475
21730
  if (!CODEBUDDY_PROVIDER_ENV.has(key) || typeof value !== "string" || value.trim() === "") continue;
@@ -21478,8 +21733,8 @@ function codebuddyProviderEnvironment(baseEnv, commandEnv) {
21478
21733
  return {
21479
21734
  env,
21480
21735
  protectedValues: [...new Set([
21481
- apiKey,
21482
- authToken,
21736
+ selectedAuth.apiKey,
21737
+ selectedAuth.authToken,
21483
21738
  source.CODEBUDDY_BASE_URL,
21484
21739
  source.HTTP_PROXY,
21485
21740
  source.HTTPS_PROXY,
@@ -21488,7 +21743,8 @@ function codebuddyProviderEnvironment(baseEnv, commandEnv) {
21488
21743
  source.https_proxy,
21489
21744
  source.all_proxy
21490
21745
  ].filter((value) => typeof value === "string" && value.trim() !== ""))],
21491
- authMode: apiKey ? "api_key" : "oauth_token"
21746
+ authMode: selectedAuth.authMode,
21747
+ authScope: selectedAuth.scope
21492
21748
  };
21493
21749
  }
21494
21750
  function validateAuthority2(input) {
@@ -21583,10 +21839,12 @@ function prepareManagedCodebuddyMcpProfile(input) {
21583
21839
  }, null, 2)}
21584
21840
  `);
21585
21841
  const provider = codebuddyProviderEnvironment(input.baseEnv, input.commandEnv);
21842
+ const desktopAuthSnapshot = provider.authMode ? null : snapshotCodebuddyDesktopAuth(input.desktopHome ?? homedir3(), input.desktopEnv ?? process.env, home);
21586
21843
  const env = {
21587
21844
  ...buildIsolatedEnvironment2(input.baseEnv, input.commandEnv),
21588
21845
  ...provider.env,
21589
21846
  HOME: home,
21847
+ ...platform2() === "win32" ? { USERPROFILE: home } : {},
21590
21848
  TMPDIR: tmp,
21591
21849
  CODEBUDDY_CONFIG_DIR: configDir,
21592
21850
  CODEBUDDY_DISABLE_MEMORY: "true",
@@ -21646,8 +21904,15 @@ function prepareManagedCodebuddyMcpProfile(input) {
21646
21904
  ...attestationFacts,
21647
21905
  attestationId: createHash5("sha256").update(JSON.stringify(attestationFacts)).digest("hex"),
21648
21906
  attestedAt: (/* @__PURE__ */ new Date()).toISOString(),
21649
- authMode: provider.authMode
21650
- }
21907
+ authMode: provider.authMode ?? desktopAuthSnapshot.authMode,
21908
+ authScope: provider.authScope ?? "desktop_os_user",
21909
+ authIsolation: desktopAuthSnapshot ? "isolated_home_desktop_auth_snapshot" : "isolated_home_provider_env"
21910
+ },
21911
+ desktopAuthSnapshot: desktopAuthSnapshot ? {
21912
+ source: CODEBUDDY_DESKTOP_AUTH_SOURCE,
21913
+ targetAuthDir: desktopAuthSnapshot.targetAuthDir,
21914
+ targetAuthFile: desktopAuthSnapshot.targetAuthFile
21915
+ } : null
21651
21916
  };
21652
21917
  } catch (error) {
21653
21918
  rmSync5(profileRoot, { recursive: true, force: true });
@@ -21821,7 +22086,7 @@ import {
21821
22086
  writeFileSync as writeFileSync7
21822
22087
  } from "node:fs";
21823
22088
  import { arch as arch3, platform as platform3 } from "node:os";
21824
- import { basename as basename5, delimiter as delimiter3, dirname as dirname7, isAbsolute as isAbsolute6, join as join10, relative as relative4, resolve as resolve9, sep as sep2 } from "node:path";
22089
+ import { basename as basename5, delimiter as delimiter3, dirname as dirname7, isAbsolute as isAbsolute6, join as join10, relative as relative4, resolve as resolve9, sep as sep3 } from "node:path";
21825
22090
  import { spawnSync as spawnSync3 } from "node:child_process";
21826
22091
 
21827
22092
  // src/amaster-runtime-daemon/pi-mcp-adapter-config.mjs
@@ -22927,7 +23192,7 @@ function createManagedPiMcpProfileApi(options = {}) {
22927
23192
  const current = pending.pop();
22928
23193
  const currentStat = lstatSync8(current);
22929
23194
  if (currentStat.isSymbolicLink()) throw new Error(`pi_managed_mcp_bootstrap_cache_unsafe: ${current}`);
22930
- const relativePath = relative4(root, current).split(sep2).join("/");
23195
+ const relativePath = relative4(root, current).split(sep3).join("/");
22931
23196
  if (currentStat.isDirectory()) {
22932
23197
  hash.update(`d:${relativePath}
22933
23198
  `);
@@ -23699,7 +23964,7 @@ function createManagedPiMcpProfileApi(options = {}) {
23699
23964
  const directory = pending.pop();
23700
23965
  for (const child of readdirSync4(directory, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
23701
23966
  const candidate = join10(directory, child.name);
23702
- const relativePath = relative4(root, candidate).split(sep2).join("/");
23967
+ const relativePath = relative4(root, candidate).split(sep3).join("/");
23703
23968
  const stat = lstatSync8(candidate);
23704
23969
  if (stat.isSymbolicLink()) throw new Error("pi_managed_mcp_company_skill_existing_source_unsafe");
23705
23970
  if (stat.isDirectory()) {
@@ -29974,10 +30239,6 @@ function fixedRules(input, includeIssueLine, runContract = "producer") {
29974
30239
  function compileConversationPrompt(input, context, maxChars) {
29975
30240
  const mode = promptContextMode(input);
29976
30241
  const taskText = readString(input.taskMarkdown) ?? "";
29977
- const wakeBodies = commentBodies(context);
29978
- const commentsDuplicatedByTask = !Array.isArray(context.paperclipTaskMarkdownCommentIds) && taskText && wakeBodies.length > 0 && wakeBodies.every((body) => taskText.includes(body));
29979
- const commentsSelected = mode !== "cold" || !commentsDuplicatedByTask;
29980
- const comments = commentsSelected ? readString(input.comments) ?? "" : "";
29981
30242
  const contextScope = {
29982
30243
  companyId: readString(asRecord(context.paperclipCompany).id),
29983
30244
  issueId: input.issueId ?? null
@@ -29989,8 +30250,11 @@ function compileConversationPrompt(input, context, maxChars) {
29989
30250
  `- workspace: ${input.cwd}`,
29990
30251
  input.managed ? `- source workspace: ${input.sourceWorkspacePath}` : ""
29991
30252
  ].filter(Boolean).join("\n");
30253
+ const wakeComments = asRecord(context.paperclipWake).comments;
30254
+ const latestWakeMessage = Array.isArray(wakeComments) ? [...wakeComments].reverse().map((comment) => readString(asRecord(comment).body)).find(Boolean) : null;
30255
+ const userPrompt = latestWakeMessage ?? readString(asRecord(context.paperclipWakeComment).body) ?? readString(asRecord(context.paperclipIssue).description);
30256
+ if (!userPrompt) throw new Error("conversation_user_message_missing");
29992
30257
  const rawSections = [
29993
- { name: "wake_comments", title: "Latest Message", priority: 95, sourceRef: commentRefs(context).map((id) => `comment:${id}`), originalContent: readString(input.comments) ?? "", content: comments, truncationReason: commentsSelected ? null : "duplicate_task_context" },
29994
30258
  { name: "task", title: "Conversation History", priority: 90, sourceRef: "conversation", originalContent: taskText, content: mode === "cold" ? taskText : "", truncationReason: mode === "cold" ? null : "mode_selection" },
29995
30259
  { name: "runtime_safety", title: "Runtime Safety", priority: 100, sourceRef: `command:${input.commandId}`, content: runtimeSafety },
29996
30260
  ...piGovernedTools ? [{ name: "pi_governed_tools", title: "Pi Governed Tools", priority: 96, sourceRef: "amaster_governed_mcp_direct_typed_contract", content: piGovernedTools }] : [],
@@ -30002,16 +30266,24 @@ function compileConversationPrompt(input, context, maxChars) {
30002
30266
  section.scope ??= contextScope;
30003
30267
  section.freshness ??= { kind: "run_snapshot" };
30004
30268
  }
30269
+ const systemPromptBudget = maxChars === null ? null : Math.max(0, maxChars - userPrompt.length);
30005
30270
  const compiled = compilePreparedSections({
30006
30271
  rawSections,
30007
30272
  mode,
30008
- maxChars,
30273
+ maxChars: systemPromptBudget,
30009
30274
  governedReadProvenance: [],
30010
30275
  resolvedDependencyTupleCount: 0
30011
30276
  });
30012
30277
  compiled.manifest.runContract = "producer";
30013
30278
  compiled.manifest.continuationPromptContract = { capability: null, mode: "legacy_server_owned_in_progress" };
30014
- return compiled;
30279
+ const usedChars = userPrompt.length + compiled.prompt.length;
30280
+ compiled.manifest.budget = {
30281
+ ...compiled.manifest.budget,
30282
+ totalChars: maxChars,
30283
+ usedChars,
30284
+ utilization: maxChars === null ? null : (usedChars / maxChars).toFixed(4)
30285
+ };
30286
+ return { prompt: userPrompt, systemPrompt: compiled.prompt, manifest: compiled.manifest };
30015
30287
  }
30016
30288
  function approvalContinuationText(input) {
30017
30289
  if (asRecord(input.nativeSession).mode !== "governed_action_approval") return "";
@@ -31275,7 +31547,7 @@ function pathWithin(candidate, root) {
31275
31547
  const rel = relative5(root, candidate);
31276
31548
  return rel === "" || !rel.startsWith("..") && !isAbsolute8(rel);
31277
31549
  }
31278
- function lstatIfPresent(path) {
31550
+ function lstatIfPresent2(path) {
31279
31551
  try {
31280
31552
  return lstatSync9(path);
31281
31553
  } catch (error) {
@@ -31296,7 +31568,7 @@ function isManagedExecutionDirectory(directory, managedWorkspacesRoot) {
31296
31568
  const candidate = canonicalExistingPath(directory);
31297
31569
  if (!pathWithin(candidate, managedRoot)) return false;
31298
31570
  const manifestPath = join13(candidate, WORKSPACE_MANIFEST_FILENAME);
31299
- const manifestStat = lstatIfPresent(manifestPath);
31571
+ const manifestStat = lstatIfPresent2(manifestPath);
31300
31572
  if (!manifestStat?.isFile() || manifestStat.isSymbolicLink()) return false;
31301
31573
  try {
31302
31574
  const manifest = JSON.parse(readFileSync14(manifestPath, "utf8"));
@@ -31497,7 +31769,7 @@ function projectExternalWorkspaceProjectInstructions(sourceWorkspacePath, execut
31497
31769
  let modelFacingSha256 = null;
31498
31770
  if (selectedSources.length > 0) {
31499
31771
  const targetPath = resolve10(targetRoot, "AGENTS.md");
31500
- const targetStat = lstatIfPresent(targetPath);
31772
+ const targetStat = lstatIfPresent2(targetPath);
31501
31773
  if (!pathWithin(targetPath, targetRoot) || targetStat?.isSymbolicLink()) {
31502
31774
  throw instructionTopologyError(
31503
31775
  "workspace_project_instruction_projection_unsafe",
@@ -31583,8 +31855,8 @@ function agentInstructionDeliveryAudit(bundle, delivery) {
31583
31855
 
31584
31856
  // src/amaster-runtime-daemon/config-state.mjs
31585
31857
  import { existsSync as existsSync13, mkdirSync as mkdirSync8, readFileSync as readFileSync15, renameSync as renameSync8, rmSync as rmSync9, writeFileSync as writeFileSync11 } from "node:fs";
31586
- import { homedir as homedir3, hostname } from "node:os";
31587
- import { dirname as dirname10, join as join14, parse as parse2, resolve as resolve11 } from "node:path";
31858
+ import { homedir as homedir4, hostname } from "node:os";
31859
+ import { dirname as dirname10, join as join14, parse as parse3, resolve as resolve11 } from "node:path";
31588
31860
 
31589
31861
  // src/amaster-runtime-daemon/capability-registry.mjs
31590
31862
  var BUILD_SUPPORTED_CAPABILITIES = Object.freeze([
@@ -31696,13 +31968,13 @@ function defaultMachineId() {
31696
31968
  }
31697
31969
  function runtimeHome(env) {
31698
31970
  return expandHomePath(String(
31699
- env.AMASTER_RUNTIME_STATE_HOME || env.AMASTER_RUNTIME_HOME || join14(homedir3(), ".amaster-employee")
31971
+ env.AMASTER_RUNTIME_STATE_HOME || env.AMASTER_RUNTIME_HOME || join14(homedir4(), ".amaster-employee")
31700
31972
  ));
31701
31973
  }
31702
31974
  function runtimeTemplatesRoot(env, home) {
31703
31975
  const configured = String(env.AMASTER_RUNTIME_TEMPLATES_ROOT ?? "").trim();
31704
31976
  const resolved = configured ? resolve11(expandHomePath(configured)) : resolve11(String(env.PI_CODING_AGENT_DIR ?? "")) === "/data/.pi" ? "/data/templates" : resolve11(join14(home, "templates"));
31705
- if (resolved === parse2(resolved).root) {
31977
+ if (resolved === parse3(resolved).root) {
31706
31978
  throw new Error("AMASTER_RUNTIME_TEMPLATES_ROOT must not be a filesystem root");
31707
31979
  }
31708
31980
  return resolved;
@@ -32162,7 +32434,7 @@ function createBrowserCredentialChannel({ consume }) {
32162
32434
 
32163
32435
  // src/amaster-runtime-daemon/runtime-artifact-upload.mjs
32164
32436
  import { createHash as createHash13 } from "node:crypto";
32165
- import { closeSync, constants, fstatSync, lstatSync as lstatSync10, openSync, readFileSync as readFileSync16, realpathSync as realpathSync9 } from "node:fs";
32437
+ import { closeSync as closeSync2, constants, fstatSync as fstatSync2, lstatSync as lstatSync10, openSync as openSync2, readFileSync as readFileSync16, realpathSync as realpathSync9 } from "node:fs";
32166
32438
  import { isAbsolute as isAbsolute9, relative as relative6, resolve as resolve12 } from "node:path";
32167
32439
  var SHA256_PATTERN = /^[a-f0-9]{64}$/;
32168
32440
  function requiredString2(value, name) {
@@ -32190,9 +32462,9 @@ function readOwnedWorkspaceFile(rootPath, sourceRelativePath, label = "Runtime w
32190
32462
  throw new Error(`${label} source is not an owned regular file`);
32191
32463
  }
32192
32464
  const noFollow = typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0;
32193
- const descriptor = openSync(sourcePath, constants.O_RDONLY | noFollow);
32465
+ const descriptor = openSync2(sourcePath, constants.O_RDONLY | noFollow);
32194
32466
  try {
32195
- const before = fstatSync(descriptor);
32467
+ const before = fstatSync2(descriptor);
32196
32468
  if (!before.isFile() || !sameFileSnapshot(pathStat, before)) {
32197
32469
  throw new Error(`${label} source changed before the governed read`);
32198
32470
  }
@@ -32216,14 +32488,14 @@ function readOwnedWorkspaceFile(rootPath, sourceRelativePath, label = "Runtime w
32216
32488
  }
32217
32489
  const body = readFileSync16(descriptor);
32218
32490
  options.afterRead?.({ sourcePath, descriptor });
32219
- const after = fstatSync(descriptor);
32491
+ const after = fstatSync2(descriptor);
32220
32492
  const pathAfter = lstatSync10(sourcePath);
32221
32493
  if (!sameFileSnapshot(before, after) || !sameFileSnapshot(pathAfter, after) || !pathAfter.isFile() || pathAfter.isSymbolicLink() || !pathWithin2(realpathSync9(sourcePath), root) || body.length !== after.size) {
32222
32494
  throw new Error(`${label} source changed during the governed read`);
32223
32495
  }
32224
32496
  return { body, relativePath, stat: after };
32225
32497
  } finally {
32226
- closeSync(descriptor);
32498
+ closeSync2(descriptor);
32227
32499
  }
32228
32500
  }
32229
32501
  function prepareRuntimeArtifactUploads(cwd, mcpToolResults) {
@@ -32782,7 +33054,7 @@ import {
32782
33054
  unlinkSync as unlinkSync3,
32783
33055
  writeFileSync as writeFileSync12
32784
33056
  } from "node:fs";
32785
- import { dirname as dirname11, extname, isAbsolute as isAbsolute11, join as join17, parse as parse3, resolve as resolve15, sep as sep3 } from "node:path";
33057
+ import { dirname as dirname11, extname, isAbsolute as isAbsolute11, join as join17, parse as parse4, resolve as resolve15, sep as sep4 } from "node:path";
32786
33058
  import { fileURLToPath } from "node:url";
32787
33059
  var PRESET_TEMPLATE_MANIFEST_FILE = ".mirrorx-preset-templates.json";
32788
33060
  var MAX_PRESET_TEMPLATE_FILES = 256;
@@ -32838,7 +33110,7 @@ function hasAllowedTemplateExtension(name) {
32838
33110
  return ALLOWED_TEMPLATE_EXTENSIONS.has(extname(name).toLowerCase());
32839
33111
  }
32840
33112
  function validTemplateName(value) {
32841
- return typeof value === "string" && value.length > 0 && value !== "." && value !== ".." && !value.includes("\0") && !value.includes("/") && !value.includes("\\") && !isAbsolute11(value) && parse3(value).base === value && hasAllowedTemplateExtension(value);
33113
+ return typeof value === "string" && value.length > 0 && value !== "." && value !== ".." && !value.includes("\0") && !value.includes("/") && !value.includes("\\") && !isAbsolute11(value) && parse4(value).base === value && hasAllowedTemplateExtension(value);
32842
33114
  }
32843
33115
  function readManifest(manifestPath, { strict }) {
32844
33116
  try {
@@ -32897,7 +33169,7 @@ function removeRetiredPresetFiles(targetDir, previousManifest, nextNames) {
32897
33169
  function materializeBundledPresetTemplates(input) {
32898
33170
  const sourceDir = resolve15(input.sourceDir);
32899
33171
  const targetDir = resolve15(input.targetDir);
32900
- if (sourceDir === targetDir || sourceDir.startsWith(`${targetDir}${sep3}`) || targetDir.startsWith(`${sourceDir}${sep3}`)) {
33172
+ if (sourceDir === targetDir || sourceDir.startsWith(`${targetDir}${sep4}`) || targetDir.startsWith(`${sourceDir}${sep4}`)) {
32901
33173
  throw new Error("preset_template_source_target_overlap");
32902
33174
  }
32903
33175
  const manifest = readManifest(join17(sourceDir, PRESET_TEMPLATE_MANIFEST_FILE), { strict: true });
@@ -33745,7 +34017,7 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
33745
34017
  }
33746
34018
 
33747
34019
  // src/amaster-runtime-daemon.mjs
33748
- var CONNECTOR_VERSION = "0.1.1-beta.263";
34020
+ var CONNECTOR_VERSION = "0.1.1-beta.265";
33749
34021
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
33750
34022
  var daemonRequire = createRequire2(import.meta.url);
33751
34023
  var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
@@ -34059,7 +34331,7 @@ function objectKeyCount(value) {
34059
34331
  return value && typeof value === "object" && !Array.isArray(value) ? Object.keys(value).length : 0;
34060
34332
  }
34061
34333
  function defaultPiCodingAgentDir() {
34062
- return join20(homedir4(), ".pi", "agent");
34334
+ return join20(homedir5(), ".pi", "agent");
34063
34335
  }
34064
34336
  function piCapabilitySourcesDiagnostics() {
34065
34337
  const configuredPiCodingAgentDir = safeExpandPath(process.env.PI_CODING_AGENT_DIR);
@@ -34189,18 +34461,30 @@ function executorReadinessFor(config, executor, piFinalContextAttestation) {
34189
34461
  };
34190
34462
  }
34191
34463
  if (executor.kind === "codebuddy") {
34464
+ const providerAuthEnv = inspectCodebuddyProviderAuthReadiness(process.env);
34465
+ const providerAuthConflict = providerAuthEnv.conflict;
34466
+ const desktopSession = inspectCodebuddyDesktopAuthReadiness();
34192
34467
  return {
34193
34468
  ...entry,
34194
34469
  label: "WorkBuddy Host\uFF08CodeBuddy \u6267\u884C\u5F15\u64CE\uFF09",
34195
34470
  model: configuredValue("AMASTER_CODEBUDDY_MODEL", process.env.AMASTER_CODEBUDDY_MODEL),
34196
34471
  auth: {
34197
- providerAuthEnv: optionalEnvPresence("CODEBUDDY_API_KEY", "CODEBUDDY_AUTH_TOKEN")
34472
+ diagnosticScope: "daemon_default",
34473
+ commandOverrideSupported: true,
34474
+ source: providerAuthConflict ? "provider_env_conflict" : providerAuthEnv.present ? "provider_env" : desktopSession.source,
34475
+ available: !providerAuthConflict && (providerAuthEnv.present || desktopSession.available),
34476
+ providerAuthEnv: {
34477
+ ...providerAuthEnv,
34478
+ conflict: providerAuthConflict
34479
+ },
34480
+ desktopSession
34198
34481
  },
34199
34482
  capabilityProtection: {
34200
34483
  featureGateEnabled: process.env.AMASTER_ENABLE_CODEBUDDY_EXECUTOR === "true",
34201
34484
  isolatedConfig: true,
34202
34485
  strictManagedMcp: true,
34203
34486
  inheritedWorkBuddyProfiles: false,
34487
+ desktopAuthPrivateSnapshot: true,
34204
34488
  minimumExecutorVersion: MINIMUM_CODEBUDDY_VERSION
34205
34489
  }
34206
34490
  };
@@ -34511,7 +34795,7 @@ AMASTER_MACHINE_ID=${quoteShell(config.machineId)}
34511
34795
  AMASTER_WORKSPACE_ALLOWLIST=${quoteShell(config.workspaceBindings.join(","))}
34512
34796
  AMASTER_EXECUTORS=${quoteShell(executorEnv)}
34513
34797
  AMASTER_NETWORK_DOMAINS=${quoteShell(config.networkDomains.join(","))}
34514
- AMASTER_DAEMON_STATE_FILE=${quoteShell(join20(homedir4(), ".amaster-employee", "runtime-connector-state.json"))}
34798
+ AMASTER_DAEMON_STATE_FILE=${quoteShell(join20(homedir5(), ".amaster-employee", "runtime-connector-state.json"))}
34515
34799
  EOF
34516
34800
 
34517
34801
  set -a
@@ -38462,6 +38746,16 @@ async function executeRunCommand(config, command) {
38462
38746
  }));
38463
38747
  const prompt = promptCompilation.prompt;
38464
38748
  const contextManifest = promptCompilation.manifest;
38749
+ const appendedSystemPrompt = readString(promptCompilation.systemPrompt);
38750
+ if (executor.kind === "pi" && appendedSystemPrompt) {
38751
+ const promptRoot = managedMcpProfile?.profileRoot ?? workspace.executorHome;
38752
+ const promptDir = join20(promptRoot, "tmp");
38753
+ mkdirSync11(promptDir, { recursive: true, mode: 448 });
38754
+ const promptPath = join20(promptDir, "conversation-system.md");
38755
+ writeFileSync13(promptPath, appendedSystemPrompt, { encoding: "utf8", mode: 384, flag: "wx" });
38756
+ const printIndex = invocation.args.lastIndexOf("-p");
38757
+ invocation.args.splice(printIndex < 0 ? invocation.args.length : printIndex, 0, "--append-system-prompt", promptPath);
38758
+ }
38465
38759
  let projectInstructionSnapshot = null;
38466
38760
  if (strictContextGovernance) {
38467
38761
  const finalContextExtensions = await runExecutionStage("context_attestation", () => attachPiFinalContextAttestor(managedMcpProfile, {
@@ -7,7 +7,7 @@ import { homedir, hostname } from "node:os";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { BUILD_SUPPORTED_CAPABILITIES } from "./amaster-runtime-daemon/capability-registry.mjs";
9
9
 
10
- const CONNECTOR_VERSION = "0.1.1-beta.263";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.265";
11
11
 
12
12
  const CONFIG_KEY_MAP = new Map([
13
13
  ["server_url", "AMASTER_EMPLOYEE_SERVER_URL"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/employee-runtime-connector",
3
- "version": "0.1.1-beta.263",
3
+ "version": "0.1.1-beta.265",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",