@zixt/host 0.0.143 → 0.0.144

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 +595 -283
  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.144",
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(
@@ -15808,6 +15808,68 @@ var Host = external_exports.object({
15808
15808
  createdAt: IsoDate2
15809
15809
  });
15810
15810
 
15811
+ // ../../packages/contracts/src/company-assets.ts
15812
+ var CompanyAssetKind = external_exports.enum([
15813
+ /** The organization's own mark, used wherever it brands something. */
15814
+ "logo",
15815
+ /** Any other picture: a product shot, a team photo, a diagram. */
15816
+ "image",
15817
+ /** A document a teammate should read or send: guidelines, a policy, a deck. */
15818
+ "document",
15819
+ /** Reusable prose: boilerplate, a disclaimer, a bio, a standard reply. */
15820
+ "text",
15821
+ /** Structured data a teammate reads: a price list, a CSV, a config. */
15822
+ "data",
15823
+ "other"
15824
+ ]);
15825
+ var CompanyAssetSource = external_exports.enum(["person", "manager", "teammate", "research"]);
15826
+ var CompanyAssetTrust = external_exports.enum(["internal", "external"]);
15827
+ var COMPANY_ASSET_NAME_MAX = 60;
15828
+ var COMPANY_ASSET_PURPOSE_MAX = 240;
15829
+ var COMPANY_ASSET_MAX_BYTES = 5 * 1024 * 1024;
15830
+ var COMPANY_ASSET_MAX_ITEMS = 40;
15831
+ var COMPANY_ASSET_SOURCE_URL_MAX = 500;
15832
+ var CompanyAssetRef = external_exports.object({
15833
+ id: CompanyAssetId,
15834
+ /** Normalized handle; this is what a teammate passes to get_company_asset. */
15835
+ name: external_exports.string().min(1).max(COMPANY_ASSET_NAME_MAX),
15836
+ kind: CompanyAssetKind,
15837
+ mediaType: external_exports.string().max(200).regex(/^[\w.+-]+\/[\w.+-]+$/, "invalid media type"),
15838
+ size: external_exports.number().int().min(1).max(COMPANY_ASSET_MAX_BYTES),
15839
+ /** One line: what it is and when to reach for it. */
15840
+ purpose: external_exports.string().min(1).max(COMPANY_ASSET_PURPOSE_MAX)
15841
+ }).strict();
15842
+ var CompanyAsset = CompanyAssetRef.extend({
15843
+ source: CompanyAssetSource,
15844
+ trust: CompanyAssetTrust,
15845
+ authorAgentId: AgentId.nullable(),
15846
+ authorMemberId: MemberId.nullable(),
15847
+ /** Where a researched or downloaded file came from, for the person checking. */
15848
+ sourceUrl: external_exports.string().max(COMPANY_ASSET_SOURCE_URL_MAX).nullable(),
15849
+ createdAt: IsoDate,
15850
+ updatedAt: IsoDate
15851
+ }).strict();
15852
+ var CompanyAssetsView = external_exports.object({
15853
+ assets: external_exports.array(CompanyAsset).max(COMPANY_ASSET_MAX_ITEMS),
15854
+ /** How many more files this organization may keep before it must remove one. */
15855
+ remaining: external_exports.number().int().min(0),
15856
+ /** Members read the inventory; Owners and Admins write it (ORG-2). */
15857
+ editable: external_exports.boolean()
15858
+ }).strict();
15859
+ var PutCompanyAssetRequest = external_exports.object({
15860
+ name: external_exports.string().trim().min(1).max(COMPANY_ASSET_NAME_MAX),
15861
+ kind: CompanyAssetKind,
15862
+ purpose: external_exports.string().trim().min(1).max(COMPANY_ASSET_PURPOSE_MAX),
15863
+ mediaType: CompanyAssetRef.shape.mediaType,
15864
+ /** Base64 payload (~4/3 of the byte cap); the decoded size is enforced server-side. */
15865
+ data: external_exports.string().min(1).max(Math.ceil(COMPANY_ASSET_MAX_BYTES / 3 * 4) + 4)
15866
+ }).strict();
15867
+ var UpdateCompanyAssetRequest = external_exports.object({
15868
+ name: external_exports.string().trim().min(1).max(COMPANY_ASSET_NAME_MAX).optional(),
15869
+ kind: CompanyAssetKind.optional(),
15870
+ purpose: external_exports.string().trim().min(1).max(COMPANY_ASSET_PURPOSE_MAX).optional()
15871
+ }).strict();
15872
+
15811
15873
  // ../../packages/contracts/src/company-profile.ts
15812
15874
  var CompanyProfileSection = external_exports.enum([
15813
15875
  /** What the business is and what it sells. */
@@ -15867,8 +15929,13 @@ var CompanyProfileEntry = external_exports.object({
15867
15929
  var CompanyProfileHeader = external_exports.object({
15868
15930
  /** The company's own website, as the person gave it, normalized to https. */
15869
15931
  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(),
15932
+ /**
15933
+ * The Company asset (CP-6) holding the verified image bytes Zixt stores
15934
+ * itself, never a hotlink to their site. It lives in the shared asset
15935
+ * store rather than a collection of its own so a teammate can reach the
15936
+ * logo the same way it reaches every other company file.
15937
+ */
15938
+ logoAssetId: CompanyAssetId.nullable(),
15872
15939
  /** Where the logo was found, shown beside it so a person can check. */
15873
15940
  logoSourceUrl: external_exports.string().max(COMPANY_PROFILE_SOURCE_URL_MAX).nullable()
15874
15941
  }).strict();
@@ -18604,6 +18671,35 @@ var AgentOp = external_exports.union([
18604
18671
  }),
18605
18672
  /** Remove a company fact that is wrong or stale, by its id. */
18606
18673
  external_exports.object({ kind: external_exports.literal("company.forget"), entryId: CompanyProfileEntryId }),
18674
+ /**
18675
+ * Resolve one shared company file by the name a teammate used (CP-6). The
18676
+ * cloud answers with metadata only; the Host then pulls the bytes over its
18677
+ * own authenticated HTTP channel, exactly as a chat attachment arrives, so a
18678
+ * five-megabyte file never rides a WebSocket frame or an outbox document.
18679
+ */
18680
+ external_exports.object({
18681
+ kind: external_exports.literal("asset.resolve"),
18682
+ name: external_exports.string().min(1).max(COMPANY_ASSET_NAME_MAX)
18683
+ }),
18684
+ /**
18685
+ * Keep one file the whole organization should reuse. Bytes ride the agent-op
18686
+ * channel the way an artifact's do, bounded the same way; writing a name that
18687
+ * already exists replaces that file rather than minting a rival.
18688
+ */
18689
+ external_exports.object({
18690
+ kind: external_exports.literal("asset.put"),
18691
+ name: external_exports.string().min(1).max(COMPANY_ASSET_NAME_MAX),
18692
+ assetKind: CompanyAssetKind,
18693
+ purpose: external_exports.string().min(1).max(COMPANY_ASSET_PURPOSE_MAX),
18694
+ mediaType: external_exports.string().max(200).regex(/^[\w.+-]+\/[\w.+-]+$/),
18695
+ size: external_exports.number().int().min(1).max(COMPANY_ASSET_MAX_BYTES),
18696
+ data: external_exports.string().min(1).max(Math.ceil(COMPANY_ASSET_MAX_BYTES / 3 * 4) + 4)
18697
+ }),
18698
+ /** Remove a shared company file that is out of date, by name. */
18699
+ external_exports.object({
18700
+ kind: external_exports.literal("asset.forget"),
18701
+ name: external_exports.string().min(1).max(COMPANY_ASSET_NAME_MAX)
18702
+ }),
18607
18703
  /** The teammate's working-folder registry with per-Machine availability. */
18608
18704
  external_exports.object({ kind: external_exports.literal("workspace.list") }),
18609
18705
  /**
@@ -23393,7 +23489,7 @@ function runnerCommandCandidates(type, options = {}) {
23393
23489
  return platform === "win32" ? [join3(toolsRoot, "codex")] : [join3(toolsRoot, "bin", "codex")];
23394
23490
  }
23395
23491
  async function commandRuns(path) {
23396
- return new Promise((resolve19) => {
23492
+ return new Promise((resolve20) => {
23397
23493
  let child;
23398
23494
  try {
23399
23495
  child = spawnCli(path, ["--version"], {
@@ -23401,21 +23497,21 @@ async function commandRuns(path) {
23401
23497
  windowsHide: true
23402
23498
  });
23403
23499
  } catch {
23404
- resolve19(false);
23500
+ resolve20(false);
23405
23501
  return;
23406
23502
  }
23407
23503
  const timer = setTimeout(() => {
23408
23504
  child.kill();
23409
- resolve19(false);
23505
+ resolve20(false);
23410
23506
  }, 1e4);
23411
23507
  timer.unref?.();
23412
23508
  child.once("error", () => {
23413
23509
  clearTimeout(timer);
23414
- resolve19(false);
23510
+ resolve20(false);
23415
23511
  });
23416
23512
  child.once("exit", (code) => {
23417
23513
  clearTimeout(timer);
23418
- resolve19(code === 0);
23514
+ resolve20(code === 0);
23419
23515
  });
23420
23516
  });
23421
23517
  }
@@ -23621,7 +23717,7 @@ async function generateTaskTitle(instructions, runner) {
23621
23717
  instructions.slice(0, INSTRUCTIONS_BUDGET),
23622
23718
  "</task_request>"
23623
23719
  ].join("\n");
23624
- return new Promise((resolve19) => {
23720
+ return new Promise((resolve20) => {
23625
23721
  const child = spawnCli(
23626
23722
  command,
23627
23723
  [
@@ -23644,7 +23740,7 @@ async function generateTaskTitle(instructions, runner) {
23644
23740
  if (settled) return;
23645
23741
  settled = true;
23646
23742
  clearTimeout(timer);
23647
- resolve19(value);
23743
+ resolve20(value);
23648
23744
  };
23649
23745
  const timer = setTimeout(() => {
23650
23746
  child.kill();
@@ -23973,11 +24069,11 @@ function createWorkerWatchdogSendDrain() {
23973
24069
  if (completed) return;
23974
24070
  completed = true;
23975
24071
  pending--;
23976
- if (pending === 0) drained.splice(0).forEach((resolve19) => resolve19());
24072
+ if (pending === 0) drained.splice(0).forEach((resolve20) => resolve20());
23977
24073
  };
23978
24074
  },
23979
24075
  drain: async () => {
23980
- if (pending > 0) await new Promise((resolve19) => drained.push(resolve19));
24076
+ if (pending > 0) await new Promise((resolve20) => drained.push(resolve20));
23981
24077
  }
23982
24078
  };
23983
24079
  }
@@ -24494,7 +24590,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
24494
24590
  const deadline = Date.parse(retryAt);
24495
24591
  if (!Number.isFinite(deadline) || signal.aborted) return false;
24496
24592
  if (deadline <= Date.now()) return true;
24497
- return await new Promise((resolve19) => {
24593
+ return await new Promise((resolve20) => {
24498
24594
  let settled = false;
24499
24595
  let timer;
24500
24596
  const finish = (ready) => {
@@ -24502,7 +24598,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
24502
24598
  settled = true;
24503
24599
  if (timer) clearTimeout(timer);
24504
24600
  signal.removeEventListener("abort", onAbort);
24505
- resolve19(ready);
24601
+ resolve20(ready);
24506
24602
  };
24507
24603
  const onAbort = () => finish(false);
24508
24604
  const schedule = () => {
@@ -24783,27 +24879,27 @@ var HostClient = class _HostClient {
24783
24879
  const unwindingAssignments = [...this.activeAssignments.values()];
24784
24880
  for (const cancel of this.cancels.values()) cancel(stopReason);
24785
24881
  for (const entry of this.secretGrants.values()) {
24786
- for (const resolve19 of entry.resolvers) resolve19({});
24882
+ for (const resolve20 of entry.resolvers) resolve20({});
24787
24883
  entry.resolvers = [];
24788
24884
  delete entry.value;
24789
24885
  }
24790
24886
  for (const entry of this.connectionGrants.values()) {
24791
- for (const resolve19 of entry.resolvers) resolve19([]);
24887
+ for (const resolve20 of entry.resolvers) resolve20([]);
24792
24888
  entry.resolvers = [];
24793
24889
  delete entry.value;
24794
24890
  }
24795
24891
  for (const entry of this.providerGrants.values()) {
24796
- for (const resolve19 of entry.resolvers) resolve19([]);
24892
+ for (const resolve20 of entry.resolvers) resolve20([]);
24797
24893
  entry.resolvers = [];
24798
24894
  delete entry.value;
24799
24895
  }
24800
24896
  for (const entry of this.integrationToolServerGrants.values()) {
24801
- for (const resolve19 of entry.resolvers) resolve19([]);
24897
+ for (const resolve20 of entry.resolvers) resolve20([]);
24802
24898
  entry.resolvers = [];
24803
24899
  delete entry.value;
24804
24900
  }
24805
24901
  for (const waiters of this.approvalWaiters.values()) {
24806
- for (const resolve19 of waiters.values()) resolve19({ approved: false, guidance: reason });
24902
+ for (const resolve20 of waiters.values()) resolve20({ approved: false, guidance: reason });
24807
24903
  }
24808
24904
  for (const waiters of this.agentOpWaiters.values()) {
24809
24905
  for (const waiter of waiters.values()) {
@@ -24830,9 +24926,9 @@ var HostClient = class _HostClient {
24830
24926
  let drainTimer;
24831
24927
  const drained = await Promise.race([
24832
24928
  Promise.allSettled(runs).then(() => true),
24833
- new Promise((resolve19) => {
24929
+ new Promise((resolve20) => {
24834
24930
  drainTimer = setTimeout(
24835
- () => resolve19(false),
24931
+ () => resolve20(false),
24836
24932
  this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
24837
24933
  );
24838
24934
  drainTimer.unref?.();
@@ -24985,9 +25081,9 @@ var HostClient = class _HostClient {
24985
25081
  let frameDrainTimer;
24986
25082
  const framesDrained = await Promise.race([
24987
25083
  frameTail.then(() => true),
24988
- new Promise((resolve19) => {
25084
+ new Promise((resolve20) => {
24989
25085
  frameDrainTimer = setTimeout(
24990
- () => resolve19(false),
25086
+ () => resolve20(false),
24991
25087
  this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
24992
25088
  );
24993
25089
  frameDrainTimer.unref?.();
@@ -25500,17 +25596,24 @@ var HostClient = class _HostClient {
25500
25596
  * The /gateway WebSocket origin answers plain HTTPS too; attachment bytes
25501
25597
  * ride that, authenticated by the same host token as the socket (TS-15).
25502
25598
  */
25599
+ /** CP-6: same channel, same token, a different Zixt-owned collection. */
25600
+ async fetchCompanyAsset(assetId, signal) {
25601
+ return this.fetchGatewayBytes(`/gateway/company-assets/${assetId}`, "company file", signal);
25602
+ }
25503
25603
  async fetchAttachment(attachmentId, signal) {
25604
+ return this.fetchGatewayBytes(`/gateway/attachments/${attachmentId}`, "attachment", signal);
25605
+ }
25606
+ async fetchGatewayBytes(pathname, label, signal) {
25504
25607
  const url3 = new URL(this.opts.url);
25505
25608
  url3.protocol = url3.protocol === "wss:" ? "https:" : "http:";
25506
- url3.pathname = `/gateway/attachments/${attachmentId}`;
25609
+ url3.pathname = pathname;
25507
25610
  url3.search = "";
25508
25611
  const response = await fetch(url3, {
25509
25612
  headers: { authorization: `Bearer ${this.opts.token}` },
25510
25613
  signal
25511
25614
  });
25512
25615
  if (!response.ok) {
25513
- throw new Error(`attachment download failed (${response.status})`);
25616
+ throw new Error(`${label} download failed (${response.status})`);
25514
25617
  }
25515
25618
  return new Uint8Array(await response.arrayBuffer());
25516
25619
  }
@@ -25565,7 +25668,7 @@ var HostClient = class _HostClient {
25565
25668
  const entry = this.secretGrants.get(key) ?? { resolvers: [] };
25566
25669
  entry.value = message.secrets;
25567
25670
  entry.expiresAt = expiresAt;
25568
- for (const resolve19 of entry.resolvers) resolve19(message.secrets);
25671
+ for (const resolve20 of entry.resolvers) resolve20(message.secrets);
25569
25672
  entry.resolvers = [];
25570
25673
  this.secretGrants.set(key, entry);
25571
25674
  return;
@@ -25596,19 +25699,19 @@ var HostClient = class _HostClient {
25596
25699
  const entry = this.connectionGrants.get(key) ?? { resolvers: [] };
25597
25700
  entry.value = message.connections;
25598
25701
  entry.expiresAt = expiresAt;
25599
- for (const resolve19 of entry.resolvers) resolve19(message.connections);
25702
+ for (const resolve20 of entry.resolvers) resolve20(message.connections);
25600
25703
  entry.resolvers = [];
25601
25704
  this.connectionGrants.set(key, entry);
25602
25705
  const providerEntry = this.providerGrants.get(key) ?? { resolvers: [] };
25603
25706
  providerEntry.value = providers;
25604
25707
  providerEntry.expiresAt = authorityExpiresAt;
25605
- for (const resolve19 of providerEntry.resolvers) resolve19(providers);
25708
+ for (const resolve20 of providerEntry.resolvers) resolve20(providers);
25606
25709
  providerEntry.resolvers = [];
25607
25710
  this.providerGrants.set(key, providerEntry);
25608
25711
  const toolServerEntry = this.integrationToolServerGrants.get(key) ?? { resolvers: [] };
25609
25712
  const toolServers = [...message.toolServers ?? []];
25610
25713
  toolServerEntry.value = toolServers;
25611
- for (const resolve19 of toolServerEntry.resolvers) resolve19(toolServers);
25714
+ for (const resolve20 of toolServerEntry.resolvers) resolve20(toolServers);
25612
25715
  toolServerEntry.resolvers = [];
25613
25716
  this.integrationToolServerGrants.set(key, toolServerEntry);
25614
25717
  return;
@@ -25747,8 +25850,8 @@ var HostClient = class _HostClient {
25747
25850
  return redactCredentialText(text, sensitiveSnapshot()).slice(0, maxLength);
25748
25851
  };
25749
25852
  let resolveCancelled;
25750
- const cancelledPromise = new Promise((resolve19) => {
25751
- resolveCancelled = resolve19;
25853
+ const cancelledPromise = new Promise((resolve20) => {
25854
+ resolveCancelled = resolve20;
25752
25855
  });
25753
25856
  const endAuthority = (reason = "cloud_cancel") => {
25754
25857
  if (stopReason) return;
@@ -25757,28 +25860,28 @@ var HostClient = class _HostClient {
25757
25860
  authorityController.abort(reason);
25758
25861
  const secretEntry = this.secretGrants.get(cancelKey);
25759
25862
  if (secretEntry) {
25760
- for (const resolve19 of secretEntry.resolvers) resolve19({});
25863
+ for (const resolve20 of secretEntry.resolvers) resolve20({});
25761
25864
  secretEntry.resolvers = [];
25762
25865
  delete secretEntry.value;
25763
25866
  }
25764
25867
  this.secretGrants.delete(cancelKey);
25765
25868
  const connectionEntry = this.connectionGrants.get(cancelKey);
25766
25869
  if (connectionEntry) {
25767
- for (const resolve19 of connectionEntry.resolvers) resolve19([]);
25870
+ for (const resolve20 of connectionEntry.resolvers) resolve20([]);
25768
25871
  connectionEntry.resolvers = [];
25769
25872
  delete connectionEntry.value;
25770
25873
  }
25771
25874
  this.connectionGrants.delete(cancelKey);
25772
25875
  const providerEntry = this.providerGrants.get(cancelKey);
25773
25876
  if (providerEntry) {
25774
- for (const resolve19 of providerEntry.resolvers) resolve19([]);
25877
+ for (const resolve20 of providerEntry.resolvers) resolve20([]);
25775
25878
  providerEntry.resolvers = [];
25776
25879
  delete providerEntry.value;
25777
25880
  }
25778
25881
  this.providerGrants.delete(cancelKey);
25779
25882
  const toolServerEntry = this.integrationToolServerGrants.get(cancelKey);
25780
25883
  if (toolServerEntry) {
25781
- for (const resolve19 of toolServerEntry.resolvers) resolve19([]);
25884
+ for (const resolve20 of toolServerEntry.resolvers) resolve20([]);
25782
25885
  toolServerEntry.resolvers = [];
25783
25886
  delete toolServerEntry.value;
25784
25887
  }
@@ -25786,8 +25889,8 @@ var HostClient = class _HostClient {
25786
25889
  this.clearAuthorityExpiry(cancelKey);
25787
25890
  const approvalWaiters = this.approvalWaiters.get(cancelKey);
25788
25891
  if (approvalWaiters) {
25789
- for (const resolve19 of approvalWaiters.values()) {
25790
- resolve19({ approved: false, guidance: "task was cancelled" });
25892
+ for (const resolve20 of approvalWaiters.values()) {
25893
+ resolve20({ approved: false, guidance: "task was cancelled" });
25791
25894
  }
25792
25895
  approvalWaiters.clear();
25793
25896
  }
@@ -25913,9 +26016,9 @@ var HostClient = class _HostClient {
25913
26016
  return value;
25914
26017
  };
25915
26018
  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);
26019
+ return new Promise((resolve20) => {
26020
+ entry.resolvers.push((value) => resolve20(capture(value)));
26021
+ setTimeout(() => resolve20(capture(entry.value ?? {})), _HostClient.SECRETS_WAIT_MS);
25919
26022
  });
25920
26023
  };
25921
26024
  const connections = () => {
@@ -25932,9 +26035,9 @@ var HostClient = class _HostClient {
25932
26035
  return value;
25933
26036
  };
25934
26037
  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);
26038
+ return new Promise((resolve20) => {
26039
+ entry.resolvers.push((value) => resolve20(capture(value)));
26040
+ setTimeout(() => resolve20(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
25938
26041
  });
25939
26042
  };
25940
26043
  const providers = () => {
@@ -25951,9 +26054,9 @@ var HostClient = class _HostClient {
25951
26054
  return value;
25952
26055
  };
25953
26056
  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);
26057
+ return new Promise((resolve20) => {
26058
+ entry.resolvers.push((value) => resolve20(capture(value)));
26059
+ setTimeout(() => resolve20(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
25957
26060
  });
25958
26061
  };
25959
26062
  const integrationToolServers = () => {
@@ -25962,9 +26065,9 @@ var HostClient = class _HostClient {
25962
26065
  this.integrationToolServerGrants.set(cancelKey, entry);
25963
26066
  const capture = (value) => authorityController.signal.aborted ? [] : value;
25964
26067
  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);
26068
+ return new Promise((resolve20) => {
26069
+ entry.resolvers.push((value) => resolve20(capture(value)));
26070
+ setTimeout(() => resolve20(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
25968
26071
  });
25969
26072
  };
25970
26073
  const linear = async () => {
@@ -25991,13 +26094,13 @@ var HostClient = class _HostClient {
25991
26094
  ...questionChoices ? { questionChoices: [...questionChoices] } : {},
25992
26095
  ...questionnaire ? { questionnaire } : {}
25993
26096
  });
25994
- return new Promise((resolve19) => {
26097
+ return new Promise((resolve20) => {
25995
26098
  const waiters = this.approvalWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
25996
26099
  this.approvalWaiters.set(cancelKey, waiters);
25997
- waiters.set(requestId, resolve19);
26100
+ waiters.set(requestId, resolve20);
25998
26101
  void cancelledPromise.then(() => {
25999
26102
  if (waiters.delete(requestId)) {
26000
- resolve19({ approved: false, guidance: "task was cancelled" });
26103
+ resolve20({ approved: false, guidance: "task was cancelled" });
26001
26104
  }
26002
26105
  });
26003
26106
  });
@@ -26043,11 +26146,11 @@ var HostClient = class _HostClient {
26043
26146
  if (existing) message = existing;
26044
26147
  else terminalMessages.set(requestId, message);
26045
26148
  }
26046
- return new Promise((resolve19) => {
26149
+ return new Promise((resolve20) => {
26047
26150
  const waiters = this.agentOpWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
26048
26151
  this.agentOpWaiters.set(cancelKey, waiters);
26049
26152
  if (waiters.has(requestId)) {
26050
- resolve19({ ok: false, error: "provider settlement request is already in flight" });
26153
+ resolve20({ ok: false, error: "provider settlement request is already in flight" });
26051
26154
  return;
26052
26155
  }
26053
26156
  const timer = setTimeout(() => {
@@ -26058,7 +26161,7 @@ var HostClient = class _HostClient {
26058
26161
  (pending) => !(pending.type === "agent.op" && pending.requestId === requestId)
26059
26162
  );
26060
26163
  }
26061
- resolve19({
26164
+ resolve20({
26062
26165
  ok: false,
26063
26166
  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
26167
  });
@@ -26066,7 +26169,7 @@ var HostClient = class _HostClient {
26066
26169
  }, _HostClient.AGENT_OP_TIMEOUT_MS);
26067
26170
  timer.unref?.();
26068
26171
  waiters.set(requestId, {
26069
- resolve: resolve19,
26172
+ resolve: resolve20,
26070
26173
  timer,
26071
26174
  ...terminal ? { terminalMessage: message } : {}
26072
26175
  });
@@ -26112,12 +26215,12 @@ var HostClient = class _HostClient {
26112
26215
  "No GitHub change was attempted; the authority grant request was invalid."
26113
26216
  );
26114
26217
  }
26115
- const outcome = await new Promise((resolve19) => {
26218
+ const outcome = await new Promise((resolve20) => {
26116
26219
  const timer = setTimeout(() => {
26117
26220
  const waiter = this.operationGrantWaiters.get(requestId);
26118
26221
  if (!waiter) return;
26119
26222
  this.operationGrantWaiters.delete(requestId);
26120
- resolve19({ grant: null, retryable: true, reason: "no_reply_from_zixt" });
26223
+ resolve20({ grant: null, retryable: true, reason: "no_reply_from_zixt" });
26121
26224
  }, this.operationGrantTimeoutMs);
26122
26225
  timer.unref?.();
26123
26226
  this.operationGrantWaiters.set(requestId, {
@@ -26130,9 +26233,9 @@ var HostClient = class _HostClient {
26130
26233
  timer,
26131
26234
  accept: (grant) => {
26132
26235
  addSensitiveValues(providerGrantSensitiveValues(grant));
26133
- resolve19({ grant });
26236
+ resolve20({ grant });
26134
26237
  },
26135
- deny: (retryable, reason, detail, retryAt, retryCode) => resolve19({
26238
+ deny: (retryable, reason, detail, retryAt, retryCode) => resolve20({
26136
26239
  grant: null,
26137
26240
  retryable,
26138
26241
  reason,
@@ -26146,7 +26249,7 @@ var HostClient = class _HostClient {
26146
26249
  } catch {
26147
26250
  clearTimeout(timer);
26148
26251
  this.operationGrantWaiters.delete(requestId);
26149
- resolve19({ grant: null, retryable: false, reason: "connection_unavailable" });
26252
+ resolve20({ grant: null, retryable: false, reason: "connection_unavailable" });
26150
26253
  }
26151
26254
  });
26152
26255
  if (outcome.grant) {
@@ -26202,7 +26305,7 @@ var HostClient = class _HostClient {
26202
26305
  )
26203
26306
  );
26204
26307
  }
26205
- return new Promise((resolve19, reject3) => {
26308
+ return new Promise((resolve20, reject3) => {
26206
26309
  const timer = setTimeout(() => {
26207
26310
  if (this.browserCredentialWaiters.delete(requestId)) {
26208
26311
  reject3(
@@ -26221,7 +26324,7 @@ var HostClient = class _HostClient {
26221
26324
  timer,
26222
26325
  accept: (credential) => {
26223
26326
  addSensitiveValues(webLoginSensitiveValues(credential));
26224
- resolve19(credential);
26327
+ resolve20(credential);
26225
26328
  },
26226
26329
  deny: (reason) => reject3(new Error(reason))
26227
26330
  });
@@ -26249,6 +26352,7 @@ var HostClient = class _HostClient {
26249
26352
  runnerRuntime: emitRunnerRuntime,
26250
26353
  siblingTasks: () => [...this.liveTasks.values()].filter((live) => live.agentId === assign.agentId && live.taskId !== assign.taskId).map(({ taskId, title }) => ({ taskId, title })),
26251
26354
  fetchAttachment: (attachmentId) => this.fetchAttachment(attachmentId, authorityController.signal),
26355
+ fetchCompanyAsset: (assetId) => this.fetchCompanyAsset(assetId, authorityController.signal),
26252
26356
  followUps: (handler5) => {
26253
26357
  if (cancelled) return () => {
26254
26358
  };
@@ -26547,14 +26651,14 @@ async function observeWindowsGuardianNonce(pid, nonce) {
26547
26651
  "Windows runner identity could not be observed"
26548
26652
  );
26549
26653
  }
26550
- return new Promise((resolve19, reject3) => {
26654
+ return new Promise((resolve20, reject3) => {
26551
26655
  let done = false;
26552
26656
  const finish = (result) => {
26553
26657
  if (done) return;
26554
26658
  done = true;
26555
26659
  clearTimeout(timeout);
26556
26660
  if (result instanceof Error) reject3(result);
26557
- else resolve19(result);
26661
+ else resolve20(result);
26558
26662
  };
26559
26663
  const timeout = setTimeout(
26560
26664
  () => finish(
@@ -26599,7 +26703,7 @@ async function observePosixGuardianNonce(pid, nonce) {
26599
26703
  );
26600
26704
  }
26601
26705
  }
26602
- return new Promise((resolve19, reject3) => {
26706
+ return new Promise((resolve20, reject3) => {
26603
26707
  const observer = spawn3("/bin/ps", ["-ww", "-o", "command=", "-p", String(pid)], {
26604
26708
  stdio: ["ignore", "pipe", "ignore"]
26605
26709
  });
@@ -26610,7 +26714,7 @@ async function observePosixGuardianNonce(pid, nonce) {
26610
26714
  done = true;
26611
26715
  clearTimeout(timeout);
26612
26716
  if (result instanceof Error) reject3(result);
26613
- else resolve19(result);
26717
+ else resolve20(result);
26614
26718
  };
26615
26719
  const timeout = setTimeout(() => {
26616
26720
  observer.kill("SIGKILL");
@@ -26657,7 +26761,7 @@ async function observeGuardianIdentity(pid, identity) {
26657
26761
  return process.platform === "win32" ? observeWindowsGuardianNonce(pid, identity.nonce) : observePosixGuardianNonce(pid, identity.nonce);
26658
26762
  }
26659
26763
  function delay(ms) {
26660
- return new Promise((resolve19) => setTimeout(resolve19, ms));
26764
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
26661
26765
  }
26662
26766
  function posixProcessRecordsFromPs(output) {
26663
26767
  const records = [];
@@ -26690,7 +26794,7 @@ function posixProcessRecordsFromPs(output) {
26690
26794
  return records;
26691
26795
  }
26692
26796
  async function snapshotPosixProcesses() {
26693
- return new Promise((resolve19, reject3) => {
26797
+ return new Promise((resolve20, reject3) => {
26694
26798
  const observer = spawn3("/bin/ps", ["-axo", "uid=,pid=,ppid=,pgid=,stat="], {
26695
26799
  stdio: ["ignore", "pipe", "ignore"]
26696
26800
  });
@@ -26703,7 +26807,7 @@ async function snapshotPosixProcesses() {
26703
26807
  if (error52) reject3(error52);
26704
26808
  else {
26705
26809
  try {
26706
- resolve19(posixProcessRecordsFromPs(output));
26810
+ resolve20(posixProcessRecordsFromPs(output));
26707
26811
  } catch (caught) {
26708
26812
  reject3(caught);
26709
26813
  }
@@ -27038,7 +27142,7 @@ async function snapshotWindowsDescendants(rootPid) {
27038
27142
  "Windows process-tree observation could not start"
27039
27143
  );
27040
27144
  }
27041
- return new Promise((resolve19, reject3) => {
27145
+ return new Promise((resolve20, reject3) => {
27042
27146
  let done = false;
27043
27147
  const timeout = setTimeout(() => {
27044
27148
  if (done) return;
@@ -27065,7 +27169,7 @@ async function snapshotWindowsDescendants(rootPid) {
27065
27169
  return;
27066
27170
  }
27067
27171
  try {
27068
- resolve19(completeWindowsDescendantPids(rootPid, processes));
27172
+ resolve20(completeWindowsDescendantPids(rootPid, processes));
27069
27173
  } catch (caught) {
27070
27174
  reject3(caught);
27071
27175
  }
@@ -27112,7 +27216,7 @@ async function waitForProcessesExit(pids, timeoutMs) {
27112
27216
  }
27113
27217
  async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, independentlyTrackedPids = []) {
27114
27218
  const trustedCommand = command ?? defaultTaskkillCommand();
27115
- const result = await new Promise((resolve19, reject3) => {
27219
+ const result = await new Promise((resolve20, reject3) => {
27116
27220
  const killer = spawn3(trustedCommand, ["/PID", String(pid), "/T", "/F"], {
27117
27221
  stdio: ["ignore", "pipe", "pipe"],
27118
27222
  windowsHide: true
@@ -27147,7 +27251,7 @@ async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, indepe
27147
27251
  done = true;
27148
27252
  clearTimeout(timeout);
27149
27253
  if (error52) reject3(error52);
27150
- else resolve19({ code: killer.exitCode, output, outputTruncated });
27254
+ else resolve20({ code: killer.exitCode, output, outputTruncated });
27151
27255
  };
27152
27256
  killer.once(
27153
27257
  "error",
@@ -27951,12 +28055,12 @@ async function createWindowsJobContainment(pid, options) {
27951
28055
  stderr = `${stderr}${String(chunk)}`.slice(-HELPER_OUTPUT_LIMIT);
27952
28056
  });
27953
28057
  const helperEvents = helper;
27954
- const exited = new Promise((resolve19) => {
28058
+ const exited = new Promise((resolve20) => {
27955
28059
  let completed = false;
27956
28060
  const complete = (code, signal) => {
27957
28061
  if (completed) return;
27958
28062
  completed = true;
27959
- resolve19({ code, signal });
28063
+ resolve20({ code, signal });
27960
28064
  };
27961
28065
  helperEvents.once("error", () => {
27962
28066
  failProtocol(new Error("Windows Job Object helper could not start"));
@@ -27969,7 +28073,7 @@ async function createWindowsJobContainment(pid, options) {
27969
28073
  });
27970
28074
  const nextLine = async (expected) => {
27971
28075
  if (protocolFailure) throw protocolFailure;
27972
- const line = lines.shift() ?? await new Promise((resolve19, reject3) => {
28076
+ const line = lines.shift() ?? await new Promise((resolve20, reject3) => {
27973
28077
  const timer = setTimeout(
27974
28078
  () => reject3(timeoutError("Windows Job Object helper did not answer in time")),
27975
28079
  timeoutMs
@@ -27977,7 +28081,7 @@ async function createWindowsJobContainment(pid, options) {
27977
28081
  timer.unref?.();
27978
28082
  lineWaiters.push((value) => {
27979
28083
  clearTimeout(timer);
27980
- resolve19(value);
28084
+ resolve20(value);
27981
28085
  });
27982
28086
  });
27983
28087
  if (protocolFailure) throw protocolFailure;
@@ -27990,8 +28094,8 @@ async function createWindowsJobContainment(pid, options) {
27990
28094
  }
27991
28095
  const stopped = await Promise.race([
27992
28096
  exited.then(() => true),
27993
- new Promise((resolve19) => {
27994
- const timer = setTimeout(() => resolve19(false), timeoutMs);
28097
+ new Promise((resolve20) => {
28098
+ const timer = setTimeout(() => resolve20(false), timeoutMs);
27995
28099
  timer.unref?.();
27996
28100
  })
27997
28101
  ]);
@@ -28050,7 +28154,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
28050
28154
  if (nonce === void 0) return true;
28051
28155
  if (!SAFE_NONCE2.test(nonce)) return false;
28052
28156
  const expected = windowsContainmentGate(nonce).trimEnd();
28053
- return new Promise((resolve19) => {
28157
+ return new Promise((resolve20) => {
28054
28158
  let pending = Buffer.alloc(0);
28055
28159
  let settled = false;
28056
28160
  const finish = (result) => {
@@ -28061,7 +28165,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
28061
28165
  input.off("end", onEnd);
28062
28166
  input.off("error", onEnd);
28063
28167
  if (result) input.pause();
28064
- resolve19(result);
28168
+ resolve20(result);
28065
28169
  };
28066
28170
  const onData = (chunk) => {
28067
28171
  pending = Buffer.concat([pending, chunk]);
@@ -29165,7 +29269,7 @@ async function installRelease(version2, options = {}) {
29165
29269
  }) : Promise.resolve(null);
29166
29270
  const timeoutMs = options.timeoutMs ?? INSTALL_TIMEOUT_MS2;
29167
29271
  const outcome = { code: null, signal: null, timedOut: false, spawnError: null };
29168
- const installed = await new Promise((resolve19, reject3) => {
29272
+ const installed = await new Promise((resolve20, reject3) => {
29169
29273
  let finished = false;
29170
29274
  let cleanupStarted = false;
29171
29275
  let exitObserved = false;
@@ -29181,7 +29285,7 @@ async function installRelease(version2, options = {}) {
29181
29285
  finished = true;
29182
29286
  clearTimeout(timer);
29183
29287
  options.signal?.removeEventListener("abort", requestCleanup);
29184
- resolve19(result);
29288
+ resolve20(result);
29185
29289
  };
29186
29290
  const requestCleanup = () => {
29187
29291
  if (cleanupStarted || finished) return;
@@ -29546,11 +29650,11 @@ async function runWorkerCompatibilityProxy(env = process.env, argv = process.arg
29546
29650
  child.stdin?.on("error", () => {
29547
29651
  });
29548
29652
  process.stdin.pipe(child.stdin);
29549
- return new Promise((resolve19) => {
29550
- child.once("error", () => resolve19(1));
29653
+ return new Promise((resolve20) => {
29654
+ child.once("error", () => resolve20(1));
29551
29655
  child.once("exit", (code) => {
29552
29656
  process.stdin.unpipe(child.stdin);
29553
- resolve19(code ?? 1);
29657
+ resolve20(code ?? 1);
29554
29658
  });
29555
29659
  });
29556
29660
  }
@@ -29630,11 +29734,11 @@ async function launchHostSupervisor(options = {}) {
29630
29734
  const waitOrStop = async (ms) => {
29631
29735
  if (stopping) return false;
29632
29736
  if (!customDelay) {
29633
- await new Promise((resolve19) => {
29737
+ await new Promise((resolve20) => {
29634
29738
  const finish = () => {
29635
29739
  clearTimeout(timer);
29636
29740
  stopController.signal.removeEventListener("abort", finish);
29637
- resolve19();
29741
+ resolve20();
29638
29742
  };
29639
29743
  const timer = setTimeout(finish, ms);
29640
29744
  stopController.signal.addEventListener("abort", finish, { once: true });
@@ -29642,8 +29746,8 @@ async function launchHostSupervisor(options = {}) {
29642
29746
  return !stopping;
29643
29747
  }
29644
29748
  let finishStop;
29645
- const stopped = new Promise((resolve19) => {
29646
- finishStop = () => resolve19();
29749
+ const stopped = new Promise((resolve20) => {
29750
+ finishStop = () => resolve20();
29647
29751
  stopController.signal.addEventListener("abort", finishStop, { once: true });
29648
29752
  });
29649
29753
  await Promise.race([customDelay(ms), stopped]);
@@ -29773,19 +29877,19 @@ async function launchHostSupervisor(options = {}) {
29773
29877
  child = spawnSupervisor(entry, version2, ownershipDirectory, containmentGateNonce);
29774
29878
  const launchedSupervisor = child;
29775
29879
  let resolveChildExited;
29776
- const childExited = new Promise((resolve19) => {
29777
- resolveChildExited = resolve19;
29880
+ const childExited = new Promise((resolve20) => {
29881
+ resolveChildExited = resolve20;
29778
29882
  });
29779
29883
  const supervisorContainmentAbort = new AbortController();
29780
29884
  void childExited.then(() => supervisorContainmentAbort.abort());
29781
29885
  const outcomePromise = new Promise(
29782
- (resolve19) => {
29886
+ (resolve20) => {
29783
29887
  let observed = false;
29784
29888
  const finish = (code, signal) => {
29785
29889
  if (observed) return;
29786
29890
  observed = true;
29787
29891
  resolveChildExited();
29788
- resolve19({ code, signal });
29892
+ resolve20({ code, signal });
29789
29893
  };
29790
29894
  child.once("error", () => finish(1, null));
29791
29895
  child.once("exit", finish);
@@ -29806,12 +29910,12 @@ async function launchHostSupervisor(options = {}) {
29806
29910
  if (!supervisorContainment || !launchedSupervisor.stdin) {
29807
29911
  throw new Error("supervisor Job Object gate is unavailable");
29808
29912
  }
29809
- await new Promise((resolve19, reject3) => {
29913
+ await new Promise((resolve20, reject3) => {
29810
29914
  launchedSupervisor.stdin.write(
29811
29915
  windowsContainmentGate(containmentGateNonce),
29812
29916
  (error52) => {
29813
29917
  if (error52) reject3(error52);
29814
- else resolve19();
29918
+ else resolve20();
29815
29919
  }
29816
29920
  );
29817
29921
  });
@@ -29959,19 +30063,19 @@ async function superviseHost(options = {}) {
29959
30063
  }
29960
30064
  }
29961
30065
  let announceShutdown;
29962
- const shutdownAnnounced = new Promise((resolve19) => {
29963
- announceShutdown = resolve19;
30066
+ const shutdownAnnounced = new Promise((resolve20) => {
30067
+ announceShutdown = resolve20;
29964
30068
  });
29965
30069
  const attempted = /* @__PURE__ */ new Set();
29966
30070
  let unsatisfiableUpdates = 0;
29967
30071
  const waitOrShutdown = async (ms) => {
29968
30072
  if (shuttingDown2) return false;
29969
30073
  if (!customDelay) {
29970
- await new Promise((resolve19) => {
30074
+ await new Promise((resolve20) => {
29971
30075
  const finish = () => {
29972
30076
  clearTimeout(timer);
29973
30077
  shutdownController.signal.removeEventListener("abort", finish);
29974
- resolve19();
30078
+ resolve20();
29975
30079
  };
29976
30080
  const timer = setTimeout(finish, ms);
29977
30081
  shutdownController.signal.addEventListener("abort", finish, { once: true });
@@ -30121,19 +30225,19 @@ async function superviseHost(options = {}) {
30121
30225
  const watchedChild = child;
30122
30226
  const workerStderr = captureWorkerStderr(watchedChild);
30123
30227
  let resolveChildExited;
30124
- const childExited = new Promise((resolve19) => {
30125
- resolveChildExited = resolve19;
30228
+ const childExited = new Promise((resolve20) => {
30229
+ resolveChildExited = resolve20;
30126
30230
  });
30127
30231
  const workerContainmentAbort = new AbortController();
30128
30232
  void childExited.then(() => workerContainmentAbort.abort());
30129
30233
  const outcomePromise = new Promise(
30130
- (resolve19) => {
30234
+ (resolve20) => {
30131
30235
  let observed = false;
30132
30236
  const finish = (result) => {
30133
30237
  if (observed) return;
30134
30238
  observed = true;
30135
30239
  resolveChildExited();
30136
- resolve19(result);
30240
+ resolve20(result);
30137
30241
  };
30138
30242
  watchedChild.once("error", () => finish({ code: 1, signal: null }));
30139
30243
  watchedChild.once(
@@ -30155,10 +30259,10 @@ async function superviseHost(options = {}) {
30155
30259
  if (!workerContainment || !watchedChild.stdin) {
30156
30260
  throw new Error("worker Job Object gate is unavailable");
30157
30261
  }
30158
- await new Promise((resolve19, reject3) => {
30262
+ await new Promise((resolve20, reject3) => {
30159
30263
  watchedChild.stdin.write(windowsContainmentGate(containmentGateNonce), (error52) => {
30160
30264
  if (error52) reject3(error52);
30161
- else resolve19();
30265
+ else resolve20();
30162
30266
  });
30163
30267
  });
30164
30268
  }
@@ -31336,7 +31440,7 @@ async function loadPlaywright() {
31336
31440
  }
31337
31441
  async function installChromium() {
31338
31442
  const cliPath = join12(playwrightCoreRoot, "cli.js");
31339
- await new Promise((resolve19, reject3) => {
31443
+ await new Promise((resolve20, reject3) => {
31340
31444
  const child = spawn7(process.execPath, [cliPath, "install", "chromium"], {
31341
31445
  env: process.env,
31342
31446
  stdio: ["ignore", "inherit", "inherit"],
@@ -31351,7 +31455,7 @@ async function installChromium() {
31351
31455
  settled = true;
31352
31456
  clearTimeout(timeout);
31353
31457
  if (error52) reject3(error52);
31354
- else resolve19();
31458
+ else resolve20();
31355
31459
  };
31356
31460
  const timeout = setTimeout(() => {
31357
31461
  child.kill();
@@ -31971,9 +32075,9 @@ function createPlaywrightBrowserAdapterFactory(dependencies = {}) {
31971
32075
  // src/runners/cli-runner.ts
31972
32076
  import { spawn as spawn11 } from "node:child_process";
31973
32077
  import { randomUUID as randomUUID12 } from "node:crypto";
31974
- import { lstat as lstat11, mkdir as mkdir13, realpath as realpath8 } from "node:fs/promises";
32078
+ import { lstat as lstat11, mkdir as mkdir14, realpath as realpath8 } from "node:fs/promises";
31975
32079
  import { homedir as homedir7 } from "node:os";
31976
- import { dirname as dirname10, isAbsolute as isAbsolute16, join as join19, resolve as resolve10 } from "node:path";
32080
+ import { dirname as dirname10, isAbsolute as isAbsolute17, join as join20, resolve as resolve11 } from "node:path";
31977
32081
 
31978
32082
  // src/tool-packs/browser/authentication-wall.ts
31979
32083
  var AUTH_PATH_SEGMENT = /(?:^|\/)(?:log[-_]?in|sign[-_]?in|sso|saml|auth|authorize|authenticate|oauth2?|session\/new|checkpoint)(?:\/|$)/i;
@@ -35155,8 +35259,8 @@ async function runGit(input, args, env) {
35155
35259
  let settled = false;
35156
35260
  let stopping = false;
35157
35261
  let resolveExited;
35158
- const exited = new Promise((resolve19) => {
35159
- resolveExited = resolve19;
35262
+ const exited = new Promise((resolve20) => {
35263
+ resolveExited = resolve20;
35160
35264
  });
35161
35265
  child.once("exit", resolveExited);
35162
35266
  const cleanup = () => {
@@ -37966,8 +38070,8 @@ var linearToolPackFactory = {
37966
38070
  async create(grant, context) {
37967
38071
  let resolveCancelled;
37968
38072
  let closed = false;
37969
- const cancelled = new Promise((resolve19) => {
37970
- resolveCancelled = resolve19;
38073
+ const cancelled = new Promise((resolve20) => {
38074
+ resolveCancelled = resolve20;
37971
38075
  });
37972
38076
  const cancel = () => {
37973
38077
  if (closed) return;
@@ -39188,6 +39292,47 @@ var TOOLS = [
39188
39292
  required: ["agent_id"]
39189
39293
  }
39190
39294
  },
39295
+ {
39296
+ name: "get_company_asset",
39297
+ 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.",
39298
+ inputSchema: {
39299
+ type: "object",
39300
+ properties: {
39301
+ name: { type: "string", description: "The company file name." }
39302
+ },
39303
+ required: ["name"]
39304
+ }
39305
+ },
39306
+ {
39307
+ name: "put_company_asset",
39308
+ 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.",
39309
+ inputSchema: {
39310
+ type: "object",
39311
+ properties: {
39312
+ name: { type: "string", description: "Short name teammates will ask for it by." },
39313
+ path: { type: "string", description: "Path to the file in your working folder." },
39314
+ kind: {
39315
+ type: "string",
39316
+ enum: ["logo", "image", "document", "text", "data", "other"],
39317
+ description: "What sort of file this is."
39318
+ },
39319
+ purpose: {
39320
+ type: "string",
39321
+ description: "One line: what it is and when a teammate should reach for it."
39322
+ }
39323
+ },
39324
+ required: ["name", "path", "kind", "purpose"]
39325
+ }
39326
+ },
39327
+ {
39328
+ name: "forget_company_asset",
39329
+ description: "Remove a shared company file that is out of date or was never right, by its name.",
39330
+ inputSchema: {
39331
+ type: "object",
39332
+ properties: { name: { type: "string", description: "The company file name." } },
39333
+ required: ["name"]
39334
+ }
39335
+ },
39191
39336
  {
39192
39337
  name: "note_company_fact",
39193
39338
  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 +39724,8 @@ function opFor(name, args) {
39579
39724
  }
39580
39725
  case "forget_company_fact":
39581
39726
  return { kind: "company.forget", entryId: str("entry_id") };
39727
+ case "forget_company_asset":
39728
+ return { kind: "asset.forget", name: str("name") };
39582
39729
  case "list_workspaces":
39583
39730
  return { kind: "workspace.list" };
39584
39731
  case "add_workspace":
@@ -39680,7 +39827,7 @@ function createAskUserServer() {
39680
39827
  let server;
39681
39828
  let listening;
39682
39829
  function ensureListening() {
39683
- listening ??= new Promise((resolve19, reject3) => {
39830
+ listening ??= new Promise((resolve20, reject3) => {
39684
39831
  server = createServer2((req, res) => {
39685
39832
  res.on("error", () => {
39686
39833
  });
@@ -39696,7 +39843,7 @@ function createAskUserServer() {
39696
39843
  server.on("error", reject3);
39697
39844
  server.listen(0, "127.0.0.1", () => {
39698
39845
  const address = server.address();
39699
- if (address && typeof address === "object") resolve19(address.port);
39846
+ if (address && typeof address === "object") resolve20(address.port);
39700
39847
  else reject3(new Error("ask_user server failed to bind"));
39701
39848
  });
39702
39849
  server.unref();
@@ -39883,6 +40030,34 @@ function createAskUserServer() {
39883
40030
  }
39884
40031
  return;
39885
40032
  }
40033
+ if (surface.platform && (name === "get_company_asset" || name === "put_company_asset")) {
40034
+ const companyAssets = handlers.companyAssets;
40035
+ if (!companyAssets) {
40036
+ toolText("company files are unavailable for this runner", true);
40037
+ return;
40038
+ }
40039
+ const assetName = typeof args["name"] === "string" ? args["name"] : "";
40040
+ if (!assetName) {
40041
+ toolText("missing required argument `name`", true);
40042
+ return;
40043
+ }
40044
+ try {
40045
+ const outcome = name === "get_company_asset" ? await companyAssets.get(assetName) : await companyAssets.put({
40046
+ name: assetName,
40047
+ path: typeof args["path"] === "string" ? args["path"] : "",
40048
+ kind: typeof args["kind"] === "string" ? args["kind"] : "other",
40049
+ purpose: typeof args["purpose"] === "string" ? args["purpose"] : ""
40050
+ });
40051
+ if (outcome.ok) toolText(JSON.stringify(outcome.result ?? { ok: true }, null, 2));
40052
+ else toolText(outcome.error ?? "the company file could not be used", true);
40053
+ } catch (err) {
40054
+ toolText(
40055
+ `the company file could not be used: ${String(err instanceof Error ? err.message : err)}`,
40056
+ true
40057
+ );
40058
+ }
40059
+ return;
40060
+ }
39886
40061
  if (surface.platform && name === "publish_file") {
39887
40062
  if (!handlers.publishFile) {
39888
40063
  toolText("file publishing is unavailable for this runner", true);
@@ -40077,8 +40252,137 @@ function createAskUserServer() {
40077
40252
  };
40078
40253
  }
40079
40254
 
40255
+ // src/runners/company-assets.ts
40256
+ import { mkdir as mkdir12, readFile as readFile11, writeFile as writeFile8 } from "node:fs/promises";
40257
+ import { isAbsolute as isAbsolute14, join as join18, resolve as resolve9 } from "node:path";
40258
+ var MAX_PUT_BYTES = 5 * 1024 * 1024;
40259
+ function parseRef(result) {
40260
+ if (!result || typeof result !== "object") return null;
40261
+ const asset = result.asset;
40262
+ if (!asset || typeof asset !== "object") return null;
40263
+ const candidate = asset;
40264
+ 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") {
40265
+ return null;
40266
+ }
40267
+ return candidate;
40268
+ }
40269
+ function extensionFor(mediaType) {
40270
+ const known = {
40271
+ "image/svg+xml": ".svg",
40272
+ "image/png": ".png",
40273
+ "image/jpeg": ".jpg",
40274
+ "image/webp": ".webp",
40275
+ "image/gif": ".gif",
40276
+ "application/pdf": ".pdf",
40277
+ "text/plain": ".txt",
40278
+ "text/markdown": ".md",
40279
+ "text/csv": ".csv",
40280
+ "application/json": ".json"
40281
+ };
40282
+ return known[mediaType.toLowerCase()] ?? "";
40283
+ }
40284
+ function createCompanyAssetHandlers(io) {
40285
+ return {
40286
+ async get(name) {
40287
+ const resolved = await io.agentOp({ kind: "asset.resolve", name });
40288
+ if (!resolved.ok) {
40289
+ return { ok: false, error: resolved.error ?? `no company file named "${name}"` };
40290
+ }
40291
+ const ref2 = parseRef(resolved.result);
40292
+ if (!ref2) return { ok: false, error: "the company file could not be identified" };
40293
+ const bytes = await io.fetchCompanyAsset(ref2.id);
40294
+ if (bytes.byteLength !== ref2.size) {
40295
+ return {
40296
+ ok: false,
40297
+ error: `the company file "${ref2.name}" arrived incomplete (${bytes.byteLength} of ${ref2.size} bytes)`
40298
+ };
40299
+ }
40300
+ const directory = join18(io.taskRoot, ".zixt-company-files", ref2.id);
40301
+ await mkdir12(directory, { recursive: true });
40302
+ const base = sanitizeAttachmentFileName(ref2.name) || "file";
40303
+ const fileName = base.includes(".") ? base : `${base}${extensionFor(ref2.mediaType)}`;
40304
+ const path = join18(directory, fileName);
40305
+ await writeFile8(path, bytes);
40306
+ return {
40307
+ ok: true,
40308
+ result: {
40309
+ path,
40310
+ name: ref2.name,
40311
+ kind: ref2.kind,
40312
+ mediaType: ref2.mediaType,
40313
+ size: ref2.size,
40314
+ purpose: ref2.purpose
40315
+ }
40316
+ };
40317
+ },
40318
+ async put(input) {
40319
+ if (!input.path) return { ok: false, error: "missing required argument `path`" };
40320
+ if (!input.purpose) {
40321
+ return { ok: false, error: "say in one line what this file is for" };
40322
+ }
40323
+ const candidate = isAbsolute14(input.path) ? input.path : resolve9(io.cwd, input.path);
40324
+ const permitted = io.allowedRoots.some((root) => {
40325
+ const normalized = resolve9(root);
40326
+ return candidate === normalized || candidate.startsWith(`${normalized}${sep6()}`);
40327
+ });
40328
+ if (!permitted) {
40329
+ return { ok: false, error: "that file is outside the folders this task may read" };
40330
+ }
40331
+ let bytes;
40332
+ try {
40333
+ bytes = new Uint8Array(await readFile11(candidate));
40334
+ } catch {
40335
+ return { ok: false, error: `the file at ${input.path} could not be read` };
40336
+ }
40337
+ if (bytes.byteLength === 0) return { ok: false, error: "that file is empty" };
40338
+ if (bytes.byteLength > MAX_PUT_BYTES) {
40339
+ return { ok: false, error: "that file is too large to keep as a company file" };
40340
+ }
40341
+ const outcome = await io.agentOp({
40342
+ kind: "asset.put",
40343
+ name: input.name,
40344
+ assetKind: assetKindOf(input.kind),
40345
+ purpose: input.purpose,
40346
+ mediaType: mediaTypeFor(candidate),
40347
+ size: bytes.byteLength,
40348
+ data: Buffer.from(bytes).toString("base64")
40349
+ });
40350
+ if (!outcome.ok) {
40351
+ return { ok: false, error: outcome.error ?? "the company file could not be kept" };
40352
+ }
40353
+ return { ok: true, result: outcome.result ?? { ok: true } };
40354
+ }
40355
+ };
40356
+ }
40357
+ function sep6() {
40358
+ return process.platform === "win32" ? "\\" : "/";
40359
+ }
40360
+ function assetKindOf(kind) {
40361
+ return kind === "logo" || kind === "image" || kind === "document" || kind === "text" || kind === "data" ? kind : "other";
40362
+ }
40363
+ function mediaTypeFor(path) {
40364
+ const lower = path.toLowerCase();
40365
+ const byExtension = [
40366
+ [".svg", "image/svg+xml"],
40367
+ [".png", "image/png"],
40368
+ [".jpg", "image/jpeg"],
40369
+ [".jpeg", "image/jpeg"],
40370
+ [".webp", "image/webp"],
40371
+ [".gif", "image/gif"],
40372
+ [".pdf", "application/pdf"],
40373
+ [".md", "text/markdown"],
40374
+ [".txt", "text/plain"],
40375
+ [".csv", "text/csv"],
40376
+ [".json", "application/json"]
40377
+ ];
40378
+ for (const [extension, mediaType] of byExtension) {
40379
+ if (lower.endsWith(extension)) return mediaType;
40380
+ }
40381
+ return "application/octet-stream";
40382
+ }
40383
+
40080
40384
  // src/runners/runner-env.ts
40081
- import { delimiter as delimiter2, isAbsolute as isAbsolute14 } from "node:path";
40385
+ import { delimiter as delimiter2, isAbsolute as isAbsolute15 } from "node:path";
40082
40386
  var PROVIDER_AUTHORITY_PREFIXES = ["GH_", "GITHUB_", "GIT_", "SSH_"];
40083
40387
  var HOST_AUTHORITY_PREFIXES = [
40084
40388
  "ZIXT_",
@@ -40137,7 +40441,7 @@ function inheritedValue(env, name) {
40137
40441
  }
40138
40442
  function sanitizeInheritedSearchPath(path) {
40139
40443
  if (!path) return "";
40140
- return path.split(delimiter2).filter((entry) => entry !== "" && isAbsolute14(entry)).join(delimiter2);
40444
+ return path.split(delimiter2).filter((entry) => entry !== "" && isAbsolute15(entry)).join(delimiter2);
40141
40445
  }
40142
40446
  function buildRunnerEnv(input) {
40143
40447
  const env = {};
@@ -40153,7 +40457,7 @@ function buildRunnerEnv(input) {
40153
40457
  }
40154
40458
  const searchPath = [
40155
40459
  sanitizeInheritedSearchPath(inheritedValue(input.inherited, "PATH")),
40156
- ...(input.softwareToolsPath ?? []).filter((entry) => isAbsolute14(entry))
40460
+ ...(input.softwareToolsPath ?? []).filter((entry) => isAbsolute15(entry))
40157
40461
  ].filter((entry) => entry !== "").join(delimiter2);
40158
40462
  const gitConfig = input.githubShell ? [
40159
40463
  ["credential.helper", ""],
@@ -40221,9 +40525,9 @@ function buildRunnerEnv(input) {
40221
40525
  // src/runners/github-shell-auth.ts
40222
40526
  import { execFile } from "node:child_process";
40223
40527
  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";
40528
+ import { chmod as chmod7, lstat as lstat10, mkdir as mkdir13, realpath as realpath7, writeFile as writeFile9 } from "node:fs/promises";
40225
40529
  import { createServer as createServer3 } from "node:http";
40226
- import { isAbsolute as isAbsolute15, join as join18, relative as relative9 } from "node:path";
40530
+ import { isAbsolute as isAbsolute16, join as join19, relative as relative9 } from "node:path";
40227
40531
  var MAX_REQUEST_BYTES2 = 16 * 1024;
40228
40532
  var DIRECTORY_MODE4 = 448;
40229
40533
  var PRIVATE_FILE_MODE = 384;
@@ -40429,7 +40733,7 @@ function parseGhInvocation(body) {
40429
40733
  }
40430
40734
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
40431
40735
  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)) {
40736
+ 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
40737
  return null;
40434
40738
  }
40435
40739
  return { args, cwd };
@@ -40588,7 +40892,7 @@ function activationCredential(grant, now = Date.now()) {
40588
40892
  }
40589
40893
  function assertChildPath2(parent, child) {
40590
40894
  const path = relative9(parent, child);
40591
- if (!path || path === ".." || path.startsWith("../") || path.startsWith("..\\") || isAbsolute15(path)) {
40895
+ if (!path || path === ".." || path.startsWith("../") || path.startsWith("..\\") || isAbsolute16(path)) {
40592
40896
  throw new Error("GitHub shell helper path escaped its private run directory");
40593
40897
  }
40594
40898
  }
@@ -40599,7 +40903,7 @@ function quoteForPosixShell(value) {
40599
40903
  return quoteForGitShell2(value);
40600
40904
  }
40601
40905
  async function writePrivate(path, content, executable = false) {
40602
- await writeFile8(path, content, {
40906
+ await writeFile9(path, content, {
40603
40907
  flag: "wx",
40604
40908
  mode: executable ? EXECUTABLE_FILE_MODE : PRIVATE_FILE_MODE
40605
40909
  });
@@ -40611,7 +40915,7 @@ async function prepareHelpers(input) {
40611
40915
  throw new Error("GitHub shell authentication requires a private real run directory");
40612
40916
  }
40613
40917
  const runRoot = await realpath7(input.runRoot);
40614
- const helperPath = join18(runRoot, "github-shell-git-credential.cjs");
40918
+ const helperPath = join19(runRoot, "github-shell-git-credential.cjs");
40615
40919
  assertChildPath2(runRoot, helperPath);
40616
40920
  await writePrivate(helperPath, GIT_HELPER_SOURCE);
40617
40921
  if (!input.ghExecutablePath) {
@@ -40622,14 +40926,14 @@ async function prepareHelpers(input) {
40622
40926
  wrapperSourcePath: null
40623
40927
  };
40624
40928
  }
40625
- const shellToolsDirectory = join18(runRoot, "shell-tools");
40929
+ const shellToolsDirectory = join19(runRoot, "shell-tools");
40626
40930
  assertChildPath2(runRoot, shellToolsDirectory);
40627
- await mkdir12(shellToolsDirectory, { mode: DIRECTORY_MODE4 });
40931
+ await mkdir13(shellToolsDirectory, { mode: DIRECTORY_MODE4 });
40628
40932
  await chmod7(shellToolsDirectory, DIRECTORY_MODE4);
40629
- const wrapperSourcePath = join18(runRoot, "github-shell-gh-wrapper.cjs");
40933
+ const wrapperSourcePath = join19(runRoot, "github-shell-gh-wrapper.cjs");
40630
40934
  assertChildPath2(runRoot, wrapperSourcePath);
40631
40935
  await writePrivate(wrapperSourcePath, GH_WRAPPER_SOURCE);
40632
- const wrapperPath = join18(shellToolsDirectory, process.platform === "win32" ? "gh.cmd" : "gh");
40936
+ const wrapperPath = join19(shellToolsDirectory, process.platform === "win32" ? "gh.cmd" : "gh");
40633
40937
  assertChildPath2(runRoot, wrapperPath);
40634
40938
  const launcher = process.platform === "win32" ? `@"${process.execPath.replaceAll('"', '""')}" "${wrapperSourcePath.replaceAll('"', '""')}" %*\r
40635
40939
  ` : `#!/bin/sh
@@ -40853,7 +41157,7 @@ password=${credential.accessToken}
40853
41157
 
40854
41158
  // src/runners/working-context.ts
40855
41159
  import { spawn as spawn10 } from "node:child_process";
40856
- import { resolve as resolve9 } from "node:path";
41160
+ import { resolve as resolve10 } from "node:path";
40857
41161
  var COMMAND_TIMEOUT_MS = 5e3;
40858
41162
  var OUTPUT_LIMIT_BYTES = 128 * 1024;
40859
41163
  var COMMAND_STOP_TIMEOUT_MS = 2e4;
@@ -41248,8 +41552,8 @@ async function repositoryState(directory, git, env, signal) {
41248
41552
  const pathLines = paths.trim().split(/\r?\n/);
41249
41553
  if (pathLines.length < 3 || !pathLines[0] || !pathLines[1] || !pathLines[2]) return null;
41250
41554
  const root = pathLines[0];
41251
- const gitDirectory = resolve9(directory, pathLines[1]);
41252
- const commonDirectory = resolve9(directory, pathLines[2]);
41555
+ const gitDirectory = resolve10(directory, pathLines[1]);
41556
+ const commonDirectory = resolve10(directory, pathLines[2]);
41253
41557
  const records = status.split(/\0|\r?\n/).filter(Boolean);
41254
41558
  const rawBranch = statusField(records, "branch.head");
41255
41559
  if (!rawBranch || rawBranch.length > 512 || !isSafeSingleLineDisplayText(rawBranch)) return null;
@@ -41424,7 +41728,7 @@ async function settlesWithin(promise2, timeoutMs) {
41424
41728
  }
41425
41729
  }
41426
41730
  function defaultRunnerWorkspaceRoot() {
41427
- return join19(homedir7(), ".zixt", "workspaces");
41731
+ return join20(homedir7(), ".zixt", "workspaces");
41428
41732
  }
41429
41733
  function defaultRunnerArtifactRoot() {
41430
41734
  return defaultRunArtifactRoot();
@@ -41473,7 +41777,7 @@ function createCliRunner(adapter, opts = {}) {
41473
41777
  const prefixArgs = opts.commandPrefixArgs ?? [];
41474
41778
  const maxWallTimeMs = opts.maxWallTimeMs;
41475
41779
  const workspaceRoot = opts.workspaceRoot ?? defaultRunnerWorkspaceRoot();
41476
- const artifactRoot = opts.artifactRoot ?? (opts.workspaceRoot === void 0 ? defaultRunnerArtifactRoot() : join19(dirname10(workspaceRoot), "run-artifacts"));
41780
+ const artifactRoot = opts.artifactRoot ?? (opts.workspaceRoot === void 0 ? defaultRunnerArtifactRoot() : join20(dirname10(workspaceRoot), "run-artifacts"));
41477
41781
  const runRegistryRoot2 = opts.runRegistryRoot ?? defaultRunRegistryRoot();
41478
41782
  const createArtifacts = opts.createArtifacts ?? createRunArtifacts;
41479
41783
  const toolPackRegistry2 = opts.toolPackRegistry ?? createDefaultToolPackRegistry();
@@ -41491,7 +41795,7 @@ function createCliRunner(adapter, opts = {}) {
41491
41795
  };
41492
41796
  const askUserServer = createAskUserServer();
41493
41797
  const windowsRoot = process.env.SystemRoot ?? process.env.WINDIR;
41494
- const windowsComspecCandidate = process.platform === "win32" && windowsRoot ? join19(windowsRoot, "System32", "cmd.exe") : void 0;
41798
+ const windowsComspecCandidate = process.platform === "win32" && windowsRoot ? join20(windowsRoot, "System32", "cmd.exe") : void 0;
41495
41799
  let safetyFailure;
41496
41800
  return async (task) => {
41497
41801
  if (safetyFailure) {
@@ -41531,8 +41835,8 @@ function createCliRunner(adapter, opts = {}) {
41531
41835
  usage: { inputTokens: 0, outputTokens: 0 }
41532
41836
  };
41533
41837
  }
41534
- const taskRoot = join19(workspaceRoot, task.agentId);
41535
- await mkdir13(taskRoot, { recursive: true });
41838
+ const taskRoot = join20(workspaceRoot, task.agentId);
41839
+ await mkdir14(taskRoot, { recursive: true });
41536
41840
  if (task.cancelledNow()) return cancelledBeforeRun();
41537
41841
  const configuredWorkspace = task.spec.workspace;
41538
41842
  let cwd = taskRoot;
@@ -41558,12 +41862,19 @@ function createCliRunner(adapter, opts = {}) {
41558
41862
  outcome.ok && outcome.result && typeof outcome.result === "object" ? outcome.result["artifact"] : void 0
41559
41863
  );
41560
41864
  if (parsed.success) {
41561
- const candidate = resolve10(cwd, path);
41865
+ const candidate = resolve11(cwd, path);
41562
41866
  const key = await realpath8(candidate).catch(() => candidate);
41563
41867
  publishedTaskFiles.set(key, parsed.data);
41564
41868
  }
41565
41869
  return outcome;
41566
41870
  };
41871
+ const companyAssets = createCompanyAssetHandlers({
41872
+ agentOp: (op) => task.agentOp(op),
41873
+ fetchCompanyAsset: (assetId) => task.fetchCompanyAsset(assetId),
41874
+ taskRoot,
41875
+ allowedRoots: [taskRoot, cwd],
41876
+ cwd
41877
+ });
41567
41878
  const [secrets, attachedConnections, providerGrants, integrationToolServers] = await Promise.all([
41568
41879
  task.secrets(),
41569
41880
  task.connections(),
@@ -41729,6 +42040,7 @@ function createCliRunner(adapter, opts = {}) {
41729
42040
  }
41730
42041
  },
41731
42042
  publishFile,
42043
+ companyAssets,
41732
42044
  // AG-4a. The person approves in the Task thread through the ordinary
41733
42045
  // approvals pipeline, so the wall clock pauses while they decide, and
41734
42046
  // a refusal is an answer the session can act on rather than a failure.
@@ -41917,7 +42229,7 @@ ${attachmentSection}` : prompt;
41917
42229
  let changed = false;
41918
42230
  for (const path of paths) {
41919
42231
  if (!path || path.length > 4096) continue;
41920
- const absolutePath = isAbsolute16(path) ? path : resolve10(cwd, path);
42232
+ const absolutePath = isAbsolute17(path) ? path : resolve11(cwd, path);
41921
42233
  const directory = dirname10(absolutePath);
41922
42234
  observedWorkingDirectories.delete(directory);
41923
42235
  observedWorkingDirectories.add(directory);
@@ -42354,7 +42666,7 @@ function runCliProcess(options) {
42354
42666
  usage: { inputTokens: 0, outputTokens: 0 }
42355
42667
  });
42356
42668
  }
42357
- return new Promise((resolve19) => {
42669
+ return new Promise((resolve20) => {
42358
42670
  const platform = options.platform ?? process.platform;
42359
42671
  const containmentGateNonce = options.guardian && platform === "win32" ? randomUUID12() : void 0;
42360
42672
  const child = options.guardian ? spawn11(
@@ -42416,7 +42728,7 @@ function runCliProcess(options) {
42416
42728
  clearInterval(timer);
42417
42729
  unregisterFollowUps?.();
42418
42730
  parser.stop?.();
42419
- resolve19(result);
42731
+ resolve20(result);
42420
42732
  };
42421
42733
  const terminate = (result) => {
42422
42734
  if (settled || forcedResult) return;
@@ -42650,7 +42962,7 @@ import { randomUUID as randomUUID13 } from "node:crypto";
42650
42962
  // src/runners/runtime-observation.ts
42651
42963
  import { open as open6, readdir as readdir6, realpath as realpath9 } from "node:fs/promises";
42652
42964
  import { homedir as homedir8 } from "node:os";
42653
- import { join as join20 } from "node:path";
42965
+ import { join as join21 } from "node:path";
42654
42966
  var READ_WINDOW_BYTES = 1024 * 1024;
42655
42967
  var CATALOG_TIMEOUT_MS = 15e3;
42656
42968
  var CATALOG_OUTPUT_LIMIT_BYTES = 4 * 1024 * 1024;
@@ -42710,9 +43022,9 @@ function displayValue(value, maxLength) {
42710
43022
  return trimmed;
42711
43023
  }
42712
43024
  function claudeTranscriptPath(input) {
42713
- const configDir = input.env["CLAUDE_CONFIG_DIR"] || join20(homeFrom(input.env), ".claude");
43025
+ const configDir = input.env["CLAUDE_CONFIG_DIR"] || join21(homeFrom(input.env), ".claude");
42714
43026
  const slug = input.resolvedCwd.replace(/[^a-zA-Z0-9]/g, "-");
42715
- return join20(configDir, "projects", slug, `${input.sessionId}.jsonl`);
43027
+ return join21(configDir, "projects", slug, `${input.sessionId}.jsonl`);
42716
43028
  }
42717
43029
  async function readClaudeSessionEffort(input) {
42718
43030
  const resolvedCwd = await realpath9(input.cwd).catch(() => input.cwd);
@@ -42728,18 +43040,18 @@ async function readClaudeSessionEffort(input) {
42728
43040
  }
42729
43041
  async function newestDirectories(root, limit) {
42730
43042
  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));
43043
+ 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
43044
  }
42733
43045
  async function findCodexRolloutPath(input) {
42734
- const codexHome = input.env["CODEX_HOME"] || join20(homeFrom(input.env), ".codex");
42735
- const sessions = join20(codexHome, "sessions");
43046
+ const codexHome = input.env["CODEX_HOME"] || join21(homeFrom(input.env), ".codex");
43047
+ const sessions = join21(codexHome, "sessions");
42736
43048
  const suffix = `-${input.threadId}.jsonl`;
42737
43049
  for (const year of await newestDirectories(sessions, 2)) {
42738
43050
  for (const month of await newestDirectories(year, 2)) {
42739
43051
  for (const day of await newestDirectories(month, 3)) {
42740
43052
  const files = await readdir6(day).catch(() => []);
42741
43053
  const match = files.find((name) => name.endsWith(suffix));
42742
- if (match) return join20(day, match);
43054
+ if (match) return join21(day, match);
42743
43055
  }
42744
43056
  }
42745
43057
  }
@@ -42762,7 +43074,7 @@ async function readCodexSessionRuntime(input) {
42762
43074
  }
42763
43075
  var codexCatalogCache = /* @__PURE__ */ new Map();
42764
43076
  async function loadCodexModelCatalog(command, prefixArgs, env) {
42765
- const output = await new Promise((resolve19) => {
43077
+ const output = await new Promise((resolve20) => {
42766
43078
  const child = spawnCli(command, [...prefixArgs, "debug", "models"], {
42767
43079
  stdio: ["ignore", "pipe", "ignore"],
42768
43080
  windowsHide: true,
@@ -42777,7 +43089,7 @@ async function loadCodexModelCatalog(command, prefixArgs, env) {
42777
43089
  if (settled) return;
42778
43090
  settled = true;
42779
43091
  clearTimeout(timer);
42780
- resolve19(value);
43092
+ resolve20(value);
42781
43093
  };
42782
43094
  const timer = setTimeout(() => {
42783
43095
  child.kill();
@@ -42882,8 +43194,8 @@ function createRuntimeReporter(input, sessionId) {
42882
43194
  var EFFORT_READ_ATTEMPTS = 5;
42883
43195
  var EFFORT_READ_INTERVAL_MS = 3e3;
42884
43196
  function delay2(ms) {
42885
- return new Promise((resolve19) => {
42886
- const timer = setTimeout(resolve19, ms);
43197
+ return new Promise((resolve20) => {
43198
+ const timer = setTimeout(resolve20, ms);
42887
43199
  timer.unref?.();
42888
43200
  });
42889
43201
  }
@@ -42970,10 +43282,10 @@ function createClaudeLiveParser(onStream, onSessionModel) {
42970
43282
  },
42971
43283
  async steer(followUp) {
42972
43284
  if (!write) return false;
42973
- return await new Promise((resolve19) => {
42974
- acknowledgements.set(followUp.inputId, resolve19);
43285
+ return await new Promise((resolve20) => {
43286
+ acknowledgements.set(followUp.inputId, resolve20);
42975
43287
  void write(input(followUp.inputId, followUp.text)).catch(() => {
42976
- if (acknowledgements.delete(followUp.inputId)) resolve19(false);
43288
+ if (acknowledgements.delete(followUp.inputId)) resolve20(false);
42977
43289
  });
42978
43290
  });
42979
43291
  },
@@ -43133,22 +43445,22 @@ function improveErrorMessage(error52) {
43133
43445
  }
43134
43446
 
43135
43447
  // src/runners/codex.ts
43136
- import { mkdir as mkdir14, readFile as readFile11, writeFile as writeFile9 } from "node:fs/promises";
43448
+ import { mkdir as mkdir15, readFile as readFile12, writeFile as writeFile10 } from "node:fs/promises";
43137
43449
  import { randomUUID as randomUUID14 } from "node:crypto";
43138
43450
  import { homedir as homedir9 } from "node:os";
43139
- import { join as join21 } from "node:path";
43451
+ import { join as join22 } from "node:path";
43140
43452
  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
43453
  function defaultCodexThreadIndexRoot() {
43142
- return join21(homedir9(), ".zixt", "codex-threads");
43454
+ return join22(homedir9(), ".zixt", "codex-threads");
43143
43455
  }
43144
43456
  var SAFE_SEGMENT3 = /^[A-Za-z0-9_-]{1,200}$/;
43145
43457
  function threadIndexPath(root, agentId, sessionKey) {
43146
43458
  if (!SAFE_SEGMENT3.test(agentId) || !SAFE_SEGMENT3.test(sessionKey)) return null;
43147
- return join21(root, agentId, `${sessionKey}.json`);
43459
+ return join22(root, agentId, `${sessionKey}.json`);
43148
43460
  }
43149
43461
  async function readThreadId(path) {
43150
43462
  try {
43151
- const parsed = JSON.parse(await readFile11(path, "utf8"));
43463
+ const parsed = JSON.parse(await readFile12(path, "utf8"));
43152
43464
  return typeof parsed.threadId === "string" && /^[A-Za-z0-9-]{1,120}$/.test(parsed.threadId) ? parsed.threadId : null;
43153
43465
  } catch {
43154
43466
  return null;
@@ -43248,7 +43560,7 @@ ${value}` : value;
43248
43560
  const recordedThreadId = indexPath ? await readThreadId(indexPath) : null;
43249
43561
  const rememberThread = (threadId) => {
43250
43562
  if (!indexPath) return;
43251
- void mkdir14(join21(threadIndexRoot, task.agentId), { recursive: true }).then(() => writeFile9(indexPath, JSON.stringify({ threadId }), "utf8")).catch(() => {
43563
+ void mkdir15(join22(threadIndexRoot, task.agentId), { recursive: true }).then(() => writeFile10(indexPath, JSON.stringify({ threadId }), "utf8")).catch(() => {
43252
43564
  });
43253
43565
  };
43254
43566
  const observeRuntime = (threadId) => {
@@ -43289,8 +43601,8 @@ ${value}` : value;
43289
43601
  var RUNTIME_READ_ATTEMPTS = 5;
43290
43602
  var RUNTIME_READ_INTERVAL_MS = 2e3;
43291
43603
  function delay3(ms) {
43292
- return new Promise((resolve19) => {
43293
- const timer = setTimeout(resolve19, ms);
43604
+ return new Promise((resolve20) => {
43605
+ const timer = setTimeout(resolve20, ms);
43294
43606
  timer.unref?.();
43295
43607
  });
43296
43608
  }
@@ -43329,7 +43641,7 @@ function createCodexAppServerParser(onStream, options) {
43329
43641
  const turnReadyWaiters = /* @__PURE__ */ new Set();
43330
43642
  const usage = () => ({ inputTokens, outputTokens });
43331
43643
  const settleTurnReadiness = (ready) => {
43332
- for (const resolve19 of turnReadyWaiters) resolve19(ready);
43644
+ for (const resolve20 of turnReadyWaiters) resolve20(ready);
43333
43645
  turnReadyWaiters.clear();
43334
43646
  };
43335
43647
  const send = async (message) => {
@@ -43510,12 +43822,12 @@ function createCodexAppServerParser(onStream, options) {
43510
43822
  async steer(input) {
43511
43823
  if (stopped) return false;
43512
43824
  if (!activeTurnId) {
43513
- const ready = await new Promise((resolve19) => turnReadyWaiters.add(resolve19));
43825
+ const ready = await new Promise((resolve20) => turnReadyWaiters.add(resolve20));
43514
43826
  if (!ready || stopped) return false;
43515
43827
  }
43516
43828
  if (!threadId || !activeTurnId) return false;
43517
- return await new Promise((resolve19) => {
43518
- steerWaiters.set(input.inputId, resolve19);
43829
+ return await new Promise((resolve20) => {
43830
+ steerWaiters.set(input.inputId, resolve20);
43519
43831
  void send({
43520
43832
  id: `steer:${input.inputId}`,
43521
43833
  method: "turn/steer",
@@ -43526,7 +43838,7 @@ function createCodexAppServerParser(onStream, options) {
43526
43838
  clientUserMessageId: input.inputId
43527
43839
  }
43528
43840
  }).catch(() => {
43529
- if (steerWaiters.delete(input.inputId)) resolve19(false);
43841
+ if (steerWaiters.delete(input.inputId)) resolve20(false);
43530
43842
  });
43531
43843
  });
43532
43844
  },
@@ -43534,7 +43846,7 @@ function createCodexAppServerParser(onStream, options) {
43534
43846
  stopped = true;
43535
43847
  write = null;
43536
43848
  settleTurnReadiness(false);
43537
- for (const resolve19 of steerWaiters.values()) resolve19(false);
43849
+ for (const resolve20 of steerWaiters.values()) resolve20(false);
43538
43850
  steerWaiters.clear();
43539
43851
  },
43540
43852
  push(chunk) {
@@ -43713,7 +44025,7 @@ function improveCodexErrorMessage(error52) {
43713
44025
  // src/runners/git-preflight.ts
43714
44026
  import { spawn as spawn12 } from "node:child_process";
43715
44027
  import { realpath as realpath10 } from "node:fs/promises";
43716
- import { isAbsolute as isAbsolute17, resolve as resolve11 } from "node:path";
44028
+ import { isAbsolute as isAbsolute18, resolve as resolve12 } from "node:path";
43717
44029
  var OUTPUT_LIMIT = 8192;
43718
44030
  var DEFAULT_TIMEOUT_MS4 = 1e4;
43719
44031
  var VERSION_PATTERN = /^git version [^\r\n]{1,108}$/;
@@ -43729,10 +44041,10 @@ function unavailable(error52, checkedAt, executablePath = null) {
43729
44041
  async function preflightGit(options = {}) {
43730
44042
  const checkedAt = (options.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
43731
44043
  const configured = options.command;
43732
- if (configured !== void 0 && !isAbsolute17(configured)) {
44044
+ if (configured !== void 0 && !isAbsolute18(configured)) {
43733
44045
  return unavailable("configured git command must be an absolute file", checkedAt);
43734
44046
  }
43735
- const trustedCwd = await realpath10(resolve11(options.trustedCwd ?? process.cwd())).catch(() => null);
44047
+ const trustedCwd = await realpath10(resolve12(options.trustedCwd ?? process.cwd())).catch(() => null);
43736
44048
  if (!trustedCwd)
43737
44049
  return unavailable("Host-owned git preflight directory is unavailable", checkedAt);
43738
44050
  const executablePath = await resolveTrustedCliCommand(configured ?? "git", {
@@ -43954,7 +44266,7 @@ function parseAuth(result) {
43954
44266
  return "unknown";
43955
44267
  }
43956
44268
  function run2(command, args) {
43957
- return new Promise((resolve19) => {
44269
+ return new Promise((resolve20) => {
43958
44270
  const child = spawnCli(command, args, {
43959
44271
  stdio: ["ignore", "pipe", "pipe"],
43960
44272
  windowsHide: true
@@ -43970,7 +44282,7 @@ function run2(command, args) {
43970
44282
  if (settled) return;
43971
44283
  settled = true;
43972
44284
  clearTimeout(timeout);
43973
- resolve19(result);
44285
+ resolve20(result);
43974
44286
  };
43975
44287
  const timeout = setTimeout(() => {
43976
44288
  child.kill();
@@ -43984,32 +44296,32 @@ function run2(command, args) {
43984
44296
  // src/linux-service.ts
43985
44297
  import { spawn as spawn13 } from "node:child_process";
43986
44298
  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";
44299
+ import { access as access5, chmod as chmod9, mkdir as mkdir17, open as open7, rename as rename8, rm as rm12 } from "node:fs/promises";
43988
44300
  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";
44301
+ import { basename as basename4, dirname as dirname11, join as join24, relative as relative10, resolve as resolve14, sep as sep8 } from "node:path";
43990
44302
 
43991
44303
  // 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";
44304
+ import { access as access4, chmod as chmod8, copyFile, mkdir as mkdir16, rename as rename7, rm as rm11 } from "node:fs/promises";
43993
44305
  import { homedir as homedir10 } from "node:os";
43994
- import { join as join22, resolve as resolve12, sep as sep6 } from "node:path";
44306
+ import { join as join23, resolve as resolve13, sep as sep7 } from "node:path";
43995
44307
  async function ensureDurableServiceNode(options = {}) {
43996
- const execPath = resolve12(options.execPath ?? process.execPath);
44308
+ const execPath = resolve13(options.execPath ?? process.execPath);
43997
44309
  const home = options.home ?? homedir10();
43998
44310
  const platform = options.platform ?? process.platform;
43999
44311
  const version2 = options.nodeVersion ?? process.version;
44000
44312
  if (!/^v?[0-9A-Za-z.-]+$/.test(version2)) {
44001
44313
  throw new Error("the Node runtime version is not a safe directory name");
44002
44314
  }
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");
44315
+ const zixtRoot = resolve13(home, ".zixt");
44316
+ if (execPath === zixtRoot || execPath.startsWith(zixtRoot + sep7)) return execPath;
44317
+ const directory = join23(zixtRoot, "runtime", `node-${version2}`);
44318
+ const destination = join23(directory, platform === "win32" ? "node.exe" : "node");
44007
44319
  const alreadyCopied = await access4(destination).then(
44008
44320
  () => true,
44009
44321
  () => false
44010
44322
  );
44011
44323
  if (alreadyCopied) return destination;
44012
- await mkdir15(directory, { recursive: true, mode: 448 });
44324
+ await mkdir16(directory, { recursive: true, mode: 448 });
44013
44325
  const temporary = `${destination}.${process.pid}.${crypto.randomUUID()}.tmp`;
44014
44326
  try {
44015
44327
  await copyFile(execPath, temporary);
@@ -44051,7 +44363,7 @@ function boundedAppend(current, chunk) {
44051
44363
  }
44052
44364
  async function defaultRunCommand(command, args) {
44053
44365
  const commandEnvironment3 = systemServiceCommandEnvironment();
44054
- return new Promise((resolve19) => {
44366
+ return new Promise((resolve20) => {
44055
44367
  const child = spawn13(command, [...args], {
44056
44368
  stdio: ["ignore", "pipe", "pipe"],
44057
44369
  env: commandEnvironment3,
@@ -44065,7 +44377,7 @@ async function defaultRunCommand(command, args) {
44065
44377
  if (settled) return;
44066
44378
  settled = true;
44067
44379
  if (timer) clearTimeout(timer);
44068
- resolve19(result);
44380
+ resolve20(result);
44069
44381
  };
44070
44382
  child.stdout?.on("data", (chunk) => {
44071
44383
  stdout = boundedAppend(stdout, chunk);
@@ -44124,22 +44436,22 @@ async function defaultSyncDirectory(path) {
44124
44436
  }
44125
44437
  }
44126
44438
  async function ensureDirectory(path, mode, syncDirectory8) {
44127
- const firstCreated = await mkdir16(path, { recursive: true, mode });
44439
+ const firstCreated = await mkdir17(path, { recursive: true, mode });
44128
44440
  if (!firstCreated) return;
44129
- const first = resolve13(firstCreated);
44130
- const target = resolve13(path);
44441
+ const first = resolve14(firstCreated);
44442
+ const target = resolve14(path);
44131
44443
  await syncDirectory8(dirname11(first));
44132
44444
  let current = first;
44133
44445
  const descendants = relative10(first, target);
44134
- for (const part of descendants ? descendants.split(sep7) : []) {
44446
+ for (const part of descendants ? descendants.split(sep8) : []) {
44135
44447
  await syncDirectory8(current);
44136
- current = join23(current, part);
44448
+ current = join24(current, part);
44137
44449
  }
44138
44450
  }
44139
44451
  async function replacePrivateFile(path, contents, mode, syncDirectory8) {
44140
44452
  const parent = dirname11(path);
44141
44453
  await ensureDirectory(parent, 448, syncDirectory8);
44142
- const temporary = join23(parent, `.${basename4(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44454
+ const temporary = join24(parent, `.${basename4(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44143
44455
  const handle = await open7(temporary, "wx", mode);
44144
44456
  try {
44145
44457
  await handle.writeFile(contents, "utf8");
@@ -44191,17 +44503,17 @@ async function installLinuxService(options) {
44191
44503
  "command search path"
44192
44504
  );
44193
44505
  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);
44506
+ const xdgConfigHome = env.XDG_CONFIG_HOME ? oneLine(env.XDG_CONFIG_HOME, "Linux configuration path") : join24(home, ".config");
44507
+ const configRoot = options.serviceConfigRoot ?? join24(xdgConfigHome, "zixt");
44508
+ const unitRoot = options.userUnitRoot ?? join24(xdgConfigHome, "systemd", "user");
44509
+ const environmentPath = join24(configRoot, "host.env");
44510
+ const unitPath = join24(unitRoot, SERVICE_NAME);
44199
44511
  const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
44200
44512
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : activateInstalledRelease);
44201
44513
  const resolveCommand = options.resolveCommand ?? defaultResolveCommand;
44202
44514
  const run3 = options.runCommand ?? defaultRunCommand;
44203
44515
  const syncDirectory8 = options.syncDirectory ?? defaultSyncDirectory;
44204
- const stabilityDelay = options.delay ?? ((ms) => new Promise((resolve19) => setTimeout(resolve19, ms)));
44516
+ const stabilityDelay = options.delay ?? ((ms) => new Promise((resolve20) => setTimeout(resolve20, ms)));
44205
44517
  const [systemctl, loginctl] = await Promise.all([
44206
44518
  resolveCommand("systemctl"),
44207
44519
  resolveCommand("loginctl")
@@ -44325,9 +44637,9 @@ async function installLinuxService(options) {
44325
44637
  // src/macos-service.ts
44326
44638
  import { spawn as spawn14 } from "node:child_process";
44327
44639
  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";
44640
+ import { access as access6, chmod as chmod10, mkdir as mkdir18, open as open8, rename as rename9, rm as rm13 } from "node:fs/promises";
44329
44641
  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";
44642
+ import { basename as basename5, dirname as dirname12, join as join25, relative as relative11, resolve as resolve15, sep as sep9 } from "node:path";
44331
44643
  var LAUNCH_AGENT_LABEL = "ai.zixt.host";
44332
44644
  var SERVICE_STABILITY_DELAY_MS2 = 2e3;
44333
44645
  var STATUS_WAIT_MS = 2e4;
@@ -44352,21 +44664,21 @@ async function syncDirectory4(path) {
44352
44664
  }
44353
44665
  }
44354
44666
  async function ensureDirectory2(path, sync) {
44355
- const firstCreated = await mkdir17(path, { recursive: true, mode: 448 });
44667
+ const firstCreated = await mkdir18(path, { recursive: true, mode: 448 });
44356
44668
  if (!firstCreated) return;
44357
- const first = resolve14(firstCreated);
44358
- const target = resolve14(path);
44669
+ const first = resolve15(firstCreated);
44670
+ const target = resolve15(path);
44359
44671
  await sync(dirname12(first));
44360
44672
  let current = first;
44361
- for (const part of relative11(first, target).split(sep8).filter(Boolean)) {
44673
+ for (const part of relative11(first, target).split(sep9).filter(Boolean)) {
44362
44674
  await sync(current);
44363
- current = join24(current, part);
44675
+ current = join25(current, part);
44364
44676
  }
44365
44677
  }
44366
44678
  async function replacePrivateFile2(path, contents, mode, sync) {
44367
44679
  const parent = dirname12(path);
44368
44680
  await ensureDirectory2(parent, sync);
44369
- const temporary = join24(parent, `.${basename5(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44681
+ const temporary = join25(parent, `.${basename5(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44370
44682
  const handle = await open8(temporary, "wx", mode);
44371
44683
  try {
44372
44684
  await handle.writeFile(contents, "utf8");
@@ -44463,14 +44775,14 @@ async function installMacosService(options) {
44463
44775
  options.path ?? env.PATH ?? "/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin",
44464
44776
  "command search path"
44465
44777
  );
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");
44778
+ const configRoot = options.configRoot ?? join25(home, "Library", "Application Support", "Zixt");
44779
+ const launchAgentsRoot = options.launchAgentsRoot ?? join25(home, "Library", "LaunchAgents");
44780
+ const logRoot = options.logRoot ?? join25(home, "Library", "Logs", "Zixt");
44781
+ const configPath = join25(configRoot, "host.env");
44782
+ const launcherPath = join25(configRoot, "host-launcher.sh");
44783
+ const plistPath = join25(launchAgentsRoot, `${LAUNCH_AGENT_LABEL}.plist`);
44784
+ const stdoutPath = join25(logRoot, "host.log");
44785
+ const stderrPath = join25(logRoot, "host-error.log");
44474
44786
  const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
44475
44787
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : (entry) => activateInstalledRelease(entry));
44476
44788
  const resolveCommand = options.resolveCommand ?? (async () => defaultResolveCommand2());
@@ -44573,9 +44885,9 @@ async function installMacosService(options) {
44573
44885
  // src/windows-service.ts
44574
44886
  import { spawn as spawn15 } from "node:child_process";
44575
44887
  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";
44888
+ import { access as access7, mkdir as mkdir19, open as open9, readFile as readFile13, rename as rename10, rm as rm14 } from "node:fs/promises";
44577
44889
  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";
44890
+ 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
44891
  var TASK_NAME = "Zixt Host";
44580
44892
  var COMMAND_TIMEOUT_MS3 = 7e4;
44581
44893
  var SERVICE_STABILITY_DELAY_MS3 = 2e3;
@@ -44601,21 +44913,21 @@ async function syncDirectory5(path) {
44601
44913
  }
44602
44914
  }
44603
44915
  async function ensureDirectory3(path, sync) {
44604
- const firstCreated = await mkdir18(path, { recursive: true, mode: 448 });
44916
+ const firstCreated = await mkdir19(path, { recursive: true, mode: 448 });
44605
44917
  if (!firstCreated) return;
44606
- const first = resolve15(firstCreated);
44607
- const target = resolve15(path);
44918
+ const first = resolve16(firstCreated);
44919
+ const target = resolve16(path);
44608
44920
  await sync(dirname13(first));
44609
44921
  let current = first;
44610
- for (const part of relative12(first, target).split(sep9).filter(Boolean)) {
44922
+ for (const part of relative12(first, target).split(sep10).filter(Boolean)) {
44611
44923
  await sync(current);
44612
- current = join25(current, part);
44924
+ current = join26(current, part);
44613
44925
  }
44614
44926
  }
44615
44927
  async function replacePrivateFile3(path, contents, sync, encoding = "utf8") {
44616
44928
  const parent = dirname13(path);
44617
44929
  await ensureDirectory3(parent, sync);
44618
- const temporary = join25(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44930
+ const temporary = join26(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44619
44931
  const handle = await open9(temporary, "wx", 384);
44620
44932
  try {
44621
44933
  await handle.writeFile(encoding === "utf16le" ? `\uFEFF${contents}` : contents, encoding);
@@ -44669,8 +44981,8 @@ async function runChild(command, args, env, input) {
44669
44981
  }
44670
44982
  async function defaultResolveCommand3(name, env) {
44671
44983
  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`);
44984
+ if (!root || !isAbsolute19(root)) return null;
44985
+ const candidate = name === "powershell" ? join26(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe") : join26(root, "System32", `${name}.exe`);
44674
44986
  return access7(candidate, constants4.X_OK).then(
44675
44987
  () => candidate,
44676
44988
  () => null
@@ -44760,7 +45072,7 @@ exit $code
44760
45072
  }
44761
45073
  async function defaultObserveStatus(path, generation) {
44762
45074
  try {
44763
- const text = (await readFile12(path, "utf8")).replace(/^\uFEFF/, "");
45075
+ const text = (await readFile13(path, "utf8")).replace(/^\uFEFF/, "");
44764
45076
  const value = JSON.parse(text);
44765
45077
  if (value.schema !== 1 || value.generation !== generation || typeof value.pid !== "number" || !Number.isSafeInteger(value.pid) || value.pid <= 0) {
44766
45078
  return null;
@@ -44815,18 +45127,18 @@ async function installWindowsService(options) {
44815
45127
  const env = options.env ?? process.env;
44816
45128
  const home = options.home ?? homedir13();
44817
45129
  const localAppData = options.localAppData ?? env.LOCALAPPDATA;
44818
- if (!localAppData || !isAbsolute18(localAppData)) {
45130
+ if (!localAppData || !isAbsolute19(localAppData)) {
44819
45131
  throw new Error("Windows local application data path is unavailable.");
44820
45132
  }
44821
45133
  const token2 = oneLine3(options.token, "pairing code");
44822
45134
  const cloudUrl = options.cloudUrl ? oneLine3(options.cloudUrl, "Zixt Cloud address") : void 0;
44823
45135
  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");
45136
+ const configRoot = options.configRoot ?? join26(localAppData, "Zixt", "Host");
45137
+ const configPath = join26(configRoot, "host.json");
45138
+ const launcherPath = join26(configRoot, "host-launcher.ps1");
45139
+ const launchShimPath = join26(configRoot, "host-launch.vbs");
45140
+ const taskXmlPath = join26(configRoot, "host-task.xml");
45141
+ const statusPath = join26(configRoot, "host-status.json");
44830
45142
  const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
44831
45143
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : (entry) => activateInstalledRelease(entry));
44832
45144
  const resolveCommand = options.resolveCommand ?? ((name) => defaultResolveCommand3(name, env));
@@ -44953,23 +45265,23 @@ async function installSystemService(options) {
44953
45265
  }
44954
45266
 
44955
45267
  // 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";
45268
+ 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
45269
  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";
45270
+ import { dirname as dirname14, join as join27, relative as relative13, resolve as resolve17, sep as sep11 } from "node:path";
44959
45271
  var DIRECTORY_MODE5 = 448;
44960
45272
  var FILE_MODE4 = 384;
44961
45273
  var MAX_OUTCOME_BYTES = 4 * 1024 * 1024;
44962
45274
  var HOST_DIRECTORY = /^hst_[0-9a-f]{32}$/;
44963
45275
  var OUTCOME_FILE = /^(tsk_[0-9a-f]{32})\.([1-9][0-9]*)\.json$/;
44964
45276
  function defaultTerminalOutcomeRoot() {
44965
- return join26(homedir14(), ".zixt", "terminal-outcomes");
45277
+ return join27(homedir14(), ".zixt", "terminal-outcomes");
44966
45278
  }
44967
45279
  function hostOutcomeRoot(root, hostId) {
44968
45280
  if (!HOST_DIRECTORY.test(hostId)) throw new Error("terminal outcome Host identity is malformed");
44969
- return join26(root, hostId);
45281
+ return join27(root, hostId);
44970
45282
  }
44971
45283
  function outcomePath(root, hostId, taskId, epoch) {
44972
- return join26(hostOutcomeRoot(root, hostId), `${taskId}.${epoch}.json`);
45284
+ return join27(hostOutcomeRoot(root, hostId), `${taskId}.${epoch}.json`);
44973
45285
  }
44974
45286
  async function syncDirectory6(root) {
44975
45287
  if (process.platform === "win32") return;
@@ -44981,15 +45293,15 @@ async function syncDirectory6(root) {
44981
45293
  }
44982
45294
  }
44983
45295
  async function requirePrivateRoot(root, sync = syncDirectory6) {
44984
- const firstCreated = await mkdir19(root, { recursive: true, mode: DIRECTORY_MODE5 });
45296
+ const firstCreated = await mkdir20(root, { recursive: true, mode: DIRECTORY_MODE5 });
44985
45297
  if (firstCreated) {
44986
- const first = resolve16(firstCreated);
44987
- const target = resolve16(root);
45298
+ const first = resolve17(firstCreated);
45299
+ const target = resolve17(root);
44988
45300
  await sync(dirname14(first));
44989
45301
  let current = first;
44990
- for (const part of relative13(first, target).split(sep10).filter(Boolean)) {
45302
+ for (const part of relative13(first, target).split(sep11).filter(Boolean)) {
44991
45303
  await sync(current);
44992
- current = join26(current, part);
45304
+ current = join27(current, part);
44993
45305
  }
44994
45306
  }
44995
45307
  const stat4 = await lstat12(root);
@@ -45020,7 +45332,7 @@ async function recordTerminalOutcome(hostId, input, root = defaultTerminalOutcom
45020
45332
  const destination = outcomePath(root, hostId, outcome.taskId, outcome.epoch);
45021
45333
  try {
45022
45334
  const existing = parseCommittedOutcome(
45023
- await readFile13(destination, { encoding: "utf8", flag: "r" }),
45335
+ await readFile14(destination, { encoding: "utf8", flag: "r" }),
45024
45336
  outcome.taskId,
45025
45337
  outcome.epoch
45026
45338
  );
@@ -45029,7 +45341,7 @@ async function recordTerminalOutcome(hostId, input, root = defaultTerminalOutcom
45029
45341
  } catch (error52) {
45030
45342
  if (error52.code !== "ENOENT") throw error52;
45031
45343
  }
45032
- const temporary = join26(
45344
+ const temporary = join27(
45033
45345
  scopedRoot,
45034
45346
  `.${outcome.taskId}.${outcome.epoch}.${process.pid}.${Date.now()}.${outcome.resultId}.tmp`
45035
45347
  );
@@ -45082,13 +45394,13 @@ async function readTerminalOutcomesStrict(root = defaultTerminalOutcomeRoot()) {
45082
45394
  if (!match || !entry.isFile() || entry.isSymbolicLink()) {
45083
45395
  throw new Error("committed terminal outcome is not a trusted regular file");
45084
45396
  }
45085
- const path = join26(scopedRoot, entry.name);
45397
+ const path = join27(scopedRoot, entry.name);
45086
45398
  const stat4 = await lstat12(path);
45087
45399
  if (!stat4.isFile() || stat4.isSymbolicLink() || stat4.size > MAX_OUTCOME_BYTES) {
45088
45400
  throw new Error("committed terminal outcome is not a trusted regular file");
45089
45401
  }
45090
45402
  const outcome = parseCommittedOutcome(
45091
- await readFile13(path, "utf8"),
45403
+ await readFile14(path, "utf8"),
45092
45404
  match[1],
45093
45405
  Number(match[2])
45094
45406
  );
@@ -45134,15 +45446,15 @@ async function forgetSupersededTerminalOutcomes(hostId, taskId, epoch, root = de
45134
45446
  }
45135
45447
 
45136
45448
  // 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";
45449
+ 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
45450
  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";
45451
+ import { dirname as dirname15, join as join28, relative as relative14, resolve as resolve18, sep as sep12 } from "node:path";
45140
45452
  var DIRECTORY_MODE6 = 448;
45141
45453
  var FILE_MODE5 = 384;
45142
45454
  var CLAIM_FILE = /^(tsk_[0-9a-f]{32})\.([1-9][0-9]*)\.json$/;
45143
45455
  var TASK_ID = /^tsk_[0-9a-f]{32}$/;
45144
45456
  function defaultAcceptedAssignmentRoot() {
45145
- return join27(homedir15(), ".zixt", "accepted-assignments");
45457
+ return join28(homedir15(), ".zixt", "accepted-assignments");
45146
45458
  }
45147
45459
  async function syncDirectory7(root) {
45148
45460
  if (process.platform === "win32") return;
@@ -45154,15 +45466,15 @@ async function syncDirectory7(root) {
45154
45466
  }
45155
45467
  }
45156
45468
  async function requirePrivateRoot2(root, sync = syncDirectory7) {
45157
- const firstCreated = await mkdir20(root, { recursive: true, mode: DIRECTORY_MODE6 });
45469
+ const firstCreated = await mkdir21(root, { recursive: true, mode: DIRECTORY_MODE6 });
45158
45470
  if (firstCreated) {
45159
- const first = resolve17(firstCreated);
45160
- const target = resolve17(root);
45471
+ const first = resolve18(firstCreated);
45472
+ const target = resolve18(root);
45161
45473
  await sync(dirname15(first));
45162
45474
  let current = first;
45163
- for (const part of relative14(first, target).split(sep11).filter(Boolean)) {
45475
+ for (const part of relative14(first, target).split(sep12).filter(Boolean)) {
45164
45476
  await sync(current);
45165
- current = join27(current, part);
45477
+ current = join28(current, part);
45166
45478
  }
45167
45479
  }
45168
45480
  const stat4 = await lstat13(root);
@@ -45176,7 +45488,7 @@ function claimPath(root, taskId, epoch) {
45176
45488
  if (!Number.isSafeInteger(epoch) || epoch < 1) {
45177
45489
  throw new Error("accepted assignment epoch is malformed");
45178
45490
  }
45179
- return join27(root, `${taskId}.${epoch}.json`);
45491
+ return join28(root, `${taskId}.${epoch}.json`);
45180
45492
  }
45181
45493
  async function recordAcceptedAssignment(assignment, root = defaultAcceptedAssignmentRoot(), options = {}) {
45182
45494
  const sync = options.syncDirectory ?? syncDirectory7;
@@ -45186,7 +45498,7 @@ async function recordAcceptedAssignment(assignment, root = defaultAcceptedAssign
45186
45498
  } catch {
45187
45499
  return false;
45188
45500
  }
45189
- const temporary = join27(
45501
+ const temporary = join28(
45190
45502
  root,
45191
45503
  `.${assignment.taskId}.${assignment.epoch}.${process.pid}.${Date.now()}.tmp`
45192
45504
  );
@@ -45248,9 +45560,9 @@ async function forgetAcknowledgedAcceptedAssignments(assignments, root = default
45248
45560
  }
45249
45561
 
45250
45562
  // 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";
45563
+ 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
45564
  import { homedir as homedir16 } from "node:os";
45253
- import { basename as basename7, dirname as dirname16, join as join28 } from "node:path";
45565
+ import { basename as basename7, dirname as dirname16, join as join29 } from "node:path";
45254
45566
 
45255
45567
  // src/logger.ts
45256
45568
  var ANSI = {
@@ -45362,11 +45674,11 @@ var LOCAL_STATUS_FILE = "status.json";
45362
45674
  var LOCAL_REQUESTS_DIR = "requests";
45363
45675
  var DEFAULT_CONSOLE_ROTATE_BYTES = 2 * 1024 * 1024;
45364
45676
  function defaultLocalObservabilityRoot() {
45365
- return join28(homedir16(), ".zixt", "observability");
45677
+ return join29(homedir16(), ".zixt", "observability");
45366
45678
  }
45367
45679
  function createLocalConsoleSink(options = {}) {
45368
45680
  const root = options.root ?? defaultLocalObservabilityRoot();
45369
- const consolePath = join28(root, LOCAL_CONSOLE_FILE);
45681
+ const consolePath = join29(root, LOCAL_CONSOLE_FILE);
45370
45682
  const rotateBytes = options.rotateBytes ?? DEFAULT_CONSOLE_ROTATE_BYTES;
45371
45683
  let disabled = false;
45372
45684
  let prepared = false;
@@ -45376,7 +45688,7 @@ function createLocalConsoleSink(options = {}) {
45376
45688
  if (disabled) return;
45377
45689
  try {
45378
45690
  if (!prepared) {
45379
- await mkdir21(root, { recursive: true, mode: 448 });
45691
+ await mkdir22(root, { recursive: true, mode: 448 });
45380
45692
  approximateBytes = await stat3(consolePath).then(
45381
45693
  (existing) => existing.size,
45382
45694
  () => 0
@@ -45384,8 +45696,8 @@ function createLocalConsoleSink(options = {}) {
45384
45696
  prepared = true;
45385
45697
  }
45386
45698
  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(
45699
+ await rm17(join29(root, LOCAL_CONSOLE_PREVIOUS_FILE), { force: true });
45700
+ await rename13(consolePath, join29(root, LOCAL_CONSOLE_PREVIOUS_FILE)).catch(
45389
45701
  (error52) => {
45390
45702
  if (error52.code !== "ENOENT") throw error52;
45391
45703
  }
@@ -45416,7 +45728,7 @@ function createLocalConsoleSink(options = {}) {
45416
45728
  };
45417
45729
  }
45418
45730
  async function consumeRunnerInstallRequests(root = defaultLocalObservabilityRoot()) {
45419
- const directory = join28(root, LOCAL_REQUESTS_DIR);
45731
+ const directory = join29(root, LOCAL_REQUESTS_DIR);
45420
45732
  const requested = /* @__PURE__ */ new Set();
45421
45733
  let names;
45422
45734
  try {
@@ -45428,7 +45740,7 @@ async function consumeRunnerInstallRequests(root = defaultLocalObservabilityRoot
45428
45740
  const name = `install-runner-${type}.json`;
45429
45741
  if (!names.includes(name)) continue;
45430
45742
  try {
45431
- await rm17(join28(directory, name), { force: true });
45743
+ await rm17(join29(directory, name), { force: true });
45432
45744
  requested.add(type);
45433
45745
  } catch {
45434
45746
  }
@@ -45436,13 +45748,13 @@ async function consumeRunnerInstallRequests(root = defaultLocalObservabilityRoot
45436
45748
  return requested;
45437
45749
  }
45438
45750
  async function writeLocalStatus(status, root = defaultLocalObservabilityRoot()) {
45439
- const destination = join28(root, LOCAL_STATUS_FILE);
45440
- const temporary = join28(
45751
+ const destination = join29(root, LOCAL_STATUS_FILE);
45752
+ const temporary = join29(
45441
45753
  dirname16(destination),
45442
45754
  `.${basename7(destination)}.${process.pid}.${crypto.randomUUID()}.tmp`
45443
45755
  );
45444
45756
  try {
45445
- await mkdir21(root, { recursive: true, mode: 448 });
45757
+ await mkdir22(root, { recursive: true, mode: 448 });
45446
45758
  const handle = await open12(temporary, "wx", 384);
45447
45759
  try {
45448
45760
  await handle.writeFile(`${JSON.stringify(status)}
@@ -45457,24 +45769,24 @@ async function writeLocalStatus(status, root = defaultLocalObservabilityRoot())
45457
45769
  }
45458
45770
 
45459
45771
  // src/demo-state.ts
45460
- import { isAbsolute as isAbsolute19, join as join29, parse as parse3, resolve as resolve18 } from "node:path";
45772
+ import { isAbsolute as isAbsolute20, join as join30, parse as parse3, resolve as resolve19 } from "node:path";
45461
45773
  var DEMO_STATE_ROOT_ENV = "ZIXT_DEMO_STATE_ROOT";
45462
45774
  function resolveDemoHostStatePaths(env = process.env) {
45463
45775
  const configured = env.ZIXT_RUNNER === "demo" ? env[DEMO_STATE_ROOT_ENV] : void 0;
45464
45776
  if (!configured) return null;
45465
- const root = resolve18(configured);
45466
- if (!isAbsolute19(configured) || root === parse3(root).root) {
45777
+ const root = resolve19(configured);
45778
+ if (!isAbsolute20(configured) || root === parse3(root).root) {
45467
45779
  throw new Error(`${DEMO_STATE_ROOT_ENV} must be a dedicated absolute directory`);
45468
45780
  }
45469
45781
  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")
45782
+ runRegistryRoot: join30(root, "run-registry"),
45783
+ terminalOutcomeRoot: join30(root, "terminal-outcomes"),
45784
+ acceptedAssignmentRoot: join30(root, "accepted-assignments"),
45785
+ runArtifactRoot: join30(root, "run-artifacts"),
45786
+ browserProfileRoot: join30(root, "browser-profiles"),
45787
+ runnerWorkspaceRoot: join30(root, "workspaces"),
45788
+ codexThreadIndexRoot: join30(root, "codex-threads"),
45789
+ localObservabilityRoot: join30(root, "local-observability")
45478
45790
  };
45479
45791
  }
45480
45792