busa-sdk 0.97.0 → 0.99.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 AssetDetailVO, $t as CreatableNodeType, A as NodeVO, At as BaseVO, B as UserRefVO, Bt as ViewFilterVO, C as CommentVO, Ct as FormVO, D as MentionInboxItemVO, Dt as UpdateFormDTO, E as LookupRollup, Et as SubmitFormDTO, F as ReviewVerdict, Ft as RecordVO, G as VaultItemInput, Gt as PlaybookAttributionVO, H as UpdateVaultSettingsDTO, Ht as ViewType, I as SearchResponseVO, It as VIEW_FIELD_MAX_WIDTH, J as VaultRuntimeEnv, Jt as NodeIcon, K as VaultItemKind, Kt as CloudContract, L as SearchResultKind, Lt as VIEW_FIELD_MIN_WIDTH, M as OperationVO, Mt as GalleryCoverFit, N as RestoredSlugChangeVO, Nt as GanttScale, O as MentionInboxPageVO, Ot as AssetAttachmentRef, P as ReviewVO, Pt as RecordLinkVO, Q as FileNodeVO, Qt as CREATABLE_NODE_TYPES, R as SearchResultVO, Rt as ViewConfigVO, S as CommentSubjectType, St as FormThemeVO, T as FieldType, Tt as ListFormsVO, U as VaultAccessPolicy, Ut as ViewVO, V as UpdatePreviewFileCredentialDTO, Vt as ViewSortVO, W as VaultEnvironment, Wt as AttachmentRef, X as VaultSettingsVO, Xt as NodeIconSource, Y as VaultScopeType, Yt as NodeIconSchema, Z as FileNodeMetadata, Zt as resolveNodeIconSource, _ as ChangeRequestVO, _t as FormBoundFieldVO, a as createBusabaseClient, at as FilePreviewConfigVO, b as CommentMentionTargetType, bt as FormShareVO, c as AuditAction, ct as FilePreviewProvider, d as ChangeRequestBatchFailureVO, dt as FileTreeFileVO, en as NodeType, et as AssetTextStatus, f as ChangeRequestCountsVO, ft as FileTreeNodeVO, g as ChangeRequestTargetType, gt as CreateFormDTO, h as ChangeRequestStatus, ht as ActivityItemVO, i as ResolvedConfig, it as GrepResultVO, j as OperationStatus, jt as GalleryCardSize, k as NodeSearchResultVO, kt as BaseFieldVO, l as AuditEventVO, lt as FilePreviewUnavailableReason, m as ChangeRequestReviewBatchResultVO, mt as NodeDetailVO, n as BusabaseConfig, nt as AssetVO, o as resolveConfig, ot as FilePreviewConfigurationStatus, p as ChangeRequestMergeBatchResultVO, pt as FileTreeReadFileVO, q as VaultItemVO, qt as cloudContract, r as DEFAULT_BASE_URL, rt as GrepInputDTO, s as AgentTaskVO, st as FilePreviewCredentialSource, t as BusabaseClient, tn as OperationKind, tt as AssetUsageVO, u as BusabaseSourceChannel, ut as FilePreviewVO, v as CommentMentionDispatchStatus, vt as FormFieldBindingVO, w as CommitVO, wt as ListFormsDTO, x as CommentMentionVO, xt as FormSubmitResultVO, y as CommentMentionInputDTO, yt as FormPageSourceVO, z as SourceAttributionVO, zt as ViewFilterOperator } from "./client-W0upTUto.js";
1
+ import { $ as FileNodeMetadata, $t as isViewFilterGroup, A as MentionInboxPageVO, At as AssetAttachmentRef, B as SearchResultVO, Bt as VIEW_FIELD_MAX_WIDTH, C as CommentMentionVO, Ct as FormSubmitResultVO, D as FieldType, Dt as ListFormsVO, E as CommitVO, Et as ListFormsDTO, F as RestoredSlugChangeVO, Ft as GanttScale, G as VaultAccessPolicy, Gt as ViewFilterGroupVO, H as UserRefVO, Ht as ViewConfigVO, I as ReviewVO, It as LOOKUP_SOURCE_LIMIT, J as VaultItemKind, Jt as ViewSortVO, K as VaultEnvironment, Kt as ViewFilterOperator, L as ReviewVerdict, Lt as LookupComputedVO, M as NodeVO, Mt as BaseVO, N as OperationStatus, Nt as GalleryCardSize, O as LookupRollup, Ot as SubmitFormDTO, P as OperationVO, Pt as GalleryCoverFit, Q as VaultSettingsVO, Qt as flattenViewFilters, R as SearchResponseVO, Rt as RecordLinkVO, S as CommentMentionTargetType, St as FormShareVO, T as CommentVO, Tt as FormVO, U as UpdatePreviewFileCredentialDTO, Ut as ViewFilterConditionVO, V as SourceAttributionVO, Vt as VIEW_FIELD_MIN_WIDTH, W as UpdateVaultSettingsDTO, Wt as ViewFilterConjunction, X as VaultRuntimeEnv, Xt as ViewVO, Y as VaultItemVO, Yt as ViewType, Z as VaultScopeType, Zt as combineViewFilters, _ as ChangeRequestStatus, _t as ActivityItemVO, a as createBusabaseClient, an as NodeIconSchema, at as GrepInputDTO, b as CommentMentionDispatchStatus, bt as FormFieldBindingVO, c as cloudContract, cn as CREATABLE_NODE_TYPES, ct as FilePreviewConfigurationStatus, d as AuditEventVO, dn as OperationKind, dt as FilePreviewUnavailableReason, en as mapViewFilters, et as FileNodeVO, f as BusabaseSourceChannel, ft as FilePreviewVO, g as ChangeRequestReviewBatchResultVO, gt as NodeDetailVO, h as ChangeRequestMergeBatchResultVO, ht as FileTreeReadFileVO, i as ResolvedConfig, in as NodeIcon, it as AssetVO, j as NodeSearchResultVO, jt as BaseFieldVO, k as MentionInboxItemVO, kt as UpdateFormDTO, l as AgentTaskVO, ln as CreatableNodeType, lt as FilePreviewCredentialSource, m as ChangeRequestCountsVO, mt as FileTreeNodeVO, n as BusabaseConfig, nn as PlaybookAttributionVO, nt as AssetTextStatus, o as resolveConfig, on as NodeIconSource, ot as GrepResultVO, p as ChangeRequestBatchFailureVO, pt as FileTreeFileVO, q as VaultItemInput, qt as ViewFilterVO, r as DEFAULT_BASE_URL, rn as AgentClientVO, rt as AssetUsageVO, s as CloudContract, sn as resolveNodeIconSource, st as FilePreviewConfigVO, t as BusabaseClient, tn as AttachmentRef, tt as AssetDetailVO, u as AuditAction, un as NodeType, ut as FilePreviewProvider, v as ChangeRequestTargetType, vt as CreateFormDTO, w as CommentSubjectType, wt as FormThemeVO, x as CommentMentionInputDTO, xt as FormPageSourceVO, y as ChangeRequestVO, yt as FormBoundFieldVO, z as SearchResultKind, zt as RecordVO } from "./client-BUzSZV3L.js";
2
2
  import { z } from "zod";
