@inferencesh/sdk 0.34.0 → 0.35.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.35.0] - 2026-10-28
11
+
12
+ ### Breaking
13
+ - The builtin hooks are `suggest` and `extract`, not `belt:suggest` and `belt:extract`. `BuiltinHookBeltSuggest` and `BuiltinHookBeltExtract` are now `BuiltinHookSuggest` and `BuiltinHookExtract`; `learningHooks()` writes the new names.
14
+
15
+ ### Added
16
+ - `ChatHookEvent.injection_ids`: the injection messages a hook run wrote.
17
+
10
18
  ## [0.34.0] - 2026-10-26
11
19
 
12
20
  ### Breaking
package/dist/agent/api.js CHANGED
@@ -81,6 +81,8 @@ export async function fetchAgentInfo(client, agentRef) {
81
81
  description: version?.description,
82
82
  example_prompts: version?.example_prompts,
83
83
  model_capabilities: Array.isArray(capabilities) ? capabilities : undefined,
84
+ agent_id: resp.data?.id,
85
+ version_id: resp.data?.version_id || version?.id,
84
86
  };
85
87
  }
86
88
  catch {
@@ -95,6 +95,13 @@ export type AgentInfo = Partial<Pick<AgentVersionDTO, 'description' | 'example_p
95
95
  * its app version. Undefined when unknown; then assume everything.
96
96
  */
97
97
  model_capabilities?: string[];
98
+ /** The agent's id. */
99
+ agent_id?: string;
100
+ /**
101
+ * The agent's current version. A chat stays on the version it started
102
+ * with; one on another version can move to this one with switchAgent.
103
+ */
104
+ version_id?: string;
98
105
  };
99
106
  /**
100
107
  * Status of the chat
@@ -13,7 +13,7 @@ export declare class LifecycleHookBuilder {
13
13
  webhook(url: string): this;
14
14
  /** Set handler to a task (agent ref) */
15
15
  task(agentRef: string): this;
16
- /** Set handler to a builtin the platform runs itself (e.g. belt:suggest) */
16
+ /** Set handler to a builtin the platform runs itself (e.g. suggest) */
17
17
  builtin(name: BuiltinHook): this;
18
18
  /** Set async execution */
19
19
  async(enabled: boolean): this;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Hook Builder - Fluent API for defining lifecycle hooks
3
3
  */
4
- import { HookHandlerWebhook, HookHandlerTask, HookHandlerBuiltin, BuiltinHookBeltSuggest, BuiltinHookBeltExtract, HookEventTurnStart, HookEventAgentComplete, HookEventPreCompact, } from './types.js';
4
+ import { HookHandlerWebhook, HookHandlerTask, HookHandlerBuiltin, BuiltinHookSuggest, BuiltinHookExtract, HookEventTurnStart, HookEventAgentComplete, HookEventPreCompact, } from './types.js';
5
5
  // =============================================================================
6
6
  // Hook Builder
7
7
  // =============================================================================
@@ -23,7 +23,7 @@ export class LifecycleHookBuilder {
23
23
  this.handlerRef = agentRef;
24
24
  return this;
25
25
  }
