@honcho-ai/core 1.6.1 → 1.7.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 (48) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +2 -2
  3. package/index.d.mts +6 -8
  4. package/index.d.ts +6 -8
  5. package/index.d.ts.map +1 -1
  6. package/index.js +7 -8
  7. package/index.js.map +1 -1
  8. package/index.mjs +7 -8
  9. package/index.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/index.d.ts +1 -1
  12. package/resources/index.d.ts.map +1 -1
  13. package/resources/index.js.map +1 -1
  14. package/resources/index.mjs.map +1 -1
  15. package/resources/workspaces/conclusions.d.ts +142 -0
  16. package/resources/workspaces/conclusions.d.ts.map +1 -0
  17. package/resources/workspaces/conclusions.js +47 -0
  18. package/resources/workspaces/conclusions.js.map +1 -0
  19. package/resources/workspaces/conclusions.mjs +42 -0
  20. package/resources/workspaces/conclusions.mjs.map +1 -0
  21. package/resources/workspaces/index.d.ts +3 -2
  22. package/resources/workspaces/index.d.ts.map +1 -1
  23. package/resources/workspaces/index.js +4 -1
  24. package/resources/workspaces/index.js.map +1 -1
  25. package/resources/workspaces/index.mjs +1 -0
  26. package/resources/workspaces/index.mjs.map +1 -1
  27. package/resources/workspaces/observations.d.ts +40 -30
  28. package/resources/workspaces/observations.d.ts.map +1 -1
  29. package/resources/workspaces/observations.js +6 -0
  30. package/resources/workspaces/observations.js.map +1 -1
  31. package/resources/workspaces/observations.mjs +6 -0
  32. package/resources/workspaces/observations.mjs.map +1 -1
  33. package/resources/workspaces/workspaces.d.ts +90 -5
  34. package/resources/workspaces/workspaces.d.ts.map +1 -1
  35. package/resources/workspaces/workspaces.js +12 -0
  36. package/resources/workspaces/workspaces.js.map +1 -1
  37. package/resources/workspaces/workspaces.mjs +13 -1
  38. package/resources/workspaces/workspaces.mjs.map +1 -1
  39. package/src/index.ts +12 -10
  40. package/src/resources/index.ts +2 -0
  41. package/src/resources/workspaces/conclusions.ts +220 -0
  42. package/src/resources/workspaces/index.ts +18 -0
  43. package/src/resources/workspaces/observations.ts +48 -37
  44. package/src/resources/workspaces/workspaces.ts +150 -3
  45. package/src/version.ts +1 -1
  46. package/version.d.ts +1 -1
  47. package/version.js +1 -1
  48. package/version.mjs +1 -1
