mindgraph 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -52,6 +52,10 @@ new MindGraph({ baseUrl: string, apiKey?: string, jwt?: string })
52
52
  |--------|-------------|
53
53
  | `capture(req)` | Capture a source, snippet, or observation |
54
54
  | `entity(req)` | Create, alias, resolve, or merge entities |
55
+ | `series(req)` | Call the typed time-series action surface directly |
56
+ | `createSeries` / `appendSeries` / `seriesWindow` | Create a Series, append sourced points, and page through a bounded time window |
57
+ | `aggregateSeries` / `latestSeries` / `listSeriesForEntity` | Read bounded aggregates, cached latest values, and an entity's Series |
58
+ | `batchLatestSeries` / `batchAggregateSeries` / `deleteSeries` | Compare Series across entities or tombstone a Series and its points |
55
59
  | `findOrCreateEntity(label, props?, agentId?)` | Convenience: create or find an entity by label (generic fallback) |
56
60
  | `findOrCreatePerson(label, props?, agentId?)` | Find or create a Person entity |
57
61
  | `findOrCreateOrganization(label, props?, agentId?)` | Find or create an Organization entity |
@@ -103,9 +107,25 @@ const entity = await graph.findOrCreateEntity("Some Entity");
103
107
  |--------|-------------|
104
108
  | `session(req)` | Open a session, record traces, or close a session |
105
109
  | `journal(label, props, options?)` | Record a journal entry linked to an optional session |
106
- | `distill(req)` | Create a Summary (default) or Lesson with source provenance |
110
+ | `distill(req)` | Create a Summary, Lesson, or governed Skill candidate with source provenance |
107
111
  | `memoryConfig(req)` | Set/get preferences and memory policies |
108
112
 
113
+ `output_type: "skill"` requires caller-authored SKILL.md content and at
114
+ least one provenance field. It always creates a candidate for review:
115
+
116
+ ```typescript
117
+ await graph.distill({
118
+ label: "Recover a malformed import",
119
+ output_type: "skill",
120
+ work_uid: "work_import_42",
121
+ props: {
122
+ name: "recover-malformed-import",
123
+ description: "Use after a spreadsheet import fails schema validation.",
124
+ content: "# Recovery\n\nValidate headers, normalize dates, then retry.",
125
+ },
126
+ });
127
+ ```
128
+
109
129
  ### Agent Layer
110
130
 
111
131
  | Method | Description |
@@ -139,6 +159,7 @@ Define typed domain objects (Customer, Order, Contract…) as a semantic contrac
139
159
  |--------|-------------|
140
160
  | `proposeOntologySchema(req)` | Draft a schema from a description (+ optional sample docs); returns `{ schema_id, job_id }` |
141
161
  | `activateOntologySchema(id)` / `getOntologySchema(id)` / `listOntologySchemas()` | Schema lifecycle |
162
+ | `createOntologySeriesBinding` / `syncOntologySeriesBinding` / `archiveOntologySeriesBinding` | Manage SQL-backed dense-measurement bindings |
142
163
  | `listOntologyProposals(opts?)` / `approveOntologyProposal(id)` / `rejectOntologyProposal(id)` | Review extracted-object proposals |
143
164
  | `queryOntology({ query, include_cognitive_context })` | Typed retrieval with the cognitive overlay fused in |
144
165
  | `listOntologyTools()` | The generated read-tool manifest (`search_/get_/summarize_<obj>`) the MCP server renders |
package/dist/index.d.mts CHANGED
@@ -179,6 +179,47 @@ interface PlaceProps {
179
179
  identifiers?: Record<string, string>;
180
180
  attributes?: Record<string, unknown>;
181
181
  }
