@astrosheep/keiyaku 4.6.18 → 4.6.19

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.
@@ -1,9 +1,9 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { join } from "node:path";
3
- import { Square, SquareError } from "@astrosheep/square";
3
+ import { Square, SquareError, harnessOwner, localUserOwner } from "@astrosheep/square";
4
4
  /**
5
5
  * The submitting-edge identity policy. Every Square read is rooted in the
6
- * submitted environment's actual Body, never this process's ambient identity.
6
+ * submitted environment's actual owner, never this process's ambient identity.
7
7
  */
8
8
  const HARNESS_SESSIONS = [
9
9
  { provider: "claude", channel: "claude-code", variable: "CLAUDE_CODE_SESSION_ID" },
@@ -26,7 +26,7 @@ function sessionCoordinates(environment) {
26
26
  return session === undefined ? [] : [{ channel, ...(provider === undefined ? {} : { provider }), session }];
27
27
  });
28
28
  }
29
- function squareBody(environment) {
29
+ function squareOwner(environment) {
30
30
  if (environment.CLAUDE_CODE_CHILD_SESSION === "1")
31
31
  return undefined;
32
32
  const coordinates = sessionCoordinates(environment);
@@ -34,7 +34,7 @@ function squareBody(environment) {
34
34
  if (native.length > 1)
35
35
  return undefined;
36
36
  const coordinate = native[0] ?? coordinates.find(({ channel }) => channel === "paseo");
37
- return coordinate === undefined ? undefined : { channel: coordinate.channel, session: coordinate.session };
37
+ return coordinate === undefined ? undefined : harnessOwner(coordinate);
38
38
  }
39
39
  function squareSeatName(provider, session) {
40
40
  const digest = createHash("sha256")
@@ -57,17 +57,17 @@ function priorSeatNames(environment) {
57
57
  }
58
58
  async function usableName(name) {
59
59
  try {
60
- await Square.inMemory({ markdown: "" }).participant(name);
60
+ await Square.inMemory({ markdown: "" }).join(name, { owner: localUserOwner() });
61
61
  return true;
62
62
  }
63
63
  catch {
64
64
  return false;
65
65
  }
66
66
  }
67
- async function standingAt(location, environment, body, signal) {
67
+ async function standingAt(location, environment, owner, signal) {
68
68
  let square;
69
69
  try {
70
- square = await Square.at({ path: location, env: environment, body }, { signal });
70
+ square = await Square.at({ path: location, env: environment }, { signal });
71
71
  }
72
72
  catch (error) {
73
73
  return error instanceof SquareError && error.code === "unavailable"
@@ -75,14 +75,14 @@ async function standingAt(location, environment, body, signal) {
75
75
  : { kind: "indeterminate" };
76
76
  }
77
77
  try {
78
- const recognized = await square.recognize();
79
- if (recognized.length === 1)
80
- return { kind: "standing", name: recognized[0].name };
81
- if (recognized.length > 1)
78
+ const standing = (await square.seatsOf(owner)).filter(({ attachment }) => attachment === "attached");
79
+ if (standing.length === 1)
80
+ return { kind: "standing", name: standing[0].name };
81
+ if (standing.length > 1)
82
82
  return { kind: "indeterminate" };
83
83
  const known = new Set(priorSeatNames(environment));
84
84
  const participants = (await square.participants({}, { signal })).participants;
85
- if (participants.some(({ name, state }) => known.has(name) && state !== "not joined"))
85
+ if (participants.some(({ name, presence }) => known.has(name) && presence !== "never-joined"))
86
86
  return { kind: "indeterminate" };
87
87
  return { kind: "absent" };
88
88
  }
@@ -118,12 +118,12 @@ export async function squareSeat(input, control = {}) {
118
118
  const name = declared(input.environment, "SQUARE_PARTICIPANT_NAME");
119
119
  if (name !== undefined)
120
120
  return (await usableName(name)) ? name : undefined;
121
- const body = squareBody(input.environment);
121
+ const owner = squareOwner(input.environment);
122
122
  const candidate = seatCandidate(input.environment);
123
- if (body === undefined)
123
+ if (owner === undefined)
124
124
  return undefined;
125
125
  const location = join(input.path, ".square", "KEIYAKU.square");
126
- const standing = await bounded(async (signal) => await standingAt(location, input.environment, body, signal), control);
126
+ const standing = await bounded(async (signal) => await standingAt(location, input.environment, owner, signal), control);
127
127
  if (standing?.kind === "standing")
128
128
  return standing.name;
129
129
  return standing?.kind === "absent" ? candidate : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/keiyaku",
3
- "version": "4.6.18",
3
+ "version": "4.6.19",
4
4
  "workspaces": [
5
5
  "plugins/square",
6
6
  "plugins/paseo/forwarder"
@@ -81,8 +81,8 @@
81
81
  "dependencies": {
82
82
  "@agentclientprotocol/sdk": "^1.3.0",
83
83
  "@anthropic-ai/claude-agent-sdk": "^0.3.226",
84
- "@astrosheep/keiyaku-plugin-square": "0.1.12",
85
- "@astrosheep/square": "^0.3.93",
84
+ "@astrosheep/keiyaku-plugin-square": "0.1.13",
85
+ "@astrosheep/square": "latest",
86
86
  "@getpaseo/client": "0.11.2",
87
87
  "@getpaseo/protocol": "0.11.2",
88
88
  "@opencode/client": "2.0.20",