busabase-sdk 0.60.0 → 0.70.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as AssetTextStatus, A as NodeVO, At as GalleryCardSize, B as UpdatePreviewFileCredentialDTO, Bt as ViewSortVO, C as CommentVO, Ct as ListFormsDTO, D as MentionInboxItemVO, Dt as AssetAttachmentRef, E as LookupRollup, Et as UpdateFormDTO, F as SearchResponseVO, Ft as VIEW_FIELD_MAX_WIDTH, G as VaultItemKind, Gt as cloudContract, H as VaultAccessPolicy, Ht as ViewVO, I as SearchResultKind, It as VIEW_FIELD_MIN_WIDTH, J as VaultScopeType, Jt as CREATABLE_NODE_TYPES, K as VaultItemVO, Kt as NodeIcon, L as SearchResultVO, Lt as ViewConfigVO, M as OperationVO, Mt as GanttScale, N as ReviewVO, Nt as RecordLinkVO, O as MentionInboxPageVO, Ot as BaseFieldVO, P as ReviewVerdict, Pt as RecordVO, Q as AssetDetailVO, R as SourceAttributionVO, Rt as ViewFilterOperator, S as CommentSubjectType, St as FormVO, T as FieldType, Tt as SubmitFormDTO, U as VaultEnvironment, Ut as AttachmentRef, V as UpdateVaultSettingsDTO, Vt as ViewType, W as VaultItemInput, Wt as CloudContract, X as FileNodeMetadata, Xt as NodeType, Y as VaultSettingsVO, Yt as CreatableNodeType, Z as FileNodeVO, Zt as OperationKind, _ as ChangeRequestVO, _t as FormFieldBindingVO, a as createBusabaseClient, at as FilePreviewConfigurationStatus, b as CommentMentionTargetType, bt as FormSubmitResultVO, c as AuditAction, ct as FilePreviewUnavailableReason, d as ChangeRequestBatchFailureVO, dt as FileTreeNodeVO, et as AssetUsageVO, f as ChangeRequestCountsVO, ft as FileTreeReadFileVO, g as ChangeRequestTargetType, gt as FormBoundFieldVO, h as ChangeRequestStatus, ht as CreateFormDTO, i as ResolvedConfig, it as FilePreviewConfigVO, j as OperationStatus, jt as GalleryCoverFit, k as NodeSearchResultVO, kt as BaseVO, l as AuditEventVO, lt as FilePreviewVO, m as ChangeRequestReviewBatchResultVO, mt as ActivityItemVO, n as BusabaseConfig, nt as GrepInputDTO, o as resolveConfig, ot as FilePreviewCredentialSource, p as ChangeRequestMergeBatchResultVO, pt as NodeDetailVO, q as VaultRuntimeEnv, qt as NodeIconSchema, r as DEFAULT_BASE_URL, rt as GrepResultVO, s as AgentTaskVO, st as FilePreviewProvider, t as BusabaseClient, tt as AssetVO, u as BusabaseSourceChannel, ut as FileTreeFileVO, v as CommentMentionDispatchStatus, vt as FormPageSourceVO, w as CommitVO, wt as ListFormsVO, x as CommentMentionVO, xt as FormThemeVO, y as CommentMentionInputDTO, yt as FormShareVO, z as UserRefVO, zt as ViewFilterVO } from "./client-SAiQFoug.js";
1
+ import { $ as AssetTextStatus, A as NodeVO, At as GalleryCardSize, B as UpdatePreviewFileCredentialDTO, Bt as ViewSortVO, C as CommentVO, Ct as ListFormsDTO, D as MentionInboxItemVO, Dt as AssetAttachmentRef, E as LookupRollup, Et as UpdateFormDTO, F as SearchResponseVO, Ft as VIEW_FIELD_MAX_WIDTH, G as VaultItemKind, Gt as cloudContract, H as VaultAccessPolicy, Ht as ViewVO, I as SearchResultKind, It as VIEW_FIELD_MIN_WIDTH, J as VaultScopeType, Jt as CREATABLE_NODE_TYPES, K as VaultItemVO, Kt as NodeIcon, L as SearchResultVO, Lt as ViewConfigVO, M as OperationVO, Mt as GanttScale, N as ReviewVO, Nt as RecordLinkVO, O as MentionInboxPageVO, Ot as BaseFieldVO, P as ReviewVerdict, Pt as RecordVO, Q as AssetDetailVO, R as SourceAttributionVO, Rt as ViewFilterOperator, S as CommentSubjectType, St as FormVO, T as FieldType, Tt as SubmitFormDTO, U as VaultEnvironment, Ut as AttachmentRef, V as UpdateVaultSettingsDTO, Vt as ViewType, W as VaultItemInput, Wt as CloudContract, X as FileNodeMetadata, Xt as NodeType, Y as VaultSettingsVO, Yt as CreatableNodeType, Z as FileNodeVO, Zt as OperationKind, _ as ChangeRequestVO, _t as FormFieldBindingVO, a as createBusabaseClient, at as FilePreviewConfigurationStatus, b as CommentMentionTargetType, bt as FormSubmitResultVO, c as AuditAction, ct as FilePreviewUnavailableReason, d as ChangeRequestBatchFailureVO, dt as FileTreeNodeVO, et as AssetUsageVO, f as ChangeRequestCountsVO, ft as FileTreeReadFileVO, g as ChangeRequestTargetType, gt as FormBoundFieldVO, h as ChangeRequestStatus, ht as CreateFormDTO, i as ResolvedConfig, it as FilePreviewConfigVO, j as OperationStatus, jt as GalleryCoverFit, k as NodeSearchResultVO, kt as BaseVO, l as AuditEventVO, lt as FilePreviewVO, m as ChangeRequestReviewBatchResultVO, mt as ActivityItemVO, n as BusabaseConfig, nt as GrepInputDTO, o as resolveConfig, ot as FilePreviewCredentialSource, p as ChangeRequestMergeBatchResultVO, pt as NodeDetailVO, q as VaultRuntimeEnv, qt as NodeIconSchema, r as DEFAULT_BASE_URL, rt as GrepResultVO, s as AgentTaskVO, st as FilePreviewProvider, t as BusabaseClient, tt as AssetVO, u as BusabaseSourceChannel, ut as FileTreeFileVO, v as CommentMentionDispatchStatus, vt as FormPageSourceVO, w as CommitVO, wt as ListFormsVO, x as CommentMentionVO, xt as FormThemeVO, y as CommentMentionInputDTO, yt as FormShareVO, z as UserRefVO, zt as ViewFilterVO } from "./client-RSU_7-Nn.js";
2
2
  import { z } from "zod";
