@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.
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/registry.js +2 -2
- package/dist/square-wiring.d.ts +4 -0
- package/dist/square-wiring.js +4 -0
- package/package.json +1 -1
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 {
|
|
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 {
|
|
3
|
+
export { assignedSquareName, bindCurrentParticipant, unbindCurrentParticipant } from './registry.js';
|
package/dist/registry.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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 (
|
|
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);
|
package/dist/square-wiring.d.ts
CHANGED
|
@@ -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;
|
package/dist/square-wiring.js
CHANGED
|
@@ -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'
|