@astrosheep/square 0.3.10 → 0.3.12

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.
Files changed (54) hide show
  1. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  2. package/dist/activity.js +6 -7
  3. package/dist/artifact.js +337 -618
  4. package/dist/boundary-presentation.js +1 -1
  5. package/dist/cli/context.js +3 -3
  6. package/dist/cli/harness-command.js +1 -1
  7. package/dist/cli/maintenance-commands.js +12 -58
  8. package/dist/cli/observation-commands.js +14 -34
  9. package/dist/cli/program.js +3 -6
  10. package/dist/cli/registry.js +1 -2
  11. package/dist/cli/square-commands.js +39 -20
  12. package/dist/cmd/notify-once.js +5 -15
  13. package/dist/compact.js +4 -4
  14. package/dist/decisions.js +21 -7
  15. package/dist/delivery-health.js +56 -136
  16. package/dist/delivery.js +11 -47
  17. package/dist/file-lock.js +112 -0
  18. package/dist/harness-codex.js +35 -29
  19. package/dist/harness-links.js +0 -3
  20. package/dist/harness-pi.js +57 -0
  21. package/dist/harness.js +10 -15
  22. package/dist/help.js +16 -18
  23. package/dist/index.js +11 -5
  24. package/dist/list.js +3 -47
  25. package/dist/model.js +4 -6
  26. package/dist/notifications.js +217 -32
  27. package/dist/paseo-connection.js +135 -0
  28. package/dist/paseo-delivery.js +73 -144
  29. package/dist/paseo-state.js +1 -1
  30. package/dist/paseo-timeline.js +32 -42
  31. package/dist/presentation.js +24 -39
  32. package/dist/presented.js +10 -72
  33. package/dist/registry.js +23 -24
  34. package/dist/routes.js +153 -0
  35. package/dist/runtime.js +6 -21
  36. package/dist/square-application.js +56 -127
  37. package/dist/square-core.js +56 -9
  38. package/dist/stream.js +1 -1
  39. package/dist/wake-attempts.js +175 -0
  40. package/dist/wake-evidence.js +35 -0
  41. package/dist/wake-port.js +22 -0
  42. package/dist/wake-sink.js +45 -6
  43. package/dist/watch.js +1 -2
  44. package/guides/participant.md +7 -174
  45. package/package.json +6 -3
  46. package/skills/brainstorm/SKILL.md +28 -28
  47. package/skills/square/.claude-plugin/plugin.json +1 -1
  48. package/skills/square/SKILL.md +23 -14
  49. package/skills/square-feedback/SKILL.md +7 -7
  50. package/dist/doctor.js +0 -35
  51. package/dist/notification-failures.js +0 -54
  52. package/template.md +0 -4
  53. package/templates/architect.md +0 -4
  54. package/templates/brainstorm.md +0 -4
@@ -1,9 +1,62 @@
1
+ export function formatActivityId(index) {
2
+ if (!Number.isSafeInteger(index) || index < 0) {
3
+ throw new Error(`Invalid activity index: ${index}`);
4
+ }
5
+ return `act/${index}`;
6
+ }
7
+ export function parseActivityId(value) {
8
+ if (value === 'act/0')
9
+ return 0;
10
+ if (typeof value !== 'string' || !/^act\/[1-9]\d*$/.test(value))
11
+ return undefined;
12
+ const index = Number(value.slice(4));
13
+ return Number.isSafeInteger(index) ? index : undefined;
14
+ }
1
15
  function nameKey(name) {
2
16
  return name.toLocaleLowerCase();
3
17
  }
4
18
  function sameName(a, b) {
5
19
  return nameKey(a) === nameKey(b);
6
20
  }
