@agimon-ai/po 0.0.0-alpha.2 → 0.0.0-alpha.21
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/README.md +14 -11
- package/dist/antigravity.mjs +1 -2
- package/dist/baseCommand.mjs +1 -2
- package/dist/bin/cli.cjs +37 -14
- package/dist/bin/cli.cjs.map +1 -1
- package/dist/bin/cli.mjs +34 -14
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/{doomRunner.cjs → poRunner.cjs} +5 -5
- package/dist/bin/poRunner.cjs.map +1 -0
- package/dist/bin/{doomRunner.d.mts → poRunner.d.mts} +2 -2
- package/dist/bin/poRunner.d.mts.map +1 -0
- package/dist/bin/{doomRunner.mjs → poRunner.mjs} +5 -5
- package/dist/bin/poRunner.mjs.map +1 -0
- package/dist/builders/cli/extensionAssembler/index.cjs +14 -12
- package/dist/builders/cli/extensionAssembler/index.cjs.map +1 -1
- package/dist/builders/cli/extensionAssembler/index.d.mts +2 -1
- package/dist/builders/cli/extensionAssembler/index.d.mts.map +1 -1
- package/dist/builders/cli/extensionAssembler/index.mjs +14 -12
- package/dist/builders/cli/extensionAssembler/index.mjs.map +1 -1
- package/dist/catalog/index.json +68 -51
- package/dist/cliApp.mjs +1 -2
- package/dist/codex.mjs +1 -2
- package/dist/compatibilityCommand.mjs +1 -2
- package/dist/compatibilityContext.mjs +1 -2
- package/dist/compatibilityOptions.mjs +1 -2
- package/dist/config.cjs +57 -12
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +3 -3
- package/dist/doctorCommand.mjs +1 -2
- package/dist/emitMcpCommand.mjs +1 -2
- package/dist/explainCommand.mjs +1 -2
- package/dist/extensions/server.cjs +11 -7
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts +2 -2
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +12 -8
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/harnessContext.mjs +1 -2
- package/dist/harnessState.cjs +66 -11
- package/dist/harnessState.d.mts +2 -2
- package/dist/harnessState.mjs +1 -2
- package/dist/index.cjs +60 -15
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/initCommand.mjs +1 -2
- package/dist/matrixOptions.mjs +1 -2
- package/dist/options.mjs +1 -2
- package/dist/process.mjs +1 -2
- package/dist/projectTrust.cjs +2 -2
- package/dist/projectTrust.d.mts +2 -2
- package/dist/projectTrust.mjs +1 -2
- package/dist/repository.cjs +1 -1
- package/dist/repository.d.mts +2 -2
- package/dist/repository.mjs +1 -2
- package/dist/router.mjs +1 -2
- package/dist/shared.mjs +1 -2
- package/dist/src/bin/agentDirectory.cjs +18 -12
- package/dist/src/bin/agentDirectory.cjs.map +1 -1
- package/dist/src/bin/agentDirectory.mjs +15 -12
- package/dist/src/bin/agentDirectory.mjs.map +1 -1
- package/dist/src/builders/apiContractExport/index.cjs +6 -6
- package/dist/src/builders/apiContractExport/index.cjs.map +1 -1
- package/dist/src/builders/apiContractExport/index.mjs +9 -9
- package/dist/src/builders/apiContractExport/index.mjs.map +1 -1
- package/dist/src/builders/cli/entryResolution.cjs +3 -3
- package/dist/src/builders/cli/entryResolution.cjs.map +1 -1
- package/dist/src/builders/cli/entryResolution.mjs +3 -3
- package/dist/src/builders/cli/entryResolution.mjs.map +1 -1
- package/dist/src/builders/cli/harnessContext.cjs +5 -5
- package/dist/src/builders/cli/harnessContext.cjs.map +1 -1
- package/dist/src/builders/cli/harnessContext.mjs +7 -7
- package/dist/src/builders/cli/harnessContext.mjs.map +1 -1
- package/dist/src/builders/hooks/index.cjs +1 -1
- package/dist/src/builders/hooks/index.cjs.map +1 -1
- package/dist/src/builders/hooks/index.mjs +2 -2
- package/dist/src/builders/hooks/index.mjs.map +1 -1
- package/dist/src/builders/server/backgroundSync.cjs +13 -1
- package/dist/src/builders/server/backgroundSync.cjs.map +1 -1
- package/dist/src/builders/server/backgroundSync.mjs +13 -1
- package/dist/src/builders/server/backgroundSync.mjs.map +1 -1
- package/dist/src/builders/server/bundlerService.cjs +151 -0
- package/dist/src/builders/server/bundlerService.cjs.map +1 -0
- package/dist/src/builders/server/bundlerService.mjs +151 -0
- package/dist/src/builders/server/bundlerService.mjs.map +1 -0
- package/dist/src/builders/server/computerUseBinding.cjs +2 -2
- package/dist/src/builders/server/computerUseBinding.cjs.map +1 -1
- package/dist/src/builders/server/computerUseBinding.mjs +3 -3
- package/dist/src/builders/server/computerUseBinding.mjs.map +1 -1
- package/dist/src/builders/server/defaultWorkspace.cjs +1 -1
- package/dist/src/builders/server/defaultWorkspace.cjs.map +1 -1
- package/dist/src/builders/server/defaultWorkspace.mjs +2 -2
- package/dist/src/builders/server/defaultWorkspace.mjs.map +1 -1
- package/dist/src/builders/server/idleRestart.cjs +3 -3
- package/dist/src/builders/server/idleRestart.cjs.map +1 -1
- package/dist/src/builders/server/idleRestart.mjs +3 -3
- package/dist/src/builders/server/idleRestart.mjs.map +1 -1
- package/dist/src/builders/server/index.cjs +6 -6
- package/dist/src/builders/server/index.cjs.map +1 -1
- package/dist/src/builders/server/index.mjs +6 -6
- package/dist/src/builders/server/index.mjs.map +1 -1
- package/dist/src/builders/server/logSink.cjs +3 -3
- package/dist/src/builders/server/logSink.cjs.map +1 -1
- package/dist/src/builders/server/logSink.mjs +2 -2
- package/dist/src/builders/server/logSink.mjs.map +1 -1
- package/dist/src/builders/server/mcpBundle.cjs.map +1 -1
- package/dist/src/builders/server/mcpBundle.d.mts +2 -2
- package/dist/src/builders/server/mcpBundle.mjs.map +1 -1
- package/dist/src/builders/server/packageUrl.cjs +25 -18
- package/dist/src/builders/server/packageUrl.cjs.map +1 -1
- package/dist/src/builders/server/packageUrl.mjs +25 -18
- package/dist/src/builders/server/packageUrl.mjs.map +1 -1
- package/dist/src/builders/server/runtime.cjs +157 -168
- package/dist/src/builders/server/runtime.cjs.map +1 -1
- package/dist/src/builders/server/runtime.mjs +161 -171
- package/dist/src/builders/server/runtime.mjs.map +1 -1
- package/dist/src/builders/server/selectionStatus.cjs +3 -3
- package/dist/src/builders/server/selectionStatus.cjs.map +1 -1
- package/dist/src/builders/server/selectionStatus.mjs +3 -3
- package/dist/src/builders/server/selectionStatus.mjs.map +1 -1
- package/dist/src/builders/server/sessionArguments.cjs.map +1 -1
- package/dist/src/builders/server/sessionArguments.mjs.map +1 -1
- package/dist/src/builders/server/watcherService.cjs +65 -0
- package/dist/src/builders/server/watcherService.cjs.map +1 -0
- package/dist/src/builders/server/watcherService.mjs +61 -0
- package/dist/src/builders/server/watcherService.mjs.map +1 -0
- package/dist/src/builders/server/webTemplateDecision.cjs +1 -1
- package/dist/src/builders/server/webTemplateDecision.cjs.map +1 -1
- package/dist/src/builders/server/webTemplateDecision.mjs +2 -2
- package/dist/src/builders/server/webTemplateDecision.mjs.map +1 -1
- package/dist/src/builders/web/bundle.cjs.map +1 -1
- package/dist/src/builders/web/bundle.d.mts +4 -3
- package/dist/src/builders/web/bundle.mjs.map +1 -1
- package/dist/src/builders/web/bundleAssetPolicy.d.mts +1 -0
- package/dist/src/builders/web/index.cjs +1 -1
- package/dist/src/builders/web/index.cjs.map +1 -1
- package/dist/src/builders/web/index.d.mts +1 -0
- package/dist/src/builders/web/index.mjs +1 -1
- package/dist/src/builders/web/index.mjs.map +1 -1
- package/dist/src/builders/web/webPluginGenerate.cjs +4 -15
- package/dist/src/builders/web/webPluginGenerate.cjs.map +1 -1
- package/dist/src/builders/web/webPluginGenerate.d.mts +5 -9
- package/dist/src/builders/web/webPluginGenerate.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginGenerate.mjs +4 -15
- package/dist/src/builders/web/webPluginGenerate.mjs.map +1 -1
- package/dist/src/builders/web/webPluginVite.d.mts +1 -0
- package/dist/src/cli/cliApp.cjs +1 -1
- package/dist/src/cli/cliApp.cjs.map +1 -1
- package/dist/src/cli/cliApp.mjs +1 -1
- package/dist/src/cli/cliApp.mjs.map +1 -1
- package/dist/src/cli/commands/compat/index.cjs +1 -1
- package/dist/src/cli/commands/compat/index.cjs.map +1 -1
- package/dist/src/cli/commands/compat/index.mjs +1 -1
- package/dist/src/cli/commands/compat/index.mjs.map +1 -1
- package/dist/src/cli/commands/doctor/index.cjs +2 -2
- package/dist/src/cli/commands/doctor/index.cjs.map +1 -1
- package/dist/src/cli/commands/doctor/index.d.mts +1 -0
- package/dist/src/cli/commands/doctor/index.d.mts.map +1 -1
- package/dist/src/cli/commands/doctor/index.mjs +4 -4
- package/dist/src/cli/commands/doctor/index.mjs.map +1 -1
- package/dist/src/cli/commands/explain/index.cjs +3 -1
- package/dist/src/cli/commands/explain/index.cjs.map +1 -1
- package/dist/src/cli/commands/explain/index.d.mts.map +1 -1
- package/dist/src/cli/commands/explain/index.mjs +4 -2
- package/dist/src/cli/commands/explain/index.mjs.map +1 -1
- package/dist/src/cli/commands/init/index.cjs +2 -2
- package/dist/src/cli/commands/init/index.cjs.map +1 -1
- package/dist/src/cli/commands/init/index.mjs +3 -3
- package/dist/src/cli/commands/init/index.mjs.map +1 -1
- package/dist/src/cli/commands/init/presenter.cjs +1 -1
- package/dist/src/cli/commands/init/presenter.cjs.map +1 -1
- package/dist/src/cli/commands/init/presenter.mjs +2 -2
- package/dist/src/cli/commands/init/presenter.mjs.map +1 -1
- package/dist/src/cli/commands/sync/index.cjs +4 -4
- package/dist/src/cli/commands/sync/index.cjs.map +1 -1
- package/dist/src/cli/commands/sync/index.d.mts +1 -0
- package/dist/src/cli/commands/sync/index.mjs +7 -7
- package/dist/src/cli/commands/sync/index.mjs.map +1 -1
- package/dist/src/cli/commands/sync/presenter.cjs +1 -1
- package/dist/src/cli/commands/sync/presenter.cjs.map +1 -1
- package/dist/src/cli/commands/sync/presenter.d.mts +1 -1
- package/dist/src/cli/commands/sync/presenter.mjs +1 -1
- package/dist/src/cli/commands/sync/presenter.mjs.map +1 -1
- package/dist/src/cli/commands/web/index.cjs +2 -1
- package/dist/src/cli/commands/web/index.cjs.map +1 -1
- package/dist/src/cli/commands/web/index.mjs +2 -1
- package/dist/src/cli/commands/web/index.mjs.map +1 -1
- package/dist/src/cli/harnessOptions.cjs +1 -1
- package/dist/src/cli/harnessOptions.cjs.map +1 -1
- package/dist/src/cli/harnessOptions.mjs +2 -2
- package/dist/src/cli/harnessOptions.mjs.map +1 -1
- package/dist/src/cli/help.cjs +2 -0
- package/dist/src/cli/help.cjs.map +1 -1
- package/dist/src/cli/help.mjs +2 -0
- package/dist/src/cli/help.mjs.map +1 -1
- package/dist/src/cli/matrixOptions.cjs +1 -1
- package/dist/src/cli/matrixOptions.cjs.map +1 -1
- package/dist/src/cli/matrixOptions.d.mts +1 -1
- package/dist/src/cli/matrixOptions.mjs +1 -1
- package/dist/src/cli/matrixOptions.mjs.map +1 -1
- package/dist/src/cli/server/run.cjs +1 -1
- package/dist/src/cli/server/run.cjs.map +1 -1
- package/dist/src/cli/server/run.mjs +2 -2
- package/dist/src/cli/server/run.mjs.map +1 -1
- package/dist/src/composition/harnessState/index.cjs +66 -11
- package/dist/src/composition/harnessState/index.cjs.map +1 -1
- package/dist/src/composition/harnessState/index.d.mts +3 -3
- package/dist/src/composition/harnessState/index.mjs +2 -2
- package/dist/src/composition/harnessState/index.mjs.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.cjs +5 -4
- package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.mjs +6 -5
- package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -1
- package/dist/src/composition/poHomeMigration/index.cjs +1 -1
- package/dist/src/composition/poHomeMigration/index.cjs.map +1 -1
- package/dist/src/composition/poHomeMigration/index.mjs +1 -1
- package/dist/src/composition/poHomeMigration/index.mjs.map +1 -1
- package/dist/src/composition/projectTrust/index.cjs +6 -6
- package/dist/src/composition/projectTrust/index.cjs.map +1 -1
- package/dist/src/composition/projectTrust/index.d.mts +7 -7
- package/dist/src/composition/projectTrust/index.d.mts.map +1 -1
- package/dist/src/composition/projectTrust/index.mjs +6 -6
- package/dist/src/composition/projectTrust/index.mjs.map +1 -1
- package/dist/src/composition/repository/index.cjs +8 -8
- package/dist/src/composition/repository/index.cjs.map +1 -1
- package/dist/src/composition/repository/index.d.mts +5 -5
- package/dist/src/composition/repository/index.d.mts.map +1 -1
- package/dist/src/composition/repository/index.mjs +10 -10
- package/dist/src/composition/repository/index.mjs.map +1 -1
- package/dist/src/composition/syncService/index.cjs +29 -9
- package/dist/src/composition/syncService/index.cjs.map +1 -1
- package/dist/src/composition/syncService/index.d.mts.map +1 -1
- package/dist/src/composition/syncService/index.mjs +31 -11
- package/dist/src/composition/syncService/index.mjs.map +1 -1
- package/dist/src/composition/syncService/localBuilds.cjs +7 -2
- package/dist/src/composition/syncService/localBuilds.cjs.map +1 -1
- package/dist/src/composition/syncService/localBuilds.mjs +7 -2
- package/dist/src/composition/syncService/localBuilds.mjs.map +1 -1
- package/dist/src/extensions/setupDiagnostics.cjs +3 -3
- package/dist/src/extensions/setupDiagnostics.cjs.map +1 -1
- package/dist/src/extensions/setupDiagnostics.mjs +3 -3
- package/dist/src/extensions/setupDiagnostics.mjs.map +1 -1
- package/dist/utils.mjs +1 -2
- package/docs/server/api-export.md +3 -3
- package/docs/server/api.md +23 -22
- package/docs/server/getting-started.md +7 -7
- package/docs/server/index.md +4 -4
- package/docs/server/ipc.md +7 -11
- package/docs/server/lifecycle.md +17 -17
- package/docs/server/security.md +8 -8
- package/package.json +42 -45
- package/src/prompts/po-author-extension/SKILL.md +1 -1
- package/src/prompts/po-author-extension/references/extension-contract.md +4 -4
- package/dist/bin/doomRunner.cjs.map +0 -1
- package/dist/bin/doomRunner.d.mts.map +0 -1
- package/dist/bin/doomRunner.mjs.map +0 -1
|
@@ -2,27 +2,24 @@ const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
|
2
2
|
const require_index = require("../../composition/harnessState/index.cjs");
|
|
3
3
|
const require_index$1 = require("../../composition/repository/index.cjs");
|
|
4
4
|
const require_builders_cli_extensionAssembler_index = require("../../../builders/cli/extensionAssembler/index.cjs");
|
|
5
|
-
const require_packageUrl = require("./packageUrl.cjs");
|
|
6
5
|
const require_index$2 = require("../web/index.cjs");
|
|
7
6
|
const require_index$3 = require("../native/index.cjs");
|
|
8
7
|
const require_index$4 = require("../../composition/layerPackageInstaller/index.cjs");
|
|
9
|
-
const require_sessionComposition = require("../cli/sessionComposition.cjs");
|
|
10
8
|
const require_mcpAppBuild = require("./mcpAppBuild.cjs");
|
|
11
|
-
const require_mcpBundle = require("./mcpBundle.cjs");
|
|
12
9
|
const require_index$5 = require("../../composition/syncService/index.cjs");
|
|
13
10
|
const require_backgroundSync = require("./backgroundSync.cjs");
|
|
14
11
|
const require_harnessContext = require("../cli/harnessContext.cjs");
|
|
15
12
|
const require_index$6 = require("../hooks/index.cjs");
|
|
13
|
+
const require_bundlerService = require("./bundlerService.cjs");
|
|
16
14
|
const require_computerUseBinding = require("./computerUseBinding.cjs");
|
|
17
15
|
const require_defaultWorkspace = require("./defaultWorkspace.cjs");
|
|
18
16
|
const require_idleRestart = require("./idleRestart.cjs");
|
|
19
|
-
const require_index$7 = require("./index.cjs");
|
|
20
17
|
const require_logSink = require("./logSink.cjs");
|
|
21
|
-
const require_packageReloadCheck = require("./packageReloadCheck.cjs");
|
|
22
18
|
const require_runtimeResources = require("./runtimeResources.cjs");
|
|
23
19
|
const require_selectionStatus = require("./selectionStatus.cjs");
|
|
24
20
|
const require_sessionArguments = require("./sessionArguments.cjs");
|
|
25
21
|
const require_shutdown = require("./shutdown.cjs");
|
|
22
|
+
const require_watcherService = require("./watcherService.cjs");
|
|
26
23
|
const require_webTemplateDecision = require("./webTemplateDecision.cjs");
|
|
27
24
|
const require_workspaceCheckout = require("./workspaceCheckout.cjs");
|
|
28
25
|
let node_fs = require("node:fs");
|
|
@@ -36,10 +33,11 @@ let _agimon_ai_po_config_majorModes = require("@agimon-ai/po-config/majorModes")
|
|
|
36
33
|
let _agimon_ai_po_config_profiles = require("@agimon-ai/po-config/profiles");
|
|
37
34
|
let _agimon_ai_po_core_runtimeLogSinkTelemetry = require("@agimon-ai/po-core/runtimeLogSinkTelemetry");
|
|
38
35
|
let _agimon_ai_po_core_piSettings = require("@agimon-ai/po-core/piSettings");
|
|
39
|
-
let
|
|
36
|
+
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
40
37
|
let node_crypto = require("node:crypto");
|
|
41
38
|
node_crypto = require_runtime.__toESM(node_crypto, 1);
|
|
42
39
|
let _agimon_ai_po_core_history = require("@agimon-ai/po-core/history");
|
|
40
|
+
let _agimon_ai_po_core_nodePlatform = require("@agimon-ai/po-core/nodePlatform");
|
|
43
41
|
let _agimon_ai_po_core_backgroundWork = require("@agimon-ai/po-core/backgroundWork");
|
|
44
42
|
let _agimon_ai_po_core_headlessHub = require("@agimon-ai/po-core/headlessHub");
|
|
45
43
|
let _agimon_ai_po_core_headlessServer = require("@agimon-ai/po-core/headlessServer");
|
|
@@ -51,8 +49,6 @@ let _agimon_ai_po_core_remoteRuntime = require("@agimon-ai/po-core/remoteRuntime
|
|
|
51
49
|
let _agimon_ai_po_core_serverTelemetry = require("@agimon-ai/po-core/serverTelemetry");
|
|
52
50
|
let _agimon_ai_po_core_webCompositions = require("@agimon-ai/po-core/webCompositions");
|
|
53
51
|
let _agimon_ai_po_minor_mode = require("@agimon-ai/po-minor-mode");
|
|
54
|
-
let ws = require("ws");
|
|
55
|
-
ws = require_runtime.__toESM(ws, 1);
|
|
56
52
|
let _agimon_ai_po_config_harnessStore = require("@agimon-ai/po-config/harnessStore");
|
|
57
53
|
let _agimon_ai_po_config_harnessState = require("@agimon-ai/po-config/harnessState");
|
|
58
54
|
//#region src/builders/server/runtime.ts
|
|
@@ -64,7 +60,7 @@ async function bounded(operation, label, notice) {
|
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
62
|
async function runServerRuntime(options, runtime) {
|
|
67
|
-
const { cwd: baseCwd, environment: incomingEnvironment, notice, resolveHarnessOptions, signal, onExtensionCheck } = runtime;
|
|
63
|
+
const { cwd: baseCwd, environment: incomingEnvironment, notice: rawNotice, resolveHarnessOptions, signal, onExtensionCheck } = runtime;
|
|
68
64
|
const baseEnvironment = {
|
|
69
65
|
...incomingEnvironment,
|
|
70
66
|
LOG_SINK_INSTANCE: "global"
|
|
@@ -73,31 +69,58 @@ async function runServerRuntime(options, runtime) {
|
|
|
73
69
|
await require_logSink.ensureGlobalLogSink({
|
|
74
70
|
cwd: baseCwd,
|
|
75
71
|
env: baseEnvironment,
|
|
76
|
-
notice
|
|
77
|
-
}).catch((error) =>
|
|
72
|
+
notice: rawNotice
|
|
73
|
+
}).catch((error) => rawNotice(`Global log sink unavailable: ${error instanceof Error ? error.message : String(error)}`));
|
|
78
74
|
const telemetry = (0, _agimon_ai_po_core_serverTelemetry.createServerTelemetry)({
|
|
79
75
|
cwd: baseCwd,
|
|
80
76
|
env: baseEnvironment,
|
|
81
|
-
warn:
|
|
77
|
+
warn: rawNotice
|
|
82
78
|
});
|
|
79
|
+
const notice = (message) => {
|
|
80
|
+
rawNotice(message);
|
|
81
|
+
telemetry.recordEvent("po_server.notice", { message }).catch((error) => rawNotice(`notice telemetry failed: ${String(error)}`));
|
|
82
|
+
};
|
|
83
83
|
const homeDirectory = baseEnvironment.HOME ?? node_os.default.homedir();
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
84
|
+
const serverDirectory = node_path.default.join((0, _agimon_ai_po_core_piSettings.piAgentDirectory)(baseEnvironment), "server");
|
|
85
|
+
const platform = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)({
|
|
86
|
+
homeDirectory,
|
|
87
|
+
sessionsRoot: node_path.default.join(serverDirectory, "sessions")
|
|
88
|
+
});
|
|
89
|
+
/** Called on a watched change; assigned once every scope can be checked. */
|
|
90
|
+
let pickUpChange = () => void 0;
|
|
91
|
+
const watcher = require_watcherService.createWatcherService({
|
|
92
|
+
onChange: () => pickUpChange(),
|
|
93
|
+
onNotice: notice
|
|
94
|
+
});
|
|
95
|
+
const isConfig = (file) => /\.ya?ml$/u.test(file);
|
|
96
|
+
watcher.add({
|
|
97
|
+
path: (0, _agimon_ai_po_config_config.globalPoConfigDirectory)(homeDirectory),
|
|
98
|
+
include: isConfig
|
|
99
|
+
});
|
|
100
|
+
/** Compiles and loads packages once per content; every scope and session selects from it. */
|
|
101
|
+
const bundler = require_bundlerService.createBundlerService({
|
|
102
|
+
homeDirectory,
|
|
103
|
+
environment: baseEnvironment,
|
|
104
|
+
onCompositions: (root, compositions) => {
|
|
105
|
+
watcher.add({
|
|
106
|
+
path: node_path.default.join(root, ".po"),
|
|
107
|
+
include: isConfig
|
|
108
|
+
});
|
|
109
|
+
for (const packageRoot of require_index$2.compositionPackageRoots(compositions)) if (!packageRoot.includes(`${node_path.default.sep}node_modules${node_path.default.sep}`)) watcher.add({
|
|
110
|
+
path: packageRoot,
|
|
111
|
+
recursive: true,
|
|
112
|
+
include: require_watcherService.outsideNodeModules
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
92
116
|
/** The hook module descriptor from the root's live registry; sources load in place or from snapshots. */
|
|
93
117
|
const liveHookModules = (repoRoot) => require_index$6.writeLiveHookModules({
|
|
94
118
|
repoRoot,
|
|
95
119
|
homeDirectory,
|
|
96
|
-
directory: node_path.default.join((0, _agimon_ai_po_config_config.
|
|
97
|
-
artifactFor: (source) => packageUrls.pathFor(source),
|
|
120
|
+
directory: node_path.default.join((0, _agimon_ai_po_config_config.globalPoConfigDirectory)(homeDirectory), "server", "hook-modules"),
|
|
121
|
+
artifactFor: (source) => bundler.packageUrls.pathFor(source),
|
|
98
122
|
onNotice: notice
|
|
99
123
|
});
|
|
100
|
-
const serverDirectory = node_path.default.join((0, _agimon_ai_po_core_piSettings.piAgentDirectory)(baseEnvironment), "server");
|
|
101
124
|
const requestReceipts = (0, _agimon_ai_po_core_history.createRequestReceipts)({ directory: node_path.default.join(serverDirectory, "request-receipts-v1") });
|
|
102
125
|
const activeMedia = /* @__PURE__ */ new Set();
|
|
103
126
|
const mediaArbitration = {
|
|
@@ -181,7 +204,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
181
204
|
/** The last harness context built to report each repository's MCP projection, kept while it is current. */
|
|
182
205
|
const repositoryContexts = /* @__PURE__ */ new Map();
|
|
183
206
|
const sessionArtifacts = /* @__PURE__ */ new Map();
|
|
184
|
-
/** Each host's
|
|
207
|
+
/** Each host's session package root, where its session services (background work included) live. */
|
|
185
208
|
const sessionServiceRoots = /* @__PURE__ */ new WeakMap();
|
|
186
209
|
let mountSessionApis;
|
|
187
210
|
/**
|
|
@@ -268,8 +291,11 @@ async function runServerRuntime(options, runtime) {
|
|
|
268
291
|
stepUpRequired: () => remoteRuntime?.remote.stepUpRequired("computer-use.activate") === true
|
|
269
292
|
});
|
|
270
293
|
let hub;
|
|
294
|
+
/** Assigned once the global builds can be read; no session opens before then. */
|
|
295
|
+
let publishSessionCompositions = () => ({});
|
|
271
296
|
hub = (0, _agimon_ai_po_core_headlessHub.createHeadlessHub)({
|
|
272
297
|
manager: sessionManager,
|
|
298
|
+
platform,
|
|
273
299
|
resolveProfileIdentity: (root, profile) => {
|
|
274
300
|
const identity = (0, _agimon_ai_po_config_profiles.resolveProfile)(root, profile, homeDirectory).identity;
|
|
275
301
|
return identity === void 0 ? void 0 : {
|
|
@@ -277,10 +303,11 @@ async function runServerRuntime(options, runtime) {
|
|
|
277
303
|
icon: identity.icon
|
|
278
304
|
};
|
|
279
305
|
},
|
|
306
|
+
publishSessionCompositions: (sessionId, root, majorMode) => publishSessionCompositions(sessionId, root, majorMode),
|
|
280
307
|
admitWorkspace: async ({ root, name }) => admitWorkspace(root === void 0 || root.trim() === "" ? await require_defaultWorkspace.createDefaultWorkspaceFolder(name ?? "", homeDirectory) : root, name),
|
|
281
308
|
onWorkspaceRemoved: (workspaceId) => {
|
|
282
309
|
workspaces.remove(workspaceId);
|
|
283
|
-
|
|
310
|
+
bundler.forgetScope(`workspace:${workspaceId}`);
|
|
284
311
|
webCompositions?.remove({
|
|
285
312
|
scope: "workspace",
|
|
286
313
|
workspaceId
|
|
@@ -322,7 +349,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
322
349
|
const hosts = sessionManager.sessions();
|
|
323
350
|
if (hosts.some((host) => {
|
|
324
351
|
const root = sessionServiceRoots.get(host);
|
|
325
|
-
const service = root === void 0 ? void 0 : (0, _agimon_ai_po_core_backgroundWork.
|
|
352
|
+
const service = root === void 0 ? void 0 : (0, _agimon_ai_po_core_backgroundWork.readPoBackgroundWorkService)(root);
|
|
326
353
|
return service !== void 0 && require_idleRestart.holdsRestart(service.snapshot());
|
|
327
354
|
})) return true;
|
|
328
355
|
return (await Promise.all(hosts.map((host) => host.runtime.readState()))).some((state) => state.isStreaming || state.isCompacting);
|
|
@@ -334,10 +361,13 @@ async function runServerRuntime(options, runtime) {
|
|
|
334
361
|
const stopPersistSessionNames = hub.onEvent((event) => {
|
|
335
362
|
if (event.kind !== "upsert") return;
|
|
336
363
|
const record = openSessions.list().find((entry) => entry.sessionId === event.session.id);
|
|
337
|
-
|
|
364
|
+
const groups = event.session.groups ?? [];
|
|
365
|
+
const sameGroups = groups.length === (record?.groups ?? []).length && groups.every((group, index) => record?.groups?.[index] === group);
|
|
366
|
+
if (record === void 0 || record.name === event.session.name && sameGroups) return;
|
|
338
367
|
openSessions.add({
|
|
339
368
|
...record,
|
|
340
|
-
name: event.session.name
|
|
369
|
+
name: event.session.name,
|
|
370
|
+
groups
|
|
341
371
|
});
|
|
342
372
|
});
|
|
343
373
|
let harnessContext;
|
|
@@ -367,7 +397,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
367
397
|
sessionId: options.sessionId ?? node_crypto.default.randomUUID(),
|
|
368
398
|
sessionName: options.sessionName
|
|
369
399
|
});
|
|
370
|
-
const globalRoot = (0, _agimon_ai_po_config_config.
|
|
400
|
+
const globalRoot = (0, _agimon_ai_po_config_config.globalPoConfigDirectory)(homeDirectory);
|
|
371
401
|
webCompositions = (0, _agimon_ai_po_core_webCompositions.createWebCompositions)(node_path.default.join(globalRoot, "server"), notice);
|
|
372
402
|
/** Assigned once every scope can be checked; a sync that exits sooner is picked up then. */
|
|
373
403
|
let pickUpSync = async () => void 0;
|
|
@@ -383,37 +413,14 @@ async function runServerRuntime(options, runtime) {
|
|
|
383
413
|
background: backgroundSync,
|
|
384
414
|
onNotice: notice
|
|
385
415
|
});
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
* the root opens without it; the server never installs or builds.
|
|
390
|
-
*/
|
|
391
|
-
const liveCompositions = (root) => require_sessionComposition.rootCompositions({
|
|
392
|
-
root,
|
|
393
|
-
homeDirectory,
|
|
394
|
-
environment: baseEnvironment,
|
|
395
|
-
tolerateUnsynced: true
|
|
416
|
+
watcher.add({
|
|
417
|
+
path: node_path.default.dirname(require_index$5.syncPointerPath(globalRoot)),
|
|
418
|
+
include: (file) => file === node_path.default.basename(require_index$5.syncPointerPath(globalRoot))
|
|
396
419
|
});
|
|
397
|
-
/** The root's server facet entries, each with the URL its current package content imports from. */
|
|
398
|
-
const facetEntries = async (root) => {
|
|
399
|
-
const entries = [];
|
|
400
|
-
for (const { declaration, module, owners } of require_index$7.serverFacetCandidates(liveCompositions(root))) entries.push({
|
|
401
|
-
packageName: declaration.packageName,
|
|
402
|
-
entry: declaration.entry,
|
|
403
|
-
module,
|
|
404
|
-
url: await packageUrls.urlFor(module),
|
|
405
|
-
scopes: declaration.scopes,
|
|
406
|
-
owners,
|
|
407
|
-
required: declaration.required === true
|
|
408
|
-
});
|
|
409
|
-
return entries;
|
|
410
|
-
};
|
|
411
|
-
/** Every package root the root's config can select, over all its major modes. */
|
|
412
|
-
const scopePackageRoots = (root) => require_index$2.compositionPackageRoots(liveCompositions(root));
|
|
413
420
|
/** What the root opened without: packages that do not resolve yet and web plugins with no slot. */
|
|
414
421
|
const unsyncedOf = (root) => {
|
|
415
422
|
try {
|
|
416
|
-
const compositions =
|
|
423
|
+
const compositions = bundler.compositions(root);
|
|
417
424
|
const unslotted = webBuild === void 0 ? [] : require_index$2.unslottedWebPackages(webBuild, require_index$2.compositionPackageRoots(compositions));
|
|
418
425
|
return [.../* @__PURE__ */ new Set([...require_builders_cli_extensionAssembler_index.unsyncedSelectors(compositions), ...unslotted])];
|
|
419
426
|
} catch (error) {
|
|
@@ -429,11 +436,24 @@ async function runServerRuntime(options, runtime) {
|
|
|
429
436
|
unsynced: unsyncedOf(root)
|
|
430
437
|
}, request);
|
|
431
438
|
let webBuild;
|
|
432
|
-
/**
|
|
433
|
-
|
|
439
|
+
/**
|
|
440
|
+
* Publishes one mount out of the current global build, naming only the plugin slots its root
|
|
441
|
+
* resolves. A session mount passes its major mode, so it names only that mode's slots.
|
|
442
|
+
*/
|
|
443
|
+
const publishWebMount = (mount, root, majorMode) => webBuild === void 0 ? void 0 : webCompositions?.publish(mount, webBuild, hub.channelTypes(), require_index$2.mountWebPluginSlots(webBuild, bundler.packageRoots(root, majorMode)));
|
|
434
444
|
let nativeBuild;
|
|
435
445
|
/** Publishes one mount's native composition out of the current global native build. */
|
|
436
|
-
const publishNativeMount = (mount, root) => nativeBuild === void 0 ? void 0 : webCompositions?.publishNative(mount, nativeBuild, hub.channelTypes(), require_index$3.mountNativePluginIds(nativeBuild,
|
|
446
|
+
const publishNativeMount = (mount, root, majorMode) => nativeBuild === void 0 ? void 0 : webCompositions?.publishNative(mount, nativeBuild, hub.channelTypes(), require_index$3.mountNativePluginIds(nativeBuild, bundler.packageRoots(root, majorMode)));
|
|
447
|
+
publishSessionCompositions = (sessionId, root, majorMode) => ({
|
|
448
|
+
webComposition: publishWebMount({
|
|
449
|
+
scope: "session",
|
|
450
|
+
sessionId
|
|
451
|
+
}, root, majorMode),
|
|
452
|
+
nativeComposition: publishNativeMount({
|
|
453
|
+
scope: "session",
|
|
454
|
+
sessionId
|
|
455
|
+
}, root, majorMode)
|
|
456
|
+
});
|
|
437
457
|
const pickUpWebBuild = require_backgroundSync.createKeyedPickup((key) => require_index$2.readGlobalWebBuildRecord(globalRoot, key), (build, key) => {
|
|
438
458
|
notice(`Publishing global web build ${key}.`);
|
|
439
459
|
webBuild = build;
|
|
@@ -495,58 +515,28 @@ async function runServerRuntime(options, runtime) {
|
|
|
495
515
|
for (const { root, mount } of mounts) publish(mount, root);
|
|
496
516
|
}
|
|
497
517
|
};
|
|
498
|
-
const defaultSelection = (root) => {
|
|
499
|
-
const config = (0, _agimon_ai_po_config_majorModes.loadMajorModesConfig)(root, homeDirectory, baseEnvironment);
|
|
500
|
-
const majorMode = config.defaultMajorMode;
|
|
501
|
-
return {
|
|
502
|
-
root,
|
|
503
|
-
majorMode,
|
|
504
|
-
activeLayers: (0, _agimon_ai_po_config_majorModes.resolveLayers)(config, majorMode)
|
|
505
|
-
};
|
|
506
|
-
};
|
|
507
518
|
const loadComposition = async (root, scope, selection) => {
|
|
508
|
-
const selected = selection ?? defaultSelection(root);
|
|
509
|
-
return telemetry.runInSpan("po_server.composition_load", { scope }, async () => (0,
|
|
510
|
-
entries: await
|
|
519
|
+
const selected = selection ?? bundler.defaultSelection(root);
|
|
520
|
+
return telemetry.runInSpan("po_server.composition_load", { scope }, async () => (0, _agimon_ai_po_core_serverPlugin.loadServerPackages)(scope, {
|
|
521
|
+
entries: await bundler.packageEntries(root),
|
|
511
522
|
majorMode: selected.majorMode,
|
|
512
523
|
activeLayers: selected.activeLayers,
|
|
513
524
|
retainCandidates: scope === "session",
|
|
514
525
|
onNotice: notice,
|
|
515
|
-
poisoned:
|
|
516
|
-
importer:
|
|
526
|
+
poisoned: bundler.poisoned,
|
|
527
|
+
importer: bundler.importer
|
|
517
528
|
}));
|
|
518
529
|
};
|
|
519
530
|
const scopeKey = (mount) => mount.scope === "global" ? "global" : `workspace:${mount.workspaceId}`;
|
|
520
|
-
/**
|
|
521
|
-
* What a global or workspace scope loads: one identity per facet entry in that scope.
|
|
522
|
-
* The URL changes with package content; `selection` carries ownership and the root's
|
|
523
|
-
* default mode, so a modes.yaml change that moves a facet in or out remounts too.
|
|
524
|
-
*/
|
|
525
|
-
const scopeIdentities = (root, scope, entries) => {
|
|
526
|
-
const { majorMode, activeLayers } = defaultSelection(root);
|
|
527
|
-
return entries.filter((entry) => entry.scopes.includes(scope)).map((entry) => ({
|
|
528
|
-
module: entry.module,
|
|
529
|
-
url: entry.url,
|
|
530
|
-
selection: JSON.stringify([
|
|
531
|
-
entry.owners,
|
|
532
|
-
entry.required === true,
|
|
533
|
-
majorMode,
|
|
534
|
-
activeLayers
|
|
535
|
-
])
|
|
536
|
-
}));
|
|
537
|
-
};
|
|
538
531
|
const scopeChecks = /* @__PURE__ */ new Map();
|
|
539
532
|
/**
|
|
540
|
-
* The reload check for one
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
* one scope run one at a time; a
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
* ponytail: no fs.watch. A rebuilt local package takes effect at the next session or
|
|
548
|
-
* admission. Watch the declared entries (see packageUrl's declaredTargets) and call this
|
|
549
|
-
* when workspace routes must update without opening a session.
|
|
533
|
+
* The reload check for one served global or workspace scope: recompute its package URLs
|
|
534
|
+
* and, only when they changed, load the new set and install it. Unchanged URLs come from
|
|
535
|
+
* the module cache and the scope skips them, so only changed packages import and restart;
|
|
536
|
+
* a package no longer selected stays installed. A scope this server has not served yet is
|
|
537
|
+
* left to its admission. Checks of one scope run one at a time; a changed package whose
|
|
538
|
+
* new build fails gets its previous build back, and the check retries next time. Runs on a
|
|
539
|
+
* watched change, a finished sync and an upm change, never on the session path.
|
|
550
540
|
*/
|
|
551
541
|
const checkScope = (root, mount) => {
|
|
552
542
|
const key = scopeKey(mount);
|
|
@@ -556,15 +546,15 @@ async function runServerRuntime(options, runtime) {
|
|
|
556
546
|
} catch (error) {
|
|
557
547
|
notice(`Web build check failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
558
548
|
}
|
|
559
|
-
const change =
|
|
549
|
+
const change = await bundler.diffScope(key, root, mount.scope);
|
|
560
550
|
if (change.first || change.changed.length === 0 && change.reselected.length === 0 && change.removed.length === 0) return;
|
|
561
551
|
const bundle = await loadComposition(root, mount.scope);
|
|
562
|
-
await hub.
|
|
563
|
-
|
|
552
|
+
await hub.installPackages(mount, bundle.packages);
|
|
553
|
+
bundler.commitScope(key, root, mount.scope, bundle.entries);
|
|
564
554
|
idleRestart.supersede(change.superseded);
|
|
565
555
|
publishWebMount(mount, root);
|
|
566
556
|
publishNativeMount(mount, root);
|
|
567
|
-
notice(`Reloaded ${mount.scope === "global" ? "global" : `workspace '${mount.workspaceId}'`}
|
|
557
|
+
notice(`Reloaded ${mount.scope === "global" ? "global" : `workspace '${mount.workspaceId}'`} packages (${String(change.changed.length)} changed, ${String(change.removed.length)} no longer selected).`);
|
|
568
558
|
}).catch((error) => notice(`Extension check of ${key} failed and retries at the next check: ${error instanceof Error ? error.message : String(error)}`));
|
|
569
559
|
scopeChecks.set(key, settled);
|
|
570
560
|
settled.then(() => {
|
|
@@ -574,16 +564,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
574
564
|
};
|
|
575
565
|
const loadSessionMcp = async (root, selection) => {
|
|
576
566
|
return telemetry.runInSpan("po_server.mcp_bundle_load", {}, async () => {
|
|
577
|
-
const entries =
|
|
578
|
-
const candidates = require_mcpBundle.mcpPluginCandidates(liveCompositions(root));
|
|
579
|
-
for (const { declaration, module, owners } of candidates) entries.push({
|
|
580
|
-
packageName: declaration.packageName,
|
|
581
|
-
...declaration.ui === void 0 ? {} : { widgets: declaration.ui.widgets },
|
|
582
|
-
entry: declaration.entry,
|
|
583
|
-
module,
|
|
584
|
-
url: await packageUrls.urlFor(module),
|
|
585
|
-
owners
|
|
586
|
-
});
|
|
567
|
+
const { candidates, entries } = await bundler.mcpEntries(root);
|
|
587
568
|
let app;
|
|
588
569
|
try {
|
|
589
570
|
app = require_mcpAppBuild.readMcpAppBuild({
|
|
@@ -605,8 +586,8 @@ async function runServerRuntime(options, runtime) {
|
|
|
605
586
|
activeLayers: selection.activeLayers,
|
|
606
587
|
retainCandidates: true,
|
|
607
588
|
onNotice: notice,
|
|
608
|
-
poisoned:
|
|
609
|
-
importer:
|
|
589
|
+
poisoned: bundler.poisoned,
|
|
590
|
+
importer: bundler.importer
|
|
610
591
|
});
|
|
611
592
|
});
|
|
612
593
|
};
|
|
@@ -678,27 +659,22 @@ async function runServerRuntime(options, runtime) {
|
|
|
678
659
|
redirect: "manual"
|
|
679
660
|
}));
|
|
680
661
|
},
|
|
681
|
-
|
|
682
|
-
if (!cockpit
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
"x-po-
|
|
687
|
-
|
|
688
|
-
"x-po-api-caller-locality": "remote",
|
|
689
|
-
"x-po-api-caller-device-id": deviceId,
|
|
690
|
-
"x-po-api-caller-step-up": "not-required"
|
|
691
|
-
}
|
|
692
|
-
} });
|
|
662
|
+
acceptProtocol: (pathname, link, deviceId) => {
|
|
663
|
+
if (!cockpit) throw new Error("The headless protocol listener is not ready.");
|
|
664
|
+
return cockpit.acceptProtocol(pathname, link, {
|
|
665
|
+
"x-po-api-caller-locality": "remote",
|
|
666
|
+
"x-po-api-caller-device-id": deviceId,
|
|
667
|
+
"x-po-api-caller-step-up": "not-required"
|
|
668
|
+
});
|
|
693
669
|
}
|
|
694
670
|
});
|
|
695
|
-
await hub.
|
|
671
|
+
await hub.serveScope({
|
|
696
672
|
...sharedApiContext,
|
|
697
673
|
scope: "global",
|
|
698
674
|
requestReceipts: requestReceipts.receipts,
|
|
699
675
|
remoteControl: { fetch: (request) => remoteRuntime.fetchLocal(request) }
|
|
700
|
-
});
|
|
701
|
-
|
|
676
|
+
}, globalBundle.packages);
|
|
677
|
+
bundler.commitScope("global", globalRoot, "global", globalBundle.entries);
|
|
702
678
|
refreshWebBuild();
|
|
703
679
|
syncCheckpoint(globalRoot, "The global scope");
|
|
704
680
|
if (!backgroundSync.syncing) backgroundSync.request("server start");
|
|
@@ -717,10 +693,6 @@ async function runServerRuntime(options, runtime) {
|
|
|
717
693
|
const renamed = record !== void 0 && name !== record.name;
|
|
718
694
|
const existing = hub.workspaces().find((workspace) => workspace.id === id);
|
|
719
695
|
if (existing !== void 0 && existing.available !== false && existing.root === root) {
|
|
720
|
-
await checkScope(root, {
|
|
721
|
-
scope: "workspace",
|
|
722
|
-
workspaceId: id
|
|
723
|
-
});
|
|
724
696
|
syncCheckpoint(root, workspaceLabel(root, name));
|
|
725
697
|
if (renamed) {
|
|
726
698
|
workspaces.add({
|
|
@@ -757,15 +729,15 @@ async function runServerRuntime(options, runtime) {
|
|
|
757
729
|
});
|
|
758
730
|
const admission = (async () => {
|
|
759
731
|
const bundle = await loadComposition(root, "workspace");
|
|
760
|
-
await hub.
|
|
732
|
+
await hub.serveScope({
|
|
761
733
|
...sharedApiContext,
|
|
762
734
|
scope: "workspace",
|
|
763
735
|
workspaceId: id,
|
|
764
736
|
workspaceRoot: root,
|
|
765
737
|
cwd: root,
|
|
766
738
|
resolveRepository: (requestedId) => requestedId === id ? root : void 0
|
|
767
|
-
});
|
|
768
|
-
|
|
739
|
+
}, bundle.packages);
|
|
740
|
+
bundler.commitScope(`workspace:${id}`, root, "workspace", bundle.entries);
|
|
769
741
|
try {
|
|
770
742
|
refreshWebBuild();
|
|
771
743
|
publishWebMount({
|
|
@@ -864,20 +836,14 @@ async function runServerRuntime(options, runtime) {
|
|
|
864
836
|
return {
|
|
865
837
|
cwd: policyOptions.cwd,
|
|
866
838
|
repoRoot: policyOptions.repoRoot,
|
|
839
|
+
platform,
|
|
867
840
|
sessionId: identity.sessionId,
|
|
868
841
|
workspaceId: workspace.id,
|
|
869
842
|
groupingRoot: workspace.root,
|
|
870
843
|
sessionName: identity.sessionName,
|
|
871
844
|
...explicit.initialFastMode === void 0 ? {} : { initialFastMode: explicit.initialFastMode },
|
|
872
845
|
...explicit.initialAgentLocked === void 0 ? {} : { initialAgentLocked: explicit.initialAgentLocked },
|
|
873
|
-
|
|
874
|
-
scope: "session",
|
|
875
|
-
sessionId: identity.sessionId
|
|
876
|
-
}, workspace.root),
|
|
877
|
-
nativeComposition: publishNativeMount({
|
|
878
|
-
scope: "session",
|
|
879
|
-
sessionId: identity.sessionId
|
|
880
|
-
}, workspace.root),
|
|
846
|
+
...explicit.resume ? { resume: true } : {},
|
|
881
847
|
...identity.parentSessionId === void 0 ? {} : { parentSessionId: identity.parentSessionId },
|
|
882
848
|
...identity.sessionProvenance === void 0 ? {} : { sessionProvenance: identity.sessionProvenance },
|
|
883
849
|
agentArgs: policyOptions.piArgs,
|
|
@@ -909,7 +875,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
909
875
|
};
|
|
910
876
|
},
|
|
911
877
|
candidates: bundle.entries,
|
|
912
|
-
providerOverrides: () => (0,
|
|
878
|
+
providerOverrides: () => (0, _agimon_ai_po_core_serverPlugin.selectedServerProviderOverrides)(bundle.packages, sessionEnvironment),
|
|
913
879
|
requiredServerPackages: async () => {
|
|
914
880
|
const harness = (0, _agimon_ai_po_config_harnessStore.loadHarnessState)(sessionEnvironment).state;
|
|
915
881
|
if (!harness.hooks) return [];
|
|
@@ -934,14 +900,16 @@ async function runServerRuntime(options, runtime) {
|
|
|
934
900
|
onNotice: notice
|
|
935
901
|
};
|
|
936
902
|
};
|
|
937
|
-
mountSessionApis = (sessionOptions, host) => (0, _agimon_ai_po_core_packageApiServer.serveSessionApis)({
|
|
903
|
+
mountSessionApis = async (sessionOptions, host) => (0, _agimon_ai_po_core_packageApiServer.serveSessionApis)({
|
|
904
|
+
parentScope: await hub.sessionParentScope(sessionOptions.workspaceId),
|
|
938
905
|
sessionId: sessionOptions.sessionId,
|
|
906
|
+
platform,
|
|
939
907
|
cwd: sessionOptions.cwd,
|
|
940
908
|
environment: sessionOptions.environment,
|
|
941
909
|
directEvents: hub.directEvents,
|
|
942
910
|
requestApi: (mount, basePath, request) => hub.requestApi(mount, basePath, request),
|
|
943
911
|
publishActivity: (activity) => hub.setSessionActivity?.(sessionOptions.sessionId, activity),
|
|
944
|
-
shareFile: (filePath, label) => remoteRuntime === void 0 ? Promise.reject(new Error(_agimon_ai_po_core_packageApi.
|
|
912
|
+
shareFile: (filePath, label) => remoteRuntime === void 0 ? Promise.reject(new Error(_agimon_ai_po_core_packageApi.PO_SHARE_FILE_REMOTE_OFF_MESSAGE)) : remoteRuntime.fileShares.mint({
|
|
945
913
|
sessionId: sessionOptions.sessionId,
|
|
946
914
|
cwd: sessionOptions.cwd,
|
|
947
915
|
path: filePath,
|
|
@@ -968,10 +936,11 @@ async function runServerRuntime(options, runtime) {
|
|
|
968
936
|
sessionService: hub.sessionService,
|
|
969
937
|
mediaArbitration,
|
|
970
938
|
executionBudget,
|
|
939
|
+
editPresence: hub.editPresence,
|
|
971
940
|
peerAgents,
|
|
972
941
|
pluginRegistry: hub.pluginRegistry,
|
|
973
942
|
apis: [],
|
|
974
|
-
|
|
943
|
+
packages: pendingSessions.get(sessionOptions.sessionId)?.bundle.packages ?? [],
|
|
975
944
|
workspaceId: sessionOptions.workspaceId,
|
|
976
945
|
workspaceRoot: sessionOptions.repoRoot,
|
|
977
946
|
...host.sessionContext === void 0 ? {} : { sessionContext: host.sessionContext },
|
|
@@ -985,11 +954,11 @@ async function runServerRuntime(options, runtime) {
|
|
|
985
954
|
})
|
|
986
955
|
};
|
|
987
956
|
},
|
|
988
|
-
|
|
957
|
+
preparePackages: (root) => {
|
|
989
958
|
sessionServiceRoots.set(host, root);
|
|
990
|
-
host.
|
|
959
|
+
host.preparePackages(root);
|
|
991
960
|
},
|
|
992
|
-
|
|
961
|
+
activatePackages: host.activatePackages,
|
|
993
962
|
canDispatch: host.canDispatch,
|
|
994
963
|
telemetry,
|
|
995
964
|
onNotice: notice
|
|
@@ -1088,6 +1057,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
1088
1057
|
};
|
|
1089
1058
|
const inheritedWorkspaceId = groupingWorkspaceId ?? (request.parentSessionId ? hub.session(request.parentSessionId)?.workspaceId ?? openSessions.list().find((record) => record.sessionId === request.parentSessionId)?.workspaceId : void 0);
|
|
1090
1059
|
const explicit = require_sessionArguments.sessionSelectionArgs(request);
|
|
1060
|
+
const openStartedAt = Date.now();
|
|
1091
1061
|
const start = (async () => {
|
|
1092
1062
|
const parent = request.parentSessionId !== void 0 && (sessionId === void 0 || request.reservationId !== void 0) ? sessionManager.get(request.parentSessionId) : void 0;
|
|
1093
1063
|
let initialFastMode;
|
|
@@ -1097,7 +1067,6 @@ async function runServerRuntime(options, runtime) {
|
|
|
1097
1067
|
initialFastMode = state.fastMode;
|
|
1098
1068
|
}
|
|
1099
1069
|
const childIdentity = require_sessionArguments.resolveSessionIdentity([], identity);
|
|
1100
|
-
if (sessionId !== void 0 && request.reservationId === void 0) childIdentity.agentArgs.push("--session", node_path.default.join(serverDirectory, "sessions", "durable-v1", `${childIdentity.identity.sessionId}.sqlite`));
|
|
1101
1070
|
const childEnvironment = {
|
|
1102
1071
|
...baseEnvironment,
|
|
1103
1072
|
...request.environment
|
|
@@ -1105,15 +1074,8 @@ async function runServerRuntime(options, runtime) {
|
|
|
1105
1074
|
for (const key of [_agimon_ai_po_config_harnessStore.HARNESS_STATE_POINTER, ...Object.values(_agimon_ai_po_config_harnessState.HARNESS_STATE_KEYS)]) delete childEnvironment[key];
|
|
1106
1075
|
const workspace = inheritedWorkspaceId === void 0 ? await admitWorkspace(request.cwd) : hub.workspaces().find((candidate) => candidate.id === inheritedWorkspaceId && candidate.available !== false);
|
|
1107
1076
|
if (workspace === void 0) throw new Error("The session workspace is unavailable.");
|
|
1108
|
-
await checkScope(globalRoot, { scope: "global" });
|
|
1109
1077
|
syncCheckpoint(globalRoot, "The global scope");
|
|
1110
|
-
if (inheritedWorkspaceId !== void 0)
|
|
1111
|
-
await checkScope(workspace.root, {
|
|
1112
|
-
scope: "workspace",
|
|
1113
|
-
workspaceId: workspace.id
|
|
1114
|
-
});
|
|
1115
|
-
syncCheckpoint(workspace.root, workspaceLabel(workspace.root, workspace.name));
|
|
1116
|
-
}
|
|
1078
|
+
if (inheritedWorkspaceId !== void 0) syncCheckpoint(workspace.root, workspaceLabel(workspace.root, workspace.name));
|
|
1117
1079
|
const member = isMemberCheckout(request.cwd, workspace);
|
|
1118
1080
|
const childContext = await require_harnessContext.buildHarnessContext(resolveHarnessOptions({
|
|
1119
1081
|
args: [
|
|
@@ -1156,6 +1118,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
1156
1118
|
pinned: explicit.pinned,
|
|
1157
1119
|
...initialFastMode === void 0 ? {} : { initialFastMode },
|
|
1158
1120
|
...request.reservationId === void 0 ? {} : { initialAgentLocked: true },
|
|
1121
|
+
...sessionId !== void 0 && request.reservationId === void 0 ? { resume: true } : {},
|
|
1159
1122
|
...request.selection?.minorModes === void 0 ? {} : { minorModes: request.selection.minorModes },
|
|
1160
1123
|
...request.tools === void 0 ? {} : { allowedTools: request.tools }
|
|
1161
1124
|
}));
|
|
@@ -1170,7 +1133,8 @@ async function runServerRuntime(options, runtime) {
|
|
|
1170
1133
|
name: created.name,
|
|
1171
1134
|
createdAt: created.createdAt,
|
|
1172
1135
|
...created.parentSessionId === void 0 ? {} : { parentSessionId: created.parentSessionId },
|
|
1173
|
-
...created.sessionProvenance === void 0 ? {} : { sessionProvenance: created.sessionProvenance }
|
|
1136
|
+
...created.sessionProvenance === void 0 ? {} : { sessionProvenance: created.sessionProvenance },
|
|
1137
|
+
...created.groups === void 0 || created.groups.length === 0 ? {} : { groups: [...created.groups] }
|
|
1174
1138
|
}) === false) throw new Error("The new session could not be durably recorded.");
|
|
1175
1139
|
}
|
|
1176
1140
|
return {
|
|
@@ -1187,6 +1151,10 @@ async function runServerRuntime(options, runtime) {
|
|
|
1187
1151
|
throw error;
|
|
1188
1152
|
}
|
|
1189
1153
|
})();
|
|
1154
|
+
start.then(() => "success", () => "failure").then((outcome) => telemetry.recordEvent("po_server.session_open", {
|
|
1155
|
+
duration_ms: Date.now() - openStartedAt,
|
|
1156
|
+
outcome
|
|
1157
|
+
})).catch((error) => rawNotice(`session open telemetry failed: ${String(error)}`));
|
|
1190
1158
|
if (request.reservationId !== void 0) reservedOpens.set(identity.sessionId, start);
|
|
1191
1159
|
try {
|
|
1192
1160
|
return await start;
|
|
@@ -1195,6 +1163,8 @@ async function runServerRuntime(options, runtime) {
|
|
|
1195
1163
|
}
|
|
1196
1164
|
};
|
|
1197
1165
|
const checkAllScopes = async () => {
|
|
1166
|
+
bundler.invalidate();
|
|
1167
|
+
syncCheckpoints.invalidate();
|
|
1198
1168
|
await checkScope(globalRoot, { scope: "global" });
|
|
1199
1169
|
for (const workspace of hub.workspaces()) if (workspace.available !== false) await checkScope(workspace.root, {
|
|
1200
1170
|
scope: "workspace",
|
|
@@ -1205,7 +1175,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
1205
1175
|
/**
|
|
1206
1176
|
* A finished background sync goes through the same live reload: the read-only refresh
|
|
1207
1177
|
* republishes a changed build, and each scope re-imports only packages whose URLs moved.
|
|
1208
|
-
* Session
|
|
1178
|
+
* Session packages and the MCP app switch at the next session. The warnings are re-read
|
|
1209
1179
|
* without requesting another sync, so a sync that could not fix a root never loops.
|
|
1210
1180
|
*/
|
|
1211
1181
|
pickUpSync = async () => {
|
|
@@ -1213,12 +1183,21 @@ async function runServerRuntime(options, runtime) {
|
|
|
1213
1183
|
syncCheckpoint(globalRoot, "The global scope", false);
|
|
1214
1184
|
for (const workspace of hub.workspaces()) if (workspace.available !== false) syncCheckpoint(workspace.root, workspaceLabel(workspace.root, workspace.name), false);
|
|
1215
1185
|
};
|
|
1186
|
+
pickUpChange = () => {
|
|
1187
|
+
pickUpSync().catch((error) => notice(`Extension reload failed: ${String(error)}`));
|
|
1188
|
+
};
|
|
1216
1189
|
});
|
|
1217
1190
|
const workspaceResumes = /* @__PURE__ */ new Map();
|
|
1191
|
+
const reportedUnreadable = /* @__PURE__ */ new Set();
|
|
1192
|
+
const unreadableHistory = (sessionId, error) => {
|
|
1193
|
+
if (reportedUnreadable.has(sessionId)) return;
|
|
1194
|
+
reportedUnreadable.add(sessionId);
|
|
1195
|
+
notice(`Saved session ${sessionId} is hidden from History: ${error instanceof Error ? error.message : String(error)}`);
|
|
1196
|
+
};
|
|
1218
1197
|
const savedHistory = async (workspaceId) => {
|
|
1219
1198
|
const root = hub.workspaces().find((workspace) => workspace.id === workspaceId && workspace.available !== false)?.root;
|
|
1220
1199
|
if (!root) throw new Error("Workspace not found.");
|
|
1221
|
-
return (0, _agimon_ai_po_core_history.listSavedSessionRecords)(
|
|
1200
|
+
return (0, _agimon_ai_po_core_history.listSavedSessionRecords)(platform.sessions, root, new Set(hub.snapshot().map((active) => active.id)), workspaceId, unreadableHistory);
|
|
1222
1201
|
};
|
|
1223
1202
|
const validateExecution = (target, workspaceId) => {
|
|
1224
1203
|
const root = hub.workspaces().find((workspace) => workspace.id === workspaceId && workspace.available !== false)?.root;
|
|
@@ -1235,6 +1214,9 @@ async function runServerRuntime(options, runtime) {
|
|
|
1235
1214
|
...record.parentSessionId === void 0 ? {} : { parentSessionId: record.parentSessionId },
|
|
1236
1215
|
...record.sessionProvenance === void 0 ? {} : { sessionProvenance: record.sessionProvenance }
|
|
1237
1216
|
}, record.sessionId, record.workspaceId);
|
|
1217
|
+
const groups = record.groups ?? [];
|
|
1218
|
+
const opened = hub.session(record.sessionId)?.groups ?? [];
|
|
1219
|
+
if (groups.length !== opened.length || groups.some((group, index) => opened[index] !== group)) await hub.runtime(record.sessionId)?.setGroups(groups);
|
|
1238
1220
|
};
|
|
1239
1221
|
cockpit = await (0, _agimon_ai_po_core_headlessServer.serveHeadlessServer)({
|
|
1240
1222
|
port: options.webPort,
|
|
@@ -1271,14 +1253,14 @@ async function runServerRuntime(options, runtime) {
|
|
|
1271
1253
|
sessionHistory: (session) => {
|
|
1272
1254
|
const workspaceRoot = hub.workspaces().find((workspace) => workspace.id === session.workspaceId)?.root;
|
|
1273
1255
|
if (!workspaceRoot) throw new Error("Session workspace not found.");
|
|
1274
|
-
return (0, _agimon_ai_po_core_history.listSavedSessions)(
|
|
1256
|
+
return (0, _agimon_ai_po_core_history.listSavedSessions)(platform.sessions, workspaceRoot, new Set(hub.snapshot().map((active) => active.id)), session.workspaceId, unreadableHistory);
|
|
1275
1257
|
},
|
|
1276
1258
|
readDormantTranscript: (record, request, context) => {
|
|
1277
1259
|
const workspaceRoot = hub.workspaces().find((workspace) => workspace.id === record.workspaceId)?.root;
|
|
1278
1260
|
if (!workspaceRoot || record.groupingRoot !== void 0 && record.groupingRoot !== workspaceRoot) throw new Error("Saved transcript unavailable.");
|
|
1279
1261
|
const owner = node_fs.default.realpathSync(require_index$1.findRepositoryRoot(record.cwd));
|
|
1280
1262
|
if (record.repoRoot !== void 0 && record.repoRoot !== owner) throw new Error("Saved transcript checkout has changed.");
|
|
1281
|
-
return (0, _agimon_ai_po_core_history.readSqliteTranscript)(
|
|
1263
|
+
return (0, _agimon_ai_po_core_history.readSqliteTranscript)(platform.sessions, record.sessionId, request, context, {
|
|
1282
1264
|
sessionId: record.sessionId,
|
|
1283
1265
|
workspaceRoot: owner,
|
|
1284
1266
|
workspaceId: record.workspaceId,
|
|
@@ -1324,6 +1306,12 @@ async function runServerRuntime(options, runtime) {
|
|
|
1324
1306
|
},
|
|
1325
1307
|
dormantSessions: () => openSessions.list(),
|
|
1326
1308
|
removeDormantSession: (record) => openSessions.remove(record.sessionId),
|
|
1309
|
+
setDormantGroups: (record, groups) => {
|
|
1310
|
+
if (!openSessions.add({
|
|
1311
|
+
...record,
|
|
1312
|
+
groups: [...groups]
|
|
1313
|
+
})) throw new Error("The session groups could not be durably recorded.");
|
|
1314
|
+
},
|
|
1327
1315
|
reviveSession: reviveRecord,
|
|
1328
1316
|
requestAsset: (request) => webCompositions?.request(request) ?? Promise.resolve(void 0),
|
|
1329
1317
|
compositions: () => {
|
|
@@ -1397,6 +1385,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
1397
1385
|
stopIdleRestartPoke();
|
|
1398
1386
|
stopResourceMonitor();
|
|
1399
1387
|
executionBudget.close();
|
|
1388
|
+
watcher.close();
|
|
1400
1389
|
stopPersistSessionNames();
|
|
1401
1390
|
clearInterval(eventLoopMonitor);
|
|
1402
1391
|
await bounded(telemetry.recordEvent("po_server.shutdown"), "shutdown telemetry", notice);
|