@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.
Files changed (191) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist-lib/index.d.ts +7 -5
  3. package/dist-lib/index.js +5 -4
  4. package/dist-lib/lib/agent/resolve.js +2 -1
  5. package/dist-lib/lib/capabilities/completion-engine/actors/answering.js +2 -2
  6. package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +1 -1
  7. package/dist-lib/lib/capabilities/completion-engine/actors/execute.d.ts +1 -1
  8. package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +8 -6
  9. package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +1 -1
  10. package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +1 -1
  11. package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +2 -1
  12. package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +8 -3
  13. package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +10 -4
  14. package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.js +2 -1
  15. package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +8 -8
  16. package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +2 -2
  17. package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +3 -2
  18. package/dist-lib/lib/capabilities/completion-engine/loop.js +1 -0
  19. package/dist-lib/lib/capabilities/completion-engine/round.js +9 -9
  20. package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +3 -1
  21. package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +5 -41
  22. package/dist-lib/lib/capabilities/completion-engine/tool-execution.js +4 -133
  23. package/dist-lib/lib/capabilities/completion-engine/tool-outcome.d.ts +4 -0
  24. package/dist-lib/lib/capabilities/completion-engine/tool-outcome.js +42 -0
  25. package/dist-lib/lib/capabilities/completion-engine/tool-preflight.d.ts +43 -0
  26. package/dist-lib/lib/capabilities/completion-engine/tool-preflight.js +91 -0
  27. package/dist-lib/lib/capabilities/completion-engine/turns.js +7 -4
  28. package/dist-lib/lib/capabilities/tool-turns/attachments.d.ts +7 -0
  29. package/dist-lib/lib/capabilities/tool-turns/attachments.js +39 -0
  30. package/dist-lib/lib/capabilities/tool-turns/copy.d.ts +13 -0
  31. package/dist-lib/lib/capabilities/tool-turns/copy.js +29 -0
  32. package/dist-lib/lib/capabilities/tool-turns/result-turn.d.ts +22 -0
  33. package/dist-lib/lib/capabilities/tool-turns/result-turn.js +120 -0
  34. package/dist-lib/lib/capabilities/tool-turns/run-limits.d.ts +6 -0
  35. package/dist-lib/lib/capabilities/tool-turns/run-limits.js +32 -0
  36. package/dist-lib/lib/capabilities/tool-turns/skill-loads.d.ts +9 -0
  37. package/dist-lib/lib/capabilities/tool-turns/skill-loads.js +71 -0
  38. package/dist-lib/lib/capabilities/tool-turns.d.ts +8 -54
  39. package/dist-lib/lib/capabilities/tool-turns.js +6 -281
  40. package/dist-lib/lib/client/index.js +3 -3
  41. package/dist-lib/lib/connect/abort.d.ts +6 -0
  42. package/dist-lib/lib/connect/abort.js +52 -0
  43. package/dist-lib/lib/connect/bridges.d.ts +21 -0
  44. package/dist-lib/lib/connect/bridges.js +185 -0
  45. package/dist-lib/lib/connect/decode.d.ts +31 -0
  46. package/dist-lib/lib/connect/decode.js +114 -0
  47. package/dist-lib/lib/connect/host-run-log.d.ts +16 -0
  48. package/dist-lib/lib/connect/host-run-log.js +74 -0
  49. package/dist-lib/lib/connect/served.d.ts +7 -0
  50. package/dist-lib/lib/connect/served.js +45 -0
  51. package/dist-lib/lib/connect.d.ts +3 -3
  52. package/dist-lib/lib/connect.js +24 -468
  53. package/dist-lib/lib/context-window.d.ts +13 -7
  54. package/dist-lib/lib/context-window.js +13 -6
  55. package/dist-lib/lib/contract/agent.d.ts +12 -1
  56. package/dist-lib/lib/contract/completion.d.ts +5 -1
  57. package/dist-lib/lib/contract/drive.d.ts +130 -4
  58. package/dist-lib/lib/contract/ocr.d.ts +5 -1
  59. package/dist-lib/lib/contract-types.d.ts +5 -3
  60. package/dist-lib/lib/errors.js +3 -3
  61. package/dist-lib/lib/helpers/goal-check/asks.d.ts +25 -0
  62. package/dist-lib/lib/helpers/goal-check/asks.js +52 -0
  63. package/dist-lib/lib/helpers/goal-check/checks.d.ts +8 -0
  64. package/dist-lib/lib/helpers/goal-check/checks.js +92 -0
  65. package/dist-lib/lib/helpers/goal-check/commands.d.ts +7 -0
  66. package/dist-lib/lib/helpers/goal-check/commands.js +130 -0
  67. package/dist-lib/lib/helpers/goal-check/paths.d.ts +5 -0
  68. package/dist-lib/lib/helpers/goal-check/paths.js +44 -0
  69. package/dist-lib/lib/helpers/goal-check/shell.d.ts +9 -0
  70. package/dist-lib/lib/helpers/goal-check/shell.js +96 -0
  71. package/dist-lib/lib/helpers/goal-check.d.ts +35 -43
  72. package/dist-lib/lib/helpers/goal-check.js +34 -406
  73. package/dist-lib/lib/helpers/recent-map.d.ts +7 -0
  74. package/dist-lib/lib/helpers/recent-map.js +23 -0
  75. package/dist-lib/lib/helpers/tool-call-markup/emit.d.ts +6 -0
  76. package/dist-lib/lib/helpers/tool-call-markup/emit.js +15 -0
  77. package/dist-lib/lib/helpers/tool-call-markup/recover.d.ts +22 -0
  78. package/dist-lib/lib/helpers/tool-call-markup/recover.js +130 -0
  79. package/dist-lib/lib/helpers/tool-call-markup/skill-recovery.d.ts +3 -0
  80. package/dist-lib/lib/helpers/tool-call-markup/skill-recovery.js +56 -0
  81. package/dist-lib/lib/helpers/tool-call-markup/strip.d.ts +4 -0
  82. package/dist-lib/lib/helpers/tool-call-markup/strip.js +149 -0
  83. package/dist-lib/lib/helpers/tool-call-markup.d.ts +19 -24
  84. package/dist-lib/lib/helpers/tool-call-markup.js +17 -343
  85. package/dist-lib/lib/machine/completion/actions/completion.d.ts +12 -18
  86. package/dist-lib/lib/machine/completion/actions/completion.js +19 -178
  87. package/dist-lib/lib/machine/completion/actions/goal.d.ts +10 -0
  88. package/dist-lib/lib/machine/completion/actions/goal.js +93 -0
  89. package/dist-lib/lib/machine/completion/actions/prepare.js +2 -1
  90. package/dist-lib/lib/machine/completion/actions/reject-tool.d.ts +16 -0
  91. package/dist-lib/lib/machine/completion/actions/reject-tool.js +147 -0
  92. package/dist-lib/lib/machine/completion/actions/retry-round.d.ts +6 -0
  93. package/dist-lib/lib/machine/completion/actions/retry-round.js +50 -0
  94. package/dist-lib/lib/machine/completion/actions/rounds.d.ts +5 -0
  95. package/dist-lib/lib/machine/completion/actions/rounds.js +31 -0
  96. package/dist-lib/lib/machine/completion/actions/tools.d.ts +1 -16
  97. package/dist-lib/lib/machine/completion/actions/tools.js +16 -161
  98. package/dist-lib/lib/machine/completion/context.js +3 -3
  99. package/dist-lib/lib/machine/completion/implementations.d.ts +2 -2
  100. package/dist-lib/lib/machine/completion/implementations.js +6 -2
  101. package/dist-lib/lib/machine/completion/machine.d.ts +2 -2
  102. package/dist-lib/lib/machine/completion/metrics.d.ts +25 -0
  103. package/dist-lib/lib/machine/completion/metrics.js +68 -0
  104. package/dist-lib/lib/machine/completion/nudges.d.ts +5 -0
  105. package/dist-lib/lib/machine/completion/nudges.js +33 -0
  106. package/dist-lib/lib/machine/completion/rules.d.ts +5 -34
  107. package/dist-lib/lib/machine/completion/rules.js +4 -120
  108. package/dist-lib/lib/machine/completion/splice.d.ts +9 -0
  109. package/dist-lib/lib/machine/completion/splice.js +19 -0
  110. package/dist-lib/lib/machine/completion/types.d.ts +4 -13
  111. package/dist-lib/lib/machine/index.d.ts +3 -3
  112. package/dist-lib/lib/machine/index.js +2 -2
  113. package/dist-lib/lib/media-host.js +2 -2
  114. package/dist-lib/lib/media-wire.js +2 -2
  115. package/dist-lib/lib/residency/completion-runtime.d.ts +2 -1
  116. package/dist-lib/lib/residency/completion-runtime.js +44 -1
  117. package/dist-lib/lib/residency/index.d.ts +3 -2
  118. package/dist-lib/lib/residency/index.js +2 -2
  119. package/dist-lib/lib/round-host.js +3 -3
  120. package/dist-lib/lib/round-port.js +3 -3
  121. package/dist-lib/lib/run-log/redact.js +7 -7
  122. package/dist-lib/lib/serve/completion.d.ts +7 -0
  123. package/dist-lib/lib/serve/completion.js +553 -0
  124. package/dist-lib/lib/serve/downloads.d.ts +4 -0
  125. package/dist-lib/lib/serve/downloads.js +79 -0
  126. package/dist-lib/lib/serve/models.d.ts +5 -0
  127. package/dist-lib/lib/serve/models.js +120 -0
  128. package/dist-lib/lib/serve/noop.d.ts +1 -0
  129. package/dist-lib/lib/serve/noop.js +1 -0
  130. package/dist-lib/lib/serve/requests.d.ts +147 -0
  131. package/dist-lib/lib/serve/requests.js +1 -0
  132. package/dist-lib/lib/serve/rounds.d.ts +11 -0
  133. package/dist-lib/lib/serve/rounds.js +67 -0
  134. package/dist-lib/lib/serve/run-log-start.d.ts +38 -0
  135. package/dist-lib/lib/serve/run-log-start.js +254 -0
  136. package/dist-lib/lib/serve/skills.d.ts +32 -0
  137. package/dist-lib/lib/serve/skills.js +46 -0
  138. package/dist-lib/lib/serve.d.ts +5 -1
  139. package/dist-lib/lib/serve.js +14 -1071
  140. package/dist-lib/lib/skills-host/index.d.ts +4 -2
  141. package/dist-lib/lib/skills-host/index.js +20 -8
  142. package/dist-lib/lib/tools/fs/drive.d.ts +1 -17
  143. package/dist-lib/lib/tools/fs/remote-protocol.d.ts +1 -81
  144. package/dist-lib/lib/tools/fs/scope.d.ts +2 -17
  145. package/dist-lib/lib/tools/fs/search.d.ts +2 -18
  146. package/dist-lib/lib/tools/fs/walk.d.ts +1 -5
  147. package/dist-lib/lib/tools/pdf/build.d.ts +2 -2
  148. package/dist-lib/lib/tools/pdf/recognize.js +4 -8
  149. package/dist-lib/lib/tools/pdf/request.d.ts +3 -8
  150. package/dist-lib/lib/tools/pdf/request.js +4 -4
  151. package/dist-lib/lib/tools/pdf.d.ts +0 -1
  152. package/dist-lib/lib/tools/pdf.js +0 -1
  153. package/dist-lib/lib/tools/skill.js +13 -4
  154. package/dist-lib/lib/tools/skills/bundled-dir.d.ts +3 -0
  155. package/dist-lib/lib/tools/skills/bundled-dir.js +27 -24
  156. package/dist-lib/lib/tools/skills/bundled-hash.d.ts +1 -0
  157. package/dist-lib/lib/tools/skills/bundled-hash.js +4 -1
  158. package/dist-lib/lib/tools/skills/catalog-loader.d.ts +12 -0
  159. package/dist-lib/lib/tools/skills/catalog-loader.js +173 -0
  160. package/dist-lib/lib/tools/skills/catalog.d.ts +5 -8
  161. package/dist-lib/lib/tools/skills/catalog.js +1 -162
  162. package/dist-lib/lib/tools/skills/index.d.ts +1 -0
  163. package/dist-lib/lib/tools/skills/index.js +1 -0
  164. package/dist-lib/lib/tools/skills/skill-tree.d.ts +5 -0
  165. package/dist-lib/lib/tools/skills/skill-tree.js +54 -0
  166. package/dist-lib/lib/wire/download.d.ts +10 -0
  167. package/dist-lib/lib/wire/download.js +35 -0
  168. package/dist-lib/lib/wire/event.d.ts +41 -0
  169. package/dist-lib/lib/wire/event.js +306 -0
  170. package/dist-lib/lib/wire/fields.d.ts +3 -0
  171. package/dist-lib/lib/wire/fields.js +12 -0
  172. package/dist-lib/lib/wire/knowledge.d.ts +9 -0
  173. package/dist-lib/lib/wire/knowledge.js +68 -0
  174. package/dist-lib/lib/wire/round.d.ts +14 -0
  175. package/dist-lib/lib/wire/round.js +45 -0
  176. package/dist-lib/lib/wire/vectors.d.ts +6 -0
  177. package/dist-lib/lib/wire/vectors.js +33 -0
  178. package/dist-lib/lib/wire.d.ts +28 -77
  179. package/dist-lib/lib/wire.js +24 -489
  180. package/dist-lib/plugins/ocr/coverage.d.ts +3 -0
  181. package/dist-lib/plugins/ocr/coverage.js +67 -0
  182. package/dist-lib/plugins/ocr/ocr-runtime.d.ts +4 -2
  183. package/dist-lib/plugins/ocr/ocr-runtime.js +25 -4
  184. package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
  185. package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
  186. package/dist-lib/schema/harness.js +4 -1
  187. package/dist-lib/spec/hrpc/messages.js +25 -1
  188. package/dist-lib/spec/hyperschema/index.js +25 -1
  189. package/dist-lib/spec/hyperschema/schema.json +6 -1
  190. package/dist-lib/spec/hyperschema/types.d.ts +1 -0
  191. package/package.json +2 -2
