@h-rig/runtime 0.0.6-alpha.3 → 0.0.6-alpha.4

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.
@@ -3848,8 +3848,8 @@ function githubStatusFor(issue) {
3848
3848
  return "open";
3849
3849
  }
3850
3850
  function selectedGitHubEnv() {
3851
- const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() ?? "";
3852
- return { GH_TOKEN: token, GITHUB_TOKEN: token };
3851
+ const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() || process.env.RIG_GITHUB_TOKEN?.trim() || "";
3852
+ return { GH_TOKEN: token, GITHUB_TOKEN: token, RIG_GITHUB_TOKEN: token };
3853
3853
  }
3854
3854
  function ghSpawnOptions() {
3855
3855
  return { encoding: "utf-8", env: { ...process.env, ...selectedGitHubEnv() } };
@@ -6154,20 +6154,23 @@ function hashProjectPath(workspaceDir) {
6154
6154
  }
6155
6155
  function resolveGithubCliBinaryPath() {
6156
6156
  const explicit = process.env.RIG_GH_BIN?.trim();
6157
- if (explicit && existsSync24(explicit)) {
6157
+ if (explicit && existsSync24(explicit) && !isRuntimeGatewayGhPath(explicit)) {
6158
6158
  return explicit;
6159
6159
  }
6160
- const bunResolved = Bun.which("gh");
6161
- if (bunResolved && existsSync24(bunResolved)) {
6162
- return bunResolved;
6163
- }
6164
- for (const candidate of ["/opt/homebrew/bin/gh", "/usr/local/bin/gh", "/usr/bin/gh"]) {
6160
+ for (const candidate of ["/usr/bin/gh", "/opt/homebrew/bin/gh", "/usr/local/bin/gh"]) {
6165
6161
  if (existsSync24(candidate)) {
6166
6162
  return candidate;
6167
6163
  }
6168
6164
  }
6165
+ const bunResolved = Bun.which("gh");
6166
+ if (bunResolved && existsSync24(bunResolved) && !isRuntimeGatewayGhPath(bunResolved)) {
6167
+ return bunResolved;
6168
+ }
6169
6169
  return "";
6170
6170
  }
6171
+ function isRuntimeGatewayGhPath(candidate) {
6172
+ return /\/\.rig\/bin\/gh$/.test(candidate.replace(/\\/g, "/"));
6173
+ }
6171
6174
  async function resolveGithubCliAuthToken(ghBinary = "") {
6172
6175
  const gh = ghBinary || resolveGithubCliBinaryPath();
6173
6176
  if (!gh) {
@@ -6268,6 +6271,8 @@ async function runtimeEnv(projectRoot, runtime) {
6268
6271
  XDG_CACHE_HOME: runtime.cacheDir,
6269
6272
  XDG_STATE_HOME: runtime.stateDir,
6270
6273
  RIG_AGENT_ID: runtime.id,
6274
+ ...process.env.RIG_RUN_ID?.trim() ? { RIG_RUN_ID: process.env.RIG_RUN_ID.trim() } : {},
6275
+ ...process.env.RIG_SERVER_RUN_ID?.trim() ? { RIG_SERVER_RUN_ID: process.env.RIG_SERVER_RUN_ID.trim() } : {},
6271
6276
  RIG_TASK_ID: runtime.taskId,
6272
6277
  RIG_TASK_RUNTIME_ID: runtime.id,
6273
6278
  RIG_TASK_WORKSPACE: runtime.workspaceDir,
@@ -8111,7 +8116,11 @@ async function ensureAgentRuntime(options) {
8111
8116
  mkdirSync18(runtime.binDir, { recursive: true });
8112
8117
  mkdirSync18(workspaceLayout.distDir, { recursive: true });
8113
8118
  prepareRuntimeWorkspace(options.projectRoot, workspaceDir);
8114
- await resetEphemeralTaskArtifacts(workspaceDir, options.taskId);
8119
+ if (options.preserveTaskArtifacts) {
8120
+ console.log(`[rig-agent] Preserving runtime task artifacts for resume of ${options.taskId}.`);
8121
+ } else {
8122
+ await resetEphemeralTaskArtifacts(workspaceDir, options.taskId);
8123
+ }
8115
8124
  const ctx = {
8116
8125
  runtimeId: options.id,
8117
8126
  taskId: options.taskId,
@@ -686,20 +686,23 @@ function hashProjectPath(workspaceDir) {
686
686
  }
687
687
  function resolveGithubCliBinaryPath() {
688
688
  const explicit = process.env.RIG_GH_BIN?.trim();
689
- if (explicit && existsSync5(explicit)) {
689
+ if (explicit && existsSync5(explicit) && !isRuntimeGatewayGhPath(explicit)) {
690
690
  return explicit;
691
691
  }
692
- const bunResolved = Bun.which("gh");
693
- if (bunResolved && existsSync5(bunResolved)) {
694
- return bunResolved;
695
- }
696
- for (const candidate of ["/opt/homebrew/bin/gh", "/usr/local/bin/gh", "/usr/bin/gh"]) {
692
+ for (const candidate of ["/usr/bin/gh", "/opt/homebrew/bin/gh", "/usr/local/bin/gh"]) {
697
693
  if (existsSync5(candidate)) {
698
694
  return candidate;
699
695
  }
700
696
  }
697
+ const bunResolved = Bun.which("gh");
698
+ if (bunResolved && existsSync5(bunResolved) && !isRuntimeGatewayGhPath(bunResolved)) {
699
+ return bunResolved;
700
+ }
701
701
  return "";
702
702
  }
703
+ function isRuntimeGatewayGhPath(candidate) {
704
+ return /\/\.rig\/bin\/gh$/.test(candidate.replace(/\\/g, "/"));
705
+ }
703
706
  async function resolveGithubCliAuthToken(ghBinary = "") {
704
707
  const gh = ghBinary || resolveGithubCliBinaryPath();
705
708
  if (!gh) {
@@ -800,6 +803,8 @@ async function runtimeEnv(projectRoot, runtime) {
800
803
  XDG_CACHE_HOME: runtime.cacheDir,
801
804
  XDG_STATE_HOME: runtime.stateDir,
802
805
  RIG_AGENT_ID: runtime.id,
806
+ ...process.env.RIG_RUN_ID?.trim() ? { RIG_RUN_ID: process.env.RIG_RUN_ID.trim() } : {},
807
+ ...process.env.RIG_SERVER_RUN_ID?.trim() ? { RIG_SERVER_RUN_ID: process.env.RIG_SERVER_RUN_ID.trim() } : {},
803
808
  RIG_TASK_ID: runtime.taskId,
804
809
  RIG_TASK_RUNTIME_ID: runtime.id,
805
810
  RIG_TASK_WORKSPACE: runtime.workspaceDir,
@@ -3148,8 +3148,8 @@ function githubStatusFor(issue) {
3148
3148
  return "open";
3149
3149
  }
3150
3150
  function selectedGitHubEnv() {
3151
- const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() ?? "";
3152
- return { GH_TOKEN: token, GITHUB_TOKEN: token };
3151
+ const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() || process.env.RIG_GITHUB_TOKEN?.trim() || "";
3152
+ return { GH_TOKEN: token, GITHUB_TOKEN: token, RIG_GITHUB_TOKEN: token };
3153
3153
  }
3154
3154
  function ghSpawnOptions() {
3155
3155
  return { encoding: "utf-8", env: { ...process.env, ...selectedGitHubEnv() } };
@@ -5454,20 +5454,23 @@ function hashProjectPath(workspaceDir) {
5454
5454
  }
5455
5455
  function resolveGithubCliBinaryPath() {
5456
5456
  const explicit = process.env.RIG_GH_BIN?.trim();
5457
- if (explicit && existsSync23(explicit)) {
5457
+ if (explicit && existsSync23(explicit) && !isRuntimeGatewayGhPath(explicit)) {
5458
5458
  return explicit;
5459
5459
  }
5460
- const bunResolved = Bun.which("gh");
5461
- if (bunResolved && existsSync23(bunResolved)) {
5462
- return bunResolved;
5463
- }
5464
- for (const candidate of ["/opt/homebrew/bin/gh", "/usr/local/bin/gh", "/usr/bin/gh"]) {
5460
+ for (const candidate of ["/usr/bin/gh", "/opt/homebrew/bin/gh", "/usr/local/bin/gh"]) {
5465
5461
  if (existsSync23(candidate)) {
5466
5462
  return candidate;
5467
5463
  }
5468
5464
  }
5465
+ const bunResolved = Bun.which("gh");
5466
+ if (bunResolved && existsSync23(bunResolved) && !isRuntimeGatewayGhPath(bunResolved)) {
5467
+ return bunResolved;
5468
+ }
5469
5469
  return "";
5470
5470
  }
5471
+ function isRuntimeGatewayGhPath(candidate) {
5472
+ return /\/\.rig\/bin\/gh$/.test(candidate.replace(/\\/g, "/"));
5473
+ }
5471
5474
  async function resolveGithubCliAuthToken(ghBinary = "") {
5472
5475
  const gh = ghBinary || resolveGithubCliBinaryPath();
5473
5476
  if (!gh) {
@@ -5568,6 +5571,8 @@ async function runtimeEnv(projectRoot, runtime) {
5568
5571
  XDG_CACHE_HOME: runtime.cacheDir,
5569
5572
  XDG_STATE_HOME: runtime.stateDir,
5570
5573
  RIG_AGENT_ID: runtime.id,
5574
+ ...process.env.RIG_RUN_ID?.trim() ? { RIG_RUN_ID: process.env.RIG_RUN_ID.trim() } : {},
5575
+ ...process.env.RIG_SERVER_RUN_ID?.trim() ? { RIG_SERVER_RUN_ID: process.env.RIG_SERVER_RUN_ID.trim() } : {},
5571
5576
  RIG_TASK_ID: runtime.taskId,
5572
5577
  RIG_TASK_RUNTIME_ID: runtime.id,
5573
5578
  RIG_TASK_WORKSPACE: runtime.workspaceDir,
@@ -8080,7 +8085,11 @@ async function ensureAgentRuntime(options) {
8080
8085
  mkdirSync18(runtime.binDir, { recursive: true });
8081
8086
  mkdirSync18(workspaceLayout.distDir, { recursive: true });
8082
8087
  prepareRuntimeWorkspace(options.projectRoot, workspaceDir);
8083
- await resetEphemeralTaskArtifacts(workspaceDir, options.taskId);
8088
+ if (options.preserveTaskArtifacts) {
8089
+ console.log(`[rig-agent] Preserving runtime task artifacts for resume of ${options.taskId}.`);
8090
+ } else {
8091
+ await resetEphemeralTaskArtifacts(workspaceDir, options.taskId);
8092
+ }
8084
8093
  const ctx = {
8085
8094
  runtimeId: options.id,
8086
8095
  taskId: options.taskId,
@@ -2091,20 +2091,23 @@ function taskRuntimeId(taskId) {
2091
2091
  }
2092
2092
  function resolveGithubCliBinaryPath() {
2093
2093
  const explicit = process.env.RIG_GH_BIN?.trim();
2094
- if (explicit && existsSync8(explicit)) {
2094
+ if (explicit && existsSync8(explicit) && !isRuntimeGatewayGhPath(explicit)) {
2095
2095
  return explicit;
2096
2096
  }
2097
- const bunResolved = Bun.which("gh");
2098
- if (bunResolved && existsSync8(bunResolved)) {
2099
- return bunResolved;
2100
- }
2101
- for (const candidate of ["/opt/homebrew/bin/gh", "/usr/local/bin/gh", "/usr/bin/gh"]) {
2097
+ for (const candidate of ["/usr/bin/gh", "/opt/homebrew/bin/gh", "/usr/local/bin/gh"]) {
2102
2098
  if (existsSync8(candidate)) {
2103
2099
  return candidate;
2104
2100
  }
2105
2101
  }
2102
+ const bunResolved = Bun.which("gh");
2103
+ if (bunResolved && existsSync8(bunResolved) && !isRuntimeGatewayGhPath(bunResolved)) {
2104
+ return bunResolved;
2105
+ }
2106
2106
  return "";
2107
2107
  }
2108
+ function isRuntimeGatewayGhPath(candidate) {
2109
+ return /\/\.rig\/bin\/gh$/.test(candidate.replace(/\\/g, "/"));
2110
+ }
2108
2111
  async function resolveGithubCliAuthToken(ghBinary = "") {
2109
2112
  const gh = ghBinary || resolveGithubCliBinaryPath();
2110
2113
  if (!gh) {
@@ -2198,6 +2201,8 @@ async function runtimeEnv(projectRoot, runtime) {
2198
2201
  XDG_CACHE_HOME: runtime.cacheDir,
2199
2202
  XDG_STATE_HOME: runtime.stateDir,
2200
2203
  RIG_AGENT_ID: runtime.id,
2204
+ ...process.env.RIG_RUN_ID?.trim() ? { RIG_RUN_ID: process.env.RIG_RUN_ID.trim() } : {},
2205
+ ...process.env.RIG_SERVER_RUN_ID?.trim() ? { RIG_SERVER_RUN_ID: process.env.RIG_SERVER_RUN_ID.trim() } : {},
2201
2206
  RIG_TASK_ID: runtime.taskId,
2202
2207
  RIG_TASK_RUNTIME_ID: runtime.id,
2203
2208
  RIG_TASK_WORKSPACE: runtime.workspaceDir,
@@ -417,20 +417,23 @@ function hashProjectPath(workspaceDir) {
417
417
  }
418
418
  function resolveGithubCliBinaryPath() {
419
419
  const explicit = process.env.RIG_GH_BIN?.trim();
420
- if (explicit && existsSync3(explicit)) {
420
+ if (explicit && existsSync3(explicit) && !isRuntimeGatewayGhPath(explicit)) {
421
421
  return explicit;
422
422
  }
423
- const bunResolved = Bun.which("gh");
424
- if (bunResolved && existsSync3(bunResolved)) {
425
- return bunResolved;
426
- }
427
- for (const candidate of ["/opt/homebrew/bin/gh", "/usr/local/bin/gh", "/usr/bin/gh"]) {
423
+ for (const candidate of ["/usr/bin/gh", "/opt/homebrew/bin/gh", "/usr/local/bin/gh"]) {
428
424
  if (existsSync3(candidate)) {
429
425
  return candidate;
430
426
  }
431
427
  }
428
+ const bunResolved = Bun.which("gh");
429
+ if (bunResolved && existsSync3(bunResolved) && !isRuntimeGatewayGhPath(bunResolved)) {
430
+ return bunResolved;
431
+ }
432
432
  return "";
433
433
  }
434
+ function isRuntimeGatewayGhPath(candidate) {
435
+ return /\/\.rig\/bin\/gh$/.test(candidate.replace(/\\/g, "/"));
436
+ }
434
437
  async function resolveGithubCliAuthToken(ghBinary = "") {
435
438
  const gh = ghBinary || resolveGithubCliBinaryPath();
436
439
  if (!gh) {
@@ -3148,8 +3148,8 @@ function githubStatusFor(issue) {
3148
3148
  return "open";
3149
3149
  }
3150
3150
  function selectedGitHubEnv() {
3151
- const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() ?? "";
3152
- return { GH_TOKEN: token, GITHUB_TOKEN: token };
3151
+ const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() || process.env.RIG_GITHUB_TOKEN?.trim() || "";
3152
+ return { GH_TOKEN: token, GITHUB_TOKEN: token, RIG_GITHUB_TOKEN: token };
3153
3153
  }
3154
3154
  function ghSpawnOptions() {
3155
3155
  return { encoding: "utf-8", env: { ...process.env, ...selectedGitHubEnv() } };
@@ -5454,20 +5454,23 @@ function hashProjectPath(workspaceDir) {
5454
5454
  }
5455
5455
  function resolveGithubCliBinaryPath() {
5456
5456
  const explicit = process.env.RIG_GH_BIN?.trim();
5457
- if (explicit && existsSync23(explicit)) {
5457
+ if (explicit && existsSync23(explicit) && !isRuntimeGatewayGhPath(explicit)) {
5458
5458
  return explicit;
5459
5459
  }
5460
- const bunResolved = Bun.which("gh");
5461
- if (bunResolved && existsSync23(bunResolved)) {
5462
- return bunResolved;
5463
- }
5464
- for (const candidate of ["/opt/homebrew/bin/gh", "/usr/local/bin/gh", "/usr/bin/gh"]) {
5460
+ for (const candidate of ["/usr/bin/gh", "/opt/homebrew/bin/gh", "/usr/local/bin/gh"]) {
5465
5461
  if (existsSync23(candidate)) {
5466
5462
  return candidate;
5467
5463
  }
5468
5464
  }
5465
+ const bunResolved = Bun.which("gh");
5466
+ if (bunResolved && existsSync23(bunResolved) && !isRuntimeGatewayGhPath(bunResolved)) {
5467
+ return bunResolved;
5468
+ }
5469
5469
  return "";
5470
5470
  }
5471
+ function isRuntimeGatewayGhPath(candidate) {
5472
+ return /\/\.rig\/bin\/gh$/.test(candidate.replace(/\\/g, "/"));
5473
+ }
5471
5474
  async function resolveGithubCliAuthToken(ghBinary = "") {
5472
5475
  const gh = ghBinary || resolveGithubCliBinaryPath();
5473
5476
  if (!gh) {
@@ -5568,6 +5571,8 @@ async function runtimeEnv(projectRoot, runtime) {
5568
5571
  XDG_CACHE_HOME: runtime.cacheDir,
5569
5572
  XDG_STATE_HOME: runtime.stateDir,
5570
5573
  RIG_AGENT_ID: runtime.id,
5574
+ ...process.env.RIG_RUN_ID?.trim() ? { RIG_RUN_ID: process.env.RIG_RUN_ID.trim() } : {},
5575
+ ...process.env.RIG_SERVER_RUN_ID?.trim() ? { RIG_SERVER_RUN_ID: process.env.RIG_SERVER_RUN_ID.trim() } : {},
5571
5576
  RIG_TASK_ID: runtime.taskId,
5572
5577
  RIG_TASK_RUNTIME_ID: runtime.id,
5573
5578
  RIG_TASK_WORKSPACE: runtime.workspaceDir,
@@ -8080,7 +8085,11 @@ async function ensureAgentRuntime(options) {
8080
8085
  mkdirSync18(runtime.binDir, { recursive: true });
8081
8086
  mkdirSync18(workspaceLayout.distDir, { recursive: true });
8082
8087
  prepareRuntimeWorkspace(options.projectRoot, workspaceDir);
8083
- await resetEphemeralTaskArtifacts(workspaceDir, options.taskId);
8088
+ if (options.preserveTaskArtifacts) {
8089
+ console.log(`[rig-agent] Preserving runtime task artifacts for resume of ${options.taskId}.`);
8090
+ } else {
8091
+ await resetEphemeralTaskArtifacts(workspaceDir, options.taskId);
8092
+ }
8084
8093
  const ctx = {
8085
8094
  runtimeId: options.id,
8086
8095
  taskId: options.taskId,
@@ -4560,8 +4560,8 @@ function githubStatusFor(issue) {
4560
4560
  return "open";
4561
4561
  }
4562
4562
  function selectedGitHubEnv() {
4563
- const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() ?? "";
4564
- return { GH_TOKEN: token, GITHUB_TOKEN: token };
4563
+ const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() || process.env.RIG_GITHUB_TOKEN?.trim() || "";
4564
+ return { GH_TOKEN: token, GITHUB_TOKEN: token, RIG_GITHUB_TOKEN: token };
4565
4565
  }
4566
4566
  function ghSpawnOptions() {
4567
4567
  return { encoding: "utf-8", env: { ...process.env, ...selectedGitHubEnv() } };
@@ -6178,20 +6178,23 @@ function hashProjectPath(workspaceDir) {
6178
6178
  }
6179
6179
  function resolveGithubCliBinaryPath() {
6180
6180
  const explicit = process.env.RIG_GH_BIN?.trim();
6181
- if (explicit && existsSync24(explicit)) {
6181
+ if (explicit && existsSync24(explicit) && !isRuntimeGatewayGhPath(explicit)) {
6182
6182
  return explicit;
6183
6183
  }
6184
- const bunResolved = Bun.which("gh");
6185
- if (bunResolved && existsSync24(bunResolved)) {
6186
- return bunResolved;
6187
- }
6188
- for (const candidate of ["/opt/homebrew/bin/gh", "/usr/local/bin/gh", "/usr/bin/gh"]) {
6184
+ for (const candidate of ["/usr/bin/gh", "/opt/homebrew/bin/gh", "/usr/local/bin/gh"]) {
6189
6185
  if (existsSync24(candidate)) {
6190
6186
  return candidate;
6191
6187
  }
6192
6188
  }
6189
+ const bunResolved = Bun.which("gh");
6190
+ if (bunResolved && existsSync24(bunResolved) && !isRuntimeGatewayGhPath(bunResolved)) {
6191
+ return bunResolved;
6192
+ }
6193
6193
  return "";
6194
6194
  }
6195
+ function isRuntimeGatewayGhPath(candidate) {
6196
+ return /\/\.rig\/bin\/gh$/.test(candidate.replace(/\\/g, "/"));
6197
+ }
6195
6198
  async function resolveGithubCliAuthToken(ghBinary = "") {
6196
6199
  const gh = ghBinary || resolveGithubCliBinaryPath();
6197
6200
  if (!gh) {
@@ -6292,6 +6295,8 @@ async function runtimeEnv(projectRoot, runtime) {
6292
6295
  XDG_CACHE_HOME: runtime.cacheDir,
6293
6296
  XDG_STATE_HOME: runtime.stateDir,
6294
6297
  RIG_AGENT_ID: runtime.id,
6298
+ ...process.env.RIG_RUN_ID?.trim() ? { RIG_RUN_ID: process.env.RIG_RUN_ID.trim() } : {},
6299
+ ...process.env.RIG_SERVER_RUN_ID?.trim() ? { RIG_SERVER_RUN_ID: process.env.RIG_SERVER_RUN_ID.trim() } : {},
6295
6300
  RIG_TASK_ID: runtime.taskId,
6296
6301
  RIG_TASK_RUNTIME_ID: runtime.id,
6297
6302
  RIG_TASK_WORKSPACE: runtime.workspaceDir,
@@ -8065,7 +8070,11 @@ async function ensureAgentRuntime(options) {
8065
8070
  mkdirSync18(runtime.binDir, { recursive: true });
8066
8071
  mkdirSync18(workspaceLayout.distDir, { recursive: true });
8067
8072
  prepareRuntimeWorkspace(options.projectRoot, workspaceDir);
8068
- await resetEphemeralTaskArtifacts(workspaceDir, options.taskId);
8073
+ if (options.preserveTaskArtifacts) {
8074
+ console.log(`[rig-agent] Preserving runtime task artifacts for resume of ${options.taskId}.`);
8075
+ } else {
8076
+ await resetEphemeralTaskArtifacts(workspaceDir, options.taskId);
8077
+ }
8069
8078
  const ctx = {
8070
8079
  runtimeId: options.id,
8071
8080
  taskId: options.taskId,
@@ -198,6 +198,17 @@ async function readSourceAwareTaskStatus(projectRoot, taskId, options = {}) {
198
198
  return null;
199
199
  }
200
200
  }
201
+ function updateGithubIssueTaskBySourceIssueId(sourceIssueId, taskId, update, options = {}) {
202
+ const parsed = sourceIssueId?.trim().match(/^([^/]+)\/([^#]+)#(\d+)$/);
203
+ if (!parsed || parsed[3] !== taskId) {
204
+ return false;
205
+ }
206
+ applyGithubIssueUpdate(options.ghBinary ?? "gh", options.spawn ?? spawnSync, parsed[3], {
207
+ sourceIssueId: sourceIssueId.trim(),
208
+ taskSource: { kind: "github-issues", owner: parsed[1], repo: parsed[2] }
209
+ }, update);
210
+ return true;
211
+ }
201
212
  function updateSourceAwareTaskConfigTask(projectRoot, taskId, update, options = {}) {
202
213
  const configPath = options.configPath ?? resolve2(projectRoot, ".rig", "task-config.json");
203
214
  const rawEntry = readRawTaskEntry(configPath, taskId);
@@ -553,8 +564,8 @@ function ensureStatusLabel(bin, repo, spawnFn, label) {
553
564
  }
554
565
  }
555
566
  function selectedGitHubEnv() {
556
- const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() ?? "";
557
- return { GH_TOKEN: token, GITHUB_TOKEN: token };
567
+ const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() || process.env.RIG_GITHUB_TOKEN?.trim() || "";
568
+ return { GH_TOKEN: token, GITHUB_TOKEN: token, RIG_GITHUB_TOKEN: token };
558
569
  }
559
570
  function ghSpawnOptions() {
560
571
  return { encoding: "utf-8", env: { ...process.env, ...selectedGitHubEnv() } };
@@ -605,6 +616,7 @@ function isPlainRecord2(candidate) {
605
616
  }
606
617
  export {
607
618
  updateSourceAwareTaskConfigTask,
619
+ updateGithubIssueTaskBySourceIssueId,
608
620
  readSourceAwareTaskStatus,
609
621
  readMaterializedTaskMetadata,
610
622
  createSourceAwareTaskConfigRecordReader
@@ -884,8 +884,8 @@ function ensureStatusLabel(bin, repo, spawnFn, label) {
884
884
  }
885
885
  }
886
886
  function selectedGitHubEnv() {
887
- const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() ?? "";
888
- return { GH_TOKEN: token, GITHUB_TOKEN: token };
887
+ const token = process.env.RIG_GITHUB_SELECTED_TOKEN?.trim() || process.env.RIG_GITHUB_TOKEN?.trim() || "";
888
+ return { GH_TOKEN: token, GITHUB_TOKEN: token, RIG_GITHUB_TOKEN: token };
889
889
  }
890
890
  function ghSpawnOptions() {
891
891
  return { encoding: "utf-8", env: { ...process.env, ...selectedGitHubEnv() } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/runtime",
3
- "version": "0.0.6-alpha.3",
3
+ "version": "0.0.6-alpha.4",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -64,11 +64,11 @@
64
64
  "module": "./dist/src/index.js",
65
65
  "dependencies": {
66
66
  "@libsql/client": "^0.17.2",
67
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.3",
68
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.3",
69
- "@rig/hook-kit": "npm:@h-rig/hook-kit@0.0.6-alpha.3",
70
- "@rig/shared": "npm:@h-rig/shared@0.0.6-alpha.3",
71
- "@rig/validator-kit": "npm:@h-rig/validator-kit@0.0.6-alpha.3",
67
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.4",
68
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.4",
69
+ "@rig/hook-kit": "npm:@h-rig/hook-kit@0.0.6-alpha.4",
70
+ "@rig/shared": "npm:@h-rig/shared@0.0.6-alpha.4",
71
+ "@rig/validator-kit": "npm:@h-rig/validator-kit@0.0.6-alpha.4",
72
72
  "effect": "4.0.0-beta.78",
73
73
  "smol-toml": "^1.6.0"
74
74
  }