qlogicagent 2.20.2 → 2.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-contract.js +1 -1
- package/dist/agent.js +39 -35
- package/dist/cli.js +1 -1
- package/dist/host-contract.js +1 -1
- package/dist/host-session-collection-contract.js +1 -1
- package/dist/index.js +624 -549
- package/dist/memory-category-contract.js +1 -0
- package/dist/orchestration.js +1 -1
- package/dist/project-memory-host.js +21 -21
- package/dist/protocol.js +1 -1
- package/dist/skill-category-contract.js +1 -0
- package/dist/skills/builtin/web-research/SKILL.md +37 -0
- package/dist/skills/mcp/astraclaw-native-mcp-server.js +1 -1
- package/dist/tunables.js +1 -1
- package/dist/types/agent/memory-recall-context.d.ts +6 -9
- package/dist/types/agent/memory-recall-injection.d.ts +1 -6
- package/dist/types/agent/tool-loop/agent-argument-normalizer.d.ts +12 -0
- package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +8 -0
- package/dist/types/agent/tool-loop.d.ts +5 -0
- package/dist/types/agent/types.d.ts +5 -0
- package/dist/types/cli/acp-extended-handlers.d.ts +11 -9
- package/dist/types/cli/acp-session-handlers.d.ts +1 -1
- package/dist/types/cli/acp-session-host.d.ts +8 -0
- package/dist/types/cli/agent-runtime-bootstrap.d.ts +7 -1
- package/dist/types/cli/agent-runtime-session-state.d.ts +23 -6
- package/dist/types/cli/atomic-text-file.d.ts +31 -0
- package/dist/types/cli/background-context-capsule.d.ts +12 -0
- package/dist/types/cli/base-tool-bootstrap.d.ts +1 -0
- package/dist/types/cli/cli-acp-request-handler.d.ts +3 -1
- package/dist/types/cli/community-workflow-installer.d.ts +1 -1
- package/dist/types/cli/core-tool-coordinator.d.ts +1 -0
- package/dist/types/cli/core-tools/agent-tool-service.d.ts +17 -1
- package/dist/types/cli/dev-tool-bootstrap.d.ts +3 -2
- package/dist/types/cli/dev-tools/dev-tool-bootstrap-service.d.ts +1 -0
- package/dist/types/cli/dev-tools/dev-tool-registry.d.ts +3 -1
- package/dist/types/cli/dev-tools/incremental-repo-map.d.ts +81 -0
- package/dist/types/cli/dev-tools/lsp-supervisor.d.ts +59 -0
- package/dist/types/cli/dev-tools/lsp-tool-service.d.ts +2 -0
- package/dist/types/cli/handlers/community-handler.d.ts +2 -0
- package/dist/types/cli/handlers/dream-handler.d.ts +1 -1
- package/dist/types/cli/handlers/memory-handler.d.ts +2 -14
- package/dist/types/cli/handlers/product-handler.d.ts +6 -24
- package/dist/types/cli/handlers/turn-handler.d.ts +1 -0
- package/dist/types/cli/idle-dream-coordinator.d.ts +9 -5
- package/dist/types/cli/memory-background-coordinator.d.ts +26 -0
- package/dist/types/cli/memory-candidate-service.d.ts +2 -3
- package/dist/types/cli/memory-coordinator.d.ts +12 -8
- package/dist/types/cli/permission-bootstrap.d.ts +10 -1
- package/dist/types/cli/product-acp-params.d.ts +29 -0
- package/dist/types/cli/resolved-agent-cache.d.ts +18 -7
- package/dist/types/cli/rpc-registry.d.ts +2 -1
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +2 -0
- package/dist/types/cli/stdio-acp-request-host.d.ts +7 -4
- package/dist/types/cli/stdio-agent-session-bootstrap.d.ts +8 -2
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +4 -2
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +1 -0
- package/dist/types/cli/stdio-server.d.ts +53 -16
- package/dist/types/cli/stdio-session-runtime-coordinator.d.ts +0 -2
- package/dist/types/cli/task-distillation-coordinator.d.ts +42 -14
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +14 -4
- package/dist/types/cli/tool-bootstrap.d.ts +2 -1
- package/dist/types/cli/turn-core.d.ts +4 -0
- package/dist/types/cli/turn-lifecycle.d.ts +1 -0
- package/dist/types/contracts/hooks.d.ts +3 -2
- package/dist/types/contracts/turn-event.d.ts +7 -0
- package/dist/types/host-contract/index.d.ts +144 -14
- package/dist/types/host-contract/memory-category.d.ts +8 -0
- package/dist/types/host-contract/skill-category.d.ts +5 -0
- package/dist/types/host-session-collection-contract.d.ts +1 -0
- package/dist/types/orchestration/agent-instance.d.ts +15 -0
- package/dist/types/orchestration/dag-scheduler.d.ts +18 -0
- package/dist/types/orchestration/delegate-approval-policy.d.ts +8 -0
- package/dist/types/orchestration/goal-acceptance.d.ts +2 -5
- package/dist/types/orchestration/goal-loop-coordinator.d.ts +4 -2
- package/dist/types/orchestration/goal-mode-adapters.d.ts +16 -0
- package/dist/types/orchestration/goal-run-types.d.ts +6 -1
- package/dist/types/orchestration/product-budget.d.ts +35 -16
- package/dist/types/orchestration/product-persistence.d.ts +5 -14
- package/dist/types/orchestration/product-planner.d.ts +38 -0
- package/dist/types/orchestration/product-worktree.d.ts +4 -2
- package/dist/types/orchestration/solo-evaluator.d.ts +42 -2
- package/dist/types/orchestration/solo-spec-builder.d.ts +3 -0
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +6 -0
- package/dist/types/orchestration/testing/run-state-client-double.d.ts +13 -0
- package/dist/types/orchestration/workflow/builtin-capabilities.d.ts +3 -0
- package/dist/types/orchestration/workflow/capability-catalog.d.ts +31 -0
- package/dist/types/orchestration/workflow/cron-schedule.d.ts +3 -4
- package/dist/types/orchestration/workflow/expression.d.ts +2 -1
- package/dist/types/orchestration/workflow/n8n-import.d.ts +3 -0
- package/dist/types/orchestration/workflow/node-registry.d.ts +2 -2
- package/dist/types/orchestration/workflow/node-schema.d.ts +20 -4
- package/dist/types/orchestration/workflow/params-schema.d.ts +7 -6
- package/dist/types/orchestration/workflow/qla-executor-host.d.ts +4 -1
- package/dist/types/orchestration/workflow/run-history-store.d.ts +33 -3
- package/dist/types/orchestration/workflow/semantic-acceptance.d.ts +65 -0
- package/dist/types/orchestration/workflow/workflow-authoring.d.ts +74 -0
- package/dist/types/orchestration/workflow/workflow-bundle.d.ts +4 -0
- package/dist/types/orchestration/workflow/workflow-controller.d.ts +16 -4
- package/dist/types/orchestration/workflow/workflow-edit-context.d.ts +46 -0
- package/dist/types/orchestration/workflow/workflow-intent-contract.d.ts +56 -0
- package/dist/types/orchestration/workflow/workflow-patch.d.ts +7 -0
- package/dist/types/orchestration/workflow/workflow-runtime.d.ts +5 -0
- package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +11 -0
- package/dist/types/orchestration/workflow/workflow-store.d.ts +5 -0
- package/dist/types/orchestration/workflow/workflow-template-setup.d.ts +65 -0
- package/dist/types/orchestration/workflow/workflow-trigger.d.ts +4 -0
- package/dist/types/orchestration/workflow-chat-builder.d.ts +105 -20
- package/dist/types/orchestration/worktree-task-prompt.d.ts +1 -0
- package/dist/types/protocol/agent-contract.d.ts +49 -8
- package/dist/types/protocol/notifications.d.ts +1 -1
- package/dist/types/protocol/wire/acp-agent-management.d.ts +97 -9
- package/dist/types/protocol/wire/acp-protocol.d.ts +7 -1
- package/dist/types/protocol/wire/agent-methods.d.ts +15 -1
- package/dist/types/protocol/wire/index.d.ts +2 -4
- package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +1 -39
- package/dist/types/protocol/wire/notification-payloads.d.ts +96 -1
- package/dist/types/protocol/wire/web-capability.d.ts +2 -2
- package/dist/types/runtime/community/community-consent-client.d.ts +3 -0
- package/dist/types/runtime/config/tunable-defaults.d.ts +0 -6
- package/dist/types/runtime/execution/bounded-output-tail.d.ts +7 -0
- package/dist/types/runtime/execution/dream-agent.d.ts +8 -5
- package/dist/types/runtime/execution/dream-category-context.d.ts +3 -3
- package/dist/types/runtime/execution/structured-tool-progress.d.ts +21 -0
- package/dist/types/runtime/hooks/memory-hooks.d.ts +20 -8
- package/dist/types/runtime/infra/background-tasks.d.ts +5 -1
- package/dist/types/runtime/infra/cloud-auth-host-authority.d.ts +4 -0
- package/dist/types/runtime/infra/llmrouter-access-token.d.ts +0 -1
- package/dist/types/runtime/infra/subagent-turn-snapshot.d.ts +32 -0
- package/dist/types/runtime/infra/turn-telemetry-store.d.ts +22 -0
- package/dist/types/runtime/memory/implicit-extraction.d.ts +23 -7
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +0 -5
- package/dist/types/runtime/ports/index.d.ts +2 -3
- package/dist/types/runtime/ports/memory-provider.d.ts +31 -16
- package/dist/types/runtime/ports/memory-writer.d.ts +55 -6
- package/dist/types/runtime/ports/permission-contracts.d.ts +2 -0
- package/dist/types/runtime/ports/tool-contracts.d.ts +3 -1
- package/dist/types/runtime/prompt/identity-section.d.ts +2 -0
- package/dist/types/runtime/session/session-permission-store.d.ts +6 -0
- package/dist/types/runtime/tasks/task-types.d.ts +2 -0
- package/dist/types/skills/memory/host-memory-provider.d.ts +59 -9
- package/dist/types/skills/memory/memory-tool.d.ts +3 -1
- package/dist/types/skills/memory/task-distillation.d.ts +22 -3
- package/dist/types/skills/permissions/hook-runner.d.ts +8 -0
- package/dist/types/skills/permissions/operation-classifier.d.ts +7 -0
- package/dist/types/skills/skill-system/skill-category.d.ts +10 -0
- package/dist/types/skills/tools/agent-tool.d.ts +13 -21
- package/dist/types/skills/tools/edit-tool.d.ts +10 -2
- package/dist/types/skills/tools/exec-tool.d.ts +2 -2
- package/dist/types/skills/tools/file-text-snapshot.d.ts +24 -0
- package/dist/types/skills/tools/lsp-tool.d.ts +1 -1
- package/dist/types/skills/tools/patch-tool.d.ts +10 -3
- package/dist/types/skills/tools/read-tool.d.ts +23 -1
- package/dist/types/skills/tools/repo-map-tool.d.ts +52 -0
- package/dist/types/skills/tools/search-tool.d.ts +10 -1
- package/dist/types/skills/tools/shell/index.d.ts +1 -2
- package/dist/types/skills/tools/shell/shell-command.d.ts +1 -1
- package/dist/types/skills/tools/shell/shell-exec.d.ts +2 -2
- package/dist/types/skills/tools/shell/task-output.d.ts +12 -3
- package/dist/types/skills/tools/subagent-decision-tool.d.ts +15 -0
- package/dist/types/skills/tools/task-tool.d.ts +16 -2
- package/dist/types/skills/tools/write-tool.d.ts +2 -1
- package/dist/types/transport/acp-server.d.ts +1 -0
- package/dist/types/transport/host-cloud-auth-client.d.ts +10 -0
- package/dist/types/transport/host-community-client.d.ts +8 -0
- package/dist/types/transport/host-run-state-client.d.ts +6 -0
- package/dist/types/workflow-host.d.ts +8 -1
- package/dist/workflow-host.js +9 -9
- package/package.json +25 -6
- package/dist/types/cli/tool-bootstrap-web-registration.d.ts +0 -14
- package/dist/types/orchestration/tool-cascade.d.ts +0 -49
- package/dist/types/protocol/wire/channel-ingress.d.ts +0 -29
- package/dist/types/protocol/wire/channel.d.ts +0 -89
- package/dist/types/runtime/infra/native-mcp-config-sync.d.ts +0 -16
- package/dist/types/runtime/memory/categories.d.ts +0 -5
- package/dist/types/runtime/memory/recall-category-filter.d.ts +0 -42
- package/dist/types/runtime/ports/source-provider.d.ts +0 -39
- package/dist/types/runtime/ports/web-search-contracts.d.ts +0 -21
- package/dist/types/server/search-svc.d.ts +0 -1
- package/dist/types/skills/memory/local-embedding.d.ts +0 -80
- package/dist/types/skills/memory/memory-config-resolver.d.ts +0 -4
- package/dist/types/skills/memory/memory-embedding-config.d.ts +0 -31
- package/dist/types/skills/tools/web-answer-tool.d.ts +0 -27
- package/dist/types/skills/tools/web-fetch-tool.d.ts +0 -80
- package/dist/types/skills/tools/web-research-tool.d.ts +0 -48
- package/dist/types/skills/tools/web-search-tool.d.ts +0 -46
- package/dist/types/skills/web-search/brave-source.d.ts +0 -3
- package/dist/types/skills/web-search/crawl4ai-extractor.d.ts +0 -16
- package/dist/types/skills/web-search/embedding-rerank.d.ts +0 -13
- package/dist/types/skills/web-search/exa-source.d.ts +0 -3
- package/dist/types/skills/web-search/multi-source-backend.d.ts +0 -23
- package/dist/types/skills/web-search/redis-source-cache.d.ts +0 -6
- package/dist/types/skills/web-search/search-svc-source.d.ts +0 -5
- package/dist/types/skills/web-search/searxng-source.d.ts +0 -4
- package/dist/types/skills/web-search/serper-source.d.ts +0 -3
- package/dist/types/skills/web-search/source-factory.d.ts +0 -6
- package/dist/types/skills/web-search/stability.d.ts +0 -26
- package/dist/types/skills/web-search/web-tunable-resolver.d.ts +0 -16
|
@@ -107,6 +107,7 @@ export declare function hydrateAttachmentReferenceUrlsForTurn(messages: ChatMess
|
|
|
107
107
|
* clean prompt text (VS Code two-line model). The original array/objects are never mutated.
|
|
108
108
|
*/
|
|
109
109
|
export declare function augmentLastUserMessageContent(messages: ChatMessage[], modelContext: string): ChatMessage[];
|
|
110
|
+
export declare function getLatestUserTextForTurn(messages: readonly ChatMessage[]): string;
|
|
110
111
|
/**
|
|
111
112
|
* Insert a SYSTEM-role context message immediately BEFORE the last user message (LLM view only).
|
|
112
113
|
*
|
|
@@ -17,23 +17,23 @@ export interface IdleDreamCoordinatorOptions {
|
|
|
17
17
|
randomId?: () => string;
|
|
18
18
|
timers?: IdleDreamTimers;
|
|
19
19
|
log(message: string): void;
|
|
20
|
-
sendNotification(method: string, params: Record<string, unknown>): void;
|
|
21
20
|
getCurrentSessionId(): string;
|
|
22
21
|
getCurrentTurnCount(): number;
|
|
23
|
-
|
|
22
|
+
hasForegroundTurn(): boolean;
|
|
24
23
|
resolveDreamClient(): IdleDreamClient | null;
|
|
25
24
|
resolveMemoryRoot(): string;
|
|
26
25
|
resolveTranscriptDir(): string;
|
|
27
26
|
listRecentSessions(): Promise<Array<{
|
|
28
27
|
sessionId: string;
|
|
29
28
|
}>>;
|
|
30
|
-
runDream(message: AgentRpcRequest): Promise<void>;
|
|
29
|
+
runDream(message: AgentRpcRequest, signal: AbortSignal): Promise<void>;
|
|
30
|
+
runBackgroundWork(label: string, work: (signal: AbortSignal) => Promise<void>): Promise<boolean>;
|
|
31
31
|
/**
|
|
32
32
|
* Optional idle-time hook run on every idle fire BEFORE the dream gates (so it is not blocked by
|
|
33
33
|
* dream cooldown / missing LLM transport). Used for the feedback redaction+upload sweep
|
|
34
34
|
* (design §9 item 5). Errors are swallowed so a sweep failure never breaks dream.
|
|
35
35
|
*/
|
|
36
|
-
onIdle?(): Promise<void>;
|
|
36
|
+
onIdle?(signal: AbortSignal): Promise<void>;
|
|
37
37
|
}
|
|
38
38
|
export declare class IdleDreamCoordinator {
|
|
39
39
|
private readonly options;
|
|
@@ -42,12 +42,16 @@ export declare class IdleDreamCoordinator {
|
|
|
42
42
|
private readonly randomId;
|
|
43
43
|
private readonly timers;
|
|
44
44
|
private idleTimer;
|
|
45
|
+
private idleCycle;
|
|
46
|
+
private idleDreamTurnId;
|
|
45
47
|
constructor(options: IdleDreamCoordinatorOptions);
|
|
46
48
|
applyEnvOverrides(env: Record<string, string | undefined>): void;
|
|
47
49
|
enable(minutes?: number): void;
|
|
48
|
-
handleTurnNotification(method: string): void;
|
|
50
|
+
handleTurnNotification(method: string, params?: Record<string, unknown>): void;
|
|
51
|
+
yieldToForegroundTurn(): void;
|
|
49
52
|
cancelTimer(): void;
|
|
50
53
|
resetTimer(): void;
|
|
51
54
|
triggerIdleDream(): Promise<void>;
|
|
55
|
+
private runIdleDreamCycle;
|
|
52
56
|
}
|
|
53
57
|
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type MemoryBackgroundWork = (signal: AbortSignal) => Promise<void>;
|
|
2
|
+
export interface MemoryBackgroundCoordinatorOptions {
|
|
3
|
+
defaultTimeoutMs?: number;
|
|
4
|
+
idleCycleTimeoutMs?: number;
|
|
5
|
+
maxTimeoutRetries?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* One process-wide lane for memory learning work. Foreground turns have strict
|
|
9
|
+
* priority: they abort active work and queued jobs resume serially afterwards.
|
|
10
|
+
*/
|
|
11
|
+
export declare class MemoryBackgroundCoordinator {
|
|
12
|
+
private readonly log;
|
|
13
|
+
private foregroundReservations;
|
|
14
|
+
private active;
|
|
15
|
+
private readonly queue;
|
|
16
|
+
private nextSequence;
|
|
17
|
+
private readonly defaultTimeoutMs;
|
|
18
|
+
private readonly idleCycleTimeoutMs;
|
|
19
|
+
private readonly maxTimeoutRetries;
|
|
20
|
+
constructor(log?: (message: string) => void, options?: MemoryBackgroundCoordinatorOptions);
|
|
21
|
+
beginForegroundTurn(): void;
|
|
22
|
+
endForegroundTurn(): void;
|
|
23
|
+
schedule(label: string, work: MemoryBackgroundWork): Promise<boolean>;
|
|
24
|
+
private enqueue;
|
|
25
|
+
private drain;
|
|
26
|
+
}
|
|
@@ -14,10 +14,9 @@ export interface MemoryCandidateHost {
|
|
|
14
14
|
memoryProvider?: {
|
|
15
15
|
search?(query: string, userId: string, options?: {
|
|
16
16
|
limit?: number;
|
|
17
|
-
minScore?: number;
|
|
18
17
|
}): Promise<Array<{
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
id: string;
|
|
19
|
+
content: string;
|
|
21
20
|
score?: number;
|
|
22
21
|
metadata?: Record<string, unknown>;
|
|
23
22
|
}>>;
|
|
@@ -2,15 +2,16 @@ import { type HostRequestRequester } from "../skills/memory/host-memory-provider
|
|
|
2
2
|
import { type MemoryPrefetchState } from "../runtime/hooks/memory-hooks.js";
|
|
3
3
|
import type { HookRegistry } from "../contracts/hooks.js";
|
|
4
4
|
import type { RuntimeLogger } from "../runtime/hooks/hook-registry.js";
|
|
5
|
-
import type { MemoryDreamRuntimeProvider, MemoryHandlerProvider, MemoryLearningSink, MemoryProvider, MemoryRuntimeHookProvider, MemoryToolProvider, ProjectMemoryStore, ToolCatalog } from "../runtime/ports/index.js";
|
|
5
|
+
import type { MemoryDreamRuntimeProvider, MemoryExtractionQueue, MemoryHandlerProvider, MemoryLearningSink, MemoryProvider, MemoryRuntimeHookProvider, MemoryToolProvider, ProjectMemoryStore, ToolCatalog } from "../runtime/ports/index.js";
|
|
6
6
|
import type { LLMTransport } from "./provider-core-facade.js";
|
|
7
7
|
export interface MemoryProviderState {
|
|
8
|
-
recallProvider: MemoryProvider
|
|
9
|
-
runtimeHookProvider: MemoryRuntimeHookProvider
|
|
10
|
-
learningSink: MemoryLearningSink
|
|
11
|
-
toolProvider: MemoryToolProvider
|
|
12
|
-
handlerProvider: MemoryHandlerProvider
|
|
13
|
-
dreamProvider: MemoryDreamRuntimeProvider
|
|
8
|
+
recallProvider: MemoryProvider;
|
|
9
|
+
runtimeHookProvider: MemoryRuntimeHookProvider;
|
|
10
|
+
learningSink: MemoryLearningSink;
|
|
11
|
+
toolProvider: MemoryToolProvider;
|
|
12
|
+
handlerProvider: MemoryHandlerProvider;
|
|
13
|
+
dreamProvider: MemoryDreamRuntimeProvider;
|
|
14
|
+
extractionQueue: MemoryExtractionQueue;
|
|
14
15
|
userId: string;
|
|
15
16
|
}
|
|
16
17
|
/** Host-request access exposed by the ACP protocol coordinator. */
|
|
@@ -18,7 +19,7 @@ export interface MemoryHostRequestAccess {
|
|
|
18
19
|
supportsHostRequestService(service: "memory"): boolean;
|
|
19
20
|
readonly hostRequest: HostRequestRequester;
|
|
20
21
|
}
|
|
21
|
-
/** 装配期绑定(stdio-runtime-services 注入;lazy resolver——gate 在创建时刻现读)
|
|
22
|
+
/** 装配期绑定(stdio-runtime-services 注入;lazy resolver——gate 在创建时刻现读)。 */
|
|
22
23
|
export declare function bindMemoryHostRequestAccess(resolve: () => MemoryHostRequestAccess | null): void;
|
|
23
24
|
export declare function ensureHostMemoryProvider(currentUserId: string): MemoryProviderState;
|
|
24
25
|
export interface RegisterMemoryRuntimeHooksDeps {
|
|
@@ -33,6 +34,7 @@ export interface RegisterMemoryRuntimeHooksDeps {
|
|
|
33
34
|
apiKey: string;
|
|
34
35
|
model: string;
|
|
35
36
|
} | null;
|
|
37
|
+
scheduleBackgroundMemoryWork(label: string, work: (signal: AbortSignal) => Promise<void>): Promise<boolean>;
|
|
36
38
|
/** Part B recall visibility: forwards turn.memory_recall to the client. */
|
|
37
39
|
sendNotification?: (method: string, params: Record<string, unknown>) => void;
|
|
38
40
|
}
|
|
@@ -42,6 +44,8 @@ export interface RegisterMemoryToolDeps {
|
|
|
42
44
|
getMemdir?: () => ProjectMemoryStore;
|
|
43
45
|
memoryProvider: MemoryToolProvider | null;
|
|
44
46
|
memoryUserId: string;
|
|
47
|
+
sessionId?: string;
|
|
48
|
+
getTurnId?: () => string;
|
|
45
49
|
toolCatalog: ToolCatalog;
|
|
46
50
|
sendNotification?: (method: string, params: Record<string, unknown>) => void;
|
|
47
51
|
}
|
|
@@ -2,6 +2,7 @@ import type { HookRegistry } from "../contracts/hooks.js";
|
|
|
2
2
|
import type { NotificationMethod, NotificationMethodMap } from "../protocol/notifications.js";
|
|
3
3
|
import type { AcpPermissionRequestParams } from "../protocol/wire/index.js";
|
|
4
4
|
import type { ToolCatalog } from "../runtime/ports/index.js";
|
|
5
|
+
import { type SandboxPermissionSnapshot } from "./tool-bootstrap.js";
|
|
5
6
|
import type { HostProfileClient } from "../transport/host-profile-client.js";
|
|
6
7
|
import { type RuntimePermissionChecker, type RuntimePermissionRuleEngine } from "./permission-runtime-service.js";
|
|
7
8
|
export { createApprovalResponseFromAcpOption } from "./permission-approval-bridge.js";
|
|
@@ -31,11 +32,19 @@ export interface PermissionBootstrapDeps {
|
|
|
31
32
|
} | undefined;
|
|
32
33
|
sendNotification<M extends NotificationMethod>(method: M, params: NotificationMethodMap[M]): void;
|
|
33
34
|
resolveHostProfileClient?: () => HostProfileClient | undefined;
|
|
34
|
-
|
|
35
|
+
sessionPermissionStore?: {
|
|
36
|
+
loadAllowedDirectories(sessionId: string, projectRoot: string): string[];
|
|
37
|
+
appendAllowedDirectory(sessionId: string, projectRoot: string, pathPrefix: string): Promise<void>;
|
|
38
|
+
};
|
|
39
|
+
/** Existing session engine reused when an Agent is rebuilt for the same session. */
|
|
40
|
+
existingRuleEngine?: RuntimePermissionRuleEngine;
|
|
41
|
+
/** AsyncLocal-aware resolver supplied by the pooled stdio host. */
|
|
42
|
+
resolveSandboxPermissionSnapshot?: () => SandboxPermissionSnapshot | undefined;
|
|
35
43
|
}
|
|
36
44
|
export interface PermissionBootstrapResult {
|
|
37
45
|
permissionChecker: RuntimePermissionChecker;
|
|
38
46
|
permissionUnregister: () => void;
|
|
39
47
|
ruleEngine: RuntimePermissionRuleEngine;
|
|
48
|
+
groupSecurityActive: boolean;
|
|
40
49
|
}
|
|
41
50
|
export declare function configurePermissionBootstrap(deps: PermissionBootstrapDeps): PermissionBootstrapResult;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime validation for the `x/product.*` ACP write surface.
|
|
3
|
+
*
|
|
4
|
+
* Every product entry point casts with `params as unknown as XParams`, and the only fields anything
|
|
5
|
+
* actually checked were projectId / canonicalSessionId / cwd (via requireGatewayProjectContext).
|
|
6
|
+
* `instances`, `tasks`, `budget`, `productId` and `taskId` reached the orchestrator unvalidated, so a
|
|
7
|
+
* malformed frame surfaced far downstream — an empty assignee died at dispatch with
|
|
8
|
+
* `No instance found for assignee ""`, a missing prompt produced a task that could only fail, and a
|
|
9
|
+
* non-array `tasks` threw somewhere inside DagScheduler construction.
|
|
10
|
+
*
|
|
11
|
+
* Validate at the boundary and fail with an actionable message naming the offending field.
|
|
12
|
+
*/
|
|
13
|
+
/** `instances[]` — each needs a name (assignees reference it) and an agentId (the provider to spawn). */
|
|
14
|
+
export declare function assertProductInstances(value: unknown, field?: string): void;
|
|
15
|
+
/** `tasks[]` — taskId/assignee/prompt are all load-bearing at dispatch time. */
|
|
16
|
+
export declare function assertProductTasks(value: unknown, field?: string): void;
|
|
17
|
+
/** `budget` is optional, but a present one must carry usable numbers rather than silently doing nothing. */
|
|
18
|
+
export declare function assertProductBudget(value: unknown, field?: string): void;
|
|
19
|
+
export declare function assertProductId(params: Record<string, unknown>): string;
|
|
20
|
+
export declare function assertProductTaskId(params: Record<string, unknown>): string;
|
|
21
|
+
/**
|
|
22
|
+
* `x/product.create` — the orchestrator builds the DAG straight from these.
|
|
23
|
+
*
|
|
24
|
+
* `name` is deliberately NOT required here: existing callers omit it and the orchestrator derives a
|
|
25
|
+
* display name. Only the fields that cause a downstream failure are enforced.
|
|
26
|
+
*/
|
|
27
|
+
export declare function assertProductCreateParams(params: Record<string, unknown>): void;
|
|
28
|
+
/** `x/product.confirm` — the user-edited final payload; same shape requirements as create. */
|
|
29
|
+
export declare function assertProductConfirmParams(params: Record<string, unknown>): void;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import type { Agent } from "../agent/agent.js";
|
|
21
21
|
import type { LLMTransport } from "./provider-core-facade.js";
|
|
22
|
+
import type { SessionRuntimeState } from "./agent-runtime-session-state.js";
|
|
22
23
|
export interface ResolvedAgentSnapshot {
|
|
23
24
|
agent: Agent;
|
|
24
25
|
transport: LLMTransport;
|
|
@@ -27,6 +28,10 @@ export interface ResolvedAgentSnapshot {
|
|
|
27
28
|
provider: string;
|
|
28
29
|
baseUrl: string;
|
|
29
30
|
configKey: string;
|
|
31
|
+
runtimeGeneration?: SessionRuntimeState;
|
|
32
|
+
}
|
|
33
|
+
export interface ResolvedAgentView extends Omit<ResolvedAgentSnapshot, "agent"> {
|
|
34
|
+
agent: Agent | null;
|
|
30
35
|
}
|
|
31
36
|
/**
|
|
32
37
|
* ToolInvoker captures a session overlay at Agent construction, so equal provider/model settings
|
|
@@ -34,15 +39,21 @@ export interface ResolvedAgentSnapshot {
|
|
|
34
39
|
*/
|
|
35
40
|
export declare function buildSessionAgentConfigKey(sessionId: string, resolvedConfigKey: string, mcpConfigKey?: string): string;
|
|
36
41
|
export declare class ResolvedAgentCache {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
private readonly snapshotsByConfigKey;
|
|
43
|
+
private readonly latestConfigKeyBySession;
|
|
44
|
+
private lastConfigKey;
|
|
45
|
+
private get lastSnapshot();
|
|
46
|
+
get agent(): Agent | null;
|
|
47
|
+
get transport(): LLMTransport | null;
|
|
48
|
+
get apiKey(): string;
|
|
49
|
+
get model(): string;
|
|
50
|
+
get provider(): string;
|
|
51
|
+
get baseUrl(): string;
|
|
44
52
|
/** True when a cached Agent matches the given resolved config key. */
|
|
45
53
|
matches(configKey: string): boolean;
|
|
54
|
+
getRuntimeGeneration(configKey: string): SessionRuntimeState | undefined;
|
|
55
|
+
getForSession(sessionId: string): ResolvedAgentView | undefined;
|
|
56
|
+
get(configKey: string): ResolvedAgentView | undefined;
|
|
46
57
|
/** Store the freshly resolved Agent + LLM client snapshot. */
|
|
47
58
|
store(snapshot: ResolvedAgentSnapshot): void;
|
|
48
59
|
/** Drop only the Agent + config key — force re-resolve, keep the last snapshot. */
|
|
@@ -30,7 +30,7 @@ export type RpcMethodHandler = (msg: AgentRpcRequest) => void | Promise<void>;
|
|
|
30
30
|
* adapters, just applied uniformly across every RPC domain.
|
|
31
31
|
*/
|
|
32
32
|
export interface TaskDistillationRpcSurface {
|
|
33
|
-
runPass(reason: "manual"): Promise<object>;
|
|
33
|
+
runPass(reason: "manual", signal?: AbortSignal): Promise<object>;
|
|
34
34
|
listProposals(): Promise<unknown[]>;
|
|
35
35
|
dismissProposal(id: string): Promise<boolean>;
|
|
36
36
|
acknowledgeProposal(id: string): Promise<boolean>;
|
|
@@ -41,6 +41,7 @@ export interface TaskDistillationRpcSurface {
|
|
|
41
41
|
export interface RpcHandlerHosts {
|
|
42
42
|
/** R3/V3 蒸馏晋升面(惰性:首调时构造 coordinator)。 */
|
|
43
43
|
getTaskDistillation?: () => TaskDistillationRpcSurface;
|
|
44
|
+
scheduleBackgroundMemoryWork(label: string, work: (signal: AbortSignal) => Promise<void>): Promise<boolean>;
|
|
44
45
|
config: ConfigHandlerHost;
|
|
45
46
|
control: ControlHandlerHost;
|
|
46
47
|
session: SessionHandlerHost;
|
|
@@ -10,6 +10,7 @@ export interface RuntimeHookBootstrapDeps {
|
|
|
10
10
|
taskStore: TaskStore;
|
|
11
11
|
backgroundTasks: BackgroundTaskManager;
|
|
12
12
|
sessionId: string;
|
|
13
|
+
getTurnId(): string;
|
|
13
14
|
projectRoot: string;
|
|
14
15
|
memdir: ProjectMemoryStore;
|
|
15
16
|
getMemdir?: () => ProjectMemoryStore | null;
|
|
@@ -23,6 +24,7 @@ export interface RuntimeHookBootstrapDeps {
|
|
|
23
24
|
apiKey: string;
|
|
24
25
|
model: string;
|
|
25
26
|
} | null;
|
|
27
|
+
scheduleBackgroundMemoryWork(label: string, work: (signal: AbortSignal) => Promise<void>): Promise<boolean>;
|
|
26
28
|
compressionClient: {
|
|
27
29
|
transport: LLMTransport;
|
|
28
30
|
apiKey: string;
|
|
@@ -8,7 +8,7 @@ import type { CliAcpRequestHandlerHost } from "./cli-acp-request-handler.js";
|
|
|
8
8
|
* (`this: any`), so members it touches must be forwarded here explicitly;
|
|
9
9
|
* see TURN_PIPELINE_HOST_MEMBERS for the regression-tested list.
|
|
10
10
|
*/
|
|
11
|
-
export type StdioAcpRequestHostSource = Pick<CliAcpRequestHandlerHost, "activeTurn" | "acpSessionMeta" | "acpSessionMetaBySession" | "currentHooks" | "currentSessionId" | "currentTurnId" | "memoryPrefetchState" | "permissionChecker" | "sessionHistory" | "sessionLlmConfigBySession" | "materializedSessionProfiles" | "sessionState" | "cancelIdleDreamTimer" | "disposeSessionRuntime" | "disposeSessionMcp" | "runInSessionScope" | "enableIdleDream" | "ensureDefaultProject" | "initializeHostProjectAuthority" | "ensureModelRegistryHydrated" | "getActiveProjectRoot" | "log" | "sendNotification" | "setActiveWorkdir"> & {
|
|
11
|
+
export type StdioAcpRequestHostSource = Pick<CliAcpRequestHandlerHost, "activeTurn" | "turnDone" | "acpSessionMeta" | "acpSessionMetaBySession" | "currentHooks" | "currentSessionId" | "currentTurnId" | "memoryPrefetchState" | "permissionChecker" | "sessionHistory" | "sessionLlmConfigBySession" | "materializedSessionProfiles" | "sessionState" | "cancelIdleDreamTimer" | "disposeSessionRuntime" | "disposeSessionPermissions" | "disposeSessionMcp" | "runInSessionScope" | "runInExistingSessionScope" | "beginForegroundTurn" | "endForegroundTurn" | "enableIdleDream" | "ensureDefaultProject" | "initializeHostProjectAuthority" | "ensureModelRegistryHydrated" | "getActiveProjectRoot" | "log" | "sendNotification" | "setActiveWorkdir"> & {
|
|
12
12
|
currentModel: string | undefined;
|
|
13
13
|
lastAssistantMessageForExtract: string | undefined;
|
|
14
14
|
lastUserMessageForAutoExtract: string | undefined;
|
|
@@ -18,7 +18,9 @@ export type StdioAcpRequestHostSource = Pick<CliAcpRequestHandlerHost, "activeTu
|
|
|
18
18
|
projectMemoryStoreFactory: unknown;
|
|
19
19
|
toolCatalog: unknown;
|
|
20
20
|
taskDistillation: unknown;
|
|
21
|
-
cancelBackgroundTasksForSession(sessionId?: string): void;
|
|
21
|
+
cancelBackgroundTasksForSession(sessionId?: string, parentTurnId?: string): void;
|
|
22
|
+
beginTurnRequest(): number;
|
|
23
|
+
isTurnRequestCurrent(generation: number): boolean;
|
|
22
24
|
configureTurnMedia(config: Record<string, unknown> | undefined, turnId: string): void;
|
|
23
25
|
getAcpPermissionSession(): {
|
|
24
26
|
sessionId: string;
|
|
@@ -27,12 +29,13 @@ export type StdioAcpRequestHostSource = Pick<CliAcpRequestHandlerHost, "activeTu
|
|
|
27
29
|
}>;
|
|
28
30
|
} | undefined;
|
|
29
31
|
getHostRequestClient(): Pick<HostRequestClient, "request"> | undefined;
|
|
30
|
-
drainPendingTaskNotifications(): string[];
|
|
32
|
+
drainPendingTaskNotifications(sessionId: string): string[];
|
|
31
33
|
resolveAgent(config: unknown, projectRoot?: string): unknown;
|
|
32
34
|
resolveClientForPurpose(purpose: unknown): unknown;
|
|
35
|
+
scheduleBackgroundMemoryWork(label: string, work: (signal: AbortSignal) => Promise<void>): Promise<boolean>;
|
|
33
36
|
sendResponse(id: string | number, result?: unknown, error?: unknown): void;
|
|
34
37
|
};
|
|
35
38
|
/** Host members the shared turn pipeline reads/writes — keep in sync with
|
|
36
39
|
* `grep -oE "this\.[a-zA-Z]+" src/cli/handlers/turn-handler.ts | sort -u`. */
|
|
37
|
-
export declare const TURN_PIPELINE_HOST_MEMBERS: readonly ["activeTurn", "configureTurnMedia", "currentHooks", "currentModel", "currentTurnId", "drainPendingTaskNotifications", "getAcpPermissionSession", "getHostRequestClient", "getActiveProjectRoot", "lastAssistantMessageForExtract", "lastUserMessageForAutoExtract", "log", "mcpReady", "memdir", "pendingAskUser", "permissionChecker", "projectMemoryStoreFactory", "resolveAgent", "resolveClientForPurpose", "sendNotification", "sendResponse", "sessionHistory", "sessionState", "setActiveWorkdir", "taskDistillation", "toolCatalog"];
|
|
40
|
+
export declare const TURN_PIPELINE_HOST_MEMBERS: readonly ["activeTurn", "turnDone", "beginForegroundTurn", "beginTurnRequest", "configureTurnMedia", "currentHooks", "currentModel", "currentTurnId", "isTurnRequestCurrent", "drainPendingTaskNotifications", "endForegroundTurn", "getAcpPermissionSession", "getHostRequestClient", "getActiveProjectRoot", "lastAssistantMessageForExtract", "lastUserMessageForAutoExtract", "log", "mcpReady", "memdir", "pendingAskUser", "permissionChecker", "projectMemoryStoreFactory", "resolveAgent", "resolveClientForPurpose", "scheduleBackgroundMemoryWork", "sendNotification", "sendResponse", "sessionHistory", "sessionState", "setActiveWorkdir", "taskDistillation", "toolCatalog"];
|
|
38
41
|
export declare function createStdioAcpRequestHandlerHost(host: StdioAcpRequestHostSource): CliAcpRequestHandlerHost;
|
|
@@ -15,6 +15,7 @@ import type { ResolvedTextGenerationConfig } from "./model-client-resolver.js";
|
|
|
15
15
|
import type { LLMTransport, ProviderRegistry } from "./provider-core-facade.js";
|
|
16
16
|
import type { MediaPersistence } from "../runtime/infra/media-persistence.js";
|
|
17
17
|
import type { FileWatcher } from "./agent-runtime-bootstrap.js";
|
|
18
|
+
import type { SandboxPermissionSnapshot } from "./tool-bootstrap.js";
|
|
18
19
|
export interface StdioAgentSessionBootstrapDeps {
|
|
19
20
|
config: Record<string, unknown> & {
|
|
20
21
|
maxRounds?: number;
|
|
@@ -27,6 +28,7 @@ export interface StdioAgentSessionBootstrapDeps {
|
|
|
27
28
|
getTurnId(): string;
|
|
28
29
|
projectRoot: string;
|
|
29
30
|
pathService: PathService;
|
|
31
|
+
getActiveWorkdir?: () => string;
|
|
30
32
|
memdir: ProjectMemoryStore;
|
|
31
33
|
getMemdir?: () => ProjectMemoryStore | null;
|
|
32
34
|
currentUserId: string;
|
|
@@ -38,14 +40,17 @@ export interface StdioAgentSessionBootstrapDeps {
|
|
|
38
40
|
apiKey: string;
|
|
39
41
|
model: string;
|
|
40
42
|
} | null;
|
|
43
|
+
scheduleBackgroundMemoryWork(label: string, work: (signal: AbortSignal) => Promise<void>): Promise<boolean>;
|
|
41
44
|
providerRegistry: ProviderRegistry;
|
|
42
45
|
mediaPersistence: MediaPersistence;
|
|
43
46
|
toolCatalog: ToolCatalog;
|
|
44
47
|
runtimeSession: {
|
|
45
|
-
permissionUnregister: (() => void) | null;
|
|
46
48
|
fileWatcher: FileWatcher | null;
|
|
47
49
|
getPluginSkills(): ReturnType<PluginLoader["getPluginSkills"]>;
|
|
48
|
-
|
|
50
|
+
getPermissionState(sessionId: string): {
|
|
51
|
+
ruleEngine: PermissionRuleEnginePort;
|
|
52
|
+
} | undefined;
|
|
53
|
+
applyBootstrap(sessionId: string, result: {
|
|
49
54
|
hooks: HookRegistry;
|
|
50
55
|
memoryHandlerProvider: MemoryHandlerProvider | null;
|
|
51
56
|
memoryDreamProvider: MemoryDreamRuntimeProvider | null;
|
|
@@ -63,6 +68,7 @@ export interface StdioAgentSessionBootstrapDeps {
|
|
|
63
68
|
setMcpConfigKey(configKey: string): void;
|
|
64
69
|
setPluginLoader(loader: PluginLoader): void;
|
|
65
70
|
setFileWatcher(watcher: FileWatcher | null): void;
|
|
71
|
+
resolveSandboxPermissionSnapshot?(): SandboxPermissionSnapshot | undefined;
|
|
66
72
|
getAcpPermissionSession(): {
|
|
67
73
|
sessionId: string;
|
|
68
74
|
requestPermission(params: AcpPermissionRequestParams): Promise<{
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import type { LLMRequest } from "../agent/types.js";
|
|
2
2
|
import type { ModelPurpose } from "../runtime/infra/model-registry.js";
|
|
3
|
+
import type { ProjectMemoryStore, ProjectMemoryStoreFactory } from "../runtime/ports/index.js";
|
|
3
4
|
import type { MultiAgentHandlerHost } from "./multi-agent-handler-host.js";
|
|
4
5
|
import type { RpcHandlerHosts } from "./rpc-registry.js";
|
|
5
6
|
type DirectStdioRpcHost = RpcHandlerHosts["config"] & RpcHandlerHosts["control"] & RpcHandlerHosts["files"] & RpcHandlerHosts["skills"] & RpcHandlerHosts["community"] & {
|
|
6
7
|
currentTurnId?: string;
|
|
7
8
|
/** Mid-turn guidance queue (运行中引导) — shared between handleTurnGuide and the tool loop's drain. */
|
|
8
9
|
pendingTurnGuidance?: string[];
|
|
9
|
-
memdir:
|
|
10
|
-
projectMemoryStoreFactory:
|
|
10
|
+
memdir: ProjectMemoryStore | null;
|
|
11
|
+
projectMemoryStoreFactory: ProjectMemoryStoreFactory;
|
|
11
12
|
setActiveWorkdir(dir: string): void;
|
|
12
13
|
getActiveProjectRoot(): string;
|
|
13
14
|
readonly multiAgentHandlerHost: MultiAgentHandlerHost;
|
|
14
15
|
};
|
|
15
16
|
type StdioRpcAdapterSource = DirectStdioRpcHost & {
|
|
16
17
|
ensureTaskDistillation(): import("./rpc-registry.js").TaskDistillationRpcSurface;
|
|
18
|
+
scheduleBackgroundMemoryWork(label: string, work: (signal: AbortSignal) => Promise<void>): Promise<boolean>;
|
|
17
19
|
activeTurn: RpcHandlerHosts["turn"]["activeTurn"];
|
|
18
20
|
currentSessionId: NonNullable<RpcHandlerHosts["session"]["currentSessionId"]>;
|
|
19
21
|
currentModel: NonNullable<RpcHandlerHosts["session"]["currentModel"]>;
|
|
@@ -9,6 +9,7 @@ export interface StdioRuntimeBootstrapDeps {
|
|
|
9
9
|
getActiveProjectRoot(): string;
|
|
10
10
|
getCurrentSessionId?(): string | undefined;
|
|
11
11
|
getCurrentTurnId?(): string | undefined;
|
|
12
|
+
isGroupSecurityMode?(): boolean;
|
|
12
13
|
resolveClientForPurpose(purpose: ModelPurpose): {
|
|
13
14
|
transport: LLMTransport;
|
|
14
15
|
apiKey: string;
|
|
@@ -20,7 +20,6 @@ import { BackgroundTaskManager } from "../runtime/infra/background-tasks.js";
|
|
|
20
20
|
import { type AgentRpcError } from "../protocol/wire/index.js";
|
|
21
21
|
import type { AcpServer } from "../transport/acp-server.js";
|
|
22
22
|
import type { NotificationMethod, NotificationMethodMap } from "../protocol/notifications.js";
|
|
23
|
-
import { AgentRuntimeSessionState } from "./agent-runtime-session-state.js";
|
|
24
23
|
import { type MultiAgentHandlerHost } from "./multi-agent-handler-host.js";
|
|
25
24
|
import { SessionHistoryCoordinator } from "./session-history-coordinator.js";
|
|
26
25
|
import type { MemoryDreamRuntimeProvider, MemoryHandlerProvider, PermissionMode, ProjectMemoryStore } from "../runtime/ports/index.js";
|
|
@@ -29,6 +28,8 @@ import { HostCapabilityClient } from "../transport/host-capability-client.js";
|
|
|
29
28
|
import { HostSessionClient } from "../transport/host-session-client.js";
|
|
30
29
|
import { HostProjectClient } from "../transport/host-project-client.js";
|
|
31
30
|
import { HostFeedbackClient } from "../transport/host-feedback-client.js";
|
|
31
|
+
import { HostCommunityClient } from "../transport/host-community-client.js";
|
|
32
|
+
import { HostCloudAuthClient } from "../transport/host-cloud-auth-client.js";
|
|
32
33
|
export interface StdioServerConfig {
|
|
33
34
|
verbose: boolean;
|
|
34
35
|
transport?: Transport;
|
|
@@ -41,15 +42,16 @@ export declare class StdioServer {
|
|
|
41
42
|
private rpc;
|
|
42
43
|
/** Gateway contract — exposed for control-handler metrics/cancel. */
|
|
43
44
|
get rpcContract(): import("../protocol/wire/gateway-contract.js").GatewayRpcContract;
|
|
44
|
-
|
|
45
|
+
private connectionActiveTurn;
|
|
45
46
|
/** Resolves when the active turn fully completes (including post-abort flush). */
|
|
46
|
-
private
|
|
47
|
+
private connectionTurnDone;
|
|
47
48
|
verbose: boolean;
|
|
48
49
|
private transport;
|
|
49
50
|
private readonly runtimeServices;
|
|
50
51
|
private readonly runtimeSession;
|
|
51
52
|
/** Canonical ACP session captured for the full async turn; never inferred from a mutable pointer. */
|
|
52
53
|
private readonly sessionScope;
|
|
54
|
+
private readonly executionBySession;
|
|
53
55
|
/**
|
|
54
56
|
* DERIVED resolved-agent cache (Agent + LLM client snapshot). The invalidation
|
|
55
57
|
* invariant (full wipe on registry change vs forget-agent on session dispose)
|
|
@@ -63,18 +65,23 @@ export declare class StdioServer {
|
|
|
63
65
|
taskStore: TaskStore;
|
|
64
66
|
/** Unified background execution registry (agent forks + backgrounded shell commands). */
|
|
65
67
|
backgroundTasks: BackgroundTaskManager;
|
|
66
|
-
/** Settled-task notifications
|
|
67
|
-
private
|
|
68
|
+
/** Settled-task notifications isolated by their launching session. */
|
|
69
|
+
private readonly pendingTaskNotificationsBySession;
|
|
68
70
|
/** Session-scoped memory prefetch state (LRU dedup + byte limit). */
|
|
69
|
-
|
|
71
|
+
private connectionMemoryPrefetchState;
|
|
70
72
|
/** Last user message text for auto-extract hook (set at turn start, cleared at turn end).
|
|
71
73
|
* Public: the turn pipeline writes it through the ACP host adapter. */
|
|
72
|
-
|
|
74
|
+
private connectionLastUserMessageForAutoExtract;
|
|
73
75
|
/** Last assistant message text for implicit extraction hook (set at turn end).
|
|
74
76
|
* Public: the turn pipeline writes it through the ACP host adapter. */
|
|
75
|
-
|
|
77
|
+
private connectionLastAssistantMessageForExtract;
|
|
78
|
+
private connectionPendingTurnGuidance;
|
|
79
|
+
private connectionRequestGeneration;
|
|
80
|
+
/** Foreground reservations begin before async routing, closing the idle-timer race. */
|
|
81
|
+
private foregroundTurnCount;
|
|
82
|
+
private readonly memoryBackground;
|
|
76
83
|
/** MEMDIR file-based memory (CC memdir parity). */
|
|
77
|
-
|
|
84
|
+
private connectionMemdir;
|
|
78
85
|
readonly projectMemoryStoreFactory: import("../runtime/ports/project-memory-store.js").ProjectMemoryStoreFactory;
|
|
79
86
|
/** Memory write gate state (P2+P3: category gate + supersedes). */
|
|
80
87
|
/** Pending ask_user requests waiting for host response */
|
|
@@ -96,6 +103,7 @@ export declare class StdioServer {
|
|
|
96
103
|
get toolCatalog(): import("../runtime/ports/tool-contracts.js").ToolCatalog;
|
|
97
104
|
/** Turn pipeline awaits this before tool dispatch (MCP servers connected). */
|
|
98
105
|
get mcpReady(): Promise<void>;
|
|
106
|
+
private get activeResolvedAgent();
|
|
99
107
|
private get agent();
|
|
100
108
|
/** Cached LLM transport for sub-agent forks (dream). */
|
|
101
109
|
get currentTransport(): LLMTransport | null;
|
|
@@ -106,9 +114,33 @@ export declare class StdioServer {
|
|
|
106
114
|
get currentSessionId(): string;
|
|
107
115
|
set currentSessionId(v: string);
|
|
108
116
|
private activeScopedSessionId;
|
|
117
|
+
private activeScopedWorkdir;
|
|
118
|
+
private activeScopedRuntimeState;
|
|
119
|
+
private isActiveGroupSecurityMode;
|
|
120
|
+
private bindCachedRuntimeGeneration;
|
|
121
|
+
private createSessionExecutionState;
|
|
122
|
+
private getOrCreateSessionExecutionState;
|
|
123
|
+
private runWithSessionExecutionScope;
|
|
109
124
|
runInSessionScope<T>(sessionId: string, action: () => Promise<T>): Promise<T>;
|
|
125
|
+
runInExistingSessionScope<T>(sessionId: string, action: () => Promise<T>): Promise<T | undefined>;
|
|
126
|
+
get activeTurn(): AbortController | null;
|
|
127
|
+
set activeTurn(value: AbortController | null);
|
|
128
|
+
get turnDone(): Promise<void>;
|
|
129
|
+
set turnDone(value: Promise<void>);
|
|
110
130
|
get currentTurnId(): string;
|
|
111
131
|
set currentTurnId(v: string);
|
|
132
|
+
beginTurnRequest(): number;
|
|
133
|
+
isTurnRequestCurrent(generation: number): boolean;
|
|
134
|
+
get sessionState(): SessionState | null;
|
|
135
|
+
set sessionState(v: SessionState | null);
|
|
136
|
+
get memoryPrefetchState(): MemoryPrefetchState;
|
|
137
|
+
set memoryPrefetchState(v: MemoryPrefetchState);
|
|
138
|
+
get memdir(): ProjectMemoryStore | null;
|
|
139
|
+
set memdir(v: ProjectMemoryStore | null);
|
|
140
|
+
get lastUserMessageForAutoExtract(): string | undefined;
|
|
141
|
+
set lastUserMessageForAutoExtract(v: string | undefined);
|
|
142
|
+
get lastAssistantMessageForExtract(): string | undefined;
|
|
143
|
+
set lastAssistantMessageForExtract(v: string | undefined);
|
|
112
144
|
/**
|
|
113
145
|
* The active ACP permission session for the current turn, or undefined when no host is connected.
|
|
114
146
|
*/
|
|
@@ -122,6 +154,8 @@ export declare class StdioServer {
|
|
|
122
154
|
getHostProfileClient(): HostProfileClient | undefined;
|
|
123
155
|
/** Thin read-only facade; consumers fail loudly when the host did not advertise capability. */
|
|
124
156
|
getHostCapabilityClient(): HostCapabilityClient | undefined;
|
|
157
|
+
getHostCommunityClient(): HostCommunityClient | undefined;
|
|
158
|
+
getHostCloudAuthClient(): HostCloudAuthClient | undefined;
|
|
125
159
|
getHostAgentProviderDirectory(): import("../runtime/infra/host-agent-provider-directory.js").HostAgentProviderDirectory;
|
|
126
160
|
/** Session durable-state facade; absent under gate-off/standalone so compatibility stays inert. */
|
|
127
161
|
getHostSessionClient(): HostSessionClient | undefined;
|
|
@@ -135,22 +169,21 @@ export declare class StdioServer {
|
|
|
135
169
|
* Declared as a real field so the proxy in createTurnHost has a shared backing store
|
|
136
170
|
* (turn pipeline and handleTurnGuide must see the SAME array).
|
|
137
171
|
*/
|
|
138
|
-
pendingTurnGuidance: string[];
|
|
172
|
+
get pendingTurnGuidance(): string[];
|
|
173
|
+
set pendingTurnGuidance(v: string[]);
|
|
139
174
|
/** LH-10: an explicit cancel of a session stops the background tasks that
|
|
140
175
|
* session launched — the forked agent + the exec processes it spawned —
|
|
141
176
|
* instead of leaving them running as zombies. Keyed by session id, which is
|
|
142
177
|
* shared across the client/agent boundary (turn ids are not). */
|
|
143
|
-
cancelBackgroundTasksForSession(sessionId?: string): void;
|
|
144
|
-
get sessionState(): SessionState | null;
|
|
145
|
-
set sessionState(v: SessionState | null);
|
|
178
|
+
cancelBackgroundTasksForSession(sessionId?: string, parentTurnId?: string): void;
|
|
146
179
|
get sessionLlmConfigBySession(): Map<string, import("./acp-session-host.js").SessionLlmConfig>;
|
|
147
180
|
get materializedSessionProfiles(): Map<string, import("./acp-session-host.js").MaterializedSessionProfile>;
|
|
148
181
|
get acpSessionMeta(): Record<string, unknown> | null;
|
|
149
182
|
set acpSessionMeta(v: Record<string, unknown> | null);
|
|
150
183
|
get acpSessionMetaBySession(): Map<string, Record<string, unknown>>;
|
|
151
184
|
get currentHooks(): import("../contracts/hooks.js").HookRegistry | null;
|
|
152
|
-
get permissionChecker():
|
|
153
|
-
private
|
|
185
|
+
get permissionChecker(): import("../runtime/ports/permission-contracts.js").PermissionMetadataResolver | null;
|
|
186
|
+
private resolveSandboxPermissionSnapshot;
|
|
154
187
|
/**
|
|
155
188
|
* config.update 权限热应用:写盘的同时立即更新活的 rule engine,
|
|
156
189
|
* 当前会话(乃至运行中 turn)的下一次工具调用就按新模式判定——
|
|
@@ -177,7 +210,7 @@ export declare class StdioServer {
|
|
|
177
210
|
* Called by the turn pipeline at turn start — settled tasks are injected
|
|
178
211
|
* into the model's context as <task_notification> blocks.
|
|
179
212
|
*/
|
|
180
|
-
drainPendingTaskNotifications(): string[];
|
|
213
|
+
drainPendingTaskNotifications(sessionId: string): string[];
|
|
181
214
|
ensureModelRegistryHydrated(): Promise<void>;
|
|
182
215
|
syncToolListMediaConfig(): void;
|
|
183
216
|
configureTurnMedia(config: Record<string, unknown> | undefined, turnId: string): void;
|
|
@@ -250,8 +283,12 @@ export declare class StdioServer {
|
|
|
250
283
|
* Enable idle dream scheduling. Called after session setup when LLM config is available.
|
|
251
284
|
*/
|
|
252
285
|
enableIdleDream(minutes?: number): void;
|
|
286
|
+
beginForegroundTurn(): void;
|
|
287
|
+
endForegroundTurn(): void;
|
|
288
|
+
scheduleBackgroundMemoryWork(label: string, work: (signal: AbortSignal) => Promise<void>): Promise<boolean>;
|
|
253
289
|
cancelIdleDreamTimer(): void;
|
|
254
290
|
disposeSessionRuntime(): void;
|
|
291
|
+
disposeSessionPermissions(sessionId: string): void;
|
|
255
292
|
disposeSessionMcp(sessionId: string): Promise<void>;
|
|
256
293
|
/**
|
|
257
294
|
* Initialize the ACP server alongside the legacy protocol.
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { type MemoryPrefetchState } from "../runtime/hooks/memory-hooks.js";
|
|
2
2
|
import type { MemoryDreamRuntimeProvider, MemoryHandlerProvider } from "../runtime/ports/index.js";
|
|
3
3
|
import type { AgentRuntimeSessionState } from "./agent-runtime-session-state.js";
|
|
4
|
-
import type { ResolvedAgentCache } from "./resolved-agent-cache.js";
|
|
5
4
|
import type { StdioRuntimeServices } from "./stdio-runtime-services.js";
|
|
6
5
|
export interface StdioSessionRuntimeCoordinatorDeps {
|
|
7
6
|
runtimeSession: AgentRuntimeSessionState;
|
|
8
7
|
runtimeServices: Pick<StdioRuntimeServices, "closeMemoryProviders">;
|
|
9
|
-
resolvedAgent: Pick<ResolvedAgentCache, "forgetAgent">;
|
|
10
8
|
getMemoryProvider(): MemoryHandlerProvider | null;
|
|
11
9
|
getMemoryDreamProvider(): MemoryDreamRuntimeProvider | null;
|
|
12
10
|
setMemoryPrefetchState(state: MemoryPrefetchState): void;
|