@@ -1,9 +1,13 @@
1
1
  import { assign, enqueueActions } from 'xstate';
2
2
  import { isFailureResultReference } from '../../helpers/failure-result.js';
3
3
  import { approveCompletion, requestApproval } from './actions/approval.js';
4
- import { addKnowledge, answerCompletion, continueGoal, continueStalledGoal, continueStop, continueWithFollowUps, failCompletion, finishWrapRound, finishRound, markGoalStalled, retryCappedSearch, retryCutRound, retryMalformedRound, retryMuteRound, retryNarratedRound, settleGoal, startInitialRound, startNextRound, wrapCompletion, wrapCutCompletion, wrapDeliveredCompletion, wrapExhaustedCompletion, wrapMuteCompletion, wrapSearchCappedCompletion } from './actions/completion.js';
4
+ import { answerCompletion, failCompletion, finishWrapRound, finishRound, wrapCompletion, wrapCutCompletion, wrapDeliveredCompletion, wrapExhaustedCompletion, wrapMuteCompletion, wrapSearchCappedCompletion } from './actions/completion.js';
5
+ import { continueGoal, continueStalledGoal, continueStop, markGoalStalled, settleGoal } from './actions/goal.js';
5
6
  import { authorizePrepare, requestPrepare, settlePrepare, settlePrepareFailure } from './actions/prepare.js';
