@qvac/harness 1.0.0-rc.19 → 1.0.0-rc.20

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 (59) hide show
  1. package/CHANGELOG.md +106 -2
  2. package/README.md +7 -0
  3. package/dist-lib/lib/capabilities/agent-ports.js +4 -3
  4. package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +1 -0
  5. package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +3 -1
  6. package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +5 -4
  7. package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +5 -1
  8. package/dist-lib/lib/capabilities/completion-engine/driver.js +9 -2
  9. package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +3 -1
  10. package/dist-lib/lib/capabilities/sdk-tool.d.ts +2 -2
  11. package/dist-lib/lib/capabilities/sdk-tool.js +2 -2
  12. package/dist-lib/lib/capabilities/tool-turns.d.ts +1 -0
  13. package/dist-lib/lib/capabilities/tool-turns.js +2 -0
  14. package/dist-lib/lib/contract/agent.d.ts +2 -0
  15. package/dist-lib/lib/contract/media.d.ts +7 -0
  16. package/dist-lib/lib/helpers/run-outcome.d.ts +2 -0
  17. package/dist-lib/lib/helpers/run-outcome.js +6 -2
  18. package/dist-lib/lib/machine/completion/types.d.ts +1 -0
  19. package/dist-lib/lib/machine/index.d.ts +2 -0
  20. package/dist-lib/lib/machine/index.js +2 -0
  21. package/dist-lib/lib/media-wire.js +16 -1
  22. package/dist-lib/lib/models/context-choice.js +8 -1
  23. package/dist-lib/lib/models/llm-presets.js +27 -1
  24. package/dist-lib/lib/models/model-catalog-constants.d.ts +2 -2
  25. package/dist-lib/lib/models/model-catalog-constants.js +3 -4
  26. package/dist-lib/lib/models/model-catalog.d.ts +4 -2
  27. package/dist-lib/lib/models/model-catalog.js +29 -11
  28. package/dist-lib/lib/models/tts-model-default.d.ts +2 -1
  29. package/dist-lib/lib/models/tts-model-default.js +8 -6
  30. package/dist-lib/lib/plugins/registry.d.ts +1 -0
  31. package/dist-lib/lib/plugins/registry.js +7 -4
  32. package/dist-lib/lib/prompt.d.ts +5 -4
  33. package/dist-lib/lib/prompt.js +68 -22
  34. package/dist-lib/lib/residency/completion-runtime.js +6 -1
  35. package/dist-lib/lib/residency/index.js +1 -0
  36. package/dist-lib/lib/tools/files/edit-file.d.ts +4 -1
  37. package/dist-lib/lib/tools/files/edit-file.js +220 -28
  38. package/dist-lib/lib/tools/files/index.js +3 -1
  39. package/dist-lib/lib/tools/fs/edit-match.d.ts +22 -0
  40. package/dist-lib/lib/tools/fs/edit-match.js +337 -45
  41. package/dist-lib/plugins/coding-guards/index.d.ts +25 -0
  42. package/dist-lib/plugins/coding-guards/index.js +126 -0
  43. package/dist-lib/plugins/image/edit-image.d.ts +3 -22
  44. package/dist-lib/plugins/image/edit-image.js +13 -32
  45. package/dist-lib/plugins/image/fit.d.ts +31 -0
  46. package/dist-lib/plugins/image/fit.js +28 -0
  47. package/dist-lib/plugins/image/generate-image.d.ts +9 -2
  48. package/dist-lib/plugins/image/generate-image.js +23 -6
  49. package/dist-lib/plugins/image/index.js +4 -1
  50. package/dist-lib/plugins/ocr/index.d.ts +1 -1
  51. package/dist-lib/plugins/ocr/index.js +3 -1
  52. package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
  53. package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
  54. package/dist-lib/plugins/speech/speech-engine.d.ts +1 -1
  55. package/dist-lib/plugins/speech/speech-engine.js +10 -5
  56. package/dist-lib/plugins/speech/speech-text.d.ts +1 -0
  57. package/dist-lib/plugins/speech/speech-text.js +9 -4
  58. package/dist-lib/plugins/speech/voice.js +7 -2
  59. package/package.json +5 -1
