@astrosheep/square 0.3.19 → 0.3.21

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,6 +1,6 @@
1
1
  {
2
2
  "name": "square",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "Native Claude Code turn-boundary delivery for Square participants",
5
5
  "author": {
6
6
  "name": "Square"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "square",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "Shared Square activity with reliable participant attention at Codex boundaries.",
5
5
  "author": {
6
6
  "name": "Square"
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Square } from './square-wiring.js';
2
2
  export { SquareError } from './model.js';
3
- export { bindCurrentParticipant, currentParticipantName, unbindCurrentParticipant } from './registry.js';
3
+ export { assignedSquareName, bindCurrentParticipant, unbindCurrentParticipant } from './registry.js';
4
4
  export type { ActivityId } from './square-core.js';
5
5
  export type { Activity, CatchOptions, CatchResult, ExpressOptions, ExpressResult, HistoryQuery, ListenerChangeResult, OpenOptions, Participant, ParticipantStatus, PerceivedActivity, SquareAtInput, SquareBuildInput, SquareSnapshot, SquareSource, WakeNotifier, } from './square-facade.js';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { Square } from './square-wiring.js';
2
2
  export { SquareError } from './model.js';
3
- export { bindCurrentParticipant, currentParticipantName, unbindCurrentParticipant } from './registry.js';
3
+ export { assignedSquareName, bindCurrentParticipant, unbindCurrentParticipant } from './registry.js';
@@ -38,7 +38,7 @@ export declare function lookupParticipant(squarePath: string, name: string, now?
38
38
  export declare function localParticipantOwner(squarePath: string, name: string, env?: NodeJS.ProcessEnv, now?: number): string | undefined;
39
39
  export declare function localParticipantName(squarePath: string, env?: NodeJS.ProcessEnv): string | undefined;
40
40
  /** Resolve the one participant name owned by the current local session set, without a square path. */
41
- export declare function currentParticipantName(env?: NodeJS.ProcessEnv): string | undefined;
41
+ export declare function assignedSquareName(env?: NodeJS.ProcessEnv): string | undefined;
42
42
  export type CurrentParticipantBinding = Readonly<{
43
43
  created: boolean;
44
44
  ownerId: string;
package/dist/registry.js CHANGED
@@ -237,13 +237,13 @@ export function localParticipantName(squarePath, env = process.env) {
237
237
  return names.size === 1 ? [...names][0] : undefined;
238
238
  }
239
239
  /** Resolve the one participant name owned by the current local session set, without a square path. */
240
- export function currentParticipantName(env = process.env) {
240
+ export function assignedSquareName(env = process.env) {
241
241
  const names = new Set(localSessionIdentities(env).flatMap((identity) => lookupSession(identity.sessionId).map((item) => item.name)));
242
242
  return names.size === 1 ? [...names][0] : undefined;
243
243
  }
244
244
  /** Bind a current local session to one explicit square without taking an occupied registry name. */
245
245
  export function bindCurrentParticipant(squarePath, name, env = process.env) {
246
- if (currentParticipantName(env) !== name) {
246
+ if (assignedSquareName(env) !== name) {
247
247
  throw new SquareError('invalid_args', `The current session is not uniquely bound to ${name}`);
248
248
  }
249
249
  const localOwner = localParticipantOwner(squarePath, name, env);
@@ -9,6 +9,10 @@ export declare class Square {
9
9
  static build(input: SquareBuildInput): Promise<Square>;
10
10
  static inMemory(input: Omit<SquareBuildInput, 'path'>): Square;
11
11
  join(name: string): Promise<Participant>;
12
+ joinWithActivity(name: string): Promise<{
13
+ readonly participant: Participant;
14
+ readonly activity: Activity | null;
15
+ }>;
12
16
  implicitJoin(name: string): Promise<{
13
17
  readonly state: 'joined' | 'active' | 'done';
14
18
  readonly participant?: Participant;
@@ -59,6 +59,10 @@ export class Square {
59
59
  const joined = await join(this.square, name);
60
60
  return new ParticipantHandle(joined.name, this.square);
61
61
  }
62
+ async joinWithActivity(name) {
63
+ const joined = await join(this.square, name);
64
+ return { participant: new ParticipantHandle(joined.name, this.square), activity: joined.activity };
65
+ }
62
66
  async implicitJoin(name) {
63
67
  const joined = await implicitJoin(this.square, name);
64
68
  return joined.state === 'done'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/square",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "A shared public square where agents join, catch activity, express, and step out when done.",
5
5
  "type": "module",
6
6
  "bin": {