@hasura/promptql 2.0.0-alpha.2 → 2.0.0-alpha.4

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
@@ -66,14 +66,14 @@ const sdk = new PromptQLSdk({
66
66
  });
67
67
 
68
68
  // Start a new thread
69
- const thread = await sdk.startThread({
69
+ const thread = await sdk.thread.start({
70
70
  message: 'What are the top 10 customers by revenue?',
71
71
  });
72
72
 
73
73
  console.log('Thread ID:', thread.thread_id);
74
74
 
75
75
  // Stream events from the thread
76
- sdk.streamThreadEventsByThreadId(thread.thread_id).subscribe({
76
+ sdk.thread.streamEvents(thread.thread_id).subscribe({
77
77
  next: (events) => {
78
78
  events.forEach(event => {
79
79
  console.log('Event:', event);
@@ -88,13 +88,13 @@ sdk.streamThreadEventsByThreadId(thread.thread_id).subscribe({
88
88
 
89
89
  ```typescript
90
90
  // Send a follow-up message to an existing thread
91
- const result = await sdk.sendMessageToThread({
91
+ const result = await sdk.thread.sendMessage({
92
92
  threadId: 'existing-thread-id',
93
93
  message: 'Now show me their average order value',
94
94
  });
95
95
 
96
96
  // Stream the response
97
- sdk.streamThreadEventsByThreadId(result.thread_id, result.thread_event_id)
97
+ sdk.streamEvents(result.thread_id, result.thread_event_id)
98
98
  .subscribe({
99
99
  next: (events) => console.log('New events:', events),
100
100
  });
@@ -115,14 +115,14 @@ const sdk = new PromptQLSdk({
115
115
  });
116
116
 
117
117
  // Start a new thread
118
- const thread = await sdk.startThread({
118
+ const thread = await sdk.thread.start({
119
119
  message: 'What are the top 10 customers by revenue?',
120
120
  });
121
121
 
122
122
  console.log('Thread ID:', thread.thread_id);
123
123
 
124
124
  const events = await lastValueFrom(
125
- sdk.streamThreadEventsByThreadId(
125
+ sdk.thread.streamEvents(
126
126
  result.thread_id,
127
127
  ),
128
128
  );
@@ -145,14 +145,14 @@ const sdk = new PromptQLSdk({
145
145
  });
146
146
 
147
147
  // Start a new thread
148
- const thread = await sdk.startThread({
148
+ const thread = await sdk.thread.start({
149
149
  message: 'What are the top 10 customers by revenue?',
150
150
  });
151
151
 
152
152
  console.log('Thread ID:', thread.thread_id);
153
153
 
154
154
  // Stream events from the thread
155
- sdk.streamThreadEventsByThreadId(thread.thread_id)
155
+ sdk.streamEvents(thread.thread_id)
156
156
  .pipe(
157
157
  pairwise(),
158
158
  map(([prev, curr]) => diffThreadEvents(prev, curr)),
@@ -171,7 +171,7 @@ sdk.streamThreadEventsByThreadId(thread.thread_id)
171
171
  ### Listing Threads
172
172
 
173
173
  ```typescript
174
- const threads = await sdk.getThreads({
174
+ const threads = await sdk.thread.list({
175
175
  limit: 20,
176
176
  offset: 0,
177
177
  order_by: [{ created_at: 'desc' }],
@@ -188,7 +188,7 @@ threads.forEach(thread => {
188
188
  ### Get a Specific Thread
189
189
 
190
190
  ```typescript
191
- const thread = await sdk.getThreadById('thread-id');
191
+ const thread = await sdk.thread.get('thread-id');
192
192
  console.log('Thread:', thread);
193
193
  ```
194
194
 
@@ -208,7 +208,7 @@ import {
208
208
  getUserMessageEvent,
209
209
  } from '@hasura/promptql';
210
210
 
211
- sdk.streamThreadEventsByThreadId(threadId).subscribe({
211
+ sdk.thread.streamEvents(threadId).subscribe({
212
212
  next: (events) => {
213
213
  events.forEach(event => {
214
214
  // Check for plan generation start
@@ -291,72 +291,6 @@ interface PromptQLSdkOptions {
291
291
  }
292
292
  ```
293
293
 
294
- ## API Reference
295
-
296
- ### Class: `PromptQLSdk`
297
-
298
- #### Constructor
299
-
300
- ```typescript
301
- new PromptQLSdk(options: PromptQLSdkOptions)
302
- ```
303
-
304
- #### Methods
305
-
306
- ##### `getThreads(variables)`
307
-
308
- List threads with optional filtering and pagination.
309
-
310
- ```typescript
311
- getThreads(variables: GetThreadsQueryVariables): Promise<ThreadFragment[]>
312
- ```
313
-
314
- ##### `getThreadById(threadId)`
315
-
316
- Get a specific thread by ID.
317
-
318
- ```typescript
319
- getThreadById(threadId: string): Promise<ThreadFragment | null | undefined>
320
- ```
321
-
322
- ##### `startThread(variables)`
323
-
324
- Start a new thread with a message.
325
-
326
- ```typescript
327
- startThread(variables: StartThreadArguments): Promise<StartThreadOutput>
328
- ```
329
-
330
- ##### `sendMessageToThread(variables)`
331
-
332
- Send a message to an existing thread.
333
-
334
- ```typescript
335
- sendMessageToThread(variables: SendMessageToThreadArguments): Promise<SendMessageToThreadOutput>
336
- ```
337
-
338
- ##### `subscribeThreadEventsByThreadId(threadId, threadEventId?)`
339
-
340
- Subscribe to events from a thread. Continues indefinitely.
341
-
342
- ```typescript
343
- subscribeThreadEventsByThreadId(
344
- threadId: string,
345
- threadEventId?: string | null
346
- ): Observable<ThreadEvent[]>
347
- ```
348
-
349
- ##### `streamThreadEventsByThreadId(threadId, threadEventId?)`
350
-
351
- Stream events from a thread. Automatically completes when interaction finishes.
352
-
353
- ```typescript
354
- streamThreadEventsByThreadId(
355
- threadId: string,
356
- threadEventId?: string | null
357
- ): Observable<ThreadEvent[]>
358
- ```
359
-
360
294
  ## License
361
295
 
362
296
  Apache License 2.0 - see [LICENSE](LICENSE) file for details.
package/biome.json CHANGED
@@ -2,7 +2,14 @@
2
2
  "$schema": "https://biomejs.dev/schemas/2.3.13/schema.json",
3
3
  "root": false,
4
4
  "files": {
5
- "includes": ["**/*.ts", "**/*.gql", "!src/generated/*", "!dist/**/*"]
5
+ "includes": [
6
+ "**/*.ts",
7
+ "**/*.gql",
8
+ "!src/generated/*",
9
+ "!dist/**/*"
10
+ ]
6
11
  },
7
- "extends": ["@hasura/biome-config/base"]
8
- }
12
+ "extends": [
13
+ "../biome-config/base.json"
14
+ ]
15
+ }
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { ApolloClient, Observable } from '@apollo/client';
2
1
  import { GraphQLError } from 'graphql';
2
+ import { ApolloClient, Observable } from '@apollo/client';
3
3
 
4
4
  /**
5
5
  * This file was automatically generated by json-schema-to-typescript.
@@ -2536,14 +2536,6 @@ interface ArtifactReference2 {
2536
2536
  version: number;
2537
2537
  }
2538
2538
 
2539
- type ApolloClientOptions = {
2540
- url: string;
2541
- headers?: Record<string, string>;
2542
- getAuthToken: () => Promise<string>;
2543
- fetch?: typeof fetch;
2544
- };
2545
- declare const createApolloClient: (options: ApolloClientOptions) => ApolloClient;
2546
-
2547
2539
  type Maybe<T> = T | null;
2548
2540
  type InputMaybe<T> = Maybe<T>;
2549
2541
  type Exact<T extends {
@@ -4177,48 +4169,108 @@ type WikiInfoGenerated = EventOfKind<WikiExplorerUpdate, "WikiInfoGenerated">;
4177
4169
  type WikiExplorerCompleted = EventOfKind<WikiExplorerUpdate, "Completed">;
4178
4170
 
4179
4171
  /**
4180
- * PromptQL SDK allows you to interact with PromptQL API.
4172
+ * Constructor options for a PromptQL authenticator.
4181
4173
  */
4182
- declare class PromptQLSdk {
4183
- constructor(options: PromptQLSdkOptions);
4184
- private client;
4185
- private projectId;
4186
- private buildId;
4187
- private defaultTimezone;
4174
+ type PromptQLAuthTokenGeneratorOptions = {
4175
+ authHost?: string;
4176
+ projectId: string;
4177
+ promptqlGraphQLUrl: string;
4178
+ serviceAccountToken: string;
4179
+ fetch?: typeof fetch;
4180
+ };
4181
+ declare function createPromptQLAuthTokenGenerator(options: PromptQLAuthTokenGeneratorOptions): () => Promise<string>;
4182
+
4183
+ type LuxAuthPromptQLTokenSuccessResponse = {
4184
+ status: "success";
4185
+ expiry: string;
4186
+ token: string;
4187
+ };
4188
+ type LuxAuthPromptQLTokenFailedResponse = {
4189
+ error: string;
4190
+ status: "failure";
4191
+ };
4192
+ declare function isLuxAuthPromptQLTokenFailedResponse(input: unknown): input is LuxAuthPromptQLTokenFailedResponse;
4193
+ declare function isLuxAuthPromptQLTokenSuccessResponse(input: unknown): input is LuxAuthPromptQLTokenSuccessResponse;
4194
+ declare function isEnrichTokenMutationResponse(input: unknown): input is {
4195
+ data?: {
4196
+ enrich_token: EnrichTokenOutput;
4197
+ };
4198
+ errors?: GraphQLError[];
4199
+ };
4200
+
4201
+ type ClientOptions = {
4202
+ client: ApolloClient;
4203
+ projectId: string;
4204
+ buildId: string | undefined;
4205
+ defaultTimezone: string;
4206
+ };
4207
+
4208
+ /**
4209
+ * Project class implements the set of PromptQL project APIs.
4210
+ */
4211
+ declare class Project {
4212
+ private _options;
4213
+ constructor(options: ClientOptions);
4188
4214
  /**
4189
4215
  * Get the basic information of the PromptQL project.
4190
4216
  */
4191
- getProjectInfo(): Promise<GetProjectInfoOutput>;
4217
+ info(): Promise<GetProjectInfoOutput>;
4218
+ }
4219
+
4220
+ /**
4221
+ * Project class implements the set of PromptQL thread APIs.
4222
+ */
4223
+ declare class Thread {
4224
+ private _options;
4225
+ constructor(options: ClientOptions);
4192
4226
  /**
4193
4227
  * List threads of the current project. The default limit is 10.
4194
4228
  */
4195
- getThreads(variables: GetThreadsQueryVariables): Promise<ThreadFragment[]>;
4229
+ list(variables: GetThreadsQueryVariables): Promise<ThreadFragment[]>;
4196
4230
  /**
4197
4231
  * Get a thread by ID.
4198
4232
  */
4199
- getThreadById(threadId: string): Promise<ThreadFragment | null | undefined>;
4233
+ get(threadId: string): Promise<ThreadFragment | null | undefined>;
4200
4234
  /**
4201
4235
  * Start a PromptQL thread.
4202
4236
  */
4203
- startThread(variables: StartThreadArguments): Promise<StartThreadOutput>;
4237
+ start(variables: StartThreadArguments): Promise<StartThreadOutput>;
4204
4238
  /**
4205
4239
  * Send a message to an existing thread.
4206
4240
  */
4207
- sendMessageToThread(variables: SendMessageToThreadArguments): Promise<SendMessageToThreadOutput>;
4241
+ sendMessage(variables: SendMessageToThreadArguments): Promise<SendMessageToThreadOutput>;
4208
4242
  /**
4209
4243
  * Subscribe to events of a thread by ID. The subscription won't stop even if the interaction is completed.
4210
4244
  */
4211
- subscribeThreadEventsByThreadId(threadId: string, threadEventId?: string | null): Observable<ThreadEvent[]>;
4245
+ subscribeEvents(threadId: string, threadEventId?: string | null): Observable<ThreadEvent[]>;
4212
4246
  /**
4213
4247
  * Stream events of a thread by ID. Stop the subscription right after received the completed event.
4214
4248
  */
4215
- streamThreadEventsByThreadId(threadId: string, threadEventId?: string | null): Observable<ThreadEvent[]>;
4249
+ streamEvents(threadId: string, threadEventId?: string | null): Observable<ThreadEvent[]>;
4250
+ }
4251
+
4252
+ /**
4253
+ * PromptQL SDK allows you to interact with PromptQL API.
4254
+ */
4255
+ declare class PromptQLSdk {
4256
+ constructor(options: PromptQLSdkOptions);
4257
+ private _options;
4258
+ readonly thread: Thread;
4259
+ readonly project: Project;
4216
4260
  }
4217
4261
  /**
4218
4262
  * The interface of PromptQLSdk
4219
4263
  */
4220
4264
  type IPromptQLSdk = InstanceType<typeof PromptQLSdk>;
4221
4265
 
4266
+ type ApolloClientOptions = {
4267
+ url: string;
4268
+ headers?: Record<string, string>;
4269
+ getAuthToken: () => Promise<string>;
4270
+ fetch?: typeof fetch;
4271
+ };
4272
+ declare const createApolloClient: (options: ApolloClientOptions) => ApolloClient;
4273
+
4222
4274
  /**
4223
4275
  * Compare event elements between the previous array and the current array.
4224
4276
  * @param prev Previous thread events
@@ -4371,34 +4423,4 @@ declare function getAgentOrchestratorStepUiProgrammerEvent(eventData: ThreadEven
4371
4423
  */
4372
4424
  declare function getAgentOrchestratorStepSavedProgramRunnerEvent(eventData: ThreadEvent$1): SavedProgramRunnerUpdate | null;
4373
4425
 
4374
- /**
4375
- * Constructor options for a PromptQL authenticator.
4376
- */
4377
- type PromptQLAuthTokenGeneratorOptions = {
4378
- authHost?: string;
4379
- projectId: string;
4380
- promptqlGraphQLUrl: string;
4381
- serviceAccountToken: string;
4382
- fetch?: typeof fetch;
4383
- };
4384
- declare function createPromptQLAuthTokenGenerator(options: PromptQLAuthTokenGeneratorOptions): () => Promise<string>;
4385
-
4386
- type LuxAuthPromptQLTokenSuccessResponse = {
4387
- status: "success";
4388
- expiry: string;
4389
- token: string;
4390
- };
4391
- type LuxAuthPromptQLTokenFailedResponse = {
4392
- error: string;
4393
- status: "failure";
4394
- };
4395
- declare function isLuxAuthPromptQLTokenFailedResponse(input: unknown): input is LuxAuthPromptQLTokenFailedResponse;
4396
- declare function isLuxAuthPromptQLTokenSuccessResponse(input: unknown): input is LuxAuthPromptQLTokenSuccessResponse;
4397
- declare function isEnrichTokenMutationResponse(input: unknown): input is {
4398
- data?: {
4399
- enrich_token: EnrichTokenOutput;
4400
- };
4401
- errors?: GraphQLError[];
4402
- };
4403
-
4404
4426
  export { type AgentInteraction, type AgentState, type AgentUpdate, type AllTheServerTypes, type AnalyzedCodeAction, type AnalyzedCodeAction2, type ApolloClientOptions, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactPreview, type ArtifactReference, type ArtifactReference1, type ArtifactReference2, type ArtifactState, type ArtifactType, type ArtifactType2, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CheckedAssumption, type CheckedTopic, type CodeAction, type CodeAction2, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalysis1, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysis1, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisOutcome, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerState, type ContextExplorerUpdate, type CurrentAction, type DataArtifactUpdated, type DataArtifactUpdatedV1, type Dependency, type EventOfKind, type FactSource, type GeneratedCode, type GeneratedFile, type GeneratedFile2, type GeneratedProgramRunnerOutput, type GeneratedResponse, type GeneratedUiCode, type GeneratedUiCode1, type GetThreadsQueryVariables, type IPromptQLSdk, type Interaction, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDeclineReason, type InteractionFinishedUpdate, type InteractionOutcome, type InternalUpdate, type KeysOfUnion, type LlmUsage, type LuxAuthPromptQLTokenSuccessResponse, type MessageProcessingStarted, type MessageProcessingState, type MessageProcessingUpdate, type OrchestratorState, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineColumn, type PipelineColumnType, type PipelinePartitionSpec, type PipelinePartitionTransform, type PipelineRunStepDetails, type PipelineSchema, type PipelineSink, type PipelineSource, type PipelineStep, type PipelineTransform, type PlanGenerationStarted, type PlanState, type PlanStateStep, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionState, type PlanningDecisionUpdate, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunResult, type ProgramRunnerAction, type ProgramRunnerAction2, type ProgramRunnerActionResult, type ProgramRunnerAttempt, type ProgramTransform, type ProgrammerState, type ProgrammerUpdate, type PromptQLAuthTokenGeneratorOptions, PromptQLSdk, type PromptQLSdkOptions, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, type ResponseGenerationState, type ResponseGenerationUpdate, type RunConfigV1, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunProgramRequest2, type RunSavedProgramRequest, type RunSavedProgramRequest2, type RunStarted, type RunStartedV1, type RunStepDetails, type SavedProgramRunnerStage, type SavedProgramRunnerState, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type SchemaContext, type SchemaContext1, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerState, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationState, type SchemaTasksGenerationUpdate, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type ShelfActionEvent, type ShelfSink, type ShelfUpdate, type ShelfUpdateV1, type SocialFeedRating, type SocialFeedRatingLlmUsage, type SocialFeedRatingOutcome, type SocialFeedRatingUpdate, type Span, type SqlError, type SqlErrorV1, type SqlRunStepDetails, type SqlSource, type SqlStep, type StartThreadArguments, type StartThreadOutput, type StartingOrchestrator, type Step, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepState, type StepUpdate, type SummaryAction, type TasksGenerated, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiPageV1, type WikiSection, type WikiTitle, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getUserCancelEvent, getUserMessageEvent, isEnrichTokenMutationResponse, isLuxAuthPromptQLTokenFailedResponse, isLuxAuthPromptQLTokenSuccessResponse };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ApolloClient, Observable } from '@apollo/client';
2
1
  import { GraphQLError } from 'graphql';
2
+ import { ApolloClient, Observable } from '@apollo/client';
3
3
 
4
4
  /**
5
5
  * This file was automatically generated by json-schema-to-typescript.
@@ -2536,14 +2536,6 @@ interface ArtifactReference2 {
2536
2536
  version: number;
2537
2537
  }
2538
2538
 
2539
- type ApolloClientOptions = {
2540
- url: string;
2541
- headers?: Record<string, string>;
2542
- getAuthToken: () => Promise<string>;
2543
- fetch?: typeof fetch;
2544
- };
2545
- declare const createApolloClient: (options: ApolloClientOptions) => ApolloClient;
2546
-
2547
2539
  type Maybe<T> = T | null;
2548
2540
  type InputMaybe<T> = Maybe<T>;
2549
2541
  type Exact<T extends {
@@ -4177,48 +4169,108 @@ type WikiInfoGenerated = EventOfKind<WikiExplorerUpdate, "WikiInfoGenerated">;
4177
4169
  type WikiExplorerCompleted = EventOfKind<WikiExplorerUpdate, "Completed">;
4178
4170
 
4179
4171
  /**
4180
- * PromptQL SDK allows you to interact with PromptQL API.
4172
+ * Constructor options for a PromptQL authenticator.
4181
4173
  */
4182
- declare class PromptQLSdk {
4183
- constructor(options: PromptQLSdkOptions);
4184
- private client;
4185
- private projectId;
4186
- private buildId;
4187
- private defaultTimezone;
4174
+ type PromptQLAuthTokenGeneratorOptions = {
4175
+ authHost?: string;
4176
+ projectId: string;
4177
+ promptqlGraphQLUrl: string;
4178
+ serviceAccountToken: string;
4179
+ fetch?: typeof fetch;
4180
+ };
4181
+ declare function createPromptQLAuthTokenGenerator(options: PromptQLAuthTokenGeneratorOptions): () => Promise<string>;
4182
+
4183
+ type LuxAuthPromptQLTokenSuccessResponse = {
4184
+ status: "success";
4185
+ expiry: string;
4186
+ token: string;
4187
+ };
4188
+ type LuxAuthPromptQLTokenFailedResponse = {
4189
+ error: string;
4190
+ status: "failure";
4191
+ };
4192
+ declare function isLuxAuthPromptQLTokenFailedResponse(input: unknown): input is LuxAuthPromptQLTokenFailedResponse;
4193
+ declare function isLuxAuthPromptQLTokenSuccessResponse(input: unknown): input is LuxAuthPromptQLTokenSuccessResponse;
4194
+ declare function isEnrichTokenMutationResponse(input: unknown): input is {
4195
+ data?: {
4196
+ enrich_token: EnrichTokenOutput;
4197
+ };
4198
+ errors?: GraphQLError[];
4199
+ };
4200
+
4201
+ type ClientOptions = {
4202
+ client: ApolloClient;
4203
+ projectId: string;
4204
+ buildId: string | undefined;
4205
+ defaultTimezone: string;
4206
+ };
4207
+
4208
+ /**
4209
+ * Project class implements the set of PromptQL project APIs.
4210
+ */
4211
+ declare class Project {
4212
+ private _options;
4213
+ constructor(options: ClientOptions);
4188
4214
  /**
4189
4215
  * Get the basic information of the PromptQL project.
4190
4216
  */
4191
- getProjectInfo(): Promise<GetProjectInfoOutput>;
4217
+ info(): Promise<GetProjectInfoOutput>;
4218
+ }
4219
+
4220
+ /**
4221
+ * Project class implements the set of PromptQL thread APIs.
4222
+ */
4223
+ declare class Thread {
4224
+ private _options;
4225
+ constructor(options: ClientOptions);
4192
4226
  /**
4193
4227
  * List threads of the current project. The default limit is 10.
4194
4228
  */
4195
- getThreads(variables: GetThreadsQueryVariables): Promise<ThreadFragment[]>;
4229
+ list(variables: GetThreadsQueryVariables): Promise<ThreadFragment[]>;
4196
4230
  /**
4197
4231
  * Get a thread by ID.
4198
4232
  */
4199
- getThreadById(threadId: string): Promise<ThreadFragment | null | undefined>;
4233
+ get(threadId: string): Promise<ThreadFragment | null | undefined>;
4200
4234
  /**
4201
4235
  * Start a PromptQL thread.
4202
4236
  */
4203
- startThread(variables: StartThreadArguments): Promise<StartThreadOutput>;
4237
+ start(variables: StartThreadArguments): Promise<StartThreadOutput>;
4204
4238
  /**
4205
4239
  * Send a message to an existing thread.
4206
4240
  */
4207
- sendMessageToThread(variables: SendMessageToThreadArguments): Promise<SendMessageToThreadOutput>;
4241
+ sendMessage(variables: SendMessageToThreadArguments): Promise<SendMessageToThreadOutput>;
4208
4242
  /**
4209
4243
  * Subscribe to events of a thread by ID. The subscription won't stop even if the interaction is completed.
4210
4244
  */
4211
- subscribeThreadEventsByThreadId(threadId: string, threadEventId?: string | null): Observable<ThreadEvent[]>;
4245
+ subscribeEvents(threadId: string, threadEventId?: string | null): Observable<ThreadEvent[]>;
4212
4246
  /**
4213
4247
  * Stream events of a thread by ID. Stop the subscription right after received the completed event.
4214
4248
  */
4215
- streamThreadEventsByThreadId(threadId: string, threadEventId?: string | null): Observable<ThreadEvent[]>;
4249
+ streamEvents(threadId: string, threadEventId?: string | null): Observable<ThreadEvent[]>;
4250
+ }
4251
+
4252
+ /**
4253
+ * PromptQL SDK allows you to interact with PromptQL API.
4254
+ */
4255
+ declare class PromptQLSdk {
4256
+ constructor(options: PromptQLSdkOptions);
4257
+ private _options;
4258
+ readonly thread: Thread;
4259
+ readonly project: Project;
4216
4260
  }
4217
4261
  /**
4218
4262
  * The interface of PromptQLSdk
4219
4263
  */
4220
4264
  type IPromptQLSdk = InstanceType<typeof PromptQLSdk>;
4221
4265
 
4266
+ type ApolloClientOptions = {
4267
+ url: string;
4268
+ headers?: Record<string, string>;
4269
+ getAuthToken: () => Promise<string>;
4270
+ fetch?: typeof fetch;
4271
+ };
4272
+ declare const createApolloClient: (options: ApolloClientOptions) => ApolloClient;
4273
+
4222
4274
  /**
4223
4275
  * Compare event elements between the previous array and the current array.
4224
4276
  * @param prev Previous thread events
@@ -4371,34 +4423,4 @@ declare function getAgentOrchestratorStepUiProgrammerEvent(eventData: ThreadEven
4371
4423
  */
4372
4424
  declare function getAgentOrchestratorStepSavedProgramRunnerEvent(eventData: ThreadEvent$1): SavedProgramRunnerUpdate | null;
4373
4425
 
4374
- /**
4375
- * Constructor options for a PromptQL authenticator.
4376
- */
4377
- type PromptQLAuthTokenGeneratorOptions = {
4378
- authHost?: string;
4379
- projectId: string;
4380
- promptqlGraphQLUrl: string;
4381
- serviceAccountToken: string;
4382
- fetch?: typeof fetch;
4383
- };
4384
- declare function createPromptQLAuthTokenGenerator(options: PromptQLAuthTokenGeneratorOptions): () => Promise<string>;
4385
-
4386
- type LuxAuthPromptQLTokenSuccessResponse = {
4387
- status: "success";
4388
- expiry: string;
4389
- token: string;
4390
- };
4391
- type LuxAuthPromptQLTokenFailedResponse = {
4392
- error: string;
4393
- status: "failure";
4394
- };
4395
- declare function isLuxAuthPromptQLTokenFailedResponse(input: unknown): input is LuxAuthPromptQLTokenFailedResponse;
4396
- declare function isLuxAuthPromptQLTokenSuccessResponse(input: unknown): input is LuxAuthPromptQLTokenSuccessResponse;
4397
- declare function isEnrichTokenMutationResponse(input: unknown): input is {
4398
- data?: {
4399
- enrich_token: EnrichTokenOutput;
4400
- };
4401
- errors?: GraphQLError[];
4402
- };
4403
-
4404
4426
  export { type AgentInteraction, type AgentState, type AgentUpdate, type AllTheServerTypes, type AnalyzedCodeAction, type AnalyzedCodeAction2, type ApolloClientOptions, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactPreview, type ArtifactReference, type ArtifactReference1, type ArtifactReference2, type ArtifactState, type ArtifactType, type ArtifactType2, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CheckedAssumption, type CheckedTopic, type CodeAction, type CodeAction2, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalysis1, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysis1, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisOutcome, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerState, type ContextExplorerUpdate, type CurrentAction, type DataArtifactUpdated, type DataArtifactUpdatedV1, type Dependency, type EventOfKind, type FactSource, type GeneratedCode, type GeneratedFile, type GeneratedFile2, type GeneratedProgramRunnerOutput, type GeneratedResponse, type GeneratedUiCode, type GeneratedUiCode1, type GetThreadsQueryVariables, type IPromptQLSdk, type Interaction, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDeclineReason, type InteractionFinishedUpdate, type InteractionOutcome, type InternalUpdate, type KeysOfUnion, type LlmUsage, type LuxAuthPromptQLTokenSuccessResponse, type MessageProcessingStarted, type MessageProcessingState, type MessageProcessingUpdate, type OrchestratorState, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineColumn, type PipelineColumnType, type PipelinePartitionSpec, type PipelinePartitionTransform, type PipelineRunStepDetails, type PipelineSchema, type PipelineSink, type PipelineSource, type PipelineStep, type PipelineTransform, type PlanGenerationStarted, type PlanState, type PlanStateStep, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionState, type PlanningDecisionUpdate, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunResult, type ProgramRunnerAction, type ProgramRunnerAction2, type ProgramRunnerActionResult, type ProgramRunnerAttempt, type ProgramTransform, type ProgrammerState, type ProgrammerUpdate, type PromptQLAuthTokenGeneratorOptions, PromptQLSdk, type PromptQLSdkOptions, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, type ResponseGenerationState, type ResponseGenerationUpdate, type RunConfigV1, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunProgramRequest2, type RunSavedProgramRequest, type RunSavedProgramRequest2, type RunStarted, type RunStartedV1, type RunStepDetails, type SavedProgramRunnerStage, type SavedProgramRunnerState, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type SchemaContext, type SchemaContext1, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerState, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationState, type SchemaTasksGenerationUpdate, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type ShelfActionEvent, type ShelfSink, type ShelfUpdate, type ShelfUpdateV1, type SocialFeedRating, type SocialFeedRatingLlmUsage, type SocialFeedRatingOutcome, type SocialFeedRatingUpdate, type Span, type SqlError, type SqlErrorV1, type SqlRunStepDetails, type SqlSource, type SqlStep, type StartThreadArguments, type StartThreadOutput, type StartingOrchestrator, type Step, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepState, type StepUpdate, type SummaryAction, type TasksGenerated, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiPageV1, type WikiSection, type WikiTitle, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getUserCancelEvent, getUserMessageEvent, isEnrichTokenMutationResponse, isLuxAuthPromptQLTokenFailedResponse, isLuxAuthPromptQLTokenSuccessResponse };