@honcho-ai/core 1.4.0 → 1.5.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/core.js +3 -3
  3. package/core.js.map +1 -1
  4. package/core.mjs +3 -3
  5. package/core.mjs.map +1 -1
  6. package/index.d.ts.map +1 -1
  7. package/index.js.map +1 -1
  8. package/index.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/workspaces/index.d.ts +2 -2
  11. package/resources/workspaces/index.d.ts.map +1 -1
  12. package/resources/workspaces/index.js.map +1 -1
  13. package/resources/workspaces/index.mjs.map +1 -1
  14. package/resources/workspaces/peers/index.d.ts +1 -1
  15. package/resources/workspaces/peers/index.d.ts.map +1 -1
  16. package/resources/workspaces/peers/index.js.map +1 -1
  17. package/resources/workspaces/peers/index.mjs.map +1 -1
  18. package/resources/workspaces/peers/peers.d.ts +24 -3
  19. package/resources/workspaces/peers/peers.d.ts.map +1 -1
  20. package/resources/workspaces/peers/peers.js +7 -1
  21. package/resources/workspaces/peers/peers.js.map +1 -1
  22. package/resources/workspaces/peers/peers.mjs +7 -1
  23. package/resources/workspaces/peers/peers.mjs.map +1 -1
  24. package/resources/workspaces/sessions/index.d.ts +1 -1
  25. package/resources/workspaces/sessions/index.d.ts.map +1 -1
  26. package/resources/workspaces/sessions/index.js.map +1 -1
  27. package/resources/workspaces/sessions/index.mjs.map +1 -1
  28. package/resources/workspaces/sessions/sessions.d.ts +121 -72
  29. package/resources/workspaces/sessions/sessions.d.ts.map +1 -1
  30. package/resources/workspaces/sessions/sessions.js.map +1 -1
  31. package/resources/workspaces/sessions/sessions.mjs.map +1 -1
  32. package/resources/workspaces/workspaces.d.ts +4 -4
  33. package/resources/workspaces/workspaces.d.ts.map +1 -1
  34. package/resources/workspaces/workspaces.js.map +1 -1
  35. package/resources/workspaces/workspaces.mjs.map +1 -1
  36. package/src/core.ts +3 -3
  37. package/src/index.ts +1 -0
  38. package/src/resources/workspaces/index.ts +3 -0
  39. package/src/resources/workspaces/peers/index.ts +2 -0
  40. package/src/resources/workspaces/peers/peers.ts +44 -2
  41. package/src/resources/workspaces/sessions/index.ts +1 -0
  42. package/src/resources/workspaces/sessions/sessions.ts +137 -81
  43. package/src/resources/workspaces/workspaces.ts +6 -0
  44. package/src/version.ts +1 -1
  45. package/version.d.ts +1 -1
  46. package/version.js +1 -1
  47. package/version.mjs +1 -1
@@ -50,6 +50,31 @@ export class Peers extends APIResource {
50
50
  });
51
51
  }
52
52
 
53
+ /**
54
+ * Get a peer card for a specific peer relationship.
55
+ *
56
+ * Returns the peer card that the observer peer has for the target peer if it
57
+ * exists. If no target is specified, returns the observer's own peer card.
58
+ */
59
+ card(
60
+ workspaceId: string,
61
+ peerId: string,
62
+ query?: PeerCardParams,
63
+ options?: Core.RequestOptions,
64
+ ): Core.APIPromise<PeerCardResponse>;
65
+ card(workspaceId: string, peerId: string, options?: Core.RequestOptions): Core.APIPromise<PeerCardResponse>;
66
+ card(
67
+ workspaceId: string,
68
+ peerId: string,
69
+ query: PeerCardParams | Core.RequestOptions = {},
70
+ options?: Core.RequestOptions,
71
+ ): Core.APIPromise<PeerCardResponse> {
72
+ if (isRequestOptions(query)) {
73
+ return this.card(workspaceId, peerId, {}, query);
74
+ }
75
+ return this._client.get(`/v2/workspaces/${workspaceId}/peers/${peerId}/card`, { query, ...options });
76
+ }
77
+
53
78
  /**
54
79
  * Chat
55
80
  */
