@orkestrel/agent 0.0.43 → 0.0.45

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.
@@ -3382,8 +3382,8 @@ export declare function collectBuiltinDefinitions(options: Pick<AgentOptions, 'b
3382
3382
  * {@link findToolCall}. It then folds the pairs in message order: a `load` whose message content
3383
3383
  * equals `BUILTIN_NOTES.loaded` adds its `skill`, an `unload` with `BUILTIN_NOTES.unloaded` removes
3384
3384
  * it, and a `switch` with `BUILTIN_NOTES.switched` selects its `workspace`. Each call's arguments
3385
- * are admitted through the built-in's contract in `builtinToolContracts`, lossless repairs
3386
- * included, as its tool's door admits them, so a `{ skill: 1 }` the door repaired to `'1'` counts
3385
+ * are repaired through the built-in's contract in `builtinToolContracts` by `repairValue`, as
3386
+ * its tool's door repairs them, so a `{ skill: 1 }` the door repaired to `'1'` counts
3387
3387
  * as `'1'`; arguments the contract refuses change nothing. A skill loaded again while shown keeps
3388
3388
  * its place, and one loaded again after its unload goes last. Any other message and a denied or
3389
3389
  * refused call change nothing. The result holds `workspace` only when a switch succeeded.
@@ -3382,8 +3382,8 @@ export declare function collectBuiltinDefinitions(options: Pick<AgentOptions, 'b
3382
3382
  * {@link findToolCall}. It then folds the pairs in message order: a `load` whose message content
3383
3383
  * equals `BUILTIN_NOTES.loaded` adds its `skill`, an `unload` with `BUILTIN_NOTES.unloaded` removes
3384
3384
  * it, and a `switch` with `BUILTIN_NOTES.switched` selects its `workspace`. Each call's arguments
3385
- * are admitted through the built-in's contract in `builtinToolContracts`, lossless repairs
3386
- * included, as its tool's door admits them, so a `{ skill: 1 }` the door repaired to `'1'` counts
3385
+ * are repaired through the built-in's contract in `builtinToolContracts` by `repairValue`, as
3386
+ * its tool's door repairs them, so a `{ skill: 1 }` the door repaired to `'1'` counts
3387
3387
  * as `'1'`; arguments the contract refuses change nothing. A skill loaded again while shown keeps
3388
3388
  * its place, and one loaded again after its unload goes last. Any other message and a denied or
3389
3389
  * refused call change nothing. The result holds `workspace` only when a switch succeeded.
@@ -1,4 +1,4 @@
1
- import { ContractError, INTRINSICS, admitValue, arrayOf, arrayShape, attempt, booleanShape, boundsOf, canonicalStringify, cloneJSONValue, createContract, describeFaults, errorToMessage, failure, holds, integerShape, isArray, isBoolean, isError, isFiniteNumber, isFunction, isJSONValue, isNumber, isObject, isPromiseLike, isRecord, isString, jsonShape, literalOf, literalShape, matchesExactKeys, nullableOf, nullableShape, numberShape, objectOf, objectShape, optionalOf, optionalShape, parseJSON, parseJSONAs, parseJSONValue, preview, rawShape, recordOf, recordShape, refuseOptionKeys, schemaToParameters, schemaToShape, stringShape, success, unionOf, unionShape } from "@orkestrel/contract";
1
+ import { ContractError, INTRINSICS, arrayOf, arrayShape, attempt, booleanShape, boundsOf, canonicalStringify, cloneJSONValue, createContract, describeFaults, errorToMessage, failure, holds, integerShape, isArray, isBoolean, isError, isFiniteNumber, isFunction, isJSONValue, isNumber, isObject, isPromiseLike, isRecord, isString, jsonShape, literalOf, literalShape, matchesExactKeys, nullableOf, nullableShape, numberShape, objectOf, objectShape, optionalOf, optionalShape, parseJSON, parseJSONAs, parseJSONValue, preview, rawShape, recordOf, recordShape, refuseOptionKeys, repairValue, schemaToParameters, schemaToShape, stringShape, success, unionOf, unionShape } from "@orkestrel/contract";
2
2
  import { createTokenBudget, createTokenMeter, isBudget, isBudgetAmount, isBudgetError, isTokenUsage } from "@orkestrel/budget";
3
3
  import { ToolError, ToolManager, createTool, createToolManager, isToolCall, isToolError } from "@orkestrel/tool";
4
4
  import { createNDJSONParser } from "@orkestrel/ndjson";
@@ -6701,20 +6701,20 @@ var BUILTIN_LIMITS = Object.freeze({
6701
6701
  * definitions `collectBuiltinDefinitions` returns both read their text and annotations here.
6702
6702
  */
6703
6703
  var BUILTIN_TOOLS = Object.freeze({
6704
- load: Object.freeze({ description: "Loads one skill from the skills index, so its instructions join yours and its tools become callable from your next step. Example: {\"skill\":\"refunds\"}. Replies with a short acknowledgement, not the instructions; call unload when you no longer need the skill." }),
6705
- unload: Object.freeze({ description: "Unloads one skill you loaded, so its instructions and tools leave from your next step. Example: {\"skill\":\"refunds\"}. Replies with a short acknowledgement." }),
6704
+ load: Object.freeze({ description: "Loads one skill from the skills index, so its instructions join yours and its tools become callable from your next step. Example: {\"skill\":\"refunds\"}. A number given as the skill reads as its digits, so {\"skill\":7} loads the skill \"7\". Replies with a short acknowledgement, not the instructions; call unload when you no longer need the skill." }),
6705
+ unload: Object.freeze({ description: "Unloads one skill you loaded, so its instructions and tools leave from your next step. Example: {\"skill\":\"refunds\"}. A number given as the skill reads as its digits, so {\"skill\":7} unloads the skill \"7\". Replies with a short acknowledgement." }),
6706
6706
  memo: Object.freeze({
6707
- description: "Reads one memo from the memos index and replies with its full text. Example: {\"name\":\"tone\"}. Reading changes nothing; call remember to write a memo.",
6707
+ description: "Reads one memo from the memos index and replies with its full text. Example: {\"name\":\"tone\"}. A number given as the name reads as its digits, so {\"name\":7} reads the memo \"7\". Reading changes nothing; call remember to write a memo.",
6708
6708
  annotations: Object.freeze({
6709
6709
  pure: true,
6710
6710
  untrusted: true
6711
6711
  })
6712
6712
  }),
6713
6713
  remember: Object.freeze({
6714
- description: "Saves one memo under a name you are allowed to write: a one-line description for the memos index, and the content. Example: {\"name\":\"tone\",\"description\":\"Reply tone\",\"content\":\"Keep replies brief, because the user asked for that.\"}. Replies with a short acknowledgement; call memo to read a memo back.",
6714
+ description: "Saves one memo under a name you are allowed to write: a one-line description for the memos index, and the content. Example: {\"name\":\"tone\",\"description\":\"Reply tone\",\"content\":\"Keep replies brief, because the user asked for that.\"}. A number given for any of the three reads as its digits, so a name of 7 saves the memo \"7\". Replies with a short acknowledgement; call memo to read a memo back.",
6715
6715
  annotations: Object.freeze({ consequential: true })
6716
6716
  }),
6717
- switch: Object.freeze({ description: "Selects one workspace from the workspaces index, so its files join your context from your next step. Example: {\"workspace\":\"orders\"}. Replies with a short acknowledgement." })
6717
+ switch: Object.freeze({ description: "Selects one workspace from the workspaces index, so its files join your context from your next step. Example: {\"workspace\":\"orders\"}. A number given as the workspace reads as its digits, so {\"workspace\":7} selects the workspace \"7\". Replies with a short acknowledgement." })
6718
6718
  });
6719
6719
  /**
6720
6720
  * Matches one control, format, line-separator, or paragraph-separator code point — the class
@@ -8604,8 +8604,8 @@ function resolveDisclosure(context, conversation, workspace, ceiling, builtins)
8604
8604
  * {@link findToolCall}. It then folds the pairs in message order: a `load` whose message content
8605
8605
  * equals `BUILTIN_NOTES.loaded` adds its `skill`, an `unload` with `BUILTIN_NOTES.unloaded` removes
8606
8606
  * it, and a `switch` with `BUILTIN_NOTES.switched` selects its `workspace`. Each call's arguments
8607
- * are admitted through the built-in's contract in `builtinToolContracts`, lossless repairs
8608
- * included, as its tool's door admits them, so a `{ skill: 1 }` the door repaired to `'1'` counts
8607
+ * are repaired through the built-in's contract in `builtinToolContracts` by `repairValue`, as
8608
+ * its tool's door repairs them, so a `{ skill: 1 }` the door repaired to `'1'` counts
8609
8609
  * as `'1'`; arguments the contract refuses change nothing. A skill loaded again while shown keeps
8610
8610
  * its place, and one loaded again after its unload goes last. Any other message and a denied or
8611
8611
  * refused call change nothing. The result holds `workspace` only when a switch succeeded.
@@ -8641,9 +8641,9 @@ function collectDisclosure(conversation, builtins) {
8641
8641
  if (call === void 0 || !isAgentBuiltin(name) || !counted.has(name)) return shown;
8642
8642
  const note = name === "load" ? BUILTIN_NOTES.loaded : name === "unload" ? BUILTIN_NOTES.unloaded : BUILTIN_NOTES.switched;
8643
8643
  if (message.content !== note) return shown;
8644
- const admitted = admitValue(builtinToolContracts[name].contract, { ...call.arguments });
8645
- const skill = admitted.success ? admitted.value.value["skill"] : void 0;
8646
- const workspace = admitted.success ? admitted.value.value["workspace"] : void 0;
8644
+ const repaired = repairValue(builtinToolContracts[name].contract, { ...call.arguments });
8645
+ const skill = repaired.success ? repaired.value.value["skill"] : void 0;
8646
+ const workspace = repaired.success ? repaired.value.value["workspace"] : void 0;
8647
8647
  if (name === "load") return !isString(skill) || shown.skills.includes(skill) ? shown : {
8648
8648
  ...shown,
8649
8649
  skills: [...shown.skills, skill]
@@ -13477,7 +13477,7 @@ var Ledger = class {
13477
13477
  }));
13478
13478
  tools.add(createTool({
13479
13479
  name: "recall",
13480
- description: `Find something said earlier that isn't in the messages you can see, by an owner name, an id, or one of the topics ${renderTopicNames(options.topics)}. Returns statements and lookup findings first, then earlier requests and replies labeled by origin; newest first within each group.`,
13480
+ description: `Find something said earlier that isn't in the messages you can see, by an owner name, an id, or one of the topics ${renderTopicNames(options.topics)}. A number given as the topic reads as its digits, so {"topic":7} searches for "7". Returns statements and lookup findings first, then earlier requests and replies labeled by origin; newest first within each group.`,
13481
13481
  contract: objectShape({ topic: stringShape({
13482
13482
  min: 1,
13483
13483
  description: "An owner name, an id, or a topic"
@@ -13879,8 +13879,8 @@ var Ledger = class {
13879
13879
  const gauge = this.#gauge;
13880
13880
  if (gauge === void 0) return void 0;
13881
13881
  const room = gauge.remainder(request.calls) - this.#predict;
13882
- const admitted = admitValue(builtinToolContracts[name].contract, { ...args });
13883
- const values = admitted.success ? admitted.value.value : {};
13882
+ const repaired = repairValue(builtinToolContracts[name].contract, { ...args });
13883
+ const values = repaired.success ? repaired.value.value : {};
13884
13884
  if (name === "remember") {
13885
13885
  const line = isString(values["name"]) && isString(values["description"]) ? renderIndexEntry({
13886
13886
  name: values["name"],