cordisx 0.1.0-beta.62 → 0.1.0-beta.63
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/assets/launcher/native-agent-models-mcp.mjs +1 -1
- package/dist/assets/launcher/native-app-server-protocol.mjs +23 -24
- package/dist/assets/launcher/native-json-lines.mjs +40 -0
- package/dist/assets/launcher/native-provider-transport.mjs +34 -39
- package/dist/assets/launcher/native-session-fork.mjs +98 -0
- package/dist/codex-adapter/adapter.mjs +19 -5
- package/dist/codex-adapter/native-agent-task-source.d.ts +1 -1
- package/dist/codex-adapter/native-agent-task-source.js +4 -2
- package/dist/codex-adapter/native-agent-task-transform.js +12 -3
- package/dist/native/native-helper-artifact.json +1 -1
- package/dist/src/launcher/agent-bridge-codex-history.d.ts +47 -0
- package/dist/src/launcher/agent-bridge-codex-history.d.ts.map +1 -0
- package/dist/src/launcher/agent-bridge-codex-history.js +171 -0
- package/dist/src/launcher/agent-bridge-codex-history.js.map +1 -0
- package/dist/src/launcher/agent-bridge-context.d.ts +1 -1
- package/dist/src/launcher/agent-bridge-context.d.ts.map +1 -1
- package/dist/src/launcher/agent-bridge.d.ts +2 -5
- package/dist/src/launcher/agent-bridge.d.ts.map +1 -1
- package/dist/src/launcher/agent-bridge.js +28 -52
- package/dist/src/launcher/agent-bridge.js.map +1 -1
- package/dist/src/launcher/cdp-installation-bootstrap.d.ts.map +1 -1
- package/dist/src/launcher/cdp-installation-bootstrap.js +3 -1
- package/dist/src/launcher/cdp-installation-bootstrap.js.map +1 -1
- package/dist/src/launcher/cdp-installation-cleanup.d.ts +1 -0
- package/dist/src/launcher/cdp-installation-cleanup.d.ts.map +1 -1
- package/dist/src/launcher/cdp-installation-cleanup.js +2 -0
- package/dist/src/launcher/cdp-installation-cleanup.js.map +1 -1
- package/dist/src/launcher/cdp-installation-deadline.d.ts +6 -0
- package/dist/src/launcher/cdp-installation-deadline.d.ts.map +1 -0
- package/dist/src/launcher/cdp-installation-deadline.js +15 -0
- package/dist/src/launcher/cdp-installation-deadline.js.map +1 -0
- package/dist/src/launcher/cdp-installation-support.d.ts +3 -3
- package/dist/src/launcher/cdp-installation-support.d.ts.map +1 -1
- package/dist/src/launcher/cdp-installation-support.js +73 -66
- package/dist/src/launcher/cdp-installation-support.js.map +1 -1
- package/dist/src/launcher/cdp-installation.d.ts +2 -1
- package/dist/src/launcher/cdp-installation.d.ts.map +1 -1
- package/dist/src/launcher/cdp-installation.js +7 -1
- package/dist/src/launcher/cdp-installation.js.map +1 -1
- package/dist/src/launcher/cdp-session.d.ts +14 -1
- package/dist/src/launcher/cdp-session.d.ts.map +1 -1
- package/dist/src/launcher/cdp-session.js +92 -4
- package/dist/src/launcher/cdp-session.js.map +1 -1
- package/dist/src/launcher/cdp-target-retirement.d.ts +8 -0
- package/dist/src/launcher/cdp-target-retirement.d.ts.map +1 -0
- package/dist/src/launcher/cdp-target-retirement.js +79 -0
- package/dist/src/launcher/cdp-target-retirement.js.map +1 -0
- package/dist/src/launcher/cdp.d.ts.map +1 -1
- package/dist/src/launcher/cdp.js +10 -7
- package/dist/src/launcher/cdp.js.map +1 -1
- package/dist/src/launcher/native-agent-task-routing.d.ts +4 -0
- package/dist/src/launcher/native-agent-task-routing.d.ts.map +1 -1
- package/dist/src/launcher/native-agent-task-routing.js +32 -15
- package/dist/src/launcher/native-agent-task-routing.js.map +1 -1
- package/dist/src/launcher/native-agent-tasks.d.ts +3 -0
- package/dist/src/launcher/native-agent-tasks.d.ts.map +1 -1
- package/dist/src/launcher/native-agent-tasks.js +27 -0
- package/dist/src/launcher/native-agent-tasks.js.map +1 -1
- package/dist/src/launcher/native-draft-model-preference.d.ts +25 -0
- package/dist/src/launcher/native-draft-model-preference.d.ts.map +1 -0
- package/dist/src/launcher/native-draft-model-preference.js +57 -0
- package/dist/src/launcher/native-draft-model-preference.js.map +1 -0
- package/dist/src/launcher/native-predispatch-interception.d.ts +4 -1
- package/dist/src/launcher/native-predispatch-interception.d.ts.map +1 -1
- package/dist/src/launcher/native-predispatch-interception.js +38 -17
- package/dist/src/launcher/native-predispatch-interception.js.map +1 -1
- package/dist/src/launcher/native-source-configuration.d.ts +39 -0
- package/dist/src/launcher/native-source-configuration.d.ts.map +1 -0
- package/dist/src/launcher/native-source-configuration.js +72 -0
- package/dist/src/launcher/native-source-configuration.js.map +1 -0
- package/dist/src/launcher/native-submission-cdp-channel.d.ts +3 -1
- package/dist/src/launcher/native-submission-cdp-channel.d.ts.map +1 -1
- package/dist/src/launcher/native-submission-cdp-channel.js +35 -58
- package/dist/src/launcher/native-submission-cdp-channel.js.map +1 -1
- package/dist/src/launcher/native-submission-channel-cleanup.d.ts +4 -0
- package/dist/src/launcher/native-submission-channel-cleanup.d.ts.map +1 -0
- package/dist/src/launcher/native-submission-channel-cleanup.js +63 -0
- package/dist/src/launcher/native-submission-channel-cleanup.js.map +1 -0
- package/dist/src/launcher/native-submission-composition.d.ts.map +1 -1
- package/dist/src/launcher/native-submission-composition.js +5 -2
- package/dist/src/launcher/native-submission-composition.js.map +1 -1
- package/dist/src/launcher/native-submission-control-server.d.ts +2 -1
- package/dist/src/launcher/native-submission-control-server.d.ts.map +1 -1
- package/dist/src/launcher/native-submission-control-server.js +97 -8
- package/dist/src/launcher/native-submission-control-server.js.map +1 -1
- package/dist/src/launcher/responses-encrypted-replay.d.ts.map +1 -1
- package/dist/src/launcher/responses-encrypted-replay.js +0 -5
- package/dist/src/launcher/responses-encrypted-replay.js.map +1 -1
- package/dist/src/renderer/adapter/native-model-provider-seat.d.ts +1 -0
- package/dist/src/renderer/adapter/native-model-provider-seat.d.ts.map +1 -1
- package/dist/src/renderer/adapter/native-model-provider-seat.js +2 -0
- package/dist/src/renderer/adapter/native-model-provider-seat.js.map +1 -1
- package/dist/src/renderer/model-provider-selection.d.ts.map +1 -1
- package/dist/src/renderer/model-provider-selection.js +32 -4
- package/dist/src/renderer/model-provider-selection.js.map +1 -1
- package/dist/src/renderer/model-provider-selector.d.ts +1 -0
- package/dist/src/renderer/model-provider-selector.d.ts.map +1 -1
- package/dist/src/renderer/model-provider-selector.js +16 -2
- package/dist/src/renderer/model-provider-selector.js.map +1 -1
- package/dist/src/renderer/native-composer-creation-handoff.d.ts +2 -1
- package/dist/src/renderer/native-composer-creation-handoff.d.ts.map +1 -1
- package/dist/src/renderer/native-composer-creation-handoff.js +4 -2
- package/dist/src/renderer/native-composer-creation-handoff.js.map +1 -1
- package/dist/src/renderer/native-composer-refresh.d.ts +11 -2
- package/dist/src/renderer/native-composer-refresh.d.ts.map +1 -1
- package/dist/src/renderer/native-composer-refresh.js +39 -8
- package/dist/src/renderer/native-composer-refresh.js.map +1 -1
- package/dist/src/renderer/native-composer-request-observer.d.ts +1 -0
- package/dist/src/renderer/native-composer-request-observer.d.ts.map +1 -1
- package/dist/src/renderer/native-composer-request-observer.js +9 -3
- package/dist/src/renderer/native-composer-request-observer.js.map +1 -1
- package/dist/src/renderer/native-composer-submission-router.d.ts +7 -1
- package/dist/src/renderer/native-composer-submission-router.d.ts.map +1 -1
- package/dist/src/renderer/native-composer-submission-router.js +16 -8
- package/dist/src/renderer/native-composer-submission-router.js.map +1 -1
- package/dist/src/renderer/native-model-provider-state.d.ts +11 -0
- package/dist/src/renderer/native-model-provider-state.d.ts.map +1 -1
- package/dist/src/renderer/native-model-provider-state.js +37 -0
- package/dist/src/renderer/native-model-provider-state.js.map +1 -1
- package/dist/src/renderer/native-model-provider-transport.d.ts +3 -0
- package/dist/src/renderer/native-model-provider-transport.d.ts.map +1 -1
- package/dist/src/renderer/native-model-provider-transport.js +115 -47
- package/dist/src/renderer/native-model-provider-transport.js.map +1 -1
- package/dist/src/renderer/native-model-reasoning.d.ts +1 -0
- package/dist/src/renderer/native-model-reasoning.d.ts.map +1 -1
- package/dist/src/renderer/native-model-reasoning.js +3 -0
- package/dist/src/renderer/native-model-reasoning.js.map +1 -1
- package/dist/src/renderer/native-provider-selection-client.d.ts +3 -0
- package/dist/src/renderer/native-provider-selection-client.d.ts.map +1 -1
- package/dist/src/renderer/native-provider-selection-client.js +6 -0
- package/dist/src/renderer/native-provider-selection-client.js.map +1 -1
- package/dist/src/renderer/native-session-display-cache.d.ts +21 -0
- package/dist/src/renderer/native-session-display-cache.d.ts.map +1 -0
- package/dist/src/renderer/native-session-display-cache.js +75 -0
- package/dist/src/renderer/native-session-display-cache.js.map +1 -0
- package/dist/src/renderer/native-settings-reconciliation.d.ts +25 -0
- package/dist/src/renderer/native-settings-reconciliation.d.ts.map +1 -0
- package/dist/src/renderer/native-settings-reconciliation.js +53 -0
- package/dist/src/renderer/native-settings-reconciliation.js.map +1 -0
- package/package.json +1 -1
|
@@ -70,7 +70,7 @@ const tools = [{
|
|
|
70
70
|
}, {
|
|
71
71
|
name: 'read_session',
|
|
72
72
|
description:
|
|
73
|
-
'Read one page of a conversation transcript by its sessionId (from list_sessions), newest messages kept, plus the link and `transcriptTotal
|
|
73
|
+
'Read one page of a conversation transcript by its sessionId (from list_sessions), newest messages kept, plus the link and `transcriptTotal` (null when native paging has not counted the whole transcript). Read-only and cheap for one page, but a page may be large (~60k characters). Page older text with `cursor` from `nextCursor`; `truncated: true` means something was left out, and `clippedCharacters` says how much of the oldest returned message was cut.',
|
|
74
74
|
inputSchema: {
|
|
75
75
|
type: 'object',
|
|
76
76
|
additionalProperties: false,
|
|
@@ -12,6 +12,8 @@ import { createNativeProviderTransport } from './native-provider-transport.mjs'
|
|
|
12
12
|
import { nativeProviderFailure } from './native-provider-errors.mjs'
|
|
13
13
|
import { switchNativeThread } from './native-thread-switch.mjs'
|
|
14
14
|
import { createNativeProviderContinuation, dispatchNativeSelectionMutation } from './native-provider-continuation.mjs'
|
|
15
|
+
import { inheritNativeFork } from './native-session-fork.mjs'
|
|
16
|
+
import { readNativeLines } from './native-json-lines.mjs'
|
|
15
17
|
|
|
16
18
|
const socketPath = process.env.CORDISX_NATIVE_CONTROL_SOCKET
|
|
17
19
|
const nonce = process.env.CORDISX_NATIVE_CONTROL_NONCE
|
|
@@ -19,8 +21,6 @@ const executable = process.env.CORDISX_NATIVE_REAL_CODEX_PATH
|
|
|
19
21
|
const nativeCliEntry = process.env.CORDISX_NATIVE_CLI_ENTRY_PATH
|
|
20
22
|
const agentModelsBinding = process.env.CORDISX_NATIVE_AGENT_MODELS_BINDING
|
|
21
23
|
const marker = 'cordisx.operation_token'
|
|
22
|
-
// Native history and plugin catalogs can exceed the small private control-message budget.
|
|
23
|
-
const maxNativeLineBytes = 64 * 1024 * 1024
|
|
24
24
|
const maxControlLineBytes = 8 * 1024 * 1024
|
|
25
25
|
if (!socketPath || !nonce || !executable?.startsWith('/')) throw new Error('Native intermediary is not configured')
|
|
26
26
|
for (
|
|
@@ -56,7 +56,12 @@ if (agentModelsBinding && nativeArgs.includes('app-server')) {
|
|
|
56
56
|
)
|
|
57
57
|
}
|
|
58
58
|
const child = spawn(executable, nativeArgs, { stdio: ['pipe', 'pipe', 'inherit'], env: process.env })
|
|
59
|
-
const nativeTransport = createNativeProviderTransport(child, {
|
|
59
|
+
const nativeTransport = createNativeProviderTransport(child, {
|
|
60
|
+
executable,
|
|
61
|
+
args: nativeArgs,
|
|
62
|
+
env: process.env,
|
|
63
|
+
diagnostic: details => nativeLifecycle(details.phase, details),
|
|
64
|
+
})
|
|
60
65
|
const control = net.connect(socketPath)
|
|
61
66
|
const controlCalls = new Map()
|
|
62
67
|
const privateCalls = new Map()
|
|
@@ -277,27 +282,8 @@ function missingManagedProvider(message) {
|
|
|
277
282
|
}
|
|
278
283
|
|
|
279
284
|
// Only framed messages are buffered. Many small lines in one chunk do not count as one large request.
|
|
280
|
-
function readLines(stream, receive, maxLineBytes
|
|
281
|
-
|
|
282
|
-
stream.setEncoding('utf8')
|
|
283
|
-
stream.on('data', chunk => {
|
|
284
|
-
buffer += chunk
|
|
285
|
-
for (;;) {
|
|
286
|
-
const newline = buffer.indexOf('\n')
|
|
287
|
-
if (newline < 0) break
|
|
288
|
-
const line = buffer.slice(0, newline)
|
|
289
|
-
buffer = buffer.slice(newline + 1)
|
|
290
|
-
if (Buffer.byteLength(line) > maxLineBytes) {
|
|
291
|
-
stop('frame-limit-exceeded')
|
|
292
|
-
return
|
|
293
|
-
}
|
|
294
|
-
if (line.length > 0) receive(line)
|
|
295
|
-
}
|
|
296
|
-
if (Buffer.byteLength(buffer) > maxLineBytes) stop('frame-limit-exceeded')
|
|
297
|
-
})
|
|
298
|
-
stream.once('end', () => {
|
|
299
|
-
if (buffer.trim() !== '') stop('incomplete-frame')
|
|
300
|
-
})
|
|
285
|
+
function readLines(stream, receive, maxLineBytes) {
|
|
286
|
+
readNativeLines(stream, receive, stop, maxLineBytes)
|
|
301
287
|
}
|
|
302
288
|
|
|
303
289
|
let authenticate
|
|
@@ -422,6 +408,14 @@ async function forward(line) {
|
|
|
422
408
|
return
|
|
423
409
|
}
|
|
424
410
|
if (!managed) {
|
|
411
|
+
const fork = await inheritNativeFork(message, { nativeCall, controlCall })
|
|
412
|
+
if (fork.handled) {
|
|
413
|
+
await write(
|
|
414
|
+
process.stdout,
|
|
415
|
+
fork.error ? { id: message.id, error: fork.error } : { id: message.id, result: fork.result },
|
|
416
|
+
)
|
|
417
|
+
return
|
|
418
|
+
}
|
|
425
419
|
if (['thread/start', 'turn/start', 'turn/steer', 'turn/addUserMessage'].includes(message?.method)) {
|
|
426
420
|
const allowed = await controlCall('unmarked-provider', {
|
|
427
421
|
...(typeof params?.threadId === 'string' ? { threadId: params.threadId } : {}),
|
|
@@ -575,6 +569,9 @@ async function forward(line) {
|
|
|
575
569
|
turnDiagnostics.selected(message.id, dispatch)
|
|
576
570
|
const nextConfig = { ...config }
|
|
577
571
|
delete nextConfig[marker]
|
|
572
|
+
if (dispatch.agentTask && (dispatch.serviceTier === 'priority' || dispatch.serviceTier === null)) {
|
|
573
|
+
params.serviceTier = dispatch.serviceTier
|
|
574
|
+
}
|
|
578
575
|
if (message.method === 'thread/start') {
|
|
579
576
|
params.modelProvider = dispatch.providerId
|
|
580
577
|
params.model = dispatch.model
|
|
@@ -886,6 +883,8 @@ const continuation = createNativeProviderContinuation({
|
|
|
886
883
|
const BRIDGE_NATIVE_METHODS = new Set([
|
|
887
884
|
'thread/list',
|
|
888
885
|
'thread/read',
|
|
886
|
+
'thread/turns/list',
|
|
887
|
+
'thread/items/list',
|
|
889
888
|
'thread/start',
|
|
890
889
|
'thread/resume',
|
|
891
890
|
'thread/name/set',
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Accumulate each JSONL frame once. Model data has no Host byte cap by default. */
|
|
2
|
+
export function readNativeLines(stream, receive, reject, maxBytes) {
|
|
3
|
+
let fragments = []
|
|
4
|
+
let bytes = 0
|
|
5
|
+
let rejected = false
|
|
6
|
+
const fail = reason => {
|
|
7
|
+
if (rejected) return
|
|
8
|
+
rejected = true
|
|
9
|
+
fragments = []
|
|
10
|
+
bytes = 0
|
|
11
|
+
reject(reason)
|
|
12
|
+
}
|
|
13
|
+
stream.setEncoding('utf8')
|
|
14
|
+
stream.on('data', chunk => {
|
|
15
|
+
if (rejected) return
|
|
16
|
+
let start = 0
|
|
17
|
+
for (;;) {
|
|
18
|
+
const newline = chunk.indexOf('\n', start)
|
|
19
|
+
const fragment = chunk.slice(start, newline < 0 ? undefined : newline)
|
|
20
|
+
if (maxBytes !== undefined) {
|
|
21
|
+
bytes += Buffer.byteLength(fragment)
|
|
22
|
+
if (bytes > maxBytes) return fail('frame-limit-exceeded')
|
|
23
|
+
}
|
|
24
|
+
if (fragment.length > 0) fragments.push(fragment)
|
|
25
|
+
if (newline < 0) return
|
|
26
|
+
const line = fragments.length === 1 ? fragments[0] : fragments.join('')
|
|
27
|
+
fragments = []
|
|
28
|
+
bytes = 0
|
|
29
|
+
start = newline + 1
|
|
30
|
+
if (line.length > 0) receive(line)
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
stream.once('end', () => {
|
|
34
|
+
if (!rejected && fragments.some(fragment => fragment.trim() !== '')) fail('incomplete-frame')
|
|
35
|
+
fragments = []
|
|
36
|
+
})
|
|
37
|
+
stream.once('close', () => {
|
|
38
|
+
fragments = []
|
|
39
|
+
})
|
|
40
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process'
|
|
2
2
|
import { randomUUID } from 'node:crypto'
|
|
3
3
|
import { PassThrough, Writable } from 'node:stream'
|
|
4
|
+
import { readNativeLines } from './native-json-lines.mjs'
|
|
4
5
|
|
|
5
6
|
const object = value => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : undefined
|
|
6
7
|
const provider = value => typeof value === 'string' && /^[a-zA-Z0-9_.:-]{1,128}$/u.test(value) ? value : undefined
|
|
7
8
|
const key = id => JSON.stringify([typeof id, id])
|
|
8
|
-
const MAX_FRAME = 64 * 1024 * 1024
|
|
9
9
|
const MAX_WORKERS = 128
|
|
10
10
|
|
|
11
11
|
/** Multiplex native connections after the Host has admitted the original request.
|
|
@@ -13,12 +13,17 @@ const MAX_WORKERS = 128
|
|
|
13
13
|
* The inert process default satisfies native provider identity checks and cannot
|
|
14
14
|
* silently send a request when a per-thread override has been lost.
|
|
15
15
|
*/
|
|
16
|
-
export function createNativeProviderTransport(primary, { executable, args, env, initialize } = {}) {
|
|
16
|
+
export function createNativeProviderTransport(primary, { executable, args, env, initialize, diagnostic } = {}) {
|
|
17
17
|
const stdout = new PassThrough()
|
|
18
18
|
const workers = new Map()
|
|
19
19
|
const owners = new Map()
|
|
20
20
|
const serverRequests = new Map()
|
|
21
21
|
const primaryWrite = primary.stdin.write.bind(primary.stdin)
|
|
22
|
+
const observe = details => {
|
|
23
|
+
try {
|
|
24
|
+
diagnostic?.(details)
|
|
25
|
+
} catch { /* Diagnostics never control provider transport. */ }
|
|
26
|
+
}
|
|
22
27
|
let initializeParams = initialize
|
|
23
28
|
let disposed = false
|
|
24
29
|
const emit = (message, original) => {
|
|
@@ -54,7 +59,7 @@ export function createNativeProviderTransport(primary, { executable, args, env,
|
|
|
54
59
|
if (owner?.connection === connection) owner.turn = message.result.turn
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
|
-
if (Array.isArray(message.result?.data)) {
|
|
62
|
+
if (pending?.method === 'thread/list' && Array.isArray(message.result?.data)) {
|
|
58
63
|
for (const thread of message.result.data) {
|
|
59
64
|
const owner = owners.get(thread.id)
|
|
60
65
|
if (owner?.connection !== primary && owner?.status) {
|
|
@@ -93,25 +98,14 @@ export function createNativeProviderTransport(primary, { executable, args, env,
|
|
|
93
98
|
emit(message, original)
|
|
94
99
|
}
|
|
95
100
|
const attach = (stream, connection) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
while ((boundary = buffer.indexOf('\n')) >= 0) {
|
|
102
|
-
const line = buffer.slice(0, boundary)
|
|
103
|
-
buffer = buffer.slice(boundary + 1)
|
|
104
|
-
if (Buffer.byteLength(line) > MAX_FRAME) {
|
|
105
|
-
connection.child?.kill('SIGTERM')
|
|
106
|
-
return
|
|
107
|
-
}
|
|
108
|
-
try {
|
|
109
|
-
receive(connection, JSON.parse(line), line)
|
|
110
|
-
} catch {
|
|
111
|
-
if (connection === primary && !disposed) stdout.write(line + '\n')
|
|
112
|
-
}
|
|
101
|
+
readNativeLines(stream, line => {
|
|
102
|
+
try {
|
|
103
|
+
receive(connection, JSON.parse(line), line)
|
|
104
|
+
} catch {
|
|
105
|
+
if (connection === primary && !disposed) stdout.write(line + '\n')
|
|
113
106
|
}
|
|
114
|
-
|
|
107
|
+
}, reason => {
|
|
108
|
+
observe({ phase: reason, childPid: connection.child?.pid })
|
|
115
109
|
})
|
|
116
110
|
}
|
|
117
111
|
primary.pending = new Map()
|
|
@@ -158,7 +152,8 @@ export function createNativeProviderTransport(primary, { executable, args, env,
|
|
|
158
152
|
})
|
|
159
153
|
workers.set(id, worker)
|
|
160
154
|
attach(child.stdout, worker)
|
|
161
|
-
const failed =
|
|
155
|
+
const failed = details => {
|
|
156
|
+
observe({ childPid: child.pid, provider: id, ...details })
|
|
162
157
|
if (worker.closed) return
|
|
163
158
|
worker.closed = true
|
|
164
159
|
if (workers.get(id) === worker) workers.delete(id)
|
|
@@ -197,9 +192,11 @@ export function createNativeProviderTransport(primary, { executable, args, env,
|
|
|
197
192
|
serverRequests.delete(requestId)
|
|
198
193
|
}
|
|
199
194
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
child.
|
|
195
|
+
const errorCode = error =>
|
|
196
|
+
['ENOENT', 'EACCES', 'EPERM', 'EPIPE', 'ECONNRESET'].includes(error?.code) ? error.code : 'unknown'
|
|
197
|
+
child.once('error', error => failed({ phase: 'provider-spawn-failed', errorCode: errorCode(error) }))
|
|
198
|
+
child.once('exit', (exitCode, signal) => failed({ phase: 'provider-exited', exitCode, signal }))
|
|
199
|
+
child.stdin.on('error', error => failed({ phase: 'provider-input-error', errorCode: errorCode(error) }))
|
|
203
200
|
void send(worker.write, { id: worker.initializeId, method: 'initialize', params: initializeParams })
|
|
204
201
|
.catch(worker.rejectReady)
|
|
205
202
|
}
|
|
@@ -241,29 +238,26 @@ export function createNativeProviderTransport(primary, { executable, args, env,
|
|
|
241
238
|
const write = connection === primary ? primaryWrite : connection.write
|
|
242
239
|
await new Promise((resolve, reject) => write(original + '\n', error => error ? reject(error) : resolve()))
|
|
243
240
|
}
|
|
244
|
-
let
|
|
241
|
+
let fragments = []
|
|
245
242
|
const stdin = new Writable({
|
|
246
243
|
write(chunk, _encoding, callback) {
|
|
247
|
-
|
|
244
|
+
const input = chunk.toString('utf8')
|
|
248
245
|
const frames = []
|
|
249
|
-
let
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
246
|
+
let start = 0
|
|
247
|
+
for (;;) {
|
|
248
|
+
const boundary = input.indexOf('\n', start)
|
|
249
|
+
const fragment = input.slice(start, boundary < 0 ? undefined : boundary)
|
|
250
|
+
if (fragment.length > 0) fragments.push(fragment)
|
|
251
|
+
if (boundary < 0) break
|
|
252
|
+
const line = fragments.length === 1 ? fragments[0] : fragments.join('')
|
|
253
|
+
fragments = []
|
|
254
|
+
start = boundary + 1
|
|
257
255
|
try {
|
|
258
256
|
frames.push({ message: JSON.parse(line), original: line })
|
|
259
257
|
} catch {
|
|
260
258
|
primaryWrite(line + '\n')
|
|
261
259
|
}
|
|
262
260
|
}
|
|
263
|
-
if (Buffer.byteLength(buffer) > MAX_FRAME) {
|
|
264
|
-
callback(new Error('Native frame exceeds limit'))
|
|
265
|
-
return
|
|
266
|
-
}
|
|
267
261
|
void (async () => {
|
|
268
262
|
for (const { message: frame, original } of frames) {
|
|
269
263
|
try {
|
|
@@ -296,6 +290,7 @@ export function createNativeProviderTransport(primary, { executable, args, env,
|
|
|
296
290
|
workers.clear()
|
|
297
291
|
owners.clear()
|
|
298
292
|
serverRequests.clear()
|
|
293
|
+
fragments = []
|
|
299
294
|
stdin.destroy()
|
|
300
295
|
stdout.end()
|
|
301
296
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { configuredOverrides, optionsAuthority } from './native-configured-overrides.mjs'
|
|
2
|
+
|
|
3
|
+
const object = value => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : undefined
|
|
4
|
+
const valid = value => typeof value === 'string' && /^[^\0\r\n]{1,512}$/u.test(value)
|
|
5
|
+
const token = value => valid(value) && value.length >= 16 && value.length <= 256
|
|
6
|
+
const efforts = new Set(['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra'])
|
|
7
|
+
const failure = message => ({ handled: true, error: { code: -32000, message } })
|
|
8
|
+
|
|
9
|
+
/** Use only a live, exact source; unknown sources retain the native fork path. */
|
|
10
|
+
export async function inheritNativeFork(message, { nativeCall, controlCall }) {
|
|
11
|
+
const params = object(message.params)
|
|
12
|
+
if (
|
|
13
|
+
message.method !== 'thread/fork' || !params || !valid(params.threadId)
|
|
14
|
+
|| params.path != null || !['string', 'number'].includes(typeof message.id)
|
|
15
|
+
) return { handled: false }
|
|
16
|
+
const source = await controlCall('source-configuration', { threadId: params.threadId }).catch(() => undefined)
|
|
17
|
+
if (
|
|
18
|
+
!source || !valid(source.providerId) || !valid(source.model) || !efforts.has(source.reasoningEffort)
|
|
19
|
+
|| (source.serviceTier !== null && source.serviceTier !== 'priority')
|
|
20
|
+
) return { handled: false }
|
|
21
|
+
const inputConfig = object(params.config) ?? {}
|
|
22
|
+
const providerId = params.modelProvider ?? inputConfig.model_provider ?? source.providerId
|
|
23
|
+
const model = params.model ?? inputConfig.model ?? source.model
|
|
24
|
+
if (
|
|
25
|
+
!valid(providerId) || !valid(model)
|
|
26
|
+
|| (params.modelProvider != null && inputConfig.model_provider != null
|
|
27
|
+
&& params.modelProvider !== inputConfig.model_provider)
|
|
28
|
+
) return { handled: false }
|
|
29
|
+
const effort = Object.hasOwn(inputConfig, 'model_reasoning_effort')
|
|
30
|
+
? inputConfig.model_reasoning_effort
|
|
31
|
+
: source.reasoningEffort
|
|
32
|
+
const hasTopTier = Object.hasOwn(params, 'serviceTier')
|
|
33
|
+
const hasConfigTier = Object.hasOwn(inputConfig, 'service_tier')
|
|
34
|
+
const knownTier = value => value === null || value === 'priority'
|
|
35
|
+
// Native schema accepts arbitrary strings and does not specify conflict precedence.
|
|
36
|
+
// Preserve unknown or conflicting explicit settings through the native path.
|
|
37
|
+
if (
|
|
38
|
+
hasTopTier && !knownTier(params.serviceTier) || hasConfigTier && !knownTier(inputConfig.service_tier)
|
|
39
|
+
|| hasTopTier && hasConfigTier && params.serviceTier !== inputConfig.service_tier
|
|
40
|
+
) return { handled: false }
|
|
41
|
+
const tier = hasTopTier ? params.serviceTier : hasConfigTier ? inputConfig.service_tier : source.serviceTier
|
|
42
|
+
if (!efforts.has(effort)) return { handled: false }
|
|
43
|
+
let lease
|
|
44
|
+
try {
|
|
45
|
+
if (providerId !== 'openai') {
|
|
46
|
+
const prepared = await controlCall('fork-prepare', { threadId: params.threadId, providerId, model })
|
|
47
|
+
if (prepared?.kind !== 'resume' || !token(prepared.resumeToken) || !object(prepared.configOverrides)) {
|
|
48
|
+
return failure('Fork provider preparation failed; the source conversation is unchanged.')
|
|
49
|
+
}
|
|
50
|
+
lease = prepared
|
|
51
|
+
}
|
|
52
|
+
const latest = await controlCall('source-configuration', { threadId: params.threadId })
|
|
53
|
+
if (JSON.stringify(latest) !== JSON.stringify(source)) throw new Error('Source configuration changed')
|
|
54
|
+
const overrides = lease?.configOverrides ?? {}
|
|
55
|
+
const config = overrides[optionsAuthority] === undefined
|
|
56
|
+
? { ...inputConfig, ...overrides }
|
|
57
|
+
: configuredOverrides(inputConfig, overrides)
|
|
58
|
+
config.model_reasoning_effort = effort
|
|
59
|
+
const result = await nativeCall('thread/fork', {
|
|
60
|
+
...params,
|
|
61
|
+
modelProvider: providerId,
|
|
62
|
+
model,
|
|
63
|
+
serviceTier: tier,
|
|
64
|
+
config,
|
|
65
|
+
})
|
|
66
|
+
const child = result?.thread?.id
|
|
67
|
+
if (
|
|
68
|
+
!valid(child) || child === params.threadId || result.modelProvider !== providerId || result.model !== model
|
|
69
|
+
|| result.reasoningEffort !== effort || result.serviceTier !== tier
|
|
70
|
+
) throw new Error('Fork result is uncertain')
|
|
71
|
+
if (lease) {
|
|
72
|
+
const committed = await controlCall('fork-complete', {
|
|
73
|
+
threadId: params.threadId,
|
|
74
|
+
createdThreadId: child,
|
|
75
|
+
resumeToken: lease.resumeToken,
|
|
76
|
+
succeeded: true,
|
|
77
|
+
})
|
|
78
|
+
lease = undefined
|
|
79
|
+
if (committed !== true) throw new Error('Fork binding is uncertain')
|
|
80
|
+
}
|
|
81
|
+
return { handled: true, result }
|
|
82
|
+
} catch (error) {
|
|
83
|
+
if (lease) {
|
|
84
|
+
await controlCall('fork-complete', {
|
|
85
|
+
threadId: params.threadId,
|
|
86
|
+
resumeToken: lease.resumeToken,
|
|
87
|
+
succeeded: false,
|
|
88
|
+
}).catch(() => undefined)
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
handled: true,
|
|
92
|
+
error: error?.nativeError ?? {
|
|
93
|
+
code: -32000,
|
|
94
|
+
message: 'Fork result is uncertain. Check conversation history before retrying.',
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -6886,11 +6886,11 @@ var TaskSource = class {
|
|
|
6886
6886
|
addProperty(object, text) {
|
|
6887
6887
|
this.insert(object.start + 1, text + ",");
|
|
6888
6888
|
}
|
|
6889
|
-
addHandle(fn, pattern, model) {
|
|
6889
|
+
addHandle(fn, pattern, model, effort) {
|
|
6890
6890
|
this.addProperty(pattern, `${taskHandle}:${taskHandle}`);
|
|
6891
6891
|
this.insert(
|
|
6892
6892
|
fn.body.start + 1,
|
|
6893
|
-
`if(${taskHandle}!==void 0&&!globalThis.${taskMarker}?.owns(${taskHandle}))throw Error('Invalid native task handle');${model === void 0 ? "" : `if(${taskHandle}!==void 0)${model}=${taskHandle}.model;`}`
|
|
6893
|
+
`if(${taskHandle}!==void 0&&!globalThis.${taskMarker}?.owns(${taskHandle}))throw Error('Invalid native task handle');${model === void 0 ? "" : `if(${taskHandle}!==void 0)${model}=${taskHandle}.model;`}${effort === void 0 ? "" : `if(${taskHandle}!==void 0&&${effort}==null&&${taskHandle}.reasoningEffort!==void 0)${effort}=${taskHandle}.reasoningEffort;`}`
|
|
6894
6894
|
);
|
|
6895
6895
|
}
|
|
6896
6896
|
declaration(name) {
|
|
@@ -6936,12 +6936,21 @@ function executionEdits(plan) {
|
|
|
6936
6936
|
if (!hasKeys(options, ["scope", "sourceThreadId", "target", "model", "prompt", "parentTurnId", "rootTurnId"])) {
|
|
6937
6937
|
throw new Error("Native task creation input unavailable");
|
|
6938
6938
|
}
|
|
6939
|
+
const modelNode = properties(options).get("model");
|
|
6940
|
+
if (!["Identifier", "MemberExpression", "Literal"].includes(modelNode.type)) {
|
|
6941
|
+
throw new Error("Native task model binding unavailable");
|
|
6942
|
+
}
|
|
6943
|
+
const thinkingNode = properties(options).get("thinking");
|
|
6944
|
+
const tierNode = properties(options).get("serviceTier");
|
|
6945
|
+
if ([thinkingNode, tierNode].some((node) => node && !["Identifier", "MemberExpression", "Literal"].includes(node.type))) {
|
|
6946
|
+
throw new Error("Native task configuration binding unavailable");
|
|
6947
|
+
}
|
|
6939
6948
|
const targetNode = properties(options).get("target");
|
|
6940
6949
|
if (targetNode.type !== "Identifier") throw new Error("Native task target binding unavailable");
|
|
6941
6950
|
const target = plan.text(targetNode);
|
|
6942
6951
|
plan.replace(
|
|
6943
6952
|
call,
|
|
6944
|
-
`await (async()=>{const ${taskHandle}=await globalThis.${taskMarker}?.claim({callId:__cxTaskCallId,sourceThreadId:__cxTaskSourceThread,arguments:__cxTaskArguments,hostId:${target}.type==='remoteProject'?${target}.hostId:'local'});if(typeof __cxTaskCallId==='string'&&__cxTaskCallId.startsWith('cordisx-task-')&&${taskHandle}===void 0)throw Error('Native task routing unavailable');return ${plan.text(call.callee)}({${taskHandle},${plan.text(options).slice(1, -1)}})})()`
|
|
6953
|
+
`await (async()=>{const ${taskHandle}=await globalThis.${taskMarker}?.claim({callId:__cxTaskCallId,sourceThreadId:__cxTaskSourceThread,arguments:__cxTaskArguments,model:${plan.text(modelNode)},${thinkingNode ? `thinking:${plan.text(thinkingNode)},` : ""}${tierNode ? `serviceTier:${plan.text(tierNode)},` : ""}hostId:${target}.type==='remoteProject'?${target}.hostId:'local'});if(typeof __cxTaskCallId==='string'&&__cxTaskCallId.startsWith('cordisx-task-')&&${taskHandle}===void 0)throw Error('Native task routing unavailable');return ${plan.text(call.callee)}({${taskHandle},${plan.text(options).slice(1, -1)}})})()`
|
|
6945
6954
|
);
|
|
6946
6955
|
const callers = plan.nodes(
|
|
6947
6956
|
plan.ast,
|
|
@@ -6984,7 +6993,7 @@ function initialEdits(plan) {
|
|
|
6984
6993
|
}
|
|
6985
6994
|
const localFn = plan.declaration(local.callee.name);
|
|
6986
6995
|
const localInput = plan.parameter(localFn, ["config", "model", "thinking", "target", "sourceThreadId"]);
|
|
6987
|
-
plan.addHandle(localFn, localInput, plan.binding(localInput, "model"));
|
|
6996
|
+
plan.addHandle(localFn, localInput, plan.binding(localInput, "model"), plan.binding(localInput, "thinking"));
|
|
6988
6997
|
const localRequest = plan.require(
|
|
6989
6998
|
localFn.body,
|
|
6990
6999
|
(node) => node.type === "ObjectExpression" && hasKeys(node, ["collaborationMode", "config", "projectAssignment", "workspaceKind", "threadSource"]),
|
|
@@ -7007,7 +7016,12 @@ function initialEdits(plan) {
|
|
|
7007
7016
|
"startingState",
|
|
7008
7017
|
"sourceThreadId"
|
|
7009
7018
|
]);
|
|
7010
|
-
plan.addHandle(
|
|
7019
|
+
plan.addHandle(
|
|
7020
|
+
worktreeFn,
|
|
7021
|
+
worktreeInput,
|
|
7022
|
+
plan.binding(worktreeInput, "model"),
|
|
7023
|
+
plan.binding(worktreeInput, "thinking")
|
|
7024
|
+
);
|
|
7011
7025
|
const queued = plan.require(
|
|
7012
7026
|
worktreeFn.body,
|
|
7013
7027
|
(node) => node.type === "ObjectExpression" && hasKeys(node, ["startConversationParamsInput", "startingState", "launchMode"]),
|
|
@@ -19,7 +19,7 @@ export declare class TaskSource {
|
|
|
19
19
|
insert(position: number, text: string): void;
|
|
20
20
|
replace(node: SyntaxNode, text: string): void;
|
|
21
21
|
addProperty(object: SyntaxNode, text: string): void;
|
|
22
|
-
addHandle(fn: SyntaxNode, pattern: SyntaxNode, model?: string): void;
|
|
22
|
+
addHandle(fn: SyntaxNode, pattern: SyntaxNode, model?: string, effort?: string): void;
|
|
23
23
|
declaration(name: string): SyntaxNode;
|
|
24
24
|
result(): string;
|
|
25
25
|
}
|
|
@@ -55,9 +55,11 @@ export class TaskSource {
|
|
|
55
55
|
addProperty(object, text) {
|
|
56
56
|
this.insert(object.start + 1, text + ',');
|
|
57
57
|
}
|
|
58
|
-
addHandle(fn, pattern, model) {
|
|
58
|
+
addHandle(fn, pattern, model, effort) {
|
|
59
59
|
this.addProperty(pattern, `${taskHandle}:${taskHandle}`);
|
|
60
|
-
this.insert(fn.body.start + 1, `if(${taskHandle}!==void 0&&!globalThis.${taskMarker}?.owns(${taskHandle}))throw Error('Invalid native task handle');${model === undefined ? '' : `if(${taskHandle}!==void 0)${model}=${taskHandle}.model;`}
|
|
60
|
+
this.insert(fn.body.start + 1, `if(${taskHandle}!==void 0&&!globalThis.${taskMarker}?.owns(${taskHandle}))throw Error('Invalid native task handle');${model === undefined ? '' : `if(${taskHandle}!==void 0)${model}=${taskHandle}.model;`}${effort === undefined
|
|
61
|
+
? ''
|
|
62
|
+
: `if(${taskHandle}!==void 0&&${effort}==null&&${taskHandle}.reasoningEffort!==void 0)${effort}=${taskHandle}.reasoningEffort;`}`);
|
|
61
63
|
}
|
|
62
64
|
declaration(name) {
|
|
63
65
|
return one(this.functions.filter(fn => fn.type === 'FunctionDeclaration' && fn.id?.name === name), `task-helper-${name}`);
|
|
@@ -16,12 +16,21 @@ function executionEdits(plan) {
|
|
|
16
16
|
if (!hasKeys(options, ['scope', 'sourceThreadId', 'target', 'model', 'prompt', 'parentTurnId', 'rootTurnId'])) {
|
|
17
17
|
throw new Error('Native task creation input unavailable');
|
|
18
18
|
}
|
|
19
|
+
const modelNode = properties(options).get('model');
|
|
20
|
+
if (!['Identifier', 'MemberExpression', 'Literal'].includes(modelNode.type)) {
|
|
21
|
+
throw new Error('Native task model binding unavailable');
|
|
22
|
+
}
|
|
23
|
+
const thinkingNode = properties(options).get('thinking');
|
|
24
|
+
const tierNode = properties(options).get('serviceTier');
|
|
25
|
+
if ([thinkingNode, tierNode].some(node => node && !['Identifier', 'MemberExpression', 'Literal'].includes(node.type))) {
|
|
26
|
+
throw new Error('Native task configuration binding unavailable');
|
|
27
|
+
}
|
|
19
28
|
const targetNode = properties(options).get('target');
|
|
20
29
|
if (targetNode.type !== 'Identifier')
|
|
21
30
|
throw new Error('Native task target binding unavailable');
|
|
22
31
|
const target = plan.text(targetNode);
|
|
23
32
|
// Wrap this one native call, preserving original permission, registration and settlement helpers.
|
|
24
|
-
plan.replace(call, `await (async()=>{const ${taskHandle}=await globalThis.${taskMarker}?.claim({callId:__cxTaskCallId,sourceThreadId:__cxTaskSourceThread,arguments:__cxTaskArguments,hostId:${target}.type==='remoteProject'?${target}.hostId:'local'});if(typeof __cxTaskCallId==='string'&&__cxTaskCallId.startsWith('cordisx-task-')&&${taskHandle}===void 0)throw Error('Native task routing unavailable');return ${plan.text(call.callee)}({${taskHandle},${plan.text(options).slice(1, -1)}})})()`);
|
|
33
|
+
plan.replace(call, `await (async()=>{const ${taskHandle}=await globalThis.${taskMarker}?.claim({callId:__cxTaskCallId,sourceThreadId:__cxTaskSourceThread,arguments:__cxTaskArguments,model:${plan.text(modelNode)},${thinkingNode ? `thinking:${plan.text(thinkingNode)},` : ''}${tierNode ? `serviceTier:${plan.text(tierNode)},` : ''}hostId:${target}.type==='remoteProject'?${target}.hostId:'local'});if(typeof __cxTaskCallId==='string'&&__cxTaskCallId.startsWith('cordisx-task-')&&${taskHandle}===void 0)throw Error('Native task routing unavailable');return ${plan.text(call.callee)}({${taskHandle},${plan.text(options).slice(1, -1)}})})()`);
|
|
25
34
|
const callers = plan.nodes(plan.ast, node => node.type === 'CallExpression' && node.callee.type === 'Identifier' && node.callee.name === fn.id?.name);
|
|
26
35
|
const caller = one(callers, 'task-dispatch-call');
|
|
27
36
|
const argumentsValue = properties(caller.arguments[0]).get('argumentsValue');
|
|
@@ -64,7 +73,7 @@ function initialEdits(plan) {
|
|
|
64
73
|
}
|
|
65
74
|
const localFn = plan.declaration(local.callee.name);
|
|
66
75
|
const localInput = plan.parameter(localFn, ['config', 'model', 'thinking', 'target', 'sourceThreadId']);
|
|
67
|
-
plan.addHandle(localFn, localInput, plan.binding(localInput, 'model'));
|
|
76
|
+
plan.addHandle(localFn, localInput, plan.binding(localInput, 'model'), plan.binding(localInput, 'thinking'));
|
|
68
77
|
const localRequest = plan.require(localFn.body, node => node.type === 'ObjectExpression'
|
|
69
78
|
&& hasKeys(node, ['collaborationMode', 'config', 'projectAssignment', 'workspaceKind', 'threadSource']), 'local-request');
|
|
70
79
|
const priorConfig = properties(localRequest).get('config');
|
|
@@ -83,7 +92,7 @@ function initialEdits(plan) {
|
|
|
83
92
|
'startingState',
|
|
84
93
|
'sourceThreadId',
|
|
85
94
|
]);
|
|
86
|
-
plan.addHandle(worktreeFn, worktreeInput, plan.binding(worktreeInput, 'model'));
|
|
95
|
+
plan.addHandle(worktreeFn, worktreeInput, plan.binding(worktreeInput, 'model'), plan.binding(worktreeInput, 'thinking'));
|
|
87
96
|
const queued = plan.require(worktreeFn.body, node => node.type === 'ObjectExpression'
|
|
88
97
|
&& hasKeys(node, ['startConversationParamsInput', 'startingState', 'launchMode']), 'worktree-request');
|
|
89
98
|
const queuedInput = properties(queued).get('startConversationParamsInput');
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type TranscriptEntry } from './agent-bridge-transcript.js';
|
|
2
|
+
import type { NativeBridgeMethod } from './native-submission-control-server.js';
|
|
3
|
+
interface NativeHistoryReader {
|
|
4
|
+
nativeRequest(method: NativeBridgeMethod, params: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
5
|
+
}
|
|
6
|
+
/** Compatibility projection for callers that already have an in-memory thread. */
|
|
7
|
+
export declare function threadEntries(value: unknown): readonly TranscriptEntry[];
|
|
8
|
+
export declare const threadTranscript: (value: unknown, limit?: number) => readonly TranscriptEntry[];
|
|
9
|
+
export declare const transcriptLimit: (value: unknown) => number | undefined;
|
|
10
|
+
export declare function codexThreadMetadata(codex: NativeHistoryReader, threadId: string): Promise<Record<string, unknown> | undefined>;
|
|
11
|
+
/** Page native items before projecting text; a display limit never hydrates full history. */
|
|
12
|
+
export declare function codexTranscriptPage(codex: NativeHistoryReader, threadId: string, options?: {
|
|
13
|
+
readonly limit?: number;
|
|
14
|
+
readonly cursor?: unknown;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
clippedCharacters: number;
|
|
17
|
+
nextCursor?: string;
|
|
18
|
+
entries: readonly TranscriptEntry[];
|
|
19
|
+
total: number | null;
|
|
20
|
+
truncated: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
/** A bounded recent-history scan for discovery and mechanical caller summaries. */
|
|
23
|
+
export declare function codexRecentEntries(codex: NativeHistoryReader, threadId: string, options?: {
|
|
24
|
+
readonly deadline?: number;
|
|
25
|
+
readonly maxCharacters?: number;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
entries: TranscriptEntry[];
|
|
28
|
+
capped: boolean;
|
|
29
|
+
reason: "time-limit";
|
|
30
|
+
} | {
|
|
31
|
+
entries: TranscriptEntry[];
|
|
32
|
+
capped: boolean;
|
|
33
|
+
reason: "size-limit";
|
|
34
|
+
} | {
|
|
35
|
+
entries: TranscriptEntry[];
|
|
36
|
+
capped: boolean;
|
|
37
|
+
reason?: never;
|
|
38
|
+
} | {
|
|
39
|
+
entries: TranscriptEntry[];
|
|
40
|
+
capped: boolean;
|
|
41
|
+
reason: "history-page-limit";
|
|
42
|
+
}>;
|
|
43
|
+
export declare const summaryHistoryCharacters = 60000;
|
|
44
|
+
/** Read turn metadata without loading any items; only a matching turn can finish an operation. */
|
|
45
|
+
export declare function codexTurn(codex: NativeHistoryReader, threadId: string, turnId: string): Promise<Record<string, unknown> | undefined>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=agent-bridge-codex-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-bridge-codex-history.d.ts","sourceRoot":"","sources":["../../../src/launcher/agent-bridge-codex-history.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAE/E,UAAU,mBAAmB;IAC3B,aAAa,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACvG;AA8BD,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,eAAe,EAAE,CASxE;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,EAAE,QAAQ,MAAM,KAAG,SAAS,eAAe,EACN,CAAA;AAEpF,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,SAC4C,CAAA;AAEtG,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,gDAErF;AAsDD,6FAA6F;AAC7F,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,mBAAmB,EAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO;;;;;;GA+BrE;AAED,mFAAmF;AACnF,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,mBAAmB,EAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAO;;;;;;;;;;;;;;;;GAmB9E;AAED,eAAO,MAAM,wBAAwB,QAAuB,CAAA;AAE5D,kGAAkG;AAClG,wBAAsB,SAAS,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gDAqB3F"}
|