@sixb/client 0.1.17 → 0.1.19

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 (55) hide show
  1. package/README.md +8 -23
  2. package/dist/actions.d.ts +9 -50
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/browser.d.ts.map +1 -1
  5. package/dist/browser.js +9 -4
  6. package/dist/browser.js.map +3 -3
  7. package/dist/{chunk-bvasdctr.js → chunk-12s8gbwj.js} +2 -2
  8. package/dist/{chunk-aqpr0h1n.js → chunk-3aa3m9z6.js} +2 -2
  9. package/dist/{chunk-mjvdcaw4.js → chunk-95bnb04n.js} +1 -1
  10. package/dist/{chunk-p1j3d7t0.js → chunk-awbb496e.js} +1 -1
  11. package/dist/{chunk-bcyvstee.js → chunk-j512cs3e.js} +15 -224
  12. package/dist/chunk-j512cs3e.js.map +17 -0
  13. package/dist/{chunk-hdgztpzs.js → chunk-tkjkrcdt.js} +1 -3
  14. package/dist/{chunk-hdgztpzs.js.map → chunk-tkjkrcdt.js.map} +3 -3
  15. package/dist/connectors/queries.d.ts.map +1 -1
  16. package/dist/events-builder.d.ts +2 -27
  17. package/dist/events-builder.d.ts.map +1 -1
  18. package/dist/events-transport.d.ts +1 -3
  19. package/dist/events-transport.d.ts.map +1 -1
  20. package/dist/generated/@tanstack/react-query.gen.d.ts +428 -194
  21. package/dist/generated/@tanstack/react-query.gen.d.ts.map +1 -1
  22. package/dist/generated/index.d.ts +1 -1
  23. package/dist/generated/index.d.ts.map +1 -1
  24. package/dist/generated/sdk.gen.d.ts +3 -1
  25. package/dist/generated/sdk.gen.d.ts.map +1 -1
  26. package/dist/generated/types.gen.d.ts +220 -46
  27. package/dist/generated/types.gen.d.ts.map +1 -1
  28. package/dist/hooks.js +18 -29
  29. package/dist/hooks.js.map +4 -4
  30. package/dist/index.d.ts +2 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +7 -15
  33. package/dist/index.js.map +1 -1
  34. package/dist/logs.js +3 -3
  35. package/dist/models.js +1 -1
  36. package/dist/query-hooks.d.ts +5 -5
  37. package/dist/query-hooks.d.ts.map +1 -1
  38. package/dist/query.js +3 -3
  39. package/package.json +2 -2
  40. package/src/actions.ts +9 -288
  41. package/src/browser.ts +9 -0
  42. package/src/events-builder.ts +4 -80
  43. package/src/events-transport.ts +2 -5
  44. package/src/file.ts +5 -2
  45. package/src/generated/@tanstack/react-query.gen.ts +3 -1
  46. package/src/generated/index.ts +1 -0
  47. package/src/generated/sdk.gen.ts +3 -3
  48. package/src/generated/types.gen.ts +296 -71
  49. package/src/index.ts +2 -1
  50. package/src/query-hooks.ts +29 -44
  51. package/dist/chunk-bcyvstee.js.map +0 -17
  52. /package/dist/{chunk-bvasdctr.js.map → chunk-12s8gbwj.js.map} +0 -0
  53. /package/dist/{chunk-aqpr0h1n.js.map → chunk-3aa3m9z6.js.map} +0 -0
  54. /package/dist/{chunk-mjvdcaw4.js.map → chunk-95bnb04n.js.map} +0 -0
  55. /package/dist/{chunk-p1j3d7t0.js.map → chunk-awbb496e.js.map} +0 -0
@@ -12,9 +12,8 @@
12
12
  */
13
13
 
14
14
  import type {
15
- ActionDefinition,
16
15
  DatasetDefinition,
17
- InferObjectProperties,
16
+ InferObjectReadProperties,
18
17
  InferPropertyValue,
19
18
  PipelineDefinition,
20
19
  RuleDefinition,
@@ -116,7 +115,7 @@ type ObjectPropertiesEventOf<
116
115
  > = Override<
117
116
  TEvent,
118
117
  {
119
- payload: Override<TEvent["payload"], { properties: InferObjectProperties<TObjectType> }>
118
+ payload: Override<TEvent["payload"], { properties: InferObjectReadProperties<TObjectType> }>
120
119
  }
121
120
  >
122
121
 
@@ -249,42 +248,6 @@ export interface EventsRunBuilder<TEvent extends SixbEvent> extends Subscribable
249
248
  run(runId: string): EventsRunBuilder<TEvent>
250
249
  }
