@mono-agent/agent-app 0.20.14 → 0.21.0
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 +227 -80
- package/dist/adapter-send-tools.d.ts +3 -2
- package/dist/adapter-send-tools.d.ts.map +1 -1
- package/dist/adapter-send-tools.js +15 -5
- package/dist/adapter-send-tools.js.map +1 -1
- package/dist/app-controller-channels.d.ts +2 -0
- package/dist/app-controller-channels.d.ts.map +1 -1
- package/dist/app-controller-channels.js +10 -1
- package/dist/app-controller-channels.js.map +1 -1
- package/dist/app-controller-maintenance.d.ts +3 -1
- package/dist/app-controller-maintenance.d.ts.map +1 -1
- package/dist/app-controller-maintenance.js +3 -0
- package/dist/app-controller-maintenance.js.map +1 -1
- package/dist/app-controller-responder.d.ts +2 -0
- package/dist/app-controller-responder.d.ts.map +1 -1
- package/dist/app-controller-responder.js +21 -17
- package/dist/app-controller-responder.js.map +1 -1
- package/dist/app-controller-traceability.d.ts.map +1 -1
- package/dist/app-controller-traceability.js +3 -0
- package/dist/app-controller-traceability.js.map +1 -1
- package/dist/app-controller-types.d.ts +1 -0
- package/dist/app-controller-types.d.ts.map +1 -1
- package/dist/app-controller.d.ts +2 -0
- package/dist/app-controller.d.ts.map +1 -1
- package/dist/app-controller.js +3 -0
- package/dist/app-controller.js.map +1 -1
- package/dist/artifact-retention.js +11 -0
- package/dist/artifact-retention.js.map +1 -1
- package/dist/background.d.ts +0 -6
- package/dist/background.d.ts.map +1 -1
- package/dist/background.js +5 -58
- package/dist/background.js.map +1 -1
- package/dist/channel-drivers/tui.d.ts +2 -2
- package/dist/channel-drivers/tui.d.ts.map +1 -1
- package/dist/channel-drivers/tui.js +27 -8
- package/dist/channel-drivers/tui.js.map +1 -1
- package/dist/cli-args.d.ts +4 -5
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +20 -19
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-background-command.d.ts.map +1 -1
- package/dist/cli-background-command.js +4 -0
- package/dist/cli-background-command.js.map +1 -1
- package/dist/cli-commands.d.ts.map +1 -1
- package/dist/cli-commands.js +13 -2
- package/dist/cli-commands.js.map +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +33 -19
- package/dist/cli-help.js.map +1 -1
- package/dist/cli-init-command.d.ts.map +1 -1
- package/dist/cli-init-command.js +26 -22
- package/dist/cli-init-command.js.map +1 -1
- package/dist/cli-install-skill-command.d.ts.map +1 -1
- package/dist/cli-install-skill-command.js +12 -3
- package/dist/cli-install-skill-command.js.map +1 -1
- package/dist/config-reference.d.ts +1 -0
- package/dist/config-reference.d.ts.map +1 -1
- package/dist/config-reference.js +66 -10
- package/dist/config-reference.js.map +1 -1
- package/dist/configured-agent.d.ts +9 -1
- package/dist/configured-agent.d.ts.map +1 -1
- package/dist/configured-agent.js +95 -29
- package/dist/configured-agent.js.map +1 -1
- package/dist/cron-control-store.d.ts.map +1 -1
- package/dist/cron-control-store.js +4 -2
- package/dist/cron-control-store.js.map +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +215 -45
- package/dist/doctor.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interaction-bridge.d.ts +3 -3
- package/dist/interaction-bridge.d.ts.map +1 -1
- package/dist/interaction-bridge.js +27 -10
- package/dist/interaction-bridge.js.map +1 -1
- package/dist/launchd.d.ts +2 -0
- package/dist/launchd.d.ts.map +1 -1
- package/dist/launchd.js +3 -0
- package/dist/launchd.js.map +1 -1
- package/dist/local-tui-session.d.ts +14 -0
- package/dist/local-tui-session.d.ts.map +1 -0
- package/dist/local-tui-session.js +100 -0
- package/dist/local-tui-session.js.map +1 -0
- package/dist/mcp-apps.d.ts.map +1 -1
- package/dist/mcp-apps.js +3 -0
- package/dist/mcp-apps.js.map +1 -1
- package/dist/memory-journal.d.ts +53 -0
- package/dist/memory-journal.d.ts.map +1 -0
- package/dist/memory-journal.js +586 -0
- package/dist/memory-journal.js.map +1 -0
- package/dist/memory-recall.d.ts.map +1 -1
- package/dist/memory-recall.js +16 -2
- package/dist/memory-recall.js.map +1 -1
- package/dist/memory-retrieval.d.ts +9 -0
- package/dist/memory-retrieval.d.ts.map +1 -1
- package/dist/memory-retrieval.js +20 -0
- package/dist/memory-retrieval.js.map +1 -1
- package/dist/modules/base.js +1 -1
- package/dist/modules/base.js.map +1 -1
- package/dist/modules/known-tools.d.ts +1 -1
- package/dist/modules/known-tools.d.ts.map +1 -1
- package/dist/modules/known-tools.js +1 -0
- package/dist/modules/known-tools.js.map +1 -1
- package/dist/monitors-command.js +12 -2
- package/dist/monitors-command.js.map +1 -1
- package/dist/monitors-config.d.ts +4 -1
- package/dist/monitors-config.d.ts.map +1 -1
- package/dist/monitors-config.js +5 -1
- package/dist/monitors-config.js.map +1 -1
- package/dist/monitors-context.d.ts.map +1 -1
- package/dist/monitors-context.js +14 -2
- package/dist/monitors-context.js.map +1 -1
- package/dist/monitors-service.d.ts +2 -2
- package/dist/monitors-service.d.ts.map +1 -1
- package/dist/monitors-service.js +227 -96
- package/dist/monitors-service.js.map +1 -1
- package/dist/monitors-store.d.ts +11 -1
- package/dist/monitors-store.d.ts.map +1 -1
- package/dist/monitors-store.js +36 -6
- package/dist/monitors-store.js.map +1 -1
- package/dist/notify-destinations.d.ts +3 -2
- package/dist/notify-destinations.d.ts.map +1 -1
- package/dist/notify-destinations.js +6 -7
- package/dist/notify-destinations.js.map +1 -1
- package/dist/posted-reply-history.d.ts.map +1 -1
- package/dist/posted-reply-history.js +40 -3
- package/dist/posted-reply-history.js.map +1 -1
- package/dist/proactive-notify.d.ts +20 -1
- package/dist/proactive-notify.d.ts.map +1 -1
- package/dist/proactive-notify.js +56 -3
- package/dist/proactive-notify.js.map +1 -1
- package/dist/process-job-channel-routing.js +2 -1
- package/dist/process-job-channel-routing.js.map +1 -1
- package/dist/process-job-output-tail.d.ts +53 -0
- package/dist/process-job-output-tail.d.ts.map +1 -0
- package/dist/process-job-output-tail.js +257 -0
- package/dist/process-job-output-tail.js.map +1 -0
- package/dist/process-jobs-config.d.ts +1 -1
- package/dist/process-jobs-config.js +1 -1
- package/dist/process-jobs-config.js.map +1 -1
- package/dist/process-jobs-context.d.ts +3 -1
- package/dist/process-jobs-context.d.ts.map +1 -1
- package/dist/process-jobs-context.js +44 -11
- package/dist/process-jobs-context.js.map +1 -1
- package/dist/process-jobs-runtime.d.ts.map +1 -1
- package/dist/process-jobs-runtime.js +14 -0
- package/dist/process-jobs-runtime.js.map +1 -1
- package/dist/process-jobs-service.d.ts.map +1 -1
- package/dist/process-jobs-service.js +115 -23
- package/dist/process-jobs-service.js.map +1 -1
- package/dist/process-jobs-store.d.ts +3 -1
- package/dist/process-jobs-store.d.ts.map +1 -1
- package/dist/process-jobs-store.js +4 -1
- package/dist/process-jobs-store.js.map +1 -1
- package/dist/process-output-redaction.d.ts +26 -1
- package/dist/process-output-redaction.d.ts.map +1 -1
- package/dist/process-output-redaction.js +164 -2
- package/dist/process-output-redaction.js.map +1 -1
- package/dist/project-skills.d.ts +11 -5
- package/dist/project-skills.d.ts.map +1 -1
- package/dist/project-skills.js +88 -39
- package/dist/project-skills.js.map +1 -1
- package/dist/provider-auth-checks.d.ts +27 -0
- package/dist/provider-auth-checks.d.ts.map +1 -0
- package/dist/provider-auth-checks.js +349 -0
- package/dist/provider-auth-checks.js.map +1 -0
- package/dist/provider-auth-observations.d.ts +22 -0
- package/dist/provider-auth-observations.d.ts.map +1 -0
- package/dist/provider-auth-observations.js +139 -0
- package/dist/provider-auth-observations.js.map +1 -0
- package/dist/provider-auth-operator.d.ts +19 -0
- package/dist/provider-auth-operator.d.ts.map +1 -0
- package/dist/provider-auth-operator.js +560 -0
- package/dist/provider-auth-operator.js.map +1 -0
- package/dist/provider-auth-status.d.ts +20 -0
- package/dist/provider-auth-status.d.ts.map +1 -0
- package/dist/provider-auth-status.js +235 -0
- package/dist/provider-auth-status.js.map +1 -0
- package/dist/provider-model-catalog.d.ts +17 -0
- package/dist/provider-model-catalog.d.ts.map +1 -1
- package/dist/provider-model-catalog.js +113 -2
- package/dist/provider-model-catalog.js.map +1 -1
- package/dist/provider-setup.d.ts +22 -0
- package/dist/provider-setup.d.ts.map +1 -1
- package/dist/provider-setup.js +101 -15
- package/dist/provider-setup.js.map +1 -1
- package/dist/reply-artifacts.d.ts +3 -1
- package/dist/reply-artifacts.d.ts.map +1 -1
- package/dist/reply-artifacts.js +45 -10
- package/dist/reply-artifacts.js.map +1 -1
- package/dist/request-model-override.d.ts +11 -2
- package/dist/request-model-override.d.ts.map +1 -1
- package/dist/request-model-override.js +51 -1
- package/dist/request-model-override.js.map +1 -1
- package/dist/request-scoped-mcp.d.ts +3 -0
- package/dist/request-scoped-mcp.d.ts.map +1 -1
- package/dist/request-scoped-mcp.js +1 -1
- package/dist/request-scoped-mcp.js.map +1 -1
- package/dist/run-history.d.ts.map +1 -1
- package/dist/run-history.js +56 -13
- package/dist/run-history.js.map +1 -1
- package/dist/seen-conversations.d.ts +4 -3
- package/dist/seen-conversations.d.ts.map +1 -1
- package/dist/seen-conversations.js +6 -5
- package/dist/seen-conversations.js.map +1 -1
- package/dist/session-history.d.ts +14 -0
- package/dist/session-history.d.ts.map +1 -1
- package/dist/session-history.js +120 -5
- package/dist/session-history.js.map +1 -1
- package/dist/systemd-command.d.ts +8 -0
- package/dist/systemd-command.d.ts.map +1 -0
- package/dist/systemd-command.js +206 -0
- package/dist/systemd-command.js.map +1 -0
- package/dist/systemd.d.ts +51 -0
- package/dist/systemd.d.ts.map +1 -0
- package/dist/systemd.js +299 -0
- package/dist/systemd.js.map +1 -0
- package/dist/tool-output-artifacts.d.ts +4 -0
- package/dist/tool-output-artifacts.d.ts.map +1 -0
- package/dist/tool-output-artifacts.js +17 -0
- package/dist/tool-output-artifacts.js.map +1 -0
- package/dist/tui-command.d.ts +0 -45
- package/dist/tui-command.d.ts.map +1 -1
- package/dist/tui-command.js +27 -264
- package/dist/tui-command.js.map +1 -1
- package/dist/untrusted-text.js +2 -2
- package/dist/web-command.d.ts +3 -0
- package/dist/web-command.d.ts.map +1 -1
- package/dist/web-command.js +112 -7
- package/dist/web-command.js.map +1 -1
- package/dist/web-request-coordinator.d.ts +19 -0
- package/dist/web-request-coordinator.d.ts.map +1 -0
- package/dist/web-request-coordinator.js +242 -0
- package/dist/web-request-coordinator.js.map +1 -0
- package/dist/wizard/prompts.d.ts.map +1 -1
- package/dist/wizard/prompts.js +1 -0
- package/dist/wizard/prompts.js.map +1 -1
- package/dist/wizard/run.js +1 -1
- package/dist/wizard/run.js.map +1 -1
- package/package.json +18 -18
- package/schema/mono-agent.config.schema.json +120 -8
- package/skills/mono-agent-composer/SKILL.md +4 -4
- package/skills/mono-agent-composer/references/config-blueprint.md +18 -7
- package/skills/mono-agent-composer/references/discovery-questions.md +10 -5
- package/skills/mono-agent-composer/references/feature-coverage.md +30 -14
- package/skills/mono-agent-composer/references/package-map.md +6 -3
- package/skills/mono-agent-composer/references/playbooks.md +20 -5
- package/skills/mono-agent-composer/references/validation.md +4 -3
- package/dist/configuration-proposal-main.d.ts +0 -3
- package/dist/configuration-proposal-main.d.ts.map +0 -1
- package/dist/configuration-proposal-main.js +0 -13
- package/dist/configuration-proposal-main.js.map +0 -1
- package/dist/configuration-proposal-tool.d.ts +0 -33
- package/dist/configuration-proposal-tool.d.ts.map +0 -1
- package/dist/configuration-proposal-tool.js +0 -180
- package/dist/configuration-proposal-tool.js.map +0 -1
- package/dist/local-configuration.d.ts +0 -99
- package/dist/local-configuration.d.ts.map +0 -1
- package/dist/local-configuration.js +0 -1302
- package/dist/local-configuration.js.map +0 -1
package/dist/configured-agent.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createHostWebRequestCoordinator } from "./web-request-coordinator.js";
|
|
2
|
+
import { createAgentHarness, createSessionRuntimeResolver, createAgentResponder, acquireToolHistoryWriter, createDurableHistoryStore, createToolPolicy, loadToolPolicyFromJsonFileSync, renderSkillIndexSection, ToolHistoryReader, toolHistoryLogicalConversationId, } from "@mono-agent/agent-harness";
|
|
2
3
|
import { readFileSync } from "node:fs";
|
|
3
4
|
import { homedir } from "node:os";
|
|
4
5
|
import { resolve as resolvePath } from "node:path";
|
|
@@ -8,8 +9,10 @@ import { createCompositeRunRecorder, createJsonlRunRecorder } from "@mono-agent/
|
|
|
8
9
|
import { createPhoenixRunExporter } from "@mono-agent/observability/otel";
|
|
9
10
|
import { createMonoRuntime, createPiOAuthApiKeyResolver, createSrtSandboxEngine, describeMonoRuntimeSupport, modelReferenceKey, monoRuntimeSupportsSessionResume, parseMonoRuntimeModelReference, runtimeOptionsForLocalProvider, mergeSandboxPolicies, } from "@mono-agent/runtime-adapter";
|
|
10
11
|
import { agentArtifactDerivedRoots } from "./agent-artifact-paths.js";
|
|
12
|
+
import { createToolOutputArtifactsRuntimeExtension } from "./tool-output-artifacts.js";
|
|
11
13
|
import { acquireAgentRootOwnership, assertAgentRootLeaseOutsideWorkspace, releaseAgentRootOwnershipWhenIdle, } from "./agent-root-coordinator.js";
|
|
12
14
|
import { resolveMemoryRecallSettings } from "./memory-recall.js";
|
|
15
|
+
import { createMemoryJournalRuntimeExtension, isMemoryJournalCapableStore, isMemoryJournalToolAllowed, } from "./memory-journal.js";
|
|
13
16
|
import { BUILTIN_TOOL_NAMES, canonicalToolName, isAllowAllTools } from "./modules/known-tools.js";
|
|
14
17
|
import { createSharedMemoryRecallRuntimeExtension, isSharedRecallStore, MemoryRetrievalService, } from "./memory-retrieval.js";
|
|
15
18
|
import { createMemoryRememberRuntimeExtension, isRememberCapableStore, isRememberToolAllowed, } from "./memory-remember.js";
|
|
@@ -19,6 +22,7 @@ import { resolveProcessJobsProtectionPosture, } from "./process-jobs-protection.
|
|
|
19
22
|
import { createMonitorsRuntimeExtension, monitorsAvailableForRequest } from "./monitors-runtime.js";
|
|
20
23
|
import { createProcessJobsRuntimeExtension, processJobsAvailableForRequest, processJobsSandboxPolicy, PROCESS_JOBS_PI_NATIVE_REQUIRED_ERROR, PROCESS_JOBS_PROTECTION_UNAVAILABLE_ERROR, } from "./process-jobs-runtime.js";
|
|
21
24
|
import { attestProcessJobsRootRegistrySnapshot, loadProcessJobsRootRegistryProtection, processJobsProtectionPolicyRoots, registerProcessJobsRoot, } from "./process-jobs-root-registry.js";
|
|
25
|
+
import { activeProjectSkillSelections, isRetiredProjectSkillName } from "./project-skills.js";
|
|
22
26
|
import { isReadSkillDenied } from "./skill-registry.js";
|
|
23
27
|
import { loadSupermemoryPlugin } from "./supermemory-plugin.js";
|
|
24
28
|
/**
|
|
@@ -83,12 +87,17 @@ function withArtifactCommitHook(recorder, onCommitted, args) {
|
|
|
83
87
|
return recorder;
|
|
84
88
|
}
|
|
85
89
|
let terminalPromise;
|
|
86
|
-
const notify = (phase) => {
|
|
90
|
+
const notify = (phase, summary) => {
|
|
87
91
|
try {
|
|
88
92
|
// The cache invalidation used by the app is synchronous. Promise.resolve
|
|
89
93
|
// also contains an async implementation without delaying
|
|
90
94
|
// the JSONL/export pipeline or leaking an unhandled rejection.
|
|
91
|
-
void Promise.resolve(onCommitted({
|
|
95
|
+
void Promise.resolve(onCommitted({
|
|
96
|
+
phase,
|
|
97
|
+
runId: args.runId,
|
|
98
|
+
conversationId: args.conversationId,
|
|
99
|
+
...(summary === undefined ? {} : { summary }),
|
|
100
|
+
}))
|
|
92
101
|
.catch(() => undefined);
|
|
93
102
|
}
|
|
94
103
|
catch {
|
|
@@ -97,7 +106,7 @@ function withArtifactCommitHook(recorder, onCommitted, args) {
|
|
|
97
106
|
};
|
|
98
107
|
const commitTerminal = (operation) => {
|
|
99
108
|
terminalPromise ??= operation().then((summary) => {
|
|
100
|
-
notify("finished");
|
|
109
|
+
notify("finished", summary);
|
|
101
110
|
return summary;
|
|
102
111
|
});
|
|
103
112
|
return terminalPromise;
|
|
@@ -118,8 +127,10 @@ function withArtifactCommitHook(recorder, onCommitted, args) {
|
|
|
118
127
|
await wrapped.prepareFinish?.(result);
|
|
119
128
|
return await wrapped.commitFinish(result);
|
|
120
129
|
},
|
|
121
|
-
async fail(error) {
|
|
122
|
-
return await commitTerminal(async () =>
|
|
130
|
+
async fail(error, context) {
|
|
131
|
+
return await commitTerminal(async () => context === undefined
|
|
132
|
+
? await recorder.fail(error)
|
|
133
|
+
: await recorder.fail(error, context));
|
|
123
134
|
},
|
|
124
135
|
};
|
|
125
136
|
if (recorder.start !== undefined) {
|
|
@@ -456,6 +467,7 @@ function subagentsRuntimeOptions(config, deps) {
|
|
|
456
467
|
// milliseconds. The parent keeps working, so the degradation is invisible
|
|
457
468
|
// until you read the child's activity log.
|
|
458
469
|
...(config.tools.web?.search === undefined ? {} : { webSearchConfig: config.tools.web.search }),
|
|
470
|
+
...(config.tools.web?.coordination === "host" ? { webRequestCoordinator: createHostWebRequestCoordinator() } : {}),
|
|
459
471
|
...(config.tools.web?.fetch === undefined ? {} : { webFetchConfig: config.tools.web.fetch }),
|
|
460
472
|
// Both keys or neither: pi-bridge builds ReadSkill only when it has the
|
|
461
473
|
// names AND the root, and a half-set pair fails by silently omitting the
|
|
@@ -508,9 +520,8 @@ function fallbackChainForConfig(config, options) {
|
|
|
508
520
|
// and the router never runs — so same-model retries would silently do
|
|
509
521
|
// nothing for every agent with no configured backups. Build a retry-only
|
|
510
522
|
// single-entry chain instead whenever the primary asks for more than one
|
|
511
|
-
// attempt.
|
|
512
|
-
//
|
|
513
|
-
// provider session on the retry itself (retryIndex > 0).
|
|
523
|
+
// attempt. Both retry-only and multi-entry chains keep sessions on the
|
|
524
|
+
// primary's first attempt; the router makes later attempts stateless.
|
|
514
525
|
if (primaryAttempts <= 1) {
|
|
515
526
|
return {};
|
|
516
527
|
}
|
|
@@ -621,6 +632,11 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
621
632
|
}, {
|
|
622
633
|
suppressSandboxEngine: processJobsProtectionPosture.suppressSyntheticSandbox,
|
|
623
634
|
});
|
|
635
|
+
const runtimeForSession = createSessionRuntimeResolver({ runtime, model,
|
|
636
|
+
...(options.runtimeForModel === undefined ? {} : { runtimeForModel: options.runtimeForModel }),
|
|
637
|
+
});
|
|
638
|
+
const runtimeForModel = options.runtimeForModel === undefined ? undefined
|
|
639
|
+
: (target) => runtimeForSession(modelReferenceKey(target));
|
|
624
640
|
const clearSessionsBoundaryOptions = {
|
|
625
641
|
cwd: agentRoot,
|
|
626
642
|
workspace: config.runtime.workspace,
|
|
@@ -651,7 +667,8 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
651
667
|
// fallback-free runtime when no `memoryRuntime` is injected.
|
|
652
668
|
const configuredMemory = options.memory ?? (await createConfiguredMemoryInternal(config, { cwd: agentRoot }, processJobsProtectionPosture));
|
|
653
669
|
const memory = configuredMemoryForHarness(config, configuredMemory);
|
|
654
|
-
const
|
|
670
|
+
const memoryReadToolsEnabled = resolveMemoryRecallSettings(config) !== undefined;
|
|
671
|
+
const memoryRecall = !memoryReadToolsEnabled
|
|
655
672
|
|| !(memory instanceof MemoryRetrievalService)
|
|
656
673
|
? undefined
|
|
657
674
|
: createSharedMemoryRecallRuntimeExtension(memory, {
|
|
@@ -659,6 +676,20 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
659
676
|
? {}
|
|
660
677
|
: { onUnavailable: options.onMemoryRecallUnavailable }),
|
|
661
678
|
});
|
|
679
|
+
// Chronological enumeration shares the explicit memory-read switch with
|
|
680
|
+
// MemoryRecall, but additionally follows normal app-tool policy and requires
|
|
681
|
+
// an affirmative local capability. External search backends stay incapable.
|
|
682
|
+
const memoryJournal = !memoryReadToolsEnabled
|
|
683
|
+
|| !(memory instanceof MemoryRetrievalService)
|
|
684
|
+
|| !isMemoryJournalCapableStore(memory)
|
|
685
|
+
|| !isMemoryJournalToolAllowed(config.tools)
|
|
686
|
+
? undefined
|
|
687
|
+
: createMemoryJournalRuntimeExtension(memory, {
|
|
688
|
+
...(options.env === undefined ? {} : { env: options.env }),
|
|
689
|
+
...(options.onMemoryJournalUnavailable === undefined
|
|
690
|
+
? {}
|
|
691
|
+
: { onUnavailable: options.onMemoryJournalUnavailable }),
|
|
692
|
+
});
|
|
662
693
|
// The durable write surface is gated three ways: the store must affirm the
|
|
663
694
|
// capability (a read-only or external backend never does), the operator must
|
|
664
695
|
// not have disabled it, and tool policy must allow it. Unlike MemoryRecall it
|
|
@@ -676,6 +707,7 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
676
707
|
});
|
|
677
708
|
const composedRuntimeOptionsForRequest = composeRuntimeOptionExtensions([
|
|
678
709
|
memoryRecall,
|
|
710
|
+
memoryJournal,
|
|
679
711
|
memoryRemember,
|
|
680
712
|
options.runtimeOptionsForRequest,
|
|
681
713
|
], {
|
|
@@ -699,7 +731,7 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
699
731
|
routesOnlyPiNative: internalHooks.processJobs?.routesOnlyPiNative
|
|
700
732
|
?? (() => configuredRoutesOnlyPiNative(config, model).ok),
|
|
701
733
|
});
|
|
702
|
-
const
|
|
734
|
+
const monitoredRuntimeOptionsForRequest = createMonitorsRuntimeExtension({
|
|
703
735
|
next: processJobsRuntimeOptionsForRequest,
|
|
704
736
|
service: internalHooks.monitors?.service,
|
|
705
737
|
coreConfig: config,
|
|
@@ -710,25 +742,28 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
710
742
|
?? internalHooks.processJobs?.routesOnlyPiNative
|
|
711
743
|
?? (() => configuredRoutesOnlyPiNative(config, model).ok),
|
|
712
744
|
});
|
|
745
|
+
const toolOutputArtifactRoot = resolvePath(config.artifacts.dir, "tool-output");
|
|
746
|
+
const runtimeOptionsForRequest = createToolOutputArtifactsRuntimeExtension(monitoredRuntimeOptionsForRequest, toolOutputArtifactRoot);
|
|
713
747
|
const subagents = subagentsRuntimeOptions(config, {
|
|
714
748
|
runtime,
|
|
715
749
|
baseModel: model,
|
|
716
|
-
...(
|
|
750
|
+
...(runtimeForModel === undefined ? {} : { runtimeForModel }),
|
|
717
751
|
});
|
|
718
752
|
const runtimeOptions = mergeStaticRuntimeOptions(runtimeOptionsForLocalProvider(model, config.providers?.local), configRuntimeFlags(config), sandboxEngine === undefined ? undefined : { sandboxEngine }, subagents, options.runtimeOptions);
|
|
719
753
|
const sessionOptions = {
|
|
720
754
|
mode: config.runtime.session.mode,
|
|
721
755
|
idleTimeoutMs: config.runtime.session.idleTimeoutMs,
|
|
722
|
-
//
|
|
723
|
-
//
|
|
724
|
-
//
|
|
725
|
-
supportsResume:
|
|
726
|
-
? false
|
|
727
|
-
: supportsSessionResume(),
|
|
756
|
+
// Continuous sessions belong to the primary's first attempt. The router
|
|
757
|
+
// strips session state from retries and backups and withholds their resumable
|
|
758
|
+
// result id; an unsynchronized durable answer rotates the epoch before the next turn.
|
|
759
|
+
supportsResume: supportsSessionResume(),
|
|
728
760
|
...(config.runtime.session.isolateProactive === undefined
|
|
729
761
|
? {}
|
|
730
762
|
: { isolateProactive: config.runtime.session.isolateProactive }),
|
|
731
763
|
...(options.onSessionEvent === undefined ? {} : { onSessionEvent: options.onSessionEvent }),
|
|
764
|
+
...(options.terminalRecoverySettlementMs === undefined
|
|
765
|
+
? {}
|
|
766
|
+
: { terminalRecoverySettlementMs: options.terminalRecoverySettlementMs }),
|
|
732
767
|
};
|
|
733
768
|
const piSessionsRoot = config.providers?.piNative?.piSessionsRoot;
|
|
734
769
|
const retireDurableSession = runtime.retireDurableSession?.bind(runtime);
|
|
@@ -739,8 +774,18 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
739
774
|
...(piSessionsRoot === undefined || retireDurableSession === undefined
|
|
740
775
|
? {}
|
|
741
776
|
: {
|
|
742
|
-
retireProviderSession: async (providerSessionId) => {
|
|
743
|
-
|
|
777
|
+
retireProviderSession: async (providerSessionId, modelKey) => {
|
|
778
|
+
const owner = runtimeForSession(modelKey);
|
|
779
|
+
if (owner.retireDurableSession === undefined) {
|
|
780
|
+
throw new Error("Session owner cannot retire durable provider state.");
|
|
781
|
+
}
|
|
782
|
+
// Durable retirement detaches an open Pi handle before unlinking;
|
|
783
|
+
// ordinary invalidation alone rejects while a cancelled turn unwinds.
|
|
784
|
+
await owner.retireDurableSession(providerSessionId, piSessionsRoot);
|
|
785
|
+
if (owner.invalidateSession !== undefined)
|
|
786
|
+
await owner.invalidateSession(providerSessionId);
|
|
787
|
+
else
|
|
788
|
+
await owner.disposeSession?.(providerSessionId);
|
|
744
789
|
},
|
|
745
790
|
}),
|
|
746
791
|
});
|
|
@@ -753,7 +798,7 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
753
798
|
// create either the sidecar or its owner database.
|
|
754
799
|
const toolHistory = lazyConfiguredToolHistory({
|
|
755
800
|
root: historyRoot,
|
|
756
|
-
artifactRoot:
|
|
801
|
+
artifactRoot: toolOutputArtifactRoot,
|
|
757
802
|
rollover,
|
|
758
803
|
...(options.onToolHistoryWarning === undefined
|
|
759
804
|
? {}
|
|
@@ -765,8 +810,19 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
765
810
|
...(config.context.soulPath === undefined ? {} : { soulPath: config.context.soulPath }),
|
|
766
811
|
...(config.context.skillsRoot === undefined ? {} : { skillsRoot: config.context.skillsRoot }),
|
|
767
812
|
...(config.context.skillMaxBytes === undefined ? {} : { skillMaxBytes: config.context.skillMaxBytes }),
|
|
768
|
-
...(config.context.skillDisclosure === undefined
|
|
769
|
-
|
|
813
|
+
...(config.context.skillDisclosure === undefined
|
|
814
|
+
? {}
|
|
815
|
+
: {
|
|
816
|
+
// Index disclosure inventories every installed skill, not only selected
|
|
817
|
+
// ones. Until the explicit updater retires the legacy file, fall back
|
|
818
|
+
// to selected-body loading so that stale configure instructions cannot
|
|
819
|
+
// re-enter through ReadSkill.
|
|
820
|
+
skillDisclosure: config.context.skillDisclosure === "index"
|
|
821
|
+
&& config.context.selectedSkills.some(isRetiredProjectSkillName)
|
|
822
|
+
? "full"
|
|
823
|
+
: config.context.skillDisclosure,
|
|
824
|
+
}),
|
|
825
|
+
selectedSkills: activeProjectSkillSelections(config.context.selectedSkills),
|
|
770
826
|
runtime,
|
|
771
827
|
model,
|
|
772
828
|
cwd: config.runtime.workspace,
|
|
@@ -832,7 +888,7 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
832
888
|
capabilityIssuer: options.continuationCapabilityIssuer,
|
|
833
889
|
},
|
|
834
890
|
}),
|
|
835
|
-
...(
|
|
891
|
+
...(runtimeForModel === undefined ? {} : { runtimeForModel }),
|
|
836
892
|
...(memory === undefined ? {} : { memory }),
|
|
837
893
|
memoryWriteMode: config.memory?.writeMode ?? "disabled",
|
|
838
894
|
...(options.onMemoryWarning === undefined ? {} : { onMemoryWarning: options.onMemoryWarning }),
|
|
@@ -873,6 +929,7 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
|
|
|
873
929
|
function harnessWithAgentRootOwnership(harness, ownership) {
|
|
874
930
|
let disposePromise;
|
|
875
931
|
return {
|
|
932
|
+
...(harness.liveInputOwnership === undefined ? {} : { liveInputOwnership: harness.liveInputOwnership }),
|
|
876
933
|
run: harness.run.bind(harness),
|
|
877
934
|
...(harness.submit === undefined ? {} : { submit: harness.submit.bind(harness) }),
|
|
878
935
|
...(harness.offerLiveInput === undefined
|
|
@@ -885,6 +942,9 @@ function harnessWithAgentRootOwnership(harness, ownership) {
|
|
|
885
942
|
...(harness.appendVerbatimTurn === undefined
|
|
886
943
|
? {}
|
|
887
944
|
: { appendVerbatimTurn: harness.appendVerbatimTurn.bind(harness) }),
|
|
945
|
+
...(harness.importContext === undefined
|
|
946
|
+
? {}
|
|
947
|
+
: { importContext: harness.importContext.bind(harness) }),
|
|
888
948
|
dispose: () => {
|
|
889
949
|
disposePromise ??= Promise.resolve()
|
|
890
950
|
.then(async () => await harness.dispose?.())
|
|
@@ -1079,7 +1139,7 @@ export function lazyConfiguredToolHistory(options) {
|
|
|
1079
1139
|
}
|
|
1080
1140
|
};
|
|
1081
1141
|
},
|
|
1082
|
-
async finishRun(binding, status, failureKind) {
|
|
1142
|
+
async finishRun(binding, status, failureKind, cancellationReasonCode) {
|
|
1083
1143
|
const key = turnKey(binding.conversationId, binding.runId);
|
|
1084
1144
|
const state = turnStates.get(key);
|
|
1085
1145
|
try {
|
|
@@ -1087,7 +1147,7 @@ export function lazyConfiguredToolHistory(options) {
|
|
|
1087
1147
|
return;
|
|
1088
1148
|
const handle = await state.attempt.promise.catch(() => undefined);
|
|
1089
1149
|
try {
|
|
1090
|
-
await handle?.writer.finishRun(binding, status, failureKind);
|
|
1150
|
+
await handle?.writer.finishRun(binding, status, failureKind, cancellationReasonCode);
|
|
1091
1151
|
}
|
|
1092
1152
|
catch (error) {
|
|
1093
1153
|
if (handle === undefined)
|
|
@@ -1223,9 +1283,6 @@ async function createConfiguredAgentResponderInternal(options, internalHooks = {
|
|
|
1223
1283
|
}
|
|
1224
1284
|
/** @internal Shared only with app-local history decorators; absent from the package root. */
|
|
1225
1285
|
export const DEFAULT_HISTORY_MAX_MESSAGES = 64;
|
|
1226
|
-
function hasConfiguredFallback(config) {
|
|
1227
|
-
return (config.runtime.fallbacks?.length ?? 0) > 0;
|
|
1228
|
-
}
|
|
1229
1286
|
function supportsSessionResume() {
|
|
1230
1287
|
try {
|
|
1231
1288
|
return monoRuntimeSupportsSessionResume();
|
|
@@ -1354,6 +1411,12 @@ async function createConfiguredMemoryInternal(config, deps, protectionPosture) {
|
|
|
1354
1411
|
function runtimeHostOptionsForConfig(config) {
|
|
1355
1412
|
return {
|
|
1356
1413
|
workspace: config.runtime.workspace,
|
|
1414
|
+
...(config.tools.filesystem === undefined
|
|
1415
|
+
? {}
|
|
1416
|
+
: {
|
|
1417
|
+
additionalReadRoots: config.tools.filesystem.readableRoots,
|
|
1418
|
+
additionalWriteRoots: config.tools.filesystem.writableRoots,
|
|
1419
|
+
}),
|
|
1357
1420
|
qaOutputDir: config.artifacts.dir,
|
|
1358
1421
|
...(config.providers?.piAuthPath === undefined
|
|
1359
1422
|
? {}
|
|
@@ -1736,6 +1799,7 @@ function configRuntimeFlags(config) {
|
|
|
1736
1799
|
};
|
|
1737
1800
|
if (permissionMode === undefined
|
|
1738
1801
|
&& piNative?.transport === undefined
|
|
1802
|
+
&& piNative?.promptCacheDiagnostics === undefined
|
|
1739
1803
|
&& piNative?.piMaxRetries === undefined
|
|
1740
1804
|
&& piNative?.maxRetryDelayMs === undefined
|
|
1741
1805
|
&& compaction === undefined
|
|
@@ -1747,12 +1811,14 @@ function configRuntimeFlags(config) {
|
|
|
1747
1811
|
return {
|
|
1748
1812
|
...(permissionMode === undefined ? {} : { permissionMode }),
|
|
1749
1813
|
...(piNative?.transport === undefined ? {} : { piTransport: piNative.transport }),
|
|
1814
|
+
...(piNative?.promptCacheDiagnostics === undefined ? {} : { promptCacheDiagnostics: piNative.promptCacheDiagnostics }),
|
|
1750
1815
|
...(piNative?.piMaxRetries === undefined ? {} : { piMaxRetries: piNative.piMaxRetries }),
|
|
1751
1816
|
...(piNative?.maxRetryDelayMs === undefined ? {} : { maxRetryDelayMs: piNative.maxRetryDelayMs }),
|
|
1752
1817
|
...(compaction === undefined ? {} : { compaction }),
|
|
1753
1818
|
...(settings === undefined ? {} : { settings }),
|
|
1754
1819
|
...(webSearchConfig === undefined ? {} : { webSearchConfig }),
|
|
1755
1820
|
...(webFetchConfig === undefined ? {} : { webFetchConfig }),
|
|
1821
|
+
...(config.tools.web?.coordination === "host" ? { webRequestCoordinator: createHostWebRequestCoordinator() } : {}),
|
|
1756
1822
|
};
|
|
1757
1823
|
}
|
|
1758
1824
|
function isRuntimeOptions(value) {
|