@rarebit-one/harness-kernel 0.9.0 → 0.11.0-next.0

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 (98) hide show
  1. package/README.md +174 -6
  2. package/dist/agent.d.ts +80 -8
  3. package/dist/agent.d.ts.map +1 -1
  4. package/dist/agent.js +225 -25
  5. package/dist/agent.js.map +1 -1
  6. package/dist/engines/acp.d.ts +10 -0
  7. package/dist/engines/acp.d.ts.map +1 -1
  8. package/dist/engines/acp.js +8 -1
  9. package/dist/engines/acp.js.map +1 -1
  10. package/dist/engines/acpDriver.d.ts +2 -0
  11. package/dist/engines/acpDriver.d.ts.map +1 -1
  12. package/dist/engines/acpDriver.js +6 -1
  13. package/dist/engines/acpDriver.js.map +1 -1
  14. package/dist/engines/claudeCode.d.ts +6 -4
  15. package/dist/engines/claudeCode.d.ts.map +1 -1
  16. package/dist/engines/claudeCode.js +8 -5
  17. package/dist/engines/claudeCode.js.map +1 -1
  18. package/dist/engines/claudeCodeDriver.d.ts +8 -0
  19. package/dist/engines/claudeCodeDriver.d.ts.map +1 -1
  20. package/dist/engines/claudeCodeDriver.js +14 -1
  21. package/dist/engines/claudeCodeDriver.js.map +1 -1
  22. package/dist/engines/codex.d.ts.map +1 -1
  23. package/dist/engines/codex.js +2 -1
  24. package/dist/engines/codex.js.map +1 -1
  25. package/dist/engines/codexDriver.d.ts +2 -0
  26. package/dist/engines/codexDriver.d.ts.map +1 -1
  27. package/dist/engines/codexDriver.js +15 -9
  28. package/dist/engines/codexDriver.js.map +1 -1
  29. package/dist/engines/isolation.d.ts +45 -0
  30. package/dist/engines/isolation.d.ts.map +1 -0
  31. package/dist/engines/isolation.js +119 -0
  32. package/dist/engines/isolation.js.map +1 -0
  33. package/dist/engines/native.d.ts +5 -0
  34. package/dist/engines/native.d.ts.map +1 -1
  35. package/dist/engines/native.js +28 -10
  36. package/dist/engines/native.js.map +1 -1
  37. package/dist/engines/types.d.ts +28 -0
  38. package/dist/engines/types.d.ts.map +1 -1
  39. package/dist/events.d.ts +20 -0
  40. package/dist/events.d.ts.map +1 -1
  41. package/dist/events.js.map +1 -1
  42. package/dist/index.d.ts +17 -11
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +7 -4
  45. package/dist/index.js.map +1 -1
  46. package/dist/loop.d.ts +58 -11
  47. package/dist/loop.d.ts.map +1 -1
  48. package/dist/loop.js +7 -5
  49. package/dist/loop.js.map +1 -1
  50. package/dist/models/chat.d.ts +2 -1
  51. package/dist/models/chat.d.ts.map +1 -1
  52. package/dist/models/chat.js +20 -4
  53. package/dist/models/chat.js.map +1 -1
  54. package/dist/models/types.d.ts +16 -0
  55. package/dist/models/types.d.ts.map +1 -1
  56. package/dist/models/types.js.map +1 -1
  57. package/dist/private.d.ts.map +1 -1
  58. package/dist/private.js +21 -0
  59. package/dist/private.js.map +1 -1
  60. package/dist/providers/anthropic.d.ts +27 -3
  61. package/dist/providers/anthropic.d.ts.map +1 -1
  62. package/dist/providers/anthropic.js +95 -29
  63. package/dist/providers/anthropic.js.map +1 -1
  64. package/dist/providers/index.d.ts +42 -6
  65. package/dist/providers/index.d.ts.map +1 -1
  66. package/dist/providers/index.js +132 -48
  67. package/dist/providers/index.js.map +1 -1
  68. package/dist/providers/mock.d.ts +6 -3
  69. package/dist/providers/mock.d.ts.map +1 -1
  70. package/dist/providers/mock.js +8 -3
  71. package/dist/providers/mock.js.map +1 -1
  72. package/dist/providers/openai.d.ts +51 -7
  73. package/dist/providers/openai.d.ts.map +1 -1
  74. package/dist/providers/openai.js +128 -30
  75. package/dist/providers/openai.js.map +1 -1
  76. package/dist/providers/options.d.ts +162 -0
  77. package/dist/providers/options.d.ts.map +1 -0
  78. package/dist/providers/options.js +67 -0
  79. package/dist/providers/options.js.map +1 -0
  80. package/dist/providers/scripted.d.ts +49 -0
  81. package/dist/providers/scripted.d.ts.map +1 -0
  82. package/dist/providers/scripted.js +90 -0
  83. package/dist/providers/scripted.js.map +1 -0
  84. package/dist/providers/types.d.ts +34 -0
  85. package/dist/providers/types.d.ts.map +1 -1
  86. package/dist/tools/metadata.d.ts +24 -0
  87. package/dist/tools/metadata.d.ts.map +1 -1
  88. package/dist/tools/metadata.js +8 -0
  89. package/dist/tools/metadata.js.map +1 -1
  90. package/dist/tools/registry.d.ts +10 -3
  91. package/dist/tools/registry.d.ts.map +1 -1
  92. package/dist/tools/registry.js +9 -4
  93. package/dist/tools/registry.js.map +1 -1
  94. package/dist/tools/terminal.d.ts +33 -0
  95. package/dist/tools/terminal.d.ts.map +1 -0
  96. package/dist/tools/terminal.js +32 -0
  97. package/dist/tools/terminal.js.map +1 -0
  98. package/package.json +5 -4
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Per-call provider options: the typed passthrough from a caller to the adapter
3
+ * that makes the HTTP request.
4
+ *
5
+ * Two kinds of thing live here, and the split is deliberate:
6
+ *
7
+ * - **Neutral options** (`maxTokens`, `promptCache`, `responseFormat`) name an
8
+ * intent, and each adapter maps it onto its own wire format as well as it
9
+ * can. Prompt caching is the clearest case: Anthropic wants explicit
10
+ * `cache_control` breakpoints, OpenRouter wants them inside content parts,
11
+ * OpenAI caches prefixes automatically and only takes a routing key.
12
+ * - **Adapter-addressed options** (`openrouter`) carry one API's own
13
+ * vocabulary verbatim, snake_case and all, because translating them would
14
+ * only add a place for the two to drift.
15
+ *
16
+ * Either way, an option an adapter cannot honour is an error, never a silent
17
+ * drop: a caller that asked for zero-data-retention routing and got a request
18
+ * that said nothing about it would have no way to notice.
19
+ */
20
+ /** Anthropic's breakpoint ceiling is four; two go to system and tools. */
21
+ export const MAX_TRAILING_CACHE_MESSAGES = 2;
22
+ /** Apply the defaults and the clamp. */
23
+ export function resolvePromptCache(options) {
24
+ const requested = options.trailingMessages ?? 1;
25
+ const trailingMessages = Math.max(0, Math.min(MAX_TRAILING_CACHE_MESSAGES, Number.isFinite(requested) ? Math.floor(requested) : 1));
26
+ return {
27
+ system: options.system ?? true,
28
+ tools: options.tools ?? true,
29
+ trailingMessages,
30
+ ...(options.ttl !== undefined ? { ttl: options.ttl } : {}),
31
+ ...(options.key !== undefined ? { key: options.key } : {}),
32
+ };
33
+ }
34
+ /**
35
+ * Thrown when an option is addressed to an adapter that cannot honour it. The
36
+ * kernel never drops an option on the floor: silence here is how a request
37
+ * meant for a zero-data-retention route ends up somewhere else.
38
+ */
39
+ export class ProviderOptionsError extends Error {
40
+ adapter;
41
+ option;
42
+ constructor(adapter, option, detail) {
43
+ super(`provider "${adapter}" does not support providerOptions.${option}${detail ? ` (${detail})` : ""}`);
44
+ this.name = "ProviderOptionsError";
45
+ this.adapter = adapter;
46
+ this.option = option;
47
+ }
48
+ }
49
+ /** Throw if `options` carries `option`, for an adapter that cannot honour it. */
50
+ export function rejectOption(adapter, options, option, detail) {
51
+ if (options?.[option] !== undefined)
52
+ throw new ProviderOptionsError(adapter, option, detail);
53
+ }
54
+ /** The per-call retry count when given and non-negative, else undefined (the client's default). */
55
+ export function resolveMaxRetries(options) {
56
+ const n = options?.maxRetries;
57
+ return typeof n === "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : undefined;
58
+ }
59
+ /**
60
+ * The per-call completion cap: the option when given and positive, else the
61
+ * caller's fallback (normally the env-resolved `RUNNER_MAX_TOKENS`).
62
+ */
63
+ export function resolveMaxTokens(options, fallback) {
64
+ const n = options?.maxTokens;
65
+ return typeof n === "number" && Number.isFinite(n) && n > 0 ? Math.floor(n) : fallback;
66
+ }
67
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/providers/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAoCH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAW5C,wCAAwC;AACxC,MAAM,UAAU,kBAAkB,CAAC,OAA2B;IAC5D,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,IAAI,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QAAE,MAAM,IAAI,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAC9F,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,iBAAiB,CAAC,OAAoC;IACpE,MAAM,CAAC,GAAG,OAAO,EAAE,UAAU,CAAA;IAC7B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC1F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAoC,EAAE,QAAgB;IACrF,MAAM,CAAC,GAAG,OAAO,EAAE,SAAS,CAAA;IAC5B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;AACxF,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { CompletionRequest, ConverseOptions, ConverseRequest, ConverseResult, Provider } from "./types.js";
2
+ /**
3
+ * One scripted model turn: a fixed result, or a function of the request it
4
+ * answers (and its zero-based index in the script) for a script that needs to
5
+ * inspect what the loop sent before deciding.
6
+ */
7
+ export type ScriptedTurn = ConverseResult | ((req: ConverseRequest, index: number) => ConverseResult | Promise<ConverseResult>);
8
+ export interface ScriptedProviderOptions {
9
+ /** Reported as `Provider.name`; shows up as the run's `provider`. Default `"scripted"`. */
10
+ name?: string;
11
+ /** Reported as `Provider.model` and stamped on every result that names none. */
12
+ model?: string;
13
+ /** Declare usage reporting when the script's turns carry `usage`. Default `false`. */
14
+ reportsUsage?: boolean;
15
+ }
16
+ /** Thrown when the loop asks for a turn the script does not have. */
17
+ export declare class ScriptExhaustedError extends Error {
18
+ readonly played: number;
19
+ constructor(played: number);
20
+ }
21
+ /**
22
+ * A deterministic provider that plays back a recorded script of model turns.
23
+ *
24
+ * It exists for evals and tests that need the whole loop to run — tools
25
+ * executed, results fed back, terminal tools honoured — without a model or a
26
+ * network, and with every request the loop built available afterwards for
27
+ * assertions. It fails loud in both directions: a script that runs out throws
28
+ * rather than inventing a turn, and `remaining` lets a test assert that every
29
+ * recorded turn was consumed.
30
+ *
31
+ * It honours `signal` the way a real adapter does, so cancellation tests can
32
+ * run against it too.
33
+ */
34
+ export declare class ScriptedProvider implements Provider {
35
+ readonly name: string;
36
+ readonly model?: string;
37
+ readonly reportsUsage: boolean;
38
+ /** Every request received, in order, as detached copies. */
39
+ readonly requests: ConverseRequest[];
40
+ private readonly script;
41
+ private played;
42
+ constructor(script: readonly ScriptedTurn[], options?: ScriptedProviderOptions);
43
+ /** Turns not yet played. Zero after a conversation consumed the whole script. */
44
+ get remaining(): number;
45
+ converse(req: ConverseRequest, opts?: ConverseOptions): Promise<ConverseResult>;
46
+ /** Play the next turn as a one-shot completion and return its text. */
47
+ complete(req: CompletionRequest): Promise<string>;
48
+ }
49
+ //# sourceMappingURL=scripted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripted.d.ts","sourceRoot":"","sources":["../../src/providers/scripted.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,cAAc,EACd,QAAQ,EACT,MAAM,YAAY,CAAA;AAEnB;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACpB,cAAc,GACd,CAAC,CAAC,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,KAAK,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;AAEvF,MAAM,WAAW,uBAAuB;IACtC,2FAA2F;IAC3F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sFAAsF;IACtF,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,qEAAqE;AACrE,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;gBAEX,MAAM,EAAE,MAAM;CAQ3B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAiB,YAAW,QAAQ;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAK;IAEzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;IAChD,OAAO,CAAC,MAAM,CAAI;gBAEN,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,OAAO,GAAE,uBAA4B;IAOlF,iFAAiF;IACjF,IAAI,SAAS,IAAI,MAAM,CAEtB;IAEK,QAAQ,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAoBrF,uEAAuE;IACjE,QAAQ,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;CAQxD"}
@@ -0,0 +1,90 @@
1
+ /** Thrown when the loop asks for a turn the script does not have. */
2
+ export class ScriptExhaustedError extends Error {
3
+ played;
4
+ constructor(played) {
5
+ super(`scripted provider exhausted: ${played} turn(s) played and the loop asked for another — ` +
6
+ "the script is shorter than the conversation it was recorded against");
7
+ this.name = "ScriptExhaustedError";
8
+ this.played = played;
9
+ }
10
+ }
11
+ /**
12
+ * A deterministic provider that plays back a recorded script of model turns.
13
+ *
14
+ * It exists for evals and tests that need the whole loop to run — tools
15
+ * executed, results fed back, terminal tools honoured — without a model or a
16
+ * network, and with every request the loop built available afterwards for
17
+ * assertions. It fails loud in both directions: a script that runs out throws
18
+ * rather than inventing a turn, and `remaining` lets a test assert that every
19
+ * recorded turn was consumed.
20
+ *
21
+ * It honours `signal` the way a real adapter does, so cancellation tests can
22
+ * run against it too.
23
+ */
24
+ export class ScriptedProvider {
25
+ name;
26
+ model;
27
+ reportsUsage;
28
+ /** Every request received, in order, as detached copies. */
29
+ requests = [];
30
+ script;
31
+ played = 0;
32
+ constructor(script, options = {}) {
33
+ this.script = script;
34
+ this.name = options.name ?? "scripted";
35
+ if (options.model !== undefined)
36
+ this.model = options.model;
37
+ this.reportsUsage = options.reportsUsage ?? false;
38
+ }
39
+ /** Turns not yet played. Zero after a conversation consumed the whole script. */
40
+ get remaining() {
41
+ return this.script.length - this.played;
42
+ }
43
+ async converse(req, opts) {
44
+ opts?.signal?.throwIfAborted();
45
+ const turn = this.script[this.played];
46
+ if (turn === undefined)
47
+ throw new ScriptExhaustedError(this.played);
48
+ const index = this.played;
49
+ this.played += 1;
50
+ this.requests.push(detach(req));
51
+ const result = typeof turn === "function" ? await turn(req, index) : turn;
52
+ opts?.signal?.throwIfAborted();
53
+ // Return a deep copy: the loop hands a call's `input` to the tool, a tool
54
+ // may mutate it, and a script that reuses one recorded result across turns
55
+ // must play the same data every time or the eval is not deterministic.
56
+ const copy = detachResult(result);
57
+ return {
58
+ ...copy,
59
+ ...(copy.model === undefined && this.model !== undefined ? { model: this.model } : {}),
60
+ };
61
+ }
62
+ /** Play the next turn as a one-shot completion and return its text. */
63
+ async complete(req) {
64
+ const result = await this.converse({
65
+ system: req.system,
66
+ messages: [{ role: "user", text: req.prompt }],
67
+ tools: [],
68
+ });
69
+ return result.text;
70
+ }
71
+ }
72
+ /** A detached copy of a turn, whole; the shallow fallback covers a value `structuredClone` refuses. */
73
+ function detachResult(result) {
74
+ try {
75
+ return structuredClone(result);
76
+ }
77
+ catch {
78
+ return { ...result, toolCalls: result.toolCalls.map((c) => ({ ...c, input: { ...c.input } })) };
79
+ }
80
+ }
81
+ /** A detached copy of a request, so later mutation by the loop cannot rewrite history. */
82
+ function detach(req) {
83
+ try {
84
+ return structuredClone(req);
85
+ }
86
+ catch {
87
+ return { ...req, messages: [...req.messages], tools: [...req.tools] };
88
+ }
89
+ }
90
+ //# sourceMappingURL=scripted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripted.js","sourceRoot":"","sources":["../../src/providers/scripted.ts"],"names":[],"mappings":"AA0BA,qEAAqE;AACrE,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,MAAM,CAAQ;IAEvB,YAAY,MAAc;QACxB,KAAK,CACH,gCAAgC,MAAM,mDAAmD;YACvF,qEAAqE,CACxE,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,gBAAgB;IAClB,IAAI,CAAQ;IACZ,KAAK,CAAS;IACd,YAAY,CAAS;IAC9B,4DAA4D;IACnD,QAAQ,GAAsB,EAAE,CAAA;IAExB,MAAM,CAAyB;IACxC,MAAM,GAAG,CAAC,CAAA;IAElB,YAAY,MAA+B,EAAE,UAAmC,EAAE;QAChF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,UAAU,CAAA;QACtC,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QAC3D,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,KAAK,CAAA;IACnD,CAAC;IAED,iFAAiF;IACjF,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IACzC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,GAAoB,EAAE,IAAsB;QACzD,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA;QAC9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C1C,IAAI,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,CAAA;IACjG,CAAC;AACH,CAAC;AAED,0FAA0F;AAC1F,SAAS,MAAM,CAAC,GAAoB;IAClC,IAAI,CAAC;QACH,OAAO,eAAe,CAAC,GAAG,CAAC,CAAA;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,CAAA;IACvE,CAAC;AACH,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { TokenUsage } from "../models/types.js";
2
+ import type { ProviderOptions } from "./options.js";
2
3
  export interface CompletionRequest {
3
4
  system: string;
4
5
  prompt: string;
@@ -44,6 +45,12 @@ export interface ConverseRequest {
44
45
  system: string;
45
46
  messages: AgentMessage[];
46
47
  tools: ToolSpec[];
48
+ /**
49
+ * Per-call options for the adapter: token cap, prompt caching, response
50
+ * format, OpenRouter routing. See `providers/options.ts`. An adapter that
51
+ * cannot honour an option it was given throws rather than ignoring it.
52
+ */
53
+ providerOptions?: ProviderOptions;
47
54
  }
48
55
  export interface ConverseResult {
49
56
  /** Assistant prose for this turn (may be empty when it only calls tools). */
@@ -52,6 +59,26 @@ export interface ConverseResult {
52
59
  toolCalls: ToolCall[];
53
60
  /** Token accounting for this call, when the provider's API reports it. */
54
61
  usage?: TokenUsage;
62
+ /**
63
+ * The model id the response was served by, as the API reported it. This is
64
+ * the *effective* model: with a fallback list it can differ from the one
65
+ * requested. Absent when the API did not say; `chatModel` then fills in the
66
+ * adapter's configured model.
67
+ */
68
+ model?: string;
69
+ /**
70
+ * The provider's id for this response (an Anthropic message id, an OpenAI
71
+ * completion id, an OpenRouter generation id). What a billing or audit query
72
+ * against the provider keys on.
73
+ */
74
+ responseId?: string;
75
+ /**
76
+ * The upstream that served the request behind an aggregator (OpenRouter's
77
+ * `provider` field: "Anthropic", "Google Vertex", …). Absent for direct
78
+ * adapters. This is what a data-policy audit needs, since it names who
79
+ * actually processed the prompt.
80
+ */
81
+ upstream?: string;
55
82
  }
56
83
  /**
57
84
  * Per-call options for {@link Provider.converse}.
@@ -66,6 +93,13 @@ export interface ConverseOptions {
66
93
  }
67
94
  export interface Provider {
68
95
  readonly name: string;
96
+ /**
97
+ * The model id this adapter was configured with (the per-run model, else its
98
+ * env default, else its built-in default). Optional so a custom provider
99
+ * written before this field existed still compiles; the built-in adapters
100
+ * all set it, and `chatModel` reports it when a response names no model.
101
+ */
102
+ readonly model?: string;
69
103
  /**
70
104
  * True when `converse` always populates `ConverseResult.usage`. `chatModel`
71
105
  * declares `caps.usage` from this, so a provider that reports nothing (the
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEpD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,2EAA2E;AAC3E,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC;AAED,4CAA4C;AAC5C,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,E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M,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,eAAe,CAAA;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAA;IACZ,gEAAgE;IAChE,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACjD,2EAA2E;IAC3E,QAAQ,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;CAChF"}
@@ -26,6 +26,24 @@ import type { Tool } from "./registry.js";
26
26
  export type InvocationMode = "user_initiated" | "system_initiated";
27
27
  /** How long a tool's result should be retained by the caller. */
28
28
  export type ResultRetention = "ephemeral" | "standard" | "persistent";
29
+ /**
30
+ * What the loop does with a call to this tool.
31
+ *
32
+ * - `execute` — run it and feed the result back (the default).
33
+ * - `terminal` — run it, append its result, then END the loop with the call
34
+ * as the structured answer. A final-answer tool. The other
35
+ * calls of the same assistant turn still run (in order), so
36
+ * the transcript stays whole; the first terminal call that
37
+ * succeeds is the answer.
38
+ * - `external` — the loop does not run it: it returns the pending call and
39
+ * resumes when the caller supplies the result. Reserved for a
40
+ * loop that can suspend; the native loop refuses it today.
41
+ *
42
+ * This is the one piece of metadata the native loop acts on rather than merely
43
+ * records, because where a call ends up is control flow, and control flow is
44
+ * the loop's.
45
+ */
46
+ export type ToolDispatch = "execute" | "terminal" | "external";
29
47
  /**
30
48
  * Whether a tool's raw output reaches the client. `suppressed` trims it from
31
49
  * client-facing envelopes while the model still receives it unchanged — for
@@ -41,6 +59,8 @@ export type ClientResultVisibility = "full" | "suppressed";
41
59
  export interface ToolMetadata {
42
60
  /** Human-facing label, where a UI wants something friendlier than `name`. */
43
61
  displayName?: string;
62
+ /** What the loop does with a call to this tool. Absent means `execute`. */
63
+ dispatch?: ToolDispatch;
44
64
  /**
45
65
  * Capability scoping. When set, only the listed capabilities see the tool;
46
66
  * absent or null means every capability does.
@@ -97,6 +117,10 @@ export declare function selectTools(tools: Tool[], selection?: ToolSelection): T
97
117
  * the schema would only spend context.
98
118
  */
99
119
  export declare function toToolSpecs(tools: Tool[]): ToolSpec[];
120
+ /** A tool's dispatch, with the default applied. */
121
+ export declare function toolDispatch(tool: Tool): ToolDispatch;
122
+ /** Tools whose call ends the loop with a structured answer. */
123
+ export declare function terminalTools(tools: Tool[]): Tool[];
100
124
  /** Tools that must not execute until a human has approved them. */
101
125
  export declare function toolsRequiringConfirmation(tools: Tool[]): Tool[];
102
126
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/tools/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAEzC;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;GAOG;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AAE,CAErD;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAIzE"}
@@ -35,6 +35,14 @@ export function selectTools(tools, selection = {}) {
35
35
  export function toToolSpecs(tools) {
36
36
  return tools.map((tool) => tool.spec);
37
37
  }
38
+ /** A tool's dispatch, with the default applied. */
39
+ export function toolDispatch(tool) {
40
+ return tool.meta?.dispatch ?? "execute";
41
+ }
42
+ /** Tools whose call ends the loop with a structured answer. */
43
+ export function terminalTools(tools) {
44
+ return tools.filter((tool) => toolDispatch(tool) === "terminal");
45
+ }
38
46
  /** Tools that must not execute until a human has approved them. */
39
47
  export function toolsRequiringConfirmation(tools) {
40
48
  return tools.filter((tool) => tool.meta?.requiresConfirmation === true);
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/tools/metadata.ts"],"names":[],"mappings":"AA4FA,qDAAqD;AACrD,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,YAA2B,EAAE;IACrE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;IACtB,IAAI,SAAS,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IAClF,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IAEtB,0EAA0E;IAC1E,6EAA6E;IAC7E,4CAA4C;IAC5C,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClE,IAAI,CAAC,SAAS,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;YACrF,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;IAED,IAAI,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,IAAI,CAAC,YAAY;QAAE,OAAO,SAAS,CAAA;IACxE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;AACnE,CAAC"}
@@ -70,13 +70,20 @@ export declare function executeTool(tool: Tool, input: Record<string, unknown>,
70
70
  * (from the workflow's `permissions.tools`).
71
71
  */
72
72
  export declare function primitiveTools(sandboxDir: string, env: NodeJS.ProcessEnv, allowed?: string[], allowHosts?: string[]): Tool[];
73
+ /** How a connector's tool is named for the model. The default namespaces it. */
74
+ export type ConnectorToolName = (connectorName: string, toolName: string) => string;
75
+ /** The default: `<connector>__<tool>`, so two connectors cannot collide. */
76
+ export declare const namespacedToolName: ConnectorToolName;
73
77
  /**
74
- * Tools exposed by the run's MCP connectors. Each connector's tools are
75
- * namespaced `<connector>__<tool>` to avoid collisions. Returns a `close` to
76
- * tear down the connections when the run ends.
78
+ * Tools exposed by the run's MCP connectors. Each connector's tools are named
79
+ * `<connector>__<tool>` by default so two connectors cannot collide; pass
80
+ * `toolName` to name them differently (a single-connector application may
81
+ * want the server's own names, so its prompts and its tool names match).
82
+ * Returns a `close` to tear down the connections when the run ends.
77
83
  */
78
84
  export declare function connectorTools(connectors: ConnectorConfig[], connect?: (config: ConnectorConfig) => Promise<McpConnection>, opts?: {
79
85
  signal?: AbortSignal;
86
+ toolName?: ConnectorToolName;
80
87
  }): Promise<{
81
88
  tools: Tool[];
82
89
  close: () => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;A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WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CAC3F;AAED,sFAAsF;AACtF,wBAAsB,WAAW,CAC/B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,GAAG,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,UAAU,CAAC,CAGrB;AAeD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,OAAO,CAAC,EAAE,MAAM,EAAE,EAClB,UAAU,CAAC,EAAE,MAAM,EAAE,GACpB,IAAI,EAAE,CAgGR;AAED,gFAAgF;AAChF,MAAM,MAAM,iBAAiB,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;AAEnF,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,iBAAgE,CAAA;AAEjG;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,eAAe,EAAE,EAC7B,OAAO,GAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,aAAa,CAAc,EACzE,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAAO,GAChE,OAAO,CAAC;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAgExD"}
@@ -127,13 +127,18 @@ export function primitiveTools(sandboxDir, env, allowed, allowHosts) {
127
127
  ];
128
128
  return allowed ? all.filter((t) => allowed.includes(t.spec.name)) : all;
129
129
  }
130
+ /** The default: `<connector>__<tool>`, so two connectors cannot collide. */
131
+ export const namespacedToolName = (connector, tool) => `${connector}__${tool}`;
130
132
  /**
131
- * Tools exposed by the run's MCP connectors. Each connector's tools are
132
- * namespaced `<connector>__<tool>` to avoid collisions. Returns a `close` to
133
- * tear down the connections when the run ends.
133
+ * Tools exposed by the run's MCP connectors. Each connector's tools are named
134
+ * `<connector>__<tool>` by default so two connectors cannot collide; pass
135
+ * `toolName` to name them differently (a single-connector application may
136
+ * want the server's own names, so its prompts and its tool names match).
137
+ * Returns a `close` to tear down the connections when the run ends.
134
138
  */
135
139
  export async function connectorTools(connectors, connect = connectMcp, opts = {}) {
136
140
  const { signal } = opts;
141
+ const nameFor = opts.toolName ?? namespacedToolName;
137
142
  const connections = [];
138
143
  // Each setup await stops waiting the moment `signal` aborts, so a stalled
139
144
  // server cannot hold a canceled run; the catch below then closes every
@@ -171,7 +176,7 @@ export async function connectorTools(connectors, connect = connectMcp, opts = {}
171
176
  for (const tool of listed.tools ?? []) {
172
177
  tools.push({
173
178
  spec: {
174
- name: `${config.name}__${tool.name}`,
179
+ name: nameFor(config.name, tool.name),
175
180
  description: tool.description ?? `${config.name} tool ${tool.name}`,
176
181
  inputSchema: tool.inputSchema ?? { type: "object" },
177
182
  },
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAsB,MAAM,4BAA4B,CAAA;AA6D3E,sFAAsF;AACtF,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAU,EACV,KAA8B,EAC9B,GAAiB;IAEjB,IAAI,IAAI,CAAC,iBAAiB;QAAE,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACrE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC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registry.js";
3
+ export interface TerminalToolOptions {
4
+ /** The name the model calls, e.g. `reply` or `final_answer`. */
5
+ name: string;
6
+ description: string;
7
+ /** JSON Schema for the structured answer the model must produce. */
8
+ inputSchema: Record<string, unknown>;
9
+ /** Any other metadata; `dispatch` is fixed to `"terminal"`. */
10
+ meta?: Omit<ToolMetadata, "dispatch">;
11
+ }
12
+ /**
13
+ * A final-answer tool: calling it ends the loop, and the call's arguments are
14
+ * the run's structured result (`ConversationResult.terminal.input`).
15
+ *
16
+ * This is how a conversational application gets a typed reply out of the loop
17
+ * instead of parsing prose. The model is told the schema through the tool
18
+ * definition, so the shape is enforced where models enforce shapes best. The
19
+ * kernel does not validate the arguments against the schema (it ships no
20
+ * JSON-Schema validator); a caller that needs validation runs it on
21
+ * `terminal.input`, or supplies its own `Tool` with `meta.dispatch: "terminal"`
22
+ * whose executor throws on a bad answer, which sends the error back to the
23
+ * model and lets it try again.
24
+ *
25
+ * The executor here is a no-op that acknowledges the call: a tool result still
26
+ * has to be appended so the transcript carries no dangling tool call and can be
27
+ * resumed on the next turn. For the same reason, any other tool calls the
28
+ * model made in the same turn still execute, before or after this one in the
29
+ * order it issued them; "final" means the loop ends after this turn, not that
30
+ * this call pre-empts its siblings.
31
+ */
32
+ export declare function terminalTool(options: TerminalToolOptions): Tool;
33
+ //# sourceMappingURL=terminal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../src/tools/terminal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAEzC,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,+DAA+D;IAC/D,IAAI,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;CACtC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAU/D"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A final-answer tool: calling it ends the loop, and the call's arguments are
3
+ * the run's structured result (`ConversationResult.terminal.input`).
4
+ *
5
+ * This is how a conversational application gets a typed reply out of the loop
6
+ * instead of parsing prose. The model is told the schema through the tool
7
+ * definition, so the shape is enforced where models enforce shapes best. The
8
+ * kernel does not validate the arguments against the schema (it ships no
9
+ * JSON-Schema validator); a caller that needs validation runs it on
10
+ * `terminal.input`, or supplies its own `Tool` with `meta.dispatch: "terminal"`
11
+ * whose executor throws on a bad answer, which sends the error back to the
12
+ * model and lets it try again.
13
+ *
14
+ * The executor here is a no-op that acknowledges the call: a tool result still
15
+ * has to be appended so the transcript carries no dangling tool call and can be
16
+ * resumed on the next turn. For the same reason, any other tool calls the
17
+ * model made in the same turn still execute, before or after this one in the
18
+ * order it issued them; "final" means the loop ends after this turn, not that
19
+ * this call pre-empts its siblings.
20
+ */
21
+ export function terminalTool(options) {
22
+ return {
23
+ spec: {
24
+ name: options.name,
25
+ description: options.description,
26
+ inputSchema: options.inputSchema,
27
+ },
28
+ meta: { ...options.meta, dispatch: "terminal" },
29
+ execute: () => Promise.resolve("accepted"),
30
+ };
31
+ }
32
+ //# sourceMappingURL=terminal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal.js","sourceRoot":"","sources":["../../src/tools/terminal.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY,CAAC,OAA4B;IACvD,OAAO;QACL,IAAI,EAAE;YACJ,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC;QACD,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE;QAC/C,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;KAC3C,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rarebit-one/harness-kernel",
3
- "version": "0.9.0",
4
- "description": "Provider-neutral AI-harness kernel — LLM adapters, tool-use loop, MCP connectors, and a pluggable agent-engine seam",
3
+ "version": "0.11.0-next.0",
4
+ "description": "Provider-neutral AI-harness kernel \u2014 LLM adapters, tool-use loop, MCP connectors, and a pluggable agent-engine seam",
5
5
  "license": "MIT",
6
6
  "author": "Jaryl Sim <code@jaryl.dev>",
7
7
  "type": "module",
@@ -12,7 +12,8 @@
12
12
  ".": {
13
13
  "types": "./dist/index.d.ts",
14
14
  "import": "./dist/index.js"
15
- }
15
+ },
16
+ "./package.json": "./package.json"
16
17
  },
17
18
  "files": [
18
19
  "dist"
@@ -51,7 +52,7 @@
51
52
  },
52
53
  "dependencies": {
53
54
  "@anthropic-ai/claude-agent-sdk": "^0.3.228",
54
- "@anthropic-ai/sdk": "^0.129.0",
55
+ "@anthropic-ai/sdk": "^0.133.0",
55
56
  "@modelcontextprotocol/sdk": "^1.30.0",
56
57
  "@zed-industries/agent-client-protocol": "^0.4.5",
57
58
  "openai": "^7.4.0",