@widgetic/cli 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -90,18 +90,35 @@ pass show provider/key | widgetic api partners set-partner-adapter-connection --
90
90
 
91
91
  A secret typed as the text of the flag is refused (exit code 2), nothing is sent, and the error does not repeat it. `--dry-run` prints `[redacted]` in its place, whether it came from a flag or from the document of `--data`. Which values are secrets is the contract's word, not a list in the CLI ([`src/secrets.ts`](src/secrets.ts)): the generator stops at a secret it has no safe way to take (one in a URL, a header, a form field or an MCP tool argument).
92
92
 
93
+ ### Which workspace a change goes to
94
+
95
+ A key works in one workspace at a time: an organization key (`wdg_org_…`) in its team's, a person's key (`wgt_usr_…`) in the one that person has switched to on widgetic.com. That switch is shared by everything that signs in as the person, so a change made from the terminal can land in a team's workspace while you are thinking of your own. `widgetic doctor` says where the key works (the `Workspace` line), and so does `widgetic mcp get-profile` (its `workspace`).
96
+
97
+ The tools that change a workflow, an A/B test or a translation take `--expected-workspace <personal|team name>` (tool contract 1.17.0 and later). It never picks or switches a workspace: it says where the change is meant for, and the server refuses it, and changes nothing (exit code 5), when the key works anywhere else.
98
+
99
+ ```bash
100
+ widgetic mcp save-workflow --expected-workspace "Acme Studio" --input @workflow.json
101
+ widgetic mcp publish-workflow --workflow-id <id> --expected-workspace personal
102
+ ```
103
+
104
+ - **`WIDGETIC_WORKSPACE` says it for every change of a shell or a CI job**, so that a script cannot forget it: `export WIDGETIC_WORKSPACE="Acme Studio"`. A flag, or the key of `--input`, wins over it for that call. A read is not held, and neither is a tool that takes no workspace (a widget is always your own).
105
+ - **A hold that cannot be made is not a change that goes through.** With the variable set, the CLI stops a change (exit code 2, nothing sent) when the variable is empty, when this version of the CLI was built from a tool contract that cannot hold a change (`widgetic update`), and when the tool is one it does not know (`widgetic mcp call <tool>`) and `--input` has no `expected_workspace`.
106
+ - **The question before a publish names the workspace.** At a terminal it says where the key works (`… in the team workspace "Acme Studio". Continue?`), and once you say yes the change is held to the workspace it named, so a switch made in another tab in between changes nothing. With `--yes` or `--json` nothing is asked and nothing is added: a script gives `--expected-workspace` or sets the variable.
107
+ - Only the `widgetic mcp` commands are held. A team called `personal` cannot be named, because the server reads that word as your own workspace: leave the argument out.
108
+
93
109
  ### Environment variables
94
110
 
