@qvac/harness 1.0.0-rc.20 → 1.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist-lib/index.d.ts +7 -5
- package/dist-lib/index.js +5 -4
- package/dist-lib/lib/agent/resolve.js +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.js +2 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/execute.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +8 -6
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +8 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +10 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.js +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +8 -8
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +2 -2
- package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +3 -2
- package/dist-lib/lib/capabilities/completion-engine/loop.js +1 -0
- package/dist-lib/lib/capabilities/completion-engine/round.js +9 -9
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +3 -1
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +5 -41
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.js +4 -133
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.js +42 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-preflight.d.ts +43 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-preflight.js +91 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.js +7 -4
- package/dist-lib/lib/capabilities/tool-turns/attachments.d.ts +7 -0
- package/dist-lib/lib/capabilities/tool-turns/attachments.js +39 -0
- package/dist-lib/lib/capabilities/tool-turns/copy.d.ts +13 -0
- package/dist-lib/lib/capabilities/tool-turns/copy.js +29 -0
- package/dist-lib/lib/capabilities/tool-turns/result-turn.d.ts +22 -0
- package/dist-lib/lib/capabilities/tool-turns/result-turn.js +120 -0
- package/dist-lib/lib/capabilities/tool-turns/run-limits.d.ts +6 -0
- package/dist-lib/lib/capabilities/tool-turns/run-limits.js +32 -0
- package/dist-lib/lib/capabilities/tool-turns/skill-loads.d.ts +9 -0
- package/dist-lib/lib/capabilities/tool-turns/skill-loads.js +71 -0
- package/dist-lib/lib/capabilities/tool-turns.d.ts +8 -54
- package/dist-lib/lib/capabilities/tool-turns.js +6 -281
- package/dist-lib/lib/client/index.js +3 -3
- package/dist-lib/lib/connect/abort.d.ts +6 -0
- package/dist-lib/lib/connect/abort.js +52 -0
- package/dist-lib/lib/connect/bridges.d.ts +21 -0
- package/dist-lib/lib/connect/bridges.js +185 -0
- package/dist-lib/lib/connect/decode.d.ts +31 -0
- package/dist-lib/lib/connect/decode.js +114 -0
- package/dist-lib/lib/connect/host-run-log.d.ts +16 -0
- package/dist-lib/lib/connect/host-run-log.js +74 -0
- package/dist-lib/lib/connect/served.d.ts +7 -0
- package/dist-lib/lib/connect/served.js +45 -0
- package/dist-lib/lib/connect.d.ts +3 -3
- package/dist-lib/lib/connect.js +24 -468
- package/dist-lib/lib/context-window.d.ts +13 -7
- package/dist-lib/lib/context-window.js +13 -6
- package/dist-lib/lib/contract/agent.d.ts +12 -1
- package/dist-lib/lib/contract/completion.d.ts +5 -1
- package/dist-lib/lib/contract/drive.d.ts +130 -4
- package/dist-lib/lib/contract/ocr.d.ts +5 -1
- package/dist-lib/lib/contract-types.d.ts +5 -3
- package/dist-lib/lib/errors.js +3 -3
- package/dist-lib/lib/helpers/goal-check/asks.d.ts +25 -0
- package/dist-lib/lib/helpers/goal-check/asks.js +52 -0
- package/dist-lib/lib/helpers/goal-check/checks.d.ts +8 -0
- package/dist-lib/lib/helpers/goal-check/checks.js +92 -0
- package/dist-lib/lib/helpers/goal-check/commands.d.ts +7 -0
- package/dist-lib/lib/helpers/goal-check/commands.js +130 -0
- package/dist-lib/lib/helpers/goal-check/paths.d.ts +5 -0
- package/dist-lib/lib/helpers/goal-check/paths.js +44 -0
- package/dist-lib/lib/helpers/goal-check/shell.d.ts +9 -0
- package/dist-lib/lib/helpers/goal-check/shell.js +96 -0
- package/dist-lib/lib/helpers/goal-check.d.ts +35 -43
- package/dist-lib/lib/helpers/goal-check.js +34 -406
- package/dist-lib/lib/helpers/recent-map.d.ts +7 -0
- package/dist-lib/lib/helpers/recent-map.js +23 -0
- package/dist-lib/lib/helpers/tool-call-markup/emit.d.ts +6 -0
- package/dist-lib/lib/helpers/tool-call-markup/emit.js +15 -0
- package/dist-lib/lib/helpers/tool-call-markup/recover.d.ts +22 -0
- package/dist-lib/lib/helpers/tool-call-markup/recover.js +130 -0
- package/dist-lib/lib/helpers/tool-call-markup/skill-recovery.d.ts +3 -0
- package/dist-lib/lib/helpers/tool-call-markup/skill-recovery.js +56 -0
- package/dist-lib/lib/helpers/tool-call-markup/strip.d.ts +4 -0
- package/dist-lib/lib/helpers/tool-call-markup/strip.js +149 -0
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +19 -24
- package/dist-lib/lib/helpers/tool-call-markup.js +17 -343
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +12 -18
- package/dist-lib/lib/machine/completion/actions/completion.js +19 -178
- package/dist-lib/lib/machine/completion/actions/goal.d.ts +10 -0
- package/dist-lib/lib/machine/completion/actions/goal.js +93 -0
- package/dist-lib/lib/machine/completion/actions/prepare.js +2 -1
- package/dist-lib/lib/machine/completion/actions/reject-tool.d.ts +16 -0
- package/dist-lib/lib/machine/completion/actions/reject-tool.js +147 -0
- package/dist-lib/lib/machine/completion/actions/retry-round.d.ts +6 -0
- package/dist-lib/lib/machine/completion/actions/retry-round.js +50 -0
- package/dist-lib/lib/machine/completion/actions/rounds.d.ts +5 -0
- package/dist-lib/lib/machine/completion/actions/rounds.js +31 -0
- package/dist-lib/lib/machine/completion/actions/tools.d.ts +1 -16
- package/dist-lib/lib/machine/completion/actions/tools.js +16 -161
- package/dist-lib/lib/machine/completion/context.js +3 -3
- package/dist-lib/lib/machine/completion/implementations.d.ts +2 -2
- package/dist-lib/lib/machine/completion/implementations.js +6 -2
- package/dist-lib/lib/machine/completion/machine.d.ts +2 -2
- package/dist-lib/lib/machine/completion/metrics.d.ts +25 -0
- package/dist-lib/lib/machine/completion/metrics.js +68 -0
- package/dist-lib/lib/machine/completion/nudges.d.ts +5 -0
- package/dist-lib/lib/machine/completion/nudges.js +33 -0
- package/dist-lib/lib/machine/completion/rules.d.ts +5 -34
- package/dist-lib/lib/machine/completion/rules.js +4 -120
- package/dist-lib/lib/machine/completion/splice.d.ts +9 -0
- package/dist-lib/lib/machine/completion/splice.js +19 -0
- package/dist-lib/lib/machine/completion/types.d.ts +4 -13
- package/dist-lib/lib/machine/index.d.ts +3 -3
- package/dist-lib/lib/machine/index.js +2 -2
- package/dist-lib/lib/media-host.js +2 -2
- package/dist-lib/lib/media-wire.js +2 -2
- package/dist-lib/lib/residency/completion-runtime.d.ts +2 -1
- package/dist-lib/lib/residency/completion-runtime.js +44 -1
- package/dist-lib/lib/residency/index.d.ts +3 -2
- package/dist-lib/lib/residency/index.js +2 -2
- package/dist-lib/lib/round-host.js +3 -3
- package/dist-lib/lib/round-port.js +3 -3
- package/dist-lib/lib/run-log/redact.js +7 -7
- package/dist-lib/lib/serve/completion.d.ts +7 -0
- package/dist-lib/lib/serve/completion.js +553 -0
- package/dist-lib/lib/serve/downloads.d.ts +4 -0
- package/dist-lib/lib/serve/downloads.js +79 -0
- package/dist-lib/lib/serve/models.d.ts +5 -0
- package/dist-lib/lib/serve/models.js +120 -0
- package/dist-lib/lib/serve/noop.d.ts +1 -0
- package/dist-lib/lib/serve/noop.js +1 -0
- package/dist-lib/lib/serve/requests.d.ts +147 -0
- package/dist-lib/lib/serve/requests.js +1 -0
- package/dist-lib/lib/serve/rounds.d.ts +11 -0
- package/dist-lib/lib/serve/rounds.js +67 -0
- package/dist-lib/lib/serve/run-log-start.d.ts +38 -0
- package/dist-lib/lib/serve/run-log-start.js +254 -0
- package/dist-lib/lib/serve/skills.d.ts +32 -0
- package/dist-lib/lib/serve/skills.js +46 -0
- package/dist-lib/lib/serve.d.ts +5 -1
- package/dist-lib/lib/serve.js +14 -1071
- package/dist-lib/lib/skills-host/index.d.ts +4 -2
- package/dist-lib/lib/skills-host/index.js +20 -8
- package/dist-lib/lib/tools/fs/drive.d.ts +1 -17
- package/dist-lib/lib/tools/fs/remote-protocol.d.ts +1 -81
- package/dist-lib/lib/tools/fs/scope.d.ts +2 -17
- package/dist-lib/lib/tools/fs/search.d.ts +2 -18
- package/dist-lib/lib/tools/fs/walk.d.ts +1 -5
- package/dist-lib/lib/tools/pdf/build.d.ts +2 -2
- package/dist-lib/lib/tools/pdf/recognize.js +4 -8
- package/dist-lib/lib/tools/pdf/request.d.ts +3 -8
- package/dist-lib/lib/tools/pdf/request.js +4 -4
- package/dist-lib/lib/tools/pdf.d.ts +0 -1
- package/dist-lib/lib/tools/pdf.js +0 -1
- package/dist-lib/lib/tools/skill.js +13 -4
- package/dist-lib/lib/tools/skills/bundled-dir.d.ts +3 -0
- package/dist-lib/lib/tools/skills/bundled-dir.js +27 -24
- package/dist-lib/lib/tools/skills/bundled-hash.d.ts +1 -0
- package/dist-lib/lib/tools/skills/bundled-hash.js +4 -1
- package/dist-lib/lib/tools/skills/catalog-loader.d.ts +12 -0
- package/dist-lib/lib/tools/skills/catalog-loader.js +173 -0
- package/dist-lib/lib/tools/skills/catalog.d.ts +5 -8
- package/dist-lib/lib/tools/skills/catalog.js +1 -162
- package/dist-lib/lib/tools/skills/index.d.ts +1 -0
- package/dist-lib/lib/tools/skills/index.js +1 -0
- package/dist-lib/lib/tools/skills/skill-tree.d.ts +5 -0
- package/dist-lib/lib/tools/skills/skill-tree.js +54 -0
- package/dist-lib/lib/wire/download.d.ts +10 -0
- package/dist-lib/lib/wire/download.js +35 -0
- package/dist-lib/lib/wire/event.d.ts +41 -0
- package/dist-lib/lib/wire/event.js +306 -0
- package/dist-lib/lib/wire/fields.d.ts +3 -0
- package/dist-lib/lib/wire/fields.js +12 -0
- package/dist-lib/lib/wire/knowledge.d.ts +9 -0
- package/dist-lib/lib/wire/knowledge.js +68 -0
- package/dist-lib/lib/wire/round.d.ts +14 -0
- package/dist-lib/lib/wire/round.js +45 -0
- package/dist-lib/lib/wire/vectors.d.ts +6 -0
- package/dist-lib/lib/wire/vectors.js +33 -0
- package/dist-lib/lib/wire.d.ts +28 -77
- package/dist-lib/lib/wire.js +24 -489
- package/dist-lib/plugins/ocr/coverage.d.ts +3 -0
- package/dist-lib/plugins/ocr/coverage.js +67 -0
- package/dist-lib/plugins/ocr/ocr-runtime.d.ts +4 -2
- package/dist-lib/plugins/ocr/ocr-runtime.js +25 -4
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
- package/dist-lib/schema/harness.js +4 -1
- package/dist-lib/spec/hrpc/messages.js +25 -1
- package/dist-lib/spec/hyperschema/index.js +25 -1
- package/dist-lib/spec/hyperschema/schema.json +6 -1
- package/dist-lib/spec/hyperschema/types.d.ts +1 -0
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import type { CompletionSkillEntry } from '../capabilities/skill-entry.ts';
|
|
|
2
2
|
import type { SkillReadiness, ToolDefinition, ToolExecuteContext } from '../contract/index.ts';
|
|
3
3
|
import type { CredentialEntry, SkillsOptions, SkillWriteResult } from '../contract-types.ts';
|
|
4
4
|
import type { CredentialStoreFn, CredentialStoreValue } from '../tools/skills/auth-resolver.ts';
|
|
5
|
-
import { type ResolvedSkillCatalogEntry } from '../tools/skills/catalog.ts';
|
|
5
|
+
import { type ResolvedSkillCatalogEntry, type SkillTreeRef } from '../tools/skills/catalog.ts';
|
|
6
6
|
import { type CopyBaseResult, type DeleteOverlayResult, type ManagedSkill, type SkillFileContent } from '../tools/skills/overlay-crud.ts';
|
|
7
7
|
import { type SkillSettingEntry } from '../tools/skills/skill-settings.ts';
|
|
8
8
|
export interface HarnessSkillsOptions extends SkillsOptions {
|
|
@@ -47,7 +47,8 @@ export declare class SkillsHost {
|
|
|
47
47
|
deleteOverlaySkill(name: string): Promise<DeleteOverlayResult>;
|
|
48
48
|
resolveCredential(key: string, ctx?: ToolExecuteContext): Promise<CredentialStoreValue> | CredentialStoreValue;
|
|
49
49
|
statuses(agentId?: string | null, modelName?: string | null, options?: HarnessSkillsOptions): Promise<ResolvedSkillCatalogEntry[]>;
|
|
50
|
-
|
|
50
|
+
private _statuses;
|
|
51
|
+
completionSkills(agentId: string | null, model: string, trees?: readonly SkillTreeRef[]): Promise<CompletionSkillEntry[]>;
|
|
51
52
|
get platform(): string;
|
|
52
53
|
private _currentPlatform;
|
|
53
54
|
private _installedTools;
|
|
@@ -55,6 +56,7 @@ export declare class SkillsHost {
|
|
|
55
56
|
private _overlayDir;
|
|
56
57
|
private _reload;
|
|
57
58
|
private _filter;
|
|
59
|
+
private _supported;
|
|
58
60
|
private _watch;
|
|
59
61
|
private _probeBinVersions;
|
|
60
62
|
private _runBinVersionProbes;
|
|
@@ -4,7 +4,7 @@ import { errorMessage } from '../guards.js';
|
|
|
4
4
|
import { HarnessLog } from '../log.js';
|
|
5
5
|
import { modelNameToCapabilityProfile } from '../models/model-catalog.js';
|
|
6
6
|
import { probeBinVersions } from '../tools/skills/bin-check.js';
|
|
7
|
-
import { availableSkills, detectPlatform, loadSkillCatalog, resolveSkillStatuses, skillSupportsPlatform, versionProbeSkills } from '../tools/skills/catalog.js';
|
|
7
|
+
import { availableSkills, detectPlatform, layerSkills, loadSkillCatalog, resolveSkillStatuses, skillSupportsPlatform, versionProbeSkills } from '../tools/skills/catalog.js';
|
|
8
8
|
import { resetCredentialHealth } from '../tools/skills/credential-health.js';
|
|
9
9
|
import { ensureSkillsOverlayDir } from '../tools/skills/overlay-dir.js';
|
|
10
10
|
import { copyBaseForEdit, deleteOverlaySkill, listManagedSkills, readSkillFile, writeSkillFile } from '../tools/skills/overlay-crud.js';
|
|
@@ -151,10 +151,13 @@ export class SkillsHost {
|
|
|
151
151
|
}
|
|
152
152
|
return null;
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
statuses(agentId, modelName, options) {
|
|
155
|
+
return this._statuses(this._allSkills, { agentId, modelName, options });
|
|
156
|
+
}
|
|
157
|
+
async _statuses(skills, { agentId, modelName, options }) {
|
|
155
158
|
const platform = this._currentPlatform();
|
|
156
159
|
const refresh = options?.refresh === true;
|
|
157
|
-
return resolveSkillStatuses(
|
|
160
|
+
return resolveSkillStatuses(skills, {
|
|
158
161
|
installedTools: this._installedTools(),
|
|
159
162
|
credentialStore: (key, ctx) => this.resolveCredential(key, ctx),
|
|
160
163
|
settingsStore: (skill, agentId) => this.skillSettings(skill, agentId),
|
|
@@ -169,9 +172,15 @@ export class SkillsHost {
|
|
|
169
172
|
readiness: this._readiness
|
|
170
173
|
});
|
|
171
174
|
}
|
|
172
|
-
async completionSkills(agentId, model) {
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
+
async completionSkills(agentId, model, trees = []) {
|
|
176
|
+
const all = trees.length ? await layerSkills(this._allSkills, trees) : this._allSkills;
|
|
177
|
+
const supported = trees.length ? this._supported(all) : this._supportedSkills;
|
|
178
|
+
const options = { skipCredentialProbe: true, skipBinProbe: true };
|
|
179
|
+
const statuses = new Map((await this._statuses(all, { agentId, modelName: model, options })).map((entry) => [
|
|
180
|
+
entry.name,
|
|
181
|
+
entry.status
|
|
182
|
+
]));
|
|
183
|
+
return availableSkills(supported, this._installedTools()).map((entry) => ({
|
|
175
184
|
...entry,
|
|
176
185
|
status: statuses.get(entry.name)
|
|
177
186
|
}));
|
|
@@ -200,9 +209,12 @@ export class SkillsHost {
|
|
|
200
209
|
this._filter();
|
|
201
210
|
}
|
|
202
211
|
_filter() {
|
|
212
|
+
this._supportedSkills = this._supported(this._allSkills);
|
|
213
|
+
}
|
|
214
|
+
_supported(skills) {
|
|
203
215
|
const platform = this._currentPlatform();
|
|
204
|
-
const supported =
|
|
205
|
-
|
|
216
|
+
const supported = skills.filter((skill) => skillSupportsPlatform(skill, platform));
|
|
217
|
+
return availableSkills(supported, this._installedTools());
|
|
206
218
|
}
|
|
207
219
|
async _watch() {
|
|
208
220
|
if (this._watcher)
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import type { Writable } from 'streamx';
|
|
2
1
|
import { HarnessError } from '../../errors.ts';
|
|
3
|
-
|
|
4
|
-
export interface DriveListOptions {
|
|
5
|
-
skip?: ReadonlySet<string>;
|
|
6
|
-
recursive?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface Drive {
|
|
9
|
-
entry(key: string, opts?: {
|
|
10
|
-
follow?: boolean;
|
|
11
|
-
}): Promise<DriveEntry | null>;
|
|
12
|
-
get(key: string): Promise<Uint8Array | null>;
|
|
13
|
-
list(folder?: string, opts?: DriveListOptions): AsyncIterable<DriveEntry | DriveDir>;
|
|
14
|
-
createReadStream(key: string): AsyncIterable<Uint8Array>;
|
|
15
|
-
createWriteStream(key: string, opts?: {
|
|
16
|
-
executable?: boolean;
|
|
17
|
-
}): Writable;
|
|
18
|
-
}
|
|
2
|
+
export type { Drive, DriveListOptions } from '../../contract/drive.ts';
|
|
19
3
|
export declare class DriveReadTruncatedError extends HarnessError<'DRIVE_READ_TRUNCATED'> {
|
|
20
4
|
constructor(key: string, bytes: number);
|
|
21
5
|
}
|
|
@@ -1,82 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export interface DriveEntry {
|
|
3
|
-
key: string;
|
|
4
|
-
value: {
|
|
5
|
-
executable: boolean;
|
|
6
|
-
linkname: string | null;
|
|
7
|
-
blob: {
|
|
8
|
-
byteLength: number;
|
|
9
|
-
} | null;
|
|
10
|
-
metadata: unknown;
|
|
11
|
-
};
|
|
12
|
-
mtime?: number;
|
|
13
|
-
}
|
|
14
|
-
export interface DriveDir {
|
|
15
|
-
key: string;
|
|
16
|
-
dir: true;
|
|
17
|
-
}
|
|
18
|
-
export interface GrantedDrive {
|
|
19
|
-
readonly key: string;
|
|
20
|
-
readonly writable: boolean;
|
|
21
|
-
readonly search?: boolean;
|
|
22
|
-
}
|
|
1
|
+
export type { DriveDir, DriveEntry, DriveEntryRequest, DriveGetRequest, DriveListRequest, DriveOpFn, DriveReadRequest, DriveRequest, DriveResponse, DriveSearchQuery, DriveSearchRequest, DriveWriteRequest, GrantedDrive } from '../../contract/drive.ts';
|
|
23
2
|
export declare const MAX_DRIVE_BYTES: number;
|
|
24
|
-
export interface DriveEntryRequest {
|
|
25
|
-
op: 'entry';
|
|
26
|
-
driveKey: string;
|
|
27
|
-
key: string;
|
|
28
|
-
}
|
|
29
|
-
export interface DriveGetRequest {
|
|
30
|
-
op: 'get';
|
|
31
|
-
driveKey: string;
|
|
32
|
-
key: string;
|
|
33
|
-
}
|
|
34
|
-
export interface DriveReadRequest {
|
|
35
|
-
op: 'read';
|
|
36
|
-
driveKey: string;
|
|
37
|
-
key: string;
|
|
38
|
-
}
|
|
39
|
-
export interface DriveListRequest {
|
|
40
|
-
op: 'list';
|
|
41
|
-
driveKey: string;
|
|
42
|
-
folder: string;
|
|
43
|
-
skip: string[];
|
|
44
|
-
recursive: boolean;
|
|
45
|
-
limit: number;
|
|
46
|
-
cursor: string | null;
|
|
47
|
-
}
|
|
48
|
-
export interface DriveWriteRequest {
|
|
49
|
-
op: 'write';
|
|
50
|
-
driveKey: string;
|
|
51
|
-
key: string;
|
|
52
|
-
path: string;
|
|
53
|
-
executable?: boolean;
|
|
54
|
-
}
|
|
55
|
-
export interface DriveSearchQuery {
|
|
56
|
-
folder: string;
|
|
57
|
-
queries: string[];
|
|
58
|
-
regex: boolean;
|
|
59
|
-
caseSensitive: boolean;
|
|
60
|
-
includeIgnored: boolean;
|
|
61
|
-
maxMatches: number;
|
|
62
|
-
maxEntries: number;
|
|
63
|
-
maxMs: number;
|
|
64
|
-
}
|
|
65
|
-
export interface DriveSearchRequest extends DriveSearchQuery {
|
|
66
|
-
op: 'search';
|
|
67
|
-
driveKey: string;
|
|
68
|
-
}
|
|
69
|
-
export type DriveRequest = DriveEntryRequest | DriveGetRequest | DriveReadRequest | DriveListRequest | DriveWriteRequest | DriveSearchRequest;
|
|
70
|
-
export interface DriveResponse {
|
|
71
|
-
error?: string;
|
|
72
|
-
entry?: DriveEntry | null;
|
|
73
|
-
path?: string | null;
|
|
74
|
-
truncated?: boolean;
|
|
75
|
-
entries?: Array<DriveEntry | DriveDir>;
|
|
76
|
-
cursor?: string | null;
|
|
77
|
-
hits?: SearchHit[];
|
|
78
|
-
capped?: boolean;
|
|
79
|
-
cut?: boolean;
|
|
80
|
-
skippedLinks?: number;
|
|
81
|
-
}
|
|
82
|
-
export type DriveOpFn = (request: DriveRequest) => Promise<DriveResponse>;
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import type { CompiledPolicy } from '../../contract/policy.ts';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
import type { FolderSearchResult } from './search.ts';
|
|
2
|
+
import type { DriveRoot, LocalRoot } from '../../contract/drive.ts';
|
|
3
|
+
export type { DriveRoot, HyperRoot, LocalRoot } from '../../contract/drive.ts';
|
|
5
4
|
export type Realpath = (p: string) => Promise<string>;
|
|
6
5
|
export declare const defaultRealpath: Realpath;
|
|
7
|
-
export interface LocalRoot {
|
|
8
|
-
readonly kind: 'local';
|
|
9
|
-
readonly root: string;
|
|
10
|
-
readonly drive: Drive;
|
|
11
|
-
}
|
|
12
|
-
export interface HyperRoot {
|
|
13
|
-
readonly kind: 'hyper';
|
|
14
|
-
readonly key: string;
|
|
15
|
-
readonly writable: boolean;
|
|
16
|
-
readonly prefix: string;
|
|
17
|
-
readonly drive: Drive;
|
|
18
|
-
readonly search?: (query: DriveSearchQuery) => Promise<FolderSearchResult>;
|
|
19
|
-
}
|
|
20
|
-
export type DriveRoot = LocalRoot | HyperRoot;
|
|
21
6
|
export interface FsToolOptions {
|
|
22
7
|
readonly realpath?: Realpath;
|
|
23
8
|
readonly deniedRoots?: readonly string[];
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Drive, FolderSearchResult, SearchFile, SearchResult } from '../../contract/drive.ts';
|
|
2
2
|
import type { DriveResponse, DriveSearchRequest } from './remote-protocol.ts';
|
|
3
3
|
import { type DriveRoot } from './scope.ts';
|
|
4
|
-
|
|
4
|
+
export type { FolderSearchResult, SearchFile, SearchHit, SearchResult } from '../../contract/drive.ts';
|
|
5
5
|
export declare const MAX_GREP_MATCHES = 1000;
|
|
6
|
-
export interface SearchHit {
|
|
7
|
-
file: string;
|
|
8
|
-
line: number;
|
|
9
|
-
text: string;
|
|
10
|
-
}
|
|
11
|
-
export interface SearchFile {
|
|
12
|
-
path: string;
|
|
13
|
-
key: string;
|
|
14
|
-
}
|
|
15
6
|
export interface SearchOptions {
|
|
16
7
|
regex?: boolean;
|
|
17
8
|
caseSensitive?: boolean;
|
|
18
9
|
concurrency?: number;
|
|
19
10
|
}
|
|
20
|
-
export interface SearchResult {
|
|
21
|
-
hits: SearchHit[];
|
|
22
|
-
capped: boolean;
|
|
23
|
-
cut: boolean;
|
|
24
|
-
}
|
|
25
11
|
export interface FolderSearchOptions {
|
|
26
12
|
maxMatches: number;
|
|
27
13
|
includeIgnored?: boolean;
|
|
@@ -30,8 +16,6 @@ export interface FolderSearchOptions {
|
|
|
30
16
|
deny?: readonly string[];
|
|
31
17
|
include?: ((name: string, path: string) => boolean) | null;
|
|
32
18
|
}
|
|
33
|
-
export interface FolderSearchResult extends SearchResult, WalkSummary {
|
|
34
|
-
}
|
|
35
19
|
export declare class DriveSearch {
|
|
36
20
|
#private;
|
|
37
21
|
constructor(queries: readonly string[], { regex, caseSensitive, concurrency }?: SearchOptions);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DriveRoot, WalkSummary } from '../../contract/drive.ts';
|
|
2
2
|
export declare const WALK_SKIP_DIRS: Set<string>;
|
|
3
3
|
export declare const MAX_WALK_ENTRIES = 10000;
|
|
4
4
|
export declare const MAX_WALK_MS = 30000;
|
|
@@ -8,10 +8,6 @@ export interface WalkedFile {
|
|
|
8
8
|
byteLength: number;
|
|
9
9
|
mtime?: number;
|
|
10
10
|
}
|
|
11
|
-
export interface WalkSummary {
|
|
12
|
-
truncated: boolean;
|
|
13
|
-
skippedLinks: number;
|
|
14
|
-
}
|
|
15
11
|
export interface WalkResult extends WalkSummary {
|
|
16
12
|
files: WalkedFile[];
|
|
17
13
|
}
|
|
@@ -20,7 +20,7 @@ export interface Built {
|
|
|
20
20
|
readonly bytes: Uint8Array;
|
|
21
21
|
readonly pageCount: number;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
interface ReadField {
|
|
24
24
|
readonly name: string;
|
|
25
25
|
readonly type: string;
|
|
26
26
|
readonly value: Field['value'];
|
|
@@ -39,7 +39,7 @@ export interface ReadDocument {
|
|
|
39
39
|
readonly note: string | undefined;
|
|
40
40
|
readonly truncated: true | undefined;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
interface ReadDocuments {
|
|
43
43
|
readonly documents: readonly ReadDocument[];
|
|
44
44
|
}
|
|
45
45
|
export interface ReadBudget {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'crypto';
|
|
2
2
|
import { errorMessage } from '../../guards.js';
|
|
3
|
+
import { RecentMap } from '../../helpers/recent-map.js';
|
|
3
4
|
import { HarnessLog } from '../../log.js';
|
|
4
5
|
import { cleanText } from './build.js';
|
|
5
6
|
const OCR_SCALE = 2;
|
|
@@ -33,7 +34,8 @@ export async function recognizePages({ doc, bytes }, { ocr, signal, budget }) {
|
|
|
33
34
|
}
|
|
34
35
|
async function readPage(doc, page, { ocr, signal }) {
|
|
35
36
|
try {
|
|
36
|
-
|
|
37
|
+
const { text } = await ocr.read(await doc.renderAsync(page, { scale: OCR_SCALE }), signal);
|
|
38
|
+
return cleanText(text);
|
|
37
39
|
}
|
|
38
40
|
catch (err) {
|
|
39
41
|
if (signal?.aborted) {
|
|
@@ -44,16 +46,10 @@ async function readPage(doc, page, { ocr, signal }) {
|
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
function keptPages(ocr, bytes) {
|
|
47
|
-
const documents = keptByService.get(ocr) ?? new
|
|
49
|
+
const documents = keptByService.get(ocr) ?? new RecentMap(KEPT_DOCUMENTS);
|
|
48
50
|
keptByService.set(ocr, documents);
|
|
49
51
|
const id = createHash('sha256').update(bytes).digest('hex');
|
|
50
52
|
const pages = documents.get(id) ?? new Map();
|
|
51
|
-
documents.delete(id);
|
|
52
53
|
documents.set(id, pages);
|
|
53
|
-
for (const oldest of documents.keys()) {
|
|
54
|
-
if (documents.size <= KEPT_DOCUMENTS)
|
|
55
|
-
break;
|
|
56
|
-
documents.delete(oldest);
|
|
57
|
-
}
|
|
58
54
|
return pages;
|
|
59
55
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export declare const PDF_ACTIONS: readonly ['create', 'merge', 'split', 'rotate', 'watermark', 'fill', 'encrypt', 'decrypt', 'text'];
|
|
2
2
|
export declare const PAGE_SIZES: readonly ['A4', 'A5', 'Letter', 'Legal'];
|
|
3
|
-
export declare const DEGREES: readonly [90, 180, 270];
|
|
4
3
|
export declare const WHERE_IDS_ARE = "copy the id from the [Attached file \"\u2026\" \u2014 attachmentId: \u2026] line or an earlier tool result";
|
|
5
4
|
export type Action = (typeof PDF_ACTIONS)[number];
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
type PageSize = (typeof PAGE_SIZES)[number];
|
|
6
|
+
type FieldValue = string | number | boolean | string[];
|
|
7
|
+
interface Permissions {
|
|
9
8
|
print?: boolean;
|
|
10
9
|
modify?: boolean;
|
|
11
10
|
copy?: boolean;
|
|
@@ -55,9 +54,5 @@ export type CreateRequest = Extract<PdfRequest, {
|
|
|
55
54
|
action: 'create';
|
|
56
55
|
}>;
|
|
57
56
|
export declare function parsePages(value: unknown): number[] | string;
|
|
58
|
-
type Args = Record<string, unknown>;
|
|
59
|
-
export declare function impliedAction(args: Args): Action | 'read';
|
|
60
|
-
export declare function pageSizeOf(value: unknown): PageSize | undefined;
|
|
61
|
-
export declare function quarterTurn(value: unknown): number | undefined;
|
|
62
57
|
export declare function parseRequest(args: Record<string, unknown>): PdfRequest | string;
|
|
63
58
|
export {};
|
|
@@ -11,7 +11,7 @@ export const PDF_ACTIONS = [
|
|
|
11
11
|
'text'
|
|
12
12
|
];
|
|
13
13
|
export const PAGE_SIZES = ['A4', 'A5', 'Letter', 'Legal'];
|
|
14
|
-
|
|
14
|
+
const DEGREES = [90, 180, 270];
|
|
15
15
|
export const WHERE_IDS_ARE = 'copy the id from the [Attached file "…" — attachmentId: …] line or an earlier tool result';
|
|
16
16
|
const MAX_PAGE_SPAN = 10_000;
|
|
17
17
|
const PAGES_HINT = 'pages must be page numbers counted from 1, like [1, 2, 3]';
|
|
@@ -117,7 +117,7 @@ const IMPLIED = [
|
|
|
117
117
|
[(args) => hasOutput(args, '.pdf') && idCount(args) > 1, 'merge'],
|
|
118
118
|
[(args) => hasOutput(args, '.pdf') && args.pages !== undefined, 'split']
|
|
119
119
|
];
|
|
120
|
-
|
|
120
|
+
function impliedAction(args) {
|
|
121
121
|
return IMPLIED.find(([applies]) => applies(args))?.[1] ?? 'read';
|
|
122
122
|
}
|
|
123
123
|
function actionOf(args) {
|
|
@@ -136,12 +136,12 @@ function actionOf(args) {
|
|
|
136
136
|
error: `unknown action "${action}"; actions are ${PDF_ACTIONS.join(', ')}, or leave action out to read a PDF`
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
function pageSizeOf(value) {
|
|
140
140
|
if (typeof value !== 'string')
|
|
141
141
|
return undefined;
|
|
142
142
|
return PAGE_SIZES.find((size) => size.toLowerCase() === value.trim().toLowerCase());
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
function quarterTurn(value) {
|
|
145
145
|
const degrees = Number(value);
|
|
146
146
|
if (!Number.isInteger(degrees)) {
|
|
147
147
|
return undefined;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ToolDefinition } from '../contract/index.ts';
|
|
2
2
|
import { type Pdfium, type Source } from './pdf/build.ts';
|
|
3
3
|
import { type PdfRequest } from './pdf/request.ts';
|
|
4
|
-
export { parsePages, parseRequest } from './pdf/request.ts';
|
|
5
4
|
export declare function outputName(request: PdfRequest, inputs: readonly Source[]): string;
|
|
6
5
|
export declare function createPdfTool(load?: () => Promise<Pdfium | null>): ToolDefinition;
|
|
@@ -6,7 +6,6 @@ import { build, pagesLabel, everyPageShown, readDocs, READ_TEXT_LIMIT, shownNote
|
|
|
6
6
|
import { placeImages } from './pdf/images.js';
|
|
7
7
|
import { recognizePages } from './pdf/recognize.js';
|
|
8
8
|
import { PAGE_SIZES, parseRequest, PDF_ACTIONS, WHERE_IDS_ARE } from './pdf/request.js';
|
|
9
|
-
export { parsePages, parseRequest } from './pdf/request.js';
|
|
10
9
|
const SUFFIXES = {
|
|
11
10
|
create: 'revised',
|
|
12
11
|
merge: 'merged',
|
|
@@ -21,6 +21,9 @@ export function mainFileRequested(name, file) {
|
|
|
21
21
|
export function skillFileArg(args) {
|
|
22
22
|
return args?.file ?? args?.path ?? args?.filename;
|
|
23
23
|
}
|
|
24
|
+
function skillNameArg(args) {
|
|
25
|
+
return unquoteArg(args.name ?? args.skill_name ?? args.skill);
|
|
26
|
+
}
|
|
24
27
|
export function skillFileStem(file) {
|
|
25
28
|
return file
|
|
26
29
|
.toLowerCase()
|
|
@@ -76,7 +79,11 @@ function nearestFile(wanted, available) {
|
|
|
76
79
|
export function createSkillTool({ skillsDir, overlayDir = resolveSkillsOverlayDir(), read } = {}) {
|
|
77
80
|
const baseDrive = skillsDir ? new Localdrive(skillsDir) : null;
|
|
78
81
|
const overlayDrive = overlayDir ? new Localdrive(overlayDir) : null;
|
|
79
|
-
async function resolveSkill(name, file) {
|
|
82
|
+
async function resolveSkill(name, file, tree) {
|
|
83
|
+
const own = tree ? await tree.drive.get(`/${name}/${file}`) : null;
|
|
84
|
+
if (own) {
|
|
85
|
+
return { raw: b4a.toString(own, 'utf8'), root: tree?.root };
|
|
86
|
+
}
|
|
80
87
|
if (read) {
|
|
81
88
|
return { raw: await read(name, file), root: skillsDir };
|
|
82
89
|
}
|
|
@@ -125,14 +132,16 @@ export function createSkillTool({ skillsDir, overlayDir = resolveSkillsOverlayDi
|
|
|
125
132
|
effect: () => 'read',
|
|
126
133
|
autoApprove: true,
|
|
127
134
|
async execute(args, ctx) {
|
|
128
|
-
const name =
|
|
135
|
+
const name = skillNameArg(args);
|
|
136
|
+
const root = ctx?.skillTrees?.get(name)?.root;
|
|
137
|
+
const tree = root ? { root, drive: new Localdrive(root) } : null;
|
|
129
138
|
const fileArg = skillFileArg(args);
|
|
130
139
|
const file = mainFileRequested(name, fileArg) ? MAIN_FILE : unquoteArg(fileArg);
|
|
131
140
|
if (file.startsWith('/') || file.includes('\\') || file.split('/').includes('..')) {
|
|
132
141
|
return { error: `file not found in skill ${name}: ${file}` };
|
|
133
142
|
}
|
|
134
143
|
const load = async (target) => {
|
|
135
|
-
const { raw, root } = await resolveSkill(name, target);
|
|
144
|
+
const { raw, root } = await resolveSkill(name, target, tree);
|
|
136
145
|
const { body, meta } = parseSkillFrontMatter(raw);
|
|
137
146
|
const dir = resolveSkillDir(root, name);
|
|
138
147
|
const content = dir ? body.replaceAll('{{SKILL_DIR}}', ShellLine.escape(dir)) : body;
|
|
@@ -158,7 +167,7 @@ export function createSkillTool({ skillsDir, overlayDir = resolveSkillsOverlayDi
|
|
|
158
167
|
if (file === MAIN_FILE) {
|
|
159
168
|
return { error: `skill not found: ${name}` };
|
|
160
169
|
}
|
|
161
|
-
const available = await listSkillFiles([overlayDrive, baseDrive], name);
|
|
170
|
+
const available = await listSkillFiles([tree?.drive ?? null, overlayDrive, baseDrive], name);
|
|
162
171
|
const near = nearestFile(file, available);
|
|
163
172
|
if (near !== null) {
|
|
164
173
|
try {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { type BundledFile } from './bundled-hash.ts';
|
|
1
2
|
export interface SkillsBundle {
|
|
2
3
|
readonly skills: Readonly<Record<string, string>>;
|
|
3
4
|
readonly hash: string;
|
|
4
5
|
}
|
|
5
6
|
export declare function ensureBundledSkillsDir(bundle: SkillsBundle): Promise<string>;
|
|
7
|
+
export declare function materializeTree(dir: string, files: ReadonlyArray<BundledFile>, hash: string): Promise<void>;
|
|
6
8
|
export declare function randomSuffix(): string;
|
|
9
|
+
export declare function readTree(dir: string, hash: string): Promise<BundledFile[] | null>;
|
|
@@ -4,7 +4,7 @@ import path from 'path';
|
|
|
4
4
|
import process from 'process';
|
|
5
5
|
import { HarnessError } from '../../errors.js';
|
|
6
6
|
import { userTmpPath } from '../../tmp-path.js';
|
|
7
|
-
import {
|
|
7
|
+
import { hashSkillFiles } from './bundled-hash.js';
|
|
8
8
|
const inflight = new Map();
|
|
9
9
|
export function ensureBundledSkillsDir(bundle) {
|
|
10
10
|
if (!/^[0-9a-f]{16}$/.test(bundle.hash)) {
|
|
@@ -12,15 +12,18 @@ export function ensureBundledSkillsDir(bundle) {
|
|
|
12
12
|
}
|
|
13
13
|
let pending = inflight.get(bundle.hash);
|
|
14
14
|
if (!pending) {
|
|
15
|
-
|
|
15
|
+
const dir = userTmpPath('qvac-harness-skills-' + bundle.hash);
|
|
16
|
+
const files = Object.entries(bundle.skills).map(([path, content]) => ({ path, content }));
|
|
17
|
+
pending = materializeTree(dir, files, bundle.hash)
|
|
18
|
+
.then(() => dir)
|
|
19
|
+
.finally(() => inflight.delete(bundle.hash));
|
|
16
20
|
inflight.set(bundle.hash, pending);
|
|
17
21
|
}
|
|
18
22
|
return pending;
|
|
19
23
|
}
|
|
20
|
-
async function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return dir;
|
|
24
|
+
export async function materializeTree(dir, files, hash) {
|
|
25
|
+
if (await validTree(dir, hash)) {
|
|
26
|
+
return;
|
|
24
27
|
}
|
|
25
28
|
const staging = `${dir}-staging-${process.pid}-${randomSuffix()}`;
|
|
26
29
|
await fs.promises.mkdir(staging, { recursive: true });
|
|
@@ -28,32 +31,32 @@ async function materialize(bundle) {
|
|
|
28
31
|
await fs.promises.chmod(staging, 0o700);
|
|
29
32
|
}
|
|
30
33
|
try {
|
|
31
|
-
await writeTree(staging,
|
|
32
|
-
if (!(await validTree(staging,
|
|
34
|
+
await writeTree(staging, files);
|
|
35
|
+
if (!(await validTree(staging, hash))) {
|
|
33
36
|
throw new HarnessError('BUNDLED_SKILLS_INVALID', [staging]);
|
|
34
37
|
}
|
|
35
38
|
if (await tryRename(staging, dir)) {
|
|
36
|
-
return
|
|
39
|
+
return;
|
|
37
40
|
}
|
|
38
|
-
if (await validTree(dir,
|
|
39
|
-
return
|
|
41
|
+
if (await validTree(dir, hash)) {
|
|
42
|
+
return;
|
|
40
43
|
}
|
|
41
44
|
const trash = `${dir}.trash-${process.pid}-${randomSuffix()}`;
|
|
42
45
|
try {
|
|
43
46
|
await fs.promises.rename(dir, trash);
|
|
44
47
|
}
|
|
45
48
|
catch (err) {
|
|
46
|
-
if (await validTree(dir,
|
|
47
|
-
return
|
|
49
|
+
if (await validTree(dir, hash)) {
|
|
50
|
+
return;
|
|
48
51
|
}
|
|
49
52
|
throw occupiedError(dir, err);
|
|
50
53
|
}
|
|
51
54
|
void fs.promises.rm(trash, { recursive: true, force: true });
|
|
52
55
|
if (await tryRename(staging, dir)) {
|
|
53
|
-
return
|
|
56
|
+
return;
|
|
54
57
|
}
|
|
55
|
-
if (await validTree(dir,
|
|
56
|
-
return
|
|
58
|
+
if (await validTree(dir, hash)) {
|
|
59
|
+
return;
|
|
57
60
|
}
|
|
58
61
|
throw tamperError(dir);
|
|
59
62
|
}
|
|
@@ -80,29 +83,29 @@ async function tryRename(from, to) {
|
|
|
80
83
|
return false;
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
|
-
async function writeTree(dir,
|
|
84
|
-
for (const
|
|
86
|
+
async function writeTree(dir, files) {
|
|
87
|
+
for (const { path: relPath, content } of files) {
|
|
85
88
|
const target = path.join(dir, relPath);
|
|
86
89
|
await fs.promises.mkdir(path.dirname(target), { recursive: true });
|
|
87
90
|
await fs.promises.writeFile(target, content);
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
async function validTree(dir, hash) {
|
|
94
|
+
return (await readTree(dir, hash)) !== null;
|
|
95
|
+
}
|
|
96
|
+
export async function readTree(dir, hash) {
|
|
91
97
|
try {
|
|
92
98
|
if (os.platform() !== 'win32') {
|
|
93
99
|
const stat = await fs.promises.lstat(dir);
|
|
94
100
|
if (!stat.isDirectory() || (stat.mode & 0o077) !== 0) {
|
|
95
|
-
return
|
|
101
|
+
return null;
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
const files = await collect(dir, '');
|
|
99
|
-
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
return hashBundledSkills(files) === hash;
|
|
105
|
+
return files && hashSkillFiles(files).slice(0, hash.length) === hash ? files : null;
|
|
103
106
|
}
|
|
104
107
|
catch {
|
|
105
|
-
return
|
|
108
|
+
return null;
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
async function collect(dir, prefix) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
2
|
export function hashBundledSkills(files) {
|
|
3
|
+
return hashSkillFiles(files).slice(0, 16);
|
|
4
|
+
}
|
|
5
|
+
export function hashSkillFiles(files) {
|
|
3
6
|
const hash = crypto.createHash('sha256');
|
|
4
7
|
const sorted = [...files].sort(byPath);
|
|
5
8
|
for (const file of sorted) {
|
|
@@ -8,7 +11,7 @@ export function hashBundledSkills(files) {
|
|
|
8
11
|
hash.update(file.content);
|
|
9
12
|
hash.update('\0');
|
|
10
13
|
}
|
|
11
|
-
return hash.digest('hex')
|
|
14
|
+
return hash.digest('hex');
|
|
12
15
|
}
|
|
13
16
|
function byPath(a, b) {
|
|
14
17
|
if (a.path < b.path)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SkillCatalogEntry } from './catalog.ts';
|
|
2
|
+
export interface LoadSkillCatalogOptions {
|
|
3
|
+
platform?: string | null;
|
|
4
|
+
overlayDir?: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function loadSkillCatalog(skillsDir: string | null, { platform, overlayDir }?: LoadSkillCatalogOptions): Promise<SkillCatalogEntry[]>;
|
|
7
|
+
export interface SkillTreeRef {
|
|
8
|
+
readonly root: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function layerSkills(catalog: readonly SkillCatalogEntry[], trees: readonly SkillTreeRef[]): Promise<SkillCatalogEntry[]>;
|
|
12
|
+
export declare function detectPlatform(): string;
|