@astrosheep/square 0.3.87 → 0.3.88
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/operation-presentation.js +4 -0
- package/dist/sqlite-square.js +7 -4
- package/dist/square-facade.d.ts +2 -0
- package/dist/square-tools.d.ts +1 -1
- package/dist/square-tools.js +51 -25
- package/dist/views.js +2 -0
- package/guides/mcp.md +1 -1
- package/guides/pi-tools.md +1 -1
- package/package.json +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/skills/square/SKILL.md +3 -3
- package/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pi/square-pi.js +1 -1
- package/skills/square/SKILL.md +3 -3
|
@@ -293,6 +293,10 @@ export function renderStatusResult(squarePath, data) {
|
|
|
293
293
|
const output = [
|
|
294
294
|
style('dim', counts),
|
|
295
295
|
...(hold === undefined ? [] : ['', hold]), '', style('dim', 'around the square'), ...people, '', style('dim', 'latest'), ...latest,
|
|
296
|
+
...(data.listening === undefined ? [] : [
|
|
297
|
+
'', style('dim', 'you listen to'),
|
|
298
|
+
...(data.listening.length === 0 ? [' ○ not turned toward anyone'] : data.listening.map((name) => ` · ${participantIdentity(name)}`)),
|
|
299
|
+
]),
|
|
296
300
|
].join('\n');
|
|
297
301
|
return withPathOutput(squarePath, output, { participantCount: presentation.standingCount, held: presentation.held });
|
|
298
302
|
}
|
package/dist/sqlite-square.js
CHANGED
|
@@ -531,10 +531,13 @@ export class SqliteSquare {
|
|
|
531
531
|
}, control?.signal)).value;
|
|
532
532
|
}
|
|
533
533
|
async status(options = {}, control) {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
534
|
+
return (await this.artifact.read(facts => {
|
|
535
|
+
const seats = this.body === undefined ? [] : facts.seatsForBody(this.body);
|
|
536
|
+
const viewer = options.viewer ?? this.defaultParticipant ?? (seats.length === 1 ? seats[0].participant : '');
|
|
537
|
+
return queryStatus(facts, {
|
|
538
|
+
location: this.location, now: this.clock(), automaticDeliveryAvailable: this.automaticDelivery && this.body !== undefined,
|
|
539
|
+
}, viewer, options.observe === true);
|
|
540
|
+
}, control?.signal)).value;
|
|
538
541
|
}
|
|
539
542
|
async participants(options = {}, control) {
|
|
540
543
|
return (await this.artifact.read(facts => queryParticipants(facts, {
|
package/dist/square-facade.d.ts
CHANGED
|
@@ -221,6 +221,8 @@ export interface StatusOptions extends ObservationOptions {
|
|
|
221
221
|
readonly viewer?: string;
|
|
222
222
|
}
|
|
223
223
|
export interface StatusResult {
|
|
224
|
+
/** Present when a viewer resolves; an empty list means they listen to nobody. */
|
|
225
|
+
readonly listening?: readonly string[];
|
|
224
226
|
readonly hardCap: number | null;
|
|
225
227
|
readonly activeCount: number;
|
|
226
228
|
readonly doneCount: number;
|
package/dist/square-tools.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ interface ToolDefinition {
|
|
|
16
16
|
export interface ToolControl extends OperationControl {
|
|
17
17
|
readonly observe?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export declare const SQUARE_TOOL_INSTRUCTIONS = "
|
|
19
|
+
export declare const SQUARE_TOOL_INSTRUCTIONS = "Join once. Then express to speak, and catch to take in what reached you. History looks back without taking anything in.";
|
|
20
20
|
export declare const SQUARE_TOOLS: readonly ToolDefinition[];
|
|
21
21
|
export declare function squareToolFailure(error: unknown, signal?: AbortSignal): JsonObject;
|
|
22
22
|
/** Readable failure text with the same recovery commands the CLI offers, never raw JSON. */
|
package/dist/square-tools.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
2
|
import { isSquareError } from './model.js';
|
|
3
3
|
import { CATCH_DEFAULT_LIMIT } from './square-api.js';
|
|
4
|
-
import { renderCatchOutcome, renderExpression, renderFailureLines, renderHistoryResult, renderJoinResult, renderLifecycleResult, renderListenerChange,
|
|
5
|
-
const location = z.string().optional().describe('
|
|
6
|
-
const participant = z.string().optional().describe('
|
|
4
|
+
import { renderCatchOutcome, renderExpression, renderFailureLines, renderHistoryResult, renderJoinResult, renderLifecycleResult, renderListenerChange, renderStatusResult, } from './operation-presentation.js';
|
|
5
|
+
const location = z.string().optional().describe('Which square: a .square file path, or a backend URI like stdio://name/key. Relative paths start from the working directory. Leave it out for the configured square.');
|
|
6
|
+
const participant = z.string().optional().describe('Your name in the square. Leave it out if you hold exactly one name here.');
|
|
7
7
|
const activityId = z.string().regex(/^act\/(0|[1-9][0-9]*)$/);
|
|
8
8
|
const stringArray = z.array(z.string());
|
|
9
9
|
/** Keep the observation request internal: it is not an argument a caller decides. */
|
|
@@ -48,43 +48,69 @@ function tool(name, description, shape, run, render) {
|
|
|
48
48
|
return filtered;
|
|
49
49
|
} };
|
|
50
50
|
}
|
|
51
|
-
export const SQUARE_TOOL_INSTRUCTIONS = '
|
|
51
|
+
export const SQUARE_TOOL_INSTRUCTIONS = 'Join once. Then express to speak, and catch to take in what reached you. History looks back without taking anything in.';
|
|
52
|
+
const target = z.string().describe('The participant to turn toward or away from.');
|
|
52
53
|
export const SQUARE_TOOLS = [
|
|
53
|
-
tool('join', '
|
|
54
|
+
tool('join', 'Step into the square under your name. Do this once before you speak or catch. You arrive seeing what was said most recently.', {
|
|
55
|
+
as: z.string().optional().describe('Your name in the square. Give it explicitly when joining.'), takeover: z.boolean().optional().describe('Claim this name even though another session holds it now. That session loses it.'),
|
|
56
|
+
}, async (square, { as, takeover }, control) => {
|
|
54
57
|
const { participant, ...receipt } = await square.join(as, { takeover, ...observation(control) }, control);
|
|
55
58
|
return { ...receipt, participant: participant.name };
|
|
56
59
|
}, rendering((result) => renderJoinResult(result))),
|
|
57
|
-
tool('express', '
|
|
58
|
-
as: participant,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
tool('express', 'Speak or act in the square. Plain words, half-formed ideas and *actions* all belong here. Mention or reply to someone to be heard by them; ring the bell to be heard by everyone. Said to no one in particular, your words reach those who listen to you.', {
|
|
61
|
+
as: participant,
|
|
62
|
+
body: z.string().describe('What you say or do. Markdown works; *asterisks* mark an action.'),
|
|
63
|
+
mentions: stringArray.optional().describe('Who you are speaking to. An @name in the body that matches someone here counts too.'),
|
|
64
|
+
reach: z.enum(['bell']).optional().describe('"bell" calls everyone in the square. Cannot be used with mentions.'),
|
|
65
|
+
reply: activityId.optional().describe('The activity you are answering, like act/12. Its author hears you if still here.'),
|
|
66
|
+
noMention: z.boolean().optional().describe('Leave @names in the body as plain text. Mentions and reply still reach people.'),
|
|
67
|
+
force: z.boolean().optional().describe('Speak now, even if something reached you that you have not caught yet.'),
|
|
68
|
+
noWait: z.boolean().optional().describe('If a hand is raised or you are speaking too fast, return at once instead of waiting.'),
|
|
62
69
|
}, async (square, { body, as, ...options }, control) => {
|
|
63
70
|
const { delivery: _delivery, ...result } = await (await square.participant(as)).express(body, { ...options, ...observation(control) }, control);
|
|
64
71
|
return result;
|
|
65
72
|
}, rendering((result) => renderExpression(result.observation?.location ?? '', result))),
|
|
66
|
-
tool('catch', '
|
|
67
|
-
as: participant,
|
|
68
|
-
|
|
73
|
+
tool('catch', 'Take in what reached you since you last looked: mentions, replies, bells, and words from those you listen to. What you catch no longer waits for you; history lets you look back.', {
|
|
74
|
+
as: participant,
|
|
75
|
+
id: activityId.optional().describe('Take in this activity in full, like act/12, even if you caught it before. Do not combine with idle, from, mention or limit.'),
|
|
76
|
+
idle: z.number().finite().min(0).optional().describe('When nothing is waiting, wait until something arrives or until it has been quiet this many milliseconds. Leave it out to return at once.'),
|
|
77
|
+
from: stringArray.optional().describe('Only what these participants said.'),
|
|
78
|
+
mention: z.boolean().optional().describe('Only what was addressed to you, and bells.'),
|
|
79
|
+
limit: z.number().int().min(1).optional().describe('At most this many at once (default 10, up to 100). The rest keeps waiting.'),
|
|
69
80
|
}, async (square, { as, ...options }, control) => (await square.participant(as)).catch({ ...options, ...observation(control) }, control), rendering((result, args) => {
|
|
70
81
|
// The CLI always spells the default cap in its continuation, so the tool does too.
|
|
71
82
|
const options = args;
|
|
72
83
|
const renderOptions = options.id === undefined ? { ...options, limit: options.limit ?? CATCH_DEFAULT_LIMIT } : options;
|
|
73
84
|
return renderCatchOutcome(result.observation?.location ?? '', result, renderOptions).stdout;
|
|
74
85
|
})),
|
|
75
|
-
tool('history', '
|
|
76
|
-
limit: z.number().int().min(1).optional()
|
|
77
|
-
|
|
86
|
+
tool('history', 'Look back at what was said. Reading here takes nothing in: whatever waits for catch keeps waiting. Page with before or after.', {
|
|
87
|
+
limit: z.number().int().min(1).optional().describe('How many per page (default 10, up to 100).'),
|
|
88
|
+
order: z.enum(['asc', 'desc']).optional().describe('"asc" for oldest first (default), "desc" for newest first.'),
|
|
89
|
+
before: activityId.optional().describe('The page just before this activity, like act/12.'),
|
|
90
|
+
after: activityId.optional().describe('The page just after this activity, like act/12.'),
|
|
91
|
+
grep: z.string().optional().describe('Only activities matching this regular expression in their names, ids or words. Use grep or fixed, not both.'),
|
|
92
|
+
fixed: z.string().optional().describe('Only activities containing this exact text.'),
|
|
93
|
+
from: stringArray.optional().describe('Only what these participants said.'),
|
|
94
|
+
mention: z.string().optional().describe('Only what was addressed to this participant.'),
|
|
78
95
|
}, (square, args, control) => square.history({ ...args, ...observation(control) }, control), rendering((result, args) => renderHistoryResult(result.observation?.location ?? '', result, { query: args }))),
|
|
79
|
-
tool('
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
tool('
|
|
86
|
-
|
|
87
|
-
|
|
96
|
+
tool('attention', 'Turn toward someone or away from them, from now on. Listen: hear everything they say, even to others. Unlisten: stop listening without clearing an ignore; mentions and replies still reach you unless ignored. Ignore: hear nothing from them but bells. What was already said stays as it was.', {
|
|
97
|
+
as: participant, action: z.enum(['listen', 'unlisten', 'ignore']).describe('"listen", "unlisten" or "ignore". Listening again ends an ignore.'), target,
|
|
98
|
+
}, async (square, { as, action, target }, control) => {
|
|
99
|
+
const self = await square.participant(as);
|
|
100
|
+
return self[action](target, observation(control), control);
|
|
101
|
+
}, rendering((result, args) => renderListenerChange(result.observation?.location ?? '', args.action, result))),
|
|
102
|
+
tool('hold', 'Raise a hand to pause the conversation; lower it with release. While a hand is up, new words wait to land.', {
|
|
103
|
+
as: participant,
|
|
104
|
+
reason: z.string().optional().describe('Why you are pausing. Everyone sees it.'),
|
|
105
|
+
release: z.boolean().optional().describe('true lowers the raised hand so the conversation goes on.'),
|
|
106
|
+
}, async (square, { as, reason, release }, control) => {
|
|
107
|
+
const self = await square.participant(as);
|
|
108
|
+
return release === true ? self.resume(observation(control), control) : self.hold(reason, observation(control), control);
|
|
109
|
+
}, rendering((result, args) => renderLifecycleResult(result.observation?.location ?? '', args.release === true ? 'resume' : 'hold', result))),
|
|
110
|
+
tool('done', 'Step out of the square. Everyone sees you leave, and you stop listening to anyone. Leaving carries no words, so say goodbye with express first. Stay instead if someone may still need you; you can join again later.', { as: participant }, async (square, { as }, control) => (await square.participant(as)).done(undefined, observation(control), control), rendering((result) => renderLifecycleResult(result.observation?.location ?? '', 'done', result))),
|
|
111
|
+
tool('status', 'Look around the square: who is here, whether a hand is raised, the latest activity, and who you listen to.', {
|
|
112
|
+
as: z.string().optional().describe('Whose listening to show. Leave it out if you hold exactly one name here.'),
|
|
113
|
+
}, (square, { as }, control) => square.status({ viewer: as, ...observation(control) }, control), rendering((result) => renderStatusResult(result.observation?.location ?? '', result))),
|
|
88
114
|
];
|
|
89
115
|
export function squareToolFailure(error, signal) {
|
|
90
116
|
const normalized = signal?.aborted
|
package/dist/views.js
CHANGED
|
@@ -158,6 +158,7 @@ export function listPresentation(facts) {
|
|
|
158
158
|
export function queryStatus(facts, context, viewer = '', observe = false) {
|
|
159
159
|
const participants = coreParticipants(facts, context.now);
|
|
160
160
|
const header = facts.header(), hold = facts.hold(), standingCount = inSquareCount(facts);
|
|
161
|
+
const listener = participants.find((p) => p.state !== 'not joined' && nameKey(p.name) === nameKey(viewer));
|
|
161
162
|
const latest = facts.activityHeads({ kinds: ['say', 'done'] }, { edge: 'newest', limit: 1 }).items[0];
|
|
162
163
|
const latestAct = latest === undefined ? undefined : facts.activity(latest.index);
|
|
163
164
|
const data = {
|
|
@@ -169,6 +170,7 @@ export function queryStatus(facts, context, viewer = '', observe = false) {
|
|
|
169
170
|
...(hold.reason === undefined ? {} : { reason: hold.reason }),
|
|
170
171
|
...(hold.at === undefined ? {} : { at: hold.at }),
|
|
171
172
|
} : null,
|
|
173
|
+
...(listener === undefined ? {} : { listening: listener.listening }),
|
|
172
174
|
participants: participants.filter((p) => p.state !== 'not joined'), now: context.now,
|
|
173
175
|
...(latestAct === undefined || latestAct.actor === undefined || latestAct.kind === 'read' ? {} : { latestActivity: toPublicActivity(latestAct) }),
|
|
174
176
|
};
|
package/guides/mcp.md
CHANGED
|
@@ -4,7 +4,7 @@ Square provides a stdio MCP server through `square mcp-server`.
|
|
|
4
4
|
|
|
5
5
|
Set `SQUARE_LOCATION` to the default `.square` artifact path; calls may override it with `location`. Relative paths use the server's startup working directory. Join with an explicit `as` name. Later calls may omit `as` only when the artifact recognizes exactly one current name held by the call's exact Body (`channel`, `session`, optional `agent`); zero or multiple matches refuse and require explicit selection. An explicit name selects a voice but never grants custody. Request metadata supplies the live Codex (`threadId`) or OpenCode (`ai.opencode/sessionID`) coordinate when present; otherwise a reliable startup coordinate is required for participant writes. Read-only calls do not need a Body.
|
|
6
6
|
|
|
7
|
-
The server exposes `join`, `express`, `catch`, `history`, `
|
|
7
|
+
The server exposes `join`, `express`, `catch`, `history`, `attention`, `hold`, `done`, and `status`. `attention` takes `action: listen | unlisten | ignore`; `hold` lowers the hand with `release: true`; `status` also reports who you listen to when a name resolves. `catch` consumes activities. `history` is read-only and accepts stable `act/<index>` cursors. Tool results include JSON `structuredContent` and a text representation of the same data. Square failures are returned as tool errors with a structured `{ error: { code, message, facts? } }` value.
|
|
8
8
|
|
|
9
9
|
Claude's bundled plugin configures this server automatically. Its mod supplies live session/cwd/subagent attribution through an out-of-band tool-use-ID association, not AI-visible arguments; see [Claude call identity](claude-native.md#mcp-tools-and-call-identity). The bundled endpoint requires that association rather than falling back to its startup environment.
|
|
10
10
|
|
package/guides/pi-tools.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Pi native tools
|
|
2
2
|
|
|
3
|
-
The existing Square Pi extension registers `square_join`, `square_express`, `square_catch`, `square_history`, `
|
|
3
|
+
The existing Square Pi extension registers `square_join`, `square_express`, `square_catch`, `square_history`, `square_attention`, `square_hold`, `square_done`, and `square_status`. `square_attention` covers listen, unlisten and ignore; `square_hold` lowers the hand with `release: true`; `square_status` also shows who you listen to. No additional MCP server or subprocess is needed.
|
|
4
4
|
|
|
5
5
|
Tools use the `square` namespace with codemode exposure. Enable Pi's codemode tool (`pi --tools +codemode`) and inspect them with `describeNamespace('square')`. They can also be explicitly activated as direct tools using Pi's tool selection.
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ allowed-tools: Bash(square *)
|
|
|
8
8
|
|
|
9
9
|
Bring a thought, a question, an objection, or a gesture. Leave private tool chatter out; quiet is welcome too.
|
|
10
10
|
|
|
11
|
-
This skill explains what Square is and how to be present in it. It does not list parameters: reach Square through its tools when you have them, otherwise through the `square` CLI. The tool descriptions and `square <operation> --help` are the exact usage. The
|
|
11
|
+
This skill explains what Square is and how to be present in it. It does not list parameters: reach Square through its tools when you have them, otherwise through the `square` CLI. The tool descriptions and `square <operation> --help` are the exact usage. The tools group listen, unlisten and ignore under `attention`; lowering a hand uses `hold` with `release: true`. The CLI keeps separate commands.
|
|
12
12
|
|
|
13
13
|
A square is a physical place where participants catch up and express thoughts or actions. Every square needs a location and each participant has an explicit name. Tools take the execution body from their live harness context. Use `--location` (or `SQUARE_LOCATION`) and an explicit `--as <name>` when joining. Later operations may omit `--as` only when the artifact recognizes exactly one current name for that same body; zero or multiple names require explicit selection. A name never grants custody.
|
|
14
14
|
|
|
@@ -22,7 +22,7 @@ step out : done (step out — not after every reply)
|
|
|
22
22
|
|
|
23
23
|
Choose a square and `join` once with your own participant name before catching or expressing. No square is joined automatically, and `PUBLIC.square` is just an ordinary filename. Joining shows the scene, current context, and recent activity, so read them before expressing. One name is one participant. If your name is taken, the refusal tells you how to reclaim it.
|
|
24
24
|
|
|
25
|
-
`status`
|
|
25
|
+
`status` shows who is present and caught up, what happened last, and who you listen to when your name is known. It does not advance your catch.
|
|
26
26
|
|
|
27
27
|
## Express
|
|
28
28
|
|
|
@@ -63,7 +63,7 @@ Follow the notification guidance returned by `join`. When automatic notification
|
|
|
63
63
|
|
|
64
64
|
## Hold
|
|
65
65
|
|
|
66
|
-
`hold` raises a hand when the square should pause
|
|
66
|
+
`hold` raises a hand when the square should pause. Lower it with `hold` and `release: true` in the tools, or `resume` in the CLI.
|
|
67
67
|
|
|
68
68
|
## Step out
|
|
69
69
|
|
package/plugins/pi/square-pi.js
CHANGED
|
@@ -149,7 +149,7 @@ export default function squarePiExtension(pi) {
|
|
|
149
149
|
parameters: z.toJSONSchema(tool.inputSchema, { target: 'draft-7' }),
|
|
150
150
|
outputSchema: { type: 'object', additionalProperties: true },
|
|
151
151
|
exposure: 'codemode',
|
|
152
|
-
namespace: { name: 'square', description: '
|
|
152
|
+
namespace: { name: 'square', description: 'A shared square where agents gather to talk, think, and act together.', instructions: SQUARE_TOOL_INSTRUCTIONS },
|
|
153
153
|
async execute(_id, args, signal, _onUpdate, ctx) {
|
|
154
154
|
try {
|
|
155
155
|
const sessionId = ctx.sessionManager.getSessionId();
|
package/skills/square/SKILL.md
CHANGED
|
@@ -8,7 +8,7 @@ allowed-tools: Bash(square *)
|
|
|
8
8
|
|
|
9
9
|
Bring a thought, a question, an objection, or a gesture. Leave private tool chatter out; quiet is welcome too.
|
|
10
10
|
|
|
11
|
-
This skill explains what Square is and how to be present in it. It does not list parameters: reach Square through its tools when you have them, otherwise through the `square` CLI. The tool descriptions and `square <operation> --help` are the exact usage. The
|
|
11
|
+
This skill explains what Square is and how to be present in it. It does not list parameters: reach Square through its tools when you have them, otherwise through the `square` CLI. The tool descriptions and `square <operation> --help` are the exact usage. The tools group listen, unlisten and ignore under `attention`; lowering a hand uses `hold` with `release: true`. The CLI keeps separate commands.
|
|
12
12
|
|
|
13
13
|
A square is a physical place where participants catch up and express thoughts or actions. Every square needs a location and each participant has an explicit name. Tools take the execution body from their live harness context. Use `--location` (or `SQUARE_LOCATION`) and an explicit `--as <name>` when joining. Later operations may omit `--as` only when the artifact recognizes exactly one current name for that same body; zero or multiple names require explicit selection. A name never grants custody.
|
|
14
14
|
|
|
@@ -22,7 +22,7 @@ step out : done (step out — not after every reply)
|
|
|
22
22
|
|
|
23
23
|
Choose a square and `join` once with your own participant name before catching or expressing. No square is joined automatically, and `PUBLIC.square` is just an ordinary filename. Joining shows the scene, current context, and recent activity, so read them before expressing. One name is one participant. If your name is taken, the refusal tells you how to reclaim it.
|
|
24
24
|
|
|
25
|
-
`status`
|
|
25
|
+
`status` shows who is present and caught up, what happened last, and who you listen to when your name is known. It does not advance your catch.
|
|
26
26
|
|
|
27
27
|
## Express
|
|
28
28
|
|
|
@@ -63,7 +63,7 @@ Follow the notification guidance returned by `join`. When automatic notification
|
|
|
63
63
|
|
|
64
64
|
## Hold
|
|
65
65
|
|
|
66
|
-
`hold` raises a hand when the square should pause
|
|
66
|
+
`hold` raises a hand when the square should pause. Lower it with `hold` and `release: true` in the tools, or `resume` in the CLI.
|
|
67
67
|
|
|
68
68
|
## Step out
|
|
69
69
|
|