tines 0.0.193 → 0.0.195

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 +11 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3677,6 +3677,7 @@ var DESCRIBERS = {
3677
3677
  "context.deleted": (ev, p) => contextSegments(ev, p),
3678
3678
  "runner.registered": (ev, p) => [text(`${action(ev.type)} runner`), name(p.name)],
3679
3679
  "runner.updated": (ev, p) => [text(`${action(ev.type)} runner`), name(p.name)],
3680
+ "runner.daemon_replaced": (_ev, p) => [text("replaced daemon for runner"), name(p.name)],
3680
3681
  "runner.removed": (ev, p) => [text(`${action(ev.type)} runner`), name(p.name)],
3681
3682
  "runner.errored": (_ev, p) => [
3682
3683
  text("saw runner"),
@@ -7648,6 +7649,7 @@ import {
7648
7649
  writeFileSync as writeFileSync3
7649
7650
  } from "node:fs";
7650
7651
  import { hostname, platform, arch } from "node:os";
7652
+ import { randomUUID } from "node:crypto";
7651
7653
  import { dirname as dirname4, join as join5 } from "node:path";
7652
7654
  import { StringDecoder } from "node:string_decoder";
7653
7655
 
@@ -8790,6 +8792,7 @@ function pidAlive(pid) {
8790
8792
  }
8791
8793
  }
8792
8794
  async function runDaemon(opts) {
8795
+ const instanceId = randomUUID();
8793
8796
  const baseUrl = opts.url.replace(/\/+$/, "");
8794
8797
  mkdirSync4(opts.configDir, { recursive: true });
8795
8798
  mkdirSync4(workspacesDir(opts.configDir), { recursive: true, mode: 448 });
@@ -9219,6 +9222,7 @@ async function runDaemon(opts) {
9219
9222
  while (!shuttingDown) {
9220
9223
  try {
9221
9224
  const res = await client2.pollRunner(creds.runner_id, {
9225
+ instance_id: instanceId,
9222
9226
  owned_runs: table2.ids(),
9223
9227
  max_concurrent: opts.maxConcurrent,
9224
9228
  // Stated on every poll while pending; absent otherwise, which
@@ -9245,6 +9249,13 @@ async function runDaemon(opts) {
9245
9249
  process.exit(0);
9246
9250
  }
9247
9251
  } catch (err) {
9252
+ if (err instanceof ApiError && err.status === 409 && err.code === "runner_conflict") {
9253
+ console.error(
9254
+ `runner ${opts.name} was superseded by another daemon instance; this daemon is exiting`
9255
+ );
9256
+ await shutdown();
9257
+ return;
9258
+ }
9248
9259
  if (err instanceof ApiError && err.status === 401) {
9249
9260
  for (const run of table2.values()) {
9250
9261
  if (run.child?.pid) killTree(run.child.pid, "SIGKILL");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tines",
3
- "version": "0.0.193",
3
+ "version": "0.0.195",
4
4
  "description": "CLI for Tines, an orchestration layer for AI agents",
5
5
  "repository": {
6
6
  "type": "git",