@work-shape/catalyst-api-contract 0.8.0-rc.3 → 0.8.0-rc.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/dist/index.js CHANGED
@@ -769,7 +769,7 @@ import { z as z39 } from "zod";
769
769
  // package.json
770
770
  var package_default = {
771
771
  name: "@work-shape/catalyst-api-contract",
772
- version: "0.8.0-rc.3",
772
+ version: "0.8.0-rc.4",
773
773
  license: "MIT",
774
774
  repository: {
775
775
  type: "git",
@@ -2564,6 +2564,10 @@ var agentDraftSchema = z13.object({
2564
2564
  config: configAssetConfigSchema,
2565
2565
  author: z13.object({
2566
2566
  userId: z13.string().optional(),
2567
+ /** The name of the person who wrote the draft last, while their account exists. */
2568
+ displayLabel: z13.string().optional(),
2569
+ /** The name people read for the person who wrote the draft last, while they exist. */
2570
+ name: z13.string().optional(),
2567
2571
  conversationId: z13.string().optional(),
2568
2572
  release: z13.boolean()
2569
2573
  }),
@@ -2618,6 +2622,8 @@ var agentDraftSummarySchema = z14.object({
2618
2622
  baseRevision: revisionNumberSchema2,
2619
2623
  author: z14.object({
2620
2624
  userId: z14.string().optional(),
2625
+ /** The name of the person who wrote the draft last, while their account exists. */
2626
+ displayLabel: z14.string().optional(),
2621
2627
  conversationId: z14.string().optional(),
2622
2628
  release: z14.boolean()
2623
2629
  }),
@@ -2662,6 +2668,7 @@ var assetFileSchema = z14.object({
2662
2668
  text: z14.string().optional(),
2663
2669
  base64: z14.string().optional()
2664
2670
  });
2671
+ var assetVerbSchema = z14.enum(["write", "delete", "publish"]);
2665
2672
  var assetSchema = z14.object({
2666
2673
  id: z14.string(),
2667
2674
  kind: z14.string(),
@@ -2673,6 +2680,8 @@ var assetSchema = z14.object({
2673
2680
  config: configAssetConfigSchema,
2674
2681
  /** The active account's display label for the Workflow revision returned by this read. */
2675
2682
  runsAs: z14.string().optional(),
2683
+ /** Unrecorded draft review lines naming its audience and shared source accounts. */
2684
+ publishQuestion: z14.array(z14.string()).optional(),
2676
2685
  /**
2677
2686
  * The revision `config` and `files` are of, for a kind with a draft and a published revision:
2678
2687
  * the draft where the call names none.
@@ -2700,6 +2709,12 @@ var assetSchema = z14.object({
2700
2709
  unavailableModels: z14.array(unavailableModelSchema).optional(),
2701
2710
  /** False when the primary model is unavailable; no model is substituted. */
2702
2711
  chatAvailable: z14.boolean().optional(),
2712
+ /**
2713
+ * What the caller may do to this asset, as the instance decides it on this asset: grants and
2714
+ * denies on the instance, a Namespace, a workspace and the asset itself. A kind without a
2715
+ * published revision names no `publish`. Left out by an instance from before AD-4.
2716
+ */
2717
+ allowed: z14.array(assetVerbSchema).optional(),
2703
2718
  updatedAt: timestampSchema
2704
2719
  });
2705
2720
  var assetWarningSchema = z14.object({ code: z14.string(), message: z14.string() });
@@ -6231,8 +6246,20 @@ var jobOperations = {
6231
6246
  };
6232
6247
 
6233
6248
  // src/operations/knowledge.ts
6249
+ import {
6250
+ knowledgeSyncInputSchema,
6251
+ knowledgeSyncResultSchema,
6252
+ knowledgeSourcesOutputSchema,
6253
+ knowledgeSourceItemsInputSchema,
6254
+ knowledgeSourceItemsOutputSchema,
6255
+ knowledgeLocateInputSchema,
6256
+ knowledgeLocateOutputSchema,
6257
+ knowledgeRetryInputSchema,
6258
+ knowledgeRetryOutputSchema
6259
+ } from "@work-shape/catalyst-asset-schemas";
6234
6260
  import {
6235
6261
  DATA_STORE_SCALAR_TYPES as DATA_STORE_SCALAR_TYPES2,
6262
+ MANAGED_FILE_STATUSES,
6236
6263
  KNOWLEDGE_BASE_STATUSES,
6237
6264
  KNOWLEDGE_DOCUMENT_FAILURE_CODES,
6238
6265
  KNOWLEDGE_DOCUMENT_STATES,
@@ -6314,6 +6341,8 @@ var knowledgeListDocumentsResponseSchema = z32.object({
6314
6341
  format: z32.string(),
6315
6342
  /** The size of the file in bytes. */
6316
6343
  bytes: z32.number().int(),
6344
+ /** Released originals remain at the source; file metadata and extracted text stay here. */
6345
+ originalStatus: z32.enum(MANAGED_FILE_STATUSES).exclude(["deleted"]).optional(),
6317
6346
  /** `pending` until it is searchable, then `indexed`; `failed` with `failureCode`. */
6318
6347
  state: z32.enum(KNOWLEDGE_DOCUMENT_STATES),
6319
6348
  failureCode: z32.enum(KNOWLEDGE_DOCUMENT_FAILURE_CODES).optional(),
@@ -6335,16 +6364,6 @@ var knowledgeListDocumentsResponseSchema = z32.object({
6335
6364
  /** Present while more documents follow. */
6336
6365
  nextCursor: z32.string().optional()
6337
6366
  });
6338
- var knowledgeRetryDocumentsRequestSchema = z32.strictObject({
6339
- /** The documents to index again: failed ones, or pending ones whose indexing seems stuck. */
6340
- documentIds: z32.array(z32.string().min(1)).min(1).max(100)
6341
- });
6342
- var knowledgeRetryDocumentsResponseSchema = z32.object({
6343
- /** Each named document in the Knowledge Base, with its state after the retry. */
6344
- documents: z32.array(z32.object({ id: z32.string(), state: z32.enum(KNOWLEDGE_DOCUMENT_STATES) })),
6345
- /** How many contents were queued to be indexed again. */
6346
- queued: z32.number().int()
6347
- });
6348
6367
  var knowledgeSearchRequestSchema = z32.strictObject({
6349
6368
  /** Words or a question. Quoted words are a phrase, and a word after `-` is left out. */
6350
6369
  query: z32.string().trim().min(1).max(1e3),
@@ -6382,6 +6401,53 @@ var BASE = {
6382
6401
  errors: ["NOT_FOUND", "CONFLICT", "TIMEOUT"]
6383
6402
  };
6384
6403
  var knowledgeOperations = {
6404
+ "knowledge_bases.sync": defineRegisteredOperation({
6405
+ ...BASE,
6406
+ id: "knowledge_bases.sync",
6407
+ method: "POST",
6408
+ path: "/api/v1/knowledge-bases/:knowledgeBase/sync",
6409
+ summary: "Start a full source sync and return its Operation Run immediately; concurrent starts join the running sync",
6410
+ scope: "config_assets:write",
6411
+ effect: "changing",
6412
+ body: knowledgeSyncInputSchema,
6413
+ response: json(knowledgeSyncResultSchema),
6414
+ rateClass: "write"
6415
+ }),
6416
+ "knowledge_bases.sources": defineRegisteredOperation({
6417
+ ...BASE,
6418
+ id: "knowledge_bases.sources",
6419
+ method: "GET",
6420
+ path: "/api/v1/knowledge-bases/:knowledgeBase/sources",
6421
+ summary: "Read source states, counts, failure codes and sync progress",
6422
+ scope: "config_assets:read",
6423
+ effect: "reading",
6424
+ response: json(knowledgeSourcesOutputSchema),
6425
+ rateClass: "read"
6426
+ }),
6427
+ "knowledge_bases.source_items": defineRegisteredOperation({
6428
+ ...BASE,
6429
+ id: "knowledge_bases.source_items",
6430
+ method: "GET",
6431
+ path: "/api/v1/knowledge-bases/:knowledgeBase/sources/:source/items",
6432
+ summary: "Page through the items of a source, newest change first; filter by state or failure code",
6433
+ scope: "config_assets:read",
6434
+ effect: "reading",
6435
+ query: knowledgeSourceItemsInputSchema.omit({ source: true }),
6436
+ response: json(knowledgeSourceItemsOutputSchema),
6437
+ rateClass: "read"
6438
+ }),
6439
+ "knowledge_bases.locate": defineRegisteredOperation({
6440
+ ...BASE,
6441
+ id: "knowledge_bases.locate",
6442
+ method: "GET",
6443
+ path: "/api/v1/knowledge-bases/:knowledgeBase/locate",
6444
+ summary: "Locate a source item for erasure: state and lifecycle times without content, file name or path",
6445
+ scope: "config_assets:read",
6446
+ effect: "reading",
6447
+ query: knowledgeLocateInputSchema,
6448
+ response: json(knowledgeLocateOutputSchema),
6449
+ rateClass: "read"
6450
+ }),
6385
6451
  "knowledge_bases.get": defineRegisteredOperation({
6386
6452
  ...BASE,
6387
6453
  id: "knowledge_bases.get",
@@ -6462,10 +6528,10 @@ var knowledgeOperations = {
6462
6528
  method: "POST",
6463
6529
  path: "/api/v1/knowledge-bases/:knowledgeBase/documents/retry",
6464
6530
  summary: "Index documents of a Knowledge Base again: a failed one goes back to pending, and its content is queued",
6465
- scope: "data_store_rows:write",
6531
+ scope: "config_assets:write",
6466
6532
  effect: "changing",
6467
- body: knowledgeRetryDocumentsRequestSchema,
6468
- response: json(knowledgeRetryDocumentsResponseSchema),
6533
+ body: knowledgeRetryInputSchema,
6534
+ response: json(knowledgeRetryOutputSchema),
6469
6535
  errors: ["NOT_FOUND", "CONFLICT", "VALIDATION_FAILED", "TIMEOUT"],
6470
6536
  rateClass: "write"
6471
6537
  }),
@@ -7316,6 +7382,8 @@ import {
7316
7382
  } from "@work-shape/catalyst-asset-schemas";
7317
7383
  import { z as z38 } from "zod";
7318
7384
  var WORKFLOW_RUN_OUTPUT_PREVIEW_MAX_CHARS = 2e3;
7385
+ var WORKFLOW_RUN_KEY_MAX_CHARS = 200;
7386
+ var runKeySchema = z38.string().min(1).max(WORKFLOW_RUN_KEY_MAX_CHARS);
7319
7387
  var runStatusSchema = z38.enum(WORKFLOW_RUN_STATUSES2);
7320
7388
  var stepRunStatusSchema = z38.enum(WORKFLOW_STEP_RUN_STATUSES);
7321
7389
  var stepTypeSchema = z38.enum([...WORKFLOW_STEP_TYPES, ...WORKFLOW_RESERVED_STEP_TYPES]);
@@ -7360,6 +7428,11 @@ var workflowRunSchema = z38.object({
7360
7428
  }),
7361
7429
  /** The due time of the schedule that started the run. Missing on every other run. */
7362
7430
  scheduledFor: timestampSchema.optional(),
7431
+ /**
7432
+ * The run key its start gave the run, such as `2026-09/1402`. Among the Workflow's runs that
7433
+ * are open or `done` a key exists once. Missing on a run started without one.
7434
+ */
7435
+ runKey: z38.string().optional(),
7363
7436
  /** The Operation Run of the call that started the run. */
7364
7437
  operationRunId: z38.string().optional(),
7365
7438
  parentRunId: z38.string().optional(),
@@ -7431,6 +7504,11 @@ var workflowStepRunSchema = z38.object({
7431
7504
  attempt: z38.number().int().min(0),
7432
7505
  /** The Operation Run of the call an operation step made. */
7433
7506
  operationRunId: z38.string().optional(),
7507
+ /**
7508
+ * On the step run of a `workflow` step whose start a run key answered: the run it waits for
7509
+ * and does not own. Cancelling this run leaves that one going.
7510
+ */
7511
+ linkedRunId: z38.string().optional(),
7434
7512
  error: workflowRunErrorSchema.optional(),
7435
7513
  outputPreview: workflowOutputPreviewSchema.optional(),
7436
7514
  createdAt: timestampSchema,
@@ -7439,7 +7517,17 @@ var workflowStepRunSchema = z38.object({
7439
7517
  });
7440
7518
  var startWorkflowRunRequestSchema = z38.object({
7441
7519
  /** The input of the run, checked against the `inputs` of the Workflow's definition. */
7442
- input: z38.record(z38.string(), z38.unknown()).optional()
7520
+ input: z38.record(z38.string(), z38.unknown()).optional(),
7521
+ /**
7522
+ * The run key, such as `2026-09/1402`. Where a run of the Workflow that is open or `done`
7523
+ * holds it, the start starts nothing and answers that run; a run that ended `failed`,
7524
+ * `cancelled` or `limit_reached` holds no key.
7525
+ */
7526
+ key: runKeySchema.optional()
7527
+ });
7528
+ var listWorkflowRunsQuerySchema = listQuerySchema.extend({
7529
+ key: runKeySchema.optional(),
7530
+ keyPrefix: runKeySchema.optional()
7443
7531
  });
7444
7532
  var listWorkflowStepRunsQuerySchema = listQuerySchema.extend({
7445
7533
  topLevel: z38.enum(["true", "false"]).optional(),
@@ -7516,7 +7604,7 @@ var workflowOperations = {
7516
7604
  effect: "changing",
7517
7605
  body: startWorkflowRunRequestSchema,
7518
7606
  response: json(workflowRunSchema),
7519
- errors: ["NOT_FOUND", "CONFLICT"],
7607
+ errors: ["NOT_FOUND", "CONFLICT", "VALIDATION_FAILED"],
7520
7608
  rateClass: "write"
7521
7609
  }),
7522
7610
  "workflows.test": defineRegisteredOperation({
@@ -7538,15 +7626,15 @@ var workflowOperations = {
7538
7626
  id: "workflows.list_runs",
7539
7627
  method: "GET",
7540
7628
  path: "/api/v1/workflows/:workflow/runs",
7541
- summary: "List the runs of one Workflow with their status, newest first",
7629
+ summary: "List the runs of one Workflow with their status, newest first: all of them, or those of one run key or key prefix",
7542
7630
  tag: "Workflows",
7543
7631
  auth: "principal",
7544
7632
  scope: "config_assets:read",
7545
7633
  requires: [],
7546
7634
  effect: "reading",
7547
- query: listQuerySchema,
7635
+ query: listWorkflowRunsQuerySchema,
7548
7636
  response: page(workflowRunSchema, ["createdAt", "id"], true),
7549
- errors: [],
7637
+ errors: ["VALIDATION_FAILED"],
7550
7638
  rateClass: "read"
7551
7639
  }),
7552
7640
  "workflows.get_run": defineRegisteredOperation({
@@ -7717,6 +7805,7 @@ __export(schemas_exports, {
7717
7805
  assetSyncItemSchema: () => assetSyncItemSchema,
7718
7806
  assetSyncRefusedItemSchema: () => assetSyncRefusedItemSchema,
7719
7807
  assetValidationIssueSchema: () => assetValidationIssueSchema,
7808
+ assetVerbSchema: () => assetVerbSchema,
7720
7809
  assetWarningSchema: () => assetWarningSchema,
7721
7810
  assetWriteResponseSchema: () => assetWriteResponseSchema,
7722
7811
  assistantFinalMessageMetadataSchema: () => assistantFinalMessageMetadataSchema,
@@ -8664,6 +8753,7 @@ export {
8664
8753
  VIEW_RUNTIME,
8665
8754
  VIEW_SHELL,
8666
8755
  VIEW_SHELL_MESSAGES,
8756
+ WORKFLOW_RUN_KEY_MAX_CHARS,
8667
8757
  WORKFLOW_RUN_OUTPUT_PREVIEW_MAX_CHARS,
8668
8758
  activeRunSummarySchema,
8669
8759
  addWorkspaceMemberRequestSchema,
@@ -8742,6 +8832,7 @@ export {
8742
8832
  assetSyncItemSchema,
8743
8833
  assetSyncRefusedItemSchema,
8744
8834
  assetValidationIssueSchema,
8835
+ assetVerbSchema,
8745
8836
  assetWarningSchema,
8746
8837
  assetWriteResponseSchema,
8747
8838
  assistantFinalMessageMetadataSchema,
@@ -8868,6 +8959,7 @@ export {
8868
8959
  listLiveOnceQuerySchema,
8869
8960
  listPermissionGrantsQuerySchema,
8870
8961
  listQuerySchema,
8962
+ listWorkflowRunsQuerySchema,
8871
8963
  listWorkflowStepRunsQuerySchema,
8872
8964
  listWorkspaceFilesQuerySchema,
8873
8965
  liveOnceListSchema,