@orion-agents/orion-code 0.2.2 → 0.3.1
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/CHANGELOG.md +82 -0
- package/README.md +89 -14
- package/README.zh-CN.md +77 -14
- package/bin/orion +15 -4
- package/dist/cli.js +51 -172
- package/dist/cli.js.map +1 -1
- package/dist/commands/model-command-handlers.d.ts +2 -2
- package/dist/commands/model-command-handlers.d.ts.map +1 -1
- package/dist/commands/model-command-handlers.js +113 -32
- package/dist/commands/model-command-handlers.js.map +1 -1
- package/dist/commands/session-command-handlers.d.ts.map +1 -1
- package/dist/commands/session-command-handlers.js +106 -15
- package/dist/commands/session-command-handlers.js.map +1 -1
- package/dist/commands/types.d.ts +13 -3
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +1 -1
- package/dist/commands/types.js.map +1 -1
- package/dist/core/tool-artifacts.d.ts +2 -0
- package/dist/core/tool-artifacts.d.ts.map +1 -1
- package/dist/core/tool-artifacts.js +27 -1
- package/dist/core/tool-artifacts.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime/agent-loop.d.ts.map +1 -1
- package/dist/runtime/agent-loop.js +3 -3
- package/dist/runtime/agent-loop.js.map +1 -1
- package/dist/runtime/agent-runtime-controller.d.ts +32 -1
- package/dist/runtime/agent-runtime-controller.d.ts.map +1 -1
- package/dist/runtime/agent-runtime-controller.js +241 -27
- package/dist/runtime/agent-runtime-controller.js.map +1 -1
- package/dist/runtime/agent-runtime-protocol.d.ts +4 -0
- package/dist/runtime/agent-runtime-protocol.d.ts.map +1 -1
- package/dist/runtime/agent-runtime-protocol.js.map +1 -1
- package/dist/runtime/agent-runtime-runner.d.ts +2 -1
- package/dist/runtime/agent-runtime-runner.d.ts.map +1 -1
- package/dist/runtime/durable-tool-receipt-reader.d.ts +32 -0
- package/dist/runtime/durable-tool-receipt-reader.d.ts.map +1 -0
- package/dist/runtime/durable-tool-receipt-reader.js +130 -0
- package/dist/runtime/durable-tool-receipt-reader.js.map +1 -0
- package/dist/runtime/legacy-thread-materializer.d.ts +31 -0
- package/dist/runtime/legacy-thread-materializer.d.ts.map +1 -1
- package/dist/runtime/legacy-thread-materializer.js +71 -17
- package/dist/runtime/legacy-thread-materializer.js.map +1 -1
- package/dist/runtime/orion-runtime-v1.d.ts +2 -0
- package/dist/runtime/orion-runtime-v1.d.ts.map +1 -1
- package/dist/runtime/orion-runtime-v1.js +7 -1
- package/dist/runtime/orion-runtime-v1.js.map +1 -1
- package/dist/runtime/orion-session-runner.d.ts +7 -2
- package/dist/runtime/orion-session-runner.d.ts.map +1 -1
- package/dist/runtime/orion-session-runner.js +16 -6
- package/dist/runtime/orion-session-runner.js.map +1 -1
- package/dist/runtime/product-bootstrap.d.ts +22 -0
- package/dist/runtime/product-bootstrap.d.ts.map +1 -0
- package/dist/runtime/product-bootstrap.js +374 -0
- package/dist/runtime/product-bootstrap.js.map +1 -0
- package/dist/runtime/product-orion-runtime.d.ts +2 -1
- package/dist/runtime/product-orion-runtime.d.ts.map +1 -1
- package/dist/runtime/product-orion-runtime.js +83 -13
- package/dist/runtime/product-orion-runtime.js.map +1 -1
- package/dist/runtime/protocol/runtime-protocol-v1.d.ts +1 -1
- package/dist/runtime/protocol/runtime-protocol-v1.js +1 -1
- package/dist/runtime/protocol/runtime-protocol-v1.js.map +1 -1
- package/dist/runtime/release-receipts.d.ts +66 -3
- package/dist/runtime/release-receipts.d.ts.map +1 -1
- package/dist/runtime/release-receipts.js +340 -7
- package/dist/runtime/release-receipts.js.map +1 -1
- package/dist/runtime/step-snapshot.d.ts.map +1 -1
- package/dist/runtime/step-snapshot.js +22 -2
- package/dist/runtime/step-snapshot.js.map +1 -1
- package/dist/runtime/subagents/runtime-integration.d.ts +1 -1
- package/dist/runtime/subagents/runtime-integration.d.ts.map +1 -1
- package/dist/runtime/subagents/runtime-integration.js +5 -2
- package/dist/runtime/subagents/runtime-integration.js.map +1 -1
- package/dist/runtime/thread-event-store.d.ts +80 -0
- package/dist/runtime/thread-event-store.d.ts.map +1 -1
- package/dist/runtime/thread-event-store.js +456 -22
- package/dist/runtime/thread-event-store.js.map +1 -1
- package/dist/runtime/thread-projection.d.ts +10 -0
- package/dist/runtime/thread-projection.d.ts.map +1 -1
- package/dist/runtime/thread-projection.js +40 -0
- package/dist/runtime/thread-projection.js.map +1 -1
- package/dist/runtime/thread-runtime.d.ts +3 -1
- package/dist/runtime/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/thread-runtime.js +6 -0
- package/dist/runtime/thread-runtime.js.map +1 -1
- package/dist/runtime/thread-session-index.d.ts +84 -0
- package/dist/runtime/thread-session-index.d.ts.map +1 -0
- package/dist/runtime/thread-session-index.js +503 -0
- package/dist/runtime/thread-session-index.js.map +1 -0
- package/dist/runtime/thread-session-view.d.ts +70 -9
- package/dist/runtime/thread-session-view.d.ts.map +1 -1
- package/dist/runtime/thread-session-view.js +200 -82
- package/dist/runtime/thread-session-view.js.map +1 -1
- package/dist/runtime/thread-ui-adapter.d.ts +2 -0
- package/dist/runtime/thread-ui-adapter.d.ts.map +1 -1
- package/dist/runtime/thread-ui-adapter.js +86 -4
- package/dist/runtime/thread-ui-adapter.js.map +1 -1
- package/dist/runtime/tool-detail-repository.d.ts.map +1 -1
- package/dist/runtime/tool-detail-repository.js +23 -19
- package/dist/runtime/tool-detail-repository.js.map +1 -1
- package/dist/runtime/tool-receipt-validator.d.ts +21 -0
- package/dist/runtime/tool-receipt-validator.d.ts.map +1 -0
- package/dist/runtime/tool-receipt-validator.js +157 -0
- package/dist/runtime/tool-receipt-validator.js.map +1 -0
- package/dist/runtime/ui-events.d.ts +35 -0
- package/dist/runtime/ui-events.d.ts.map +1 -1
- package/dist/runtime/ui-events.js +1 -0
- package/dist/runtime/ui-events.js.map +1 -1
- package/dist/runtime/ui-view-model.d.ts +2 -0
- package/dist/runtime/ui-view-model.d.ts.map +1 -1
- package/dist/runtime/ui-view-model.js +7 -3
- package/dist/runtime/ui-view-model.js.map +1 -1
- package/dist/services/global-config.d.ts +25 -0
- package/dist/services/global-config.d.ts.map +1 -1
- package/dist/services/global-config.js +373 -5
- package/dist/services/global-config.js.map +1 -1
- package/dist/services/redaction.d.ts +4 -0
- package/dist/services/redaction.d.ts.map +1 -1
- package/dist/services/redaction.js +63 -0
- package/dist/services/redaction.js.map +1 -1
- package/dist/services/session-index.d.ts +16 -0
- package/dist/services/session-index.d.ts.map +1 -1
- package/dist/services/session-index.js +45 -36
- package/dist/services/session-index.js.map +1 -1
- package/dist/services/session-storage.d.ts +59 -0
- package/dist/services/session-storage.d.ts.map +1 -1
- package/dist/services/session-storage.js +306 -107
- package/dist/services/session-storage.js.map +1 -1
- package/dist/services/settings-coordinator.d.ts +174 -0
- package/dist/services/settings-coordinator.d.ts.map +1 -0
- package/dist/services/settings-coordinator.js +605 -0
- package/dist/services/settings-coordinator.js.map +1 -0
- package/dist/services/settings-document-repository.d.ts +138 -0
- package/dist/services/settings-document-repository.d.ts.map +1 -0
- package/dist/services/settings-document-repository.js +551 -0
- package/dist/services/settings-document-repository.js.map +1 -0
- package/dist/services/workspace-registry.d.ts +42 -0
- package/dist/services/workspace-registry.d.ts.map +1 -0
- package/dist/services/workspace-registry.js +222 -0
- package/dist/services/workspace-registry.js.map +1 -0
- package/dist/terminal-ui/launch.d.ts.map +1 -1
- package/dist/terminal-ui/launch.js +5 -0
- package/dist/terminal-ui/launch.js.map +1 -1
- package/dist/tui-ui/state.d.ts.map +1 -1
- package/dist/tui-ui/state.js +5 -0
- package/dist/tui-ui/state.js.map +1 -1
- package/dist/web/errors.d.ts +6 -0
- package/dist/web/errors.d.ts.map +1 -0
- package/dist/web/errors.js +13 -0
- package/dist/web/errors.js.map +1 -0
- package/dist/web/event-hub.d.ts +43 -0
- package/dist/web/event-hub.d.ts.map +1 -0
- package/dist/web/event-hub.js +323 -0
- package/dist/web/event-hub.js.map +1 -0
- package/dist/web/file-read-service.d.ts +55 -0
- package/dist/web/file-read-service.d.ts.map +1 -0
- package/dist/web/file-read-service.js +399 -0
- package/dist/web/file-read-service.js.map +1 -0
- package/dist/web/git-read-model-service.d.ts +77 -0
- package/dist/web/git-read-model-service.d.ts.map +1 -0
- package/dist/web/git-read-model-service.js +631 -0
- package/dist/web/git-read-model-service.js.map +1 -0
- package/dist/web/index.d.ts +6 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +28 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/launch.d.ts +9 -0
- package/dist/web/launch.d.ts.map +1 -0
- package/dist/web/launch.js +64 -0
- package/dist/web/launch.js.map +1 -0
- package/dist/web/protocol.d.ts +408 -0
- package/dist/web/protocol.d.ts.map +1 -0
- package/dist/web/protocol.js +369 -0
- package/dist/web/protocol.js.map +1 -0
- package/dist/web/review-service.d.ts +38 -0
- package/dist/web/review-service.d.ts.map +1 -0
- package/dist/web/review-service.js +74 -0
- package/dist/web/review-service.js.map +1 -0
- package/dist/web/server.d.ts +20 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +744 -0
- package/dist/web/server.js.map +1 -0
- package/dist/web/terminal-manager.d.ts +155 -0
- package/dist/web/terminal-manager.d.ts.map +1 -0
- package/dist/web/terminal-manager.js +728 -0
- package/dist/web/terminal-manager.js.map +1 -0
- package/dist/web/terminal-server.d.ts +8 -0
- package/dist/web/terminal-server.d.ts.map +1 -0
- package/dist/web/terminal-server.js +275 -0
- package/dist/web/terminal-server.js.map +1 -0
- package/dist/web/workbench-controller.d.ts +99 -0
- package/dist/web/workbench-controller.d.ts.map +1 -0
- package/dist/web/workbench-controller.js +1267 -0
- package/dist/web/workbench-controller.js.map +1 -0
- package/dist/web-client/assets/DiffViewer-DpKoD07C.js +5 -0
- package/dist/web-client/assets/FilesPanel-BkoLmgjR.js +2 -0
- package/dist/web-client/assets/GitPanel-D20StcdG.js +1 -0
- package/dist/web-client/assets/ReviewPanel-3MVWbMQV.js +1 -0
- package/dist/web-client/assets/TerminalPanel-BLQ592Fb.js +21 -0
- package/dist/web-client/assets/TerminalPanel-DLuoa74B.css +1 -0
- package/dist/web-client/assets/index-BkIDl_xk.js +16 -0
- package/dist/web-client/assets/index-DXMpnWE8.css +1 -0
- package/dist/web-client/index.html +16 -0
- package/docs/architecture/v0.3.0-web-api.yaml +1340 -0
- package/docs/architecture/v0.3.1-web-api.yaml +2290 -0
- package/docs/migration/v0.2.2-to-v0.3.0-settings.md +114 -0
- package/docs/migration/v0.2.2-to-v0.3.0.md +55 -0
- package/docs/migration/v0.3.0-to-v0.3.1.md +88 -0
- package/docs/orion.example.json +9 -2
- package/docs/plan/v0.3.0-node-runtime-compatibility-plan.md +57 -0
- package/docs/plan/v0.3.0-settings-integration-plan.md +740 -0
- package/docs/plan/v0.3.0-web-workbench-plan.md +376 -0
- package/docs/plan/v0.3.1-web-workbench-professional-shell-plan.md +848 -0
- package/docs/readme.md +22 -1
- package/docs/test/v0.3.1-web-workbench-e2e-plan.md +140 -0
- package/npm-shrinkwrap.json +1229 -45
- package/package.json +47 -11
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createProductUiRuntime = createProductUiRuntime;
|
|
4
|
+
const prompt_context_1 = require("../memory/prompt-context");
|
|
5
|
+
const store_1 = require("../framework/store");
|
|
6
|
+
const compact_1 = require("../services/compact");
|
|
7
|
+
const config_1 = require("../services/config");
|
|
8
|
+
const config_dir_1 = require("../services/config-dir");
|
|
9
|
+
const global_config_1 = require("../services/global-config");
|
|
10
|
+
const llm_1 = require("../services/llm");
|
|
11
|
+
const effort_1 = require("../services/effort");
|
|
12
|
+
const model_context_1 = require("../services/model-context");
|
|
13
|
+
const model_registry_1 = require("../services/model-registry");
|
|
14
|
+
const project_instructions_1 = require("../services/project-instructions");
|
|
15
|
+
const provider_resilience_1 = require("../services/provider-resilience");
|
|
16
|
+
const settings_coordinator_1 = require("../services/settings-coordinator");
|
|
17
|
+
const session_storage_1 = require("../services/session-storage");
|
|
18
|
+
const usage_state_1 = require("../services/usage-state");
|
|
19
|
+
const version_1 = require("../product/version");
|
|
20
|
+
const first_party_tool_universe_1 = require("./first-party-tool-universe");
|
|
21
|
+
const mcp_1 = require("./mcp");
|
|
22
|
+
const model_coordinator_1 = require("./model-coordinator");
|
|
23
|
+
const orion_session_runner_1 = require("./orion-session-runner");
|
|
24
|
+
const product_orion_runtime_1 = require("./product-orion-runtime");
|
|
25
|
+
const skills_1 = require("./skills");
|
|
26
|
+
/**
|
|
27
|
+
* Shared product composition root for TUI, terminal, print and Web surfaces.
|
|
28
|
+
*
|
|
29
|
+
* Renderers receive the same Store, session runner, OrionRuntime and permission
|
|
30
|
+
* bridge. Presentation layers must not construct an alternate agent loop.
|
|
31
|
+
*/
|
|
32
|
+
async function createProductUiRuntime(options) {
|
|
33
|
+
(0, config_dir_1.ensureConfigDir)();
|
|
34
|
+
(0, global_config_1.recordFirstStartTime)();
|
|
35
|
+
const cwd = options.cwd;
|
|
36
|
+
const config = (0, config_1.loadConfig)(options.uiRenderer ? { ui: { renderer: options.uiRenderer } } : {});
|
|
37
|
+
const memoryContent = (0, prompt_context_1.buildMemoryPromptContext)('', cwd).content;
|
|
38
|
+
const projectInstructionsContent = (0, project_instructions_1.loadProjectInstructions)(cwd);
|
|
39
|
+
const firstPartyTools = (0, first_party_tool_universe_1.createProductionFirstPartyToolUniverseV1)({
|
|
40
|
+
context: { cwd, config: { name: config.name, mode: config.mode } },
|
|
41
|
+
});
|
|
42
|
+
const toolCatalog = firstPartyTools.catalog;
|
|
43
|
+
const skillProvider = (0, skills_1.createProductionFilesystemSkillProviderV1)({
|
|
44
|
+
cwd,
|
|
45
|
+
configuredPaths: config.skills?.paths,
|
|
46
|
+
});
|
|
47
|
+
const mcpAdapter = (0, mcp_1.createFirstPartyMcpAdapterV1)({
|
|
48
|
+
config: (0, mcp_1.loadFirstPartyMcpConfigurationV1)(),
|
|
49
|
+
baseDirectory: cwd,
|
|
50
|
+
});
|
|
51
|
+
const profileFor = (selector) => config.modelRegistry ? ((0, model_registry_1.lookupProfile)(config.modelRegistry, selector) ?? undefined) : undefined;
|
|
52
|
+
// `config.model` is already resolved through the explicit durable
|
|
53
|
+
// `defaultModel`. Keep the product default separate so unset agrees with
|
|
54
|
+
// loadConfig() on the next Host bootstrap.
|
|
55
|
+
const internalDefaultModelSelector = 'gpt-4o';
|
|
56
|
+
const initialProfile = profileFor(config.model) ?? config.modelRegistry?.defaultProfile ?? undefined;
|
|
57
|
+
let defaultModelSelector = config.modelRegistry?.defaultProfile?.id ?? config.model;
|
|
58
|
+
const resolveRuntimeEffort = (session) => (0, effort_1.resolveProfileEffort)(profileFor(session?.model ?? defaultModelSelector) ?? initialProfile, {
|
|
59
|
+
session: session?.effortPreference,
|
|
60
|
+
project: (0, global_config_1.getProjectConfig)(cwd).defaultEffort,
|
|
61
|
+
global: (0, global_config_1.loadGlobalConfig)().defaultEffort ?? config.defaultEffort,
|
|
62
|
+
});
|
|
63
|
+
const initialEffort = resolveRuntimeEffort();
|
|
64
|
+
const store = new store_1.Store({
|
|
65
|
+
config,
|
|
66
|
+
tools: toolCatalog.entries.map(entry => entry.tool),
|
|
67
|
+
currentModel: config.model,
|
|
68
|
+
effortPreference: initialEffort.requested,
|
|
69
|
+
resolvedEffort: initialEffort,
|
|
70
|
+
memoryContent,
|
|
71
|
+
skillsContent: '',
|
|
72
|
+
projectInstructionsContent,
|
|
73
|
+
});
|
|
74
|
+
let llm = null;
|
|
75
|
+
let modelCoordinator;
|
|
76
|
+
const configured = config.modelRegistry
|
|
77
|
+
? config.modelRegistry.defaultProfile !== null
|
|
78
|
+
: (0, config_1.isConfigured)(config);
|
|
79
|
+
if (configured) {
|
|
80
|
+
const defaultProvider = initialProfile
|
|
81
|
+
? config.modelRegistry?.providers.get(initialProfile.provider)
|
|
82
|
+
: null;
|
|
83
|
+
llm = new llm_1.LLMService({
|
|
84
|
+
apiKey: defaultProvider
|
|
85
|
+
? defaultProvider.apiKey.startsWith('$')
|
|
86
|
+
? (process.env[defaultProvider.apiKey.slice(1)] ?? '')
|
|
87
|
+
: defaultProvider.apiKey
|
|
88
|
+
: config.apiKey,
|
|
89
|
+
baseUrl: defaultProvider?.baseUrl ?? config.apiBaseUrl,
|
|
90
|
+
model: initialProfile?.model ?? config.model,
|
|
91
|
+
fallbackModel: config.modelRegistry?.fallbackProfile?.model ?? config.fallbackModel,
|
|
92
|
+
providerProtocol: defaultProvider?.protocol,
|
|
93
|
+
reasoningCapability: initialProfile?.reasoningCapability,
|
|
94
|
+
fallbackReasoningCapability: config.modelRegistry?.fallbackProfile?.reasoningCapability,
|
|
95
|
+
effortPreference: initialEffort.requested,
|
|
96
|
+
});
|
|
97
|
+
llm.resilience = new provider_resilience_1.ProviderResilienceCoordinator();
|
|
98
|
+
modelCoordinator = new model_coordinator_1.ModelCoordinator();
|
|
99
|
+
if (config.modelRegistry && config.modelClientPool) {
|
|
100
|
+
modelCoordinator.bind(config.modelRegistry, config.modelClientPool);
|
|
101
|
+
modelCoordinator.initModel(initialProfile?.id ?? config.model);
|
|
102
|
+
}
|
|
103
|
+
if (config.apiBaseUrl) {
|
|
104
|
+
(0, model_context_1.discoverModelContexts)(config.apiBaseUrl, config.apiKey).catch(() => undefined);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const compactCoordinator = new compact_1.CompactCoordinator({
|
|
108
|
+
modelId: llm?.getModel() ?? config.model,
|
|
109
|
+
llm,
|
|
110
|
+
outputReserveTokens: llm?.getMaxTokens?.(),
|
|
111
|
+
compactInstructions: (0, global_config_1.getProjectConfig)(cwd).compactInstructions,
|
|
112
|
+
getContextCapsule: () => store.getSnapshot().harnessState?.capsule,
|
|
113
|
+
getHarnessState: () => store.getSnapshot().harnessState,
|
|
114
|
+
});
|
|
115
|
+
let currentSession = null;
|
|
116
|
+
let sessionRunner;
|
|
117
|
+
let settingsRuntimeIdleProbe = () => true;
|
|
118
|
+
let shuttingDown = false;
|
|
119
|
+
const applySessionState = (session, resolvedEffortOverride) => {
|
|
120
|
+
const selector = session?.model ?? defaultModelSelector;
|
|
121
|
+
const profile = profileFor(selector);
|
|
122
|
+
const provider = profile ? config.modelRegistry?.providers.get(profile.provider) : undefined;
|
|
123
|
+
const effort = resolvedEffortOverride ?? resolveRuntimeEffort(session);
|
|
124
|
+
if (profile) {
|
|
125
|
+
modelCoordinator?.initModel(profile.id);
|
|
126
|
+
if (provider && config.modelClientPool) {
|
|
127
|
+
llm?.setProviderClient(config.modelClientPool.getClient(provider));
|
|
128
|
+
}
|
|
129
|
+
llm?.setModel(profile.model);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
llm?.setModel(selector);
|
|
133
|
+
}
|
|
134
|
+
if (provider) {
|
|
135
|
+
llm?.setEffortContext({
|
|
136
|
+
preference: effort.requested,
|
|
137
|
+
protocol: provider.protocol,
|
|
138
|
+
capability: profile?.reasoningCapability,
|
|
139
|
+
fallbackCapability: config.modelRegistry?.fallbackProfile?.reasoningCapability,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
store.setState({ currentModel: profile?.id ?? selector });
|
|
143
|
+
store.setEffort(effort.requested, effort);
|
|
144
|
+
compactCoordinator.configure({
|
|
145
|
+
modelId: profile?.model ?? selector,
|
|
146
|
+
llm,
|
|
147
|
+
outputReserveTokens: llm?.getMaxTokens?.(),
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
const setSession = (session) => {
|
|
151
|
+
applySessionState(session);
|
|
152
|
+
currentSession = session;
|
|
153
|
+
};
|
|
154
|
+
const currentSessionSettings = () => {
|
|
155
|
+
if (!currentSession)
|
|
156
|
+
return undefined;
|
|
157
|
+
return {
|
|
158
|
+
model: currentSession.model,
|
|
159
|
+
effort: resolveRuntimeEffort(currentSession).requested,
|
|
160
|
+
overridesProjectEffort: currentSession.effortPreference !== undefined,
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
const ensureSession = () => {
|
|
164
|
+
if (!currentSession) {
|
|
165
|
+
defaultModelSelector =
|
|
166
|
+
settingsCoordinator?.describe().sections.defaults.model.effectiveValue ??
|
|
167
|
+
defaultModelSelector;
|
|
168
|
+
const created = (0, session_storage_1.createSession)(cwd, defaultModelSelector);
|
|
169
|
+
(0, global_config_1.incrementSessionCount)();
|
|
170
|
+
setSession(created);
|
|
171
|
+
return created;
|
|
172
|
+
}
|
|
173
|
+
return currentSession;
|
|
174
|
+
};
|
|
175
|
+
const getSession = () => currentSession;
|
|
176
|
+
const prepareSettingsRuntime = (context) => {
|
|
177
|
+
const defaultModelOperation = context.operations.find(operation => operation.key === 'defaults.model');
|
|
178
|
+
const candidateDefaultModelSelector = defaultModelOperation?.op === 'set'
|
|
179
|
+
? defaultModelOperation.value
|
|
180
|
+
: defaultModelOperation?.op === 'unset'
|
|
181
|
+
? internalDefaultModelSelector
|
|
182
|
+
: defaultModelSelector;
|
|
183
|
+
const effortModelSelector = currentSession?.model ?? candidateDefaultModelSelector;
|
|
184
|
+
for (const operation of context.operations) {
|
|
185
|
+
if (operation.key === 'defaults.model') {
|
|
186
|
+
const candidate = operation.op === 'set' ? operation.value : internalDefaultModelSelector;
|
|
187
|
+
const configured = config.modelRegistry?.enabledProfiles.some(profile => profile.id === candidate);
|
|
188
|
+
if (config.modelRegistry && !configured) {
|
|
189
|
+
throw new Error(`Model ${candidate} is not enabled in the configured registry.`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if ((operation.key === 'defaults.effort' || operation.key === 'defaults.globalEffort') &&
|
|
193
|
+
operation.op === 'set' &&
|
|
194
|
+
operation.value !== 'auto') {
|
|
195
|
+
const profile = profileFor(effortModelSelector);
|
|
196
|
+
const resolved = (0, effort_1.resolveProfileEffort)(profile, { request: operation.value });
|
|
197
|
+
if (!resolved.supported) {
|
|
198
|
+
throw new Error(`Effort ${operation.value} is unavailable for ${profile?.id ?? 'the active model'}.`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
const applySettingsRuntime = async (context) => {
|
|
204
|
+
const previousDefaultModel = defaultModelSelector;
|
|
205
|
+
const previousConfigModel = config.model;
|
|
206
|
+
const previousGlobalEffort = config.defaultEffort;
|
|
207
|
+
const previousToolConfirmation = config.toolConfirmation;
|
|
208
|
+
const changesDefaultModel = context.operations.some(operation => operation.key === 'defaults.model');
|
|
209
|
+
const changesEffort = context.operations.some(operation => operation.key === 'defaults.effort' || operation.key === 'defaults.globalEffort');
|
|
210
|
+
const changesToolConfirmation = context.operations.some(operation => operation.key === 'permissions.toolConfirmation');
|
|
211
|
+
try {
|
|
212
|
+
if (changesDefaultModel) {
|
|
213
|
+
defaultModelSelector = context.document.sections.defaults.model.effectiveValue;
|
|
214
|
+
config.model = defaultModelSelector;
|
|
215
|
+
}
|
|
216
|
+
const globalEffortOperation = context.operations.find(operation => operation.key === 'defaults.globalEffort');
|
|
217
|
+
if (globalEffortOperation) {
|
|
218
|
+
config.defaultEffort =
|
|
219
|
+
globalEffortOperation.op === 'set' ? globalEffortOperation.value : undefined;
|
|
220
|
+
}
|
|
221
|
+
if (changesToolConfirmation) {
|
|
222
|
+
config.toolConfirmation =
|
|
223
|
+
context.document.sections.permissions.toolConfirmation.effectiveValue;
|
|
224
|
+
}
|
|
225
|
+
if (changesDefaultModel || changesEffort)
|
|
226
|
+
applySessionState(currentSession);
|
|
227
|
+
if (changesToolConfirmation && sessionRunner && currentSession) {
|
|
228
|
+
await sessionRunner.restoreSession();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
const previousEffortField = context.before.sections.defaults.effort;
|
|
233
|
+
const previousResolvedEffort = (0, effort_1.resolveProfileEffort)(profileFor(currentSession?.model ?? previousDefaultModel) ?? initialProfile, {
|
|
234
|
+
session: currentSession?.effortPreference,
|
|
235
|
+
...(previousEffortField.source === 'project'
|
|
236
|
+
? { project: previousEffortField.effectiveValue }
|
|
237
|
+
: previousEffortField.source === 'global'
|
|
238
|
+
? { global: previousEffortField.effectiveValue }
|
|
239
|
+
: {}),
|
|
240
|
+
});
|
|
241
|
+
defaultModelSelector = previousDefaultModel;
|
|
242
|
+
config.model = previousConfigModel;
|
|
243
|
+
config.defaultEffort = previousGlobalEffort;
|
|
244
|
+
config.toolConfirmation = previousToolConfirmation;
|
|
245
|
+
// Coordinator rolls durable bytes back only after this callback rejects.
|
|
246
|
+
// Restore the live effort from the pre-write view instead of rereading
|
|
247
|
+
// the still-new project/global bytes during this catch path.
|
|
248
|
+
applySessionState(currentSession, previousResolvedEffort);
|
|
249
|
+
if (changesToolConfirmation && sessionRunner && currentSession) {
|
|
250
|
+
await sessionRunner.restoreSession().catch(() => undefined);
|
|
251
|
+
}
|
|
252
|
+
throw error;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
const settingsCoordinator = settings_coordinator_1.SettingsCoordinatorV1.create({
|
|
256
|
+
workspace: cwd,
|
|
257
|
+
onInvalidated: options.onSettingsInvalidated,
|
|
258
|
+
models: config.modelRegistry?.enabledProfiles.map(profile => ({
|
|
259
|
+
id: profile.id,
|
|
260
|
+
label: profile.displayName ?? profile.id,
|
|
261
|
+
provider: profile.provider,
|
|
262
|
+
})),
|
|
263
|
+
internalDefaultModel: internalDefaultModelSelector,
|
|
264
|
+
modelDefaultEffort: 'auto',
|
|
265
|
+
internalToolConfirmation: 'allow',
|
|
266
|
+
runtimeIdle: () => settingsRuntimeIdleProbe(),
|
|
267
|
+
runtimePrepare: prepareSettingsRuntime,
|
|
268
|
+
runtimeApply: applySettingsRuntime,
|
|
269
|
+
});
|
|
270
|
+
defaultModelSelector = settingsCoordinator.describe().sections.defaults.model.effectiveValue;
|
|
271
|
+
const describeSettings = () => settingsCoordinator.describe({
|
|
272
|
+
currentSession: currentSessionSettings(),
|
|
273
|
+
runtime: { busy: !settingsRuntimeIdleProbe() },
|
|
274
|
+
});
|
|
275
|
+
const updateSettings = input => settingsCoordinator.update({
|
|
276
|
+
...input,
|
|
277
|
+
currentSession: currentSessionSettings(),
|
|
278
|
+
runtime: { busy: !settingsRuntimeIdleProbe() },
|
|
279
|
+
});
|
|
280
|
+
const synchronizeSettings = () => settingsCoordinator.synchronizeExternalChanges({
|
|
281
|
+
currentSession: currentSessionSettings(),
|
|
282
|
+
runtime: { busy: !settingsRuntimeIdleProbe() },
|
|
283
|
+
});
|
|
284
|
+
const bindSettingsRuntimeIdleProbe = probe => {
|
|
285
|
+
settingsRuntimeIdleProbe = probe;
|
|
286
|
+
return () => {
|
|
287
|
+
if (settingsRuntimeIdleProbe === probe)
|
|
288
|
+
settingsRuntimeIdleProbe = () => true;
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
const costTracker = store.getSnapshot().costTracker;
|
|
292
|
+
costTracker.setRecordSink(record => {
|
|
293
|
+
(0, usage_state_1.appendUsageRecord)(record, { sessionId: currentSession?.id, projectPath: cwd });
|
|
294
|
+
});
|
|
295
|
+
const unsubscribeLlmUsage = llm?.subscribeUsage(event => {
|
|
296
|
+
costTracker.record(event.usage, { model: event.model, requestKind: event.operation });
|
|
297
|
+
});
|
|
298
|
+
const shutdown = async () => {
|
|
299
|
+
if (shuttingDown)
|
|
300
|
+
return;
|
|
301
|
+
shuttingDown = true;
|
|
302
|
+
settingsCoordinator?.close();
|
|
303
|
+
await sessionRunner?.close(options.shutdownReason ?? 'Orion product runtime shutdown');
|
|
304
|
+
if (currentSession) {
|
|
305
|
+
const messages = (0, session_storage_1.readSessionMessages)(currentSession.id);
|
|
306
|
+
if (messages.length > 0)
|
|
307
|
+
(0, session_storage_1.updateSessionSummary)(currentSession.id, messages);
|
|
308
|
+
(0, session_storage_1.endSession)(currentSession.id);
|
|
309
|
+
}
|
|
310
|
+
unsubscribeLlmUsage?.();
|
|
311
|
+
};
|
|
312
|
+
const createAgentRunner = llm
|
|
313
|
+
? (events, runnerOptions) => {
|
|
314
|
+
if (sessionRunner)
|
|
315
|
+
return sessionRunner;
|
|
316
|
+
sessionRunner = new orion_session_runner_1.OrionSessionRunnerV1({
|
|
317
|
+
eventSink: events,
|
|
318
|
+
getSessionId: () => ensureSession().id,
|
|
319
|
+
createRuntime: (sessionId, activation) => (0, product_orion_runtime_1.createProductOrionRuntimeV1)({
|
|
320
|
+
cwd,
|
|
321
|
+
config,
|
|
322
|
+
store,
|
|
323
|
+
llm: llm,
|
|
324
|
+
compactCoordinator,
|
|
325
|
+
toolCatalog,
|
|
326
|
+
skillProviders: [skillProvider],
|
|
327
|
+
mcpDescriptors: mcpAdapter.descriptors,
|
|
328
|
+
mcpConnector: mcpAdapter.connector,
|
|
329
|
+
approvalHandler: runnerOptions.approvalHandler,
|
|
330
|
+
}, sessionId, activation),
|
|
331
|
+
mode: () => {
|
|
332
|
+
const mode = store.getSnapshot().agentMode;
|
|
333
|
+
return mode === 'plan' ? 'plan' : mode === 'auto' ? 'auto' : 'build';
|
|
334
|
+
},
|
|
335
|
+
onActiveRuntime: options.onActiveSessionRuntime,
|
|
336
|
+
replayHistoryOnRestore: runnerOptions.replayHistoryOnRestore,
|
|
337
|
+
});
|
|
338
|
+
return sessionRunner;
|
|
339
|
+
}
|
|
340
|
+
: undefined;
|
|
341
|
+
const inspectSkills = async () => {
|
|
342
|
+
const controller = new AbortController();
|
|
343
|
+
const observation = await skillProvider.list({ id: `product:${cwd}`, sourceScopeOrder: undefined }, controller.signal);
|
|
344
|
+
return observation.descriptors;
|
|
345
|
+
};
|
|
346
|
+
return {
|
|
347
|
+
cwd,
|
|
348
|
+
version: version_1.PACKAGE_VERSION,
|
|
349
|
+
config,
|
|
350
|
+
store,
|
|
351
|
+
llm,
|
|
352
|
+
compactCoordinator,
|
|
353
|
+
modelCoordinator,
|
|
354
|
+
createAgentRunner,
|
|
355
|
+
getHarnessDiagnostics: async () => sessionRunner?.diagnostics(),
|
|
356
|
+
inspectSkills,
|
|
357
|
+
inspectMcp: () => mcpAdapter.descriptors,
|
|
358
|
+
rebindSessionRuntime: async () => {
|
|
359
|
+
if (sessionRunner && currentSession)
|
|
360
|
+
await sessionRunner.restoreSession();
|
|
361
|
+
},
|
|
362
|
+
settingsCoordinator,
|
|
363
|
+
describeSettings,
|
|
364
|
+
updateSettings,
|
|
365
|
+
synchronizeSettings,
|
|
366
|
+
bindSettingsRuntimeIdleProbe,
|
|
367
|
+
isConfigured: (0, config_1.isConfigured)(config),
|
|
368
|
+
ensureSession,
|
|
369
|
+
setSession,
|
|
370
|
+
getSession,
|
|
371
|
+
shutdown,
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
//# sourceMappingURL=product-bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-bootstrap.js","sourceRoot":"","sources":["../../src/runtime/product-bootstrap.ts"],"names":[],"mappings":";;AA6DA,wDA0YC;AAvcD,6DAAoE;AACpE,8CAA2C;AAC3C,iDAAyD;AACzD,+CAA+E;AAC/E,uDAAyD;AACzD,6DAKmC;AACnC,yCAA6C;AAC7C,+CAA+E;AAC/E,6DAAkE;AAClE,+DAAsF;AACtF,2EAA2E;AAC3E,yEAAgF;AAChF,2EAI0C;AAC1C,iEAMqC;AACrC,yDAA4D;AAC5D,gDAAqD;AACrD,2EAAuF;AACvF,+BAAuF;AACvF,2DAAuD;AACvD,iEAA8D;AAG9D,mEAAsE;AACtE,qCAAqE;AAiBrE;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAC1C,OAAyC;IAEzC,IAAA,4BAAe,GAAE,CAAC;IAClB,IAAA,oCAAoB,GAAE,CAAC;IAEvB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IACxB,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9F,MAAM,aAAa,GAAG,IAAA,yCAAwB,EAAC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AAc,EAAE,CAAC;QAC5E,CAAC;QACD,mBAAmB;QACnB,gBAAgB;QAChB,cAAc;QACd,mBAAmB;QACnB,4BAA4B;QAC5B,YAAY,EAAE,IAAA,qBAAY,EAAC,MAAM,CAAC;QAClC,aAAa;QACb,UAAU;QACV,UAAU;QACV,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -7,6 +7,7 @@ import type { McpConnectorV1, McpServerDescriptorInputV1 } from './mcp';
|
|
|
7
7
|
import { type OrionRuntimeV1 } from './orion-runtime-v1';
|
|
8
8
|
import type { SkillProviderV1 } from './skills';
|
|
9
9
|
import type { FirstPartyApprovalHandlerV1 } from './first-party-tool-services';
|
|
10
|
+
import type { ThreadSessionRuntimeActivationV1 } from './thread-session-view';
|
|
10
11
|
import type { SubagentThreadReceiptV1 } from './subagent-thread-runtime';
|
|
11
12
|
import { type SubagentRole } from './subagents/types';
|
|
12
13
|
export interface ProductOrionRuntimeOptionsV1 {
|
|
@@ -31,5 +32,5 @@ export interface ProductOrionRuntimeOptionsV1 {
|
|
|
31
32
|
readonly onSubagentReceipt?: (receipt: SubagentThreadReceiptV1) => void | Promise<void>;
|
|
32
33
|
}
|
|
33
34
|
/** Build one explicit OrionRuntime owner for a legacy Session/v2 Thread identity. */
|
|
34
|
-
export declare function createProductOrionRuntimeV1(options: ProductOrionRuntimeOptionsV1, sessionId: string): OrionRuntimeV1;
|
|
35
|
+
export declare function createProductOrionRuntimeV1(options: ProductOrionRuntimeOptionsV1, sessionId: string, activation?: ThreadSessionRuntimeActivationV1): OrionRuntimeV1;
|
|
35
36
|
//# sourceMappingURL=product-orion-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-orion-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/product-orion-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"product-orion-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/product-orion-runtime.ts"],"names":[],"mappings":"AAG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,EAAE,2BAA2B,CAAC;IACvD,8EAA8E;IAC9E,QAAQ,CAAC,2BAA2B,CAAC,EAAE,CAAC,KAAK,EAAE;QAC7C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;QAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;KACnC,KAAK,UAAU,CAAC;IACjB,wFAAwF;IACxF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzF;AAED,qFAAqF;AACrF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,4BAA4B,EACrC,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,gCAAgC,GAC5C,cAAc,CA6KhB"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createProductOrionRuntimeV1 = createProductOrionRuntimeV1;
|
|
4
4
|
const path_1 = require("path");
|
|
5
|
+
const fs_1 = require("fs");
|
|
5
6
|
const prompt_1 = require("../framework/prompt");
|
|
6
7
|
const stop_decision_1 = require("../framework/stop-decision");
|
|
7
8
|
const prompt_context_1 = require("../memory/prompt-context");
|
|
@@ -9,11 +10,12 @@ const file_context_1 = require("../services/file-context");
|
|
|
9
10
|
const goal_storage_1 = require("../services/goal-storage");
|
|
10
11
|
const llm_1 = require("../services/llm");
|
|
11
12
|
const session_storage_1 = require("../services/session-storage");
|
|
13
|
+
const model_registry_1 = require("../services/model-registry");
|
|
12
14
|
const token_estimate_1 = require("../utils/token-estimate");
|
|
15
|
+
const debug_log_1 = require("../utils/debug-log");
|
|
13
16
|
const paths_1 = require("../product/paths");
|
|
14
17
|
const builtin_tool_provider_1 = require("./builtin-tool-provider");
|
|
15
18
|
const legacy_thread_materializer_1 = require("./legacy-thread-materializer");
|
|
16
|
-
const thread_event_store_1 = require("./thread-event-store");
|
|
17
19
|
const orion_runtime_v1_1 = require("./orion-runtime-v1");
|
|
18
20
|
const prompts_1 = require("./prompts");
|
|
19
21
|
const canonical_1 = require("./protocol/canonical");
|
|
@@ -27,20 +29,27 @@ const presets_1 = require("./subagents/presets");
|
|
|
27
29
|
const types_1 = require("./subagents/types");
|
|
28
30
|
const turn_commit_1 = require("./turn-commit");
|
|
29
31
|
/** Build one explicit OrionRuntime owner for a legacy Session/v2 Thread identity. */
|
|
30
|
-
function createProductOrionRuntimeV1(options, sessionId) {
|
|
32
|
+
function createProductOrionRuntimeV1(options, sessionId, activation) {
|
|
31
33
|
let promptState;
|
|
32
34
|
const scheduledPlanReceipts = new Set();
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
+
let openedStorage = activation
|
|
36
|
+
? openedStorageFromActivation(options.cwd, sessionId, activation)
|
|
37
|
+
: (0, legacy_thread_materializer_1.openSessionStorageV1)(options.cwd, sessionId);
|
|
38
|
+
if (openedStorage.resolution.kind === 'legacy') {
|
|
35
39
|
(0, legacy_thread_materializer_1.materializeLegacyThreadV1)({ projectPath: options.cwd, sessionId });
|
|
36
|
-
|
|
40
|
+
openedStorage = (0, legacy_thread_materializer_1.openSessionStorageV1)(options.cwd, sessionId);
|
|
37
41
|
}
|
|
38
|
-
|
|
42
|
+
const { resolution: storage } = openedStorage;
|
|
43
|
+
if (storage.kind !== 'thread' || !('store' in openedStorage)) {
|
|
39
44
|
throw new Error(`Session ${sessionId} did not cut over to a v2 Thread.`);
|
|
40
45
|
}
|
|
41
|
-
const existingProjection =
|
|
46
|
+
const existingProjection = openedStorage.store.loadProjection();
|
|
42
47
|
const hasDurableTurnCommit = Object.values(existingProjection.turns).some(turn => turn.commit);
|
|
43
|
-
const
|
|
48
|
+
const selectedModel = options.store.getSnapshot().currentModel;
|
|
49
|
+
const profile = options.config.modelRegistry
|
|
50
|
+
? ((0, model_registry_1.lookupProfile)(options.config.modelRegistry, selectedModel) ??
|
|
51
|
+
options.config.modelRegistry.defaultProfile)
|
|
52
|
+
: undefined;
|
|
44
53
|
const provider = profile
|
|
45
54
|
? options.config.modelRegistry?.providers.get(profile.provider)
|
|
46
55
|
: undefined;
|
|
@@ -79,6 +88,7 @@ function createProductOrionRuntimeV1(options, sessionId) {
|
|
|
79
88
|
eventStore: {
|
|
80
89
|
rootDir: (0, paths_1.getProjectThreadsV2Dir)(options.cwd),
|
|
81
90
|
threadId: storage.threadId,
|
|
91
|
+
store: openedStorage.store,
|
|
82
92
|
},
|
|
83
93
|
projectPath: options.cwd,
|
|
84
94
|
taskContext: {
|
|
@@ -153,13 +163,15 @@ function createProductOrionRuntimeV1(options, sessionId) {
|
|
|
153
163
|
harnessState: commit.taskContextState,
|
|
154
164
|
conversationHistory: commit.history.map(message => ({ ...message })),
|
|
155
165
|
});
|
|
166
|
+
synchronizeSessionThreadReadModel(sessionId, storage.generation, runtime.graph.eventStore);
|
|
156
167
|
const planReceipt = planReceiptFromCommit(durableCommit);
|
|
157
168
|
if (planReceipt) {
|
|
158
169
|
projectPlanReceipt(options.store, planReceipt);
|
|
159
170
|
schedulePlanExecution(runtime, planReceipt, scheduledPlanReceipts);
|
|
160
171
|
}
|
|
161
172
|
},
|
|
162
|
-
onRuntimeStarted: ({ restoredCommit, thread }) => {
|
|
173
|
+
onRuntimeStarted: ({ restoredCommit, thread, eventStore }) => {
|
|
174
|
+
synchronizeSessionThreadReadModel(sessionId, storage.generation, eventStore);
|
|
163
175
|
if (restoredCommit)
|
|
164
176
|
projectRestoredTurnCommit(options.store, restoredCommit);
|
|
165
177
|
const planReceipt = restoredCommit ? planReceiptFromCommit(restoredCommit) : undefined;
|
|
@@ -174,9 +186,67 @@ function createProductOrionRuntimeV1(options, sessionId) {
|
|
|
174
186
|
});
|
|
175
187
|
return runtime;
|
|
176
188
|
}
|
|
189
|
+
function openedStorageFromActivation(projectPath, sessionId, activation) {
|
|
190
|
+
if (activation.version !== 1 ||
|
|
191
|
+
(0, fs_1.realpathSync)((0, path_1.resolve)(activation.projectPath)) !== (0, fs_1.realpathSync)((0, path_1.resolve)(projectPath)) ||
|
|
192
|
+
activation.sessionId !== sessionId ||
|
|
193
|
+
activation.store.threadId !== activation.threadId) {
|
|
194
|
+
throw new Error(`Session ${sessionId} Runtime activation does not match its target identity.`);
|
|
195
|
+
}
|
|
196
|
+
const index = (0, legacy_thread_materializer_1.loadThreadCutoverIndexV1)(projectPath);
|
|
197
|
+
const entry = index.sessions[sessionId];
|
|
198
|
+
if (!entry || entry.threadId !== activation.threadId) {
|
|
199
|
+
throw new Error(`Session ${sessionId} Runtime activation no longer matches the cutover index.`);
|
|
200
|
+
}
|
|
201
|
+
const projection = activation.store.loadProjection();
|
|
202
|
+
if (projection.cursor < activation.cursor ||
|
|
203
|
+
(projection.cursor === activation.cursor && projection.digest !== activation.projectionDigest)) {
|
|
204
|
+
throw new Error(`Session ${sessionId} Runtime activation moved behind its verified edge.`);
|
|
205
|
+
}
|
|
206
|
+
return Object.freeze({
|
|
207
|
+
resolution: Object.freeze({
|
|
208
|
+
kind: 'thread',
|
|
209
|
+
sessionId,
|
|
210
|
+
threadId: activation.threadId,
|
|
211
|
+
cursor: projection.cursor,
|
|
212
|
+
projectionDigest: projection.digest,
|
|
213
|
+
generation: index.generation,
|
|
214
|
+
}),
|
|
215
|
+
store: activation.store,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function synchronizeSessionThreadReadModel(sessionId, cutoverGeneration, eventStore) {
|
|
219
|
+
try {
|
|
220
|
+
const head = eventStore.captureReadModelHead();
|
|
221
|
+
const { projection } = head;
|
|
222
|
+
(0, session_storage_1.updateSessionThreadReadModel)(sessionId, {
|
|
223
|
+
threadId: projection.threadId,
|
|
224
|
+
cursor: projection.cursor,
|
|
225
|
+
projectionDigest: projection.digest,
|
|
226
|
+
cutoverGeneration,
|
|
227
|
+
lastRecordHash: head.lastRecordHash,
|
|
228
|
+
logDevice: head.log.device,
|
|
229
|
+
logInode: head.log.inode,
|
|
230
|
+
logMtimeNs: head.log.mtimeNs,
|
|
231
|
+
logCtimeNs: head.log.ctimeNs,
|
|
232
|
+
messageCount: Object.values(projection.items).filter(item => item.kind === 'message' && item.status !== 'started').length,
|
|
233
|
+
historySizeBytes: head.log.bytes,
|
|
234
|
+
updatedAt: head.lastEventTimestamp,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
// Session-list metadata is a rebuildable read model. A projection refresh
|
|
239
|
+
// must never turn a committed agent turn into a reported failure.
|
|
240
|
+
(0, debug_log_1.debugError)('product-orion-runtime.sessionReadModel', error, sessionId);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
177
243
|
function createProductSubagentCompositionV1(options, model) {
|
|
178
244
|
const config = (0, policy_1.clampSubagentConfig)(options.config.subagents ?? types_1.DEFAULT_SUBAGENT_CONFIG);
|
|
179
|
-
const
|
|
245
|
+
const selectedProfileId = options.store.getSnapshot().currentModel;
|
|
246
|
+
const selectedProfile = options.config.modelRegistry
|
|
247
|
+
? (0, model_registry_1.lookupProfile)(options.config.modelRegistry, selectedProfileId)
|
|
248
|
+
: null;
|
|
249
|
+
const rootLlmConfig = (0, runtime_integration_1.deriveRootLlmConfig)(options.config, selectedProfileId);
|
|
180
250
|
if (config.mode === 'off' || !rootLlmConfig.apiKey)
|
|
181
251
|
return undefined;
|
|
182
252
|
const allowedNames = new Set(presets_1.READ_ONLY_INVESTIGATION_TOOLS);
|
|
@@ -234,7 +304,7 @@ function createProductSubagentCompositionV1(options, model) {
|
|
|
234
304
|
createModelExecutor: childInput => {
|
|
235
305
|
const executor = options.createSubagentModelExecutor
|
|
236
306
|
? options.createSubagentModelExecutor(childInput)
|
|
237
|
-
: createProductChildModelExecutor(options, rootLlmConfig, model.providerProtocol);
|
|
307
|
+
: createProductChildModelExecutor(options, rootLlmConfig, model.providerProtocol, selectedProfile?.reasoningCapability);
|
|
238
308
|
if (executor === options.llm || issuedModels.has(executor)) {
|
|
239
309
|
throw new Error('Subagent model factory must return a distinct LLMService for every child request.');
|
|
240
310
|
}
|
|
@@ -335,11 +405,11 @@ function createProductSubagentRolePolicies(options, config) {
|
|
|
335
405
|
]);
|
|
336
406
|
return Object.freeze(Object.fromEntries(entries));
|
|
337
407
|
}
|
|
338
|
-
function createProductChildModelExecutor(options, rootConfig, providerProtocol) {
|
|
408
|
+
function createProductChildModelExecutor(options, rootConfig, providerProtocol, reasoningCapability) {
|
|
339
409
|
const executor = new llm_1.LLMService({
|
|
340
410
|
...(0, production_1.createChildLlmConfig)(rootConfig),
|
|
341
411
|
providerProtocol,
|
|
342
|
-
reasoningCapability
|
|
412
|
+
reasoningCapability,
|
|
343
413
|
fallbackReasoningCapability: options.config.modelRegistry?.fallbackProfile?.reasoningCapability,
|
|
344
414
|
effortPreference: options.config.defaultEffort,
|
|
345
415
|
});
|