26
- /** Set handler to a builtin the platform runs itself (e.g. belt:suggest) */
26
+ /** Set handler to a builtin the platform runs itself (e.g. suggest) */
27
27
  builtin(name) {
28
28
  this.handlerType = HookHandlerBuiltin;
29
29
  this.handlerRef = name;
@@ -64,11 +64,11 @@ export const lifecycleHook = (event) => new LifecycleHookBuilder(event);
64
64
  export function learningHooks(opts) {
65
65
  const hooks = [];
66
66
  if (opts.suggest) {
67
- hooks.push(lifecycleHook(HookEventTurnStart).builtin(BuiltinHookBeltSuggest).build());
67
+ hooks.push(lifecycleHook(HookEventTurnStart).builtin(BuiltinHookSuggest).build());
68
68
  }
69
69
  if (opts.learn) {
70
70
  for (const event of [HookEventAgentComplete, HookEventPreCompact]) {
71
- hooks.push(lifecycleHook(event).builtin(BuiltinHookBeltExtract).build());
71
+ hooks.push(lifecycleHook(event).builtin(BuiltinHookExtract).build());
72
72
  }
73
73
  }
74
74
  return hooks;
package/dist/types.d.ts CHANGED
@@ -6459,6 +6459,11 @@ export interface ChatHookEvent {
6459
6459
  decision?: HookDecision;
6460
6460
  reason?: string;
6461
6461
  injected?: boolean;
6462
+ /**
6463
+ * InjectionIDs are the injection messages the run wrote, so a reader
6464
+ * shows what the hook added with the run instead of as rows of its own.
6465
+ */
6466
+ injection_ids?: string[];
6462
6467
  error?: string;
6463
6468
  duration_ms: number;
6464
6469
  }
@@ -8083,21 +8088,21 @@ export declare const HookHandlerBuiltin: HookHandlerType;
8083
8088
  * agent config is validated against it, and clients enumerate it to show what
8084
8089
  * an agent can switch on without hosting anything.
8085
8090
  */
8086
- export type BuiltinHook = "belt:suggest" | "belt:extract";
8091
+ export type BuiltinHook = "suggest" | "extract";
8087
8092
  /**
8088
- * BuiltinHookBeltSuggest searches the team's skills, knowledge and apps
8093
+ * BuiltinHookSuggest searches the team's skills, knowledge and apps
8089
8094
  * for what the turn is about and injects the matches, so an agent picks up
8090
8095
  * procedural knowledge it was never prompted with.
8091
8096
  */
8092
- export declare const BuiltinHookBeltSuggest: BuiltinHook;
8097
+ export declare const BuiltinHookSuggest: BuiltinHook;
8093
8098
  /**
8094
- * BuiltinHookBeltExtract reviews the conversation for reusable knowledge
8099
+ * BuiltinHookExtract reviews the conversation for reusable knowledge
8095
8100
  * and saves it to the team's registry, deduplicated against what is
8096
- * there, so belt:suggest can hand it back later. It runs in the
8101
+ * there, so suggest can hand it back later. It runs in the
8097
8102
  * background: on agent.complete every tenth user turn, and before
8098
8103
  * compaction drops the turns it would have learned from.
8099
8104
  */
8100
- export declare const BuiltinHookBeltExtract: BuiltinHook;
8105
+ export declare const BuiltinHookExtract: BuiltinHook;
8101
8106
  /**
8102
8107
  * BuiltinHookDefinition describes a builtin hook and where it may be used.
8103
8108
  */
package/dist/types.js CHANGED
@@ -1720,19 +1720,19 @@ export const HookHandlerTask = "task";
1720
1720
  export const HookHandlerGate = "gate";
1721
1721
  export const HookHandlerBuiltin = "builtin";
1722
1722
  /**
1723
- * BuiltinHookBeltSuggest searches the team's skills, knowledge and apps
1723
+ * BuiltinHookSuggest searches the team's skills, knowledge and apps
1724
1724
  * for what the turn is about and injects the matches, so an agent picks up
1725
1725
  * procedural knowledge it was never prompted with.
1726
1726
  */
1727
- export const BuiltinHookBeltSuggest = "belt:suggest";
1727
+ export const BuiltinHookSuggest = "suggest";
1728
1728
  /**
1729
- * BuiltinHookBeltExtract reviews the conversation for reusable knowledge
1729
+ * BuiltinHookExtract reviews the conversation for reusable knowledge
1730
1730
  * and saves it to the team's registry, deduplicated against what is
1731
- * there, so belt:suggest can hand it back later. It runs in the
1731
+ * there, so suggest can hand it back later. It runs in the
1732
1732
  * background: on agent.complete every tenth user turn, and before
1733
1733
  * compaction drops the turns it would have learned from.
1734
1734
  */
1735
- export const BuiltinHookBeltExtract = "belt:extract";
1735
+ export const BuiltinHookExtract = "extract";
1736
1736
  export const AgentEventSubagentStarted = "subagent.started";
1737
1737
  export const AgentEventSubagentUpdated = "subagent.updated";
1738
1738
  export const AgentEventSubagentCompleted = "subagent.completed";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "description": "Official JavaScript/TypeScript SDK for inference.sh - Run AI models with a simple API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",