@astrosheep/square 0.3.42 → 0.3.43
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/attention-presentation.d.ts +1 -1
- package/dist/attention-presentation.js +1 -1
- package/dist/automatic-session.js +38 -23
- package/dist/boundary-presentation.js +1 -1
- package/dist/codex-boundary-state.js +2 -2
- package/dist/delivery-operations.d.ts +2 -2
- package/dist/delivery-operations.js +144 -45
- package/dist/file-lock.d.ts +5 -1
- package/dist/file-lock.js +16 -91
- package/dist/host-ledger-file-adapter.d.ts +6 -2
- package/dist/host-ledger-file-adapter.js +42 -23
- package/dist/host-ledger.d.ts +13 -3
- package/dist/notifications.js +32 -3
- package/dist/participant-identity.js +1 -1
- package/dist/ports.d.ts +5 -2
- package/dist/presentation-operations.js +8 -6
- package/dist/registry.d.ts +40 -2
- package/dist/registry.js +142 -5
- package/dist/routes.d.ts +15 -3
- package/dist/routes.js +72 -12
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.js +0 -1
- package/dist/square-actions.d.ts +7 -4
- package/dist/square-actions.js +240 -40
- package/dist/square-facade.d.ts +4 -0
- package/dist/square-projections.d.ts +7 -0
- package/dist/square-projections.js +17 -4
- package/dist/square-storage.js +59 -13
- package/dist/square-wiring.d.ts +2 -1
- package/dist/square-wiring.js +3 -2
- package/dist/state-cell.d.ts +4 -1
- package/dist/wake-attempts.js +8 -2
- package/extensions/square-pi.js +7 -0
- package/package.json +1 -1
package/dist/wake-attempts.js
CHANGED
|
@@ -64,7 +64,10 @@ export async function recordWakeAttempt(attempt, env = process.env) {
|
|
|
64
64
|
throw new Error(`${value.outcome} wake attempts require a transport signature.`);
|
|
65
65
|
}
|
|
66
66
|
const safe = redact(value, env.PASEO_PASSWORD);
|
|
67
|
-
|
|
67
|
+
const session = safe.session ?? safe.signature ?? `route:${safe.routeKind}`;
|
|
68
|
+
const claim = await ledger(env).claimEvidence({ location: safe.attention.squarePath, participant: safe.attention.recipient, session, activity: formatActivityId(safe.attention.actIndex), kind: 'wake', leaseMs: 5000 });
|
|
69
|
+
if (claim.status === 'acquired')
|
|
70
|
+
await ledger(env).appendWakeAttempt({ location: safe.attention.squarePath, participant: safe.attention.recipient, session, activity: formatActivityId(safe.attention.actIndex), kind: 'wake', outcome: safe.outcome, routeKind: safe.routeKind, signature: safe.signature, attemptN: safe.attemptN, message: safe.message, diagnostic: safe.diagnostic, at: safe.at, claimToken: claim.claimToken });
|
|
68
71
|
return value;
|
|
69
72
|
}
|
|
70
73
|
export async function recordRecoveredUnknown(attention, lease, env = process.env, at = Date.now()) {
|
|
@@ -94,7 +97,10 @@ export async function recordRecoveredUnknown(attention, lease, env = process.env
|
|
|
94
97
|
attemptN: lease.attemptN,
|
|
95
98
|
message: 'The notification worker ended after dispatch began; transport acceptance is unknown.',
|
|
96
99
|
};
|
|
97
|
-
|
|
100
|
+
const session = lease.session ?? value.signature;
|
|
101
|
+
const claim = await ledger(env).claimEvidence({ location: attention.squarePath, participant: attention.recipient, session, activity: formatActivityId(attention.actIndex), kind: 'wake', leaseMs: 5000 });
|
|
102
|
+
if (claim.status === 'acquired')
|
|
103
|
+
await ledger(env).appendWakeAttempt({ location: attention.squarePath, participant: attention.recipient, session, activity: formatActivityId(attention.actIndex), kind: 'wake', outcome: 'unknown', routeKind, signature: value.signature, attemptN: value.attemptN, message: value.message, at, claimToken: claim.claimToken });
|
|
98
104
|
return value;
|
|
99
105
|
}
|
|
100
106
|
}
|
package/extensions/square-pi.js
CHANGED
|
@@ -34,6 +34,7 @@ export default function squarePiExtension(pi) {
|
|
|
34
34
|
let sessionId;
|
|
35
35
|
let sessionCwd;
|
|
36
36
|
let joiningContext;
|
|
37
|
+
let previousSessionId;
|
|
37
38
|
let watcher;
|
|
38
39
|
let watcherAbort;
|
|
39
40
|
let generation = 0;
|
|
@@ -196,6 +197,8 @@ export default function squarePiExtension(pi) {
|
|
|
196
197
|
retryWait = undefined;
|
|
197
198
|
sessionId = ctx.sessionManager.getSessionId();
|
|
198
199
|
sessionCwd = ctx.cwd || process.cwd();
|
|
200
|
+
previousSessionId = process.env.SQUARE_PI_SESSION_ID;
|
|
201
|
+
process.env.SQUARE_PI_SESSION_ID = sessionId;
|
|
199
202
|
joiningContext = undefined;
|
|
200
203
|
void automaticSessionStart('pi', sessionId, sessionCwd).catch(() => undefined);
|
|
201
204
|
watcherAbort = new AbortController();
|
|
@@ -230,6 +233,10 @@ export default function squarePiExtension(pi) {
|
|
|
230
233
|
for (const waiter of settledWaiters) waiter.resolve();
|
|
231
234
|
settledWaiters = [];
|
|
232
235
|
if (sessionId && sessionCwd) void automaticSessionEnd('pi', sessionId, sessionCwd).catch(() => undefined);
|
|
236
|
+
if (process.env.SQUARE_PI_SESSION_ID === sessionId) {
|
|
237
|
+
if (previousSessionId === undefined) delete process.env.SQUARE_PI_SESSION_ID;
|
|
238
|
+
else process.env.SQUARE_PI_SESSION_ID = previousSessionId;
|
|
239
|
+
}
|
|
233
240
|
sessionId = undefined;
|
|
234
241
|
sessionCwd = undefined;
|
|
235
242
|
joiningContext = undefined;
|