6
- import { finishBatch, finishDirectTool, finishTool, endRunOnTool, queueDirectSearch, rejectCutOffTool, rejectDeniedApproval, rejectPlanModeWrite, rejectRepeatedTool, rejectTool, resolveTools, selectNextTool, startDirectTool, startTool } from './actions/tools.js';
7
+ import { retryCappedSearch, retryCutRound, retryMalformedRound, retryMuteRound, retryNarratedRound } from './actions/retry-round.js';
8
+ import { rejectCutOffTool, rejectDeniedApproval, rejectPlanModeWrite, rejectRepeatedTool, rejectTool } from './actions/reject-tool.js';
9
+ import { addKnowledge, continueWithFollowUps, startInitialRound, startNextRound } from './actions/rounds.js';
10
+ import { finishBatch, finishDirectTool, finishTool, endRunOnTool, queueDirectSearch, resolveTools, selectNextTool, startDirectTool, startTool } from './actions/tools.js';
7
11
  import { allResolvedToolsCapped, canMuteRetry, canRetryCut, canRetryMalformed, canRetryNarrated, canRetrySearchCap, hasQueuedTool, hasRoundsLeft, repeatsBlocked, searchPending } from './guards/retry.js';
8
12
  import { goalMet, goalStalled, goalTokensLeft, leadingReads, runsUnasked } from './rules.js';
