@zixt/host 0.0.143 → 0.0.145

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.
Files changed (2) hide show
  1. package/dist/index.js +606 -285
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import { homedir as homedir4 } from "node:os";
28
28
  // package.json
29
29
  var package_default = {
30
30
  name: "@zixt/host",
31
- version: "0.0.143",
31
+ version: "0.0.145",
32
32
  type: "module",
33
33
  exports: {
34
34
  ".": "./src/client.ts",
@@ -14716,8 +14716,8 @@ var ID_PREFIXES = {
14716
14716
  productFeedback: "pfb",
14717
14717
  /** One shared company fact every teammate and the Manager read (CP-1). */
14718
14718
  companyProfileEntry: "cpe",
14719
- /** A bounded, validated image of the organization's own logo (CP-3). */
14720
- companyLogo: "clg"
14719
+ /** One reusable file the whole organization shares (CP-6). */
14720
+ companyAsset: "cas"
14721
14721
  };
14722
14722
  var idPattern = (prefix) => new RegExp(`^${prefix}_[0-9a-f]{32}$`);
14723
14723
  function newId(prefix) {
@@ -14760,7 +14760,7 @@ var CompanyProfileEntryId = idSchema(
14760
14760
  ID_PREFIXES.companyProfileEntry,
14761
14761
  "company profile entry id"
14762
14762
  );
14763
- var CompanyLogoId = idSchema(ID_PREFIXES.companyLogo, "company logo id");
14763
+ var CompanyAssetId = idSchema(ID_PREFIXES.companyAsset, "company asset id");
14764
14764
  var ConversationId = idSchema(ID_PREFIXES.conversation, "conversation id");
14765
14765
  var ConversationEventId = idSchema(ID_PREFIXES.conversationEvent, "conversation event id");
14766
14766
  var ManagerIntegrationActionId = idSchema(
@@ -14826,6 +14826,7 @@ var BrowserTab = external_exports.object({
14826
14826
  loading: external_exports.boolean()
14827
14827
  }).strict();
14828
14828
  var BROWSER_MAX_TABS = 12;
14829
+ var TeammateQuestionAttention = external_exports.enum(["browser", "answer"]);
14829
14830
  var BrowserSessionState = external_exports.object({
14830
14831
  browserSessionId: BrowserSessionId,
14831
14832
  taskId: TaskId,
@@ -15808,6 +15809,68 @@ var Host = external_exports.object({
15808
15809
  createdAt: IsoDate2
15809
15810
  });
15810
15811
 
15812
+ // ../../packages/contracts/src/company-assets.ts
15813
+ var CompanyAssetKind = external_exports.enum([
15814
+ /** The organization's own mark, used wherever it brands something. */
15815
+ "logo",
15816
+ /** Any other picture: a product shot, a team photo, a diagram. */
15817
+ "image",
15818
+ /** A document a teammate should read or send: guidelines, a policy, a deck. */
15819
+ "document",
15820
+ /** Reusable prose: boilerplate, a disclaimer, a bio, a standard reply. */
15821
+ "text",
15822
+ /** Structured data a teammate reads: a price list, a CSV, a config. */
15823
+ "data",
15824
+ "other"
15825
+ ]);
15826
+ var CompanyAssetSource = external_exports.enum(["person", "manager", "teammate", "research"]);
15827
+ var CompanyAssetTrust = external_exports.enum(["internal", "external"]);
15828
+ var COMPANY_ASSET_NAME_MAX = 60;
15829
+ var COMPANY_ASSET_PURPOSE_MAX = 240;
15830
+ var COMPANY_ASSET_MAX_BYTES = 5 * 1024 * 1024;
15831
+ var COMPANY_ASSET_MAX_ITEMS = 40;
15832
+ var COMPANY_ASSET_SOURCE_URL_MAX = 500;
15833
+ var CompanyAssetRef = external_exports.object({
15834
+ id: CompanyAssetId,
15835
+ /** Normalized handle; this is what a teammate passes to get_company_asset. */
15836
+ name: external_exports.string().min(1).max(COMPANY_ASSET_NAME_MAX),
15837
+ kind: CompanyAssetKind,
15838
+ mediaType: external_exports.string().max(200).regex(/^[\w.+-]+\/[\w.+-]+$/, "invalid media type"),
15839
+ size: external_exports.number().int().min(1).max(COMPANY_ASSET_MAX_BYTES),
15840
+ /** One line: what it is and when to reach for it. */
15841
+ purpose: external_exports.string().min(1).max(COMPANY_ASSET_PURPOSE_MAX)
15842
+ }).strict();
15843
+ var CompanyAsset = CompanyAssetRef.extend({
15844
+ source: CompanyAssetSource,
15845
+ trust: CompanyAssetTrust,
15846
+ authorAgentId: AgentId.nullable(),
15847
+ authorMemberId: MemberId.nullable(),
15848
+ /** Where a researched or downloaded file came from, for the person checking. */
15849
+ sourceUrl: external_exports.string().max(COMPANY_ASSET_SOURCE_URL_MAX).nullable(),
15850
+ createdAt: IsoDate,
15851
+ updatedAt: IsoDate
15852
+ }).strict();
15853
+ var CompanyAssetsView = external_exports.object({
15854
+ assets: external_exports.array(CompanyAsset).max(COMPANY_ASSET_MAX_ITEMS),
15855
+ /** How many more files this organization may keep before it must remove one. */
15856
+ remaining: external_exports.number().int().min(0),
15857
+ /** Members read the inventory; Owners and Admins write it (ORG-2). */
15858
+ editable: external_exports.boolean()
15859
+ }).strict();
15860
+ var PutCompanyAssetRequest = external_exports.object({
15861
+ name: external_exports.string().trim().min(1).max(COMPANY_ASSET_NAME_MAX),
15862
+ kind: CompanyAssetKind,
15863
+ purpose: external_exports.string().trim().min(1).max(COMPANY_ASSET_PURPOSE_MAX),
15864
+ mediaType: CompanyAssetRef.shape.mediaType,
15865
+ /** Base64 payload (~4/3 of the byte cap); the decoded size is enforced server-side. */
15866
+ data: external_exports.string().min(1).max(Math.ceil(COMPANY_ASSET_MAX_BYTES / 3 * 4) + 4)
15867
+ }).strict();
15868
+ var UpdateCompanyAssetRequest = external_exports.object({
15869
+ name: external_exports.string().trim().min(1).max(COMPANY_ASSET_NAME_MAX).optional(),
15870
+ kind: CompanyAssetKind.optional(),
15871
+ purpose: external_exports.string().trim().min(1).max(COMPANY_ASSET_PURPOSE_MAX).optional()
15872
+ }).strict();
15873
+
15811
15874
  // ../../packages/contracts/src/company-profile.ts
15812
15875
  var CompanyProfileSection = external_exports.enum([
15813
15876
  /** What the business is and what it sells. */
@@ -15867,8 +15930,13 @@ var CompanyProfileEntry = external_exports.object({
15867
15930
  var CompanyProfileHeader = external_exports.object({
15868
15931
  /** The company's own website, as the person gave it, normalized to https. */
15869
15932
  websiteUrl: external_exports.string().max(COMPANY_PROFILE_SOURCE_URL_MAX).nullable(),
15870
- /** Verified image bytes Zixt stores itself; never a hotlink to their site. */
15871
- logoAssetId: CompanyLogoId.nullable(),
15933
+ /**
15934
+ * The Company asset (CP-6) holding the verified image bytes Zixt stores
15935
+ * itself, never a hotlink to their site. It lives in the shared asset
15936
+ * store rather than a collection of its own so a teammate can reach the
15937
+ * logo the same way it reaches every other company file.
15938
+ */
15939
+ logoAssetId: CompanyAssetId.nullable(),
15872
15940
  /** Where the logo was found, shown beside it so a person can check. */
15873
15941
  logoSourceUrl: external_exports.string().max(COMPANY_PROFILE_SOURCE_URL_MAX).nullable()
15874
15942
  }).strict();
@@ -18604,6 +18672,35 @@ var AgentOp = external_exports.union([
18604
18672
  }),
18605
18673
  /** Remove a company fact that is wrong or stale, by its id. */
18606
18674
  external_exports.object({ kind: external_exports.literal("company.forget"), entryId: CompanyProfileEntryId }),
18675
+ /**
18676
+ * Resolve one shared company file by the name a teammate used (CP-6). The
18677
+ * cloud answers with metadata only; the Host then pulls the bytes over its
18678
+ * own authenticated HTTP channel, exactly as a chat attachment arrives, so a
18679
+ * five-megabyte file never rides a WebSocket frame or an outbox document.
18680
+ */
18681
+ external_exports.object({
18682
+ kind: external_exports.literal("asset.resolve"),
18683
+ name: external_exports.string().min(1).max(COMPANY_ASSET_NAME_MAX)
18684
+ }),
18685
+ /**
18686
+ * Keep one file the whole organization should reuse. Bytes ride the agent-op
18687
+ * channel the way an artifact's do, bounded the same way; writing a name that
18688
+ * already exists replaces that file rather than minting a rival.
18689
+ */
18690
+ external_exports.object({
18691
+ kind: external_exports.literal("asset.put"),
18692
+ name: external_exports.string().min(1).max(COMPANY_ASSET_NAME_MAX),
18693
+ assetKind: CompanyAssetKind,
18694
+ purpose: external_exports.string().min(1).max(COMPANY_ASSET_PURPOSE_MAX),
18695
+ mediaType: external_exports.string().max(200).regex(/^[\w.+-]+\/[\w.+-]+$/),
18696
+ size: external_exports.number().int().min(1).max(COMPANY_ASSET_MAX_BYTES),
18697
+ data: external_exports.string().min(1).max(Math.ceil(COMPANY_ASSET_MAX_BYTES / 3 * 4) + 4)
18698
+ }),
18699
+ /** Remove a shared company file that is out of date, by name. */
18700
+ external_exports.object({
18701
+ kind: external_exports.literal("asset.forget"),
18702
+ name: external_exports.string().min(1).max(COMPANY_ASSET_NAME_MAX)
18703
+ }),
18607
18704
  /** The teammate's working-folder registry with per-Machine availability. */
18608
18705
  external_exports.object({ kind: external_exports.literal("workspace.list") }),
18609
18706
  /**
@@ -20039,6 +20136,13 @@ var ConversationEventProjection = external_exports.discriminatedUnion("kind", [
20039
20136
  role: external_exports.enum(["member", "teammate"]),
20040
20137
  displayName: external_exports.string().nullable()
20041
20138
  }).strict().nullable().optional(),
20139
+ /**
20140
+ * The pending ask a `question` event mirrors, so the Conversation can
20141
+ * offer the answer where the question was relayed instead of making a
20142
+ * person leave for the Task page to type one sentence (MG-5). Null once
20143
+ * the ask is decided or withheld, and absent on legacy rows.
20144
+ */
20145
+ questionApprovalId: ApprovalId.nullable().optional(),
20042
20146
  /**
20043
20147
  * Opaque presentation key shared by the useful report and its synthetic
20044
20148
  * terminal wake-up. It is never shown to people; clients use it only to
@@ -20433,12 +20537,13 @@ var ManagerTaskRailRepresentative = external_exports.object({
20433
20537
  updatedAt: external_exports.string()
20434
20538
  }).strict();
20435
20539
  var MANAGER_RAIL_WORKSTREAM_LIMIT = 10;
20540
+ var ManagerRailAttention = external_exports.enum(["none", "answer", "browser"]);
20436
20541
  var ManagerTaskRailWorkstream = external_exports.object({
20437
20542
  workstreamId: external_exports.string().min(1).max(160),
20438
20543
  /** The workstream's newest live Task title, already role-projected. */
20439
20544
  title: external_exports.string().max(1e3),
20440
20545
  representative: ManagerTaskRailRepresentative,
20441
- browserAttention: external_exports.boolean().default(false)
20546
+ attention: ManagerRailAttention.default("none")
20442
20547
  }).strict();
20443
20548
  var ManagerTaskRailSummary = external_exports.object({
20444
20549
  conversationId: ConversationId,
@@ -20446,7 +20551,7 @@ var ManagerTaskRailSummary = external_exports.object({
20446
20551
  hasAgentMatch: external_exports.boolean(),
20447
20552
  hasStatusMatch: external_exports.boolean(),
20448
20553
  representative: ManagerTaskRailRepresentative.nullable(),
20449
- browserAttention: external_exports.boolean().default(false),
20554
+ attention: ManagerRailAttention.default("none"),
20450
20555
  /**
20451
20556
  * Live workstreams this thread carries besides the one its own row
20452
20557
  * represents. Defaulted so a browser that outruns a deploy degrades to the
@@ -23393,7 +23498,7 @@ function runnerCommandCandidates(type, options = {}) {
23393
23498
  return platform === "win32" ? [join3(toolsRoot, "codex")] : [join3(toolsRoot, "bin", "codex")];
23394
23499
  }
23395
23500
  async function commandRuns(path) {
23396
- return new Promise((resolve19) => {
23501
+ return new Promise((resolve20) => {
23397
23502
  let child;
23398
23503
  try {
23399
23504
  child = spawnCli(path, ["--version"], {
@@ -23401,21 +23506,21 @@ async function commandRuns(path) {
23401
23506
  windowsHide: true
23402
23507
  });
23403
23508
  } catch {
23404
- resolve19(false);
23509
+ resolve20(false);
23405
23510
  return;
23406
23511
  }
23407
23512
  const timer = setTimeout(() => {
23408
23513
  child.kill();
23409
- resolve19(false);
23514
+ resolve20(false);
23410
23515
  }, 1e4);
23411
23516
  timer.unref?.();
23412
23517
  child.once("error", () => {
23413
23518
  clearTimeout(timer);
23414
- resolve19(false);
23519
+ resolve20(false);
23415
23520
  });
23416
23521
  child.once("exit", (code) => {
23417
23522
  clearTimeout(timer);
23418
- resolve19(code === 0);
23523
+ resolve20(code === 0);
23419
23524
  });
23420
23525
  });
23421
23526
  }
@@ -23621,7 +23726,7 @@ async function generateTaskTitle(instructions, runner) {
23621
23726
  instructions.slice(0, INSTRUCTIONS_BUDGET),
23622
23727
  "</task_request>"
23623
23728
  ].join("\n");
23624
- return new Promise((resolve19) => {
23729
+ return new Promise((resolve20) => {
23625
23730
  const child = spawnCli(
23626
23731
  command,
23627
23732
  [
@@ -23644,7 +23749,7 @@ async function generateTaskTitle(instructions, runner) {
23644
23749
  if (settled) return;
23645
23750
  settled = true;
23646
23751
  clearTimeout(timer);
23647
- resolve19(value);
23752
+ resolve20(value);
23648
23753
  };
23649
23754
  const timer = setTimeout(() => {
23650
23755
  child.kill();
@@ -23973,11 +24078,11 @@ function createWorkerWatchdogSendDrain() {
23973
24078
  if (completed) return;
23974
24079
  completed = true;
23975
24080
  pending--;
23976
- if (pending === 0) drained.splice(0).forEach((resolve19) => resolve19());
24081
+ if (pending === 0) drained.splice(0).forEach((resolve20) => resolve20());
23977
24082
  };
23978
24083
  },
23979
24084
  drain: async () => {
23980
- if (pending > 0) await new Promise((resolve19) => drained.push(resolve19));
24085
+ if (pending > 0) await new Promise((resolve20) => drained.push(resolve20));
23981
24086
  }
23982
24087
  };
23983
24088
  }
@@ -24494,7 +24599,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
24494
24599
  const deadline = Date.parse(retryAt);
24495
24600
  if (!Number.isFinite(deadline) || signal.aborted) return false;
24496
24601
  if (deadline <= Date.now()) return true;
24497
- return await new Promise((resolve19) => {
24602
+ return await new Promise((resolve20) => {
24498
24603
  let settled = false;
24499
24604
  let timer;
24500
24605
  const finish = (ready) => {
@@ -24502,7 +24607,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
24502
24607
  settled = true;
24503
24608
  if (timer) clearTimeout(timer);
24504
24609
  signal.removeEventListener("abort", onAbort);
24505
- resolve19(ready);
24610
+ resolve20(ready);
24506
24611
  };
24507
24612
  const onAbort = () => finish(false);
24508
24613
  const schedule = () => {
@@ -24783,27 +24888,27 @@ var HostClient = class _HostClient {
24783
24888
  const unwindingAssignments = [...this.activeAssignments.values()];
24784
24889
  for (const cancel of this.cancels.values()) cancel(stopReason);
24785
24890
  for (const entry of this.secretGrants.values()) {
24786
- for (const resolve19 of entry.resolvers) resolve19({});
24891
+ for (const resolve20 of entry.resolvers) resolve20({});
24787
24892
  entry.resolvers = [];
24788
24893
  delete entry.value;
24789
24894
  }
24790
24895
  for (const entry of this.connectionGrants.values()) {
24791
- for (const resolve19 of entry.resolvers) resolve19([]);
24896
+ for (const resolve20 of entry.resolvers) resolve20([]);
24792
24897
  entry.resolvers = [];
24793
24898
  delete entry.value;
24794
24899
  }
24795
24900
  for (const entry of this.providerGrants.values()) {
24796
- for (const resolve19 of entry.resolvers) resolve19([]);
24901
+ for (const resolve20 of entry.resolvers) resolve20([]);
24797
24902
  entry.resolvers = [];
24798
24903
  delete entry.value;
24799
24904
  }
24800
24905
  for (const entry of this.integrationToolServerGrants.values()) {
24801
- for (const resolve19 of entry.resolvers) resolve19([]);
24906
+ for (const resolve20 of entry.resolvers) resolve20([]);
24802
24907
  entry.resolvers = [];
24803
24908
  delete entry.value;
24804
24909
  }
24805
24910
  for (const waiters of this.approvalWaiters.values()) {
24806
- for (const resolve19 of waiters.values()) resolve19({ approved: false, guidance: reason });
24911
+ for (const resolve20 of waiters.values()) resolve20({ approved: false, guidance: reason });
24807
24912
  }
24808
24913
  for (const waiters of this.agentOpWaiters.values()) {
24809
24914
  for (const waiter of waiters.values()) {
@@ -24830,9 +24935,9 @@ var HostClient = class _HostClient {
24830
24935
  let drainTimer;
24831
24936
  const drained = await Promise.race([
24832
24937
  Promise.allSettled(runs).then(() => true),
24833
- new Promise((resolve19) => {
24938
+ new Promise((resolve20) => {
24834
24939
  drainTimer = setTimeout(
24835
- () => resolve19(false),
24940
+ () => resolve20(false),
24836
24941
  this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
24837
24942
  );
24838
24943
  drainTimer.unref?.();
@@ -24985,9 +25090,9 @@ var HostClient = class _HostClient {
24985
25090
  let frameDrainTimer;
24986
25091
  const framesDrained = await Promise.race([
24987
25092
  frameTail.then(() => true),
24988
- new Promise((resolve19) => {
25093
+ new Promise((resolve20) => {
24989
25094
  frameDrainTimer = setTimeout(
24990
- () => resolve19(false),
25095
+ () => resolve20(false),
24991
25096
  this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
24992
25097
  );
24993
25098
  frameDrainTimer.unref?.();
@@ -25500,17 +25605,24 @@ var HostClient = class _HostClient {
25500
25605
  * The /gateway WebSocket origin answers plain HTTPS too; attachment bytes
25501
25606
  * ride that, authenticated by the same host token as the socket (TS-15).
25502
25607
  */
25608
+ /** CP-6: same channel, same token, a different Zixt-owned collection. */
25609
+ async fetchCompanyAsset(assetId, signal) {
25610
+ return this.fetchGatewayBytes(`/gateway/company-assets/${assetId}`, "company file", signal);
25611
+ }
25503
25612
  async fetchAttachment(attachmentId, signal) {
25613
+ return this.fetchGatewayBytes(`/gateway/attachments/${attachmentId}`, "attachment", signal);
25614
+ }
25615
+ async fetchGatewayBytes(pathname, label, signal) {
25504
25616
  const url3 = new URL(this.opts.url);
25505
25617
  url3.protocol = url3.protocol === "wss:" ? "https:" : "http:";
25506
- url3.pathname = `/gateway/attachments/${attachmentId}`;
25618
+ url3.pathname = pathname;
25507
25619
  url3.search = "";
25508
25620
  const response = await fetch(url3, {
25509
25621
  headers: { authorization: `Bearer ${this.opts.token}` },
25510
25622
  signal
25511
25623
  });
25512
25624
  if (!response.ok) {
25513
- throw new Error(`attachment download failed (${response.status})`);
25625
+ throw new Error(`${label} download failed (${response.status})`);
25514
25626
  }
25515
25627
  return new Uint8Array(await response.arrayBuffer());
25516
25628
  }
@@ -25565,7 +25677,7 @@ var HostClient = class _HostClient {
25565
25677
  const entry = this.secretGrants.get(key) ?? { resolvers: [] };
25566
25678
  entry.value = message.secrets;
25567
25679
  entry.expiresAt = expiresAt;
25568
- for (const resolve19 of entry.resolvers) resolve19(message.secrets);
25680
+ for (const resolve20 of entry.resolvers) resolve20(message.secrets);
25569
25681
  entry.resolvers = [];
25570
25682
  this.secretGrants.set(key, entry);
25571
25683
  return;
@@ -25596,19 +25708,19 @@ var HostClient = class _HostClient {
25596
25708
  const entry = this.connectionGrants.get(key) ?? { resolvers: [] };
25597
25709
  entry.value = message.connections;
25598
25710
  entry.expiresAt = expiresAt;
25599
- for (const resolve19 of entry.resolvers) resolve19(message.connections);
25711
+ for (const resolve20 of entry.resolvers) resolve20(message.connections);
25600
25712
  entry.resolvers = [];
25601
25713
  this.connectionGrants.set(key, entry);
25602
25714
  const providerEntry = this.providerGrants.get(key) ?? { resolvers: [] };
25603
25715
  providerEntry.value = providers;
25604
25716
  providerEntry.expiresAt = authorityExpiresAt;
25605
- for (const resolve19 of providerEntry.resolvers) resolve19(providers);
25717
+ for (const resolve20 of providerEntry.resolvers) resolve20(providers);
25606
25718
  providerEntry.resolvers = [];
25607
25719
  this.providerGrants.set(key, providerEntry);
25608
25720
  const toolServerEntry = this.integrationToolServerGrants.get(key) ?? { resolvers: [] };
25609
25721
  const toolServers = [...message.toolServers ?? []];
25610
25722
  toolServerEntry.value = toolServers;
25611
- for (const resolve19 of toolServerEntry.resolvers) resolve19(toolServers);
25723
+ for (const resolve20 of toolServerEntry.resolvers) resolve20(toolServers);
25612
25724
  toolServerEntry.resolvers = [];
25613
25725
  this.integrationToolServerGrants.set(key, toolServerEntry);
25614
25726
  return;
@@ -25747,8 +25859,8 @@ var HostClient = class _HostClient {
25747
25859
  return redactCredentialText(text, sensitiveSnapshot()).slice(0, maxLength);
25748
25860
  };
25749
25861
  let resolveCancelled;
25750
- const cancelledPromise = new Promise((resolve19) => {
25751
- resolveCancelled = resolve19;
25862
+ const cancelledPromise = new Promise((resolve20) => {
25863
+ resolveCancelled = resolve20;
25752
25864
  });
25753
25865
  const endAuthority = (reason = "cloud_cancel") => {
25754
25866
  if (stopReason) return;
@@ -25757,28 +25869,28 @@ var HostClient = class _HostClient {
25757
25869
  authorityController.abort(reason);
25758
25870
  const secretEntry = this.secretGrants.get(cancelKey);
25759
25871
  if (secretEntry) {
25760
- for (const resolve19 of secretEntry.resolvers) resolve19({});
25872
+ for (const resolve20 of secretEntry.resolvers) resolve20({});
25761
25873
  secretEntry.resolvers = [];
25762
25874
  delete secretEntry.value;
25763
25875
  }
25764
25876
  this.secretGrants.delete(cancelKey);
25765
25877
  const connectionEntry = this.connectionGrants.get(cancelKey);
25766
25878
  if (connectionEntry) {
25767
- for (const resolve19 of connectionEntry.resolvers) resolve19([]);
25879
+ for (const resolve20 of connectionEntry.resolvers) resolve20([]);
25768
25880
  connectionEntry.resolvers = [];
25769
25881
  delete connectionEntry.value;
25770
25882
  }
25771
25883
  this.connectionGrants.delete(cancelKey);
25772
25884
  const providerEntry = this.providerGrants.get(cancelKey);
25773
25885
  if (providerEntry) {
25774
- for (const resolve19 of providerEntry.resolvers) resolve19([]);
25886
+ for (const resolve20 of providerEntry.resolvers) resolve20([]);
25775
25887
  providerEntry.resolvers = [];
25776
25888
  delete providerEntry.value;
25777
25889
  }
25778
25890
  this.providerGrants.delete(cancelKey);
25779
25891
  const toolServerEntry = this.integrationToolServerGrants.get(cancelKey);
25780
25892
  if (toolServerEntry) {
25781
- for (const resolve19 of toolServerEntry.resolvers) resolve19([]);
25893
+ for (const resolve20 of toolServerEntry.resolvers) resolve20([]);
25782
25894
  toolServerEntry.resolvers = [];
25783
25895
  delete toolServerEntry.value;
25784
25896
  }
@@ -25786,8 +25898,8 @@ var HostClient = class _HostClient {
25786
25898
  this.clearAuthorityExpiry(cancelKey);
25787
25899
  const approvalWaiters = this.approvalWaiters.get(cancelKey);
25788
25900
  if (approvalWaiters) {
25789
- for (const resolve19 of approvalWaiters.values()) {
25790
- resolve19({ approved: false, guidance: "task was cancelled" });
25901
+ for (const resolve20 of approvalWaiters.values()) {
25902
+ resolve20({ approved: false, guidance: "task was cancelled" });
25791
25903
  }
25792
25904
  approvalWaiters.clear();
25793
25905
  }
@@ -25913,9 +26025,9 @@ var HostClient = class _HostClient {
25913
26025
  return value;
25914
26026
  };
25915
26027
  if (entry.value) return Promise.resolve(capture(entry.value));
25916
- return new Promise((resolve19) => {
25917
- entry.resolvers.push((value) => resolve19(capture(value)));
25918
- setTimeout(() => resolve19(capture(entry.value ?? {})), _HostClient.SECRETS_WAIT_MS);
26028
+ return new Promise((resolve20) => {
26029
+ entry.resolvers.push((value) => resolve20(capture(value)));
26030
+ setTimeout(() => resolve20(capture(entry.value ?? {})), _HostClient.SECRETS_WAIT_MS);
25919
26031
  });
25920
26032
  };
25921
26033
  const connections = () => {
@@ -25932,9 +26044,9 @@ var HostClient = class _HostClient {
25932
26044
  return value;
25933
26045
  };
25934
26046
  if (entry.value) return Promise.resolve(capture(entry.value));
25935
- return new Promise((resolve19) => {
25936
- entry.resolvers.push((value) => resolve19(capture(value)));
25937
- setTimeout(() => resolve19(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
26047
+ return new Promise((resolve20) => {
26048
+ entry.resolvers.push((value) => resolve20(capture(value)));
26049
+ setTimeout(() => resolve20(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
25938
26050
  });
25939
26051
  };
25940
26052
  const providers = () => {
@@ -25951,9 +26063,9 @@ var HostClient = class _HostClient {
25951
26063
  return value;
25952
26064
  };
25953
26065
  if (entry.value !== void 0) return Promise.resolve(capture(entry.value));
25954
- return new Promise((resolve19) => {
25955
- entry.resolvers.push((value) => resolve19(capture(value)));
25956
- setTimeout(() => resolve19(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
26066
+ return new Promise((resolve20) => {
26067
+ entry.resolvers.push((value) => resolve20(capture(value)));
26068
+ setTimeout(() => resolve20(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
25957
26069
  });
25958
26070
  };
25959
26071
  const integrationToolServers = () => {
@@ -25962,9 +26074,9 @@ var HostClient = class _HostClient {
25962
26074
  this.integrationToolServerGrants.set(cancelKey, entry);
25963
26075
  const capture = (value) => authorityController.signal.aborted ? [] : value;
25964
26076
  if (entry.value !== void 0) return Promise.resolve(capture(entry.value));
25965
- return new Promise((resolve19) => {
25966
- entry.resolvers.push((value) => resolve19(capture(value)));
25967
- setTimeout(() => resolve19(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
26077
+ return new Promise((resolve20) => {
26078
+ entry.resolvers.push((value) => resolve20(capture(value)));
26079
+ setTimeout(() => resolve20(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
25968
26080
  });
25969
26081
  };
25970
26082
  const linear = async () => {
@@ -25991,13 +26103,13 @@ var HostClient = class _HostClient {
25991
26103
  ...questionChoices ? { questionChoices: [...questionChoices] } : {},
25992
26104
  ...questionnaire ? { questionnaire } : {}
25993
26105
  });
25994
- return new Promise((resolve19) => {
26106
+ return new Promise((resolve20) => {
25995
26107
  const waiters = this.approvalWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
25996
26108
  this.approvalWaiters.set(cancelKey, waiters);
25997
- waiters.set(requestId, resolve19);
26109
+ waiters.set(requestId, resolve20);
25998
26110
  void cancelledPromise.then(() => {
25999
26111
  if (waiters.delete(requestId)) {
26000
- resolve19({ approved: false, guidance: "task was cancelled" });
26112
+ resolve20({ approved: false, guidance: "task was cancelled" });
26001
26113
  }
26002
26114
  });
26003
26115
  });
@@ -26043,11 +26155,11 @@ var HostClient = class _HostClient {
26043
26155
  if (existing) message = existing;
26044
26156
  else terminalMessages.set(requestId, message);
26045
26157
  }
26046
- return new Promise((resolve19) => {
26158
+ return new Promise((resolve20) => {
26047
26159
  const waiters = this.agentOpWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
26048
26160
  this.agentOpWaiters.set(cancelKey, waiters);
26049
26161
  if (waiters.has(requestId)) {
26050
- resolve19({ ok: false, error: "provider settlement request is already in flight" });
26162
+ resolve20({ ok: false, error: "provider settlement request is already in flight" });
26051
26163
  return;
26052
26164
  }
26053
26165
  const timer = setTimeout(() => {
@@ -26058,7 +26170,7 @@ var HostClient = class _HostClient {
26058
26170
  (pending) => !(pending.type === "agent.op" && pending.requestId === requestId)
26059
26171
  );
26060
26172
  }
26061
- resolve19({
26173
+ resolve20({
26062
26174
  ok: false,
26063
26175
  error: terminal ? "The provider call completed, but Zixt could not record its outcome. Do not retry; wait for reconciliation." : "the platform did not answer in time; verify with a list_* tool before retrying a mutating call"
26064
26176
  });
@@ -26066,7 +26178,7 @@ var HostClient = class _HostClient {
26066
26178
  }, _HostClient.AGENT_OP_TIMEOUT_MS);
26067
26179
  timer.unref?.();
26068
26180
  waiters.set(requestId, {
26069
- resolve: resolve19,
26181
+ resolve: resolve20,
26070
26182
  timer,
26071
26183
  ...terminal ? { terminalMessage: message } : {}
26072
26184
  });
@@ -26112,12 +26224,12 @@ var HostClient = class _HostClient {
26112
26224
  "No GitHub change was attempted; the authority grant request was invalid."
26113
26225
  );
26114
26226
  }
26115
- const outcome = await new Promise((resolve19) => {
26227
+ const outcome = await new Promise((resolve20) => {
26116
26228
  const timer = setTimeout(() => {
26117
26229
  const waiter = this.operationGrantWaiters.get(requestId);
26118
26230
  if (!waiter) return;
26119
26231
  this.operationGrantWaiters.delete(requestId);
26120
- resolve19({ grant: null, retryable: true, reason: "no_reply_from_zixt" });
26232
+ resolve20({ grant: null, retryable: true, reason: "no_reply_from_zixt" });
26121
26233
  }, this.operationGrantTimeoutMs);
26122
26234
  timer.unref?.();
26123
26235
  this.operationGrantWaiters.set(requestId, {
@@ -26130,9 +26242,9 @@ var HostClient = class _HostClient {
26130
26242
  timer,
26131
26243
  accept: (grant) => {
26132
26244
  addSensitiveValues(providerGrantSensitiveValues(grant));
26133
- resolve19({ grant });
26245
+ resolve20({ grant });
26134
26246
  },
26135
- deny: (retryable, reason, detail, retryAt, retryCode) => resolve19({
26247
+ deny: (retryable, reason, detail, retryAt, retryCode) => resolve20({
26136
26248
  grant: null,
26137
26249
  retryable,
26138
26250
  reason,
@@ -26146,7 +26258,7 @@ var HostClient = class _HostClient {
26146
26258
  } catch {
26147
26259
  clearTimeout(timer);
26148
26260
  this.operationGrantWaiters.delete(requestId);
26149
- resolve19({ grant: null, retryable: false, reason: "connection_unavailable" });
26261
+ resolve20({ grant: null, retryable: false, reason: "connection_unavailable" });
26150
26262
  }
26151
26263
  });
26152
26264
  if (outcome.grant) {
@@ -26202,7 +26314,7 @@ var HostClient = class _HostClient {
26202
26314
  )
26203
26315
  );
26204
26316
  }
26205
- return new Promise((resolve19, reject3) => {
26317
+ return new Promise((resolve20, reject3) => {
26206
26318
  const timer = setTimeout(() => {
26207
26319
  if (this.browserCredentialWaiters.delete(requestId)) {
26208
26320
  reject3(
@@ -26221,7 +26333,7 @@ var HostClient = class _HostClient {
26221
26333
  timer,
26222
26334
  accept: (credential) => {
26223
26335
  addSensitiveValues(webLoginSensitiveValues(credential));
26224
- resolve19(credential);
26336
+ resolve20(credential);
26225
26337
  },
26226
26338
  deny: (reason) => reject3(new Error(reason))
26227
26339
  });
@@ -26249,6 +26361,7 @@ var HostClient = class _HostClient {
26249
26361
  runnerRuntime: emitRunnerRuntime,
26250
26362
  siblingTasks: () => [...this.liveTasks.values()].filter((live) => live.agentId === assign.agentId && live.taskId !== assign.taskId).map(({ taskId, title }) => ({ taskId, title })),
26251
26363
  fetchAttachment: (attachmentId) => this.fetchAttachment(attachmentId, authorityController.signal),
26364
+ fetchCompanyAsset: (assetId) => this.fetchCompanyAsset(assetId, authorityController.signal),
26252
26365
  followUps: (handler5) => {
26253
26366
  if (cancelled) return () => {
26254
26367
  };
@@ -26547,14 +26660,14 @@ async function observeWindowsGuardianNonce(pid, nonce) {
26547
26660
  "Windows runner identity could not be observed"
26548
26661
  );
26549
26662
  }
26550
- return new Promise((resolve19, reject3) => {
26663
+ return new Promise((resolve20, reject3) => {
26551
26664
  let done = false;
26552
26665
  const finish = (result) => {
26553
26666
  if (done) return;
26554
26667
  done = true;
26555
26668
  clearTimeout(timeout);
26556
26669
  if (result instanceof Error) reject3(result);
26557
- else resolve19(result);
26670
+ else resolve20(result);
26558
26671
  };
26559
26672
  const timeout = setTimeout(
26560
26673
  () => finish(
@@ -26599,7 +26712,7 @@ async function observePosixGuardianNonce(pid, nonce) {
26599
26712
  );
26600
26713
  }
26601
26714
  }
26602
- return new Promise((resolve19, reject3) => {
26715
+ return new Promise((resolve20, reject3) => {
26603
26716
  const observer = spawn3("/bin/ps", ["-ww", "-o", "command=", "-p", String(pid)], {
26604
26717
  stdio: ["ignore", "pipe", "ignore"]
26605
26718
  });
@@ -26610,7 +26723,7 @@ async function observePosixGuardianNonce(pid, nonce) {
26610
26723
  done = true;
26611
26724
  clearTimeout(timeout);
26612
26725
  if (result instanceof Error) reject3(result);
26613
- else resolve19(result);
26726
+ else resolve20(result);
26614
26727
  };
26615
26728
  const timeout = setTimeout(() => {
26616
26729
  observer.kill("SIGKILL");
@@ -26657,7 +26770,7 @@ async function observeGuardianIdentity(pid, identity) {
26657
26770
  return process.platform === "win32" ? observeWindowsGuardianNonce(pid, identity.nonce) : observePosixGuardianNonce(pid, identity.nonce);
26658
26771
  }
26659
26772
  function delay(ms) {
26660
- return new Promise((resolve19) => setTimeout(resolve19, ms));
26773
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
26661
26774
  }
26662
26775
  function posixProcessRecordsFromPs(output) {
26663
26776
  const records = [];
@@ -26690,7 +26803,7 @@ function posixProcessRecordsFromPs(output) {
26690
26803
  return records;
26691
26804
  }
26692
26805
  async function snapshotPosixProcesses() {
26693
- return new Promise((resolve19, reject3) => {
26806
+ return new Promise((resolve20, reject3) => {
26694
26807
  const observer = spawn3("/bin/ps", ["-axo", "uid=,pid=,ppid=,pgid=,stat="], {
26695
26808
  stdio: ["ignore", "pipe", "ignore"]
26696
26809
  });
@@ -26703,7 +26816,7 @@ async function snapshotPosixProcesses() {
26703
26816
  if (error52) reject3(error52);
26704
26817
  else {
26705
26818
  try {
26706
- resolve19(posixProcessRecordsFromPs(output));
26819
+ resolve20(posixProcessRecordsFromPs(output));
26707
26820
  } catch (caught) {
26708
26821
  reject3(caught);
26709
26822
  }
@@ -27038,7 +27151,7 @@ async function snapshotWindowsDescendants(rootPid) {
27038
27151
  "Windows process-tree observation could not start"
27039
27152
  );
27040
27153
  }
27041
- return new Promise((resolve19, reject3) => {
27154
+ return new Promise((resolve20, reject3) => {
27042
27155
  let done = false;
27043
27156
  const timeout = setTimeout(() => {
27044
27157
  if (done) return;
@@ -27065,7 +27178,7 @@ async function snapshotWindowsDescendants(rootPid) {
27065
27178
  return;
27066
27179
  }
27067
27180
  try {
27068
- resolve19(completeWindowsDescendantPids(rootPid, processes));
27181
+ resolve20(completeWindowsDescendantPids(rootPid, processes));
27069
27182
  } catch (caught) {
27070
27183
  reject3(caught);
27071
27184
  }
@@ -27112,7 +27225,7 @@ async function waitForProcessesExit(pids, timeoutMs) {
27112
27225
  }
27113
27226
  async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, independentlyTrackedPids = []) {
27114
27227
  const trustedCommand = command ?? defaultTaskkillCommand();
27115
- const result = await new Promise((resolve19, reject3) => {
27228
+ const result = await new Promise((resolve20, reject3) => {
27116
27229
  const killer = spawn3(trustedCommand, ["/PID", String(pid), "/T", "/F"], {
27117
27230
  stdio: ["ignore", "pipe", "pipe"],
27118
27231
  windowsHide: true
@@ -27147,7 +27260,7 @@ async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, indepe
27147
27260
  done = true;
27148
27261
  clearTimeout(timeout);
27149
27262
  if (error52) reject3(error52);
27150
- else resolve19({ code: killer.exitCode, output, outputTruncated });
27263
+ else resolve20({ code: killer.exitCode, output, outputTruncated });
27151
27264
  };
27152
27265
  killer.once(
27153
27266
  "error",
@@ -27951,12 +28064,12 @@ async function createWindowsJobContainment(pid, options) {
27951
28064
  stderr = `${stderr}${String(chunk)}`.slice(-HELPER_OUTPUT_LIMIT);
27952
28065
  });
27953
28066
  const helperEvents = helper;
27954
- const exited = new Promise((resolve19) => {
28067
+ const exited = new Promise((resolve20) => {
27955
28068
  let completed = false;
27956
28069
  const complete = (code, signal) => {
27957
28070
  if (completed) return;
27958
28071
  completed = true;
27959
- resolve19({ code, signal });
28072
+ resolve20({ code, signal });
27960
28073
  };
27961
28074
  helperEvents.once("error", () => {
27962
28075
  failProtocol(new Error("Windows Job Object helper could not start"));
@@ -27969,7 +28082,7 @@ async function createWindowsJobContainment(pid, options) {
27969
28082
  });
27970
28083
  const nextLine = async (expected) => {
27971
28084
  if (protocolFailure) throw protocolFailure;
27972
- const line = lines.shift() ?? await new Promise((resolve19, reject3) => {
28085
+ const line = lines.shift() ?? await new Promise((resolve20, reject3) => {
27973
28086
  const timer = setTimeout(
27974
28087
  () => reject3(timeoutError("Windows Job Object helper did not answer in time")),
27975
28088
  timeoutMs
@@ -27977,7 +28090,7 @@ async function createWindowsJobContainment(pid, options) {
27977
28090
  timer.unref?.();
27978
28091
  lineWaiters.push((value) => {
27979
28092
  clearTimeout(timer);
27980
- resolve19(value);
28093
+ resolve20(value);
27981
28094
  });
27982
28095
  });
27983
28096
  if (protocolFailure) throw protocolFailure;
@@ -27990,8 +28103,8 @@ async function createWindowsJobContainment(pid, options) {
27990
28103
  }
27991
28104
  const stopped = await Promise.race([
27992
28105
  exited.then(() => true),
27993
- new Promise((resolve19) => {
27994
- const timer = setTimeout(() => resolve19(false), timeoutMs);
28106
+ new Promise((resolve20) => {
28107
+ const timer = setTimeout(() => resolve20(false), timeoutMs);
27995
28108
  timer.unref?.();
27996
28109
  })
27997
28110
  ]);
@@ -28050,7 +28163,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
28050
28163
  if (nonce === void 0) return true;
28051
28164
  if (!SAFE_NONCE2.test(nonce)) return false;
28052
28165
  const expected = windowsContainmentGate(nonce).trimEnd();
28053
- return new Promise((resolve19) => {
28166
+ return new Promise((resolve20) => {
28054
28167
  let pending = Buffer.alloc(0);
28055
28168
  let settled = false;
28056
28169
  const finish = (result) => {
@@ -28061,7 +28174,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
28061
28174
  input.off("end", onEnd);
28062
28175
  input.off("error", onEnd);
28063
28176
  if (result) input.pause();
28064
- resolve19(result);
28177
+ resolve20(result);
28065
28178
  };
28066
28179
  const onData = (chunk) => {
28067
28180
  pending = Buffer.concat([pending, chunk]);
@@ -29165,7 +29278,7 @@ async function installRelease(version2, options = {}) {
29165
29278
  }) : Promise.resolve(null);
29166
29279
  const timeoutMs = options.timeoutMs ?? INSTALL_TIMEOUT_MS2;
29167
29280
  const outcome = { code: null, signal: null, timedOut: false, spawnError: null };
29168
- const installed = await new Promise((resolve19, reject3) => {
29281
+ const installed = await new Promise((resolve20, reject3) => {
29169
29282
  let finished = false;
29170
29283
  let cleanupStarted = false;
29171
29284
  let exitObserved = false;
@@ -29181,7 +29294,7 @@ async function installRelease(version2, options = {}) {
29181
29294
  finished = true;
29182
29295
  clearTimeout(timer);
29183
29296
  options.signal?.removeEventListener("abort", requestCleanup);
29184
- resolve19(result);
29297
+ resolve20(result);
29185
29298
  };
29186
29299
  const requestCleanup = () => {
29187
29300
  if (cleanupStarted || finished) return;
@@ -29546,11 +29659,11 @@ async function runWorkerCompatibilityProxy(env = process.env, argv = process.arg
29546
29659
  child.stdin?.on("error", () => {
29547
29660
  });
29548
29661
  process.stdin.pipe(child.stdin);
29549
- return new Promise((resolve19) => {
29550
- child.once("error", () => resolve19(1));
29662
+ return new Promise((resolve20) => {
29663
+ child.once("error", () => resolve20(1));
29551
29664
  child.once("exit", (code) => {
29552
29665
  process.stdin.unpipe(child.stdin);
29553
- resolve19(code ?? 1);
29666
+ resolve20(code ?? 1);
29554
29667
  });
29555
29668
  });
29556
29669
  }
@@ -29630,11 +29743,11 @@ async function launchHostSupervisor(options = {}) {
29630
29743
  const waitOrStop = async (ms) => {
29631
29744
  if (stopping) return false;
29632
29745
  if (!customDelay) {
29633
- await new Promise((resolve19) => {
29746
+ await new Promise((resolve20) => {
29634
29747
  const finish = () => {
29635
29748
  clearTimeout(timer);
29636
29749
  stopController.signal.removeEventListener("abort", finish);
29637
- resolve19();
29750
+ resolve20();
29638
29751
  };
29639
29752
  const timer = setTimeout(finish, ms);
29640
29753
  stopController.signal.addEventListener("abort", finish, { once: true });
@@ -29642,8 +29755,8 @@ async function launchHostSupervisor(options = {}) {
29642
29755
  return !stopping;
29643
29756
  }
29644
29757
  let finishStop;
29645
- const stopped = new Promise((resolve19) => {
29646
- finishStop = () => resolve19();
29758
+ const stopped = new Promise((resolve20) => {
29759
+ finishStop = () => resolve20();
29647
29760
  stopController.signal.addEventListener("abort", finishStop, { once: true });
29648
29761
  });
29649
29762
  await Promise.race([customDelay(ms), stopped]);
@@ -29773,19 +29886,19 @@ async function launchHostSupervisor(options = {}) {
29773
29886
  child = spawnSupervisor(entry, version2, ownershipDirectory, containmentGateNonce);
29774
29887
  const launchedSupervisor = child;
29775
29888
  let resolveChildExited;
29776
- const childExited = new Promise((resolve19) => {
29777
- resolveChildExited = resolve19;
29889
+ const childExited = new Promise((resolve20) => {
29890
+ resolveChildExited = resolve20;
29778
29891
  });
29779
29892
  const supervisorContainmentAbort = new AbortController();
29780
29893
  void childExited.then(() => supervisorContainmentAbort.abort());
29781
29894
  const outcomePromise = new Promise(
29782
- (resolve19) => {
29895
+ (resolve20) => {
29783
29896
  let observed = false;
29784
29897
  const finish = (code, signal) => {
29785
29898
  if (observed) return;
29786
29899
  observed = true;
29787
29900
  resolveChildExited();
29788
- resolve19({ code, signal });
29901
+ resolve20({ code, signal });
29789
29902
  };
29790
29903
  child.once("error", () => finish(1, null));
29791
29904
  child.once("exit", finish);
@@ -29806,12 +29919,12 @@ async function launchHostSupervisor(options = {}) {
29806
29919
  if (!supervisorContainment || !launchedSupervisor.stdin) {
29807
29920
  throw new Error("supervisor Job Object gate is unavailable");
29808
29921
  }
29809
- await new Promise((resolve19, reject3) => {
29922
+ await new Promise((resolve20, reject3) => {
29810
29923
  launchedSupervisor.stdin.write(
29811
29924
  windowsContainmentGate(containmentGateNonce),
29812
29925
  (error52) => {
29813
29926
  if (error52) reject3(error52);
29814
- else resolve19();
29927
+ else resolve20();
29815
29928
  }
29816
29929
  );
29817
29930
  });
@@ -29959,19 +30072,19 @@ async function superviseHost(options = {}) {
29959
30072
  }
29960
30073
  }
29961
30074
  let announceShutdown;
29962
- const shutdownAnnounced = new Promise((resolve19) => {
29963
- announceShutdown = resolve19;
30075
+ const shutdownAnnounced = new Promise((resolve20) => {
30076
+ announceShutdown = resolve20;
29964
30077
  });
29965
30078
  const attempted = /* @__PURE__ */ new Set();
29966
30079
  let unsatisfiableUpdates = 0;
29967
30080
  const waitOrShutdown = async (ms) => {
29968
30081
  if (shuttingDown2) return false;
29969
30082
  if (!customDelay) {
29970
- await new Promise((resolve19) => {
30083
+ await new Promise((resolve20) => {
29971
30084
  const finish = () => {
29972
30085
  clearTimeout(timer);
29973
30086
  shutdownController.signal.removeEventListener("abort", finish);
29974
- resolve19();
30087
+ resolve20();
29975
30088
  };
29976
30089
  const timer = setTimeout(finish, ms);
29977
30090
  shutdownController.signal.addEventListener("abort", finish, { once: true });
@@ -30121,19 +30234,19 @@ async function superviseHost(options = {}) {
30121
30234
  const watchedChild = child;
30122
30235
  const workerStderr = captureWorkerStderr(watchedChild);
30123
30236
  let resolveChildExited;
30124
- const childExited = new Promise((resolve19) => {
30125
- resolveChildExited = resolve19;
30237
+ const childExited = new Promise((resolve20) => {
30238
+ resolveChildExited = resolve20;
30126
30239
  });
30127
30240
  const workerContainmentAbort = new AbortController();
30128
30241
  void childExited.then(() => workerContainmentAbort.abort());
30129
30242
  const outcomePromise = new Promise(
30130
- (resolve19) => {
30243
+ (resolve20) => {
30131
30244
  let observed = false;
30132
30245
  const finish = (result) => {
30133
30246
  if (observed) return;
30134
30247
  observed = true;
30135
30248
  resolveChildExited();
30136
- resolve19(result);
30249
+ resolve20(result);
30137
30250
  };
30138
30251
  watchedChild.once("error", () => finish({ code: 1, signal: null }));
30139
30252
  watchedChild.once(
@@ -30155,10 +30268,10 @@ async function superviseHost(options = {}) {
30155
30268
  if (!workerContainment || !watchedChild.stdin) {
30156
30269
  throw new Error("worker Job Object gate is unavailable");
30157
30270
  }
30158
- await new Promise((resolve19, reject3) => {
30271
+ await new Promise((resolve20, reject3) => {
30159
30272
  watchedChild.stdin.write(windowsContainmentGate(containmentGateNonce), (error52) => {
30160
30273
  if (error52) reject3(error52);
30161
- else resolve19();
30274
+ else resolve20();
30162
30275
  });
30163
30276
  });
30164
30277
  }
@@ -31336,7 +31449,7 @@ async function loadPlaywright() {
31336
31449
  }
31337
31450
  async function installChromium() {
31338
31451
  const cliPath = join12(playwrightCoreRoot, "cli.js");
31339
- await new Promise((resolve19, reject3) => {
31452
+ await new Promise((resolve20, reject3) => {
31340
31453
  const child = spawn7(process.execPath, [cliPath, "install", "chromium"], {
31341
31454
  env: process.env,
31342
31455
  stdio: ["ignore", "inherit", "inherit"],
@@ -31351,7 +31464,7 @@ async function installChromium() {
31351
31464
  settled = true;
31352
31465
  clearTimeout(timeout);
31353
31466
  if (error52) reject3(error52);
31354
- else resolve19();
31467
+ else resolve20();
31355
31468
  };
31356
31469
  const timeout = setTimeout(() => {
31357
31470
  child.kill();
@@ -31971,9 +32084,9 @@ function createPlaywrightBrowserAdapterFactory(dependencies = {}) {
31971
32084
  // src/runners/cli-runner.ts
31972
32085
  import { spawn as spawn11 } from "node:child_process";
31973
32086
  import { randomUUID as randomUUID12 } from "node:crypto";
31974
- import { lstat as lstat11, mkdir as mkdir13, realpath as realpath8 } from "node:fs/promises";
32087
+ import { lstat as lstat11, mkdir as mkdir14, realpath as realpath8 } from "node:fs/promises";
31975
32088
  import { homedir as homedir7 } from "node:os";
31976
- import { dirname as dirname10, isAbsolute as isAbsolute16, join as join19, resolve as resolve10 } from "node:path";
32089
+ import { dirname as dirname10, isAbsolute as isAbsolute17, join as join20, resolve as resolve11 } from "node:path";
31977
32090
 
31978
32091
  // src/tool-packs/browser/authentication-wall.ts
31979
32092
  var AUTH_PATH_SEGMENT = /(?:^|\/)(?:log[-_]?in|sign[-_]?in|sso|saml|auth|authorize|authenticate|oauth2?|session\/new|checkpoint)(?:\/|$)/i;
@@ -35155,8 +35268,8 @@ async function runGit(input, args, env) {
35155
35268
  let settled = false;
35156
35269
  let stopping = false;
35157
35270
  let resolveExited;
35158
- const exited = new Promise((resolve19) => {
35159
- resolveExited = resolve19;
35271
+ const exited = new Promise((resolve20) => {
35272
+ resolveExited = resolve20;
35160
35273
  });
35161
35274
  child.once("exit", resolveExited);
35162
35275
  const cleanup = () => {
@@ -37966,8 +38079,8 @@ var linearToolPackFactory = {
37966
38079
  async create(grant, context) {
37967
38080
  let resolveCancelled;
37968
38081
  let closed = false;
37969
- const cancelled = new Promise((resolve19) => {
37970
- resolveCancelled = resolve19;
38082
+ const cancelled = new Promise((resolve20) => {
38083
+ resolveCancelled = resolve20;
37971
38084
  });
37972
38085
  const cancel = () => {
37973
38086
  if (closed) return;
@@ -39188,6 +39301,47 @@ var TOOLS = [
39188
39301
  required: ["agent_id"]
39189
39302
  }
39190
39303
  },
39304
+ {
39305
+ name: "get_company_asset",
39306
+ description: "Download one of the shared company files into your working folder and get back its path, so you can read or use it like any other file. Ask for it by the name shown in the company files list - the logo, the brand guidelines, a price list. Use this instead of describing or recreating something the company already has.",
39307
+ inputSchema: {
39308
+ type: "object",
39309
+ properties: {
39310
+ name: { type: "string", description: "The company file name." }
39311
+ },
39312
+ required: ["name"]
39313
+ }
39314
+ },
39315
+ {
39316
+ name: "put_company_asset",
39317
+ description: "Keep a file from your working folder as a shared company file, so every teammate can use it later. Use it for something the whole company should reuse, not for this task working output. Writing a name that already exists replaces that file.",
39318
+ inputSchema: {
39319
+ type: "object",
39320
+ properties: {
39321
+ name: { type: "string", description: "Short name teammates will ask for it by." },
39322
+ path: { type: "string", description: "Path to the file in your working folder." },
39323
+ kind: {
39324
+ type: "string",
39325
+ enum: ["logo", "image", "document", "text", "data", "other"],
39326
+ description: "What sort of file this is."
39327
+ },
39328
+ purpose: {
39329
+ type: "string",
39330
+ description: "One line: what it is and when a teammate should reach for it."
39331
+ }
39332
+ },
39333
+ required: ["name", "path", "kind", "purpose"]
39334
+ }
39335
+ },
39336
+ {
39337
+ name: "forget_company_asset",
39338
+ description: "Remove a shared company file that is out of date or was never right, by its name.",
39339
+ inputSchema: {
39340
+ type: "object",
39341
+ properties: { name: { type: "string", description: "The company file name." } },
39342
+ required: ["name"]
39343
+ }
39344
+ },
39191
39345
  {
39192
39346
  name: "note_company_fact",
39193
39347
  description: "Keep one short fact about the organization you work for in the shared company profile, which every teammate and the manager read on every task: what the business does, who it serves, how customers reach it, how it operates, how it sounds, or who it competes with. Use it when you learn something durable about the business itself, and to correct a fact that is wrong - writing the same section and subject again replaces the earlier text. This is not your own memory: use remember for what you learned about a project or this machine, and this for what is true about the company.",
@@ -39579,6 +39733,8 @@ function opFor(name, args) {
39579
39733
  }
39580
39734
  case "forget_company_fact":
39581
39735
  return { kind: "company.forget", entryId: str("entry_id") };
39736
+ case "forget_company_asset":
39737
+ return { kind: "asset.forget", name: str("name") };
39582
39738
  case "list_workspaces":
39583
39739
  return { kind: "workspace.list" };
39584
39740
  case "add_workspace":
@@ -39680,7 +39836,7 @@ function createAskUserServer() {
39680
39836
  let server;
39681
39837
  let listening;
39682
39838
  function ensureListening() {
39683
- listening ??= new Promise((resolve19, reject3) => {
39839
+ listening ??= new Promise((resolve20, reject3) => {
39684
39840
  server = createServer2((req, res) => {
39685
39841
  res.on("error", () => {
39686
39842
  });
@@ -39696,7 +39852,7 @@ function createAskUserServer() {
39696
39852
  server.on("error", reject3);
39697
39853
  server.listen(0, "127.0.0.1", () => {
39698
39854
  const address = server.address();
39699
- if (address && typeof address === "object") resolve19(address.port);
39855
+ if (address && typeof address === "object") resolve20(address.port);
39700
39856
  else reject3(new Error("ask_user server failed to bind"));
39701
39857
  });
39702
39858
  server.unref();
@@ -39883,6 +40039,34 @@ function createAskUserServer() {
39883
40039
  }
39884
40040
  return;
39885
40041
  }
40042
+ if (surface.platform && (name === "get_company_asset" || name === "put_company_asset")) {
40043
+ const companyAssets = handlers.companyAssets;
40044
+ if (!companyAssets) {
40045
+ toolText("company files are unavailable for this runner", true);
40046
+ return;
40047
+ }
40048
+ const assetName = typeof args["name"] === "string" ? args["name"] : "";
40049
+ if (!assetName) {
40050
+ toolText("missing required argument `name`", true);
40051
+ return;
40052
+ }
40053
+ try {
40054
+ const outcome = name === "get_company_asset" ? await companyAssets.get(assetName) : await companyAssets.put({
40055
+ name: assetName,
40056
+ path: typeof args["path"] === "string" ? args["path"] : "",
40057
+ kind: typeof args["kind"] === "string" ? args["kind"] : "other",
40058
+ purpose: typeof args["purpose"] === "string" ? args["purpose"] : ""
40059
+ });
40060
+ if (outcome.ok) toolText(JSON.stringify(outcome.result ?? { ok: true }, null, 2));
40061
+ else toolText(outcome.error ?? "the company file could not be used", true);
40062
+ } catch (err) {
40063
+ toolText(
40064
+ `the company file could not be used: ${String(err instanceof Error ? err.message : err)}`,
40065
+ true
40066
+ );
40067
+ }
40068
+ return;
40069
+ }
39886
40070
  if (surface.platform && name === "publish_file") {
39887
40071
  if (!handlers.publishFile) {
39888
40072
  toolText("file publishing is unavailable for this runner", true);
@@ -40077,8 +40261,137 @@ function createAskUserServer() {
40077
40261
  };
40078
40262
  }
40079
40263
 
40264
+ // src/runners/company-assets.ts
40265
+ import { mkdir as mkdir12, readFile as readFile11, writeFile as writeFile8 } from "node:fs/promises";
40266
+ import { isAbsolute as isAbsolute14, join as join18, resolve as resolve9 } from "node:path";
40267
+ var MAX_PUT_BYTES = 5 * 1024 * 1024;
40268
+ function parseRef(result) {
40269
+ if (!result || typeof result !== "object") return null;
40270
+ const asset = result.asset;
40271
+ if (!asset || typeof asset !== "object") return null;
40272
+ const candidate = asset;
40273
+ if (typeof candidate["id"] !== "string" || typeof candidate["name"] !== "string" || typeof candidate["mediaType"] !== "string" || typeof candidate["size"] !== "number" || typeof candidate["kind"] !== "string" || typeof candidate["purpose"] !== "string") {
40274
+ return null;
40275
+ }
40276
+ return candidate;
40277
+ }
40278
+ function extensionFor(mediaType) {
40279
+ const known = {
40280
+ "image/svg+xml": ".svg",
40281
+ "image/png": ".png",
40282
+ "image/jpeg": ".jpg",
40283
+ "image/webp": ".webp",
40284
+ "image/gif": ".gif",
40285
+ "application/pdf": ".pdf",
40286
+ "text/plain": ".txt",
40287
+ "text/markdown": ".md",
40288
+ "text/csv": ".csv",
40289
+ "application/json": ".json"
40290
+ };
40291
+ return known[mediaType.toLowerCase()] ?? "";
40292
+ }
40293
+ function createCompanyAssetHandlers(io) {
40294
+ return {
40295
+ async get(name) {
40296
+ const resolved = await io.agentOp({ kind: "asset.resolve", name });
40297
+ if (!resolved.ok) {
40298
+ return { ok: false, error: resolved.error ?? `no company file named "${name}"` };
40299
+ }
40300
+ const ref2 = parseRef(resolved.result);
40301
+ if (!ref2) return { ok: false, error: "the company file could not be identified" };
40302
+ const bytes = await io.fetchCompanyAsset(ref2.id);
40303
+ if (bytes.byteLength !== ref2.size) {
40304
+ return {
40305
+ ok: false,
40306
+ error: `the company file "${ref2.name}" arrived incomplete (${bytes.byteLength} of ${ref2.size} bytes)`
40307
+ };
40308
+ }
40309
+ const directory = join18(io.taskRoot, ".zixt-company-files", ref2.id);
40310
+ await mkdir12(directory, { recursive: true });
40311
+ const base = sanitizeAttachmentFileName(ref2.name) || "file";
40312
+ const fileName = base.includes(".") ? base : `${base}${extensionFor(ref2.mediaType)}`;
40313
+ const path = join18(directory, fileName);
40314
+ await writeFile8(path, bytes);
40315
+ return {
40316
+ ok: true,
40317
+ result: {
40318
+ path,
40319
+ name: ref2.name,
40320
+ kind: ref2.kind,
40321
+ mediaType: ref2.mediaType,
40322
+ size: ref2.size,
40323
+ purpose: ref2.purpose
40324
+ }
40325
+ };
40326
+ },
40327
+ async put(input) {
40328
+ if (!input.path) return { ok: false, error: "missing required argument `path`" };
40329
+ if (!input.purpose) {
40330
+ return { ok: false, error: "say in one line what this file is for" };
40331
+ }
40332
+ const candidate = isAbsolute14(input.path) ? input.path : resolve9(io.cwd, input.path);
40333
+ const permitted = io.allowedRoots.some((root) => {
40334
+ const normalized = resolve9(root);
40335
+ return candidate === normalized || candidate.startsWith(`${normalized}${sep6()}`);
40336
+ });
40337
+ if (!permitted) {
40338
+ return { ok: false, error: "that file is outside the folders this task may read" };
40339
+ }
40340
+ let bytes;
40341
+ try {
40342
+ bytes = new Uint8Array(await readFile11(candidate));
40343
+ } catch {
40344
+ return { ok: false, error: `the file at ${input.path} could not be read` };
40345
+ }
40346
+ if (bytes.byteLength === 0) return { ok: false, error: "that file is empty" };
40347
+ if (bytes.byteLength > MAX_PUT_BYTES) {
40348
+ return { ok: false, error: "that file is too large to keep as a company file" };
40349
+ }
40350
+ const outcome = await io.agentOp({
40351
+ kind: "asset.put",
40352
+ name: input.name,
40353
+ assetKind: assetKindOf(input.kind),
40354
+ purpose: input.purpose,
40355
+ mediaType: mediaTypeFor(candidate),
40356
+ size: bytes.byteLength,
40357
+ data: Buffer.from(bytes).toString("base64")
40358
+ });
40359
+ if (!outcome.ok) {
40360
+ return { ok: false, error: outcome.error ?? "the company file could not be kept" };
40361
+ }
40362
+ return { ok: true, result: outcome.result ?? { ok: true } };
40363
+ }
40364
+ };
40365
+ }
40366
+ function sep6() {
40367
+ return process.platform === "win32" ? "\\" : "/";
40368
+ }
40369
+ function assetKindOf(kind) {
40370
+ return kind === "logo" || kind === "image" || kind === "document" || kind === "text" || kind === "data" ? kind : "other";
40371
+ }
40372
+ function mediaTypeFor(path) {
40373
+ const lower = path.toLowerCase();
40374
+ const byExtension = [
40375
+ [".svg", "image/svg+xml"],
40376
+ [".png", "image/png"],
40377
+ [".jpg", "image/jpeg"],
40378
+ [".jpeg", "image/jpeg"],
40379
+ [".webp", "image/webp"],
40380
+ [".gif", "image/gif"],
40381
+ [".pdf", "application/pdf"],
40382
+ [".md", "text/markdown"],
40383
+ [".txt", "text/plain"],
40384
+ [".csv", "text/csv"],
40385
+ [".json", "application/json"]
40386
+ ];
40387
+ for (const [extension, mediaType] of byExtension) {
40388
+ if (lower.endsWith(extension)) return mediaType;
40389
+ }
40390
+ return "application/octet-stream";
40391
+ }
40392
+
40080
40393
  // src/runners/runner-env.ts
40081
- import { delimiter as delimiter2, isAbsolute as isAbsolute14 } from "node:path";
40394
+ import { delimiter as delimiter2, isAbsolute as isAbsolute15 } from "node:path";
40082
40395
  var PROVIDER_AUTHORITY_PREFIXES = ["GH_", "GITHUB_", "GIT_", "SSH_"];
40083
40396
  var HOST_AUTHORITY_PREFIXES = [
40084
40397
  "ZIXT_",
@@ -40137,7 +40450,7 @@ function inheritedValue(env, name) {
40137
40450
  }
40138
40451
  function sanitizeInheritedSearchPath(path) {
40139
40452
  if (!path) return "";
40140
- return path.split(delimiter2).filter((entry) => entry !== "" && isAbsolute14(entry)).join(delimiter2);
40453
+ return path.split(delimiter2).filter((entry) => entry !== "" && isAbsolute15(entry)).join(delimiter2);
40141
40454
  }
40142
40455
  function buildRunnerEnv(input) {
40143
40456
  const env = {};
@@ -40153,7 +40466,7 @@ function buildRunnerEnv(input) {
40153
40466
  }
40154
40467
  const searchPath = [
40155
40468
  sanitizeInheritedSearchPath(inheritedValue(input.inherited, "PATH")),
40156
- ...(input.softwareToolsPath ?? []).filter((entry) => isAbsolute14(entry))
40469
+ ...(input.softwareToolsPath ?? []).filter((entry) => isAbsolute15(entry))
40157
40470
  ].filter((entry) => entry !== "").join(delimiter2);
40158
40471
  const gitConfig = input.githubShell ? [
40159
40472
  ["credential.helper", ""],
@@ -40221,9 +40534,9 @@ function buildRunnerEnv(input) {
40221
40534
  // src/runners/github-shell-auth.ts
40222
40535
  import { execFile } from "node:child_process";
40223
40536
  import { randomBytes as randomBytes2, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
40224
- import { chmod as chmod7, lstat as lstat10, mkdir as mkdir12, realpath as realpath7, writeFile as writeFile8 } from "node:fs/promises";
40537
+ import { chmod as chmod7, lstat as lstat10, mkdir as mkdir13, realpath as realpath7, writeFile as writeFile9 } from "node:fs/promises";
40225
40538
  import { createServer as createServer3 } from "node:http";
40226
- import { isAbsolute as isAbsolute15, join as join18, relative as relative9 } from "node:path";
40539
+ import { isAbsolute as isAbsolute16, join as join19, relative as relative9 } from "node:path";
40227
40540
  var MAX_REQUEST_BYTES2 = 16 * 1024;
40228
40541
  var DIRECTORY_MODE4 = 448;
40229
40542
  var PRIVATE_FILE_MODE = 384;
@@ -40429,7 +40742,7 @@ function parseGhInvocation(body) {
40429
40742
  }
40430
40743
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
40431
40744
  const { args, cwd } = value;
40432
- if (!Array.isArray(args) || args.length > 256 || args.some((argument) => typeof argument !== "string" || argument.length > 4096) || typeof cwd !== "string" || cwd.length === 0 || cwd.length > 4096 || !isAbsolute15(cwd)) {
40745
+ if (!Array.isArray(args) || args.length > 256 || args.some((argument) => typeof argument !== "string" || argument.length > 4096) || typeof cwd !== "string" || cwd.length === 0 || cwd.length > 4096 || !isAbsolute16(cwd)) {
40433
40746
  return null;
40434
40747
  }
40435
40748
  return { args, cwd };
@@ -40588,7 +40901,7 @@ function activationCredential(grant, now = Date.now()) {
40588
40901
  }
40589
40902
  function assertChildPath2(parent, child) {
40590
40903
  const path = relative9(parent, child);
40591
- if (!path || path === ".." || path.startsWith("../") || path.startsWith("..\\") || isAbsolute15(path)) {
40904
+ if (!path || path === ".." || path.startsWith("../") || path.startsWith("..\\") || isAbsolute16(path)) {
40592
40905
  throw new Error("GitHub shell helper path escaped its private run directory");
40593
40906
  }
40594
40907
  }
@@ -40599,7 +40912,7 @@ function quoteForPosixShell(value) {
40599
40912
  return quoteForGitShell2(value);
40600
40913
  }
40601
40914
  async function writePrivate(path, content, executable = false) {
40602
- await writeFile8(path, content, {
40915
+ await writeFile9(path, content, {
40603
40916
  flag: "wx",
40604
40917
  mode: executable ? EXECUTABLE_FILE_MODE : PRIVATE_FILE_MODE
40605
40918
  });
@@ -40611,7 +40924,7 @@ async function prepareHelpers(input) {
40611
40924
  throw new Error("GitHub shell authentication requires a private real run directory");
40612
40925
  }
40613
40926
  const runRoot = await realpath7(input.runRoot);
40614
- const helperPath = join18(runRoot, "github-shell-git-credential.cjs");
40927
+ const helperPath = join19(runRoot, "github-shell-git-credential.cjs");
40615
40928
  assertChildPath2(runRoot, helperPath);
40616
40929
  await writePrivate(helperPath, GIT_HELPER_SOURCE);
40617
40930
  if (!input.ghExecutablePath) {
@@ -40622,14 +40935,14 @@ async function prepareHelpers(input) {
40622
40935
  wrapperSourcePath: null
40623
40936
  };
40624
40937
  }
40625
- const shellToolsDirectory = join18(runRoot, "shell-tools");
40938
+ const shellToolsDirectory = join19(runRoot, "shell-tools");
40626
40939
  assertChildPath2(runRoot, shellToolsDirectory);
40627
- await mkdir12(shellToolsDirectory, { mode: DIRECTORY_MODE4 });
40940
+ await mkdir13(shellToolsDirectory, { mode: DIRECTORY_MODE4 });
40628
40941
  await chmod7(shellToolsDirectory, DIRECTORY_MODE4);
40629
- const wrapperSourcePath = join18(runRoot, "github-shell-gh-wrapper.cjs");
40942
+ const wrapperSourcePath = join19(runRoot, "github-shell-gh-wrapper.cjs");
40630
40943
  assertChildPath2(runRoot, wrapperSourcePath);
40631
40944
  await writePrivate(wrapperSourcePath, GH_WRAPPER_SOURCE);
40632
- const wrapperPath = join18(shellToolsDirectory, process.platform === "win32" ? "gh.cmd" : "gh");
40945
+ const wrapperPath = join19(shellToolsDirectory, process.platform === "win32" ? "gh.cmd" : "gh");
40633
40946
  assertChildPath2(runRoot, wrapperPath);
40634
40947
  const launcher = process.platform === "win32" ? `@"${process.execPath.replaceAll('"', '""')}" "${wrapperSourcePath.replaceAll('"', '""')}" %*\r
40635
40948
  ` : `#!/bin/sh
@@ -40853,7 +41166,7 @@ password=${credential.accessToken}
40853
41166
 
40854
41167
  // src/runners/working-context.ts
40855
41168
  import { spawn as spawn10 } from "node:child_process";
40856
- import { resolve as resolve9 } from "node:path";
41169
+ import { resolve as resolve10 } from "node:path";
40857
41170
  var COMMAND_TIMEOUT_MS = 5e3;
40858
41171
  var OUTPUT_LIMIT_BYTES = 128 * 1024;
40859
41172
  var COMMAND_STOP_TIMEOUT_MS = 2e4;
@@ -41248,8 +41561,8 @@ async function repositoryState(directory, git, env, signal) {
41248
41561
  const pathLines = paths.trim().split(/\r?\n/);
41249
41562
  if (pathLines.length < 3 || !pathLines[0] || !pathLines[1] || !pathLines[2]) return null;
41250
41563
  const root = pathLines[0];
41251
- const gitDirectory = resolve9(directory, pathLines[1]);
41252
- const commonDirectory = resolve9(directory, pathLines[2]);
41564
+ const gitDirectory = resolve10(directory, pathLines[1]);
41565
+ const commonDirectory = resolve10(directory, pathLines[2]);
41253
41566
  const records = status.split(/\0|\r?\n/).filter(Boolean);
41254
41567
  const rawBranch = statusField(records, "branch.head");
41255
41568
  if (!rawBranch || rawBranch.length > 512 || !isSafeSingleLineDisplayText(rawBranch)) return null;
@@ -41424,7 +41737,7 @@ async function settlesWithin(promise2, timeoutMs) {
41424
41737
  }
41425
41738
  }
41426
41739
  function defaultRunnerWorkspaceRoot() {
41427
- return join19(homedir7(), ".zixt", "workspaces");
41740
+ return join20(homedir7(), ".zixt", "workspaces");
41428
41741
  }
41429
41742
  function defaultRunnerArtifactRoot() {
41430
41743
  return defaultRunArtifactRoot();
@@ -41473,7 +41786,7 @@ function createCliRunner(adapter, opts = {}) {
41473
41786
  const prefixArgs = opts.commandPrefixArgs ?? [];
41474
41787
  const maxWallTimeMs = opts.maxWallTimeMs;
41475
41788
  const workspaceRoot = opts.workspaceRoot ?? defaultRunnerWorkspaceRoot();
41476
- const artifactRoot = opts.artifactRoot ?? (opts.workspaceRoot === void 0 ? defaultRunnerArtifactRoot() : join19(dirname10(workspaceRoot), "run-artifacts"));
41789
+ const artifactRoot = opts.artifactRoot ?? (opts.workspaceRoot === void 0 ? defaultRunnerArtifactRoot() : join20(dirname10(workspaceRoot), "run-artifacts"));
41477
41790
  const runRegistryRoot2 = opts.runRegistryRoot ?? defaultRunRegistryRoot();
41478
41791
  const createArtifacts = opts.createArtifacts ?? createRunArtifacts;
41479
41792
  const toolPackRegistry2 = opts.toolPackRegistry ?? createDefaultToolPackRegistry();
@@ -41491,7 +41804,7 @@ function createCliRunner(adapter, opts = {}) {
41491
41804
  };
41492
41805
  const askUserServer = createAskUserServer();
41493
41806
  const windowsRoot = process.env.SystemRoot ?? process.env.WINDIR;
41494
- const windowsComspecCandidate = process.platform === "win32" && windowsRoot ? join19(windowsRoot, "System32", "cmd.exe") : void 0;
41807
+ const windowsComspecCandidate = process.platform === "win32" && windowsRoot ? join20(windowsRoot, "System32", "cmd.exe") : void 0;
41495
41808
  let safetyFailure;
41496
41809
  return async (task) => {
41497
41810
  if (safetyFailure) {
@@ -41531,8 +41844,8 @@ function createCliRunner(adapter, opts = {}) {
41531
41844
  usage: { inputTokens: 0, outputTokens: 0 }
41532
41845
  };
41533
41846
  }
41534
- const taskRoot = join19(workspaceRoot, task.agentId);
41535
- await mkdir13(taskRoot, { recursive: true });
41847
+ const taskRoot = join20(workspaceRoot, task.agentId);
41848
+ await mkdir14(taskRoot, { recursive: true });
41536
41849
  if (task.cancelledNow()) return cancelledBeforeRun();
41537
41850
  const configuredWorkspace = task.spec.workspace;
41538
41851
  let cwd = taskRoot;
@@ -41558,12 +41871,19 @@ function createCliRunner(adapter, opts = {}) {
41558
41871
  outcome.ok && outcome.result && typeof outcome.result === "object" ? outcome.result["artifact"] : void 0
41559
41872
  );
41560
41873
  if (parsed.success) {
41561
- const candidate = resolve10(cwd, path);
41874
+ const candidate = resolve11(cwd, path);
41562
41875
  const key = await realpath8(candidate).catch(() => candidate);
41563
41876
  publishedTaskFiles.set(key, parsed.data);
41564
41877
  }
41565
41878
  return outcome;
41566
41879
  };
41880
+ const companyAssets = createCompanyAssetHandlers({
41881
+ agentOp: (op) => task.agentOp(op),
41882
+ fetchCompanyAsset: (assetId) => task.fetchCompanyAsset(assetId),
41883
+ taskRoot,
41884
+ allowedRoots: [taskRoot, cwd],
41885
+ cwd
41886
+ });
41567
41887
  const [secrets, attachedConnections, providerGrants, integrationToolServers] = await Promise.all([
41568
41888
  task.secrets(),
41569
41889
  task.connections(),
@@ -41729,6 +42049,7 @@ function createCliRunner(adapter, opts = {}) {
41729
42049
  }
41730
42050
  },
41731
42051
  publishFile,
42052
+ companyAssets,
41732
42053
  // AG-4a. The person approves in the Task thread through the ordinary
41733
42054
  // approvals pipeline, so the wall clock pauses while they decide, and
41734
42055
  // a refusal is an answer the session can act on rather than a failure.
@@ -41917,7 +42238,7 @@ ${attachmentSection}` : prompt;
41917
42238
  let changed = false;
41918
42239
  for (const path of paths) {
41919
42240
  if (!path || path.length > 4096) continue;
41920
- const absolutePath = isAbsolute16(path) ? path : resolve10(cwd, path);
42241
+ const absolutePath = isAbsolute17(path) ? path : resolve11(cwd, path);
41921
42242
  const directory = dirname10(absolutePath);
41922
42243
  observedWorkingDirectories.delete(directory);
41923
42244
  observedWorkingDirectories.add(directory);
@@ -42354,7 +42675,7 @@ function runCliProcess(options) {
42354
42675
  usage: { inputTokens: 0, outputTokens: 0 }
42355
42676
  });
42356
42677
  }
42357
- return new Promise((resolve19) => {
42678
+ return new Promise((resolve20) => {
42358
42679
  const platform = options.platform ?? process.platform;
42359
42680
  const containmentGateNonce = options.guardian && platform === "win32" ? randomUUID12() : void 0;
42360
42681
  const child = options.guardian ? spawn11(
@@ -42416,7 +42737,7 @@ function runCliProcess(options) {
42416
42737
  clearInterval(timer);
42417
42738
  unregisterFollowUps?.();
42418
42739
  parser.stop?.();
42419
- resolve19(result);
42740
+ resolve20(result);
42420
42741
  };
42421
42742
  const terminate = (result) => {
42422
42743
  if (settled || forcedResult) return;
@@ -42650,7 +42971,7 @@ import { randomUUID as randomUUID13 } from "node:crypto";
42650
42971
  // src/runners/runtime-observation.ts
42651
42972
  import { open as open6, readdir as readdir6, realpath as realpath9 } from "node:fs/promises";
42652
42973
  import { homedir as homedir8 } from "node:os";
42653
- import { join as join20 } from "node:path";
42974
+ import { join as join21 } from "node:path";
42654
42975
  var READ_WINDOW_BYTES = 1024 * 1024;
42655
42976
  var CATALOG_TIMEOUT_MS = 15e3;
42656
42977
  var CATALOG_OUTPUT_LIMIT_BYTES = 4 * 1024 * 1024;
@@ -42710,9 +43031,9 @@ function displayValue(value, maxLength) {
42710
43031
  return trimmed;
42711
43032
  }
42712
43033
  function claudeTranscriptPath(input) {
42713
- const configDir = input.env["CLAUDE_CONFIG_DIR"] || join20(homeFrom(input.env), ".claude");
43034
+ const configDir = input.env["CLAUDE_CONFIG_DIR"] || join21(homeFrom(input.env), ".claude");
42714
43035
  const slug = input.resolvedCwd.replace(/[^a-zA-Z0-9]/g, "-");
42715
- return join20(configDir, "projects", slug, `${input.sessionId}.jsonl`);
43036
+ return join21(configDir, "projects", slug, `${input.sessionId}.jsonl`);
42716
43037
  }
42717
43038
  async function readClaudeSessionEffort(input) {
42718
43039
  const resolvedCwd = await realpath9(input.cwd).catch(() => input.cwd);
@@ -42728,18 +43049,18 @@ async function readClaudeSessionEffort(input) {
42728
43049
  }
42729
43050
  async function newestDirectories(root, limit) {
42730
43051
  const entries = await readdir6(root, { withFileTypes: true }).catch(() => []);
42731
- return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort((left, right) => right.localeCompare(left)).slice(0, limit).map((name) => join20(root, name));
43052
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort((left, right) => right.localeCompare(left)).slice(0, limit).map((name) => join21(root, name));
42732
43053
  }
42733
43054
  async function findCodexRolloutPath(input) {
42734
- const codexHome = input.env["CODEX_HOME"] || join20(homeFrom(input.env), ".codex");
42735
- const sessions = join20(codexHome, "sessions");
43055
+ const codexHome = input.env["CODEX_HOME"] || join21(homeFrom(input.env), ".codex");
43056
+ const sessions = join21(codexHome, "sessions");
42736
43057
  const suffix = `-${input.threadId}.jsonl`;
42737
43058
  for (const year of await newestDirectories(sessions, 2)) {
42738
43059
  for (const month of await newestDirectories(year, 2)) {
42739
43060
  for (const day of await newestDirectories(month, 3)) {
42740
43061
  const files = await readdir6(day).catch(() => []);
42741
43062
  const match = files.find((name) => name.endsWith(suffix));
42742
- if (match) return join20(day, match);
43063
+ if (match) return join21(day, match);
42743
43064
  }
42744
43065
  }
42745
43066
  }
@@ -42762,7 +43083,7 @@ async function readCodexSessionRuntime(input) {
42762
43083
  }
42763
43084
  var codexCatalogCache = /* @__PURE__ */ new Map();
42764
43085
  async function loadCodexModelCatalog(command, prefixArgs, env) {
42765
- const output = await new Promise((resolve19) => {
43086
+ const output = await new Promise((resolve20) => {
42766
43087
  const child = spawnCli(command, [...prefixArgs, "debug", "models"], {
42767
43088
  stdio: ["ignore", "pipe", "ignore"],
42768
43089
  windowsHide: true,
@@ -42777,7 +43098,7 @@ async function loadCodexModelCatalog(command, prefixArgs, env) {
42777
43098
  if (settled) return;
42778
43099
  settled = true;
42779
43100
  clearTimeout(timer);
42780
- resolve19(value);
43101
+ resolve20(value);
42781
43102
  };
42782
43103
  const timer = setTimeout(() => {
42783
43104
  child.kill();
@@ -42882,8 +43203,8 @@ function createRuntimeReporter(input, sessionId) {
42882
43203
  var EFFORT_READ_ATTEMPTS = 5;
42883
43204
  var EFFORT_READ_INTERVAL_MS = 3e3;
42884
43205
  function delay2(ms) {
42885
- return new Promise((resolve19) => {
42886
- const timer = setTimeout(resolve19, ms);
43206
+ return new Promise((resolve20) => {
43207
+ const timer = setTimeout(resolve20, ms);
42887
43208
  timer.unref?.();
42888
43209
  });
42889
43210
  }
@@ -42970,10 +43291,10 @@ function createClaudeLiveParser(onStream, onSessionModel) {
42970
43291
  },
42971
43292
  async steer(followUp) {
42972
43293
  if (!write) return false;
42973
- return await new Promise((resolve19) => {
42974
- acknowledgements.set(followUp.inputId, resolve19);
43294
+ return await new Promise((resolve20) => {
43295
+ acknowledgements.set(followUp.inputId, resolve20);
42975
43296
  void write(input(followUp.inputId, followUp.text)).catch(() => {
42976
- if (acknowledgements.delete(followUp.inputId)) resolve19(false);
43297
+ if (acknowledgements.delete(followUp.inputId)) resolve20(false);
42977
43298
  });
42978
43299
  });
42979
43300
  },
@@ -43133,22 +43454,22 @@ function improveErrorMessage(error52) {
43133
43454
  }
43134
43455
 
43135
43456
  // src/runners/codex.ts
43136
- import { mkdir as mkdir14, readFile as readFile11, writeFile as writeFile9 } from "node:fs/promises";
43457
+ import { mkdir as mkdir15, readFile as readFile12, writeFile as writeFile10 } from "node:fs/promises";
43137
43458
  import { randomUUID as randomUUID14 } from "node:crypto";
43138
43459
  import { homedir as homedir9 } from "node:os";
43139
- import { join as join21 } from "node:path";
43460
+ import { join as join22 } from "node:path";
43140
43461
  var CODEX_NOT_FOUND_MESSAGE = "The `codex` CLI was not found on this Machine. Install it (npm install -g @openai/codex) and sign in with `codex login`, or switch the agent to API-key auth.";
43141
43462
  function defaultCodexThreadIndexRoot() {
43142
- return join21(homedir9(), ".zixt", "codex-threads");
43463
+ return join22(homedir9(), ".zixt", "codex-threads");
43143
43464
  }
43144
43465
  var SAFE_SEGMENT3 = /^[A-Za-z0-9_-]{1,200}$/;
43145
43466
  function threadIndexPath(root, agentId, sessionKey) {
43146
43467
  if (!SAFE_SEGMENT3.test(agentId) || !SAFE_SEGMENT3.test(sessionKey)) return null;
43147
- return join21(root, agentId, `${sessionKey}.json`);
43468
+ return join22(root, agentId, `${sessionKey}.json`);
43148
43469
  }
43149
43470
  async function readThreadId(path) {
43150
43471
  try {
43151
- const parsed = JSON.parse(await readFile11(path, "utf8"));
43472
+ const parsed = JSON.parse(await readFile12(path, "utf8"));
43152
43473
  return typeof parsed.threadId === "string" && /^[A-Za-z0-9-]{1,120}$/.test(parsed.threadId) ? parsed.threadId : null;
43153
43474
  } catch {
43154
43475
  return null;
@@ -43248,7 +43569,7 @@ ${value}` : value;
43248
43569
  const recordedThreadId = indexPath ? await readThreadId(indexPath) : null;
43249
43570
  const rememberThread = (threadId) => {
43250
43571
  if (!indexPath) return;
43251
- void mkdir14(join21(threadIndexRoot, task.agentId), { recursive: true }).then(() => writeFile9(indexPath, JSON.stringify({ threadId }), "utf8")).catch(() => {
43572
+ void mkdir15(join22(threadIndexRoot, task.agentId), { recursive: true }).then(() => writeFile10(indexPath, JSON.stringify({ threadId }), "utf8")).catch(() => {
43252
43573
  });
43253
43574
  };
43254
43575
  const observeRuntime = (threadId) => {
@@ -43289,8 +43610,8 @@ ${value}` : value;
43289
43610
  var RUNTIME_READ_ATTEMPTS = 5;
43290
43611
  var RUNTIME_READ_INTERVAL_MS = 2e3;
43291
43612
  function delay3(ms) {
43292
- return new Promise((resolve19) => {
43293
- const timer = setTimeout(resolve19, ms);
43613
+ return new Promise((resolve20) => {
43614
+ const timer = setTimeout(resolve20, ms);
43294
43615
  timer.unref?.();
43295
43616
  });
43296
43617
  }
@@ -43329,7 +43650,7 @@ function createCodexAppServerParser(onStream, options) {
43329
43650
  const turnReadyWaiters = /* @__PURE__ */ new Set();
43330
43651
  const usage = () => ({ inputTokens, outputTokens });
43331
43652
  const settleTurnReadiness = (ready) => {
43332
- for (const resolve19 of turnReadyWaiters) resolve19(ready);
43653
+ for (const resolve20 of turnReadyWaiters) resolve20(ready);
43333
43654
  turnReadyWaiters.clear();
43334
43655
  };
43335
43656
  const send = async (message) => {
@@ -43510,12 +43831,12 @@ function createCodexAppServerParser(onStream, options) {
43510
43831
  async steer(input) {
43511
43832
  if (stopped) return false;
43512
43833
  if (!activeTurnId) {
43513
- const ready = await new Promise((resolve19) => turnReadyWaiters.add(resolve19));
43834
+ const ready = await new Promise((resolve20) => turnReadyWaiters.add(resolve20));
43514
43835
  if (!ready || stopped) return false;
43515
43836
  }
43516
43837
  if (!threadId || !activeTurnId) return false;
43517
- return await new Promise((resolve19) => {
43518
- steerWaiters.set(input.inputId, resolve19);
43838
+ return await new Promise((resolve20) => {
43839
+ steerWaiters.set(input.inputId, resolve20);
43519
43840
  void send({
43520
43841
  id: `steer:${input.inputId}`,
43521
43842
  method: "turn/steer",
@@ -43526,7 +43847,7 @@ function createCodexAppServerParser(onStream, options) {
43526
43847
  clientUserMessageId: input.inputId
43527
43848
  }
43528
43849
  }).catch(() => {
43529
- if (steerWaiters.delete(input.inputId)) resolve19(false);
43850
+ if (steerWaiters.delete(input.inputId)) resolve20(false);
43530
43851
  });
43531
43852
  });
43532
43853
  },
@@ -43534,7 +43855,7 @@ function createCodexAppServerParser(onStream, options) {
43534
43855
  stopped = true;
43535
43856
  write = null;
43536
43857
  settleTurnReadiness(false);
43537
- for (const resolve19 of steerWaiters.values()) resolve19(false);
43858
+ for (const resolve20 of steerWaiters.values()) resolve20(false);
43538
43859
  steerWaiters.clear();
43539
43860
  },
43540
43861
  push(chunk) {
@@ -43713,7 +44034,7 @@ function improveCodexErrorMessage(error52) {
43713
44034
  // src/runners/git-preflight.ts
43714
44035
  import { spawn as spawn12 } from "node:child_process";
43715
44036
  import { realpath as realpath10 } from "node:fs/promises";
43716
- import { isAbsolute as isAbsolute17, resolve as resolve11 } from "node:path";
44037
+ import { isAbsolute as isAbsolute18, resolve as resolve12 } from "node:path";
43717
44038
  var OUTPUT_LIMIT = 8192;
43718
44039
  var DEFAULT_TIMEOUT_MS4 = 1e4;
43719
44040
  var VERSION_PATTERN = /^git version [^\r\n]{1,108}$/;
@@ -43729,10 +44050,10 @@ function unavailable(error52, checkedAt, executablePath = null) {
43729
44050
  async function preflightGit(options = {}) {
43730
44051
  const checkedAt = (options.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
43731
44052
  const configured = options.command;
43732
- if (configured !== void 0 && !isAbsolute17(configured)) {
44053
+ if (configured !== void 0 && !isAbsolute18(configured)) {
43733
44054
  return unavailable("configured git command must be an absolute file", checkedAt);
43734
44055
  }
43735
- const trustedCwd = await realpath10(resolve11(options.trustedCwd ?? process.cwd())).catch(() => null);
44056
+ const trustedCwd = await realpath10(resolve12(options.trustedCwd ?? process.cwd())).catch(() => null);
43736
44057
  if (!trustedCwd)
43737
44058
  return unavailable("Host-owned git preflight directory is unavailable", checkedAt);
43738
44059
  const executablePath = await resolveTrustedCliCommand(configured ?? "git", {
@@ -43954,7 +44275,7 @@ function parseAuth(result) {
43954
44275
  return "unknown";
43955
44276
  }
43956
44277
  function run2(command, args) {
43957
- return new Promise((resolve19) => {
44278
+ return new Promise((resolve20) => {
43958
44279
  const child = spawnCli(command, args, {
43959
44280
  stdio: ["ignore", "pipe", "pipe"],
43960
44281
  windowsHide: true
@@ -43970,7 +44291,7 @@ function run2(command, args) {
43970
44291
  if (settled) return;
43971
44292
  settled = true;
43972
44293
  clearTimeout(timeout);
43973
- resolve19(result);
44294
+ resolve20(result);
43974
44295
  };
43975
44296
  const timeout = setTimeout(() => {
43976
44297
  child.kill();
@@ -43984,32 +44305,32 @@ function run2(command, args) {
43984
44305
  // src/linux-service.ts
43985
44306
  import { spawn as spawn13 } from "node:child_process";
43986
44307
  import { constants as constants2 } from "node:fs";
43987
- import { access as access5, chmod as chmod9, mkdir as mkdir16, open as open7, rename as rename8, rm as rm12 } from "node:fs/promises";
44308
+ import { access as access5, chmod as chmod9, mkdir as mkdir17, open as open7, rename as rename8, rm as rm12 } from "node:fs/promises";
43988
44309
  import { homedir as homedir11, userInfo } from "node:os";
43989
- import { basename as basename4, dirname as dirname11, join as join23, relative as relative10, resolve as resolve13, sep as sep7 } from "node:path";
44310
+ import { basename as basename4, dirname as dirname11, join as join24, relative as relative10, resolve as resolve14, sep as sep8 } from "node:path";
43990
44311
 
43991
44312
  // src/service-runtime.ts
43992
- import { access as access4, chmod as chmod8, copyFile, mkdir as mkdir15, rename as rename7, rm as rm11 } from "node:fs/promises";
44313
+ import { access as access4, chmod as chmod8, copyFile, mkdir as mkdir16, rename as rename7, rm as rm11 } from "node:fs/promises";
43993
44314
  import { homedir as homedir10 } from "node:os";
43994
- import { join as join22, resolve as resolve12, sep as sep6 } from "node:path";
44315
+ import { join as join23, resolve as resolve13, sep as sep7 } from "node:path";
43995
44316
  async function ensureDurableServiceNode(options = {}) {
43996
- const execPath = resolve12(options.execPath ?? process.execPath);
44317
+ const execPath = resolve13(options.execPath ?? process.execPath);
43997
44318
  const home = options.home ?? homedir10();
43998
44319
  const platform = options.platform ?? process.platform;
43999
44320
  const version2 = options.nodeVersion ?? process.version;
44000
44321
  if (!/^v?[0-9A-Za-z.-]+$/.test(version2)) {
44001
44322
  throw new Error("the Node runtime version is not a safe directory name");
44002
44323
  }
44003
- const zixtRoot = resolve12(home, ".zixt");
44004
- if (execPath === zixtRoot || execPath.startsWith(zixtRoot + sep6)) return execPath;
44005
- const directory = join22(zixtRoot, "runtime", `node-${version2}`);
44006
- const destination = join22(directory, platform === "win32" ? "node.exe" : "node");
44324
+ const zixtRoot = resolve13(home, ".zixt");
44325
+ if (execPath === zixtRoot || execPath.startsWith(zixtRoot + sep7)) return execPath;
44326
+ const directory = join23(zixtRoot, "runtime", `node-${version2}`);
44327
+ const destination = join23(directory, platform === "win32" ? "node.exe" : "node");
44007
44328
  const alreadyCopied = await access4(destination).then(
44008
44329
  () => true,
44009
44330
  () => false
44010
44331
  );
44011
44332
  if (alreadyCopied) return destination;
44012
- await mkdir15(directory, { recursive: true, mode: 448 });
44333
+ await mkdir16(directory, { recursive: true, mode: 448 });
44013
44334
  const temporary = `${destination}.${process.pid}.${crypto.randomUUID()}.tmp`;
44014
44335
  try {
44015
44336
  await copyFile(execPath, temporary);
@@ -44051,7 +44372,7 @@ function boundedAppend(current, chunk) {
44051
44372
  }
44052
44373
  async function defaultRunCommand(command, args) {
44053
44374
  const commandEnvironment3 = systemServiceCommandEnvironment();
44054
- return new Promise((resolve19) => {
44375
+ return new Promise((resolve20) => {
44055
44376
  const child = spawn13(command, [...args], {
44056
44377
  stdio: ["ignore", "pipe", "pipe"],
44057
44378
  env: commandEnvironment3,
@@ -44065,7 +44386,7 @@ async function defaultRunCommand(command, args) {
44065
44386
  if (settled) return;
44066
44387
  settled = true;
44067
44388
  if (timer) clearTimeout(timer);
44068
- resolve19(result);
44389
+ resolve20(result);
44069
44390
  };
44070
44391
  child.stdout?.on("data", (chunk) => {
44071
44392
  stdout = boundedAppend(stdout, chunk);
@@ -44124,22 +44445,22 @@ async function defaultSyncDirectory(path) {
44124
44445
  }
44125
44446
  }
44126
44447
  async function ensureDirectory(path, mode, syncDirectory8) {
44127
- const firstCreated = await mkdir16(path, { recursive: true, mode });
44448
+ const firstCreated = await mkdir17(path, { recursive: true, mode });
44128
44449
  if (!firstCreated) return;
44129
- const first = resolve13(firstCreated);
44130
- const target = resolve13(path);
44450
+ const first = resolve14(firstCreated);
44451
+ const target = resolve14(path);
44131
44452
  await syncDirectory8(dirname11(first));
44132
44453
  let current = first;
44133
44454
  const descendants = relative10(first, target);
44134
- for (const part of descendants ? descendants.split(sep7) : []) {
44455
+ for (const part of descendants ? descendants.split(sep8) : []) {
44135
44456
  await syncDirectory8(current);
44136
- current = join23(current, part);
44457
+ current = join24(current, part);
44137
44458
  }
44138
44459
  }
44139
44460
  async function replacePrivateFile(path, contents, mode, syncDirectory8) {
44140
44461
  const parent = dirname11(path);
44141
44462
  await ensureDirectory(parent, 448, syncDirectory8);
44142
- const temporary = join23(parent, `.${basename4(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44463
+ const temporary = join24(parent, `.${basename4(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44143
44464
  const handle = await open7(temporary, "wx", mode);
44144
44465
  try {
44145
44466
  await handle.writeFile(contents, "utf8");
@@ -44191,17 +44512,17 @@ async function installLinuxService(options) {
44191
44512
  "command search path"
44192
44513
  );
44193
44514
  const cloudUrl = options.cloudUrl ? oneLine(options.cloudUrl, "Zixt Cloud address") : void 0;
44194
- const xdgConfigHome = env.XDG_CONFIG_HOME ? oneLine(env.XDG_CONFIG_HOME, "Linux configuration path") : join23(home, ".config");
44195
- const configRoot = options.serviceConfigRoot ?? join23(xdgConfigHome, "zixt");
44196
- const unitRoot = options.userUnitRoot ?? join23(xdgConfigHome, "systemd", "user");
44197
- const environmentPath = join23(configRoot, "host.env");
44198
- const unitPath = join23(unitRoot, SERVICE_NAME);
44515
+ const xdgConfigHome = env.XDG_CONFIG_HOME ? oneLine(env.XDG_CONFIG_HOME, "Linux configuration path") : join24(home, ".config");
44516
+ const configRoot = options.serviceConfigRoot ?? join24(xdgConfigHome, "zixt");
44517
+ const unitRoot = options.userUnitRoot ?? join24(xdgConfigHome, "systemd", "user");
44518
+ const environmentPath = join24(configRoot, "host.env");
44519
+ const unitPath = join24(unitRoot, SERVICE_NAME);
44199
44520
  const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
44200
44521
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : activateInstalledRelease);
44201
44522
  const resolveCommand = options.resolveCommand ?? defaultResolveCommand;
44202
44523
  const run3 = options.runCommand ?? defaultRunCommand;
44203
44524
  const syncDirectory8 = options.syncDirectory ?? defaultSyncDirectory;
44204
- const stabilityDelay = options.delay ?? ((ms) => new Promise((resolve19) => setTimeout(resolve19, ms)));
44525
+ const stabilityDelay = options.delay ?? ((ms) => new Promise((resolve20) => setTimeout(resolve20, ms)));
44205
44526
  const [systemctl, loginctl] = await Promise.all([
44206
44527
  resolveCommand("systemctl"),
44207
44528
  resolveCommand("loginctl")
@@ -44325,9 +44646,9 @@ async function installLinuxService(options) {
44325
44646
  // src/macos-service.ts
44326
44647
  import { spawn as spawn14 } from "node:child_process";
44327
44648
  import { constants as constants3 } from "node:fs";
44328
- import { access as access6, chmod as chmod10, mkdir as mkdir17, open as open8, rename as rename9, rm as rm13 } from "node:fs/promises";
44649
+ import { access as access6, chmod as chmod10, mkdir as mkdir18, open as open8, rename as rename9, rm as rm13 } from "node:fs/promises";
44329
44650
  import { homedir as homedir12, userInfo as userInfo2 } from "node:os";
44330
- import { basename as basename5, dirname as dirname12, join as join24, relative as relative11, resolve as resolve14, sep as sep8 } from "node:path";
44651
+ import { basename as basename5, dirname as dirname12, join as join25, relative as relative11, resolve as resolve15, sep as sep9 } from "node:path";
44331
44652
  var LAUNCH_AGENT_LABEL = "ai.zixt.host";
44332
44653
  var SERVICE_STABILITY_DELAY_MS2 = 2e3;
44333
44654
  var STATUS_WAIT_MS = 2e4;
@@ -44352,21 +44673,21 @@ async function syncDirectory4(path) {
44352
44673
  }
44353
44674
  }
44354
44675
  async function ensureDirectory2(path, sync) {
44355
- const firstCreated = await mkdir17(path, { recursive: true, mode: 448 });
44676
+ const firstCreated = await mkdir18(path, { recursive: true, mode: 448 });
44356
44677
  if (!firstCreated) return;
44357
- const first = resolve14(firstCreated);
44358
- const target = resolve14(path);
44678
+ const first = resolve15(firstCreated);
44679
+ const target = resolve15(path);
44359
44680
  await sync(dirname12(first));
44360
44681
  let current = first;
44361
- for (const part of relative11(first, target).split(sep8).filter(Boolean)) {
44682
+ for (const part of relative11(first, target).split(sep9).filter(Boolean)) {
44362
44683
  await sync(current);
44363
- current = join24(current, part);
44684
+ current = join25(current, part);
44364
44685
  }
44365
44686
  }
44366
44687
  async function replacePrivateFile2(path, contents, mode, sync) {
44367
44688
  const parent = dirname12(path);
44368
44689
  await ensureDirectory2(parent, sync);
44369
- const temporary = join24(parent, `.${basename5(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44690
+ const temporary = join25(parent, `.${basename5(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44370
44691
  const handle = await open8(temporary, "wx", mode);
44371
44692
  try {
44372
44693
  await handle.writeFile(contents, "utf8");
@@ -44463,14 +44784,14 @@ async function installMacosService(options) {
44463
44784
  options.path ?? env.PATH ?? "/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin",
44464
44785
  "command search path"
44465
44786
  );
44466
- const configRoot = options.configRoot ?? join24(home, "Library", "Application Support", "Zixt");
44467
- const launchAgentsRoot = options.launchAgentsRoot ?? join24(home, "Library", "LaunchAgents");
44468
- const logRoot = options.logRoot ?? join24(home, "Library", "Logs", "Zixt");
44469
- const configPath = join24(configRoot, "host.env");
44470
- const launcherPath = join24(configRoot, "host-launcher.sh");
44471
- const plistPath = join24(launchAgentsRoot, `${LAUNCH_AGENT_LABEL}.plist`);
44472
- const stdoutPath = join24(logRoot, "host.log");
44473
- const stderrPath = join24(logRoot, "host-error.log");
44787
+ const configRoot = options.configRoot ?? join25(home, "Library", "Application Support", "Zixt");
44788
+ const launchAgentsRoot = options.launchAgentsRoot ?? join25(home, "Library", "LaunchAgents");
44789
+ const logRoot = options.logRoot ?? join25(home, "Library", "Logs", "Zixt");
44790
+ const configPath = join25(configRoot, "host.env");
44791
+ const launcherPath = join25(configRoot, "host-launcher.sh");
44792
+ const plistPath = join25(launchAgentsRoot, `${LAUNCH_AGENT_LABEL}.plist`);
44793
+ const stdoutPath = join25(logRoot, "host.log");
44794
+ const stderrPath = join25(logRoot, "host-error.log");
44474
44795
  const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
44475
44796
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : (entry) => activateInstalledRelease(entry));
44476
44797
  const resolveCommand = options.resolveCommand ?? (async () => defaultResolveCommand2());
@@ -44573,9 +44894,9 @@ async function installMacosService(options) {
44573
44894
  // src/windows-service.ts
44574
44895
  import { spawn as spawn15 } from "node:child_process";
44575
44896
  import { constants as constants4 } from "node:fs";
44576
- import { access as access7, mkdir as mkdir18, open as open9, readFile as readFile12, rename as rename10, rm as rm14 } from "node:fs/promises";
44897
+ import { access as access7, mkdir as mkdir19, open as open9, readFile as readFile13, rename as rename10, rm as rm14 } from "node:fs/promises";
44577
44898
  import { homedir as homedir13 } from "node:os";
44578
- import { basename as basename6, dirname as dirname13, isAbsolute as isAbsolute18, join as join25, relative as relative12, resolve as resolve15, sep as sep9 } from "node:path";
44899
+ import { basename as basename6, dirname as dirname13, isAbsolute as isAbsolute19, join as join26, relative as relative12, resolve as resolve16, sep as sep10 } from "node:path";
44579
44900
  var TASK_NAME = "Zixt Host";
44580
44901
  var COMMAND_TIMEOUT_MS3 = 7e4;
44581
44902
  var SERVICE_STABILITY_DELAY_MS3 = 2e3;
@@ -44601,21 +44922,21 @@ async function syncDirectory5(path) {
44601
44922
  }
44602
44923
  }
44603
44924
  async function ensureDirectory3(path, sync) {
44604
- const firstCreated = await mkdir18(path, { recursive: true, mode: 448 });
44925
+ const firstCreated = await mkdir19(path, { recursive: true, mode: 448 });
44605
44926
  if (!firstCreated) return;
44606
- const first = resolve15(firstCreated);
44607
- const target = resolve15(path);
44927
+ const first = resolve16(firstCreated);
44928
+ const target = resolve16(path);
44608
44929
  await sync(dirname13(first));
44609
44930
  let current = first;
44610
- for (const part of relative12(first, target).split(sep9).filter(Boolean)) {
44931
+ for (const part of relative12(first, target).split(sep10).filter(Boolean)) {
44611
44932
  await sync(current);
44612
- current = join25(current, part);
44933
+ current = join26(current, part);
44613
44934
  }
44614
44935
  }
44615
44936
  async function replacePrivateFile3(path, contents, sync, encoding = "utf8") {
44616
44937
  const parent = dirname13(path);
44617
44938
  await ensureDirectory3(parent, sync);
44618
- const temporary = join25(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44939
+ const temporary = join26(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44619
44940
  const handle = await open9(temporary, "wx", 384);
44620
44941
  try {
44621
44942
  await handle.writeFile(encoding === "utf16le" ? `\uFEFF${contents}` : contents, encoding);
@@ -44669,8 +44990,8 @@ async function runChild(command, args, env, input) {
44669
44990
  }
44670
44991
  async function defaultResolveCommand3(name, env) {
44671
44992
  const root = env.SYSTEMROOT ?? env.WINDIR;
44672
- if (!root || !isAbsolute18(root)) return null;
44673
- const candidate = name === "powershell" ? join25(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe") : join25(root, "System32", `${name}.exe`);
44993
+ if (!root || !isAbsolute19(root)) return null;
44994
+ const candidate = name === "powershell" ? join26(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe") : join26(root, "System32", `${name}.exe`);
44674
44995
  return access7(candidate, constants4.X_OK).then(
44675
44996
  () => candidate,
44676
44997
  () => null
@@ -44760,7 +45081,7 @@ exit $code
44760
45081
  }
44761
45082
  async function defaultObserveStatus(path, generation) {
44762
45083
  try {
44763
- const text = (await readFile12(path, "utf8")).replace(/^\uFEFF/, "");
45084
+ const text = (await readFile13(path, "utf8")).replace(/^\uFEFF/, "");
44764
45085
  const value = JSON.parse(text);
44765
45086
  if (value.schema !== 1 || value.generation !== generation || typeof value.pid !== "number" || !Number.isSafeInteger(value.pid) || value.pid <= 0) {
44766
45087
  return null;
@@ -44815,18 +45136,18 @@ async function installWindowsService(options) {
44815
45136
  const env = options.env ?? process.env;
44816
45137
  const home = options.home ?? homedir13();
44817
45138
  const localAppData = options.localAppData ?? env.LOCALAPPDATA;
44818
- if (!localAppData || !isAbsolute18(localAppData)) {
45139
+ if (!localAppData || !isAbsolute19(localAppData)) {
44819
45140
  throw new Error("Windows local application data path is unavailable.");
44820
45141
  }
44821
45142
  const token2 = oneLine3(options.token, "pairing code");
44822
45143
  const cloudUrl = options.cloudUrl ? oneLine3(options.cloudUrl, "Zixt Cloud address") : void 0;
44823
45144
  const path = oneLine3(options.path ?? env.PATH ?? "", "command search path");
44824
- const configRoot = options.configRoot ?? join25(localAppData, "Zixt", "Host");
44825
- const configPath = join25(configRoot, "host.json");
44826
- const launcherPath = join25(configRoot, "host-launcher.ps1");
44827
- const launchShimPath = join25(configRoot, "host-launch.vbs");
44828
- const taskXmlPath = join25(configRoot, "host-task.xml");
44829
- const statusPath = join25(configRoot, "host-status.json");
45145
+ const configRoot = options.configRoot ?? join26(localAppData, "Zixt", "Host");
45146
+ const configPath = join26(configRoot, "host.json");
45147
+ const launcherPath = join26(configRoot, "host-launcher.ps1");
45148
+ const launchShimPath = join26(configRoot, "host-launch.vbs");
45149
+ const taskXmlPath = join26(configRoot, "host-task.xml");
45150
+ const statusPath = join26(configRoot, "host-status.json");
44830
45151
  const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
44831
45152
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : (entry) => activateInstalledRelease(entry));
44832
45153
  const resolveCommand = options.resolveCommand ?? ((name) => defaultResolveCommand3(name, env));
@@ -44953,23 +45274,23 @@ async function installSystemService(options) {
44953
45274
  }
44954
45275
 
44955
45276
  // src/terminal-outcomes.ts
44956
- import { chmod as chmod11, lstat as lstat12, mkdir as mkdir19, open as open10, readdir as readdir7, readFile as readFile13, rename as rename11, rm as rm15 } from "node:fs/promises";
45277
+ import { chmod as chmod11, lstat as lstat12, mkdir as mkdir20, open as open10, readdir as readdir7, readFile as readFile14, rename as rename11, rm as rm15 } from "node:fs/promises";
44957
45278
  import { homedir as homedir14 } from "node:os";
44958
- import { dirname as dirname14, join as join26, relative as relative13, resolve as resolve16, sep as sep10 } from "node:path";
45279
+ import { dirname as dirname14, join as join27, relative as relative13, resolve as resolve17, sep as sep11 } from "node:path";
44959
45280
  var DIRECTORY_MODE5 = 448;
44960
45281
  var FILE_MODE4 = 384;
44961
45282
  var MAX_OUTCOME_BYTES = 4 * 1024 * 1024;
44962
45283
  var HOST_DIRECTORY = /^hst_[0-9a-f]{32}$/;
44963
45284
  var OUTCOME_FILE = /^(tsk_[0-9a-f]{32})\.([1-9][0-9]*)\.json$/;
44964
45285
  function defaultTerminalOutcomeRoot() {
44965
- return join26(homedir14(), ".zixt", "terminal-outcomes");
45286
+ return join27(homedir14(), ".zixt", "terminal-outcomes");
44966
45287
  }
44967
45288
  function hostOutcomeRoot(root, hostId) {
44968
45289
  if (!HOST_DIRECTORY.test(hostId)) throw new Error("terminal outcome Host identity is malformed");
44969
- return join26(root, hostId);
45290
+ return join27(root, hostId);
44970
45291
  }
44971
45292
  function outcomePath(root, hostId, taskId, epoch) {
44972
- return join26(hostOutcomeRoot(root, hostId), `${taskId}.${epoch}.json`);
45293
+ return join27(hostOutcomeRoot(root, hostId), `${taskId}.${epoch}.json`);
44973
45294
  }
44974
45295
  async function syncDirectory6(root) {
44975
45296
  if (process.platform === "win32") return;
@@ -44981,15 +45302,15 @@ async function syncDirectory6(root) {
44981
45302
  }
44982
45303
  }
44983
45304
  async function requirePrivateRoot(root, sync = syncDirectory6) {
44984
- const firstCreated = await mkdir19(root, { recursive: true, mode: DIRECTORY_MODE5 });
45305
+ const firstCreated = await mkdir20(root, { recursive: true, mode: DIRECTORY_MODE5 });
44985
45306
  if (firstCreated) {
44986
- const first = resolve16(firstCreated);
44987
- const target = resolve16(root);
45307
+ const first = resolve17(firstCreated);
45308
+ const target = resolve17(root);
44988
45309
  await sync(dirname14(first));
44989
45310
  let current = first;
44990
- for (const part of relative13(first, target).split(sep10).filter(Boolean)) {
45311
+ for (const part of relative13(first, target).split(sep11).filter(Boolean)) {
44991
45312
  await sync(current);
44992
- current = join26(current, part);
45313
+ current = join27(current, part);
44993
45314
  }
44994
45315
  }
44995
45316
  const stat4 = await lstat12(root);
@@ -45020,7 +45341,7 @@ async function recordTerminalOutcome(hostId, input, root = defaultTerminalOutcom
45020
45341
  const destination = outcomePath(root, hostId, outcome.taskId, outcome.epoch);
45021
45342
  try {
45022
45343
  const existing = parseCommittedOutcome(
45023
- await readFile13(destination, { encoding: "utf8", flag: "r" }),
45344
+ await readFile14(destination, { encoding: "utf8", flag: "r" }),
45024
45345
  outcome.taskId,
45025
45346
  outcome.epoch
45026
45347
  );
@@ -45029,7 +45350,7 @@ async function recordTerminalOutcome(hostId, input, root = defaultTerminalOutcom
45029
45350
  } catch (error52) {
45030
45351
  if (error52.code !== "ENOENT") throw error52;
45031
45352
  }
45032
- const temporary = join26(
45353
+ const temporary = join27(
45033
45354
  scopedRoot,
45034
45355
  `.${outcome.taskId}.${outcome.epoch}.${process.pid}.${Date.now()}.${outcome.resultId}.tmp`
45035
45356
  );
@@ -45082,13 +45403,13 @@ async function readTerminalOutcomesStrict(root = defaultTerminalOutcomeRoot()) {
45082
45403
  if (!match || !entry.isFile() || entry.isSymbolicLink()) {
45083
45404
  throw new Error("committed terminal outcome is not a trusted regular file");
45084
45405
  }
45085
- const path = join26(scopedRoot, entry.name);
45406
+ const path = join27(scopedRoot, entry.name);
45086
45407
  const stat4 = await lstat12(path);
45087
45408
  if (!stat4.isFile() || stat4.isSymbolicLink() || stat4.size > MAX_OUTCOME_BYTES) {
45088
45409
  throw new Error("committed terminal outcome is not a trusted regular file");
45089
45410
  }
45090
45411
  const outcome = parseCommittedOutcome(
45091
- await readFile13(path, "utf8"),
45412
+ await readFile14(path, "utf8"),
45092
45413
  match[1],
45093
45414
  Number(match[2])
45094
45415
  );
@@ -45134,15 +45455,15 @@ async function forgetSupersededTerminalOutcomes(hostId, taskId, epoch, root = de
45134
45455
  }
45135
45456
 
45136
45457
  // src/accepted-assignments.ts
45137
- import { chmod as chmod12, lstat as lstat13, mkdir as mkdir20, open as open11, readdir as readdir8, rename as rename12, rm as rm16 } from "node:fs/promises";
45458
+ import { chmod as chmod12, lstat as lstat13, mkdir as mkdir21, open as open11, readdir as readdir8, rename as rename12, rm as rm16 } from "node:fs/promises";
45138
45459
  import { homedir as homedir15 } from "node:os";
45139
- import { dirname as dirname15, join as join27, relative as relative14, resolve as resolve17, sep as sep11 } from "node:path";
45460
+ import { dirname as dirname15, join as join28, relative as relative14, resolve as resolve18, sep as sep12 } from "node:path";
45140
45461
  var DIRECTORY_MODE6 = 448;
45141
45462
  var FILE_MODE5 = 384;
45142
45463
  var CLAIM_FILE = /^(tsk_[0-9a-f]{32})\.([1-9][0-9]*)\.json$/;
45143
45464
  var TASK_ID = /^tsk_[0-9a-f]{32}$/;
45144
45465
  function defaultAcceptedAssignmentRoot() {
45145
- return join27(homedir15(), ".zixt", "accepted-assignments");
45466
+ return join28(homedir15(), ".zixt", "accepted-assignments");
45146
45467
  }
45147
45468
  async function syncDirectory7(root) {
45148
45469
  if (process.platform === "win32") return;
@@ -45154,15 +45475,15 @@ async function syncDirectory7(root) {
45154
45475
  }
45155
45476
  }
45156
45477
  async function requirePrivateRoot2(root, sync = syncDirectory7) {
45157
- const firstCreated = await mkdir20(root, { recursive: true, mode: DIRECTORY_MODE6 });
45478
+ const firstCreated = await mkdir21(root, { recursive: true, mode: DIRECTORY_MODE6 });
45158
45479
  if (firstCreated) {
45159
- const first = resolve17(firstCreated);
45160
- const target = resolve17(root);
45480
+ const first = resolve18(firstCreated);
45481
+ const target = resolve18(root);
45161
45482
  await sync(dirname15(first));
45162
45483
  let current = first;
45163
- for (const part of relative14(first, target).split(sep11).filter(Boolean)) {
45484
+ for (const part of relative14(first, target).split(sep12).filter(Boolean)) {
45164
45485
  await sync(current);
45165
- current = join27(current, part);
45486
+ current = join28(current, part);
45166
45487
  }
45167
45488
  }
45168
45489
  const stat4 = await lstat13(root);
@@ -45176,7 +45497,7 @@ function claimPath(root, taskId, epoch) {
45176
45497
  if (!Number.isSafeInteger(epoch) || epoch < 1) {
45177
45498
  throw new Error("accepted assignment epoch is malformed");
45178
45499
  }
45179
- return join27(root, `${taskId}.${epoch}.json`);
45500
+ return join28(root, `${taskId}.${epoch}.json`);
45180
45501
  }
45181
45502
  async function recordAcceptedAssignment(assignment, root = defaultAcceptedAssignmentRoot(), options = {}) {
45182
45503
  const sync = options.syncDirectory ?? syncDirectory7;
@@ -45186,7 +45507,7 @@ async function recordAcceptedAssignment(assignment, root = defaultAcceptedAssign
45186
45507
  } catch {
45187
45508
  return false;
45188
45509
  }
45189
- const temporary = join27(
45510
+ const temporary = join28(
45190
45511
  root,
45191
45512
  `.${assignment.taskId}.${assignment.epoch}.${process.pid}.${Date.now()}.tmp`
45192
45513
  );
@@ -45248,9 +45569,9 @@ async function forgetAcknowledgedAcceptedAssignments(assignments, root = default
45248
45569
  }
45249
45570
 
45250
45571
  // src/local-observability.ts
45251
- import { appendFile, mkdir as mkdir21, open as open12, readdir as readdir9, rename as rename13, rm as rm17, stat as stat3 } from "node:fs/promises";
45572
+ import { appendFile, mkdir as mkdir22, open as open12, readdir as readdir9, rename as rename13, rm as rm17, stat as stat3 } from "node:fs/promises";
45252
45573
  import { homedir as homedir16 } from "node:os";
45253
- import { basename as basename7, dirname as dirname16, join as join28 } from "node:path";
45574
+ import { basename as basename7, dirname as dirname16, join as join29 } from "node:path";
45254
45575
 
45255
45576
  // src/logger.ts
45256
45577
  var ANSI = {
@@ -45362,11 +45683,11 @@ var LOCAL_STATUS_FILE = "status.json";
45362
45683
  var LOCAL_REQUESTS_DIR = "requests";
45363
45684
  var DEFAULT_CONSOLE_ROTATE_BYTES = 2 * 1024 * 1024;
45364
45685
  function defaultLocalObservabilityRoot() {
45365
- return join28(homedir16(), ".zixt", "observability");
45686
+ return join29(homedir16(), ".zixt", "observability");
45366
45687
  }
45367
45688
  function createLocalConsoleSink(options = {}) {
45368
45689
  const root = options.root ?? defaultLocalObservabilityRoot();
45369
- const consolePath = join28(root, LOCAL_CONSOLE_FILE);
45690
+ const consolePath = join29(root, LOCAL_CONSOLE_FILE);
45370
45691
  const rotateBytes = options.rotateBytes ?? DEFAULT_CONSOLE_ROTATE_BYTES;
45371
45692
  let disabled = false;
45372
45693
  let prepared = false;
@@ -45376,7 +45697,7 @@ function createLocalConsoleSink(options = {}) {
45376
45697
  if (disabled) return;
45377
45698
  try {
45378
45699
  if (!prepared) {
45379
- await mkdir21(root, { recursive: true, mode: 448 });
45700
+ await mkdir22(root, { recursive: true, mode: 448 });
45380
45701
  approximateBytes = await stat3(consolePath).then(
45381
45702
  (existing) => existing.size,
45382
45703
  () => 0
@@ -45384,8 +45705,8 @@ function createLocalConsoleSink(options = {}) {
45384
45705
  prepared = true;
45385
45706
  }
45386
45707
  if (approximateBytes >= rotateBytes) {
45387
- await rm17(join28(root, LOCAL_CONSOLE_PREVIOUS_FILE), { force: true });
45388
- await rename13(consolePath, join28(root, LOCAL_CONSOLE_PREVIOUS_FILE)).catch(
45708
+ await rm17(join29(root, LOCAL_CONSOLE_PREVIOUS_FILE), { force: true });
45709
+ await rename13(consolePath, join29(root, LOCAL_CONSOLE_PREVIOUS_FILE)).catch(
45389
45710
  (error52) => {
45390
45711
  if (error52.code !== "ENOENT") throw error52;
45391
45712
  }
@@ -45416,7 +45737,7 @@ function createLocalConsoleSink(options = {}) {
45416
45737
  };
45417
45738
  }
45418
45739
  async function consumeRunnerInstallRequests(root = defaultLocalObservabilityRoot()) {
45419
- const directory = join28(root, LOCAL_REQUESTS_DIR);
45740
+ const directory = join29(root, LOCAL_REQUESTS_DIR);
45420
45741
  const requested = /* @__PURE__ */ new Set();
45421
45742
  let names;
45422
45743
  try {
@@ -45428,7 +45749,7 @@ async function consumeRunnerInstallRequests(root = defaultLocalObservabilityRoot
45428
45749
  const name = `install-runner-${type}.json`;
45429
45750
  if (!names.includes(name)) continue;
45430
45751
  try {
45431
- await rm17(join28(directory, name), { force: true });
45752
+ await rm17(join29(directory, name), { force: true });
45432
45753
  requested.add(type);
45433
45754
  } catch {
45434
45755
  }
@@ -45436,13 +45757,13 @@ async function consumeRunnerInstallRequests(root = defaultLocalObservabilityRoot
45436
45757
  return requested;
45437
45758
  }
45438
45759
  async function writeLocalStatus(status, root = defaultLocalObservabilityRoot()) {
45439
- const destination = join28(root, LOCAL_STATUS_FILE);
45440
- const temporary = join28(
45760
+ const destination = join29(root, LOCAL_STATUS_FILE);
45761
+ const temporary = join29(
45441
45762
  dirname16(destination),
45442
45763
  `.${basename7(destination)}.${process.pid}.${crypto.randomUUID()}.tmp`
45443
45764
  );
45444
45765
  try {
45445
- await mkdir21(root, { recursive: true, mode: 448 });
45766
+ await mkdir22(root, { recursive: true, mode: 448 });
45446
45767
  const handle = await open12(temporary, "wx", 384);
45447
45768
  try {
45448
45769
  await handle.writeFile(`${JSON.stringify(status)}
@@ -45457,24 +45778,24 @@ async function writeLocalStatus(status, root = defaultLocalObservabilityRoot())
45457
45778
  }
45458
45779
 
45459
45780
  // src/demo-state.ts
45460
- import { isAbsolute as isAbsolute19, join as join29, parse as parse3, resolve as resolve18 } from "node:path";
45781
+ import { isAbsolute as isAbsolute20, join as join30, parse as parse3, resolve as resolve19 } from "node:path";
45461
45782
  var DEMO_STATE_ROOT_ENV = "ZIXT_DEMO_STATE_ROOT";
45462
45783
  function resolveDemoHostStatePaths(env = process.env) {
45463
45784
  const configured = env.ZIXT_RUNNER === "demo" ? env[DEMO_STATE_ROOT_ENV] : void 0;
45464
45785
  if (!configured) return null;
45465
- const root = resolve18(configured);
45466
- if (!isAbsolute19(configured) || root === parse3(root).root) {
45786
+ const root = resolve19(configured);
45787
+ if (!isAbsolute20(configured) || root === parse3(root).root) {
45467
45788
  throw new Error(`${DEMO_STATE_ROOT_ENV} must be a dedicated absolute directory`);
45468
45789
  }
45469
45790
  return {
45470
- runRegistryRoot: join29(root, "run-registry"),
45471
- terminalOutcomeRoot: join29(root, "terminal-outcomes"),
45472
- acceptedAssignmentRoot: join29(root, "accepted-assignments"),
45473
- runArtifactRoot: join29(root, "run-artifacts"),
45474
- browserProfileRoot: join29(root, "browser-profiles"),
45475
- runnerWorkspaceRoot: join29(root, "workspaces"),
45476
- codexThreadIndexRoot: join29(root, "codex-threads"),
45477
- localObservabilityRoot: join29(root, "local-observability")
45791
+ runRegistryRoot: join30(root, "run-registry"),
45792
+ terminalOutcomeRoot: join30(root, "terminal-outcomes"),
45793
+ acceptedAssignmentRoot: join30(root, "accepted-assignments"),
45794
+ runArtifactRoot: join30(root, "run-artifacts"),
45795
+ browserProfileRoot: join30(root, "browser-profiles"),
45796
+ runnerWorkspaceRoot: join30(root, "workspaces"),
45797
+ codexThreadIndexRoot: join30(root, "codex-threads"),
45798
+ localObservabilityRoot: join30(root, "local-observability")
45478
45799
  };
45479
45800
  }
45480
45801