@erdoai/cli 0.164.0 → 0.165.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.
Files changed (2) hide show
  1. package/dist/index.js +37 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -986,6 +986,20 @@ var ErdoClient = class {
986
986
  `/v1/workstreams/${encodeURIComponent(slug)}/ledger${qs}`
987
987
  );
988
988
  }
989
+ async readWorkstreamRecommendations(slug) {
990
+ const ledger = await this.request("GET", `/v1/workstreams/${encodeURIComponent(slug)}/ledger`);
991
+ if (!Array.isArray(ledger.recommendations) || !ledger.recommendation_review) {
992
+ throw new Error("This connection does not expose the Recommendations contract yet.");
993
+ }
994
+ return ledger;
995
+ }
996
+ manageWorkstreamRecommendations(slug, input) {
997
+ return this.request(
998
+ "POST",
999
+ `/v1/workstreams/${encodeURIComponent(slug)}/recommendations`,
1000
+ input
1001
+ );
1002
+ }
989
1003
  attachWorkstreamResource(slug, input) {
990
1004
  return this.request(
991
1005
  "POST",
@@ -1971,6 +1985,7 @@ var ErdoClient = class {
1971
1985
  listApprovals(opts) {
1972
1986
  const params = new URLSearchParams();
1973
1987
  if (opts.status) params.set("status", opts.status);
1988
+ if (opts.agent_run_id) params.set("agent_run_id", opts.agent_run_id);
1974
1989
  if (opts.limit) params.set("limit", String(opts.limit));
1975
1990
  if (opts.workstream_slug) params.set("workstream_slug", opts.workstream_slug);
1976
1991
  if (opts.subject_resource_type) params.set("subject_resource_type", opts.subject_resource_type);
@@ -3733,6 +3748,26 @@ wsCmd.command("ledger <slug>").description(
3733
3748
  fail(e);
3734
3749
  }
3735
3750
  });
3751
+ wsCmd.command("recommendations <slug>").description("Read resolved recommendations and review state, or apply an exact JSON mutation").option("--input-file <path>", "JSON file containing the exact ManageRecommendationRequest body").action(async (slug, opts) => {
3752
+ try {
3753
+ const client = new ErdoClient();
3754
+ if (opts.inputFile) {
3755
+ const body = JSON.parse(readFileSync4(opts.inputFile, "utf8"));
3756
+ if (body === null || typeof body !== "object" || Array.isArray(body)) {
3757
+ throw new Error("--input-file must contain a JSON object");
3758
+ }
3759
+ print(await client.manageWorkstreamRecommendations(slug, body));
3760
+ return;
3761
+ }
3762
+ const ledger = await client.readWorkstreamRecommendations(slug);
3763
+ print({
3764
+ recommendations: ledger.recommendations,
3765
+ recommendation_review: ledger.recommendation_review
3766
+ });
3767
+ } catch (e) {
3768
+ fail(e);
3769
+ }
3770
+ });
3736
3771
  wsCmd.command("attach <slug>").description("Link a resource (page, dataset, heartbeat, experiment_run, \u2026) to a workstream").requiredOption("--type <resourceType>", "resource type (page, dataset, heartbeat, experiment_run, \u2026)").requiredOption("--id <resourceId>", "the resource's UUID").requiredOption("--rel <relationshipType>", "output | input | evidence | monitoring | subject | parent | child | running").option("--title <title>", "optional label for the link").option("--phase <phaseId>", "optional phase to attach under").action(
3737
3772
  async (slug, opts) => {
3738
3773
  try {
@@ -5192,11 +5227,12 @@ var approvalsCmd = program.command("approvals").description("List and decide app
5192
5227
  approvalsCmd.command("list").description("List approval requests, optionally filtered by status").option("-s, --status <status>", "pending | approved | rejected | expired (default: all)").option("-l, --limit <n>", "max requests", (v) => parseInt(v, 10)).option("--workstream <slug>", "only approvals for this workstream").option(
5193
5228
  "--subject-type <type>",
5194
5229
  "only approvals whose subject resource is of this type (e.g. paid_media_campaign)"
5195
- ).option("--subject-id <id>", "only approvals whose subject resource has this id").option("--json", "output raw JSON").action(
5230
+ ).option("--subject-id <id>", "only approvals whose subject resource has this id").option("--agent-run-id <uuid>", "only approvals for this agent run").option("--json", "output raw JSON").action(
5196
5231
  async (opts) => {
5197
5232
  try {
5198
5233
  const res = await new ErdoClient().listApprovals({
5199
5234
  status: opts.status,
5235
+ agent_run_id: opts.agentRunId,
5200
5236
  limit: opts.limit,
5201
5237
  workstream_slug: opts.workstream,
5202
5238
  subject_resource_type: opts.subjectType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.164.0",
3
+ "version": "0.165.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {