@myagentroam/node 0.11.15 → 0.11.16
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/connector.js +13 -20
- package/dist/native-session-history.js +35 -832
- package/dist/native-transcript-adapters.js +9 -0
- package/dist/native-transcript-model.js +1 -0
- package/dist/runner/abstract-runner.js +12 -0
- package/dist/runner/claude/conversation-parser.js +80 -1
- package/dist/runner/claude/managed-run-controller.js +4 -2
- package/dist/runner/claude/message-parsers.js +37 -0
- package/dist/runner/claude/native-context-usage.js +90 -0
- package/dist/runner/claude/native-transcript.js +347 -0
- package/dist/runner/claude/tool-normalizer.js +12 -2
- package/dist/runner/claude-code-runner.js +13 -2
- package/dist/runner/codex/conversation-parser.js +67 -3
- package/dist/runner/codex/managed-run-controller.js +3 -2
- package/dist/runner/codex/native-context-usage.js +42 -0
- package/dist/runner/codex/native-transcript.js +575 -0
- package/dist/runner/codex-runner.js +18 -3
- package/dist/runner/mar-agent/managed-run-controller.js +1 -1
- package/dist/runner/mar-agent-runner.js +6 -0
- package/dist/runner/opencode/conversation-parser.js +1 -1
- package/dist/runner/opencode/managed-run-controller.js +1 -1
- package/dist/runner/opencode-runner.js +7 -1
- package/dist/runner/runner-registry.js +4 -0
- package/dist/runtime-state.js +1 -0
- package/dist/service/continuous-run-coordinator.js +1 -0
- package/dist/service/conversation-template-manifest.js +179 -0
- package/dist/service/conversation-template-node-service.js +10 -132
- package/dist/service/external-session-resume-service.js +15 -0
- package/dist/service/fake-managed-run-service.js +1 -1
- package/dist/service/goal-continuation-coordinator.js +4 -3
- package/dist/service/goal-runtime.js +0 -9
- package/dist/service/hosted-conversation-node-service.js +16 -179
- package/dist/service/native-session-projection-service.js +7 -24
- package/dist/service/node-control-channel.js +1 -1
- package/dist/service/node-request-service.js +1 -1
- package/dist/service/node-run-event-bridge.js +0 -24
- package/dist/service/node-terminal-channel.js +1 -1
- package/dist/service/recent-run-projection-service.js +2 -1
- package/dist/service/run-workbench-service.js +1 -1
- package/dist/service/runner-interaction-service.js +2 -1
- package/dist/service/runner-service.js +6 -4
- package/dist/service/session-identity-service.js +1 -0
- package/dist/service/session-message-service.js +1 -0
- package/dist/service/session-query-service.js +1 -1
- package/dist/service/workbench-event-projection.js +1 -1
- package/dist/service/workbench-event-service.js +1 -1
- package/dist/service/workspace-file-service.js +0 -2
- package/dist/service/workspace-queue-workbench-service.js +2 -2
- package/dist/util/node-operation-parsers.js +0 -45
- package/dist/util/runner-native-session-parsers.js +17 -194
- package/package.json +4 -4
|
@@ -3,8 +3,10 @@ import { ClaudeAgentSdkAdapter } from '../claude-agent-sdk.js';
|
|
|
3
3
|
import { AbstractRunner } from './abstract-runner.js';
|
|
4
4
|
import { claudeDefaultModel, declaredRunnerProfiles } from '../runner-profiles.js';
|
|
5
5
|
import { withClaudePlanTag } from '../runner-command-engine.js';
|
|
6
|
-
import { discoverNativeSessions, readNativeSession
|
|
7
|
-
import {
|
|
6
|
+
import { discoverNativeSessions, readNativeSession } from '../native-session-history.js';
|
|
7
|
+
import { readClaudeNativeContextUsage } from './claude/native-context-usage.js';
|
|
8
|
+
import { claudeDiscoveredSession } from './claude/conversation-parser.js';
|
|
9
|
+
import { deduplicateDirectSessions, isNativeHistory, isWithinWorkspace, latestNativeActivity } from '../util/runner-native-session-parsers.js';
|
|
8
10
|
export class ClaudeCodeRunner extends AbstractRunner {
|
|
9
11
|
client;
|
|
10
12
|
environment;
|
|
@@ -16,6 +18,12 @@ export class ClaudeCodeRunner extends AbstractRunner {
|
|
|
16
18
|
this.client = client;
|
|
17
19
|
this.environment = environment;
|
|
18
20
|
}
|
|
21
|
+
migrateSessionIdentity(previousId, nativeSessionId) {
|
|
22
|
+
for (const [runId, managed] of this.execution.runs) {
|
|
23
|
+
if (managed.marSessionId === previousId)
|
|
24
|
+
this.execution.runs.set(runId, { ...managed, marSessionId: nativeSessionId });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
profile(capabilities) {
|
|
20
28
|
return declaredRunnerProfiles({
|
|
21
29
|
codexAvailable: capabilities.codex.available,
|
|
@@ -46,6 +54,9 @@ export class ClaudeCodeRunner extends AbstractRunner {
|
|
|
46
54
|
access: 'default'
|
|
47
55
|
};
|
|
48
56
|
}
|
|
57
|
+
goalAccess(currentAccess) {
|
|
58
|
+
return { access: 'bypass', accessChanged: currentAccess !== 'bypass' };
|
|
59
|
+
}
|
|
49
60
|
mcpConfiguration(raw, secrets, executionServers = []) {
|
|
50
61
|
const servers = withMarctlGuide(super.mcpConfiguration(raw, secrets, executionServers), secrets);
|
|
51
62
|
return Object.fromEntries(servers.map((server) => [
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
1
2
|
import { open, stat } from 'node:fs/promises';
|
|
2
3
|
import { StringDecoder } from 'node:string_decoder';
|
|
3
4
|
import { nodeLog } from '../../operational.js';
|
|
@@ -134,7 +135,6 @@ import { publicGoalHistoryText } from '../../service/goal-runtime.js';
|
|
|
134
135
|
const MAX_COMPOSER_ATTACHMENT_BYTES = 5 * 1024 * 1024;
|
|
135
136
|
const MAX_COMPOSER_ATTACHMENTS_BYTES = 10 * 1024 * 1024;
|
|
136
137
|
const MAX_ASSISTANT_MESSAGE_CHARACTERS = 64 * 1024;
|
|
137
|
-
export * from '../../util/runner-native-session-parsers.js';
|
|
138
138
|
/** Only the official thread descriptor can declare history-only Revert support. */
|
|
139
139
|
export function codexThreadHistoryModes(result) {
|
|
140
140
|
if (!isPlainRecord(result))
|
|
@@ -1334,5 +1334,69 @@ export function isCodexImageBlock(value) {
|
|
|
1334
1334
|
return false;
|
|
1335
1335
|
return value.type === 'image' || value.type === 'input_image' || value.type === 'output_image';
|
|
1336
1336
|
}
|
|
1337
|
-
import {
|
|
1338
|
-
export
|
|
1337
|
+
import { compactRunnerText, compactRunnerValue, boundedConversationItemId, isCanonicalBase64, isPlainRecord, nativePageEnd } from '../../util/node-operation-parsers.js';
|
|
1338
|
+
export function extractId(result, key) {
|
|
1339
|
+
if (typeof result === 'object' &&
|
|
1340
|
+
result !== null &&
|
|
1341
|
+
key in result &&
|
|
1342
|
+
typeof result[key] === 'object' &&
|
|
1343
|
+
result[key] !== null &&
|
|
1344
|
+
typeof result[key]['id'] === 'string') {
|
|
1345
|
+
return result[key]['id'];
|
|
1346
|
+
}
|
|
1347
|
+
throw new Error(`CODEX_${key.toUpperCase()}_ID_MISSING`);
|
|
1348
|
+
}
|
|
1349
|
+
export function extractCodexThreads(result) {
|
|
1350
|
+
if (typeof result !== 'object' || result === null || !('data' in result))
|
|
1351
|
+
return [];
|
|
1352
|
+
const data = result.data;
|
|
1353
|
+
if (!Array.isArray(data))
|
|
1354
|
+
return [];
|
|
1355
|
+
return data.flatMap((entry) => {
|
|
1356
|
+
if (typeof entry !== 'object' || entry === null)
|
|
1357
|
+
return [];
|
|
1358
|
+
const value = entry;
|
|
1359
|
+
if (typeof value.id !== 'string')
|
|
1360
|
+
return [];
|
|
1361
|
+
const source = typeof value.sourceKind === 'string'
|
|
1362
|
+
? value.sourceKind
|
|
1363
|
+
: typeof value.source === 'string'
|
|
1364
|
+
? value.source
|
|
1365
|
+
: typeof value.source === 'object' &&
|
|
1366
|
+
value.source !== null &&
|
|
1367
|
+
typeof value.source.kind === 'string'
|
|
1368
|
+
? value.source.kind
|
|
1369
|
+
: undefined;
|
|
1370
|
+
const sourceRecord = isPlainRecord(value.source) ? value.source : undefined;
|
|
1371
|
+
const derived = source === 'subagent' ||
|
|
1372
|
+
sourceRecord?.kind === 'subagent' ||
|
|
1373
|
+
isPlainRecord(sourceRecord?.subagent) ||
|
|
1374
|
+
isPlainRecord(sourceRecord?.subAgent);
|
|
1375
|
+
const name = typeof value.name === 'string' ? value.name.trim() : '';
|
|
1376
|
+
const preview = typeof value.preview === 'string' ? value.preview.trim() : '';
|
|
1377
|
+
const title = name || preview || undefined;
|
|
1378
|
+
const titleOrigin = name ? 'OFFICIAL' : preview ? 'PREVIEW' : undefined;
|
|
1379
|
+
return [{ id: value.id, source, derived, cwd: value.cwd, title, titleOrigin }];
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
export function codexThreadCwd(value) {
|
|
1383
|
+
if (typeof value !== 'string' || value.length === 0)
|
|
1384
|
+
throw new Error('CODEX_THREAD_CWD_INVALID');
|
|
1385
|
+
if (!value.startsWith('file:'))
|
|
1386
|
+
return value;
|
|
1387
|
+
try {
|
|
1388
|
+
return fileURLToPath(value);
|
|
1389
|
+
}
|
|
1390
|
+
catch {
|
|
1391
|
+
throw new Error('CODEX_THREAD_CWD_INVALID');
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
export function codexTimestamp(value) {
|
|
1395
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
1396
|
+
return value < 10_000_000_000 ? value * 1_000 : value;
|
|
1397
|
+
if (typeof value === 'string') {
|
|
1398
|
+
const timestamp = Date.parse(value);
|
|
1399
|
+
return Number.isNaN(timestamp) ? null : timestamp;
|
|
1400
|
+
}
|
|
1401
|
+
return null;
|
|
1402
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { NODE_MCP } from '../../mcp/naming.js';
|
|
2
2
|
import { nodeExecutionEnvironment } from '../../node-execution-environment.js';
|
|
3
|
-
import { extractId } from '
|
|
3
|
+
import { extractId } from './conversation-parser.js';
|
|
4
4
|
import { parseSecretEnvironment } from '../../util/secret-environment.js';
|
|
5
5
|
import { safeErrorCode } from '../../util/safe-error.js';
|
|
6
6
|
import { runnerErrorProjection } from '../../util/runner-error.js';
|
|
7
7
|
import { ResponseLatencyTracker } from '../../service/response-latency-tracker.js';
|
|
8
8
|
import { GenerationTimingTracker } from '../../service/generation-timing-tracker.js';
|
|
9
|
-
import { boundedConversationItemId,
|
|
9
|
+
import { boundedConversationItemId, compactRunnerText, isPlainRecord } from '../../util/node-operation-parsers.js';
|
|
10
|
+
import { codexImageAttachments, codexLiveConversationItem, codexSourceItemId, CodexUsageNormalizer, codexUserInputQuestions } from './conversation-parser.js';
|
|
10
11
|
export function resolveCodexNotificationRun(runs, input) {
|
|
11
12
|
const entries = [...runs.entries()];
|
|
12
13
|
if (input.turnId !== undefined) {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { forEachJsonlRecord, readJsonlWindow } from '../../native-jsonl-reader.js';
|
|
2
|
+
import { locateNativeSessionPath } from '../../native-session-history.js';
|
|
3
|
+
const CONTEXT_USAGE_READ_BYTES = 256 * 1024;
|
|
4
|
+
export async function readCodexNativeContextUsage(workspacePath, externalSessionId) {
|
|
5
|
+
const path = await locateNativeSessionPath('codex', workspacePath, externalSessionId);
|
|
6
|
+
if (path === undefined)
|
|
7
|
+
return undefined;
|
|
8
|
+
const window = await readJsonlWindow(path, { tailBytes: CONTEXT_USAGE_READ_BYTES });
|
|
9
|
+
if (window === undefined)
|
|
10
|
+
return undefined;
|
|
11
|
+
let usage;
|
|
12
|
+
forEachJsonlRecord(window.content, (record) => {
|
|
13
|
+
const next = codexContextUsage(record);
|
|
14
|
+
if (next !== undefined)
|
|
15
|
+
usage = next;
|
|
16
|
+
});
|
|
17
|
+
return usage;
|
|
18
|
+
}
|
|
19
|
+
function codexContextUsage(value) {
|
|
20
|
+
if (!isRecord(value) || value.type !== 'event_msg' || !isRecord(value.payload))
|
|
21
|
+
return undefined;
|
|
22
|
+
const payload = value.payload;
|
|
23
|
+
if (payload.type !== 'token_count' || !isRecord(payload.info))
|
|
24
|
+
return undefined;
|
|
25
|
+
const promptUsage = payload.info.last_token_usage;
|
|
26
|
+
const maxTokens = payload.info.model_context_window;
|
|
27
|
+
if (!isRecord(promptUsage) ||
|
|
28
|
+
typeof promptUsage.input_tokens !== 'number' ||
|
|
29
|
+
typeof maxTokens !== 'number')
|
|
30
|
+
return undefined;
|
|
31
|
+
if (!Number.isFinite(promptUsage.input_tokens) ||
|
|
32
|
+
!Number.isInteger(promptUsage.input_tokens) ||
|
|
33
|
+
!Number.isFinite(maxTokens) ||
|
|
34
|
+
!Number.isInteger(maxTokens) ||
|
|
35
|
+
maxTokens <= 0 ||
|
|
36
|
+
promptUsage.input_tokens < 0)
|
|
37
|
+
return undefined;
|
|
38
|
+
return { usedTokens: promptUsage.input_tokens, maxTokens };
|
|
39
|
+
}
|
|
40
|
+
function isRecord(value) {
|
|
41
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
42
|
+
}
|