3
3
  //#region src/url.d.ts
4
4
  /**
@@ -567,4 +567,4 @@ declare class Busabase {
567
567
  }>>>>;
568
568
  }
569
569
  //#endregion
570
- export { type ActivityItemVO, type AgentTaskVO, type FileTreeFileVO as AirAppFileVO, type FileTreeFileVO as DriveFileVO, type FileTreeFileVO, type FileTreeFileVO as SkillFileVO, type FileTreeReadFileVO as AirAppReadFileVO, type FileTreeReadFileVO as DriveReadFileVO, type FileTreeReadFileVO, type FileTreeReadFileVO as SkillReadFileVO, type FileTreeNodeVO as AirAppVO, type FileTreeNodeVO as DriveVO, type FileTreeNodeVO, type FileTreeNodeVO as SkillVO, type AssetAttachmentRef, type AssetDetailVO, type AssetTextStatus, type AssetUsageVO, type AssetVO, type AttachmentRef, type AuditAction, type AuditEventVO, type BaseFieldVO, type BaseVO, Busabase, type BusabaseAssetsClient, BusabaseChangeRequestsClient, type BusabaseClient, type BusabaseConfig, type BusabaseRecordsClient, type BusabaseSourceChannel, type BusabaseUploadedAsset, CREATABLE_NODE_TYPES, type ChangeRequestBatchFailureVO, type ChangeRequestCountsVO, type ChangeRequestMergeBatchResultVO, type ChangeRequestReviewBatchResultVO, type ChangeRequestStatus, type ChangeRequestTargetType, type ChangeRequestVO, type CloudContract, type CommentMentionDispatchStatus, type CommentMentionInputDTO, type CommentMentionTargetType, type CommentMentionVO, type CommentSubjectType, type CommentVO, type CommitVO, type CreatableNodeType, type CreateFormDTO, DEFAULT_BASE_URL, type FieldType, type FileNodeMetadata, type FileNodeVO, type FilePreviewConfigVO, type FilePreviewConfigurationStatus, type FilePreviewCredentialSource, type FilePreviewProvider, type FilePreviewUnavailableReason, type FilePreviewVO, type FormBoundFieldVO, type FormFieldBindingVO, type FormPageSourceVO, type FormShareVO, type FormSubmitResultVO, type FormThemeVO, type FormVO, type GalleryCardSize, type GalleryCoverFit, type GanttScale, type ListFormsDTO, type ListFormsVO, type LookupRollup, type MentionInboxItemVO, type MentionInboxPageVO, type NodeDetailVO, type NodeIcon, type NodeIconSchema, type NodeIconSource, type NodeSearchResultVO, type NodeType, type NodeVO, type NodeWebUrlInput, type OperationKind, type OperationStatus, type OperationVO, type PlaybookAttributionVO, type RecordByFieldInput, type RecordLinkVO, type RecordVO, type ResolvedConfig, type RestoredSlugChangeVO, type ReviewVO, type ReviewVerdict, type SearchResponseVO, type SearchResultKind, type SearchResultVO, type SourceAttributionVO, type SubmitFormDTO, type UpdateFormDTO, type UpdatePreviewFileCredentialDTO, type UpdateVaultSettingsDTO, type UploadAssetOptions, type UserRefVO, type VIEW_FIELD_MAX_WIDTH, type VIEW_FIELD_MIN_WIDTH, type VaultAccessPolicy, type VaultEnvironment, type VaultItemInput, type VaultItemKind, type VaultItemVO, type VaultRuntimeEnv, type VaultScopeType, type VaultSettingsVO, type ViewConfigVO, type ViewFilterOperator, type ViewFilterVO, type ViewSortVO, type ViewType, type ViewVO, cloudContract, createBusabaseClient, getRecordByField, grepAssets, hashBytes, nodeWebUrl, normalizeBaseUrl, resolveConfig, type resolveNodeIconSource, toFilesOnlyGrepResult, toUnifiedFilesGrepInput, uploadAsset };
570
+ export { type ActivityItemVO, type AgentClientVO, type AgentTaskVO, type FileTreeFileVO as AirAppFileVO, type FileTreeFileVO as DriveFileVO, type FileTreeFileVO, type FileTreeFileVO as SkillFileVO, type FileTreeReadFileVO as AirAppReadFileVO, type FileTreeReadFileVO as DriveReadFileVO, type FileTreeReadFileVO, type FileTreeReadFileVO as SkillReadFileVO, type FileTreeNodeVO as AirAppVO, type FileTreeNodeVO as DriveVO, type FileTreeNodeVO, type FileTreeNodeVO as SkillVO, type AssetAttachmentRef, type AssetDetailVO, type AssetTextStatus, type AssetUsageVO, type AssetVO, type AttachmentRef, type AuditAction, type AuditEventVO, type BaseFieldVO, type BaseVO, Busabase, type BusabaseAssetsClient, BusabaseChangeRequestsClient, type BusabaseClient, type BusabaseConfig, type BusabaseRecordsClient, type BusabaseSourceChannel, type BusabaseUploadedAsset, CREATABLE_NODE_TYPES, type ChangeRequestBatchFailureVO, type ChangeRequestCountsVO, type ChangeRequestMergeBatchResultVO, type ChangeRequestReviewBatchResultVO, type ChangeRequestStatus, type ChangeRequestTargetType, type ChangeRequestVO, type CloudContract, type CommentMentionDispatchStatus, type CommentMentionInputDTO, type CommentMentionTargetType, type CommentMentionVO, type CommentSubjectType, type CommentVO, type CommitVO, type CreatableNodeType, type CreateFormDTO, DEFAULT_BASE_URL, type FieldType, type FileNodeMetadata, type FileNodeVO, type FilePreviewConfigVO, type FilePreviewConfigurationStatus, type FilePreviewCredentialSource, type FilePreviewProvider, type FilePreviewUnavailableReason, type FilePreviewVO, type FormBoundFieldVO, type FormFieldBindingVO, type FormPageSourceVO, type FormShareVO, type FormSubmitResultVO, type FormThemeVO, type FormVO, type GalleryCardSize, type GalleryCoverFit, type GanttScale, type LOOKUP_SOURCE_LIMIT, type ListFormsDTO, type ListFormsVO, type LookupComputedVO, type LookupRollup, type MentionInboxItemVO, type MentionInboxPageVO, type NodeDetailVO, type NodeIcon, type NodeIconSchema, type NodeIconSource, type NodeSearchResultVO, type NodeType, type NodeVO, type NodeWebUrlInput, type OperationKind, type OperationStatus, type OperationVO, type PlaybookAttributionVO, type RecordByFieldInput, type RecordLinkVO, type RecordVO, type ResolvedConfig, type RestoredSlugChangeVO, type ReviewVO, type ReviewVerdict, type SearchResponseVO, type SearchResultKind, type SearchResultVO, type SourceAttributionVO, type SubmitFormDTO, type UpdateFormDTO, type UpdatePreviewFileCredentialDTO, type UpdateVaultSettingsDTO, type UploadAssetOptions, type UserRefVO, type VIEW_FIELD_MAX_WIDTH, type VIEW_FIELD_MIN_WIDTH, type VaultAccessPolicy, type VaultEnvironment, type VaultItemInput, type VaultItemKind, type VaultItemVO, type VaultRuntimeEnv, type VaultScopeType, type VaultSettingsVO, type ViewConfigVO, type ViewFilterConditionVO, type ViewFilterConjunction, type ViewFilterGroupVO, type ViewFilterOperator, type ViewFilterVO, type ViewSortVO, type ViewType, type ViewVO, cloudContract, type combineViewFilters, createBusabaseClient, type flattenViewFilters, getRecordByField, grepAssets, hashBytes, type isViewFilterGroup, type mapViewFilters, nodeWebUrl, normalizeBaseUrl, resolveConfig, type resolveNodeIconSource, toFilesOnlyGrepResult, toUnifiedFilesGrepInput, uploadAsset };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as uploadAsset, n as TemplateRiskLevelSchema, r as hashBytes } from "./template-DRMp6tKv.js";
1
+ import { a as hashBytes, i as TemplateVideoSchema, n as TemplateLocalesSchema, o as uploadAsset, r as TemplateRiskLevelSchema } from "./template-Bnkq4diD.js";
2
2
  import { t as normalizeBaseUrl } from "./url-B8GMXalA.js";
3
3
  import { ORPCError, createORPCClient } from "@orpc/client";
4
4
  import { OpenAPILink } from "@orpc/openapi-client/fetch";
@@ -599,6 +599,7 @@ const fieldOptionsSchema = z.object({
599
599
  currency: z.string().regex(/^[A-Z]{3}$/).optional()
600
600
  }).optional(),
601
601
  inverseFieldId: z.string().optional(),
602
+ reverseOfFieldId: z.string().optional().describe("Relation fields only. Makes this a read-only reverse column of the relation field with this id on the target Base, which must point back at this Base. Its value is computed from that field's links; edit the forward field instead."),
602
603
  lookup: z.object({
603
604
  relationFieldSlug: z.string().min(1).describe("Slug of a `relation` field on THIS Base — the hop to follow."),
604
605
  targetFieldSlug: z.string().min(1).describe("Slug of the field on the related Base whose values are pulled over."),
@@ -1000,7 +1001,7 @@ const driveNodeType = makeFileTreeNodeType({
1000
1001
  routeBase: "drives",
1001
1002
  tag: "Drives",
1002
1003
  entryFile: "README.md",
1003
- publicAccess: "no"
1004
+ publicAccess: "detail"
1004
1005
  });
1005
1006
  //#endregion
1006
1007
  //#region ../../packages/busabase-contract/src/domains/file-node/definition.ts
@@ -1099,7 +1100,7 @@ const htmlNodeType = {
1099
1100
  capabilities: {
1100
1101
  hasDetail: true,
1101
1102
  creatable: true,
1102
- publicAccess: "no"
1103
+ publicAccess: "detail"
1103
1104
  },
1104
1105
  operations: [{
1105
1106
  kind: "html_document_update",
@@ -1117,7 +1118,7 @@ const skillNodeType = makeFileTreeNodeType({
1117
1118
  routeBase: "skills",
1118
1119
  tag: "Skills",
1119
1120
  entryFile: "SKILL.md",
1120
- publicAccess: "no"
1121
+ publicAccess: "detail"
1121
1122
  });
1122
1123
  //#endregion
1123
1124
  //#region ../../packages/busabase-contract/src/domains/whiteboard/definition.ts
@@ -1273,6 +1274,14 @@ const NodeIconSchema = z.discriminatedUnion("type", [z.object({
1273
1274
  }).optional()
1274
1275
  })]);
1275
1276
  //#endregion
1277
+ //#region ../../packages/busabase-contract/src/contract/agent-client.ts
1278
+ const AgentClientVOSchema = z.object({
1279
+ /** Normalized, lowercase `[a-z0-9-]`, at most 40 characters (e.g. `codex`). */
1280
+ id: z.string(),
1281
+ /** Display name: a known agent's product name, otherwise derived from the id. */
1282
+ name: z.string()
1283
+ });
1284
+ //#endregion
1276
1285
  //#region ../../packages/busabase-contract/src/contract/node-agent-prompt-schemas.ts
