@zergai/ztc 0.2.1-dev.35568243511 → 0.2.2-dev.35681806994

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.
@@ -12130,7 +12130,7 @@ var invokeSkillTool = makeInvokeSkillTool(resolveAmbientSkills);
12130
12130
  // src/zlm.ts
12131
12131
  var ZLM_EMBED_API_VERSION = "zerglang.ztc-embed/1";
12132
12132
  var ZLM_STDIO_PROTOCOL = "zerglang.ztc-host/1";
12133
- var ZLM_ZTC_VERSION = true ? "0.2.1-dev.35568243511" : "development";
12133
+ var ZLM_ZTC_VERSION = true ? "0.2.2-dev.35681806994" : "development";
12134
12134
  var ZLM_MAX_HOST_TOOLS = 64;
12135
12135
  var ZLM_MAX_SYSTEM_PROMPT_BYTES = 128 * 1024;
12136
12136
  var ZLM_HOST_APPROVAL_CAPABILITIES = Object.freeze([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zergai/ztc",
3
- "version": "0.2.1-dev.35568243511",
3
+ "version": "0.2.2-dev.35681806994",
4
4
  "description": "Zerg Terminal Client - CLI agent for continual AI systems",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "repository": {
@@ -185,7 +185,6 @@
185
185
  "!packages/sim-swarm/dist/**/*.map"
186
186
  ],
187
187
  "bundleDependencies": [
188
- "@ztc/sim-graph",
189
188
  "@ztc/sim-swarm",
190
189
  "exceljs",
191
190
  "pptxgenjs"
@@ -235,7 +234,7 @@
235
234
  "zergRelease": {
236
235
  "branch": "development",
237
236
  "channel": "dev",
238
- "sourceCommit": "9b2af5998a14aede74ab4248aa3157acf515e467",
237
+ "sourceCommit": "151af97a4d4b5b99fc85d5d88ec93da820b1e5a3",
239
238
  "sourceVersion": "0.2.0-canary.1"
240
239
  },
241
240
  "publishConfig": {
@@ -1 +0,0 @@
1
- export * from './sim_graph.js';
@@ -1 +0,0 @@
1
- export * from './sim_graph.js';
@@ -1,351 +0,0 @@
1
- /**
2
- * SimGraph — FalkorDB Graph Backbone for Simulation
3
- *
4
- * Property graph storing entities, temporal facts, relationships,
5
- * feed posts, and events. Replaces flat in-memory stores with
6
- * structured, queryable graph data.
7
- *
8
- * Inspired by MiroFish/Graphiti's temporal knowledge graph but
9
- * implemented natively in TypeScript with FalkorDBLite (embedded,
10
- * no Docker, no Python).
11
- */
12
- /**
13
- * Scalar + nested shape accepted by FalkorDB parameter binding. Mirrors
14
- * the internal `QueryParam` type from the `falkordb` package (which is
15
- * not exported) so consumers of `rawQuery` get the same strictness.
16
- */
17
- export type QueryParamValue = null | string | number | boolean | QueryParams | QueryParamValue[];
18
- export interface QueryParams {
19
- [key: string]: QueryParamValue;
20
- }
21
- export interface GraphFact {
22
- id: string;
23
- content: string;
24
- category: string;
25
- sourceTick: number;
26
- validFrom: number;
27
- invalidAt: number | null;
28
- }
29
- export interface GraphRelationship {
30
- agentIdA: string;
31
- agentIdB: string;
32
- nameA: string;
33
- nameB: string;
34
- sentiment: number;
35
- trust: number;
36
- interactionCount: number;
37
- lastNote: string | null;
38
- }
39
- export interface GraphFeedPost {
40
- id: string;
41
- content: string;
42
- authorId: string;
43
- authorName: string;
44
- authorRole: string;
45
- source: string;
46
- createdAt: number;
47
- replyTo: string | null;
48
- reactionCount: number;
49
- topicTags: string[];
50
- }
51
- export interface GraphContext {
52
- facts: GraphFact[];
53
- agents: Array<{
54
- id: string;
55
- name: string;
56
- role: string;
57
- }>;
58
- relationships: GraphRelationship[];
59
- }
60
- export interface WorldView {
61
- ownFacts: GraphFact[];
62
- peerFacts: Array<{
63
- peerName: string;
64
- peerRole: string;
65
- facts: GraphFact[];
66
- }>;
67
- topicFacts: GraphFact[];
68
- }
69
- export interface SimulationGraphFact {
70
- id: string;
71
- subjectId: string;
72
- predicate: string;
73
- objectId: string;
74
- content: string;
75
- validFrom: number;
76
- invalidAt: number | null;
77
- sourceEventId: string;
78
- data: Record<string, unknown>;
79
- }
80
- export interface SimulationGraphFactInput {
81
- id: string;
82
- subjectId: string;
83
- predicate: string;
84
- objectId?: string;
85
- content: string;
86
- validFrom: number;
87
- invalidAt?: number | null;
88
- sourceEventId?: string;
89
- supersedesIds?: string[];
90
- data?: Record<string, unknown>;
91
- }
92
- export interface SimulationGraphEdge {
93
- sourceId: string;
94
- targetId: string;
95
- type: string;
96
- tick: number;
97
- data: Record<string, unknown>;
98
- }
99
- export interface SimulationFactGraph {
100
- schemaVersion: 1;
101
- facts: SimulationGraphFact[];
102
- edges: SimulationGraphEdge[];
103
- }
104
- export interface RecordSimulationFactInput {
105
- graph?: SimulationFactGraph;
106
- fact: SimulationGraphFactInput;
107
- }
108
- export interface ProjectActiveFactsInput {
109
- graph: SimulationFactGraph;
110
- atTick: number;
111
- subjectIds?: string[];
112
- predicates?: string[];
113
- }
114
- export interface SimulationNeighborhoodInput {
115
- graph: SimulationFactGraph;
116
- startIds: string[];
117
- maxDepth?: number;
118
- edgeTypes?: string[];
119
- }
120
- export interface SimulationNeighborhood {
121
- schemaVersion: 1;
122
- factIds: string[];
123
- facts: SimulationGraphFact[];
124
- edges: SimulationGraphEdge[];
125
- depthByFactId: Record<string, number>;
126
- }
127
- export type SimulationFocusGraphDirection = 'in' | 'out' | 'both';
128
- export interface SimulationFocusGraphNode {
129
- id: string;
130
- kind?: string;
131
- label?: string;
132
- data?: Record<string, unknown>;
133
- }
134
- export interface SimulationFocusGraphEdge {
135
- sourceId: string;
136
- targetId: string;
137
- type: string;
138
- createdAt?: string;
139
- data: Record<string, unknown>;
140
- }
141
- export interface SimulationFocusRelationSpec {
142
- name: string;
143
- edgeTypes: string[];
144
- direction?: SimulationFocusGraphDirection;
145
- limit?: number;
146
- }
147
- export interface SimulationFocusLineageSpec {
148
- edgeTypes: string[];
149
- direction?: Exclude<SimulationFocusGraphDirection, 'both'>;
150
- includeFocus?: boolean;
151
- maxDepth?: number;
152
- }
153
- export interface BuildSimulationFocusGraphContextInput {
154
- nodes?: SimulationFocusGraphNode[];
155
- edges?: SimulationFocusGraphEdge[];
156
- focusIds?: string[];
157
- relations?: SimulationFocusRelationSpec[];
158
- lineage?: SimulationFocusLineageSpec;
159
- maxFocusIds?: number;
160
- }
161
- export interface SimulationFocusLineage {
162
- focusId: string;
163
- nodeIds: string[];
164
- edgeTypes: string[];
165
- edges: SimulationFocusGraphEdge[];
166
- }
167
- export interface SimulationFocusRelationGroup {
168
- name: string;
169
- focusId: string;
170
- nodeIds: string[];
171
- edges: SimulationFocusGraphEdge[];
172
- }
173
- export interface SimulationFocusGraphContext {
174
- version: 1;
175
- focusIds: string[];
176
- lineages: SimulationFocusLineage[];
177
- relationGroups: SimulationFocusRelationGroup[];
178
- }
179
- export interface SimulationSteeringEvent {
180
- id: string;
181
- eventType?: string;
182
- acceptedSignalKinds?: string[];
183
- subjectId?: string;
184
- verdict?: string;
185
- selectionStatus?: string;
186
- createdAt?: string;
187
- data?: Record<string, unknown>;
188
- }
189
- export interface SimulationSteeringSignal {
190
- kind?: string;
191
- subjectId?: string;
192
- verdict?: string;
193
- selectionStatus?: string;
194
- priority?: number;
195
- data?: Record<string, unknown>;
196
- }
197
- export interface SimulationSteeringTask {
198
- id: string;
199
- taskType?: string;
200
- source?: string;
201
- createdAt?: string;
202
- signals?: SimulationSteeringSignal[];
203
- }
204
- export interface SimulationSteeringOutput {
205
- id: string;
206
- taskId: string;
207
- outputType?: string;
208
- createdAt?: string;
209
- data?: Record<string, unknown>;
210
- }
211
- export interface SimulationSteeringInfluenceEdge {
212
- sourceId: string;
213
- targetId: string;
214
- type: 'steering_influenced_task' | 'steering_influenced_output';
215
- createdAt: string;
216
- data: Record<string, unknown>;
217
- }
218
- export interface BuildSimulationSteeringInfluenceGraphInput {
219
- steeringEvents?: SimulationSteeringEvent[];
220
- tasks?: SimulationSteeringTask[];
221
- outputs?: SimulationSteeringOutput[];
222
- ignoreVerdictKinds?: string[];
223
- }
224
- export interface SimulationSteeringInfluenceGraph {
225
- version: 1;
226
- taskEdges: SimulationSteeringInfluenceEdge[];
227
- outputEdges: SimulationSteeringInfluenceEdge[];
228
- }
229
- export interface SimulationRestartMemoryGraphStats {
230
- nodes: number;
231
- edges: number;
232
- activeFactCount: number;
233
- }
234
- export interface SimulationRestartMemoryPacket<TFact = Record<string, unknown>> {
235
- version: 1;
236
- runId: string;
237
- focusIds: string[];
238
- activeFacts: TFact[];
239
- graphStats: SimulationRestartMemoryGraphStats;
240
- }
241
- export interface BuildSimulationRestartMemoryInput<TFact = Record<string, unknown>> {
242
- runId?: string;
243
- focusIds?: string[];
244
- activeFacts?: TFact[];
245
- graphStats?: Partial<SimulationRestartMemoryGraphStats>;
246
- maxFocusIds?: number;
247
- }
248
- export declare function recordSimulationFact(input: RecordSimulationFactInput): SimulationFactGraph;
249
- export declare function projectActiveFacts(input: ProjectActiveFactsInput): SimulationGraphFact[];
250
- export declare function traverseSimulationNeighborhood(input: SimulationNeighborhoodInput): SimulationNeighborhood;
251
- export declare function buildSimulationFocusGraphContext(input: BuildSimulationFocusGraphContextInput): SimulationFocusGraphContext;
252
- export declare function buildSimulationSteeringInfluenceGraph(input: BuildSimulationSteeringInfluenceGraphInput): SimulationSteeringInfluenceGraph;
253
- export declare function buildSimulationRestartMemory<TFact = Record<string, unknown>>(input: BuildSimulationRestartMemoryInput<TFact>): SimulationRestartMemoryPacket<TFact>;
254
- export declare class SimGraph {
255
- private db;
256
- private graph;
257
- /** Per-instance counter (review #8: avoid module-level mutable state) */
258
- private factCounter;
259
- private constructor();
260
- /**
261
- * Open an embedded FalkorDB instance and select the simulation graph.
262
- * If dataPath is provided, data persists to disk.
263
- */
264
- static open(dataPath?: string): Promise<SimGraph>;
265
- /** Close the graph database and stop the embedded server. */
266
- close(): Promise<void>;
267
- /**
268
- * Escape hatch for domain-specific adapters that want to use labels/
269
- * relationships outside the built-in schema (e.g. cybersim's `:CS*`
270
- * nodes). Returned shape matches FalkorDB's `graph.query` result.
271
- */
272
- rawQuery<T = Record<string, unknown>>(cypher: string, params?: QueryParams): Promise<{
273
- data?: T[];
274
- }>;
275
- /**
276
- * Register a range index on a node label/property pair. Safe to call
277
- * for already-indexed pairs — creation errors are swallowed.
278
- */
279
- ensureNodeIndex(label: string, property: string): Promise<void>;
280
- /** Create indices for common query patterns. */
281
- private initSchema;
282
- addAgent(agent: {
283
- id: string;
284
- name: string;
285
- role: string;
286
- organization: string;
287
- type: 'internal' | 'external';
288
- }): Promise<void>;
289
- addCompany(company: {
290
- id: string;
291
- name: string;
292
- industry: string;
293
- stage: string;
294
- }): Promise<void>;
295
- addCompetitor(companyIdA: string, companyIdB: string): Promise<void>;
296
- addWorksAt(agentId: string, companyId: string): Promise<void>;
297
- /** Add a fact stated by an agent. Returns the fact ID. */
298
- addFact(agentId: string, content: string, category: string, tick: number, aboutEntityId?: string): Promise<string>;
299
- /** Invalidate a fact at the given tick. */
300
- invalidateFact(factId: string, tick: number): Promise<void>;
301
- /**
302
- * Add a fact, checking for contradictions. If the same agent has
303
- * a current fact in the same category about the same entity,
304
- * invalidate the old fact and create a SUPERSEDES edge.
305
- */
306
- addFactWithSupersede(agentId: string, content: string, category: string, tick: number, aboutEntityId?: string): Promise<string>;
307
- /** Get all facts stated by an agent. */
308
- getAgentFacts(agentId: string, currentOnly?: boolean): Promise<GraphFact[]>;
309
- /** Get all facts about an entity. */
310
- getFactsAbout(entityId: string, currentOnly?: boolean): Promise<GraphFact[]>;
311
- /** Get facts matching a keyword in content. */
312
- getFactsByKeyword(keyword: string, currentOnly?: boolean): Promise<GraphFact[]>;
313
- setRelationship(agentIdA: string, agentIdB: string, sentiment: number, trust: number, interactionCount: number, note?: string): Promise<void>;
314
- /** Review #12: Query both directions for KNOWS relationship. */
315
- getRelationship(agentIdA: string, agentIdB: string): Promise<GraphRelationship | null>;
316
- getRelationshipsFor(agentId: string): Promise<GraphRelationship[]>;
317
- addPost(post: {
318
- id: string;
319
- content: string;
320
- authorId: string;
321
- authorName: string;
322
- authorRole: string;
323
- source: string;
324
- tick: number;
325
- replyTo?: string;
326
- topicTags?: string[];
327
- }): Promise<void>;
328
- addReaction(agentId: string, postId: string): Promise<void>;
329
- getRecentPosts(limit?: number, sinceTick?: number): Promise<GraphFeedPost[]>;
330
- addEvent(event: {
331
- id: string;
332
- type: string;
333
- description: string;
334
- tick: number;
335
- participantIds: string[];
336
- }): Promise<void>;
337
- /**
338
- * Get an agent's full world view at a given tick:
339
- * - Facts they've stated (current)
340
- * - Facts their peers have stated (current)
341
- * - Facts about topics they've discussed
342
- */
343
- getAgentWorldView(agentId: string, tick: number): Promise<WorldView>;
344
- /**
345
- * Get context around any entity — all facts, agents, and relationships.
346
- * Review #9: removed unused depth param (queries are always 1-hop).
347
- */
348
- getEntityContext(entityId: string): Promise<GraphContext>;
349
- private parseFactRows;
350
- private parsePostRows;
351
- }