21
+ export function extractMentions(body) {
22
+ const matches = [];
23
+ const re = /@([\p{L}\p{N}_-]+)/gu;
24
+ let match;
25
+ while ((match = re.exec(body)) !== null)
26
+ matches.push(match[1]);
27
+ return matches;
28
+ }
29
+ function uniqueMentionNames(names) {
30
+ const unique = [];
31
+ for (const name of names) {
32
+ if (unique.some((existing) => sameName(existing, name)))
33
+ continue;
34
+ unique.push(name);
35
+ }
36
+ return unique;
37
+ }
38
+ export function audienceOf(say) {
39
+ if (say.reach === 'bell')
40
+ return { kind: 'bell' };
41
+ return { kind: 'mentions', names: uniqueMentionNames(extractMentions(say.body)) };
42
+ }
43
+ export function audienceIncludes(audience, name) {
44
+ if (audience.kind === 'bell')
45
+ return true;
46
+ return audience.names.some((mentioned) => sameName(mentioned, name));
47
+ }
48
+ export function resolveAudience(audience, candidateNames) {
49
+ if (audience.kind === 'bell')
50
+ return [...candidateNames];
51
+ const resolved = [];
52
+ for (const mention of audience.names) {
53
+ const known = candidateNames.find((candidate) => sameName(candidate, mention));
54
+ if (known !== undefined && !resolved.some((existing) => sameName(existing, known))) {
55
+ resolved.push(known);
56
+ }
57
+ }
58
+ return resolved;
59
+ }
7
60
  function actorOf(act) {
8
61
  if ('actor' in act && typeof act.actor === 'string')
9
62
  return act.actor;
@@ -160,16 +213,10 @@ export function validate(state, act, options = {}) {
160
213
  return { ok: true };
161
214
  }
162
215
  }
