@songsid/agend 2.1.7-beta.3 → 2.1.7-beta.5
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/README.md +2 -0
- package/README.zh-TW.md +2 -0
- package/dist/agent-cli-instructions.md +5 -0
- package/dist/agent-cli.js +13 -0
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.d.ts +2 -0
- package/dist/agent-endpoint.js +48 -5
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/backend/codex-session-lookup.d.ts +59 -0
- package/dist/backend/codex-session-lookup.js +139 -0
- package/dist/backend/codex-session-lookup.js.map +1 -0
- package/dist/backend/codex.d.ts +29 -0
- package/dist/backend/codex.js +183 -10
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/types.d.ts +21 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/channel/mcp-operation-response.d.ts +3 -0
- package/dist/channel/mcp-operation-response.js +21 -0
- package/dist/channel/mcp-operation-response.js.map +1 -0
- package/dist/channel/mcp-operation-response.test.d.ts +1 -0
- package/dist/channel/mcp-operation-response.test.js +23 -0
- package/dist/channel/mcp-operation-response.test.js.map +1 -0
- package/dist/channel/mcp-server.js +20 -5
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.js +2 -0
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/cli.js +68 -2
- package/dist/cli.js.map +1 -1
- package/dist/daemon.d.ts +34 -0
- package/dist/daemon.js +415 -41
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +174 -0
- package/dist/delivery-outbox.js +824 -0
- package/dist/delivery-outbox.js.map +1 -0
- package/dist/delivery-outbox.test.d.ts +1 -0
- package/dist/delivery-outbox.test.js +597 -0
- package/dist/delivery-outbox.test.js.map +1 -0
- package/dist/delivery-queue-evidence.d.ts +15 -0
- package/dist/delivery-queue-evidence.js +35 -0
- package/dist/delivery-queue-evidence.js.map +1 -0
- package/dist/delivery-queue-evidence.test.d.ts +1 -0
- package/dist/delivery-queue-evidence.test.js +23 -0
- package/dist/delivery-queue-evidence.test.js.map +1 -0
- package/dist/delivery-reconciliation.d.ts +49 -0
- package/dist/delivery-reconciliation.js +296 -0
- package/dist/delivery-reconciliation.js.map +1 -0
- package/dist/delivery-reconciliation.test.d.ts +1 -0
- package/dist/delivery-reconciliation.test.js +411 -0
- package/dist/delivery-reconciliation.test.js.map +1 -0
- package/dist/fleet-manager.d.ts +39 -1
- package/dist/fleet-manager.js +345 -50
- package/dist/fleet-manager.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +18 -0
- package/dist/instance-lifecycle.js +116 -3
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.js +3 -0
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +6 -0
- package/dist/locale.js.map +1 -1
- package/dist/outbound-handlers.d.ts +25 -1
- package/dist/outbound-handlers.js +119 -8
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +7 -0
- package/dist/outbound-schemas.js +14 -0
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pane-write-lock.d.ts +2 -0
- package/dist/pane-write-lock.js +19 -0
- package/dist/pane-write-lock.js.map +1 -1
- package/dist/remote-credential-check.d.ts +39 -0
- package/dist/remote-credential-check.js +81 -0
- package/dist/remote-credential-check.js.map +1 -0
- package/dist/scheduler/scheduler.d.ts +5 -1
- package/dist/scheduler/scheduler.js +60 -20
- package/dist/scheduler/scheduler.js.map +1 -1
- package/dist/scheduler/scheduler.test.js +41 -2
- package/dist/scheduler/scheduler.test.js.map +1 -1
- package/dist/scheduler/types.d.ts +1 -1
- package/dist/tmux-manager.d.ts +3 -3
- package/dist/tmux-manager.js +6 -6
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tool-permissions.js +6 -6
- package/dist/tool-permissions.js.map +1 -1
- package/dist/transcript-monitor.d.ts +3 -1
- package/dist/transcript-monitor.js +15 -0
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-sources.d.ts +9 -0
- package/dist/transcript-sources.js +14 -0
- package/dist/transcript-sources.js.map +1 -1
- package/dist/usage/providers.d.ts +11 -6
- package/dist/usage/providers.js +17 -10
- package/dist/usage/providers.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import type { QueueResumePolicy } from "./delivery-queue-evidence.js";
|
|
3
|
+
export declare const DURABLE_DELIVERY_MAX_ATTEMPTS = 8;
|
|
4
|
+
export declare const DURABLE_DELIVERY_MAX_AGE_MS: number;
|
|
5
|
+
export declare const DURABLE_DELIVERY_ABORT_BACKOFF_MS = 5000;
|
|
6
|
+
export interface DaemonDeliveryPort {
|
|
7
|
+
begin(deliveryId: string, targetBootId: string, attemptNo: number, evidence?: DeliveryAttemptEvidence): "begun" | "duplicate" | "stale";
|
|
8
|
+
markEnterStarted(deliveryId: string, targetBootId: string, attemptNo: number): boolean;
|
|
9
|
+
abort(deliveryId: string, targetBootId: string, attemptNo: number, reason: string): boolean;
|
|
10
|
+
complete(deliveryId: string, targetBootId: string, attemptNo: number, outcome: "delivered" | "failed" | "uncertain", evidence?: string): boolean;
|
|
11
|
+
retryBeforeBegin(deliveryId: string, targetBootId: string, attemptNo: number, reason: string, delayMs?: number): boolean;
|
|
12
|
+
}
|
|
13
|
+
export type OutboxState = "queued" | "delivering" | "submission_started" | "reconciliation_pending" | "retry_wait" | "delivered" | "failed" | "uncertain" | "cancelled";
|
|
14
|
+
export interface NewOutboxDelivery {
|
|
15
|
+
operationId: string;
|
|
16
|
+
sourceKey: string;
|
|
17
|
+
sourceInstance: string;
|
|
18
|
+
sourceDaemonBootId: string;
|
|
19
|
+
targetInstance: string;
|
|
20
|
+
targetSession?: string;
|
|
21
|
+
kind: string;
|
|
22
|
+
correlationId?: string;
|
|
23
|
+
payload: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface OutboxDelivery {
|
|
26
|
+
deliveryId: string;
|
|
27
|
+
operationId: string;
|
|
28
|
+
sourceKey: string;
|
|
29
|
+
sourceInstance: string;
|
|
30
|
+
sourceDaemonBootId: string;
|
|
31
|
+
targetInstance: string;
|
|
32
|
+
targetSession: string | null;
|
|
33
|
+
targetDaemonBootId: string | null;
|
|
34
|
+
kind: string;
|
|
35
|
+
correlationId: string | null;
|
|
36
|
+
payload: Record<string, unknown>;
|
|
37
|
+
state: OutboxState;
|
|
38
|
+
attemptNo: number;
|
|
39
|
+
createdSeq: number;
|
|
40
|
+
managerBootId: string | null;
|
|
41
|
+
responseDeliveredAt: string | null;
|
|
42
|
+
nextAttemptAt: string | null;
|
|
43
|
+
lastError: string | null;
|
|
44
|
+
reconciliationPending: boolean;
|
|
45
|
+
}
|
|
46
|
+
export type DeliveryStatusSelector = {
|
|
47
|
+
deliveryId: string;
|
|
48
|
+
operationId?: never;
|
|
49
|
+
correlationId?: never;
|
|
50
|
+
limit?: never;
|
|
51
|
+
cursor?: never;
|
|
52
|
+
} | {
|
|
53
|
+
operationId: string;
|
|
54
|
+
deliveryId?: never;
|
|
55
|
+
correlationId?: never;
|
|
56
|
+
limit?: number;
|
|
57
|
+
cursor?: string;
|
|
58
|
+
} | {
|
|
59
|
+
correlationId: string;
|
|
60
|
+
deliveryId?: never;
|
|
61
|
+
operationId?: never;
|
|
62
|
+
limit?: number;
|
|
63
|
+
cursor?: string;
|
|
64
|
+
};
|
|
65
|
+
export interface DeliveryStatusItem {
|
|
66
|
+
delivery_id: string;
|
|
67
|
+
operation_id: string;
|
|
68
|
+
correlation_id: string | null;
|
|
69
|
+
source_instance: string;
|
|
70
|
+
target_instance: string;
|
|
71
|
+
kind: string;
|
|
72
|
+
state: OutboxState;
|
|
73
|
+
attempt_no: number;
|
|
74
|
+
created_at: string;
|
|
75
|
+
updated_at: string;
|
|
76
|
+
status_summary: string;
|
|
77
|
+
error_summary: string | null;
|
|
78
|
+
safe_to_retry: boolean;
|
|
79
|
+
}
|
|
80
|
+
export interface DeliveryStatusPage {
|
|
81
|
+
items: DeliveryStatusItem[];
|
|
82
|
+
next_cursor: string | null;
|
|
83
|
+
}
|
|
84
|
+
export type DurableSubmissionMode = "idle_submit" | "native_queue_handoff" | "steer" | "raw_paste";
|
|
85
|
+
/** Checkpoint committed with begin, before any pane paste can occur. */
|
|
86
|
+
export interface DeliveryAttemptEvidence {
|
|
87
|
+
backend: string;
|
|
88
|
+
backendVersion?: string | null;
|
|
89
|
+
windowId: string | null;
|
|
90
|
+
transcriptPath: string | null;
|
|
91
|
+
transcriptOffset: number | null;
|
|
92
|
+
transcriptSessionId: string | null;
|
|
93
|
+
submissionMode: DurableSubmissionMode;
|
|
94
|
+
queueResumePolicy?: QueueResumePolicy;
|
|
95
|
+
}
|
|
96
|
+
export interface DeliveryReconciliationCandidate extends OutboxDelivery {
|
|
97
|
+
attempt: {
|
|
98
|
+
targetDaemonBootId: string;
|
|
99
|
+
attemptNo: number;
|
|
100
|
+
backend: string | null;
|
|
101
|
+
backendVersion: string | null;
|
|
102
|
+
windowId: string | null;
|
|
103
|
+
transcriptPath: string | null;
|
|
104
|
+
transcriptOffset: number | null;
|
|
105
|
+
transcriptSessionId: string | null;
|
|
106
|
+
submissionMode: DurableSubmissionMode | null;
|
|
107
|
+
queueResumePolicy: QueueResumePolicy | null;
|
|
108
|
+
enterStartedAt: string | null;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export interface ClaimedOutboxDelivery extends OutboxDelivery {
|
|
112
|
+
targetDaemonBootId: string;
|
|
113
|
+
}
|
|
114
|
+
/** Durable admission and fenced state transitions for the fleet delivery queue. */
|
|
115
|
+
export declare class DeliveryOutbox extends EventEmitter {
|
|
116
|
+
private readonly db;
|
|
117
|
+
readonly managerBootId: string;
|
|
118
|
+
constructor(dbPath: string, managerBootId?: string);
|
|
119
|
+
private ensureColumn;
|
|
120
|
+
/** Commit admission before returning success. Duplicate source keys return their original row. */
|
|
121
|
+
admit(input: NewOutboxDelivery): {
|
|
122
|
+
delivery: OutboxDelivery;
|
|
123
|
+
inserted: boolean;
|
|
124
|
+
};
|
|
125
|
+
get(deliveryId: string): OutboxDelivery | undefined;
|
|
126
|
+
getByOperation(sourceInstance: string, operationId: string): OutboxDelivery[];
|
|
127
|
+
/**
|
|
128
|
+
* Query only rows owned by the authenticated instance as source or target.
|
|
129
|
+
* This method accepts caller identity separately from user arguments so a
|
|
130
|
+
* caller cannot widen its own visibility with a forged source name.
|
|
131
|
+
*/
|
|
132
|
+
queryStatusForInstance(callerInstance: string, selector: DeliveryStatusSelector): DeliveryStatusPage;
|
|
133
|
+
/** Open the existing outbox without migrations or writes for the operator CLI. */
|
|
134
|
+
static queryStatusReadOnly(dbPath: string, selector: DeliveryStatusSelector): DeliveryStatusPage;
|
|
135
|
+
listPending(): OutboxDelivery[];
|
|
136
|
+
nextRetryAt(): string | null;
|
|
137
|
+
/** Claim the earliest eligible target row; one caller owns each target lane. */
|
|
138
|
+
claimNext(managerBootId: string, targetBootIdFor: (target: string) => string | null, blockedTargets: ReadonlySet<string>): ClaimedOutboxDelivery | undefined;
|
|
139
|
+
/** Idempotent begin permit, committed immediately before the pane side effect. */
|
|
140
|
+
begin(deliveryId: string, targetBootId: string, attemptNo: number, evidence?: DeliveryAttemptEvidence): "begun" | "duplicate" | "stale";
|
|
141
|
+
/** Write-ahead fence: commit before tmux is allowed to receive Enter. */
|
|
142
|
+
markEnterStarted(deliveryId: string, targetBootId: string, attemptNo: number): boolean;
|
|
143
|
+
/** Safe only when the caller can prove no pane write occurred for this attempt. */
|
|
144
|
+
abort(deliveryId: string, targetBootId: string, attemptNo: number, reason: string): boolean;
|
|
145
|
+
complete(deliveryId: string, targetBootId: string, attemptNo: number, outcome: "delivered" | "failed" | "uncertain", evidence?: string): boolean;
|
|
146
|
+
/** Transient pre-submit failure: state is retryable and the same row keeps its FIFO position. */
|
|
147
|
+
retryBeforeBegin(deliveryId: string, targetBootId: string, attemptNo: number, reason: string, delayMs?: number): boolean;
|
|
148
|
+
failBeforeBegin(deliveryId: string, reason: string): boolean;
|
|
149
|
+
/** Bound both unavailable rows and unresolved reconciliation without stealing a live lease. */
|
|
150
|
+
expireStale(nowMs?: number, maxAgeMs?: number): number;
|
|
151
|
+
/** Next queued/retry expiry for bounded maintenance scheduling. */
|
|
152
|
+
nextExpiryAt(): string | null;
|
|
153
|
+
markResponseDelivered(sourceInstance: string, operationId: string): number;
|
|
154
|
+
/** Old process leases are recoverable; an old submission attempt needs evidence reconciliation. */
|
|
155
|
+
recoverForBoot(managerBootId: string): {
|
|
156
|
+
queued: number;
|
|
157
|
+
reconciliationPending: number;
|
|
158
|
+
};
|
|
159
|
+
/** Atomically create a post-restart notice for an accepted operation whose response was not recorded. */
|
|
160
|
+
admitPostRestartOutcomeNotice(parent: OutboxDelivery, currentSourceBootId: string): OutboxDelivery | undefined;
|
|
161
|
+
recoverTargetGeneration(targetInstance: string, currentTargetBootId: string): {
|
|
162
|
+
queued: number;
|
|
163
|
+
reconciliationPending: number;
|
|
164
|
+
};
|
|
165
|
+
/** Fence in-flight writes before an in-process target stop begins. */
|
|
166
|
+
markTargetReconciliationPending(targetInstance: string, targetBootId: string): number;
|
|
167
|
+
getReconciliationCandidates(targetInstance: string): DeliveryReconciliationCandidate[];
|
|
168
|
+
/** Atomically settle one old attempt using only its boot/attempt fence. */
|
|
169
|
+
reconcileAttempt(deliveryId: string, targetBootId: string, attemptNo: number, outcome: "delivered" | "retry_wait" | "uncertain", evidence: string): boolean;
|
|
170
|
+
getUnansweredAccepted(sourceInstance: string, currentBootId: string): OutboxDelivery[];
|
|
171
|
+
close(): void;
|
|
172
|
+
/** Must be called inside the same SQLite transaction as the terminal transition. */
|
|
173
|
+
private insertFailureNotice;
|
|
174
|
+
}
|