@@ -8,9 +8,9 @@ export const CAPABILITY_PROFILE_ORDER = [
8
8
  export const QWEN_35_2B = 'Qwen3.5-2B-Q4_K_M';
9
9
  export const QWEN_35_4B = 'Qwen3.5-4B-Q4_K_M';
10
10
  export const QWEN_35_9B = 'Qwen3.5-9B-Q4_K_M';
11
- export const QWEN_36_27B = 'Qwen3.6-27B-UD-Q4_K_XL';
12
11
  export const QWEN_36_35B_A3B = 'Qwen3.6-35B-A3B-UD-Q4_K_M';
13
12
  export const QWEN_38_27B = 'Qwen3.8-27B-UD-Q4_K_XL';
13
+ export const KAT_CODER_25_35B = 'Kwaipilot_KAT-Coder-V2.5-Dev-Q4_K_M';
14
14
  export const BONSAI_2_27B_PQ2 = 'Ternary-Bonsai-2-27B-PQ2_0';
15
15
  export const BONSAI_2_27B_PTQ1 = 'Ternary-Bonsai-2-27B-PTQ1_0';
16
16
  export const MEDPSY_1_7B = 'medpsy-1.7b-q4_k_m-imat';
@@ -25,9 +25,9 @@ const MODEL_NAME_TO_PROFILE = new Map([
25
25
  [QWEN_35_2B, 'low'],
26
26
  [QWEN_35_4B, 'mid'],
27
27
  [QWEN_35_9B, 'high'],
28
- [QWEN_36_27B, 'xhigh'],
29
28
  [QWEN_36_35B_A3B, 'xhigh'],
30
29
  [QWEN_38_27B, 'xhigh'],
30
+ [KAT_CODER_25_35B, 'xhigh'],
31
31
  [BONSAI_2_27B_PQ2, 'high'],
32
32
  [BONSAI_2_27B_PTQ1, 'high'],
33
33
  [MEDPSY_1_7B, 'low'],
@@ -71,9 +71,9 @@ export const AGENT_MODEL_NAMES = [
71
71
  QWEN_35_2B,
72
72
  QWEN_35_4B,
73
73
  QWEN_35_9B,
74
- QWEN_36_27B,
75
74
  QWEN_36_35B_A3B,
76
75
  QWEN_38_27B,
76
+ KAT_CODER_25_35B,
77
77
  BONSAI_2_27B_PQ2,
78
78
  BONSAI_2_27B_PTQ1,
79
79
  MEDPSY_1_7B,
@@ -91,7 +91,6 @@ const MULTIMODAL_LLMS = new Set([
91
91
  QWEN_35_2B,
92
92
  QWEN_35_4B,
93
93
  QWEN_35_9B,
94
- QWEN_36_27B,
95
94
  QWEN_36_35B_A3B,
96
95
  QWEN_38_27B,
97
96
  BONSAI_2_27B_PQ2,
@@ -4,8 +4,8 @@ import type { ModelAddon } from './model-source.ts';
4
4
  export interface SdkModelAsset extends ModelRegistryEntry {
5
5
  readonly src: string;
6
6
  }
7
- import { CAPABILITY_PROFILE_ORDER, QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_27B, QWEN_36_35B_A3B, QWEN_38_27B, BONSAI_2_27B_PQ2, BONSAI_2_27B_PTQ1, MEDPSY_1_7B, MEDPSY_4B, isCapabilityProfile, meetsMinCapabilityProfile, modelNameToCapabilityProfile, capabilityProfileToModelName, isMultimodalLlm, AGENT_MODEL_NAMES, modelDisplayName, capabilityProfileModelLabel, DEFAULT_IMAGE_MODEL_CHOICE, IMAGE_CHOICE_CATALOG, isMobilePlatform, runnableModelName, type CapabilityProfile, type HostCapability, type ImageModelChoice, type ImageChoiceEntry } from './model-catalog-constants.ts';
8
- export { CAPABILITY_PROFILE_ORDER, QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_27B, QWEN_36_35B_A3B, QWEN_38_27B, BONSAI_2_27B_PQ2, BONSAI_2_27B_PTQ1, MEDPSY_1_7B, MEDPSY_4B, isCapabilityProfile, meetsMinCapabilityProfile, modelNameToCapabilityProfile, capabilityProfileToModelName, isMultimodalLlm, AGENT_MODEL_NAMES, modelDisplayName, capabilityProfileModelLabel, DEFAULT_IMAGE_MODEL_CHOICE, IMAGE_CHOICE_CATALOG, isMobilePlatform, runnableModelName };
7
+ import { CAPABILITY_PROFILE_ORDER, QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_35B_A3B, QWEN_38_27B, KAT_CODER_25_35B, BONSAI_2_27B_PQ2, BONSAI_2_27B_PTQ1, MEDPSY_1_7B, MEDPSY_4B, isCapabilityProfile, meetsMinCapabilityProfile, modelNameToCapabilityProfile, capabilityProfileToModelName, isMultimodalLlm, AGENT_MODEL_NAMES, modelDisplayName, capabilityProfileModelLabel, DEFAULT_IMAGE_MODEL_CHOICE, IMAGE_CHOICE_CATALOG, isMobilePlatform, runnableModelName, type CapabilityProfile, type HostCapability, type ImageModelChoice, type ImageChoiceEntry } from './model-catalog-constants.ts';
8
+ export { CAPABILITY_PROFILE_ORDER, QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_35B_A3B, QWEN_38_27B, KAT_CODER_25_35B, BONSAI_2_27B_PQ2, BONSAI_2_27B_PTQ1, MEDPSY_1_7B, MEDPSY_4B, isCapabilityProfile, meetsMinCapabilityProfile, modelNameToCapabilityProfile, capabilityProfileToModelName, isMultimodalLlm, AGENT_MODEL_NAMES, modelDisplayName, capabilityProfileModelLabel, DEFAULT_IMAGE_MODEL_CHOICE, IMAGE_CHOICE_CATALOG, isMobilePlatform, runnableModelName };
9
9
  export type { CapabilityProfile, HostCapability, ImageModelChoice, ImageChoiceEntry };
10
10
  export interface LlmCatalogEntry {
11
11
  readonly name: string;
@@ -25,6 +25,7 @@ export interface CategoryDefault {
25
25
  readonly modelConfig?: Readonly<Record<string, unknown>>;
26
26
  readonly companions?: ReadonlyArray<SdkModelAsset>;
27
27
  }
28
+ export declare const AUDIO8_TTS: CategoryDefault;
28
29
  export declare const MOSS_TTS: CategoryDefault;
29
30
  export declare const MOSS_CODEC_ENCODER_SRC: "registry://s3/qvac_models_compiled/ggml/openmoss/2026-09-25/moss-codec-encoder-f16.gguf";
30
31
  export declare const CATEGORY_DEFAULTS: ReadonlyArray<CategoryDefault>;
@@ -36,6 +37,7 @@ export interface CategoryDownloadMetadata {
36
37
  export declare function categoryDownloadMetadata(model: string, addon: ModelAddon | undefined): CategoryDownloadMetadata | undefined;
37
38
  export declare function defaultVoiceModel(category: ModelCategory): string;
38
39
  export declare function defaultTtsFor(profile: CapabilityProfile): CategoryDefault;
40
+ export declare function supertonicFor(profile: CapabilityProfile | null): CategoryDefault;
39
41
  export interface CatalogModel {
40
42
  readonly name: string;
41
43
  readonly addon: ModelAddon;
@@ -1,8 +1,8 @@
1
- import { AUDIOGEN_ACESTEP_5HZ_LM_0_6B_Q8_0, AUDIOGEN_ACESTEP_V15_BASE_Q4_K_M, AUDIOGEN_ACESTEP_V15_SFT_Q8_0, AUDIOGEN_ACESTEP_V15_TURBO_Q4_K_M, AUDIOGEN_ACESTEP_V15_TURBO_Q8_0, AUDIOGEN_QWEN3_EMBEDDING_0_6B_Q8_0, AUDIOGEN_VAE_BF16, EMBEDDINGGEMMA_300M_Q4_0, FLUX_2_KLEIN_4B_Q4_0, FLUX_2_KLEIN_4B_VAE, HEALTHCARE_1_7B_MEDICAL_Q4_K_M, HEALTHCARE_4B_MEDICAL_Q4_K_M, MMPROJ_QWEN3_5_2B_MULTIMODAL_Q8_0, MMPROJ_QWEN3_5_4B_MULTIMODAL_Q8_0, MMPROJ_QWEN3_5_9B_MULTIMODAL_F16, MMPROJ_QWEN3_6_27B_MULTIMODAL_F16, MMPROJ_QWEN3_6_35B_A3B_MULTIMODAL_F16, MMPROJ_QWEN3_8_27B_MULTIMODAL_F16, MMPROJ_TERNARY_BONSAI_2_27B_MULTIMODAL_Q8_0, QWEN3_5_2B_MULTIMODAL_Q4_K_M, QWEN3_5_4B_MULTIMODAL_Q4_K_M, QWEN3_5_9B_MULTIMODAL_Q4_K_M, PARAKEET_TDT_0_6B_V3_Q8_0, PARAKEET_TDT_1_1B_Q8_0, QWEN3_4B_Q4_K_M, QWEN3_6_27B_MULTIMODAL_Q4_K_XL, QWEN3_6_35B_A3B_MULTIMODAL_Q4_K_M, QWEN3_8_27B_MULTIMODAL_UD_Q4_K_XL, SD_V2_1_1B_Q8_0, SDXL_BASE_1_0_3B_Q4_0, TERNARY_BONSAI_2_27B_MULTIMODAL_PQ2_0, TERNARY_BONSAI_2_27B_MULTIMODAL_PTQ1_0, TTS_CODEC_DECODER_MOSS_TTS_F16, TTS_CODEC_ENCODER_MOSS_TTS_F16, TTS_DELAY_LLM_MOSS_TTS_F16, TTS_MULTILINGUAL_SUPERTONIC3_FP16, TTS_MULTILINGUAL_SUPERTONIC3_Q4_0, TTS_MULTILINGUAL_SUPERTONIC3_Q8_0 } from '@qvac/inference/models';
1
+ import { AUDIOGEN_ACESTEP_5HZ_LM_0_6B_Q8_0, AUDIOGEN_ACESTEP_V15_BASE_Q4_K_M, AUDIOGEN_ACESTEP_V15_SFT_Q8_0, AUDIOGEN_ACESTEP_V15_TURBO_Q4_K_M, AUDIOGEN_ACESTEP_V15_TURBO_Q8_0, AUDIOGEN_QWEN3_EMBEDDING_0_6B_Q8_0, AUDIOGEN_VAE_BF16, EMBEDDINGGEMMA_300M_Q4_0, FLUX_2_KLEIN_4B_Q4_0, FLUX_2_KLEIN_4B_VAE, HEALTHCARE_1_7B_MEDICAL_Q4_K_M, HEALTHCARE_4B_MEDICAL_Q4_K_M, MOE_35B_INST_Q4_K_M, MMPROJ_QWEN3_5_2B_MULTIMODAL_Q8_0, MMPROJ_QWEN3_5_4B_MULTIMODAL_Q8_0, MMPROJ_QWEN3_5_9B_MULTIMODAL_F16, MMPROJ_QWEN3_6_35B_A3B_MULTIMODAL_F16, MMPROJ_QWEN3_8_27B_MULTIMODAL_F16, MMPROJ_TERNARY_BONSAI_2_27B_MULTIMODAL_Q8_0, QWEN3_5_2B_MULTIMODAL_Q4_K_M, QWEN3_5_4B_MULTIMODAL_Q4_K_M, QWEN3_5_9B_MULTIMODAL_Q4_K_M, PARAKEET_TDT_0_6B_V3_Q8_0, PARAKEET_TDT_1_1B_Q8_0, QWEN3_4B_Q4_K_M, QWEN3_6_35B_A3B_MULTIMODAL_Q4_K_M, QWEN3_8_27B_MULTIMODAL_UD_Q4_K_XL, SD_V2_1_1B_Q8_0, SDXL_BASE_1_0_3B_Q4_0, TERNARY_BONSAI_2_27B_MULTIMODAL_PQ2_0, TERNARY_BONSAI_2_27B_MULTIMODAL_PTQ1_0, TTS_CODEC_DECODER_AUDIO8_Q8_0, TTS_CODEC_DECODER_MOSS_TTS_F16, TTS_CODEC_ENCODER_MOSS_TTS_F16, TTS_DELAY_LLM_MOSS_TTS_F16, TTS_LM_MULTILINGUAL_AUDIO8_Q8_0, TTS_MULTILINGUAL_SUPERTONIC3_FP16, TTS_MULTILINGUAL_SUPERTONIC3_Q4_0, TTS_MULTILINGUAL_SUPERTONIC3_Q8_0 } from '@qvac/inference/models';
2
2
  import { detectToolDialect } from './tool-dialect.js';
3
- import { defaultTtsModelName } from './tts-model-default.js';
4
- import { CAPABILITY_PROFILE_ORDER, QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_27B, QWEN_36_35B_A3B, QWEN_38_27B, BONSAI_2_27B_PQ2, BONSAI_2_27B_PTQ1, MEDPSY_1_7B, MEDPSY_4B, isCapabilityProfile, meetsMinCapabilityProfile, modelNameToCapabilityProfile, capabilityProfileToModelName, isMultimodalLlm, AGENT_MODEL_NAMES, modelDisplayName, capabilityProfileModelLabel, DEFAULT_IMAGE_MODEL_CHOICE, IMAGE_CHOICE_CATALOG, isMobilePlatform, runnableModelName } from './model-catalog-constants.js';
5
- export { CAPABILITY_PROFILE_ORDER, QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_27B, QWEN_36_35B_A3B, QWEN_38_27B, BONSAI_2_27B_PQ2, BONSAI_2_27B_PTQ1, MEDPSY_1_7B, MEDPSY_4B, isCapabilityProfile, meetsMinCapabilityProfile, modelNameToCapabilityProfile, capabilityProfileToModelName, isMultimodalLlm, AGENT_MODEL_NAMES, modelDisplayName, capabilityProfileModelLabel, DEFAULT_IMAGE_MODEL_CHOICE, IMAGE_CHOICE_CATALOG, isMobilePlatform, runnableModelName };
3
+ import { defaultTtsModelName, supertonicModelName } from './tts-model-default.js';
4
+ import { CAPABILITY_PROFILE_ORDER, QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_35B_A3B, QWEN_38_27B, KAT_CODER_25_35B, BONSAI_2_27B_PQ2, BONSAI_2_27B_PTQ1, MEDPSY_1_7B, MEDPSY_4B, isCapabilityProfile, meetsMinCapabilityProfile, modelNameToCapabilityProfile, capabilityProfileToModelName, isMultimodalLlm, AGENT_MODEL_NAMES, modelDisplayName, capabilityProfileModelLabel, DEFAULT_IMAGE_MODEL_CHOICE, IMAGE_CHOICE_CATALOG, isMobilePlatform, runnableModelName } from './model-catalog-constants.js';
5
+ export { CAPABILITY_PROFILE_ORDER, QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_35B_A3B, QWEN_38_27B, KAT_CODER_25_35B, BONSAI_2_27B_PQ2, BONSAI_2_27B_PTQ1, MEDPSY_1_7B, MEDPSY_4B, isCapabilityProfile, meetsMinCapabilityProfile, modelNameToCapabilityProfile, capabilityProfileToModelName, isMultimodalLlm, AGENT_MODEL_NAMES, modelDisplayName, capabilityProfileModelLabel, DEFAULT_IMAGE_MODEL_CHOICE, IMAGE_CHOICE_CATALOG, isMobilePlatform, runnableModelName };
6
6
  export const LLM_CATALOG = [
7
7
  {
8
8
  name: QWEN_35_2B,
@@ -22,12 +22,6 @@ export const LLM_CATALOG = [
22
22
  capabilityProfile: 'high',
23
23
  projection: MMPROJ_QWEN3_5_9B_MULTIMODAL_F16
24
24
  },
25
- {
26
- name: QWEN_36_27B,
27
- weight: QWEN3_6_27B_MULTIMODAL_Q4_K_XL,
28
- capabilityProfile: 'xhigh',
29
- projection: MMPROJ_QWEN3_6_27B_MULTIMODAL_F16
30
- },
31
25
  {
32
26
  name: QWEN_36_35B_A3B,
33
27
  weight: QWEN3_6_35B_A3B_MULTIMODAL_Q4_K_M,
@@ -52,6 +46,13 @@ export const LLM_CATALOG = [
52
46
  capabilityProfile: 'xhigh',
53
47
  projection: MMPROJ_QWEN3_8_27B_MULTIMODAL_F16
54
48
  },
49
+ {
50
+ name: KAT_CODER_25_35B,
51
+ weight: MOE_35B_INST_Q4_K_M,
52
+ capabilityProfile: 'xhigh',
53
+ textOnly: true,
54
+ toolDialect: 'qwen35'
55
+ },
55
56
  {
56
57
  name: BONSAI_2_27B_PQ2,
57
58
  weight: TERNARY_BONSAI_2_27B_MULTIMODAL_PQ2_0,
@@ -77,6 +78,17 @@ export function defaultProjectionMap() {
77
78
  return map;
78
79
  }
79
80
  const TTS_FULL_STEPS = { ttsNumInferenceSteps: 16 };
81
+ export const AUDIO8_TTS = {
82
+ name: 'Audio8-Q8_0',
83
+ category: 'tts',
84
+ asset: TTS_LM_MULTILINGUAL_AUDIO8_Q8_0,
85
+ companions: [TTS_CODEC_DECODER_AUDIO8_Q8_0],
86
+ modelConfig: {
87
+ ttsEngine: 'audio8',
88
+ audio8CodecDecoderModelSrc: TTS_CODEC_DECODER_AUDIO8_Q8_0.src,
89
+ useGPU: true
90
+ }
91
+ };
80
92
  export const MOSS_TTS = {
81
93
  name: 'MOSS-TTS-8B-F16',
82
94
  category: 'tts',
@@ -92,6 +104,7 @@ export const MOSS_TTS = {
92
104
  };
93
105
  export const MOSS_CODEC_ENCODER_SRC = TTS_CODEC_ENCODER_MOSS_TTS_F16.src;
94
106
  export const CATEGORY_DEFAULTS = [
107
+ AUDIO8_TTS,
95
108
  { name: 'Supertonic3-Q4_0', category: 'tts', asset: TTS_MULTILINGUAL_SUPERTONIC3_Q4_0 },
96
109
  {
97
110
  name: 'Supertonic3-Q8_0',
@@ -141,7 +154,12 @@ export function defaultVoiceModel(category) {
141
154
  return entry.asset.src;
142
155
  }
143
156
  export function defaultTtsFor(profile) {
144
- const name = defaultTtsModelName(profile);
157
+ return ttsNamed(defaultTtsModelName(profile));
158
+ }
159
+ export function supertonicFor(profile) {
160
+ return ttsNamed(supertonicModelName(profile ?? 'low'));
161
+ }
162
+ function ttsNamed(name) {
145
163
  const entry = CATEGORY_DEFAULTS.find((candidate) => candidate.name === name);
146
164
  if (!entry) {
147
165
  throw new Error(`no default tts model named ${name}`);
@@ -1,3 +1,4 @@
1
1
  export type TtsCapabilityProfile = 'tiny' | 'low' | 'mid' | 'high' | 'xhigh';
2
2
  export declare const TTS_MODEL_NAMES: ReadonlyArray<string>;
3
- export declare function defaultTtsModelName(profile: TtsCapabilityProfile): string;
3
+ export declare function defaultTtsModelName(_profile: TtsCapabilityProfile): string;
4
+ export declare function supertonicModelName(profile: TtsCapabilityProfile): string;
@@ -1,13 +1,15 @@
1
- const TTS_MODEL_BY_PROFILE = {
1
+ const AUDIO8_MODEL_NAME = 'Audio8-Q8_0';
2
+ const SUPERTONIC_MODEL_BY_PROFILE = {
2
3
  tiny: 'Supertonic3-Q4_0',
3
4
  low: 'Supertonic3-Q4_0',
4
5
  mid: 'Supertonic3-FP16',
5
6
  high: 'Supertonic3-FP16',
6
7
  xhigh: 'Supertonic3-FP16'
7
8
  };
8
- export const TTS_MODEL_NAMES = [
9
- ...new Set(Object.values(TTS_MODEL_BY_PROFILE))
10
- ];
11
- export function defaultTtsModelName(profile) {
12
- return TTS_MODEL_BY_PROFILE[profile];
9
+ export const TTS_MODEL_NAMES = [AUDIO8_MODEL_NAME];
10
+ export function defaultTtsModelName(_profile) {
11
+ return AUDIO8_MODEL_NAME;
12
+ }
13
+ export function supertonicModelName(profile) {
14
+ return SUPERTONIC_MODEL_BY_PROFILE[profile];
13
15
  }
@@ -99,6 +99,7 @@ export declare class PluginRegistry {
99
99
  private _fetch;
100
100
  private _publish;
101
101
  private _revision;
102
+ private _served;
102
103
  private _holds;
103
104
  private _drained;
104
105
  private _swapping;
@@ -259,6 +259,7 @@ export class PluginRegistry {
259
259
  _fetch = undefined;
260
260
  _publish = undefined;
261
261
  _revision = 0;
262
+ _served = false;
262
263
  _holds = 0;
263
264
  _drained = null;
264
265
  _swapping = null;
@@ -314,8 +315,9 @@ export class PluginRegistry {
314
315
  add(plugin) {
315
316
  return this._swap(() => {
316
317
  this._check(plugin);
318
+ const revision = this._served ? ++this._revision : 0;
317
319
  return async () => {
318
- await this._setUp(plugin, (loaded) => this._loaded.push(loaded));
320
+ await this._setUp(plugin, revision, (loaded) => this._loaded.push(loaded));
319
321
  };
320
322
  });
321
323
  }
@@ -336,11 +338,12 @@ export class PluginRegistry {
336
338
  this._check(plugin, name);
337
339
  return async () => {
338
340
  const index = await this._drop(name);
339
- await this._setUp(plugin, (loaded) => this._loaded.splice(index, 0, loaded));
341
+ await this._setUp(plugin, ++this._revision, (loaded) => this._loaded.splice(index, 0, loaded));
340
342
  };
341
343
  });
342
344
  }
343
345
  async hold(join = false) {
346
+ this._served = true;
344
347
  while (this._swapping && !(join && this._holds > 0)) {
345
348
  await this._swapping;
346
349
  }
@@ -461,10 +464,10 @@ export class PluginRegistry {
461
464
  }
462
465
  });
463
466
  }
464
- async _setUp(plugin, place) {
467
+ async _setUp(plugin, revision, place) {
465
468
  const setups = this._held.length;
466
469
  try {
467
- await this._runtime.add(this._plugin(plugin, ++this._revision, place));
470
+ await this._runtime.add(this._plugin(plugin, revision, place));
468
471
  }
469
472
  catch (error) {
470
473
  const acquired = this._held.slice(setups);
@@ -1,4 +1,4 @@
1
- import type { Message, SystemPromptParts } from './contract/index.ts';
1
+ import type { GuidelineWording, Message, SystemPromptParts } from './contract/index.ts';
2
2
  export declare const RAG_CITATION_LINE = "After your answer, add one final line naming the files you used, written exactly as [Sources: file-a.pdf, file-b.md] - or [Sources: none] if the excerpts did not answer the question. This line is required, it is the only place square brackets belong, and it is removed before the user sees it.";
3
3
  export declare function currentTimeAnnotation(now?: Date): string;
4
4
  export declare function lastUserContent(messages: Message[]): string;
@@ -7,18 +7,19 @@ export declare function annotateUserTimes<T extends {
7
7
  content: string;
8
8
  sentAt?: number | undefined;
9
9
  }>(turns: ReadonlyArray<T>, now?: Date): T[];
10
- export declare function toolGuidelines(name: string): string[];
10
+ export declare function toolGuidelines(name: string, wording?: GuidelineWording): string[];
11
11
  export interface SystemPromptInput {
12
12
  bio?: string | null | undefined;
13
13
  toolNames?: ReadonlyArray<string>;
14
14
  skillsSection?: string | null;
15
15
  platform?: string | null | undefined;
16
+ guidelines?: GuidelineWording | undefined;
16
17
  }
17
- export declare function systemPromptParts({ bio, toolNames, skillsSection, platform }: SystemPromptInput): SystemPromptParts;
18
+ export declare function systemPromptParts({ bio, toolNames, skillsSection, platform, guidelines }: SystemPromptInput): SystemPromptParts;
18
19
  export declare function buildSystemPrompt(input: SystemPromptInput): string;
19
20
  export interface PromptSkill {
20
21
  readonly name: string;
21
22
  readonly description: string;
22
23
  readonly note?: string | undefined;
23
24
  }
24
- export declare function skillsPromptSection(skills: ReadonlyArray<PromptSkill>): string | null;
25
+ export declare function skillsPromptSection(skills: ReadonlyArray<PromptSkill>, wording?: GuidelineWording): string | null;
@@ -1,22 +1,56 @@
1
1
  const BASE_GUIDELINES = [
2
- 'When the request is ambiguous, ask for clarification rather than guessing.'
2
+ [
3
+ 'ask-when-ambiguous',
4
+ 'When the request is ambiguous, ask for clarification rather than guessing.'
5
+ ]
3
6
  ];
4
7
  const TOOL_GUIDELINES = [
5
- 'Request one action at a time; inspect the result before deciding the next step.',
6
- 'If a tool fails, analyze the error and try a corrective action before asking the user for help.',
7
- 'If a tool reports missing auth, setup, or approval, take the next tool step to complete it. Do not ask the user in chat whether to request approval; the policy/UI layer handles that.',
8
- 'If the user asks you to use a tool, emit a tool call. Never claim external information was fetched or a side effect completed unless a tool result from this turn proves it.',
9
- 'After tool execution, summarize the result for the user in plain language.',
10
- 'Every gated tool takes an `intent`: one short sentence, addressed to the user, saying plainly what that call does for them — the outcome in their words, never the code. It is the only thing the approval prompt shows them, so never leave it out and never paste the command into it.'
8
+ [
9
+ 'one-action-at-a-time',
10
+ 'Request one action at a time; inspect the result before deciding the next step.'
11
+ ],
12
+ [
13
+ 'recover-from-failure',
14
+ 'If a tool fails, analyze the error and try a corrective action before asking the user for help.'
15
+ ],
16
+ [
17
+ 'finish-setup',
18
+ 'If a tool reports missing auth, setup, or approval, take the next tool step to complete it. Do not ask the user in chat whether to request approval; the policy/UI layer handles that.'
19
+ ],
20
+ [
21
+ 'prove-side-effects',
22
+ 'If the user asks you to use a tool, emit a tool call. Never claim external information was fetched or a side effect completed unless a tool result from this turn proves it.'
23
+ ],
24
+ [
25
+ 'summarize-results',
26
+ 'After tool execution, summarize the result for the user in plain language.'
27
+ ],
28
+ [
29
+ 'intent',
30
+ 'Every gated tool takes an `intent`: one short sentence, addressed to the user, saying plainly what that call does for them — the outcome in their words, never the code. It is the only thing the approval prompt shows them, so never leave it out and never paste the command into it.'
31
+ ]
11
32
  ];
12
33
  const EXEC_FILE_GUIDELINE = 'You CAN create and deliver files: run code with `exec` and declare the file names in `outputs` — each produced file is attached to the chat for the user to open or save. Never claim you cannot produce a file, and never instruct the user to run code or use another app to make one.';
13
34
  const EXEC_ATTACHED_IMAGE_GUIDELINE = 'An image the user attached is a file you can use, not just something to look at: when they want it inside a file you build, stage that attachment as an `exec` input and embed it. Never generate a replacement for an image the user attached, and if you truly cannot use it, say so rather than delivering the file without it.';
14
35
  const SKILL_GUIDELINES = [
15
- 'Tools are typed callable functions; skills are markdown guidance for when and how to use them.',
16
- 'Before your first action on a request, check the skills list. If a skill covers the capability you are about to use, call the `skill` tool to load its full instructions FIRST — before any other tool call, and before asking the user a follow-up; the instructions usually answer it.',
17
- 'Never use a capability whose skill you have not loaded this conversation, and never claim a capability is unavailable without checking the skills list.',
18
- 'Loaded instructions may point to more files in the skill (e.g. references/edit.md). Call the `skill` tool again with `name` and `file` to load one BEFORE doing the work it covers — never guess what a referenced file contains.'
36
+ [
37
+ 'skills-are-guidance',
38
+ 'Tools are typed callable functions; skills are markdown guidance for when and how to use them.'
39
+ ],
40
+ [
41
+ 'skill-first',
42
+ 'Before your first action on a request, check the skills list. If a skill covers the capability you are about to use, call the `skill` tool to load its full instructions FIRST — before any other tool call, and before asking the user a follow-up; the instructions usually answer it.'
43
+ ],
44
+ [
45
+ 'skill-before-capability',
46
+ 'Never use a capability whose skill you have not loaded this conversation, and never claim a capability is unavailable without checking the skills list.'
47
+ ],
48
+ [
49
+ 'skill-files',
50
+ 'Loaded instructions may point to more files in the skill (e.g. references/edit.md). Call the `skill` tool again with `name` and `file` to load one BEFORE doing the work it covers — never guess what a referenced file contains.'
51
+ ]
19
52
  ];
53
+ const SKILLS_LIST_HEADER = 'Skills available this turn. You MUST call the `skill` tool with its name BEFORE using the capability it describes — load the skill first, then act.';
20
54
  const CITATION_GUIDELINE = 'Search results arrive prefixed with source labels (`[1]`, `[Source 2: file, ...]`, `Source: <url>`). Do NOT echo those labels or refer to sources by number — they are shown to the user separately. Name a source (its file name or site) in natural prose when you rely on it. If the user explicitly asks for numbered references, produce them normally.';
21
55
  export const RAG_CITATION_LINE = 'After your answer, add one final line naming the files you used, written exactly as [Sources: file-a.pdf, file-b.md] - or [Sources: none] if the excerpts did not answer the question. This line is required, it is the only place square brackets belong, and it is removed before the user sees it.';
22
56
  const METADATA_SECTION = `## Message Metadata
@@ -51,27 +85,38 @@ export function annotateUserTimes(turns, now = new Date()) {
51
85
  return { ...turn, content: `${currentTimeAnnotation(at)}\n\n${turn.content}` };
52
86
  });
53
87
  }
54
- export function toolGuidelines(name) {
88
+ function toolGuidelineEntries(name) {
55
89
  if (name === 'exec') {
56
- return [EXEC_FILE_GUIDELINE, EXEC_ATTACHED_IMAGE_GUIDELINE];
90
+ return [
91
+ ['exec-files', EXEC_FILE_GUIDELINE],
92
+ ['exec-attached-images', EXEC_ATTACHED_IMAGE_GUIDELINE]
93
+ ];
57
94
  }
58
- return name === 'web_search' || name === 'web_fetch' ? [CITATION_GUIDELINE] : [];
95
+ return name === 'web_search' || name === 'web_fetch' ? [['citations', CITATION_GUIDELINE]] : [];
59
96
  }
60
- function buildGuidelines(active) {
97
+ export function toolGuidelines(name, wording = {}) {
98
+ return toolGuidelineEntries(name)
99
+ .map(([id, text]) => wording[id] ?? text)
100
+ .filter((line) => line !== false);
101
+ }
102
+ function buildGuidelines(active, wording = {}) {
61
103
  const lines = [...BASE_GUIDELINES];
62
104
  if (active.size > 0) {
63
105
  lines.push(...TOOL_GUIDELINES);
64
106
  }
65
107
  if (active.has('exec')) {
66
- lines.push(...toolGuidelines('exec'));
108
+ lines.push(...toolGuidelineEntries('exec'));
67
109
  }
68
110
  if (active.has('skill')) {
69
111
  lines.push(...SKILL_GUIDELINES);
70
112
  }
71
113
  if (active.has('web_search') || active.has('web_fetch')) {
72
- lines.push(CITATION_GUIDELINE);
114
+ lines.push(...toolGuidelineEntries('web_search'));
73
115
  }
74
- return `**Guidelines:**\n${lines.map((line) => `- ${line}`).join('\n')}`;
116
+ const worded = lines
117
+ .map(([id, text]) => wording[id] ?? text)
118
+ .filter((line) => line !== false);
119
+ return worded.length ? `**Guidelines:**\n${worded.map((line) => `- ${line}`).join('\n')}` : '';
75
120
  }
76
121
  const PLATFORM_LABELS = {
77
122
  darwin: 'macOS',
@@ -80,7 +125,7 @@ const PLATFORM_LABELS = {
80
125
  ios: 'iOS',
81
126
  android: 'Android'
82
127
  };
83
- export function systemPromptParts({ bio, toolNames = [], skillsSection, platform }) {
128
+ export function systemPromptParts({ bio, toolNames = [], skillsSection, platform, guidelines }) {
84
129
  const active = new Set(toolNames);
85
130
  const header = active.size
86
131
  ? 'You are a helpful AI assistant with access to tools.'
@@ -89,7 +134,7 @@ export function systemPromptParts({ bio, toolNames = [], skillsSection, platform
89
134
  const label = platform ? PLATFORM_LABELS[platform] : undefined;
90
135
  const host = label ? `You run on ${label}.` : null;
91
136
  const skills = active.has('skill') ? skillsSection : null;
92
- const text = [preamble, host, bio, skills, buildGuidelines(active)]
137
+ const text = [preamble, host, bio, skills, buildGuidelines(active, guidelines)]
93
138
  .filter((part) => Boolean(part))
94
139
  .join('\n\n');
95
140
  return { text, bioChars: (bio ?? '').length, skillsChars: (skills ?? '').length };
@@ -97,11 +142,12 @@ export function systemPromptParts({ bio, toolNames = [], skillsSection, platform
97
142
  export function buildSystemPrompt(input) {
98
143
  return systemPromptParts(input).text;
99
144
  }
100
- export function skillsPromptSection(skills) {
145
+ export function skillsPromptSection(skills, wording = {}) {
101
146
  if (!skills.length)
102
147
  return null;
103
148
  const lines = skills
104
149
  .map((skill) => `- ${skill.name}: ${skill.description}${skill.note ? ` [${skill.note}]` : ''}`)
105
150
  .join('\n');
106
- return `Skills available this turn. You MUST call the \`skill\` tool with its name BEFORE using the capability it describes — load the skill first, then act.\n${lines}`;
151
+ const header = wording['skills-list'] ?? SKILLS_LIST_HEADER;
152
+ return header === false ? lines : `${header}\n${lines}`;
107
153
  }
@@ -15,7 +15,12 @@ export async function prepareCompletionRuntime(residency, request) {
15
15
  }
16
16
  const key = modelKey(model, loadOpts);
17
17
  const resident = isResident(residency.pool, key);
18
- HarnessLog.info('completion start', { model, resident, projection: Boolean(projectionModel) });
18
+ HarnessLog.info('completion start', {
19
+ model,
20
+ resident,
21
+ projection: Boolean(projectionModel),
22
+ ctxSize: loadOpts.ctxSize ?? null
23
+ });
19
24
  const acquireRound = roundAcquirer(residency, { model, key, loadOpts, signal });
20
25
  const remoteRoots = driveOp && grantedDrives?.length ? createRemoteRoots(grantedDrives, driveOp) : [];
21
26
  return {
@@ -608,6 +608,7 @@ export class Residency {
608
608
  }
609
609
  async _chooseContext(load, tier) {
610
610
  if (this._borrowed.has(load.model)) {
611
+ HarnessLog.info('context climb', { tier, stop: 'borrowed' });
611
612
  return tier;
612
613
  }
613
614
  const parallel = load.modelConfig?.['parallel'];
@@ -1,3 +1,6 @@
1
1
  import type { ToolDefinition } from '../../contract/index.ts';
2
2
  import { type FsToolOptions } from '../fs/scope.ts';
3
- export declare function createEditFileTool({ realpath, deniedRoots }?: FsToolOptions): ToolDefinition;
3
+ export declare const EMPTY_OLD_GUIDANCE = "To add lines use insert_text; to change text put the exact current text in `old`.";
4
+ export declare function createEditFileTool(options?: FsToolOptions): ToolDefinition;
5
+ export declare function createInsertTextTool(options?: FsToolOptions): ToolDefinition;
6
+ export declare function createEditManyTool(options?: FsToolOptions): ToolDefinition;