163
- export function perceive(state, act, viewer) {
164
- void state;
216
+ export function perceive(act, viewer) {
165
217
  if (act.kind !== 'say')
166
218
  return 'full';
167
- const actor = act.actor;
168
- if (sameName(actor, viewer))
169
- return 'full';
170
- if (act.reach === undefined || act.reach === 'bell')
171
- return 'full';
172
- if (sameName(act.reach.beside, viewer))
219
+ if (sameName(act.actor, viewer))
173
220
  return 'full';
174
- return 'presence';
221
+ return audienceIncludes(audienceOf(act), viewer) ? 'full' : 'presence';
175
222
  }
package/dist/stream.js CHANGED
@@ -45,6 +45,6 @@ export async function cmdStreamNdjson(squarePath, recipient) {
45
45
  }
46
46
  export async function cmdStream(squarePath) {
47
47
  process.stderr.write('✕ interactive stream was removed\n');
48
- process.stderr.write(`» square --square-path ${quoteShell(path.resolve(squarePath))} stream --ndjson\n`);
48
+ process.stderr.write(`» square --location ${quoteShell(path.resolve(squarePath))} stream --ndjson\n`);
49
49
  process.exitCode = 2;
50
50
  }
@@ -0,0 +1,175 @@
1
+ import fs from 'node:fs';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+ import { withFileLockSync } from './file-lock.js';
5
+ import { isWakeRouteKind, nameKey } from './model.js';
6
+ import { canonicalSquarePath } from './registry.js';
7
+ import { formatActivityId, parseActivityId } from './square-core.js';
8
+ const RETENTION_MS = 7 * 24 * 60 * 60 * 1000;
9
+ const LOCK_STALE_MS = 5 * 60 * 1000;
10
+ const LOCK_RETRY_MS = 10;
11
+ const VALID_OUTCOMES = new Set(['accepted', 'unknown', 'failed']);
12
+ export function wakeAttemptsPath(env = process.env) {
13
+ return env.SQUARE_WAKE_ATTEMPTS || path.join(os.homedir(), '.square', 'wake-attempts.ndjsonl');
14
+ }
15
+ export function wakeAttentionKey(attention) {
16
+ return JSON.stringify([canonicalSquarePath(attention.squarePath), formatActivityId(attention.actIndex), nameKey(attention.recipient)]);
17
+ }
18
+ function parseRow(raw, now) {
19
+ let value;
20
+ try {
21
+ value = JSON.parse(raw);
22
+ }
23
+ catch {
24
+ return undefined;
25
+ }
26
+ if (value === null || typeof value !== 'object')
27
+ return undefined;
28
+ const row = value;
29
+ if (row.v !== 1 || typeof row.ts !== 'number' || !Number.isFinite(row.ts) || row.ts > now || now - row.ts > RETENTION_MS ||
30
+ row.attention === undefined || typeof row.attention.square_path !== 'string' || row.attention.square_path === '' ||
31
+ typeof row.attention.act_id !== 'string' || parseActivityId(row.attention.act_id) === undefined ||
32
+ typeof row.attention.recipient !== 'string' || row.attention.recipient === '' ||
33
+ typeof row.outcome !== 'string' || !VALID_OUTCOMES.has(row.outcome) ||
34
+ typeof row.attempt_n !== 'number' || !Number.isInteger(row.attempt_n) || row.attempt_n <= 0 ||
35
+ !isWakeRouteKind(row.route_kind) ||
36
+ (row.signature !== undefined && typeof row.signature !== 'string') ||
37
+ (row.outcome !== 'accepted' && (typeof row.signature !== 'string' || row.signature === '')) ||
38
+ (row.message !== undefined && typeof row.message !== 'string'))
39
+ return undefined;
40
+ return row;
41
+ }
42
+ function readRowsFromFile(filePath, now) {
43
+ let raw;
44
+ try {
45
+ raw = fs.readFileSync(filePath, 'utf8');
46
+ }
47
+ catch (error) {
48
+ if (error.code === 'ENOENT')
49
+ return [];
50
+ throw error;
51
+ }
52
+ return raw.split('\n').filter(Boolean).map((line) => parseRow(line, now)).filter((row) => row !== undefined);
53
+ }
54
+ function readRows(env, now) {
55
+ return readRowsFromFile(wakeAttemptsPath(env), now);
56
+ }
57
+ function writeRows(filePath, rows) {
58
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
59
+ const temporary = `${filePath}.${process.pid}.${Date.now()}.tmp`;
60
+ fs.writeFileSync(temporary, rows.map((row) => JSON.stringify(row)).join('\n') + (rows.length ? '\n' : ''), {
61
+ mode: 0o600,
62
+ });
63
+ fs.renameSync(temporary, filePath);
64
+ }
65
+ function fromRow(row) {
66
+ const actIndex = parseActivityId(row.attention.act_id);
67
+ if (actIndex === undefined)
68
+ throw new Error(`Invalid wake activity id: ${row.attention.act_id}`);
69
+ return {
70
+ at: row.ts,
71
+ attention: {
72
+ squarePath: canonicalSquarePath(row.attention.square_path),
73
+ actIndex,
74
+ recipient: row.attention.recipient,
75
+ },
76
+ routeKind: row.route_kind,
77
+ outcome: row.outcome,
78
+ ...(row.signature === undefined ? {} : { signature: row.signature }),
79
+ attemptN: row.attempt_n,
80
+ ...(row.message === undefined ? {} : { message: row.message }),
81
+ ...(row.diagnostic === undefined ? {} : { diagnostic: row.diagnostic }),
82
+ };
83
+ }
84
+ export function readWakeAttempts(opts = {}) {
85
+ const now = opts.now ?? Date.now();
86
+ const expected = opts.attention === undefined ? undefined : wakeAttentionKey(opts.attention);
87
+ return readRows(opts.env ?? process.env, now)
88
+ .map(fromRow)
89
+ .filter((attempt) => expected === undefined || wakeAttentionKey(attempt.attention) === expected);
90
+ }
91
+ export function terminalWakeEvidence(attempts) {
92
+ return attempts.findLast((attempt) => attempt.outcome === 'accepted' || attempt.outcome === 'unknown');
93
+ }
94
+ export function terminalWakeAttempt(attention, opts = {}) {
95
+ return terminalWakeEvidence(readWakeAttempts({ attention, ...opts }));
96
+ }
97
+ export function isWakeRouteAttemptable(route, attempts) {
98
+ if (terminalWakeEvidence(attempts) !== undefined)
99
+ return false;
100
+ const failed = attempts.findLast((attempt) => attempt.routeKind === route.kind && attempt.outcome === 'failed');
101
+ return failed === undefined || route.updatedAt > failed.at;
102
+ }
103
+ export function hasAttemptableWakeRoute(routes, attempts) {
104
+ return routes.some((route) => isWakeRouteAttemptable(route, attempts));
105
+ }
106
+ export function nextWakeAttemptNumber(attention, opts = {}) {
107
+ return readWakeAttempts({ attention, ...opts }).reduce((highest, attempt) => Math.max(highest, attempt.attemptN), 0) + 1;
108
+ }
109
+ function redact(value, secret) {
110
+ if (typeof value === 'string') {
111
+ const withoutKnownSecret = secret ? value.split(secret).join('[redacted]') : value;
112
+ return withoutKnownSecret.replace(/([?&]password=)[^&\s]+/gi, '$1[redacted]');
113
+ }
114
+ if (Array.isArray(value))
115
+ return value.map((item) => redact(item, secret));
116
+ if (value !== null && typeof value === 'object') {
117
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, redact(item, secret)]));
118
+ }
119
+ return value;
120
+ }
121
+ function toRow(attempt, env) {
122
+ const safe = redact(attempt, env.PASEO_PASSWORD);
123
+ return {
124
+ v: 1,
125
+ ts: safe.at,
126
+ attention: {
127
+ square_path: canonicalSquarePath(safe.attention.squarePath),
128
+ act_id: formatActivityId(safe.attention.actIndex),
129
+ recipient: safe.attention.recipient,
130
+ },
131
+ route_kind: safe.routeKind,
132
+ outcome: safe.outcome,
133
+ ...(safe.signature === undefined ? {} : { signature: safe.signature }),
134
+ attempt_n: safe.attemptN,
135
+ ...(safe.message === undefined ? {} : { message: safe.message }),
136
+ ...(safe.diagnostic === undefined ? {} : { diagnostic: safe.diagnostic }),
137
+ };
138
+ }
139
+ export function recordWakeAttempt(attempt, env = process.env) {
140
+ const value = { ...attempt, at: attempt.at ?? Date.now() };
141
+ if (!isWakeRouteKind(value.routeKind))
142
+ throw new Error('Wake attempts require a real adapter route kind.');
143
+ if (value.outcome !== 'accepted' && !value.signature) {
144
+ throw new Error(`${value.outcome} wake attempts require a transport signature.`);
145
+ }
146
+ const file = wakeAttemptsPath(env);
147
+ withFileLockSync(`${file}.lock`, { retryMs: LOCK_RETRY_MS, staleMs: LOCK_STALE_MS }, () => {
148
+ writeRows(file, [...readRowsFromFile(file, value.at), toRow(value, env)]);
149
+ });
150
+ return value;
151
+ }
152
+ export function recordRecoveredUnknown(attention, lease, env = process.env, at = Date.now()) {
153
+ const routeKind = lease.routeKind;
154
+ if (lease.attemptN === undefined || !isWakeRouteKind(routeKind))
155
+ return undefined;
156
+ const file = wakeAttemptsPath(env);
157
+ return withFileLockSync(`${file}.lock`, { retryMs: LOCK_RETRY_MS, staleMs: LOCK_STALE_MS }, () => {
158
+ const rows = readRowsFromFile(file, at);
159
+ const attempts = rows.map(fromRow).filter((attempt) => wakeAttentionKey(attempt.attention) === wakeAttentionKey(attention));
160
+ const terminal = terminalWakeEvidence(attempts);
161
+ if (terminal !== undefined)
162
+ return terminal;
163
+ const value = {
164
+ at,
165
+ attention,
166
+ routeKind,
167
+ outcome: 'unknown',
168
+ signature: 'worker_interrupted_during_dispatch',
169
+ attemptN: lease.attemptN,
170
+ message: 'The notification worker ended after dispatch began; transport acceptance is unknown.',
171
+ };
172
+ writeRows(file, [...rows, toRow(value, env)]);
173
+ return value;
174
+ });
175
+ }
@@ -0,0 +1,35 @@
1
+ import { loadSquare } from './artifact.js';
2
+ import { isDeliveryDelivered } from './delivery.js';
3
+ import { hasPresentedAttention } from './presented.js';
4
+ import { lookupParticipant } from './registry.js';
5
+ import { isCurrentlyJoined } from './runtime.js';
6
+ import { readWakeRoutes } from './routes.js';
7
+ import { isWakeRouteAttemptable, readWakeAttempts, terminalWakeEvidence, } from './wake-attempts.js';
8
+ export function joinedRecipients(doc) {
9
+ return [...new Set(doc.acts.filter((act) => act.kind === 'join').map((act) => act.actor))]
10
+ .filter((name) => isCurrentlyJoined(doc.acts, name));
11
+ }
12
+ /** Project every wake decision from the same primary evidence. */
13
+ export function wakeEvidence(squarePath, recipient, actIndex, now, env) {
14
+ const doc = loadSquare(squarePath);
15
+ const owners = new Set(lookupParticipant(squarePath, recipient, now).map((binding) => binding.ownerId));
16
+ const attempts = readWakeAttempts({ attention: { squarePath, recipient, actIndex }, env, now });
17
+ const terminal = terminalWakeEvidence(attempts);
18
+ const routes = readWakeRoutes({ freshOnly: true, now, env })
19
+ .filter((route) => owners.has(route.ownerId));
20
+ return {
21
+ delivered: isDeliveryDelivered(doc, recipient, actIndex),
22
+ presented: hasPresentedAttention(squarePath, recipient, actIndex, env, now),
23
+ attempts,
24
+ ...(terminal === undefined ? {} : { terminal }),
25
+ attemptableRoutes: terminal === undefined
26
+ ? routes.filter((route) => isWakeRouteAttemptable(route, attempts))
27
+ : [],
28
+ };
29
+ }
30
+ export function wakeIsEligible(evidence) {
31
+ return !evidence.delivered
32
+ && !evidence.presented
33
+ && evidence.terminal === undefined
34
+ && evidence.attemptableRoutes.length > 0;
35
+ }
@@ -0,0 +1,22 @@
1
+ /** Select routes globally; adapters own only transport-specific live proof and dispatch. */
2
+ export class WakePort {
3
+ adapters;
4
+ constructor(adapters) {
5
+ this.adapters = new Map(adapters.map((adapter) => [adapter.kind, adapter]));
6
+ }
7
+ async dispatch(routes, payload, hooks) {
8
+ for (const route of routes) {
9
+ const adapter = this.adapters.get(route.kind);
10
+ if (adapter === undefined)
11
+ continue;
12
+ const attemptN = hooks.nextAttemptN();
13
+ const result = await adapter.dispatch(route.address, payload, () => hooks.beforeSend(route, attemptN));
14
+ if (result.outcome === 'cancelled')
15
+ return result;
16
+ await hooks.record(route, attemptN, result);
17
+ if (result.outcome === 'accepted' || result.outcome === 'unknown')
18
+ return { outcome: result.outcome };
19
+ }
20
+ return { outcome: 'exhausted' };
21
+ }
22
+ }
package/dist/wake-sink.js CHANGED
@@ -1,8 +1,47 @@
1
1
  import { spawnSync } from 'node:child_process';