251
250
 
252
- /** Object-subject scope builder for action events: `events.actions().subject(Type).byId(id)`. */
253
- export interface EventsActionSubjectBuilder<TEvent extends SixbEvent>
254
- extends SubscribableEvents<TEvent> {
255
- /** Scope to a single action subject object. */
256
- byId(primaryId: string): EventsActionBuilder<TEvent>
257
- }
258
-
259
- /** Action-scoped topic builder: `events.actions().run(runId).completed()`. */
260
- export interface EventsActionBuilder<TEvent extends SixbEvent> extends SubscribableEvents<TEvent> {
261
- /** Scope to a single action run id. */
262
- run(runId: string): EventsActionBuilder<TEvent>
263
-
264
- /** Scope to one action definition id. */
265
- action(actionId: string): EventsActionBuilder<TEvent>
266
-
267
- /** Scope to an object-bound action subject type. */
268
- subject<TObjectType extends ObjectTypeWithTokens>(
269
- objectType: TObjectType
270
- ): EventsActionSubjectBuilder<TEvent>
271
- subject(objectTypeId: string): EventsActionSubjectBuilder<TEvent>
272
-
273
- /** Action request events. */
274
- requested(): EventsActionBuilder<SixbEventOfType<"action.requested">>
275
-
276
- /** Successful terminal action events. */
277
- completed(): EventsActionBuilder<SixbEventOfType<"action.completed">>
278
-
279
- /** Failed or cancelled terminal action events. */
280
- failed(): EventsActionBuilder<SixbEventOfType<"action.failed">>
281
-
282
- /** All terminal action events. */
283
- terminal(): EventsActionBuilder<
284
- SixbEventOfType<"action.completed"> | SixbEventOfType<"action.failed">
285
- >
286
- }
287
-
288
251
  /** Rule-scoped topic builder: `events.rule(rule).triggered()`. */
