cli-jaw 2.2.19 → 2.2.20
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 +94 -3
- package/dist/server.js +11 -0
- package/dist/server.js.map +1 -1
- package/dist/src/agent/spawn/process-kill.js +96 -2
- package/dist/src/agent/spawn/process-kill.js.map +1 -1
- package/dist/src/agent/spawn.js +34 -65
- package/dist/src/agent/spawn.js.map +1 -1
- package/dist/src/bgtask/runner.js +26 -21
- package/dist/src/bgtask/runner.js.map +1 -1
- package/dist/src/cli/acp-client.js +11 -5
- package/dist/src/cli/acp-client.js.map +1 -1
- package/dist/src/cli/employee-handler.js +3 -2
- package/dist/src/cli/employee-handler.js.map +1 -1
- package/dist/src/code-mode/acp-host.js +22 -10
- package/dist/src/code-mode/acp-host.js.map +1 -1
- package/dist/src/core/config.js +14 -0
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/core/db.js +16 -0
- package/dist/src/core/db.js.map +1 -1
- package/dist/src/core/employees.js +22 -4
- package/dist/src/core/employees.js.map +1 -1
- package/dist/src/core/windows-shell.js +63 -0
- package/dist/src/core/windows-shell.js.map +1 -0
- package/dist/src/discord/bot.js +199 -147
- package/dist/src/discord/bot.js.map +1 -1
- package/dist/src/discord/gateway-supervisor.js +303 -0
- package/dist/src/discord/gateway-supervisor.js.map +1 -0
- package/dist/src/discord/rest-scheduler.js +448 -0
- package/dist/src/discord/rest-scheduler.js.map +1 -0
- package/dist/src/discord/send-only-client.js +59 -43
- package/dist/src/discord/send-only-client.js.map +1 -1
- package/dist/src/manager/lifecycle.js +7 -2
- package/dist/src/manager/lifecycle.js.map +1 -1
- package/dist/src/manager/notes/capabilities.js +9 -7
- package/dist/src/manager/notes/capabilities.js.map +1 -1
- package/dist/src/memory/bootstrap.js +5 -1
- package/dist/src/memory/bootstrap.js.map +1 -1
- package/dist/src/memory/host-toolchain.js +156 -0
- package/dist/src/memory/host-toolchain.js.map +1 -0
- package/dist/src/messaging/channel-capabilities.js +30 -0
- package/dist/src/messaging/channel-capabilities.js.map +1 -0
- package/dist/src/messaging/delivery-outcome.js +73 -0
- package/dist/src/messaging/delivery-outcome.js.map +1 -0
- package/dist/src/messaging/draft-stream.js +154 -0
- package/dist/src/messaging/draft-stream.js.map +1 -0
- package/dist/src/messaging/runtime.js +3 -9
- package/dist/src/messaging/runtime.js.map +1 -1
- package/dist/src/messaging/send.js +40 -8
- package/dist/src/messaging/send.js.map +1 -1
- package/dist/src/messaging/types.js +22 -1
- package/dist/src/messaging/types.js.map +1 -1
- package/dist/src/notes/search.js +6 -4
- package/dist/src/notes/search.js.map +1 -1
- package/dist/src/prompt/builder.js +110 -6
- package/dist/src/prompt/builder.js.map +1 -1
- package/dist/src/prompt/conversation-context.js +23 -0
- package/dist/src/prompt/conversation-context.js.map +1 -0
- package/dist/src/prompt/templates/a1-system.md +28 -12
- package/dist/src/prompt/templates/control-system.md +19 -6
- package/dist/src/prompt/templates/employee.md +16 -3
- package/dist/src/security/path-guards.js +124 -27
- package/dist/src/security/path-guards.js.map +1 -1
- package/dist/src/slack/api.js +38 -5
- package/dist/src/slack/api.js.map +1 -1
- package/dist/src/slack/bot.js +214 -35
- package/dist/src/slack/bot.js.map +1 -1
- package/dist/src/slack/context.js +192 -0
- package/dist/src/slack/context.js.map +1 -0
- package/dist/src/slack/conversation.js +275 -0
- package/dist/src/slack/conversation.js.map +1 -0
- package/dist/src/slack/enrichment-cache.js +334 -0
- package/dist/src/slack/enrichment-cache.js.map +1 -0
- package/dist/src/slack/history.js +47 -8
- package/dist/src/slack/history.js.map +1 -1
- package/dist/src/slack/identity.js +99 -190
- package/dist/src/slack/identity.js.map +1 -1
- package/dist/src/slack/ingress.js +78 -2
- package/dist/src/slack/ingress.js.map +1 -1
- package/dist/src/slack/progress.js +39 -51
- package/dist/src/slack/progress.js.map +1 -1
- package/dist/src/slack/thread-tracker.js +78 -0
- package/dist/src/slack/thread-tracker.js.map +1 -1
- package/dist/src/telegram/bot.js +105 -56
- package/dist/src/telegram/bot.js.map +1 -1
- package/dist/src/telegram/update-offset.js +152 -0
- package/dist/src/telegram/update-offset.js.map +1 -0
- package/package.json +1 -1
- package/public/dist/assets/Agent-C5EvX-_v.js +1 -0
- package/public/dist/assets/{manager-Bjuh1jpq.js → manager-CP-Au860.js} +1 -1
- package/public/dist/manager/index.html +1 -1
- package/public/manager/src/settings/cli-status-polling.ts +84 -0
- package/public/manager/src/settings/pages/Agent.tsx +84 -5
- package/scripts/install-officecli.ps1 +38 -2
- package/scripts/install.ps1 +1 -1
- package/public/dist/assets/Agent-nMPZsMfN.js +0 -1
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
// ─── Enrichment Cache ────────────────────────────────
|
|
2
|
+
// The concurrency primitive behind Slack enrichment lookups: TTL cache with cap
|
|
3
|
+
// eviction, classified failure suppression, capability lockout with a single
|
|
4
|
+
// re-probe, in-flight coalescing, generation invalidation, and per-caller
|
|
5
|
+
// cancellation.
|
|
6
|
+
//
|
|
7
|
+
// Why this exists as its own module: every one of those concerns was already
|
|
8
|
+
// implemented, correctly and expensively, inside identity.ts — and specifying it
|
|
9
|
+
// a SECOND time for conversation lookups produced four consecutive audit
|
|
10
|
+
// failures, because the second specification kept disagreeing with the first
|
|
11
|
+
// about cancellation ownership. Extracting it means the discipline is written
|
|
12
|
+
// once and both adapters inherit it. Design: devlog
|
|
13
|
+
// 260812_slack_conversation_context/012_wp1_replan_shared_primitive.md.
|
|
14
|
+
//
|
|
15
|
+
// Two rules run through everything below:
|
|
16
|
+
// 1. Enrichment is decoration, never a precondition. Every failure path
|
|
17
|
+
// degrades; nothing here throws at its caller.
|
|
18
|
+
// 2. Shared work belongs to no single caller. One caller cancelling must not
|
|
19
|
+
// cancel the lookup its peers are waiting on.
|
|
20
|
+
const DEFAULT_SUPPRESSION_CAP = 1000;
|
|
21
|
+
export class EnrichmentCache {
|
|
22
|
+
partitions;
|
|
23
|
+
caches = new Map();
|
|
24
|
+
/** key -> epoch ms until which the key is suppressed. */
|
|
25
|
+
suppressed = new Map();
|
|
26
|
+
inFlight = new Map();
|
|
27
|
+
/** Capability keys whose lock has lapsed and whose re-probe is in flight. */
|
|
28
|
+
probing = new Set();
|
|
29
|
+
suppressionCap;
|
|
30
|
+
classifyFailure;
|
|
31
|
+
onEvent;
|
|
32
|
+
/**
|
|
33
|
+
* Bumped by reset. Captured at dispatch and re-checked before BOTH the cache
|
|
34
|
+
* write and the publication to waiters, so a lookup issued under a superseded
|
|
35
|
+
* token can neither poison the cache nor leak a stale value to a caller.
|
|
36
|
+
*/
|
|
37
|
+
generation = 0;
|
|
38
|
+
constructor(options) {
|
|
39
|
+
this.partitions = options.partitions;
|
|
40
|
+
this.suppressionCap = options.suppressionCap ?? DEFAULT_SUPPRESSION_CAP;
|
|
41
|
+
this.classifyFailure = options.classifyFailure;
|
|
42
|
+
this.onEvent = options.onEvent;
|
|
43
|
+
for (const name of Object.keys(options.partitions)) {
|
|
44
|
+
this.caches.set(name, new Map());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Cache-only read. Never calls the loader; a miss is simply undefined. */
|
|
48
|
+
get(partition, resourceKey) {
|
|
49
|
+
const cache = this.caches.get(partition);
|
|
50
|
+
const entry = cache?.get(resourceKey);
|
|
51
|
+
if (!entry)
|
|
52
|
+
return undefined;
|
|
53
|
+
if (entry.expiresAt <= Date.now()) {
|
|
54
|
+
cache.delete(resourceKey);
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
return entry.value;
|
|
58
|
+
}
|
|
59
|
+
/** Insert a value obtained elsewhere (a bulk listing, a push payload). */
|
|
60
|
+
prime(partition, resourceKey, value) {
|
|
61
|
+
this.write(partition, resourceKey, value);
|
|
62
|
+
}
|
|
63
|
+
entryCount(partition) {
|
|
64
|
+
return this.caches.get(partition)?.size ?? 0;
|
|
65
|
+
}
|
|
66
|
+
isSuppressed(key) {
|
|
67
|
+
const until = this.suppressed.get(key);
|
|
68
|
+
if (until === undefined)
|
|
69
|
+
return false;
|
|
70
|
+
if (until <= Date.now()) {
|
|
71
|
+
this.suppressed.delete(key);
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Suppress a key directly. Exposed for adapters that learn about a failure
|
|
78
|
+
* outside a `resolve` call.
|
|
79
|
+
*/
|
|
80
|
+
suppress(key, ttlMs) {
|
|
81
|
+
this.suppressed.set(key, Date.now() + ttlMs);
|
|
82
|
+
if (this.suppressed.size > this.suppressionCap) {
|
|
83
|
+
const entries = [...this.suppressed.entries()].sort((a, b) => a[1] - b[1]);
|
|
84
|
+
for (const [stale] of entries.slice(0, Math.floor(this.suppressed.size / 2))) {
|
|
85
|
+
this.suppressed.delete(stale);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Release a capability lock and its probe reservation. */
|
|
90
|
+
clearCapability(capabilityKey) {
|
|
91
|
+
this.suppressed.delete(capabilityKey);
|
|
92
|
+
this.probing.delete(capabilityKey);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resolve a value, degrading rather than throwing.
|
|
96
|
+
*
|
|
97
|
+
* Admission order is fixed (and load-bearing): cache -> suppression ->
|
|
98
|
+
* in-flight join -> start-rate admission -> new upstream request. Joining an
|
|
99
|
+
* existing request is NOT a "start", so coalesced callers never consume the
|
|
100
|
+
* rate budget.
|
|
101
|
+
*/
|
|
102
|
+
async resolve(options) {
|
|
103
|
+
const { partition, resourceKey, capabilityKey, signal } = options;
|
|
104
|
+
const cached = this.get(partition, resourceKey);
|
|
105
|
+
if (cached !== undefined)
|
|
106
|
+
return cached;
|
|
107
|
+
// An already-cancelled caller should cost zero API calls.
|
|
108
|
+
if (signal?.aborted)
|
|
109
|
+
return options.degraded();
|
|
110
|
+
if (this.isSuppressed(resourceKey)) {
|
|
111
|
+
this.emit({ type: 'suppressed', scope: 'resource', key: resourceKey });
|
|
112
|
+
return options.degraded();
|
|
113
|
+
}
|
|
114
|
+
// Capability lock: while held, everyone degrades. Once it lapses exactly
|
|
115
|
+
// one caller is admitted to re-probe; the rest keep degrading until that
|
|
116
|
+
// probe answers. Letting them all through would restore the request storm
|
|
117
|
+
// the lock exists to prevent.
|
|
118
|
+
//
|
|
119
|
+
// The expiry check is INLINE rather than via isSuppressed(), because that
|
|
120
|
+
// helper deletes an expired key as a side effect — which erased the very
|
|
121
|
+
// marker that decides who becomes the probe, and admitted every caller.
|
|
122
|
+
let holdsProbe = false;
|
|
123
|
+
const lockedUntil = this.suppressed.get(capabilityKey);
|
|
124
|
+
if (lockedUntil !== undefined) {
|
|
125
|
+
if (lockedUntil > Date.now()) {
|
|
126
|
+
this.emit({ type: 'suppressed', scope: 'capability', key: capabilityKey });
|
|
127
|
+
return options.degraded();
|
|
128
|
+
}
|
|
129
|
+
if (this.probing.has(capabilityKey)) {
|
|
130
|
+
this.emit({ type: 'suppressed', scope: 'capability', key: capabilityKey });
|
|
131
|
+
return options.degraded();
|
|
132
|
+
}
|
|
133
|
+
// Lapsed and unclaimed: this caller is the single probe.
|
|
134
|
+
this.suppressed.delete(capabilityKey);
|
|
135
|
+
this.probing.add(capabilityKey);
|
|
136
|
+
holdsProbe = true;
|
|
137
|
+
}
|
|
138
|
+
else if (this.probing.has(capabilityKey)) {
|
|
139
|
+
// The probe holder already removed the marker; everyone else waits.
|
|
140
|
+
this.emit({ type: 'suppressed', scope: 'capability', key: capabilityKey });
|
|
141
|
+
return options.degraded();
|
|
142
|
+
}
|
|
143
|
+
const existing = this.inFlight.get(resourceKey);
|
|
144
|
+
if (existing && !existing.retired && existing.waiters > 0) {
|
|
145
|
+
if (holdsProbe)
|
|
146
|
+
this.probing.delete(capabilityKey);
|
|
147
|
+
return this.join(existing, options);
|
|
148
|
+
}
|
|
149
|
+
if (options.admitStart && !options.admitStart()) {
|
|
150
|
+
if (holdsProbe)
|
|
151
|
+
this.probing.delete(capabilityKey);
|
|
152
|
+
this.emit({ type: 'admission_declined', key: resourceKey });
|
|
153
|
+
return options.degraded();
|
|
154
|
+
}
|
|
155
|
+
return this.start(options, holdsProbe ? capabilityKey : null);
|
|
156
|
+
}
|
|
157
|
+
/** Invalidate everything. In-flight work is aborted and can no longer publish. */
|
|
158
|
+
reset() {
|
|
159
|
+
// Generation first: a request that settles during this call must already
|
|
160
|
+
// see itself as superseded.
|
|
161
|
+
this.generation += 1;
|
|
162
|
+
for (const record of this.inFlight.values()) {
|
|
163
|
+
record.retired = true;
|
|
164
|
+
record.controller.abort();
|
|
165
|
+
}
|
|
166
|
+
this.inFlight.clear();
|
|
167
|
+
this.probing.clear();
|
|
168
|
+
this.suppressed.clear();
|
|
169
|
+
for (const cache of this.caches.values())
|
|
170
|
+
cache.clear();
|
|
171
|
+
}
|
|
172
|
+
stats() {
|
|
173
|
+
const entries = {};
|
|
174
|
+
for (const [name, cache] of this.caches)
|
|
175
|
+
entries[name] = cache.size;
|
|
176
|
+
return { entries, suppressed: this.suppressed.size, inFlight: this.inFlight.size };
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The current generation. Adapters compare against the value handed to their
|
|
180
|
+
* loader to tell a live result from a superseded one — needed when a failure
|
|
181
|
+
* has side effects of its own (a warn-once latch, a metric).
|
|
182
|
+
*/
|
|
183
|
+
currentGeneration() {
|
|
184
|
+
return this.generation;
|
|
185
|
+
}
|
|
186
|
+
// ─── internals ──────────────────────────────────
|
|
187
|
+
emit(event) {
|
|
188
|
+
try {
|
|
189
|
+
this.onEvent?.(event);
|
|
190
|
+
}
|
|
191
|
+
catch { /* diagnostics must never break a lookup */ }
|
|
192
|
+
}
|
|
193
|
+
write(partition, resourceKey, value) {
|
|
194
|
+
const cache = this.caches.get(partition);
|
|
195
|
+
const spec = this.partitions[partition];
|
|
196
|
+
if (!cache || !spec)
|
|
197
|
+
return;
|
|
198
|
+
cache.set(resourceKey, { value, expiresAt: Date.now() + spec.ttlMs() });
|
|
199
|
+
if (cache.size > spec.cap) {
|
|
200
|
+
// Drop the half closest to expiry. Sorted by stored expiry rather than
|
|
201
|
+
// insertion order, because a re-write refreshes a value in place.
|
|
202
|
+
const entries = [...cache.entries()].sort((a, b) => a[1].expiresAt - b[1].expiresAt);
|
|
203
|
+
for (const [stale] of entries.slice(0, Math.floor(cache.size / 2))) {
|
|
204
|
+
cache.delete(stale);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/** Attach a caller to shared work, racing its own signal against the result. */
|
|
209
|
+
async join(record, options) {
|
|
210
|
+
record.waiters += 1;
|
|
211
|
+
try {
|
|
212
|
+
const value = await this.race(record, options.signal);
|
|
213
|
+
return value === undefined ? options.degraded() : value;
|
|
214
|
+
}
|
|
215
|
+
finally {
|
|
216
|
+
this.release(record, options.resourceKey);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Race shared work against this caller's cancellation.
|
|
221
|
+
*
|
|
222
|
+
* Cancelling abandons only this caller's interest — the shared request keeps
|
|
223
|
+
* running for its peers. `release` is what eventually stops it, once nobody
|
|
224
|
+
* is left waiting.
|
|
225
|
+
*/
|
|
226
|
+
race(record, signal) {
|
|
227
|
+
if (!signal)
|
|
228
|
+
return record.promise;
|
|
229
|
+
if (signal.aborted)
|
|
230
|
+
return Promise.resolve(undefined);
|
|
231
|
+
return new Promise(resolve => {
|
|
232
|
+
const finish = (value) => {
|
|
233
|
+
signal.removeEventListener('abort', onAbort);
|
|
234
|
+
resolve(value);
|
|
235
|
+
};
|
|
236
|
+
const onAbort = () => finish(undefined);
|
|
237
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
238
|
+
void record.promise.then(finish, () => finish(undefined));
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Drop one waiter. When the last one leaves, the record is retired
|
|
243
|
+
* SYNCHRONOUSLY before its controller is aborted, so a caller arriving in the
|
|
244
|
+
* same tick cannot attach to work that is already dying.
|
|
245
|
+
*/
|
|
246
|
+
release(record, resourceKey) {
|
|
247
|
+
record.waiters -= 1;
|
|
248
|
+
if (record.waiters > 0 || record.retired)
|
|
249
|
+
return;
|
|
250
|
+
record.retired = true;
|
|
251
|
+
if (this.inFlight.get(resourceKey) === record)
|
|
252
|
+
this.inFlight.delete(resourceKey);
|
|
253
|
+
// An abandoned probe reservation must be returned: an abort is neither a
|
|
254
|
+
// successful probe nor a capability failure, and holding it would keep the
|
|
255
|
+
// capability locked forever.
|
|
256
|
+
if (record.probeKey) {
|
|
257
|
+
this.probing.delete(record.probeKey);
|
|
258
|
+
record.probeKey = null;
|
|
259
|
+
}
|
|
260
|
+
// Only cancel work that is still running. The last waiter also departs on
|
|
261
|
+
// the SUCCESS path, and aborting there would fire cancellation handlers
|
|
262
|
+
// for a request that already delivered its value.
|
|
263
|
+
if (!record.settled)
|
|
264
|
+
record.controller.abort();
|
|
265
|
+
}
|
|
266
|
+
start(options, probeKey) {
|
|
267
|
+
const { partition, resourceKey, capabilityKey } = options;
|
|
268
|
+
const controller = new AbortController();
|
|
269
|
+
const generation = this.generation;
|
|
270
|
+
const record = {
|
|
271
|
+
promise: Promise.resolve(undefined),
|
|
272
|
+
controller,
|
|
273
|
+
waiters: 0,
|
|
274
|
+
probeKey,
|
|
275
|
+
retired: false,
|
|
276
|
+
settled: false,
|
|
277
|
+
};
|
|
278
|
+
record.promise = options
|
|
279
|
+
.load({ signal: controller.signal, generation })
|
|
280
|
+
.then((result) => {
|
|
281
|
+
// A result from a superseded generation describes the OLD token or
|
|
282
|
+
// workspace. It may neither be cached NOR handed to a waiter:
|
|
283
|
+
// returning it would leak one stale value per reset boundary.
|
|
284
|
+
if (generation !== this.generation) {
|
|
285
|
+
this.emit({ type: 'stale_discarded', key: resourceKey });
|
|
286
|
+
return undefined;
|
|
287
|
+
}
|
|
288
|
+
if (result.ok) {
|
|
289
|
+
if (record.probeKey) {
|
|
290
|
+
this.clearCapability(record.probeKey);
|
|
291
|
+
record.probeKey = null;
|
|
292
|
+
}
|
|
293
|
+
this.write(partition, resourceKey, result.value);
|
|
294
|
+
return result.value;
|
|
295
|
+
}
|
|
296
|
+
const suppression = this.classifyFailure(result.error, { resourceKey, capabilityKey });
|
|
297
|
+
if (suppression.kind === 'capability') {
|
|
298
|
+
this.suppress(suppression.key, suppression.ttlMs);
|
|
299
|
+
this.probing.delete(suppression.key);
|
|
300
|
+
if (record.probeKey === suppression.key)
|
|
301
|
+
record.probeKey = null;
|
|
302
|
+
this.emit({ type: 'capability_locked', key: suppression.key, error: result.error });
|
|
303
|
+
}
|
|
304
|
+
else if (suppression.kind === 'resource') {
|
|
305
|
+
this.suppress(suppression.key, suppression.ttlMs);
|
|
306
|
+
}
|
|
307
|
+
// A probe that failed for an unrelated reason must still release
|
|
308
|
+
// its reservation, or the capability never gets probed again.
|
|
309
|
+
if (record.probeKey) {
|
|
310
|
+
this.probing.delete(record.probeKey);
|
|
311
|
+
record.probeKey = null;
|
|
312
|
+
}
|
|
313
|
+
return undefined;
|
|
314
|
+
})
|
|
315
|
+
.catch(() => {
|
|
316
|
+
if (record.probeKey) {
|
|
317
|
+
this.probing.delete(record.probeKey);
|
|
318
|
+
record.probeKey = null;
|
|
319
|
+
}
|
|
320
|
+
return undefined;
|
|
321
|
+
})
|
|
322
|
+
.finally(() => {
|
|
323
|
+
record.settled = true;
|
|
324
|
+
// Identity-checked: a retired record may already have been replaced,
|
|
325
|
+
// and deleting the replacement would strand its waiters.
|
|
326
|
+
if (this.inFlight.get(resourceKey) === record)
|
|
327
|
+
this.inFlight.delete(resourceKey);
|
|
328
|
+
});
|
|
329
|
+
this.inFlight.set(resourceKey, record);
|
|
330
|
+
void capabilityKey; // capability state is keyed by the caller's choice
|
|
331
|
+
return this.join(record, options);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=enrichment-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrichment-cache.js","sourceRoot":"","sources":["../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AW,EAAE,MAAM,CAAC,CAAC;QACvC,KAAK,aAAa,CAAC,CAAC,mDAAmD;QACvE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACJ"}
|
|
@@ -31,19 +31,58 @@ function normalize(raw) {
|
|
|
31
31
|
}
|
|
32
32
|
return out;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Abortable sleep. A cancelled ingress must not hold the loop open, which is
|
|
36
|
+
* why the timer is unref'd by default.
|
|
37
|
+
*
|
|
38
|
+
* `keepAlive` exists for callers that are AWAITING the pause as part of their
|
|
39
|
+
* result: an unref'd timer lets the process exit mid-await, and the pending
|
|
40
|
+
* promise then resolves never. Under CI load that surfaced as
|
|
41
|
+
* "Promise resolution is still pending but the event loop has already
|
|
42
|
+
* resolved" on the retry-backoff path.
|
|
43
|
+
*/
|
|
44
|
+
function sleepUnlessAborted(ms, signal, keepAlive = false) {
|
|
45
|
+
if (signal?.aborted)
|
|
46
|
+
return Promise.resolve();
|
|
47
|
+
return new Promise(resolve => {
|
|
48
|
+
const timer = setTimeout(finish, ms);
|
|
49
|
+
if (!keepAlive)
|
|
50
|
+
timer.unref?.();
|
|
51
|
+
function finish() {
|
|
52
|
+
clearTimeout(timer);
|
|
53
|
+
signal?.removeEventListener('abort', finish);
|
|
54
|
+
resolve();
|
|
55
|
+
}
|
|
56
|
+
signal?.addEventListener('abort', finish, { once: true });
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async function callWithRetry(token, method, body, opts = {}) {
|
|
35
60
|
// form-encoded on purpose: conversations.replies REJECTS a JSON body with
|
|
36
61
|
// invalid_arguments ("missing required field: channel/ts") — verified live
|
|
37
62
|
// 2026-08-06 against T0BMJ7RSPHQ. conversations.history accepts both, so
|
|
38
63
|
// both ride the form path for one consistent contract.
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
const callOpts = {
|
|
65
|
+
form: true,
|
|
66
|
+
...(opts.fetchImpl ? { fetchImpl: opts.fetchImpl } : {}),
|
|
67
|
+
...(opts.signal ? { signal: opts.signal } : {}),
|
|
68
|
+
};
|
|
69
|
+
let result = await slackApi(token, method, body, callOpts);
|
|
70
|
+
// A 429 is retried by default (existing callers depend on it), but an
|
|
71
|
+
// enrichment caller opts out: it applies its own suppression window, and a
|
|
72
|
+
// retry would fire a second request before that window exists.
|
|
73
|
+
const retryable = isRetryableSlackError(result.error)
|
|
74
|
+
&& !(opts.noRetryOnRateLimit && result.error === 'ratelimited');
|
|
75
|
+
if (!result.ok && retryable && !opts.signal?.aborted) {
|
|
42
76
|
// One bounded retry after a short pause (Hermes uses 1s/2s; a single
|
|
43
77
|
// 1s attempt is enough for an interactive lookup — the caller can
|
|
44
78
|
// simply retry the whole request otherwise).
|
|
45
|
-
|
|
46
|
-
|
|
79
|
+
// keepAlive: the caller is awaiting this pause to produce its result,
|
|
80
|
+
// so the process must not be allowed to exit mid-backoff.
|
|
81
|
+
await sleepUnlessAborted(1000, opts.signal, true);
|
|
82
|
+
// Re-check: the wait is where a cancel usually lands.
|
|
83
|
+
if (!opts.signal?.aborted) {
|
|
84
|
+
result = await slackApi(token, method, body, callOpts);
|
|
85
|
+
}
|
|
47
86
|
}
|
|
48
87
|
if (!result.ok) {
|
|
49
88
|
// describeSlackError output is operator prose (never echoes tokens);
|
|
@@ -75,7 +114,7 @@ export function fetchSlackHistory(token, channel, opts = {}) {
|
|
|
75
114
|
// Slack ignores `inclusive` when neither bound is present; send it only
|
|
76
115
|
// when it can actually take effect.
|
|
77
116
|
...(opts.inclusive && (opts.oldest || opts.latest) ? { inclusive: true } : {}),
|
|
78
|
-
}, opts
|
|
117
|
+
}, opts);
|
|
79
118
|
}
|
|
80
119
|
/** One thread: conversations.replies (parent message included, oldest first). */
|
|
81
120
|
export function fetchSlackReplies(token, channel, threadTs, opts = {}) {
|
|
@@ -83,7 +122,7 @@ export function fetchSlackReplies(token, channel, threadTs, opts = {}) {
|
|
|
83
122
|
channel,
|
|
84
123
|
ts: threadTs,
|
|
85
124
|
limit: clampLimit(opts.limit),
|
|
86
|
-
}, opts
|
|
125
|
+
}, opts);
|
|
87
126
|
}
|
|
88
127
|
const FORMAT_CHAR_CAP = 6000;
|
|
89
128
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/slack/history.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,wEAAwE;AACxE,4EAA4E;AAC5E,wEAAwE;AACxE,kEAAkE;AAClE,0EAA0E;AAC1E,4EAA4E;AAE5E,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,qBAAqB,EAAmB,MAAM,UAAU,CAAC;AAEhG,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAkB9D,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAS3C,SAAS,UAAU,CAAC,KAAyB;IACzC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,2BAA2B,CAAC;IACvD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,SAAS,CAAC,GAAiB;IAChC,MAAM,GAAG,GAA0B,EAAE,CAAC;IACtC,KAAK,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ;YAAE,SAAS;QAC7C,GAAG,CAAC,IAAI,CAAC;YACL,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,SAAS,E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