busa-sdk 0.53.0 → 0.60.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/airapp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as BusabaseClient } from "./client-CsSxFhUP.js";
1
+ import { t as BusabaseClient } from "./client-SAiQFoug.js";
2
2
  //#region src/airapp.d.ts
3
3
  type NodeChangeRequestInput = Parameters<BusabaseClient["nodes"]["createChangeRequest"]>[0];
4
4
  type NodeOperationInput = NodeChangeRequestInput["operations"][number];
@@ -481,6 +481,17 @@ declare const cloudContract: {
481
481
  nodes: "nodes";
482
482
  records: "records";
483
483
  }>]>, z.ZodTransform<("files" | "names" | "nodes" | "records")[], "files" | "names" | "nodes" | "records" | ("files" | "names" | "nodes" | "records")[]>>>;
484
+ sort: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
485
+ created_asc: "created_asc";
486
+ created_desc: "created_desc";
487
+ relevance: "relevance";
488
+ updated_asc: "updated_asc";
489
+ updated_desc: "updated_desc";
490
+ }>>>;
491
+ updatedAfter: z.ZodOptional<z.ZodString>;
492
+ updatedBefore: z.ZodOptional<z.ZodString>;
493
+ createdBy: z.ZodOptional<z.ZodString>;
494
+ inNodeId: z.ZodOptional<z.ZodString>;
484
495
  }, z.core.$strip>, z.ZodObject<{
485
496
  query: z.ZodString;
486
497
  limit: z.ZodNumber;
@@ -500,6 +511,7 @@ declare const cloudContract: {
500
511
  eyebrow: z.ZodString;
501
512
  href: z.ZodString;
502
513
  updatedAt: z.ZodNullable<z.ZodString>;
514
+ createdBy: z.ZodDefault<z.ZodNullable<z.ZodString>>;
503
515
  }, z.core.$strip>>;
504
516
  contentTruncated: z.ZodDefault<z.ZodBoolean>;
505
517
  }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
@@ -14948,10 +14960,19 @@ declare const cloudContract: {
14948
14960
  mimeType: z.ZodString;
14949
14961
  filename: z.ZodOptional<z.ZodString>;
14950
14962
  }, z.core.$strip>>>;
