qlogicagent 2.18.12 → 2.19.2
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 +382 -382
- package/dist/agent-contract.js +1 -0
- package/dist/cli.js +1 -1
- package/dist/default-project-knowledge/INSTRUCTIONS.md +7 -7
- package/dist/default-project-knowledge/rules/project-workflow.md +6 -6
- package/dist/host-contract.js +1 -1
- package/dist/host-session-collection-contract.js +1 -0
- package/dist/index.js +478 -505
- package/dist/pet-host.js +8 -8
- package/dist/project-memory-host.js +23 -23
- package/dist/protocol.js +1 -1
- package/dist/skills/builtin/desktop-screenshot/SKILL.md +62 -62
- package/dist/skills/builtin/office-doc-reading/SKILL.md +19 -19
- package/dist/types/cli/acp-commands.d.ts +1 -1
- package/dist/types/cli/acp-extended-handlers.d.ts +8 -8
- package/dist/types/cli/acp-extended-host-adapter.d.ts +0 -11
- package/dist/types/cli/acp-session-host.d.ts +2 -0
- package/dist/types/cli/core-tool-coordinator.d.ts +0 -9
- package/dist/types/cli/default-project-bootstrap.d.ts +2 -32
- package/dist/types/cli/handlers/session-handler.d.ts +0 -43
- package/dist/types/cli/handlers/solo-handler.d.ts +3 -14
- package/dist/types/cli/multi-agent-handler-host.d.ts +3 -16
- package/dist/types/cli/product-coordinator.d.ts +3 -14
- package/dist/types/cli/rpc-registry.d.ts +0 -2
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +4 -1
- package/dist/types/cli/stdio-server.d.ts +1 -2
- package/dist/types/host-contract/index.d.ts +112 -19
- package/dist/types/host-session-collection-contract.d.ts +61 -0
- package/dist/types/orchestration/agent-instance.d.ts +11 -14
- package/dist/types/orchestration/agent-roster.d.ts +8 -4
- package/dist/types/orchestration/delegate-bridge.d.ts +8 -0
- package/dist/types/orchestration/goal-mode-adapters.d.ts +3 -3
- package/dist/types/orchestration/product-persistence.d.ts +0 -4
- package/dist/types/orchestration/product-planner.d.ts +4 -6
- package/dist/types/orchestration/solo-evaluator.d.ts +2 -5
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +2 -1
- package/dist/types/orchestration/testing/host-agent-provider-directory-fixture.d.ts +7 -0
- package/dist/types/orchestration/workflow/qla-executor-host.d.ts +1 -1
- package/dist/types/protocol/agent-contract.d.ts +50 -0
- package/dist/types/protocol/methods.d.ts +20 -38
- package/dist/types/protocol/notifications.d.ts +1 -1
- package/dist/types/protocol/wire/acp-agent-management.d.ts +2 -190
- package/dist/types/protocol/wire/acp-protocol.d.ts +3 -4
- package/dist/types/protocol/wire/agent-events.d.ts +1 -32
- package/dist/types/protocol/wire/agent-methods.d.ts +1 -243
- package/dist/types/protocol/wire/gateway-rpc.d.ts +343 -15
- package/dist/types/protocol/wire/index.d.ts +3 -3
- package/dist/types/protocol/wire/notification-payloads.d.ts +103 -126
- package/dist/types/runtime/infra/host-agent-provider-directory.d.ts +17 -0
- package/dist/types/runtime/infra/project-authority-facade.d.ts +1 -1
- package/dist/types/runtime/infra/project-data-paths.d.ts +2 -1
- package/dist/types/runtime/infra/project-host-authority.d.ts +3 -2
- package/dist/types/runtime/infra/project-store.d.ts +4 -39
- package/dist/types/runtime/session/session-catalog.d.ts +0 -12
- package/dist/types/runtime/session/session-persistence.d.ts +1 -1
- package/dist/types/runtime/session/session-resource-key.d.ts +1 -1
- package/dist/types/runtime/session/session-types.d.ts +0 -23
- package/dist/types/transport/acp-server.d.ts +2 -10
- package/dist/vendor/hatch-pet/LICENSE.txt +201 -201
- package/dist/vendor/hatch-pet/NOTICE.md +25 -25
- package/dist/vendor/hatch-pet/references/animation-rows.md +29 -29
- package/dist/vendor/hatch-pet/references/codex-pet-contract.md +35 -35
- package/dist/vendor/hatch-pet/references/qa-rubric.md +66 -66
- package/dist/vendor/hatch-pet/scripts/compose_atlas.py +169 -169
- package/dist/vendor/hatch-pet/scripts/derive_running_left_from_running_right.py +150 -150
- package/dist/vendor/hatch-pet/scripts/extract_strip_frames.py +408 -408
- package/dist/vendor/hatch-pet/scripts/inspect_frames.py +256 -256
- package/dist/vendor/hatch-pet/scripts/make_contact_sheet.py +96 -96
- package/dist/vendor/hatch-pet/scripts/prepare_pet_run.py +834 -834
- package/dist/vendor/hatch-pet/scripts/render_animation_previews.py +78 -78
- package/dist/vendor/hatch-pet/scripts/validate_atlas.py +157 -157
- package/dist/workflow-host.js +10 -10
- package/package.json +16 -1
- package/dist/types/cli/agent-config-coordinator.d.ts +0 -27
- package/dist/types/cli/agent-config-runtime.d.ts +0 -11
- package/dist/types/cli/agent-status-notifier.d.ts +0 -11
- package/dist/types/cli/handlers/agents-handler.d.ts +0 -121
- package/dist/types/cli/handlers/project-handler.d.ts +0 -36
- package/dist/types/cli/project-command-service.d.ts +0 -28
- package/dist/types/orchestration/delegation-coordinator.d.ts +0 -100
- package/dist/types/runtime/infra/acp-detector.d.ts +0 -271
- package/dist/types/runtime/infra/agent-config-store.d.ts +0 -30
- package/dist/types/runtime/infra/agent-install-runner.d.ts +0 -80
- package/dist/types/runtime/infra/external-agent-approvals.d.ts +0 -59
- package/dist/types/runtime/infra/migrate-device-scope.d.ts +0 -49
- package/dist/types/runtime/infra/project-data-gc.d.ts +0 -15
- package/dist/types/runtime/session/native/claude-session-source.d.ts +0 -23
- package/dist/types/runtime/session/native/codex-index.d.ts +0 -21
- package/dist/types/runtime/session/native/codex-session-source.d.ts +0 -31
- package/dist/types/runtime/session/native/cwd-normalize.d.ts +0 -53
- package/dist/types/runtime/session/native/ephemeral-rollout-sweep.d.ts +0 -13
- package/dist/types/runtime/session/native/native-cwd-agents.d.ts +0 -17
- package/dist/types/runtime/session/native/native-session-source.d.ts +0 -89
- package/dist/types/runtime/session/native/native-title.d.ts +0 -1
- package/dist/types/runtime/session/native/register-builtin-sources.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlogicagent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.2",
|
|
4
4
|
"description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"types": "./dist/types/protocol/wire/index.d.ts",
|
|
29
29
|
"default": "./dist/protocol.js"
|
|
30
30
|
},
|
|
31
|
+
"./agent-contract": {
|
|
32
|
+
"types": "./dist/types/protocol/agent-contract.d.ts",
|
|
33
|
+
"default": "./dist/agent-contract.js"
|
|
34
|
+
},
|
|
31
35
|
"./permissions": {
|
|
32
36
|
"types": "./dist/types/permissions.d.ts",
|
|
33
37
|
"default": "./dist/permissions.js"
|
|
@@ -56,6 +60,10 @@
|
|
|
56
60
|
"types": "./dist/types/host-contract/index.d.ts",
|
|
57
61
|
"default": "./dist/host-contract.js"
|
|
58
62
|
},
|
|
63
|
+
"./host-session-collection-contract": {
|
|
64
|
+
"types": "./dist/types/host-session-collection-contract.d.ts",
|
|
65
|
+
"default": "./dist/host-session-collection-contract.js"
|
|
66
|
+
},
|
|
59
67
|
"./plugin-marketplace-compute": {
|
|
60
68
|
"types": "./dist/types/skills/plugins/plugin-marketplace.d.ts",
|
|
61
69
|
"default": "./dist/plugin-marketplace-compute.js"
|
|
@@ -69,6 +77,9 @@
|
|
|
69
77
|
"protocol": [
|
|
70
78
|
"./dist/types/protocol/wire/index.d.ts"
|
|
71
79
|
],
|
|
80
|
+
"agent-contract": [
|
|
81
|
+
"./dist/types/protocol/agent-contract.d.ts"
|
|
82
|
+
],
|
|
72
83
|
"agent": [
|
|
73
84
|
"./dist/types/agent/agent.d.ts"
|
|
74
85
|
],
|
|
@@ -99,6 +110,9 @@
|
|
|
99
110
|
"host-contract": [
|
|
100
111
|
"./dist/types/host-contract/index.d.ts"
|
|
101
112
|
],
|
|
113
|
+
"host-session-collection-contract": [
|
|
114
|
+
"./dist/types/host-session-collection-contract.d.ts"
|
|
115
|
+
],
|
|
102
116
|
"plugin-marketplace-compute": [
|
|
103
117
|
"./dist/types/skills/plugins/plugin-marketplace.d.ts"
|
|
104
118
|
]
|
|
@@ -123,6 +137,7 @@
|
|
|
123
137
|
"check:windows-hide": "node scripts/check-windows-hide.mjs src",
|
|
124
138
|
"check:test-suite-governance": "node scripts/check-test-suite-governance.mjs",
|
|
125
139
|
"check:architecture-boundaries": "node scripts/check-architecture-boundaries.mjs",
|
|
140
|
+
"check:agent-contract": "node scripts/check-agent-contract-hash.mjs",
|
|
126
141
|
"check:route-a-teardown": "node scripts/check-route-a-teardown.mjs",
|
|
127
142
|
"check:transcript-tool-persistence": "node scripts/check-transcript-tool-persistence.mjs",
|
|
128
143
|
"check:provider-core-boundary": "node scripts/check-provider-core-boundary.mjs",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AgentConfigStore } from "../runtime/infra/agent-config-store.js";
|
|
2
|
-
import type { AcpDetector } from "../runtime/infra/acp-detector.js";
|
|
3
|
-
export interface AgentConfigCoordinatorDeps {
|
|
4
|
-
acpDetector: AcpDetector;
|
|
5
|
-
getActiveProjectRoot(): string;
|
|
6
|
-
}
|
|
7
|
-
export declare function resolveLlmrouterPublicOrigin(rawBaseUrl?: string): string | undefined;
|
|
8
|
-
export declare function resolveLlmrouterProtocolBaseUrl(agentId: string, rawBaseUrl?: string): string | undefined;
|
|
9
|
-
export declare class AgentConfigCoordinator {
|
|
10
|
-
private readonly deps;
|
|
11
|
-
private store;
|
|
12
|
-
/** Last resolved managed text model (llmrouterModel), to detect primary-model switches. */
|
|
13
|
-
private lastLlmrouterModel;
|
|
14
|
-
constructor(deps: AgentConfigCoordinatorDeps);
|
|
15
|
-
get currentStore(): AgentConfigStore | null;
|
|
16
|
-
ensureStore(): Promise<AgentConfigStore>;
|
|
17
|
-
private syncKeySources;
|
|
18
|
-
/**
|
|
19
|
-
* When the managed text model (llmrouterModel) actually changes, pooled OpenAI-compat agents
|
|
20
|
-
* (codex/qwen/opencode) still hold the OLD OPENAI_MODEL baked at spawn. Evict the platform-model
|
|
21
|
-
* followers — managed (explicit「平台额度」) or auto, NOT explicit account/userKey BYO — so the next
|
|
22
|
-
* turn respawns on the new model. The model-switch analogue of the credential-switch eviction (Cut 6);
|
|
23
|
-
* busy turns settle first (handled inside evictPooledAgentsByAgentId). Runs per agents operation via
|
|
24
|
-
* syncKeySources, so a primary-model switch takes effect on the next message.
|
|
25
|
-
*/
|
|
26
|
-
private evictModelFollowersIfChanged;
|
|
27
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AgentConfigStore } from "../runtime/infra/agent-config-store.js";
|
|
2
|
-
import type { AcpDetector } from "../runtime/infra/acp-detector.js";
|
|
3
|
-
export interface AgentConfigRuntime {
|
|
4
|
-
readonly currentStore: AgentConfigStore | null;
|
|
5
|
-
ensureStore(): Promise<AgentConfigStore>;
|
|
6
|
-
}
|
|
7
|
-
export interface AgentConfigRuntimeDeps {
|
|
8
|
-
acpDetector: AcpDetector;
|
|
9
|
-
getActiveProjectRoot(): string;
|
|
10
|
-
}
|
|
11
|
-
export declare function createAgentConfigRuntime(deps: AgentConfigRuntimeDeps): AgentConfigRuntime;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AgentsStatusNotification } from "../protocol/notifications.js";
|
|
2
|
-
export interface AgentStatusExtra {
|
|
3
|
-
missedBeats?: number;
|
|
4
|
-
lastActivityAt?: number;
|
|
5
|
-
usage?: {
|
|
6
|
-
inputTokens: number;
|
|
7
|
-
outputTokens: number;
|
|
8
|
-
totalTokens: number;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export declare function createAgentStatusNotification(agentId: string, state: string, extra?: AgentStatusExtra): AgentsStatusNotification;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agents scan/config/gateway/processes/kill handlers — extracted from StdioServer.
|
|
3
|
-
* Handles: agents.scan, agents.list, agents.config, agents.setConfig, agents.getConfig,
|
|
4
|
-
* agents.removeConfig, agents.setGateway, agents.getGateway, agents.processes,
|
|
5
|
-
* agents.kill, agents.listConfigured, agents.getLog, agents.testConnection
|
|
6
|
-
*/
|
|
7
|
-
import { type AgentRpcError, type AgentRpcRequest } from "../../protocol/wire/index.js";
|
|
8
|
-
import type { AgentConfigStore } from "../../runtime/infra/agent-config-store.js";
|
|
9
|
-
import { type AcpDetector } from "../../runtime/infra/acp-detector.js";
|
|
10
|
-
import type { DelegateBridge } from "../../orchestration/delegation-coordinator.js";
|
|
11
|
-
export interface AgentsHandlerHost {
|
|
12
|
-
acpDetector: AcpDetector;
|
|
13
|
-
ensureAgentConfigStore(): Promise<AgentConfigStore>;
|
|
14
|
-
getActiveProjectRoot?(): string;
|
|
15
|
-
handleMcpToolCall?(memberId: string, tool: string, args: Record<string, unknown>): Promise<unknown>;
|
|
16
|
-
log?(message: string): void;
|
|
17
|
-
sendResponse(id: string | number, result?: unknown, error?: AgentRpcError): void;
|
|
18
|
-
sendNotification?(method: string, params: Record<string, unknown>): void;
|
|
19
|
-
/** 激活层(S3c §1.1):gateway-routed delegate 桥(懒读;未挂/gate 关 = undefined → 旧进程池路径)。 */
|
|
20
|
-
getDelegateBridge?(): DelegateBridge | undefined;
|
|
21
|
-
}
|
|
22
|
-
interface PooledTurnCtx {
|
|
23
|
-
sessionId?: string;
|
|
24
|
-
turnId?: string;
|
|
25
|
-
requestId?: string;
|
|
26
|
-
deltas: string[];
|
|
27
|
-
streamedAny: boolean;
|
|
28
|
-
}
|
|
29
|
-
export declare function relayPooledTurnNotification(input: {
|
|
30
|
-
agentId: string;
|
|
31
|
-
turn: PooledTurnCtx | null;
|
|
32
|
-
method: string;
|
|
33
|
-
payload: unknown;
|
|
34
|
-
sendNotification?: (method: string, params: Record<string, unknown>) => void;
|
|
35
|
-
}): void;
|
|
36
|
-
/** Resolve a pending external-agent approval with the user's decision (delivered by the gateway). */
|
|
37
|
-
export declare function handleAgentsApprovalResponse(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
38
|
-
export declare function handleAgentsScan(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
39
|
-
export declare function handleAgentsList(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Curated Discover-Agent catalog (12 agents) merged with live install status, for the
|
|
42
|
-
* discover grid. Status comes from the detector; install carries the official command
|
|
43
|
-
* summary + source for the confirm dialog (no secrets).
|
|
44
|
-
*/
|
|
45
|
-
export declare function handleAgentsCatalog(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
46
|
-
export declare function handleAgentsCheckUpdates(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* One-click install a catalog agent by id. Runs ONLY the official command from the
|
|
49
|
-
* catalog manifest (never a free-form command), streaming progress via the
|
|
50
|
-
* agent.install.progress notification, then refreshes detection. Returns the outcome.
|
|
51
|
-
*/
|
|
52
|
-
export declare function handleAgentsInstall(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Open an OS terminal running an agent's interactive login/setup command (e.g. `kimi login`,
|
|
55
|
-
* `hermes acp --setup`). Lowers the barrier for own-store/oauth agents that can't be driven via
|
|
56
|
-
* injected credentials — the user completes the CLI's native login without leaving the app. The
|
|
57
|
-
* command is resolved server-side from the catalog (fixed string, no user input → no injection).
|
|
58
|
-
*/
|
|
59
|
-
export declare function handleAgentsRunSetup(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
60
|
-
export declare function handleAgentsConfig(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
61
|
-
export declare function handleAgentsSetConfig(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
62
|
-
export declare function handleAgentsGetConfig(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
63
|
-
export declare function handleAgentsRemoveConfig(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Log out / switch account for an `account`-mode agent: clear the CLI's own native credential store
|
|
66
|
-
* (where we know it — e.g. codex's ~/.codex/auth.json) and invalidate the resident pool so the next
|
|
67
|
-
* turn re-evaluates auth (and re-prompts login). For agents whose store we don't manage, returns a
|
|
68
|
-
* hint to run the CLI's own `logout`. "Switch account" = logout, then log in again.
|
|
69
|
-
*/
|
|
70
|
-
export declare function handleAgentsLogout(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
71
|
-
export declare function handleAgentsSetGateway(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
72
|
-
export declare function handleAgentsGetGateway(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
73
|
-
export declare function handleAgentsListConfigured(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
74
|
-
export declare function handleAgentsGetLog(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
75
|
-
export declare function handleAgentsTestConnection(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
76
|
-
/** Formats a session persisted transcript into a compact prior-conversation block for an external
|
|
77
|
-
* ACP agent that was cold-spawned (fresh process, empty session). Mirrors the built-in agent
|
|
78
|
-
* withResumedHistory: the engine on-disk history is authoritative, so we re-supply it and the agent
|
|
79
|
-
* regains full context after a restart/eviction. Only user/assistant text turns are included;
|
|
80
|
-
* returns "" when there is no prior history (e.g. the first turn of a new session). */
|
|
81
|
-
export declare function buildExternalHistoryPreamble(messages: Array<{
|
|
82
|
-
role: string;
|
|
83
|
-
content: unknown;
|
|
84
|
-
}>): string;
|
|
85
|
-
/** Wraps the owner-level global memory cheat sheet (preferences/boundaries) for an external
|
|
86
|
-
* agent's cold open. Third-party agents (codex/claude/...) run their own brains and never see
|
|
87
|
-
* our per-turn memory channel — without this, a user's standing preferences vanish the moment
|
|
88
|
-
* they switch agents. Injection frequency is ONCE PER PROCESS CONTEXT: it rides the same
|
|
89
|
-
* cold-spawn moment that (re)builds the agent's context (first turn of a session, or a respawn
|
|
90
|
-
* after restart/eviction — where the full history is re-sent anyway), and never on warm turns.
|
|
91
|
-
* That is the floor for a stateless external process, not a per-message tax. Size is capped by
|
|
92
|
-
* readUserIndexForPrompt itself (2048 chars / 40 lines, visible truncation marker). */
|
|
93
|
-
export declare function buildExternalMemoryPreamble(globalIndex: string | null): string;
|
|
94
|
-
/**
|
|
95
|
-
* Decide how a native-cwd session resumes on a COLD spawn, and whether that resume already carries
|
|
96
|
-
* our injected global memory sheet (so the caller can skip re-injecting it). Pure given its inputs.
|
|
97
|
-
*
|
|
98
|
-
* - BINDING resume (a `nativeBinding.nativeSessionId` persisted by a prior app turn): that prior
|
|
99
|
-
* turn injected the sheet into the prompt codex/claude recorded in its OWN rollout, so the
|
|
100
|
-
* restored context carries it → resumedFromBinding=true (skip re-inject).
|
|
101
|
-
* - LAZY-MIGRATION resume (no binding yet, but the canonical id exists in the native store — a
|
|
102
|
-
* session the user may have started in codex/claude directly): its rollout has NEVER seen our
|
|
103
|
-
* sheet → resumedFromBinding=false (inject once; after this turn the binding persists and
|
|
104
|
-
* subsequent resumes take the binding branch, injecting exactly once total).
|
|
105
|
-
* - Neither (brand-new session): no resume → inject as a normal cold open.
|
|
106
|
-
*
|
|
107
|
-
* Conflating binding with lazy-migration (resume===bound) silently starves migrated sessions of the
|
|
108
|
-
* user's preferences — the whole point of the injection is that they follow the user across agents.
|
|
109
|
-
*/
|
|
110
|
-
export declare function resolveNativeColdResume(input: {
|
|
111
|
-
sessionId: string;
|
|
112
|
-
boundNativeSessionId: string | undefined;
|
|
113
|
-
nativeSessionExists: () => Promise<boolean>;
|
|
114
|
-
}): Promise<{
|
|
115
|
-
effectiveResume: string | undefined;
|
|
116
|
-
resumedFromBinding: boolean;
|
|
117
|
-
}>;
|
|
118
|
-
/** Pre-warm an external agent's process (on agent-select) so the first message skips the cold start. */
|
|
119
|
-
export declare function handleAgentsWarm(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
120
|
-
export declare function handleAgentsPrompt(this: AgentsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
121
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project CRUD handlers extracted from StdioServer.
|
|
3
|
-
* Handles: project.create, project.list, project.delete, project.rename,
|
|
4
|
-
* project.archive, project.unarchive
|
|
5
|
-
*/
|
|
6
|
-
import { type AgentRpcError, type AgentRpcRequest } from "../../protocol/wire/index.js";
|
|
7
|
-
import type { ProjectMemoryStore, ProjectMemoryStoreFactory } from "../../runtime/ports/index.js";
|
|
8
|
-
export interface ProjectHandlerHost {
|
|
9
|
-
memdir: ProjectMemoryStore | null;
|
|
10
|
-
projectMemoryStoreFactory: ProjectMemoryStoreFactory;
|
|
11
|
-
mediaPersistence: {
|
|
12
|
-
setProjectDir(projectDir: string): void;
|
|
13
|
-
releaseProjectDir?(projectDir: string): void;
|
|
14
|
-
};
|
|
15
|
-
getActiveProjectRoot(): string;
|
|
16
|
-
setActiveWorkdir(dir: string): void;
|
|
17
|
-
sendNotification(method: string, params: Record<string, unknown>): void;
|
|
18
|
-
sendResponse(id: string | number, result?: unknown, error?: AgentRpcError): void;
|
|
19
|
-
}
|
|
20
|
-
export declare function handleProjectCreate(this: ProjectHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
21
|
-
export declare function handleProjectList(this: ProjectHandlerHost, msg: AgentRpcRequest): void;
|
|
22
|
-
export declare function handleProjectSwitch(this: ProjectHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Reliable recursive directory removal for Windows. fs.rmSync({recursive,force}) cannot be trusted
|
|
25
|
-
* here: on git repos it silently leaves read-only object/pack files (and whole subtrees) behind
|
|
26
|
-
* without throwing. This walks bottom-up, clearing the read-only attribute (chmod) on the EPERM
|
|
27
|
-
* retry, which deletes git worktrees/repos cleanly. Per-entry failures (e.g. a live EBUSY lock) are
|
|
28
|
-
* swallowed; the caller verifies via existsSync and decides success/retry.
|
|
29
|
-
*/
|
|
30
|
-
export declare function rmDirRobustSync(target: string): void;
|
|
31
|
-
export declare function handleProjectDelete(this: ProjectHandlerHost, msg: AgentRpcRequest): void;
|
|
32
|
-
export declare function handleProjectPurgeAll(this: ProjectHandlerHost, msg: AgentRpcRequest): void;
|
|
33
|
-
export declare function handleProjectRename(this: ProjectHandlerHost, msg: AgentRpcRequest): void;
|
|
34
|
-
export declare function handleProjectArchive(this: ProjectHandlerHost, msg: AgentRpcRequest): void;
|
|
35
|
-
export declare function handleProjectUnarchive(this: ProjectHandlerHost, msg: AgentRpcRequest): void;
|
|
36
|
-
export declare function handleProjectUpdate(this: ProjectHandlerHost, msg: AgentRpcRequest): void;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ProjectInfo } from "../protocol/methods.js";
|
|
2
|
-
import type { ProjectMemoryStore, ProjectMemoryStoreFactory } from "../runtime/ports/index.js";
|
|
3
|
-
export interface ProjectCommandHost {
|
|
4
|
-
memdir: ProjectMemoryStore | null;
|
|
5
|
-
projectMemoryStoreFactory: ProjectMemoryStoreFactory;
|
|
6
|
-
mediaPersistence: {
|
|
7
|
-
setProjectDir(projectDir: string): void;
|
|
8
|
-
};
|
|
9
|
-
setActiveWorkdir(dir: string): void;
|
|
10
|
-
}
|
|
11
|
-
export interface ProjectCreateCommand {
|
|
12
|
-
name: string;
|
|
13
|
-
workspaceDir?: string;
|
|
14
|
-
type?: string;
|
|
15
|
-
groupId?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface ProjectCreateResult {
|
|
18
|
-
project: ProjectInfo;
|
|
19
|
-
nameDuplicate?: ProjectInfo;
|
|
20
|
-
isAgentTeamProject: boolean;
|
|
21
|
-
/** True when creation switched the active project (container types never switch). */
|
|
22
|
-
autoSwitched: boolean;
|
|
23
|
-
deduplicated?: boolean;
|
|
24
|
-
}
|
|
25
|
-
type ProjectPlanStatus = NonNullable<ProjectInfo["planStatus"]>;
|
|
26
|
-
export declare function isProjectPlanStatus(value: unknown): value is ProjectPlanStatus;
|
|
27
|
-
export declare function createProject(host: ProjectCommandHost, command: ProjectCreateCommand): Promise<ProjectCreateResult>;
|
|
28
|
-
export {};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import type { ProductOrchestrator } from "./agent-instance.js";
|
|
2
|
-
import type { DelegateRequestParams, SupervisorEventSink, TurnResult } from "../host-contract/index.js";
|
|
3
|
-
/**
|
|
4
|
-
* 激活层(S3c):gateway-routed delegate 传输桥(解耦接口;wire 从 AcpServer.delegate/supportsDelegate 供)。
|
|
5
|
-
* hostSupportsDelegate(=gateway 在 initialize 声明 delegate 能力位)时,run() 改走此桥:leader 请网关代派
|
|
6
|
-
* worker 回合(x/delegate),事件回流经 sink,resolve 统一 TurnResult —— 不再 ProductOrchestrator.create
|
|
7
|
-
* 本地 spawn。gate 关(gateway 未声明)= isSupported()=false = 旧路径保留(单轨,zero-regression)。
|
|
8
|
-
*/
|
|
9
|
-
export interface DelegateBridge {
|
|
10
|
-
/** T9:gateway 声明 delegate 能力才放行(否则旧 ProcessManager/Orchestrator 路径)。 */
|
|
11
|
-
isSupported(): boolean;
|
|
12
|
-
/** 上行 x/delegate(resolve TurnResult;回流事件经 sink)。 */
|
|
13
|
-
send(params: DelegateRequestParams, sink: SupervisorEventSink): Promise<TurnResult>;
|
|
14
|
-
/** x/delegate.cancel(取消回合,不杀进程;rec.abort 触发时调)。 */
|
|
15
|
-
cancel(delegationId: string): void;
|
|
16
|
-
/**
|
|
17
|
-
* x/delegate.respond(leader 来源审批应答,通知 fire-and-forget;optionId 不透明透传 E2)。
|
|
18
|
-
* 站点收到 sink.onApprovalRequest 后按用户/策略决议经此应答(chat 站 §1.1 审批往返;
|
|
19
|
-
* gateway 侧 delegate-server → supervisor.respondApproval,freeze §11 补遗#3 唯一应答口)。
|
|
20
|
-
*/
|
|
21
|
-
respond(delegationId: string, approvalId: string, optionId: string): void;
|
|
22
|
-
}
|
|
23
|
-
export interface DelegationNotify {
|
|
24
|
-
(method: string, payload: Record<string, unknown>): void;
|
|
25
|
-
}
|
|
26
|
-
export interface DelegationDeps {
|
|
27
|
-
orchestrator: ProductOrchestrator;
|
|
28
|
-
cwd: string;
|
|
29
|
-
notify: DelegationNotify;
|
|
30
|
-
log?: {
|
|
31
|
-
info(m: string): void;
|
|
32
|
-
warn(m: string): void;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* 激活层(S3c):gateway-routed delegate 传输 + 会话上下文(可选;缺省 = 旧 ProductOrchestrator 路径)。
|
|
36
|
-
* bridge.isSupported()=true(gateway 声明 delegate 能力位)时,run() 改走 gateway 代派 worker;否则旧路径。
|
|
37
|
-
* projectId = deriveProjectId(cwd)(wire 供,避免 coordinator import agent-paths;单轨解析权威在会话面)。
|
|
38
|
-
*/
|
|
39
|
-
delegate?: {
|
|
40
|
-
bridge: DelegateBridge;
|
|
41
|
-
projectId: string;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
type DelegationStatus = "running" | "completed" | "failed" | "cancelled" | "timed_out";
|
|
45
|
-
export declare class DelegationCoordinator {
|
|
46
|
-
private readonly deps;
|
|
47
|
-
private readonly active;
|
|
48
|
-
/** Per-(chat×agent) tail promise — the next same-conversation delegation chains after it so they run
|
|
49
|
-
* strictly sequentially (single writer to the shared reused worktree + native session). One entry per
|
|
50
|
-
* active (chat×agent) pair (keyed, overwritten — not per-delegation), so it stays bounded. */
|
|
51
|
-
private readonly convChains;
|
|
52
|
-
/** Per-(chat×agent) native (codex/claude) session id — the background analogue of the foreground U5
|
|
53
|
-
* convergence. Seeded from the first delegation's captured session id; passed as resumeNativeSessionId on
|
|
54
|
-
* every subsequent same-conversation delegation so context accumulates (git AND non-git projects).
|
|
55
|
-
* In-memory (one entry per active pair); an engine restart resets it → the next delegation starts fresh,
|
|
56
|
-
* same as a cold foreground turn whose pool was evicted. */
|
|
57
|
-
private readonly nativeSessions;
|
|
58
|
-
constructor(deps: DelegationDeps);
|
|
59
|
-
/** Active + recent delegations for this project (x/mention.list). */
|
|
60
|
-
list(): {
|
|
61
|
-
delegationId: string;
|
|
62
|
-
agentId: string;
|
|
63
|
-
brief: string;
|
|
64
|
-
status: DelegationStatus;
|
|
65
|
-
}[];
|
|
66
|
-
/** Cancel a running delegation — aborts the poll loop, which drains+kills the worker. */
|
|
67
|
-
cancel(delegationId: string): {
|
|
68
|
-
ok: boolean;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Dispatch ONE ad-hoc task to `agentId` in the background. Returns immediately with the delegationId;
|
|
72
|
-
* the lifecycle (started / settled) is reported via notify(mention.*). An unready/uninstalled agent
|
|
73
|
-
* surfaces as a `failed` settle (never a thrown RPC).
|
|
74
|
-
*/
|
|
75
|
-
delegate(agentId: string, brief: string, opts?: {
|
|
76
|
-
acceptanceCriteria?: string;
|
|
77
|
-
delegationId?: string;
|
|
78
|
-
sessionId?: string;
|
|
79
|
-
}): {
|
|
80
|
-
delegationId: string;
|
|
81
|
-
};
|
|
82
|
-
private run;
|
|
83
|
-
/**
|
|
84
|
-
* 激活层(S3c):gateway-routed delegate 路径 —— 不本地 spawn,请网关代派一个 worker 回合。
|
|
85
|
-
* leader 铸 delegationId(rec.delegationId 已是 `del-*`,承 Q4「leader 铸 + gateway 校验唯一」);
|
|
86
|
-
* 回流 sink 把 worker 工具活动转 mention.delegate_activity(live 进度),final 由 TurnResult 承。
|
|
87
|
-
* 与旧路径行为对齐:started/settled 通知、cancel 语义(rec.abort → x/delegate.cancel)、convChain 串行不变。
|
|
88
|
-
*
|
|
89
|
-
* native session 累积(跨同会话委派的 resume)在此路径由 gateway SessionProjectService.recordNativeSessionId
|
|
90
|
-
* 于 relay 观察点回填(freeze §11 补遗#2)—— coordinator 不再本地捕获 getDelegationNativeSessionId(单轨,权威上移)。
|
|
91
|
-
*/
|
|
92
|
-
private runViaDelegate;
|
|
93
|
-
/** Collect a delegation's produced artifacts: the union of the worktree diff (tasks[].changedFiles,
|
|
94
|
-
* omitted by the wire type but carried at runtime) and the mtime-isolated capture of project-root files
|
|
95
|
-
* (for workers that write straight to the workspace), plus the worker task + terminal phase. Shared by
|
|
96
|
-
* the normal terminal path AND the timeout path, so a timed-out run still hands back its partial output. */
|
|
97
|
-
private collectProducts;
|
|
98
|
-
private settle;
|
|
99
|
-
}
|
|
100
|
-
export {};
|