95
- | Variable | What it is |
96
- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
97
- | `WIDGETIC_API_KEY` | The API key. The one secret. |
98
- | `WIDGETIC_PROFILE` | The profile of the saved key when `--profile` is not given. |
99
- | `WIDGETIC_API_URL` | The REST address, to call another environment (https; http only for localhost). Default: the server of the OpenAPI description. |
100
- | `WIDGETIC_MCP_URL` | The MCP address. Default: `https://mcp.widgetic.com/`. |
101
- | `WIDGETIC_CONFIG_DIR` | The folder of the CLI's own files. Default: `~/.config/widgetic` (`$XDG_CONFIG_HOME/widgetic`, `%APPDATA%\widgetic` on Windows). |
102
- | `WIDGETIC_DEBUG=1` | Print a stack with an unexpected error, and say why the CLI did not look for a newer version. |
103
- | `NO_UPDATE_NOTIFIER`, `WIDGETIC_NO_UPDATE_CHECK` | Set to anything but `0`, `false`, `no` or `off`: never look for a newer version or ask about one (`CI` does the same). |
104
- | `npm_config_registry` | The registry that the look for a newer version asks (default `https://registry.npmjs.org`); npm's own variable, https or http for localhost. |
111
+ | Variable | What it is |
112
+ | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
113
+ | `WIDGETIC_API_KEY` | The API key. The one secret. |
114
+ | `WIDGETIC_PROFILE` | The profile of the saved key when `--profile` is not given. |
115
+ | `WIDGETIC_API_URL` | The REST address, to call another environment (https; http only for localhost). Default: the server of the OpenAPI description. |
116
+ | `WIDGETIC_MCP_URL` | The MCP address. Default: `https://mcp.widgetic.com/`. |
117
+ | `WIDGETIC_CONFIG_DIR` | The folder of the CLI's own files. Default: `~/.config/widgetic` (`$XDG_CONFIG_HOME/widgetic`, `%APPDATA%\widgetic` on Windows). |
118
+ | `WIDGETIC_WORKSPACE` | The workspace every change of the `mcp` commands is held to: `personal`, or a team's name ([which workspace](#which-workspace-a-change-goes-to)). |
119
+ | `WIDGETIC_DEBUG=1` | Print a stack with an unexpected error, and say why the CLI did not look for a newer version. |
120
+ | `NO_UPDATE_NOTIFIER`, `WIDGETIC_NO_UPDATE_CHECK` | Set to anything but `0`, `false`, `no` or `off`: never look for a newer version or ask about one (`CI` does the same). |
121
+ | `npm_config_registry` | The registry that the look for a newer version asks (default `https://registry.npmjs.org`); npm's own variable, https or http for localhost. |
105
122
 
106
123
  ## Exit codes
107
124
 
@@ -7,6 +7,7 @@ import { McpConnection } from "../mcp/session.js";
7
7
  import { addBasicOptions, readCommon } from "../options.js";
8
8
  import { printResult, writeStdout } from "../output.js";
9
9
  import { cliIdentity, isAtLeast, minimumNodeVersion } from "../version.js";
10
+ import { contractHoldsWorkspaces, describeWorkspace, quoted, readWorkspace } from "../workspace.js";
10
11
  import { probe, validateUrl, verifyApiKey } from "./verify.js";
11
12
  const UPDATE_HINT = 'Update the CLI: npm install -g @widgetic/cli@latest';
12
13
  function failure(id, title, error) {
@@ -217,6 +218,66 @@ async function checkMcp(context) {
217
218
  await connection.close();
218
219
  }
219
220
  }
221
+ /**
222
+ * In which workspace the key works, asked of the MCP server (`get_profile`, a read that changes nothing), beside what
223
+ * `WIDGETIC_WORKSPACE` says. The two are shown and not compared: whether a change is for the workspace the key works
224
+ * in is the server's to say, with the rule it holds every change to.
225
+ */
226
+ async function checkWorkspace(context, mcp) {
227
+ const { environment, settings, key } = context;
228
+ const pinned = settings.workspace;
229
+ // What the variable asks for, and whether this CLI can do it: a variable that cannot hold anything is a warning,
230
+ // because every change would be refused.
231
+ let pinNote = '';
232
+ let pinProblem;
233
+ if (pinned !== undefined) {
234
+ if (pinned === '') {
235
+ pinNote = ' WIDGETIC_WORKSPACE is set but names no workspace, so every change is refused.';
236
+ pinProblem = 'Set WIDGETIC_WORKSPACE to "personal" or to the name of the team, or unset it.';
237
+ }
238
+ else if (!contractHoldsWorkspaces(loadMcpManifest())) {
239
+ pinNote = ` WIDGETIC_WORKSPACE is ${quoted(pinned)}, but this CLI cannot hold a change to a workspace, so every change is refused.`;
240
+ pinProblem = UPDATE_HINT;
241
+ }
242
+ else {
243
+ pinNote = ` WIDGETIC_WORKSPACE holds every change to ${quoted(pinned)}.`;
244
+ }
245
+ }
246
+ const finish = (status, message, details = {}) => ({
247
+ id: 'workspace',
248
+ title: 'Workspace',
249
+ // A variable that cannot hold anything is a problem whether or not the key could be asked.
250
+ status: (status === 'ok' || status === 'skip') && pinProblem !== undefined ? 'warn' : status,
251
+ message: `${message}${pinNote}`,
252
+ details: { ...details, pinned: pinned ?? null },
253
+ ...(pinProblem === undefined ? {} : { hint: pinProblem })
254
+ });
255
+ if (key === undefined) {
256
+ return finish('skip', 'Needs an API key: it asks the MCP server where the key works.');
257
+ }
258
+ if (mcp.status === 'fail') {
259
+ return finish('skip', 'The MCP server did not take the key, so it could not be asked where the key works.');
260
+ }
261
+ const connection = new McpConnection(environment, settings, { apiKey: key.apiKey, source: key.source }, context.timeoutMilliseconds);
262
+ let reading;
263
+ try {
264
+ reading = await readWorkspace(connection);
265
+ }
266
+ finally {
267
+ await connection.close();
268
+ }
269
+ switch (reading.status) {
270
+ case 'known':
271
+ return finish('ok', `This key works in ${describeWorkspace(reading.workspace)}.`, {
272
+ kind: reading.workspace.kind,
273
+ name: reading.workspace.name
274
+ });
275
+ case 'not_reported':
276
+ return finish('skip', 'The server did not say where this key works (a tool contract before 1.17.0, or the workspace could not be read just now).');
277
+ case 'failed':
278
+ return finish('warn', `Could not ask where this key works: ${reading.message}`);
279
+ }
280
+ }
220
281
  const MARKS = { ok: '[ok]', warn: '[warn]', fail: '[fail]', skip: '[skip]' };