182
+ interface FiscalYearEnd {
183
+ month: number;
184
+ day: number;
185
+ }
186
+ interface SeriesProps {
187
+ name: string;
188
+ description: string;
189
+ unit?: string | null;
190
+ temporality: "instant" | "period";
191
+ period_unit?: "year" | "quarter" | "month" | "week" | "day" | null;
192
+ fiscal_year_end: FiscalYearEnd;
193
+ value_kind: string;
194
+ default_source_uid?: string | null;
195
+ origin: "ingest" | "connector";
196
+ binding_uid?: string | null;
197
+ binding_name?: string | null;
198
+ n_points: number;
199
+ min_t?: number | null;
200
+ max_t?: number | null;
201
+ latest_t?: number | null;
202
+ latest_value?: number | null;
203
+ latest_period_label?: string | null;
204
+ }
205
+ type SeriesNode = Omit<GraphNode, "props"> & {
206
+ props: SeriesProps;
207
+ };
208
+ interface MeasurementPoint {
209
+ /** Microseconds since the Unix epoch (UTC). */
210
+ t: number;
211
+ value: number;
212
+ scale_applied?: number;
213
+ period_start?: number | null;
214
+ period_label?: string | null;
215
+ source_uid?: string | null;
216
+ source_ref?: string | null;
217
+ }
218
+ interface AggregatePoint {
219
+ /** UTC bucket start, microseconds since the Unix epoch. */
220
+ t: number;
221
+ value: number | null;
222
+ }
182
223
  interface CaptureRequest {
183
224
  action: "source" | "snippet" | "observation";
184
225
  label: string;
@@ -212,6 +253,146 @@ interface EntityRequest {
212
253
  /** Explicit writable Project/repository/agent Space for an identity-backed create. */
213
254
  identity_space_uid?: string;
214
255
  }
256
+ type SeriesRequest = {
257
+ action: "create";
258
+ entity_uid: string;
259
+ name: string;
260
+ description?: string;
261
+ unit?: string;
262
+ temporality: "instant" | "period";
263
+ period_unit?: "year" | "quarter" | "month" | "week" | "day";
264
+ fiscal_year_end?: FiscalYearEnd;
265
+ value_kind?: string;
266
+ default_source_uid?: string;
267
+ origin?: "ingest" | "connector";
268
+ space_uid?: string;
269
+ agent_id?: string;
270
+ } | {
271
+ action: "append";
272
+ series_uid: string;
273
+ points: MeasurementPoint[];
274
+ agent_id?: string;
275
+ } | {
276
+ action: "window";
277
+ series_uid: string;
278
+ from: number;
279
+ to: number;
280
+ cursor?: number;
281
+ limit?: number;
282
+ project_uid?: string;
283
+ } | {
284
+ action: "aggregate";
285
+ series_uid: string;
286
+ from: number;
287
+ to: number;
288
+ bucket: "year" | "quarter" | "month" | "week" | "day" | "hour";
289
+ agg: "sum" | "mean" | "min" | "max" | "count" | "std_dev" | "last";
290
+ fill?: "none" | "null" | "prev";
291
+ project_uid?: string;
292
+ } | {
293
+ action: "latest";
294
+ series_uid: string;
295
+ project_uid?: string;
296
+ } | {
297
+ action: "list_for_entity";
298
+ entity_uid: string;
299
+ project_uid?: string;
300
+ } | {
301
+ action: "batch_latest";
302
+ entity_uids: string[];
303
+ series_names?: string[];
304
+ project_uid?: string;
305
+ } | {
306
+ action: "batch_aggregate";
307
+ series_uids: string[];
308
+ from: number;
309
+ to: number;
310
+ bucket: "year" | "quarter" | "month" | "week" | "day" | "hour";
311
+ agg: "sum" | "mean" | "min" | "max" | "count" | "std_dev" | "last";
312
+ fill?: "none" | "null" | "prev";
313
+ project_uid?: string;
314
+ } | {
315
+ action: "delete_series";
316
+ series_uid: string;
317
+ reason?: string;
318
+ agent_id?: string;
319
+ };
320
+ interface CreateSeriesResponse {
321
+ created: boolean;
322
+ series: SeriesNode;
323
+ }
324
+ interface AppendSeriesResponse {
325
+ series_uid: string;
326
+ appended: number;
327
+ stats: Pick<SeriesProps, "n_points" | "min_t" | "max_t" | "latest_t" | "latest_value">;
328
+ }
329
+ interface SeriesWindowResponse {
330
+ series_uid: string;
331
+ from: number;
332
+ to: number;
333
+ points: MeasurementPoint[];
334
+ next_cursor: number | null;
335
+ }
336
+ interface SeriesAggregateResponse {
337
+ series_uid: string;
338
+ from: number;
339
+ to: number;
340
+ bucket: string;
341
+ agg: string;
342
+ fill: string;
343
+ estimated_scanned_points: number;
344
+ points: AggregatePoint[];
345
+ }
346
+ interface SeriesLatestResponse {
347
+ series_uid: string;
348
+ n_points: number;
349
+ min_t: number | null;
350
+ max_t: number | null;
351
+ latest_t: number | null;
352
+ latest_value: number | null;
353
+ latest_period_label: string | null;
354
+ }
355
+ interface ListSeriesResponse {
356
+ entity_uid: string;
357
+ series: SeriesNode[];
358
+ }
359
+ interface BatchLatestSeriesResponse {
360
+ entity_count: number;
361
+ series_names: string[];
362
+ rows: Array<{
363
+ entity_uid: string;
364
+ series_uid: string;
365
+ name: string;
366
+ unit: string | null;
367
+ temporality: string;
368
+ period_unit: string | null;
369
+ n_points: number;
370
+ latest_t: number | null;
371
+ latest_value: number | null;
372
+ latest_period_label: string | null;
373
+ }>;
374
+ coverage_complete: boolean;
375
+ }
376
+ interface BatchAggregateSeriesResponse {
377
+ from: number;
378
+ to: number;
379
+ bucket: string;
380
+ agg: string;
381
+ fill: string;
382
+ estimated_scanned_points: number;
383
+ series: Array<{
384
+ series_uid: string;
385
+ name: string;
386
+ unit: string | null;
387
+ estimated_scanned_points: number;
388
+ points: AggregatePoint[];
389
+ }>;
390
+ }
391
+ interface DeleteSeriesResponse {
392
+ series_uid: string;
393
+ deleted: boolean;
394
+ tombstoned_points: number;
395
+ }
215
396
  interface ArgumentRequest {
216
397
  claim: {
217
398
  label: string;
@@ -344,10 +525,18 @@ interface SessionRequest {
344
525
  props?: Record<string, unknown>;
345
526
  agent_id?: string;
346
527
  }
347
- interface DistillRequest {
528
+ /** Caller-authored content for a governed skill candidate. */
529
+ interface SkillDistillProps {
530
+ /** Stable agentskills.io identifier: 1-64 lowercase letters, digits, or hyphens. */
531
+ name: string;
532
+ /** Human-readable trigger guidance (1-1024 characters; XML tags are rejected). */
533
+ description: string;
534
+ /** Complete SKILL.md body, capped by the server at 64 KiB. */
535
+ content: string;
536
+ license?: string;
537
+ }
538
+ interface DistillRequestBase {
348
539
  label: string;
349
- /** Defaults to "summary" for backward compatibility. */
350
- output_type?: "summary" | "lesson";
351
540
  summary?: string;
352
541
  confidence?: number;
353
542
  salience?: number;
@@ -357,9 +546,18 @@ interface DistillRequest {
357
546
  execution_uid?: string;
358
547
  idempotency_key?: string;
359
548
  supersedes_uid?: string;
360
- props?: Record<string, unknown>;
361
549
  agent_id?: string;
362
550
  }
551
+ interface SummaryOrLessonDistillRequest extends DistillRequestBase {
552
+ /** Defaults to "summary" for backward compatibility. */
553
+ output_type?: "summary" | "lesson";
554
+ props?: Record<string, unknown>;
555
+ }
556
+ interface SkillDistillRequest extends DistillRequestBase {
557
+ output_type: "skill";
558
+ props: SkillDistillProps;
559
+ }
560
+ type DistillRequest = SummaryOrLessonDistillRequest | SkillDistillRequest;
363
561
  interface MemoryConfigRequest {
364
562
  action: "set_preference" | "get_preferences" | "set_policy" | "get_policies";
365
563
  label?: string;
@@ -763,6 +961,30 @@ interface BelievedBy {
763
961
  /** The asserting agent's certainty in the claim, or null if unspecified. */
764
962
  confidence: number | null;
765
963
  }
964
+ interface SeriesContextAnnotation {
965
+ uid: string;
966
+ name: string;
967
+ unit: string | null;
968
+ temporality: string;
969
+ origin: "ingest" | "connector" | string;
970
+ binding_name?: string | null;
971
+ /** Equivalent parallel Series; connector-backed entries sort first. */
972
+ same_metric_as?: Array<{
973
+ uid: string;
974
+ name: string;
975
+ origin: "ingest" | "connector" | string;
976
+ binding_name?: string | null;
977
+ }>;
978
+ /** Omitted for an empty Series (unknown is not zero). */
979
+ n_points?: number;
980
+ first_t?: number | null;
981
+ last_t?: number | null;
982
+ latest?: {
983
+ value: number | null;
984
+ t: number | null;
985
+ period_label: string | null;
986
+ };
987
+ }
766
988
  interface RetrieveContextResponse {
767
989
  articles?: ArticleResult[];
768
990
  chunks?: {
@@ -785,6 +1007,7 @@ interface RetrieveContextResponse {
785
1007
  }[];
786
1008
  source_chunks?: SourceChunk[];
787
1009
  believed_by?: BelievedBy[];
1010
+ series?: SeriesContextAnnotation[];
788
1011
  /** This node has been replaced by a newer value (Supersedes edge). */
789
1012
  superseded?: boolean;
790
1013
  /** UID of the node that superseded this one. */
@@ -1149,6 +1372,43 @@ interface BackingSync {
1149
1372
  /** null = manual "Sync now"; cron later. */
1150
1373
  schedule?: string | null;
1151
1374
  }
1375
+ interface SeriesBacking {
1376
+ connection_ref: string;
1377
+ table: string;
1378
+ entity_key_column: string;
1379
+ time_column: string;
1380
+ value_column: string;
1381
+ filter?: BackingFilter;
1382
+ cursor_column?: string;
1383
+ }
1384
+ interface OntologySeriesBinding {
1385
+ id: string;
1386
+ schema_id: string;
1387
+ org_id: string;
1388
+ name: string;
1389
+ entity_type: string;
1390
+ unit?: string | null;
1391
+ temporality: "instant" | "period";
1392
+ period_unit?: "year" | "half" | "quarter" | "month" | "week" | "day" | null;
1393
+ fiscal_year_end: {
1394
+ month: number;
1395
+ day: number;
1396
+ };
1397
+ backing: SeriesBacking;
1398
+ cursor_value?: string | null;
1399
+ last_domain_time?: string | null;
1400
+ reconcile_periods: number;
1401
+ last_source_keys: string[];
1402
+ last_reconciliation?: {
1403
+ deleted_source_keys: string[];
1404
+ deleted_count: number;
1405
+ policy: "rows_retained";
1406
+ completed_at: string;
1407
+ } | null;
1408
+ status: "active" | "archived";
1409
+ created_at: string;
1410
+ updated_at: string;
1411
+ }
1152
1412
  /** Datasource binding for a relation type (FK column or M:M join table). */
1153
1413
  type RelationBacking = {
1154
1414
  kind: "sql_fk";
@@ -1240,6 +1500,7 @@ interface OntologyRelationType {
1240
1500
  interface OntologySchemaDetail extends OntologySchema {
1241
1501
  object_types: OntologyObjectType[];
1242
1502
  relation_types: OntologyRelationType[];
1503
+ series_bindings: OntologySeriesBinding[];
1243
1504
  }
1244
1505
  /** A generated read-only tool descriptor (from `listOntologyTools`). */
1245
1506
  interface OntologyToolDescriptor {
@@ -1573,6 +1834,36 @@ declare class MindGraph {
1573
1834
  }): Promise<unknown>;
1574
1835
  capture(req: CaptureRequest): Promise<unknown>;
1575
1836
  entity(req: EntityRequest): Promise<unknown>;
1837
+ series(req: SeriesRequest): Promise<unknown>;
1838
+ createSeries(req: Omit<Extract<SeriesRequest, {
1839
+ action: "create";
1840
+ }>, "action">): Promise<CreateSeriesResponse>;
1841
+ appendSeries(req: Omit<Extract<SeriesRequest, {
1842
+ action: "append";
1843
+ }>, "action">): Promise<AppendSeriesResponse>;
1844
+ seriesWindow(req: Omit<Extract<SeriesRequest, {
1845
+ action: "window";
1846
+ }>, "action">): Promise<SeriesWindowResponse>;
1847
+ aggregateSeries(req: Omit<Extract<SeriesRequest, {
1848
+ action: "aggregate";
1849
+ }>, "action">): Promise<SeriesAggregateResponse>;
1850
+ latestSeries(seriesUid: string, options?: {
1851
+ project_uid?: string;
1852
+ }): Promise<SeriesLatestResponse>;
1853
+ listSeriesForEntity(entityUid: string, options?: {
1854
+ project_uid?: string;
1855
+ }): Promise<ListSeriesResponse>;
1856
+ batchLatestSeries(entityUids: string[], options?: {
1857
+ series_names?: string[];
1858
+ project_uid?: string;
1859
+ }): Promise<BatchLatestSeriesResponse>;
1860
+ batchAggregateSeries(req: Omit<Extract<SeriesRequest, {
1861
+ action: "batch_aggregate";
1862
+ }>, "action">): Promise<BatchAggregateSeriesResponse>;
1863
+ deleteSeries(seriesUid: string, options?: {
1864
+ reason?: string;
1865
+ agent_id?: string;
1866
+ }): Promise<DeleteSeriesResponse>;
1576
1867
  /** Convenience: create or find an entity by label. */
1577
1868
  findOrCreateEntity(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
1578
1869
  created: boolean;
@@ -1950,6 +2241,23 @@ declare class MindGraph {
1950
2241
  items: OntologySchema[];
1951
2242
  }>;
1952
2243
  getOntologySchema(id: string): Promise<OntologySchemaDetail>;
2244
+ createOntologySeriesBinding(schemaId: string, request: {
2245
+ name: string;
2246
+ entity_type: string;
2247
+ unit?: string;
2248
+ temporality?: "instant" | "period";
2249
+ period_unit?: "year" | "half" | "quarter" | "month" | "week" | "day";
2250
+ fiscal_year_end?: {
2251
+ month: number;
2252
+ day: number;
2253
+ };
2254
+ backing: SeriesBacking;
2255
+ reconcile_periods?: number;
2256
+ }): Promise<OntologySeriesBinding>;
2257
+ syncOntologySeriesBinding(bindingId: string, mode?: "incremental" | "full"): Promise<{
2258
+ sync_job_id: string;
2259
+ }>;
2260
+ archiveOntologySeriesBinding(schemaId: string, bindingId: string): Promise<void>;
1953
2261
  createOntologySchema(req: CreateOntologySchemaRequest): Promise<OntologySchema>;
1954
2262
  updateOntologySchema(id: string, req: UpdateOntologySchemaRequest): Promise<OntologySchema>;
1955
2263
  activateOntologySchema(id: string): Promise<OntologySchema>;
@@ -2119,4 +2427,4 @@ declare class MindGraph {
2119
2427
  }>;
2120
2428
  }
2121
2429
 
2122
- export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, type BelievedBy, type CanonicalAttachmentAuthority, type CanonicalAttachmentBinding, type CanonicalAttachmentDirection, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type CreateOntologySchemaRequest, type DecayRequest, type DeliberationRequest, type DialecticalPair, type DistillRequest, type DocumentRef, type EnrichedSearchResponse, type EntityBridge, type EntityRequest, type EpistemicCounts, type EventProps, type EvolveRequest, type ExecutionRequest, type FieldDefinition, type FieldSemantic, type FieldSemanticKind, type GovernanceRequest, type GovernanceTarget, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type ListArticlesResponse, type MemoryConfigRequest, type MemorySyncRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type NormativeKind, type ObjectBacking, type OntologicalBaseKind, type OntologyDuplicateAudit, type OntologyObjectType, type OntologyObjectTypeInput, type OntologyPredicateOperator, type OntologyProposal, type OntologyQueryPredicate, type OntologyRelationType, type OntologyRelationTypeInput, type OntologySchema, type OntologySchemaDetail, type OntologyToolDescriptor, type OrganizationProps, type Participant, type ParticipantSlotKind, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type ProposalEdits, type PurgeRequest, type RankedClaimHub, type RelatedDomainObjectsRequest, type RelationBacking, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SemanticDependence, type SemanticEvidenceRef, type SemanticEvidenceSourceKind, type SemanticGeneratorRef, type SemanticIdentityMode, type SemanticMatch, type SemanticMatchAlternative, type SemanticMatchStatus, type SemanticModifier, type SemanticModifierMatch, type SemanticNegativeControl, type SemanticParticipantSlot, type SemanticRelationKind, type SemanticReviewDecision, type SemanticRigidity, type SemanticRuntimeTemplate, type SemanticSignal, type SemanticSignalKind, type SemanticTemplateRef, type SemanticTemporalMode, type SemanticTenantBindings, type SemanticValidationAuthoringMode, type SemanticValidationMode, type SessionRequest, type SignalsQuery, type SignalsResponse, type SourceChunk, type StructureRequest, type StructuredOntologyQueryRequest, type StructuredOntologyQueryResponse, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest, type UpdateOntologySchemaRequest };
2430
+ export { type AggregatePoint, type AnalogyCandidate, type AppendSeriesResponse, type ArgumentRequest, type ArticleResult, type BatchAggregateSeriesResponse, type BatchLatestSeriesResponse, type BatchRequest, type BelievedBy, type CanonicalAttachmentAuthority, type CanonicalAttachmentBinding, type CanonicalAttachmentDirection, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type CreateOntologySchemaRequest, type CreateSeriesResponse, type DecayRequest, type DeleteSeriesResponse, type DeliberationRequest, type DialecticalPair, type DistillRequest, type DocumentRef, type EnrichedSearchResponse, type EntityBridge, type EntityRequest, type EpistemicCounts, type EventProps, type EvolveRequest, type ExecutionRequest, type FieldDefinition, type FieldSemantic, type FieldSemanticKind, type FiscalYearEnd, type GovernanceRequest, type GovernanceTarget, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type ListArticlesResponse, type ListSeriesResponse, type MeasurementPoint, type MemoryConfigRequest, type MemorySyncRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type NormativeKind, type ObjectBacking, type OntologicalBaseKind, type OntologyDuplicateAudit, type OntologyObjectType, type OntologyObjectTypeInput, type OntologyPredicateOperator, type OntologyProposal, type OntologyQueryPredicate, type OntologyRelationType, type OntologyRelationTypeInput, type OntologySchema, type OntologySchemaDetail, type OntologySeriesBinding, type OntologyToolDescriptor, type OrganizationProps, type Participant, type ParticipantSlotKind, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type ProposalEdits, type PurgeRequest, type RankedClaimHub, type RelatedDomainObjectsRequest, type RelationBacking, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SemanticDependence, type SemanticEvidenceRef, type SemanticEvidenceSourceKind, type SemanticGeneratorRef, type SemanticIdentityMode, type SemanticMatch, type SemanticMatchAlternative, type SemanticMatchStatus, type SemanticModifier, type SemanticModifierMatch, type SemanticNegativeControl, type SemanticParticipantSlot, type SemanticRelationKind, type SemanticReviewDecision, type SemanticRigidity, type SemanticRuntimeTemplate, type SemanticSignal, type SemanticSignalKind, type SemanticTemplateRef, type SemanticTemporalMode, type SemanticTenantBindings, type SemanticValidationAuthoringMode, type SemanticValidationMode, type SeriesAggregateResponse, type SeriesBacking, type SeriesContextAnnotation, type SeriesLatestResponse, type SeriesNode, type SeriesProps, type SeriesRequest, type SeriesWindowResponse, type SessionRequest, type SignalsQuery, type SignalsResponse, type SkillDistillProps, type SkillDistillRequest, type SourceChunk, type StructureRequest, type StructuredOntologyQueryRequest, type StructuredOntologyQueryResponse, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest, type UpdateOntologySchemaRequest };
package/dist/index.d.ts CHANGED
@@ -179,6 +179,47 @@ interface PlaceProps {
179
179
  identifiers?: Record<string, string>;
180
180
  attributes?: Record<string, unknown>;
181
181
  }
182
+ interface FiscalYearEnd {
183
+ month: number;
184
+ day: number;
185
+ }
186
+ interface SeriesProps {
187
+ name: string;
188
+ description: string;
189
+ unit?: string | null;
190
+ temporality: "instant" | "period";
191
+ period_unit?: "year" | "quarter" | "month" | "week" | "day" | null;
192
+ fiscal_year_end: FiscalYearEnd;
193
+ value_kind: string;
194
+ default_source_uid?: string | null;
195
+ origin: "ingest" | "connector";
196
+ binding_uid?: string | null;
197
+ binding_name?: string | null;
198
+ n_points: number;
199
+ min_t?: number | null;
200
+ max_t?: number | null;
201
+ latest_t?: number | null;
202
+ latest_value?: number | null;
203
+ latest_period_label?: string | null;
204
+ }
205
+ type SeriesNode = Omit<GraphNode, "props"> & {
206
+ props: SeriesProps;
207
+ };
208
+ interface MeasurementPoint {
209
+ /** Microseconds since the Unix epoch (UTC). */
210
+ t: number;
211
+ value: number;
212
+ scale_applied?: number;
213
+ period_start?: number | null;
214
+ period_label?: string | null;
215
+ source_uid?: string | null;
216
+ source_ref?: string | null;
217
+ }
218
+ interface AggregatePoint {
219
+ /** UTC bucket start, microseconds since the Unix epoch. */
220
+ t: number;
221
+ value: number | null;
222
+ }
182
223
  interface CaptureRequest {
183
224
  action: "source" | "snippet" | "observation";
184
225
  label: string;
@@ -212,6 +253,146 @@ interface EntityRequest {
212
253
  /** Explicit writable Project/repository/agent Space for an identity-backed create. */
213
254
  identity_space_uid?: string;
214
255
  }
256
+ type SeriesRequest = {
257
+ action: "create";
258
+ entity_uid: string;
259
+ name: string;
260
+ description?: string;
261
+ unit?: string;
262
+ temporality: "instant" | "period";
263
+ period_unit?: "year" | "quarter" | "month" | "week" | "day";
264
+ fiscal_year_end?: FiscalYearEnd;
265
+ value_kind?: string;
266
+ default_source_uid?: string;
267
+ origin?: "ingest" | "connector";
268
+ space_uid?: string;
269
+ agent_id?: string;
270
+ } | {
271
+ action: "append";
272
+ series_uid: string;
273
+ points: MeasurementPoint[];
274
+ agent_id?: string;
275
+ } | {
276
+ action: "window";
277
+ series_uid: string;
278
+ from: number;
279
+ to: number;
280
+ cursor?: number;
281
+ limit?: number;
282
+ project_uid?: string;
283
+ } | {
284
+ action: "aggregate";
285
+ series_uid: string;
286
+ from: number;
287
+ to: number;
288
+ bucket: "year" | "quarter" | "month" | "week" | "day" | "hour";
289
+ agg: "sum" | "mean" | "min" | "max" | "count" | "std_dev" | "last";
290
+ fill?: "none" | "null" | "prev";
291
+ project_uid?: string;
292
+ } | {
293
+ action: "latest";
294
+ series_uid: string;
295
+ project_uid?: string;
296
+ } | {
297
+ action: "list_for_entity";
298
+ entity_uid: string;
299
+ project_uid?: string;
300
+ } | {
301
+ action: "batch_latest";
302
+ entity_uids: string[];
303
+ series_names?: string[];
304
+ project_uid?: string;
305
+ } | {
306
+ action: "batch_aggregate";
307
+ series_uids: string[];
308
+ from: number;
309
+ to: number;
310
+ bucket: "year" | "quarter" | "month" | "week" | "day" | "hour";
311
+ agg: "sum" | "mean" | "min" | "max" | "count" | "std_dev" | "last";
312
+ fill?: "none" | "null" | "prev";
313
+ project_uid?: string;
314
+ } | {
315
+ action: "delete_series";
316
+ series_uid: string;
317
+ reason?: string;
318
+ agent_id?: string;
319
+ };
320
+ interface CreateSeriesResponse {
321
+ created: boolean;
322
+ series: SeriesNode;
323
+ }
324
+ interface AppendSeriesResponse {
325
+ series_uid: string;
326
+ appended: number;
327
+ stats: Pick<SeriesProps, "n_points" | "min_t" | "max_t" | "latest_t" | "latest_value">;
328
+ }
329
+ interface SeriesWindowResponse {
330
+ series_uid: string;
331
+ from: number;
332
+ to: number;
333
+ points: MeasurementPoint[];
334
+ next_cursor: number | null;
335
+ }
336
+ interface SeriesAggregateResponse {
337
+ series_uid: string;
338
+ from: number;
339
+ to: number;
340
+ bucket: string;
341
+ agg: string;
342
+ fill: string;
343
+ estimated_scanned_points: number;
344
+ points: AggregatePoint[];
345
+ }
346
+ interface SeriesLatestResponse {
347
+ series_uid: string;
348
+ n_points: number;
349
+ min_t: number | null;
350
+ max_t: number | null;
351
+ latest_t: number | null;
352
+ latest_value: number | null;
353
+ latest_period_label: string | null;
354
+ }
355
+ interface ListSeriesResponse {
356
+ entity_uid: string;
357
+ series: SeriesNode[];
358
+ }
359
+ interface BatchLatestSeriesResponse {
360
+ entity_count: number;
361
+ series_names: string[];
362
+ rows: Array<{
363
+ entity_uid: string;
364
+ series_uid: string;
365
+ name: string;
366
+ unit: string | null;
367
+ temporality: string;
368
+ period_unit: string | null;
369
+ n_points: number;
370
+ latest_t: number | null;
371
+ latest_value: number | null;
372
+ latest_period_label: string | null;
373
+ }>;
374
+ coverage_complete: boolean;
375
+ }
376
+ interface BatchAggregateSeriesResponse {
377
+ from: number;
378
+ to: number;
379
+ bucket: string;
380
+ agg: string;
381
+ fill: string;
382
+ estimated_scanned_points: number;
383
+ series: Array<{
384
+ series_uid: string;
385
+ name: string;
386
+ unit: string | null;
387
+ estimated_scanned_points: number;
388
+ points: AggregatePoint[];
389
+ }>;
390
+ }
391
+ interface DeleteSeriesResponse {
392
+ series_uid: string;
393
+ deleted: boolean;
394
+ tombstoned_points: number;
395
+ }
215
396
  interface ArgumentRequest {
216
397
  claim: {
217
398
  label: string;
@@ -344,10 +525,18 @@ interface SessionRequest {
344
525
  props?: Record<string, unknown>;
345
526
  agent_id?: string;
346
527
  }
347
- interface DistillRequest {
528
+ /** Caller-authored content for a governed skill candidate. */
529
+ interface SkillDistillProps {
530
+ /** Stable agentskills.io identifier: 1-64 lowercase letters, digits, or hyphens. */
531
+ name: string;
532
+ /** Human-readable trigger guidance (1-1024 characters; XML tags are rejected). */
533
+ description: string;
534
+ /** Complete SKILL.md body, capped by the server at 64 KiB. */
535
+ content: string;
536
+ license?: string;
537
+ }
538
+ interface DistillRequestBase {
348
539
  label: string;
349
- /** Defaults to "summary" for backward compatibility. */
350
- output_type?: "summary" | "lesson";
351
540
  summary?: string;
352
541
  confidence?: number;
353
542
  salience?: number;
@@ -357,9 +546,18 @@ interface DistillRequest {
357
546
  execution_uid?: string;
358
547
  idempotency_key?: string;
359
548
  supersedes_uid?: string;
360
- props?: Record<string, unknown>;
361
549
  agent_id?: string;
362
550
  }
551
+ interface SummaryOrLessonDistillRequest extends DistillRequestBase {
552
+ /** Defaults to "summary" for backward compatibility. */
553
+ output_type?: "summary" | "lesson";
554
+ props?: Record<string, unknown>;
555
+ }
556
+ interface SkillDistillRequest extends DistillRequestBase {
557
+ output_type: "skill";
558
+ props: SkillDistillProps;
559
+ }
560
+ type DistillRequest = SummaryOrLessonDistillRequest | SkillDistillRequest;
363
561
  interface MemoryConfigRequest {
364
562
  action: "set_preference" | "get_preferences" | "set_policy" | "get_policies";
365
563
  label?: string;
@@ -763,6 +961,30 @@ interface BelievedBy {
763
961
  /** The asserting agent's certainty in the claim, or null if unspecified. */
764
962
  confidence: number | null;
765
963
  }
964
+ interface SeriesContextAnnotation {
965
+ uid: string;
966
+ name: string;
967
+ unit: string | null;
968
+ temporality: string;
969
+ origin: "ingest" | "connector" | string;
970
+ binding_name?: string | null;
971
+ /** Equivalent parallel Series; connector-backed entries sort first. */
972
+ same_metric_as?: Array<{
973
+ uid: string;
974
+ name: string;
975
+ origin: "ingest" | "connector" | string;
976
+ binding_name?: string | null;
977
+ }>;
978
+ /** Omitted for an empty Series (unknown is not zero). */
979
+ n_points?: number;
980
+ first_t?: number | null;
981
+ last_t?: number | null;
982
+ latest?: {
983
+ value: number | null;
984
+ t: number | null;
985
+ period_label: string | null;
986
+ };
987
+ }
766
988
  interface RetrieveContextResponse {
767
989
  articles?: ArticleResult[];
768
990
  chunks?: {
@@ -785,6 +1007,7 @@ interface RetrieveContextResponse {
785
1007
  }[];
786
1008
  source_chunks?: SourceChunk[];
787
1009
  believed_by?: BelievedBy[];
1010
+ series?: SeriesContextAnnotation[];
788
1011
  /** This node has been replaced by a newer value (Supersedes edge). */
789
1012
  superseded?: boolean;
790
1013
  /** UID of the node that superseded this one. */
@@ -1149,6 +1372,43 @@ interface BackingSync {
1149
1372
  /** null = manual "Sync now"; cron later. */
1150
1373
  schedule?: string | null;
1151
1374
  }
1375
+ interface SeriesBacking {
1376
+ connection_ref: string;
1377
+ table: string;
1378
+ entity_key_column: string;
1379
+ time_column: string;
1380
+ value_column: string;
1381
+ filter?: BackingFilter;
1382
+ cursor_column?: string;
1383
+ }
1384
+ interface OntologySeriesBinding {
1385
+ id: string;
1386
+ schema_id: string;
1387
+ org_id: string;
1388
+ name: string;
1389
+ entity_type: string;
1390
+ unit?: string | null;
1391
+ temporality: "instant" | "period";
1392
+ period_unit?: "year" | "half" | "quarter" | "month" | "week" | "day" | null;
1393
+ fiscal_year_end: {
1394
+ month: number;
1395
+ day: number;
1396
+ };
1397
+ backing: SeriesBacking;
1398
+ cursor_value?: string | null;
1399
+ last_domain_time?: string | null;
1400
+ reconcile_periods: number;
1401
+ last_source_keys: string[];
1402
+ last_reconciliation?: {
1403
+ deleted_source_keys: string[];
1404
+ deleted_count: number;
1405
+ policy: "rows_retained";
1406
+ completed_at: string;
1407
+ } | null;
1408
+ status: "active" | "archived";
1409
+ created_at: string;
1410
+ updated_at: string;
1411
+ }
1152
1412
  /** Datasource binding for a relation type (FK column or M:M join table). */
1153
1413
  type RelationBacking = {
1154
1414
  kind: "sql_fk";
@@ -1240,6 +1500,7 @@ interface OntologyRelationType {
1240
1500
  interface OntologySchemaDetail extends OntologySchema {
1241
1501
  object_types: OntologyObjectType[];
1242
1502
  relation_types: OntologyRelationType[];
1503
+ series_bindings: OntologySeriesBinding[];
1243
1504
  }
1244
1505
  /** A generated read-only tool descriptor (from `listOntologyTools`). */
1245
1506
  interface OntologyToolDescriptor {
@@ -1573,6 +1834,36 @@ declare class MindGraph {
1573
1834
  }): Promise<unknown>;
1574
1835
  capture(req: CaptureRequest): Promise<unknown>;
1575
1836
  entity(req: EntityRequest): Promise<unknown>;
1837
+ series(req: SeriesRequest): Promise<unknown>;
1838
+ createSeries(req: Omit<Extract<SeriesRequest, {
1839
+ action: "create";
1840
+ }>, "action">): Promise<CreateSeriesResponse>;
1841
+ appendSeries(req: Omit<Extract<SeriesRequest, {
1842
+ action: "append";
1843
+ }>, "action">): Promise<AppendSeriesResponse>;
1844
+ seriesWindow(req: Omit<Extract<SeriesRequest, {
1845
+ action: "window";
1846
+ }>, "action">): Promise<SeriesWindowResponse>;
1847
+ aggregateSeries(req: Omit<Extract<SeriesRequest, {
1848
+ action: "aggregate";
1849
+ }>, "action">): Promise<SeriesAggregateResponse>;
1850
+ latestSeries(seriesUid: string, options?: {
1851
+ project_uid?: string;
1852
+ }): Promise<SeriesLatestResponse>;
1853
+ listSeriesForEntity(entityUid: string, options?: {
1854
+ project_uid?: string;
1855
+ }): Promise<ListSeriesResponse>;
1856
+ batchLatestSeries(entityUids: string[], options?: {
1857
+ series_names?: string[];
1858
+ project_uid?: string;
1859
+ }): Promise<BatchLatestSeriesResponse>;
1860
+ batchAggregateSeries(req: Omit<Extract<SeriesRequest, {
1861
+ action: "batch_aggregate";
1862
+ }>, "action">): Promise<BatchAggregateSeriesResponse>;
1863
+ deleteSeries(seriesUid: string, options?: {
1864
+ reason?: string;
1865
+ agent_id?: string;
1866
+ }): Promise<DeleteSeriesResponse>;
1576
1867
  /** Convenience: create or find an entity by label. */
1577
1868
  findOrCreateEntity(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
1578
1869
  created: boolean;
@@ -1950,6 +2241,23 @@ declare class MindGraph {
1950
2241
  items: OntologySchema[];
1951
2242
  }>;
1952
2243
  getOntologySchema(id: string): Promise<OntologySchemaDetail>;
2244
+ createOntologySeriesBinding(schemaId: string, request: {
2245
+ name: string;
2246
+ entity_type: string;
2247
+ unit?: string;
2248
+ temporality?: "instant" | "period";
2249
+ period_unit?: "year" | "half" | "quarter" | "month" | "week" | "day";
2250
+ fiscal_year_end?: {
2251
+ month: number;
2252
+ day: number;
2253
+ };
2254
+ backing: SeriesBacking;
2255
+ reconcile_periods?: number;
2256
+ }): Promise<OntologySeriesBinding>;
2257
+ syncOntologySeriesBinding(bindingId: string, mode?: "incremental" | "full"): Promise<{
2258
+ sync_job_id: string;
2259
+ }>;
2260
+ archiveOntologySeriesBinding(schemaId: string, bindingId: string): Promise<void>;
1953
2261
  createOntologySchema(req: CreateOntologySchemaRequest): Promise<OntologySchema>;
1954
2262
  updateOntologySchema(id: string, req: UpdateOntologySchemaRequest): Promise<OntologySchema>;
1955
2263
  activateOntologySchema(id: string): Promise<OntologySchema>;
@@ -2119,4 +2427,4 @@ declare class MindGraph {
2119
2427
  }>;
2120
2428
  }
2121
2429
 
2122
- export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, type BelievedBy, type CanonicalAttachmentAuthority, type CanonicalAttachmentBinding, type CanonicalAttachmentDirection, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type CreateOntologySchemaRequest, type DecayRequest, type DeliberationRequest, type DialecticalPair, type DistillRequest, type DocumentRef, type EnrichedSearchResponse, type EntityBridge, type EntityRequest, type EpistemicCounts, type EventProps, type EvolveRequest, type ExecutionRequest, type FieldDefinition, type FieldSemantic, type FieldSemanticKind, type GovernanceRequest, type GovernanceTarget, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type ListArticlesResponse, type MemoryConfigRequest, type MemorySyncRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type NormativeKind, type ObjectBacking, type OntologicalBaseKind, type OntologyDuplicateAudit, type OntologyObjectType, type OntologyObjectTypeInput, type OntologyPredicateOperator, type OntologyProposal, type OntologyQueryPredicate, type OntologyRelationType, type OntologyRelationTypeInput, type OntologySchema, type OntologySchemaDetail, type OntologyToolDescriptor, type OrganizationProps, type Participant, type ParticipantSlotKind, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type ProposalEdits, type PurgeRequest, type RankedClaimHub, type RelatedDomainObjectsRequest, type RelationBacking, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SemanticDependence, type SemanticEvidenceRef, type SemanticEvidenceSourceKind, type SemanticGeneratorRef, type SemanticIdentityMode, type SemanticMatch, type SemanticMatchAlternative, type SemanticMatchStatus, type SemanticModifier, type SemanticModifierMatch, type SemanticNegativeControl, type SemanticParticipantSlot, type SemanticRelationKind, type SemanticReviewDecision, type SemanticRigidity, type SemanticRuntimeTemplate, type SemanticSignal, type SemanticSignalKind, type SemanticTemplateRef, type SemanticTemporalMode, type SemanticTenantBindings, type SemanticValidationAuthoringMode, type SemanticValidationMode, type SessionRequest, type SignalsQuery, type SignalsResponse, type SourceChunk, type StructureRequest, type StructuredOntologyQueryRequest, type StructuredOntologyQueryResponse, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest, type UpdateOntologySchemaRequest };
2430
+ export { type AggregatePoint, type AnalogyCandidate, type AppendSeriesResponse, type ArgumentRequest, type ArticleResult, type BatchAggregateSeriesResponse, type BatchLatestSeriesResponse, type BatchRequest, type BelievedBy, type CanonicalAttachmentAuthority, type CanonicalAttachmentBinding, type CanonicalAttachmentDirection, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type CreateOntologySchemaRequest, type CreateSeriesResponse, type DecayRequest, type DeleteSeriesResponse, type DeliberationRequest, type DialecticalPair, type DistillRequest, type DocumentRef, type EnrichedSearchResponse, type EntityBridge, type EntityRequest, type EpistemicCounts, type EventProps, type EvolveRequest, type ExecutionRequest, type FieldDefinition, type FieldSemantic, type FieldSemanticKind, type FiscalYearEnd, type GovernanceRequest, type GovernanceTarget, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type ListArticlesResponse, type ListSeriesResponse, type MeasurementPoint, type MemoryConfigRequest, type MemorySyncRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type NormativeKind, type ObjectBacking, type OntologicalBaseKind, type OntologyDuplicateAudit, type OntologyObjectType, type OntologyObjectTypeInput, type OntologyPredicateOperator, type OntologyProposal, type OntologyQueryPredicate, type OntologyRelationType, type OntologyRelationTypeInput, type OntologySchema, type OntologySchemaDetail, type OntologySeriesBinding, type OntologyToolDescriptor, type OrganizationProps, type Participant, type ParticipantSlotKind, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type ProposalEdits, type PurgeRequest, type RankedClaimHub, type RelatedDomainObjectsRequest, type RelationBacking, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SemanticDependence, type SemanticEvidenceRef, type SemanticEvidenceSourceKind, type SemanticGeneratorRef, type SemanticIdentityMode, type SemanticMatch, type SemanticMatchAlternative, type SemanticMatchStatus, type SemanticModifier, type SemanticModifierMatch, type SemanticNegativeControl, type SemanticParticipantSlot, type SemanticRelationKind, type SemanticReviewDecision, type SemanticRigidity, type SemanticRuntimeTemplate, type SemanticSignal, type SemanticSignalKind, type SemanticTemplateRef, type SemanticTemporalMode, type SemanticTenantBindings, type SemanticValidationAuthoringMode, type SemanticValidationMode, type SeriesAggregateResponse, type SeriesBacking, type SeriesContextAnnotation, type SeriesLatestResponse, type SeriesNode, type SeriesProps, type SeriesRequest, type SeriesWindowResponse, type SessionRequest, type SignalsQuery, type SignalsResponse, type SkillDistillProps, type SkillDistillRequest, type SourceChunk, type StructureRequest, type StructuredOntologyQueryRequest, type StructuredOntologyQueryResponse, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest, type UpdateOntologySchemaRequest };
package/dist/index.js CHANGED
@@ -86,7 +86,8 @@ var MindGraph = class {
86
86
  );
87
87
  if (res.status === 503 && attempt < this.maxRetries) {
88
88
  lastError = err;
89
- const delay = this.retryBackoffMs * 2 ** attempt;
89
+ const retryAfterSecs = Number(res.headers.get("retry-after"));
90
+ const delay = Number.isFinite(retryAfterSecs) && retryAfterSecs > 0 ? Math.min(retryAfterSecs * 1e3, 1e4) : this.retryBackoffMs * 2 ** attempt;
90
91
  await new Promise((r) => setTimeout(r, delay));
91
92
  continue;
92
93
  }
@@ -137,6 +138,52 @@ var MindGraph = class {
137
138
  async entity(req) {
138
139
  return this.post("/reality/entity", req);
139
140
  }
141
+ async series(req) {
142
+ return this.post("/reality/series", req);
143
+ }
144
+ async createSeries(req) {
145
+ return this.post("/reality/series", { action: "create", ...req });
146
+ }
147
+ async appendSeries(req) {
148
+ return this.post("/reality/series", { action: "append", ...req });
149
+ }
150
+ async seriesWindow(req) {
151
+ return this.post("/reality/series", { action: "window", ...req });
152
+ }
153
+ async aggregateSeries(req) {
154
+ return this.post("/reality/series", { action: "aggregate", ...req });
155
+ }
156
+ async latestSeries(seriesUid, options) {
157
+ return this.post("/reality/series", {
158
+ action: "latest",
159
+ series_uid: seriesUid,
160
+ ...options
161
+ });
162
+ }
163
+ async listSeriesForEntity(entityUid, options) {
164
+ return this.post("/reality/series", {
165
+ action: "list_for_entity",
166
+ entity_uid: entityUid,
167
+ ...options
168
+ });
169
+ }
170
+ async batchLatestSeries(entityUids, options) {
171
+ return this.post("/reality/series", {
172
+ action: "batch_latest",
173
+ entity_uids: entityUids,
174
+ ...options
175
+ });
176
+ }
177
+ async batchAggregateSeries(req) {
178
+ return this.post("/reality/series", { action: "batch_aggregate", ...req });
179
+ }
180
+ async deleteSeries(seriesUid, options) {
181
+ return this.post("/reality/series", {
182
+ action: "delete_series",
183
+ series_uid: seriesUid,
184
+ ...options
185
+ });
186
+ }
140
187
  /** Convenience: create or find an entity by label. */
141
188
  async findOrCreateEntity(label, props, agentId) {
142
189
  return this.post("/reality/entity", {
@@ -706,6 +753,20 @@ var MindGraph = class {
706
753
  async getOntologySchema(id) {
707
754
  return this.get(`/v1/ontology/schemas/${seg(id)}`);
708
755
  }
756
+ async createOntologySeriesBinding(schemaId, request) {
757
+ return this.post(`/v1/ontology/schemas/${seg(schemaId)}/series-bindings`, request);
758
+ }
759
+ async syncOntologySeriesBinding(bindingId, mode) {
760
+ return this.post(
761
+ `/v1/ontology/series-bindings/${seg(bindingId)}/sync`,
762
+ mode ? { mode } : {}
763
+ );
764
+ }
765
+ async archiveOntologySeriesBinding(schemaId, bindingId) {
766
+ return this.del(
767
+ `/v1/ontology/schemas/${seg(schemaId)}/series-bindings/${seg(bindingId)}`
768
+ );
769
+ }
709
770
  async createOntologySchema(req) {
710
771
  return this.post("/v1/ontology/schemas", req);
711
772
  }
package/dist/index.mjs CHANGED
@@ -59,7 +59,8 @@ var MindGraph = class {
59
59
  );
60
60
  if (res.status === 503 && attempt < this.maxRetries) {
61
61
  lastError = err;
62
- const delay = this.retryBackoffMs * 2 ** attempt;
62
+ const retryAfterSecs = Number(res.headers.get("retry-after"));
63
+ const delay = Number.isFinite(retryAfterSecs) && retryAfterSecs > 0 ? Math.min(retryAfterSecs * 1e3, 1e4) : this.retryBackoffMs * 2 ** attempt;
63
64
  await new Promise((r) => setTimeout(r, delay));
64
65
  continue;
65
66
  }
@@ -110,6 +111,52 @@ var MindGraph = class {
110
111
  async entity(req) {
111
112
  return this.post("/reality/entity", req);
112
113
  }
114
+ async series(req) {
115
+ return this.post("/reality/series", req);
116
+ }
117
+ async createSeries(req) {
118
+ return this.post("/reality/series", { action: "create", ...req });
119
+ }
120
+ async appendSeries(req) {
121
+ return this.post("/reality/series", { action: "append", ...req });
122
+ }
123
+ async seriesWindow(req) {
124
+ return this.post("/reality/series", { action: "window", ...req });
125
+ }
126
+ async aggregateSeries(req) {
127
+ return this.post("/reality/series", { action: "aggregate", ...req });
128
+ }
129
+ async latestSeries(seriesUid, options) {
130
+ return this.post("/reality/series", {
131
+ action: "latest",
132
+ series_uid: seriesUid,
133
+ ...options
134
+ });
135
+ }
136
+ async listSeriesForEntity(entityUid, options) {
137
+ return this.post("/reality/series", {
138
+ action: "list_for_entity",
139
+ entity_uid: entityUid,
140
+ ...options
141
+ });
142
+ }
143
+ async batchLatestSeries(entityUids, options) {
144
+ return this.post("/reality/series", {
145
+ action: "batch_latest",
146
+ entity_uids: entityUids,
147
+ ...options
148
+ });
149
+ }
150
+ async batchAggregateSeries(req) {
151
+ return this.post("/reality/series", { action: "batch_aggregate", ...req });
152
+ }
153
+ async deleteSeries(seriesUid, options) {
154
+ return this.post("/reality/series", {
155
+ action: "delete_series",
156
+ series_uid: seriesUid,
157
+ ...options
158
+ });
159
+ }
113
160
  /** Convenience: create or find an entity by label. */
114
161
  async findOrCreateEntity(label, props, agentId) {
115
162
  return this.post("/reality/entity", {
@@ -679,6 +726,20 @@ var MindGraph = class {
679
726
  async getOntologySchema(id) {
680
727
  return this.get(`/v1/ontology/schemas/${seg(id)}`);
681
728
  }
729
+ async createOntologySeriesBinding(schemaId, request) {
730
+ return this.post(`/v1/ontology/schemas/${seg(schemaId)}/series-bindings`, request);
731
+ }
732
+ async syncOntologySeriesBinding(bindingId, mode) {
733
+ return this.post(
734
+ `/v1/ontology/series-bindings/${seg(bindingId)}/sync`,
735
+ mode ? { mode } : {}
736
+ );
737
+ }
738
+ async archiveOntologySeriesBinding(schemaId, bindingId) {
739
+ return this.del(
740
+ `/v1/ontology/schemas/${seg(schemaId)}/series-bindings/${seg(bindingId)}`
741
+ );
742
+ }
682
743
  async createOntologySchema(req) {
683
744
  return this.post("/v1/ontology/schemas", req);
684
745
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "TypeScript client for the MindGraph Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",