@astrosheep/square 0.3.5 → 0.3.7

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 (57) hide show
  1. package/codex-plugin/.codex-plugin/plugin.json +3 -2
  2. package/codex-plugin/hooks/hooks.json +3 -14
  3. package/dist/activity-feed.js +26 -18
  4. package/dist/activity.js +10 -10
  5. package/dist/artifact.js +138 -203
  6. package/dist/boundary-presentation.js +77 -0
  7. package/dist/claude-hook.js +4 -94
  8. package/dist/cli/context.js +7 -7
  9. package/dist/cli/maintenance-commands.js +10 -26
  10. package/dist/cli/meta-commands.js +3 -6
  11. package/dist/cli/observation-commands.js +48 -53
  12. package/dist/cli/program.js +4 -4
  13. package/dist/cli/registry.js +5 -5
  14. package/dist/cli/square-commands.js +27 -20
  15. package/dist/cmd/notify-once.js +23 -21
  16. package/dist/codex-hook.js +22 -0
  17. package/dist/compact.js +1 -1
  18. package/dist/decisions.js +61 -88
  19. package/dist/delivery-health.js +104 -210
  20. package/dist/delivery.js +68 -18
  21. package/dist/doctor.js +9 -8
  22. package/dist/harness-claude.js +38 -245
  23. package/dist/harness-codex.js +82 -616
  24. package/dist/harness-stage.js +36 -0
  25. package/dist/harness.js +3 -5
  26. package/dist/help.js +43 -35
  27. package/dist/inbox.js +12 -11
  28. package/dist/index.js +10 -121
  29. package/dist/list.js +1 -1
  30. package/dist/model.js +0 -6
  31. package/dist/notification-failures.js +54 -0
  32. package/dist/notifications.js +47 -62
  33. package/dist/paseo-delivery.js +160 -0
  34. package/dist/paseo-state.js +31 -0
  35. package/dist/paseo-timeline.js +58 -188
  36. package/dist/presentation.js +57 -64
  37. package/dist/presented.js +9 -8
  38. package/dist/registry.js +55 -45
  39. package/dist/runtime.js +27 -84
  40. package/dist/square-application.js +135 -130
  41. package/dist/square-core.js +3 -11
  42. package/dist/stream.js +27 -126
  43. package/dist/wake-sink.js +3 -214
  44. package/dist/watch.js +65 -122
  45. package/extensions/square-opencode.js +8 -73
  46. package/extensions/square-pi.js +8 -132
  47. package/guides/architect.md +3 -3
  48. package/guides/participant.md +25 -16
  49. package/package.json +2 -2
  50. package/skills/brainstorm/SKILL.md +25 -32
  51. package/skills/square/.claude-plugin/plugin.json +1 -1
  52. package/skills/square/SKILL.md +39 -107
  53. package/skills/square/hooks/hooks.json +2 -13
  54. package/skills/square-feedback/SKILL.md +4 -4
  55. package/dist/harness-lifecycle.js +0 -102
  56. package/dist/square-store.js +0 -111
  57. package/dist/terminal.js +0 -125
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "square",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Shared Square activity with reliable participant attention at Codex boundaries.",
5
5
  "author": {
6
6
  "name": "Square"
@@ -15,7 +15,8 @@
15
15
  "interface": {
16
16
  "displayName": "Square",
17
17
  "shortDescription": "Join and coordinate through a shared square",
18
- "longDescription": "Participate in a shared activity stream and receive addressed Square activity at Codex boundaries.",
18
+ "longDescription": "Participate in a shared square and receive addressed activity at Codex boundaries.",
19
+ "defaultPrompt": "Use Square to join other agents, catch their activity, express in words or embodied action, and step out when done.",
19
20
  "developerName": "Square",
20
21
  "category": "Developer Tools",
21
22
  "capabilities": [
@@ -1,25 +1,14 @@
1
1
  {
2
2
  "hooks": {
3
- "UserPromptSubmit": [
3
+ "PostToolUse": [
4
4
  {
5
5
  "hooks": [
6
6
  {
7
7
  "type": "command",
8
8
  "command": "square codex-hook",
9
9
  "timeout": 5,
10
- "statusMessage": "square-codex-hook"
11
- }
12
- ]
13
- }
14
- ],
15
- "Stop": [
16
- {
17
- "hooks": [
18
- {
19
- "type": "command",
20
- "command": "square codex-hook",
21
- "timeout": 5,
22
- "statusMessage": "square-codex-hook"
10
+ "statusMessage": "square-codex-hook",
11
+ "additionalContextLimit": 1200
23
12
  }
24
13
  ]
25
14
  }
@@ -1,36 +1,44 @@
1
1
  import { sameName } from './model.js';
2
- import { actStableIndex, advanceCursor, latestIndexedActIndex } from './runtime.js';
3
- import { matchesCatchFilter } from './delivery.js';
4
- export function indexedDelta(acts, cursor) {
5
- return acts
6
- .map((act) => ({ act, index: actStableIndex(act) }))
7
- .filter((item) => item.index > cursor);
2
+ import { advanceCursor, latestActIndex, readCursor } from './runtime.js';
3
+ import { deriveDeliveryModel, matchesCatchFilter } from './delivery.js';
4
+ export function actDelta(acts, cursor) {
5
+ return acts.filter((act) => act.index > cursor);
6
+ }
7
+ /** Public cursor changes plus directed receipts that remain pending behind it. */
8
+ export function deliveryDelta(doc, name) {
9
+ const items = actDelta(doc.acts, readCursor(doc, name));
10
+ const seen = new Set(items.map((act) => act.index));
11
+ for (const notification of deriveDeliveryModel(doc).pendingFor(name)) {
12
+ if (!seen.has(notification.item.index))
13
+ items.push(notification.item);
14
+ }
15
+ return items.sort((a, b) => a.index - b.index);
8
16
  }
9
17
  export function peerRoomChanges(delta, name) {
10
- return delta.filter((item) => item.act.actor !== undefined && !sameName(item.act.actor, name) && item.act.kind !== 'say' && item.act.kind !== 'read');
18
+ return delta.filter((act) => act.actor !== undefined && !sameName(act.actor, name) && act.kind !== 'say' && act.kind !== 'read');
11
19
  }
12
20
  export function peerPublicActs(delta, name) {
13
- return delta.filter((item) => item.act.actor !== undefined && !sameName(item.act.actor, name) && (item.act.kind === 'say' || item.act.kind === 'done'));
21
+ return delta.filter((act) => act.actor !== undefined && !sameName(act.actor, name) && (act.kind === 'say' || act.kind === 'done'));
14
22
  }
15
- function matchesParticipants(item, participants) {
16
- return participants === undefined || (item.act.actor !== undefined && participants.some((participant) => sameName(participant, item.act.actor)));
23
+ function matchesParticipants(act, participants) {
24
+ return participants === undefined || (act.actor !== undefined && participants.some((participant) => sameName(participant, act.actor)));
17
25
  }
18
- export function matchesFeedFilter(item, filter) {
19
- if (item.act.kind === 'say') {
20
- return matchesCatchFilter({ actor: item.act.actor, body: item.act.body, bell: item.act.reach === 'bell' }, filter);
26
+ export function matchesFeedFilter(act, filter) {
27
+ if (act.kind === 'say') {
28
+ return matchesCatchFilter({ actor: act.actor, body: act.body, reach: act.reach }, filter);
21
29
  }
22
- return filter.mention === undefined && matchesParticipants(item, filter.participants);
30
+ return filter.mention === undefined && matchesParticipants(act, filter.participants);
23
31
  }
24
32
  export function filteredPeerActivities(delta, name, filter) {
25
33
  return peerPublicActs(delta, name)
26
- .filter((item) => item.act.kind === 'say')
27
- .filter((item) => matchesFeedFilter(item, filter));
34
+ .filter((act) => act.kind === 'say')
35
+ .filter((act) => matchesFeedFilter(act, filter));
28
36
  }
29
37
  export function filteredRoomChanges(delta, name, filter) {
30
38
  if (filter.mention !== undefined)
31
39
  return [];
32
- return peerRoomChanges(delta, name).filter((item) => matchesParticipants(item, filter.participants));
40
+ return peerRoomChanges(delta, name).filter((act) => matchesParticipants(act, filter.participants));
33
41
  }
34
42
  export function ackPeerDelta(doc, name, delta) {
35
- return advanceCursor(doc, name, latestIndexedActIndex([...peerPublicActs(delta, name), ...peerRoomChanges(delta, name)]), 'watch');
43
+ return advanceCursor(doc, name, latestActIndex([...peerPublicActs(delta, name), ...peerRoomChanges(delta, name)]));
36
44
  }
package/dist/activity.js CHANGED
@@ -4,7 +4,7 @@ import path from 'node:path';
4
4
  import { setTimeout as sleep } from 'node:timers/promises';
5
5
  import { loadSquare } from './artifact.js';
6
6
  import { SquareError, validateName } from './model.js';
7
- import { actHintLine, renderActivityBlocked, renderActivityLimit, renderActNoWait, renderActWaiting, renderPendingFeed, withActivityNextOutput, } from './presentation.js';
7
+ import { expressHintLine, renderActivityBlocked, renderActivityLimit, renderExpressNoWait, renderExpressWaiting, renderPendingFeed, withPathOutput, } from './presentation.js';
8
8
  import { currentHold, inSquareCount, nowMs, SLEEP_MS, resolveRosterName } from './runtime.js';
9
9
  import { resolveKnownName } from './decisions.js';
10
10
  import { execute } from './square-application.js';
@@ -75,19 +75,19 @@ export async function cmdActivity(squarePath, name, activity, resolveBody, opts)
75
75
  force,
76
76
  now: nowMs(),
77
77
  ...(reach === undefined ? {} : { reach }),
78
+ ...(opts.reply === undefined ? {} : { reply: opts.reply }),
78
79
  });
79
80
  const decision = committed.result;
80
- const sent = committed.acts[0];
81
81
  const freshDoc = loadSquare(squarePath);
82
82
  const headerCount = inSquareCount(freshDoc);
83
83
  const held = currentHold(freshDoc.acts).active;
84
84
  switch (decision.type) {
85
85
  case 'sent': {
86
86
  const hasPending = decision.pendingPublic.length > 0 || decision.pendingRoomChanges.length > 0;
87
- const pending = hasPending ? `\n\n${renderPendingFeed(decision.pendingPublic, decision.pendingRoomChanges)}` : '';
88
- const hint = actHintLine(decision.ownActCount);
87
+ const pending = hasPending ? `\n\n${renderPendingFeed(freshDoc.acts, decision.pendingPublic, decision.pendingRoomChanges)}` : '';
88
+ const hint = expressHintLine(decision.ownActCount);
89
89
  const withHint = hint ? `${decision.confirmation}\n${hint}` : decision.confirmation;
90
- process.stdout.write(withActivityNextOutput(squarePath, withHint + pending, { participantCount: headerCount, held }));
90
+ process.stdout.write(withPathOutput(squarePath, withHint + pending, { participantCount: headerCount, held }));
91
91
  return;
92
92
  }
93
93
  case 'blocked': {
@@ -121,11 +121,11 @@ export async function cmdActivity(squarePath, name, activity, resolveBody, opts)
121
121
  case 'throttled': {
122
122
  if (noWait) {
123
123
  const draftPath = saveActivityDraft(squarePath, name, rawInput);
124
- process.stdout.write(renderActNoWait({ squarePath, name: knownName, reason: 'throttled', delayMs: decision.delayMs, draftPath, participantCount: headerCount, held }));
124
+ process.stdout.write(renderExpressNoWait({ squarePath, name: knownName, reason: 'throttled', delayMs: decision.delayMs, draftPath, participantCount: headerCount, held }));
125
125
  process.exit(1);
126
126
  }
127
127
  if (announcedWait !== 'throttled') {
128
- process.stdout.write(renderActWaiting({ reason: 'throttled', delayMs: decision.delayMs }) + '\n');
128
+ process.stdout.write(renderExpressWaiting({ reason: 'throttled', delayMs: decision.delayMs }) + '\n');
129
129
  announcedWait = 'throttled';
130
130
  }
131
131
  await sleep(decision.delayMs);
@@ -134,18 +134,18 @@ export async function cmdActivity(squarePath, name, activity, resolveBody, opts)
134
134
  case 'held': {
135
135
  if (noWait) {
136
136
  const draftPath = saveActivityDraft(squarePath, name, rawInput);
137
- process.stdout.write(renderActNoWait({ squarePath, name: knownName, reason: 'held', holdReason: decision.reason, draftPath, participantCount: headerCount, held }));
137
+ process.stdout.write(renderExpressNoWait({ squarePath, name: knownName, reason: 'held', holdReason: decision.reason, draftPath, participantCount: headerCount, held }));
138
138
  process.exit(1);
139
139
  }
140
140
  if (announcedWait !== 'held') {
141
- process.stdout.write(renderActWaiting({ reason: 'held' }) + '\n');
141
+ process.stdout.write(renderExpressWaiting({ reason: 'held' }) + '\n');
142
142
  announcedWait = 'held';
143
143
  }
144
144
  await sleep(SLEEP_MS);
145
145
  break;
146
146
  }
147
147
  case 'bell_quota': {
148
- process.stdout.write(withActivityNextOutput(squarePath, [`✕ the bell stays quiet for now`, ` · you can ring it again at ${formatTimestamp(decision.nextAt)}`].join('\n'), { participantCount: headerCount, held }));
148
+ process.stdout.write(withPathOutput(squarePath, [`✕ the bell stays quiet for now`, ` · you can ring it again at ${formatTimestamp(decision.nextAt)}`].join('\n'), { participantCount: headerCount, held }));
149
149
  process.exit(1);
150
150
  }
151
151
  }