@inferencesh/sdk 0.34.0 → 0.35.1
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 +13 -0
- package/dist/agent/api.js +2 -0
- package/dist/agent/types.d.ts +7 -0
- package/dist/hook-builder.d.ts +1 -1
- package/dist/hook-builder.js +4 -4
- package/dist/types.d.ts +18 -7
- package/dist/types.js +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.35.1] - 2026-10-28
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `ChatDTO.project_id`: the project a chat is filed in. `ApiAgentRunRequest.project_id` files the chat a run starts in a project.
|
|
14
|
+
|
|
15
|
+
## [0.35.0] - 2026-10-28
|
|
16
|
+
|
|
17
|
+
### Breaking
|
|
18
|
+
- 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.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- `ChatHookEvent.injection_ids`: the injection messages a hook run wrote.
|
|
22
|
+
|
|
10
23
|
## [0.34.0] - 2026-10-26
|
|
11
24
|
|
|
12
25
|
### 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 {
|
package/dist/agent/types.d.ts
CHANGED
|
@@ -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
|
package/dist/hook-builder.d.ts
CHANGED
|
@@ -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.
|
|
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;
|
package/dist/hook-builder.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hook Builder - Fluent API for defining lifecycle hooks
|
|
3
3
|
*/
|
|
4
|
-
import { HookHandlerWebhook, HookHandlerTask, HookHandlerBuiltin,
|
|
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.
|
|
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(
|
|
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(
|
|
71
|
+
hooks.push(lifecycleHook(event).builtin(BuiltinHookExtract).build());
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
return hooks;
|
package/dist/types.d.ts
CHANGED
|
@@ -504,6 +504,12 @@ export interface ApiAgentRunRequest {
|
|
|
504
504
|
[key: string]: string;
|
|
505
505
|
};
|
|
506
506
|
stream?: boolean;
|
|
507
|
+
/**
|
|
508
|
+
* ProjectID files the chat this message starts in a project. Ignored
|
|
509
|
+
* when the message posts into an existing chat (chat_id): a chat moves
|
|
510
|
+
* with POST /chats/{id}/project.
|
|
511
|
+
*/
|
|
512
|
+
project_id?: string;
|
|
507
513
|
}
|
|
508
514
|
export interface CreateAgentMessageResponse {
|
|
509
515
|
user_message?: ChatMessageDTO;
|
|
@@ -2319,7 +2325,7 @@ export interface ChatAgentDTO {
|
|
|
2319
2325
|
/**
|
|
2320
2326
|
* ChatDTO for API responses
|
|
2321
2327
|
*/
|
|
2322
|
-
export interface ChatDTO extends BaseModelDTO, PermissionModelDTO {
|
|
2328
|
+
export interface ChatDTO extends BaseModelDTO, PermissionModelDTO, ProjectModelDTO {
|
|
2323
2329
|
parent_id?: string;
|
|
2324
2330
|
parent?: ChatDTO;
|
|
2325
2331
|
children: (ChatDTO | undefined)[];
|
|
@@ -6459,6 +6465,11 @@ export interface ChatHookEvent {
|
|
|
6459
6465
|
decision?: HookDecision;
|
|
6460
6466
|
reason?: string;
|
|
6461
6467
|
injected?: boolean;
|
|
6468
|
+
/**
|
|
6469
|
+
* InjectionIDs are the injection messages the run wrote, so a reader
|
|
6470
|
+
* shows what the hook added with the run instead of as rows of its own.
|
|
6471
|
+
*/
|
|
6472
|
+
injection_ids?: string[];
|
|
6462
6473
|
error?: string;
|
|
6463
6474
|
duration_ms: number;
|
|
6464
6475
|
}
|
|
@@ -8083,21 +8094,21 @@ export declare const HookHandlerBuiltin: HookHandlerType;
|
|
|
8083
8094
|
* agent config is validated against it, and clients enumerate it to show what
|
|
8084
8095
|
* an agent can switch on without hosting anything.
|
|
8085
8096
|
*/
|
|
8086
|
-
export type BuiltinHook = "
|
|
8097
|
+
export type BuiltinHook = "suggest" | "extract";
|
|
8087
8098
|
/**
|
|
8088
|
-
*
|
|
8099
|
+
* BuiltinHookSuggest searches the team's skills, knowledge and apps
|
|
8089
8100
|
* for what the turn is about and injects the matches, so an agent picks up
|
|
8090
8101
|
* procedural knowledge it was never prompted with.
|
|
8091
8102
|
*/
|
|
8092
|
-
export declare const
|
|
8103
|
+
export declare const BuiltinHookSuggest: BuiltinHook;
|
|
8093
8104
|
/**
|
|
8094
|
-
*
|
|
8105
|
+
* BuiltinHookExtract reviews the conversation for reusable knowledge
|
|
8095
8106
|
* and saves it to the team's registry, deduplicated against what is
|
|
8096
|
-
* there, so
|
|
8107
|
+
* there, so suggest can hand it back later. It runs in the
|
|
8097
8108
|
* background: on agent.complete every tenth user turn, and before
|
|
8098
8109
|
* compaction drops the turns it would have learned from.
|
|
8099
8110
|
*/
|
|
8100
|
-
export declare const
|
|
8111
|
+
export declare const BuiltinHookExtract: BuiltinHook;
|
|
8101
8112
|
/**
|
|
8102
8113
|
* BuiltinHookDefinition describes a builtin hook and where it may be used.
|
|
8103
8114
|
*/
|
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
|
-
*
|
|
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
|
|
1727
|
+
export const BuiltinHookSuggest = "suggest";
|
|
1728
1728
|
/**
|
|
1729
|
-
*
|
|
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
|
|
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
|
|
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";
|