package/src/index.ts CHANGED
@@ -14,12 +14,14 @@ import {
14
14
  DreamConfiguration,
15
15
  MessageSearchOptions,
16
16
  PeerCardConfiguration,
17
+ QueueStatus,
17
18
  SummaryConfiguration,
18
19
  Workspace,
19
20
  WorkspaceConfiguration,
20
21
  WorkspaceDeriverStatusParams,
21
22
  WorkspaceGetOrCreateParams,
22
23
  WorkspaceListParams,
24
+ WorkspaceQueueStatusParams,
23
25
  WorkspaceSearchParams,
24
26
  WorkspaceSearchResponse,
25
27
  WorkspaceTriggerDreamParams,
@@ -29,9 +31,8 @@ import {
29
31
  } from "./resources/workspaces/workspaces.js";
30
32
 
31
33
  const environments = {
32
- demo: 'https://demo.honcho.dev',
33
- local: 'http://localhost:8000',
34
34
  production: 'https://api.honcho.dev',
35
+ local: 'http://localhost:8000',
35
36
  };
36
37
  type Environment = keyof typeof environments;
37
38
 
@@ -45,9 +46,8 @@ export interface ClientOptions {
45
46
  * Specifies the environment to use for the API.
46
47
  *
47
48
  * Each environment maps to a different base URL:
48
- * - `demo` corresponds to `https://demo.honcho.dev`
49
- * - `local` corresponds to `http://localhost:8000`
50
49
  * - `production` corresponds to `https://api.honcho.dev`
50
+ * - `local` corresponds to `http://localhost:8000`
51
51
  */
52
52
  environment?: Environment | undefined;
53
53
 
@@ -122,8 +122,8 @@ export class Honcho extends Core.APIClient {
122
122
  * API Client for interfacing with the Honcho API.
123
123
  *
124
124
  * @param {string | null | undefined} [opts.apiKey=process.env['HONCHO_API_KEY'] ?? null]
125
- * @param {Environment} [opts.environment=demo] - Specifies the environment URL to use for the API.
126
- * @param {string} [opts.baseURL=process.env['HONCHO_BASE_URL'] ?? https://demo.honcho.dev] - Override the default base URL for the API.
125
+ * @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
126
+ * @param {string} [opts.baseURL=process.env['HONCHO_BASE_URL'] ?? https://api.honcho.dev] - Override the default base URL for the API.
127
127
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
128
128
  * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
129
129
  * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -140,7 +140,7 @@ export class Honcho extends Core.APIClient {
140
140
  apiKey,
141
141
  ...opts,
142
142
  baseURL,
143
- environment: opts.environment ?? 'demo',
143
+ environment: opts.environment ?? 'production',
144
144
  };
145
145
 
146
146
  if (baseURL && opts.environment) {
@@ -150,8 +150,8 @@ export class Honcho extends Core.APIClient {
150
150
  }
151
151
 
152
152
  super({
153
- baseURL: options.baseURL || environments[options.environment || 'demo'],
154
- baseURLOverridden: baseURL ? baseURL !== environments[options.environment || 'demo'] : false,
153
+ baseURL: options.baseURL || environments[options.environment || 'production'],
154
+ baseURLOverridden: baseURL ? baseURL !== environments[options.environment || 'production'] : false,
155
155
  timeout: options.timeout ?? 60000 /* 1 minute */,
156
156
  httpAgent: options.httpAgent,
157
157
  maxRetries: options.maxRetries,
@@ -170,7 +170,7 @@ export class Honcho extends Core.APIClient {
170
170
  * Check whether the base URL is set to its default.
171
171
  */
172
172
  #baseURLOverridden(): boolean {
173
- return this.baseURL !== environments[this._options.environment || 'demo'];
173
+ return this.baseURL !== environments[this._options.environment || 'production'];
174
174
  }
175
175
 
176
176
  protected override defaultQuery(): Core.DefaultQuery | undefined {
@@ -229,6 +229,7 @@ export declare namespace Honcho {
229
229
  type DreamConfiguration as DreamConfiguration,
230
230
  type MessageSearchOptions as MessageSearchOptions,
231
231
  type PeerCardConfiguration as PeerCardConfiguration,
232
+ type QueueStatus as QueueStatus,
232
233
  type SummaryConfiguration as SummaryConfiguration,
233
234
  type Workspace as Workspace,
234
235
  type WorkspaceConfiguration as WorkspaceConfiguration,
@@ -238,6 +239,7 @@ export declare namespace Honcho {
238
239
  type WorkspaceListParams as WorkspaceListParams,
239
240
  type WorkspaceDeriverStatusParams as WorkspaceDeriverStatusParams,
240
241
  type WorkspaceGetOrCreateParams as WorkspaceGetOrCreateParams,
242
+ type WorkspaceQueueStatusParams as WorkspaceQueueStatusParams,
241
243
  type WorkspaceSearchParams as WorkspaceSearchParams,
242
244
  type WorkspaceTriggerDreamParams as WorkspaceTriggerDreamParams,
243
245
  };
@@ -9,6 +9,7 @@ export {
9
9
  type DreamConfiguration,
10
10
  type MessageSearchOptions,
11
11
  type PeerCardConfiguration,
12
+ type QueueStatus,
12
13
  type SummaryConfiguration,
13
14
  type Workspace,
14
15
  type WorkspaceConfiguration,
@@ -17,6 +18,7 @@ export {
17
18
  type WorkspaceListParams,
18
19
  type WorkspaceDeriverStatusParams,
19
20
  type WorkspaceGetOrCreateParams,
21
+ type WorkspaceQueueStatusParams,
20
22
  type WorkspaceSearchParams,
21
23
  type WorkspaceTriggerDreamParams,
22
24
  } from "./workspaces/workspaces.js";
@@ -0,0 +1,220 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from "../../resource.js";
4
+ import { isRequestOptions } from "../../core.js";
5
+ import * as Core from "../../core.js";
6
+ import { Page, type PageParams } from "../../pagination.js";
7
+
8
+ export class Conclusions extends APIResource {
9
+ /**
10
+ * Create one or more conclusions.
11
+ *
12
+ * Conclusions are theory-of-mind facts derived from interactions between peers.
13
+ */
14
+ create(
15
+ workspaceId: string,
16
+ body: ConclusionCreateParams,
17
+ options?: Core.RequestOptions,
18
+ ): Core.APIPromise<ConclusionCreateResponse> {
19
+ return this._client.post(`/v2/workspaces/${workspaceId}/conclusions`, { body, ...options });
20
+ }
21
+
22
+ /**
23
+ * List conclusions using custom filters, ordered by recency unless `reverse` is
24
+ * true.
25
+ */
26
+ list(
27
+ workspaceId: string,
28
+ params?: ConclusionListParams,
29
+ options?: Core.RequestOptions,
30
+ ): Core.PagePromise<ConclusionsPage, Conclusion>;
31
+ list(workspaceId: string, options?: Core.RequestOptions): Core.PagePromise<ConclusionsPage, Conclusion>;
32
+ list(
33
+ workspaceId: string,
34
+ params: ConclusionListParams | Core.RequestOptions = {},
35
+ options?: Core.RequestOptions,
36
+ ): Core.PagePromise<ConclusionsPage, Conclusion> {
37
+ if (isRequestOptions(params)) {
38
+ return this.list(workspaceId, {}, params);
39
+ }
40
+ const { page, reverse, size, ...body } = params;
41
+ return this._client.getAPIList(`/v2/workspaces/${workspaceId}/conclusions/list`, ConclusionsPage, {
42
+ query: { page, reverse, size },
43
+ body,
44
+ method: 'post',
45
+ ...options,
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Delete a specific conclusion (document).
51
+ */
52
+ delete(workspaceId: string, conclusionId: string, options?: Core.RequestOptions): Core.APIPromise<unknown> {
53
+ return this._client.delete(`/v2/workspaces/${workspaceId}/conclusions/${conclusionId}`, options);
54
+ }
55
+
56
+ /**
57
+ * Query conclusions using semantic search.
58
+ */
59
+ query(
60
+ workspaceId: string,
61
+ body: ConclusionQueryParams,
62
+ options?: Core.RequestOptions,
63
+ ): Core.APIPromise<ConclusionQueryResponse> {
64
+ return this._client.post(`/v2/workspaces/${workspaceId}/conclusions/query`, { body, ...options });
65
+ }
66
+ }
67
+
68
+ export class ConclusionsPage extends Page<Conclusion> {}
69
+
70
+ /**
71
+ * Conclusion response - external view of a document.
72
+ */
73
+ export interface Conclusion {
74
+ id: string;
75
+
76
+ content: string;
77
+
78
+ created_at: string;
79
+
80
+ /**
81
+ * The peer the conclusion is about
82
+ */
83
+ observed_id: string;
84
+
85
+ /**
86
+ * The peer who made the conclusion
87
+ */
88
+ observer_id: string;
89
+
90
+ session_id: string;
91
+ }
92
+
93
+ /**
94
+ * Schema for creating a single conclusion.
95
+ */
96
+ export interface ConclusionCreate {
97
+ content: string;
98
+
99
+ /**
100
+ * The peer the conclusion is about
101
+ */
102
+ observed_id: string;
103
+
104
+ /**
105
+ * The peer making the conclusion
106
+ */
107
+ observer_id: string;
108
+
109
+ /**
110
+ * The session this conclusion relates to
111
+ */
112
+ session_id: string;
113
+ }
114
+
115
+ /**
116
+ * Schema for listing conclusions with optional filters.
117
+ */
118
+ export interface ConclusionGet {
119
+ filters?: { [key: string]: unknown } | null;
120
+ }
121
+
122
+ /**
123
+ * Query parameters for semantic search of conclusions.
124
+ */
125
+ export interface ConclusionQuery {
126
+ /**
127
+ * Semantic search query
128
+ */
129
+ query: string;
130
+
131
+ /**
132
+ * Maximum cosine distance threshold for results
133
+ */
134
+ distance?: number | null;
135
+
136
+ /**
137
+ * Additional filters to apply
138
+ */
139
+ filters?: { [key: string]: unknown } | null;
140
+
141
+ /**
142
+ * Number of results to return
143
+ */
144
+ top_k?: number;
145
+ }
146
+
147
+ export interface PageConclusion {
148
+ items: Array<Conclusion>;
149
+
150
+ page: number;
151
+
152
+ size: number;
153
+
154
+ pages?: number;
155
+
156
+ total?: number;
157
+ }
158
+
159
+ export type ConclusionCreateResponse = Array<Conclusion>;
160
+
161
+ export type ConclusionDeleteResponse = unknown;
162
+
163
+ export type ConclusionQueryResponse = Array<Conclusion>;
164
+
165
+ export interface ConclusionCreateParams {
166
+ conclusions: Array<ConclusionCreate>;
167
+ }
168
+
169
+ export interface ConclusionListParams extends PageParams {
170
+ /**
171
+ * Query param: Whether to reverse the order of results
172
+ */
173
+ reverse?: boolean | null;
174
+
175
+ /**
176
+ * Body param:
177
+ */
178
+ filters?: { [key: string]: unknown } | null;
179
+ }
180
+
181
+ export interface ConclusionQueryParams {
182
+ /**
183
+ * Semantic search query
184
+ */
185
+ query: string;
186
+
187
+ /**
188
+ * Maximum cosine distance threshold for results
189
+ */
190
+ distance?: number | null;
191
+
192
+ /**
193
+ * Additional filters to apply
194
+ */
195
+ filters?: { [key: string]: unknown } | null;
196
+
197
+ /**
198
+ * Number of results to return
199
+ */
200
+ top_k?: number;
201
+ }
202
+
203
+ Conclusions.ConclusionsPage = ConclusionsPage;
204
+
205
+ export declare namespace Conclusions {
206
+ export {
207
+ type Conclusion as Conclusion,
208
+ type ConclusionCreate as ConclusionCreate,
209
+ type ConclusionGet as ConclusionGet,
210
+ type ConclusionQuery as ConclusionQuery,
211
+ type PageConclusion as PageConclusion,
212
+ type ConclusionCreateResponse as ConclusionCreateResponse,
213
+ type ConclusionDeleteResponse as ConclusionDeleteResponse,
214
+ type ConclusionQueryResponse as ConclusionQueryResponse,
215
+ ConclusionsPage as ConclusionsPage,
216
+ type ConclusionCreateParams as ConclusionCreateParams,
217
+ type ConclusionListParams as ConclusionListParams,
218
+ type ConclusionQueryParams as ConclusionQueryParams,
219
+ };
220
+ }
@@ -1,8 +1,24 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export {
4
+ ConclusionsPage,
5
+ Conclusions,
6
+ type Conclusion,
7
+ type ConclusionCreate,
8
+ type ConclusionGet,
9
+ type ConclusionQuery,
10
+ type PageConclusion,
11
+ type ConclusionCreateResponse,
12
+ type ConclusionDeleteResponse,
13
+ type ConclusionQueryResponse,
14
+ type ConclusionCreateParams,
15
+ type ConclusionListParams,
16
+ type ConclusionQueryParams,
17
+ } from "./conclusions.js";
3
18
  export {
4
19
  ObservationsPage,
5
20
  Observations,
21
+ type Observation,
6
22
  type ObservationCreate,
7
23
  type ObservationGet,
8
24
  type ObservationQuery,
@@ -70,6 +86,7 @@ export {
70
86
  type DreamConfiguration,
71
87
  type MessageSearchOptions,
72
88
  type PeerCardConfiguration,
89
+ type QueueStatus,
73
90
  type SummaryConfiguration,
74
91
  type Workspace,
75
92
  type WorkspaceConfiguration,
@@ -78,6 +95,7 @@ export {
78
95
  type WorkspaceListParams,
79
96
  type WorkspaceDeriverStatusParams,
80
97
  type WorkspaceGetOrCreateParams,
98
+ type WorkspaceQueueStatusParams,
81
99
  type WorkspaceSearchParams,
82
100
  type WorkspaceTriggerDreamParams,
83
101
  } from "./workspaces.js";
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from "../../resource.js";
4
4
  import { isRequestOptions } from "../../core.js";
5
5
  import * as Core from "../../core.js";
6
+ import * as ConclusionsAPI from "./conclusions.js";
6
7
  import { Page, type PageParams } from "../../pagination.js";
7
8
 
8
9
  export class Observations extends APIResource {
@@ -14,6 +15,8 @@ export class Observations extends APIResource {
14
15
  * the workspace. Embeddings are automatically generated for semantic search.
15
16
  *
16
17
  * Maximum of 100 observations per request.
18
+ *
19
+ * @deprecated
17
20
  */
18
21
  create(
19
22
  workspaceId: string,
@@ -29,18 +32,20 @@ export class Observations extends APIResource {
29
32
  *
30
33
  * Observations can be filtered by session_id, observer_id and observed_id using
31
34
  * the filters parameter.
35
+ *
36
+ * @deprecated
32
37
  */
33
38
  list(
34
39
  workspaceId: string,
35
40
  params?: ObservationListParams,
36
41
  options?: Core.RequestOptions,
37
- ): Core.PagePromise<ObservationsPage, Observations>;
38
- list(workspaceId: string, options?: Core.RequestOptions): Core.PagePromise<ObservationsPage, Observations>;
42
+ ): Core.PagePromise<ObservationsPage, Observation>;
43
+ list(workspaceId: string, options?: Core.RequestOptions): Core.PagePromise<ObservationsPage, Observation>;
39
44
  list(
40
45
  workspaceId: string,
41
46
  params: ObservationListParams | Core.RequestOptions = {},
42
47
  options?: Core.RequestOptions,
43
- ): Core.PagePromise<ObservationsPage, Observations> {
48
+ ): Core.PagePromise<ObservationsPage, Observation> {
44
49
  if (isRequestOptions(params)) {
45
50
  return this.list(workspaceId, {}, params);
46
51
  }
@@ -58,6 +63,8 @@ export class Observations extends APIResource {
58
63
  *
59
64
  * This permanently deletes the observation (document) from the theory-of-mind
60
65
  * system. This action cannot be undone.
66
+ *
67
+ * @deprecated
61
68
  */
62
69
  delete(
63
70
  workspaceId: string,
@@ -73,6 +80,8 @@ export class Observations extends APIResource {
73
80
  * Performs vector similarity search on observations to find semantically relevant
74
81
  * results. Observer and observed are required for semantic search and must be
75
82
  * provided in filters.
83
+ *
84
+ * @deprecated
76
85
  */
77
86
  query(
78
87
  workspaceId: string,
@@ -83,39 +92,62 @@ export class Observations extends APIResource {
83
92
  }
84
93
  }
85
94
 
86
- export class ObservationsPage extends Page<Observations> {}
95
+ export class ObservationsPage extends Page<Observation> {}
87
96
 
88
97
  /**
89
- * Schema for creating a single observation
98
+ * Deprecated: use Conclusion.
99
+ */
100
+ export interface Observation {
101
+ id: string;
102
+
103
+ content: string;
104
+
105
+ created_at: string;
106
+
107
+ /**
108
+ * The peer the conclusion is about
109
+ */
110
+ observed_id: string;
111
+
112
+ /**
113
+ * The peer who made the conclusion
114
+ */
115
+ observer_id: string;
116
+
117
+ session_id: string;
118
+ }
119
+
120
+ /**
121
+ * Deprecated: use ConclusionCreate.
90
122
  */
91
123
  export interface ObservationCreate {
92
124
  content: string;
93
125
 
94
126
  /**
95
- * The peer being observed
127
+ * The peer the conclusion is about
96
128
  */
97
129
  observed_id: string;
98
130
 
99
131
  /**
100
- * The peer making the observation
132
+ * The peer making the conclusion
101
133
  */
102
134
  observer_id: string;
103
135
 
104
136
  /**
105
- * The session this observation relates to
137
+ * The session this conclusion relates to
106
138
  */
107
139
  session_id: string;
108
140
  }
109
141
 
110
142
  /**
111
- * Schema for listing observations with optional filters
143
+ * Deprecated: use ConclusionGet.
112
144
  */
113
145
  export interface ObservationGet {
114
146
  filters?: { [key: string]: unknown } | null;
115
147
  }
116
148
 
117
149
  /**
118
- * Query parameters for semantic search of observations
150
+ * Deprecated: use ConclusionQuery.
119
151
  */
120
152
  export interface ObservationQuery {
121
153
  /**
@@ -139,31 +171,8 @@ export interface ObservationQuery {
139
171
  top_k?: number;
140
172
  }
141
173
 
142
- /**
143
- * Observation response - external view of a document
144
- */
145
- export interface Observations {
146
- id: string;
147
-
148
- content: string;
149
-
150
- created_at: string;
151
-
152
- /**
153
- * The peer being observed
154
- */
155
- observed_id: string;
156
-
157
- /**
158
- * The peer who made the observation
159
- */
160
- observer_id: string;
161
-
162
- session_id: string;
163
- }
164
-
165
174
  export interface PageObservation {
166
- items: Array<Observations>;
175
+ items: Array<Observation>;
167
176
 
168
177
  page: number;
169
178
 
@@ -174,13 +183,15 @@ export interface PageObservation {
174
183
  total?: number;
175
184
  }
176
185
 
177
- export type ObservationCreateResponse = Array<Observations>;
186
+ export type ObservationCreateResponse = Array<Observation>;
178
187
 
179
188
  export type ObservationDeleteResponse = unknown;
180
189
 
181
- export type ObservationQueryResponse = Array<Observations>;
190
+ export type ObservationQueryResponse = Array<Observation>;
182
191
 
183
192
  export interface ObservationCreateParams {
193
+ conclusions: Array<ConclusionsAPI.ConclusionCreate>;
194
+
184
195
  observations: Array<ObservationCreate>;
185
196
  }
186
197
 
@@ -222,10 +233,10 @@ Observations.ObservationsPage = ObservationsPage;
222
233
 
223
234
  export declare namespace Observations {
224
235
  export {
236
+ type Observation as Observation,
225
237
  type ObservationCreate as ObservationCreate,
226
238
  type ObservationGet as ObservationGet,
227
239
  type ObservationQuery as ObservationQuery,
228
- type Observations as Observations,
229
240
  type PageObservation as PageObservation,
230
241
  type ObservationCreateResponse as ObservationCreateResponse,
231
242
  type ObservationDeleteResponse as ObservationDeleteResponse,