@elevasis/sdk 1.46.0 → 1.47.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/cli.cjs CHANGED
@@ -25013,7 +25013,7 @@ var init_foundation = __esm({
25013
25013
  });
25014
25014
 
25015
25015
  // ../core/src/organization-model/catalogs/content.ts
25016
- var ContentPipelineStepActorSchema, ContentPipelineStepReviewModeSchema, ContentPayloadFieldTypeSchema, ContentPayloadFieldDeclarationSchema, ContentPipelineStepDeclarationSchema;
25016
+ var ContentPipelineStepActorSchema, ContentPipelineStepReviewModeSchema, ContentPayloadFieldTypeSchema, ContentPayloadFieldDeclarationSchema, ContentPipelineStepDeclarationSchema, ContentSourceAssetKindDeclarationSchema;
25017
25017
  var init_content = __esm({
25018
25018
  "../core/src/organization-model/catalogs/content.ts"() {
25019
25019
  "use strict";
@@ -25054,6 +25054,12 @@ var init_content = __esm({
25054
25054
  actionId: external_exports.string().trim().min(1).max(200).optional(),
25055
25055
  payloadFields: external_exports.array(ContentPayloadFieldDeclarationSchema).default([])
25056
25056
  });
25057
+ ContentSourceAssetKindDeclarationSchema = external_exports.object({
25058
+ label: external_exports.string().trim().min(1).max(160).optional(),
25059
+ description: external_exports.string().trim().min(1).max(2e3).optional(),
25060
+ /** D17: the template-declared serializable field list for this kind's payload. */
25061
+ payloadFields: external_exports.array(ContentPayloadFieldDeclarationSchema).default([])
25062
+ });
25057
25063
  }
25058
25064
  });
25059
25065
 
@@ -46716,7 +46722,7 @@ var init_permissions = __esm({
46716
46722
  },
46717
46723
  {
46718
46724
  key: "content.manage",
46719
- description: "Create, update, and delete content pipeline records (content_source_assets, content_items, content_item_attempts, content_distributions, artifacts)",
46725
+ description: "Create, update, and delete content pipeline records (content_source_assets, content_items, content_item_attempts, content_distributions)",
46720
46726
  isOrgGrantable: false
46721
46727
  }
46722
46728
  ];
@@ -47686,20 +47692,11 @@ var init_observability = __esm({
47686
47692
  });
47687
47693
 
47688
47694
  // ../core/src/operations/activities/types.ts
