osborn 0.9.253 → 0.9.254
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/claude-llm.d.ts +2 -0
- package/dist/claude-llm.js +31 -3
- package/dist/index.js +15 -5
- package/dist/pipeline-direct-llm.d.ts +6 -0
- package/dist/pipeline-direct-llm.js +8 -1
- package/package.json +1 -1
package/dist/claude-llm.d.ts
CHANGED
|
@@ -190,6 +190,8 @@ export declare class ClaudeLLM extends llm.LLM {
|
|
|
190
190
|
setTurbo(on: boolean): void;
|
|
191
191
|
/** Read-only accessor used by ClaudeLLMStream (private fields are class-scoped). */
|
|
192
192
|
get turbo(): boolean;
|
|
193
|
+
permissionPending: boolean;
|
|
194
|
+
compacting: boolean;
|
|
193
195
|
/**
|
|
194
196
|
* Set session ID to resume a specific conversation
|
|
195
197
|
* Call this before sending the first message to resume from a previous session
|
package/dist/claude-llm.js
CHANGED
|
@@ -1321,6 +1321,13 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
/** Read-only accessor used by ClaudeLLMStream (private fields are class-scoped). */
|
|
1323
1323
|
get turbo() { return this.#turbo; }
|
|
1324
|
+
// Steer-priority suppression state (adversarial findings #1/#8): a 'now'
|
|
1325
|
+
// message aborts the running turn, so never stamp it while that turn is
|
|
1326
|
+
// parked on a permission dialog (the user's spoken "yes, allow it" would
|
|
1327
|
+
// abort the asking turn) or while the session is compacting (repeated
|
|
1328
|
+
// voice chatter could cancel compaction over and over).
|
|
1329
|
+
permissionPending = false;
|
|
1330
|
+
compacting = false;
|
|
1324
1331
|
/**
|
|
1325
1332
|
* Set session ID to resume a specific conversation
|
|
1326
1333
|
* Call this before sending the first message to resume from a previous session
|
|
@@ -1745,7 +1752,10 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1745
1752
|
const pending = this.#pendingInterrupt;
|
|
1746
1753
|
if (pending) {
|
|
1747
1754
|
console.log('⚡ Persistent session: interrupt in flight — deferring push until it settles');
|
|
1748
|
-
|
|
1755
|
+
// Deadline (adversarial finding #2): a wedged interrupt control request
|
|
1756
|
+
// must not make the agent permanently deaf — push anyway after 8s.
|
|
1757
|
+
const deadline = new Promise((res) => setTimeout(res, 8000));
|
|
1758
|
+
Promise.race([pending, deadline]).then(() => {
|
|
1749
1759
|
if (this.#messageChannel && !this.#messageChannel.closed) {
|
|
1750
1760
|
console.log('⚡ Persistent session: pushing deferred message (post-interrupt)');
|
|
1751
1761
|
this.#messageChannel.push(userMessage);
|
|
@@ -1839,6 +1849,7 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1839
1849
|
if (msg.type === 'system' && msg.subtype === 'status') {
|
|
1840
1850
|
const status = msg.status;
|
|
1841
1851
|
if (status === 'compacting' || status === null) {
|
|
1852
|
+
this.compacting = status === 'compacting';
|
|
1842
1853
|
console.log(`[COMPACT-SDK-ITER] status change: ${status === 'compacting' ? 'ENTERED compacting' : 'EXITED compacting'} session=${msg.session_id?.substring(0, 8) ?? '?'}`);
|
|
1843
1854
|
}
|
|
1844
1855
|
}
|
|
@@ -1899,6 +1910,11 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1899
1910
|
this.#currentTurnChunkIndex = 0;
|
|
1900
1911
|
this.#currentTurnChunks = [];
|
|
1901
1912
|
this.#currentTurnSpeed = undefined;
|
|
1913
|
+
// Stale-dispatch pruning (adversarial finding #6): any Task dispatch id
|
|
1914
|
+
// still unclaimed at turn end never reached SubagentStart (denied,
|
|
1915
|
+
// errored, or its turn aborted) — drop it so it can't poison the next
|
|
1916
|
+
// agent_id pairing of the same type.
|
|
1917
|
+
this.#pendingToolUseByType.clear();
|
|
1902
1918
|
console.log('✅ Claude turn complete (persistent session stays alive)');
|
|
1903
1919
|
}
|
|
1904
1920
|
}
|
|
@@ -2120,7 +2136,15 @@ class ClaudeLLMStream extends llm.LLMStream {
|
|
|
2120
2136
|
return { behavior: 'deny', message: 'Research mode does not use plan mode. Just proceed with the research directly.' };
|
|
2121
2137
|
}
|
|
2122
2138
|
console.log(`⚠️ Permission needed: ${toolName}`);
|
|
2123
|
-
|
|
2139
|
+
// Track the pending dialog so steer-priority ('now') suppression can
|
|
2140
|
+
// avoid aborting the very turn that's waiting on the user's answer.
|
|
2141
|
+
this.#llmRef.permissionPending = true;
|
|
2142
|
+
try {
|
|
2143
|
+
return await this.#onPermissionRequest(toolName, input);
|
|
2144
|
+
}
|
|
2145
|
+
finally {
|
|
2146
|
+
this.#llmRef.permissionPending = false;
|
|
2147
|
+
}
|
|
2124
2148
|
},
|
|
2125
2149
|
hooks: {
|
|
2126
2150
|
PreToolUse: [{
|
|
@@ -2701,7 +2725,11 @@ class ClaudeLLMStream extends llm.LLMStream {
|
|
|
2701
2725
|
// Meeting transcript chunks are ambient and must NOT interrupt (they
|
|
2702
2726
|
// arrive continuously and would abort working turns nonstop).
|
|
2703
2727
|
// Escape hatch: OSBORN_MSG_PRIORITY=off restores queue-and-fold.
|
|
2704
|
-
const steerNow = process.env.OSBORN_MSG_PRIORITY !== 'off'
|
|
2728
|
+
const steerNow = process.env.OSBORN_MSG_PRIORITY !== 'off'
|
|
2729
|
+
&& !userText.startsWith('[MEETING') // ambient transcript chunks never abort a turn
|
|
2730
|
+
&& !userText.startsWith('[SYSTEM') // join/end notes etc. never abort a turn
|
|
2731
|
+
&& !this.#llmRef.permissionPending // don't abort the turn awaiting the user's answer
|
|
2732
|
+
&& !this.#llmRef.compacting; // don't cancel an in-flight compaction
|
|
2705
2733
|
this.#llmRef.pushMessage(userText, sdkOptions, {
|
|
2706
2734
|
onSessionId: this.#onSessionId,
|
|
2707
2735
|
onCheckpoint: this.#onCheckpoint,
|
package/dist/index.js
CHANGED
|
@@ -5639,8 +5639,16 @@ async function main() {
|
|
|
5639
5639
|
}
|
|
5640
5640
|
catch { }
|
|
5641
5641
|
}
|
|
5642
|
-
// Always confirm so frontend clears the card (covers ghost/stale flows too)
|
|
5643
|
-
|
|
5642
|
+
// Always confirm so frontend clears the card (covers ghost/stale flows too).
|
|
5643
|
+
// runningTasks lets the frontend tell a ghost row (0 → safe to clear)
|
|
5644
|
+
// from a live-but-uncorrelated runaway (>0 → keep the row visible).
|
|
5645
|
+
const runningTasks = (() => { try {
|
|
5646
|
+
return currentLLM.getRunningTasks?.()?.length ?? 0;
|
|
5647
|
+
}
|
|
5648
|
+
catch {
|
|
5649
|
+
return 0;
|
|
5650
|
+
} })();
|
|
5651
|
+
await sendToFrontend({ type: 'agent_stopped', agent_id: agentId, stopped, runningTasks });
|
|
5644
5652
|
}
|
|
5645
5653
|
else if (data.type === 'join_meeting') {
|
|
5646
5654
|
const meetingUrl = data.url;
|
|
@@ -5926,9 +5934,11 @@ async function main() {
|
|
|
5926
5934
|
slot.dispatchInFlight = true;
|
|
5927
5935
|
// Reuse the cold-start emitter — pushMessage's fast path ignores a
|
|
5928
5936
|
// fresh emitter once the subprocess exists (see spawnBackgroundSession).
|
|
5929
|
-
//
|
|
5930
|
-
//
|
|
5931
|
-
|
|
5937
|
+
// NO priority override here (adversarial finding #4): slot work is
|
|
5938
|
+
// FOREGROUND turn work — a 'now' dispatch would abort the previous
|
|
5939
|
+
// instruction mid-flight and corrupt dispatchInFlight accounting.
|
|
5940
|
+
// Instructions queue/fold like before.
|
|
5941
|
+
slot.llm.pushMessage(instruction, slot.sdkOptions, { onSessionId: () => { }, onCheckpoint: () => { }, eventEmitter: slot.emitter });
|
|
5932
5942
|
void sendToFrontend({ type: 'background_dispatched', sessionId: targetSessionId, instruction });
|
|
5933
5943
|
};
|
|
5934
5944
|
if (slots.has(targetSessionId))
|
|
@@ -69,6 +69,12 @@ export declare class PipelineDirectLLM extends llm.LLM {
|
|
|
69
69
|
rewindAgent(checkpointId?: string): Promise<boolean>;
|
|
70
70
|
hasActiveAgent(): boolean;
|
|
71
71
|
stopAgent(agentId: string): Promise<boolean>;
|
|
72
|
+
getRunningTasks(): {
|
|
73
|
+
taskId: string;
|
|
74
|
+
subagentType?: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
status: string;
|
|
77
|
+
}[];
|
|
72
78
|
/** Send a new prompt to Claude via direct chat() — event listeners stay attached */
|
|
73
79
|
sendPrompt(prompt: string): void;
|
|
74
80
|
enableMcpServer(k: string, c: any): void;
|
|
@@ -113,6 +113,7 @@ export class PipelineDirectLLM extends llm.LLM {
|
|
|
113
113
|
async rewindAgent(checkpointId) { return this.#claudeLLM.rewindToCheckpoint(checkpointId); }
|
|
114
114
|
hasActiveAgent() { return this.#claudeLLM.hasActiveQuery(); }
|
|
115
115
|
stopAgent(agentId) { return this.#claudeLLM.stopAgent(agentId); }
|
|
116
|
+
getRunningTasks() { return this.#claudeLLM.getRunningTasks(); }
|
|
116
117
|
/** Send a new prompt to Claude via direct chat() — event listeners stay attached */
|
|
117
118
|
sendPrompt(prompt) {
|
|
118
119
|
console.log(`📋 [pipeline] Sending prompt to Claude (${prompt.length} chars)`);
|
|
@@ -169,7 +170,13 @@ export class PipelineDirectLLM extends llm.LLM {
|
|
|
169
170
|
// interrupting active TTS. We need to forward BOTH cases so the agent knows
|
|
170
171
|
// what it produced that the user didn't hear, and so the buffer is cleared
|
|
171
172
|
// every turn even when there was no interrupt.
|
|
172
|
-
|
|
173
|
+
// MEETING GUARD (adversarial finding): never consume/enrich interrupt context
|
|
174
|
+
// on a meeting transcript chunk — enrichment would prefix it [INTERRUPTED]/
|
|
175
|
+
// [CONTEXT] (defeating the downstream '[MEETING' priority guard) and fire
|
|
176
|
+
// interruptQuery() for a transcript chunk, aborting working turns nonstop.
|
|
177
|
+
// Leave the pending context for the next REAL user message.
|
|
178
|
+
const isMeetingChunkEarly = userText.startsWith('[MEETING');
|
|
179
|
+
const interruptCtx = isMeetingChunkEarly ? null : this.#opts.getAndConsumeInterruptionContext?.();
|
|
173
180
|
if (interruptCtx && userText.trim()) {
|
|
174
181
|
const hasInterrupt = !!interruptCtx.spokenText;
|
|
175
182
|
const hasSuppressed = !!interruptCtx.suppressedText;
|