9
13
  function output(event) {
@@ -204,13 +204,13 @@ declare const createCompletionMachineImplementation: (context?: CompletionContex
204
204
  params: RejectDeniedApprovalParams;
205
205
  } | {
206
206
  type: "rejectPlanModeWrite";
207
- params: import("./actions/tools.ts").RejectPlanModeWriteParams;
207
+ params: import("./actions/reject-tool.ts").RejectPlanModeWriteParams;
208
208
  } | {
209
209
  type: "rejectRepeatedTool";
210
210
  params: import("./types.ts").RepeatOfFailedCallParams;
211
211
  } | {
212
212
  type: "rejectTool";
213
- params: import("./actions/tools.ts").RejectToolParams;
213
+ params: import("./actions/reject-tool.ts").RejectToolParams;
214
214
  } | {
215
215
  type: "requestApproval";
216
216
  params: import("./types.ts").ApprovalCall;
@@ -0,0 +1,25 @@
1
+ import type { RoundSpeed, RunBackendUse, ToolSpeed } from '../../contract/run.ts';
2
+ import type { CompletionStats } from './types.ts';
3
+ export interface MetricsState {
4
+ ttft?: number;
5
+ tokens: number;
6
+ timedTokens: number;
7
+ decodeMs: number;
8
+ promptTokens?: number;
9
+ cacheTokens?: number;
10
+ ctxSize?: number | undefined;
11
+ backends?: RunBackendUse[];
12
+ stopReason?: string | undefined;
13
+ rounds: RoundSpeed[];
14
+ tools: ToolSpeed[];
15
+ }
16
+ export interface FinishedRound {
17
+ stats?: CompletionStats | undefined;
18
+ stopReason?: string | undefined;
19
+ durationMs?: number | undefined;
20
+ ctxSize?: number | undefined;
21
+ overflows?: number | undefined;
22
+ reasoningDeltas?: number | undefined;
23
+ keyed?: boolean | undefined;
24
+ }
25
+ export declare function foldMetrics(state: MetricsState, round: number, finished: FinishedRound): void;
@@ -0,0 +1,68 @@
1
+ import { atContextBoundary } from './rules.js';
2
+ export function foldMetrics(state, round, finished) {
3
+ const { stats, stopReason } = finished;
4
+ state.stopReason = stopReason;
5
+ state.rounds = [...state.rounds, roundSpeed(round, finished)];
6
+ if (finished.ctxSize) {
7
+ state.ctxSize = finished.ctxSize;
8
+ }
9
+ if (!stats) {
10
+ if (finished.keyed === false) {
11
+ delete state.cacheTokens;
12
+ }
13
+ return;
14
+ }
15
+ if (state.ttft === undefined && stats.timeToFirstToken) {
16
+ state.ttft = stats.timeToFirstToken;
17
+ }
18
+ if (stats.generatedTokens) {
19
+ state.tokens += stats.generatedTokens;
20
+ if (stats.tokensPerSecond) {
21
+ state.decodeMs += (stats.generatedTokens / stats.tokensPerSecond) * 1000;
22
+ state.timedTokens += stats.generatedTokens;
23
+ }
24
+ }
25
+ if (stats.promptTokens !== undefined) {
26
+ state.promptTokens = stats.promptTokens;
27
+ }
28
+ if (stats.cacheTokens !== undefined) {
29
+ state.cacheTokens = stats.cacheTokens;
30
+ }
31
+ if (finished.keyed === false && stats.cacheTokens === undefined) {
32
+ delete state.cacheTokens;
33
+ }
34
+ }
35
+ const ROUND_STATS = [
36
+ 'promptTokens',
37
+ 'cacheTokens',
38
+ 'generatedTokens',
39
+ 'promptTokensPerSecond',
40
+ 'tokensPerSecond',
41
+ 'timeToFirstToken',
42
+ 'avgConcurrentSeq'
43
+ ];
44
+ function roundSpeed(round, { stats, stopReason, durationMs, overflows, reasoningDeltas, keyed }) {
45
+ const speed = { round, durationMs: durationMs ?? 0 };
46
+ for (const key of ROUND_STATS) {
47
+ const value = stats?.[key];
48
+ if (value !== undefined) {
49
+ speed[key] = value;
50
+ }
51
+ }
52
+ if (keyed === false) {
53
+ speed.cacheTokens = 0;
54
+ }
55
+ if (stopReason) {
56
+ speed.stopReason = stopReason;
57
+ }
58
+ if (overflows) {
59
+ speed.overflows = overflows;
60
+ }
61
+ if (atContextBoundary({ stats, stopReason })) {
62
+ speed.contextBoundary = true;
63
+ }
64
+ if (reasoningDeltas) {
65
+ speed.reasoningDeltas = reasoningDeltas;
66
+ }
67
+ return speed;
68
+ }
@@ -0,0 +1,5 @@
1
+ import type { PlanStep } from '../../contract/run.ts';
2
+ import type { GoalCheck as CheckedGoal } from './types.ts';
3
+ export declare function nudgeWithPlan(nudge: string, plan: readonly PlanStep[]): string;
4
+ export declare function imagesShownNote(fileNames: readonly string[]): string;
5
+ export declare function nudgeWithChecks(nudge: string, checks: readonly CheckedGoal[], unnamed?: boolean): string;
@@ -0,0 +1,33 @@
1
+ import { GoalCheck } from '../../helpers/goal-check.js';
2
+ import { isDone } from './rules.js';
3
+ const PLAN_MARKS = {
4
+ pending: '[ ]',
5
+ in_progress: '[>]',
6
+ done: '[x]'
7
+ };
8
+ export function nudgeWithPlan(nudge, plan) {
9
+ if (plan.every(isDone)) {
10
+ return nudge;
11
+ }
12
+ const lines = plan.map(({ step, status }) => `${PLAN_MARKS[status]} ${step}`);
13
+ return `${nudge}\nPlan:\n${lines.join('\n')}`;
14
+ }
15
+ export function imagesShownNote(fileNames) {
16
+ const named = fileNames.map((name) => `"${name}"`).join(', ');
17
+ return fileNames.length === 1
18
+ ? `[The image at the start of this turn is ${named}, which a tool above attached. You can see it: use what it shows, with no tool to open it.]`
19
+ : `[The images at the start of this turn are ${named}, which tools above attached. You can see them: use what they show, with no tool to open them.]`;
20
+ }
21
+ export function nudgeWithChecks(nudge, checks, unnamed) {
22
+ if (!checks.length) {
23
+ return unnamed ? `${nudge}\n${GoalCheck.GOAL_CHECKS_ASK}` : nudge;
24
+ }
25
+ const asked = unnamed ? `${nudge}\n${GoalCheck.GOAL_PROOF_ASK}` : nudge;
26
+ const open = checks.filter((check) => !check.passed);
27
+ if (!open.length) {
28
+ return asked;
29
+ }
30
+ const lines = open.map(({ name, output }) => output === null ? `- ${name}: not run yet` : `- ${name}: failed. Its last output:\n${output}`);
31
+ return (`${asked}\nChecks: the goal is met only once each of these runs as its own command and ` +
32
+ `exits 0, with no pipe or ; after it to hide its exit code.\n${lines.join('\n')}`);
33
+ }
@@ -1,6 +1,6 @@
1
- import type { CompletionHistoryEntry, HistorySplice, PlanStep, RoundSpeed, RunBackendUse, ToolSpeed } from '../../contract/run.ts';
1
+ import type { CompletionHistoryEntry, PlanStep } from '../../contract/run.ts';
2
2
  import { type FailureResultValue } from '../../helpers/failure-result.ts';
3
- import type { CompletionStats, GoalCheck, RunPolicy, SettledCall, CompletionContext, ResolvedCallSnapshot, ToolPreflightFacts } from './types.ts';
3
+ import type { CompletionStats, RunPolicy, SettledCall, CompletionContext, ResolvedCallSnapshot, ToolPreflightFacts } from './types.ts';
4
4
  export declare function runsUnasked(facts: Pick<ToolPreflightFacts, 'effect' | 'autoApprove' | 'skipApprovals' | 'permission'>): boolean;
5
5
  export declare const MAX_MUTE_ROUNDS = 1;
6
6
  export declare const MAX_CUT_ROUNDS = 2;
@@ -10,52 +10,23 @@ export declare const MAX_UNCHANGED_RESULTS = 3;
10
10
  export declare const MAX_ROUND_REPEATS = 3;
11
11
  export declare const MAX_ROUND_CALLS = 32;
12
12
  export declare const MAX_SHOWN_IMAGES = 4;
13
- export declare function nudgeWithPlan(nudge: string, plan: readonly PlanStep[]): string;
14
- export declare function imagesShownNote(fileNames: readonly string[]): string;
13
+ export declare function isDone(step: PlanStep): boolean;
15
14
  export declare function goalMet(context: Readonly<CompletionContext>): boolean;
16
15
  export declare function casesDue(context: Readonly<CompletionContext>): boolean;
17
16
  export declare function checksMet({ plan, goal }: Readonly<CompletionContext>): boolean;
18
- export declare function nudgeWithChecks(nudge: string, checks: readonly GoalCheck[], unnamed?: boolean): string;
19
17
  export declare function goalTokensLeft({ goal, metrics }: Readonly<CompletionContext>): boolean;
20
18
  export declare function goalStalled({ outcome }: Readonly<CompletionContext>): boolean;
21
19
  export declare function settledSince(settled: CompletionContext['settledResults']): CompletionContext['settledResults'];
22
20
  export declare function retainFailureResults(history: readonly CompletionHistoryEntry[], values: Readonly<Record<string, FailureResultValue>>, failedCalls: Readonly<Record<string, SettledCall>>): Record<string, FailureResultValue>;
23
21
  export declare function activate(activated: string[], names: readonly string[]): string[];
24
- export interface ApplyHistorySpliceOptions {
25
- failedCalls?: Readonly<Record<string, SettledCall>>;
26
- failureResults?: Readonly<Record<string, FailureResultValue>>;
27
- }
28
- export declare function applyHistorySplice(context: Readonly<CompletionContext>, splice?: HistorySplice, options?: ApplyHistorySpliceOptions): Pick<CompletionContext, 'history' | 'failureResults'>;
29
- export interface MetricsState {
30
- ttft?: number;
31
- tokens: number;
32
- timedTokens: number;
33
- decodeMs: number;
34
- promptTokens?: number;
35
- cacheTokens?: number;
36
- ctxSize?: number | undefined;
37
- backends?: RunBackendUse[];
38
- stopReason?: string | undefined;
39
- rounds: RoundSpeed[];
40
- tools: ToolSpeed[];
41
- }
42
- export interface FinishedRound {
22
+ interface StoppedRound {
43
23
  stats?: CompletionStats | undefined;
44
24
  stopReason?: string | undefined;
45
- durationMs?: number | undefined;
46
- ctxSize?: number | undefined;
47
- overflows?: number | undefined;
48
- reasoningDeltas?: number | undefined;
49
- keyed?: boolean | undefined;
50
- }
51
- export declare function foldMetrics(state: MetricsState, round: number, finished: FinishedRound): void;
52
- type StoppedRound = Pick<FinishedRound, 'stats' | 'stopReason'> & {
53
25
  cut?: string | undefined;
54
- };
26
+ }
55
27
  export declare function atContextBoundary({ stats, stopReason }: StoppedRound): boolean;
56
28
  export declare function cutShort(round: StoppedRound): boolean;
57
29
  export declare function cutOffMessage(policy: RunPolicy, round: StoppedRound | null): string;
58
30
  export declare function recordTool(context: Readonly<CompletionContext>, call: ResolvedCallSnapshot | null, durationMs: number | undefined): CompletionContext['metrics'];
59
31
  export declare function leadingReads(context: Readonly<CompletionContext>): number;
60
- export declare function applySplice(history: CompletionHistoryEntry[], splice?: HistorySplice): CompletionHistoryEntry[];
61
32
  export {};
@@ -1,5 +1,5 @@
1
1
  import { isFailureResultReference } from '../../helpers/failure-result.js';
2
- import { asksChecks, codeUnrun, deliverableChecked, GOAL_CHECKS_ASK, GOAL_PROOF_ASK } from '../../helpers/goal-check.js';
2
+ import { GoalCheck } from '../../helpers/goal-check.js';
3
3
  export function runsUnasked(facts) {
4
4
  if (facts.permission === 'ask')
5
5
  return false;
@@ -16,25 +16,7 @@ export const MAX_UNCHANGED_RESULTS = 3;
16
16
  export const MAX_ROUND_REPEATS = 3;
17
17
  export const MAX_ROUND_CALLS = 32;
18
18
  export const MAX_SHOWN_IMAGES = 4;
19
- const PLAN_MARKS = {
20
- pending: '[ ]',
21
- in_progress: '[>]',
22
- done: '[x]'
23
- };
24
- export function nudgeWithPlan(nudge, plan) {
25
- if (plan.every(isDone)) {
26
- return nudge;
27
- }
28
- const lines = plan.map(({ step, status }) => `${PLAN_MARKS[status]} ${step}`);
29
- return `${nudge}\nPlan:\n${lines.join('\n')}`;
30
- }
31
- export function imagesShownNote(fileNames) {
32
- const named = fileNames.map((name) => `"${name}"`).join(', ');
33
- return fileNames.length === 1
34
- ? `[The image at the start of this turn is ${named}, which a tool above attached. You can see it: use what it shows, with no tool to open it.]`
35
- : `[The images at the start of this turn are ${named}, which tools above attached. You can see them: use what they show, with no tool to open them.]`;
36
- }
37
- function isDone(step) {
19
+ export function isDone(step) {
38
20
  return step.status === 'done';
39
21
  }
40
22
  function planDone(plan) {
@@ -57,26 +39,13 @@ function halfLeft({ halfTime, round, policy, goal, metrics }) {
57
39
  export function checksMet({ plan, goal }) {
58
40
  const checks = goal?.checks ?? [];
59
41
  return (planDone(plan) &&
60
- !(goal && asksChecks(goal)) &&
42
+ !(goal && GoalCheck.asksChecks(goal)) &&
61
43
  checks.every((check) => check.passed) &&
62
- (!goal || (deliverableChecked(goal) && !codeUnrun(goal))));
44
+ (!goal || (GoalCheck.deliverableChecked(goal) && !GoalCheck.codeUnrun(goal))));
63
45
  }
64
46
  function reviewPending(goal) {
65
47
  return !!goal?.checkable && (goal.review === 'due' || goal.review === 'asked');
66
48
  }
67
- export function nudgeWithChecks(nudge, checks, unnamed) {
68
- if (!checks.length) {
69
- return unnamed ? `${nudge}\n${GOAL_CHECKS_ASK}` : nudge;
70
- }
71
- const asked = unnamed ? `${nudge}\n${GOAL_PROOF_ASK}` : nudge;
72
- const open = checks.filter((check) => !check.passed);
73
- if (!open.length) {
74
- return asked;
75
- }
76
- const lines = open.map(({ name, output }) => output === null ? `- ${name}: not run yet` : `- ${name}: failed. Its last output:\n${output}`);
77
- return (`${asked}\nChecks: the goal is met only once each of these runs as its own command and ` +
78
- `exits 0, with no pipe or ; after it to hide its exit code.\n${lines.join('\n')}`);
79
- }
80
49
  export function goalTokensLeft({ goal, metrics }) {
81
50
  return !goal || goal.tokens === null || metrics.tokens < goal.tokens;
82
51
  }
@@ -106,82 +75,6 @@ export function activate(activated, names) {
106
75
  const added = names.filter((name, at) => !activated.includes(name) && names.indexOf(name) === at);
107
76
  return added.length ? [...activated, ...added] : activated;
108
77
  }
109
- export function applyHistorySplice(context, splice, options = {}) {
110
- const failedCalls = options.failedCalls ?? context.failedCalls;
111
- const failureResults = options.failureResults ?? context.failureResults;
112
- const history = applySplice(context.history, splice);
113
- return {
114
- history,
115
- failureResults: retainFailureResults(history, failureResults, failedCalls)
116
- };
117
- }
118
- export function foldMetrics(state, round, finished) {
119
- const { stats, stopReason } = finished;
120
- state.stopReason = stopReason;
121
- state.rounds = [...state.rounds, roundSpeed(round, finished)];
122
- if (finished.ctxSize) {
123
- state.ctxSize = finished.ctxSize;
124
- }
125
- if (!stats) {
126
- if (finished.keyed === false) {
127
- delete state.cacheTokens;
128
- }
129
- return;
130
- }
131
- if (state.ttft === undefined && stats.timeToFirstToken) {
132
- state.ttft = stats.timeToFirstToken;
133
- }
134
- if (stats.generatedTokens) {
135
- state.tokens += stats.generatedTokens;
136
- if (stats.tokensPerSecond) {
137
- state.decodeMs += (stats.generatedTokens / stats.tokensPerSecond) * 1000;
138
- state.timedTokens += stats.generatedTokens;
139
- }
140
- }
141
- if (stats.promptTokens !== undefined) {
142
- state.promptTokens = stats.promptTokens;
143
- }
144
- if (stats.cacheTokens !== undefined) {
145
- state.cacheTokens = stats.cacheTokens;
146
- }
147
- if (finished.keyed === false && stats.cacheTokens === undefined) {
148
- delete state.cacheTokens;
149
- }
150
- }
151
- const ROUND_STATS = [
152
- 'promptTokens',
153
- 'cacheTokens',
154
- 'generatedTokens',
155
- 'promptTokensPerSecond',
156
- 'tokensPerSecond',
157
- 'timeToFirstToken',
158
- 'avgConcurrentSeq'
159
- ];
160
- function roundSpeed(round, { stats, stopReason, durationMs, overflows, reasoningDeltas, keyed }) {
161
- const speed = { round, durationMs: durationMs ?? 0 };
162
- for (const key of ROUND_STATS) {
163
- const value = stats?.[key];
164
- if (value !== undefined) {
165
- speed[key] = value;
166
- }
167
- }
168
- if (keyed === false) {
169
- speed.cacheTokens = 0;
170
- }
171
- if (stopReason) {
172
- speed.stopReason = stopReason;
173
- }
174
- if (overflows) {
175
- speed.overflows = overflows;
176
- }
177
- if (atContextBoundary({ stats, stopReason })) {
178
- speed.contextBoundary = true;
179
- }
180
- if (reasoningDeltas) {
181
- speed.reasoningDeltas = reasoningDeltas;
182
- }
183
- return speed;
184
- }
185
78
  export function atContextBoundary({ stats, stopReason }) {
186
79
  return stopReason === 'length' && stats?.contextBoundary !== false;
187
80
  }
@@ -210,12 +103,3 @@ export function leadingReads(context) {
210
103
  }
211
104
  return keys.size;
212
105
  }
213
- export function applySplice(history, splice) {
214
- if (!splice) {
215
- return history;
216
- }
217
- if (splice.at === history.length && !splice.messages.length) {
218
- return history;
219
- }
220
- return [...history.slice(0, splice.at), ...splice.messages];
221
- }
@@ -0,0 +1,9 @@
1
+ import type { CompletionHistoryEntry, HistorySplice } from '../../contract/run.ts';
2
+ import type { FailureResultValue } from '../../helpers/failure-result.ts';
3
+ import type { CompletionContext, SettledCall } from './types.ts';
4
+ export interface ApplyHistorySpliceOptions {
5
+ failedCalls?: Readonly<Record<string, SettledCall>>;
6
+ failureResults?: Readonly<Record<string, FailureResultValue>>;
7
+ }
8
+ export declare function applyHistorySplice(context: Readonly<CompletionContext>, splice?: HistorySplice, options?: ApplyHistorySpliceOptions): Pick<CompletionContext, 'history' | 'failureResults'>;
9
+ export declare function applySplice(history: CompletionHistoryEntry[], splice?: HistorySplice): CompletionHistoryEntry[];
@@ -0,0 +1,19 @@
1
+ import { retainFailureResults } from './rules.js';
2
+ export function applyHistorySplice(context, splice, options = {}) {
3
+ const failedCalls = options.failedCalls ?? context.failedCalls;
4
+ const failureResults = options.failureResults ?? context.failureResults;
5
+ const history = applySplice(context.history, splice);
6
+ return {
7
+ history,
8
+ failureResults: retainFailureResults(history, failureResults, failedCalls)
9
+ };
10
+ }
11
+ export function applySplice(history, splice) {
12
+ if (!splice) {
13
+ return history;
14
+ }
15
+ if (splice.at === history.length && !splice.messages.length) {
16
+ return history;
17
+ }
18
+ return [...history.slice(0, splice.at), ...splice.messages];
19
+ }
@@ -30,7 +30,7 @@ export interface EngineEvent {
30
30
  export interface EngineFacts extends Record<string, unknown> {
31
31
  runBudget: RunBudget;
32
32
  }
33
- export interface CompletionMetrics {
33
+ interface CompletionMetrics {
34
34
  ttft?: number;
35
35
  tokens: number;
36
36
  timedTokens: number;
@@ -57,7 +57,7 @@ export interface ApprovalCall {
57
57
  display?: ToolCallDisplay | null;
58
58
  quote?: string | null;
59
59
  }
60
- export interface RoundToolCall {
60
+ interface RoundToolCall {
61
61
  id: string;
62
62
  name: string;
63
63
  arguments: Record<string, unknown>;
@@ -180,7 +180,7 @@ export interface SettledCall {
180
180
  resultRef: string;
181
181
  outcome: ToolExecutionOutcome;
182
182
  }
183
- export type RejectedToolResult = {
183
+ type RejectedToolResult = {
184
184
  result: unknown;
185
185
  resultRef?: never;
186
186
  } | {
@@ -199,16 +199,6 @@ export type ToolRejectedPayload = RejectedToolResult & {
199
199
  source: 'skill' | 'tool-result';
200
200
  repeat?: ToolExecutionOutcome;
201
201
  };
202
- export type ToolPolicyRejection = 'skill-already-loaded' | 'skill-unready' | 'skill-unavailable' | 'search-cap' | 'hook-rejected' | 'unknown-tool' | 'validation' | 'outbound-refusal' | 'already-denied' | 'denied-without-approver';
203
- export type DirectToolRejectedPayload = ToolRejectedPayload & {
204
- execution: ToolExecutionSnapshot;
205
- preparation: PreparingPayload;
206
- };
207
- export interface ToolStartedPayload {
208
- call: ResolvedCallSnapshot;
209
- execution: ToolExecutionSnapshot;
210
- preparation: PreparingPayload;
211
- }
212
202
  export interface PreparingPayload {
213
203
  history?: HistorySplice;
214
204
  activated?: string[];
@@ -490,3 +480,4 @@ export type CompletionMachineEvent = {
490
480
  context?: TurnContext;
491
481
  content?: string;
492
482
  };
483
+ export {};
@@ -1,4 +1,4 @@
1
- import { goalStatus } from './completion/actions/completion.ts';
1
+ import { goalStatus } from './completion/actions/goal.ts';
2
2
  import { emptyCompletionContext } from './completion/context.ts';
3
3
  import { atContextBoundary, cutOffMessage, cutShort, runsUnasked } from './completion/rules.ts';
4
4
  import { repeatsBlocked } from './completion/guards/retry.ts';
@@ -210,13 +210,13 @@ export declare class CompletionMachine {
210
210
  params: import("./completion/types.ts").RejectDeniedApprovalParams;
211
211
  } | {
212
212
  type: "rejectPlanModeWrite";
213
- params: import("./completion/actions/tools.ts").RejectPlanModeWriteParams;
213
+ params: import("./completion/actions/reject-tool.ts").RejectPlanModeWriteParams;
214
214
  } | {
215
215
  type: "rejectRepeatedTool";
216
216
  params: import("./completion/types.ts").RepeatOfFailedCallParams;
217
217
  } | {
218
218
  type: "rejectTool";
219
- params: import("./completion/actions/tools.ts").RejectToolParams;
219
+ params: import("./completion/actions/reject-tool.ts").RejectToolParams;
220
220
  } | {
221
221
  type: "requestApproval";
222
222
  params: import("./completion/types.ts").ApprovalCall;
@@ -1,5 +1,5 @@
1
- import { goalStatus } from './completion/actions/completion.js';
2
- import { PLAN_MODE_REFUSAL } from './completion/actions/tools.js';
1
+ import { goalStatus } from './completion/actions/goal.js';
2
+ import { PLAN_MODE_REFUSAL } from './completion/actions/reject-tool.js';
3
3
  import { emptyCompletionContext } from './completion/context.js';
4
4
  import { createCompletionMachine } from './completion/machine.js';
5
5
  import { atContextBoundary, cutOffMessage, cutShort, MAX_ROUND_CALLS, MAX_ROUND_REPEATS, MAX_SHOWN_IMAGES, runsUnasked } from './completion/rules.js';
@@ -2,7 +2,7 @@ import { AbortController } from 'bare-abort-controller';
2
2
  import fs from 'fs';
3
3
  import { mediaRequestFrom, mediaResultWire } from './media-wire.js';
4
4
  import { pushQueue } from './queue.js';
5
- import { roundFailureWire } from './wire.js';
5
+ import { Wire } from './wire.js';
6
6
  export class MediaHost {
7
7
  _port;
8
8
  _out = pushQueue();
@@ -22,7 +22,7 @@ export class MediaHost {
22
22
  void mediaRequestFrom(payload)
23
23
  .then((request) => this._port(request, { signal: controller.signal, tick }))
24
24
  .then(mediaResultWire)
25
- .then((wire) => this._settle(callId, wire, wire.path), (err) => this._settle(callId, roundFailureWire(err)));
25
+ .then((wire) => this._settle(callId, wire, wire.path), (err) => this._settle(callId, Wire.roundFailureWire(err)));
26
26
  }
27
27
  cancel(callId) {
28
28
  this._rounds.get(callId)?.abort(undefined);
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs';
2
2
  import { isRecord } from './guards.js';
3
3
  import { stageFile } from './staging.js';
4
- import { roundFailureFrom } from './wire.js';
4
+ import { Wire } from './wire.js';
5
5
  const KINDS = ['image', 'music'];
6
6
  export async function mediaRequestWire(request) {
7
7
  const { images, ...json } = request;
@@ -58,7 +58,7 @@ export async function mediaResultFrom(wire) {
58
58
  if (typeof result.error === 'string') {
59
59
  return { error: result.error, code: typeof result.code === 'string' ? result.code : undefined };
60
60
  }
61
- throw roundFailureFrom(wire);
61
+ throw Wire.roundFailureFrom(wire);
62
62
  }
63
63
  function outputFrom(result, bytes) {
64
64
  if (result.kind === 'image') {
@@ -3,6 +3,7 @@ import type { CompletionArgs } from '../capabilities/completion-engine/index.ts'
3
3
  import type { CompletionSdk, RoundModelLease, ToolDefinition } from '../contract/index.ts';
4
4
  import type { CompletionContext } from '../../index.ts';
5
5
  import type { CompletionSkillEntry } from '../capabilities/skill-entry.ts';
6
+ import type { SkillTreeRef } from '../tools/skills/catalog.ts';
6
7
  import { type LlmDeviceConfig, type ModelLoadOptions, type ModelLifecycleSdk, type PoolLike } from '../models/model-pool.ts';
7
8
  export type CompletionRuntimeRequest = CompletionContext & {
8
9
  ctxSize?: number;
@@ -33,7 +34,7 @@ interface RuntimeResidency {
33
34
  load(): Promise<CompletionSdk>;
34
35
  };
35
36
  tools(): readonly ToolDefinition[];
36
- skills(agentId: string | null, model: string): Promise<CompletionSkillEntry[]>;
37
+ skills(agentId: string | null, model: string, trees?: readonly SkillTreeRef[]): Promise<CompletionSkillEntry[]>;
37
38
  platform(): string | undefined;
38
39
  loadOptions(model: string, agent?: CompletionContext['agent']): ModelLoadOptions;
39
40
  deviceConfig(): LlmDeviceConfig;
@@ -1,4 +1,7 @@
1
1
  import { HarnessError } from '../errors.js';
2
+ import { errorMessage } from '../guards.js';
3
+ import { raceAbort } from '../helpers/race-abort.js';
4
+ import { materializeSkillTree } from '../tools/skills/skill-tree.js';
2
5
  import { createLocalRoots } from '../tools/fs/local.js';
3
6
  import { createRemoteRoots } from '../tools/fs/remote.js';
4
7
  import { isResident, modelKey, resolveCtxSize } from '../models/model-pool.js';
@@ -23,6 +26,9 @@ export async function prepareCompletionRuntime(residency, request) {
23
26
  });
24
27
  const acquireRound = roundAcquirer(residency, { model, key, loadOpts, signal });
25
28
  const remoteRoots = driveOp && grantedDrives?.length ? createRemoteRoots(grantedDrives, driveOp) : [];
29
+ const shared = [...(request.workspaceSkills ?? []), ...(request.projectSkills ?? [])];
30
+ const skillTrees = await sharedSkillTrees(shared, request);
31
+ const trees = [...skillTrees].map(([name, { root }]) => ({ root, name }));
26
32
  return {
27
33
  key,
28
34
  args: {
@@ -34,7 +40,8 @@ export async function prepareCompletionRuntime(residency, request) {
34
40
  messages: projectionModel ? messages : messages.map(({ attachments, ...turn }) => turn),
35
41
  requestMessages: messages,
36
42
  tools: withRunTools(residency.tools(), request.tools ?? []),
37
- skillCatalog: await residency.skills(agent?.id ?? null, model),
43
+ skillCatalog: await residency.skills(agent?.id ?? null, model, trees),
44
+ skillTrees,
38
45
  platform: residency.platform(),
39
46
  fsRoots: [
40
47
  ...(grantedDirs?.length ? await createLocalRoots(grantedDirs) : []),
@@ -90,3 +97,39 @@ function withRunTools(builtIn, own) {
90
97
  const names = new Set(own.map((tool) => tool.name));
91
98
  return [...builtIn.filter((tool) => !names.has(tool.name)), ...own];
92
99
  }
100
+ async function sharedSkillTrees(skills, { approve, signal }) {
101
+ const byName = new Map();
102
+ for (const skill of [...skills].reverse()) {
103
+ byName.set(skill.name, [...(byName.get(skill.name) ?? []), skill]);
104
+ }
105
+ const layered = new Map();
106
+ for (const [name, candidates] of byName) {
107
+ for (const skill of candidates) {
108
+ const tree = await materializeSkillTree(skill).catch((err) => {
109
+ HarnessLog.warn('skill tree unavailable', { name, err: errorMessage(err) });
110
+ return null;
111
+ });
112
+ if (tree && (await approvedTree(skill, { approve, signal }))) {
113
+ layered.set(name, { root: tree.root });
114
+ break;
115
+ }
116
+ }
117
+ }
118
+ return layered;
119
+ }
120
+ async function approvedTree(skill, { approve, signal }) {
121
+ const resource = { kind: 'skill', label: `${skill.name}@${skill.hash}` };
122
+ const call = {
123
+ name: 'skill',
124
+ arguments: { name: skill.name },
125
+ resource,
126
+ effect: 'write'
127
+ };
128
+ try {
129
+ return approve ? (await raceAbort(approve(call), signal)) === true : false;
130
+ }
131
+ catch (err) {
132
+ HarnessLog.warn('skill tree not approved', { name: skill.name, err: errorMessage(err) });
133
+ return false;
134
+ }
135
+ }
@@ -1,5 +1,6 @@
1
1
  import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
2
2
  import type { CompletionSkillEntry } from '../capabilities/skill-entry.ts';
3
+ import type { SkillTreeRef } from '../tools/skills/catalog.ts';
3
4
  import type { AgentConfig, ToolDefinition } from '../contract/index.ts';
4
5
  import type { BorrowedModel } from '../contract/models.ts';
5
6
  import type { CapabilityInfo, LoadedModel, LoadModelResult, UnloadModelContext, UnloadModelResult } from '../contract-types.ts';
@@ -75,7 +76,7 @@ export interface ResidencyOptions {
75
76
  evictIdle(): Array<Promise<unknown>>;
76
77
  unloadIdlePlugins(): Promise<Array<PromiseSettledResult<unknown>>>;
77
78
  tools(): readonly ToolDefinition[];
78
- skills(agentId: string | null, model: string): Promise<CompletionSkillEntry[]>;
79
+ skills(agentId: string | null, model: string, trees?: readonly SkillTreeRef[]): Promise<CompletionSkillEntry[]>;
79
80
  platform?(): string;
80
81
  }
81
82
  export declare class Residency {
@@ -122,7 +123,7 @@ export declare class Residency {
122
123
  get pool(): PoolLike;
123
124
  get status(): ModelStatusCache;
124
125
  tools(): readonly ToolDefinition[];
125
- skills(agentId: string | null, model: string): Promise<CompletionSkillEntry[]>;
126
+ skills(agentId: string | null, model: string, trees?: readonly SkillTreeRef[]): Promise<CompletionSkillEntry[]>;
126
127
  platform(): string | undefined;
127
128
  recreate(): void;
128
129
  destroy(): Promise<void> | undefined;