@zixt/host 0.0.31 → 0.0.33

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 +44 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ import { homedir } from "node:os";
31
31
  // package.json
32
32
  var package_default = {
33
33
  name: "@zixt/host",
34
- version: "0.0.31",
34
+ version: "0.0.33",
35
35
  type: "module",
36
36
  exports: {
37
37
  ".": "./src/client.ts",
@@ -15899,6 +15899,10 @@ var TaskGitSummary = external_exports.object({
15899
15899
  repositories: external_exports.array(
15900
15900
  external_exports.object({
15901
15901
  githubRepository: external_exports.string().regex(/^[A-Za-z0-9_.-]{1,100}\/[A-Za-z0-9_.-]{1,100}$/).optional(),
15902
+ /** True only when this repository was an isolated Git worktree. */
15903
+ isWorktree: external_exports.boolean().optional(),
15904
+ /** False means the Task used this repository, then removed its checkout after integration. */
15905
+ available: external_exports.boolean().optional(),
15902
15906
  branch: taskGitSummaryLabel(512, "branch").nullable(),
15903
15907
  ahead: external_exports.number().int().min(0),
15904
15908
  behind: external_exports.number().int().min(0),
@@ -16134,6 +16138,8 @@ var TaskWorkingContextBase = external_exports.object({
16134
16138
  root: SafeDisplayPath,
16135
16139
  /** True when this checkout has a separate Git worktree directory. */
16136
16140
  isWorktree: external_exports.boolean(),
16141
+ /** Absent is legacy-current; false preserves a cleaned-up Task repository as history. */
16142
+ available: external_exports.boolean().optional(),
16137
16143
  /** Null is an observed detached HEAD, never an unknown branch. */
16138
16144
  branch: safeWorkingContextLabel(512, "branch").nullable(),
16139
16145
  headSha: external_exports.string().regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/).nullable(),
@@ -17774,7 +17780,7 @@ var HostRemovalImpact = external_exports.object({
17774
17780
  runningTasks: ImpactedTasks,
17775
17781
  /** Queued Tasks pinned to it. These move to automatic placement. */
17776
17782
  queuedPinnedTasks: ImpactedTasks,
17777
- /** Automations pinned to it. These need an explicit decision. */
17783
+ /** Automations pinned to it. These move to automatic placement. */
17778
17784
  pinnedAutomations: external_exports.object({
17779
17785
  count: external_exports.number().int().min(0),
17780
17786
  samples: external_exports.array(
@@ -17798,13 +17804,13 @@ var HostRemovalImpact = external_exports.object({
17798
17804
  * its website sessions, and any local work never pushed anywhere.
17799
17805
  */
17800
17806
  unrecoverableLosses: external_exports.array(external_exports.string().min(1).max(500)),
17801
- /** True when pinned Automations exist and `DELETE` therefore needs a decision. */
17807
+ /** Deprecated compatibility field; always false because Auto is the default. */
17802
17808
  requiresAutomationDecision: external_exports.boolean(),
17803
17809
  evaluatedAt: IsoDate2
17804
17810
  });
17805
17811
  var PinnedAutomationResolution = external_exports.enum(["move_to_auto", "pause"]);
17806
17812
  var RevokeHostRequest = external_exports.object({
17807
- /** Required when the impact reports pinned Automations. */
17813
+ /** Optional compatibility override; omission moves them to Auto. */
17808
17814
  pinnedAutomations: PinnedAutomationResolution.optional(),
17809
17815
  /**
17810
17816
  * Idempotency key for the whole resolution. A retried removal after a lost
@@ -18102,7 +18108,9 @@ var AttentionItemType = external_exports.enum([
18102
18108
  "task_failure",
18103
18109
  "dependency",
18104
18110
  /** An Automation paused itself and cannot resume without a person's decision. */
18105
- "automation_paused"
18111
+ "automation_paused",
18112
+ /** An Automation was kept running but its Machine preference changed. */
18113
+ "automation_moved"
18106
18114
  ]);
18107
18115
  var AttentionCategory = external_exports.enum([
18108
18116
  "answer_question",
@@ -32762,11 +32770,16 @@ function parsePullRequest(output, expectedBaseRepository, expectedHeadRepository
32762
32770
  return void 0;
32763
32771
  }
32764
32772
  }
32765
- async function pullRequest(command, gitCommand, cwd, repository, branch, signal) {
32773
+ async function pullRequest(command, gitCommand, repositoryCwd, commandCwd, repository, branch, signal) {
32766
32774
  if (!command || !repository || !branch) return void 0;
32767
32775
  const headOwner = repository.split("/")[0];
32768
32776
  const selector = `${headOwner}:${branch}`;
32769
- const baseRepositories = await pullRequestBaseRepositories(gitCommand, cwd, repository, signal);
32777
+ const baseRepositories = await pullRequestBaseRepositories(
32778
+ gitCommand,
32779
+ repositoryCwd,
32780
+ repository,
32781
+ signal
32782
+ );
32770
32783
  for (const baseRepository of baseRepositories) {
32771
32784
  const output = await run(
32772
32785
  command.executablePath,
@@ -32780,7 +32793,7 @@ async function pullRequest(command, gitCommand, cwd, repository, branch, signal)
32780
32793
  "--json",
32781
32794
  "number,title,url,state,isDraft,baseRefName,headRefName,headRepository,headRepositoryOwner"
32782
32795
  ],
32783
- cwd,
32796
+ commandCwd,
32784
32797
  command.env,
32785
32798
  signal
32786
32799
  );
@@ -32842,6 +32855,7 @@ async function repositoryState(directory, git, env, signal) {
32842
32855
  return {
32843
32856
  root,
32844
32857
  isWorktree: gitDirectory !== commonDirectory,
32858
+ available: true,
32845
32859
  branch,
32846
32860
  headSha,
32847
32861
  upstream,
@@ -32878,6 +32892,19 @@ async function collectWorkingContext(input) {
32878
32892
  ...uniqueRepositories.length > 0 ? { repositories: uniqueRepositories } : {}
32879
32893
  });
32880
32894
  }
32895
+ function preserveObservedRepositories(current, previous, fixedRepositoryRoots) {
32896
+ const fixed = new Set(fixedRepositoryRoots);
32897
+ const currentRepositories = current.repositories ?? [];
32898
+ const currentRoots = new Set(currentRepositories.map(({ root }) => root));
32899
+ const liveTaskRepositories = currentRepositories.filter(({ root }) => !fixed.has(root));
32900
+ const liveFixedRepositories = currentRepositories.filter(({ root }) => fixed.has(root));
32901
+ const retained = (previous?.repositories ?? []).filter(({ root }) => !fixed.has(root) && !currentRoots.has(root)).map((repository) => ({ ...repository, available: false }));
32902
+ const repositories = [...liveTaskRepositories, ...retained, ...liveFixedRepositories];
32903
+ return TaskWorkingContextObservation.parse({
32904
+ ...current,
32905
+ ...repositories.length > 0 ? { repositories } : { repositories: void 0 }
32906
+ });
32907
+ }
32881
32908
  var WorkingContextPullRequestCache = class {
32882
32909
  constructor(ttlMs = PULL_REQUEST_CACHE_TTL_MS, now = Date.now, maxEntries = PULL_REQUEST_CACHE_MAX_ENTRIES) {
32883
32910
  this.ttlMs = ttlMs;
@@ -32902,6 +32929,7 @@ var WorkingContextPullRequestCache = class {
32902
32929
  command,
32903
32930
  options.gitCommand,
32904
32931
  repository.root,
32932
+ options.commandCwd ?? repository.root,
32905
32933
  repository.githubRepository,
32906
32934
  repository.branch,
32907
32935
  options.signal
@@ -33915,6 +33943,7 @@ function createCliRunner(adapter, opts = {}) {
33915
33943
  ${attachmentSection}` : prompt;
33916
33944
  let activeWorkingContextReport = null;
33917
33945
  let previousWorkingContext = "";
33946
+ let previousWorkingContextValue = null;
33918
33947
  const observedWorkingDirectories = /* @__PURE__ */ new Set();
33919
33948
  let observedPathRefreshPending = false;
33920
33949
  const workingContextAbort = new AbortController();
@@ -33933,12 +33962,19 @@ ${attachmentSection}` : prompt;
33933
33962
  env: workingContextEnvironments.git,
33934
33963
  signal: workingContextAbort.signal
33935
33964
  }).then(
33965
+ (context) => preserveObservedRepositories(context, previousWorkingContextValue, [
33966
+ cwd,
33967
+ ...preparedWorkspace ? [preparedWorkspace.path] : []
33968
+ ])
33969
+ ).then(
33936
33970
  (context) => pullRequests.enrich(context, ghContextCommand, {
33937
33971
  ...options.forcePullRequest ? { force: true } : {},
33938
33972
  ...gitContextCommand ? { gitCommand: gitContextCommand } : {},
33973
+ commandCwd: cwd,
33939
33974
  signal: workingContextAbort.signal
33940
33975
  })
33941
33976
  ).then((context) => {
33977
+ previousWorkingContextValue = context;
33942
33978
  const serialized = JSON.stringify(context);
33943
33979
  if (!options.forceReport && serialized === previousWorkingContext || task.cancelledNow() || workingContextAbort.signal.aborted) {
33944
33980
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zixt/host",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/client.ts",