@townco/apiclient 0.0.35 → 0.0.37

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/dist/index.d.ts CHANGED
@@ -1,257 +1,7 @@
1
- export declare const createClient: ({ shedUrl, accessToken, debug, }: {
1
+ export declare const createTRPCLinks: ({ shedUrl, accessToken, debug, }: {
2
2
  shedUrl: string;
3
- accessToken: string;
3
+ accessToken?: string;
4
4
  debug?: boolean;
5
- }) => import("@trpc/client").TRPCClient<import("@trpc/server").TRPCBuiltRouter<{
6
- ctx: {
7
- user: import("@supabase/supabase-js").User | null;
8
- token: string;
9
- } | {
10
- user: null;
11
- token: undefined;
12
- };
13
- meta: object;
14
- errorShape: import("@trpc/server").TRPCDefaultErrorShape;
15
- transformer: true;
16
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
17
- greet: import("@trpc/server").TRPCQueryProcedure<{
18
- input: void;
19
- output: string;
20
- meta: object;
21
- }>;
22
- listArtifacts: import("@trpc/server").TRPCQueryProcedure<{
23
- input: {
24
- key: string;
25
- recursive?: boolean | undefined;
26
- kind: "agent" | "user";
27
- };
28
- output: import("@supabase/storage-js").FileObject[];
29
- meta: object;
30
- }>;
31
- getArtifactUrl: import("@trpc/server").TRPCQueryProcedure<{
32
- input: {
33
- key: string;
34
- upload?: boolean | undefined;
35
- kind: "agent" | "user";
36
- };
37
- output: string;
38
- meta: object;
39
- }>;
40
- deleteArtifact: import("@trpc/server").TRPCMutationProcedure<{
41
- input: {
42
- kind: "agent" | "user";
43
- key: string;
44
- };
45
- output: {
46
- success: boolean;
47
- };
48
- meta: object;
49
- }>;
50
- uploadArchive: import("@trpc/server").TRPCMutationProcedure<{
51
- input: import("@trpc/server/unstable-core-do-not-import").OctetInput;
52
- output: {
53
- sha256: string;
54
- cached: boolean;
55
- };
56
- meta: object;
57
- }>;
58
- deploy: import("@trpc/server").TRPCSubscriptionProcedure<{
59
- input: {
60
- agent: string;
61
- shedUrl: string;
62
- agentUser?: string | undefined;
63
- agentPass?: string | undefined;
64
- env?: Record<string, string> | undefined;
65
- } & ({
66
- type: "repo-deploy";
67
- sha256: string;
68
- } | {
69
- type: "definition-deploy";
70
- definition: {
71
- version?: string | undefined;
72
- description?: string | undefined;
73
- systemPrompt: string | null;
74
- model: string;
75
- mcps?: {
76
- name: string;
77
- transport: "http";
78
- url: string;
79
- headers?: Record<string, string> | undefined;
80
- }[] | undefined;
81
- };
82
- });
83
- output: AsyncIterable<{
84
- status: string;
85
- error?: never;
86
- } | {
87
- status?: never;
88
- error: unknown;
89
- }, void>;
90
- meta: object;
91
- }>;
92
- "library.create": import("@trpc/server").TRPCMutationProcedure<{
93
- input: {
94
- name: string;
95
- };
96
- output: {
97
- collectionId: string | undefined;
98
- };
99
- meta: object;
100
- }>;
101
- "library.list": import("@trpc/server").TRPCQueryProcedure<{
102
- input: void;
103
- output: {
104
- collections: import("./library-types").CollectionListItem[] | undefined;
105
- };
106
- meta: object;
107
- }>;
108
- "library.delete": import("@trpc/server").TRPCMutationProcedure<{
109
- input: {
110
- id: string;
111
- };
112
- output: {
113
- success: boolean;
114
- };
115
- meta: object;
116
- }>;
117
- "library.pipelineStatus": import("@trpc/server").TRPCQueryProcedure<{
118
- input: {
119
- id: string;
120
- };
121
- output: {
122
- status: any;
123
- };
124
- meta: object;
125
- }>;
126
- "library.emailDataSources": import("@trpc/server").TRPCQueryProcedure<{
127
- input: {
128
- collectionId: string;
129
- };
130
- output: {
131
- dataSources: any[] | undefined;
132
- };
133
- meta: object;
134
- }>;
135
- "library.driveConnections": import("@trpc/server").TRPCQueryProcedure<{
136
- input: {
137
- collectionId: string;
138
- };
139
- output: {
140
- connections: any[] | undefined;
141
- };
142
- meta: object;
143
- }>;
144
- "library.driveSyncFolders": import("@trpc/server").TRPCQueryProcedure<{
145
- input: {
146
- collectionId: string;
147
- };
148
- output: {
149
- folders: any[] | undefined;
150
- };
151
- meta: object;
152
- }>;
153
- "library.calendarConnections": import("@trpc/server").TRPCQueryProcedure<{
154
- input: {
155
- collectionId: string;
156
- };
157
- output: {
158
- connections: any[] | undefined;
159
- };
160
- meta: object;
161
- }>;
162
- "library.syncCalendars": import("@trpc/server").TRPCQueryProcedure<{
163
- input: {
164
- collectionId: string;
165
- };
166
- output: {
167
- calendars: any[] | undefined;
168
- };
169
- meta: object;
170
- }>;
171
- "library.slackImportHistory": import("@trpc/server").TRPCQueryProcedure<{
172
- input: {
173
- collectionId: string;
174
- };
175
- output: {
176
- imports: any[] | undefined;
177
- };
178
- meta: object;
179
- }>;
180
- "library.userUploads": import("@trpc/server").TRPCQueryProcedure<{
181
- input: {
182
- collectionId: string;
183
- };
184
- output: {
185
- uploads: any[] | undefined;
186
- };
187
- meta: object;
188
- }>;
189
- "library.createOAuthSetupLink": import("@trpc/server").TRPCMutationProcedure<{
190
- input: {
191
- collectionId: string;
192
- dataSourceType: "gmail" | "google_calendar" | "google_drive";
193
- callbackUrl: string;
194
- };
195
- output: {
196
- link: any;
197
- };
198
- meta: object;
199
- }>;
200
- "library.getOAuthSetupLinkStatus": import("@trpc/server").TRPCQueryProcedure<{
201
- input: {
202
- collectionId: string;
203
- linkId: string;
204
- };
205
- output: {
206
- status: any;
207
- };
208
- meta: object;
209
- }>;
210
- "library.disconnectGmail": import("@trpc/server").TRPCMutationProcedure<{
211
- input: {
212
- collectionId: string;
213
- dataSourceId: number;
214
- };
215
- output: {
216
- success: boolean;
217
- };
218
- meta: object;
219
- }>;
220
- "library.disconnectDrive": import("@trpc/server").TRPCMutationProcedure<{
221
- input: {
222
- collectionId: string;
223
- dataSourceId: number;
224
- };
225
- output: {
226
- success: boolean;
227
- };
228
- meta: object;
229
- }>;
230
- "library.disconnectCalendar": import("@trpc/server").TRPCMutationProcedure<{
231
- input: {
232
- collectionId: string;
233
- dataSourceId: number;
234
- };
235
- output: {
236
- success: boolean;
237
- };
238
- meta: object;
239
- }>;
240
- "library.deleteUserUpload": import("@trpc/server").TRPCMutationProcedure<{
241
- input: {
242
- collectionId: string;
243
- uploadId: number;
244
- };
245
- output: {
246
- success: boolean;
247
- };
248
- meta: object;
249
- }>;
250
- "definitions.get": import("@trpc/server").TRPCQueryProcedure<{
251
- input: {
252
- id: string;
253
- };
254
- output: import("./server").AgentDefinitionRecord;
255
- meta: object;
256
- }>;
257
- }>>>;
5
+ }) => {
6
+ links: import("@trpc/client").TRPCLink<import("@trpc/server").AnyRouter>[];
7
+ };
package/dist/index.js CHANGED
@@ -1,11 +1,13 @@
1
- import { createTRPCClient, httpLink, httpSubscriptionLink, loggerLink, splitLink, } from "@trpc/client";
1
+ import { httpLink, httpSubscriptionLink, loggerLink, splitLink, } from "@trpc/client";
2
2
  import { EventSource } from "eventsource";