3
3
  //#region src/url.d.ts
4
4
  /**
package/dist/index.js CHANGED
@@ -164,6 +164,15 @@ const AgentSessionVOSchema = z.object({
164
164
  */
165
165
  modelOption: AgentSessionModelOptionVOSchema.nullable().default(null)
166
166
  });
167
+ const ListAgentSessionsPagedInputSchema = z.object({
168
+ slug: z.string().min(1),
169
+ limit: z.number().int().min(1).max(50).default(20),
170
+ cursor: z.string().min(1).optional()
171
+ });
172
+ const AgentSessionsPageVOSchema = z.object({
173
+ items: AgentSessionVOSchema.array(),
174
+ nextCursor: z.string().nullable()
175
+ });
167
176
  /** One connected agent backend visible in the requested workspace scope. */
168
177
  const AgentConnectionVOSchema = z.object({
169
178
  slug: z.string(),
@@ -171,6 +180,8 @@ const AgentConnectionVOSchema = z.object({
171
180
  transport: AgentTransportSchema,
172
181
  sessionCount: z.number().int().nonnegative(),
173
182
  latest: AgentSessionVOSchema.nullable(),
183
+ /** Whether Busabase can start another conversation with this agent right now. */
184
+ connected: z.boolean(),
174
185
  /** Controls owner-only actions such as deleting the saved OAuth grant. */
175
186
  ownedByCurrentUser: z.boolean()
176
187
  });
@@ -216,6 +227,9 @@ slug: z.string().min(1) });
216
227
  const DisconnectAgentInputSchema = z.object({
217
228
  /** The exact connected-agent slug shown by the sessions/catalog surfaces. */
218
229
  slug: z.string().min(1) });
