@qwen-code/channel-github 0.26.6 → 0.26.7-nightly.20261104.b9e20830f7
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/GithubAdapter.d.ts +399 -1
- package/dist/GithubAdapter.d.ts.map +1 -1
- package/dist/GithubAdapter.js +3101 -62
- package/dist/GithubAdapter.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -27
- package/dist/index.js.map +1 -1
- package/dist/web-origin.d.ts +14 -0
- package/dist/web-origin.d.ts.map +1 -0
- package/dist/web-origin.js +28 -0
- package/dist/web-origin.js.map +1 -0
- package/package.json +6 -2
package/dist/GithubAdapter.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ interface GithubConfig extends ChannelConfig {
|
|
|
4
4
|
baseUrl?: string;
|
|
5
5
|
reasonFilter?: unknown;
|
|
6
6
|
useLocalGh?: boolean;
|
|
7
|
+
deliverToBoundSessions?: boolean;
|
|
8
|
+
prWatchEvents?: unknown;
|
|
9
|
+
boundSessionActions?: unknown;
|
|
7
10
|
}
|
|
8
11
|
interface GithubCursor {
|
|
9
12
|
lastProcessedAt: string;
|
|
@@ -18,13 +21,49 @@ interface GithubCursor {
|
|
|
18
21
|
dispatchedBodies?: string[];
|
|
19
22
|
/** Comment node IDs already accepted by the channel. */
|
|
20
23
|
dispatchedComments?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* created_at per dispatched comment key, so eviction can respect the
|
|
26
|
+
* re-list window: a comment whose created_at is newer than the committed
|
|
27
|
+
* cursor can still be re-fetched (mark-read may have failed), so its key
|
|
28
|
+
* must NOT be evicted — otherwise a re-listed aggregate SUPERSET batch
|
|
29
|
+
* re-dispatches already-replied comments under a fresh batch hash that
|
|
30
|
+
* misses the publication-audit backstop. Keys without a recorded time are
|
|
31
|
+
* treated as protected (conservative). Bounded by MAX_COMMENT_TIMES, which
|
|
32
|
+
* retains every ring key's time plus the still-re-listable fetched comments.
|
|
33
|
+
*/
|
|
34
|
+
dispatchedCommentTimes?: Record<string, string>;
|
|
21
35
|
/** Direct-action event node IDs already accepted by the channel. */
|
|
22
36
|
dispatchedEvents?: string[];
|
|
23
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* The prWatchEvents vocabulary, shared by the config validator, the watch
|
|
40
|
+
* emit path, and the management UI's option list (built from this constant
|
|
41
|
+
* in index.ts) so the three cannot drift apart (R2-18). Lowercase: the
|
|
42
|
+
* editor and normalizePrWatchEvents both lowercase before matching.
|
|
43
|
+
*/
|
|
44
|
+
export declare const PR_WATCH_EVENTS: readonly ["ci_failure", "merge_conflict", "head_change", "state_change"];
|
|
45
|
+
/**
|
|
46
|
+
* The notification-reason vocabulary, shared by the reasonFilter descriptor
|
|
47
|
+
* options and the boundSessionActions key validator so the two cannot drift
|
|
48
|
+
* (the PR_WATCH_EVENTS pattern). These are GitHub's notification reasons as
|
|
49
|
+
* the adapter's reasonFilter already enumerates them.
|
|
50
|
+
*/
|
|
51
|
+
export declare const PR_NOTIFICATION_REASONS: readonly ["mention", "review_requested", "assign", "author", "comment", "ci_activity", "manual", "state_change", "subscribed", "team_mention", "security_alert", "approval_requested", "invitation", "member_feature_requested", "security_advisory_credit"];
|
|
52
|
+
interface BoundSessionConfigFields {
|
|
53
|
+
deliverToBoundSessions?: unknown;
|
|
54
|
+
prWatchEvents?: unknown;
|
|
55
|
+
boundSessionActions?: unknown;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Shared validation for the plugin descriptor (returns the message) and
|
|
59
|
+
* connect() (throws it): one source of truth for the event vocabulary and
|
|
60
|
+
* the dependency rule, so the management UI and the adapter cannot drift.
|
|
61
|
+
*/
|
|
62
|
+
export declare function validateBoundSessionConfig(config: BoundSessionConfigFields, channelName: string): string | undefined;
|
|
24
63
|
interface PublicationAuditRecord {
|
|
25
64
|
at: string;
|
|
26
65
|
type: 'github_publication';
|
|
27
|
-
outcome: 'posted' | 'suppressed' | 'failed' | 'posting';
|
|
66
|
+
outcome: 'posted' | 'suppressed' | 'failed' | 'failed_ambiguous' | 'posting';
|
|
28
67
|
channel: string;
|
|
29
68
|
triggerKind?: string;
|
|
30
69
|
repository: string;
|
|
@@ -47,11 +86,102 @@ export declare class GithubChannel extends PollingChannelBase<GithubCursor> {
|
|
|
47
86
|
private webOrigin;
|
|
48
87
|
private readonly activeReactions;
|
|
49
88
|
private readonly reactionsPendingRemoval;
|
|
89
|
+
private readonly ackAnchorByBatch;
|
|
50
90
|
private pendingFinalDeliveryRetry;
|
|
51
91
|
private pendingFinalDeliveryRetryAbort;
|
|
52
92
|
private pendingFinalDeliveryRequestsActive;
|
|
53
93
|
private pendingFinalDeliveryRetryStopRequested;
|
|
54
94
|
private reasonFilter;
|
|
95
|
+
private deliverToBoundSessions;
|
|
96
|
+
private prWatchEvents;
|
|
97
|
+
/**
|
|
98
|
+
* Operator instruction templates keyed by the closed bound-action
|
|
99
|
+
* vocabulary. Non-empty switches routing to role-aware fan-out (one
|
|
100
|
+
* winner per role); empty keeps the legacy single-winner behavior.
|
|
101
|
+
*/
|
|
102
|
+
private boundSessionActions;
|
|
103
|
+
/**
|
|
104
|
+
* Durable event-level delivery history (role-aware fan-out): keys of
|
|
105
|
+
* events some role already accepted privately. Suppresses the public
|
|
106
|
+
* fallback after a partial delivery even when every follower later
|
|
107
|
+
* disappears — current-follower counts alone cannot prove that.
|
|
108
|
+
*/
|
|
109
|
+
private boundDeliveredKeys;
|
|
110
|
+
private boundDeliveredOrder;
|
|
111
|
+
/**
|
|
112
|
+
* An unreadable ring cannot prove a negative: fail CLOSED for the public
|
|
113
|
+
* fallback (suppress it) rather than risk an irreversible duplicate.
|
|
114
|
+
*/
|
|
115
|
+
private boundDeliveredUnreadable;
|
|
116
|
+
/**
|
|
117
|
+
* Tasks retired privately during the current runInboundTask call (role
|
|
118
|
+
* lost its match, siblings already delivered, ring suppression). Their
|
|
119
|
+
* success path must skip the PUBLIC reply-lane bookkeeping: nothing was
|
|
120
|
+
* published, and reading that store could wedge the retired task — and
|
|
121
|
+
* the shared cursor — on an unrelated file's readability. In-memory only:
|
|
122
|
+
* the mark lives exactly as long as the call that sets it.
|
|
123
|
+
*/
|
|
124
|
+
private privatelyRetiredInboundTaskIds;
|
|
125
|
+
private githubHost;
|
|
126
|
+
private boundSessionByPr;
|
|
127
|
+
private lastBindings;
|
|
128
|
+
private lastBindingsPartial;
|
|
129
|
+
private boundRefreshFailed;
|
|
130
|
+
/**
|
|
131
|
+
* False until the first COMPLETE binding snapshot succeeds. Re-validation
|
|
132
|
+
* and watch pruning require an authoritative enumeration, so they stay
|
|
133
|
+
* gated on this (a partial answer is not an absence).
|
|
134
|
+
*/
|
|
135
|
+
private boundSnapshotTrusted;
|
|
136
|
+
/**
|
|
137
|
+
* False until ANY binding snapshot succeeds (complete or partial). The
|
|
138
|
+
* cold-start comment-lane gate uses this, not boundSnapshotTrusted: the
|
|
139
|
+
* map is populated from partial snapshots too. Gating on complete-only
|
|
140
|
+
* would stall the lane forever under a permanent partial (an unreadable
|
|
141
|
+
* sidecar / a workspace without a runtime). An EMPTY partial answer is
|
|
142
|
+
* additionally bounded by coldEmptyPartialStreak: success of an
|
|
143
|
+
* incomplete scan does
|
|
144
|
+
* not establish absence, so the first such answers must not open the
|
|
145
|
+
* lane onto an empty map.
|
|
146
|
+
*/
|
|
147
|
+
private boundSnapshotSeen;
|
|
148
|
+
/**
|
|
149
|
+
* Consecutive empty partial snapshots while no complete snapshot has ever
|
|
150
|
+
* succeeded and the map is empty. Drives the bounded cold-start deferral
|
|
151
|
+
* (MAX_COLD_EMPTY_PARTIAL_POLLS); reset by any complete or non-empty
|
|
152
|
+
* answer.
|
|
153
|
+
*/
|
|
154
|
+
private coldEmptyPartialStreak;
|
|
155
|
+
/**
|
|
156
|
+
* How many polls of the current cold-empty streak were failed lookups
|
|
157
|
+
* (the rest answered with an empty partial). The cap line attributes the
|
|
158
|
+
* stall from this count rather than from boundSnapshotFailureStreak,
|
|
159
|
+
* which any successful answer resets: a run of failed lookups broken by
|
|
160
|
+
* a single empty partial would otherwise be blamed on the daemon's
|
|
161
|
+
* storage. Reset together with coldEmptyPartialStreak.
|
|
162
|
+
*/
|
|
163
|
+
private coldEmptyFailurePolls;
|
|
164
|
+
private partialSnapshotStreak;
|
|
165
|
+
/**
|
|
166
|
+
* True while the most recent pending-watch reconciliation FAILED (e.g.
|
|
167
|
+
* the watch file is unreadable). Generic recovery must then leave watch
|
|
168
|
+
* tasks alone: delivering and removing an accepted watch task without
|
|
169
|
+
* reconciling its on-disk pending record would let a later drain claim
|
|
170
|
+
* and deliver the same transition a second time. Unrelated comment
|
|
171
|
+
* recovery keeps running.
|
|
172
|
+
*/
|
|
173
|
+
private watchReconcileBlocked;
|
|
174
|
+
/**
|
|
175
|
+
* Consecutive binding-refresh failures since the last success. While no
|
|
176
|
+
* snapshot has ever succeeded, the cold-start gate defers the comment lane,
|
|
177
|
+
* so a permanent failure (an old daemon lacking the route, rotated
|
|
178
|
+
* credentials) would freeze every notification silently. The streak drives
|
|
179
|
+
* a distinct, throttled, actionable log so the stall is observable; the
|
|
180
|
+
* gate itself stays fail-closed.
|
|
181
|
+
*/
|
|
182
|
+
private boundSnapshotFailureStreak;
|
|
183
|
+
private prWatchState;
|
|
184
|
+
private prWatchStateLoaded;
|
|
55
185
|
private inboundRecoveryPending;
|
|
56
186
|
private recoverableInboundTasks;
|
|
57
187
|
private activeInboundTaskIdsByMessage;
|
|
@@ -105,14 +235,70 @@ export declare class GithubChannel extends PollingChannelBase<GithubCursor> {
|
|
|
105
235
|
private recordDispatchedBody;
|
|
106
236
|
private recordDispatchedComment;
|
|
107
237
|
private recordDispatched;
|
|
238
|
+
/**
|
|
239
|
+
* Window-aware eviction. Once over the soft cap, drop EVERY key whose
|
|
240
|
+
* comment can no longer be re-listed (created_at <= the committed cursor),
|
|
241
|
+
* keeping protected keys regardless of position. A key newer than the
|
|
242
|
+
* cursor — or with no recorded time (legacy migration) — is protected:
|
|
243
|
+
* evicting it would let a re-listed aggregate SUPERSET re-dispatch
|
|
244
|
+
* already-replied comments under a fresh batch hash that misses the
|
|
245
|
+
* publication-audit backstop (duplicate public reply / private injection
|
|
246
|
+
* without any crash). Under a sustained frozen cursor the protected ring
|
|
247
|
+
* grows with the re-list window (bounded by traffic × outage duration);
|
|
248
|
+
* it shrinks again once mark-read recovers and the cursor passes the keys.
|
|
249
|
+
* A protected key is NEVER evicted to make room — there is no hard-cap
|
|
250
|
+
* refusal, because refusing dispatches without freezing the cursor would
|
|
251
|
+
* mark-read the refused events (silent loss), and freezing the cursor
|
|
252
|
+
* would deadlock (the ring can only shrink once the cursor advances).
|
|
253
|
+
*/
|
|
254
|
+
private evictDispatchedComments;
|
|
255
|
+
/**
|
|
256
|
+
* Bound the time map: drop entries that are neither in the ring nor still
|
|
257
|
+
* re-listable. Times for fetched-but-not-yet-dispatched comments survive
|
|
258
|
+
* while their created_at is newer than the cursor (they may be dispatched
|
|
259
|
+
* later this poll), so eviction never loses a key's protection mid-poll.
|
|
260
|
+
*/
|
|
261
|
+
private pruneCommentTimes;
|
|
108
262
|
private dispatchEnvelope;
|
|
109
263
|
private claimInboundTask;
|
|
110
264
|
private runInboundTask;
|
|
111
265
|
private recoverInboundTasks;
|
|
112
266
|
private isRecoverableInboundTask;
|
|
113
267
|
private hasRecoverableInboundTasks;
|
|
268
|
+
/**
|
|
269
|
+
* Recoverable tasks that may hold the shared notification cursor. Pure
|
|
270
|
+
* backpressure is excluded: it has its own durable retry and a bounded
|
|
271
|
+
* deferral horizon, and must not freeze mark-as-read for every unrelated
|
|
272
|
+
* PR the channel follows. This covers both bound deliveries and the
|
|
273
|
+
* targetless deferrals an incomplete binding snapshot produces (no
|
|
274
|
+
* delivery yet, same durable retry). Watch tasks are excluded while
|
|
275
|
+
* reconcile is blocked: recovery skips them and the drain cannot run, so
|
|
276
|
+
* they cannot make progress — and watch events are detected from PR
|
|
277
|
+
* state, not notifications, so holding the cursor for them only stalls
|
|
278
|
+
* unrelated comment traffic until the watch sidecar recovers. Once
|
|
279
|
+
* reconcile succeeds they count again, and their retry budgets guarantee
|
|
280
|
+
* they settle instead of freezing the cursor forever.
|
|
281
|
+
*/
|
|
282
|
+
private hasCursorBlockingTasks;
|
|
283
|
+
/**
|
|
284
|
+
* Terminal outcome for a bound event that can no longer be delivered:
|
|
285
|
+
* append it to the private dead-letter log (the private path's exhaustion
|
|
286
|
+
* surface — it posts no public error comment) and remove the task. The
|
|
287
|
+
* event is surfaced for operator inspection, never silently consumed —
|
|
288
|
+
* including when the dead-letter write itself fails: the task is then
|
|
289
|
+
* kept, not removed.
|
|
290
|
+
*/
|
|
291
|
+
private retireBoundTask;
|
|
114
292
|
private hasPendingFinalDeliveryForTask;
|
|
115
293
|
private inboundTaskSourceKey;
|
|
294
|
+
private publicationAuditKeysCache;
|
|
295
|
+
private publicationAuditBlocked;
|
|
296
|
+
/**
|
|
297
|
+
* Publication audit keys cached for the current poll (reset at pollOnce
|
|
298
|
+
* start). Strict: an unreadable audit fails closed so the caller skips
|
|
299
|
+
* the event this poll instead of risking a duplicate publication.
|
|
300
|
+
*/
|
|
301
|
+
private publicationAuditKeysThisPoll;
|
|
116
302
|
private readPublicationAuditKeys;
|
|
117
303
|
private applyTaskDedupe;
|
|
118
304
|
private transitionInboundTask;
|
|
@@ -131,6 +317,218 @@ export declare class GithubChannel extends PollingChannelBase<GithubCursor> {
|
|
|
131
317
|
private buildRouteMetadata;
|
|
132
318
|
private githubApi;
|
|
133
319
|
private sleepForRetry;
|
|
320
|
+
private prBindingKey;
|
|
321
|
+
/**
|
|
322
|
+
* Parses a binding URL into its repo/number identity. Only GitHub web URLs
|
|
323
|
+
* on this channel's host qualify; Aone and other providers are ignored.
|
|
324
|
+
* Trailing tab segments (/files, /commits, /checks) are tolerated: the
|
|
325
|
+
* binding routes accept any http(s) URL naming the PR.
|
|
326
|
+
*/
|
|
327
|
+
private parsePrBindingUrl;
|
|
328
|
+
/**
|
|
329
|
+
* The cause clause of the cold-empty cap line, attributed from how many
|
|
330
|
+
* polls of the streak were failed lookups rather than empty partial
|
|
331
|
+
* answers: the majority cause leads and the other count is kept.
|
|
332
|
+
* boundSnapshotFailureStreak cannot carry this: any successful answer
|
|
333
|
+
* resets it, so a run of failed lookups broken by one empty partial
|
|
334
|
+
* would be blamed on the daemon's storage.
|
|
335
|
+
*/
|
|
336
|
+
private coldEmptyCapCause;
|
|
337
|
+
private refreshBoundSessions;
|
|
338
|
+
private resolveBoundDelivery;
|
|
339
|
+
/**
|
|
340
|
+
* Pick the most-recent live follower of a PR from the full binding list,
|
|
341
|
+
* excluding sessions already known Gone in this delivery attempt. Unlike
|
|
342
|
+
* resolveBoundDelivery (the single routing-map winner), this scans every
|
|
343
|
+
* listed follower so the gone-fallback can iterate past a Gone winner to
|
|
344
|
+
* the next live session — evicting the winner empties the routing map, and
|
|
345
|
+
* a stale refresh can re-list an already-Gone session as the winner; both
|
|
346
|
+
* would otherwise skip a live follower and fall through to an irreversible
|
|
347
|
+
* public reply while a complete snapshot still lists a follower.
|
|
348
|
+
*/
|
|
349
|
+
private resolveBoundDeliveryExcluding;
|
|
350
|
+
/**
|
|
351
|
+
* Role-aware fan-out is opt-in through the map's presence: with no
|
|
352
|
+
* boundSessionActions configured, every routing decision below keeps the
|
|
353
|
+
* legacy single-winner shape verbatim.
|
|
354
|
+
*/
|
|
355
|
+
private get boundRoleAware();
|
|
356
|
+
/**
|
|
357
|
+
* Every non-channel follower of a PR from the full binding list, each with
|
|
358
|
+
* the role of the entry that names THIS PR (a session may follow several
|
|
359
|
+
* PRs with different roles). Scans lastBindings so partial-snapshot
|
|
360
|
+
* retention participates exactly as it does in the legacy routing map.
|
|
361
|
+
*/
|
|
362
|
+
private boundFollowersOf;
|
|
363
|
+
/**
|
|
364
|
+
* The event class a bound delivery resolves templates against: the watch
|
|
365
|
+
* type from the durable message id (authoritative — the metadata Event
|
|
366
|
+
* line is display, not identity), else the notification trigger reason.
|
|
367
|
+
* An envelope with neither has no class and resolves through `default`.
|
|
368
|
+
*/
|
|
369
|
+
private boundEventClass;
|
|
370
|
+
/**
|
|
371
|
+
* The lane class for template resolution: comment-lane tasks (direct and
|
|
372
|
+
* aggregate, identified by their dispatchedComments dedupe) fall back to
|
|
373
|
+
* `comment` after the thread's notification reason, so a `fix:comment`
|
|
374
|
+
* template catches a comment delivered under `mention`/`subscribed`/
|
|
375
|
+
* `author` too. Watch and direct-event lanes have no lane fallback.
|
|
376
|
+
*/
|
|
377
|
+
private boundLaneClass;
|
|
378
|
+
private boundEventKey;
|
|
379
|
+
private boundEventAlreadyDelivered;
|
|
380
|
+
/**
|
|
381
|
+
* Per-target completion check for fan-out reconstruction. A missing task
|
|
382
|
+
* can mean "never claimed" OR "delivered and removed"; recreating a
|
|
383
|
+
* completed target would re-execute the event for that role after a
|
|
384
|
+
* rebind (a new session's admission ring has never seen the key). An
|
|
385
|
+
* unreadable ring cannot prove completion — reconstruct rather than lose
|
|
386
|
+
* the target (at-least-once; the same-session admission ring still
|
|
387
|
+
* dedupes).
|
|
388
|
+
*/
|
|
389
|
+
private boundTargetCompleted;
|
|
390
|
+
/**
|
|
391
|
+
* Mark the event's logical fan-out slot complete on the carrier task.
|
|
392
|
+
* The slot is the ROLE, not the session: a deferred target that accepts
|
|
393
|
+
* after retargeting completes the ORIGINAL slot, and the mark lives on
|
|
394
|
+
* the carrier task — durable for exactly as long as a surviving sibling
|
|
395
|
+
* can reconstruct it, immune to the bounded ring's FIFO eviction.
|
|
396
|
+
* MANDATORY, not best-effort: the mark is the only evidence connecting
|
|
397
|
+
* an acceptance to its original slot, so a write failure throws and the
|
|
398
|
+
* accepted task is NOT removed — its persisted deliveredAt record lets
|
|
399
|
+
* recovery retry the mark before retiring it, and reconstruction honors
|
|
400
|
+
* that acceptance evidence in the meantime (boundSlotAcceptancePending).
|
|
401
|
+
*/
|
|
402
|
+
private markFanoutSlotCompleted;
|
|
403
|
+
/**
|
|
404
|
+
* Acceptance evidence for a logical slot whose completion mark is not
|
|
405
|
+
* yet durable: a sibling task of the same event already carries
|
|
406
|
+
* deliveredAt (the daemon accepted its prompt). Reconstruction must
|
|
407
|
+
* honor it across rebinding — the accepting session may differ from the
|
|
408
|
+
* slot's original session, so the per-target ring key cannot stand in.
|
|
409
|
+
* Recovery completes the mark from the deliveredAt record before
|
|
410
|
+
* retiring the task; until then the slot stays unreconstructable.
|
|
411
|
+
*/
|
|
412
|
+
private boundSlotAcceptancePending;
|
|
413
|
+
/**
|
|
414
|
+
* Persist a terminal private retirement BEFORE the routing identity is
|
|
415
|
+
* cleared or the task removed: if the removal then fails (EIO), restart
|
|
416
|
+
* must find a non-recoverable task, not a running untargeted one that
|
|
417
|
+
* falls through to the public reply path.
|
|
418
|
+
*/
|
|
419
|
+
private markPrivatelyRetired;
|
|
420
|
+
private loadBoundDeliveredRing;
|
|
421
|
+
/**
|
|
422
|
+
* Record a private acceptance in the durable ring: the event key (blocks
|
|
423
|
+
* any public fallback for the event) AND a per-target key (secondary
|
|
424
|
+
* reconstruction guard; the authoritative per-slot completion mark lives
|
|
425
|
+
* on the carrier task, see markFanoutSlotCompleted).
|
|
426
|
+
* Best-effort persistence (the in-memory set still suppresses duplicates
|
|
427
|
+
* for this lifetime); a write failure is surfaced, never thrown into the
|
|
428
|
+
* delivery path.
|
|
429
|
+
*/
|
|
430
|
+
private recordBoundDelivered;
|
|
431
|
+
/**
|
|
432
|
+
* Resolution chain: role:event → role:lane → role:default → event → lane
|
|
433
|
+
* → default. `lane` is the comment lane's class (`comment`): comment
|
|
434
|
+
* events carry the THREAD's notification reason, so a `fix:comment`
|
|
435
|
+
* template must also catch a comment delivered under `mention`,
|
|
436
|
+
* `subscribed`, or `author` — the reason-specific key still wins when
|
|
437
|
+
* configured. Untyped winners resolve only the bare chain. No match →
|
|
438
|
+
* undefined, which in role-aware mode SKIPS the role for this event (the
|
|
439
|
+
* map is a per-role subscription) and in legacy mode cannot happen (the
|
|
440
|
+
* map is empty).
|
|
441
|
+
*/
|
|
442
|
+
private resolveBoundActionTemplate;
|
|
443
|
+
/**
|
|
444
|
+
* The delivery targets for one event. Legacy mode: the single routing-map
|
|
445
|
+
* winner (or none). Role-aware mode: one winner per role group — the most
|
|
446
|
+
* recently updated follower within the group — keeping only groups whose
|
|
447
|
+
* template chain matches the event class. `followed` distinguishes "no
|
|
448
|
+
* follower at all" (the legacy absence gate decides public vs defer) from
|
|
449
|
+
* "followers exist but no role matched" (an operator subscription
|
|
450
|
+
* decision: retire privately, never public).
|
|
451
|
+
*/
|
|
452
|
+
private resolveBoundTargets;
|
|
453
|
+
/**
|
|
454
|
+
* Delivery-time re-validation of a frozen target against the latest
|
|
455
|
+
* complete snapshot. Legacy mode keeps the base contract (the single
|
|
456
|
+
* winner, retarget on rebind). Role-aware mode re-resolves WITHIN the
|
|
457
|
+
* task's role group, so a live rebind retargets to the role's new winner
|
|
458
|
+
* and a role that lost its match retires privately instead of leaking
|
|
459
|
+
* into another role's session.
|
|
460
|
+
*/
|
|
461
|
+
private revalidateBoundTarget;
|
|
462
|
+
/**
|
|
463
|
+
* Render an operator template. GitLab's substitution contract: `%%` is a
|
|
464
|
+
* literal percent, an unknown `%foo%` stays literal (a typo is visible in
|
|
465
|
+
* the delivered prompt, never silently vanished). Substituted values are
|
|
466
|
+
* GitHub-controlled DATA: sanitized and capped with a visible marker, so
|
|
467
|
+
* a hostile title cannot smuggle unbounded text into the trusted block.
|
|
468
|
+
* Deterministic for a given (event, role, configuration) — retries render
|
|
469
|
+
* the same instruction.
|
|
470
|
+
*/
|
|
471
|
+
private renderBoundAction;
|
|
472
|
+
/**
|
|
473
|
+
* Remove a session the daemon reported permanently gone from both binding
|
|
474
|
+
* maps. A later partial snapshot otherwise retains it by recency (an
|
|
475
|
+
* incomplete enumeration is a non-absence, but an authoritative Gone is),
|
|
476
|
+
* shadowing any live follower of the same PR.
|
|
477
|
+
*/
|
|
478
|
+
private evictBoundSession;
|
|
479
|
+
private buildBoundSessionPrompt;
|
|
480
|
+
private deliverToBoundSession;
|
|
481
|
+
private prWatchStatePath;
|
|
482
|
+
private loadPrWatchState;
|
|
483
|
+
/**
|
|
484
|
+
* Whether any persisted watch entry still holds pending events. Keeps
|
|
485
|
+
* recovery blocked while watch subscriptions are disabled: an accepted
|
|
486
|
+
* task whose pending record is unreconciled must not be delivered and
|
|
487
|
+
* removed ahead of a later re-enabled drain. Fail-closed on read errors.
|
|
488
|
+
*/
|
|
489
|
+
private hasUnreconciledWatchPending;
|
|
490
|
+
/**
|
|
491
|
+
* PR keys whose earlier watch transition still has a recoverable inbound
|
|
492
|
+
* task. Undefined when the task store cannot be read: the caller must
|
|
493
|
+
* not prune or evict watch memory it cannot cross-check (fail-closed).
|
|
494
|
+
*/
|
|
495
|
+
private survivingWatchPrKeys;
|
|
496
|
+
private savePrWatchState;
|
|
497
|
+
/**
|
|
498
|
+
* Drain durable pending watch events independently of the live API pass
|
|
499
|
+
* and BEFORE generic recovery. Needs no GitHub calls: a failing or
|
|
500
|
+
* rate-limited watch pass must not starve already-detected events, and
|
|
501
|
+
* recovery must not deliver-and-remove a task that a later drain would
|
|
502
|
+
* re-claim (crash between the claim and the pending->fired save leaves
|
|
503
|
+
* both records on disk).
|
|
504
|
+
*/
|
|
505
|
+
private reconcilePendingWatch;
|
|
506
|
+
/**
|
|
507
|
+
* Edge-triggered state watch over the PRs bound to live sessions. Runs
|
|
508
|
+
* inside the existing poll loop; detection is API-level and costs no model
|
|
509
|
+
* tokens until a real transition fires.
|
|
510
|
+
*/
|
|
511
|
+
private runPrStateWatch;
|
|
512
|
+
private watchOnePr;
|
|
513
|
+
/**
|
|
514
|
+
* Deliver queued watch events. Order per event: claim the inbound task
|
|
515
|
+
* (durable), move the key from pending to fired (durable), then run the
|
|
516
|
+
* task. A crash at any point leaves either a pending event or a claimed
|
|
517
|
+
* task for the next poll / recovery, and the fired ring prevents a second
|
|
518
|
+
* delivery of the same transition.
|
|
519
|
+
*/
|
|
520
|
+
private drainPendingWatch;
|
|
521
|
+
/**
|
|
522
|
+
* Role-aware watch drain: one durable task per (event, matched role
|
|
523
|
+
* winner). The event leaves `pending` for `fired` only after EVERY
|
|
524
|
+
* matched target is claimed, so a crash mid-fan-out re-claims exactly the
|
|
525
|
+
* missing targets (claimInboundTask reuses an existing (event, target)
|
|
526
|
+
* task). Ordering is per (PR, target): a target with an unsettled
|
|
527
|
+
* predecessor waits while the event's other targets drain — one stuck
|
|
528
|
+
* role never head-of-line-blocks another.
|
|
529
|
+
*/
|
|
530
|
+
private drainPendingWatchRoleAware;
|
|
531
|
+
private fetchCiAggregate;
|
|
134
532
|
private markNotificationsAsRead;
|
|
135
533
|
private postErrorComment;
|
|
136
534
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GithubAdapter.d.ts","sourceRoot":"","sources":["../src/GithubAdapter.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,yBAAyB,
|
|
1
|
+
{"version":3,"file":"GithubAdapter.d.ts","sourceRoot":"","sources":["../src/GithubAdapter.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EAI1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAOL,kBAAkB,EAMnB,MAAM,yBAAyB,CAAC;AAIjC,UAAU,YAAa,SAAQ,aAAa;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAgID,UAAU,YAAY;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE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