@zixt/host 0.0.142 → 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 +606 -284
  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.142",
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();
@@ -17037,6 +17104,14 @@ var Schedule = external_exports.object({
17037
17104
  * a Machine with fresh Browser capability instead of running blind (OB-14).
17038
17105
  */
17039
17106
  requiresBrowser: external_exports.boolean().default(false),
17107
+ /**
17108
+ * Break-in rhythm (OB-14, founder direction 2026-08-24): the Automation
17109
+ * starts on its stored cadence and settles onto this one at the given
17110
+ * moment, so an initiative routine runs daily while the teammate is new and
17111
+ * weekly once it has found its feet. A person editing the cadence clears
17112
+ * this: their explicit choice is the new truth.
17113
+ */
17114
+ settle: external_exports.object({ at: IsoDate, cadence: ScheduleCadence }).nullable().default(null),
17040
17115
  enabled: external_exports.boolean(),
17041
17116
  lastRunAt: IsoDate.nullable(),
17042
17117
  skippedRuns: external_exports.number().int().min(0).default(0),
@@ -17057,7 +17132,9 @@ var CreateScheduleRequest = external_exports.object({
17057
17132
  cadence: ScheduleCadence,
17058
17133
  endsAt: IsoDate.nullable().optional(),
17059
17134
  requestedHostId: HostId.nullable().optional(),
17060
- requiresBrowser: external_exports.boolean().optional()
17135
+ requiresBrowser: external_exports.boolean().optional(),
17136
+ /** Break-in rhythm: begin on `cadence`, settle onto this one at the moment given. */
17137
+ settle: external_exports.object({ at: IsoDate, cadence: ScheduleCadence }).nullable().optional()
17061
17138
  });
17062
17139
  var UpdateScheduleRequest = external_exports.object({
17063
17140
  name: Schedule.shape.name,
@@ -18594,6 +18671,35 @@ var AgentOp = external_exports.union([
18594
18671
  }),
18595
18672
  /** Remove a company fact that is wrong or stale, by its id. */
18596
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
+ }),
18597
18703
  /** The teammate's working-folder registry with per-Machine availability. */
18598
18704
  external_exports.object({ kind: external_exports.literal("workspace.list") }),
18599
18705
  /**
@@ -23383,7 +23489,7 @@ function runnerCommandCandidates(type, options = {}) {
23383
23489
  return platform === "win32" ? [join3(toolsRoot, "codex")] : [join3(toolsRoot, "bin", "codex")];
23384
23490
  }
23385
23491
  async function commandRuns(path) {
23386
- return new Promise((resolve19) => {
23492
+ return new Promise((resolve20) => {
23387
23493
  let child;
23388
23494
  try {
23389
23495
  child = spawnCli(path, ["--version"], {
@@ -23391,21 +23497,21 @@ async function commandRuns(path) {
23391
23497
  windowsHide: true
23392
23498
  });
23393
23499
  } catch {
23394
- resolve19(false);
23500
+ resolve20(false);
23395
23501
  return;
23396
23502
  }
23397
23503
  const timer = setTimeout(() => {
23398
23504
  child.kill();
23399
- resolve19(false);
23505
+ resolve20(false);
23400
23506
  }, 1e4);
23401
23507
  timer.unref?.();
23402
23508
  child.once("error", () => {
23403
23509
  clearTimeout(timer);
23404
- resolve19(false);
23510
+ resolve20(false);
23405
23511
  });
23406
23512
  child.once("exit", (code) => {
23407
23513
  clearTimeout(timer);
23408
- resolve19(code === 0);
23514
+ resolve20(code === 0);
23409
23515
  });
23410
23516
  });
23411
23517
  }
@@ -23611,7 +23717,7 @@ async function generateTaskTitle(instructions, runner) {
23611
23717
  instructions.slice(0, INSTRUCTIONS_BUDGET),
23612
23718
  "</task_request>"
23613
23719
  ].join("\n");
23614
- return new Promise((resolve19) => {
23720
+ return new Promise((resolve20) => {
23615
23721
  const child = spawnCli(
23616
23722
  command,
23617
23723
  [
@@ -23634,7 +23740,7 @@ async function generateTaskTitle(instructions, runner) {
23634
23740
  if (settled) return;
23635
23741
  settled = true;
23636
23742
  clearTimeout(timer);
23637
- resolve19(value);
23743
+ resolve20(value);
23638
23744
  };
23639
23745
  const timer = setTimeout(() => {
23640
23746
  child.kill();
@@ -23963,11 +24069,11 @@ function createWorkerWatchdogSendDrain() {
23963
24069
  if (completed) return;
23964
24070
  completed = true;
23965
24071
  pending--;
23966
- if (pending === 0) drained.splice(0).forEach((resolve19) => resolve19());
24072
+ if (pending === 0) drained.splice(0).forEach((resolve20) => resolve20());
23967
24073
  };
23968
24074
  },
23969
24075
  drain: async () => {
23970
- if (pending > 0) await new Promise((resolve19) => drained.push(resolve19));
24076
+ if (pending > 0) await new Promise((resolve20) => drained.push(resolve20));
23971
24077
  }
23972
24078
  };
23973
24079
  }
@@ -24484,7 +24590,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
24484
24590
  const deadline = Date.parse(retryAt);
24485
24591
  if (!Number.isFinite(deadline) || signal.aborted) return false;
24486
24592
  if (deadline <= Date.now()) return true;
24487
- return await new Promise((resolve19) => {
24593
+ return await new Promise((resolve20) => {
24488
24594
  let settled = false;
24489
24595
  let timer;
24490
24596
  const finish = (ready) => {
@@ -24492,7 +24598,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
24492
24598
  settled = true;
24493
24599
  if (timer) clearTimeout(timer);
24494
24600
  signal.removeEventListener("abort", onAbort);
24495
- resolve19(ready);
24601
+ resolve20(ready);
24496
24602
  };
24497
24603
  const onAbort = () => finish(false);
24498
24604
  const schedule = () => {
@@ -24773,27 +24879,27 @@ var HostClient = class _HostClient {
24773
24879
  const unwindingAssignments = [...this.activeAssignments.values()];
24774
24880
  for (const cancel of this.cancels.values()) cancel(stopReason);
24775
24881
  for (const entry of this.secretGrants.values()) {
24776
- for (const resolve19 of entry.resolvers) resolve19({});
24882
+ for (const resolve20 of entry.resolvers) resolve20({});
24777
24883
  entry.resolvers = [];
24778
24884
  delete entry.value;
24779
24885
  }
24780
24886
  for (const entry of this.connectionGrants.values()) {
24781
- for (const resolve19 of entry.resolvers) resolve19([]);
24887
+ for (const resolve20 of entry.resolvers) resolve20([]);
24782
24888
  entry.resolvers = [];
24783
24889
  delete entry.value;
24784
24890
  }
24785
24891
  for (const entry of this.providerGrants.values()) {
24786
- for (const resolve19 of entry.resolvers) resolve19([]);
24892
+ for (const resolve20 of entry.resolvers) resolve20([]);
24787
24893
  entry.resolvers = [];
24788
24894
  delete entry.value;
24789
24895
  }
24790
24896
  for (const entry of this.integrationToolServerGrants.values()) {
24791
- for (const resolve19 of entry.resolvers) resolve19([]);
24897
+ for (const resolve20 of entry.resolvers) resolve20([]);
24792
24898
  entry.resolvers = [];
24793
24899
  delete entry.value;
24794
24900
  }
24795
24901
  for (const waiters of this.approvalWaiters.values()) {
24796
- for (const resolve19 of waiters.values()) resolve19({ approved: false, guidance: reason });
24902
+ for (const resolve20 of waiters.values()) resolve20({ approved: false, guidance: reason });
24797
24903
  }
24798
24904
  for (const waiters of this.agentOpWaiters.values()) {
24799
24905
  for (const waiter of waiters.values()) {
@@ -24820,9 +24926,9 @@ var HostClient = class _HostClient {
24820
24926
  let drainTimer;
24821
24927
  const drained = await Promise.race([
24822
24928
  Promise.allSettled(runs).then(() => true),
24823
- new Promise((resolve19) => {
24929
+ new Promise((resolve20) => {
24824
24930
  drainTimer = setTimeout(
24825
- () => resolve19(false),
24931
+ () => resolve20(false),
24826
24932
  this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
24827
24933
  );
24828
24934
  drainTimer.unref?.();
@@ -24975,9 +25081,9 @@ var HostClient = class _HostClient {
24975
25081
  let frameDrainTimer;
24976
25082
  const framesDrained = await Promise.race([
24977
25083
  frameTail.then(() => true),
24978
- new Promise((resolve19) => {
25084
+ new Promise((resolve20) => {
24979
25085
  frameDrainTimer = setTimeout(
24980
- () => resolve19(false),
25086
+ () => resolve20(false),
24981
25087
  this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
24982
25088
  );
24983
25089
  frameDrainTimer.unref?.();
@@ -25490,17 +25596,24 @@ var HostClient = class _HostClient {
25490
25596
  * The /gateway WebSocket origin answers plain HTTPS too; attachment bytes
25491
25597
  * ride that, authenticated by the same host token as the socket (TS-15).
25492
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
+ }
25493
25603
  async fetchAttachment(attachmentId, signal) {
25604
+ return this.fetchGatewayBytes(`/gateway/attachments/${attachmentId}`, "attachment", signal);
25605
+ }
25606
+ async fetchGatewayBytes(pathname, label, signal) {
25494
25607
  const url3 = new URL(this.opts.url);
25495
25608
  url3.protocol = url3.protocol === "wss:" ? "https:" : "http:";
25496
- url3.pathname = `/gateway/attachments/${attachmentId}`;
25609
+ url3.pathname = pathname;
25497
25610
  url3.search = "";
25498
25611
  const response = await fetch(url3, {
25499
25612
  headers: { authorization: `Bearer ${this.opts.token}` },
25500
25613
  signal
25501
25614
  });
25502
25615
  if (!response.ok) {
25503
- throw new Error(`attachment download failed (${response.status})`);
25616
+ throw new Error(`${label} download failed (${response.status})`);
25504
25617
  }
25505
25618
  return new Uint8Array(await response.arrayBuffer());
25506
25619
  }
@@ -25555,7 +25668,7 @@ var HostClient = class _HostClient {
25555
25668
  const entry = this.secretGrants.get(key) ?? { resolvers: [] };
25556
25669
  entry.value = message.secrets;
25557
25670
  entry.expiresAt = expiresAt;
25558
- for (const resolve19 of entry.resolvers) resolve19(message.secrets);
25671
+ for (const resolve20 of entry.resolvers) resolve20(message.secrets);
25559
25672
  entry.resolvers = [];
25560
25673
  this.secretGrants.set(key, entry);
25561
25674
  return;
@@ -25586,19 +25699,19 @@ var HostClient = class _HostClient {
25586
25699
  const entry = this.connectionGrants.get(key) ?? { resolvers: [] };
25587
25700
  entry.value = message.connections;
25588
25701
  entry.expiresAt = expiresAt;
25589
- for (const resolve19 of entry.resolvers) resolve19(message.connections);
25702
+ for (const resolve20 of entry.resolvers) resolve20(message.connections);
25590
25703
  entry.resolvers = [];
25591
25704
  this.connectionGrants.set(key, entry);
25592
25705
  const providerEntry = this.providerGrants.get(key) ?? { resolvers: [] };
25593
25706
  providerEntry.value = providers;
25594
25707
  providerEntry.expiresAt = authorityExpiresAt;
25595
- for (const resolve19 of providerEntry.resolvers) resolve19(providers);
25708
+ for (const resolve20 of providerEntry.resolvers) resolve20(providers);
25596
25709
  providerEntry.resolvers = [];
25597
25710
  this.providerGrants.set(key, providerEntry);
25598
25711
  const toolServerEntry = this.integrationToolServerGrants.get(key) ?? { resolvers: [] };
25599
25712
  const toolServers = [...message.toolServers ?? []];
25600
25713
  toolServerEntry.value = toolServers;
25601
- for (const resolve19 of toolServerEntry.resolvers) resolve19(toolServers);
25714
+ for (const resolve20 of toolServerEntry.resolvers) resolve20(toolServers);
25602
25715
  toolServerEntry.resolvers = [];
25603
25716
  this.integrationToolServerGrants.set(key, toolServerEntry);
25604
25717
  return;
@@ -25737,8 +25850,8 @@ var HostClient = class _HostClient {
25737
25850
  return redactCredentialText(text, sensitiveSnapshot()).slice(0, maxLength);
25738
25851
  };
25739
25852
  let resolveCancelled;
25740
- const cancelledPromise = new Promise((resolve19) => {
25741
- resolveCancelled = resolve19;
25853
+ const cancelledPromise = new Promise((resolve20) => {
25854
+ resolveCancelled = resolve20;
25742
25855
  });
25743
25856
  const endAuthority = (reason = "cloud_cancel") => {
25744
25857
  if (stopReason) return;
@@ -25747,28 +25860,28 @@ var HostClient = class _HostClient {
25747
25860
  authorityController.abort(reason);
25748
25861
  const secretEntry = this.secretGrants.get(cancelKey);
25749
25862
  if (secretEntry) {
25750
- for (const resolve19 of secretEntry.resolvers) resolve19({});
25863
+ for (const resolve20 of secretEntry.resolvers) resolve20({});
25751
25864
  secretEntry.resolvers = [];
25752
25865
  delete secretEntry.value;
25753
25866
  }
25754
25867
  this.secretGrants.delete(cancelKey);
25755
25868
  const connectionEntry = this.connectionGrants.get(cancelKey);
25756
25869
  if (connectionEntry) {
25757
- for (const resolve19 of connectionEntry.resolvers) resolve19([]);
25870
+ for (const resolve20 of connectionEntry.resolvers) resolve20([]);
25758
25871
  connectionEntry.resolvers = [];
25759
25872
  delete connectionEntry.value;
25760
25873
  }
25761
25874
  this.connectionGrants.delete(cancelKey);
25762
25875
  const providerEntry = this.providerGrants.get(cancelKey);
25763
25876
  if (providerEntry) {
25764
- for (const resolve19 of providerEntry.resolvers) resolve19([]);
25877
+ for (const resolve20 of providerEntry.resolvers) resolve20([]);
25765
25878
  providerEntry.resolvers = [];
25766
25879
  delete providerEntry.value;
25767
25880
  }
25768
25881
  this.providerGrants.delete(cancelKey);
25769
25882
  const toolServerEntry = this.integrationToolServerGrants.get(cancelKey);
25770
25883
  if (toolServerEntry) {
25771
- for (const resolve19 of toolServerEntry.resolvers) resolve19([]);
25884
+ for (const resolve20 of toolServerEntry.resolvers) resolve20([]);
25772
25885
  toolServerEntry.resolvers = [];
25773
25886
  delete toolServerEntry.value;
25774
25887
  }
@@ -25776,8 +25889,8 @@ var HostClient = class _HostClient {
25776
25889
  this.clearAuthorityExpiry(cancelKey);
25777
25890
  const approvalWaiters = this.approvalWaiters.get(cancelKey);
25778
25891
  if (approvalWaiters) {
25779
- for (const resolve19 of approvalWaiters.values()) {
25780
- resolve19({ approved: false, guidance: "task was cancelled" });
25892
+ for (const resolve20 of approvalWaiters.values()) {
25893
+ resolve20({ approved: false, guidance: "task was cancelled" });
25781
25894
  }
25782
25895
  approvalWaiters.clear();
25783
25896
  }
@@ -25903,9 +26016,9 @@ var HostClient = class _HostClient {
25903
26016
  return value;
25904
26017
  };
25905
26018
  if (entry.value) return Promise.resolve(capture(entry.value));
25906
- return new Promise((resolve19) => {
25907
- entry.resolvers.push((value) => resolve19(capture(value)));
25908
- 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);
25909
26022
  });
25910
26023
  };
25911
26024
  const connections = () => {
@@ -25922,9 +26035,9 @@ var HostClient = class _HostClient {
25922
26035
  return value;
25923
26036
  };
25924
26037
  if (entry.value) return Promise.resolve(capture(entry.value));
25925
- return new Promise((resolve19) => {
25926
- entry.resolvers.push((value) => resolve19(capture(value)));
25927
- 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);
25928
26041
  });
25929
26042
  };
25930
26043
  const providers = () => {
@@ -25941,9 +26054,9 @@ var HostClient = class _HostClient {
25941
26054
  return value;
25942
26055
  };
25943
26056
  if (entry.value !== void 0) return Promise.resolve(capture(entry.value));
25944
- return new Promise((resolve19) => {
25945
- entry.resolvers.push((value) => resolve19(capture(value)));
25946
- 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);
25947
26060
  });
25948
26061
  };
25949
26062
  const integrationToolServers = () => {
@@ -25952,9 +26065,9 @@ var HostClient = class _HostClient {
25952
26065
  this.integrationToolServerGrants.set(cancelKey, entry);
25953
26066
  const capture = (value) => authorityController.signal.aborted ? [] : value;
25954
26067
  if (entry.value !== void 0) return Promise.resolve(capture(entry.value));
25955
- return new Promise((resolve19) => {
25956
- entry.resolvers.push((value) => resolve19(capture(value)));
25957
- 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);
25958
26071
  });
25959
26072
  };
25960
26073
  const linear = async () => {
@@ -25981,13 +26094,13 @@ var HostClient = class _HostClient {
25981
26094
  ...questionChoices ? { questionChoices: [...questionChoices] } : {},
25982
26095
  ...questionnaire ? { questionnaire } : {}
25983
26096
  });
25984
- return new Promise((resolve19) => {
26097
+ return new Promise((resolve20) => {
25985
26098
  const waiters = this.approvalWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
25986
26099
  this.approvalWaiters.set(cancelKey, waiters);
25987
- waiters.set(requestId, resolve19);
26100
+ waiters.set(requestId, resolve20);
25988
26101
  void cancelledPromise.then(() => {
25989
26102
  if (waiters.delete(requestId)) {
25990
- resolve19({ approved: false, guidance: "task was cancelled" });
26103
+ resolve20({ approved: false, guidance: "task was cancelled" });
25991
26104
  }
25992
26105
  });
25993
26106
  });
@@ -26033,11 +26146,11 @@ var HostClient = class _HostClient {
26033
26146
  if (existing) message = existing;
26034
26147
  else terminalMessages.set(requestId, message);
26035
26148
  }
26036
- return new Promise((resolve19) => {
26149
+ return new Promise((resolve20) => {
26037
26150
  const waiters = this.agentOpWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
26038
26151
  this.agentOpWaiters.set(cancelKey, waiters);
26039
26152
  if (waiters.has(requestId)) {
26040
- resolve19({ ok: false, error: "provider settlement request is already in flight" });
26153
+ resolve20({ ok: false, error: "provider settlement request is already in flight" });
26041
26154
  return;
26042
26155
  }
26043
26156
  const timer = setTimeout(() => {
@@ -26048,7 +26161,7 @@ var HostClient = class _HostClient {
26048
26161
  (pending) => !(pending.type === "agent.op" && pending.requestId === requestId)
26049
26162
  );
26050
26163
  }
26051
- resolve19({
26164
+ resolve20({
26052
26165
  ok: false,
26053
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"
26054
26167
  });
@@ -26056,7 +26169,7 @@ var HostClient = class _HostClient {
26056
26169
  }, _HostClient.AGENT_OP_TIMEOUT_MS);
26057
26170
  timer.unref?.();
26058
26171
  waiters.set(requestId, {
26059
- resolve: resolve19,
26172
+ resolve: resolve20,
26060
26173
  timer,
26061
26174
  ...terminal ? { terminalMessage: message } : {}
26062
26175
  });
@@ -26102,12 +26215,12 @@ var HostClient = class _HostClient {
26102
26215
  "No GitHub change was attempted; the authority grant request was invalid."
26103
26216
  );
26104
26217
  }
26105
- const outcome = await new Promise((resolve19) => {
26218
+ const outcome = await new Promise((resolve20) => {
26106
26219
  const timer = setTimeout(() => {
26107
26220
  const waiter = this.operationGrantWaiters.get(requestId);
26108
26221
  if (!waiter) return;
26109
26222
  this.operationGrantWaiters.delete(requestId);
26110
- resolve19({ grant: null, retryable: true, reason: "no_reply_from_zixt" });
26223
+ resolve20({ grant: null, retryable: true, reason: "no_reply_from_zixt" });
26111
26224
  }, this.operationGrantTimeoutMs);
26112
26225
  timer.unref?.();
26113
26226
  this.operationGrantWaiters.set(requestId, {
@@ -26120,9 +26233,9 @@ var HostClient = class _HostClient {
26120
26233
  timer,
26121
26234
  accept: (grant) => {
26122
26235
  addSensitiveValues(providerGrantSensitiveValues(grant));
26123
- resolve19({ grant });
26236
+ resolve20({ grant });
26124
26237
  },
26125
- deny: (retryable, reason, detail, retryAt, retryCode) => resolve19({
26238
+ deny: (retryable, reason, detail, retryAt, retryCode) => resolve20({
26126
26239
  grant: null,
26127
26240
  retryable,
26128
26241
  reason,
@@ -26136,7 +26249,7 @@ var HostClient = class _HostClient {
26136
26249
  } catch {
26137
26250
  clearTimeout(timer);
26138
26251
  this.operationGrantWaiters.delete(requestId);
26139
- resolve19({ grant: null, retryable: false, reason: "connection_unavailable" });
26252
+ resolve20({ grant: null, retryable: false, reason: "connection_unavailable" });
26140
26253
  }
26141
26254
  });
26142
26255
  if (outcome.grant) {
@@ -26192,7 +26305,7 @@ var HostClient = class _HostClient {
26192
26305
  )
26193
26306
  );
26194
26307
  }
26195
- return new Promise((resolve19, reject3) => {
26308
+ return new Promise((resolve20, reject3) => {
26196
26309
  const timer = setTimeout(() => {
26197
26310
  if (this.browserCredentialWaiters.delete(requestId)) {
26198
26311
  reject3(
@@ -26211,7 +26324,7 @@ var HostClient = class _HostClient {
26211
26324
  timer,
26212
26325
  accept: (credential) => {
26213
26326
  addSensitiveValues(webLoginSensitiveValues(credential));
26214
- resolve19(credential);
26327
+ resolve20(credential);
26215
26328
  },
26216
26329
  deny: (reason) => reject3(new Error(reason))
26217
26330
  });
@@ -26239,6 +26352,7 @@ var HostClient = class _HostClient {
26239
26352
  runnerRuntime: emitRunnerRuntime,
26240
26353
  siblingTasks: () => [...this.liveTasks.values()].filter((live) => live.agentId === assign.agentId && live.taskId !== assign.taskId).map(({ taskId, title }) => ({ taskId, title })),
26241
26354
  fetchAttachment: (attachmentId) => this.fetchAttachment(attachmentId, authorityController.signal),
26355
+ fetchCompanyAsset: (assetId) => this.fetchCompanyAsset(assetId, authorityController.signal),
26242
26356
  followUps: (handler5) => {
26243
26357
  if (cancelled) return () => {
26244
26358
  };
@@ -26537,14 +26651,14 @@ async function observeWindowsGuardianNonce(pid, nonce) {
26537
26651
  "Windows runner identity could not be observed"
26538
26652
  );
26539
26653
  }
26540
- return new Promise((resolve19, reject3) => {
26654
+ return new Promise((resolve20, reject3) => {
26541
26655
  let done = false;
26542
26656
  const finish = (result) => {
26543
26657
  if (done) return;
26544
26658
  done = true;
26545
26659
  clearTimeout(timeout);
26546
26660
  if (result instanceof Error) reject3(result);
26547
- else resolve19(result);
26661
+ else resolve20(result);
26548
26662
  };
26549
26663
  const timeout = setTimeout(
26550
26664
  () => finish(
@@ -26589,7 +26703,7 @@ async function observePosixGuardianNonce(pid, nonce) {
26589
26703
  );
26590
26704
  }
26591
26705
  }
26592
- return new Promise((resolve19, reject3) => {
26706
+ return new Promise((resolve20, reject3) => {
26593
26707
  const observer = spawn3("/bin/ps", ["-ww", "-o", "command=", "-p", String(pid)], {
26594
26708
  stdio: ["ignore", "pipe", "ignore"]
26595
26709
  });
@@ -26600,7 +26714,7 @@ async function observePosixGuardianNonce(pid, nonce) {
26600
26714
  done = true;
26601
26715
  clearTimeout(timeout);
26602
26716
  if (result instanceof Error) reject3(result);
26603
- else resolve19(result);
26717
+ else resolve20(result);
26604
26718
  };
26605
26719
  const timeout = setTimeout(() => {
26606
26720
  observer.kill("SIGKILL");
@@ -26647,7 +26761,7 @@ async function observeGuardianIdentity(pid, identity) {
26647
26761
  return process.platform === "win32" ? observeWindowsGuardianNonce(pid, identity.nonce) : observePosixGuardianNonce(pid, identity.nonce);
26648
26762
  }
26649
26763
  function delay(ms) {
26650
- return new Promise((resolve19) => setTimeout(resolve19, ms));
26764
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
26651
26765
  }
26652
26766
  function posixProcessRecordsFromPs(output) {
26653
26767
  const records = [];
@@ -26680,7 +26794,7 @@ function posixProcessRecordsFromPs(output) {
26680
26794
  return records;
26681
26795
  }
26682
26796
  async function snapshotPosixProcesses() {
26683
- return new Promise((resolve19, reject3) => {
26797
+ return new Promise((resolve20, reject3) => {
26684
26798
  const observer = spawn3("/bin/ps", ["-axo", "uid=,pid=,ppid=,pgid=,stat="], {
26685
26799
  stdio: ["ignore", "pipe", "ignore"]
26686
26800
  });
@@ -26693,7 +26807,7 @@ async function snapshotPosixProcesses() {
26693
26807
  if (error52) reject3(error52);
26694
26808
  else {
26695
26809
  try {
26696
- resolve19(posixProcessRecordsFromPs(output));
26810
+ resolve20(posixProcessRecordsFromPs(output));
26697
26811
  } catch (caught) {
26698
26812
  reject3(caught);
26699
26813
  }
@@ -27028,7 +27142,7 @@ async function snapshotWindowsDescendants(rootPid) {
27028
27142
  "Windows process-tree observation could not start"
27029
27143
  );
27030
27144
  }
27031
- return new Promise((resolve19, reject3) => {
27145
+ return new Promise((resolve20, reject3) => {
27032
27146
  let done = false;
27033
27147
  const timeout = setTimeout(() => {
27034
27148
  if (done) return;
@@ -27055,7 +27169,7 @@ async function snapshotWindowsDescendants(rootPid) {
27055
27169
  return;
27056
27170
  }
27057
27171
  try {
27058
- resolve19(completeWindowsDescendantPids(rootPid, processes));
27172
+ resolve20(completeWindowsDescendantPids(rootPid, processes));
27059
27173
  } catch (caught) {
27060
27174
  reject3(caught);
27061
27175
  }
@@ -27102,7 +27216,7 @@ async function waitForProcessesExit(pids, timeoutMs) {
27102
27216
  }
27103
27217
  async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, independentlyTrackedPids = []) {
27104
27218
  const trustedCommand = command ?? defaultTaskkillCommand();
27105
- const result = await new Promise((resolve19, reject3) => {
27219
+ const result = await new Promise((resolve20, reject3) => {
27106
27220
  const killer = spawn3(trustedCommand, ["/PID", String(pid), "/T", "/F"], {
27107
27221
  stdio: ["ignore", "pipe", "pipe"],
27108
27222
  windowsHide: true
@@ -27137,7 +27251,7 @@ async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, indepe
27137
27251
  done = true;
27138
27252
  clearTimeout(timeout);
27139
27253
  if (error52) reject3(error52);
27140
- else resolve19({ code: killer.exitCode, output, outputTruncated });
27254
+ else resolve20({ code: killer.exitCode, output, outputTruncated });
27141
27255
  };
27142
27256
  killer.once(
27143
27257
  "error",
@@ -27941,12 +28055,12 @@ async function createWindowsJobContainment(pid, options) {
27941
28055
  stderr = `${stderr}${String(chunk)}`.slice(-HELPER_OUTPUT_LIMIT);
27942
28056
  });
27943
28057
  const helperEvents = helper;
27944
- const exited = new Promise((resolve19) => {
28058
+ const exited = new Promise((resolve20) => {
27945
28059
  let completed = false;
27946
28060
  const complete = (code, signal) => {
27947
28061
  if (completed) return;
27948
28062
  completed = true;
27949
- resolve19({ code, signal });
28063
+ resolve20({ code, signal });
27950
28064
  };
27951
28065
  helperEvents.once("error", () => {
27952
28066
  failProtocol(new Error("Windows Job Object helper could not start"));
@@ -27959,7 +28073,7 @@ async function createWindowsJobContainment(pid, options) {
27959
28073
  });
27960
28074
  const nextLine = async (expected) => {
27961
28075
  if (protocolFailure) throw protocolFailure;
27962
- const line = lines.shift() ?? await new Promise((resolve19, reject3) => {
28076
+ const line = lines.shift() ?? await new Promise((resolve20, reject3) => {
27963
28077
  const timer = setTimeout(
27964
28078
  () => reject3(timeoutError("Windows Job Object helper did not answer in time")),
27965
28079
  timeoutMs
@@ -27967,7 +28081,7 @@ async function createWindowsJobContainment(pid, options) {
27967
28081
  timer.unref?.();
27968
28082
  lineWaiters.push((value) => {
27969
28083
  clearTimeout(timer);
27970
- resolve19(value);
28084
+ resolve20(value);
27971
28085
  });
27972
28086
  });
27973
28087
  if (protocolFailure) throw protocolFailure;
@@ -27980,8 +28094,8 @@ async function createWindowsJobContainment(pid, options) {
27980
28094
  }
27981
28095
  const stopped = await Promise.race([
27982
28096
  exited.then(() => true),
27983
- new Promise((resolve19) => {
27984
- const timer = setTimeout(() => resolve19(false), timeoutMs);
28097
+ new Promise((resolve20) => {
28098
+ const timer = setTimeout(() => resolve20(false), timeoutMs);
27985
28099
  timer.unref?.();
27986
28100
  })
27987
28101
  ]);
@@ -28040,7 +28154,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
28040
28154
  if (nonce === void 0) return true;
28041
28155
  if (!SAFE_NONCE2.test(nonce)) return false;
28042
28156
  const expected = windowsContainmentGate(nonce).trimEnd();
28043
- return new Promise((resolve19) => {
28157
+ return new Promise((resolve20) => {
28044
28158
  let pending = Buffer.alloc(0);
28045
28159
  let settled = false;
28046
28160
  const finish = (result) => {
@@ -28051,7 +28165,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
28051
28165
  input.off("end", onEnd);
28052
28166
  input.off("error", onEnd);
28053
28167
  if (result) input.pause();
28054
- resolve19(result);
28168
+ resolve20(result);
28055
28169
  };
28056
28170
  const onData = (chunk) => {
28057
28171
  pending = Buffer.concat([pending, chunk]);
@@ -29155,7 +29269,7 @@ async function installRelease(version2, options = {}) {
29155
29269
  }) : Promise.resolve(null);
29156
29270
  const timeoutMs = options.timeoutMs ?? INSTALL_TIMEOUT_MS2;
29157
29271
  const outcome = { code: null, signal: null, timedOut: false, spawnError: null };
29158
- const installed = await new Promise((resolve19, reject3) => {
29272
+ const installed = await new Promise((resolve20, reject3) => {
29159
29273
  let finished = false;
29160
29274
  let cleanupStarted = false;
29161
29275
  let exitObserved = false;
@@ -29171,7 +29285,7 @@ async function installRelease(version2, options = {}) {
29171
29285
  finished = true;
29172
29286
  clearTimeout(timer);
29173
29287
  options.signal?.removeEventListener("abort", requestCleanup);
29174
- resolve19(result);
29288
+ resolve20(result);
29175
29289
  };
29176
29290
  const requestCleanup = () => {
29177
29291
  if (cleanupStarted || finished) return;
@@ -29536,11 +29650,11 @@ async function runWorkerCompatibilityProxy(env = process.env, argv = process.arg
29536
29650
  child.stdin?.on("error", () => {
29537
29651
  });
29538
29652
  process.stdin.pipe(child.stdin);
29539
- return new Promise((resolve19) => {
29540
- child.once("error", () => resolve19(1));
29653
+ return new Promise((resolve20) => {
29654
+ child.once("error", () => resolve20(1));
29541
29655
  child.once("exit", (code) => {
29542
29656
  process.stdin.unpipe(child.stdin);
29543
- resolve19(code ?? 1);
29657
+ resolve20(code ?? 1);
29544
29658
  });
29545
29659
  });
29546
29660
  }
@@ -29620,11 +29734,11 @@ async function launchHostSupervisor(options = {}) {
29620
29734
  const waitOrStop = async (ms) => {
29621
29735
  if (stopping) return false;
29622
29736
  if (!customDelay) {
29623
- await new Promise((resolve19) => {
29737
+ await new Promise((resolve20) => {
29624
29738
  const finish = () => {
29625
29739
  clearTimeout(timer);
29626
29740
  stopController.signal.removeEventListener("abort", finish);
29627
- resolve19();
29741
+ resolve20();
29628
29742
  };
29629
29743
  const timer = setTimeout(finish, ms);
29630
29744
  stopController.signal.addEventListener("abort", finish, { once: true });
@@ -29632,8 +29746,8 @@ async function launchHostSupervisor(options = {}) {
29632
29746
  return !stopping;
29633
29747
  }
29634
29748
  let finishStop;
29635
- const stopped = new Promise((resolve19) => {
29636
- finishStop = () => resolve19();
29749
+ const stopped = new Promise((resolve20) => {
29750
+ finishStop = () => resolve20();
29637
29751
  stopController.signal.addEventListener("abort", finishStop, { once: true });
29638
29752
  });
29639
29753
  await Promise.race([customDelay(ms), stopped]);
@@ -29763,19 +29877,19 @@ async function launchHostSupervisor(options = {}) {
29763
29877
  child = spawnSupervisor(entry, version2, ownershipDirectory, containmentGateNonce);
29764
29878
  const launchedSupervisor = child;
29765
29879
  let resolveChildExited;
29766
- const childExited = new Promise((resolve19) => {
29767
- resolveChildExited = resolve19;
29880
+ const childExited = new Promise((resolve20) => {
29881
+ resolveChildExited = resolve20;
29768
29882
  });
29769
29883
  const supervisorContainmentAbort = new AbortController();
29770
29884
  void childExited.then(() => supervisorContainmentAbort.abort());
29771
29885
  const outcomePromise = new Promise(
29772
- (resolve19) => {
29886
+ (resolve20) => {
29773
29887
  let observed = false;
29774
29888
  const finish = (code, signal) => {
29775
29889
  if (observed) return;
29776
29890
  observed = true;
29777
29891
  resolveChildExited();
29778
- resolve19({ code, signal });
29892
+ resolve20({ code, signal });
29779
29893
  };
29780
29894
  child.once("error", () => finish(1, null));
29781
29895
  child.once("exit", finish);
@@ -29796,12 +29910,12 @@ async function launchHostSupervisor(options = {}) {
29796
29910
  if (!supervisorContainment || !launchedSupervisor.stdin) {
29797
29911
  throw new Error("supervisor Job Object gate is unavailable");
29798
29912
  }
29799
- await new Promise((resolve19, reject3) => {
29913
+ await new Promise((resolve20, reject3) => {
29800
29914
  launchedSupervisor.stdin.write(
29801
29915
  windowsContainmentGate(containmentGateNonce),
29802
29916
  (error52) => {
29803
29917
  if (error52) reject3(error52);
29804
- else resolve19();
29918
+ else resolve20();
29805
29919
  }
29806
29920
  );
29807
29921
  });
@@ -29949,19 +30063,19 @@ async function superviseHost(options = {}) {
29949
30063
  }
29950
30064
  }
29951
30065
  let announceShutdown;
29952
- const shutdownAnnounced = new Promise((resolve19) => {
29953
- announceShutdown = resolve19;
30066
+ const shutdownAnnounced = new Promise((resolve20) => {
30067
+ announceShutdown = resolve20;
29954
30068
  });
29955
30069
  const attempted = /* @__PURE__ */ new Set();
29956
30070
  let unsatisfiableUpdates = 0;
29957
30071
  const waitOrShutdown = async (ms) => {
29958
30072
  if (shuttingDown2) return false;
29959
30073
  if (!customDelay) {
29960
- await new Promise((resolve19) => {
30074
+ await new Promise((resolve20) => {
29961
30075
  const finish = () => {
29962
30076
  clearTimeout(timer);
29963
30077
  shutdownController.signal.removeEventListener("abort", finish);
29964
- resolve19();
30078
+ resolve20();
29965
30079
  };
29966
30080
  const timer = setTimeout(finish, ms);
29967
30081
  shutdownController.signal.addEventListener("abort", finish, { once: true });
@@ -30111,19 +30225,19 @@ async function superviseHost(options = {}) {
30111
30225
  const watchedChild = child;
30112
30226
  const workerStderr = captureWorkerStderr(watchedChild);
30113
30227
  let resolveChildExited;
30114
- const childExited = new Promise((resolve19) => {
30115
- resolveChildExited = resolve19;
30228
+ const childExited = new Promise((resolve20) => {
30229
+ resolveChildExited = resolve20;
30116
30230
  });
30117
30231
  const workerContainmentAbort = new AbortController();
30118
30232
  void childExited.then(() => workerContainmentAbort.abort());
30119
30233
  const outcomePromise = new Promise(
30120
- (resolve19) => {
30234
+ (resolve20) => {
30121
30235
  let observed = false;
30122
30236
  const finish = (result) => {
30123
30237
  if (observed) return;
30124
30238
  observed = true;
30125
30239
  resolveChildExited();
30126
- resolve19(result);
30240
+ resolve20(result);
30127
30241
  };
30128
30242
  watchedChild.once("error", () => finish({ code: 1, signal: null }));
30129
30243
  watchedChild.once(
@@ -30145,10 +30259,10 @@ async function superviseHost(options = {}) {
30145
30259
  if (!workerContainment || !watchedChild.stdin) {
30146
30260
  throw new Error("worker Job Object gate is unavailable");
30147
30261
  }
30148
- await new Promise((resolve19, reject3) => {
30262
+ await new Promise((resolve20, reject3) => {
30149
30263
  watchedChild.stdin.write(windowsContainmentGate(containmentGateNonce), (error52) => {
30150
30264
  if (error52) reject3(error52);
30151
- else resolve19();
30265
+ else resolve20();
30152
30266
  });
30153
30267
  });
30154
30268
  }
@@ -31326,7 +31440,7 @@ async function loadPlaywright() {
31326
31440
  }
31327
31441
  async function installChromium() {
31328
31442
  const cliPath = join12(playwrightCoreRoot, "cli.js");
31329
- await new Promise((resolve19, reject3) => {
31443
+ await new Promise((resolve20, reject3) => {
31330
31444
  const child = spawn7(process.execPath, [cliPath, "install", "chromium"], {
31331
31445
  env: process.env,
31332
31446
  stdio: ["ignore", "inherit", "inherit"],
@@ -31341,7 +31455,7 @@ async function installChromium() {
31341
31455
  settled = true;
31342
31456
  clearTimeout(timeout);
31343
31457
  if (error52) reject3(error52);
31344
- else resolve19();
31458
+ else resolve20();
31345
31459
  };
31346
31460
  const timeout = setTimeout(() => {
31347
31461
  child.kill();
@@ -31961,9 +32075,9 @@ function createPlaywrightBrowserAdapterFactory(dependencies = {}) {
31961
32075
  // src/runners/cli-runner.ts
31962
32076
  import { spawn as spawn11 } from "node:child_process";
31963
32077
  import { randomUUID as randomUUID12 } from "node:crypto";
31964
- 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";
31965
32079
  import { homedir as homedir7 } from "node:os";
31966
- 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";
31967
32081
 
31968
32082
  // src/tool-packs/browser/authentication-wall.ts
31969
32083
  var AUTH_PATH_SEGMENT = /(?:^|\/)(?:log[-_]?in|sign[-_]?in|sso|saml|auth|authorize|authenticate|oauth2?|session\/new|checkpoint)(?:\/|$)/i;
@@ -35145,8 +35259,8 @@ async function runGit(input, args, env) {
35145
35259
  let settled = false;
35146
35260
  let stopping = false;
35147
35261
  let resolveExited;
35148
- const exited = new Promise((resolve19) => {
35149
- resolveExited = resolve19;
35262
+ const exited = new Promise((resolve20) => {
35263
+ resolveExited = resolve20;
35150
35264
  });
35151
35265
  child.once("exit", resolveExited);
35152
35266
  const cleanup = () => {
@@ -37956,8 +38070,8 @@ var linearToolPackFactory = {
37956
38070
  async create(grant, context) {
37957
38071
  let resolveCancelled;
37958
38072
  let closed = false;
37959
- const cancelled = new Promise((resolve19) => {
37960
- resolveCancelled = resolve19;
38073
+ const cancelled = new Promise((resolve20) => {
38074
+ resolveCancelled = resolve20;
37961
38075
  });
37962
38076
  const cancel = () => {
37963
38077
  if (closed) return;
@@ -39178,6 +39292,47 @@ var TOOLS = [
39178
39292
  required: ["agent_id"]
39179
39293
  }
39180
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
+ },
39181
39336
  {
39182
39337
  name: "note_company_fact",
39183
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.",
@@ -39569,6 +39724,8 @@ function opFor(name, args) {
39569
39724
  }
39570
39725
  case "forget_company_fact":
39571
39726
  return { kind: "company.forget", entryId: str("entry_id") };
39727
+ case "forget_company_asset":
39728
+ return { kind: "asset.forget", name: str("name") };
39572
39729
  case "list_workspaces":
39573
39730
  return { kind: "workspace.list" };
39574
39731
  case "add_workspace":
@@ -39670,7 +39827,7 @@ function createAskUserServer() {
39670
39827
  let server;
39671
39828
  let listening;
39672
39829
  function ensureListening() {
39673
- listening ??= new Promise((resolve19, reject3) => {
39830
+ listening ??= new Promise((resolve20, reject3) => {
39674
39831
  server = createServer2((req, res) => {
39675
39832
  res.on("error", () => {
39676
39833
  });
@@ -39686,7 +39843,7 @@ function createAskUserServer() {
39686
39843
  server.on("error", reject3);
39687
39844
  server.listen(0, "127.0.0.1", () => {
39688
39845
  const address = server.address();
39689
- if (address && typeof address === "object") resolve19(address.port);
39846
+ if (address && typeof address === "object") resolve20(address.port);
39690
39847
  else reject3(new Error("ask_user server failed to bind"));
39691
39848
  });
39692
39849
  server.unref();
@@ -39873,6 +40030,34 @@ function createAskUserServer() {
39873
40030
  }
39874
40031
  return;
39875
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
+ }
39876
40061
  if (surface.platform && name === "publish_file") {
39877
40062
  if (!handlers.publishFile) {
39878
40063
  toolText("file publishing is unavailable for this runner", true);
@@ -40067,8 +40252,137 @@ function createAskUserServer() {
40067
40252
  };
40068
40253
  }
40069
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
+
40070
40384
  // src/runners/runner-env.ts
40071
- import { delimiter as delimiter2, isAbsolute as isAbsolute14 } from "node:path";
40385
+ import { delimiter as delimiter2, isAbsolute as isAbsolute15 } from "node:path";
40072
40386
  var PROVIDER_AUTHORITY_PREFIXES = ["GH_", "GITHUB_", "GIT_", "SSH_"];
40073
40387
  var HOST_AUTHORITY_PREFIXES = [
40074
40388
  "ZIXT_",
@@ -40127,7 +40441,7 @@ function inheritedValue(env, name) {
40127
40441
  }
40128
40442
  function sanitizeInheritedSearchPath(path) {
40129
40443
  if (!path) return "";
40130
- return path.split(delimiter2).filter((entry) => entry !== "" && isAbsolute14(entry)).join(delimiter2);
40444
+ return path.split(delimiter2).filter((entry) => entry !== "" && isAbsolute15(entry)).join(delimiter2);
40131
40445
  }
40132
40446
  function buildRunnerEnv(input) {
40133
40447
  const env = {};
@@ -40143,7 +40457,7 @@ function buildRunnerEnv(input) {
40143
40457
  }
40144
40458
  const searchPath = [
40145
40459
  sanitizeInheritedSearchPath(inheritedValue(input.inherited, "PATH")),
40146
- ...(input.softwareToolsPath ?? []).filter((entry) => isAbsolute14(entry))
40460
+ ...(input.softwareToolsPath ?? []).filter((entry) => isAbsolute15(entry))
40147
40461
  ].filter((entry) => entry !== "").join(delimiter2);
40148
40462
  const gitConfig = input.githubShell ? [
40149
40463
  ["credential.helper", ""],
@@ -40211,9 +40525,9 @@ function buildRunnerEnv(input) {
40211
40525
  // src/runners/github-shell-auth.ts
40212
40526
  import { execFile } from "node:child_process";
40213
40527
  import { randomBytes as randomBytes2, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
40214
- 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";
40215
40529
  import { createServer as createServer3 } from "node:http";
40216
- 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";
40217
40531
  var MAX_REQUEST_BYTES2 = 16 * 1024;
40218
40532
  var DIRECTORY_MODE4 = 448;
40219
40533
  var PRIVATE_FILE_MODE = 384;
@@ -40419,7 +40733,7 @@ function parseGhInvocation(body) {
40419
40733
  }
40420
40734
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
40421
40735
  const { args, cwd } = value;
40422
- 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)) {
40423
40737
  return null;
40424
40738
  }
40425
40739
  return { args, cwd };
@@ -40578,7 +40892,7 @@ function activationCredential(grant, now = Date.now()) {
40578
40892
  }
40579
40893
  function assertChildPath2(parent, child) {
40580
40894
  const path = relative9(parent, child);
40581
- if (!path || path === ".." || path.startsWith("../") || path.startsWith("..\\") || isAbsolute15(path)) {
40895
+ if (!path || path === ".." || path.startsWith("../") || path.startsWith("..\\") || isAbsolute16(path)) {
40582
40896
  throw new Error("GitHub shell helper path escaped its private run directory");
40583
40897
  }
40584
40898
  }
@@ -40589,7 +40903,7 @@ function quoteForPosixShell(value) {
40589
40903
  return quoteForGitShell2(value);
40590
40904
  }
40591
40905
  async function writePrivate(path, content, executable = false) {
40592
- await writeFile8(path, content, {
40906
+ await writeFile9(path, content, {
40593
40907
  flag: "wx",
40594
40908
  mode: executable ? EXECUTABLE_FILE_MODE : PRIVATE_FILE_MODE
40595
40909
  });
@@ -40601,7 +40915,7 @@ async function prepareHelpers(input) {
40601
40915
  throw new Error("GitHub shell authentication requires a private real run directory");
40602
40916
  }
40603
40917
  const runRoot = await realpath7(input.runRoot);
40604
- const helperPath = join18(runRoot, "github-shell-git-credential.cjs");
40918
+ const helperPath = join19(runRoot, "github-shell-git-credential.cjs");
40605
40919
  assertChildPath2(runRoot, helperPath);
40606
40920
  await writePrivate(helperPath, GIT_HELPER_SOURCE);
40607
40921
  if (!input.ghExecutablePath) {
@@ -40612,14 +40926,14 @@ async function prepareHelpers(input) {
40612
40926
  wrapperSourcePath: null
40613
40927
  };
40614
40928
  }
40615
- const shellToolsDirectory = join18(runRoot, "shell-tools");
40929
+ const shellToolsDirectory = join19(runRoot, "shell-tools");
40616
40930
  assertChildPath2(runRoot, shellToolsDirectory);
40617
- await mkdir12(shellToolsDirectory, { mode: DIRECTORY_MODE4 });
40931
+ await mkdir13(shellToolsDirectory, { mode: DIRECTORY_MODE4 });
40618
40932
  await chmod7(shellToolsDirectory, DIRECTORY_MODE4);
40619
- const wrapperSourcePath = join18(runRoot, "github-shell-gh-wrapper.cjs");
40933
+ const wrapperSourcePath = join19(runRoot, "github-shell-gh-wrapper.cjs");
40620
40934
  assertChildPath2(runRoot, wrapperSourcePath);
40621
40935
  await writePrivate(wrapperSourcePath, GH_WRAPPER_SOURCE);
40622
- const wrapperPath = join18(shellToolsDirectory, process.platform === "win32" ? "gh.cmd" : "gh");
40936
+ const wrapperPath = join19(shellToolsDirectory, process.platform === "win32" ? "gh.cmd" : "gh");
40623
40937
  assertChildPath2(runRoot, wrapperPath);
40624
40938
  const launcher = process.platform === "win32" ? `@"${process.execPath.replaceAll('"', '""')}" "${wrapperSourcePath.replaceAll('"', '""')}" %*\r
40625
40939
  ` : `#!/bin/sh
@@ -40843,7 +41157,7 @@ password=${credential.accessToken}
40843
41157
 
40844
41158
  // src/runners/working-context.ts
40845
41159
  import { spawn as spawn10 } from "node:child_process";
40846
- import { resolve as resolve9 } from "node:path";
41160
+ import { resolve as resolve10 } from "node:path";
40847
41161
  var COMMAND_TIMEOUT_MS = 5e3;
40848
41162
  var OUTPUT_LIMIT_BYTES = 128 * 1024;
40849
41163
  var COMMAND_STOP_TIMEOUT_MS = 2e4;
@@ -41238,8 +41552,8 @@ async function repositoryState(directory, git, env, signal) {
41238
41552
  const pathLines = paths.trim().split(/\r?\n/);
41239
41553
  if (pathLines.length < 3 || !pathLines[0] || !pathLines[1] || !pathLines[2]) return null;
41240
41554
  const root = pathLines[0];
41241
- const gitDirectory = resolve9(directory, pathLines[1]);
41242
- const commonDirectory = resolve9(directory, pathLines[2]);
41555
+ const gitDirectory = resolve10(directory, pathLines[1]);
41556
+ const commonDirectory = resolve10(directory, pathLines[2]);
41243
41557
  const records = status.split(/\0|\r?\n/).filter(Boolean);
41244
41558
  const rawBranch = statusField(records, "branch.head");
41245
41559
  if (!rawBranch || rawBranch.length > 512 || !isSafeSingleLineDisplayText(rawBranch)) return null;
@@ -41414,7 +41728,7 @@ async function settlesWithin(promise2, timeoutMs) {
41414
41728
  }
41415
41729
  }
41416
41730
  function defaultRunnerWorkspaceRoot() {
41417
- return join19(homedir7(), ".zixt", "workspaces");
41731
+ return join20(homedir7(), ".zixt", "workspaces");
41418
41732
  }
41419
41733
  function defaultRunnerArtifactRoot() {
41420
41734
  return defaultRunArtifactRoot();
@@ -41463,7 +41777,7 @@ function createCliRunner(adapter, opts = {}) {
41463
41777
  const prefixArgs = opts.commandPrefixArgs ?? [];
41464
41778
  const maxWallTimeMs = opts.maxWallTimeMs;
41465
41779
  const workspaceRoot = opts.workspaceRoot ?? defaultRunnerWorkspaceRoot();
41466
- 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"));
41467
41781
  const runRegistryRoot2 = opts.runRegistryRoot ?? defaultRunRegistryRoot();
41468
41782
  const createArtifacts = opts.createArtifacts ?? createRunArtifacts;
41469
41783
  const toolPackRegistry2 = opts.toolPackRegistry ?? createDefaultToolPackRegistry();
@@ -41481,7 +41795,7 @@ function createCliRunner(adapter, opts = {}) {
41481
41795
  };
41482
41796
  const askUserServer = createAskUserServer();
41483
41797
  const windowsRoot = process.env.SystemRoot ?? process.env.WINDIR;
41484
- 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;
41485
41799
  let safetyFailure;
41486
41800
  return async (task) => {
41487
41801
  if (safetyFailure) {
@@ -41521,8 +41835,8 @@ function createCliRunner(adapter, opts = {}) {
41521
41835
  usage: { inputTokens: 0, outputTokens: 0 }
41522
41836
  };
41523
41837
  }
41524
- const taskRoot = join19(workspaceRoot, task.agentId);
41525
- await mkdir13(taskRoot, { recursive: true });
41838
+ const taskRoot = join20(workspaceRoot, task.agentId);
41839
+ await mkdir14(taskRoot, { recursive: true });
41526
41840
  if (task.cancelledNow()) return cancelledBeforeRun();
41527
41841
  const configuredWorkspace = task.spec.workspace;
41528
41842
  let cwd = taskRoot;
@@ -41548,12 +41862,19 @@ function createCliRunner(adapter, opts = {}) {
41548
41862
  outcome.ok && outcome.result && typeof outcome.result === "object" ? outcome.result["artifact"] : void 0
41549
41863
  );
41550
41864
  if (parsed.success) {
41551
- const candidate = resolve10(cwd, path);
41865
+ const candidate = resolve11(cwd, path);
41552
41866
  const key = await realpath8(candidate).catch(() => candidate);
41553
41867
  publishedTaskFiles.set(key, parsed.data);
41554
41868
  }
41555
41869
  return outcome;
41556
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
+ });
41557
41878
  const [secrets, attachedConnections, providerGrants, integrationToolServers] = await Promise.all([
41558
41879
  task.secrets(),
41559
41880
  task.connections(),
@@ -41719,6 +42040,7 @@ function createCliRunner(adapter, opts = {}) {
41719
42040
  }
41720
42041
  },
41721
42042
  publishFile,
42043
+ companyAssets,
41722
42044
  // AG-4a. The person approves in the Task thread through the ordinary
41723
42045
  // approvals pipeline, so the wall clock pauses while they decide, and
41724
42046
  // a refusal is an answer the session can act on rather than a failure.
@@ -41907,7 +42229,7 @@ ${attachmentSection}` : prompt;
41907
42229
  let changed = false;
41908
42230
  for (const path of paths) {
41909
42231
  if (!path || path.length > 4096) continue;
41910
- const absolutePath = isAbsolute16(path) ? path : resolve10(cwd, path);
42232
+ const absolutePath = isAbsolute17(path) ? path : resolve11(cwd, path);
41911
42233
  const directory = dirname10(absolutePath);
41912
42234
  observedWorkingDirectories.delete(directory);
41913
42235
  observedWorkingDirectories.add(directory);
@@ -42344,7 +42666,7 @@ function runCliProcess(options) {
42344
42666
  usage: { inputTokens: 0, outputTokens: 0 }
42345
42667
  });
42346
42668
  }
42347
- return new Promise((resolve19) => {
42669
+ return new Promise((resolve20) => {
42348
42670
  const platform = options.platform ?? process.platform;
42349
42671
  const containmentGateNonce = options.guardian && platform === "win32" ? randomUUID12() : void 0;
42350
42672
  const child = options.guardian ? spawn11(
@@ -42406,7 +42728,7 @@ function runCliProcess(options) {
42406
42728
  clearInterval(timer);
42407
42729
  unregisterFollowUps?.();
42408
42730
  parser.stop?.();
42409
- resolve19(result);
42731
+ resolve20(result);
42410
42732
  };
42411
42733
  const terminate = (result) => {
42412
42734
  if (settled || forcedResult) return;
@@ -42640,7 +42962,7 @@ import { randomUUID as randomUUID13 } from "node:crypto";
42640
42962
  // src/runners/runtime-observation.ts
42641
42963
  import { open as open6, readdir as readdir6, realpath as realpath9 } from "node:fs/promises";
42642
42964
  import { homedir as homedir8 } from "node:os";
42643
- import { join as join20 } from "node:path";
42965
+ import { join as join21 } from "node:path";
42644
42966
  var READ_WINDOW_BYTES = 1024 * 1024;
42645
42967
  var CATALOG_TIMEOUT_MS = 15e3;
42646
42968
  var CATALOG_OUTPUT_LIMIT_BYTES = 4 * 1024 * 1024;
@@ -42700,9 +43022,9 @@ function displayValue(value, maxLength) {
42700
43022
  return trimmed;
42701
43023
  }
42702
43024
  function claudeTranscriptPath(input) {
42703
- 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");
42704
43026
  const slug = input.resolvedCwd.replace(/[^a-zA-Z0-9]/g, "-");
42705
- return join20(configDir, "projects", slug, `${input.sessionId}.jsonl`);
43027
+ return join21(configDir, "projects", slug, `${input.sessionId}.jsonl`);
42706
43028
  }
42707
43029
  async function readClaudeSessionEffort(input) {
42708
43030
  const resolvedCwd = await realpath9(input.cwd).catch(() => input.cwd);
@@ -42718,18 +43040,18 @@ async function readClaudeSessionEffort(input) {
42718
43040
  }
42719
43041
  async function newestDirectories(root, limit) {
42720
43042
  const entries = await readdir6(root, { withFileTypes: true }).catch(() => []);
42721
- 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));
42722
43044
  }
42723
43045
  async function findCodexRolloutPath(input) {
42724
- const codexHome = input.env["CODEX_HOME"] || join20(homeFrom(input.env), ".codex");
42725
- const sessions = join20(codexHome, "sessions");
43046
+ const codexHome = input.env["CODEX_HOME"] || join21(homeFrom(input.env), ".codex");
43047
+ const sessions = join21(codexHome, "sessions");
42726
43048
  const suffix = `-${input.threadId}.jsonl`;
42727
43049
  for (const year of await newestDirectories(sessions, 2)) {
42728
43050
  for (const month of await newestDirectories(year, 2)) {
42729
43051
  for (const day of await newestDirectories(month, 3)) {
42730
43052
  const files = await readdir6(day).catch(() => []);
42731
43053
  const match = files.find((name) => name.endsWith(suffix));
42732
- if (match) return join20(day, match);
43054
+ if (match) return join21(day, match);
42733
43055
  }
42734
43056
  }
42735
43057
  }
@@ -42752,7 +43074,7 @@ async function readCodexSessionRuntime(input) {
42752
43074
  }
42753
43075
  var codexCatalogCache = /* @__PURE__ */ new Map();
42754
43076
  async function loadCodexModelCatalog(command, prefixArgs, env) {
42755
- const output = await new Promise((resolve19) => {
43077
+ const output = await new Promise((resolve20) => {
42756
43078
  const child = spawnCli(command, [...prefixArgs, "debug", "models"], {
42757
43079
  stdio: ["ignore", "pipe", "ignore"],
42758
43080
  windowsHide: true,
@@ -42767,7 +43089,7 @@ async function loadCodexModelCatalog(command, prefixArgs, env) {
42767
43089
  if (settled) return;
42768
43090
  settled = true;
42769
43091
  clearTimeout(timer);
42770
- resolve19(value);
43092
+ resolve20(value);
42771
43093
  };
42772
43094
  const timer = setTimeout(() => {
42773
43095
  child.kill();
@@ -42872,8 +43194,8 @@ function createRuntimeReporter(input, sessionId) {
42872
43194
  var EFFORT_READ_ATTEMPTS = 5;
42873
43195
  var EFFORT_READ_INTERVAL_MS = 3e3;
42874
43196
  function delay2(ms) {
42875
- return new Promise((resolve19) => {
42876
- const timer = setTimeout(resolve19, ms);
43197
+ return new Promise((resolve20) => {
43198
+ const timer = setTimeout(resolve20, ms);
42877
43199
  timer.unref?.();
42878
43200
  });
42879
43201
  }
@@ -42960,10 +43282,10 @@ function createClaudeLiveParser(onStream, onSessionModel) {
42960
43282
  },
42961
43283
  async steer(followUp) {
42962
43284
  if (!write) return false;
42963
- return await new Promise((resolve19) => {
42964
- acknowledgements.set(followUp.inputId, resolve19);
43285
+ return await new Promise((resolve20) => {
43286
+ acknowledgements.set(followUp.inputId, resolve20);
42965
43287
  void write(input(followUp.inputId, followUp.text)).catch(() => {
42966
- if (acknowledgements.delete(followUp.inputId)) resolve19(false);
43288
+ if (acknowledgements.delete(followUp.inputId)) resolve20(false);
42967
43289
  });
42968
43290
  });
42969
43291
  },
@@ -43123,22 +43445,22 @@ function improveErrorMessage(error52) {
43123
43445
  }
43124
43446
 
43125
43447
  // src/runners/codex.ts
43126
- 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";
43127
43449
  import { randomUUID as randomUUID14 } from "node:crypto";
43128
43450
  import { homedir as homedir9 } from "node:os";
43129
- import { join as join21 } from "node:path";
43451
+ import { join as join22 } from "node:path";
43130
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.";
43131
43453
  function defaultCodexThreadIndexRoot() {
43132
- return join21(homedir9(), ".zixt", "codex-threads");
43454
+ return join22(homedir9(), ".zixt", "codex-threads");
43133
43455
  }
43134
43456
  var SAFE_SEGMENT3 = /^[A-Za-z0-9_-]{1,200}$/;
43135
43457
  function threadIndexPath(root, agentId, sessionKey) {
43136
43458
  if (!SAFE_SEGMENT3.test(agentId) || !SAFE_SEGMENT3.test(sessionKey)) return null;
43137
- return join21(root, agentId, `${sessionKey}.json`);
43459
+ return join22(root, agentId, `${sessionKey}.json`);
43138
43460
  }
43139
43461
  async function readThreadId(path) {
43140
43462
  try {
43141
- const parsed = JSON.parse(await readFile11(path, "utf8"));
43463
+ const parsed = JSON.parse(await readFile12(path, "utf8"));
43142
43464
  return typeof parsed.threadId === "string" && /^[A-Za-z0-9-]{1,120}$/.test(parsed.threadId) ? parsed.threadId : null;
43143
43465
  } catch {
43144
43466
  return null;
@@ -43238,7 +43560,7 @@ ${value}` : value;
43238
43560
  const recordedThreadId = indexPath ? await readThreadId(indexPath) : null;
43239
43561
  const rememberThread = (threadId) => {
43240
43562
  if (!indexPath) return;
43241
- 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(() => {
43242
43564
  });
43243
43565
  };
43244
43566
  const observeRuntime = (threadId) => {
@@ -43279,8 +43601,8 @@ ${value}` : value;
43279
43601
  var RUNTIME_READ_ATTEMPTS = 5;
43280
43602
  var RUNTIME_READ_INTERVAL_MS = 2e3;
43281
43603
  function delay3(ms) {
43282
- return new Promise((resolve19) => {
43283
- const timer = setTimeout(resolve19, ms);
43604
+ return new Promise((resolve20) => {
43605
+ const timer = setTimeout(resolve20, ms);
43284
43606
  timer.unref?.();
43285
43607
  });
43286
43608
  }
@@ -43319,7 +43641,7 @@ function createCodexAppServerParser(onStream, options) {
43319
43641
  const turnReadyWaiters = /* @__PURE__ */ new Set();
43320
43642
  const usage = () => ({ inputTokens, outputTokens });
43321
43643
  const settleTurnReadiness = (ready) => {
43322
- for (const resolve19 of turnReadyWaiters) resolve19(ready);
43644
+ for (const resolve20 of turnReadyWaiters) resolve20(ready);
43323
43645
  turnReadyWaiters.clear();
43324
43646
  };
43325
43647
  const send = async (message) => {
@@ -43500,12 +43822,12 @@ function createCodexAppServerParser(onStream, options) {
43500
43822
  async steer(input) {
43501
43823
  if (stopped) return false;
43502
43824
  if (!activeTurnId) {
43503
- const ready = await new Promise((resolve19) => turnReadyWaiters.add(resolve19));
43825
+ const ready = await new Promise((resolve20) => turnReadyWaiters.add(resolve20));
43504
43826
  if (!ready || stopped) return false;
43505
43827
  }
43506
43828
  if (!threadId || !activeTurnId) return false;
43507
- return await new Promise((resolve19) => {
43508
- steerWaiters.set(input.inputId, resolve19);
43829
+ return await new Promise((resolve20) => {
43830
+ steerWaiters.set(input.inputId, resolve20);
43509
43831
  void send({
43510
43832
  id: `steer:${input.inputId}`,
43511
43833
  method: "turn/steer",
@@ -43516,7 +43838,7 @@ function createCodexAppServerParser(onStream, options) {
43516
43838
  clientUserMessageId: input.inputId
43517
43839
  }
43518
43840
  }).catch(() => {
43519
- if (steerWaiters.delete(input.inputId)) resolve19(false);
43841
+ if (steerWaiters.delete(input.inputId)) resolve20(false);
43520
43842
  });
43521
43843
  });
43522
43844
  },
@@ -43524,7 +43846,7 @@ function createCodexAppServerParser(onStream, options) {
43524
43846
  stopped = true;
43525
43847
  write = null;
43526
43848
  settleTurnReadiness(false);
43527
- for (const resolve19 of steerWaiters.values()) resolve19(false);
43849
+ for (const resolve20 of steerWaiters.values()) resolve20(false);
43528
43850
  steerWaiters.clear();
43529
43851
  },
43530
43852
  push(chunk) {
@@ -43703,7 +44025,7 @@ function improveCodexErrorMessage(error52) {
43703
44025
  // src/runners/git-preflight.ts
43704
44026
  import { spawn as spawn12 } from "node:child_process";
43705
44027
  import { realpath as realpath10 } from "node:fs/promises";
43706
- import { isAbsolute as isAbsolute17, resolve as resolve11 } from "node:path";
44028
+ import { isAbsolute as isAbsolute18, resolve as resolve12 } from "node:path";
43707
44029
  var OUTPUT_LIMIT = 8192;
43708
44030
  var DEFAULT_TIMEOUT_MS4 = 1e4;
43709
44031
  var VERSION_PATTERN = /^git version [^\r\n]{1,108}$/;
@@ -43719,10 +44041,10 @@ function unavailable(error52, checkedAt, executablePath = null) {
43719
44041
  async function preflightGit(options = {}) {
43720
44042
  const checkedAt = (options.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
43721
44043
  const configured = options.command;
43722
- if (configured !== void 0 && !isAbsolute17(configured)) {
44044
+ if (configured !== void 0 && !isAbsolute18(configured)) {
43723
44045
  return unavailable("configured git command must be an absolute file", checkedAt);
43724
44046
  }
43725
- const trustedCwd = await realpath10(resolve11(options.trustedCwd ?? process.cwd())).catch(() => null);
44047
+ const trustedCwd = await realpath10(resolve12(options.trustedCwd ?? process.cwd())).catch(() => null);
43726
44048
  if (!trustedCwd)
43727
44049
  return unavailable("Host-owned git preflight directory is unavailable", checkedAt);
43728
44050
  const executablePath = await resolveTrustedCliCommand(configured ?? "git", {
@@ -43944,7 +44266,7 @@ function parseAuth(result) {
43944
44266
  return "unknown";
43945
44267
  }
43946
44268
  function run2(command, args) {
43947
- return new Promise((resolve19) => {
44269
+ return new Promise((resolve20) => {
43948
44270
  const child = spawnCli(command, args, {
43949
44271
  stdio: ["ignore", "pipe", "pipe"],
43950
44272
  windowsHide: true
@@ -43960,7 +44282,7 @@ function run2(command, args) {
43960
44282
  if (settled) return;
43961
44283
  settled = true;
43962
44284
  clearTimeout(timeout);
43963
- resolve19(result);
44285
+ resolve20(result);
43964
44286
  };
43965
44287
  const timeout = setTimeout(() => {
43966
44288
  child.kill();
@@ -43974,32 +44296,32 @@ function run2(command, args) {
43974
44296
  // src/linux-service.ts
43975
44297
  import { spawn as spawn13 } from "node:child_process";
43976
44298
  import { constants as constants2 } from "node:fs";
43977
- 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";
43978
44300
  import { homedir as homedir11, userInfo } from "node:os";
43979
- 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";
43980
44302
 
43981
44303
  // src/service-runtime.ts
43982
- 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";
43983
44305
  import { homedir as homedir10 } from "node:os";
43984
- 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";
43985
44307
  async function ensureDurableServiceNode(options = {}) {
43986
- const execPath = resolve12(options.execPath ?? process.execPath);
44308
+ const execPath = resolve13(options.execPath ?? process.execPath);
43987
44309
  const home = options.home ?? homedir10();
43988
44310
  const platform = options.platform ?? process.platform;
43989
44311
  const version2 = options.nodeVersion ?? process.version;
43990
44312
  if (!/^v?[0-9A-Za-z.-]+$/.test(version2)) {
43991
44313
  throw new Error("the Node runtime version is not a safe directory name");
43992
44314
  }
43993
- const zixtRoot = resolve12(home, ".zixt");
43994
- if (execPath === zixtRoot || execPath.startsWith(zixtRoot + sep6)) return execPath;
43995
- const directory = join22(zixtRoot, "runtime", `node-${version2}`);
43996
- 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");
43997
44319
  const alreadyCopied = await access4(destination).then(
43998
44320
  () => true,
43999
44321
  () => false
44000
44322
  );
44001
44323
  if (alreadyCopied) return destination;
44002
- await mkdir15(directory, { recursive: true, mode: 448 });
44324
+ await mkdir16(directory, { recursive: true, mode: 448 });
44003
44325
  const temporary = `${destination}.${process.pid}.${crypto.randomUUID()}.tmp`;
44004
44326
  try {
44005
44327
  await copyFile(execPath, temporary);
@@ -44041,7 +44363,7 @@ function boundedAppend(current, chunk) {
44041
44363
  }
44042
44364
  async function defaultRunCommand(command, args) {
44043
44365
  const commandEnvironment3 = systemServiceCommandEnvironment();
44044
- return new Promise((resolve19) => {
44366
+ return new Promise((resolve20) => {
44045
44367
  const child = spawn13(command, [...args], {
44046
44368
  stdio: ["ignore", "pipe", "pipe"],
44047
44369
  env: commandEnvironment3,
@@ -44055,7 +44377,7 @@ async function defaultRunCommand(command, args) {
44055
44377
  if (settled) return;
44056
44378
  settled = true;
44057
44379
  if (timer) clearTimeout(timer);
44058
- resolve19(result);
44380
+ resolve20(result);
44059
44381
  };
44060
44382
  child.stdout?.on("data", (chunk) => {
44061
44383
  stdout = boundedAppend(stdout, chunk);
@@ -44114,22 +44436,22 @@ async function defaultSyncDirectory(path) {
44114
44436
  }
44115
44437
  }
44116
44438
  async function ensureDirectory(path, mode, syncDirectory8) {
44117
- const firstCreated = await mkdir16(path, { recursive: true, mode });
44439
+ const firstCreated = await mkdir17(path, { recursive: true, mode });
44118
44440
  if (!firstCreated) return;
44119
- const first = resolve13(firstCreated);
44120
- const target = resolve13(path);
44441
+ const first = resolve14(firstCreated);
44442
+ const target = resolve14(path);
44121
44443
  await syncDirectory8(dirname11(first));
44122
44444
  let current = first;
44123
44445
  const descendants = relative10(first, target);
44124
- for (const part of descendants ? descendants.split(sep7) : []) {
44446
+ for (const part of descendants ? descendants.split(sep8) : []) {
44125
44447
  await syncDirectory8(current);
44126
- current = join23(current, part);
44448
+ current = join24(current, part);
44127
44449
  }
44128
44450
  }
44129
44451
  async function replacePrivateFile(path, contents, mode, syncDirectory8) {
44130
44452
  const parent = dirname11(path);
44131
44453
  await ensureDirectory(parent, 448, syncDirectory8);
44132
- const temporary = join23(parent, `.${basename4(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44454
+ const temporary = join24(parent, `.${basename4(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44133
44455
  const handle = await open7(temporary, "wx", mode);
44134
44456
  try {
44135
44457
  await handle.writeFile(contents, "utf8");
@@ -44181,17 +44503,17 @@ async function installLinuxService(options) {
44181
44503
  "command search path"
44182
44504
  );
44183
44505
  const cloudUrl = options.cloudUrl ? oneLine(options.cloudUrl, "Zixt Cloud address") : void 0;
44184
- const xdgConfigHome = env.XDG_CONFIG_HOME ? oneLine(env.XDG_CONFIG_HOME, "Linux configuration path") : join23(home, ".config");
44185
- const configRoot = options.serviceConfigRoot ?? join23(xdgConfigHome, "zixt");
44186
- const unitRoot = options.userUnitRoot ?? join23(xdgConfigHome, "systemd", "user");
44187
- const environmentPath = join23(configRoot, "host.env");
44188
- 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);
44189
44511
  const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
44190
44512
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : activateInstalledRelease);
44191
44513
  const resolveCommand = options.resolveCommand ?? defaultResolveCommand;
44192
44514
  const run3 = options.runCommand ?? defaultRunCommand;
44193
44515
  const syncDirectory8 = options.syncDirectory ?? defaultSyncDirectory;
44194
- const stabilityDelay = options.delay ?? ((ms) => new Promise((resolve19) => setTimeout(resolve19, ms)));
44516
+ const stabilityDelay = options.delay ?? ((ms) => new Promise((resolve20) => setTimeout(resolve20, ms)));
44195
44517
  const [systemctl, loginctl] = await Promise.all([
44196
44518
  resolveCommand("systemctl"),
44197
44519
  resolveCommand("loginctl")
@@ -44315,9 +44637,9 @@ async function installLinuxService(options) {
44315
44637
  // src/macos-service.ts
44316
44638
  import { spawn as spawn14 } from "node:child_process";
44317
44639
  import { constants as constants3 } from "node:fs";
44318
- 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";
44319
44641
  import { homedir as homedir12, userInfo as userInfo2 } from "node:os";
44320
- 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";
44321
44643
  var LAUNCH_AGENT_LABEL = "ai.zixt.host";
44322
44644
  var SERVICE_STABILITY_DELAY_MS2 = 2e3;
44323
44645
  var STATUS_WAIT_MS = 2e4;
@@ -44342,21 +44664,21 @@ async function syncDirectory4(path) {
44342
44664
  }
44343
44665
  }
44344
44666
  async function ensureDirectory2(path, sync) {
44345
- const firstCreated = await mkdir17(path, { recursive: true, mode: 448 });
44667
+ const firstCreated = await mkdir18(path, { recursive: true, mode: 448 });
44346
44668
  if (!firstCreated) return;
44347
- const first = resolve14(firstCreated);
44348
- const target = resolve14(path);
44669
+ const first = resolve15(firstCreated);
44670
+ const target = resolve15(path);
44349
44671
  await sync(dirname12(first));
44350
44672
  let current = first;
44351
- for (const part of relative11(first, target).split(sep8).filter(Boolean)) {
44673
+ for (const part of relative11(first, target).split(sep9).filter(Boolean)) {
44352
44674
  await sync(current);
44353
- current = join24(current, part);
44675
+ current = join25(current, part);
44354
44676
  }
44355
44677
  }
44356
44678
  async function replacePrivateFile2(path, contents, mode, sync) {
44357
44679
  const parent = dirname12(path);
44358
44680
  await ensureDirectory2(parent, sync);
44359
- const temporary = join24(parent, `.${basename5(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44681
+ const temporary = join25(parent, `.${basename5(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44360
44682
  const handle = await open8(temporary, "wx", mode);
44361
44683
  try {
44362
44684
  await handle.writeFile(contents, "utf8");
@@ -44453,14 +44775,14 @@ async function installMacosService(options) {
44453
44775
  options.path ?? env.PATH ?? "/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin",
44454
44776
  "command search path"
44455
44777
  );
44456
- const configRoot = options.configRoot ?? join24(home, "Library", "Application Support", "Zixt");
44457
- const launchAgentsRoot = options.launchAgentsRoot ?? join24(home, "Library", "LaunchAgents");
44458
- const logRoot = options.logRoot ?? join24(home, "Library", "Logs", "Zixt");
44459
- const configPath = join24(configRoot, "host.env");
44460
- const launcherPath = join24(configRoot, "host-launcher.sh");
44461
- const plistPath = join24(launchAgentsRoot, `${LAUNCH_AGENT_LABEL}.plist`);
44462
- const stdoutPath = join24(logRoot, "host.log");
44463
- 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");
44464
44786
  const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
44465
44787
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : (entry) => activateInstalledRelease(entry));
44466
44788
  const resolveCommand = options.resolveCommand ?? (async () => defaultResolveCommand2());
@@ -44563,9 +44885,9 @@ async function installMacosService(options) {
44563
44885
  // src/windows-service.ts
44564
44886
  import { spawn as spawn15 } from "node:child_process";
44565
44887
  import { constants as constants4 } from "node:fs";
44566
- 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";
44567
44889
  import { homedir as homedir13 } from "node:os";
44568
- 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";
44569
44891
  var TASK_NAME = "Zixt Host";
44570
44892
  var COMMAND_TIMEOUT_MS3 = 7e4;
44571
44893
  var SERVICE_STABILITY_DELAY_MS3 = 2e3;
@@ -44591,21 +44913,21 @@ async function syncDirectory5(path) {
44591
44913
  }
44592
44914
  }
44593
44915
  async function ensureDirectory3(path, sync) {
44594
- const firstCreated = await mkdir18(path, { recursive: true, mode: 448 });
44916
+ const firstCreated = await mkdir19(path, { recursive: true, mode: 448 });
44595
44917
  if (!firstCreated) return;
44596
- const first = resolve15(firstCreated);
44597
- const target = resolve15(path);
44918
+ const first = resolve16(firstCreated);
44919
+ const target = resolve16(path);
44598
44920
  await sync(dirname13(first));
44599
44921
  let current = first;
44600
- for (const part of relative12(first, target).split(sep9).filter(Boolean)) {
44922
+ for (const part of relative12(first, target).split(sep10).filter(Boolean)) {
44601
44923
  await sync(current);
44602
- current = join25(current, part);
44924
+ current = join26(current, part);
44603
44925
  }
44604
44926
  }
44605
44927
  async function replacePrivateFile3(path, contents, sync, encoding = "utf8") {
44606
44928
  const parent = dirname13(path);
44607
44929
  await ensureDirectory3(parent, sync);
44608
- const temporary = join25(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44930
+ const temporary = join26(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
44609
44931
  const handle = await open9(temporary, "wx", 384);
44610
44932
  try {
44611
44933
  await handle.writeFile(encoding === "utf16le" ? `\uFEFF${contents}` : contents, encoding);
@@ -44659,8 +44981,8 @@ async function runChild(command, args, env, input) {
44659
44981
  }
44660
44982
  async function defaultResolveCommand3(name, env) {
44661
44983
  const root = env.SYSTEMROOT ?? env.WINDIR;
44662
- if (!root || !isAbsolute18(root)) return null;
44663
- 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`);
44664
44986
  return access7(candidate, constants4.X_OK).then(
44665
44987
  () => candidate,
44666
44988
  () => null
@@ -44750,7 +45072,7 @@ exit $code
44750
45072
  }
44751
45073
  async function defaultObserveStatus(path, generation) {
44752
45074
  try {
44753
- const text = (await readFile12(path, "utf8")).replace(/^\uFEFF/, "");
45075
+ const text = (await readFile13(path, "utf8")).replace(/^\uFEFF/, "");
44754
45076
  const value = JSON.parse(text);
44755
45077
  if (value.schema !== 1 || value.generation !== generation || typeof value.pid !== "number" || !Number.isSafeInteger(value.pid) || value.pid <= 0) {
44756
45078
  return null;
@@ -44805,18 +45127,18 @@ async function installWindowsService(options) {
44805
45127
  const env = options.env ?? process.env;
44806
45128
  const home = options.home ?? homedir13();
44807
45129
  const localAppData = options.localAppData ?? env.LOCALAPPDATA;
44808
- if (!localAppData || !isAbsolute18(localAppData)) {
45130
+ if (!localAppData || !isAbsolute19(localAppData)) {
44809
45131
  throw new Error("Windows local application data path is unavailable.");
44810
45132
  }
44811
45133
  const token2 = oneLine3(options.token, "pairing code");
44812
45134
  const cloudUrl = options.cloudUrl ? oneLine3(options.cloudUrl, "Zixt Cloud address") : void 0;
44813
45135
  const path = oneLine3(options.path ?? env.PATH ?? "", "command search path");
44814
- const configRoot = options.configRoot ?? join25(localAppData, "Zixt", "Host");
44815
- const configPath = join25(configRoot, "host.json");
44816
- const launcherPath = join25(configRoot, "host-launcher.ps1");
44817
- const launchShimPath = join25(configRoot, "host-launch.vbs");
44818
- const taskXmlPath = join25(configRoot, "host-task.xml");
44819
- 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");
44820
45142
  const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
44821
45143
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : (entry) => activateInstalledRelease(entry));
44822
45144
  const resolveCommand = options.resolveCommand ?? ((name) => defaultResolveCommand3(name, env));
@@ -44943,23 +45265,23 @@ async function installSystemService(options) {
44943
45265
  }
44944
45266
 
44945
45267
  // src/terminal-outcomes.ts
44946
- 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";
44947
45269
  import { homedir as homedir14 } from "node:os";
44948
- 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";
44949
45271
  var DIRECTORY_MODE5 = 448;
44950
45272
  var FILE_MODE4 = 384;
44951
45273
  var MAX_OUTCOME_BYTES = 4 * 1024 * 1024;
44952
45274
  var HOST_DIRECTORY = /^hst_[0-9a-f]{32}$/;
44953
45275
  var OUTCOME_FILE = /^(tsk_[0-9a-f]{32})\.([1-9][0-9]*)\.json$/;
44954
45276
  function defaultTerminalOutcomeRoot() {
44955
- return join26(homedir14(), ".zixt", "terminal-outcomes");
45277
+ return join27(homedir14(), ".zixt", "terminal-outcomes");
44956
45278
  }
44957
45279
  function hostOutcomeRoot(root, hostId) {
44958
45280
  if (!HOST_DIRECTORY.test(hostId)) throw new Error("terminal outcome Host identity is malformed");
44959
- return join26(root, hostId);
45281
+ return join27(root, hostId);
44960
45282
  }
44961
45283
  function outcomePath(root, hostId, taskId, epoch) {
44962
- return join26(hostOutcomeRoot(root, hostId), `${taskId}.${epoch}.json`);
45284
+ return join27(hostOutcomeRoot(root, hostId), `${taskId}.${epoch}.json`);
44963
45285
  }
44964
45286
  async function syncDirectory6(root) {
44965
45287
  if (process.platform === "win32") return;
@@ -44971,15 +45293,15 @@ async function syncDirectory6(root) {
44971
45293
  }
44972
45294
  }
44973
45295
  async function requirePrivateRoot(root, sync = syncDirectory6) {
44974
- const firstCreated = await mkdir19(root, { recursive: true, mode: DIRECTORY_MODE5 });
45296
+ const firstCreated = await mkdir20(root, { recursive: true, mode: DIRECTORY_MODE5 });
44975
45297
  if (firstCreated) {
44976
- const first = resolve16(firstCreated);
44977
- const target = resolve16(root);
45298
+ const first = resolve17(firstCreated);
45299
+ const target = resolve17(root);
44978
45300
  await sync(dirname14(first));
44979
45301
  let current = first;
44980
- for (const part of relative13(first, target).split(sep10).filter(Boolean)) {
45302
+ for (const part of relative13(first, target).split(sep11).filter(Boolean)) {
44981
45303
  await sync(current);
44982
- current = join26(current, part);
45304
+ current = join27(current, part);
44983
45305
  }
44984
45306
  }
44985
45307
  const stat4 = await lstat12(root);
@@ -45010,7 +45332,7 @@ async function recordTerminalOutcome(hostId, input, root = defaultTerminalOutcom
45010
45332
  const destination = outcomePath(root, hostId, outcome.taskId, outcome.epoch);
45011
45333
  try {
45012
45334
  const existing = parseCommittedOutcome(
45013
- await readFile13(destination, { encoding: "utf8", flag: "r" }),
45335
+ await readFile14(destination, { encoding: "utf8", flag: "r" }),
45014
45336
  outcome.taskId,
45015
45337
  outcome.epoch
45016
45338
  );
@@ -45019,7 +45341,7 @@ async function recordTerminalOutcome(hostId, input, root = defaultTerminalOutcom
45019
45341
  } catch (error52) {
45020
45342
  if (error52.code !== "ENOENT") throw error52;
45021
45343
  }
45022
- const temporary = join26(
45344
+ const temporary = join27(
45023
45345
  scopedRoot,
45024
45346
  `.${outcome.taskId}.${outcome.epoch}.${process.pid}.${Date.now()}.${outcome.resultId}.tmp`
45025
45347
  );
@@ -45072,13 +45394,13 @@ async function readTerminalOutcomesStrict(root = defaultTerminalOutcomeRoot()) {
45072
45394
  if (!match || !entry.isFile() || entry.isSymbolicLink()) {
45073
45395
  throw new Error("committed terminal outcome is not a trusted regular file");
45074
45396
  }
45075
- const path = join26(scopedRoot, entry.name);
45397
+ const path = join27(scopedRoot, entry.name);
45076
45398
  const stat4 = await lstat12(path);
45077
45399
  if (!stat4.isFile() || stat4.isSymbolicLink() || stat4.size > MAX_OUTCOME_BYTES) {
45078
45400
  throw new Error("committed terminal outcome is not a trusted regular file");
45079
45401
  }
45080
45402
  const outcome = parseCommittedOutcome(
45081
- await readFile13(path, "utf8"),
45403
+ await readFile14(path, "utf8"),
45082
45404
  match[1],
45083
45405
  Number(match[2])
45084
45406
  );
@@ -45124,15 +45446,15 @@ async function forgetSupersededTerminalOutcomes(hostId, taskId, epoch, root = de
45124
45446
  }
45125
45447
 
45126
45448
  // src/accepted-assignments.ts
45127
- 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";
45128
45450
  import { homedir as homedir15 } from "node:os";
45129
- 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";
45130
45452
  var DIRECTORY_MODE6 = 448;
45131
45453
  var FILE_MODE5 = 384;
45132
45454
  var CLAIM_FILE = /^(tsk_[0-9a-f]{32})\.([1-9][0-9]*)\.json$/;
45133
45455
  var TASK_ID = /^tsk_[0-9a-f]{32}$/;
45134
45456
  function defaultAcceptedAssignmentRoot() {
45135
- return join27(homedir15(), ".zixt", "accepted-assignments");
45457
+ return join28(homedir15(), ".zixt", "accepted-assignments");
45136
45458
  }
45137
45459
  async function syncDirectory7(root) {
45138
45460
  if (process.platform === "win32") return;
@@ -45144,15 +45466,15 @@ async function syncDirectory7(root) {
45144
45466
  }
45145
45467
  }
45146
45468
  async function requirePrivateRoot2(root, sync = syncDirectory7) {
45147
- const firstCreated = await mkdir20(root, { recursive: true, mode: DIRECTORY_MODE6 });
45469
+ const firstCreated = await mkdir21(root, { recursive: true, mode: DIRECTORY_MODE6 });
45148
45470
  if (firstCreated) {
45149
- const first = resolve17(firstCreated);
45150
- const target = resolve17(root);
45471
+ const first = resolve18(firstCreated);
45472
+ const target = resolve18(root);
45151
45473
  await sync(dirname15(first));
45152
45474
  let current = first;
45153
- for (const part of relative14(first, target).split(sep11).filter(Boolean)) {
45475
+ for (const part of relative14(first, target).split(sep12).filter(Boolean)) {
45154
45476
  await sync(current);
45155
- current = join27(current, part);
45477
+ current = join28(current, part);
45156
45478
  }
45157
45479
  }
45158
45480
  const stat4 = await lstat13(root);
@@ -45166,7 +45488,7 @@ function claimPath(root, taskId, epoch) {
45166
45488
  if (!Number.isSafeInteger(epoch) || epoch < 1) {
45167
45489
  throw new Error("accepted assignment epoch is malformed");
45168
45490
  }
45169
- return join27(root, `${taskId}.${epoch}.json`);
45491
+ return join28(root, `${taskId}.${epoch}.json`);
45170
45492
  }
45171
45493
  async function recordAcceptedAssignment(assignment, root = defaultAcceptedAssignmentRoot(), options = {}) {
45172
45494
  const sync = options.syncDirectory ?? syncDirectory7;
@@ -45176,7 +45498,7 @@ async function recordAcceptedAssignment(assignment, root = defaultAcceptedAssign
45176
45498
  } catch {
45177
45499
  return false;
45178
45500
  }
45179
- const temporary = join27(
45501
+ const temporary = join28(
45180
45502
  root,
45181
45503
  `.${assignment.taskId}.${assignment.epoch}.${process.pid}.${Date.now()}.tmp`
45182
45504
  );
@@ -45238,9 +45560,9 @@ async function forgetAcknowledgedAcceptedAssignments(assignments, root = default
45238
45560
  }
45239
45561
 
45240
45562
  // src/local-observability.ts
45241
- 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";
45242
45564
  import { homedir as homedir16 } from "node:os";
45243
- 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";
45244
45566
 
45245
45567
  // src/logger.ts
45246
45568
  var ANSI = {
@@ -45352,11 +45674,11 @@ var LOCAL_STATUS_FILE = "status.json";
45352
45674
  var LOCAL_REQUESTS_DIR = "requests";
45353
45675
  var DEFAULT_CONSOLE_ROTATE_BYTES = 2 * 1024 * 1024;
45354
45676
  function defaultLocalObservabilityRoot() {
45355
- return join28(homedir16(), ".zixt", "observability");
45677
+ return join29(homedir16(), ".zixt", "observability");
45356
45678
  }
45357
45679
  function createLocalConsoleSink(options = {}) {
45358
45680
  const root = options.root ?? defaultLocalObservabilityRoot();
45359
- const consolePath = join28(root, LOCAL_CONSOLE_FILE);
45681
+ const consolePath = join29(root, LOCAL_CONSOLE_FILE);
45360
45682
  const rotateBytes = options.rotateBytes ?? DEFAULT_CONSOLE_ROTATE_BYTES;
45361
45683
  let disabled = false;
45362
45684
  let prepared = false;
@@ -45366,7 +45688,7 @@ function createLocalConsoleSink(options = {}) {
45366
45688
  if (disabled) return;
45367
45689
  try {
45368
45690
  if (!prepared) {
45369
- await mkdir21(root, { recursive: true, mode: 448 });
45691
+ await mkdir22(root, { recursive: true, mode: 448 });
45370
45692
  approximateBytes = await stat3(consolePath).then(
45371
45693
  (existing) => existing.size,
45372
45694
  () => 0
@@ -45374,8 +45696,8 @@ function createLocalConsoleSink(options = {}) {
45374
45696
  prepared = true;
45375
45697
  }
45376
45698
  if (approximateBytes >= rotateBytes) {
45377
- await rm17(join28(root, LOCAL_CONSOLE_PREVIOUS_FILE), { force: true });
45378
- 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(
45379
45701
  (error52) => {
45380
45702
  if (error52.code !== "ENOENT") throw error52;
45381
45703
  }
@@ -45406,7 +45728,7 @@ function createLocalConsoleSink(options = {}) {
45406
45728
  };
45407
45729
  }
45408
45730
  async function consumeRunnerInstallRequests(root = defaultLocalObservabilityRoot()) {
45409
- const directory = join28(root, LOCAL_REQUESTS_DIR);
45731
+ const directory = join29(root, LOCAL_REQUESTS_DIR);
45410
45732
  const requested = /* @__PURE__ */ new Set();
45411
45733
  let names;
45412
45734
  try {
@@ -45418,7 +45740,7 @@ async function consumeRunnerInstallRequests(root = defaultLocalObservabilityRoot
45418
45740
  const name = `install-runner-${type}.json`;
45419
45741
  if (!names.includes(name)) continue;
45420
45742
  try {
45421
- await rm17(join28(directory, name), { force: true });
45743
+ await rm17(join29(directory, name), { force: true });
45422
45744
  requested.add(type);
45423
45745
  } catch {
45424
45746
  }
@@ -45426,13 +45748,13 @@ async function consumeRunnerInstallRequests(root = defaultLocalObservabilityRoot
45426
45748
  return requested;
45427
45749
  }
45428
45750
  async function writeLocalStatus(status, root = defaultLocalObservabilityRoot()) {
45429
- const destination = join28(root, LOCAL_STATUS_FILE);
45430
- const temporary = join28(
45751
+ const destination = join29(root, LOCAL_STATUS_FILE);
45752
+ const temporary = join29(
45431
45753
  dirname16(destination),
45432
45754
  `.${basename7(destination)}.${process.pid}.${crypto.randomUUID()}.tmp`
45433
45755
  );
45434
45756
  try {
45435
- await mkdir21(root, { recursive: true, mode: 448 });
45757
+ await mkdir22(root, { recursive: true, mode: 448 });
45436
45758
  const handle = await open12(temporary, "wx", 384);
45437
45759
  try {
45438
45760
  await handle.writeFile(`${JSON.stringify(status)}
@@ -45447,24 +45769,24 @@ async function writeLocalStatus(status, root = defaultLocalObservabilityRoot())
45447
45769
  }
45448
45770
 
45449
45771
  // src/demo-state.ts
45450
- 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";
45451
45773
  var DEMO_STATE_ROOT_ENV = "ZIXT_DEMO_STATE_ROOT";
45452
45774
  function resolveDemoHostStatePaths(env = process.env) {
45453
45775
  const configured = env.ZIXT_RUNNER === "demo" ? env[DEMO_STATE_ROOT_ENV] : void 0;
45454
45776
  if (!configured) return null;
45455
- const root = resolve18(configured);
45456
- if (!isAbsolute19(configured) || root === parse3(root).root) {
45777
+ const root = resolve19(configured);
45778
+ if (!isAbsolute20(configured) || root === parse3(root).root) {
45457
45779
  throw new Error(`${DEMO_STATE_ROOT_ENV} must be a dedicated absolute directory`);
45458
45780
  }
45459
45781
  return {
45460
- runRegistryRoot: join29(root, "run-registry"),
45461
- terminalOutcomeRoot: join29(root, "terminal-outcomes"),
45462
- acceptedAssignmentRoot: join29(root, "accepted-assignments"),
45463
- runArtifactRoot: join29(root, "run-artifacts"),
45464
- browserProfileRoot: join29(root, "browser-profiles"),
45465
- runnerWorkspaceRoot: join29(root, "workspaces"),
45466
- codexThreadIndexRoot: join29(root, "codex-threads"),
45467
- 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")
45468
45790
  };
45469
45791
  }
45470
45792