221
282
  function printReport(environment, checks, summary) {
222
283
  const lines = [];
@@ -257,7 +318,9 @@ async function runDoctor(environment, node) {
257
318
  }
258
319
  if (!checks.some((check) => check.id === 'credentials'))
259
320
  checks.push(...(await checkCredentials(context)));
260
- checks.push(await checkRest(context), await checkMcp(context));
321
+ const rest = await checkRest(context);
322
+ const mcp = await checkMcp(context);
323
+ checks.push(rest, mcp, await checkWorkspace(context, mcp));
261
324
  const failed = checks.filter((check) => check.status === 'fail').length;
262
325
  const warned = checks.filter((check) => check.status === 'warn').length;
263
326
  if (common.json) {
@@ -285,7 +348,7 @@ export function registerDoctorCommand(root, environment) {
285
348
  .command('doctor')
286
349
  // The line the list of commands of `widgetic --help` shows; the whole text is the help of `doctor` itself.
287
350
  .summary('Check the install, the API key and both servers, and say what is wrong.')
288
- .description('Check the install and both servers: the CLI and its contracts, the API key, the REST API, and the MCP server (which tool contract it speaks and which tools it offers, compared with this CLI).\n\nExit code 0 when nothing failed, 1 when a check did; --json prints every check.');
351
+ .description('Check the install and both servers: the CLI and its contracts, the API key, the REST API, and the MCP server (which tool contract it speaks and which tools it offers, compared with this CLI). It also says in which workspace the key works, the person’s own or a team’s, which is where a change made with it goes.\n\nExit code 0 when nothing failed, 1 when a check did; --json prints every check.');
289
352
  addBasicOptions(doctor, { server: true });
290
353
  doctor.action(async () => {
291
354
  await runDoctor(environment, doctor);
package/dist/config.js CHANGED
@@ -89,7 +89,8 @@ export function resolveSettings(environment, options) {
89
89
  apiUrl: apiUrl.href.replace(/\/+$/, ''),
90
90
  apiRootUrl: apiUrl.origin,
91
91
  mcpUrl: mcpUrl.href,
92
- configDir: configDirectory(environment)
92
+ configDir: configDirectory(environment),
93
+ workspace: environment.env.WIDGETIC_WORKSPACE?.trim()
93
94
  };
94
95
  }
95
96
  /** The seconds `--timeout` gave, or the default; the flag is checked when it is parsed. */
package/dist/mcp/plan.js CHANGED
@@ -2,8 +2,9 @@ import { readDocument } from "../input.js";
2
2
  import { redactSecrets } from "../secrets.js";
3
3
  import { namedByFlag, requireValid } from "../validate.js";
4
4
  import { cliIdentity } from "../version.js";
5
+ import { holdToPinnedWorkspace } from "../workspace.js";
5
6
  export async function planMcpCall(plan) {
6
- const { environment, command, values, input } = plan;
7
+ const { environment, command, values, input, workspace } = plan;
7
8
  const args = input === undefined ? {} : await readDocument(environment, input, 'input');
8
9
  for (const flag of command.flags) {
9
10
  if (values.has(flag.flag))
@@ -14,6 +15,9 @@ export async function planMcpCall(plan) {
14
15
  if (flag.cliDefault !== undefined && !(flag.property in args))
15
16
  args[flag.property] = flag.cliDefault;
16
17
  }
18
+ // A change goes where the person said it should: the workspace of the shell, when the call names none (and a refusal when it cannot be held).
19
+ if (workspace !== undefined)
20
+ holdToPinnedWorkspace(command, args, workspace);
17
21
  const flagOf = new Map(command.flags.map((flag) => [flag.property, flag.flag]));
18
22
  await requireValid(command.inputSchema, args, `The input of ${command.tool}`, (path) => namedByFlag(path, flagOf));
19
23
  return { command, arguments: args };
@@ -7,6 +7,7 @@ import { addCommonOptions, addFlag, commandHelp, readCommon, readFlags } from ".
7
7
  import { printResult } from "../output.js";
8
8
  import { isWaitTool, WAIT_OVERLAY } from "../overlay.js";
9
9
  import { retryNotifier, withRetries } from "../retry.js";
10
+ import { assertionFor, contractHoldsWorkspaces, describeWorkspace, quoted, readWorkspace, takesWorkspace, WORKSPACE_ARGUMENT } from "../workspace.js";
10
11
  import { describeMcpPlan, planMcpCall } from "./plan.js";
11
12
  import { McpConnection, refusalOf } from "./session.js";
12
13
  import { waitForBuild } from "./wait.js";
@@ -29,6 +30,41 @@ function whatItDoes(command) {
29
30
  return 'is not a tool this CLI knows, so it cannot tell what it changes';
30
31
  return 'makes something public or removes it';
31
32
  }
33
+ /**
34
+ * The workspace a question names: the one the call is already held to, or else where the key works, asked on a
35
+ * connection of its own (the question is a courtesy: a key that is missing or a server that does not answer is
36
+ * said by the call itself, after it). A tool that takes no workspace has nothing to name.
37
+ */
38
+ async function workspaceOfQuestion(environment, settings, command, plan, timeoutMs) {
39
+ if (!takesWorkspace(command))
40
+ return undefined;
41
+ const held = plan.arguments[WORKSPACE_ARGUMENT];
42
+ if (typeof held === 'string') {
43
+ return {
44
+ words: `, in the workspace ${quoted(held)} only (it is refused, and nothing changes, if this key works in another)`,
45
+ assertion: undefined
46
+ };
47
+ }
48
+ try {
49
+ const key = await requireApiKey(environment, settings);
50
+ const connection = new McpConnection(environment, settings, { apiKey: key.apiKey, source: key.source }, timeoutMs);
51
+ try {
52
+ const reading = await readWorkspace(connection);
53
+ if (reading.status !== 'known')
54
+ return undefined;
55
+ return {
56
+ words: `, in ${describeWorkspace(reading.workspace)}`,
57
+ assertion: assertionFor(reading.workspace, command)
58
+ };
59
+ }
60
+ finally {
61
+ await connection.close();
62
+ }
63
+ }
64
+ catch {
65
+ return undefined;
66
+ }
67
+ }
32
68
  /** What a tool's answer is, printed: the data of the tool; without data, its text. */
33
69
  function printOutcome(environment, outcome, json) {
34
70
  if (outcome.structured !== undefined) {
@@ -47,17 +83,32 @@ export async function runMcpCommand(run, command, node, bindings) {
47
83
  const input = typeof options.input === 'string' ? options.input : undefined;
48
84
  const waits = options.wait === true;
49
85
  const settings = resolveSettings(environment, { profile: common.profile });
50
- const plan = await planMcpCall({ environment, command, values, input });
86
+ const plan = await planMcpCall({
87
+ environment,
88
+ command,
89
+ values,
90
+ input,
91
+ workspace: { value: settings.workspace, contractHolds: contractHoldsWorkspaces(manifest) }
92
+ });
51
93
  if (common.dryRun) {
52
94
  printResult(environment, describeMcpPlan(plan, settings), common.json);
53
95
  return;
54
96
  }
55
97
  if (command.confirm) {
98
+ // A question that will be asked says where the change goes; one that will not (--yes, --json, no terminal) asks nothing more.
99
+ const asks = !common.yes && !common.json && environment.confirm !== undefined;
100
+ const shown = asks
101
+ ? await workspaceOfQuestion(environment, settings, command, plan, timeoutMilliseconds(common.timeout))
102
+ : undefined;
56
103
  await confirmOrStop(environment, {
57
- what: `${command.tool} ${whatItDoes(command)}`,
104
+ what: `${command.tool} ${whatItDoes(command)}${shown?.words ?? ''}`,
58
105
  yes: common.yes,
59
106
  json: common.json
60
107
  });
108
+ // The person said yes to the workspace that was named, so the call is held to it: a switch made in another tab
109
+ // between the question and the call changes nothing.
110
+ if (shown?.assertion !== undefined)
111
+ plan.arguments[WORKSPACE_ARGUMENT] = shown.assertion;
61
112
  }
62
113
  const key = await requireApiKey(environment, settings);
63
114
  const connection = new McpConnection(environment, settings, { apiKey: key.apiKey, source: key.source }, timeoutMilliseconds(common.timeout));
@@ -0,0 +1,136 @@
1
+ import { usageError } from "./errors.js";
2
+ import { isRecord } from "./http.js";
3
+ /**
4
+ * Holding a change to the workspace it was meant for.
5
+ *
6
+ * A key works in one workspace at a time: an organization key in its team's, a person's key in the workspace the
7
+ * person has switched to on widgetic.com. That switch is shared, so every connection of the person moves with it, the
8
+ * CLI's and an assistant's included, and `widgetic mcp save-workflow` can change the team's workflow while the person
9
+ * is thinking of their own. The tools that change a workflow, an A/B test or a translation therefore take
10
+ * `expected_workspace` (tool contract 1.17.0): `personal`, or the name of a team. The server refuses, and changes
11
+ * nothing, when the key works anywhere else. The argument only asserts; nothing here picks or switches a workspace.
12
+ *
13
+ * This is the CLI's side of it:
14
+ *
15
+ * - where a value comes from: `--expected-workspace`, a key of `--input`, and `WIDGETIC_WORKSPACE` for every change
16
+ * a shell or a CI job makes (the flag and the document win over the variable);
17
+ * - what is refused before anything is sent: a hold that cannot be made is never a change that goes through;
18
+ * - how the CLI asks the server where a key works (`get_profile`), to say it in the question before a publish and
19
+ * in `widgetic doctor`.
20
+ */
21
+ /** The argument of the tool contract that holds a change to a workspace. */
22
+ export const WORKSPACE_ARGUMENT = 'expected_workspace';
23
+ /** The word the server reads as the person's own workspace, in any case and spacing. */
24
+ const PERSONAL_WORD = 'personal';
25
+ /** The limit of the argument when a contract does not say (the gateway's own). */
26
+ const DEFAULT_WORKSPACE_NAME_LIMIT = 100;
27
+ /** How much of a name a line shows. */
28
+ const SHOWN_NAME_LIMIT = 100;
29
+ /** The tool that answers where a key works (`workspace`, since tool contract 1.17.0), and costs nothing. */
30
+ const PROFILE_TOOL = 'get_profile';
31
+ /** Whether this tool takes the argument: it is one of the tools that change something in a workspace. */
32
+ export function takesWorkspace(command) {
33
+ const properties = command.inputSchema.properties;
34
+ return isRecord(properties) && WORKSPACE_ARGUMENT in properties;
35
+ }
36
+ /** Whether the tool contract this CLI was built from has the argument on any tool. A CLI built before 1.17.0 cannot hold a change. */
37
+ export function contractHoldsWorkspaces(manifest) {
38
+ return manifest.commands.some(takesWorkspace);
39
+ }
40
+ /**
41
+ * Puts `WIDGETIC_WORKSPACE` into the arguments of a tool that changes something, or says why it cannot. It never
42
+ * replaces what the person gave: a flag or a key of the document is the call's own word, and the variable is only the
43
+ * default of the shell. A read is not held (it says where it worked in its answer), and a change to a tool that takes
44
+ * no workspace (a widget is always the person's own) has nothing to hold.
45
+ *
46
+ * Every other case is a refusal, because a call that is let through without the hold is exactly what the variable was
47
+ * set to prevent: it names nothing, or this CLI cannot hold changes at all, or it does not know the tool.
48
+ */
49
+ export function holdToPinnedWorkspace(command, args, pin) {
50
+ if (pin.value === undefined || command.readOnly || WORKSPACE_ARGUMENT in args)
51
+ return;
52
+ if (takesWorkspace(command)) {
53
+ if (pin.value === '') {
54
+ throw usageError(`WIDGETIC_WORKSPACE is set but names no workspace, so ${command.tool} was not sent.`, 'Set it to "personal" or to the name of the team, or unset it.');
55
+ }
56
+ args[WORKSPACE_ARGUMENT] = pin.value;
57
+ return;
58
+ }
59
+ if (command.scopes.length === 0) {
60
+ throw usageError(`WIDGETIC_WORKSPACE is set, but this CLI does not know ${command.tool}, so it cannot tell whether it takes a workspace: nothing was sent.`, `If it takes ${WORKSPACE_ARGUMENT}, give it in --input; if it does not, unset WIDGETIC_WORKSPACE for this call.`);
61
+ }
62
+ if (!pin.contractHolds) {
63
+ throw usageError(`WIDGETIC_WORKSPACE is set, but this CLI cannot hold ${command.tool} to a workspace (the tool contract it was built from has no ${WORKSPACE_ARGUMENT}): nothing was sent.`, 'Update the CLI: npm install -g @widgetic/cli@latest');
64
+ }
65
+ }
66
+ function firstLine(text) {
67
+ const line = (text.split('\n')[0] ?? '').trim();
68
+ return line.length > 200 ? `${line.slice(0, 200)}…` : line;
69
+ }
70
+ /** Asks `get_profile` where the key works. */
71
+ export async function readWorkspace(connection) {
72
+ let outcome;
73
+ try {
74
+ outcome = await connection.call(PROFILE_TOOL, {});
75
+ }
76
+ catch (error) {
77
+ return { status: 'failed', message: firstLine(error instanceof Error ? error.message : String(error)) };
78
+ }
79
+ if (outcome.isError) {
80
+ return { status: 'failed', message: firstLine(outcome.text) || `${PROFILE_TOOL} was refused` };
81
+ }
82
+ const workspace = outcome.structured?.workspace;
83
+ if (isRecord(workspace) && (workspace.kind === 'personal' || workspace.kind === 'team')) {
84
+ const name = typeof workspace.name === 'string' && workspace.name.trim() !== '' ? workspace.name : null;
85
+ return { status: 'known', workspace: { kind: workspace.kind, name } };
86
+ }
87
+ return { status: 'not_reported' };
88
+ }
89
+ /**
90
+ * Text of someone else's (a team's name is typed by a stranger) or of the person's own, put in a line the terminal
91
+ * shows: quoted as JSON, with the control and invisible characters JSON leaves alone written as escapes, so that
92
+ * nothing in a name can move the cursor, hide the words around it or make the line read otherwise.
93
+ */
94
+ export function quoted(text) {
95
+ const letters = [...text];
96
+ const clipped = letters.length > SHOWN_NAME_LIMIT ? `${letters.slice(0, SHOWN_NAME_LIMIT).join('')}…` : text;
97
+ return JSON.stringify(clipped).replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/gu, (character) => `\\u{${(character.codePointAt(0) ?? 0).toString(16)}}`);
98
+ }
99
+ /** Where a key works, as a phrase for a sentence. */
100
+ export function describeWorkspace(workspace) {
101
+ if (workspace.kind === 'personal')
102
+ return 'your own workspace';
103
+ return workspace.name === null
104
+ ? 'a team workspace (its name could not be read)'
105
+ : `the team workspace ${quoted(workspace.name)}`;
106
+ }
107
+ /**
108
+ * What a person who was shown this workspace and said yes can have the call held to: `personal`, or the team's name.
109
+ * Nothing when the name cannot be given to the argument: it is not readable, it is longer than the contract allows,
110
+ * or it reads as `personal` (the server takes that word for the person's own workspace).
111
+ */
112
+ export function assertionFor(workspace, command) {
113
+ if (workspace.kind === 'personal')
114
+ return 'personal';
115
+ const name = workspace.name;
116
+ if (name === null)
117
+ return undefined;
118
+ // The way the gateway reads a name (`tidy` in its workspaceExpectation.ts): compatibility form, one space for any run of
119
+ // white space, no control or format characters, no edges, no capitals. A name that reads as nothing or as `personal`
120
+ // cannot be sent as a team's: the server would take it for something else.
121
+ const read = name
122
+ .normalize('NFKC')
123
+ .replace(/\s+/gu, ' ')
124
+ .replace(/[\p{Cc}\p{Cf}]/gu, '')
125
+ .trim()
126
+ .toLowerCase();
127
+ if (read === '' || read === PERSONAL_WORD)
128
+ return undefined;
129
+ const property = isRecord(command.inputSchema.properties)
130
+ ? command.inputSchema.properties[WORKSPACE_ARGUMENT]
131
+ : undefined;
132
+ const limit = isRecord(property) && typeof property.maxLength === 'number'
133
+ ? property.maxLength
134
+ : DEFAULT_WORKSPACE_NAME_LIMIT;
135
+ return name.length <= limit ? name : undefined;
136
+ }
@@ -1 +1 @@
1
- {"package":"@widgetic/api-contracts","version":"1.11.127","publishTag":"latest","source":{"commit":"bc6f558c13283761dd938bc8338cdfc8a874679f","branch":null,"dirty":false,"atOriginMain":true},"openApi":{"file":"openapi-public.json","sha256":"3f2012956a562333734e0d22900b600fa8cecb1a398eb7f9921f5ff3b7a31df2","paths":124,"operations":169,"servers":["https://api.widgetic.com/v1"]},"mcp":{"file":"mcp-tools.json","sha256":"f74111c1369015328f6d368f58ccb43d752058284e9af9747e5fc42a9c4c10dc","contractVersion":"1.16.0","serverName":"widgetic","tools":45}}
1
+ {"package":"@widgetic/api-contracts","version":"1.11.129","publishTag":"latest","source":{"commit":"f25a2c341f936e0d2bde46dd075e7cc674f988e4","branch":null,"dirty":false,"atOriginMain":true},"openApi":{"file":"openapi-public.json","sha256":"e4bd261cec132fe097a4bc85b9248d4e26346fa08d084ea13434a998284c3251","paths":124,"operations":169,"servers":["https://api.widgetic.com/v1"]},"mcp":{"file":"mcp-tools.json","sha256":"b6634f2f2fcbf68b51c3c1dc9c7d192a5112f665d1965d37c9f3ee416097ccaa","contractVersion":"1.18.0","serverName":"widgetic","tools":45}}