@andorra-labs/code 0.1.15 → 0.1.17
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/src/acp-agent.d.ts +6 -0
- package/dist/src/acp-agent.js +15 -4
- package/dist/src/agent-definitions.js +29 -6
- package/dist/src/agent-execution.js +15 -10
- package/dist/src/agent-mcp-catalog.js +1 -0
- package/dist/src/agent-mcp.d.ts +4 -1
- package/dist/src/agent-mcp.js +46 -10
- package/dist/src/andorra/entry.d.ts +10 -0
- package/dist/src/andorra/entry.js +18 -4
- package/dist/src/andorra/hosted.d.ts +2 -1
- package/dist/src/andorra/hosted.js +2 -1
- package/dist/src/andorra/notices.d.ts +5 -0
- package/dist/src/andorra/notices.js +7 -0
- package/dist/src/andorra/state.d.ts +3 -2
- package/dist/src/andorra/state.js +4 -4
- package/dist/src/andorra/terminal.js +7 -2
- package/dist/src/anthropic-credentials.js +2 -0
- package/dist/src/app-server/error.d.ts +5 -0
- package/dist/src/app-server/error.js +7 -0
- package/dist/src/app-server/protocol.d.ts +22 -44
- package/dist/src/app-server/protocol.js +5 -1
- package/dist/src/app-server/workspace.d.ts +89 -0
- package/dist/src/app-server/workspace.js +457 -11
- package/dist/src/app-server.d.ts +465 -32
- package/dist/src/app-server.js +3308 -517
- package/dist/src/auth/deployment.js +2 -2
- package/dist/src/bridge/cloud.d.ts +27 -0
- package/dist/src/bridge/cloud.js +187 -0
- package/dist/src/bridge/command.d.ts +30 -0
- package/dist/src/bridge/command.js +347 -0
- package/dist/src/bridge/control.d.ts +68 -0
- package/dist/src/bridge/control.js +233 -0
- package/dist/src/bridge/engines.d.ts +90 -0
- package/dist/src/bridge/engines.js +601 -0
- package/dist/src/bridge/host-ops.d.ts +9 -0
- package/dist/src/bridge/host-ops.js +129 -0
- package/dist/src/bridge/host.d.ts +47 -0
- package/dist/src/bridge/host.js +540 -0
- package/dist/src/bridge/link.d.ts +38 -0
- package/dist/src/bridge/link.js +508 -0
- package/dist/src/bridge/login-link.d.ts +29 -0
- package/dist/src/bridge/login-link.js +54 -0
- package/dist/src/bridge/protocol.d.ts +136 -0
- package/dist/src/bridge/protocol.js +11 -0
- package/dist/src/bridge/store.d.ts +12 -0
- package/dist/src/bridge/store.js +61 -0
- package/dist/src/bridge/wording.d.ts +6 -0
- package/dist/src/bridge/wording.js +10 -0
- package/dist/src/browser-runner.js +1 -0
- package/dist/src/browser-server.js +7 -1
- package/dist/src/browser-ui/style.css +3 -3
- package/dist/src/browser-ui/tokens.css +28 -17
- package/dist/src/change-authors.d.ts +41 -0
- package/dist/src/change-authors.js +146 -0
- package/dist/src/claude-provider.js +3 -1
- package/dist/src/cli.js +202 -38
- package/dist/src/codex-errors.js +4 -1
- package/dist/src/coding-tools.js +15 -15
- package/dist/src/command-screens.d.ts +6 -0
- package/dist/src/command-screens.js +19 -14
- package/dist/src/commands.d.ts +14 -1
- package/dist/src/compaction-phrases.d.ts +4 -0
- package/dist/src/compaction-phrases.js +20 -0
- package/dist/src/completion.js +82 -5
- package/dist/src/config.d.ts +71 -3
- package/dist/src/config.js +202 -77
- package/dist/src/context-compaction.js +2 -1
- package/dist/src/deadline.js +13 -1
- package/dist/src/decision/DecisionManager.js +3 -2
- package/dist/src/decision/checks.js +1 -1
- package/dist/src/decision/requestPhrases.d.ts +4 -0
- package/dist/src/decision/requestPhrases.js +22 -0
- package/dist/src/default-graph.js +1 -1
- package/dist/src/file-diff.d.ts +4 -0
- package/dist/src/file-diff.js +2 -1
- package/dist/src/github-app/agent-writes.d.ts +102 -0
- package/dist/src/github-app/agent-writes.js +320 -0
- package/dist/src/github-app/client.d.ts +349 -0
- package/dist/src/github-app/client.js +810 -0
- package/dist/src/github-app/event-source.d.ts +208 -0
- package/dist/src/github-app/event-source.js +684 -0
- package/dist/src/github-app/metrics.d.ts +32 -0
- package/dist/src/github-app/metrics.js +49 -0
- package/dist/src/github-app/review-loop.d.ts +274 -0
- package/dist/src/github-app/review-loop.js +1177 -0
- package/dist/src/github-app/review-node.d.ts +81 -0
- package/dist/src/github-app/review-node.js +205 -0
- package/dist/src/github-app/review-post.d.ts +73 -0
- package/dist/src/github-app/review-post.js +139 -0
- package/dist/src/github-app/review-text.d.ts +107 -0
- package/dist/src/github-app/review-text.js +1133 -0
- package/dist/src/github-app/review-threads.d.ts +47 -0
- package/dist/src/github-app/review-threads.js +107 -0
- package/dist/src/github-app/reviewer.d.ts +121 -0
- package/dist/src/github-app/reviewer.js +598 -0
- package/dist/src/github-app/store.d.ts +59 -0
- package/dist/src/github-app/store.js +148 -0
- package/dist/src/github-app/triggers.d.ts +141 -0
- package/dist/src/github-app/triggers.js +441 -0
- package/dist/src/github-inbox.d.ts +55 -0
- package/dist/src/github-inbox.js +153 -0
- package/dist/src/github-names.d.ts +8 -0
- package/dist/src/github-names.js +8 -0
- package/dist/src/glob-search.d.ts +61 -0
- package/dist/src/glob-search.js +180 -0
- package/dist/src/graph-health.js +13 -4
- package/dist/src/graph-manager-chat.js +1 -1
- package/dist/src/graph-preview.d.ts +46 -0
- package/dist/src/graph-preview.js +55 -0
- package/dist/src/graph-provider-portability.js +34 -11
- package/dist/src/graph-quota.d.ts +29 -2
- package/dist/src/graph-quota.js +68 -10
- package/dist/src/graph-runner.js +88 -10
- package/dist/src/graph-server.d.ts +1 -1
- package/dist/src/graph-server.js +11 -9
- package/dist/src/graph-sync.js +3 -3
- package/dist/src/graph-ui/app.js +201 -40
- package/dist/src/graph-ui/controls.css +1 -0
- package/dist/src/graph-ui/embed.js +2 -2
- package/dist/src/graph-ui/icons.js +3 -1
- package/dist/src/graph-ui/index.html +1 -1
- package/dist/src/graph-ui/manager.css +1 -1
- package/dist/src/graph-ui/manager.js +2 -2
- package/dist/src/graph-ui/sidebar.js +30 -0
- package/dist/src/graph-ui/studio-canvas.js +26 -13
- package/dist/src/graph-ui/studio.css +15 -7
- package/dist/src/graph-ui/studio.js +26 -5
- package/dist/src/graph-ui/style.css +77 -45
- package/dist/src/graph-ui/theme.js +3 -36
- package/dist/src/graph-ui/tokens.css +28 -20
- package/dist/src/graphs.d.ts +34 -1
- package/dist/src/graphs.js +162 -17
- package/dist/src/image-input.d.ts +16 -0
- package/dist/src/image-input.js +41 -0
- package/dist/src/membership.d.ts +30 -1
- package/dist/src/membership.js +48 -8
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +7 -1
- package/dist/src/model-metadata.js +39 -17
- package/dist/src/model-relay/local.d.ts +116 -0
- package/dist/src/model-relay/local.js +468 -0
- package/dist/src/model-relay/remote.d.ts +129 -0
- package/dist/src/model-relay/remote.js +252 -0
- package/dist/src/model-relay/runs.d.ts +34 -0
- package/dist/src/model-relay/runs.js +146 -0
- package/dist/src/model-relay/wire.d.ts +5 -0
- package/dist/src/model-relay/wire.js +5 -0
- package/dist/src/plan-pass.d.ts +59 -0
- package/dist/src/plan-pass.js +165 -0
- package/dist/src/project-registry.d.ts +21 -0
- package/dist/src/project-registry.js +74 -0
- package/dist/src/provider-engine.js +3 -0
- package/dist/src/provider-import.d.ts +0 -12
- package/dist/src/provider-import.js +7 -195
- package/dist/src/providers.d.ts +40 -2
- package/dist/src/providers.js +93 -23
- package/dist/src/pull-request-checks.d.ts +26 -0
- package/dist/src/pull-request-checks.js +56 -0
- package/dist/src/pull-request-conversation.d.ts +134 -0
- package/dist/src/pull-request-conversation.js +221 -0
- package/dist/src/pull-request-create.d.ts +175 -0
- package/dist/src/pull-request-create.js +392 -0
- package/dist/src/pull-request-details.d.ts +242 -0
- package/dist/src/pull-request-details.js +614 -0
- package/dist/src/pull-request-edit.d.ts +23 -0
- package/dist/src/pull-request-edit.js +91 -0
- package/dist/src/pull-request-logs.d.ts +87 -0
- package/dist/src/pull-request-logs.js +183 -0
- package/dist/src/pull-request-merge.d.ts +112 -0
- package/dist/src/pull-request-merge.js +258 -0
- package/dist/src/pull-request-review.d.ts +137 -0
- package/dist/src/pull-request-review.js +401 -0
- package/dist/src/pull-requests.d.ts +369 -8
- package/dist/src/pull-requests.js +524 -55
- package/dist/src/react-runtime.js +38 -5
- package/dist/src/remote/engine-pool.d.ts +88 -4
- package/dist/src/remote/engine-pool.js +379 -90
- package/dist/src/remote/roots.d.ts +19 -0
- package/dist/src/remote/roots.js +45 -7
- package/dist/src/remote/types.d.ts +0 -44
- package/dist/src/run-control.d.ts +17 -0
- package/dist/src/run-control.js +47 -0
- package/dist/src/run-progress.d.ts +10 -0
- package/dist/src/run-progress.js +122 -0
- package/dist/src/run-records.d.ts +7 -2
- package/dist/src/run-records.js +71 -6
- package/dist/src/runtime.d.ts +9 -1
- package/dist/src/runtime.js +24 -4
- package/dist/src/session-changes.d.ts +35 -0
- package/dist/src/session-changes.js +194 -6
- package/dist/src/session-monitor.js +2 -1
- package/dist/src/session-reaper.d.ts +1 -1
- package/dist/src/session-reaper.js +6 -1
- package/dist/src/session-summary.d.ts +2 -1
- package/dist/src/session-summary.js +2 -1
- package/dist/src/sessions.d.ts +11 -1
- package/dist/src/sessions.js +17 -4
- package/dist/src/skills/bundled/diagram/SKILL.md +5 -3
- package/dist/src/skills/bundled/graph-manager/SKILL.md +7 -4
- package/dist/src/skills/bundled/provenance.json +2 -2
- package/dist/src/skills/runtime-skills.js +1 -1
- package/dist/src/subagent-run.js +1 -0
- package/dist/src/telemetry/capture-core.d.ts +17 -0
- package/dist/src/telemetry/capture-core.js +59 -1
- package/dist/src/telemetry/classify.d.ts +3 -1
- package/dist/src/telemetry/classify.js +37 -0
- package/dist/src/telemetry/emitter.d.ts +17 -0
- package/dist/src/telemetry/emitter.js +76 -5
- package/dist/src/telemetry/schema.d.ts +47 -2
- package/dist/src/telemetry/schema.js +120 -5
- package/dist/src/telemetry/surface.d.ts +3 -1
- package/dist/src/telemetry/surface.js +4 -1
- package/dist/src/telemetry/uploader.d.ts +6 -1
- package/dist/src/telemetry/uploader.js +22 -3
- package/dist/src/terminal-ui.d.ts +1 -0
- package/dist/src/terminal-ui.js +10 -3
- package/dist/src/test-edit-guard.d.ts +7 -0
- package/dist/src/test-edit-guard.js +49 -1
- package/dist/src/timers.d.ts +2 -0
- package/dist/src/tools.js +59 -9
- package/dist/src/transcript.js +8 -2
- package/dist/src/types.d.ts +7 -0
- package/dist/src/usage-analytics.js +18 -10
- package/package.json +6 -1
- package/dist/src/remote/cert.d.ts +0 -11
- package/dist/src/remote/cert.js +0 -87
- package/dist/src/remote/client.d.ts +0 -119
- package/dist/src/remote/client.js +0 -544
- package/dist/src/remote/command.d.ts +0 -4
- package/dist/src/remote/command.js +0 -194
- package/dist/src/remote/errors.d.ts +0 -11
- package/dist/src/remote/errors.js +0 -14
- package/dist/src/remote/network.d.ts +0 -22
- package/dist/src/remote/network.js +0 -102
- package/dist/src/remote/pairing.d.ts +0 -63
- package/dist/src/remote/pairing.js +0 -299
- package/dist/src/remote/pem.d.ts +0 -2
- package/dist/src/remote/pem.js +0 -7
- package/dist/src/remote/serve.d.ts +0 -68
- package/dist/src/remote/serve.js +0 -244
- package/dist/src/remote/server.d.ts +0 -21
- package/dist/src/remote/server.js +0 -406
|
@@ -9,7 +9,7 @@ import { runRegularTurnLoop } from '../vendor/zcode/source/runtime/turn-loop.js'
|
|
|
9
9
|
import { validateInitialModelToolInput, getInitialInputValidationModelContent } from '../vendor/zcode/source/tool/executor/validation.js';
|
|
10
10
|
import { andorraIsContextOverflow } from '../vendor/engine/runtime/ai/utils/overflow.js';
|
|
11
11
|
import { toEngineResponse, engineModel } from './engine/protocol.js';
|
|
12
|
-
import { ProviderRequestError } from './providers.js';
|
|
12
|
+
import { ProviderRequestError, runFailureCode } from './providers.js';
|
|
13
13
|
import { COMPLETION_ALONE_ERROR, COMPLETION_TOOL, COMPLETION_GUIDANCE, FINAL_RESPONSE_GUIDANCE, OUTPUT_STOOD_IN_NOTE, RESPONSE_STRUCTURE_GUIDANCE, completionTool, completionResponse, parseCompletion, withoutTrailingEnvelope } from './completion.js';
|
|
14
14
|
import { MAX_GATE_ASKS, MAX_IDLE_UNFINISHED_ASKS, finalAnswerGate, proseIsFinalAnswer } from './completion-gates.js';
|
|
15
15
|
import { TestEditGuard, testEditNudge } from './test-edit-guard.js';
|
|
@@ -23,7 +23,7 @@ import { monotonicNow, elapsedMs } from './duration.js';
|
|
|
23
23
|
import { planToolDependencies, requiresToolBarrier } from './tool-dependencies.js';
|
|
24
24
|
import { realpath, stat } from 'node:fs/promises';
|
|
25
25
|
import { isAbsolute, relative, resolve } from 'node:path';
|
|
26
|
-
import { createRunTelemetry, recordEdit, recordTestCommand, recordToolFailure, recordToolUse } from './telemetry/capture.js';
|
|
26
|
+
import { createRunTelemetry, recordEdit, recordErrorOnce, recordTestCommand, recordToolFailure, recordToolUse } from './telemetry/capture.js';
|
|
27
27
|
import { isTestCommandLine } from './telemetry/classify.js';
|
|
28
28
|
import { callFileDiff, diffLineStats, fileDiffTarget, readFileSnapshot } from './tool-diff-stats.js';
|
|
29
29
|
import { TodoStore } from './todos.js';
|
|
@@ -47,7 +47,7 @@ const DEFAULT_AGENT_INSTRUCTIONS = `You are the Andorra Agent in Andorra Code's
|
|
|
47
47
|
Handle the user's task end to end, whether it is a coding task or a general one: implement code and verify changes with appropriate tools, and answer general research, writing and analysis directly from the available sources.`;
|
|
48
48
|
const IMPLEMENTATION_GUIDANCE = `Every model turn resends the whole conversation, so finish in the fewest turns that fully cover the task.
|
|
49
49
|
Compose new or fully rewritten files in a single Write; reserve Edit for surgical changes to long existing files. Tool results already show the applied change, so never re-read a file just to confirm your own Write or Edit.
|
|
50
|
-
Issue independent read-only calls together in one turn. Combine quick related shell checks into one labeled command, but give a search or scan that may be slow its own call: a timeout stops the whole command and loses the output of every check in it.
|
|
50
|
+
Issue independent read-only calls together in one turn. Send the edits for one change together in one turn as well: several Edit or Write calls, in different files or in the same file, run in the order you list them, and the command that checks them goes last in that same turn. Each call reports its own result, and a later call still runs when an earlier edit failed to match, so read every result before trusting the check. Combine quick related shell checks into one labeled command, but give a search or scan that may be slow its own call: a timeout stops the whole command and loses the output of every check in it.
|
|
51
51
|
Do mechanical or repetitive work by executing code (a shell one-liner or script), not through repeated model-driven edits.
|
|
52
52
|
Keep tool output proportionate: filter, count, select, or tail large files, logs and command output instead of feeding them whole into context. Finding something is the exception. When the task names a thing you have not located (a host, service, project, tool or file), look for it by file and directory name before anything else: list the working directory in full, without a first-N or last-N cap, and search names as well as contents, because a file can be named for a thing its text never mentions. A listing you cut short, or a search that timed out or was stopped, is not evidence that the thing is absent: rerun it narrower or in its own call before concluding so or asking the user.
|
|
53
53
|
Reuse unchanged evidence and known interfaces rather than rereading files. For runnable software, build the smallest integrated vertical slice first: entry point, initialization and one real interaction. Run a boot/syntax smoke check as soon as that slice exists, before broad subsystem inventories or polishing. Use observed failures to choose the next targeted inspection, and verify with the smallest check that can actually fail. Then complete every requested behavior and verification.
|
|
@@ -708,6 +708,11 @@ ${runtimeEnvironmentNote()}` + (options.systemPrompt ? `\nAgent instructions:\n$
|
|
|
708
708
|
let imageInputRejected = false;
|
|
709
709
|
let forceSequential = false;
|
|
710
710
|
let model = engineModel(options.model, options.provider, options.contextWindow);
|
|
711
|
+
// /compact sent during a run: the run was stopped and resumed with this flag, so its first turn summarizes
|
|
712
|
+
// every eligible earlier exchange (keeping the latest tool turns), whatever the context pressure.
|
|
713
|
+
let compactRequested = !options.subagentId && options.resumeMessages !== undefined && options.resumeState?.compactRequested === true;
|
|
714
|
+
// The same request made in-process (the terminal's /compact) stays pending on RunControl until the run's own agent takes it,
|
|
715
|
+
// so one made while the run was still starting is acted on at the first turn.
|
|
711
716
|
const recoverCompaction = async (error) => {
|
|
712
717
|
if (!(error instanceof CompactionRecoveryError))
|
|
713
718
|
return false;
|
|
@@ -810,6 +815,29 @@ ${runtimeEnvironmentNote()}` + (options.systemPrompt ? `\nAgent instructions:\n$
|
|
|
810
815
|
retireTodoUpdates(messages, (_call, owner, observation) => !inheritedMessages.has(owner) && !!observation && !observation.content.startsWith('Tool error:'));
|
|
811
816
|
closeAssistantTail();
|
|
812
817
|
const threshold = contextThreshold(model.contextWindow, model.maxTokens);
|
|
818
|
+
if (control && !options.subagentId && control.takeCompactionRequest())
|
|
819
|
+
compactRequested = true;
|
|
820
|
+
if (compactRequested) {
|
|
821
|
+
compactRequested = false;
|
|
822
|
+
const before = contextUsage.pressure(messages, toolContextChars, schemaKey);
|
|
823
|
+
try {
|
|
824
|
+
const requested = await historyCompactor.compact(messages, toolContextChars, limits.maxContextChars, { options, result, signal: operationSignal, invocationId }, { triggerChars: 0, targetChars: Math.max(1, limits.maxContextChars - pinnedContextChars(messages, toolContextChars)), protectDiscovery: false, keepRecentToolTurns: 2, retireAllEligible: true });
|
|
825
|
+
await emit('agent.context.compacted', { reason: 'requested', removedExchanges: requested.removed, contextChars: requested.chars, beforeTokens: before.tokens, afterTokens: contextUsage.pressure(messages, toolContextChars).tokens, tokenSource: before.source, threshold });
|
|
826
|
+
}
|
|
827
|
+
catch (error) {
|
|
828
|
+
signal.throwIfAborted();
|
|
829
|
+
if (operationSignal.aborted) {
|
|
830
|
+
// Paused (Ctrl+C) while the summary was being written: keep the request and redo this turn once the run resumes.
|
|
831
|
+
compactRequested = true;
|
|
832
|
+
iteration--;
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
if (!(error instanceof CompactionRecoveryError))
|
|
836
|
+
throw error;
|
|
837
|
+
// The user asked for it, but the run need not stop over it: carry on with the full history.
|
|
838
|
+
await emit('agent.context.compaction.deferred', { reason: error.reason, requested: true, contextChars: contextChars() });
|
|
839
|
+
}
|
|
840
|
+
}
|
|
813
841
|
let beforeCleanup = contextUsage.pressure(messages, toolContextChars, schemaKey);
|
|
814
842
|
const underPressure = () => beforeCleanup.tokens >= Math.floor(threshold * .9) || contextChars() > limits.maxContextChars;
|
|
815
843
|
if (supersededSnapshots.size && underPressure()) {
|
|
@@ -927,7 +955,7 @@ ${runtimeEnvironmentNote()}` + (options.systemPrompt ? `\nAgent instructions:\n$
|
|
|
927
955
|
const forced = !selectedStep && forceToolCall;
|
|
928
956
|
if (forced)
|
|
929
957
|
forceToolCall = false;
|
|
930
|
-
const stopSteerWatch = !selectedStep && control && options.getSteeringMessages
|
|
958
|
+
const stopSteerWatch = !selectedStep && control && (options.getSteeringMessages || !options.subagentId)
|
|
931
959
|
? control.onSteer(() => steerCut.abort(new Error('Interrupted to read a steering message.')), options.subagentId)
|
|
932
960
|
: () => { };
|
|
933
961
|
try {
|
|
@@ -936,7 +964,8 @@ ${runtimeEnvironmentNote()}` + (options.systemPrompt ? `\nAgent instructions:\n$
|
|
|
936
964
|
: await generateWithUsage(options, result, { model: options.model, messages: requestMessages, tools: advertisedTools, signal: AbortSignal.any([operationSignal, steerCut.signal]),
|
|
937
965
|
mutableTail, estimateInputTokens,
|
|
938
966
|
...(forced ? { toolChoice: 'required' } : {}),
|
|
939
|
-
|
|
967
|
+
// generateWithUsage records the retried error in the run's telemetry; the code stays out of the event.
|
|
968
|
+
onRetry: ({ unparsedReply: _unparsedReply, code: _code, ...retry }) => emit('agent.model.retry', { ...retry }),
|
|
940
969
|
context: { runId: result.id, nodeId: options.nodeId ?? 'engineer', providerId: options.provider, invocationId, ...(options.subagentId ? { subagentId: options.subagentId } : {}) } }));
|
|
941
970
|
}
|
|
942
971
|
catch (error) {
|
|
@@ -1777,6 +1806,10 @@ ${runtimeEnvironmentNote()}` + (options.systemPrompt ? `\nAgent instructions:\n$
|
|
|
1777
1806
|
if (error.contextOverflow)
|
|
1778
1807
|
result.providerOverflow = true;
|
|
1779
1808
|
}
|
|
1809
|
+
if (!cancelled && !deadline && !(error instanceof ClarificationRequiredError)) {
|
|
1810
|
+
// A model request's failure was recorded where it happened; this reuses that code rather than counting it again.
|
|
1811
|
+
result.failureCode = recordErrorOnce(result.telemetry, error, runFailureCode(error));
|
|
1812
|
+
}
|
|
1780
1813
|
result.status = cancelled ? 'cancelled' : deadline ? 'exhausted' : error instanceof ClarificationRequiredError ? 'needs_clarification' : 'infrastructure_error';
|
|
1781
1814
|
result.reason = cancelled ? 'cancelled' : deadline ? 'wallTimeMs' : error instanceof Error ? error.message : 'Runtime failure';
|
|
1782
1815
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export declare const REMOTE_PRIMARY_ENGINE = "remote-primary";
|
|
2
2
|
export declare const RELAY_CAPABILITY_REQUIREMENT = "remote.engine.relay.capability";
|
|
3
|
+
/** How the relay treats a method: whether a desktop may call it on a machine, and whether it changes something there (no deadline slack). */
|
|
4
|
+
export declare function relayMethodClass(method: string): {
|
|
5
|
+
relayed: boolean;
|
|
6
|
+
primary: boolean;
|
|
7
|
+
mutating: boolean;
|
|
8
|
+
};
|
|
3
9
|
export interface RelayError {
|
|
4
10
|
code: string;
|
|
5
11
|
message: string;
|
|
@@ -16,6 +22,42 @@ export interface RelayAnswer {
|
|
|
16
22
|
result?: unknown;
|
|
17
23
|
error?: RelayError;
|
|
18
24
|
}
|
|
25
|
+
export type RelayInstallEvent = {
|
|
26
|
+
version: string;
|
|
27
|
+
state: 'installing';
|
|
28
|
+
} | {
|
|
29
|
+
version: string;
|
|
30
|
+
state: 'ready';
|
|
31
|
+
} | {
|
|
32
|
+
version: string;
|
|
33
|
+
state: 'failed';
|
|
34
|
+
reason: string;
|
|
35
|
+
};
|
|
36
|
+
/** Engines of other versions than this host's: what starts them, and which versions have one running. */
|
|
37
|
+
export interface RelayEngines {
|
|
38
|
+
readonly hostVersion: string;
|
|
39
|
+
/**
|
|
40
|
+
* The command that starts an engine of that version (undefined: the host's own). It never waits on an install: it
|
|
41
|
+
* throws an error whose `code` is `busy` while the version installs, `remote` after an install failed and
|
|
42
|
+
* `invalid-params` for a version this machine cannot run.
|
|
43
|
+
*/
|
|
44
|
+
commandFor(version: string | undefined): Promise<string[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Starts installing a missing version when a connection of it opens: `underway` when an install of it had already
|
|
47
|
+
* started, `failed` while a failed install of it cools down.
|
|
48
|
+
*/
|
|
49
|
+
prepare?(version: string | undefined): Promise<'started' | 'underway' | 'none' | 'failed'>;
|
|
50
|
+
/** What a connection of that version is to be told at this moment: being installed, the failure it cools down from, or nothing. */
|
|
51
|
+
installState?(version: string): {
|
|
52
|
+
state: 'installing';
|
|
53
|
+
} | {
|
|
54
|
+
state: 'failed';
|
|
55
|
+
reason: string;
|
|
56
|
+
} | undefined;
|
|
57
|
+
watch?(listener: (event: RelayInstallEvent) => void): () => void;
|
|
58
|
+
inUse(version: string): void;
|
|
59
|
+
released(version: string): void;
|
|
60
|
+
}
|
|
19
61
|
type EventSink = (payload: {
|
|
20
62
|
engine: string;
|
|
21
63
|
event: string;
|
|
@@ -32,6 +74,7 @@ declare function isRemoteProjectSpelling(value: string): boolean;
|
|
|
32
74
|
declare function rootPartOf(value: string): string | undefined;
|
|
33
75
|
export declare class RemoteEngineRelay {
|
|
34
76
|
private readonly directory;
|
|
77
|
+
private readonly timing;
|
|
35
78
|
private readonly children;
|
|
36
79
|
private readonly retiringChildren;
|
|
37
80
|
private taskSeq;
|
|
@@ -41,24 +84,42 @@ export declare class RemoteEngineRelay {
|
|
|
41
84
|
private readonly runEngine;
|
|
42
85
|
private readonly sessionEngine;
|
|
43
86
|
private readonly activeRuns;
|
|
87
|
+
private readonly runStates;
|
|
44
88
|
private readonly finishedRuns;
|
|
45
89
|
private readonly translations;
|
|
46
|
-
private
|
|
90
|
+
private sinklessTimer;
|
|
47
91
|
private delivery;
|
|
48
92
|
private closed;
|
|
49
|
-
|
|
93
|
+
private startsInFlight;
|
|
94
|
+
private readonly engines;
|
|
95
|
+
private readonly stopWatching;
|
|
96
|
+
constructor(directory: string, timing?: {
|
|
97
|
+
sinklessTtlMs?: number;
|
|
98
|
+
sweepMs?: number;
|
|
99
|
+
wakeAnswerMs?: number;
|
|
100
|
+
now?: () => number;
|
|
101
|
+
}, options?: {
|
|
102
|
+
engines?: RelayEngines;
|
|
103
|
+
});
|
|
104
|
+
/** The engine version a connection's tasks run on: undefined for the host's own, and always without a store. */
|
|
105
|
+
private engineVersion;
|
|
106
|
+
private announceInstall;
|
|
107
|
+
private sendInstallEvent;
|
|
108
|
+
private prepareEngine;
|
|
50
109
|
request(deviceId: string, body: RelayRequestBody): Promise<RelayAnswer>;
|
|
51
110
|
private validate;
|
|
52
111
|
private childDeadline;
|
|
53
112
|
private dispatch;
|
|
54
113
|
private startRequest;
|
|
114
|
+
private reclaimIdleEngine;
|
|
115
|
+
private taskEngineCount;
|
|
55
116
|
private runTargetRequest;
|
|
56
117
|
private terminalRequest;
|
|
57
118
|
private translateParams;
|
|
58
119
|
private restoreRequestedEcho;
|
|
59
120
|
private connection;
|
|
60
121
|
private sever;
|
|
61
|
-
events(deviceId: string, connectionId: string, viewerWorkspaceId: string | undefined, sink: EventSink, cut: () => void): () => void;
|
|
122
|
+
events(deviceId: string, connectionId: string, viewerWorkspaceId: string | undefined, sink: EventSink, cut: () => void, version?: string): () => void;
|
|
62
123
|
private replayTo;
|
|
63
124
|
private enqueueTo;
|
|
64
125
|
private enqueue;
|
|
@@ -68,11 +129,34 @@ export declare class RemoteEngineRelay {
|
|
|
68
129
|
private engineOwnsRun;
|
|
69
130
|
private engine;
|
|
70
131
|
private spawnChild;
|
|
132
|
+
private refuseAtEngineCap;
|
|
133
|
+
private engineCommand;
|
|
134
|
+
private releaseEngine;
|
|
71
135
|
private childIsIdle;
|
|
136
|
+
private childRunsBackground;
|
|
72
137
|
private childHoldsWake;
|
|
73
138
|
private retireChild;
|
|
74
139
|
private translation;
|
|
75
|
-
private
|
|
140
|
+
private startSinklessSweep;
|
|
141
|
+
/** Runs doing work on this machine: a run waiting for the user's computer, an approval or an answer is not counted. */
|
|
142
|
+
activity(): {
|
|
143
|
+
running: number;
|
|
144
|
+
};
|
|
145
|
+
/** Task starts in flight plus runs on task engines, waiting ones included: what a host restart would interrupt. */
|
|
146
|
+
runningTasks(): number;
|
|
147
|
+
/**
|
|
148
|
+
* Work a host restart would lose that runningTasks() may not show: a terminal open on the primary engine, and in any engine
|
|
149
|
+
* a wake armed (it lives only in that engine's memory and starts a run when due), a run as the engine itself reports it
|
|
150
|
+
* (one it started from a wake, the primary's included, which no run.start announced), or a background process still running.
|
|
151
|
+
* An engine that does not answer counts as holding for UNANSWERING_ENGINE_HOLD_MS of silence, and no longer.
|
|
152
|
+
*/
|
|
153
|
+
holdsWork(): Promise<boolean>;
|
|
154
|
+
private childHoldsWork;
|
|
155
|
+
/** The engine version the desktop that opened this connection runs, or undefined when it said none or the connection is gone. */
|
|
156
|
+
connectionVersion(connectionId: string): string | undefined;
|
|
157
|
+
disconnect(deviceId: string, connectionId?: string): void;
|
|
76
158
|
close(): Promise<void>;
|
|
77
159
|
}
|
|
160
|
+
/** How long an engine that keeps failing to say what wakes it holds is taken to hold one. */
|
|
161
|
+
export declare const UNANSWERING_ENGINE_HOLD_MS = 120000;
|
|
78
162
|
export { REMOTE_PROJECT_PREFIX, isRemoteProjectSpelling, rootPartOf };
|