@work-shape/catalyst-cli 0.8.0-rc.29 → 0.8.0-rc.30

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
@@ -7231,6 +7231,7 @@ declare const assetOperations: {
7231
7231
  revision: zod.ZodNumber;
7232
7232
  draftRevision: zod.ZodOptional<zod.ZodNumber>;
7233
7233
  publishedRevision: zod.ZodOptional<zod.ZodNumber>;
7234
+ approvalRequestId: zod.ZodOptional<zod.ZodString>;
7234
7235
  }, zod_v4_core.$strip>, zod.ZodObject<{
7235
7236
  type: zod.ZodLiteral<"delete">;
7236
7237
  kind: zod.ZodString;
@@ -8228,6 +8229,7 @@ declare const assetOperations: {
8228
8229
  sha256: zod.ZodString;
8229
8230
  bytes: zod.ZodNumber;
8230
8231
  }, zod_v4_core.$strip>>>;
8232
+ approvalRequestId: zod.ZodOptional<zod.ZodString>;
8231
8233
  warnings: zod.ZodArray<zod.ZodObject<{
8232
8234
  code: zod.ZodString;
8233
8235
  message: zod.ZodString;
@@ -8952,6 +8954,7 @@ declare const assetOperations: {
8952
8954
  sha256: zod.ZodString;
8953
8955
  bytes: zod.ZodNumber;
8954
8956
  }, zod_v4_core.$strip>>>;
8957
+ approvalRequestId: zod.ZodOptional<zod.ZodString>;
8955
8958
  warnings: zod.ZodArray<zod.ZodObject<{
8956
8959
  code: zod.ZodString;
8957
8960
  message: zod.ZodString;
@@ -9803,6 +9806,7 @@ declare const assetOperations: {
9803
9806
  sha256: zod.ZodString;
9804
9807
  bytes: zod.ZodNumber;
9805
9808
  }, zod_v4_core.$strip>>>;
9809
+ approvalRequestId: zod.ZodOptional<zod.ZodString>;
9806
9810
  warnings: zod.ZodArray<zod.ZodObject<{
9807
9811
  code: zod.ZodString;
9808
9812
  message: zod.ZodString;
@@ -34010,8 +34014,9 @@ declare const roleOperations: {
34010
34014
  };
34011
34015
 
34012
34016
  /**
34013
- * The shared draft of a skill the instance or a Shared Workspace owns (SKILL-DRAFT-1), available
34014
- * only to holders of the skill's write right. `assets.publish` makes it live with `skill.publish`.
34017
+ * A skill's draft from before skills went live on save (SKILL-LIVE-1), available only to holders
34018
+ * of the skill's write right. `assets.publish` makes it live with `skill.publish`. No write makes
34019
+ * a new one, so these answer no draft on an instance without one left.
34015
34020
  */
34016
34021
  declare const skillOperations: {
34017
34022
  readonly "skills.draft.get": Operation<{
package/dist/index.js CHANGED
@@ -77,7 +77,7 @@ var AGENT_ACTIONS = [
77
77
  var SKILL_ACTIONS = [
78
78
  "skill.read",
79
79
  "skill.write",
80
- // Makes the shared draft of a team's or the instance's skill live (SKILL-DRAFT-1).
80
+ // A save of a team's or the instance's skill is live with it; without it, a request (SKILL-LIVE-1).
81
81
  "skill.publish",
82
82
  "skill.delete",
83
83
  "skill.approve"
@@ -508,6 +508,7 @@ var INFRASTRUCTURE_WITHHELD_FIELDS = ["endpointHost", "bucket"];
508
508
  var OPENAI_COMPATIBLE_APIS = ["chat_completions", "responses"];
509
509
  var MODEL_PROVIDER_AUTH_MODES = ["bearer", "api-key"];
510
510
  var CONVERSATION_VISIBILITIES = ["workspace", "private"];
511
+ var CONVERSATION_TITLE_MAX_CHARS = 120;
511
512
  var WEB_SOURCE_PROVIDERS = [
512
513
  "openai-native",
513
514
  "serper",
@@ -2806,7 +2807,7 @@ import { z as z68 } from "zod";
2806
2807
  // ../api-contract/package.json
2807
2808
  var package_default = {
2808
2809
  name: "@work-shape/catalyst-api-contract",
2809
- version: "0.8.0-rc.29",
2810
+ version: "0.8.0-rc.30",
2810
2811
  license: "MIT",
2811
2812
  repository: {
2812
2813
  type: "git",
@@ -4837,6 +4838,11 @@ var assetWriteResponseSchema = z30.object({
4837
4838
  /** The file set of the revision and its source files, after a write that carried files. */
4838
4839
  fileSetId: z30.string().optional(),
4839
4840
  files: z30.array(assetFileEntrySchema).optional(),
4841
+ /**
4842
+ * The change waits for this `skill_change` request: its writer may not make the skill live.
4843
+ * `revision` names the live revision, which stays as it was (SKILL-LIVE-1).
4844
+ */
4845
+ approvalRequestId: z30.string().optional(),
4840
4846
  warnings: z30.array(assetWarningSchema)
4841
4847
  });
4842
4848
  var confirmHandoverSchema = z30.string().regex(/^[a-f0-9]{64}$/u).optional();
@@ -5090,7 +5096,9 @@ var assetSyncAppliedItemSchema = z30.discriminatedUnion("status", [
5090
5096
  /** The revision this batch gave the asset. */
5091
5097
  revision: revisionNumberSchema,
5092
5098
  draftRevision: revisionNumberSchema.optional(),
5093
- publishedRevision: revisionNumberSchema.optional()
5099
+ publishedRevision: revisionNumberSchema.optional(),
5100
+ /** The change waits for this request: `revision` names the live one, as it was. */
5101
+ approvalRequestId: z30.string().optional()
5094
5102
  }),
5095
5103
  // A delete in a release of an asset that is not there: nothing was written for it.
5096
5104
  z30.object({
@@ -5967,7 +5975,7 @@ var conversationDataStoreAddedSchema = z33.object({
5967
5975
  readTools: z33.array(z33.string())
5968
5976
  });
5969
5977
  var renameConversationRequestSchema = z33.object({
5970
- title: z33.string().trim().min(1).max(120)
5978
+ title: z33.string().trim().min(1).max(CONVERSATION_TITLE_MAX_CHARS)
5971
5979
  });
5972
5980
  var toolDecisionModeSchema = z33.enum(TOOL_DECISION_MODES);
5973
5981
  var agentRunStatusSchema = z33.enum(AGENT_RUN_STATUSES);
@@ -15923,6 +15931,9 @@ function workingCopyKinds(manifest) {
15923
15931
  return (manifest.guardrails ?? []).length > 0 ? ASSET_KINDS : [...CONFIG_ASSET_KINDS];
15924
15932
  }
15925
15933
  var PULL_CONCURRENCY = 8;
15934
+ function filedForApproval(subject, requestId2, live) {
15935
+ return `${subject}: not live. Filed for approval as request ${requestId2}, because this key or account may not publish it; live revision ${live} is unchanged until a holder of skill.approve approves it in the Inbox.`;
15936
+ }
15926
15937
  function formatDraftAuthor(author) {
15927
15938
  if (author.release) return "a release push";
15928
15939
  const person = author.displayLabel ?? (author.userId === void 0 ? "somebody" : "an account that is gone");
@@ -17772,9 +17783,11 @@ publish offers it in its workspace. A workspace's agent made by someone without
17772
17783
  starts offered nowhere; 'catalyst agent publish <name> --revision 1' publishes it as made,
17773
17784
  without a draft. A service principal's key publishes no agent. 'catalyst agent discard
17774
17785
  <name> --revision <n>' drops the draft.
17775
- A skill of the instance or of a Shared Workspace has one shared draft too: a put or a push
17776
- writes it, 'catalyst skill publish <name> --revision <n>' (or 'push --publish') makes it live,
17777
- and 'catalyst skill discard <name> --revision <n>' drops it. A personal skill is live on save.
17786
+ A skill has no draft: a put, a push or a revert is live. A skill of the instance or of a Shared
17787
+ Workspace asks for skill.publish on a person's account or key with config_assets:publish;
17788
+ without it the write files a request a holder of skill.approve decides in the Inbox, says so
17789
+ and exits with 3. 'catalyst skill publish <name> --revision <n>' and 'catalyst skill discard
17790
+ <name> --revision <n>' decide a draft from before this rule; until then its writes are refused.
17778
17791
  Exit codes: 0 done, 1 refused or failed, 2 usage, 3 waits for an approval (nothing changed yet).
17779
17792
  `;
17780
17793
  }
@@ -17871,32 +17884,18 @@ async function pushConfig(options) {
17871
17884
  }
17872
17885
  const api = await connectApi(instance.url, options, instance);
17873
17886
  const listing = await listRemoteAssets(api, workingCopyKinds(manifest));
17874
- for (const asset of touched.filter((asset2) => asset2.kind === "skill")) {
17875
- const remote = listing.get(asset.key);
17876
- if (remote && (remote.draft?.revision ?? null) !== (baselineAssets[asset.key]?.draftRevision ?? null)) {
17877
- writeError(
17878
- options,
17879
- [
17880
- "The skill draft changed. Read it again before saving",
17881
- formatPushConflict(
17882
- [
17883
- {
17884
- kind: "skill",
17885
- name: asset.name,
17886
- draft: { revision: remote.draft?.revision ?? null },
17887
- ...remote.draft ? {
17888
- changedBy: formatDraftAuthor(remote.draft.author),
17889
- changedAt: remote.draft.updatedAt
17890
- } : {}
17891
- }
17892
- ],
17893
- false,
17894
- options
17895
- )
17896
- ].join("\n")
17897
- );
17898
- return 1;
17899
- }
17887
+ const skillDrafts = touched.flatMap((asset) => {
17888
+ const draft = asset.kind === "skill" ? listing.get(asset.key)?.draft : void 0;
17889
+ return draft ? [{ name: asset.name, draft }] : [];
17890
+ });
17891
+ if (skillDrafts.length > 0) {
17892
+ writeError(
17893
+ options,
17894
+ skillDrafts.map(
17895
+ ({ name: name2, draft }) => `skill:${name2} has an unpublished draft from before skills went live on save. Publish it with 'catalyst skill publish ${name2} --revision ${draft.revision}' or discard it on the skill page, then push again.`
17896
+ ).join("\n")
17897
+ );
17898
+ return 1;
17900
17899
  }
17901
17900
  const touchedKeys = new Set(touched.map((asset) => asset.key));
17902
17901
  const localKeys = new Set(assetEntries(local).map((asset) => asset.key));
@@ -18029,6 +18028,7 @@ async function pushConfig(options) {
18029
18028
  }
18030
18029
  }
18031
18030
  const drafted = [];
18031
+ const filed = [];
18032
18032
  if (items.length > 0 || changesDefault) {
18033
18033
  const batch = {
18034
18034
  ...batchScope(instance),
@@ -18044,9 +18044,15 @@ async function pushConfig(options) {
18044
18044
  }
18045
18045
  const result = synced;
18046
18046
  const revisions = {};
18047
+ const filedInSync = /* @__PURE__ */ new Set();
18047
18048
  for (const item of result.items) {
18048
18049
  if (item.status !== "applied" || item.type !== "put") continue;
18049
18050
  const key2 = `${item.kind}:${item.name}`;
18051
+ if (item.approvalRequestId !== void 0) {
18052
+ filedInSync.add(key2);
18053
+ filed.push(filedForApproval(key2, item.approvalRequestId, item.revision));
18054
+ continue;
18055
+ }
18050
18056
  if (item.draftRevision === void 0) {
18051
18057
  revisions[key2] = item.kind === "agent" || item.kind === "skill" ? { id: item.id, revision: item.revision, draftRevision: null } : { id: item.id, revision: item.revision };
18052
18058
  } else {
@@ -18067,7 +18073,7 @@ async function pushConfig(options) {
18067
18073
  });
18068
18074
  }
18069
18075
  }
18070
- const pushed = bundleOf(syncTouched);
18076
+ const pushed = bundleOf(syncTouched.filter((asset) => !filedInSync.has(asset.key)));
18071
18077
  await recordBaseline(
18072
18078
  workingDir,
18073
18079
  instance.key,
@@ -18083,6 +18089,7 @@ async function pushConfig(options) {
18083
18089
  )
18084
18090
  );
18085
18091
  writeOutput(options, `Pushed ${formatCounts(pushed)}, version ${result.version}.`);
18092
+ for (const line of filed) writeOutput(options, line);
18086
18093
  for (const draft of drafted) {
18087
18094
  writeOutput(
18088
18095
  options,
@@ -18129,6 +18136,18 @@ async function pushConfig(options) {
18129
18136
  );
18130
18137
  return 1;
18131
18138
  }
18139
+ if (outcome.output.approvalRequestId !== void 0) {
18140
+ const line = filedForApproval(
18141
+ asset.key,
18142
+ outcome.output.approvalRequestId,
18143
+ outcome.output.revision
18144
+ );
18145
+ filed.push(line);
18146
+ writeOutput(options, line);
18147
+ for (const warning of outcome.output.warnings ?? [])
18148
+ writeOutput(options, `Warning: ${warning.message}`);
18149
+ continue;
18150
+ }
18132
18151
  const id3 = listing.get(asset.key)?.id ?? (await api.getAsset("skill", asset.name))?.id;
18133
18152
  const { draftRevision } = outcome.output;
18134
18153
  const live = draftRevision === void 0 ? outcome.output.revision : outcome.output.publishedRevision ?? base?.revision ?? outcome.output.revision;
@@ -18198,10 +18217,7 @@ async function pushConfig(options) {
18198
18217
  ...instance.workspace === void 0 ? {} : { workspaceId: instance.workspace },
18199
18218
  options
18200
18219
  });
18201
- if (guardrailsWritten !== 0 || !options.publish || drafted.length === 0) {
18202
- return guardrailsWritten;
18203
- }
18204
- return publishDrafts(api, drafted, {
18220
+ const finished = guardrailsWritten !== 0 || !options.publish || drafted.length === 0 ? guardrailsWritten : await publishDrafts(api, drafted, {
18205
18221
  workingDir,
18206
18222
  instanceKey: instance.key,
18207
18223
  version: baseline.lastPulledVersion,
@@ -18209,6 +18225,7 @@ async function pushConfig(options) {
18209
18225
  ...instance.workspace === void 0 ? {} : { workspaceId: instance.workspace },
18210
18226
  options
18211
18227
  });
18228
+ return finished === 0 && filed.length > 0 ? 3 : finished;
18212
18229
  }
18213
18230
  async function publishDrafts(api, drafts, input) {
18214
18231
  const { options } = input;
@@ -18655,7 +18672,8 @@ function settle(session2, outcome, lines, approvalHint) {
18655
18672
  }
18656
18673
  if (session2.values.json) writeOutput(session2.options, JSON.stringify(outcome.output, null, 2));
18657
18674
  else writeOutput(session2.options, lines(outcome.output).join("\n"));
18658
- return EXIT3.done;
18675
+ const filed = typeof outcome.output === "object" && outcome.output !== null && "approvalRequestId" in outcome.output && outcome.output.approvalRequestId !== void 0;
18676
+ return filed ? EXIT3.pending : EXIT3.done;
18659
18677
  }
18660
18678
  function print(session2, value, text2) {
18661
18679
  writeOutput(session2.options, session2.values.json ? JSON.stringify(value, null, 2) : text2());
@@ -19082,7 +19100,7 @@ var validateVerb = {
19082
19100
  // src/asset-verbs/put.ts
19083
19101
  var putVerb = {
19084
19102
  usage: "put <name> --from <file-or-folder> --if-revision <n|new> [--if-draft-revision <n|none>]",
19085
- summary: "Create an asset (--if-revision new) or replace it at the revision you read (assets.put). An agent that exists, and a shared skill, is written as its draft",
19103
+ summary: "Create an asset (--if-revision new) or replace it at the revision you read (assets.put). An agent that exists is written as its draft; a shared skill goes live, or files a request without skill.publish",
19086
19104
  named: true,
19087
19105
  options: {
19088
19106
  from: { type: "string" },
@@ -19116,7 +19134,11 @@ var putVerb = {
19116
19134
  `It may have been written: run 'catalyst ${kindNoun(session2.kind)} show ${name2}' before sending it again.`
19117
19135
  ).catch(explainDraftChanged(name2, "put", session2.kind.kind));
19118
19136
  return settle(session2, outcome, (output) => [
19119
- output.draftRevision !== void 0 && (session2.kind.kind === AGENT_KIND || session2.kind.kind === "skill") ? `Wrote ${session2.kind.kind} '${name2}' as draft revision ${output.draftRevision}; live revision ${output.publishedRevision ?? "-"} is unchanged until it is published with 'catalyst ${session2.kind.kind} publish ${name2} --revision ${output.draftRevision}'.` : `Wrote ${session2.kind.kind} '${name2}' at revision ${output.revision}.${session2.kind.lifecycle === "draft_published" ? " It is a draft until it is published." : ""}`,
19137
+ output.approvalRequestId !== void 0 ? filedForApproval(
19138
+ `${session2.kind.kind} '${name2}'`,
19139
+ output.approvalRequestId,
19140
+ output.revision
19141
+ ) : output.draftRevision !== void 0 && (session2.kind.kind === AGENT_KIND || session2.kind.kind === "skill") ? `Wrote ${session2.kind.kind} '${name2}' as draft revision ${output.draftRevision}; live revision ${output.publishedRevision ?? "-"} is unchanged until it is published with 'catalyst ${session2.kind.kind} publish ${name2} --revision ${output.draftRevision}'.` : `Wrote ${session2.kind.kind} '${name2}' at revision ${output.revision}.${session2.kind.lifecycle === "draft_published" ? " It is a draft until it is published." : ""}`,
19120
19142
  ...formatWarnings(output.warnings)
19121
19143
  ]);
19122
19144
  };
@@ -19526,7 +19548,7 @@ var deleteVerb = {
19526
19548
  // src/asset-verbs/revert.ts
19527
19549
  var revertVerb = {
19528
19550
  usage: "revert <name> --to <n> --if-revision <n> [--if-draft-revision <n|none>]",
19529
- summary: "Make an earlier revision the content again (assets.revert). For an agent it becomes the draft",
19551
+ summary: "Make an earlier revision the content again (assets.revert). For an agent it becomes the draft; a shared skill goes live, or files a request without skill.publish",
19530
19552
  named: true,
19531
19553
  options: {
19532
19554
  to: { type: "string" },
@@ -19548,7 +19570,11 @@ var revertVerb = {
19548
19570
  "It may have been applied: run 'history' before sending it again."
19549
19571
  ).catch(explainDraftChanged(name2, "revert", session2.kind.kind));
19550
19572
  return settle(session2, outcome, (output) => [
19551
- output.draftRevision !== void 0 && (session2.kind.kind === AGENT_KIND || session2.kind.kind === "skill") ? `Wrote the content of revision ${revision} of ${session2.kind.kind} '${name2}' as draft revision ${output.draftRevision}; live revision ${output.publishedRevision ?? "-"} is unchanged until it is published.` : `Reverted ${session2.kind.kind} '${name2}' to the content of revision ${revision}; it is revision ${output.revision} now.`,
19573
+ output.approvalRequestId !== void 0 ? filedForApproval(
19574
+ `${session2.kind.kind} '${name2}'`,
19575
+ output.approvalRequestId,
19576
+ output.revision
19577
+ ) : output.draftRevision !== void 0 && (session2.kind.kind === AGENT_KIND || session2.kind.kind === "skill") ? `Wrote the content of revision ${revision} of ${session2.kind.kind} '${name2}' as draft revision ${output.draftRevision}; live revision ${output.publishedRevision ?? "-"} is unchanged until it is published.` : `Reverted ${session2.kind.kind} '${name2}' to the content of revision ${revision}; it is revision ${output.revision} now.`,
19552
19578
  ...formatWarnings(output.warnings)
19553
19579
  ]);
19554
19580
  };
@@ -20798,7 +20824,9 @@ var commands = {
20798
20824
  pull: `Sync remote config assets into the local working copy. An agent is pulled
20799
20825
  at its live revision; each pending draft is listed with its author`,
20800
20826
  push: `Merge local config assets into the remote instance. A changed agent that
20801
- exists is written as its draft: "draft revision n", nothing live yet`,
20827
+ exists is written as its draft: "draft revision n", nothing live yet. A
20828
+ changed skill goes live, or files a request where the key may not publish
20829
+ it, and the exit code is 3`,
20802
20830
  diff: `Show local changes, remote newer assets, and conflicts, each agent against
20803
20831
  its live revision, and name each pending agent draft`,
20804
20832
  validate: `Validate local assets and remote references`,
@@ -20849,6 +20877,13 @@ model_judge check, its instruction in check.md. Guardrails are no part of a rele
20849
20877
  writes each as its draft with assets.put after the batch, which needs the config_assets:write
20850
20878
  scope. Publishing is a step of its own.
20851
20879
 
20880
+ A team's or the instance's skill has no draft. A push of a changed skill writes one new live
20881
+ revision, whatever files changed, for a person's key with skill.publish and the
20882
+ config_assets:publish scope. Any other key, a release key among them, files a skill_change
20883
+ request instead: the push prints the request and that the live revision is unchanged, exits 3,
20884
+ and keeps the change in the working copy as not yet written. A push again names the same
20885
+ request. After the approval in the Inbox, 'catalyst config pull --only skill:<name>' records it.
20886
+
20852
20887
  An agent has its live revision and at most one draft, which every writer shares. A push of
20853
20888
  a changed agent writes that draft and names the draft revision the last pull or push saw: it
20854
20889
  is refused when somebody changed the draft since, naming who. 'catalyst agent publish <name>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@work-shape/catalyst-cli",
3
- "version": "0.8.0-rc.29",
3
+ "version": "0.8.0-rc.30",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,9 +40,9 @@
40
40
  "@types/node": "^24.13.1",
41
41
  "tsup": "^8.5.1",
42
42
  "typescript": "^6.0.3",
43
- "@work-shape/catalyst-api-client": "0.8.0-rc.29",
44
- "@work-shape/catalyst-api-contract": "0.8.0-rc.29",
45
- "@work-shape/catalyst-asset-schemas": "0.8.0-rc.29"
43
+ "@work-shape/catalyst-api-client": "0.8.0-rc.30",
44
+ "@work-shape/catalyst-api-contract": "0.8.0-rc.30",
45
+ "@work-shape/catalyst-asset-schemas": "0.8.0-rc.30"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsup",