@astrosheep/square 0.3.106 → 0.4.1
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/activity-feed.js +1 -1
- package/dist/artifact-store.d.ts +41 -0
- package/dist/artifact-store.js +272 -0
- package/dist/artifact.d.ts +6 -12
- package/dist/artifact.js +43 -344
- package/dist/attention-presentation.d.ts +13 -7
- package/dist/attention-presentation.js +29 -68
- package/dist/boundary-presentation.d.ts +3 -16
- package/dist/boundary-presentation.js +29 -109
- package/dist/card-presentation.d.ts +1 -0
- package/dist/card-presentation.js +2 -0
- package/dist/catch-decisions.d.ts +2 -2
- package/dist/catch-decisions.js +7 -3
- package/dist/catch-selection.d.ts +8 -0
- package/dist/catch-selection.js +5 -0
- package/dist/claude-delivery.d.ts +14 -12
- package/dist/claude-delivery.js +42 -142
- package/dist/claude-mcp-context.js +2 -2
- package/dist/claude-mod.js +28 -140
- package/dist/claude-transport.d.ts +5 -0
- package/dist/claude-transport.js +34 -0
- package/dist/cli/context.d.ts +2 -2
- package/dist/cli/context.js +7 -10
- package/dist/cli/maintenance-commands.d.ts +0 -4
- package/dist/cli/maintenance-commands.js +2 -29
- package/dist/cli/observation-commands.d.ts +2 -0
- package/dist/cli/observation-commands.js +12 -2
- package/dist/cli/program.js +1 -1
- package/dist/cli/registry.js +4 -3
- package/dist/codex-address.d.ts +2 -2
- package/dist/codex-boundary-state.d.ts +1 -5
- package/dist/codex-boundary-state.js +0 -4
- package/dist/codex-hook.d.ts +7 -10
- package/dist/codex-hook.js +69 -33
- package/dist/codex-queue.d.ts +10 -11
- package/dist/codex-queue.js +32 -34
- package/dist/codex-watch.d.ts +2 -0
- package/dist/codex-watch.js +100 -0
- package/dist/decisions.js +3 -3
- package/dist/delivery-deferral.d.ts +1 -19
- package/dist/delivery-deferral.js +1 -29
- package/dist/delivery-frame.d.ts +7 -0
- package/dist/delivery-frame.js +11 -0
- package/dist/delivery-ledger-sqlite.d.ts +97 -0
- package/dist/delivery-ledger-sqlite.js +496 -0
- package/dist/delivery-ledger.d.ts +196 -0
- package/dist/delivery-ledger.js +268 -0
- package/dist/delivery-lifetime.d.ts +6 -0
- package/dist/delivery-lifetime.js +45 -0
- package/dist/harness-links.js +61 -7
- package/dist/harness.js +12 -17
- package/dist/help.js +3 -6
- package/dist/http-delivery.d.ts +5 -9
- package/dist/http-delivery.js +20 -79
- package/dist/inbox.d.ts +6 -57
- package/dist/inbox.js +24 -380
- package/dist/index.d.ts +7 -4
- package/dist/index.js +5 -2
- package/dist/mcp.d.ts +2 -1
- package/dist/mcp.js +40 -70
- package/dist/message.d.ts +7 -0
- package/dist/message.js +23 -0
- package/dist/model.d.ts +15 -91
- package/dist/model.js +2 -140
- package/dist/neutral.d.ts +72 -0
- package/dist/neutral.js +27 -0
- package/dist/notifications.d.ts +24 -26
- package/dist/notifications.js +39 -143
- package/dist/operation-control.d.ts +4 -0
- package/dist/operation-control.js +20 -0
- package/dist/operation-presentation.d.ts +1 -2
- package/dist/operation-presentation.js +1 -7
- package/dist/owner.d.ts +2 -2
- package/dist/owner.js +1 -1
- package/dist/packages/agent-delivery/src/claude-native.d.ts +2 -0
- package/dist/packages/agent-delivery/src/claude-native.js +5 -0
- package/dist/packages/agent-delivery/src/codex-boundary.d.ts +11 -6
- package/dist/packages/agent-delivery/src/codex-boundary.js +31 -40
- package/dist/packages/agent-delivery/src/codex-hook.d.ts +17 -12
- package/dist/packages/agent-delivery/src/codex-hook.js +26 -39
- package/dist/packages/agent-delivery/src/codex.d.ts +3 -0
- package/dist/packages/agent-delivery/src/codex.js +41 -4
- package/dist/packages/agent-delivery/src/index.d.ts +3 -1
- package/dist/packages/agent-delivery/src/index.js +1 -1
- package/dist/packages/agent-delivery/src/paseo.js +11 -2
- package/dist/packages/agent-delivery/src/types.d.ts +1 -0
- package/dist/paseo-delivery.d.ts +5 -5
- package/dist/paseo-delivery.js +19 -99
- package/dist/paseo.d.ts +1 -1
- package/dist/paseo.js +1 -1
- package/dist/plugins/opencode/index.d.ts +5 -3
- package/dist/plugins/opencode/index.js +99 -21
- package/dist/plugins/opencode-shared/delivery.d.ts +23 -0
- package/dist/plugins/opencode-shared/delivery.js +109 -0
- package/dist/plugins/opencode-v1/index.d.ts +28 -0
- package/dist/plugins/opencode-v1/index.js +41 -0
- package/dist/plugins/opencode-v1/runtime.d.ts +56 -0
- package/dist/plugins/opencode-v1/runtime.js +152 -0
- package/dist/plugins/opencode-v1/transport.d.ts +13 -0
- package/dist/plugins/opencode-v1/transport.js +50 -0
- package/dist/plugins/paseo/shared/card-presentation.d.ts +10 -0
- package/dist/plugins/paseo/shared/card-presentation.js +7 -0
- package/dist/ports.d.ts +33 -214
- package/dist/presentation.d.ts +5 -5
- package/dist/presentation.js +1 -0
- package/dist/runtime.js +2 -2
- package/dist/search.js +1 -1
- package/dist/session-lifecycle.d.ts +8 -7
- package/dist/session-lifecycle.js +40 -42
- package/dist/sqlite-framing.d.ts +8 -0
- package/dist/sqlite-framing.js +31 -0
- package/dist/sqlite-square.d.ts +16 -26
- package/dist/sqlite-square.js +199 -262
- package/dist/sqlite-values.d.ts +21 -0
- package/dist/sqlite-values.js +78 -0
- package/dist/square-api.d.ts +1 -1
- package/dist/square-api.js +5 -8
- package/dist/square-core.d.ts +0 -1
- package/dist/square-domain.d.ts +12 -10
- package/dist/square-domain.js +105 -223
- package/dist/square-facade.d.ts +25 -76
- package/dist/square-location.d.ts +6 -1
- package/dist/square-location.js +1 -1
- package/dist/square-post.d.ts +53 -0
- package/dist/square-post.js +4 -0
- package/dist/square-posting.d.ts +13 -0
- package/dist/square-posting.js +174 -0
- package/dist/square-producer-sqlite.d.ts +11 -0
- package/dist/square-producer-sqlite.js +210 -0
- package/dist/square-receive.d.ts +2 -3
- package/dist/square-sqlite.d.ts +33 -42
- package/dist/square-sqlite.js +236 -768
- package/dist/square-tools.d.ts +8 -0
- package/dist/square-tools.js +39 -0
- package/dist/square-values.d.ts +27 -0
- package/dist/square-values.js +90 -0
- package/dist/views.d.ts +6 -6
- package/dist/views.js +14 -9
- package/dist/wake-sink.d.ts +4 -11
- package/dist/wake-sink.js +8 -32
- package/dist/wake-transports.d.ts +4 -0
- package/dist/wake-transports.js +11 -0
- package/examples/symmetric-domains.mjs +29 -249
- package/guides/change-waits.md +13 -53
- package/guides/claude-native.md +19 -172
- package/guides/codex-delivery.md +55 -78
- package/guides/delivery-primitives.md +48 -207
- package/guides/operation-cancellation.md +2 -5
- package/guides/participant-ownership.md +25 -89
- package/guides/pi-native-delivery.md +19 -56
- package/guides/pi-tools.md +6 -8
- package/guides/row-runtime-delivery-evidence.md +2 -0
- package/guides/row-storage-design.md +19 -44
- package/guides/square-api.md +113 -538
- package/package.json +8 -8
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/hooks/hooks.json +1 -1
- package/plugins/claude/{hooks/register.js → mods/square.js} +4 -7
- package/plugins/claude/types.d.ts +1 -1
- package/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/hooks/hooks.json +11 -23
- package/plugins/opencode/index.ts +91 -23
- package/plugins/opencode-shared/delivery.ts +91 -0
- package/plugins/opencode-v1/index.ts +36 -0
- package/plugins/opencode-v1/runtime.ts +134 -0
- package/plugins/opencode-v1/transport.ts +41 -0
- package/plugins/paseo/OVERVIEW.md +5 -5
- package/plugins/paseo/README.md +7 -6
- package/plugins/paseo/client/markdown.tsx +5 -5
- package/plugins/paseo/client/square-message.tsx +28 -24
- package/plugins/paseo/client/transform.ts +8 -5
- package/plugins/paseo/shared/card-presentation.ts +16 -0
- package/plugins/paseo/shared/message.ts +6 -11
- package/plugins/pi/square-pi.js +167 -451
- package/dist/channel.d.ts +0 -74
- package/dist/channel.js +0 -92
- package/dist/claude-delivery-status.d.ts +0 -13
- package/dist/claude-delivery-status.js +0 -46
- package/dist/cmd/notify-once.d.ts +0 -2
- package/dist/cmd/notify-once.js +0 -29
- package/dist/delivery-attempts.d.ts +0 -52
- package/dist/delivery-attempts.js +0 -73
- package/dist/delivery-effects.d.ts +0 -139
- package/dist/delivery-effects.js +0 -163
- package/dist/delivery-health.d.ts +0 -51
- package/dist/delivery-health.js +0 -173
- package/dist/delivery-operations.d.ts +0 -9
- package/dist/delivery-operations.js +0 -168
- package/dist/delivery-primitives.d.ts +0 -5
- package/dist/delivery-primitives.js +0 -3
- package/dist/delivery.d.ts +0 -45
- package/dist/delivery.js +0 -106
- package/dist/plugins/opencode/delivery.d.ts +0 -19
- package/dist/plugins/opencode/delivery.js +0 -238
- package/dist/presentation-operations.d.ts +0 -18
- package/dist/presentation-operations.js +0 -86
- package/dist/square-index.d.ts +0 -16
- package/dist/square-index.js +0 -106
- package/dist/square-legacy-framing.d.ts +0 -11
- package/dist/square-legacy-framing.js +0 -64
- package/dist/square-migration-host-ledger.d.ts +0 -26
- package/dist/square-migration-host-ledger.js +0 -169
- package/dist/square-migration.d.ts +0 -30
- package/dist/square-migration.js +0 -599
- package/guides/migration.md +0 -156
- package/plugins/opencode/delivery.ts +0 -211
package/dist/harness.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { doctorDeliveryHealth } from './delivery-health.js';
|
|
3
|
-
import { wakeGraceMs } from './notifications.js';
|
|
1
|
+
import { DeliveryLedger, deliveryLedgerLocation } from './delivery-ledger.js';
|
|
4
2
|
import { truncateExternalDiagnostic } from './presentation.js';
|
|
5
3
|
import { doctorClaudePlugin, installClaudePlugin, uninstallClaudePlugin, } from './harness-claude.js';
|
|
6
4
|
import { doctorCodexPlugin, installCodexPlugin, uninstallCodexPlugin, } from './harness-codex.js';
|
|
@@ -18,16 +16,6 @@ async function doctorHost(label, inspect) {
|
|
|
18
16
|
return result([`○ ${label} doctor unavailable (${truncateExternalDiagnostic(diagnostic)})`]);
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
|
-
function readableSquarePath(squarePath) {
|
|
22
|
-
if (squarePath === undefined)
|
|
23
|
-
return false;
|
|
24
|
-
try {
|
|
25
|
-
return fs.statSync(squarePath).isFile() && (fs.accessSync(squarePath, fs.constants.R_OK), true);
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
19
|
const TARGETS = [
|
|
32
20
|
{
|
|
33
21
|
name: 'claude',
|
|
@@ -78,10 +66,17 @@ const TARGETS = [
|
|
|
78
66
|
{
|
|
79
67
|
name: 'delivery',
|
|
80
68
|
capabilities: ['doctor'],
|
|
81
|
-
async doctor({
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
69
|
+
async doctor({ homeDir }) {
|
|
70
|
+
return doctorHost('delivery', async () => {
|
|
71
|
+
const ledger = await DeliveryLedger.open({ location: deliveryLedgerLocation(process.env, homeDir) });
|
|
72
|
+
try {
|
|
73
|
+
const health = await ledger.health();
|
|
74
|
+
return [`· delivery health · ${health.unknownAttempts.length} unknown attempts · ${health.repeatedFailures.length} repeated failures · ${health.sessionsWithoutRoute.length} sessions without route`];
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
await ledger.close();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
85
80
|
},
|
|
86
81
|
},
|
|
87
82
|
];
|
package/dist/help.js
CHANGED
|
@@ -58,6 +58,8 @@ const COMMANDS = [
|
|
|
58
58
|
details: ['Options:', ' --for-owner <id> Required opaque owner.', ' --limit <N> Snapshot memberships (default 20, maximum 100).'],
|
|
59
59
|
},
|
|
60
60
|
{ names: ['codex-hook'], usage: '{command}', summary: 'Present pending attention at one native agent boundary.', hiddenFromIndex: true },
|
|
61
|
+
{ names: ['codex-watch'], usage: '{command}', summary: 'Observe pending attention from a native async Stop hook.', hiddenFromIndex: true },
|
|
62
|
+
{ names: ['codex-interrupt'], usage: '{command}', summary: 'Cancel pending attention at a native Interrupt boundary.', hiddenFromIndex: true },
|
|
61
63
|
{ names: ['claude-mod'], usage: '{command}', summary: 'Receive a structured operation from the loaded Claude mod.', hiddenFromIndex: true },
|
|
62
64
|
{
|
|
63
65
|
names: ['history'], usage: 'history [filters] [output]', usesSquare: true, group: 'participant',
|
|
@@ -89,11 +91,6 @@ const COMMANDS = [
|
|
|
89
91
|
names: ['doctor'], usage: 'doctor', usesSquare: true, group: 'maintenance',
|
|
90
92
|
summary: 'Validate artifact integrity.',
|
|
91
93
|
},
|
|
92
|
-
{
|
|
93
|
-
names: ['migrate'], usage: 'migrate', usesSquare: true, group: 'maintenance',
|
|
94
|
-
summary: 'Convert a supported older square to the current format in place.',
|
|
95
|
-
details: ['For the selected .square artifact only. Stop sessions using this artifact before conversion. Back up the stopped artifact, migrate it, then run square --location <path> doctor before starting updated clients.', 'Versions 2–7 migrate explicitly to format 8. Format 7 migration deletes hold/resume activities and their keyed rows, clears replies to those activities, and preserves surviving activity ids with gaps. Format 6 attachment and opaque-owner conversion are preserved; versions 4/5 first gain attached seats, and 4 also gains empty deferrals. Version 1, unrelated or unsupported artifacts refuse without a write. Names whose legacy owner and routes agree may share an owner; ambiguous names stay standing without custody. Rejoin with the same owner after migration to republish discovery. There is no --check, --backup or --force.'],
|
|
96
|
-
},
|
|
97
94
|
];
|
|
98
95
|
function definitionFor(command) {
|
|
99
96
|
return COMMANDS.find((item) => item.names.includes(command));
|
|
@@ -105,7 +102,7 @@ export function renderGlobalHelp() {
|
|
|
105
102
|
const groups = [
|
|
106
103
|
{ key: 'participant', title: 'In the square:', order: ['join', 'express', 'listen', 'unlisten', 'ignore', 'listening', 'catch', 'history', 'status', 'done'] },
|
|
107
104
|
{ key: 'host', title: 'Prepare and manage:', order: ['build', 'list', 'participants'] },
|
|
108
|
-
{ key: 'maintenance', title: 'Setup:', order: ['install', 'uninstall', 'doctor'
|
|
105
|
+
{ key: 'maintenance', title: 'Setup:', order: ['install', 'uninstall', 'doctor'] },
|
|
109
106
|
];
|
|
110
107
|
const commandLines = groups.flatMap(({ key, title, order }) => [
|
|
111
108
|
title,
|
package/dist/http-delivery.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { WakeOutcome, WakeRequest, WakeTransportPort } from './ports.js';
|
|
1
|
+
import type { DeliveryCard, DeliveryTransport, DeliveryTransportContext, TransportOutcome } from './delivery-ledger.js';
|
|
3
2
|
export interface HttpWakeTransportOptions {
|
|
4
3
|
fetch?: typeof fetch;
|
|
5
4
|
env?: NodeJS.ProcessEnv;
|
|
6
5
|
}
|
|
7
|
-
/** HTTP
|
|
8
|
-
export declare class HttpWakeTransport implements
|
|
6
|
+
/** A successful HTTP response acknowledges custody, not presentation. */
|
|
7
|
+
export declare class HttpWakeTransport implements DeliveryTransport {
|
|
9
8
|
private readonly opts;
|
|
9
|
+
readonly kind = "http";
|
|
10
10
|
constructor(opts?: HttpWakeTransportOptions);
|
|
11
|
-
|
|
12
|
-
outcome: 'not-capable';
|
|
13
|
-
diagnostic: string;
|
|
14
|
-
}>;
|
|
15
|
-
attempt(request: WakeRequest, timeoutMs: number, beforeSend: () => Promise<boolean>): Promise<WakeOutcome>;
|
|
11
|
+
send(card: DeliveryCard, address: Readonly<Record<string, string>>, context: DeliveryTransportContext): Promise<TransportOutcome>;
|
|
16
12
|
}
|
package/dist/http-delivery.js
CHANGED
|
@@ -1,101 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
/** Configuration only: probing never contacts the receiver. */
|
|
3
|
-
function configuration(route, env) {
|
|
4
|
-
if (route.kind !== 'http')
|
|
5
|
-
return undefined;
|
|
1
|
+
function configuration(address, env) {
|
|
6
2
|
try {
|
|
7
|
-
const url = new URL(
|
|
8
|
-
if (!['http:', 'https:'].includes(url.protocol) || !url.hostname || url.username || url.password
|
|
9
|
-
|| route.address.url.includes('#'))
|
|
3
|
+
const url = new URL(address.url);
|
|
4
|
+
if (!['http:', 'https:'].includes(url.protocol) || !url.hostname || url.username || url.password || address.url.includes('#'))
|
|
10
5
|
return undefined;
|
|
11
6
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const token = tokenEnv.trim() ? env[tokenEnv] : undefined;
|
|
15
|
-
// RFC 6750 bearer credentials; whitespace/control characters cannot become headers.
|
|
7
|
+
if (address.tokenEnv !== undefined) {
|
|
8
|
+
const token = address.tokenEnv.trim() ? env[address.tokenEnv] : undefined;
|
|
16
9
|
if (!token || token !== token.trim() || !/^[A-Za-z0-9._~+\/-]+=*$/.test(token))
|
|
17
10
|
return undefined;
|
|
18
11
|
headers.set('Authorization', `Bearer ${token}`);
|
|
19
12
|
}
|
|
20
|
-
return { url:
|
|
13
|
+
return { url: address.url, headers };
|
|
21
14
|
}
|
|
22
15
|
catch {
|
|
23
16
|
return undefined;
|
|
24
17
|
}
|
|
25
18
|
}
|
|
26
|
-
/** HTTP
|
|
19
|
+
/** A successful HTTP response acknowledges custody, not presentation. */
|
|
27
20
|
export class HttpWakeTransport {
|
|
28
21
|
opts;
|
|
22
|
+
kind = 'http';
|
|
29
23
|
constructor(opts = {}) {
|
|
30
24
|
this.opts = opts;
|
|
31
25
|
}
|
|
32
|
-
async
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (request.route.kind !== 'http')
|
|
39
|
-
return { outcome: 'not-capable' };
|
|
40
|
-
const config = configuration(request.route, this.opts.env ?? process.env);
|
|
41
|
-
if (config === undefined)
|
|
42
|
-
return { outcome: 'failed', signature: 'http_config_rejected', message: 'Invalid HTTP wake configuration.' };
|
|
43
|
-
const controller = new AbortController();
|
|
44
|
-
let sent = false;
|
|
45
|
-
const budgetUnavailable = () => sent
|
|
46
|
-
? { outcome: 'unknown', signature: 'http_send_timeout', message: 'HTTP wake acceptance is unknown after timeout.' }
|
|
47
|
-
: { outcome: 'failed', signature: 'http_pre_send_timeout', message: 'HTTP wake budget elapsed before sending.' };
|
|
48
|
-
if (!Number.isFinite(timeoutMs) || Date.now() >= deadline)
|
|
49
|
-
return budgetUnavailable();
|
|
50
|
-
let timer;
|
|
51
|
-
const timeout = new Promise(resolve => {
|
|
52
|
-
timer = setTimeout(() => { controller.abort(); resolve(budgetUnavailable()); }, Math.max(0, deadline - Date.now()));
|
|
53
|
-
});
|
|
54
|
-
const send = async () => {
|
|
55
|
-
try {
|
|
56
|
-
const preview = request.artifact === undefined ? undefined
|
|
57
|
-
: (await request.artifact.read(facts => wakePreview(facts, request), controller.signal)).value;
|
|
58
|
-
if (preview === undefined)
|
|
59
|
-
return { outcome: 'not-capable', diagnostic: 'No pending Square activity to preview.' };
|
|
60
|
-
const body = JSON.stringify({
|
|
61
|
-
location: request.location, participant: request.participant, activity: request.activity, actor: request.actor,
|
|
62
|
-
...(request.attemptN === undefined ? {} : { attemptN: request.attemptN }), preview,
|
|
63
|
-
});
|
|
64
|
-
if (controller.signal.aborted || Date.now() >= deadline)
|
|
65
|
-
return budgetUnavailable();
|
|
66
|
-
if (!(await beforeSend()))
|
|
67
|
-
return { outcome: 'not-capable' };
|
|
68
|
-
// Preview and the final gate spend the same absolute budget as the request.
|
|
69
|
-
if (controller.signal.aborted || Date.now() >= deadline)
|
|
70
|
-
return budgetUnavailable();
|
|
71
|
-
sent = true;
|
|
72
|
-
const response = await (this.opts.fetch ?? fetch)(config.url, {
|
|
73
|
-
method: 'POST', headers: config.headers, body, redirect: 'manual', signal: controller.signal,
|
|
74
|
-
});
|
|
75
|
-
// Status is the whole acknowledgement; never wait for or buffer a receiver body.
|
|
76
|
-
void response.body?.cancel().catch(() => undefined);
|
|
77
|
-
if (response.status >= 200 && response.status < 300)
|
|
78
|
-
return { outcome: 'accepted', signature: 'http_accepted' };
|
|
79
|
-
return {
|
|
80
|
-
outcome: 'failed', signature: response.status >= 500 && response.status < 600 ? 'http_status_transient' : 'http_status_rejected',
|
|
81
|
-
message: `HTTP wake returned status ${response.status}.`,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
// URLs, query credentials and raw fetch exceptions must never reach evidence.
|
|
86
|
-
if (controller.signal.aborted)
|
|
87
|
-
return budgetUnavailable();
|
|
88
|
-
return sent
|
|
89
|
-
? { outcome: 'unknown', signature: 'http_send_unknown', message: 'HTTP wake acceptance is unknown after a network error.' }
|
|
90
|
-
: { outcome: 'failed', signature: 'http_pre_send_failed', message: 'HTTP wake could not be prepared.' };
|
|
91
|
-
}
|
|
92
|
-
};
|
|
26
|
+
async send(card, address, context) {
|
|
27
|
+
const config = configuration(address, this.opts.env ?? process.env);
|
|
28
|
+
if (!config)
|
|
29
|
+
return 'not-capable';
|
|
30
|
+
if (!await context.beforeSend() || context.signal.aborted || Date.now() >= context.deadline)
|
|
31
|
+
return 'not-capable';
|
|
93
32
|
try {
|
|
94
|
-
|
|
33
|
+
const response = await (this.opts.fetch ?? fetch)(config.url, { method: 'POST', headers: config.headers,
|
|
34
|
+
body: JSON.stringify({ owner: card.owner, key: card.key, text: card.text }), redirect: 'manual', signal: context.signal });
|
|
35
|
+
void response.body?.cancel().catch(() => undefined);
|
|
36
|
+
return response.status >= 200 && response.status < 300 ? 'accepted' : 'failed';
|
|
95
37
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
clearTimeout(timer);
|
|
38
|
+
catch {
|
|
39
|
+
return 'unknown';
|
|
99
40
|
}
|
|
100
41
|
}
|
|
101
42
|
}
|
package/dist/inbox.d.ts
CHANGED
|
@@ -1,58 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** Local delivery suppression, never persisted as evidence of receipt. */
|
|
6
|
-
excludeKeys?: ReadonlySet<string>;
|
|
7
|
-
/** Arm before dispatch; retry only after a substantive change, not our failed evidence write. */
|
|
8
|
-
skipImmediate?: boolean;
|
|
9
|
-
onChangeArmed?: (armed: boolean) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare function pendingKey(membership: LocatedSeat, actIndex: number): string;
|
|
12
|
-
export declare function pendingAtBoundary(inbox: readonly PendingMembership[]): PendingMembership[];
|
|
13
|
-
/** Revalidate a supplied batch immediately before the boundary's independent claim/send checks. */
|
|
14
|
-
export declare function projectBoundaryEligibility(inbox: readonly PendingMembership[]): Promise<PendingMembership[]>;
|
|
15
|
-
export interface SessionBindingCandidate {
|
|
16
|
-
readonly location: string;
|
|
1
|
+
import type { Owner } from './model.js';
|
|
2
|
+
import type { InboxMembershipSummary } from './square-facade.js';
|
|
3
|
+
/** Filesystem-scoped membership counts. This is a World read, not a delivery scan. */
|
|
4
|
+
export declare function sessionInboxCounts(input: {
|
|
17
5
|
readonly owner: Owner;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export declare function projectSessionCandidates(input: SessionSeatQuery): Promise<readonly SessionBindingCandidate[]>;
|
|
21
|
-
export interface SessionSeatQuery {
|
|
22
|
-
readonly owner?: Owner;
|
|
23
|
-
readonly location?: string;
|
|
24
|
-
readonly env?: NodeJS.ProcessEnv;
|
|
25
|
-
}
|
|
26
|
-
/** Lifecycle reads resolve seats and join times, never pending activity bodies. */
|
|
27
|
-
export declare function projectSessionSeats(input: SessionSeatQuery, signal?: AbortSignal): Promise<LocatedSeat[]>;
|
|
28
|
-
/** Public count boundary: one coherent read per artifact, without pending body hydration. */
|
|
29
|
-
export declare function sessionInboxCounts(input: SessionSeatQuery, signal?: AbortSignal): Promise<import('./square-facade.js').InboxMembershipSummary[]>;
|
|
30
|
-
export interface NativePendingPreview {
|
|
31
|
-
readonly payload: string;
|
|
32
|
-
readonly clipped: boolean;
|
|
33
|
-
}
|
|
34
|
-
export type NativePendingPreviewInput = {
|
|
35
|
-
readonly location: string;
|
|
36
|
-
readonly generation: import('./model.js').ActivityId;
|
|
37
|
-
readonly participant: string;
|
|
38
|
-
readonly actIndex: number;
|
|
39
|
-
readonly cancelledThrough?: number;
|
|
40
|
-
readonly now: number;
|
|
41
|
-
} & ({
|
|
42
|
-
readonly routeKind: 'claude-native';
|
|
43
|
-
readonly address: Readonly<Record<string, string>>;
|
|
44
|
-
} | {
|
|
45
|
-
readonly routeKind: 'opencode-server';
|
|
46
|
-
readonly address: Readonly<Record<string, string>>;
|
|
47
|
-
});
|
|
48
|
-
/** Current-generation native attention, owned by its exact wake address and catch state. */
|
|
49
|
-
export declare function nativePendingPreview(facts: SquareRead, input: NativePendingPreviewInput): NativePendingPreview | undefined;
|
|
50
|
-
export declare function sessionInbox(owner: Owner, env?: NodeJS.ProcessEnv, signal?: AbortSignal): Promise<PendingMembership[]>;
|
|
51
|
-
export interface SessionPendingObserver {
|
|
52
|
-
/** Read committed revisions before reusing content; filesystem hints are only for waiting. */
|
|
53
|
-
read(options?: Pick<PendingWaitOptions, 'signal' | 'excludeKeys'>): Promise<PendingMembership[]>;
|
|
54
|
-
wait(timeoutMs: number, options?: PendingWaitOptions): Promise<PendingMembership[]>;
|
|
55
|
-
close(): void;
|
|
56
|
-
}
|
|
57
|
-
/** Session-scoped projection over process-shared storage change detectors. */
|
|
58
|
-
export declare function observeSessionPending(owner: Owner, suppliedEnv?: NodeJS.ProcessEnv): Promise<SessionPendingObserver>;
|
|
6
|
+
readonly cwd?: string;
|
|
7
|
+
}, signal?: AbortSignal): Promise<InboxMembershipSummary[]>;
|