@settlemint/dalp-cli 3.1.32-main.42499448331 → 3.1.32-main.42524761245

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.
@@ -44829,14 +44829,15 @@
44829
44829
  "type": "string",
44830
44830
  "enum": [
44831
44831
  "admin",
44832
+ "agent",
44832
44833
  "participant",
44833
44834
  "system"
44834
44835
  ],
44835
44836
  "pattern": null,
44836
44837
  "examples": [
44837
44838
  "admin",
44838
- "participant",
44839
- "system"
44839
+ "agent",
44840
+ "participant"
44840
44841
  ],
44841
44842
  "fields": []
44842
44843
  },
@@ -45043,14 +45044,15 @@
45043
45044
  "type": "string",
45044
45045
  "enum": [
45045
45046
  "admin",
45047
+ "agent",
45046
45048
  "participant",
45047
45049
  "system"
45048
45050
  ],
45049
45051
  "pattern": null,
45050
45052
  "examples": [
45051
45053
  "admin",
45052
- "participant",
45053
- "system"
45054
+ "agent",
45055
+ "participant"
45054
45056
  ],
45055
45057
  "fields": []
45056
45058
  },
@@ -45184,14 +45186,15 @@
45184
45186
  "type": "string",
45185
45187
  "enum": [
45186
45188
  "admin",
45189
+ "agent",
45187
45190
  "participant",
45188
45191
  "system"
45189
45192
  ],
45190
45193
  "pattern": null,
45191
45194
  "examples": [
45192
45195
  "admin",
45193
- "participant",
45194
- "system"
45196
+ "agent",
45197
+ "participant"
45195
45198
  ],
45196
45199
  "fields": []
45197
45200
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@settlemint/dalp-cli",
3
- "version": "3.1.32-main.42499448331",
3
+ "version": "3.1.32-main.42524761245",
4
4
  "private": false,
5
5
  "description": "CLI for the Digital Asset Lifecycle Platform — manage tokens, identities, compliance, and more from the command line.",
6
6
  "homepage": "https://settlemint.com",
@@ -50,14 +50,14 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@modelcontextprotocol/server": "2.0.0-alpha.4",
53
- "@settlemint/dalp-sdk": "3.1.32-main.42499448331",
53
+ "@settlemint/dalp-sdk": "3.1.32-main.42524761245",
54
54
  "incur": "0.7.1",
55
55
  "zod": "4.6.7"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@arethetypeswrong/cli": "0.18.5",
59
- "@testkit/effect-bun-test": "3.1.32-main.42499448331",
60
- "@tools/typescript-config": "3.1.32-main.42499448331",
59
+ "@testkit/effect-bun-test": "3.1.32-main.42524761245",
60
+ "@tools/typescript-config": "3.1.32-main.42524761245",
61
61
  "@types/bun": "1.4.4",
62
62
  "publint": "0.3.25"
63
63
  },
@@ -8,6 +8,8 @@ import { runCommand } from "../lib/run-command.ts";
8
8
  import { promptSecret } from "../lib/secret-prompt.ts";
9
9
  import { CLI_USER_AGENT, cliVars } from "../lib/vars.ts";
10
10
 
11
+ const TRAILING_SLASHES_PATTERN = /\/+$/u;
12
+
11
13
  const deviceCodeSchema = z.object({
12
14
  device_code: z.string(),
13
15
  user_code: z.string(),
@@ -108,7 +110,7 @@ export function validateLoginBaseUrl(apiUrl: string): string {
108
110
  message: "DALP login URLs must not contain a query string or fragment.",
109
111
  });
110
112
  }
111
- return parsed.href.replace(/\/+$/u, "");
113
+ return parsed.href.replace(TRAILING_SLASHES_PATTERN, "");
112
114
  }
113
115
 
114
116
  async function readBoundedJson<T>(response: Response, schema: z.ZodType<T>): Promise<T> {
@@ -44829,14 +44829,15 @@
44829
44829
  "type": "string",
44830
44830
  "enum": [
44831
44831
  "admin",
44832
+ "agent",
44832
44833
  "participant",
44833
44834
  "system"
44834
44835
  ],
44835
44836
  "pattern": null,
44836
44837
  "examples": [
44837
44838
  "admin",
44838
- "participant",
44839
- "system"
44839
+ "agent",
44840
+ "participant"
44840
44841
  ],
44841
44842
  "fields": []
44842
44843
  },
@@ -45043,14 +45044,15 @@
45043
45044
  "type": "string",