14963
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
14964
+ accepted: z.ZodLiteral<true>;
14965
+ sessionId: z.ZodString;
14951
14966
  }, z.core.$strip>, z.ZodObject<{
14952
- accepted: z.ZodBoolean;
14967
+ accepted: z.ZodLiteral<false>;
14953
14968
  sessionId: z.ZodString;
14954
- }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
14969
+ status: z.ZodEnum<{
14970
+ ended: "ended";
14971
+ failed: "failed";
14972
+ }>;
14973
+ promptRecorded: z.ZodBoolean;
14974
+ message: z.ZodString;
14975
+ }, z.core.$strip>], "accepted">, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
14955
14976
  cancel: import("@orpc/contract").ContractProcedure<z.ZodObject<{
14956
14977
  sessionId: z.ZodString;
14957
14978
  }, z.core.$strip>, z.ZodObject<{
@@ -25688,6 +25709,8 @@ interface SearchResultVO {
25688
25709
  eyebrow: string;
25689
25710
  href: string;
25690
25711
  updatedAt: string | null;
25712
+ /** Creating actor, or null when the source cannot say. Never render null as a person. */
25713
+ createdBy: string | null;
25691
25714
  }
25692
25715
  interface SearchResponseVO {
25693
25716
  query: string;
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-CsSxFhUP.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-SAiQFoug.js";
2
2
  import { z } from "zod";
3
3
  //#region src/url.d.ts
4
4
  /**
@@ -323,6 +323,7 @@ declare class Busabase {
323
323
  eyebrow: string;
324
324
  href: string;
325
325
  updatedAt: string | null;
326
+ createdBy: string | null;
326
327
  }[];
327
328
  contentTruncated: boolean;
328
329
  }, Error>;
package/dist/index.js CHANGED
@@ -278,13 +278,20 @@ list: oc.input(ListAgentConnectionsInputSchema).output(AgentConnectionVOSchema.a
278
278
  list: oc.output(AgentSessionVOSchema.array()),
279
279
  create: oc.input(CreateAgentSessionInputSchema).output(AgentSessionVOSchema),
280
280
  /**
281
- * Send a message. Returns as soon as the turn is accepted the reply arrives
282
- * on `subscribe`, not here, so a slow agent never blocks the caller.
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.
283
284
  */
284
- prompt: oc.input(PromptAgentSessionInputSchema).output(z.object({
285
- accepted: z.boolean(),
285
+ prompt: oc.input(PromptAgentSessionInputSchema).output(z.discriminatedUnion("accepted", [z.object({
286
+ accepted: z.literal(true),
286
287
  sessionId: z.string()
287
- })),
288
+ }), z.object({
289
+ accepted: z.literal(false),
290
+ sessionId: z.string(),
291
+ status: AgentSessionStatusSchema.extract(["ended", "failed"]),
292
+ promptRecorded: z.boolean(),
293
+ message: z.string()
294
+ })])),
288
295
  cancel: oc.input(AgentSessionIdInputSchema).output(z.object({ ok: z.boolean() })),
289
296
  close: oc.input(AgentSessionIdInputSchema).output(z.object({ ok: z.boolean() })),
290
297
  /**
@@ -1172,17 +1179,17 @@ const NodeIconSchema = z.discriminatedUnion("type", [z.object({
1172
1179
  //#endregion
1173
1180
  //#region ../../packages/busabase-contract/src/contract/node-agent-prompt-schemas.ts
1174
1181
  /**
1175
- * Per-node custom scenario prompts (`node.metadata.agentPrompts`) — the single
1182
+ * Per-node custom scenario prompts (`node.agentPrompts`) — the single
1176
1183
  * schema shared by BOTH write and read paths, per the node-agent-prompts
1177
1184
  * design (v2) §7.3:
1178
1185
  *
1179
1186
  * - Write: `busabase-cli nodes set-agent-prompts` validates a file against this
1180
- * schema client-side, before calling `nodes.updateMetadata` — a malformed file
1181
- * never reaches the network.
1187
+ * schema client-side, before calling `nodes.updateAgentPrompts` — a malformed
1188
+ * file never reaches the network.
1182
1189
  * - Read: `buildNodeAgentPrompts` (`packages/busabase-core/.../node-agent-prompts.ts`)
1183
- * `.safeParse`s whatever is stored in `metadata.agentPrompts` and falls back to
1184
- * the node type's default scenarios on failure, so a bad write (or a manual
1185
- * jsonb edit) can never crash the Agent Prompts dialog.
1190
+ * `.safeParse`s whatever is stored in the node's `agentPrompts` column and
1191
+ * ignores invalid custom entries, so a bad write (or a manual jsonb edit) can
1192
+ * never crash the Agent Prompts dialog or hide its built-in scenarios.
1186
1193
  *
1187
1194
  * One schema, one place to edit the limits — do not duplicate this validation on
1188
1195
  * either side.
@@ -1232,7 +1239,7 @@ const customPromptDefSchema = z.object({
1232
1239
  body: customPromptBodySchema
1233
1240
  });
1234
1241
  /**
1235
- * The full `metadata.agentPrompts` array. `.max` bounds the list; the
1242
+ * The full `agentPrompts` array. `.max` bounds the list; the
1236
1243
  * `superRefine` catches duplicate keys with an issue path pointing at the
1237
1244
  * offending entry, so a CLI/server validation error names which entry and
1238
1245
  * which key collided instead of a bare "keys must be unique".
@@ -1670,7 +1677,16 @@ const searchResultSchema = z.object({
1670
1677
  body: z.string(),
1671
1678
  eyebrow: z.string(),
1672
1679
  href: z.string(),
1673
- updatedAt: z.string().nullable()
1680
+ updatedAt: z.string().nullable(),
1681
+ /**
1682
+ * The actor that created this, or null when the source cannot say.
1683
+ *
1684
+ * Present so a result can SHOW its author and so the author filter can be
1685
+ * driven by clicking one — you can only filter by a creator you can actually
1686
+ * see, which beats a free-text box you have to guess the spelling of. Null is
1687
+ * rendered as "unknown", never as a person.
1688
+ */
1689
+ createdBy: z.string().nullable().default(null)
1674
1690
  });
1675
1691
  const searchResponseSchema = z.object({
1676
1692
  query: z.string(),
@@ -1910,6 +1926,13 @@ const SEARCH_SOURCES = [
1910
1926
  "names",
1911
1927
  "nodes"
1912
1928
  ];
1929
+ const SearchSortSchema = z.enum([
1930
+ "relevance",
1931
+ "updated_desc",
1932
+ "updated_asc",
1933
+ "created_desc",
1934
+ "created_asc"
1935
+ ]);
1913
1936
  const searchInputSchema = z.object({
1914
1937
  query: z.string().default("").describe("Full-text query. An empty string matches nothing."),
1915
1938
  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."),
@@ -1923,7 +1946,43 @@ const searchInputSchema = z.object({
1923
1946
  * (`?sources=records&sources=files`) becomes an array. Accept both shapes
1924
1947
  * and normalize to an array.
1925
1948
  */
1926
- sources: z.union([z.array(z.enum(SEARCH_SOURCES)), z.enum(SEARCH_SOURCES)]).transform((value) => Array.isArray(value) ? value : [value]).optional().describe("Restrict which content is searched. Omitting it searches ALL sources. Repeat the parameter to pass several (`?sources=records&sources=files`); a single occurrence is accepted as a bare value.")
1949
+ sources: z.union([z.array(z.enum(SEARCH_SOURCES)), z.enum(SEARCH_SOURCES)]).transform((value) => Array.isArray(value) ? value : [value]).optional().describe("Restrict which content is searched. Omitting it searches ALL sources. Repeat the parameter to pass several (`?sources=records&sources=files`); a single occurrence is accepted as a bare value."),
1950
+ sort: SearchSortSchema.optional().default("relevance").describe("Result order. `relevance` (default) keeps each source's own ranking — for records that is the full-text rank, for everything else most-recently-updated first. The four explicit orders sort every source by the same column so a mixed result set is comparable."),
1951
+ /**
1952
+ * Both bounds are inclusive ISO 8601 instants, and both are optional — one
1953
+ * on its own is an open-ended range, which is what "since last Monday" and
1954
+ * "before the migration" each need.
1955
+ *
1956
+ * Filters the same timestamp `sort` orders by, so "edited this week, newest
1957
+ * first" reads as one coherent question rather than two unrelated knobs.
1958
+ */
1959
+ updatedAfter: z.string().datetime({ offset: true }).optional().describe("Inclusive lower bound, ISO 8601. A UTC `Z` or an explicit offset; not a bare local time."),
1960
+ updatedBefore: z.string().datetime({ offset: true }).optional().describe("Inclusive upper bound, ISO 8601. A UTC `Z` or an explicit offset; not a bare local time."),
1961
+ /**
1962
+ * Restrict to what one actor created.
1963
+ *
1964
+ * Every source answers from a real column, which is what made this filter
1965
+ * shippable: records and assets carry their own `created_by`, node CONTENT
1966
+ * reads `busabase_nodes.created_by` (added with this change, backfilled from
1967
+ * each node's `node_create` commit), and Bases resolve through the owning
1968
+ * node the Base query already joins for its dates and sort.
1969
+ *
1970
+ * A free-form actor id, not a user id — agents and API keys create things
1971
+ * too, and filtering by "user" would silently drop everything an agent made.
1972
+ *
1973
+ * Nodes whose creating commit is gone have a NULL `created_by` and match no
1974
+ * author. That is deliberate: "this row cannot tell" must not render as
1975
+ * "nobody made it".
1976
+ */
1977
+ createdBy: z.string().optional().describe("Restrict to one creator. Matches the actor id, which may be an agent or API key."),
1978
+ /**
1979
+ * Restrict to a subtree: this node and everything beneath it.
1980
+ *
1981
+ * Resolved by walking the tree in application code (`collectSubtreeIds`),
1982
+ * the same way `isDescendantOf` and permanent-delete already do — workspace
1983
+ * trees are shallow and this repo has no recursive-CTE precedent.
1984
+ */
1985
+ inNodeId: z.string().optional().describe("Limit to this node and its descendants.")
1927
1986
  });
1928
1987
  const authSpaceSchema = z.object({
1929
1988
  id: z.string(),
@@ -5241,14 +5300,14 @@ const busabaseContractRoutes = {
5241
5300
  path: "/nodes/{nodeId}/agent-prompts",
5242
5301
  tags: ["Nodes"],
5243
5302
  summary: "Get node custom agent prompts",
5244
- successDescription: "This node's custom scenario prompts, which replace the node type's default prompts in the Ask-agent dialog. `null` means the node has never had any set, which is not the same as an empty list. Read separately from the node itself because the list is large enough (50 prompts x 8 KiB per locale) that carrying it on every node listing would be its own problem. Requires read access on the node."
5303
+ successDescription: "This node's custom scenario prompts, which appear alongside the node type's built-in prompts in the Ask-agent dialog. `null` means the node has never had any set, which is not the same as an empty list. Read separately from the node itself because the list is large enough (50 prompts x 8 KiB per locale) that carrying it on every node listing would be its own problem. Requires read access on the node."
5245
5304
  }).input(getNodeAgentPromptsInputSchema).output(nodeAgentPromptsSchema),
5246
5305
  updateAgentPrompts: oc.route({
5247
5306
  method: "PUT",
5248
5307
  path: "/nodes/{nodeId}/agent-prompts",
5249
5308
  tags: ["Nodes"],
5250
5309
  summary: "Replace node custom agent prompts",
5251
- successDescription: "Replaced this node's custom scenario prompts — the whole list, not a merge. Send `null` to clear them and return the node to its type's default prompts. Requires write access on the node."
5310
+ successDescription: "Replaced this node's custom scenario prompts — the whole custom list, not a merge. Send `null` to clear custom prompts; built-in prompts are always retained. Requires write access on the node."
5252
5311
  }).input(updateNodeAgentPromptsInputSchema).output(nodeAgentPromptsSchema),
5253
5312
  updateContent: oc.route({
5254
5313
  method: "PUT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "busa-sdk",
3
- "version": "0.53.0",
3
+ "version": "0.60.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). Short-name alias for busabase-sdk.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/busabase/busabase/tree/main/apps/busabase-sdk",