@inferencesh/sdk 0.33.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 +21 -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 +33 -15
- package/dist/types.js +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,27 @@ 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
|
+
|
|
18
|
+
## [0.34.0] - 2026-10-26
|
|
19
|
+
|
|
20
|
+
### Breaking
|
|
21
|
+
- `CursorListRequest.page` and `CursorListResponse.total_items` are gone: lists are cursor-only. Page with `cursor` and `has_more`.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- `ToolInvocationDTO.action`: the phrase the model wrote for the call ("Fetch unread emails from alice@x.com"). Empty when it left it out.
|
|
25
|
+
- `AgentRunDTO.finished_at`: when the run reached a terminal state.
|
|
26
|
+
- `ChatRunEvent.duration_ms`: how long the run took, from its start to its end.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- Auth scheme scopes (`scopes`, `required_scopes`) are the provider's own scope names; `scope_aliases` are optional shorthand for them.
|
|
30
|
+
|
|
10
31
|
## [0.33.0] - 2026-10-24
|
|
11
32
|
|
|
12
33
|
### 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
|
@@ -394,6 +394,10 @@ export interface AgentRunDTO extends BaseModelDTO, PermissionModelDTO {
|
|
|
394
394
|
state: AgentRunState;
|
|
395
395
|
error?: string;
|
|
396
396
|
output?: any;
|
|
397
|
+
/**
|
|
398
|
+
* FinishedAt is when the run reached a terminal state; nil while it runs.
|
|
399
|
+
*/
|
|
400
|
+
finished_at?: string;
|
|
397
401
|
interrupt_reason?: InterruptReason;
|
|
398
402
|
interrupt_tool_id?: string;
|
|
399
403
|
interrupt_meta?: any;
|
|
@@ -2786,7 +2790,6 @@ export interface SortOrder {
|
|
|
2786
2790
|
*/
|
|
2787
2791
|
export interface CursorListRequest {
|
|
2788
2792
|
cursor: string;
|
|
2789
|
-
page?: number;
|
|
2790
2793
|
limit: number;
|
|
2791
2794
|
direction: string;
|
|
2792
2795
|
search?: SearchRequest;
|
|
@@ -2812,7 +2815,6 @@ export interface CursorListResponse<T extends any> {
|
|
|
2812
2815
|
has_next: boolean;
|
|
2813
2816
|
has_previous: boolean;
|
|
2814
2817
|
items_per_page: number;
|
|
2815
|
-
total_items: number;
|
|
2816
2818
|
}
|
|
2817
2819
|
/**
|
|
2818
2820
|
* CountResponse is the response for count endpoints.
|
|
@@ -5419,6 +5421,11 @@ export interface ToolInvocationDTO extends BaseModelDTO, PermissionModelDTO {
|
|
|
5419
5421
|
tool_invocation_id: string;
|
|
5420
5422
|
type: ToolType;
|
|
5421
5423
|
display_name?: string;
|
|
5424
|
+
/**
|
|
5425
|
+
* Action is what the model said the call does, as an imperative phrase
|
|
5426
|
+
* ("Fetch unread emails from alice@x.com"). Empty when it left it out.
|
|
5427
|
+
*/
|
|
5428
|
+
action?: string;
|
|
5422
5429
|
execution_id?: string;
|
|
5423
5430
|
function: ToolInvocationFunction;
|
|
5424
5431
|
status: ToolInvocationStatus;
|
|
@@ -5994,8 +6001,8 @@ export interface AuthMethodLookup {
|
|
|
5994
6001
|
}
|
|
5995
6002
|
/**
|
|
5996
6003
|
* AuthMethodCapability is something an app can ask for from this provider,
|
|
5997
|
-
* satisfied by a connection holding its scopes. Scopes are
|
|
5998
|
-
* own (
|
|
6004
|
+
* satisfied by a connection holding its scopes. Scopes are the provider's
|
|
6005
|
+
* own names (Wire form), the ones a credential stores.
|
|
5999
6006
|
*/
|
|
6000
6007
|
export interface AuthMethodCapability {
|
|
6001
6008
|
key: string;
|
|
@@ -6052,10 +6059,11 @@ export interface AuthMethod {
|
|
|
6052
6059
|
authorization_endpoint?: string;
|
|
6053
6060
|
scopes?: string[];
|
|
6054
6061
|
/**
|
|
6055
|
-
* ScopeAliases
|
|
6056
|
-
*
|
|
6057
|
-
*
|
|
6058
|
-
*
|
|
6062
|
+
* ScopeAliases are shorthand a caller may write for a provider scope
|
|
6063
|
+
* ("gmail.send" → "https://www.googleapis.com/auth/gmail.send"). They
|
|
6064
|
+
* are accepted on input only: credentials, capabilities and allowed
|
|
6065
|
+
* lists hold the provider's own name (Wire), and every comparison is
|
|
6066
|
+
* in that form. A scope with no alias is the provider's name as is.
|
|
6059
6067
|
*/
|
|
6060
6068
|
scope_aliases?: {
|
|
6061
6069
|
[key: string]: string;
|
|
@@ -6103,7 +6111,7 @@ export interface AuthMethod {
|
|
|
6103
6111
|
* re-authorizing for more scopes, whatever the caller asked for: the
|
|
6104
6112
|
* scopes the identity lookup and token refresh need (Google's openid,
|
|
6105
6113
|
* email and profile; X's users.read and offline.access). In the
|
|
6106
|
-
*
|
|
6114
|
+
* provider's own names, like Scopes. Empty = only what was asked for.
|
|
6107
6115
|
*/
|
|
6108
6116
|
required_scopes?: string[];
|
|
6109
6117
|
/**
|
|
@@ -6422,6 +6430,11 @@ export interface ChatRunEvent {
|
|
|
6422
6430
|
run_id: string;
|
|
6423
6431
|
state: AgentRunState;
|
|
6424
6432
|
reason?: RunEndReason;
|
|
6433
|
+
/**
|
|
6434
|
+
* DurationMs is how long the run took, from its start to its end. The
|
|
6435
|
+
* event message's created_at is when it ended.
|
|
6436
|
+
*/
|
|
6437
|
+
duration_ms?: number;
|
|
6425
6438
|
}
|
|
6426
6439
|
/**
|
|
6427
6440
|
* ChatEvent is the payload of an event-role message: system info shown in the
|
|
@@ -6446,6 +6459,11 @@ export interface ChatHookEvent {
|
|
|
6446
6459
|
decision?: HookDecision;
|
|
6447
6460
|
reason?: string;
|
|
6448
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[];
|
|
6449
6467
|
error?: string;
|
|
6450
6468
|
duration_ms: number;
|
|
6451
6469
|
}
|
|
@@ -8070,21 +8088,21 @@ export declare const HookHandlerBuiltin: HookHandlerType;
|
|
|
8070
8088
|
* agent config is validated against it, and clients enumerate it to show what
|
|
8071
8089
|
* an agent can switch on without hosting anything.
|
|
8072
8090
|
*/
|
|
8073
|
-
export type BuiltinHook = "
|
|
8091
|
+
export type BuiltinHook = "suggest" | "extract";
|
|
8074
8092
|
/**
|
|
8075
|
-
*
|
|
8093
|
+
* BuiltinHookSuggest searches the team's skills, knowledge and apps
|
|
8076
8094
|
* for what the turn is about and injects the matches, so an agent picks up
|
|
8077
8095
|
* procedural knowledge it was never prompted with.
|
|
8078
8096
|
*/
|
|
8079
|
-
export declare const
|
|
8097
|
+
export declare const BuiltinHookSuggest: BuiltinHook;
|
|
8080
8098
|
/**
|
|
8081
|
-
*
|
|
8099
|
+
* BuiltinHookExtract reviews the conversation for reusable knowledge
|
|
8082
8100
|
* and saves it to the team's registry, deduplicated against what is
|
|
8083
|
-
* there, so
|
|
8101
|
+
* there, so suggest can hand it back later. It runs in the
|
|
8084
8102
|
* background: on agent.complete every tenth user turn, and before
|
|
8085
8103
|
* compaction drops the turns it would have learned from.
|
|
8086
8104
|
*/
|
|
8087
|
-
export declare const
|
|
8105
|
+
export declare const BuiltinHookExtract: BuiltinHook;
|
|
8088
8106
|
/**
|
|
8089
8107
|
* BuiltinHookDefinition describes a builtin hook and where it may be used.
|
|
8090
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
|
-
*
|
|
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";
|