45044
45045
  "enum": [
45045
45046
  "admin",
45047
+ "agent",
45046
45048
  "participant",
45047
45049
  "system"
45048
45050
  ],
45049
45051
  "pattern": null,
45050
45052
  "examples": [
45051
45053
  "admin",
45052
- "participant",
45053
- "system"
45054
+ "agent",
45055
+ "participant"
45054
45056
  ],
45055
45057
  "fields": []
45056
45058
  },
@@ -45184,14 +45186,15 @@
45184
45186
  "type": "string",
45185
45187
  "enum": [
45186
45188
  "admin",
45189
+ "agent",
45187
45190
  "participant",
45188
45191
  "system"
45189
45192
  ],
45190
45193
  "pattern": null,
45191
45194
  "examples": [
45192
45195
  "admin",
45193
- "participant",
45194
- "system"
45196
+ "agent",
45197
+ "participant"
45195
45198
  ],
45196
45199
  "fields": []
45197
45200
  },
package/src/hosted-mcp.ts CHANGED
@@ -31,6 +31,8 @@ export interface PrepareCall {
31
31
  readonly assetId: string;
32
32
  readonly fields: Readonly<Record<string, string>>;
33
33
  readonly execution: HostedExecutionMode;
34
+ readonly agentId: string | undefined;
35
+ readonly idempotencyKey: string | undefined;
34
36
  }
35
37
 
36
38
  export type PrepareOutcome =
@@ -73,13 +75,23 @@ const prepareCommand = (tool: PrepareTool) => ({
73
75
  assetId: z.string().describe("The asset the write acts on: its contract address."),
74
76
  ...Object.fromEntries(Object.entries(tool.fields).map(([name, field]) => [name, fieldOption(field)])),
75
77
  execution: executionOption,
78
+ agentId: z
79
+ .string()
80
+ .optional()
81
+ .describe("With execution mandate only: the agent principal that acts, its pp_ id from the Agents page."),
82
+ idempotencyKey: z
83
+ .string()
84
+ .optional()
85
+ .describe(
86
+ "Required with execution mandate: a key you choose for this write and send again, unchanged, on a retry, so the write never runs twice."
87
+ ),
76
88
  }),
77
89
  run: async (context: {
78
90
  readonly options: PrepareOptions;
79
91
  readonly var: { readonly prepare?: PrepareExecutor | undefined };
80
92
  readonly error: (error: { readonly code: string; readonly message: string }) => unknown;
81
93
  }) => {
82
- const { assetId, execution, ...rest } = context.options;
94
+ const { assetId, execution, agentId, idempotencyKey, ...rest } = context.options;
83
95
  if (context.var.prepare === undefined || typeof assetId !== "string") {
84
96
  return context.error({ code: "PREPARE_UNAVAILABLE", message: "This server does not prepare writes." });
85
97
  }
@@ -91,6 +103,8 @@ const prepareCommand = (tool: PrepareTool) => ({
91
103
  assetId,
92
104
  fields,
93
105
  execution: execution === "mandate" ? "mandate" : "inbox",
106
+ agentId,
107
+ idempotencyKey,
94
108
  });
95
109
  return "refused" in outcome ? context.error(outcome.refused) : outcome.prepared;
96
110
  },
@@ -3,6 +3,8 @@ import { z } from "incur";
3
3
  import type { StoredCredentials } from "./credential-store.ts";
4
4
  import { CLI_USER_AGENT } from "./vars.ts";
5
5
 
6
+ const TRAILING_SLASHES_PATTERN = /\/+$/u;
7
+
6
8
  const AUTH_REQUEST_TIMEOUT_MS = 10_000;
7
9
 
