@zixt/host 0.0.20 → 0.0.22

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 +15 -9
  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.20",
34
+ version: "0.0.22",
35
35
  type: "module",
36
36
  exports: {
37
37
  ".": "./src/client.ts",
@@ -15831,7 +15831,10 @@ var Task = external_exports.object({
15831
15831
  /** Assignment epoch — bumped every time the task is (re)assigned (PRD §7.4). */
15832
15832
  epoch: external_exports.number().int().min(0),
15833
15833
  hostId: HostId.nullable(),
15834
- /** TS-16: the exact Machine this Task was asked to run on; null lets the dispatcher pick. */
15834
+ /**
15835
+ * TS-16: the Task's durable Machine affinity. Null lets the dispatcher pick
15836
+ * its first Machine; assignment then records that choice for later runs.
15837
+ */
15835
15838
  requestedHostId: HostId.nullable().default(null),
15836
15839
  /** TS-16: per-Task runner/model/effort selection; null runs the teammate's configuration. */
15837
15840
  runner: TaskRunnerSelection.nullable().default(null),
@@ -15975,7 +15978,9 @@ var CreateTaskInput = external_exports.object({
15975
15978
  /** Explicit producer opt-in to the independent TS-14 review workflow. */
15976
15979
  reviewMode: TaskReviewMode.optional(),
15977
15980
  /**
15978
- * Run on this exact Machine (TS-16). Absent means the dispatcher picks.
15981
+ * Run on this exact Machine (TS-16). Absent means the dispatcher picks
15982
+ * the first Machine; the Task then stays there unless a person explicitly
15983
+ * chooses interrupted-work recovery on another Machine.
15979
15984
  * A teammate never runs on two Machines at once (AG-6a), so live work on
15980
15985
  * another Machine truthfully queues this Task rather than overriding it.
15981
15986
  */
@@ -16993,7 +16998,7 @@ var GithubOperationGrant = external_exports.discriminatedUnion("operation", [
16993
16998
  provider: external_exports.literal("github"),
16994
16999
  operation: external_exports.literal("repository.clone_created"),
16995
17000
  accessToken: external_exports.string().min(1).max(1e4),
16996
- expiresAt: IsoDate,
17001
+ expiresAt: IsoDate.nullable(),
16997
17002
  installationId: GithubNumericId,
16998
17003
  repositoryId: GithubNumericId,
16999
17004
  repository: GithubRepositoryGrant,
@@ -17008,7 +17013,7 @@ var GithubOperationGrant = external_exports.discriminatedUnion("operation", [
17008
17013
  provider: external_exports.literal("github"),
17009
17014
  operation: external_exports.literal("repository.activate"),
17010
17015
  accessToken: external_exports.string().min(1).max(1e4),
17011
- expiresAt: IsoDate,
17016
+ expiresAt: IsoDate.nullable(),
17012
17017
  installationId: GithubNumericId,
17013
17018
  repositoryId: GithubNumericId,
17014
17019
  repository: GithubRepositoryGrant,
@@ -20296,7 +20301,7 @@ var HostClient = class _HostClient {
20296
20301
  }
20297
20302
  const { grant } = frame;
20298
20303
  const repositoryMatches = waiter.request.operation === "repository.create" ? grant.operation === "repository.create" : waiter.request.operation === "repository.clone_created" ? grant.operation === "repository.clone_created" && grant.repositoryId === waiter.request.repositoryId : grant.operation === "repository.activate" && (waiter.request.repositoryId !== void 0 ? grant.repositoryId === waiter.request.repositoryId : grant.repository.fullName === waiter.request.fullName);
20299
- if (grant.provider !== waiter.request.provider || grant.operation !== waiter.request.operation || grant.installationId !== waiter.installationId || !repositoryMatches || Date.parse(grant.expiresAt) <= Date.now()) {
20304
+ if (grant.provider !== waiter.request.provider || grant.operation !== waiter.request.operation || grant.installationId !== waiter.installationId || !repositoryMatches || grant.expiresAt !== null && Date.parse(grant.expiresAt) <= Date.now()) {
20300
20305
  return;
20301
20306
  }
20302
20307
  clearTimeout(waiter.timer);
@@ -27458,7 +27463,7 @@ function parseArgs(raw) {
27458
27463
  }
27459
27464
  function validateOperationGrant(value, input) {
27460
27465
  const parsed = GithubOperationGrant.parse(value);
27461
- if (parsed.operation !== input.operation || parsed.installationId !== input.installationId || Date.parse(parsed.expiresAt) <= input.now.getTime()) {
27466
+ if (parsed.operation !== input.operation || parsed.installationId !== input.installationId || parsed.expiresAt !== null && Date.parse(parsed.expiresAt) <= input.now.getTime()) {
27462
27467
  throw new GithubInputError("GitHub operation grant does not match this task");
27463
27468
  }
27464
27469
  if (input.operation === "repository.clone_created" && (parsed.operation !== "repository.clone_created" || parsed.repositoryId !== input.repositoryId)) {
@@ -29541,7 +29546,7 @@ function createGithubToolPackFactory(options = {}) {
29541
29546
  stage = "checking the repository credentials Zixt returned";
29542
29547
  if (operationGrant.operation !== "repository.activate" || operationGrant.installationId !== grant.installationId || operationGrant.operations.some(
29543
29548
  (operation) => !locallySupportedOperations.has(operation)
29544
- ) || Date.parse(operationGrant.expiresAt) <= now().getTime() || selector.repositoryId !== void 0 && operationGrant.repositoryId !== selector.repositoryId || selector.fullName !== void 0 && operationGrant.repository.fullName !== selector.fullName) {
29549
+ ) || operationGrant.expiresAt !== null && Date.parse(operationGrant.expiresAt) <= now().getTime() || selector.repositoryId !== void 0 && operationGrant.repositoryId !== selector.repositoryId || selector.fullName !== void 0 && operationGrant.repository.fullName !== selector.fullName) {
29545
29550
  return { ok: false, error: "GitHub returned invalid repository authority." };
29546
29551
  }
29547
29552
  const [owner] = operationGrant.repository.fullName.split("/");
@@ -32061,6 +32066,7 @@ function credentialFromTaskGrant(grant, allowed) {
32061
32066
  return { accessToken: grant.accessToken, expiresAt };
32062
32067
  }
32063
32068
  function activationCredential(grant, now = Date.now()) {
32069
+ if (grant.expiresAt === null) return { accessToken: grant.accessToken, expiresAt: null };
32064
32070
  const expiresAt = new Date(grant.expiresAt);
32065
32071
  return expiresAt.getTime() <= now ? null : { accessToken: grant.accessToken, expiresAt };
32066
32072
  }
@@ -32165,7 +32171,7 @@ async function createGithubShellAuth(input) {
32165
32171
  const refreshes = /* @__PURE__ */ new Map();
32166
32172
  const liveOperationActivation = (repositoryId2) => {
32167
32173
  const candidates = (input.operationGrants?.() ?? []).filter(
32168
- (grant) => grant.operation === "repository.activate" && grant.installationId === input.initialGrant.installationId && grant.repositoryId === repositoryId2 && Date.parse(grant.expiresAt) > now()
32174
+ (grant) => grant.operation === "repository.activate" && grant.installationId === input.initialGrant.installationId && grant.repositoryId === repositoryId2 && (grant.expiresAt === null || Date.parse(grant.expiresAt) > now())
32169
32175
  );
32170
32176
  return candidates.at(-1) ?? null;
32171
32177
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zixt/host",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/client.ts",