@@ -94,7 +119,7 @@ export class Peers extends APIResource {
94
119
  * If a session_id is provided in the body, we get the working representation of
95
120
  * the peer in that session. If a target is provided, we get the representation of
96
121
  * the target from the perspective of the peer. If no target is provided, we get
97
- * the global representation of the peer.
122
+ * the omniscient Honcho representation of the peer.
98
123
  */
99
124
  workingRepresentation(
100
125
  workspaceId: string,
@@ -151,6 +176,13 @@ export interface SessionGet {
151
176
  filters?: { [key: string]: unknown } | null;
152
177
  }
153
178
 
179
+ export interface PeerCardResponse {
180
+ /**
181
+ * The peer card content, or None if not found
182
+ */
183
+ peer_card?: Array<string> | null;
184
+ }
185
+
154
186
  export interface PeerChatResponse {
155
187
  content: string;
156
188
  }
@@ -172,6 +204,14 @@ export interface PeerListParams extends PageParams {
172
204
  filters?: { [key: string]: unknown } | null;
173
205
  }
174
206
 
207
+ export interface PeerCardParams {
208
+ /**
209
+ * The peer whose card to retrieve. If not provided, returns the observer's own
210
+ * card
211
+ */
212
+ target?: string | null;
213
+ }
214
+
175
215
  export interface PeerChatParams {
176
216
  /**
177
217
  * Dialectic API Prompt
@@ -220,7 +260,7 @@ export interface PeerWorkingRepresentationParams {
220
260
  /**
221
261
  * Get the working representation within this session
222
262
  */
223
- session_id: string;
263
+ session_id?: string | null;
224
264
 
225
265
  /**
226
266
  * Optional peer ID to get the representation for, from the perspective of this
@@ -238,12 +278,14 @@ export declare namespace Peers {
238
278
  type PageSession as PageSession,
239
279
  type Peer as Peer,
240
280
  type SessionGet as SessionGet,
281
+ type PeerCardResponse as PeerCardResponse,
241
282
  type PeerChatResponse as PeerChatResponse,
242
283
  type PeerSearchResponse as PeerSearchResponse,
243
284
  type PeerWorkingRepresentationResponse as PeerWorkingRepresentationResponse,
244
285
  PeersPage as PeersPage,
245
286
  type PeerUpdateParams as PeerUpdateParams,
246
287
  type PeerListParams as PeerListParams,
288
+ type PeerCardParams as PeerCardParams,
247
289
  type PeerChatParams as PeerChatParams,
248
290
  type PeerGetOrCreateParams as PeerGetOrCreateParams,
249
291
  type PeerSearchParams as PeerSearchParams,
@@ -26,6 +26,7 @@ export {
26
26
  SessionsPage,
27
27
  Sessions,
28
28
  type Session,
29
+ type Summary,
29
30
  type SessionDeleteResponse,
30
31
  type SessionGetContextResponse,
31
32
  type SessionSearchResponse,
@@ -197,6 +197,33 @@ export interface Session {
197
197
  metadata?: { [key: string]: unknown };
198
198
  }
199
199
 
200
+ export interface Summary {
201
+ /**
202
+ * The summary text
203
+ */
204
+ content: string;
205
+
206
+ /**
207
+ * The timestamp of when the summary was created (ISO format)
208
+ */
209
+ created_at: string;
210
+
211
+ /**
212
+ * The public ID of the message that this summary covers up to
213
+ */
214
+ message_id: string;
215
+
216
+ /**
217
+ * The type of summary (short or long)
218
+ */
219
+ summary_type: string;
220
+
221
+ /**
222
+ * The number of tokens in the summary text
223
+ */
224
+ token_count: number;
225
+ }
226
+
200
227
  export type SessionDeleteResponse = unknown;
201
228
 
202
229
  export interface SessionGetContextResponse {
@@ -204,41 +231,110 @@ export interface SessionGetContextResponse {
204
231
 
205
232
  messages: Array<MessagesAPI.Message>;
206
233
 
234
+ /**
235
+ * The peer card, if context is requested from a specific perspective
236
+ */
237
+ peer_card?: Array<string> | null;
238
+
239
+ /**
240
+ * A Representation is a traversable and diffable map of observations. At the base,
241
+ * we have a list of explicit observations, derived from a peer's messages.
242
+ *
243
+ * From there, deductive observations can be made by establishing logical
244
+ * relationships between explicit observations.
245
+ *
246
+ * In the future, we can add more levels of reasoning on top of these.
247
+ *
248
+ * All of a peer's observations are stored as documents in a collection. These
249
+ * documents can be queried in various ways to produce this Representation object.
250
+ *
251
+ * Additionally, a "working representation" is a version of this data structure
252
+ * representing the most recent observations within a single session.
253
+ *
254
+ * A representation can have a maximum number of observations, which is applied
255
+ * individually to each level of reasoning. If a maximum is set, observations are
256
+ * added and removed in FIFO order.
257
+ */
258
+ peer_representation?: SessionGetContextResponse.PeerRepresentation | null;
259
+
207
260
  /**
208
261
  * The summary if available
209
262
  */
210
- summary?: SessionGetContextResponse.Summary | null;
263
+ summary?: Summary | null;
211
264
  }
212
265
 
213
266
  export namespace SessionGetContextResponse {
214
267
  /**
215
- * The summary if available
268
+ * A Representation is a traversable and diffable map of observations. At the base,
269
+ * we have a list of explicit observations, derived from a peer's messages.
270
+ *
271
+ * From there, deductive observations can be made by establishing logical
272
+ * relationships between explicit observations.
273
+ *
274
+ * In the future, we can add more levels of reasoning on top of these.
275
+ *
276
+ * All of a peer's observations are stored as documents in a collection. These
277
+ * documents can be queried in various ways to produce this Representation object.
278
+ *
279
+ * Additionally, a "working representation" is a version of this data structure
280
+ * representing the most recent observations within a single session.
281
+ *
282
+ * A representation can have a maximum number of observations, which is applied
283
+ * individually to each level of reasoning. If a maximum is set, observations are
284
+ * added and removed in FIFO order.
216
285
  */
217
- export interface Summary {
286
+ export interface PeerRepresentation {
218
287
  /**
219
- * The summary text
288
+ * Conclusions that MUST be true given explicit facts and premises - strict logical
289
+ * necessities. Each deduction should have premises and a single conclusion.
220
290
  */
221
- content: string;
291
+ deductive?: Array<PeerRepresentation.Deductive>;
222
292
 
223
293
  /**
224
- * The timestamp of when the summary was created (ISO format)
294
+ * Facts LITERALLY stated by the user - direct quotes or clear paraphrases only, no
295
+ * interpretation or inference. Example: ['The user is 25 years old', 'The user has
296
+ * a dog']
225
297
  */
226
- created_at: string;
298
+ explicit?: Array<PeerRepresentation.Explicit>;
299
+ }
227
300
 
301
+ export namespace PeerRepresentation {
228
302
  /**
229
- * The ID of the message that this summary covers up to
303
+ * Deductive observation with multiple premises and one conclusion, plus metadata.
230
304
  */
231
- message_id: number;
305
+ export interface Deductive {
306
+ /**
307
+ * The deductive conclusion
308
+ */
309
+ conclusion: string;
232
310
 
233
- /**
234
- * The type of summary (short or long)
235
- */
236
- summary_type: string;
311
+ created_at: string;
312
+
313
+ message_ids: Array<Array<unknown>>;
314
+
315
+ session_name: string;
316
+
317
+ /**
318
+ * Supporting premises or evidence for this conclusion
319
+ */
320
+ premises?: Array<string>;
321
+ }
237
322
 
238
323
  /**
239
- * The number of tokens in the summary text
324
+ * Explicit observation with content and metadata.
240
325
  */
241
- token_count: number;
326
+ export interface Explicit {
327
+ /**
328
+ * The explicit observation
329
+ */
330
+ content: string;
331
+
332
+ created_at: string;
333
+
334
+ message_ids: Array<Array<unknown>>;
335
+
336
+ session_name: string;
337
+ }
242
338
  }
243
339
  }
244
340
 
@@ -250,74 +346,12 @@ export interface SessionSummariesResponse {
250
346
  /**
251
347
  * The long summary if available
252
348
  */
253
- long_summary?: SessionSummariesResponse.LongSummary | null;
349
+ long_summary?: Summary | null;
254
350
 
255
351
  /**
256
352
  * The short summary if available
257
353
  */
258
- short_summary?: SessionSummariesResponse.ShortSummary | null;
259
- }
260
-
261
- export namespace SessionSummariesResponse {
262
- /**
263
- * The long summary if available
264
- */
265
- export interface LongSummary {
266
- /**
267
- * The summary text
268
- */
269
- content: string;
270
-
271
- /**
272
- * The timestamp of when the summary was created (ISO format)
273
- */
274
- created_at: string;
275
-
276
- /**
277
- * The ID of the message that this summary covers up to
278
- */
279
- message_id: number;
280
-
281
- /**
282
- * The type of summary (short or long)
283
- */
284
- summary_type: string;
285
-
286
- /**
287
- * The number of tokens in the summary text
288
- */
289
- token_count: number;
290
- }
291
-
292
- /**
293
- * The short summary if available
294
- */
295
- export interface ShortSummary {
296
- /**
297
- * The summary text
298
- */
299
- content: string;
300
-
301
- /**
302
- * The timestamp of when the summary was created (ISO format)
303
- */
304
- created_at: string;
305
-
306
- /**
307
- * The ID of the message that this summary covers up to
308
- */
309
- message_id: number;
310
-
311
- /**
312
- * The type of summary (short or long)
313
- */
314
- summary_type: string;
315
-
316
- /**
317
- * The number of tokens in the summary text
318
- */
319
- token_count: number;
320
- }
354
+ short_summary?: Summary | null;
321
355
  }
322
356
 
323
357
  export interface SessionUpdateParams {
@@ -341,14 +375,35 @@ export interface SessionCloneParams {
341
375
  }
342
376
 
343
377
  export interface SessionGetContextParams {
378
+ /**
379
+ * The most recent message, used to fetch semantically relevant observations
380
+ */
381
+ last_message?: string | null;
382
+
383
+ /**
384
+ * A peer to get context for. If given, response will attempt to include
385
+ * representation and card from the perspective of that peer. Must be provided with
386
+ * `peer_target`.
387
+ */
388
+ peer_perspective?: string | null;
389
+
390
+ /**
391
+ * The target of the perspective. If given without `peer_perspective`, will get the
392
+ * Honcho-level representation and peer card for this peer. If given with
393
+ * `peer_perspective`, will get the representation and card for this peer _from the
394
+ * perspective of that peer_.
395
+ */
396
+ peer_target?: string | null;
397
+
344
398
  /**
345
399
  * Whether or not to include a summary _if_ one is available for the session
346
400
  */
347
401
  summary?: boolean;
348
402
 
349
403
  /**
350
- * Number of tokens to use for the context. Includes summary if set to true. If not
351
- * provided, the context will be exhaustive (within 100000 tokens)
404
+ * Number of tokens to use for the context. Includes summary if set to true.
405
+ * Includes representation and peer card if they are included in the response. If
406
+ * not provided, the context will be exhaustive (within 100000 tokens)
352
407
  */
353
408
  tokens?: number | null;
354
409
  }
@@ -388,6 +443,7 @@ Sessions.Peers = Peers;
388
443
  export declare namespace Sessions {
389
444
  export {
390
445
  type Session as Session,
446
+ type Summary as Summary,
391
447
  type SessionDeleteResponse as SessionDeleteResponse,
392
448
  type SessionGetContextResponse as SessionGetContextResponse,
393
449
  type SessionSearchResponse as SessionSearchResponse,
@@ -18,6 +18,8 @@ import {
18
18
  PagePeer,
19
19
  PageSession,
20
20
  Peer,
21
+ PeerCardParams,
22
+ PeerCardResponse,
21
23
  PeerChatParams,
22
24
  PeerChatResponse,
23
25
  PeerGetOrCreateParams,
@@ -47,6 +49,7 @@ import {
47
49
  SessionUpdateParams,
48
50
  Sessions as SessionsAPISessions,
49
51
  SessionsPage,
52
+ Summary,
50
53
  } from "./sessions/sessions.js";
51
54
  import { Page, type PageParams } from "../../pagination.js";
52
55
 
@@ -303,12 +306,14 @@ export declare namespace Workspaces {
303
306
  type PageSession as PageSession,
304
307
  type Peer as Peer,
305
308
  type SessionGet as SessionGet,
309
+ type PeerCardResponse as PeerCardResponse,
306
310
  type PeerChatResponse as PeerChatResponse,
307
311
  type PeerSearchResponse as PeerSearchResponse,
308
312
  type PeerWorkingRepresentationResponse as PeerWorkingRepresentationResponse,
309
313
  PeersPage as PeersPage,
310
314
  type PeerUpdateParams as PeerUpdateParams,
311
315
  type PeerListParams as PeerListParams,
316
+ type PeerCardParams as PeerCardParams,
312
317
  type PeerChatParams as PeerChatParams,
313
318
  type PeerGetOrCreateParams as PeerGetOrCreateParams,
314
319
  type PeerSearchParams as PeerSearchParams,
@@ -318,6 +323,7 @@ export declare namespace Workspaces {
318
323
  export {
319
324
  SessionsAPISessions as Sessions,
320
325
  type Session as Session,
326
+ type Summary as Summary,
321
327
  type SessionDeleteResponse as SessionDeleteResponse,
322
328
  type SessionGetContextResponse as SessionGetContextResponse,
323
329
  type SessionSearchResponse as SessionSearchResponse,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.4.0'; // x-release-please-version
1
+ export const VERSION = '1.5.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.4.0";
1
+ export declare const VERSION = "1.5.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.4.0'; // x-release-please-version
4
+ exports.VERSION = '1.5.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.4.0'; // x-release-please-version
1
+ export const VERSION = '1.5.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map