47695
+ var ACTIVITY_TYPES, ACTIVITY_STATUSES, ACTOR_TYPES;
47689
47696
  var init_types14 = __esm({
47690
47697
  "../core/src/operations/activities/types.ts"() {
47691
47698
  "use strict";
47692
- }
47693
- });
47694
-
47695
- // ../core/src/operations/activities/api-schemas.ts
47696
- var ActivityTypeSchema, ActivityStatusSchema, MetadataSchema, CreateActivitySchema, ActivityTrendQuerySchema, ListActivitiesQuerySchema;
47697
- var init_api_schemas3 = __esm({
47698
- "../core/src/operations/activities/api-schemas.ts"() {
47699
- "use strict";
47700
- init_zod();
47701
- init_validation();
47702
- ActivityTypeSchema = external_exports.enum([
47699
+ ACTIVITY_TYPES = [
47703
47700
  "workflow_execution",
47704
47701
  "agent_run",
47705
47702
  "hitl_action",
@@ -47712,8 +47709,22 @@ var init_api_schemas3 = __esm({
47712
47709
  "agent_access_grant_change",
47713
47710
  "deployment_change",
47714
47711
  "membership_change"
47715
- ]);
47716
- ActivityStatusSchema = external_exports.enum(["success", "failure", "pending", "approved", "rejected", "completed"]);
47712
+ ];
47713
+ ACTIVITY_STATUSES = ["success", "failure", "pending", "approved", "rejected", "completed"];
47714
+ ACTOR_TYPES = ["user", "system", "api_key"];
47715
+ }
47716
+ });
47717
+
47718
+ // ../core/src/operations/activities/api-schemas.ts
47719
+ var ActivityTypeSchema, ActivityStatusSchema, MetadataSchema, CreateActivitySchema, ActivityTrendQuerySchema, ListActivitiesQuerySchema;
47720
+ var init_api_schemas3 = __esm({
47721
+ "../core/src/operations/activities/api-schemas.ts"() {
47722
+ "use strict";
47723
+ init_zod();
47724
+ init_validation();
47725
+ init_types14();
47726
+ ActivityTypeSchema = external_exports.enum(ACTIVITY_TYPES);
47727
+ ActivityStatusSchema = external_exports.enum(ACTIVITY_STATUSES);
47717
47728
  MetadataSchema = external_exports.record(external_exports.string(), external_exports.unknown()).refine((val) => JSON.stringify(val).length <= 5e4, "Metadata exceeds 50KB limit").optional();
47718
47729
  CreateActivitySchema = external_exports.object({
47719
47730
  activityType: ActivityTypeSchema,
@@ -47726,8 +47737,11 @@ var init_api_schemas3 = __esm({
47726
47737
  metadata: MetadataSchema,
47727
47738
  occurredAt: external_exports.string().datetime().optional(),
47728
47739
  actorId: external_exports.string().uuid().optional(),
47729
- actorType: external_exports.enum(["user", "system", "api_key"]).optional()
47740
+ actorType: external_exports.enum(ACTOR_TYPES).optional()
47730
47741
  // NO organizationId (always from JWT/API key context)
47742
+ // NO actorApiKeyId — an API-key actor is always server-derived from the authenticated
47743
+ // key (request.apiKeyContext), never caller-asserted. Accepting it here would let any
47744
+ // caller stamp an arbitrary key as the actor.
47731
47745
  }).strict();
47732
47746
  ActivityTrendQuerySchema = external_exports.object({
47733
47747
  activityType: ActivityTypeSchema.optional(),
@@ -48823,7 +48837,7 @@ var init_package = __esm({
48823
48837
  "package.json"() {
48824
48838
  package_default = {
48825
48839
  name: "@elevasis/sdk",
48826
- version: "1.46.0",
48840
+ version: "1.47.0",
48827
48841
  description: "SDK for building Elevasis organization resources",
48828
48842
  type: "module",
48829
48843
  bin: {
@@ -55781,6 +55795,489 @@ function registerClientCommands(program3) {
55781
55795
  registerClientDelete(program3);
55782
55796
  }
55783
55797
 
55798
+ // src/cli/commands/content/list.ts
55799
+ init_source();
55800
+ init_api_client();
55801
+ init_config2();
55802
+ init_wrap_action();
55803
+ function appendQuery4(params, key, value) {
55804
+ if (value === void 0 || value === null || value === "") return;
55805
+ params.set(key, String(value));
55806
+ }
55807
+ function registerContentList(program3) {
55808
+ program3.command("content:list").description(
55809
+ "List content pipeline items\n Example: elevasis-sdk content:list --status queued --pipeline-id short-form-repurpose"
55810
+ ).option("--status <status>", "Filter by content item status").option("--pillar <pillar>", "Filter by content pillar").option("--pipeline-id <id>", "Filter by pipeline template id").option("--client-id <id>", "Filter by client id").option("--reviewed-by <id>", "Filter by reviewer user id").option("--search <query>", "Search by title").option("--limit <n>", "Maximum number of results").option("--offset <n>", "Pagination offset").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
55811
+ wrapAction("content:list", async (options) => {
55812
+ const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
55813
+ const params = new URLSearchParams();
55814
+ appendQuery4(params, "status", options.status);
55815
+ appendQuery4(params, "pillar", options.pillar);
55816
+ appendQuery4(params, "pipelineId", options.pipelineId);
55817
+ appendQuery4(params, "clientId", options.clientId);
55818
+ appendQuery4(params, "reviewedBy", options.reviewedBy);
55819
+ appendQuery4(params, "search", options.search);
55820
+ appendQuery4(params, "limit", options.limit);
55821
+ appendQuery4(params, "offset", options.offset);
55822
+ const query = params.toString();
55823
+ const endpoint = query ? `/api/external/content/items?${query}` : "/api/external/content/items";
55824
+ const result = await apiGet(endpoint, apiUrl);
55825
+ if (!options.pretty) {
55826
+ console.log(JSON.stringify(result, null, 2));
55827
+ return;
55828
+ }
55829
+ if (result.data.length === 0) {
55830
+ console.log(source_default.yellow("No content items found."));
55831
+ return;
55832
+ }
55833
+ console.log(source_default.cyan(`
55834
+ Content items (${result.data.length} of ${result.total}):
55835
+ `));
55836
+ for (const item of result.data) {
55837
+ console.log(` ${source_default.bold(item.title)} ${source_default.gray(item.status)}`);
55838
+ console.log(source_default.gray(` ID: ${item.id}`));
55839
+ if (item.pipelineId) console.log(source_default.gray(` Pipeline: ${item.pipelineId}`));
55840
+ if (item.pillar) console.log(source_default.gray(` Pillar: ${item.pillar}`));
55841
+ }
55842
+ console.log();
55843
+ })
55844
+ );
55845
+ }
55846
+
55847
+ // src/cli/commands/content/get.ts
55848
+ init_source();
55849
+ init_api_client();
55850
+ init_config2();
55851
+ init_wrap_action();
55852
+ function registerContentGet(program3) {
55853
+ program3.command("content:get <itemId>").description(
55854
+ "Get a content item, its attempts, and its distributions in one call\n Example: elevasis-sdk content:get <uuid>"
55855
+ ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
55856
+ wrapAction("content:get", async (itemId, options) => {
55857
+ const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
55858
+ const result = await apiGet(`/api/external/content/items/${itemId}`, apiUrl);
55859
+ if (!options.pretty) {
55860
+ console.log(JSON.stringify(result, null, 2));
55861
+ return;
55862
+ }
55863
+ const { item, attempts, distributions } = result;
55864
+ console.log(source_default.cyan(`
55865
+ Content item: ${item.title}`));
55866
+ console.log(source_default.gray(` ID: ${item.id}`));
55867
+ console.log(source_default.gray(` Status: ${item.status}`));
55868
+ if (item.pipelineId) console.log(source_default.gray(` Pipeline: ${item.pipelineId}`));
55869
+ console.log(source_default.gray(` Attempts (${attempts.length}):`));
55870
+ for (const attempt of attempts) {
55871
+ const execution = attempt.sourceExecutionId ? ` execution=${attempt.sourceExecutionId}` : "";
55872
+ console.log(source_default.gray(` - ${attempt.stepKey ?? "(no step)"}: ${attempt.status}${execution}`));
55873
+ }
55874
+ console.log(source_default.gray(` Distributions (${distributions.length}):`));
55875
+ for (const distribution of distributions) {
55876
+ console.log(source_default.gray(` - ${distribution.platform}/${distribution.format}: ${distribution.status}`));
55877
+ }
55878
+ console.log();
55879
+ })
55880
+ );
55881
+ }
55882
+
55883
+ // src/cli/commands/content/board.ts
55884
+ init_source();
55885
+
55886
+ // ../core/src/content/derive-board.ts
55887
+ function sortPipelineSteps(steps) {
55888
+ return [...steps].sort((a, b) => {
55889
+ if (a.order !== b.order) return a.order - b.order;
55890
+ return a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
55891
+ });
55892
+ }
55893
+ function deriveItemPlacement(processingState, sortedSteps) {
55894
+ const stateKeys = Object.keys(processingState);
55895
+ if (stateKeys.length > 0) {
55896
+ const catalogKeys = new Set(sortedSteps.map((step) => step.key));
55897
+ const hasKnownKey = stateKeys.some((key) => catalogKeys.has(key));
55898
+ if (!hasKnownKey) {
55899
+ return { bucket: "unplaced", stepKey: null };
55900
+ }
55901
+ }
55902
+ const currentStep = sortedSteps.find((step) => {
55903
+ const entry = processingState[step.key];
55904
+ return !entry || entry.status !== "success";
55905
+ });
55906
+ if (!currentStep) {
55907
+ return { bucket: "done", stepKey: null };
55908
+ }
55909
+ return { bucket: "column", stepKey: currentStep.key };
55910
+ }
55911
+ function deriveAwaitingReview(step, item) {
55912
+ if (!step) return false;
55913
+ return step.reviewMode !== "none" && item.reviewedAt === null;
55914
+ }
55915
+ function deriveContentBoard(items, pipeline, now) {
55916
+ const sortedSteps = sortPipelineSteps(pipeline.steps);
55917
+ const stepsByKey = new Map(sortedSteps.map((step) => [step.key, step]));
55918
+ const cardsByStepKey = /* @__PURE__ */ new Map();
55919
+ const done = [];
55920
+ const unplaced = [];
55921
+ for (const item of items) {
55922
+ const placement = deriveItemPlacement(item.processingState, sortedSteps);
55923
+ const step = placement.stepKey ? stepsByKey.get(placement.stepKey) : void 0;
55924
+ const card = {
55925
+ item,
55926
+ stepKey: placement.stepKey,
55927
+ ageMs: now - Date.parse(item.updatedAt),
55928
+ awaitingReview: deriveAwaitingReview(step, item)
55929
+ };
55930
+ if (placement.bucket === "done") {
55931
+ done.push(card);
55932
+ } else if (placement.bucket === "unplaced") {
55933
+ unplaced.push(card);
55934
+ } else if (placement.stepKey) {
55935
+ const existing = cardsByStepKey.get(placement.stepKey);
55936
+ if (existing) {
55937
+ existing.push(card);
55938
+ } else {
55939
+ cardsByStepKey.set(placement.stepKey, [card]);
55940
+ }
55941
+ }
55942
+ }
55943
+ const byAgeDescending = (a, b) => b.ageMs - a.ageMs;
55944
+ for (const cards of cardsByStepKey.values()) {
55945
+ cards.sort(byAgeDescending);
55946
+ }
55947
+ done.sort(byAgeDescending);
55948
+ unplaced.sort(byAgeDescending);
55949
+ const columns = sortedSteps.map((step) => {
55950
+ const cards = cardsByStepKey.get(step.key) ?? [];
55951
+ const column = { step, cards };
55952
+ if (step.reviewMode === "live" || step.reviewMode === "queued") {
55953
+ column.gate = {
55954
+ reviewMode: step.reviewMode,
55955
+ waitingCount: cards.filter((card) => card.awaitingReview).length
55956
+ };
55957
+ }
55958
+ return column;
55959
+ });
55960
+ return {
55961
+ columns,
55962
+ done,
55963
+ unplaced,
55964
+ isCollapsed: pipeline.steps.length <= 1
55965
+ };
55966
+ }
55967
+
55968
+ // ../core/src/content/item-identity.ts
55969
+ function getContentItemIdentity(item, payloadFields, maxLength = 80) {
55970
+ const candidate = resolveIdentityCandidate(item, payloadFields);
55971
+ return normalizeIdentity(candidate, maxLength);
55972
+ }
55973
+ function resolveIdentityCandidate(item, payloadFields) {
55974
+ const firstBodyLine = getFirstNonBlankLine(item.body);
55975
+ if (firstBodyLine) return firstBodyLine;
55976
+ const payloadField = getFirstStringPayloadValue(item.payload, payloadFields);
55977
+ if (payloadField) return payloadField;
55978
+ if (isNonBlank(item.title)) return item.title;
55979
+ return "Untitled";
55980
+ }
55981
+ function getFirstNonBlankLine(text) {
55982
+ if (!text) return void 0;
55983
+ for (const line of text.split("\n")) {
55984
+ if (isNonBlank(line)) return line.trim();
55985
+ }
55986
+ return void 0;
55987
+ }
55988
+ function getFirstStringPayloadValue(payload, payloadFields) {
55989
+ if (typeof payload !== "object" || payload === null || Array.isArray(payload)) return void 0;
55990
+ const record2 = payload;
55991
+ const keys = payloadFields && payloadFields.length > 0 ? payloadFields.map((field2) => field2.key) : Object.keys(record2);
55992
+ for (const key of keys) {
55993
+ const value = record2[key];
55994
+ if (typeof value === "string" && isNonBlank(value)) return value;
55995
+ }
55996
+ return void 0;
55997
+ }
55998
+ function isNonBlank(value) {
55999
+ return value.trim().length > 0;
56000
+ }
56001
+ function normalizeIdentity(candidate, maxLength) {
56002
+ const collapsed = candidate.replace(/\s+/g, " ").trim();
56003
+ if (collapsed.length <= maxLength) return collapsed;
56004
+ const truncated = collapsed.slice(0, maxLength);
56005
+ const lastSpace = truncated.lastIndexOf(" ");
56006
+ const cut = lastSpace > 0 ? truncated.slice(0, lastSpace) : truncated;
56007
+ return `${cut}\u2026`;
56008
+ }
56009
+
56010
+ // src/cli/commands/content/board.ts
56011
+ init_api_client();
56012
+ init_config2();
56013
+ init_wrap_action();
56014
+ var DEFAULT_ITEM_LIMIT = 100;
56015
+ function formatAge(ageMs) {
56016
+ if (!Number.isFinite(ageMs) || ageMs < 0) return "--";
56017
+ const minutes = Math.floor(ageMs / 6e4);
56018
+ if (minutes < 60) return `${minutes}m`;
56019
+ const hours = Math.floor(minutes / 60);
56020
+ if (hours < 24) return `${hours}h`;
56021
+ const days = Math.floor(hours / 24);
56022
+ return `${days}d ${hours % 24}h`;
56023
+ }
56024
+ function printCards(cards, stepsByKey) {
56025
+ if (cards.length === 0) {
56026
+ console.log(source_default.gray(" (empty)"));
56027
+ return;
56028
+ }
56029
+ for (const card of cards) {
56030
+ const payloadFields = card.stepKey ? stepsByKey.get(card.stepKey)?.payloadFields : void 0;
56031
+ const identity = getContentItemIdentity(card.item, payloadFields);
56032
+ const age = source_default.gray(formatAge(card.ageMs));
56033
+ const waiting = card.awaitingReview ? source_default.yellow(" [awaiting review]") : "";
56034
+ console.log(` ${identity}${waiting} ${age}`);
56035
+ console.log(source_default.gray(` ${card.item.id}`));
56036
+ }
56037
+ }
56038
+ function registerContentBoard(program3) {
56039
+ program3.command("content:board <pipelineId>").description(
56040
+ "Render one pipeline as a board -- columns, review gates, and waiting counts\n Example: elevasis-sdk content:board short-form-repurpose --pretty"
56041
+ ).option("--limit <n>", `Items to pull before deriving (default and API maximum ${DEFAULT_ITEM_LIMIT})`).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56042
+ wrapAction("content:board", async (pipelineId, options) => {
56043
+ const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56044
+ const limit = options.limit ?? String(DEFAULT_ITEM_LIMIT);
56045
+ const pipeline = await apiGet(`/api/external/content/pipelines/${pipelineId}`, apiUrl);
56046
+ const params = new URLSearchParams({ pipelineId, limit });
56047
+ const items = await apiGet(`/api/external/content/items?${params.toString()}`, apiUrl);
56048
+ const board = deriveContentBoard(items.data, pipeline, Date.now());
56049
+ const stepsByKey = new Map(pipeline.steps.map((step) => [step.key, step]));
56050
+ const truncated = items.total > items.data.length;
56051
+ if (!options.pretty) {
56052
+ console.log(JSON.stringify({ pipelineId, total: items.total, truncated, board }, null, 2));
56053
+ return;
56054
+ }
56055
+ console.log(
56056
+ source_default.cyan(`
56057
+ Board: ${pipelineId} ${source_default.gray(`${items.data.length} of ${items.total} item(s)`)}`)
56058
+ );
56059
+ if (truncated) {
56060
+ console.log(
56061
+ source_default.yellow(
56062
+ ` Showing ${items.data.length} of ${items.total} items -- this board is PARTIAL. ${DEFAULT_ITEM_LIMIT} is the API's page ceiling, so the rest are not on it. Narrow with content:list, or read the remainder with content:list --offset.`
56063
+ )
56064
+ );
56065
+ }
56066
+ if (board.isCollapsed) {
56067
+ console.log(source_default.gray(" This pipeline declares 0 or 1 steps, so it has no columns to speak of."));
56068
+ }
56069
+ console.log();
56070
+ for (const column of board.columns) {
56071
+ const gate = column.gate ? source_default.yellow(` [${column.gate.reviewMode} gate -- ${column.gate.waitingCount} waiting]`) : "";
56072
+ console.log(` ${source_default.bold(column.step.label)} ${source_default.gray(column.step.key)}${gate}`);
56073
+ printCards(column.cards, stepsByKey);
56074
+ }
56075
+ console.log(`
56076
+ ${source_default.bold("Done")} ${source_default.gray(`(${board.done.length})`)}`);
56077
+ printCards(board.done, stepsByKey);
56078
+ if (board.unplaced.length > 0) {
56079
+ console.log(
56080
+ `
56081
+ ${source_default.bold("Unplaced")} ${source_default.gray(`(${board.unplaced.length}) -- processingState names no step this pipeline declares`)}`
56082
+ );
56083
+ printCards(board.unplaced, stepsByKey);
56084
+ }
56085
+ console.log();
56086
+ })
56087
+ );
56088
+ }
56089
+
56090
+ // src/cli/commands/content/queue.ts
56091
+ init_source();
56092
+ init_api_client();
56093
+ init_config2();
56094
+ init_wrap_action();
56095
+ function registerContentQueue(program3) {
56096
+ program3.command("content:queue").description("List content items awaiting a `queued`-gate review\n Example: elevasis-sdk content:queue --pretty").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56097
+ wrapAction("content:queue", async (options) => {
56098
+ const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56099
+ const result = await apiGet("/api/external/content/queue", apiUrl);
56100
+ if (!options.pretty) {
56101
+ console.log(JSON.stringify(result, null, 2));
56102
+ return;
56103
+ }
56104
+ if (result.data.length === 0) {
56105
+ console.log(source_default.yellow("No content items are awaiting review."));
56106
+ return;
56107
+ }
56108
+ console.log(source_default.cyan(`
56109
+ Queued for review (${result.data.length}):
56110
+ `));
56111
+ for (const entry of result.data) {
56112
+ console.log(` ${source_default.bold(entry.item.title)} ${source_default.gray(entry.stepKey)}`);
56113
+ console.log(source_default.gray(` Item ID: ${entry.item.id}`));
56114
+ console.log(source_default.gray(` Attempt ID: ${entry.attemptId}`));
56115
+ console.log(source_default.gray(` Attempted: ${entry.attemptedAt}`));
56116
+ }
56117
+ console.log();
56118
+ })
56119
+ );
56120
+ }
56121
+
56122
+ // src/cli/commands/content/pipeline.ts
56123
+ init_source();
56124
+ init_api_client();
56125
+ init_config2();
56126
+ init_wrap_action();
56127
+ function printPipelineSummary(pipeline) {
56128
+ console.log(source_default.cyan(`
56129
+ Pipeline: ${pipeline.id}`));
56130
+ const steps = Array.isArray(pipeline.steps) ? pipeline.steps : [];
56131
+ console.log(source_default.gray(` Steps (${steps.length}):`));
56132
+ for (const step of steps) {
56133
+ console.log(source_default.gray(` - ${step.key} (reviewMode: ${step.reviewMode})`));
56134
+ }
56135
+ console.log();
56136
+ }
56137
+ function registerContentPipeline(program3) {
56138
+ program3.command("content:pipeline [id]").description(
56139
+ "List content pipeline templates, or show one pipeline's step contract\n Example: elevasis-sdk content:pipeline short-form-repurpose"
56140
+ ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56141
+ wrapAction("content:pipeline", async (id, options) => {
56142
+ const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56143
+ if (!id) {
56144
+ const result = await apiGet("/api/external/content/pipelines", apiUrl);
56145
+ if (!options.pretty) {
56146
+ console.log(JSON.stringify(result, null, 2));
56147
+ return;
56148
+ }
56149
+ if (result.data.length === 0) {
56150
+ console.log(source_default.yellow("No content pipelines found."));
56151
+ return;
56152
+ }
56153
+ console.log(source_default.cyan(`
56154
+ Content pipelines (${result.data.length}):
56155
+ `));
56156
+ for (const pipeline2 of result.data) {
56157
+ const steps = Array.isArray(pipeline2.steps) ? pipeline2.steps : [];
56158
+ console.log(` ${source_default.bold(pipeline2.id)} ${source_default.gray(`${steps.length} step(s)`)}`);
56159
+ }
56160
+ console.log();
56161
+ return;
56162
+ }
56163
+ const pipeline = await apiGet(`/api/external/content/pipelines/${id}`, apiUrl);
56164
+ if (!options.pretty) {
56165
+ console.log(JSON.stringify(pipeline, null, 2));
56166
+ return;
56167
+ }
56168
+ printPipelineSummary(pipeline);
56169
+ })
56170
+ );
56171
+ }
56172
+
56173
+ // src/cli/commands/content/distributions.ts
56174
+ init_source();
56175
+ init_api_client();
56176
+ init_config2();
56177
+ init_wrap_action();
56178
+ function appendQuery5(params, key, value) {
56179
+ if (value === void 0 || value === null || value === "") return;
56180
+ params.set(key, String(value));
56181
+ }
56182
+ function registerContentDistributions(program3) {
56183
+ program3.command("content:distributions").description(
56184
+ "List content distributions\n Example: elevasis-sdk content:distributions --pipeline-id short-form-repurpose"
56185
+ ).option("--content-item-id <id>", "Filter by content item id").option("--pipeline-id <id>", "Filter by pipeline template id").option("--platform <platform>", "Filter by distribution platform").option("--status <status>", "Filter by distribution status").option("--limit <n>", "Maximum number of results").option("--offset <n>", "Pagination offset").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56186
+ wrapAction("content:distributions", async (options) => {
56187
+ const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56188
+ const params = new URLSearchParams();
56189
+ appendQuery5(params, "contentItemId", options.contentItemId);
56190
+ appendQuery5(params, "pipelineId", options.pipelineId);
56191
+ appendQuery5(params, "platform", options.platform);
56192
+ appendQuery5(params, "status", options.status);
56193
+ appendQuery5(params, "limit", options.limit);
56194
+ appendQuery5(params, "offset", options.offset);
56195
+ const query = params.toString();
56196
+ const endpoint = query ? `/api/external/content/distributions?${query}` : "/api/external/content/distributions";
56197
+ const result = await apiGet(endpoint, apiUrl);
56198
+ if (!options.pretty) {
56199
+ console.log(JSON.stringify(result, null, 2));
56200
+ return;
56201
+ }
56202
+ if (result.data.length === 0) {
56203
+ console.log(source_default.yellow("No content distributions found."));
56204
+ return;
56205
+ }
56206
+ console.log(source_default.cyan(`
56207
+ Content distributions (${result.data.length}):
56208
+ `));
56209
+ for (const distribution of result.data) {
56210
+ console.log(
56211
+ ` ${source_default.bold(`${distribution.platform}/${distribution.format}`)} ${source_default.gray(distribution.status)}`
56212
+ );
56213
+ console.log(source_default.gray(` ID: ${distribution.id}`));
56214
+ console.log(source_default.gray(` Item ID: ${distribution.contentItemId}`));
56215
+ }
56216
+ console.log();
56217
+ })
56218
+ );
56219
+ }
56220
+
56221
+ // src/cli/commands/content/review.ts
56222
+ init_source();
56223
+ init_api_client();
56224
+ init_config2();
56225
+ init_wrap_action();
56226
+ function registerContentReview(program3) {
56227
+ program3.command("content:review <itemId>").description(
56228
+ "Clear a queued review gate on a content item\n Example: elevasis-sdk content:review <uuid> --step draft-review --approve --user reviewer@example.com"
56229
+ ).requiredOption("--step <key>", "The stepKey of the queued gate to clear (from `content:queue`)").requiredOption(
56230
+ "--user <email>",
56231
+ "The acting reviewer\u2019s email -- must be an active member of the API key\u2019s organization"
56232
+ ).option("--approve", "Approve the item at this step").option("--reject", "Reject the item at this step (requires --reason)").option("--feedback <text>", "Optional reviewer feedback (1..5000 chars)").option("--reason <text>", "Reason for rejection -- required when --reject is set").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56233
+ wrapAction("content:review", async (itemId, options) => {
56234
+ if (options.approve && options.reject) {
56235
+ throw new Error("Pass exactly one of --approve or --reject, not both");
56236
+ }
56237
+ if (!options.approve && !options.reject) {
56238
+ throw new Error("Pass one of --approve or --reject");
56239
+ }
56240
+ if (options.reject && !options.reason) {
56241
+ throw new Error("--reject requires --reason");
56242
+ }
56243
+ const decision = options.approve ? "approved" : "rejected";
56244
+ const body = {
56245
+ user_email: options.user,
56246
+ stepKey: options.step,
56247
+ decision
56248
+ };
56249
+ if (options.feedback !== void 0) body.reviewerFeedback = options.feedback;
56250
+ if (options.reject) body.rejectReason = options.reason;
56251
+ const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56252
+ const result = await apiPost(
56253
+ `/api/external/content/items/${itemId}/review`,
56254
+ body,
56255
+ apiUrl
56256
+ );
56257
+ if (!options.pretty) {
56258
+ console.log(JSON.stringify(result, null, 2));
56259
+ return;
56260
+ }
56261
+ const verb = decision === "approved" ? source_default.green("approved") : source_default.red("rejected");
56262
+ console.log(source_default.cyan(`
56263
+ Content item ${itemId} ${verb} at step ${options.step}`));
56264
+ if (result.item?.status) console.log(source_default.gray(` Status: ${result.item.status}`));
56265
+ console.log();
56266
+ })
56267
+ );
56268
+ }
56269
+
56270
+ // src/cli/commands/content/index.ts
56271
+ function registerContentCommands(program3) {
56272
+ registerContentList(program3);
56273
+ registerContentGet(program3);
56274
+ registerContentBoard(program3);
56275
+ registerContentQueue(program3);
56276
+ registerContentPipeline(program3);
56277
+ registerContentDistributions(program3);
56278
+ registerContentReview(program3);
56279
+ }
56280
+
55784
56281
  // src/cli/commands/queue/queue.ts
55785
56282
  init_source();
55786
56283
  init_api_client();
@@ -55789,7 +56286,7 @@ init_wrap_action();
55789
56286
  function printJson8(value) {
55790
56287
  console.log(JSON.stringify(value, null, 2));
55791
56288
  }
55792
- function appendQuery4(params, key, value) {
56289
+ function appendQuery6(params, key, value) {
55793
56290
  if (value === void 0 || value === null || value === "") return;
55794
56291
  params.set(key, String(value));
55795
56292
  }
@@ -55815,13 +56312,13 @@ function registerQueueList(program3) {
55815
56312
  async (options) => {
55816
56313
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
55817
56314
  const params = new URLSearchParams();
55818
- appendQuery4(params, "status", options.status);
55819
- appendQuery4(params, "humanCheckpoint", options.humanCheckpoint);
55820
- appendQuery4(params, "timeRange", options.timeRange);
55821
- appendQuery4(params, "priorityMin", options.priorityMin);
55822
- appendQuery4(params, "priorityMax", options.priorityMax);
55823
- appendQuery4(params, "limit", options.limit);
55824
- appendQuery4(params, "offset", options.offset);
56315
+ appendQuery6(params, "status", options.status);
56316
+ appendQuery6(params, "humanCheckpoint", options.humanCheckpoint);
56317
+ appendQuery6(params, "timeRange", options.timeRange);
56318
+ appendQuery6(params, "priorityMin", options.priorityMin);
56319
+ appendQuery6(params, "priorityMax", options.priorityMax);
56320
+ appendQuery6(params, "limit", options.limit);
56321
+ appendQuery6(params, "offset", options.offset);
55825
56322
  const result = await apiGet(
55826
56323
  endpointWithQuery4("/api/external/command-queue", params),
55827
56324
  apiUrl
@@ -55926,10 +56423,10 @@ function registerQueueStatus(program3) {
55926
56423
  async (options) => {
55927
56424
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
55928
56425
  const params = new URLSearchParams();
55929
- appendQuery4(params, "timeRange", options.timeRange);
55930
- appendQuery4(params, "priorityMin", options.priorityMin);
55931
- appendQuery4(params, "priorityMax", options.priorityMax);
55932
- appendQuery4(params, "status", options.status);
56426
+ appendQuery6(params, "timeRange", options.timeRange);
56427
+ appendQuery6(params, "priorityMin", options.priorityMin);
56428
+ appendQuery6(params, "priorityMax", options.priorityMax);
56429
+ appendQuery6(params, "status", options.status);
55933
56430
  const result = await apiGet(
55934
56431
  endpointWithQuery4("/api/external/command-queue/checkpoints", params),
55935
56432
  apiUrl
@@ -55978,7 +56475,7 @@ init_wrap_action();
55978
56475
  function printJson9(value) {
55979
56476
  console.log(JSON.stringify(value, null, 2));
55980
56477
  }
55981
- function appendQuery5(params, key, value) {
56478
+ function appendQuery7(params, key, value) {
55982
56479
  if (value === void 0 || value === null || value === "") return;
55983
56480
  params.set(key, String(value));
55984
56481
  }
@@ -56007,11 +56504,11 @@ function registerScheduleList(program3) {
56007
56504
  async (options) => {
56008
56505
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56009
56506
  const params = new URLSearchParams();
56010
- appendQuery5(params, "status", options.status);
56011
- appendQuery5(params, "targetResourceType", options.targetResourceType);
56012
- appendQuery5(params, "targetResourceId", options.targetResourceId);
56013
- appendQuery5(params, "limit", options.limit);
56014
- appendQuery5(params, "offset", options.offset);
56507
+ appendQuery7(params, "status", options.status);
56508
+ appendQuery7(params, "targetResourceType", options.targetResourceType);
56509
+ appendQuery7(params, "targetResourceId", options.targetResourceId);
56510
+ appendQuery7(params, "limit", options.limit);
56511
+ appendQuery7(params, "offset", options.offset);
56015
56512
  const result = await apiGet(
56016
56513
  endpointWithQuery5("/api/external/task-scheduler/schedules", params),
56017
56514
  apiUrl
@@ -56211,7 +56708,7 @@ var PRIORITY_HELP = "low | normal | high | urgent";
56211
56708
  function registerNoteCreate2(program3) {
56212
56709
  program3.command("note:create").description(
56213
56710
  'Create a personal note for a user\n Example: elevasis-sdk note:create --content "Deal X stalled" --user agent@example.com'
56214
- ).requiredOption("--content <text>", "Note content").option("--user <email>", "Target user email (default: API key owner)").option("--title <text>", "Optional note title").option("--priority <priority>", `Priority: ${PRIORITY_HELP}`).option("--pinned", "Pin the note to the top of the panel").option("--source <id>", "Source identifier (e.g. workflow or agent ID)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56711
+ ).requiredOption("--content <text>", "Note content").option("--user <email>", "Target user email (required -- the API rejects the call without it)").option("--title <text>", "Optional note title").option("--priority <priority>", `Priority: ${PRIORITY_HELP}`).option("--pinned", "Pin the note to the top of the panel").option("--source <id>", "Source identifier (e.g. workflow or agent ID)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56215
56712
  wrapAction(
56216
56713
  "note:create",
56217
56714
  async (options) => {
@@ -56367,7 +56864,7 @@ init_wrap_action();
56367
56864
  function printJson11(value) {
56368
56865
  console.log(JSON.stringify(value, null, 2));
56369
56866
  }
56370
- function appendQuery6(params, key, value) {
56867
+ function appendQuery8(params, key, value) {
56371
56868
  if (value === void 0 || value === null || value === "") return;
56372
56869
  params.set(key, String(value));
56373
56870
  }
@@ -56401,8 +56898,8 @@ function resolveTurnInput(options) {
56401
56898
  }
56402
56899
  function messagesEndpoint(sessionId, limit, cursor) {
56403
56900
  const params = new URLSearchParams();
56404
- appendQuery6(params, "limit", limit);
56405
- appendQuery6(params, "cursor", cursor);
56901
+ appendQuery8(params, "limit", limit);
56902
+ appendQuery8(params, "cursor", cursor);
56406
56903
  return endpointWithQuery6(`/api/external/sessions/${sessionId}/messages`, params);
56407
56904
  }
56408
56905
  async function fetchSessionMessages(sessionId, apiUrl, options) {
@@ -56487,9 +56984,9 @@ function registerSessionList(program3) {
56487
56984
  wrapAction("session:list", async (options) => {
56488
56985
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56489
56986
  const params = new URLSearchParams();
56490
- appendQuery6(params, "resourceId", options.resourceId);
56491
- appendQuery6(params, "userId", options.userId);
56492
- appendQuery6(params, "limit", options.limit);
56987
+ appendQuery8(params, "resourceId", options.resourceId);
56988
+ appendQuery8(params, "userId", options.userId);
56989
+ appendQuery8(params, "limit", options.limit);
56493
56990
  const result = await apiGet(endpointWithQuery6("/api/external/sessions", params), apiUrl);
56494
56991
  if (options.json) {
56495
56992
  printJson11(result);
@@ -56624,7 +57121,7 @@ init_wrap_action();
56624
57121
  function printJson12(value) {
56625
57122
  console.log(JSON.stringify(value, null, 2));
56626
57123
  }
56627
- function appendQuery7(params, key, value) {
57124
+ function appendQuery9(params, key, value) {
56628
57125
  if (value === void 0 || value === null || value === "" || value === false) return;
56629
57126
  params.set(key, String(value));
56630
57127
  }
@@ -56689,8 +57186,8 @@ function registerGrantList(program3) {
56689
57186
  wrapAction("grant:list", async (options) => {
56690
57187
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56691
57188
  const params = new URLSearchParams();
56692
- appendQuery7(params, "resourceId", options.resourceId);
56693
- appendQuery7(params, "includeDisabled", options.includeDisabled ? "true" : void 0);
57189
+ appendQuery9(params, "resourceId", options.resourceId);
57190
+ appendQuery9(params, "includeDisabled", options.includeDisabled ? "true" : void 0);
56694
57191
  const result = await apiGet(
56695
57192
  endpointWithQuery7("/api/external/agent-access-grants", params),
56696
57193
  apiUrl
@@ -58034,6 +58531,13 @@ Commands:
58034
58531
  elevasis-sdk client:list [--search <query>] List clients with optional search
58035
58532
  elevasis-sdk client:get <id> Get client detail and lineage
58036
58533
  elevasis-sdk client:status Show client portfolio status
58534
+ elevasis-sdk content:list [--status queued] List content pipeline items
58535
+ elevasis-sdk content:get <itemId> Get an item, its attempts, and distributions
58536
+ elevasis-sdk content:queue List items awaiting a queued-gate review
58537
+ elevasis-sdk content:pipeline [id] List pipeline templates, or one step contract
58538
+ elevasis-sdk content:distributions List content distributions
58539
+ elevasis-sdk content:review <itemId> --step <key> --approve|--reject --user <email>
58540
+ Clear a queued review gate on a content item
58037
58541
  elevasis-sdk queue:list [--status pending] List HITL command queue tasks
58038
58542
  elevasis-sdk queue:select <id> --action-id <id> Select and execute a HITL queue action
58039
58543
  elevasis-sdk schedule:list [--status active] List task schedules
@@ -58084,6 +58588,7 @@ registerErrorCommand(program2);
58084
58588
  registerRenameCommand(program2);
58085
58589
  registerProjectCommands(program2);
58086
58590
  registerClientCommands(program2);
58591
+ registerContentCommands(program2);
58087
58592
  registerQueueCommands(program2);
58088
58593
  registerScheduleCommands(program2);
58089
58594
  registerAgentCommands(program2);