@myagentroam/node 0.11.36 → 0.11.38
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/application/execution-lifecycle.js +54 -0
- package/dist/application/node-lifecycle.js +104 -0
- package/dist/application/node-operation-admission.js +51 -0
- package/dist/application/node-operation-contracts.js +1 -0
- package/dist/application/runner-composition.js +22 -0
- package/dist/application/session-projection-composition.js +26 -0
- package/dist/application/workspace-application.js +61 -0
- package/dist/application/workspace-composition.js +21 -0
- package/dist/capabilities.js +2 -3
- package/dist/codex-app-server.js +1 -471
- package/dist/connection/authorization.js +26 -0
- package/dist/{service → connection}/direct-transfer-service.js +1 -1
- package/dist/connection/endpoints.js +32 -0
- package/dist/connector.js +145 -253
- package/dist/control-outbound-scheduler.js +3 -0
- package/dist/database.js +34 -14
- package/dist/git-askpass.js +1 -1
- package/dist/git-execution-helper.js +1 -1
- package/dist/hosting/hosted-conversation-file-identity.js +27 -0
- package/dist/hosting/hosted-conversation-file-operations.js +44 -0
- package/dist/hosting/hosted-conversation-node-service.js +974 -0
- package/dist/hosting/hosted-conversation-runs.js +599 -0
- package/dist/hosting/hosted-conversation-templates.js +280 -0
- package/dist/hosting/hosted-conversation-uploads.js +344 -0
- package/dist/hosting/hosted-conversation-watch.js +194 -0
- package/dist/hosting/runtime-contracts.js +1 -0
- package/dist/runner/abstract-runner.js +4 -13
- package/dist/{claude-agent-sdk.js → runner/claude/claude-agent-sdk.js} +2 -2
- package/dist/runner/claude/conversation-parser.js +2 -1
- package/dist/runner/claude/managed-run-controller.js +6 -7
- package/dist/runner/claude/message-parsers.js +2 -1
- package/dist/runner/claude/native-transcript.js +2 -1
- package/dist/runner/claude/tool-normalizer.js +1 -1
- package/dist/runner/claude-code-runner.js +2 -2
- package/dist/runner/codex/codex-app-server.js +471 -0
- package/dist/runner/codex/conversation-parser.js +4 -2
- package/dist/runner/codex/managed-run-controller.js +7 -9
- package/dist/runner/codex/native-transcript.js +1 -1
- package/dist/runner/codex/tool-normalizer.js +1 -1
- package/dist/runner/codex-runner.js +9 -27
- package/dist/runner/contracts.js +1 -0
- package/dist/runner/mar-agent/conversation-normalizer.js +2 -2
- package/dist/runner/mar-agent/history-projection.js +1 -1
- package/dist/runner/mar-agent/hosted-conversation-runtime.js +6 -10
- package/dist/runner/mar-agent/managed-run-controller.js +85 -61
- package/dist/runner/mar-agent/runtime-model-factory.js +0 -3
- package/dist/runner/mar-agent-runner.js +1 -1
- package/dist/runner/normalization.js +42 -0
- package/dist/runner/opencode/conversation-parser.js +1 -1
- package/dist/runner/opencode/managed-run-controller.js +6 -7
- package/dist/{opencode-server.js → runner/opencode/opencode-server.js} +2 -2
- package/dist/runner/opencode/tool-normalizer.js +1 -1
- package/dist/runner/opencode-runner.js +4 -5
- package/dist/runner/runner-registry.js +4 -1
- package/dist/runtime-state.js +48 -372
- package/dist/service/computer-use-enablement-service.js +1 -1
- package/dist/service/continuous-run-coordinator.js +52 -7
- package/dist/service/conversation-history-service.js +4 -4
- package/dist/service/conversation-hosting-capability-service.js +1 -1
- package/dist/service/conversation-hosting-enablement-service.js +1 -1
- package/dist/service/conversation-hosting-lifecycle-service.js +3 -3
- package/dist/service/conversation-hosting-maintenance-service.js +1 -1
- package/dist/service/conversation-observation.js +1 -1
- package/dist/service/conversation-segment-service.js +1 -1
- package/dist/service/external-session-resume-service.js +47 -27
- package/dist/service/fake-managed-run-service.js +3 -7
- package/dist/service/git-operation-service.js +1 -1
- package/dist/service/goal-continuation-coordinator.js +14 -7
- package/dist/service/mar-agent-model-transport-test-service.js +1 -1
- package/dist/service/native-session-watch-service.js +1 -1
- package/dist/service/node-connection-lifecycle-service.js +6 -3
- package/dist/service/node-control-channel.js +48 -11
- package/dist/service/node-request-service.js +1 -1
- package/dist/service/node-terminal-channel.js +2 -1
- package/dist/service/node-workspace-coordinator.js +3 -2
- package/dist/service/notification-mcp-bridge.js +6 -2
- package/dist/service/recent-run-projection-service.js +1 -1
- package/dist/service/restart-session-restorer.js +1 -1
- package/dist/service/run-event-service.js +49 -42
- package/dist/service/run-workbench-service.js +3 -3
- package/dist/service/runner-interaction-service.js +6 -5
- package/dist/service/runner-service.js +1 -1
- package/dist/service/session-recent-activity.js +2 -1
- package/dist/service/skill-directory-service.js +1 -1
- package/dist/service/skill-install-service.js +2 -2
- package/dist/service/terminal-service.js +1 -1
- package/dist/service/workbench-event-projection.js +3 -2
- package/dist/service/workbench-event-service.js +1 -1
- package/dist/service/workspace-service.js +3 -2
- package/dist/session/attachments.js +110 -0
- package/dist/session/contracts.js +1 -0
- package/dist/{util → session}/conversation-identity.js +1 -1
- package/dist/session/input-validation.js +15 -0
- package/dist/{service → session}/native-session-projection-service.js +40 -11
- package/dist/session/pagination.js +77 -0
- package/dist/{util → session}/runner-native-session-parsers.js +2 -1
- package/dist/session/runtime/approvals.js +90 -0
- package/dist/session/runtime/conversation-projection.js +310 -0
- package/dist/session/runtime/type-guards.js +19 -0
- package/dist/{service → session}/session-catalog-service.js +5 -4
- package/dist/{service → session}/session-command-service.js +3 -3
- package/dist/{service → session}/session-identity-service.js +1 -1
- package/dist/{service → session}/session-lifecycle-service.js +18 -7
- package/dist/{service → session}/session-message-service.js +6 -5
- package/dist/{service → session}/session-presentation-service.js +1 -1
- package/dist/{service → session}/session-query-service.js +2 -2
- package/dist/{service → session}/session-schedule-service.js +2 -2
- package/dist/util/records.js +3 -0
- package/dist/workspace/contracts.js +1 -0
- package/dist/workspace/file-index.js +534 -0
- package/dist/workspace/files.js +466 -0
- package/dist/workspace/git.js +991 -0
- package/dist/workspace/path-access.js +184 -0
- package/dist/workspace/utf8.js +12 -0
- package/dist/{service → workspace}/workspace-change-service.js +45 -21
- package/dist/{service → workspace}/workspace-code-navigation-service.js +6 -6
- package/dist/{service → workspace}/workspace-file-manager-service.js +1 -1
- package/dist/{service → workspace}/workspace-file-service.js +16 -16
- package/dist/{service → workspace}/workspace-git-exclude-service.js +1 -1
- package/dist/{service → workspace}/workspace-queue-workbench-service.js +3 -2
- package/dist/{service → workspace}/workspace-session-service.js +45 -40
- package/dist/{service → workspace}/workspace-upload-service.js +28 -28
- package/dist/{service → workspace}/workspace-watch-service.js +29 -28
- package/dist/{service → workspace}/workspace-workbench-service.js +4 -3
- package/package.json +4 -4
- package/dist/service/hosted-conversation-node-service.js +0 -2252
- package/dist/service/run-domain-state.js +0 -4
- package/dist/service/session-domain-state.js +0 -9
- package/dist/service/workspace-domain-state.js +0 -41
- package/dist/util/node-operation-parsers.js +0 -320
- package/dist/workspace.js +0 -2168
- /package/dist/{connector → application}/node-connector-options.js +0 -0
- /package/dist/{util → connection}/node-operation-data.js +0 -0
- /package/dist/{connector → connection}/node-operation-router.js +0 -0
- /package/dist/{service → hosting}/hosted-conversation-sandbox-profile.js +0 -0
- /package/dist/{service → hosting}/hosted-conversation-store.js +0 -0
- /package/dist/{util → mcp}/secret-environment.js +0 -0
- /package/dist/{claude-channel.js → runner/claude/claude-channel.js} +0 -0
- /package/dist/{util → runner}/personal-instructions.js +0 -0
- /package/dist/{util → runner}/runner-error.js +0 -0
- /package/dist/{service/conversation-work-process.js → session/runtime/work-process.js} +0 -0
- /package/dist/{service → session}/session-context-service.js +0 -0
- /package/dist/{util → workspace}/git-credential-client.js +0 -0
- /package/dist/{service → workspace}/workspace-content-search-service.js +0 -0
- /package/dist/{service → workspace}/workspace-watch-snapshot-service.js +0 -0
|
@@ -245,33 +245,29 @@ export class MarAgentHostedConversationRuntime {
|
|
|
245
245
|
clientMessageId: request.clientMessageId
|
|
246
246
|
});
|
|
247
247
|
},
|
|
248
|
-
cancel: () => {
|
|
248
|
+
cancel: (reason = 'interrupt') => {
|
|
249
249
|
if (settled || this.#active.get(input.sessionId)?.handle !== handle)
|
|
250
250
|
return false;
|
|
251
|
+
if (reason === 'shutdown')
|
|
252
|
+
titleController.abort();
|
|
251
253
|
execution.cancel();
|
|
252
254
|
return true;
|
|
253
255
|
}
|
|
254
256
|
};
|
|
255
|
-
this.#active.set(input.sessionId, {
|
|
256
|
-
handle,
|
|
257
|
-
completion,
|
|
258
|
-
cancelTitle: () => titleController.abort()
|
|
259
|
-
});
|
|
257
|
+
this.#active.set(input.sessionId, { handle, completion });
|
|
260
258
|
return handle;
|
|
261
259
|
}
|
|
262
260
|
async releaseSession(input) {
|
|
263
261
|
const active = this.#active.get(input.sessionId);
|
|
264
262
|
if (active === undefined)
|
|
265
263
|
return;
|
|
266
|
-
active.
|
|
267
|
-
active.handle.cancel();
|
|
264
|
+
active.handle.cancel('shutdown');
|
|
268
265
|
await active.completion.catch(() => undefined);
|
|
269
266
|
}
|
|
270
267
|
async dispose() {
|
|
271
268
|
const active = [...this.#active.values()];
|
|
272
269
|
for (const execution of active) {
|
|
273
|
-
execution.
|
|
274
|
-
execution.handle.cancel();
|
|
270
|
+
execution.handle.cancel('shutdown');
|
|
275
271
|
}
|
|
276
272
|
await Promise.allSettled(active.map((execution) => execution.completion));
|
|
277
273
|
}
|
|
@@ -8,12 +8,12 @@ import { homedir } from 'node:os';
|
|
|
8
8
|
import { nodeLog } from '../../operational.js';
|
|
9
9
|
import { createAgent, generateSessionTitle } from '@myagentroam/agent';
|
|
10
10
|
import { marAgentReasoningEffortSchema, resolveMarAgentDefaultReasoningEffort } from '@myagentroam/protocol';
|
|
11
|
-
import { boundedConversationItemId } from '
|
|
12
|
-
import { parseSecretEnvironment } from '../../
|
|
11
|
+
import { boundedConversationItemId } from '../normalization.js';
|
|
12
|
+
import { parseSecretEnvironment } from '../../mcp/secret-environment.js';
|
|
13
13
|
import { MarAgentMcpClientCache } from './mcp-client-pool.js';
|
|
14
14
|
import { MarAgentConversationNormalizer, normalizeMarAgentUsage } from './conversation-normalizer.js';
|
|
15
|
-
import { parseRunnerImageAttachments } from '../../
|
|
16
|
-
import { runnerErrorProjection } from '
|
|
15
|
+
import { parseRunnerImageAttachments } from '../../session/attachments.js';
|
|
16
|
+
import { runnerErrorProjection } from '../runner-error.js';
|
|
17
17
|
import { MarAgentRuntimeModelFactory, sdkModelConfigurations, closeImageCredentialProviders } from './runtime-model-factory.js';
|
|
18
18
|
import { createImageGenerationExtensions } from './image-generation-extensions.js';
|
|
19
19
|
import { createWebToolsExtensions } from './web-tools-extensions.js';
|
|
@@ -111,7 +111,9 @@ export class MarAgentManagedRunController {
|
|
|
111
111
|
if (session.externalSessionId === null || session.nativeControl !== 'MAR_MANAGED')
|
|
112
112
|
throw new Error('RUNNER_COMMAND_UNAVAILABLE');
|
|
113
113
|
const execution = context.executionContext;
|
|
114
|
-
const resolved = resolveMarAgentExecutionInput(execution?.runner === 'mar-agent'
|
|
114
|
+
const resolved = resolveMarAgentExecutionInput(execution?.runner === 'mar-agent'
|
|
115
|
+
? execution.runnerInput
|
|
116
|
+
: undefined, session.model ?? '');
|
|
115
117
|
if (resolved === undefined)
|
|
116
118
|
throw new Error('RUNNER_COMMAND_UNAVAILABLE');
|
|
117
119
|
const runId = randomUUID();
|
|
@@ -149,7 +151,7 @@ export class MarAgentManagedRunController {
|
|
|
149
151
|
typeof payload.input !== 'string' ||
|
|
150
152
|
typeof payload.cwd !== 'string' ||
|
|
151
153
|
typeof payload.model !== 'string' ||
|
|
152
|
-
this.host.
|
|
154
|
+
this.host.isExecutionActive(payload.runId))
|
|
153
155
|
return;
|
|
154
156
|
const resolved = resolveMarAgentExecutionInput(marAgentEnvelopeInput(payload), payload.model);
|
|
155
157
|
if (resolved === undefined) {
|
|
@@ -242,7 +244,7 @@ export class MarAgentManagedRunController {
|
|
|
242
244
|
this.#executions.set(input.runId, execution);
|
|
243
245
|
let runtime;
|
|
244
246
|
let use;
|
|
245
|
-
let
|
|
247
|
+
let terminalEvent;
|
|
246
248
|
let executionMcpLease;
|
|
247
249
|
let executionMcpBinding;
|
|
248
250
|
let computerUseBinding;
|
|
@@ -250,7 +252,7 @@ export class MarAgentManagedRunController {
|
|
|
250
252
|
let titleTask;
|
|
251
253
|
let cancelledDuringPreparation = false;
|
|
252
254
|
try {
|
|
253
|
-
this.host.
|
|
255
|
+
this.host.executionAccepted(input.runId);
|
|
254
256
|
this.host.adopt({
|
|
255
257
|
runId: input.runId,
|
|
256
258
|
sessionId: input.sessionId,
|
|
@@ -419,34 +421,44 @@ export class MarAgentManagedRunController {
|
|
|
419
421
|
: result;
|
|
420
422
|
});
|
|
421
423
|
this.host.emit(input.runId, 'run.running', {}, 'RUNNING');
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
titleTask
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
executionId: handle.executionId,
|
|
432
|
-
purpose: 'title',
|
|
433
|
-
agentRole: 'root'
|
|
434
|
-
})),
|
|
435
|
-
signal: titleController.signal
|
|
436
|
-
}).catch((error) => {
|
|
437
|
-
if (!titleController.signal.aborted)
|
|
438
|
-
nodeLog('runner.mar-agent.title.failed', {
|
|
424
|
+
const consumeEvents = async () => {
|
|
425
|
+
for await (const event of handle) {
|
|
426
|
+
if (event.type === 'execution.started' && metadata?.automaticTitlePending && !titleTask) {
|
|
427
|
+
titleTask = this.#generateTitle({
|
|
428
|
+
models: sdkModelConfigurations(executionModels),
|
|
429
|
+
currentModelId: input.model.id,
|
|
430
|
+
prompt: input.input,
|
|
431
|
+
onModelUsage: (usage) => this.host.emit(input.runId, 'run.usage', normalizeMarAgentUsage({
|
|
432
|
+
...usage,
|
|
439
433
|
sessionId: session.id,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
})
|
|
444
|
-
|
|
445
|
-
|
|
434
|
+
executionId: handle.executionId,
|
|
435
|
+
purpose: 'title',
|
|
436
|
+
agentRole: 'root'
|
|
437
|
+
})),
|
|
438
|
+
signal: titleController.signal
|
|
439
|
+
}).catch((error) => {
|
|
440
|
+
if (!titleController.signal.aborted)
|
|
441
|
+
nodeLog('runner.mar-agent.title.failed', {
|
|
442
|
+
sessionId: session.id,
|
|
443
|
+
runId: input.runId,
|
|
444
|
+
stage: 'generate',
|
|
445
|
+
code: runnerErrorProjection(error, 'MAR_AGENT_TITLE_GENERATION_FAILED').code
|
|
446
|
+
});
|
|
447
|
+
return undefined;
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
this.project(input.runId, event);
|
|
446
451
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
452
|
+
};
|
|
453
|
+
const [eventsResult, executionResult] = await Promise.allSettled([
|
|
454
|
+
consumeEvents(),
|
|
455
|
+
(async () => handle.result())()
|
|
456
|
+
]);
|
|
457
|
+
if (eventsResult.status === 'rejected')
|
|
458
|
+
throw eventsResult.reason;
|
|
459
|
+
if (executionResult.status === 'rejected')
|
|
460
|
+
throw executionResult.reason;
|
|
461
|
+
const result = executionResult.value;
|
|
450
462
|
const title = await titleTask;
|
|
451
463
|
if (title && !titleController.signal.aborted)
|
|
452
464
|
await runtime.agent
|
|
@@ -473,30 +485,33 @@ export class MarAgentManagedRunController {
|
|
|
473
485
|
? 'CANCELLED'
|
|
474
486
|
: 'FAILED';
|
|
475
487
|
use?.terminal();
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
488
|
+
terminalEvent = {
|
|
489
|
+
eventType: status === 'SUCCEEDED'
|
|
490
|
+
? 'run.completed'
|
|
491
|
+
: status === 'CANCELLED'
|
|
492
|
+
? 'run.cancelled'
|
|
493
|
+
: status === 'FAILED'
|
|
494
|
+
? 'run.failed'
|
|
495
|
+
: 'run.completed',
|
|
496
|
+
payload: {
|
|
497
|
+
status,
|
|
498
|
+
...(result.errorCode ? { code: result.errorCode } : {}),
|
|
499
|
+
...(result.errorMessage ? { message: result.errorMessage } : {}),
|
|
500
|
+
...(permissionStop === undefined
|
|
501
|
+
? {}
|
|
502
|
+
: {
|
|
503
|
+
permissionStop,
|
|
504
|
+
code: permissionStop.action === 'ask'
|
|
505
|
+
? 'MAR_AGENT_PERMISSION_ASK'
|
|
506
|
+
: 'MAR_AGENT_PERMISSION_DENIED',
|
|
507
|
+
message: permissionStop.reason
|
|
508
|
+
})
|
|
509
|
+
},
|
|
510
|
+
status
|
|
511
|
+
};
|
|
497
512
|
}
|
|
498
513
|
catch (error) {
|
|
499
|
-
if (
|
|
514
|
+
if (terminalEvent !== undefined) {
|
|
500
515
|
nodeLog('runner.mar-agent.run.cleanup_failed', {
|
|
501
516
|
runId: input.runId,
|
|
502
517
|
code: 'MAR_AGENT_RUN_CLEANUP_FAILED'
|
|
@@ -519,7 +534,7 @@ export class MarAgentManagedRunController {
|
|
|
519
534
|
retryAfterMs: null
|
|
520
535
|
}
|
|
521
536
|
});
|
|
522
|
-
|
|
537
|
+
terminalEvent = { eventType: 'run.failed', payload: projected, status: 'FAILED' };
|
|
523
538
|
}
|
|
524
539
|
}
|
|
525
540
|
finally {
|
|
@@ -560,13 +575,22 @@ export class MarAgentManagedRunController {
|
|
|
560
575
|
finally {
|
|
561
576
|
use?.terminal();
|
|
562
577
|
this.#normalizers.delete(input.runId);
|
|
563
|
-
this.host.active.delete(input.runId);
|
|
564
578
|
this.#executions.delete(input.runId);
|
|
565
579
|
this.#steerTargets.delete(input.runId);
|
|
566
|
-
|
|
580
|
+
if (cancelledDuringPreparation)
|
|
581
|
+
terminalEvent = {
|
|
582
|
+
eventType: 'run.cancelled',
|
|
583
|
+
payload: { status: 'CANCELLED' },
|
|
584
|
+
status: 'CANCELLED'
|
|
585
|
+
};
|
|
586
|
+
try {
|
|
587
|
+
if (terminalEvent !== undefined)
|
|
588
|
+
this.host.emit(input.runId, terminalEvent.eventType, terminalEvent.payload, terminalEvent.status);
|
|
589
|
+
}
|
|
590
|
+
finally {
|
|
591
|
+
resolveSettled();
|
|
592
|
+
}
|
|
567
593
|
}
|
|
568
|
-
if (cancelledDuringPreparation)
|
|
569
|
-
this.host.emit(input.runId, 'run.cancelled', { status: 'CANCELLED' }, 'CANCELLED');
|
|
570
594
|
}
|
|
571
595
|
}
|
|
572
596
|
#resolveMcpServers(installations, environment, executionServers = []) {
|
|
@@ -68,9 +68,6 @@ export class MarAgentRuntimeModelFactory {
|
|
|
68
68
|
...(configuration.serviceTier === undefined
|
|
69
69
|
? {}
|
|
70
70
|
: { serviceTier: configuration.serviceTier }),
|
|
71
|
-
...(configuration.serviceTier === undefined && configuration.fastMode === true
|
|
72
|
-
? { fastMode: true }
|
|
73
|
-
: {}),
|
|
74
71
|
hostedWebSearch: configuration.hostedWebSearch,
|
|
75
72
|
useResourceUrl: configuration.useResourceUrl,
|
|
76
73
|
...(imageGeneration === undefined ? {} : { imageGeneration }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { marAgentNodeModelSummarySchema, parseComposerTags, resolveMarAgentDefaultReasoningEffort, serializeComposerTag } from '@myagentroam/protocol';
|
|
2
2
|
import { nodeLog } from '../operational.js';
|
|
3
|
-
import { runnerErrorProjection } from '
|
|
3
|
+
import { runnerErrorProjection } from './runner-error.js';
|
|
4
4
|
import { AgentError, openAgentSessionCatalog } from '@myagentroam/agent';
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
6
|
import { resolve } from 'node:path';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export function compactRunnerText(value, limit) {
|
|
2
|
+
return value.length <= limit ? value : `${value.slice(0, Math.max(0, limit - 1))}…`;
|
|
3
|
+
}
|
|
4
|
+
export function compactRunnerValue(value, limit) {
|
|
5
|
+
if (value === undefined || value === null)
|
|
6
|
+
return { text: '', truncated: false };
|
|
7
|
+
let text;
|
|
8
|
+
if (typeof value === 'string')
|
|
9
|
+
text = value;
|
|
10
|
+
else {
|
|
11
|
+
try {
|
|
12
|
+
text = JSON.stringify(value);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return { text: '(Unable to display)', truncated: false };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return { text: compactRunnerText(text, limit), truncated: text.length > limit };
|
|
19
|
+
}
|
|
20
|
+
export function nativePageEnd(cursor, sessionId, fallback) {
|
|
21
|
+
if (cursor === undefined)
|
|
22
|
+
return fallback;
|
|
23
|
+
try {
|
|
24
|
+
const value = JSON.parse(Buffer.from(cursor, 'base64url').toString('utf8'));
|
|
25
|
+
return value.sessionId === sessionId &&
|
|
26
|
+
Number.isInteger(value.end) &&
|
|
27
|
+
value.end >= 0
|
|
28
|
+
? Math.min(value.end, fallback)
|
|
29
|
+
: fallback;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return fallback;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function boundedConversationItemId(prefix, value) {
|
|
36
|
+
const candidate = `${prefix}:${value}`;
|
|
37
|
+
if (candidate.length <= 88)
|
|
38
|
+
return candidate;
|
|
39
|
+
return `${prefix}:${Buffer.from(value)
|
|
40
|
+
.toString('base64url')
|
|
41
|
+
.slice(0, 88 - prefix.length - 1)}`;
|
|
42
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { boundedConversationItemId, compactRunnerText } from '
|
|
1
|
+
import { boundedConversationItemId, compactRunnerText } from '../normalization.js';
|
|
2
2
|
import { publicGoalHistoryText } from '../../service/goal-runtime.js';
|
|
3
3
|
import { normalizeOpenCodeTool } from './tool-normalizer.js';
|
|
4
4
|
import { RunnerUsageTracker, usageToken, usageTokenSum } from '../../service/runner-usage-tracker.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OpenCodeUsageNormalizer, openCodeSourceItemId } from './conversation-parser.js';
|
|
2
2
|
import { parseComposerTags } from '@myagentroam/protocol';
|
|
3
3
|
import { nodeExecutionEnvironment } from '../../node-execution-environment.js';
|
|
4
|
-
import { parseSecretEnvironment } from '../../
|
|
5
|
-
import { runnerErrorProjection } from '
|
|
6
|
-
import { boundedConversationItemId, compactRunnerText } from '
|
|
4
|
+
import { parseSecretEnvironment } from '../../mcp/secret-environment.js';
|
|
5
|
+
import { runnerErrorProjection } from '../runner-error.js';
|
|
6
|
+
import { boundedConversationItemId, compactRunnerText } from '../normalization.js';
|
|
7
7
|
import { openCodePatchToolPayload, openCodeQuestions } from './conversation-parser.js';
|
|
8
8
|
import { normalizeOpenCodeTool } from './tool-normalizer.js';
|
|
9
9
|
import { ResponseLatencyTracker } from '../../service/response-latency-tracker.js';
|
|
@@ -65,7 +65,7 @@ export class OpenCodeManagedRunController {
|
|
|
65
65
|
externalSessionId: session.externalSessionId,
|
|
66
66
|
...(initiatedByUserId === undefined ? {} : { initiatedByUserId })
|
|
67
67
|
});
|
|
68
|
-
this.host.
|
|
68
|
+
this.host.executionAccepted(runId);
|
|
69
69
|
this.runner.execution.set(runId, {
|
|
70
70
|
runId,
|
|
71
71
|
sessionId: session.id,
|
|
@@ -108,7 +108,7 @@ export class OpenCodeManagedRunController {
|
|
|
108
108
|
typeof payload.cwd !== 'string' ||
|
|
109
109
|
typeof payload.model !== 'string' ||
|
|
110
110
|
this.host.intercepted() ||
|
|
111
|
-
this.host.
|
|
111
|
+
this.host.isExecutionActive(payload.runId))
|
|
112
112
|
return;
|
|
113
113
|
let environment;
|
|
114
114
|
let mcp;
|
|
@@ -207,7 +207,7 @@ export class OpenCodeManagedRunController {
|
|
|
207
207
|
const client = this.runner.managedClient(input.environment, hasMcpConfiguration(input.mcp) ? input.runId : undefined);
|
|
208
208
|
this.startingClients.set(input.runId, client);
|
|
209
209
|
this.startingCwds.set(input.runId, input.cwd);
|
|
210
|
-
this.host.
|
|
210
|
+
this.host.executionAccepted(input.runId);
|
|
211
211
|
this.host.emit(input.runId, 'run.started', {}, 'STARTING');
|
|
212
212
|
let settlePrompt;
|
|
213
213
|
const promptSettled = new Promise((resolve) => {
|
|
@@ -758,7 +758,6 @@ export class OpenCodeManagedRunController {
|
|
|
758
758
|
this.messageParents.delete(runId);
|
|
759
759
|
this.compactionPartIds.delete(runId);
|
|
760
760
|
this.completedCompactionParents.delete(runId);
|
|
761
|
-
this.host.active.delete(runId);
|
|
762
761
|
for (const [id, pending] of this.permissions)
|
|
763
762
|
if (pending.runId === runId) {
|
|
764
763
|
clearTimeout(pending.timer);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { randomBytes } from 'node:crypto';
|
|
3
3
|
import { createServer } from 'node:net';
|
|
4
|
-
import { minimalRunnerEnvironment, platformCliInvocation } from '
|
|
5
|
-
import { terminateProcessTree } from '
|
|
4
|
+
import { minimalRunnerEnvironment, platformCliInvocation } from '../../operational.js';
|
|
5
|
+
import { terminateProcessTree } from '../../process-tree.js';
|
|
6
6
|
const START_TIMEOUT_MS = 10_000;
|
|
7
7
|
export class OpenCodeServerClient {
|
|
8
8
|
options;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compactRunnerText, compactRunnerValue } from '
|
|
1
|
+
import { compactRunnerText, compactRunnerValue } from '../normalization.js';
|
|
2
2
|
export function normalizeOpenCodeTool(toolName, state) {
|
|
3
3
|
const status = state?.status === 'completed'
|
|
4
4
|
? 'COMPLETED'
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { withMarctlGuide } from '../mcp/marctl-guide.js';
|
|
2
|
-
import { OpenCodeServerClient } from '
|
|
2
|
+
import { OpenCodeServerClient } from './opencode/opencode-server.js';
|
|
3
3
|
import { openCodeContextLimits, openCodeProfileModels } from '../opencode-runtime.js';
|
|
4
4
|
import { declaredRunnerProfiles } from '../runner-profiles.js';
|
|
5
5
|
import { AbstractRunner } from './abstract-runner.js';
|
|
6
|
-
import { isWithinWorkspace } from '../
|
|
6
|
+
import { isWithinWorkspace } from '../session/runner-native-session-parsers.js';
|
|
7
7
|
import { createHash } from 'node:crypto';
|
|
8
8
|
import { homedir } from 'node:os';
|
|
9
9
|
import { openCodeConversationPage, openCodeUserMessagePreview } from './opencode/conversation-parser.js';
|
|
10
10
|
import { nodeLog } from '../operational.js';
|
|
11
|
-
import { runnerErrorProjection } from '
|
|
11
|
+
import { runnerErrorProjection } from './runner-error.js';
|
|
12
12
|
const PROFILE_ENTRY_TTL_MS = 30 * 60_000;
|
|
13
13
|
const PROFILE_FAILURE_RETRY_MS = 30_000;
|
|
14
14
|
const PROFILE_REFRESH_TIMEOUT_MS = 90_000;
|
|
@@ -355,10 +355,9 @@ export class OpenCodeRunner extends AbstractRunner {
|
|
|
355
355
|
commandStates: context.commandStates
|
|
356
356
|
};
|
|
357
357
|
}
|
|
358
|
-
async renameNative(session, input
|
|
358
|
+
async renameNative(session, input) {
|
|
359
359
|
if (session.externalSessionId !== null && input.title !== undefined)
|
|
360
360
|
await this.client.updateSession(session.cwd, session.externalSessionId, input.title ?? '');
|
|
361
|
-
await super.renameNative(session, input, database);
|
|
362
361
|
}
|
|
363
362
|
async removeNative(session, nativeSessionId) {
|
|
364
363
|
await this.client.deleteSession(session.cwd, nativeSessionId);
|
|
@@ -94,6 +94,9 @@ export class RunnerRegistry {
|
|
|
94
94
|
return false;
|
|
95
95
|
}
|
|
96
96
|
async stop() {
|
|
97
|
-
await Promise.allSettled([...this.runners.values()].map((runner) => runner.stop()));
|
|
97
|
+
const results = await Promise.allSettled([...this.runners.values()].map(async (runner) => runner.stop()));
|
|
98
|
+
const failure = results.find((result) => result.status === 'rejected');
|
|
99
|
+
if (failure !== undefined)
|
|
100
|
+
throw failure.reason;
|
|
98
101
|
}
|
|
99
102
|
}
|