@forbocai/core 0.6.1 → 0.6.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/dist/index.d.mts CHANGED
@@ -37,6 +37,7 @@ interface MemoryItem {
37
37
  timestamp: number;
38
38
  type: string;
39
39
  importance: number;
40
+ similarity?: number;
40
41
  }
41
42
  interface IMemory {
42
43
  store(text: string, type?: string, importance?: number): Promise<MemoryItem>;
@@ -121,6 +122,95 @@ interface VerdictResponse {
121
122
  action?: NPCAction;
122
123
  dialogue: string;
123
124
  }
125
+ /**
126
+ * User Story: As the SDK runtime, I need one accumulated "tape" payload that
127
+ * is echoed to the API each turn so orchestration remains stateless.
128
+ * ᚠ the tape hums like a cold star map passed hand to hand in the dark.
129
+ */
130
+ interface ProcessTape {
131
+ observation: string;
132
+ context: Record<string, unknown>;
133
+ npcState: Record<string, unknown>;
134
+ persona?: string;
135
+ actor?: {
136
+ npcId: string;
137
+ persona: string;
138
+ data?: Record<string, unknown>;
139
+ };
140
+ memories: RecalledMemory[];
141
+ prompt?: string;
142
+ constraints?: PromptConstraints;
143
+ generatedOutput?: string;
144
+ rulesetId?: string;
145
+ vectorQueried?: boolean;
146
+ }
147
+ /**
148
+ * User Story: As the API orchestrator, I need the SDK to perform actor lookup
149
+ * as an explicit atomic side-effect.
150
+ * A tiny identity ping echoes through the hull before the engines spin.
151
+ */
152
+ interface IdentifyActorInstruction {
153
+ type: 'IdentifyActor';
154
+ }
155
+ /**
156
+ * User Story: As the API orchestrator, I need vector recall to be an explicit
157
+ * instruction with concrete query parameters.
158
+ * ᚢ one sharp memory sweep, like scanning ruins with a single beam.
159
+ */
160
+ interface QueryVectorInstruction {
161
+ type: 'QueryVector';
162
+ query: string;
163
+ limit: number;
164
+ threshold: number;
165
+ }
166
+ /**
167
+ * User Story: As the API orchestrator, I need local inference to execute from
168
+ * an API-provided prompt and constraints with zero SDK initiative.
169
+ * The body stays quiet and obedient while the mind scripts the pulse.
170
+ */
171
+ interface ExecuteInferenceInstruction {
172
+ type: 'ExecuteInference';
173
+ prompt: string;
174
+ constraints: PromptConstraints;
175
+ }
176
+ /**
177
+ * User Story: As the API orchestrator, I need a terminal instruction that
178
+ * carries validated output plus persistence instructions for the SDK.
179
+ * ᚱ this is the seal at the airlock when the cycle clicks shut.
180
+ */
181
+ interface FinalizeInstruction {
182
+ type: 'Finalize';
183
+ valid: boolean;
184
+ signature?: string;
185
+ memoryStore: MemoryStoreInstruction[];
186
+ stateTransform: Record<string, unknown>;
187
+ action?: NPCAction;
188
+ dialogue: string;
189
+ }
190
+ /**
191
+ * User Story: As protocol typing, I need one discriminated union for atomic
192
+ * instructions so handler dispatch is deterministic.
193
+ * Every branch gets its own rune and none of the wires pretend to be another.
194
+ */
195
+ type NPCInstruction = IdentifyActorInstruction | QueryVectorInstruction | ExecuteInferenceInstruction | FinalizeInstruction;
196
+ /**
197
+ * User Story: As the API loop transport, I need request shape consistency for
198
+ * the full tape and previous side-effect result.
199
+ * The packet stays rigid so the void between hops does not eat context.
200
+ */
201
+ interface NPCProcessRequest {
202
+ tape: ProcessTape;
203
+ lastResult?: Record<string, unknown>;
204
+ }
205
+ /**
206
+ * User Story: As the SDK interpreter, I need the next instruction packaged
207
+ * with the updated tape every round-trip.
208
+ * ᚲ each return frame is one breadcrumb and one command rune forward.
209
+ */
210
+ interface NPCProcessResponse {
211
+ instruction: NPCInstruction;
212
+ tape: ProcessTape;
213
+ }
124
214
 
125
215
  interface ValidationContext {
126
216
  npcState?: Record<string, unknown>;
@@ -1071,6 +1161,12 @@ declare const selectNPCById: (state: {
1071
1161
  apiUrl: string;
1072
1162
  apiKey?: string;
1073
1163
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
1164
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
1165
+ npcId: string;
1166
+ request: NPCProcessRequest;
1167
+ apiUrl: string;
1168
+ apiKey?: string;
1169
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
1074
1170
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
1075
1171
  npcId: string;
1076
1172
  request: DirectiveRequest;
@@ -1273,6 +1369,12 @@ declare const selectNPCIds: (state: {
1273
1369
  apiUrl: string;
1274
1370
  apiKey?: string;
1275
1371
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
1372
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
1373
+ npcId: string;
1374
+ request: NPCProcessRequest;
1375
+ apiUrl: string;
1376
+ apiKey?: string;
1377
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
1276
1378
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
1277
1379
  npcId: string;
1278
1380
  request: DirectiveRequest;
@@ -1464,6 +1566,12 @@ declare const selectNPCEntities: (state: {
1464
1566
  apiUrl: string;
1465
1567
  apiKey?: string;
1466
1568
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
1569
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
1570
+ npcId: string;
1571
+ request: NPCProcessRequest;
1572
+ apiUrl: string;
1573
+ apiKey?: string;
1574
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
1467
1575
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
1468
1576
  npcId: string;
1469
1577
  request: DirectiveRequest;
@@ -1655,6 +1763,12 @@ declare const selectAllNPCs: (state: {
1655
1763
  apiUrl: string;
1656
1764
  apiKey?: string;
1657
1765
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
1766
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
1767
+ npcId: string;
1768
+ request: NPCProcessRequest;
1769
+ apiUrl: string;
1770
+ apiKey?: string;
1771
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
1658
1772
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
1659
1773
  npcId: string;
1660
1774
  request: DirectiveRequest;
@@ -1846,6 +1960,12 @@ declare const selectTotalNPCs: (state: {
1846
1960
  apiUrl: string;
1847
1961
  apiKey?: string;
1848
1962
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
1963
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
1964
+ npcId: string;
1965
+ request: NPCProcessRequest;
1966
+ apiUrl: string;
1967
+ apiKey?: string;
1968
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
1849
1969
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
1850
1970
  npcId: string;
1851
1971
  request: DirectiveRequest;
@@ -2286,6 +2406,12 @@ declare const selectDirectiveById: (state: {
2286
2406
  apiUrl: string;
2287
2407
  apiKey?: string;
2288
2408
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
2409
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
2410
+ npcId: string;
2411
+ request: NPCProcessRequest;
2412
+ apiUrl: string;
2413
+ apiKey?: string;
2414
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
2289
2415
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
2290
2416
  npcId: string;
2291
2417
  request: DirectiveRequest;
@@ -2491,6 +2617,12 @@ declare const selectAllDirectives: (state: {
2491
2617
  apiUrl: string;
2492
2618
  apiKey?: string;
2493
2619
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
2620
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
2621
+ npcId: string;
2622
+ request: NPCProcessRequest;
2623
+ apiUrl: string;
2624
+ apiKey?: string;
2625
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
2494
2626
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
2495
2627
  npcId: string;
2496
2628
  request: DirectiveRequest;
@@ -2694,6 +2826,12 @@ declare const createSDKStore: <S extends ReducersMapObject>(extraReducers?: S) =
2694
2826
  apiUrl: string;
2695
2827
  apiKey?: string;
2696
2828
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
2829
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
2830
+ npcId: string;
2831
+ request: NPCProcessRequest;
2832
+ apiUrl: string;
2833
+ apiKey?: string;
2834
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
2697
2835
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
2698
2836
  npcId: string;
2699
2837
  request: DirectiveRequest;
@@ -2885,6 +3023,12 @@ declare const createSDKStore: <S extends ReducersMapObject>(extraReducers?: S) =
2885
3023
  apiUrl: string;
2886
3024
  apiKey?: string;
2887
3025
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
3026
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
3027
+ npcId: string;
3028
+ request: NPCProcessRequest;
3029
+ apiUrl: string;
3030
+ apiKey?: string;
3031
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
2888
3032
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
2889
3033
  npcId: string;
2890
3034
  request: DirectiveRequest;
@@ -3077,6 +3221,12 @@ declare const store: _reduxjs_toolkit.EnhancedStore<{
3077
3221
  apiUrl: string;
3078
3222
  apiKey?: string;
3079
3223
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
3224
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
3225
+ npcId: string;
3226
+ request: NPCProcessRequest;
3227
+ apiUrl: string;
3228
+ apiKey?: string;
3229
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
3080
3230
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
3081
3231
  npcId: string;
3082
3232
  request: DirectiveRequest;
@@ -3268,6 +3418,12 @@ declare const store: _reduxjs_toolkit.EnhancedStore<{
3268
3418
  apiUrl: string;
3269
3419
  apiKey?: string;
3270
3420
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
3421
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
3422
+ npcId: string;
3423
+ request: NPCProcessRequest;
3424
+ apiUrl: string;
3425
+ apiKey?: string;
3426
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
3271
3427
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
3272
3428
  npcId: string;
3273
3429
  request: DirectiveRequest;
@@ -3460,6 +3616,12 @@ declare const dispatch: ((action: redux.Action<"listenerMiddleware/add">) => _re
3460
3616
  apiUrl: string;
3461
3617
  apiKey?: string;
3462
3618
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
3619
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
3620
+ npcId: string;
3621
+ request: NPCProcessRequest;
3622
+ apiUrl: string;
3623
+ apiKey?: string;
3624
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
3463
3625
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
3464
3626
  npcId: string;
3465
3627
  request: DirectiveRequest;
@@ -3738,6 +3900,7 @@ declare const soulSlice: _reduxjs_toolkit.Slice<SoulState, {
3738
3900
  timestamp: number;
3739
3901
  type: string;
3740
3902
  importance: number;
3903
+ similarity?: number | undefined;
3741
3904
  }[];
3742
3905
  state: {
3743
3906
  [x: string]: unknown;
@@ -3757,6 +3920,7 @@ declare const soulSlice: _reduxjs_toolkit.Slice<SoulState, {
3757
3920
  timestamp: number;
3758
3921
  type: string;
3759
3922
  importance: number;
3923
+ similarity?: number | undefined;
3760
3924
  }[];
3761
3925
  state: {
3762
3926
  [x: string]: unknown;
@@ -3811,7 +3975,7 @@ declare const streamFromCortexWithDelay: (cortex: ICortex, prompt: string, onChu
3811
3975
  delayMs?: number;
3812
3976
  }) => Promise<string>;
3813
3977
 
3814
- declare const SDK_VERSION = "0.6.0";
3978
+ declare const SDK_VERSION = "0.6.1";
3815
3979
 
3816
3980
  /**
3817
3981
  * User Story: As NPC creation flows, I need lightweight id generation that
@@ -3846,6 +4010,17 @@ declare const sdkApi: _reduxjs_toolkit_query.Api<_reduxjs_toolkit_query.BaseQuer
3846
4010
  apiUrl: string;
3847
4011
  apiKey?: string;
3848
4012
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
4013
+ /**
4014
+ * User Story: As the SDK protocol loop, I need a single process endpoint
4015
+ * that returns one atomic instruction per turn while echoing full tape state.
4016
+ * ᚹ one hop in, one hop out, like passing a lit shard through vacuum.
4017
+ */
4018
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
4019
+ npcId: string;
4020
+ request: NPCProcessRequest;
4021
+ apiUrl: string;
4022
+ apiKey?: string;
4023
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
3849
4024
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
3850
4025
  npcId: string;
3851
4026
  request: DirectiveRequest;
@@ -4022,6 +4197,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4022
4197
  timestamp: number;
4023
4198
  type: string;
4024
4199
  importance: number;
4200
+ similarity?: number | undefined;
4025
4201
  };
4026
4202
  };
4027
4203
  storageStatus: "idle" | "storing" | "error";
@@ -4039,6 +4215,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4039
4215
  timestamp: number;
4040
4216
  type: string;
4041
4217
  importance: number;
4218
+ similarity?: number | undefined;
4042
4219
  };
4043
4220
  };
4044
4221
  storageStatus: "idle" | "storing" | "error";
@@ -4056,6 +4233,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4056
4233
  timestamp: number;
4057
4234
  type: string;
4058
4235
  importance: number;
4236
+ similarity?: number | undefined;
4059
4237
  };
4060
4238
  };
4061
4239
  storageStatus: "idle" | "storing" | "error";
@@ -4073,6 +4251,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4073
4251
  timestamp: number;
4074
4252
  type: string;
4075
4253
  importance: number;
4254
+ similarity?: number | undefined;
4076
4255
  };
4077
4256
  };
4078
4257
  storageStatus: "idle" | "storing" | "error";
@@ -4090,6 +4269,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4090
4269
  timestamp: number;
4091
4270
  type: string;
4092
4271
  importance: number;
4272
+ similarity?: number | undefined;
4093
4273
  };
4094
4274
  };
4095
4275
  storageStatus: "idle" | "storing" | "error";
@@ -4107,6 +4287,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4107
4287
  timestamp: number;
4108
4288
  type: string;
4109
4289
  importance: number;
4290
+ similarity?: number | undefined;
4110
4291
  };
4111
4292
  };
4112
4293
  storageStatus: "idle" | "storing" | "error";
@@ -4124,6 +4305,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4124
4305
  timestamp: number;
4125
4306
  type: string;
4126
4307
  importance: number;
4308
+ similarity?: number | undefined;
4127
4309
  };
4128
4310
  };
4129
4311
  storageStatus: "idle" | "storing" | "error";
@@ -4159,6 +4341,12 @@ declare const selectMemoryById: (state: {
4159
4341
  apiUrl: string;
4160
4342
  apiKey?: string;
4161
4343
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
4344
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
4345
+ npcId: string;
4346
+ request: NPCProcessRequest;
4347
+ apiUrl: string;
4348
+ apiKey?: string;
4349
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
4162
4350
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
4163
4351
  npcId: string;
4164
4352
  request: DirectiveRequest;
@@ -4341,6 +4529,7 @@ declare const selectMemoryById: (state: {
4341
4529
  timestamp: number;
4342
4530
  type: string;
4343
4531
  importance: number;
4532
+ similarity?: number | undefined;
4344
4533
  };
4345
4534
  declare const selectAllMemories: (state: {
4346
4535
  [x: string]: /*elided*/ any;
@@ -4357,6 +4546,12 @@ declare const selectAllMemories: (state: {
4357
4546
  apiUrl: string;
4358
4547
  apiKey?: string;
4359
4548
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
4549
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
4550
+ npcId: string;
4551
+ request: NPCProcessRequest;
4552
+ apiUrl: string;
4553
+ apiKey?: string;
4554
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
4360
4555
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
4361
4556
  npcId: string;
4362
4557
  request: DirectiveRequest;
@@ -4645,4 +4840,4 @@ declare const clearMemoryRemoteThunk: _reduxjs_toolkit.AsyncThunk<any, {
4645
4840
  rejectedMeta?: unknown;
4646
4841
  }>;
4647
4842
 
4648
- export { type AgentConfig, type AgentResponse, type ApiStatusResponse, type BridgeRule, type BridgeState, type CompletionOptions, type ContextRequest, type ContextResponse, type CortexConfig, type CortexInitResponse, type CortexInternalState, type CortexModelInfo, type CortexStatus, type DirectiveRequest, type DirectiveResponse, type DirectiveRuleSet, type DirectiveRun, type GhostConfig, type GhostHistoryEntry, type GhostResults, type GhostRunResponse, type GhostState, type GhostStatus, type ICortex, type IMemory, type INPC, type ImportedNpc, type MemoryItem, type MemoryRecallInstruction, type MemoryStoreInstruction, type NPCAction, type NPCInternalState, type NPCState, type PromptConstraints, type RecalledMemory, type SDKDispatch, type SDKState, type SDKStore, SDK_VERSION, type Soul, type SoulConfig, type SoulExportResponse, type SoulExportResult, type SoulListResponse, type SoulState, type SoulVerifyResult, type ValidationContext, type ValidationResult, type ValidationRule, type VerdictRequest, type VerdictResponse, addToHistory, blockAction, bridgeSlice, checkApiStatusThunk, clearBlock, clearBridgeValidation, clearDirectivesForNpc, clearGhostSession, clearMemoryRemoteThunk, clearSoulState, completeRemoteThunk, contextComposed, cortexInitFailed, cortexInitStart, cortexInitSuccess, cortexSlice, createInitialState, createSDKStore, delay, deleteRulesetThunk, directiveReceived, directiveRunFailed, directiveRunStarted, directiveSlice, dispatch, exportToSoul, generateNPCId, getBridgeRulesThunk, getGhostHistoryThunk, getGhostResultsThunk, getGhostStatusThunk, getSoulListThunk, ghostSlice, importNpcFromSoulThunk, importSoulFromArweaveThunk, initRemoteCortexThunk, listCortexModelsThunk, listMemoryRemoteThunk, listRulePresetsThunk, listRulesetsThunk, loadBridgePresetThunk, localExportSoulThunk, memoise, memoiseAsync, memoryClear, memoryRecallFailed, memoryRecallStart, memoryRecallSuccess, memorySlice, memoryStoreFailed, memoryStoreStart, memoryStoreSuccess, npcSlice, pipe, processNPC, recallMemoryRemoteThunk, registerRulesetThunk, remoteExportSoulThunk, removeNPC, sdkApi, selectActiveDirective, selectActiveDirectiveId, selectActiveNPC, selectActiveNpcId, selectAllDirectives, selectAllMemories, selectAllNPCs, selectDirectiveById, selectLastRecalledMemories, selectMemoryById, selectNPCById, selectNPCEntities, selectNPCIds, selectTotalNPCs, setActiveNPC, setCortexStatus, setHistory, setLastAction, setNPCInfo, setNPCState, soulSlice, startGhostThunk, stopGhostThunk, store, storeMemoryRemoteThunk, streamFromCortex, streamFromCortexWithDelay, streamToCallback, streamToString, updateNPCState, updateNPCStateLocally, validateBridgeThunk, verdictValidated, verifySoulThunk };
4843
+ export { type AgentConfig, type AgentResponse, type ApiStatusResponse, type BridgeRule, type BridgeState, type CompletionOptions, type ContextRequest, type ContextResponse, type CortexConfig, type CortexInitResponse, type CortexInternalState, type CortexModelInfo, type CortexStatus, type DirectiveRequest, type DirectiveResponse, type DirectiveRuleSet, type DirectiveRun, type ExecuteInferenceInstruction, type FinalizeInstruction, type GhostConfig, type GhostHistoryEntry, type GhostResults, type GhostRunResponse, type GhostState, type GhostStatus, type ICortex, type IMemory, type INPC, type IdentifyActorInstruction, type ImportedNpc, type MemoryItem, type MemoryRecallInstruction, type MemoryStoreInstruction, type NPCAction, type NPCInstruction, type NPCInternalState, type NPCProcessRequest, type NPCProcessResponse, type NPCState, type ProcessTape, type PromptConstraints, type QueryVectorInstruction, type RecalledMemory, type SDKDispatch, type SDKState, type SDKStore, SDK_VERSION, type Soul, type SoulConfig, type SoulExportResponse, type SoulExportResult, type SoulListResponse, type SoulState, type SoulVerifyResult, type ValidationContext, type ValidationResult, type ValidationRule, type VerdictRequest, type VerdictResponse, addToHistory, blockAction, bridgeSlice, checkApiStatusThunk, clearBlock, clearBridgeValidation, clearDirectivesForNpc, clearGhostSession, clearMemoryRemoteThunk, clearSoulState, completeRemoteThunk, contextComposed, cortexInitFailed, cortexInitStart, cortexInitSuccess, cortexSlice, createInitialState, createSDKStore, delay, deleteRulesetThunk, directiveReceived, directiveRunFailed, directiveRunStarted, directiveSlice, dispatch, exportToSoul, generateNPCId, getBridgeRulesThunk, getGhostHistoryThunk, getGhostResultsThunk, getGhostStatusThunk, getSoulListThunk, ghostSlice, importNpcFromSoulThunk, importSoulFromArweaveThunk, initRemoteCortexThunk, listCortexModelsThunk, listMemoryRemoteThunk, listRulePresetsThunk, listRulesetsThunk, loadBridgePresetThunk, localExportSoulThunk, memoise, memoiseAsync, memoryClear, memoryRecallFailed, memoryRecallStart, memoryRecallSuccess, memorySlice, memoryStoreFailed, memoryStoreStart, memoryStoreSuccess, npcSlice, pipe, processNPC, recallMemoryRemoteThunk, registerRulesetThunk, remoteExportSoulThunk, removeNPC, sdkApi, selectActiveDirective, selectActiveDirectiveId, selectActiveNPC, selectActiveNpcId, selectAllDirectives, selectAllMemories, selectAllNPCs, selectDirectiveById, selectLastRecalledMemories, selectMemoryById, selectNPCById, selectNPCEntities, selectNPCIds, selectTotalNPCs, setActiveNPC, setCortexStatus, setHistory, setLastAction, setNPCInfo, setNPCState, soulSlice, startGhostThunk, stopGhostThunk, store, storeMemoryRemoteThunk, streamFromCortex, streamFromCortexWithDelay, streamToCallback, streamToString, updateNPCState, updateNPCStateLocally, validateBridgeThunk, verdictValidated, verifySoulThunk };
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ interface MemoryItem {
37
37
  timestamp: number;
38
38
  type: string;
39
39
  importance: number;
40
+ similarity?: number;
40
41
  }
41
42
  interface IMemory {
42
43
  store(text: string, type?: string, importance?: number): Promise<MemoryItem>;
@@ -121,6 +122,95 @@ interface VerdictResponse {
121
122
  action?: NPCAction;
122
123
  dialogue: string;
123
124
  }
125
+ /**
126
+ * User Story: As the SDK runtime, I need one accumulated "tape" payload that
127
+ * is echoed to the API each turn so orchestration remains stateless.
128
+ * ᚠ the tape hums like a cold star map passed hand to hand in the dark.
129
+ */
130
+ interface ProcessTape {
131
+ observation: string;
132
+ context: Record<string, unknown>;
133
+ npcState: Record<string, unknown>;
134
+ persona?: string;
135
+ actor?: {
136
+ npcId: string;
137
+ persona: string;
138
+ data?: Record<string, unknown>;
139
+ };
140
+ memories: RecalledMemory[];
141
+ prompt?: string;
142
+ constraints?: PromptConstraints;
143
+ generatedOutput?: string;
144
+ rulesetId?: string;
145
+ vectorQueried?: boolean;
146
+ }
147
+ /**
148
+ * User Story: As the API orchestrator, I need the SDK to perform actor lookup
149
+ * as an explicit atomic side-effect.
150
+ * A tiny identity ping echoes through the hull before the engines spin.
151
+ */
152
+ interface IdentifyActorInstruction {
153
+ type: 'IdentifyActor';
154
+ }
155
+ /**
156
+ * User Story: As the API orchestrator, I need vector recall to be an explicit
157
+ * instruction with concrete query parameters.
158
+ * ᚢ one sharp memory sweep, like scanning ruins with a single beam.
159
+ */
160
+ interface QueryVectorInstruction {
161
+ type: 'QueryVector';
162
+ query: string;
163
+ limit: number;
164
+ threshold: number;
165
+ }
166
+ /**
167
+ * User Story: As the API orchestrator, I need local inference to execute from
168
+ * an API-provided prompt and constraints with zero SDK initiative.
169
+ * The body stays quiet and obedient while the mind scripts the pulse.
170
+ */
171
+ interface ExecuteInferenceInstruction {
172
+ type: 'ExecuteInference';
173
+ prompt: string;
174
+ constraints: PromptConstraints;
175
+ }
176
+ /**
177
+ * User Story: As the API orchestrator, I need a terminal instruction that
178
+ * carries validated output plus persistence instructions for the SDK.
179
+ * ᚱ this is the seal at the airlock when the cycle clicks shut.
180
+ */
181
+ interface FinalizeInstruction {
182
+ type: 'Finalize';
183
+ valid: boolean;
184
+ signature?: string;
185
+ memoryStore: MemoryStoreInstruction[];
186
+ stateTransform: Record<string, unknown>;
187
+ action?: NPCAction;
188
+ dialogue: string;
189
+ }
190
+ /**
191
+ * User Story: As protocol typing, I need one discriminated union for atomic
192
+ * instructions so handler dispatch is deterministic.
193
+ * Every branch gets its own rune and none of the wires pretend to be another.
194
+ */
195
+ type NPCInstruction = IdentifyActorInstruction | QueryVectorInstruction | ExecuteInferenceInstruction | FinalizeInstruction;
196
+ /**
197
+ * User Story: As the API loop transport, I need request shape consistency for
198
+ * the full tape and previous side-effect result.
199
+ * The packet stays rigid so the void between hops does not eat context.
200
+ */
201
+ interface NPCProcessRequest {
202
+ tape: ProcessTape;
203
+ lastResult?: Record<string, unknown>;
204
+ }
205
+ /**
206
+ * User Story: As the SDK interpreter, I need the next instruction packaged
207
+ * with the updated tape every round-trip.
208
+ * ᚲ each return frame is one breadcrumb and one command rune forward.
209
+ */
210
+ interface NPCProcessResponse {
211
+ instruction: NPCInstruction;
212
+ tape: ProcessTape;
213
+ }
124
214
 
125
215
  interface ValidationContext {
126
216
  npcState?: Record<string, unknown>;
@@ -1071,6 +1161,12 @@ declare const selectNPCById: (state: {
1071
1161
  apiUrl: string;
1072
1162
  apiKey?: string;
1073
1163
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
1164
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
1165
+ npcId: string;
1166
+ request: NPCProcessRequest;
1167
+ apiUrl: string;
1168
+ apiKey?: string;
1169
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
1074
1170
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
1075
1171
  npcId: string;
1076
1172
  request: DirectiveRequest;
@@ -1273,6 +1369,12 @@ declare const selectNPCIds: (state: {
1273
1369
  apiUrl: string;
1274
1370
  apiKey?: string;
1275
1371
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
1372
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
1373
+ npcId: string;
1374
+ request: NPCProcessRequest;
1375
+ apiUrl: string;
1376
+ apiKey?: string;
1377
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
1276
1378
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
1277
1379
  npcId: string;
1278
1380
  request: DirectiveRequest;
@@ -1464,6 +1566,12 @@ declare const selectNPCEntities: (state: {
1464
1566
  apiUrl: string;
1465
1567
  apiKey?: string;
1466
1568
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
1569
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
1570
+ npcId: string;
1571
+ request: NPCProcessRequest;
1572
+ apiUrl: string;
1573
+ apiKey?: string;
1574
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
1467
1575
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
1468
1576
  npcId: string;
1469
1577
  request: DirectiveRequest;
@@ -1655,6 +1763,12 @@ declare const selectAllNPCs: (state: {
1655
1763
  apiUrl: string;
1656
1764
  apiKey?: string;
1657
1765
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
1766
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
1767
+ npcId: string;
1768
+ request: NPCProcessRequest;
1769
+ apiUrl: string;
1770
+ apiKey?: string;
1771
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
1658
1772
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
1659
1773
  npcId: string;
1660
1774
  request: DirectiveRequest;
@@ -1846,6 +1960,12 @@ declare const selectTotalNPCs: (state: {
1846
1960
  apiUrl: string;
1847
1961
  apiKey?: string;
1848
1962
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
1963
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
1964
+ npcId: string;
1965
+ request: NPCProcessRequest;
1966
+ apiUrl: string;
1967
+ apiKey?: string;
1968
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
1849
1969
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
1850
1970
  npcId: string;
1851
1971
  request: DirectiveRequest;
@@ -2286,6 +2406,12 @@ declare const selectDirectiveById: (state: {
2286
2406
  apiUrl: string;
2287
2407
  apiKey?: string;
2288
2408
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
2409
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
2410
+ npcId: string;
2411
+ request: NPCProcessRequest;
2412
+ apiUrl: string;
2413
+ apiKey?: string;
2414
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
2289
2415
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
2290
2416
  npcId: string;
2291
2417
  request: DirectiveRequest;
@@ -2491,6 +2617,12 @@ declare const selectAllDirectives: (state: {
2491
2617
  apiUrl: string;
2492
2618
  apiKey?: string;
2493
2619
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
2620
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
2621
+ npcId: string;
2622
+ request: NPCProcessRequest;
2623
+ apiUrl: string;
2624
+ apiKey?: string;
2625
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
2494
2626
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
2495
2627
  npcId: string;
2496
2628
  request: DirectiveRequest;
@@ -2694,6 +2826,12 @@ declare const createSDKStore: <S extends ReducersMapObject>(extraReducers?: S) =
2694
2826
  apiUrl: string;
2695
2827
  apiKey?: string;
2696
2828
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
2829
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
2830
+ npcId: string;
2831
+ request: NPCProcessRequest;
2832
+ apiUrl: string;
2833
+ apiKey?: string;
2834
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
2697
2835
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
2698
2836
  npcId: string;
2699
2837
  request: DirectiveRequest;
@@ -2885,6 +3023,12 @@ declare const createSDKStore: <S extends ReducersMapObject>(extraReducers?: S) =
2885
3023
  apiUrl: string;
2886
3024
  apiKey?: string;
2887
3025
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
3026
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
3027
+ npcId: string;
3028
+ request: NPCProcessRequest;
3029
+ apiUrl: string;
3030
+ apiKey?: string;
3031
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
2888
3032
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
2889
3033
  npcId: string;
2890
3034
  request: DirectiveRequest;
@@ -3077,6 +3221,12 @@ declare const store: _reduxjs_toolkit.EnhancedStore<{
3077
3221
  apiUrl: string;
3078
3222
  apiKey?: string;
3079
3223
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
3224
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
3225
+ npcId: string;
3226
+ request: NPCProcessRequest;
3227
+ apiUrl: string;
3228
+ apiKey?: string;
3229
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
3080
3230
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
3081
3231
  npcId: string;
3082
3232
  request: DirectiveRequest;
@@ -3268,6 +3418,12 @@ declare const store: _reduxjs_toolkit.EnhancedStore<{
3268
3418
  apiUrl: string;
3269
3419
  apiKey?: string;
3270
3420
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
3421
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
3422
+ npcId: string;
3423
+ request: NPCProcessRequest;
3424
+ apiUrl: string;
3425
+ apiKey?: string;
3426
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
3271
3427
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
3272
3428
  npcId: string;
3273
3429
  request: DirectiveRequest;
@@ -3460,6 +3616,12 @@ declare const dispatch: ((action: redux.Action<"listenerMiddleware/add">) => _re
3460
3616
  apiUrl: string;
3461
3617
  apiKey?: string;
3462
3618
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
3619
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
3620
+ npcId: string;
3621
+ request: NPCProcessRequest;
3622
+ apiUrl: string;
3623
+ apiKey?: string;
3624
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
3463
3625
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
3464
3626
  npcId: string;
3465
3627
  request: DirectiveRequest;
@@ -3738,6 +3900,7 @@ declare const soulSlice: _reduxjs_toolkit.Slice<SoulState, {
3738
3900
  timestamp: number;
3739
3901
  type: string;
3740
3902
  importance: number;
3903
+ similarity?: number | undefined;
3741
3904
  }[];
3742
3905
  state: {
3743
3906
  [x: string]: unknown;
@@ -3757,6 +3920,7 @@ declare const soulSlice: _reduxjs_toolkit.Slice<SoulState, {
3757
3920
  timestamp: number;
3758
3921
  type: string;
3759
3922
  importance: number;
3923
+ similarity?: number | undefined;
3760
3924
  }[];
3761
3925
  state: {
3762
3926
  [x: string]: unknown;
@@ -3811,7 +3975,7 @@ declare const streamFromCortexWithDelay: (cortex: ICortex, prompt: string, onChu
3811
3975
  delayMs?: number;
3812
3976
  }) => Promise<string>;
3813
3977
 
3814
- declare const SDK_VERSION = "0.6.0";
3978
+ declare const SDK_VERSION = "0.6.1";
3815
3979
 
3816
3980
  /**
3817
3981
  * User Story: As NPC creation flows, I need lightweight id generation that
@@ -3846,6 +4010,17 @@ declare const sdkApi: _reduxjs_toolkit_query.Api<_reduxjs_toolkit_query.BaseQuer
3846
4010
  apiUrl: string;
3847
4011
  apiKey?: string;
3848
4012
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
4013
+ /**
4014
+ * User Story: As the SDK protocol loop, I need a single process endpoint
4015
+ * that returns one atomic instruction per turn while echoing full tape state.
4016
+ * ᚹ one hop in, one hop out, like passing a lit shard through vacuum.
4017
+ */
4018
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
4019
+ npcId: string;
4020
+ request: NPCProcessRequest;
4021
+ apiUrl: string;
4022
+ apiKey?: string;
4023
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
3849
4024
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
3850
4025
  npcId: string;
3851
4026
  request: DirectiveRequest;
@@ -4022,6 +4197,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4022
4197
  timestamp: number;
4023
4198
  type: string;
4024
4199
  importance: number;
4200
+ similarity?: number | undefined;
4025
4201
  };
4026
4202
  };
4027
4203
  storageStatus: "idle" | "storing" | "error";
@@ -4039,6 +4215,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4039
4215
  timestamp: number;
4040
4216
  type: string;
4041
4217
  importance: number;
4218
+ similarity?: number | undefined;
4042
4219
  };
4043
4220
  };
4044
4221
  storageStatus: "idle" | "storing" | "error";
@@ -4056,6 +4233,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4056
4233
  timestamp: number;
4057
4234
  type: string;
4058
4235
  importance: number;
4236
+ similarity?: number | undefined;
4059
4237
  };
4060
4238
  };
4061
4239
  storageStatus: "idle" | "storing" | "error";
@@ -4073,6 +4251,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4073
4251
  timestamp: number;
4074
4252
  type: string;
4075
4253
  importance: number;
4254
+ similarity?: number | undefined;
4076
4255
  };
4077
4256
  };
4078
4257
  storageStatus: "idle" | "storing" | "error";
@@ -4090,6 +4269,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4090
4269
  timestamp: number;
4091
4270
  type: string;
4092
4271
  importance: number;
4272
+ similarity?: number | undefined;
4093
4273
  };
4094
4274
  };
4095
4275
  storageStatus: "idle" | "storing" | "error";
@@ -4107,6 +4287,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4107
4287
  timestamp: number;
4108
4288
  type: string;
4109
4289
  importance: number;
4290
+ similarity?: number | undefined;
4110
4291
  };
4111
4292
  };
4112
4293
  storageStatus: "idle" | "storing" | "error";
@@ -4124,6 +4305,7 @@ declare const memorySlice: _reduxjs_toolkit.Slice<_reduxjs_toolkit.EntityState<M
4124
4305
  timestamp: number;
4125
4306
  type: string;
4126
4307
  importance: number;
4308
+ similarity?: number | undefined;
4127
4309
  };
4128
4310
  };
4129
4311
  storageStatus: "idle" | "storing" | "error";
@@ -4159,6 +4341,12 @@ declare const selectMemoryById: (state: {
4159
4341
  apiUrl: string;
4160
4342
  apiKey?: string;
4161
4343
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
4344
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
4345
+ npcId: string;
4346
+ request: NPCProcessRequest;
4347
+ apiUrl: string;
4348
+ apiKey?: string;
4349
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
4162
4350
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
4163
4351
  npcId: string;
4164
4352
  request: DirectiveRequest;
@@ -4341,6 +4529,7 @@ declare const selectMemoryById: (state: {
4341
4529
  timestamp: number;
4342
4530
  type: string;
4343
4531
  importance: number;
4532
+ similarity?: number | undefined;
4344
4533
  };
4345
4534
  declare const selectAllMemories: (state: {
4346
4535
  [x: string]: /*elided*/ any;
@@ -4357,6 +4546,12 @@ declare const selectAllMemories: (state: {
4357
4546
  apiUrl: string;
4358
4547
  apiKey?: string;
4359
4548
  }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", CortexInitResponse, "forbocApi", unknown>;
4549
+ postNpcProcess: _reduxjs_toolkit_query.MutationDefinition<{
4550
+ npcId: string;
4551
+ request: NPCProcessRequest;
4552
+ apiUrl: string;
4553
+ apiKey?: string;
4554
+ }, _reduxjs_toolkit_query.BaseQueryFn<string | _reduxjs_toolkit_query.FetchArgs, unknown, _reduxjs_toolkit_query.FetchBaseQueryError, {}, _reduxjs_toolkit_query.FetchBaseQueryMeta>, "NPC" | "Memory" | "Cortex" | "Ghost" | "Soul" | "Bridge" | "Rule", NPCProcessResponse, "forbocApi", unknown>;
4360
4555
  postDirective: _reduxjs_toolkit_query.MutationDefinition<{
4361
4556
  npcId: string;
4362
4557
  request: DirectiveRequest;
@@ -4645,4 +4840,4 @@ declare const clearMemoryRemoteThunk: _reduxjs_toolkit.AsyncThunk<any, {
4645
4840
  rejectedMeta?: unknown;
4646
4841
  }>;
4647
4842
 
4648
- export { type AgentConfig, type AgentResponse, type ApiStatusResponse, type BridgeRule, type BridgeState, type CompletionOptions, type ContextRequest, type ContextResponse, type CortexConfig, type CortexInitResponse, type CortexInternalState, type CortexModelInfo, type CortexStatus, type DirectiveRequest, type DirectiveResponse, type DirectiveRuleSet, type DirectiveRun, type GhostConfig, type GhostHistoryEntry, type GhostResults, type GhostRunResponse, type GhostState, type GhostStatus, type ICortex, type IMemory, type INPC, type ImportedNpc, type MemoryItem, type MemoryRecallInstruction, type MemoryStoreInstruction, type NPCAction, type NPCInternalState, type NPCState, type PromptConstraints, type RecalledMemory, type SDKDispatch, type SDKState, type SDKStore, SDK_VERSION, type Soul, type SoulConfig, type SoulExportResponse, type SoulExportResult, type SoulListResponse, type SoulState, type SoulVerifyResult, type ValidationContext, type ValidationResult, type ValidationRule, type VerdictRequest, type VerdictResponse, addToHistory, blockAction, bridgeSlice, checkApiStatusThunk, clearBlock, clearBridgeValidation, clearDirectivesForNpc, clearGhostSession, clearMemoryRemoteThunk, clearSoulState, completeRemoteThunk, contextComposed, cortexInitFailed, cortexInitStart, cortexInitSuccess, cortexSlice, createInitialState, createSDKStore, delay, deleteRulesetThunk, directiveReceived, directiveRunFailed, directiveRunStarted, directiveSlice, dispatch, exportToSoul, generateNPCId, getBridgeRulesThunk, getGhostHistoryThunk, getGhostResultsThunk, getGhostStatusThunk, getSoulListThunk, ghostSlice, importNpcFromSoulThunk, importSoulFromArweaveThunk, initRemoteCortexThunk, listCortexModelsThunk, listMemoryRemoteThunk, listRulePresetsThunk, listRulesetsThunk, loadBridgePresetThunk, localExportSoulThunk, memoise, memoiseAsync, memoryClear, memoryRecallFailed, memoryRecallStart, memoryRecallSuccess, memorySlice, memoryStoreFailed, memoryStoreStart, memoryStoreSuccess, npcSlice, pipe, processNPC, recallMemoryRemoteThunk, registerRulesetThunk, remoteExportSoulThunk, removeNPC, sdkApi, selectActiveDirective, selectActiveDirectiveId, selectActiveNPC, selectActiveNpcId, selectAllDirectives, selectAllMemories, selectAllNPCs, selectDirectiveById, selectLastRecalledMemories, selectMemoryById, selectNPCById, selectNPCEntities, selectNPCIds, selectTotalNPCs, setActiveNPC, setCortexStatus, setHistory, setLastAction, setNPCInfo, setNPCState, soulSlice, startGhostThunk, stopGhostThunk, store, storeMemoryRemoteThunk, streamFromCortex, streamFromCortexWithDelay, streamToCallback, streamToString, updateNPCState, updateNPCStateLocally, validateBridgeThunk, verdictValidated, verifySoulThunk };
4843
+ export { type AgentConfig, type AgentResponse, type ApiStatusResponse, type BridgeRule, type BridgeState, type CompletionOptions, type ContextRequest, type ContextResponse, type CortexConfig, type CortexInitResponse, type CortexInternalState, type CortexModelInfo, type CortexStatus, type DirectiveRequest, type DirectiveResponse, type DirectiveRuleSet, type DirectiveRun, type ExecuteInferenceInstruction, type FinalizeInstruction, type GhostConfig, type GhostHistoryEntry, type GhostResults, type GhostRunResponse, type GhostState, type GhostStatus, type ICortex, type IMemory, type INPC, type IdentifyActorInstruction, type ImportedNpc, type MemoryItem, type MemoryRecallInstruction, type MemoryStoreInstruction, type NPCAction, type NPCInstruction, type NPCInternalState, type NPCProcessRequest, type NPCProcessResponse, type NPCState, type ProcessTape, type PromptConstraints, type QueryVectorInstruction, type RecalledMemory, type SDKDispatch, type SDKState, type SDKStore, SDK_VERSION, type Soul, type SoulConfig, type SoulExportResponse, type SoulExportResult, type SoulListResponse, type SoulState, type SoulVerifyResult, type ValidationContext, type ValidationResult, type ValidationRule, type VerdictRequest, type VerdictResponse, addToHistory, blockAction, bridgeSlice, checkApiStatusThunk, clearBlock, clearBridgeValidation, clearDirectivesForNpc, clearGhostSession, clearMemoryRemoteThunk, clearSoulState, completeRemoteThunk, contextComposed, cortexInitFailed, cortexInitStart, cortexInitSuccess, cortexSlice, createInitialState, createSDKStore, delay, deleteRulesetThunk, directiveReceived, directiveRunFailed, directiveRunStarted, directiveSlice, dispatch, exportToSoul, generateNPCId, getBridgeRulesThunk, getGhostHistoryThunk, getGhostResultsThunk, getGhostStatusThunk, getSoulListThunk, ghostSlice, importNpcFromSoulThunk, importSoulFromArweaveThunk, initRemoteCortexThunk, listCortexModelsThunk, listMemoryRemoteThunk, listRulePresetsThunk, listRulesetsThunk, loadBridgePresetThunk, localExportSoulThunk, memoise, memoiseAsync, memoryClear, memoryRecallFailed, memoryRecallStart, memoryRecallSuccess, memorySlice, memoryStoreFailed, memoryStoreStart, memoryStoreSuccess, npcSlice, pipe, processNPC, recallMemoryRemoteThunk, registerRulesetThunk, remoteExportSoulThunk, removeNPC, sdkApi, selectActiveDirective, selectActiveDirectiveId, selectActiveNPC, selectActiveNpcId, selectAllDirectives, selectAllMemories, selectAllNPCs, selectDirectiveById, selectLastRecalledMemories, selectMemoryById, selectNPCById, selectNPCEntities, selectNPCIds, selectTotalNPCs, setActiveNPC, setCortexStatus, setHistory, setLastAction, setNPCInfo, setNPCState, soulSlice, startGhostThunk, stopGhostThunk, store, storeMemoryRemoteThunk, streamFromCortex, streamFromCortexWithDelay, streamToCallback, streamToString, updateNPCState, updateNPCStateLocally, validateBridgeThunk, verdictValidated, verifySoulThunk };
package/dist/index.js CHANGED
@@ -169,6 +169,21 @@ var sdkApi = (0, import_query.createApi)({
169
169
  transformResponse: (response) => response
170
170
  }),
171
171
  // NPC Endpoints
172
+ /**
173
+ * User Story: As the SDK protocol loop, I need a single process endpoint
174
+ * that returns one atomic instruction per turn while echoing full tape state.
175
+ * ᚹ one hop in, one hop out, like passing a lit shard through vacuum.
176
+ */
177
+ postNpcProcess: builder.mutation({
178
+ query: ({ npcId, request, apiUrl, apiKey }) => ({
179
+ url: `${apiUrl}/npcs/${npcId}/process`,
180
+ method: "POST",
181
+ headers: apiKey ? { "Authorization": `Bearer ${apiKey}` } : {},
182
+ body: request
183
+ }),
184
+ invalidatesTags: (result, error, { npcId }) => [{ type: "NPC", id: npcId }],
185
+ transformResponse: (response) => response
186
+ }),
172
187
  postDirective: builder.mutation({
173
188
  query: ({ npcId, request, apiUrl, apiKey }) => ({
174
189
  url: `${apiUrl}/npcs/${npcId}/directive`,
@@ -863,7 +878,7 @@ var { clearGhostSession } = ghostSlice.actions;
863
878
  var ghostSlice_default = ghostSlice.reducer;
864
879
 
865
880
  // src/utils/sdkVersion.ts
866
- var SDK_VERSION = "0.6.0";
881
+ var SDK_VERSION = "0.6.1";
867
882
 
868
883
  // src/utils/generateNPCId.ts
869
884
  var generateNPCId = () => `ag_${Date.now().toString(36)}`;
@@ -1304,6 +1319,13 @@ var dispatch = store.dispatch;
1304
1319
 
1305
1320
  // src/thunks.ts
1306
1321
  var import_toolkit10 = require("@reduxjs/toolkit");
1322
+ var extractThunkErrorMessage = (e) => {
1323
+ if (typeof e === "string") return e;
1324
+ if (e?.data?.message) return String(e.data.message);
1325
+ if (e?.error) return String(e.error);
1326
+ if (e?.message) return String(e.message);
1327
+ return "Protocol processing failed";
1328
+ };
1307
1329
  var processNPC = (0, import_toolkit10.createAsyncThunk)(
1308
1330
  "npc/process",
1309
1331
  async ({ npcId: argNpcId, text, context = {}, apiUrl, apiKey, memory, cortex, persona: argPersona }, { getState, dispatch: dispatch2, rejectWithValue }) => {
@@ -1327,61 +1349,111 @@ var processNPC = (0, import_toolkit10.createAsyncThunk)(
1327
1349
  const directiveId = `${npcId}:${Date.now()}`;
1328
1350
  dispatch2(directiveRunStarted({ id: directiveId, npcId, observation: text }));
1329
1351
  try {
1330
- const directiveResult = await dispatch2(
1331
- sdkApi.endpoints.postDirective.initiate({ npcId, request: { observation: text, npcState: currentState, context }, apiUrl, apiKey })
1332
- ).unwrap();
1333
- dispatch2(directiveReceived({ id: directiveId, response: directiveResult }));
1334
- if (directiveResult.memoryRecall && !memory) {
1335
- return rejectWithValue("API requested memory recall, but no memory engine is configured");
1336
- }
1337
- const recalledMemories = memory && directiveResult.memoryRecall ? (await memory.recall(
1338
- directiveResult.memoryRecall.query,
1339
- directiveResult.memoryRecall.limit,
1340
- directiveResult.memoryRecall.threshold
1341
- )).map((m) => ({ text: m.text, type: m.type, importance: m.importance })) : [];
1342
- const contextResult = await dispatch2(
1343
- sdkApi.endpoints.postContext.initiate({ npcId, request: { memories: recalledMemories, observation: text, npcState: currentState, persona }, apiUrl, apiKey })
1344
- ).unwrap();
1345
- dispatch2(contextComposed({ id: directiveId, prompt: contextResult.prompt, constraints: contextResult.constraints }));
1346
- const generatedText = await cortex.complete(contextResult.prompt, {
1347
- maxTokens: contextResult.constraints.maxTokens,
1348
- temperature: contextResult.constraints.temperature,
1349
- stop: contextResult.constraints.stop
1350
- });
1351
- const verdictResult = await dispatch2(
1352
- sdkApi.endpoints.postVerdict.initiate({ npcId, request: { generatedOutput: generatedText, observation: text, npcState: currentState }, apiUrl, apiKey })
1353
- ).unwrap();
1354
- dispatch2(verdictValidated({ id: directiveId, verdict: verdictResult }));
1355
- if (!verdictResult.valid) {
1356
- dispatch2(blockAction({ id: npcId, reason: verdictResult.dialogue || "Validation Failed" }));
1357
- return {
1358
- dialogue: verdictResult.dialogue,
1359
- action: verdictResult.action,
1360
- thought: verdictResult.dialogue
1361
- };
1362
- }
1363
- if (verdictResult.memoryStore?.length && !memory) {
1364
- return rejectWithValue("API returned memoryStore instructions, but no memory engine is configured");
1365
- }
1366
- if (memory && verdictResult.memoryStore) {
1367
- for (const inst of verdictResult.memoryStore) {
1368
- await memory.store(inst.text, inst.type, inst.importance);
1352
+ const initialTape = {
1353
+ observation: text,
1354
+ context,
1355
+ npcState: currentState,
1356
+ persona,
1357
+ memories: [],
1358
+ vectorQueried: false
1359
+ };
1360
+ const maxTurns = 12;
1361
+ const persistMemoryInstructionsRecursively = async (instructions, index = 0) => {
1362
+ if (!memory || index >= instructions.length) {
1363
+ return;
1369
1364
  }
1370
- }
1371
- if (verdictResult.stateDelta) {
1372
- dispatch2(updateNPCState({ id: npcId, delta: verdictResult.stateDelta }));
1373
- }
1374
- const action = verdictResult.action;
1375
- dispatch2(setLastAction({ id: npcId, action }));
1376
- dispatch2(addToHistory({ id: npcId, role: "user", content: text }));
1377
- dispatch2(addToHistory({ id: npcId, role: "assistant", content: verdictResult.dialogue }));
1378
- return {
1379
- dialogue: verdictResult.dialogue,
1380
- action,
1381
- thought: verdictResult.dialogue
1365
+ const inst = instructions[index];
1366
+ await memory.store(inst.text, inst.type, inst.importance);
1367
+ await persistMemoryInstructionsRecursively(instructions, index + 1);
1368
+ };
1369
+ const runProtocolRecursively = async (tape, lastResult, turn) => {
1370
+ if (turn >= maxTurns) {
1371
+ return rejectWithValue(`Protocol loop exceeded max turns (${maxTurns})`);
1372
+ }
1373
+ const request = { tape, lastResult };
1374
+ const processResult = await dispatch2(
1375
+ sdkApi.endpoints.postNpcProcess.initiate({ npcId, request, apiUrl, apiKey })
1376
+ ).unwrap();
1377
+ const nextTape = processResult.tape;
1378
+ const instruction = processResult.instruction;
1379
+ if (instruction.type === "IdentifyActor") {
1380
+ return runProtocolRecursively(nextTape, {
1381
+ type: "IdentifyActorResult",
1382
+ actor: {
1383
+ npcId,
1384
+ persona,
1385
+ data: nextTape.npcState
1386
+ }
1387
+ }, turn + 1);
1388
+ }
1389
+ if (instruction.type === "QueryVector") {
1390
+ dispatch2(directiveReceived({
1391
+ id: directiveId,
1392
+ response: { memoryRecall: { query: instruction.query, limit: instruction.limit, threshold: instruction.threshold } }
1393
+ }));
1394
+ if (!memory) {
1395
+ return rejectWithValue("API requested memory recall, but no memory engine is configured");
1396
+ }
1397
+ const recalled = await memory.recall(instruction.query, instruction.limit, instruction.threshold);
1398
+ return runProtocolRecursively(nextTape, {
1399
+ type: "QueryVectorResult",
1400
+ memories: recalled.map((m) => ({ text: m.text, type: m.type, importance: m.importance, similarity: m.similarity }))
1401
+ }, turn + 1);
1402
+ }
1403
+ if (instruction.type === "ExecuteInference") {
1404
+ dispatch2(contextComposed({ id: directiveId, prompt: instruction.prompt, constraints: instruction.constraints }));
1405
+ const generatedText = await cortex.complete(instruction.prompt, {
1406
+ maxTokens: instruction.constraints.maxTokens,
1407
+ temperature: instruction.constraints.temperature,
1408
+ stop: instruction.constraints.stop
1409
+ });
1410
+ return runProtocolRecursively(nextTape, {
1411
+ type: "ExecuteInferenceResult",
1412
+ generatedOutput: generatedText
1413
+ }, turn + 1);
1414
+ }
1415
+ if (instruction.type === "Finalize") {
1416
+ const finalize = instruction;
1417
+ dispatch2(verdictValidated({
1418
+ id: directiveId,
1419
+ verdict: {
1420
+ valid: finalize.valid,
1421
+ signature: finalize.signature,
1422
+ memoryStore: finalize.memoryStore,
1423
+ stateDelta: finalize.stateTransform,
1424
+ action: finalize.action,
1425
+ dialogue: finalize.dialogue
1426
+ }
1427
+ }));
1428
+ if (!finalize.valid) {
1429
+ dispatch2(blockAction({ id: npcId, reason: finalize.dialogue || "Validation Failed" }));
1430
+ return {
1431
+ dialogue: finalize.dialogue,
1432
+ action: finalize.action,
1433
+ thought: finalize.dialogue
1434
+ };
1435
+ }
1436
+ if (finalize.memoryStore?.length && !memory) {
1437
+ return rejectWithValue("API returned memoryStore instructions, but no memory engine is configured");
1438
+ }
1439
+ await persistMemoryInstructionsRecursively(finalize.memoryStore || []);
1440
+ if (finalize.stateTransform) {
1441
+ dispatch2(updateNPCState({ id: npcId, delta: finalize.stateTransform }));
1442
+ }
1443
+ dispatch2(setLastAction({ id: npcId, action: finalize.action }));
1444
+ dispatch2(addToHistory({ id: npcId, role: "user", content: text }));
1445
+ dispatch2(addToHistory({ id: npcId, role: "assistant", content: finalize.dialogue }));
1446
+ return {
1447
+ dialogue: finalize.dialogue,
1448
+ action: finalize.action,
1449
+ thought: finalize.dialogue
1450
+ };
1451
+ }
1452
+ return rejectWithValue("API returned unknown instruction type");
1382
1453
  };
1454
+ return runProtocolRecursively(initialTape, void 0, 0);
1383
1455
  } catch (e) {
1384
- const message = e?.message || e?.data?.message || "Protocol processing failed";
1456
+ const message = extractThunkErrorMessage(e);
1385
1457
  dispatch2(directiveRunFailed({ id: directiveId, error: String(message) }));
1386
1458
  return rejectWithValue(String(message));
1387
1459
  }
package/dist/index.mjs CHANGED
@@ -49,6 +49,21 @@ var sdkApi = createApi({
49
49
  transformResponse: (response) => response
50
50
  }),
51
51
  // NPC Endpoints
52
+ /**
53
+ * User Story: As the SDK protocol loop, I need a single process endpoint
54
+ * that returns one atomic instruction per turn while echoing full tape state.
55
+ * ᚹ one hop in, one hop out, like passing a lit shard through vacuum.
56
+ */
57
+ postNpcProcess: builder.mutation({
58
+ query: ({ npcId, request, apiUrl, apiKey }) => ({
59
+ url: `${apiUrl}/npcs/${npcId}/process`,
60
+ method: "POST",
61
+ headers: apiKey ? { "Authorization": `Bearer ${apiKey}` } : {},
62
+ body: request
63
+ }),
64
+ invalidatesTags: (result, error, { npcId }) => [{ type: "NPC", id: npcId }],
65
+ transformResponse: (response) => response
66
+ }),
52
67
  postDirective: builder.mutation({
53
68
  query: ({ npcId, request, apiUrl, apiKey }) => ({
54
69
  url: `${apiUrl}/npcs/${npcId}/directive`,
@@ -743,7 +758,7 @@ var { clearGhostSession } = ghostSlice.actions;
743
758
  var ghostSlice_default = ghostSlice.reducer;
744
759
 
745
760
  // src/utils/sdkVersion.ts
746
- var SDK_VERSION = "0.6.0";
761
+ var SDK_VERSION = "0.6.1";
747
762
 
748
763
  // src/utils/generateNPCId.ts
749
764
  var generateNPCId = () => `ag_${Date.now().toString(36)}`;
@@ -1184,6 +1199,13 @@ var dispatch = store.dispatch;
1184
1199
 
1185
1200
  // src/thunks.ts
1186
1201
  import { createAsyncThunk as createAsyncThunk5 } from "@reduxjs/toolkit";
1202
+ var extractThunkErrorMessage = (e) => {
1203
+ if (typeof e === "string") return e;
1204
+ if (e?.data?.message) return String(e.data.message);
1205
+ if (e?.error) return String(e.error);
1206
+ if (e?.message) return String(e.message);
1207
+ return "Protocol processing failed";
1208
+ };
1187
1209
  var processNPC = createAsyncThunk5(
1188
1210
  "npc/process",
1189
1211
  async ({ npcId: argNpcId, text, context = {}, apiUrl, apiKey, memory, cortex, persona: argPersona }, { getState, dispatch: dispatch2, rejectWithValue }) => {
@@ -1207,61 +1229,111 @@ var processNPC = createAsyncThunk5(
1207
1229
  const directiveId = `${npcId}:${Date.now()}`;
1208
1230
  dispatch2(directiveRunStarted({ id: directiveId, npcId, observation: text }));
1209
1231
  try {
1210
- const directiveResult = await dispatch2(
1211
- sdkApi.endpoints.postDirective.initiate({ npcId, request: { observation: text, npcState: currentState, context }, apiUrl, apiKey })
1212
- ).unwrap();
1213
- dispatch2(directiveReceived({ id: directiveId, response: directiveResult }));
1214
- if (directiveResult.memoryRecall && !memory) {
1215
- return rejectWithValue("API requested memory recall, but no memory engine is configured");
1216
- }
1217
- const recalledMemories = memory && directiveResult.memoryRecall ? (await memory.recall(
1218
- directiveResult.memoryRecall.query,
1219
- directiveResult.memoryRecall.limit,
1220
- directiveResult.memoryRecall.threshold
1221
- )).map((m) => ({ text: m.text, type: m.type, importance: m.importance })) : [];
1222
- const contextResult = await dispatch2(
1223
- sdkApi.endpoints.postContext.initiate({ npcId, request: { memories: recalledMemories, observation: text, npcState: currentState, persona }, apiUrl, apiKey })
1224
- ).unwrap();
1225
- dispatch2(contextComposed({ id: directiveId, prompt: contextResult.prompt, constraints: contextResult.constraints }));
1226
- const generatedText = await cortex.complete(contextResult.prompt, {
1227
- maxTokens: contextResult.constraints.maxTokens,
1228
- temperature: contextResult.constraints.temperature,
1229
- stop: contextResult.constraints.stop
1230
- });
1231
- const verdictResult = await dispatch2(
1232
- sdkApi.endpoints.postVerdict.initiate({ npcId, request: { generatedOutput: generatedText, observation: text, npcState: currentState }, apiUrl, apiKey })
1233
- ).unwrap();
1234
- dispatch2(verdictValidated({ id: directiveId, verdict: verdictResult }));
1235
- if (!verdictResult.valid) {
1236
- dispatch2(blockAction({ id: npcId, reason: verdictResult.dialogue || "Validation Failed" }));
1237
- return {
1238
- dialogue: verdictResult.dialogue,
1239
- action: verdictResult.action,
1240
- thought: verdictResult.dialogue
1241
- };
1242
- }
1243
- if (verdictResult.memoryStore?.length && !memory) {
1244
- return rejectWithValue("API returned memoryStore instructions, but no memory engine is configured");
1245
- }
1246
- if (memory && verdictResult.memoryStore) {
1247
- for (const inst of verdictResult.memoryStore) {
1248
- await memory.store(inst.text, inst.type, inst.importance);
1232
+ const initialTape = {
1233
+ observation: text,
1234
+ context,
1235
+ npcState: currentState,
1236
+ persona,
1237
+ memories: [],
1238
+ vectorQueried: false
1239
+ };
1240
+ const maxTurns = 12;
1241
+ const persistMemoryInstructionsRecursively = async (instructions, index = 0) => {
1242
+ if (!memory || index >= instructions.length) {
1243
+ return;
1249
1244
  }
1250
- }
1251
- if (verdictResult.stateDelta) {
1252
- dispatch2(updateNPCState({ id: npcId, delta: verdictResult.stateDelta }));
1253
- }
1254
- const action = verdictResult.action;
1255
- dispatch2(setLastAction({ id: npcId, action }));
1256
- dispatch2(addToHistory({ id: npcId, role: "user", content: text }));
1257
- dispatch2(addToHistory({ id: npcId, role: "assistant", content: verdictResult.dialogue }));
1258
- return {
1259
- dialogue: verdictResult.dialogue,
1260
- action,
1261
- thought: verdictResult.dialogue
1245
+ const inst = instructions[index];
1246
+ await memory.store(inst.text, inst.type, inst.importance);
1247
+ await persistMemoryInstructionsRecursively(instructions, index + 1);
1248
+ };
1249
+ const runProtocolRecursively = async (tape, lastResult, turn) => {
1250
+ if (turn >= maxTurns) {
1251
+ return rejectWithValue(`Protocol loop exceeded max turns (${maxTurns})`);
1252
+ }
1253
+ const request = { tape, lastResult };
1254
+ const processResult = await dispatch2(
1255
+ sdkApi.endpoints.postNpcProcess.initiate({ npcId, request, apiUrl, apiKey })
1256
+ ).unwrap();
1257
+ const nextTape = processResult.tape;
1258
+ const instruction = processResult.instruction;
1259
+ if (instruction.type === "IdentifyActor") {
1260
+ return runProtocolRecursively(nextTape, {
1261
+ type: "IdentifyActorResult",
1262
+ actor: {
1263
+ npcId,
1264
+ persona,
1265
+ data: nextTape.npcState
1266
+ }
1267
+ }, turn + 1);
1268
+ }
1269
+ if (instruction.type === "QueryVector") {
1270
+ dispatch2(directiveReceived({
1271
+ id: directiveId,
1272
+ response: { memoryRecall: { query: instruction.query, limit: instruction.limit, threshold: instruction.threshold } }
1273
+ }));
1274
+ if (!memory) {
1275
+ return rejectWithValue("API requested memory recall, but no memory engine is configured");
1276
+ }
1277
+ const recalled = await memory.recall(instruction.query, instruction.limit, instruction.threshold);
1278
+ return runProtocolRecursively(nextTape, {
1279
+ type: "QueryVectorResult",
1280
+ memories: recalled.map((m) => ({ text: m.text, type: m.type, importance: m.importance, similarity: m.similarity }))
1281
+ }, turn + 1);
1282
+ }
1283
+ if (instruction.type === "ExecuteInference") {
1284
+ dispatch2(contextComposed({ id: directiveId, prompt: instruction.prompt, constraints: instruction.constraints }));
1285
+ const generatedText = await cortex.complete(instruction.prompt, {
1286
+ maxTokens: instruction.constraints.maxTokens,
1287
+ temperature: instruction.constraints.temperature,
1288
+ stop: instruction.constraints.stop
1289
+ });
1290
+ return runProtocolRecursively(nextTape, {
1291
+ type: "ExecuteInferenceResult",
1292
+ generatedOutput: generatedText
1293
+ }, turn + 1);
1294
+ }
1295
+ if (instruction.type === "Finalize") {
1296
+ const finalize = instruction;
1297
+ dispatch2(verdictValidated({
1298
+ id: directiveId,
1299
+ verdict: {
1300
+ valid: finalize.valid,
1301
+ signature: finalize.signature,
1302
+ memoryStore: finalize.memoryStore,
1303
+ stateDelta: finalize.stateTransform,
1304
+ action: finalize.action,
1305
+ dialogue: finalize.dialogue
1306
+ }
1307
+ }));
1308
+ if (!finalize.valid) {
1309
+ dispatch2(blockAction({ id: npcId, reason: finalize.dialogue || "Validation Failed" }));
1310
+ return {
1311
+ dialogue: finalize.dialogue,
1312
+ action: finalize.action,
1313
+ thought: finalize.dialogue
1314
+ };
1315
+ }
1316
+ if (finalize.memoryStore?.length && !memory) {
1317
+ return rejectWithValue("API returned memoryStore instructions, but no memory engine is configured");
1318
+ }
1319
+ await persistMemoryInstructionsRecursively(finalize.memoryStore || []);
1320
+ if (finalize.stateTransform) {
1321
+ dispatch2(updateNPCState({ id: npcId, delta: finalize.stateTransform }));
1322
+ }
1323
+ dispatch2(setLastAction({ id: npcId, action: finalize.action }));
1324
+ dispatch2(addToHistory({ id: npcId, role: "user", content: text }));
1325
+ dispatch2(addToHistory({ id: npcId, role: "assistant", content: finalize.dialogue }));
1326
+ return {
1327
+ dialogue: finalize.dialogue,
1328
+ action: finalize.action,
1329
+ thought: finalize.dialogue
1330
+ };
1331
+ }
1332
+ return rejectWithValue("API returned unknown instruction type");
1262
1333
  };
1334
+ return runProtocolRecursively(initialTape, void 0, 0);
1263
1335
  } catch (e) {
1264
- const message = e?.message || e?.data?.message || "Protocol processing failed";
1336
+ const message = extractThunkErrorMessage(e);
1265
1337
  dispatch2(directiveRunFailed({ id: directiveId, error: String(message) }));
1266
1338
  return rejectWithValue(String(message));
1267
1339
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forbocai/core",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Core agnostic logic for ForbocAI SDK",
6
6
  "main": "dist/index.js",