@honcho-ai/core 1.6.0 → 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 +31 -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 +67 -25
  28. package/resources/workspaces/observations.d.ts.map +1 -1
  29. package/resources/workspaces/observations.js +18 -0
  30. package/resources/workspaces/observations.js.map +1 -1
  31. package/resources/workspaces/observations.mjs +18 -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 +21 -0
  43. package/src/resources/workspaces/observations.ts +91 -32
  44. package/src/resources/workspaces/workspaces.ts +156 -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,13 +1,32 @@
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,
22
+ type ObservationCreate,
6
23
  type ObservationGet,
7
24
  type ObservationQuery,
8
25
  type PageObservation,
26
+ type ObservationCreateResponse,
9
27
  type ObservationDeleteResponse,
10
28
  type ObservationQueryResponse,
29
+ type ObservationCreateParams,
11
30
  type ObservationListParams,
12
31
  type ObservationQueryParams,
13
32
  } from "./observations.js";
@@ -67,6 +86,7 @@ export {
67
86
  type DreamConfiguration,
68
87
  type MessageSearchOptions,
69
88
  type PeerCardConfiguration,
89
+ type QueueStatus,
70
90
  type SummaryConfiguration,
71
91
  type Workspace,
72
92
  type WorkspaceConfiguration,
@@ -75,6 +95,7 @@ export {
75
95
  type WorkspaceListParams,
76
96
  type WorkspaceDeriverStatusParams,
77
97
  type WorkspaceGetOrCreateParams,
98
+ type WorkspaceQueueStatusParams,
78
99
  type WorkspaceSearchParams,
79
100
  type WorkspaceTriggerDreamParams,
80
101
  } from "./workspaces.js";
@@ -3,27 +3,49 @@
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 {
10
+ /**
11
+ * Create one or more observations.
12
+ *
13
+ * Creates observations (theory-of-mind facts) for the specified observer/observed
14
+ * peer pairs. Each observation must reference existing peers and a session within
15
+ * the workspace. Embeddings are automatically generated for semantic search.
16
+ *
17
+ * Maximum of 100 observations per request.
18
+ *
19
+ * @deprecated
20
+ */
21
+ create(
22
+ workspaceId: string,
23
+ body: ObservationCreateParams,
24
+ options?: Core.RequestOptions,
25
+ ): Core.APIPromise<ObservationCreateResponse> {
26
+ return this._client.post(`/v2/workspaces/${workspaceId}/observations`, { body, ...options });
27
+ }
28
+
9
29
  /**
10
30
  * List all observations using custom filters. Observations are listed by recency
11
31
  * unless `reverse` is set to `true`.
12
32
  *
13
33
  * Observations can be filtered by session_id, observer_id and observed_id using
14
34
  * the filters parameter.
35
+ *
36
+ * @deprecated
15
37
  */
16
38
  list(
17
39
  workspaceId: string,
18
40
  params?: ObservationListParams,
19
41
  options?: Core.RequestOptions,
20
- ): Core.PagePromise<ObservationsPage, Observations>;
21
- 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>;
22
44
  list(
23
45
  workspaceId: string,
24
46
  params: ObservationListParams | Core.RequestOptions = {},
25
47
  options?: Core.RequestOptions,
26
- ): Core.PagePromise<ObservationsPage, Observations> {
48
+ ): Core.PagePromise<ObservationsPage, Observation> {
27
49
  if (isRequestOptions(params)) {
28
50
  return this.list(workspaceId, {}, params);
29
51
  }
@@ -41,6 +63,8 @@ export class Observations extends APIResource {
41
63
  *
42
64
  * This permanently deletes the observation (document) from the theory-of-mind
43
65
  * system. This action cannot be undone.
66
+ *
67
+ * @deprecated
44
68
  */
45
69
  delete(
46
70
  workspaceId: string,
@@ -56,6 +80,8 @@ export class Observations extends APIResource {
56
80
  * Performs vector similarity search on observations to find semantically relevant
57
81
  * results. Observer and observed are required for semantic search and must be
58
82
  * provided in filters.
83
+ *
84
+ * @deprecated
59
85
  */
60
86
  query(
61
87
  workspaceId: string,
@@ -66,17 +92,62 @@ export class Observations extends APIResource {
66
92
  }
67
93
  }
68
94
 
69
- export class ObservationsPage extends Page<Observations> {}
95
+ export class ObservationsPage extends Page<Observation> {}
96
+
97
+ /**
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
+ }
70
119
 
71
120
  /**
72
- * Schema for listing observations with optional filters
121
+ * Deprecated: use ConclusionCreate.
122
+ */
123
+ export interface ObservationCreate {
124
+ content: string;
125
+
126
+ /**
127
+ * The peer the conclusion is about
128
+ */
129
+ observed_id: string;
130
+
131
+ /**
132
+ * The peer making the conclusion
133
+ */
134
+ observer_id: string;
135
+
136
+ /**
137
+ * The session this conclusion relates to
138
+ */
139
+ session_id: string;
140
+ }
141
+
142
+ /**
143
+ * Deprecated: use ConclusionGet.
73
144
  */
74
145
  export interface ObservationGet {
75
146
  filters?: { [key: string]: unknown } | null;
76
147
  }
77
148
 
78
149
  /**
79
- * Query parameters for semantic search of observations
150
+ * Deprecated: use ConclusionQuery.
80
151
  */
81
152
  export interface ObservationQuery {
82
153
  /**
@@ -100,31 +171,8 @@ export interface ObservationQuery {
100
171
  top_k?: number;
101
172
  }
102
173
 
103
- /**
104
- * Observation response - external view of a document
105
- */
106
- export interface Observations {
107
- id: string;
108
-
109
- content: string;
110
-
111
- created_at: string;
112
-
113
- /**
114
- * The peer being observed
115
- */
116
- observed_id: string;
117
-
118
- /**
119
- * The peer who made the observation
120
- */
121
- observer_id: string;
122
-
123
- session_id: string;
124
- }
125
-
126
174
  export interface PageObservation {
127
- items: Array<Observations>;
175
+ items: Array<Observation>;
128
176
 
129
177
  page: number;
130
178
 
@@ -135,9 +183,17 @@ export interface PageObservation {
135
183
  total?: number;
136
184
  }
137
185
 
186
+ export type ObservationCreateResponse = Array<Observation>;
187
+
138
188
  export type ObservationDeleteResponse = unknown;
139
189
 
140
- export type ObservationQueryResponse = Array<Observations>;
190
+ export type ObservationQueryResponse = Array<Observation>;
191
+
192
+ export interface ObservationCreateParams {
193
+ conclusions: Array<ConclusionsAPI.ConclusionCreate>;
194
+
195
+ observations: Array<ObservationCreate>;
196
+ }
141
197
 
142
198
  export interface ObservationListParams extends PageParams {
143
199
  /**
@@ -177,13 +233,16 @@ Observations.ObservationsPage = ObservationsPage;
177
233
 
178
234
  export declare namespace Observations {
179
235
  export {
236
+ type Observation as Observation,
237
+ type ObservationCreate as ObservationCreate,
180
238
  type ObservationGet as ObservationGet,
181
239
  type ObservationQuery as ObservationQuery,
182
- type Observations as Observations,
183
240
  type PageObservation as PageObservation,
241
+ type ObservationCreateResponse as ObservationCreateResponse,
184
242
  type ObservationDeleteResponse as ObservationDeleteResponse,
185
243
  type ObservationQueryResponse as ObservationQueryResponse,
186
244
  ObservationsPage as ObservationsPage,
245
+ type ObservationCreateParams as ObservationCreateParams,
187
246
  type ObservationListParams as ObservationListParams,
188
247
  type ObservationQueryParams as ObservationQueryParams,
189
248
  };