230
+ const DeleteAgentHistoryInputSchema = z.object({
231
+ /** Deletes only the current actor's sessions for this agent in the active space. */
232
+ slug: z.string().min(1) });
219
233
  /**
220
234
  * A base64 payload the browser attached.
221
235
  *
@@ -268,6 +282,10 @@ const agentsContract = {
268
282
  /** Connectable backends. Availability is resolved per request, not cached in the client. */
269
283
  catalog: oc.output(AgentCatalogEntryVOSchema.array()),
270
284
  disconnect: oc.input(DisconnectAgentInputSchema).output(z.object({
285
+ ok: z.boolean(),
286
+ endedSessionCount: z.number().int().nonnegative()
287
+ })),
288
+ deleteHistory: oc.input(DeleteAgentHistoryInputSchema).output(z.object({
271
289
  ok: z.boolean(),
272
290
  deletedSessionCount: z.number().int().nonnegative()
273
291
  })),
@@ -276,11 +294,15 @@ const agentsContract = {
276
294
  list: oc.input(ListAgentConnectionsInputSchema).output(AgentConnectionVOSchema.array()) },
277
295
  sessions: {
278
296
  list: oc.output(AgentSessionVOSchema.array()),
297
+ listPaged: oc.input(ListAgentSessionsPagedInputSchema).output(AgentSessionsPageVOSchema),
279
298
  create: oc.input(CreateAgentSessionInputSchema).output(AgentSessionVOSchema),
280
299
  /**
281
- * Send a message. A terminal session returns `accepted: false` instead of
282
- * relying on error text; `promptRecorded` tells the caller whether automatic
283
- * continuation can resend without duplicating a server echo.
300
+ * Accept a message for asynchronous execution. `accepted: true` means the
301
+ * prompt is durable and the turn slot is owned; progress and completion
302
+ * arrive through `subscribe`, so this RPC never spans the whole agent run.
303
+ * A terminal session returns `accepted: false` instead of relying on error
304
+ * text; `promptRecorded` tells the caller whether automatic continuation
305
+ * can resend without duplicating a server echo.
284
306
  */
285
307
  prompt: oc.input(PromptAgentSessionInputSchema).output(z.discriminatedUnion("accepted", [z.object({
286
308
  accepted: z.literal(true),
@@ -447,6 +469,7 @@ const fieldTypeSchema = z.enum([
447
469
  "html",
448
470
  "attachment",
449
471
  "relation",
472
+ "member",
450
473
  "number",
451
474
  "date",
452
475
  "checkbox",
@@ -553,8 +576,7 @@ const baseSchema = z.object({
553
576
  requiredApprovals: z.number()
554
577
  }),
555
578
  createdAt: z.string(),
556
- fields: z.array(baseFieldSchema),
557
- metadata: z.record(z.string(), z.unknown()).default({})
579
+ fields: z.array(baseFieldSchema)
558
580
  });
559
581
  const createBaseInputSchema = z.object({
560
582
  parentNodeId: z.string().optional().describe("Parent node id. Must be a folder or the space root; container-incapable node types (Base, Doc, AirApp, etc.) cannot hold children."),
@@ -968,22 +990,34 @@ const formNodeType = {
968
990
  label: "Form",
969
991
  icon: "form",
970
992
  /**
971
- * `hidden` until a Form can be created from a create surface at all.
993
+ * No longer `hidden`. The two conditions that hid it are both met:
994
+ *
995
+ * 1. The New-item flow ASKS FOR THE TARGET BASE — `create-node-modal.tsx`
996
+ * renders a "Writes into" Base picker (plus the field checklist) whenever
997
+ * `form` is the selected type, and keeps its submit disabled until one is
998
+ * chosen, the same way it already does for `file` and its asset.
999
+ * 2. A MATERIALIZER WRITES THE CONFIG ROW — `materializeFormNode`
1000
+ * (busabase-core `domains/form/logic/form-ops.ts`) inserts the
1001
+ * `busabase_forms` row inside the merge transaction, from the
1002
+ * `node_create` operation's `metadata.targetBaseId` / `metadata.formBindings`.
1003
+ * Both create paths run it, so a Form merged after review is configured
1004
+ * exactly like one created immediately.
1005
+ *
1006
+ * A Form that still arrives unconfigured (an API caller that sent only the
1007
+ * generic node fields) is no longer a dead end either: the detail view's
1008
+ * "not set up yet" state now carries a "Connect this form to a Base" action.
972
1009
  *
973
- * `busabase_forms.target_base_id` is NOT NULL and `form` registers no
974
- * `node_create` materializer, so a Form built through the generic New-item
975
- * flow (which only collects name/slug/description) is a node row with no form
976
- * config behind it — it opens to a dead end, every time, for everyone. The
977
- * type stays fully `creatable` so `forms.create` (which does take a target
978
- * Base) and the REST/MCP surface are untouched; it just no longer offers an
979
- * entry point that cannot succeed. Drop this once the New-item flow asks for
980
- * the target Base and a materializer writes the config row.
1010
+ * `hidden` is read by THREE create surfaces — web's `create-node-modal.tsx`,
1011
+ * `node-agent-prompts.ts`, and React Native's
1012
+ * `apps/busabase-mobile/.../CreateNodeModal.tsx`. Mobile has no Base picker,
1013
+ * so it names `form` in its own `UNSUPPORTED_TYPES` set (alongside `file`,
1014
+ * which is excluded there for the same "can't collect the required input"
1015
+ * reason) rather than re-creating the dead end on another platform.
981
1016
  */
982
1017
  capabilities: {
983
1018
  hasDetail: true,
984
1019
  creatable: true,
985
- publicAccess: "submit",
986
- hidden: true
1020
+ publicAccess: "submit"
987
1021
  },
988
1022
  operations: []
989
1023
  };
@@ -1705,6 +1739,43 @@ const searchResponseSchema = z.object({
1705
1739
  */
1706
1740
  contentTruncated: z.boolean().default(false)
1707
1741
  });
1742
+ /**
1743
+ * Payload-free interaction events for search quality measurement.
1744
+ *
1745
+ * Every object is strict on purpose: accepting and stripping an accidental
1746
+ * `query` property would make the transport look privacy-safe while callers
1747
+ * were still sending search text over the wire.
1748
+ */
1749
+ const searchInteractionInputSchema = z.discriminatedUnion("event", [
1750
+ z.object({
1751
+ event: z.literal("result_click"),
1752
+ sessionId: z.string().uuid(),
1753
+ surface: z.enum(["quick", "advanced"]),
1754
+ position: z.number().int().min(1).max(100),
1755
+ resultKind: z.enum([
1756
+ "record",
1757
+ "change_request",
1758
+ "base",
1759
+ "file",
1760
+ "node"
1761
+ ])
1762
+ }).strict(),
1763
+ z.object({
1764
+ event: z.literal("quick_to_advanced"),
1765
+ sessionId: z.string().uuid(),
1766
+ surface: z.literal("quick"),
1767
+ resultCount: z.number().int().min(0).max(100)
1768
+ }).strict(),
1769
+ z.object({
1770
+ event: z.literal("results_shown"),
1771
+ sessionId: z.string().uuid(),
1772
+ surface: z.enum(["quick", "advanced"]),
1773
+ resultCount: z.number().int().min(0).max(100),
1774
+ durationMs: z.number().int().min(0).max(12e4),
1775
+ hasMore: z.boolean()
1776
+ }).strict()
1777
+ ]);
1778
+ const searchInteractionResponseSchema = z.object({ accepted: z.literal(true) });
1708
1779
  const liveEventSchema = z.object({
1709
1780
  kind: z.enum([
1710
1781
  "change_request.created",
@@ -1935,6 +2006,8 @@ const SearchSortSchema = z.enum([
1935
2006
  ]);
1936
2007
  const searchInputSchema = z.object({
1937
2008
  query: z.string().default("").describe("Full-text query. An empty string matches nothing."),
2009
+ mode: z.enum(["quick", "full"]).optional().default("full").describe("Search depth. `quick` skips live file-body scans for typeahead; `full` preserves complete search behavior."),
2010
+ surface: z.enum(["quick", "advanced"]).optional().describe("Optional first-party UI surface for aggregate quality metrics. API/CLI callers should omit it."),
1938
2011
  limit: z.coerce.number().int().min(1).max(100).optional().default(20).describe("Results per page. Capped at 100; note the default is 20, not 50."),
1939
2012
  offset: z.coerce.number().int().min(0).optional().default(0).describe("0-indexed skip count. This endpoint pages by offset, not by cursor."),
1940
2013
  /**
@@ -2031,7 +2104,21 @@ const authInfoSchema = z.object({
2031
2104
  /** Cloud only: the server created this user's first Space during this exact request. */
2032
2105
  createdSpace: z.boolean().optional(),
2033
2106
  /** Cloud only: this auto-created Space still needs its idempotent starter initialization. */
2034
- bootstrapRequired: z.boolean().optional()
2107
+ bootstrapRequired: z.boolean().optional(),
2108
+ /** Cloud only: effective permission ceiling of the credential used for this request. */
2109
+ credentialPermissionLevel: z.enum([
2110
+ "read",
2111
+ "changeRequest",
2112
+ "write",
2113
+ "manage"
2114
+ ]).optional(),
2115
+ /** Cloud only: credential ceiling capped by the selected Space membership role. */
2116
+ effectivePermissionLevel: z.enum([
2117
+ "read",
2118
+ "changeRequest",
2119
+ "write",
2120
+ "manage"
2121
+ ]).optional()
2035
2122
  });
2036
2123
  //#endregion
2037
2124
  //#region ../../packages/busabase-contract/src/domains/filetree/contract.ts
@@ -2832,6 +2919,7 @@ const recordSchema = z.object({
2832
2919
  status: z.enum(["active", "archived"]),
2833
2920
  createdBy: z.string(),
2834
2921
  createdByUser: userRefSchema.nullable().optional().default(null),
2922
+ fieldUsers: z.record(z.string(), userRefSchema).optional().default({}),
2835
2923
  archivedAt: z.string().nullable(),
2836
2924
  createdAt: z.string(),
2837
2925
  updatedAt: z.string(),
@@ -5201,6 +5289,7 @@ const busabaseContractRoutes = {
5201
5289
  summary: "Search Busabase",
5202
5290
  successDescription: "Paginated search results across records, change requests, Bases, File nodes, and Assets."
5203
5291
  }).input(searchInputSchema).output(searchResponseSchema),
5292
+ searchMetrics: { report: oc.input(searchInteractionInputSchema).output(searchInteractionResponseSchema) },
5204
5293
  grep: oc.route({
5205
5294
  method: "POST",
5206
5295
  path: "/grep",
@@ -5531,6 +5620,18 @@ const busabaseContractRoutes = {
5531
5620
  summary: "List agent revision tasks",
5532
5621
  successDescription: "Change requests awaiting an external agent (request-changes or @ai mentions)."
5533
5622
  }).output(z.array(agentTaskSchema)) },
5623
+ spaces: {
5624
+ /**
5625
+ * The member roster of the space this request is scoped to — the people a
5626
+ * `member` field's picker may offer.
5627
+ *
5628
+ * RPC-only by design (no `.route(...)`). A procedure WITH a path is
5629
+ * published into `/api/v1` and into every agent's MCP tool catalog; a
5630
+ * workspace member directory belongs in neither. Resolution is delegated to
5631
+ * the host (`BusabaseContext.listMembers`), because membership lives in the
5632
+ * host, not in this engine.
5633
+ */
5634
+ members: oc.output(z.array(userRefSchema)) },
5534
5635
  live: { subscribe: oc.output(eventIterator(liveEventSchema)) },
5535
5636
  bases: baseContract,
5536
5637
  fileTrees: fileTreeContract,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "busabase-sdk",
3
- "version": "0.60.0",
3
+ "version": "0.70.0",
4
4
  "description": "Typed TypeScript/JavaScript SDK for the Busabase OpenAPI REST API. Talks to a local or remote `busabase server` (or Busabase Cloud).",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/busabase/busabase/tree/main/apps/busabase-sdk",
@@ -67,9 +67,9 @@
67
67
  "tsx": "^4.20.5",
68
68
  "typescript": "^7.0.2",
69
69
  "vitest": "^4.1.11",
70
- "open-domains": "0.0.2",
71
- "busabase-contract": "0.60.0",
72
- "openlib": "0.1.1"
70
+ "busabase-contract": "0.70.0",
71
+ "openlib": "0.1.1",
72
+ "open-domains": "0.0.2"
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=24.18.0"