1277
1286
  /**
1278
1287
  * Per-node custom scenario prompts (`node.agentPrompts`) — the single
@@ -1775,7 +1784,12 @@ const sourceAttributionSchema = z.object({
1775
1784
  ownerName: z.string().nullable(),
1776
1785
  channel: sourceChannelSchema.nullable(),
1777
1786
  /** Present only when the write declared a playbook the server could validate. */
1778
- playbook: PlaybookAttributionVOSchema.nullable().optional()
1787
+ playbook: PlaybookAttributionVOSchema.nullable().optional(),
1788
+ /**
1789
+ * Present only when the write named its agent client (`x-busabase-agent`;
1790
+ * busabase-cli sends it automatically). Self-reported — a label, not identity.
1791
+ */
1792
+ agent: AgentClientVOSchema.nullable().optional()
1779
1793
  });
1780
1794
  const commitSchema = z.object({
1781
1795
  id: z.string(),
@@ -2087,6 +2101,7 @@ const liveEventSchema = z.object({
2087
2101
  "node.metadata_updated",
2088
2102
  "node.settings_updated"
2089
2103
  ]),
2104
+ reason: z.literal("acl").optional(),
2090
2105
  spaceId: z.string(),
2091
2106
  actorId: z.string(),
2092
2107
  changeRequestId: z.string().nullable(),
@@ -3126,6 +3141,23 @@ const viewFilterSchema = z.object({
3126
3141
  operator: viewFilterOperatorSchema,
3127
3142
  value: z.unknown().optional()
3128
3143
  });
3144
+ const viewFilterConjunctionSchema = z.enum(["and", "or"]);
3145
+ const deepestViewFilterGroupSchema = z.object({
3146
+ conjunction: viewFilterConjunctionSchema,
3147
+ conditions: z.array(viewFilterSchema).min(1).max(100)
3148
+ });
3149
+ const viewFilterGroupSchema = z.object({
3150
+ conjunction: viewFilterConjunctionSchema,
3151
+ conditions: z.array(z.union([viewFilterSchema, deepestViewFilterGroupSchema])).min(1).max(100)
3152
+ });
3153
+ const viewFilterConditionSchema = z.union([viewFilterSchema, viewFilterGroupSchema]);
3154
+ const viewFiltersSchema = z.array(viewFilterConditionSchema).max(100).superRefine((conditions, ctx) => {
3155
+ const count = (items) => items.reduce((total, item) => total + ("conditions" in item ? count(item.conditions) : 1), 0);
3156
+ if (count(conditions) > 100) ctx.addIssue({
3157
+ code: "custom",
3158
+ message: "A view supports at most 100 filter conditions."
3159
+ });
3160
+ });
3129
3161
  const viewSortSchema = z.object({
3130
3162
  direction: z.enum(["asc", "desc"]),
3131
3163
  fieldSlug: z.string(),
@@ -3146,7 +3178,8 @@ const galleryCardSizeSchema = z.enum([
3146
3178
  "large"
3147
3179
  ]);
3148
3180
  const viewConfigSchema = z.object({
3149
- filters: z.array(viewFilterSchema).default([]),
3181
+ filters: viewFiltersSchema.default([]),
3182
+ filterConjunction: viewFilterConjunctionSchema.optional(),
3150
3183
  sorts: z.array(viewSortSchema).default([]),
3151
3184
  visibleFieldSlugs: z.array(z.string()).nullable().optional(),
3152
3185
  fieldWidths: z.record(z.string().min(1), z.number().int().min(92).max(640)).optional(),
@@ -3194,7 +3227,7 @@ const viewConfigPatchSchema = viewConfigSchema.omit({
3194
3227
  filters: true,
3195
3228
  sorts: true
3196
3229
  }).extend({
3197
- filters: z.array(viewFilterSchema).optional(),
3230
+ filters: viewFiltersSchema.optional(),
3198
3231
  sorts: z.array(viewSortSchema).optional()
3199
3232
  });
3200
3233
  const updateViewInputSchema = z.object({
@@ -3243,6 +3276,38 @@ const viewChangeRequestInputSchema = z.discriminatedUnion("operation", [
3243
3276
  ]);
3244
3277
  //#endregion
3245
3278
  //#region ../../packages/busabase-contract/src/domains/base/contract/record-schemas.ts
3279
+ const lookupComputedSchema = z.object({
3280
+ status: z.enum([
3281
+ "ready",
3282
+ "unlinked",
3283
+ "empty",
3284
+ "invalid",
3285
+ "inaccessible"
3286
+ ]),
3287
+ reason: z.enum([
3288
+ "missing_configuration",
3289
+ "missing_relation",
3290
+ "missing_source_configuration",
3291
+ "missing_target_field",
3292
+ "unsupported_source",
3293
+ "unsupported_rollup",
3294
+ "source_base_mismatch",
3295
+ "source_record_archived"
3296
+ ]).optional(),
3297
+ value: z.unknown(),
3298
+ targetField: baseFieldSchema.optional(),
3299
+ sourceBaseId: z.string().optional(),
3300
+ sourceBaseSlug: z.string().optional(),
3301
+ sources: z.array(z.object({
3302
+ recordId: z.string(),
3303
+ title: z.string(),
3304
+ value: z.unknown(),
3305
+ headCommitId: z.string()
3306
+ })).max(25).default([]),
3307
+ sourcesTruncated: z.boolean().optional(),
3308
+ dependencyVersion: z.string(),
3309
+ dependencyReadAt: z.number().finite().nonnegative().optional()
3310
+ });
3246
3311
  const recordSchema = z.object({
3247
3312
  id: z.string(),
3248
3313
  baseId: z.string(),
@@ -3253,6 +3318,7 @@ const recordSchema = z.object({
3253
3318
  createdBy: z.string(),
3254
3319
  createdByUser: userRefSchema.nullable().optional().default(null),
3255
3320
  fieldUsers: z.record(z.string(), userRefSchema).optional().default({}),
3321
+ computedFields: z.record(z.string(), lookupComputedSchema).optional(),
3256
3322
  archivedAt: z.string().nullable(),
3257
3323
  createdAt: z.string(),
3258
3324
  updatedAt: z.string(),
@@ -3830,8 +3896,11 @@ const recordContract = {
3830
3896
  path: "/records/{recordId}/links",
3831
3897
  tags: ["Records"],
3832
3898
  summary: "List record links",
3833
- successDescription: "Active outbound links from a canonical record."
3834
- }).input(z.object({ recordId: z.string() })).output(z.array(recordLinkSchema))
3899
+ successDescription: "Active links of a canonical record: outbound (this record's relation fields) by default, or inbound (other records whose relation fields link here)."
3900
+ }).input(z.object({
3901
+ recordId: z.string(),
3902
+ direction: z.enum(["outbound", "inbound"]).optional().describe("`outbound` (default): links stored on this record. `inbound`: links from other live records that point at this record — the reverse side of a relation, i.e. 'who links here'.")
3903
+ })).output(z.array(recordLinkSchema))
3835
3904
  };
3836
3905
  const viewContract = { changeRequest: oc.route({
3837
3906
  method: "POST",
@@ -4600,9 +4669,10 @@ const installContract = {
4600
4669
  * The catalog is the file `busabase-cli index` builds from a skills repository
4601
4670
  * — see `busabase-package/index-build`. Most shapes are re-declared here rather
4602
4671
  * than imported because that module is Node-only (it reads packages) and these
4603
- * are rendered in a browser; `TemplateRiskLevelSchema` is the one exception,
4604
- * imported from the package domain because it is already pure zod and a third
4605
- * copy of the same enum is a worse outcome than the cross-domain import.
4672
+ * are rendered in a browser; `TemplateRiskLevelSchema` and
4673
+ * `TemplateLocalesSchema` are the exceptions, imported from the package domain
4674
+ * because they are already pure zod and a second copy of the same shape is a
4675
+ * worse outcome than the cross-domain import.
4606
4676
  *
4607
4677
  * Spec: `apps/busabase/content/spec/template-center.md` §6.4.
4608
4678
  */
@@ -4653,6 +4723,24 @@ const TemplateCardVOSchema = z.object({
4653
4723
  * than the screenshots — see `videoUrl` in the catalog logic.
4654
4724
  */
4655
4725
  video: z.string().optional(),
4726
+ /**
4727
+ * Every default clip, absolute URLs, in display order. `video` is always the
4728
+ * first of these (kept for clients built before this field existed — the
4729
+ * mobile app ships separately from the server). Render through
4730
+ * `pickTemplateMedia(card, locale)`, never from this directly.
4731
+ */
4732
+ videos: z.array(TemplateVideoSchema).optional(),
4733
+ /**
4734
+ * Per-locale screenshots/clips, absolute URLs like the fields above,
4735
+ * keyed by locale. Absent when the template declares none — and on every
4736
+ * card an older catalog produced. Never read it directly: render through
4737
+ * `pickTemplateMedia(card, locale)` (`domains/templates/media`), which owns
4738
+ * the fallback to `screenshots` / `video`.
4739
+ *
4740
+ * Declared here because this is a plain `z.object`: an undeclared key would
4741
+ * be stripped by `.output()` before it ever reached a client.
4742
+ */
4743
+ locales: TemplateLocalesSchema.optional(),
4656
4744
  agentPrompts: z.array(z.string()).default([]),
4657
4745
  version: z.string().optional(),
4658
4746
  author: z.string().optional(),
@@ -130,6 +130,45 @@ const TemplateSecretSchema = z.object({
130
130
  description: z.string().default(""),
131
131
  required: z.boolean().default(true)
132
132
  });
133
+ /**
134
+ * One demo clip in a template's gallery.
135
+ *
136
+ * An object rather than a bare path, on purpose, and from the first release: the
137
+ * catalog is read at runtime by servers that were deployed before this existed,
138
+ * so a list of strings that later became a list of objects would break exactly
139
+ * the servers in between. `title` is what tells two clips of one template apart
140
+ * ("30-second tour", "Full walkthrough"); a locale that wants the title in its
141
+ * own language declares its own `videos` list.
142
+ *
143
+ * `src` is package-relative in `busabase.json` and an absolute URL on the card.
144
+ */
145
+ const TemplateVideoSchema = z.object({
146
+ src: z.string().min(1),
147
+ title: z.string().optional()
148
+ });
149
+ /**
150
+ * One locale's own gallery media — the value side of `template.locales`.
151
+ *
152
+ * All fields optional and independent: a locale that only re-recorded the clip
153
+ * declares just `video` (or `videos`) and keeps the default screenshots. Paths
154
+ * are package-relative in `busabase.json` and absolute URLs on the catalog card;
155
+ * the shape is the same, which is why the card VO reuses this schema.
156
+ */
157
+ const TemplateLocaleMediaSchema = z.object({
158
+ /** Replaces the default list WHOLE for this locale — never merged per index. */
159
+ screenshots: z.array(z.string()).optional(),
160
+ video: z.string().optional(),
161
+ /** Replaces the default clips WHOLE for this locale; wins over `video` here. */
162
+ videos: z.array(TemplateVideoSchema).optional()
163
+ });
164
+ /**
165
+ * Per-locale media keyed by locale (`"zh-CN"`, `"ja"`).
166
+ *
167
+ * Keys are plain strings on purpose, not the supported-locale enum: a template
168
+ * written for a locale this server does not know yet must still install. The
169
+ * audit warns about such keys; the schema never rejects them.
170
+ */
171
+ const TemplateLocalesSchema = z.record(z.string(), TemplateLocaleMediaSchema);
133
172
  z.object({
134
173
  /** Template Center category, e.g. `"crm"`, `"email"`, `"content"`. */
135
174
  category: z.string().min(1),
@@ -150,6 +189,31 @@ z.object({
150
189
  */
151
190
  video: z.string().optional(),
152
191
  /**
192
+ * Several demo clips, in the order they are shown (cover first, then these,
193
+ * then the screenshots), at most `TEMPLATE_VIDEO_LIMIT`.
194
+ *
195
+ * `video` stays the one-clip shorthand and is unchanged. When `videos` is
196
+ * declared it wins, and the catalog index still writes `video` as the first
197
+ * entry's path so servers deployed before this field existed keep showing one
198
+ * clip instead of none.
199
+ */
200
+ videos: z.array(TemplateVideoSchema).optional(),
201
+ /**
202
+ * Localized gallery media, the App Store / Google Play rule: a viewer whose
203
+ * locale has an entry sees that entry's `screenshots` / `video` / `videos`; anything the
204
+ * entry leaves out, and every locale without an entry, falls back to the two
205
+ * fields above. Those stay the English/default set — they are what every
206
+ * deployed server and CLI already reads, so their meaning cannot change.
207
+ *
208
+ * `{ "zh-CN": { "screenshots": ["assets/screenshots/cover-zh-CN.webp"],
209
+ * "video": "assets/recordings/busa-rnd-zh-CN.mp4" } }`
210
+ *
211
+ * Additive by construction: an older parser strips the key (see the note on
212
+ * `video`), so an older server simply shows the defaults. Selection lives in
213
+ * one place — `pickTemplateMedia` in `domains/templates/media`.
214
+ */
215
+ locales: TemplateLocalesSchema.optional(),
216
+ /**
153
217
  * Ready-made prompts shown after install ("Ask agent" prefills the first).
154
218
  *
155
219
  * They are the difference between a folder of tables and something a user can
@@ -235,4 +299,4 @@ z.object({
235
299
  ["isTemplateSkill"]: z.literal(true)
236
300
  });
237
301
  //#endregion
238
- export { uploadAsset as i, TemplateRiskLevelSchema as n, hashBytes as r, APP_ROOT_RESOURCE_KEY as t };
302
+ export { hashBytes as a, TemplateVideoSchema as i, TemplateLocalesSchema as n, uploadAsset as o, TemplateRiskLevelSchema as r, APP_ROOT_RESOURCE_KEY as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "busa-sdk",
3
- "version": "0.97.0",
3
+ "version": "0.99.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",