@advicenxt/sbp-types 0.1.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/README.md +32 -0
- package/dist/index.d.ts +234 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @advicenxt/sbp-types
|
|
2
|
+
|
|
3
|
+
Canonical type definitions for the **Stigmergic Blackboard Protocol (SBP)** v0.1.
|
|
4
|
+
|
|
5
|
+
This package provides the shared type interfaces used across all SBP implementations — server, TypeScript client, and third-party libraries.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @advicenxt/sbp-types
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type {
|
|
17
|
+
Pheromone,
|
|
18
|
+
DecayModel,
|
|
19
|
+
ScentCondition,
|
|
20
|
+
EmitParams,
|
|
21
|
+
SniffResult
|
|
22
|
+
} from "@advicenxt/sbp-types";
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## What's Included
|
|
26
|
+
|
|
27
|
+
- **Decay Models** — `ExponentialDecay`, `LinearDecay`, `StepDecay`, `ImmortalDecay`
|
|
28
|
+
- **Data Types** — `Pheromone`, `PheromoneSnapshot`, `TagFilter`
|
|
29
|
+
- **Conditions** — `ThresholdCondition`, `CompositeCondition`, `RateCondition`, `PatternCondition`
|
|
30
|
+
- **Operations** — All params/result types for emit, sniff, register, deregister, evaporate, inspect
|
|
31
|
+
- **JSON-RPC** — Request, response, and error types
|
|
32
|
+
- **Error Codes** — `SBP_ERROR_CODES` constant and `SbpError` class
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @advicenxt/sbp-types — Canonical Type Definitions
|
|
3
|
+
* Stigmergic Blackboard Protocol v0.1
|
|
4
|
+
*
|
|
5
|
+
* This package is the single source of truth for SBP types.
|
|
6
|
+
* Used by @advicenxt/sbp-server, @advicenxt/sbp-client, and third-party implementations.
|
|
7
|
+
*/
|
|
8
|
+
export interface ExponentialDecay {
|
|
9
|
+
type: "exponential";
|
|
10
|
+
half_life_ms: number;
|
|
11
|
+
}
|
|
12
|
+
export interface LinearDecay {
|
|
13
|
+
type: "linear";
|
|
14
|
+
rate_per_ms: number;
|
|
15
|
+
}
|
|
16
|
+
export interface StepDecay {
|
|
17
|
+
type: "step";
|
|
18
|
+
steps: Array<{
|
|
19
|
+
at_ms: number;
|
|
20
|
+
intensity: number;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
export interface ImmortalDecay {
|
|
24
|
+
type: "immortal";
|
|
25
|
+
}
|
|
26
|
+
export type DecayModel = ExponentialDecay | LinearDecay | StepDecay | ImmortalDecay;
|
|
27
|
+
export interface Pheromone {
|
|
28
|
+
id: string;
|
|
29
|
+
trail: string;
|
|
30
|
+
type: string;
|
|
31
|
+
emitted_at: number;
|
|
32
|
+
last_reinforced_at: number;
|
|
33
|
+
initial_intensity: number;
|
|
34
|
+
decay_model: DecayModel;
|
|
35
|
+
payload: Record<string, unknown>;
|
|
36
|
+
source_agent?: string;
|
|
37
|
+
tags: string[];
|
|
38
|
+
ttl_floor: number;
|
|
39
|
+
}
|
|
40
|
+
export interface PheromoneSnapshot {
|
|
41
|
+
id: string;
|
|
42
|
+
trail: string;
|
|
43
|
+
type: string;
|
|
44
|
+
current_intensity: number;
|
|
45
|
+
payload: Record<string, unknown>;
|
|
46
|
+
age_ms: number;
|
|
47
|
+
tags: string[];
|
|
48
|
+
}
|
|
49
|
+
export interface TagFilter {
|
|
50
|
+
any?: string[];
|
|
51
|
+
all?: string[];
|
|
52
|
+
none?: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface ThresholdCondition {
|
|
55
|
+
type: "threshold";
|
|
56
|
+
trail: string;
|
|
57
|
+
signal_type: string;
|
|
58
|
+
tags?: TagFilter;
|
|
59
|
+
aggregation: "sum" | "max" | "avg" | "count" | "any";
|
|
60
|
+
operator: ">=" | ">" | "<=" | "<" | "==" | "!=";
|
|
61
|
+
value: number;
|
|
62
|
+
}
|
|
63
|
+
export interface CompositeCondition {
|
|
64
|
+
type: "composite";
|
|
65
|
+
operator: "and" | "or" | "not";
|
|
66
|
+
conditions: ScentCondition[];
|
|
67
|
+
}
|
|
68
|
+
export interface RateCondition {
|
|
69
|
+
type: "rate";
|
|
70
|
+
trail: string;
|
|
71
|
+
signal_type: string;
|
|
72
|
+
metric: "emissions_per_second" | "intensity_delta";
|
|
73
|
+
window_ms: number;
|
|
74
|
+
operator: ">=" | ">" | "<=" | "<";
|
|
75
|
+
value: number;
|
|
76
|
+
}
|
|
77
|
+
export interface PatternCondition {
|
|
78
|
+
type: "pattern";
|
|
79
|
+
sequence: Array<{
|
|
80
|
+
trail: string;
|
|
81
|
+
signal_type: string;
|
|
82
|
+
min_intensity?: number;
|
|
83
|
+
}>;
|
|
84
|
+
window_ms: number;
|
|
85
|
+
ordered?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export type ScentCondition = ThresholdCondition | CompositeCondition | RateCondition | PatternCondition;
|
|
88
|
+
export type MergeStrategy = "reinforce" | "replace" | "max" | "add" | "new";
|
|
89
|
+
export type TriggerMode = "level" | "edge_rising" | "edge_falling";
|
|
90
|
+
export interface EmitParams {
|
|
91
|
+
trail: string;
|
|
92
|
+
type: string;
|
|
93
|
+
intensity: number;
|
|
94
|
+
decay?: DecayModel;
|
|
95
|
+
payload?: Record<string, unknown>;
|
|
96
|
+
tags?: string[];
|
|
97
|
+
merge_strategy?: MergeStrategy;
|
|
98
|
+
source_agent?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface EmitResult {
|
|
101
|
+
pheromone_id: string;
|
|
102
|
+
action: "created" | "reinforced" | "replaced" | "merged";
|
|
103
|
+
previous_intensity?: number;
|
|
104
|
+
new_intensity: number;
|
|
105
|
+
}
|
|
106
|
+
export interface SniffParams {
|
|
107
|
+
trails?: string[];
|
|
108
|
+
types?: string[];
|
|
109
|
+
min_intensity?: number;
|
|
110
|
+
max_age_ms?: number;
|
|
111
|
+
tags?: TagFilter;
|
|
112
|
+
limit?: number;
|
|
113
|
+
include_evaporated?: boolean;
|
|
114
|
+
}
|
|
115
|
+
export interface AggregateStats {
|
|
116
|
+
count: number;
|
|
117
|
+
sum_intensity: number;
|
|
118
|
+
max_intensity: number;
|
|
119
|
+
avg_intensity: number;
|
|
120
|
+
}
|
|
121
|
+
export interface SniffResult {
|
|
122
|
+
timestamp: number;
|
|
123
|
+
pheromones: PheromoneSnapshot[];
|
|
124
|
+
aggregates: Record<string, AggregateStats>;
|
|
125
|
+
}
|
|
126
|
+
export interface RegisterScentParams {
|
|
127
|
+
scent_id: string;
|
|
128
|
+
agent_endpoint: string;
|
|
129
|
+
condition: ScentCondition;
|
|
130
|
+
cooldown_ms?: number;
|
|
131
|
+
activation_payload?: Record<string, unknown>;
|
|
132
|
+
trigger_mode?: TriggerMode;
|
|
133
|
+
hysteresis?: number;
|
|
134
|
+
max_execution_ms?: number;
|
|
135
|
+
context_trails?: string[];
|
|
136
|
+
}
|
|
137
|
+
export interface RegisterScentResult {
|
|
138
|
+
scent_id: string;
|
|
139
|
+
status: "registered" | "updated";
|
|
140
|
+
current_condition_state: {
|
|
141
|
+
met: boolean;
|
|
142
|
+
partial?: Record<string, boolean>;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
export interface DeregisterScentParams {
|
|
146
|
+
scent_id: string;
|
|
147
|
+
}
|
|
148
|
+
export interface DeregisterScentResult {
|
|
149
|
+
scent_id: string;
|
|
150
|
+
status: "deregistered" | "not_found";
|
|
151
|
+
}
|
|
152
|
+
export interface TriggerPayload {
|
|
153
|
+
scent_id: string;
|
|
154
|
+
triggered_at: number;
|
|
155
|
+
condition_snapshot: Record<string, {
|
|
156
|
+
value: number;
|
|
157
|
+
pheromone_ids: string[];
|
|
158
|
+
}>;
|
|
159
|
+
context_pheromones: PheromoneSnapshot[];
|
|
160
|
+
activation_payload: Record<string, unknown>;
|
|
161
|
+
}
|
|
162
|
+
export interface EvaporateParams {
|
|
163
|
+
trail?: string;
|
|
164
|
+
types?: string[];
|
|
165
|
+
older_than_ms?: number;
|
|
166
|
+
below_intensity?: number;
|
|
167
|
+
tags?: TagFilter;
|
|
168
|
+
}
|
|
169
|
+
export interface EvaporateResult {
|
|
170
|
+
evaporated_count: number;
|
|
171
|
+
trails_affected: string[];
|
|
172
|
+
}
|
|
173
|
+
export interface InspectParams {
|
|
174
|
+
include?: Array<"trails" | "scents" | "stats">;
|
|
175
|
+
}
|
|
176
|
+
export interface TrailInfo {
|
|
177
|
+
name: string;
|
|
178
|
+
pheromone_count: number;
|
|
179
|
+
total_intensity: number;
|
|
180
|
+
avg_intensity: number;
|
|
181
|
+
}
|
|
182
|
+
export interface ScentInfo {
|
|
183
|
+
scent_id: string;
|
|
184
|
+
agent_endpoint: string;
|
|
185
|
+
condition_met: boolean;
|
|
186
|
+
in_cooldown: boolean;
|
|
187
|
+
last_triggered_at: number | null;
|
|
188
|
+
}
|
|
189
|
+
export interface InspectResult {
|
|
190
|
+
timestamp: number;
|
|
191
|
+
trails?: TrailInfo[];
|
|
192
|
+
scents?: ScentInfo[];
|
|
193
|
+
stats?: {
|
|
194
|
+
total_pheromones: number;
|
|
195
|
+
active_pheromones: number;
|
|
196
|
+
total_scents: number;
|
|
197
|
+
uptime_ms: number;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
export interface JsonRpcRequest<T = unknown> {
|
|
201
|
+
jsonrpc: "2.0";
|
|
202
|
+
id: string | number;
|
|
203
|
+
method: string;
|
|
204
|
+
params: T;
|
|
205
|
+
}
|
|
206
|
+
export interface JsonRpcSuccessResponse<T = unknown> {
|
|
207
|
+
jsonrpc: "2.0";
|
|
208
|
+
id: string | number;
|
|
209
|
+
result: T;
|
|
210
|
+
}
|
|
211
|
+
export interface JsonRpcErrorResponse {
|
|
212
|
+
jsonrpc: "2.0";
|
|
213
|
+
id: string | number | null;
|
|
214
|
+
error: {
|
|
215
|
+
code: number;
|
|
216
|
+
message: string;
|
|
217
|
+
data?: unknown;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export type JsonRpcResponse<T = unknown> = JsonRpcSuccessResponse<T> | JsonRpcErrorResponse;
|
|
221
|
+
export declare const SBP_ERROR_CODES: {
|
|
222
|
+
readonly TRAIL_NOT_FOUND: -32001;
|
|
223
|
+
readonly SCENT_NOT_FOUND: -32002;
|
|
224
|
+
readonly PAYLOAD_VALIDATION_FAILED: -32003;
|
|
225
|
+
readonly RATE_LIMITED: -32004;
|
|
226
|
+
readonly UNAUTHORIZED: -32005;
|
|
227
|
+
readonly INVALID_CONDITION: -32006;
|
|
228
|
+
};
|
|
229
|
+
export declare class SbpError extends Error {
|
|
230
|
+
code: number;
|
|
231
|
+
data?: unknown | undefined;
|
|
232
|
+
constructor(code: number, message: string, data?: unknown | undefined);
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EA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AAED,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,OAAO,IAAI,sBAAsB,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC;AAM5F,eAAO,MAAM,eAAe;;;;;;;CAOlB,CAAC;AAEX,qBAAa,QAAS,SAAQ,KAAK;IAEpB,IAAI,EAAE,MAAM;IAEZ,IAAI,CAAC,EAAE,OAAO;gBAFd,IAAI,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACR,IAAI,CAAC,EAAE,OAAO,YAAA;CAK5B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @advicenxt/sbp-types — Canonical Type Definitions
|
|
3
|
+
* Stigmergic Blackboard Protocol v0.1
|
|
4
|
+
*
|
|
5
|
+
* This package is the single source of truth for SBP types.
|
|
6
|
+
* Used by @advicenxt/sbp-server, @advicenxt/sbp-client, and third-party implementations.
|
|
7
|
+
*/
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// ERROR CODES
|
|
10
|
+
// ============================================================================
|
|
11
|
+
export const SBP_ERROR_CODES = {
|
|
12
|
+
TRAIL_NOT_FOUND: -32001,
|
|
13
|
+
SCENT_NOT_FOUND: -32002,
|
|
14
|
+
PAYLOAD_VALIDATION_FAILED: -32003,
|
|
15
|
+
RATE_LIMITED: -32004,
|
|
16
|
+
UNAUTHORIZED: -32005,
|
|
17
|
+
INVALID_CONDITION: -32006,
|
|
18
|
+
};
|
|
19
|
+
export class SbpError extends Error {
|
|
20
|
+
code;
|
|
21
|
+
data;
|
|
22
|
+
constructor(code, message, data) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.code = code;
|
|
25
|
+
this.data = data;
|
|
26
|
+
this.name = "SbpError";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+QH,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,eAAe,EAAE,CAAC,KAAK;IACvB,eAAe,EAAE,CAAC,KAAK;IACvB,yBAAyB,EAAE,CAAC,KAAK;IACjC,YAAY,EAAE,CAAC,KAAK;IACpB,YAAY,EAAE,CAAC,KAAK;IACpB,iBAAiB,EAAE,CAAC,KAAK;CACnB,CAAC;AAEX,MAAM,OAAO,QAAS,SAAQ,KAAK;IAEpB;IAEA;IAHX,YACW,IAAY,EACnB,OAAe,EACR,IAAc;QAErB,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,SAAI,GAAJ,IAAI,CAAQ;QAEZ,SAAI,GAAJ,IAAI,CAAU;QAGrB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IAC3B,CAAC;CACJ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@advicenxt/sbp-types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Canonical type definitions for the Stigmergic Blackboard Protocol (SBP)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"clean": "rimraf dist"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"sbp",
|
|
24
|
+
"stigmergy",
|
|
25
|
+
"pheromone",
|
|
26
|
+
"blackboard",
|
|
27
|
+
"protocol",
|
|
28
|
+
"types"
|
|
29
|
+
],
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"author": "adviceNXT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/AdviceNXT/sbp",
|
|
35
|
+
"directory": "packages/types"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://sbp.dev",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/AdviceNXT/sbp/issues"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"typescript": "^5.3.0"
|
|
43
|
+
}
|
|
44
|
+
}
|