3
3
  import superjson from "superjson";
4
- export const createClient = ({ shedUrl, accessToken, debug = true, }) => {
5
- const authHeader = { Authorization: `Bearer ${accessToken}` };
4
+ export const createTRPCLinks = ({ shedUrl, accessToken, debug = true, }) => {
5
+ const authHeader = accessToken
6
+ ? { Authorization: `Bearer ${accessToken}` }
7
+ : {};
6
8
  const url = `${shedUrl}/api/trpc`;
7
9
  const baseLinkOpts = { url, transformer: superjson };
8
- return createTRPCClient({
10
+ return {
9
11
  links: [
10
12
  loggerLink({ enabled: (_) => debug }),
11
13
  splitLink({
@@ -14,7 +16,7 @@ export const createClient = ({ shedUrl, accessToken, debug = true, }) => {
14
16
  ...baseLinkOpts,
15
17
  EventSource,
16
18
  eventSourceOptions: {
17
- fetch: async (url, init) => fetch(url, {
19
+ fetch: async (url, init) => await fetch(url, {
18
20
  ...init,
19
21
  headers: { ...init.headers, ...authHeader },
20
22
  }),
@@ -23,5 +25,5 @@ export const createClient = ({ shedUrl, accessToken, debug = true, }) => {
23
25
  false: httpLink({ ...baseLinkOpts, headers: authHeader }),
24
26
  }),
25
27
  ],
26
- });
28
+ };
27
29
  };
package/dist/server.d.ts CHANGED
@@ -76,6 +76,20 @@ declare const AgentDefinitionSchema: z.ZodObject<{
76
76
  url: z.ZodString;
77
77
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
78
78
  }, z.core.$strip>>>;
79
+ subagents: z.ZodOptional<z.ZodArray<z.ZodObject<{
80
+ name: z.ZodString;
81
+ description: z.ZodOptional<z.ZodString>;
82
+ toolDescription: z.ZodString;
83
+ displayName: z.ZodOptional<z.ZodString>;
84
+ systemPrompt: z.ZodNullable<z.ZodString>;
85
+ model: z.ZodString;
86
+ mcps: z.ZodOptional<z.ZodArray<z.ZodObject<{
87
+ name: z.ZodString;
88
+ transport: z.ZodLiteral<"http">;
89
+ url: z.ZodString;
90
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
91
+ }, z.core.$strip>>>;
92
+ }, z.core.$strip>>>;
79
93
  }, z.core.$strip>;
80
94
  export declare const router: import("@trpc/server").TRPCBuiltRouter<{
81
95
  ctx: {
@@ -94,6 +108,13 @@ export declare const router: import("@trpc/server").TRPCBuiltRouter<{
94
108
  output: string;
95
109
  meta: object;
96
110
  }>;
111
+ "config.libraryApiUrl": import("@trpc/server").TRPCQueryProcedure<{
112
+ input: void;
113
+ output: {
114
+ url: string;
115
+ };
116
+ meta: object;
117
+ }>;
97
118
  listArtifacts: import("@trpc/server").TRPCQueryProcedure<{
98
119
  input: {
99
120
  key: string;
@@ -153,14 +174,34 @@ export declare const router: import("@trpc/server").TRPCBuiltRouter<{
153
174
  url: string;
154
175
  headers?: Record<string, string> | undefined;
155
176
  }[] | undefined;
177
+ subagents?: {
178
+ name: string;
179
+ description?: string | undefined;
180
+ toolDescription: string;
181
+ displayName?: string | undefined;
182
+ systemPrompt: string | null;
183
+ model: string;
184
+ mcps?: {
185
+ name: string;
186
+ transport: "http";
187
+ url: string;
188
+ headers?: Record<string, string> | undefined;
189
+ }[] | undefined;
190
+ }[] | undefined;
156
191
  };
157
192
  });
158
193
  output: AsyncIterable<{
159
194
  status: string;
160
195
  error?: never;
196
+ agentUrl?: never;
161
197
  } | {
162
- status?: never;
163
198
  error: unknown;
199
+ status?: never;
200
+ agentUrl?: never;
201
+ } | {
202
+ error?: never;
203
+ status: string;
204
+ agentUrl: string;
164
205
  }, void, any>;
165
206
  meta: object;
166
207
  }>;
@@ -180,6 +221,15 @@ export declare const router: import("@trpc/server").TRPCBuiltRouter<{
180
221
  };
181
222
  meta: object;
182
223
  }>;
224
+ "library.getApiKey": import("@trpc/server").TRPCQueryProcedure<{
225
+ input: {
226
+ id: string;
227
+ };
228
+ output: {
229
+ apiKey: string | undefined;
230
+ };
231
+ meta: object;
232
+ }>;
183
233
  "library.delete": import("@trpc/server").TRPCMutationProcedure<{
184
234
  input: {
185
235
  id: string;
@@ -312,6 +362,26 @@ export declare const router: import("@trpc/server").TRPCBuiltRouter<{
312
362
  };
313
363
  meta: object;
314
364
  }>;
365
+ "library.disconnectMbox": import("@trpc/server").TRPCMutationProcedure<{
366
+ input: {
367
+ collectionId: string;
368
+ dataSourceId: number;
369
+ };
370
+ output: {
371
+ success: boolean;
372
+ };
373
+ meta: object;
374
+ }>;
375
+ "library.disconnectSlack": import("@trpc/server").TRPCMutationProcedure<{
376
+ input: {
377
+ collectionId: string;
378
+ importId: number;
379
+ };
380
+ output: {
381
+ success: boolean;
382
+ };
383
+ meta: object;
384
+ }>;
315
385
  "library.deleteUserUpload": import("@trpc/server").TRPCMutationProcedure<{
316
386
  input: {
317
387
  collectionId: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@townco/apiclient",
3
3
  "type": "module",
4
- "version": "0.0.35",
4
+ "version": "0.0.37",
5
5
  "description": "apiclient",
6
6
  "license": "UNLICENSED",
7
7
  "main": "./dist/index.js",
@@ -14,6 +14,10 @@
14
14
  ".": {
15
15
  "import": "./dist/index.js",
16
16
  "types": "./dist/index.d.ts"
17
+ },
18
+ "./server": {
19
+ "import": "./dist/server.js",
20
+ "types": "./dist/server.d.ts"
17
21
  }
18
22
  },
19
23
  "devDependencies": {