qlogicagent 2.20.6 → 2.20.7
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 +27 -54
- package/dist/agent-contract.js +1 -1
- package/dist/agent.js +42 -41
- package/dist/cli.js +1 -1
- package/dist/host-contract.js +1 -1
- package/dist/index.js +539 -565
- package/dist/orchestration.js +14 -14
- package/dist/project-memory-host.js +30 -33
- package/dist/protocol.js +1 -1
- package/dist/types/agent/memory-recall-context.d.ts +7 -0
- package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +2 -0
- package/dist/types/agent/tool-loop/direct-response-contract.d.ts +12 -0
- package/dist/types/agent/tool-loop/final-status-stream-suppressor.d.ts +22 -0
- package/dist/types/agent/tool-loop/loop-helpers.d.ts +2 -2
- package/dist/types/agent/tool-loop.d.ts +5 -1
- package/dist/types/agent/types.d.ts +27 -15
- package/dist/types/cli/acp-commands.d.ts +1 -1
- package/dist/types/cli/acp-extended-handlers.d.ts +13 -3
- package/dist/types/cli/agent-runtime-session-state.d.ts +1 -0
- package/dist/types/cli/base-tool-bootstrap.d.ts +0 -7
- package/dist/types/cli/community-skill-installer.d.ts +2 -0
- package/dist/types/cli/core-tool-coordinator.d.ts +0 -3
- package/dist/types/cli/core-tools/registry.d.ts +1 -4
- package/dist/types/cli/handlers/config-handler.d.ts +0 -1
- package/dist/types/cli/handlers/goal-handler.d.ts +24 -0
- package/dist/types/cli/handlers/memory-handler.d.ts +1 -2
- package/dist/types/cli/handlers/skill-curator-handler.d.ts +8 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +9 -12
- package/dist/types/cli/memory-candidate-service.d.ts +1 -8
- package/dist/types/cli/memory-coordinator.d.ts +1 -13
- package/dist/types/cli/product-acp-params.d.ts +1 -0
- package/dist/types/cli/provider-core-facade.d.ts +2 -30
- package/dist/types/cli/rpc-registry.d.ts +2 -4
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +1 -2
- package/dist/types/cli/stdio-acp-request-host.d.ts +1 -2
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +0 -2
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +0 -7
- package/dist/types/cli/stdio-runtime-services.d.ts +1 -8
- package/dist/types/cli/stdio-server.d.ts +0 -4
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +0 -4
- package/dist/types/cli/tool-bootstrap.d.ts +0 -17
- package/dist/types/contracts/memory-recall-packet.d.ts +31 -0
- package/dist/types/contracts/memory-response-contract.d.ts +2 -0
- package/dist/types/contracts/tool-execution-evidence.d.ts +8 -0
- package/dist/types/contracts/tool-name.d.ts +10 -0
- package/dist/types/contracts/turn-event.d.ts +36 -3
- package/dist/types/host-contract/acp-content.d.ts +45 -0
- package/dist/types/host-contract/index.d.ts +59 -48
- package/dist/types/orchestration/agent-instance.d.ts +21 -1
- package/dist/types/orchestration/agent-roster.d.ts +14 -15
- package/dist/types/orchestration/dag-scheduler.d.ts +4 -0
- package/dist/types/orchestration/goal-context-envelope.d.ts +7 -0
- package/dist/types/orchestration/goal-loop-coordinator.d.ts +55 -12
- package/dist/types/orchestration/goal-mode-adapters.d.ts +13 -1
- package/dist/types/orchestration/goal-run-persistence.d.ts +9 -2
- package/dist/types/orchestration/goal-run-types.d.ts +127 -13
- package/dist/types/orchestration/index.d.ts +1 -1
- package/dist/types/orchestration/product-persistence.d.ts +10 -1
- package/dist/types/orchestration/product-planner.d.ts +3 -3
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +1 -0
- package/dist/types/orchestration/workflow/data-item.d.ts +1 -1
- package/dist/types/orchestration/workflow/expression.d.ts +1 -2
- package/dist/types/orchestration/workflow/workflow-patch.d.ts +1 -2
- package/dist/types/orchestration/workflow/workflow-render.d.ts +1 -2
- package/dist/types/project-memory-host.d.ts +1 -0
- package/dist/types/protocol/agent-contract.d.ts +10 -8
- package/dist/types/protocol/methods.d.ts +2 -19
- package/dist/types/protocol/notifications.d.ts +1 -1
- package/dist/types/protocol/wire/acp-agent-management.d.ts +48 -6
- package/dist/types/protocol/wire/acp-protocol.d.ts +11 -24
- package/dist/types/protocol/wire/agent-methods.d.ts +5 -142
- package/dist/types/protocol/wire/chat-types.d.ts +50 -0
- package/dist/types/protocol/wire/index.d.ts +2 -2
- package/dist/types/protocol/wire/notification-payloads.d.ts +73 -122
- package/dist/types/protocol/wire/thread-protocol.d.ts +4 -40
- package/dist/types/runtime/community/community-consent-client.d.ts +0 -13
- package/dist/types/runtime/context/context-compression-strategies.d.ts +29 -0
- package/dist/types/runtime/context/context-envelope.d.ts +3 -0
- package/dist/types/runtime/execution/dream-agent.d.ts +4 -5
- package/dist/types/runtime/execution/mcp-capability-selection.d.ts +54 -0
- package/dist/types/runtime/execution/memory-decay.d.ts +1 -1
- package/dist/types/runtime/execution/search-result-quality.d.ts +22 -0
- package/dist/types/runtime/execution/streaming-tool-executor.d.ts +2 -0
- package/dist/types/runtime/execution/tool-result-storage.d.ts +44 -0
- package/dist/types/runtime/hooks/memory-hooks.d.ts +3 -2
- package/dist/types/runtime/infra/agent-paths.d.ts +0 -8
- package/dist/types/runtime/infra/default-path-service.d.ts +0 -2
- package/dist/types/runtime/infra/llmrouter-managed-inference.d.ts +54 -1
- package/dist/types/runtime/infra/media-persistence.d.ts +6 -36
- package/dist/types/runtime/memory/implicit-extraction.d.ts +7 -15
- package/dist/types/runtime/memory/memory-recall-attribution.d.ts +24 -0
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +14 -0
- package/dist/types/runtime/ports/index.d.ts +1 -3
- package/dist/types/runtime/ports/memory-provider.d.ts +2 -19
- package/dist/types/runtime/ports/memory-writer.d.ts +1 -1
- package/dist/types/runtime/ports/path-service.d.ts +0 -2
- package/dist/types/runtime/prompt/capability-routing-policy.d.ts +13 -0
- package/dist/types/runtime/prompt/environment-context.d.ts +3 -6
- package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +8 -13
- package/dist/types/runtime/prompt/tool-necessity-policy.d.ts +12 -0
- package/dist/types/skills/mcp/mcp-manager.d.ts +29 -4
- package/dist/types/skills/memory/host-memory-provider.d.ts +3 -9
- package/dist/types/skills/memory/memdir.d.ts +1 -1
- package/dist/types/skills/memory/memory-content-safety.d.ts +1 -0
- package/dist/types/skills/permissions/hook-runner.d.ts +3 -3
- package/dist/types/skills/portable-tool.d.ts +5 -0
- package/dist/types/skills/skill-system/skill-lifecycle.d.ts +1 -0
- package/dist/types/skills/tools/exec-tool.d.ts +1 -5
- package/dist/types/skills/tools/shell/command-compatibility.d.ts +3 -0
- package/dist/types/skills/tools/shell/index.d.ts +4 -3
- package/dist/types/skills/tools/shell/shell-exec.d.ts +15 -8
- package/dist/types/skills/tools/shell/shell-provider.d.ts +26 -0
- package/dist/types/transport/acp-server.d.ts +4 -1
- package/dist/types/transport/host-community-client.d.ts +0 -1
- package/dist/types/transport/host-request-client.d.ts +1 -0
- package/dist/types/transport/host-run-state-client.d.ts +1 -1
- package/dist/workflow-host.js +6 -6
- package/package.json +4 -3
- package/dist/skills/mcp/astraclaw-native-mcp-server.js +0 -12
- package/dist/types/cli/core-tools/checkpoint-tool-bootstrap.d.ts +0 -9
- package/dist/types/cli/core-tools/checkpoint-tool-service.d.ts +0 -7
- package/dist/types/cli/core-tools/config-tool-bootstrap.d.ts +0 -7
- package/dist/types/cli/core-tools/config-tool-service.d.ts +0 -13
- package/dist/types/cli/core-tools/monitor-tool-bootstrap.d.ts +0 -7
- package/dist/types/cli/core-tools/monitor-tool-service.d.ts +0 -6
- package/dist/types/cli/dev-tool-bootstrap.d.ts +0 -9
- package/dist/types/cli/dev-tools/dev-tool-bootstrap-service.d.ts +0 -7
- package/dist/types/cli/dev-tools/dev-tool-registry.d.ts +0 -8
- package/dist/types/cli/dev-tools/incremental-repo-map.d.ts +0 -81
- package/dist/types/cli/dev-tools/lsp-supervisor.d.ts +0 -59
- package/dist/types/cli/dev-tools/lsp-tool-service.d.ts +0 -7
- package/dist/types/cli/handlers/media-handler.d.ts +0 -19
- package/dist/types/cli/handlers/skills-handler.d.ts +0 -37
- package/dist/types/cli/industrial-runtime-store.d.ts +0 -16
- package/dist/types/cli/media-capability-schema.d.ts +0 -49
- package/dist/types/cli/media-file-api-service.d.ts +0 -73
- package/dist/types/cli/media-file-tool-service.d.ts +0 -13
- package/dist/types/cli/media-inline.d.ts +0 -31
- package/dist/types/cli/media-runtime-facade.d.ts +0 -51
- package/dist/types/cli/media-understanding.d.ts +0 -102
- package/dist/types/cli/skill-invocation-service.d.ts +0 -10
- package/dist/types/cli/skill-tools-bootstrap.d.ts +0 -35
- package/dist/types/cli/skills-query-service.d.ts +0 -41
- package/dist/types/cli/tool-bootstrap-media-registration.d.ts +0 -20
- package/dist/types/cli/turn-media-setup.d.ts +0 -34
- package/dist/types/cli/turn-preview-browser-setup.d.ts +0 -15
- package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +0 -33
- package/dist/types/runtime/infra/builtin-skills-seed.d.ts +0 -31
- package/dist/types/runtime/infra/checkpoint-backend.d.ts +0 -9
- package/dist/types/runtime/infra/industrial-runtime-session-server.d.ts +0 -20
- package/dist/types/runtime/infra/migrate-project-skills.d.ts +0 -24
- package/dist/types/runtime/infra/project-skill-manifest.d.ts +0 -21
- package/dist/types/runtime/infra/skill-resolver.d.ts +0 -74
- package/dist/types/runtime/infra/worktree-backend.d.ts +0 -86
- package/dist/types/runtime/ports/checkpoint-contracts.d.ts +0 -19
- package/dist/types/runtime/ports/worktree-contracts.d.ts +0 -22
- package/dist/types/skills/mcp/astraclaw-native-mcp-server.d.ts +0 -1
- package/dist/types/skills/memory/memory-tool.d.ts +0 -87
- package/dist/types/skills/tools/checkpoint-tool.d.ts +0 -66
- package/dist/types/skills/tools/config-tool.d.ts +0 -61
- package/dist/types/skills/tools/file-management-tool.d.ts +0 -90
- package/dist/types/skills/tools/image-generate-tool.d.ts +0 -98
- package/dist/types/skills/tools/instructions-tool.d.ts +0 -65
- package/dist/types/skills/tools/lsp-tool.d.ts +0 -153
- package/dist/types/skills/tools/media-cancel-tool.d.ts +0 -30
- package/dist/types/skills/tools/media-understand-tool.d.ts +0 -28
- package/dist/types/skills/tools/monitor-tool.d.ts +0 -113
- package/dist/types/skills/tools/music-generate-tool.d.ts +0 -80
- package/dist/types/skills/tools/notebook-edit-tool.d.ts +0 -15
- package/dist/types/skills/tools/preview-browser-tool.d.ts +0 -136
- package/dist/types/skills/tools/repo-map-tool.d.ts +0 -52
- package/dist/types/skills/tools/skill-tool.d.ts +0 -142
- package/dist/types/skills/tools/sleep-tool.d.ts +0 -49
- package/dist/types/skills/tools/stt-tool.d.ts +0 -33
- package/dist/types/skills/tools/subagent-decision-tool.d.ts +0 -15
- package/dist/types/skills/tools/three-d-generate-tool.d.ts +0 -46
- package/dist/types/skills/tools/tts-tool.d.ts +0 -50
- package/dist/types/skills/tools/video-edit-tool.d.ts +0 -72
- package/dist/types/skills/tools/video-generate-tool.d.ts +0 -162
- package/dist/types/skills/tools/video-merge-tool.d.ts +0 -105
- package/dist/types/skills/tools/video-upscale-tool.d.ts +0 -45
- package/dist/types/skills/tools/voice-clone-tool.d.ts +0 -40
- package/dist/types/skills/tools/worktree-tool.d.ts +0 -69
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared media-understanding — single source of truth for turning a non-text medium
|
|
3
|
-
* (image / audio / video) into plain text via the matching understanding model.
|
|
4
|
-
*
|
|
5
|
-
* Used by BOTH pipelines:
|
|
6
|
-
* - memory candidates (memory-candidate-service.ts): passes a base64 `data:` URL built
|
|
7
|
-
* from persisted attachment bytes.
|
|
8
|
-
* - the turn gate (handlers/turn-handler.ts): passes the local media-proxy URL already
|
|
9
|
-
* stamped onto the user message, so a medium the main model can't consume is routed
|
|
10
|
-
* to the understanding model and its description injected instead of dropped.
|
|
11
|
-
*
|
|
12
|
-
* The function is URL-agnostic on purpose: it just places whatever URL string it is given
|
|
13
|
-
* onto the modality-correct message field and streams the reply. It never reads attachment
|
|
14
|
-
* bytes and never persists anything — callers own storage/injection.
|
|
15
|
-
*/
|
|
16
|
-
export type UnderstandMediaKind = "image" | "audio" | "video";
|
|
17
|
-
/** Maps each medium to the ModelPurpose that understands it. */
|
|
18
|
-
export declare const PURPOSE_BY_KIND: Record<UnderstandMediaKind, "imageUnderstanding" | "stt" | "videoUnderstanding">;
|
|
19
|
-
/** Maps each medium to the ChatMessage field the transport reads media URLs from. */
|
|
20
|
-
export declare const URL_FIELD_BY_KIND: Record<UnderstandMediaKind, "imageUrls" | "audioUrls" | "videoUrls">;
|
|
21
|
-
/** Per-medium instruction. Every kind is normalized to plain text so callers only swap a label. */
|
|
22
|
-
export declare const PROMPT_BY_KIND: Record<UnderstandMediaKind, string>;
|
|
23
|
-
/**
|
|
24
|
-
* The subset of stream-chunk fields understandMediaUrl inspects. Deliberately loose and
|
|
25
|
-
* all-optional beyond `type` so it stays structurally compatible with the real LLMTransport's
|
|
26
|
-
* discriminated LLMChunk union (delta / usage / error / done all satisfy it) and the memory
|
|
27
|
-
* client. Beyond the `delta` text we read the `usage` tokens and the terminal `error` / `done`
|
|
28
|
-
* so an empty reply can be diagnosed (medium never reached the model) rather than silently
|
|
29
|
-
* reported as a blank description.
|
|
30
|
-
*/
|
|
31
|
-
export interface UnderstandMediaChunk {
|
|
32
|
-
type: string;
|
|
33
|
-
text?: string;
|
|
34
|
-
promptTokens?: number;
|
|
35
|
-
completionTokens?: number;
|
|
36
|
-
finishReason?: string;
|
|
37
|
-
message?: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* A resolved understanding client. Structurally compatible with both the real LLMTransport
|
|
41
|
-
* (whose `stream` takes an optional third `signal` arg) and the memory client. Deliberately
|
|
42
|
-
* loose on the request/chunk shapes so it composes with either caller without import cycles.
|
|
43
|
-
*/
|
|
44
|
-
export interface UnderstandMediaClient {
|
|
45
|
-
model: string;
|
|
46
|
-
apiKey: string;
|
|
47
|
-
transport: {
|
|
48
|
-
stream(request: object, apiKey: string, signal?: AbortSignal): AsyncIterable<UnderstandMediaChunk>;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Why an understanding call yielded no usable text. Lets callers separate a genuine "the model
|
|
53
|
-
* looked and had nothing to say" (`empty_output`) from "the medium never reached the model"
|
|
54
|
-
* (`fetch_failed`) — the silent-empty failure mode where an unfetchable image (e.g. a private-OSS
|
|
55
|
-
* URL the provider 403s on) bills zero input tokens, so an empty reply is a delivery failure, not
|
|
56
|
-
* a blank description. `stream_error` is an explicit upstream error surfaced mid-stream.
|
|
57
|
-
*/
|
|
58
|
-
export type MediaUnderstandFailure = "fetch_failed" | "stream_error" | "empty_output";
|
|
59
|
-
/**
|
|
60
|
-
* Structured outcome of understandMediaUrl. `text` is the transcript (empty ⇔ the model produced
|
|
61
|
-
* no text); when `text` is empty, `failure` classifies WHY so callers can surface a delivery
|
|
62
|
-
* failure distinctly instead of treating every empty reply as "nothing to describe". The token /
|
|
63
|
-
* finishReason fields carry the diagnostic evidence for logs.
|
|
64
|
-
*/
|
|
65
|
-
export interface UnderstandMediaResult {
|
|
66
|
-
/** The model's trimmed text. Empty string ⇔ no text was produced (see `failure`). */
|
|
67
|
-
text: string;
|
|
68
|
-
/** Input tokens the provider billed, if a usage chunk arrived. undefined ⇔ no usage chunk was
|
|
69
|
-
* seen at all — itself a strong "nothing reached, or came back from, the model" signal. */
|
|
70
|
-
promptTokens?: number;
|
|
71
|
-
/** Output tokens, if a usage chunk arrived. */
|
|
72
|
-
completionTokens?: number;
|
|
73
|
-
/** finishReason from the terminal chunk ("" / undefined ⇔ truncated or none). */
|
|
74
|
-
finishReason?: string;
|
|
75
|
-
/** Message from an explicit `error` chunk, if the stream surfaced one. */
|
|
76
|
-
errorText?: string;
|
|
77
|
-
/** Set when the reply is not a trustworthy result. Usually `text` is empty, but `fetch_failed` can
|
|
78
|
-
* accompany NON-empty `text` — an image billed at text-only tokens was never seen, so its "description"
|
|
79
|
-
* is confabulated. undefined ⇔ a real success; when set, callers must NOT treat `text` as valid. */
|
|
80
|
-
failure?: MediaUnderstandFailure;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Stream an already-built understanding request and classify an empty reply. Placement of the
|
|
84
|
-
* prompt and media URL(s) onto the request is the CALLER's job — this owns only the streaming +
|
|
85
|
-
* diagnosis, so every vision caller (the turn gate's understandMediaUrl AND the pet forge's image
|
|
86
|
-
* analysis / vision-QA) shares ONE definition of "fetch_failed vs empty_output vs stream_error"
|
|
87
|
-
* instead of each re-deriving it from a thin delta-only loop. `kind` drives only the image
|
|
88
|
-
* token-floor heuristic — pass the kind of the primary medium carried on the request.
|
|
89
|
-
*/
|
|
90
|
-
export declare function streamUnderstanding(client: UnderstandMediaClient, request: Record<string, unknown>, kind: UnderstandMediaKind, opts?: {
|
|
91
|
-
signal?: AbortSignal;
|
|
92
|
-
}): Promise<UnderstandMediaResult>;
|
|
93
|
-
/**
|
|
94
|
-
* Understand a single medium at `url`. Returns a structured result: the trimmed text (may be
|
|
95
|
-
* empty) plus, when empty, a `failure` classifying WHY. Never throws for an empty reply — the
|
|
96
|
-
* caller decides how to degrade, but can now tell a delivery failure (`fetch_failed`) apart from a
|
|
97
|
-
* blank description (`empty_output`) instead of treating every empty reply the same. Thin wrapper
|
|
98
|
-
* over streamUnderstanding that builds the single-URL, modality-correct request.
|
|
99
|
-
*/
|
|
100
|
-
export declare function understandMediaUrl(client: UnderstandMediaClient, kind: UnderstandMediaKind, url: string, opts?: {
|
|
101
|
-
signal?: AbortSignal;
|
|
102
|
-
}): Promise<UnderstandMediaResult>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { HostCapabilityClient } from "../transport/host-capability-client.js";
|
|
2
|
-
export interface RunSkillInvocationParams {
|
|
3
|
-
skillName: string;
|
|
4
|
-
skillContent: string;
|
|
5
|
-
userArgs?: string;
|
|
6
|
-
skillDir?: string;
|
|
7
|
-
sessionId?: string;
|
|
8
|
-
hostCapabilityClient: HostCapabilityClient;
|
|
9
|
-
}
|
|
10
|
-
export declare function runSkillInvocation(params: RunSkillInvocationParams): Promise<string>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { NotificationMethod, NotificationMethodMap } from "../protocol/notifications.js";
|
|
2
|
-
import type { MemoryLearningSink, PathService, ToolCatalog } from "../runtime/ports/index.js";
|
|
3
|
-
import type { WorkspaceSkill } from "../skills/skill-system/skill-types.js";
|
|
4
|
-
import type { HostCapabilityClient } from "../transport/host-capability-client.js";
|
|
5
|
-
export interface SkillToolsBootstrapDeps {
|
|
6
|
-
config: Record<string, unknown>;
|
|
7
|
-
pathService: PathService;
|
|
8
|
-
toolCatalog: ToolCatalog;
|
|
9
|
-
}
|
|
10
|
-
export type SkillLearningMemorySink = MemoryLearningSink;
|
|
11
|
-
export interface SkillToolsHost {
|
|
12
|
-
getActiveProjectRoot(): string;
|
|
13
|
-
getPluginSkills(): WorkspaceSkill[];
|
|
14
|
-
getHostCapabilityClient(): HostCapabilityClient | undefined;
|
|
15
|
-
sendNotification<M extends NotificationMethod>(method: M, params: NotificationMethodMap[M]): void;
|
|
16
|
-
getMemoryLearningSink(): SkillLearningMemorySink | null;
|
|
17
|
-
getMemoryUserId(): string;
|
|
18
|
-
}
|
|
19
|
-
export interface SkillToolsRegistrationContext extends SkillToolsBootstrapDeps {
|
|
20
|
-
host: SkillToolsHost;
|
|
21
|
-
}
|
|
22
|
-
export declare const skillToolsRegistrationModule: import("../runtime/ports/tool-contracts.js").ToolRegistrationModule<SkillToolsRegistrationContext>;
|
|
23
|
-
export declare function configureSkillToolsBootstrap(host: SkillToolsHost, deps: SkillToolsBootstrapDeps): void;
|
|
24
|
-
/**
|
|
25
|
-
* Resolve a supporting-file path inside a skill folder.
|
|
26
|
-
* Returns the absolute target, or null when the path escapes the skill dir
|
|
27
|
-
* or targets SKILL.md itself (SKILL.md must go through the validated
|
|
28
|
-
* content path, never the raw supporting-file write).
|
|
29
|
-
*/
|
|
30
|
-
export declare function resolveSupportingFilePath(skillDir: string, filePath: string): string | null;
|
|
31
|
-
/**
|
|
32
|
-
* 读技能文件:ENOENT(文件不存在)→ null(语义 = 技能/文件未安装);其余失败
|
|
33
|
-
* (EPERM/EISDIR 等)抛出真实错误 —— 读失败不能伪装成"技能不存在"。导出仅为单测。
|
|
34
|
-
*/
|
|
35
|
-
export declare function readSkillFileOrNull(label: string, filePath: string): Promise<string | null>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { HostCapabilityClient } from "../transport/host-capability-client.js";
|
|
2
|
-
export interface SkillListEntry {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
path: string;
|
|
6
|
-
/** Effective in this project: not globally muted and not muted in this project. */
|
|
7
|
-
active: boolean;
|
|
8
|
-
/** Muted everywhere (the plugin card's off switch). */
|
|
9
|
-
globallyDisabled: boolean;
|
|
10
|
-
/** Muted in THIS project only (the project opt-out). */
|
|
11
|
-
projectDisabled: boolean;
|
|
12
|
-
/** Frontmatter classification (Hub category vocabulary) — drives the card palette/tag. Undefined for unclassified legacy skills. */
|
|
13
|
-
category?: string;
|
|
14
|
-
/** Frontmatter author — agent-authored skills carry "用户". */
|
|
15
|
-
author?: string;
|
|
16
|
-
/** Provenance (lifecycle store): learned/created/promoted/copied = local origin; "installed" = from the Hub. */
|
|
17
|
-
source?: "learned" | "created" | "installed" | "promoted";
|
|
18
|
-
displayName: {
|
|
19
|
-
key: string;
|
|
20
|
-
fallback: string;
|
|
21
|
-
};
|
|
22
|
-
displayDescription: {
|
|
23
|
-
key: string;
|
|
24
|
-
fallback: string;
|
|
25
|
-
};
|
|
26
|
-
fallbackName: string;
|
|
27
|
-
fallbackDescription: string;
|
|
28
|
-
systemGenerated: boolean;
|
|
29
|
-
version?: string;
|
|
30
|
-
/** Registry version actually installed (from the lifecycle store) — same
|
|
31
|
-
* namespace as the catalog's latestVersion, so the UI can detect
|
|
32
|
-
* installed < latest and offer an update. Absent for non-registry skills. */
|
|
33
|
-
registryVersion?: string;
|
|
34
|
-
description?: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* List every skill in the single global store, annotated with its enablement
|
|
38
|
-
* scope and whether it is active in the given project. Name-collisions cannot
|
|
39
|
-
* occur (one directory per name in the store), so each skill appears once.
|
|
40
|
-
*/
|
|
41
|
-
export declare function listSkillsForProject(capability: HostCapabilityClient | undefined, projectRoot?: string): Promise<SkillListEntry[]>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { PortableTool } from "../skills/portable-tool.js";
|
|
2
|
-
import type { MediaPersistence } from "../runtime/infra/media-persistence.js";
|
|
3
|
-
import { type ModelPurpose } from "../runtime/infra/model-registry.js";
|
|
4
|
-
import type { LLMTransport } from "./provider-core-facade.js";
|
|
5
|
-
export interface LocalMediaToolRegistrationContext {
|
|
6
|
-
tools: PortableTool<any>[];
|
|
7
|
-
getCwd(): string;
|
|
8
|
-
activeProjectRoot(): string;
|
|
9
|
-
mediaPersistence?: MediaPersistence;
|
|
10
|
-
/** Resolves the LLM client bound to a model purpose — needed by the image/video understanding
|
|
11
|
-
* tools, which run the imageUnderstanding / videoUnderstanding purpose model (a vision LLM),
|
|
12
|
-
* NOT the media-generation runtime that stt/generation ride. Absent → those tools are skipped. */
|
|
13
|
-
resolveClientForPurpose?(purpose: ModelPurpose): {
|
|
14
|
-
transport: LLMTransport;
|
|
15
|
-
apiKey: string;
|
|
16
|
-
model: string;
|
|
17
|
-
} | null;
|
|
18
|
-
}
|
|
19
|
-
export declare const localMediaToolRegistrationModule: import("../runtime/ports/tool-contracts.js").ToolRegistrationModule<LocalMediaToolRegistrationContext>;
|
|
20
|
-
export declare function registerLocalMediaTools(context: LocalMediaToolRegistrationContext): void;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { TurnConfig } from "../agent/types.js";
|
|
2
|
-
import { type ModelRegistry } from "../runtime/infra/model-registry.js";
|
|
3
|
-
import { type MediaClient } from "./provider-core-facade.js";
|
|
4
|
-
interface MediaUsageRecorder {
|
|
5
|
-
addMediaUsage(model: string, billingUnit: string, quantity: number): void;
|
|
6
|
-
}
|
|
7
|
-
export interface TurnMediaSetupHost {
|
|
8
|
-
mediaClient: MediaClient;
|
|
9
|
-
currentMediaApiKeys: Record<string, string> | null;
|
|
10
|
-
sessionState?: MediaUsageRecorder | null;
|
|
11
|
-
sendNotification(method: string, params: Record<string, unknown>): void;
|
|
12
|
-
}
|
|
13
|
-
export declare function deriveMediaProvidersFromBindings(registry: Pick<ModelRegistry, "getBinding">): TurnConfig["mediaProviders"];
|
|
14
|
-
/**
|
|
15
|
-
* Derive per-turn media providers from a Host-pushed session profile's bindings. The Host materializes
|
|
16
|
-
* and pushes a FRESH profile every turn (session/set_config "profile") covering every purpose — media
|
|
17
|
-
* ones included (imageGeneration/tts/videoGeneration/musicGeneration/threeDGeneration/stt/voiceClone).
|
|
18
|
-
* Threading these into config.mediaProviders lets the fresh binding WIN over the once-hydrated in-process
|
|
19
|
-
* ModelRegistry default: configureTurnMedia merges config.mediaProviders OVER deriveMediaProvidersFromBindings,
|
|
20
|
-
* so a media purpose is no longer pinned to the registry snapshot until a process reload. Uses the same
|
|
21
|
-
* MEDIA_PURPOSES purpose→capability map as the registry path (single source of truth) and the same
|
|
22
|
-
* nativeModelId ?? model rule (profile bindings carry no nativeModelId today, so this resolves to model).
|
|
23
|
-
*/
|
|
24
|
-
export declare function deriveMediaProvidersFromProfileBindings(bindings: Record<string, {
|
|
25
|
-
provider?: string;
|
|
26
|
-
model?: string;
|
|
27
|
-
nativeModelId?: string;
|
|
28
|
-
}>): TurnConfig["mediaProviders"];
|
|
29
|
-
export declare function configureTurnMedia(params: {
|
|
30
|
-
host: TurnMediaSetupHost;
|
|
31
|
-
config?: Record<string, unknown>;
|
|
32
|
-
turnId: string;
|
|
33
|
-
}): void;
|
|
34
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { HostRequestClient } from "../transport/host-request-client.js";
|
|
2
|
-
import type { PreviewBrowserDriveResult, PreviewBrowserToolParams } from "../skills/tools/preview-browser-tool.js";
|
|
3
|
-
export interface TurnPreviewBrowserSetupHost {
|
|
4
|
-
/** The coordinator-owned unary host client, or undefined when no host is attached. */
|
|
5
|
-
getHostRequestClient(): Pick<HostRequestClient, "request"> | undefined;
|
|
6
|
-
/** Active turn attribution; injected into preview params, never accepted from agent tool input. */
|
|
7
|
-
readonly currentSessionId: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Build the preview_browser backend over the coordinator-owned HostRequestClient. The action is the
|
|
11
|
-
* service method and is removed from the action-specific payload. Preview owns an explicit 15s
|
|
12
|
-
* policy; failures remain visible as `{ error }`.
|
|
13
|
-
*/
|
|
14
|
-
export declare function makePreviewBrowserBackend(host: TurnPreviewBrowserSetupHost): (params: PreviewBrowserToolParams, signal?: AbortSignal) => Promise<PreviewBrowserDriveResult>;
|
|
15
|
-
export declare function configureTurnPreviewBrowser(host: TurnPreviewBrowserSetupHost): void;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ToolCatalog } from "../ports/index.js";
|
|
2
|
-
export declare const ASTRACLAW_CAPABILITIES_SERVER_NAME = "astraclaw_capabilities";
|
|
3
|
-
export declare const ASTRACLAW_CAPABILITIES_RETIRED_SERVER_NAMES: readonly ["astraclaw"];
|
|
4
|
-
export interface AstraClawCapabilityToolInput {
|
|
5
|
-
tool: string;
|
|
6
|
-
args: Record<string, unknown>;
|
|
7
|
-
projectRoot: string;
|
|
8
|
-
availableToolNames?: Iterable<string>;
|
|
9
|
-
currentEnvironment?: string;
|
|
10
|
-
toolCatalog?: ToolCatalog;
|
|
11
|
-
/**
|
|
12
|
-
* Configured MCP servers serving NO tools this session (invalid config / connect failure).
|
|
13
|
-
* Disclosed in mcp_connectors_list so a failed server is visibly missing, not silently absent.
|
|
14
|
-
*/
|
|
15
|
-
mcpServerFailures?: Array<{
|
|
16
|
-
name: string;
|
|
17
|
-
phase?: string;
|
|
18
|
-
error: string;
|
|
19
|
-
}>;
|
|
20
|
-
}
|
|
21
|
-
export type AstraClawCapabilityToolResult = {
|
|
22
|
-
handled: false;
|
|
23
|
-
} | {
|
|
24
|
-
handled: true;
|
|
25
|
-
result: unknown;
|
|
26
|
-
};
|
|
27
|
-
export declare function buildAstraClawCapabilitiesSystemPrompt(input: {
|
|
28
|
-
projectRoot: string;
|
|
29
|
-
mcpAvailable: boolean;
|
|
30
|
-
availableToolNames?: Iterable<string>;
|
|
31
|
-
currentEnvironment?: string;
|
|
32
|
-
}): Promise<string | undefined>;
|
|
33
|
-
export declare function handleAstraClawCapabilityToolCall(input: AstraClawCapabilityToolInput): Promise<AstraClawCapabilityToolResult>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export interface SeedBuiltinSkillsOptions {
|
|
2
|
-
/** Global skill store dir (getUserSkillsDir()). Each skill lands at <storeDir>/<name>/SKILL.md. */
|
|
3
|
-
storeDir: string;
|
|
4
|
-
/** Override the shipped builtin-skills source dir; defaults to the packaged skills/builtin. */
|
|
5
|
-
builtinDir?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface SeedBuiltinSkillsResult {
|
|
8
|
-
/** Names of skills newly copied this run (empty when all already present or source missing). */
|
|
9
|
-
seeded: string[];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Locate the shipped skills/builtin directory from a module directory.
|
|
13
|
-
*
|
|
14
|
-
* The module dir differs by packaging mode — crucially, the production build is an esbuild
|
|
15
|
-
* BUNDLE: this module is inlined into dist/cli.js, so at runtime import.meta.url resolves to
|
|
16
|
-
* dist/cli.js itself, NOT dist/runtime/infra/... Probe candidates in order:
|
|
17
|
-
* 1. hereDir/skills/builtin — bundle: hereDir = dist/ → dist/skills/builtin
|
|
18
|
-
* (build.mjs copies skills/builtin there).
|
|
19
|
-
* 2. hereDir/../../skills/builtin — unbundled dist module at dist/runtime/infra/.
|
|
20
|
-
* 3. hereDir/../../../skills/builtin — dev/tsx/vitest: src/runtime/infra → repo-root skills/builtin.
|
|
21
|
-
* Returns the first candidate that exists, or undefined when none does (stripped-down build).
|
|
22
|
-
* Exported pure (hereDir in → path out) so tests can drive it against synthetic layouts.
|
|
23
|
-
*/
|
|
24
|
-
export declare function resolveBuiltinDirFrom(hereDir: string): string | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Copy each builtin skill directory into the store only when its target does not yet exist.
|
|
27
|
-
* Idempotent: a second run with everything already present returns { seeded: [] }.
|
|
28
|
-
* Missing builtinDir is not an error — returns { seeded: [] } so a stripped-down build
|
|
29
|
-
* (or a local checkout without the assets) never blocks startup.
|
|
30
|
-
*/
|
|
31
|
-
export declare function seedBuiltinSkills(options: SeedBuiltinSkillsOptions): SeedBuiltinSkillsResult;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local Checkpoint Backend — git-based shadow repo implementation.
|
|
3
|
-
*
|
|
4
|
-
* Creates and manages checkpoint snapshots in the centralized companion store
|
|
5
|
-
* `~/.qlogicagent/projectData/<projectId>/checkpoints/<sessionId>/`
|
|
6
|
-
* (NOT inside the user's workspace) using a shadow git repository independent of the user's .git.
|
|
7
|
-
*/
|
|
8
|
-
import type { CheckpointBackend } from "../ports/checkpoint-contracts.js";
|
|
9
|
-
export declare function createLocalCheckpointBackend(projectRoot: string, sessionId: string): CheckpointBackend;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ConfigPort } from "../ports/index.js";
|
|
2
|
-
export interface IndustrialRuntimeChildEnv {
|
|
3
|
-
XIAOZHICLAW_RUNTIME_SESSION_URL: string;
|
|
4
|
-
XIAOZHICLAW_RUNTIME_SESSION_BEARER: string;
|
|
5
|
-
XIAOZHICLAW_RUNTIME_CONVERSATION_ID?: string;
|
|
6
|
-
XIAOZHICLAW_RUNTIME_CREDENTIAL_SUBJECT: string;
|
|
7
|
-
}
|
|
8
|
-
type ProbeSession = (signal: AbortSignal) => Promise<Response>;
|
|
9
|
-
export interface IndustrialRuntimeSessionServerForTest {
|
|
10
|
-
childEnv(sessionId?: string): IndustrialRuntimeChildEnv;
|
|
11
|
-
stop(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
export declare function industrialRuntimeSessionChildEnv(sessionId?: string): Promise<IndustrialRuntimeChildEnv | undefined>;
|
|
14
|
-
export declare function stopIndustrialRuntimeSessionServer(): Promise<void>;
|
|
15
|
-
export declare function __createIndustrialRuntimeSessionServerForTest(options: {
|
|
16
|
-
probeSession: ProbeSession;
|
|
17
|
-
configPort?: ConfigPort;
|
|
18
|
-
fetch?: typeof fetch;
|
|
19
|
-
}): Promise<IndustrialRuntimeSessionServerForTest>;
|
|
20
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One-shot migration: fold legacy per-project skill directories
|
|
3
|
-
* (`<projectRoot>/.qlogicagent/skills/<name>/`) into the single global store.
|
|
4
|
-
*
|
|
5
|
-
* Under the opt-out model every skill is global, so a freshly-migrated skill is parked GLOBALLY
|
|
6
|
-
* DISABLED — the same default as an agent-learned skill. The user re-enables it deliberately from
|
|
7
|
-
* the plugins page; a once-project-scoped skill must NOT silently light up in every project.
|
|
8
|
-
*
|
|
9
|
-
* Idempotent — a no-op once the legacy directory is gone, so it is safe to call on every project
|
|
10
|
-
* activation. Conflict-safe — if a DIFFERENT skill of the same name already exists in the store, the
|
|
11
|
-
* legacy copy is LEFT IN PLACE with a loud warning and never silently overwritten.
|
|
12
|
-
*/
|
|
13
|
-
export interface SkillMigrationResult {
|
|
14
|
-
/** Moved into the store fresh (parked globally disabled). */
|
|
15
|
-
migrated: string[];
|
|
16
|
-
conflicts: string[];
|
|
17
|
-
/** Already present in the store with identical content; legacy copy dropped, store entry untouched. */
|
|
18
|
-
reconciled: string[];
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Migrate one project's legacy skills into the global store. Best-effort and
|
|
22
|
-
* idempotent. Returns a summary of what happened.
|
|
23
|
-
*/
|
|
24
|
-
export declare function migrateProjectSkills(projectRoot: string): SkillMigrationResult;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill mute registries — under the single-store model, EVERY skill is global. There is no
|
|
3
|
-
* project-scoped / opt-in concept; instead there are two opt-OUT mute lists:
|
|
4
|
-
*
|
|
5
|
-
* - device-level (~/.qlogicagent/skills-disabled.json) — off in EVERY project
|
|
6
|
-
* (the plugin card's on/off switch; also where agent-learned skills land, disabled, until the
|
|
7
|
-
* user reviews and enables them). 与技能 store 同域:插件及其开关都是设备资产,登录身份切换
|
|
8
|
-
* 不得改变哪些技能是开着的(此前 per-owner 键控会让 A 身份停放的技能在 B 身份下点亮)。
|
|
9
|
-
* - per-project (<cwd>/.qlogicagent/skills-disabled.json) — off in THIS project only
|
|
10
|
-
* (the "project skills" opt-out, to cut down which skills an agent sees in a given project).
|
|
11
|
-
*
|
|
12
|
-
* active(project) = stored skill AND name ∉ globally-disabled AND name ∉ project-disabled
|
|
13
|
-
*/
|
|
14
|
-
/** Globally muted skills (inactive everywhere). */
|
|
15
|
-
export declare function readGloballyDisabledSkills(): Set<string>;
|
|
16
|
-
/** Mute/unmute a skill globally. Idempotent. Returns true if the registry changed. */
|
|
17
|
-
export declare function setSkillGloballyDisabled(name: string, disabled: boolean): boolean;
|
|
18
|
-
/** Skills muted in this project (inactive here, active elsewhere unless globally muted). */
|
|
19
|
-
export declare function readProjectDisabledSkills(cwd: string): Set<string>;
|
|
20
|
-
/** Mute/unmute a skill in this project. Idempotent. Returns true if the manifest changed. */
|
|
21
|
-
export declare function setProjectSkillDisabled(cwd: string, name: string, disabled: boolean): boolean;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill resolver — single source of truth for "which skills are effective in a given project".
|
|
3
|
-
*
|
|
4
|
-
* Storage: ONE global store at getUserSkillsDir(). Every skill is global; two opt-out mute lists
|
|
5
|
-
* decide effectiveness — owner-level (off everywhere) and per-project (off in this project). See
|
|
6
|
-
* project-skill-manifest.
|
|
7
|
-
*
|
|
8
|
-
* active(project) = stored skill AND name ∉ globally-disabled AND name ∉ project-disabled
|
|
9
|
-
*
|
|
10
|
-
* All resolution / listing / injection surfaces MUST go through this module so precedence lives in
|
|
11
|
-
* exactly one place. Kept in runtime/infra (no skills-layer imports) so both runtime and cli callers
|
|
12
|
-
* may use it without crossing the runtime → skills boundary.
|
|
13
|
-
*/
|
|
14
|
-
export interface ResolvedSkill {
|
|
15
|
-
name: string;
|
|
16
|
-
/** Absolute path to <store>/<name>/SKILL.md */
|
|
17
|
-
filePath: string;
|
|
18
|
-
/** Absolute path to <store>/<name> */
|
|
19
|
-
baseDir: string;
|
|
20
|
-
/** Muted everywhere (the plugin card's off switch / agent-learned-pending-review). */
|
|
21
|
-
globallyDisabled: boolean;
|
|
22
|
-
/** Muted in THIS project's context (the per-project opt-out). */
|
|
23
|
-
projectDisabled: boolean;
|
|
24
|
-
/** Effective here: neither globally nor project muted. */
|
|
25
|
-
active: boolean;
|
|
26
|
-
systemGenerated: boolean;
|
|
27
|
-
description?: string;
|
|
28
|
-
version?: string;
|
|
29
|
-
/** Frontmatter classification (Hub category vocabulary: efficiency/dev/writing/…) — drives the card palette. */
|
|
30
|
-
category?: string;
|
|
31
|
-
/** Frontmatter author — agent-authored skills carry "用户". */
|
|
32
|
-
author?: string;
|
|
33
|
-
requiredTools?: string[];
|
|
34
|
-
environments?: string[];
|
|
35
|
-
}
|
|
36
|
-
export declare function isSystemGeneratedSkillName(name: string): boolean;
|
|
37
|
-
export interface SkillActivationContext {
|
|
38
|
-
availableToolNames?: Iterable<string>;
|
|
39
|
-
currentEnvironment?: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Resolve all skills in the global store, annotated with global/project mute state and whether
|
|
43
|
-
* they're active in the given project context.
|
|
44
|
-
*
|
|
45
|
-
* Returns ALL store skills (active and inactive) so listing surfaces can show enable/disable state;
|
|
46
|
-
* callers that only want active skills filter `.active` (or use resolveActiveSkills).
|
|
47
|
-
*/
|
|
48
|
-
export declare function resolveSkills(projectRoot?: string, activation?: SkillActivationContext): ResolvedSkill[];
|
|
49
|
-
/** Only the skills active in the given project (for the system-prompt skills catalog / resolution). */
|
|
50
|
-
export declare function resolveActiveSkills(projectRoot?: string, activation?: SkillActivationContext): ResolvedSkill[];
|
|
51
|
-
/**
|
|
52
|
-
* Async, NON-BLOCKING, cached twin of {@link resolveSkills} for the first-token hot path
|
|
53
|
-
* ({@link createAvailableSkillsSection}). Returns ALL store skills annotated with mute/active state,
|
|
54
|
-
* exactly like {@link resolveSkills}, but reads off the event loop and reuses cached parse results when
|
|
55
|
-
* the store is unchanged. The sync {@link resolveSkills} is deliberately left intact for other callers.
|
|
56
|
-
*/
|
|
57
|
-
export declare function resolveSkillsAsync(projectRoot?: string, activation?: SkillActivationContext): Promise<ResolvedSkill[]>;
|
|
58
|
-
/** Async twin of {@link resolveActiveSkills}: only the skills active in the given project context. */
|
|
59
|
-
export declare function resolveActiveSkillsAsync(projectRoot?: string, activation?: SkillActivationContext): Promise<ResolvedSkill[]>;
|
|
60
|
-
/** Test-only: drop the async raw-skill cache so each test observes a cold read. */
|
|
61
|
-
export declare function __clearSkillResolveCacheForTests(): void;
|
|
62
|
-
/**
|
|
63
|
-
* Resolve a single skill by name to its store paths, or null if not present.
|
|
64
|
-
* Resolution honors only the global store (single source of truth) and ignores
|
|
65
|
-
* enablement — any stored skill is invocable by explicit name.
|
|
66
|
-
*/
|
|
67
|
-
export declare function resolveSkillPath(name: string): {
|
|
68
|
-
baseDir: string;
|
|
69
|
-
filePath: string;
|
|
70
|
-
} | null;
|
|
71
|
-
export declare function skillConditionsMatch(meta: {
|
|
72
|
-
requiredTools?: string[];
|
|
73
|
-
environments?: string[];
|
|
74
|
-
}, activation: SkillActivationContext | undefined): boolean;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Worktree Backend — git command implementation for WorktreeToolDeps.
|
|
3
|
-
*
|
|
4
|
-
* CC reference: claude-code-haha/src/utils/worktree.ts
|
|
5
|
-
*
|
|
6
|
-
* Implements the host-provided git worktree backend:
|
|
7
|
-
* - enterWorktree(): git worktree add -B <branch> <path> HEAD
|
|
8
|
-
* - exitWorktree(): git worktree remove / keep
|
|
9
|
-
* - listWorktrees(): git worktree listporcelain
|
|
10
|
-
* - isInWorktree(): check if cwd is inside a worktree
|
|
11
|
-
* - currentWorktree(): get current worktree info
|
|
12
|
-
*
|
|
13
|
-
* State management:
|
|
14
|
-
* - Tracks current worktree session in memory
|
|
15
|
-
* - CWD switching via process.chdir()
|
|
16
|
-
* - Safety checks: uncommitted changes, unpushed commits
|
|
17
|
-
*
|
|
18
|
-
* Security: validateWorktreeSlug() prevents path traversal.
|
|
19
|
-
*/
|
|
20
|
-
import type { WorktreeBackend } from "../ports/worktree-contracts.js";
|
|
21
|
-
interface WorktreeSession {
|
|
22
|
-
originalCwd: string;
|
|
23
|
-
worktreePath: string;
|
|
24
|
-
worktreeName: string;
|
|
25
|
-
worktreeBranch: string;
|
|
26
|
-
/** tmux session name (CC parity). */
|
|
27
|
-
tmuxSessionName?: string;
|
|
28
|
-
/** Whether worktree was created via a user hook (CC hookBased). */
|
|
29
|
-
hookBased?: boolean;
|
|
30
|
-
/** Creation duration in ms (unset on resume). */
|
|
31
|
-
creationDurationMs?: number;
|
|
32
|
-
/** True if sparse-checkout was applied. */
|
|
33
|
-
usedSparsePaths?: boolean;
|
|
34
|
-
}
|
|
35
|
-
/** Get the current worktree session (CC getCurrentWorktreeSession parity). */
|
|
36
|
-
export declare function getCurrentWorktreeSession(): WorktreeSession | null;
|
|
37
|
-
/** Restore session on resume (CC restoreWorktreeSession parity). */
|
|
38
|
-
export declare function restoreWorktreeSession(session: WorktreeSession | null): void;
|
|
39
|
-
export declare function findGitRoot(cwd?: string): Promise<string | null>;
|
|
40
|
-
/** Check whether tmux is available on the system. */
|
|
41
|
-
export declare function isTmuxAvailable(): Promise<boolean>;
|
|
42
|
-
/** Generate a tmux session name from repo path and branch (CC parity). */
|
|
43
|
-
export declare function generateTmuxSessionName(repoPath: string, branch: string): string;
|
|
44
|
-
/**
|
|
45
|
-
* Create a tmux session for a worktree (CC createTmuxSessionForWorktree parity).
|
|
46
|
-
* Returns the session name, or null if tmux is not available.
|
|
47
|
-
*/
|
|
48
|
-
export declare function createTmuxSession(worktreePath: string, sessionName: string): Promise<string | null>;
|
|
49
|
-
/** Kill a tmux session (CC killTmuxSession parity). */
|
|
50
|
-
export declare function killTmuxSession(sessionName: string): Promise<boolean>;
|
|
51
|
-
/**
|
|
52
|
-
* Create a lightweight worktree for a sub-agent without modifying the
|
|
53
|
-
* global session. CC reference: createAgentWorktree().
|
|
54
|
-
*/
|
|
55
|
-
export declare function createAgentWorktree(gitRoot: string, slug: string, log?: {
|
|
56
|
-
info(msg: string): void;
|
|
57
|
-
warn(msg: string): void;
|
|
58
|
-
}): Promise<{
|
|
59
|
-
worktreePath: string;
|
|
60
|
-
branch: string;
|
|
61
|
-
} | null>;
|
|
62
|
-
/** Remove an agent worktree (CC removeAgentWorktree parity). */
|
|
63
|
-
export declare function removeAgentWorktree(gitRoot: string, worktreePath: string, branch: string, log?: {
|
|
64
|
-
info(msg: string): void;
|
|
65
|
-
warn(msg: string): void;
|
|
66
|
-
}): Promise<boolean>;
|
|
67
|
-
/**
|
|
68
|
-
* Clean up stale agent worktrees older than maxAgeDays (CC cleanupStaleAgentWorktrees parity).
|
|
69
|
-
*/
|
|
70
|
-
export declare function cleanupStaleAgentWorktrees(gitRoot: string, maxAgeDays?: number, log?: {
|
|
71
|
-
info(msg: string): void;
|
|
72
|
-
warn(msg: string): void;
|
|
73
|
-
}): Promise<number>;
|
|
74
|
-
export interface WorktreeBackendOptions {
|
|
75
|
-
/** Logger for worktree operations */
|
|
76
|
-
log: {
|
|
77
|
-
info(msg: string): void;
|
|
78
|
-
warn(msg: string): void;
|
|
79
|
-
};
|
|
80
|
-
/** Directories to symlink from main repo (CC parity: node_modules, etc.) */
|
|
81
|
-
symlinkDirs?: string[];
|
|
82
|
-
/** Sparse-checkout paths (CC settings.worktree.sparsePaths parity). */
|
|
83
|
-
sparsePaths?: string[];
|
|
84
|
-
}
|
|
85
|
-
export declare function createWorktreeBackend(opts: WorktreeBackendOptions): WorktreeBackend;
|
|
86
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface Checkpoint {
|
|
2
|
-
id: string;
|
|
3
|
-
message: string;
|
|
4
|
-
timestamp: string;
|
|
5
|
-
fileCount: number;
|
|
6
|
-
}
|
|
7
|
-
export interface CheckpointResult {
|
|
8
|
-
success: boolean;
|
|
9
|
-
checkpoint?: Checkpoint;
|
|
10
|
-
checkpoints?: Checkpoint[];
|
|
11
|
-
diff?: string;
|
|
12
|
-
error?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface CheckpointBackend {
|
|
15
|
-
createCheckpoint(message?: string): Promise<CheckpointResult>;
|
|
16
|
-
listCheckpoints(): Promise<CheckpointResult>;
|
|
17
|
-
restoreCheckpoint(checkpointId: string, paths?: string[]): Promise<CheckpointResult>;
|
|
18
|
-
diffCheckpoint(checkpointId: string): Promise<CheckpointResult>;
|
|
19
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface WorktreeInfo {
|
|
2
|
-
name: string;
|
|
3
|
-
path: string;
|
|
4
|
-
branch: string;
|
|
5
|
-
isCurrent: boolean;
|
|
6
|
-
hasChanges: boolean;
|
|
7
|
-
unpushedCommits: number;
|
|
8
|
-
}
|
|
9
|
-
export interface WorktreeResult {
|
|
10
|
-
success: boolean;
|
|
11
|
-
worktree?: WorktreeInfo;
|
|
12
|
-
worktrees?: WorktreeInfo[];
|
|
13
|
-
previousCwd?: string;
|
|
14
|
-
error?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface WorktreeBackend {
|
|
17
|
-
enterWorktree(name?: string): Promise<WorktreeResult>;
|
|
18
|
-
exitWorktree(action: "keep" | "remove", discardChanges?: boolean): Promise<WorktreeResult>;
|
|
19
|
-
listWorktrees(): Promise<WorktreeResult>;
|
|
20
|
-
isInWorktree(): boolean;
|
|
21
|
-
currentWorktree?(): WorktreeInfo | null;
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|