8
10
  export async function authRequest(
@@ -24,7 +26,7 @@ export async function authRequest(
24
26
  let response: Response;
25
27
  let text: string;
26
28
  try {
27
- response = await fetch(`${apiUrl.replace(/\/+$/u, "")}/api/auth${route}`, {
29
+ response = await fetch(`${apiUrl.replace(TRAILING_SLASHES_PATTERN, "")}/api/auth${route}`, {
28
30
  method: request.method,
29
31
  headers,
30
32
  signal: deadline.signal,
@@ -4,6 +4,9 @@ import { z } from "zod";
4
4
  import { getConfigDir } from "./cli-config.ts";
5
5
  import { makeCliError, isCliFailure } from "./errors.ts";
6
6
 
7
+ const KEYCHAIN_ENTRY_SEPARATOR_PATTERN = /\n(?=keychain:)/u;
8
+ const ACCOUNT_PATTERN = /"acct"<blob>="([^"]*)"/u;
9
+
7
10
  const SERVICE_NAME = "dalp-cli";
8
11
 
9
12
  const StoredCredentialsSchema = z.object({
@@ -48,11 +51,11 @@ async function keychainAccounts(
48
51
  });
49
52
  }
50
53
  const accounts = new Set<string>();
51
- for (const entry of dump.stdout.split(/\n(?=keychain:)/u)) {
54
+ for (const entry of dump.stdout.split(KEYCHAIN_ENTRY_SEPARATOR_PATTERN)) {
52
55
  if (!entry.includes(`"svce"<blob>="${SERVICE_NAME}"`)) {
53
56
  continue;
54
57
  }
55
- const account = entry.match(/"acct"<blob>="([^"]*)"/u)?.[1];
58
+ const account = entry.match(ACCOUNT_PATTERN)?.[1];
56
59
  if (account !== undefined) {
57
60
  accounts.add(account);
58
61
  }
@@ -19,6 +19,9 @@ import {
19
19
  } from "./sdk-cli-schema.ts";
20
20
  import { cliVars } from "./vars.ts";
21
21
 
22
+ const CAMEL_BOUNDARY_PATTERN = /([a-z0-9])([A-Z])/gu;
23
+ const DASH_RUN_PATTERN = /-+/gu;
24
+
22
25
  function readOkHelper<T extends object>(
23
26
  context: T
24
27
  ): ((data: unknown, meta?: { cta?: CliCtaBlock }) => unknown) | undefined {
@@ -128,9 +131,9 @@ function selectOperation(ops: ReadonlyArray<OperationDescriptor>, path: ApiBag |
128
131
 
129
132
  function headerOptionName(name: string): string {
130
133
  return name
131
- .replaceAll(/([a-z0-9])([A-Z])/gu, "$1-$2")
134
+ .replaceAll(CAMEL_BOUNDARY_PATTERN, "$1-$2")
132
135
  .replaceAll("_", "-")
133
- .replaceAll(/-+/gu, "-")
136
+ .replaceAll(DASH_RUN_PATTERN, "-")
134
137
  .toLowerCase();
135
138
  }
136
139
 
@@ -1,6 +1,9 @@
1
1
  import { z } from "incur";
2
2
  import type { SurfaceOperation, SurfaceParam } from "./openapi-surface-types.ts";
3
3
 
4
+ const CAMEL_BOUNDARY_PATTERN = /([a-z0-9])([A-Z])/gu;
5
+ const DASH_RUN_PATTERN = /-+/gu;
6
+
4
7
  export type ZodTypeAny = z.ZodType;
5
8
 
6
9
  const cliValueSchema = z.union([z.json(), z.date(), z.bigint(), z.undefined()]);
@@ -226,9 +229,9 @@ export function buildOptionsFromSdk(
226
229
 
227
230
  for (const param of surface?.headerParams ?? []) {
228
231
  const headerOption = param.name
229
- .replaceAll(/([a-z0-9])([A-Z])/gu, "$1-$2")
232
+ .replaceAll(CAMEL_BOUNDARY_PATTERN, "$1-$2")
230
233
  .replaceAll("_", "-")
231
- .replaceAll(/-+/gu, "-")
234
+ .replaceAll(DASH_RUN_PATTERN, "-")
232
235
  .toLowerCase();
233
236
  if (out[headerOption] !== undefined) {
234
237
  continue;
package/src/main.ts CHANGED
@@ -11,9 +11,12 @@ import { registerGeneratedOperations } from "./lib/register-operations.ts";
11
11
  import { runCommand } from "./lib/run-command.ts";
12
12
  import { CLI_VERSION, cliVars } from "./lib/vars.ts";
13
13
 
14
+ const COMMAND_NAME_SEPARATOR_PATTERN = /[ _]/u;
15
+
14
16
  const SKIP_AUTH_COMMANDS = new Set(["login", "logout", "config", "mcp", "skills"]);
15
17
 
16
- export const topLevelCommandName = (command: string | undefined): string => command?.split(/[ _]/u)[0] ?? "";
18
+ export const topLevelCommandName = (command: string | undefined): string =>
19
+ command?.split(COMMAND_NAME_SEPARATOR_PATTERN)[0] ?? "";
17
20
 
18
21
  export const makeCli = (): Cli.Cli<Record<string, never>, typeof cliVars> => {
19
22
  const cli: Cli.Cli<Record<string, never>, typeof cliVars> = Cli.create("dalp", {