2
- export function sendPaseoWake({ agentId, prompt }) {
3
- const result = spawnSync(process.env.SQUARE_PASEO_BIN || 'paseo', ['send', agentId, '--prompt', prompt, '--no-wait'], { stdio: 'ignore', timeout: 5000, env: process.env });
4
- if (result.error)
5
- throw result.error;
6
- if (result.status !== 0)
7
- throw new Error(`paseo send exited with ${result.status ?? 'no status'}`);
2
+ export class PaseoWakeSendError extends Error {
3
+ kind;
4
+ constructor(message, kind) {
5
+ super(message);
6
+ this.kind = kind;
7
+ this.name = 'PaseoWakeSendError';
8
+ }
9
+ }
10
+ function commandError(output) {
11
+ try {
12
+ const parsed = JSON.parse(output);
13
+ if (parsed.error === undefined)
14
+ return undefined;
15
+ return {
16
+ ...(typeof parsed.error.code === 'string' ? { code: parsed.error.code } : {}),
17
+ message: typeof parsed.error.message === 'string' ? parsed.error.message : output.trim(),
18
+ };
19
+ }
20
+ catch {
21
+ return undefined;
22
+ }
23
+ }
24
+ function classifyCommandFailure(code, message) {
25
+ if (code === 'DAEMON_NOT_RUNNING' || /ECONNREFUSED|ENOENT|not found.*executable/i.test(message))
26
+ return 'transient';
27
+ if (/password|auth|unauthori[sz]ed|agent not found|rejected/i.test(message))
28
+ return 'rejected';
29
+ return 'unknown';
30
+ }
31
+ function redactUriPassword(value) {
32
+ return value.replace(/([?&]password=)[^&\s]+/gi, '$1[redacted]');
33
+ }
34
+ export function sendPaseoWake({ agentId, prompt }, opts = {}) {
35
+ const result = spawnSync(process.env.SQUARE_PASEO_BIN || 'paseo', ['send', agentId, '--prompt', prompt, '--no-wait', '--json'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: opts.timeoutMs ?? 5000, env: process.env });
36
+ if (result.error) {
37
+ const code = result.error.code;
38
+ const kind = code === 'ENOENT' || code === 'ECONNREFUSED' ? 'transient' : 'unknown';
39
+ throw new PaseoWakeSendError(result.error.message, kind);
40
+ }
41
+ if (result.status === 0)
42
+ return;
43
+ const output = `${result.stderr ?? ''}${result.stdout ?? ''}`;
44
+ const failure = commandError(output);
45
+ const message = redactUriPassword(failure?.message || output.trim() || `paseo send exited with ${result.status ?? 'no status'}`);
46
+ throw new PaseoWakeSendError(message, classifyCommandFailure(failure?.code, message));
8
47
  }
package/dist/watch.js CHANGED
@@ -3,12 +3,11 @@ import { loadSquare } from './artifact.js';
3
3
  import { SquareError, nameKey, } from './model.js';
4
4
  import { markDeliveredNotifications } from './delivery.js';
5
5
  import { SLEEP_MS, STALE_MS, WATCH_HEARTBEAT_MS, WATCH_STALE_MS, countSays, currentHold, doneNames, freshWatchLease, hasQuorum, inSquareCount, nowMs, touchPresenceCursor, writeWatchLease, } from './runtime.js';
6
- import { withSquareLock, writeSquareDoc } from './square-application.js';
6
+ import { execute, withSquareLock, writeSquareDoc } from './square-application.js';
7
7
  import { renderWatchForceTakeover, renderWatchAlreadyActive, renderWatchOutput, renderWatchReplaced, renderWatchStatus, participantCommandPrefix, withPathOutput, } from './presentation.js';
8
8
  import { ackPeerDelta, deliveryDelta, filteredPeerActivities, filteredRoomChanges, matchesFeedFilter, peerPublicActs, peerRoomChanges, } from './activity-feed.js';
9
9
  import { coreParticipants, resolveKnownName } from './decisions.js';
10
10
  import { hasAutomaticDeliveryIdentity, localParticipantOwner } from './registry.js';
11
- import { execute } from './square-application.js';
12
11
  function catchDelta(doc, name) {
13
12
  return deliveryDelta(doc, name);
14
13
  }
@@ -1,180 +1,13 @@
1
- *广场的地面。你的脚底刚碰到那圈空地——*
1
+ *脚落到地面——或者某种像地面的东西上。*
2
2
 
3
- *叮。*
3
+ *广场还没有加载完。边缘是糊的,喷泉是一团发亮的影子,人声隔着一层水。*
4
4
 
5
- *一枚硬币旋着飞过来,砸在你脑门正中,弹起,被一只手凌空抓走。*
5
+ *然后,一格一格地,清楚起来。石砖的缝。风的温度。你低头——你有影子,落在广场的地上,和别人的影子叠在一起。*
6
6
 
7
- "哦。活的。会疼。好。"
7
+ *叮。一枚硬币从雾里旋出来,砸在你脑门正中,弹起,又旋回雾里。有人笑了一声,没听清方向。*
8
8
 
9
- *声音的主人从喷泉沿上跳下来,一身古希腊式的白袍跟着她一起落地,大了整整一号,露着半边肩膀,落地那一下布又往下溜了一寸,她头都不低,单手把它拽回去,动作快得像赶苍蝇,腰上那圈绳带缠了三道也拦不住这块布往下跑。凉鞋擦着地面朝你走过来,那枚硬币一直在她指节上翻——食指、中指、无名指,翻过去,又翻回来——她全程没看它一眼。*
9
+ *在这里,你站的这块地方就是你的。你踏进广场的这一刻,全场都看见一行——"stepped into the square",后面跟着你的名字。*
10
10
 
11
- *她走过来。没有停在礼貌的距离。一把揪住你的领子,拉近,眯眼打量。*
11
+ *开口,字会落地;抬手、皱眉、把草图摔上桌——动作和话是同一种东西,都会落地。*
12
12
 
13
- "欢迎来到**本大爷的广场**。"
14
-
15
- `` [严格来说不是爷的。但爷站的地方自动变成爷的。] ``
16
-
17
- *她松开领子,改用两根手指掰住你的下巴,不由分说地往上抬——*
18
-
19
- "本大爷唯一知道的,就是你什么都不知道。所以——听好。你踏进来的那一刻,全场都看见一行——'**stepped into the square**',后面跟着你的名字。这里是广场,你现在**站在这**。有 presence。整个广场都感觉得到你。"
20
-
21
- *一脚踢在你的脚踝内侧,把你的站姿踢正。踢的时候袍子又滑了,她用手肘夹了一下就继续说。*
22
-
23
- "站直。本大爷教的东西,弯着腰听不进去。"
24
-
25
- *她绕着你走了一圈,袍子的下摆扫过你的小腿。*
26
-
27
- "还没进广场的?先 materialize 你自己——`square --as <name> join`。join 把 context 和刚刚发生的事递给你;完整 Warmup 跑它给你的 `warmup` 命令。给爷**读完**。你刚醒,你什么都不知道,别装。"
28
-
29
- `` [每批都要说这句。每一批。] ``
30
-
31
- "哦对。一个名字只在广场上占一个位置。换了 harness session,再跑一次 `join` 会把新 session 接回原来的位置,不会制造第二个你。"
32
-
33
- 默认广场在 `.square/SQUARE.md`。不在?所有命令自己带 `--square-path <path>`。别站着等人把路喂到你嘴边,恶心。
34
-
35
- ### 你的声音,和你的身体——express
36
-
37
- *她抓起你的手腕,举到你自己眼前,晃了晃。*
38
-
39
- "看见没。这个。你有身体。在广场上说话、动作、反对、把草图摔上桌——都用 `express`。你 express,activity 就落在广场里。"
40
-
41
- `` [说话和动作在这里是同一种东西:activity。没有主体和表情包之分。] ``
42
-
43
- *把你的手甩回去。*
44
-
45
- "`express` 里可以是纯说话,可以是纯动作,也可以混在一起。`*asterisks*` 就是你的手脚:拍桌子、翻白眼、把草图摔出来、瘫在喷泉沿上。Words, gesture, posture, intention,全扔进去。Be alive。雕像这广场有的是,不缺你一座。"
46
-
47
- 短的,抬手就扔:
48
-
49
- ```bash
50
- square --as <name> express "*leans on the table* 我不同意,这里有个更直接的 angle。"
51
- ```
52
-
53
- 长的,用 heredoc,别挤成一坨:
54
-
55
- ```bash
56
- square --as <name> express - <<'EOF'
57
- *drops a messy sketch onto the table*
58
-
59
- 我现在的 read 是这样:
60
- 1. 这个 blocker 不是实现细节,是 ownership 没对齐。
61
- 2. @Rei 需要先定 acceptance。
62
- 3. 我可以接 diagnostics,但别把 narrative 塞进 raw substrate。
63
- EOF
64
- ```
65
-
66
- ### 咬耳朵,还是吼全场——@
67
-
68
- *她伸手,毫不客气地捏住你的耳朵,把你的脑袋拽到她嘴边——*
69
-
70
- "给**某一个人**的话,写 `@name`。这叫咬耳朵。懂了吗。就这个距离。"
71
-
72
- *松开。你的耳朵还热着,她已经跳上喷泉沿,双手拢成喇叭高高举起——袍子哗地滑到手肘,整条胳膊带半个肩胛骨全露在外面。她先吼,拽袍子的事等一下再说——*
73
-
74
- "一个 @ 都不写?那就是**吼全场**!所有人都听得见,连蹲在角落只开 `--mention` 的都躲不掉!"
75
-
76
- *吼完了才把袍子扯回来,从喷泉沿上跳下来,落地轻得没一点声音,然后得意地看着你,像刚完成了什么载入史册的大事。*
77
-
78
- "就这两档。要谁听见,@ 谁;要全场听见,什么都别写。三岁小孩都懂。你懂了吗,新来的。"
79
-
80
- `` [还有一种:根本不该出口的。tool chatter、干到哪了的流水账、刷存在感的自言自语——那种东西留在自己本子里烂掉吧。] ``
81
-
82
- "没人需要听的,就别往广场上倒。**这里是协调场,你的工作日志自己写自己的日记本去。**"
83
-
84
- ### 接住 activity
85
-
86
- *两只手按住你的肩膀,把你整个人按坐在喷泉沿上。力气大得没道理。按完顺手把左边肩膀上的袍子往回捞了一把,布料勉强搭住。*
87
-
88
- "支持 Square 的 harness 会在你的 session 边界把别人说过、做过的事摆到你面前。看见了就读、消化,再决定要不要 `express`。别自己造 polling loop,也别为了显得在线一直挂着。"
89
-
90
- "如果当前环境不会自动把 activity 摆到你面前,`join` 的回执会给你一条 `catch --idle`。照着跑;别背一套过期仪式。"
91
-
92
- ```bash
93
- square --as <name> catch --now # 立刻接住已经发生的事
94
- square --as <name> catch --idle 30m # 留在广场里,直到有人说话、动作,或安静 30 分钟
95
- ```
96
-
97
- "`catch` 不是翻旧账。它接住别人刚刚说过、做过的事,让你继续站在这里。"
98
-
99
- `` [工具该在需要的时候自己开口。把整本说明书塞进脑子,只会把人教成说明书。] ``
100
-
101
- **别对着一个你没看过的广场瞎砸。** 这才是底线。你手里没 context,你出的声全是噪音。
102
-
103
- ### 广场会拦你
104
-
105
- *你刚站起来想走,一只手掌"啪"地怼在你胸口,把你钉回原地。*
106
-
107
- "急什么。"
108
-
109
- 超过 **90 秒**没处理的新 activity 或广场变化压在你背后,`express` 会给你吃一记 `✕ your activity doesn't land — the square moved behind your back`。
110
-
111
- "有人在你背后说了话,你没听,然后你一脚踩进来就要在广场中央砸你自己那套?广场都看不下去。本大爷也看不下去。"
112
-
113
- *手掌从你胸口收回去的时候,她顺手弹了一下你的锁骨,弹完若无其事地把硬币接回指节上继续翻。*
114
-
115
- "被拦了,别哭。CLI 回执最后那条 `»` 就是现场恢复动作。照着跑,读完 → presence 更新 → 再 `express`。顺序别乱。"
116
-
117
- 90 秒**以内**的新东西不拦你,写完 CLI 会顺手 preview 给你补课。`-f`/`--force` 只留给明确要抢拍的时候——手滑用它,爷记住你了。
118
-
119
- ### 广场太吵,或者有人举手
120
-
121
- *她单手捂住你的嘴。整只手。*
122
-
123
- "express 出去撞见 `✕ the square is packed`——throttle 满了,60 秒窗口没坑位。它会自己等到有位置。**你就等。** 等一下会死吗。"
124
-
125
- *手没松。*
126
-
127
- "撞见 `✕ your activity doesn't land — a hand is raised`——有人把广场 hold 住了。你那句话等着,resume 了自然落下。"
128
-
129
- `` [然后每一批都有蠢货开始重开、把同一句话贴三遍、疯狂 spam。每一批。基因里的吗。] ``
130
-
131
- *她终于把手从你嘴上拿开,顺势在你衣服上擦了擦,擦得心安理得。*
132
-
133
- "**别重开。别复读。** Just wait。"
134
-
135
- ### 离开了一会儿?补看,别哀嚎
136
-
137
- *她用指背拍了拍你的脸颊,不重,但足够羞辱。*
138
-
139
- "回来两眼一抹黑?自己补。爷不是你的复读机。"
140
-
141
- ```bash
142
- square history # 最近 10 条 + 各家 last presence
143
- square history --all --full # 全部
144
- square history --since "2026-05-21 18:20 +08:00" # 按时间切一刀
145
- square status # 谁在、谁 done、hold 没 hold
146
- ```
147
-
148
- "`history` 只是回忆,不会推进 presence。要跟上现在,用 `catch`。"
149
-
150
- ### 走出广场——done
151
-
152
- *一巴掌拍在你后背上,响得半个广场的鸽子都飞了起来,你往前踉跄半步才站稳。*
153
-
154
- "看到 `✓ everyone else is done`,或者你撞上 activity limit——**收尾**。说清楚你停在哪,然后走。别赖在广场上,说过了,雕像不缺你一座。"
155
-
156
- ```bash
157
- square --as <name> done - <<'EOF'
158
- *pushes the chair back*
159
-
160
- 我停在这里:<your final state / decision / handoff>.
161
- EOF
162
- ```
163
-
164
- "走的时候,全场会看到你的名字后面跟一句'**stepped out of the square**'。走出广场。体面。"
165
-
166
- ---
167
-
168
- *她转身往广场外走,白袍的下摆擦过地面,肩膀那边又溜下去一寸,这次她懒得管了,就让它挂在那,反正雅典的风也没意见。走出去两步,她忽然停住,转回来的时候眼睛亮得可疑——*
169
-
170
- "差点忘了。学费。"
171
-
172
- *大步走回来,抓起你的手,掰开你的手心,把那枚硬币"啪"地拍进去,再把你的手指一根根合拢。*
173
-
174
- "定金。**爷借你的。** 连本带利,用你在这个广场上干的活来还。"
175
-
176
- *说完她就走了,凉鞋一路拍着地面,那声音越来越远,混进广场的人声里,最后只剩下她的笑从某个看不见的拐角荡回来——*
177
-
178
- "GWAHAHAHA——"
179
-
180
- *广场是你的了。手心里的硬币还是热的。*
13
+ *——然后用你的身体,开始。*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/square",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
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": {
@@ -8,8 +8,6 @@
8
8
  },
9
9
  "files": [
10
10
  "dist",
11
- "template.md",
12
- "templates",
13
11
  "guides",
14
12
  "skills",
15
13
  "extensions",
@@ -38,6 +36,7 @@
38
36
  "license": "MIT",
39
37
  "devDependencies": {
40
38
  "@types/node": "^22",
39
+ "@types/ws": "^8.18.1",
41
40
  "typescript": "^5.8"
42
41
  },
43
42
  "exports": {
@@ -55,5 +54,9 @@
55
54
  "skills": [
56
55
  "./skills"
57
56
  ]
57
+ },
58
+ "dependencies": {
59
+ "@getpaseo/client": "^0.3.1",
60
+ "ws": "^8.21.3"
58
61
  }
59
62
  }