289
252
  export interface EventsRuleBuilder<TEvent extends SixbEvent> extends SubscribableEvents<TEvent> {
290
253
  triggered(): EventsRuleBuilder<SixbEventOfType<"rule.triggered">>
@@ -360,11 +323,10 @@ export function createWsSubscribeExecutor(options?: { client?: Client }): EventS
360
323
  const socket = createEventSocket({
361
324
  topic: filter.topic,
362
325
  types: filter.types,
363
- // Object/action/run scope is filtered server-side; the client predicate
326
+ // Object/run scope is filtered server-side; the client predicate
364
327
  // still refines propertyId/linkId and guards correctness.
365
328
  objectTypeId: filter.objectTypeId,
366
329
  primaryId: filter.primaryId,
367
- actionId: filter.actionId,
368
330
  runId: filter.runId,
369
331
  afterCursor: subscribeOptions?.afterCursor,
370
332
  limit: subscribeOptions?.limit,
@@ -518,29 +480,12 @@ class EventsBuilderImpl {
518
480
  return this.withFilter({ runId })
519
481
  }
520
482
 
521
- action(actionId: string): EventsBuilderImpl {
522
- return this.withFilter({ actionId })
523
- }
524
-
525
- subject(objectType: ObjectTypeWithTokens | string): EventsBuilderImpl {
526
- const objectTypeId = typeof objectType === "string" ? objectType : objectType.id
527
- return this.withFilter({ objectTypeId })
528
- }
529
-
530
- requested(): EventsBuilderImpl {
531
- return this.withFilter({ topic: "actions", types: ["action.requested"] })
532
- }
533
-
534
- completed(): EventsBuilderImpl {
535
- return this.withFilter({ topic: "actions", types: ["action.completed"] })
536
- }
537
-
538
483
  failed(): EventsBuilderImpl {
539
484
  const selector = this.params.selector
540
485
  if (selector && "failed" in selector) {
541
486
  return this.withSelectorSpec(selector.failed())
542
487
  }
543
- return this.withFilter({ topic: "actions", types: ["action.failed"] })
488
+ return this
544
489
  }
545
490
 
546
491
  succeeded(): EventsBuilderImpl {
@@ -559,10 +504,6 @@ class EventsBuilderImpl {
559
504
  return this
560
505
  }
561
506
 
562
- terminal(): EventsBuilderImpl {
563
- return this.withFilter({ topic: "actions", types: ["action.completed", "action.failed"] })
564
- }
565
-
566
507
  triggered(): EventsBuilderImpl {
567
508
  return this.withFilter({ topic: "rules", types: ["rule.triggered"] })
568
509
  }
@@ -647,11 +588,6 @@ export interface SixbEventsApi {
647
588
  objects(options?: SixbEventsClientOptions): EventsTopicBuilder<SixbEventOfTopic<"objects">>
648
589
  telemetry(options?: SixbEventsClientOptions): EventsTopicBuilder<SixbEventOfTopic<"telemetry">>
649
590
  links(options?: SixbEventsClientOptions): EventsTopicBuilder<SixbEventOfTopic<"links">>
650
- actions(options?: SixbEventsClientOptions): EventsActionBuilder<SixbEventOfTopic<"actions">>
651
- action<TAction extends ActionDefinition>(
652
- action: TAction,
653
- options?: SixbEventsClientOptions
654
- ): EventsActionBuilder<SixbEventOfTopic<"actions">>
655
591
  rule<TRule extends RuleDefinition>(
656
592
  rule: TRule,
657
593
  options?: SixbEventsClientOptions
@@ -690,12 +626,6 @@ function runBuilder<TEvent extends SixbEvent>(
690
626
  return createBuilder({ topic }, options) as unknown as EventsRunBuilder<TEvent>
691
627
  }
692
628
 
693
- function actionBuilder<TEvent extends SixbEvent>(
694
- options?: SixbEventsClientOptions
695
- ): EventsActionBuilder<TEvent> {
696
- return createBuilder({ topic: "actions" }, options) as unknown as EventsActionBuilder<TEvent>
697
- }
698
-
699
629
  const eventsApi = {} as SixbEventsApi
700
630
 
701
631
  eventsApi.object = (objectType, options) => {
@@ -710,12 +640,6 @@ eventsApi.all = (options) => createBuilder({}, options) as unknown as EventsTopi
710
640
  eventsApi.objects = (options) => topicBuilder("objects", options)
711
641
  eventsApi.telemetry = (options) => topicBuilder("telemetry", options)
712
642
  eventsApi.links = (options) => topicBuilder("links", options)
713
- eventsApi.actions = (options) => actionBuilder(options)
714
- eventsApi.action = (action, options) =>
715
- createBuilder(
716
- { topic: "actions", actionId: action.id },
717
- options
718
- ) as unknown as EventsActionBuilder<SixbEventOfTopic<"actions">>
719
643
  eventsApi.rule = (rule, options) =>
720
644
  createBuilder({ topic: "rules", ruleId: rule.id }, options) as unknown as EventsRuleBuilder<
721
645
  SixbEventOfTopic<"rules">
@@ -31,9 +31,7 @@ export interface EventSocketOptions {
31
31
  readonly objectTypeId?: string
32
32
  /** Object-instance scope; the server narrows the stream when set. */
33
33
  readonly primaryId?: string
34
- /** Action id scope; the server narrows the stream when set. */
35
- readonly actionId?: string
36
- /** Run id scope; the server narrows run/action streams when set. */
34
+ /** Run id scope; the server narrows run streams when set. */
37
35
  readonly runId?: string
38
36
  readonly afterCursor?: string
39
37
  readonly limit?: number
@@ -67,7 +65,7 @@ type EventStreamServerMessage =
67
65
  * the same fields when they are sent on the subscribe message).
68
66
  */
69
67
  export function createEventSocket(options: EventSocketOptions): EventSocket {
70
- const { topic, types, objectTypeId, primaryId, actionId, runId, limit } = options
68
+ const { topic, types, objectTypeId, primaryId, runId, limit } = options
71
69
  let latestCursor = options.afterCursor
72
70
  let transportState: ReconnectingSocketState = {
73
71
  connected: false,
@@ -103,7 +101,6 @@ export function createEventSocket(options: EventSocketOptions): EventSocket {
103
101
  ...(types && types.length > 0 ? { types } : {}),
104
102
  ...(objectTypeId ? { objectTypeId } : {}),
105
103
  ...(primaryId ? { primaryId } : {}),
106
- ...(actionId ? { actionId } : {}),
107
104
  ...(runId ? { runId } : {}),
108
105
  ...(latestCursor ? { afterCursor: latestCursor } : {}),
109
106
  ...(limit ? { limit } : {}),
package/src/file.ts CHANGED
@@ -207,9 +207,11 @@ async function putDirectUpload(input: {
207
207
  readonly url: string
208
208
  readonly signal?: AbortSignal
209
209
  }): Promise<void> {
210
+ // Browser fetch rejects an arbitrary receiver; invoke it as a standalone function.
211
+ const fetch = input.fetch
210
212
  let response: Response
211
213
  try {
212
- response = await input.fetch(input.url, {
214
+ response = await fetch(input.url, {
213
215
  method: input.method,
214
216
  headers: input.headers,
215
217
  body: input.file,
@@ -236,6 +238,7 @@ async function uploadMultipartFile(input: {
236
238
  readonly uploadId: string
237
239
  readonly signal?: AbortSignal
238
240
  }): Promise<Array<{ partNumber: number; etag?: string }>> {
241
+ const fetch = input.fetch
239
242
  const parts: Array<{ partNumber: number; etag?: string }> = []
240
243
  let partNumber = 1
241
244
 
@@ -250,7 +253,7 @@ async function uploadMultipartFile(input: {
250
253
 
251
254
  let response: Response
252
255
  try {
253
- response = await input.fetch(signedPart.url, {
256
+ response = await fetch(signedPart.url, {
254
257
  method: signedPart.method,
255
258
  headers: signedPart.headers,
256
259
  body: input.file.slice(offset, Math.min(input.file.size, offset + input.partSizeBytes)),
@@ -3681,6 +3681,8 @@ export const getActionOptions = (options: Options<GetActionData>) =>
3681
3681
 
3682
3682
  /**
3683
3683
  * Request an action
3684
+ *
3685
+ * Runs the action and returns its terminal run. A run that fails is returned with status `failed`. Its effects run after the response, which does not wait for them. An error response usually means no run was requested, but a 500 can follow a run that started: request again with the same `runId` to get its record if it was written. A `runId` that was already recorded returns that run, and 409 while this server still runs it. 503 means the server is stopping and started nothing.
3684
3686
  */
3685
3687
  export const requestActionMutation = (
3686
3688
  options?: Partial<Options<RequestActionData>>
@@ -4301,7 +4303,7 @@ export const cancelAgentRunMutation = (
4301
4303
  }
4302
4304
 
4303
4305
  /**
4304
- * Retry a failed agent run
4306
+ * Retry a failed or interrupted agent run
4305
4307
  */
4306
4308
  export const retryAgentRunMutation = (
4307
4309
  options?: Partial<Options<RetryAgentRunData>>
@@ -700,6 +700,7 @@ export type {
700
700
  RecreateAgentThreadSandboxErrors,
701
701
  RecreateAgentThreadSandboxResponse,
702
702
  RecreateAgentThreadSandboxResponses,
703
+ Redactions,
703
704
  RefreshAuthSessionData,
704
705
  RefreshAuthSessionError,
705
706
  RefreshAuthSessionErrors,
@@ -612,7 +612,6 @@ export const createAuthPersonalAccessToken = <ThrowOnError extends boolean = fal
612
612
  security: [
613
613
  { name: "x-sixb-csrf", type: "apiKey" },
614
614
  { scheme: "bearer", type: "http" },
615
- { scheme: "bearer", type: "http" },
616
615
  ],
617
616
  url: "/api/auth/access-tokens",
618
617
  ...options,
@@ -738,7 +737,6 @@ export const createAuthServiceAccountAccessToken = <ThrowOnError extends boolean
738
737
  security: [
739
738
  { name: "x-sixb-csrf", type: "apiKey" },
740
739
  { scheme: "bearer", type: "http" },
741
- { scheme: "bearer", type: "http" },
742
740
  ],
743
741
  url: "/api/auth/service-accounts/{serviceAccountId}/access-tokens",
744
742
  ...options,
@@ -2230,6 +2228,8 @@ export const getAction = <ThrowOnError extends boolean = false>(
2230
2228
 
2231
2229
  /**
2232
2230
  * Request an action
2231
+ *
2232
+ * Runs the action and returns its terminal run. A run that fails is returned with status `failed`. Its effects run after the response, which does not wait for them. An error response usually means no run was requested, but a 500 can follow a run that started: request again with the same `runId` to get its record if it was written. A `runId` that was already recorded returns that run, and 409 while this server still runs it. 503 means the server is stopping and started nothing.
2233
2233
  */
2234
2234
  export const requestAction = <ThrowOnError extends boolean = false>(
2235
2235
  options: Options<RequestActionData, ThrowOnError>
@@ -2616,7 +2616,7 @@ export const cancelAgentRun = <ThrowOnError extends boolean = false>(
2616
2616
  })
2617
2617
 
2618
2618
  /**
2619
- * Retry a failed agent run
2619
+ * Retry a failed or interrupted agent run
2620
2620
  */
2621
2621
  export const retryAgentRun = <ThrowOnError extends boolean = false>(
2622
2622
  options: Options<RetryAgentRunData, ThrowOnError>