@tablation/crew 0.143.2 → 0.143.3

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.
package/dist/cli.js CHANGED
@@ -976,6 +976,15 @@ var TUNNEL_REJECTED_KEY = "tunnel_rejected";
976
976
  function tunnelRejectedMessage(workspaceId, quickExits) {
977
977
  return `the relay tunnel for workspace ${workspaceId} exited before settling on ${quickExits} consecutive cycles, which is how a refused claim looks (the relay logs "slug already owned by another workspace/ssh key") \u2014 rotate the slug with \`crew rotate-passenger-url\` or check the relay journal. If the relay logged no rejection, a Linux passengers unit without KillMode=process kills the tunnel when the sync exits (CREW-2994): run \`crew install\`, and see \`crew doctor\``;
978
978
  }
979
+ function staleTunnelAttentionKeys(openKeys, plannedIds) {
980
+ const prefixes = [`${TUNNEL_REJECTED_KEY}:`, `${RELAY_CONTROL_UNSUPPORTED_KEY}:`];
981
+ return openKeys.filter((key) => {
982
+ const prefix = prefixes.find((p) => key.startsWith(p));
983
+ if (!prefix) return false;
984
+ const id = key.slice(prefix.length);
985
+ return !id.startsWith("periscope:") && !plannedIds.has(id);
986
+ });
987
+ }
979
988
  function rejectedTunnels(stateDir) {
980
989
  const out = [];
981
990
  for (const workspaceId of readAllPersistedWorkspaceIds(stateDir)) {
@@ -1036,6 +1045,11 @@ function periscopeTunnelRejectedItem(ticket, quickExits, nowIso) {
1036
1045
  message: `the relay preview tunnel for periscope ${ticket} exited before settling on ${quickExits} consecutive passes; its link does not work. Check that the relay supports the \`preview\` tunnel kind (crew-relay) and that the route key is accepted, or end the periscope.`
1037
1046
  };
1038
1047
  }
1048
+ function staleTunnelKeys(openKeys, sidecars) {
1049
+ const watched = new Set(sidecars.filter((sc) => sc.slug && !sc.tunnelStopped).map((sc) => periscopeTunnelKey(sc.ticket)));
1050
+ const prefix = `${TUNNEL_REJECTED_KEY}:periscope:`;
1051
+ return openKeys.filter((key) => key.startsWith(prefix) && !watched.has(key));
1052
+ }
1039
1053
  async function runPeriscopeTunnelPass(d) {
1040
1054
  let respawned = 0;
1041
1055
  for (const sc of d.sidecars()) {
@@ -17976,6 +17990,9 @@ function acceptedBy(t, i) {
17976
17990
  }
17977
17991
  function parkTarget(t, i) {
17978
17992
  const person = (m) => m && (m.kind === "hold" || m.kind === "person") ? m : void 0;
17993
+ const heldHere = !!t.held_by_ship_id && t.held_by_ship_id === i.myShipId && !!i.workModes && modeOf(t, i.workModes) === "hybrid";
17994
+ const heldOp = heldHere ? operatorOf(i.roster) : void 0;
17995
+ if (heldOp) return { step: "operator", member: heldOp };
17979
17996
  const a = acceptor(t, i);
17980
17997
  const unverified = a && !a.member ? a.name : void 0;
17981
17998
  const byAcceptor = person(a?.member);
@@ -22899,6 +22916,7 @@ async function applyRouteDecision(o, ctx, decision) {
22899
22916
  openKeys: () => openShipAttention(o.state).filter((i) => i.kind === "periscope_idle").map((i) => i.key),
22900
22917
  warn: (message) => emit.warn(message, { step: "sweep" })
22901
22918
  });
22919
+ for (const key of staleTunnelKeys(openShipAttention(o.state).map((i) => i.key), readPeriscopeSidecars(o.ship.stateDir))) clearShipAttention(o.state, key);
22902
22920
  if (o.ship.relayPreviews && o.ship.relayHost) {
22903
22921
  const ship = o.ship;
22904
22922
  const relayHost = ship.relayHost;
@@ -26285,7 +26303,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
26285
26303
  import { existsSync as existsSync55, readdirSync as readdirSync17, statSync as statSync16 } from "fs";
26286
26304
  import { join as join56 } from "path";
26287
26305
  function builtVersion() {
26288
- return true ? "0.143.2" : null;
26306
+ return true ? "0.143.3" : null;
26289
26307
  }
26290
26308
  var REBUILD_HINT = "rebuild with npm run build";
26291
26309
  function newestMtime(path) {
@@ -29106,6 +29124,10 @@ if (command === "passenger-sync-daemon") {
29106
29124
  apiKeys: passengerApiKeys(apiRoutes),
29107
29125
  controlSocket: controlSocketFor(cfg.ship.stateDir),
29108
29126
  onStatus: (workspaceId, status2, info) => {
29127
+ if (status2 === "disconnected" && !planned.has(workspaceId)) {
29128
+ clearShipAttention(state, `${TUNNEL_REJECTED_KEY}:${workspaceId}`);
29129
+ clearShipAttention(state, `${RELAY_CONTROL_UNSUPPORTED_KEY}:${workspaceId}`);
29130
+ }
29109
29131
  const owningRoute = apiRoutes.find((r) => r.resolved?.workspaceId === workspaceId);
29110
29132
  if (!owningRoute) return;
29111
29133
  pending.push(
@@ -29137,6 +29159,7 @@ if (command === "passenger-sync-daemon") {
29137
29159
  for (const plan of containerPlans) pending.push(reconcileEndpoint(plan.workspaceId, reconcile));
29138
29160
  for (const plan of plans) pending.push(reconcileRelayUrl(plan.workspaceId, apiRoutes));
29139
29161
  await Promise.all(pending);
29162
+ for (const key of staleTunnelAttentionKeys(openShipAttention(state).map((i) => i.key), planned)) clearShipAttention(state, key);
29140
29163
  await reconcilePeriscopeEndpoints();
29141
29164
  } catch (e) {
29142
29165
  emit.warn(`ship tunnel sync failed: ${e.message}`, { step: "passengers" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.143.2",
3
+ "version": "0.143.3",
4
4
  "description": "A standing team of headless agents that picks work off a Tablation board, does it on a machine you control, and reports back.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -568,7 +568,9 @@ ticket looks:
568
568
  person — a comment alone is not a stop.
569
569
 
570
570
  The decision belongs to whoever made the call on the ticket, so the digest
571
- resolves `park to` in this order and the first that resolves wins: (1) the
571
+ resolves `park to` in this order and the first that resolves wins: (0) in a
572
+ `hybrid` project, the **ship operator** of the ship currently holding the
573
+ ticket (`held_by_ship_id` is this ship); (1) the
572
574
  **acceptor**, the person who last moved the ticket into `accepted` (the
573
575
  `accepted by` column; a lane, workflow or the system promoting it does not
574
576
  count); (2) the **filer**, only when a hold or a linked person, never a