@inferencesh/sdk 0.14.1 → 0.14.2
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 +9 -0
- package/dist/hook-builder.d.ts +14 -1
- package/dist/hook-builder.js +26 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types.d.ts +36 -1
- package/dist/types.js +15 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.14.2] - 2026-10-01
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Instance types: `InstanceRentalType` (`on_demand`, `spot`), `rental_type` on availability and engine-picker offers, `hourly_price` on spot entries.
|
|
15
|
+
- `lifecycleHook(event).builtin(name)` for hooks the platform runs itself.
|
|
16
|
+
- `learningHooks({ suggest, learn })`: `suggest` adds the team's matching skills, knowledge and apps to context before each turn (`belt:suggest`); `learn` saves reusable knowledge from the conversation to the team's registry every 10th user turn and before compaction (`belt:extract`). Both are off unless set.
|
|
17
|
+
- `BuiltinHookBeltExtract`.
|
|
18
|
+
|
|
10
19
|
## [0.14.1] - 2026-10-01
|
|
11
20
|
|
|
12
21
|
### Added
|
package/dist/hook-builder.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hook Builder - Fluent API for defining lifecycle hooks
|
|
3
3
|
*/
|
|
4
|
-
import { LifecycleHookConfig, HookEvent } from './types';
|
|
4
|
+
import { LifecycleHookConfig, HookEvent, BuiltinHook } from './types';
|
|
5
5
|
export declare class LifecycleHookBuilder {
|
|
6
6
|
private event;
|
|
7
7
|
private handlerType;
|
|
@@ -13,6 +13,8 @@ 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) */
|
|
17
|
+
builtin(name: BuiltinHook): this;
|
|
16
18
|
/** Set async execution */
|
|
17
19
|
async(enabled: boolean): this;
|
|
18
20
|
/** Set handler timeout in seconds */
|
|
@@ -21,3 +23,14 @@ export declare class LifecycleHookBuilder {
|
|
|
21
23
|
}
|
|
22
24
|
/** Create a lifecycle hook for an agent event */
|
|
23
25
|
export declare const lifecycleHook: (event: HookEvent) => LifecycleHookBuilder;
|
|
26
|
+
/**
|
|
27
|
+
* The built-in learning hooks, attached to the events each one runs on.
|
|
28
|
+
* - `suggest`: before each turn, add the team's matching skills, knowledge and apps to context.
|
|
29
|
+
* - `learn`: every 10th user turn and before compaction, save reusable knowledge from the
|
|
30
|
+
* conversation to the team's registry, deduplicated. Runs on the agent's own model, and only
|
|
31
|
+
* for chats by the agent's owning team.
|
|
32
|
+
*/
|
|
33
|
+
export declare function learningHooks(opts: {
|
|
34
|
+
suggest?: boolean;
|
|
35
|
+
learn?: boolean;
|
|
36
|
+
}): LifecycleHookConfig[];
|
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 } from './types';
|
|
4
|
+
import { HookHandlerWebhook, HookHandlerTask, HookHandlerBuiltin, BuiltinHookBeltSuggest, BuiltinHookBeltExtract, HookEventTurnStart, HookEventAgentComplete, HookEventPreCompact, } from './types';
|
|
5
5
|
// =============================================================================
|
|
6
6
|
// Hook Builder
|
|
7
7
|
// =============================================================================
|
|
@@ -23,6 +23,12 @@ 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) */
|
|
27
|
+
builtin(name) {
|
|
28
|
+
this.handlerType = HookHandlerBuiltin;
|
|
29
|
+
this.handlerRef = name;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
26
32
|
/** Set async execution */
|
|
27
33
|
async(enabled) {
|
|
28
34
|
this.isAsync = enabled;
|
|
@@ -48,3 +54,22 @@ export class LifecycleHookBuilder {
|
|
|
48
54
|
// =============================================================================
|
|
49
55
|
/** Create a lifecycle hook for an agent event */
|
|
50
56
|
export const lifecycleHook = (event) => new LifecycleHookBuilder(event);
|
|
57
|
+
/**
|
|
58
|
+
* The built-in learning hooks, attached to the events each one runs on.
|
|
59
|
+
* - `suggest`: before each turn, add the team's matching skills, knowledge and apps to context.
|
|
60
|
+
* - `learn`: every 10th user turn and before compaction, save reusable knowledge from the
|
|
61
|
+
* conversation to the team's registry, deduplicated. Runs on the agent's own model, and only
|
|
62
|
+
* for chats by the agent's owning team.
|
|
63
|
+
*/
|
|
64
|
+
export function learningHooks(opts) {
|
|
65
|
+
const hooks = [];
|
|
66
|
+
if (opts.suggest) {
|
|
67
|
+
hooks.push(lifecycleHook(HookEventTurnStart).builtin(BuiltinHookBeltSuggest).build());
|
|
68
|
+
}
|
|
69
|
+
if (opts.learn) {
|
|
70
|
+
for (const event of [HookEventAgentComplete, HookEventPreCompact]) {
|
|
71
|
+
hooks.push(lifecycleHook(event).builtin(BuiltinHookBeltExtract).build());
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return hooks;
|
|
75
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export { isLiveField, parseMediaType, pcmFormat, splitLiveSchema, binaryLiveFiel
|
|
|
31
31
|
export type { JsonSchema, MediaType, PCMFormat, LiveField } from './live/schema';
|
|
32
32
|
export { tool, appTool, agentTool, webhookTool, httpTool, callTool, mcpTool, internalTools, string, number, integer, boolean, enumOf, object, array, optional, } from './tool-builder';
|
|
33
33
|
export type { ClientTool, ClientToolHandler } from './tool-builder';
|
|
34
|
-
export { lifecycleHook } from './hook-builder';
|
|
34
|
+
export { lifecycleHook, learningHooks } from './hook-builder';
|
|
35
35
|
export type { LifecycleHookBuilder } from './hook-builder';
|
|
36
36
|
export { DeltaAccumulator, createLLMDeltaAccumulator, type DeltaEvent, type FieldTags, type FieldTagsRegistry } from './delta';
|
|
37
37
|
export { parseStatus, isTerminalStatus, isChatBusy, isAwaitingHuman, isRunTerminal, isRunInterrupted, isRunSettled, isRunWorking, isMessageTerminal, pendingApprovals, } from './utils';
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ export { isLiveField, parseMediaType, pcmFormat, splitLiveSchema, binaryLiveFiel
|
|
|
33
33
|
// Tool Builder (fluent API)
|
|
34
34
|
export { tool, appTool, agentTool, webhookTool, httpTool, callTool, mcpTool, internalTools, string, number, integer, boolean, enumOf, object, array, optional, } from './tool-builder';
|
|
35
35
|
// Hook Builder (fluent API)
|
|
36
|
-
export { lifecycleHook } from './hook-builder';
|
|
36
|
+
export { lifecycleHook, learningHooks } from './hook-builder';
|
|
37
37
|
// Delta accumulator for streaming responses
|
|
38
38
|
export { DeltaAccumulator, createLLMDeltaAccumulator } from './delta';
|
|
39
39
|
// Status utilities (handle both int and string status values)
|
package/dist/types.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export interface InternalToolsConfig {
|
|
|
7
7
|
widget?: boolean;
|
|
8
8
|
finish?: boolean;
|
|
9
9
|
skills?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Deprecated: ignored. Host context is disabled until embed context has a
|
|
12
|
+
* replacement; agents are never offered get_host_context or send_to_host.
|
|
13
|
+
*/
|
|
10
14
|
host_context?: boolean;
|
|
11
15
|
meta?: boolean;
|
|
12
16
|
artifact?: boolean;
|
|
@@ -2498,6 +2502,7 @@ export interface InstanceDTO extends BaseModelDTO, PermissionModelDTO {
|
|
|
2498
2502
|
status: InstanceStatus;
|
|
2499
2503
|
cost_estimate: string;
|
|
2500
2504
|
hourly_price: number;
|
|
2505
|
+
rental_type?: InstanceRentalType;
|
|
2501
2506
|
template_id?: string;
|
|
2502
2507
|
volume_ids?: string[];
|
|
2503
2508
|
tags?: string[];
|
|
@@ -2519,6 +2524,11 @@ export interface InstanceTypeDTO extends BaseModelDTO, PermissionModelDTO {
|
|
|
2519
2524
|
cloud_instance_type: string;
|
|
2520
2525
|
deployment_type: InstanceTypeDeploymentType;
|
|
2521
2526
|
hourly_price: number;
|
|
2527
|
+
/**
|
|
2528
|
+
* RentalType is set on engine-picker offers: Region and HourlyPrice are
|
|
2529
|
+
* for this rental type. Empty on the raw catalog.
|
|
2530
|
+
*/
|
|
2531
|
+
rental_type?: InstanceRentalType;
|
|
2522
2532
|
configuration?: InstanceTypeConfiguration;
|
|
2523
2533
|
availability: InstanceTypeAvailability[];
|
|
2524
2534
|
boot_time?: InstanceTypeBootTime;
|
|
@@ -2538,6 +2548,11 @@ export interface InstanceTypeConfiguration {
|
|
|
2538
2548
|
export interface InstanceTypeAvailability {
|
|
2539
2549
|
available: boolean;
|
|
2540
2550
|
region: string;
|
|
2551
|
+
rental_type?: InstanceRentalType;
|
|
2552
|
+
/**
|
|
2553
|
+
* HourlyPrice is the spot price in cents, set on spot entries only.
|
|
2554
|
+
*/
|
|
2555
|
+
hourly_price?: number;
|
|
2541
2556
|
}
|
|
2542
2557
|
export interface InstanceTypeBootTime {
|
|
2543
2558
|
average_seconds: number;
|
|
@@ -4785,6 +4800,13 @@ export type InstanceTypeDeploymentType = "vm" | "container" | "baremetal";
|
|
|
4785
4800
|
export declare const InstanceTypeDeploymentTypeVM: InstanceTypeDeploymentType;
|
|
4786
4801
|
export declare const InstanceTypeDeploymentTypeContainer: InstanceTypeDeploymentType;
|
|
4787
4802
|
export declare const InstanceTypeDeploymentTypeBaremetal: InstanceTypeDeploymentType;
|
|
4803
|
+
/**
|
|
4804
|
+
* InstanceRentalType is how a Shadeform instance is rented. Spot is discounted
|
|
4805
|
+
* but can be reclaimed at any time.
|
|
4806
|
+
*/
|
|
4807
|
+
export type InstanceRentalType = "on_demand" | "spot";
|
|
4808
|
+
export declare const InstanceRentalTypeOnDemand: InstanceRentalType;
|
|
4809
|
+
export declare const InstanceRentalTypeSpot: InstanceRentalType;
|
|
4788
4810
|
export type AppSessionStatus = "active" | "ended" | "expired";
|
|
4789
4811
|
export declare const AppSessionStatusActive: AppSessionStatus;
|
|
4790
4812
|
export declare const AppSessionStatusEnded: AppSessionStatus;
|
|
@@ -5579,8 +5601,21 @@ export declare const HookHandlerBuiltin: HookHandlerType;
|
|
|
5579
5601
|
* agent config is validated against it, and clients enumerate it to show what
|
|
5580
5602
|
* an agent can switch on without hosting anything.
|
|
5581
5603
|
*/
|
|
5582
|
-
export type BuiltinHook = "belt:suggest";
|
|
5604
|
+
export type BuiltinHook = "belt:suggest" | "belt:extract";
|
|
5605
|
+
/**
|
|
5606
|
+
* BuiltinHookBeltSuggest searches the team's skills, knowledge and apps
|
|
5607
|
+
* for what the turn is about and injects the matches, so an agent picks up
|
|
5608
|
+
* procedural knowledge it was never prompted with.
|
|
5609
|
+
*/
|
|
5583
5610
|
export declare const BuiltinHookBeltSuggest: BuiltinHook;
|
|
5611
|
+
/**
|
|
5612
|
+
* BuiltinHookBeltExtract reviews the conversation for reusable knowledge
|
|
5613
|
+
* and saves it to the team's registry, deduplicated against what is
|
|
5614
|
+
* there, so belt:suggest can hand it back later. It runs in the
|
|
5615
|
+
* background: on agent.complete every tenth user turn, and before
|
|
5616
|
+
* compaction drops the turns it would have learned from.
|
|
5617
|
+
*/
|
|
5618
|
+
export declare const BuiltinHookBeltExtract: BuiltinHook;
|
|
5584
5619
|
/**
|
|
5585
5620
|
* BuiltinHookDefinition describes a builtin hook and where it may be used.
|
|
5586
5621
|
*/
|
package/dist/types.js
CHANGED
|
@@ -734,6 +734,8 @@ export const InstanceStatusDeleted = "deleted";
|
|
|
734
734
|
export const InstanceTypeDeploymentTypeVM = "vm";
|
|
735
735
|
export const InstanceTypeDeploymentTypeContainer = "container";
|
|
736
736
|
export const InstanceTypeDeploymentTypeBaremetal = "baremetal";
|
|
737
|
+
export const InstanceRentalTypeOnDemand = "on_demand";
|
|
738
|
+
export const InstanceRentalTypeSpot = "spot";
|
|
737
739
|
export const AppSessionStatusActive = "active";
|
|
738
740
|
export const AppSessionStatusEnded = "ended";
|
|
739
741
|
export const AppSessionStatusExpired = "expired";
|
|
@@ -1201,7 +1203,20 @@ export const HookHandlerWebhook = "webhook";
|
|
|
1201
1203
|
export const HookHandlerTask = "task";
|
|
1202
1204
|
export const HookHandlerGate = "gate";
|
|
1203
1205
|
export const HookHandlerBuiltin = "builtin";
|
|
1206
|
+
/**
|
|
1207
|
+
* BuiltinHookBeltSuggest searches the team's skills, knowledge and apps
|
|
1208
|
+
* for what the turn is about and injects the matches, so an agent picks up
|
|
1209
|
+
* procedural knowledge it was never prompted with.
|
|
1210
|
+
*/
|
|
1204
1211
|
export const BuiltinHookBeltSuggest = "belt:suggest";
|
|
1212
|
+
/**
|
|
1213
|
+
* BuiltinHookBeltExtract reviews the conversation for reusable knowledge
|
|
1214
|
+
* and saves it to the team's registry, deduplicated against what is
|
|
1215
|
+
* there, so belt:suggest can hand it back later. It runs in the
|
|
1216
|
+
* background: on agent.complete every tenth user turn, and before
|
|
1217
|
+
* compaction drops the turns it would have learned from.
|
|
1218
|
+
*/
|
|
1219
|
+
export const BuiltinHookBeltExtract = "belt:extract";
|
|
1205
1220
|
export const ToolInvocationStatusPending = "pending";
|
|
1206
1221
|
export const ToolInvocationStatusInProgress = "in_progress";
|
|
1207
1222
|
export const ToolInvocationStatusAwaitingInput = "awaiting_input";
|