@synopackageland/cli 0.53.6 → 0.53.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.53.8 (2026-11-11)
4
+
5
+ - The ready-to-paste `ui_secret_ignores` entry printed by `build` and project `check` now lists every flagged text. Texts longer than 200 characters were left out, which in minified output (non-ASCII escaped as `\uXXXX`) dropped long translated strings; now every text up to the 4096-character `match` limit is listed untruncated, exactly as `match` needs it. Error lines stay truncated, and known token signatures are still never printed.
6
+ - `check` prints one entry per file instead of one per finding, so a file with several kinds of hits no longer gets duplicate entries. When the file already has an entry, the paste is a complete replacement that keeps its reviewed texts, drops stale ones and adds the new hits.
7
+ - Pasted values are written as ASCII-only YAML strings, so they parse back to exactly the flagged text.
8
+
9
+ ## 0.53.7 (2026-11-11)
10
+
11
+ - The v2 operation registry accepts the SDK 0.53.33 AI semantics: `ai` classes `propose`, `local` and `one-click`, and optional `consent`, `targets`, `risk`, `tier`, `undo`, `audit`, `mcp`, `dynamicProvider` and `labels`. `ctl generate`, `check` and description validation refuse invalid values with the field named.
12
+ - `generated/tools.json` adds each field only when the operation declares it, with an `execution` for the new classes; `generated/operations.md` adds one line of declared semantics. Registries without the new fields generate byte-identical artifacts.
13
+ - `ctl tools <app> --mcp` lists the tools an external MCP client may see. `ctl tool` returns a dry-run plan for `propose`, `local` and `one-click` tools and never executes them.
14
+ - `ctl generate` and `check` warn when an AI tool summary has four words or fewer (`CTL_DESCRIPTION_QUALITY`); set `ctl.descriptions: error` to refuse them.
15
+ - Older CLI releases cannot read descriptions of Apps that use the new fields; update the CLI first.
16
+
3
17
  ## 0.53.6 (2026-11-11)
4
18
 
5
19
  - `ui_secret_ignores` entries can name a bundler-hashed chunk with one `[hash]` (`app/chunks/Dialog-[hash].js`), so an unrelated frontend change no longer breaks the build with `UI_SECRET_IGNORE_MISSING`. `[hash]` matches `[A-Za-z0-9_-]{6,64}` inside one path segment, with no other glob syntax, and must match exactly one file; more than one fails with `UI_SECRET_IGNORE_AMBIGUOUS`, listing them.
@@ -1,5 +1,7 @@
1
1
  import type { CtlClient, DiscoverOptions } from './service.js';
2
- export declare function listAiTools(client: CtlClient, appName: string, options?: DiscoverOptions): Promise<{
2
+ export declare function listAiTools(client: CtlClient, appName: string, options?: DiscoverOptions & {
3
+ mcp?: boolean;
4
+ }): Promise<{
3
5
  auth?: {
4
6
  state: import("./native-store.js").NativeStoreState;
5
7
  reason?: string;
@@ -17,6 +19,15 @@ export declare function listAiTools(client: CtlClient, appName: string, options?
17
19
  };
18
20
  sha256: string;
19
21
  tools: {
22
+ consent?: import("./operation-semantics.js").OperationConsent | undefined;
23
+ targets?: import("./operation-semantics.js").OperationTargets | undefined;
24
+ risk?: "low" | "medium" | "high" | undefined;
25
+ tier?: string | undefined;
26
+ undo?: import("./operation-semantics.js").OperationUndo | undefined;
27
+ audit?: "change" | "sensitive-read" | "read" | "none" | undefined;
28
+ mcp?: "exposed" | "hidden" | "human-only" | undefined;
29
+ labels?: Record<string, string> | undefined;
30
+ dynamicProvider?: boolean | undefined;
20
31
  execution: string;
21
32
  preview?: string | undefined;
22
33
  name: string;
@@ -28,12 +39,14 @@ export declare function listAiTools(client: CtlClient, appName: string, options?
28
39
  destructiveHint: boolean;
29
40
  openWorldHint: boolean;
30
41
  };
31
- ai: "read" | "preview" | "draft" | "human-only" | "hidden";
42
+ ai: "local" | "read" | "preview" | "draft" | "human-only" | "hidden" | "propose" | "one-click";
32
43
  flow: import("./descriptor.js").Flow;
33
44
  }[];
34
45
  }>;
35
46
  /** A draft is always a preview and plan. This API has no write-confirmation input.
36
47
  * Humans can execute the reviewed ctl plan separately with the normal --yes guard.
37
48
  * Read tools run a complete fixed flow, including job polling or pagination.
49
+ * propose, local and one-click need the App's per-turn Allow-changes or a
50
+ * person pressing a card; ctl has neither, so they return a dry-run plan only.
38
51
  */
39
52
  export declare function runAiTool(client: CtlClient, appName: string, method: string, params: Record<string, unknown>, options?: DiscoverOptions): Promise<any>;
@@ -1,19 +1,22 @@
1
1
  import { CtlError } from './errors.js';
2
2
  import { registryTools } from './registry.js';
3
+ import { isToolClass } from './operation-semantics.js';
3
4
  export async function listAiTools(client, appName, options = {}) {
4
5
  const app = client.selectApp(await client.discover(options), appName);
5
6
  if (app.version === 1 || app.version === 2 && !app.payload.operations)
6
7
  throw new CtlError('CTL_AI_REGISTRY_REQUIRED', 'AI tools require an operation registry.', 'Migrate the App operation registry.', 5);
7
- return { package: app.payload.package, sha256: app.sha256, tools: registryTools({ operations: app.version === 3 ? app.payload.commands : app.payload.operations }), ...(app.payload.execution ? { auth: await client.nativeState(app), credentialGuidance: 'Ask the user to run ctl auth in their own terminal. Never request credentials in chat.' } : {}) };
8
+ return { package: app.payload.package, sha256: app.sha256, tools: registryTools({ operations: app.version === 3 ? app.payload.commands : app.payload.operations }, { mcp: options.mcp }), ...(app.payload.execution ? { auth: await client.nativeState(app), credentialGuidance: 'Ask the user to run ctl auth in their own terminal. Never request credentials in chat.' } : {}) };
8
9
  }
9
10
  /** A draft is always a preview and plan. This API has no write-confirmation input.
10
11
  * Humans can execute the reviewed ctl plan separately with the normal --yes guard.
11
12
  * Read tools run a complete fixed flow, including job polling or pagination.
13
+ * propose, local and one-click need the App's per-turn Allow-changes or a
14
+ * person pressing a card; ctl has neither, so they return a dry-run plan only.
12
15
  */
13
16
  export async function runAiTool(client, appName, method, params, options = {}) {
14
17
  const app = client.selectApp(await client.discover(options), appName);
15
18
  const op = app.version !== 1 ? app.payload.commands[method] : undefined;
16
- if (!op || !['read', 'preview', 'draft'].includes(op.ai ?? ''))
19
+ if (!op || !isToolClass(op.ai))
17
20
  throw new CtlError('CTL_AI_NOT_EXPOSED', 'Operation is not an AI tool.', 'Use the generated tool list.', 4);
18
21
  const args = ['--input', '-'], stdin = JSON.stringify(params);
19
22
  if (op.ai === 'draft') {
@@ -24,5 +27,9 @@ export async function runAiTool(client, appName, method, params, options = {}) {
24
27
  const draft = await client.execute(appName, op.cli, args, { ...options, stdin, dryRun: true });
25
28
  return { confirmationRequired: true, preview: result, draft };
26
29
  }
30
+ if (['propose', 'local', 'one-click'].includes(op.ai ?? '')) {
31
+ const plan = await client.execute(appName, op.cli, args, { ...options, stdin, dryRun: true });
32
+ return { confirmationRequired: true, ai: op.ai, plan };
33
+ }
27
34
  return client.execute(appName, op.cli, args, { ...options, stdin });
28
35
  }
package/dist/ctl/cli.js CHANGED
@@ -144,9 +144,10 @@ async function runCtlWithin(argv, io = {}) {
144
144
  throw new CtlError('CTL_ARGUMENT_INVALID', 'Select one host and App.', 'Use --host <profile>.', 3);
145
145
  const { listAiTools, runAiTool } = await import('./ai-tools.js');
146
146
  if (args[0] === 'tools') {
147
- if (args.length !== 2)
148
- throw new CtlError('CTL_ARGUMENT_INVALID', 'Unexpected tool-list arguments.', 'Use ctl tools <app>.', 3);
149
- emit({ ok: true, data: await listAiTools(client(store.get(hosts[0])), args[1]) });
147
+ const mcp = args[2] === '--mcp';
148
+ if (args.length !== (mcp ? 3 : 2))
149
+ throw new CtlError('CTL_ARGUMENT_INVALID', 'Unexpected tool-list arguments.', 'Use ctl tools <app> [--mcp].', 3);
150
+ emit({ ok: true, data: await listAiTools(client(store.get(hosts[0])), args[1], { mcp }) });
150
151
  return;
151
152
  }
152
153
  if (args.length !== 5 || args[3] !== '--input' || !args[4])
@@ -12,5 +12,5 @@ export async function generateCommand(args) {
12
12
  const result = spawnSync(command, argv, { cwd: options?.cwd, env: options?.env, encoding: 'utf8' });
13
13
  return { status: result.status ?? 1, stdout: result.stdout ?? '', stderr: result.stderr ?? '' };
14
14
  }, check);
15
- return { checked: check, sha256: result.description.sha256 };
15
+ return { checked: check, sha256: result.description.sha256, ...('warnings' in result && result.warnings ? { warnings: result.warnings } : {}) };
16
16
  }
@@ -0,0 +1,51 @@
1
+ /** Optional v2 AI semantics. Every field is metadata for the App/SDK runtime;
2
+ * none grants authority. Omitted fields keep earlier v2 output unchanged. */
3
+ export declare const TOOL_CLASSES: readonly ["read", "preview", "draft", "propose", "local", "one-click"];
4
+ export type OperationConsent = {
5
+ category?: string;
6
+ param?: string;
7
+ };
8
+ export type OperationTargets = {
9
+ max: number;
10
+ traceable?: boolean;
11
+ };
12
+ export type OperationUndo = {
13
+ method: string;
14
+ from: string;
15
+ param: string;
16
+ };
17
+ export interface OperationSemantics {
18
+ consent?: OperationConsent;
19
+ targets?: OperationTargets;
20
+ risk?: 'low' | 'medium' | 'high';
21
+ tier?: string;
22
+ undo?: OperationUndo;
23
+ audit?: 'change' | 'sensitive-read' | 'read' | 'none';
24
+ mcp?: 'exposed' | 'hidden' | 'human-only';
25
+ labels?: Record<string, string>;
26
+ dynamicProvider?: boolean;
27
+ }
28
+ export declare const SEMANTIC_FIELDS: readonly ["consent", "targets", "risk", "tier", "undo", "audit", "mcp", "labels", "dynamicProvider"];
29
+ export declare const isToolClass: (ai: unknown) => boolean;
30
+ /** Effective defaults follow from ai and effect alone. */
31
+ export declare function auditClass(op: {
32
+ audit?: string;
33
+ effect: string;
34
+ }): string;
35
+ export declare function mcpExposure(op: {
36
+ mcp?: string;
37
+ ai?: string;
38
+ }): string;
39
+ /** Returns the first problem as `field: reason`, or undefined. Mirrors the SDK's Go validation. */
40
+ export declare function semanticsProblem(name: string, op: any, ops: Record<string, any>): string | undefined;
41
+ /** Declared semantics only, in a fixed order, for generated artifacts. */
42
+ export declare function declaredSemantics(op: OperationSemantics): Partial<OperationSemantics>;
43
+ export declare const TOOL_EXECUTION: Record<string, string>;
44
+ /** Summary quality for model-facing tools: say what it does and when to use it. */
45
+ export declare function descriptionFindings(operations: Record<string, {
46
+ summary: string;
47
+ ai?: string;
48
+ }>): {
49
+ method: string;
50
+ message: string;
51
+ }[];
@@ -0,0 +1,85 @@
1
+ /** Optional v2 AI semantics. Every field is metadata for the App/SDK runtime;
2
+ * none grants authority. Omitted fields keep earlier v2 output unchanged. */
3
+ export const TOOL_CLASSES = ['read', 'preview', 'draft', 'propose', 'local', 'one-click'];
4
+ export const SEMANTIC_FIELDS = ['consent', 'targets', 'risk', 'tier', 'undo', 'audit', 'mcp', 'labels', 'dynamicProvider'];
5
+ const TOKEN = /^[a-z][a-z0-9-]{0,31}$/, TIER = /^[A-Za-z0-9][A-Za-z0-9_-]{0,15}$/, PARAM = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
6
+ export const isToolClass = (ai) => TOOL_CLASSES.includes(ai);
7
+ const record = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
8
+ const pointer = (v) => typeof v === 'string' && v.length > 1 && v.length <= 128 && v[0] === '/' && !/[\r\n]/.test(v);
9
+ const exactKeys = (v, allowed) => Object.keys(v).every(k => allowed.includes(k));
10
+ const head = (p) => p.slice(1).split('/')[0].replaceAll('~1', '/').replaceAll('~0', '~');
11
+ const hasParam = (schema, name) => !record(schema?.properties) || Object.hasOwn(schema.properties, name);
12
+ /** Effective defaults follow from ai and effect alone. */
13
+ export function auditClass(op) { return op.audit ?? (op.effect === 'read' ? 'read' : 'change'); }
14
+ export function mcpExposure(op) { return op.mcp ?? (isToolClass(op.ai) ? 'exposed' : op.ai === 'human-only' ? 'human-only' : 'hidden'); }
15
+ /** Returns the first problem as `field: reason`, or undefined. Mirrors the SDK's Go validation. */
16
+ export function semanticsProblem(name, op, ops) {
17
+ if (op.ai === 'propose' && op.effect !== 'write')
18
+ return 'propose stores a proposal and requires effect write';
19
+ if (op.ai === 'local' && op.effect !== 'write')
20
+ return 'local is a reversible App-local change and requires effect write';
21
+ const c = op.consent;
22
+ if (c !== undefined) {
23
+ if (!isToolClass(op.ai))
24
+ return 'consent applies only to AI tool classes';
25
+ if (!record(c) || !exactKeys(c, ['category', 'param']) || (c.category === undefined) === (c.param === undefined))
26
+ return 'consent requires exactly one of category or param';
27
+ if (c.category !== undefined && (typeof c.category !== 'string' || !TOKEN.test(c.category)))
28
+ return 'consent category must be a lowercase token';
29
+ if (c.param !== undefined && (!pointer(c.param) || !hasParam(op.paramsSchema, head(c.param))))
30
+ return 'consent param must be a JSON pointer to a declared parameter';
31
+ }
32
+ const t = op.targets;
33
+ if (t !== undefined && (!record(t) || !exactKeys(t, ['max', 'traceable']) || !Number.isInteger(t.max) || t.max < 0 || t.max > 1000 || t.traceable !== undefined && typeof t.traceable !== 'boolean'))
34
+ return 'targets requires integer max 0..1000 and optional boolean traceable';
35
+ if (op.risk !== undefined && !['low', 'medium', 'high'].includes(op.risk))
36
+ return 'risk must be low, medium or high';
37
+ if (op.tier !== undefined && (typeof op.tier !== 'string' || !TIER.test(op.tier)))
38
+ return 'tier must be a short token';
39
+ const u = op.undo;
40
+ if (u !== undefined) {
41
+ const target = record(u) ? ops[u.method] : undefined;
42
+ if (!record(u) || !exactKeys(u, ['method', 'from', 'param']))
43
+ return 'undo requires method, from and param';
44
+ if (op.effect === 'read')
45
+ return 'undo applies only to a change';
46
+ if (u.method === name || !target || target.effect === 'read' || target.ai === 'hidden')
47
+ return 'undo method must be another visible change operation';
48
+ if (!pointer(u.from))
49
+ return 'undo from must be a JSON pointer into the result';
50
+ if (typeof u.param !== 'string' || !PARAM.test(u.param) || !hasParam(target.paramsSchema, u.param))
51
+ return `undo param must be a parameter of ${u.method}`;
52
+ }
53
+ if (op.audit !== undefined) {
54
+ if (!['change', 'sensitive-read', 'read', 'none'].includes(op.audit))
55
+ return 'audit must be change, sensitive-read, read or none';
56
+ if (op.audit !== 'change' && op.effect !== 'read')
57
+ return 'audit of a change must be change';
58
+ }
59
+ if (op.mcp !== undefined) {
60
+ if (!['exposed', 'hidden', 'human-only'].includes(op.mcp))
61
+ return 'mcp must be exposed, hidden or human-only';
62
+ if (op.mcp === 'exposed' && !isToolClass(op.ai))
63
+ return 'mcp exposed requires an AI tool class';
64
+ if (op.mcp === 'human-only' && op.ai === 'hidden')
65
+ return 'mcp cannot expose a hidden operation';
66
+ }
67
+ if (op.dynamicProvider !== undefined && (typeof op.dynamicProvider !== 'boolean' || op.dynamicProvider && !isToolClass(op.ai)))
68
+ return 'dynamicProvider requires an AI tool class';
69
+ const l = op.labels;
70
+ if (l !== undefined && (!record(l) || Object.keys(l).length > 16 || Object.entries(l).some(([k, v]) => !TOKEN.test(k) || typeof v !== 'string' || v.length > 128 || /[\r\n]/.test(v))))
71
+ return 'labels need at most 16 lowercase keys with one-line values up to 128 characters';
72
+ return undefined;
73
+ }
74
+ /** Declared semantics only, in a fixed order, for generated artifacts. */
75
+ export function declaredSemantics(op) {
76
+ return Object.fromEntries(SEMANTIC_FIELDS.filter(k => op[k] !== undefined).map(k => [k, op[k]]));
77
+ }
78
+ export const TOOL_EXECUTION = { read: 'flow', preview: 'flow', draft: 'preview-and-human-confirmation', propose: 'proposal-with-allow-changes', local: 'allow-changes-or-human-card', "one-click": 'human-card' };
79
+ /** Summary quality for model-facing tools: say what it does and when to use it. */
80
+ export function descriptionFindings(operations) {
81
+ return Object.entries(operations).sort(([a], [b]) => a.localeCompare(b)).filter(([, op]) => isToolClass(op.ai)).flatMap(([method, op]) => {
82
+ const words = op.summary.trim().split(/\s+/).filter(Boolean).length;
83
+ return words <= 4 ? [{ method, message: `${method}: summary has ${words} word${words === 1 ? '' : 's'}; say what the tool does and when to use it (at least 5 words).` }] : [];
84
+ });
85
+ }
@@ -1,7 +1,8 @@
1
1
  import { type Operation } from './descriptor.js';
2
- export declare const AI_CLASSES: readonly ["read", "preview", "draft", "human-only", "hidden"];
2
+ import { type OperationSemantics } from './operation-semantics.js';
3
+ export declare const AI_CLASSES: readonly ["read", "preview", "draft", "propose", "local", "one-click", "human-only", "hidden"];
3
4
  export type AIClass = typeof AI_CLASSES[number];
4
- export type RegisteredOperation = Operation & {
5
+ export type RegisteredOperation = Operation & OperationSemantics & {
5
6
  ai: AIClass;
6
7
  paramsSchema: Record<string, any>;
7
8
  resultSchema: Record<string, any>;
@@ -28,7 +29,21 @@ export declare function checkRouteEquality(registry: OperationRegistry, routes:
28
29
  permission: string;
29
30
  }[]): void;
30
31
  export declare function registryPermissions(registry: OperationRegistry): string;
31
- export declare function registryTools(registry: Pick<OperationRegistry, 'operations'>): {
32
+ /** Model-facing tools. Semantic fields appear only when declared, so earlier
33
+ * registries generate byte-identical tools.json. With mcp, only tools an
34
+ * external MCP client may list (exposed, or human-only as a card) remain. */
35
+ export declare function registryTools(registry: Pick<OperationRegistry, 'operations'>, options?: {
36
+ mcp?: boolean;
37
+ }): {
38
+ consent?: import("./operation-semantics.js").OperationConsent | undefined;
39
+ targets?: import("./operation-semantics.js").OperationTargets | undefined;
40
+ risk?: "low" | "medium" | "high" | undefined;
41
+ tier?: string | undefined;
42
+ undo?: import("./operation-semantics.js").OperationUndo | undefined;
43
+ audit?: "change" | "sensitive-read" | "read" | "none" | undefined;
44
+ mcp?: "exposed" | "hidden" | "human-only" | undefined;
45
+ labels?: Record<string, string> | undefined;
46
+ dynamicProvider?: boolean | undefined;
32
47
  execution: string;
33
48
  preview?: string | undefined;
34
49
  name: string;
@@ -40,7 +55,7 @@ export declare function registryTools(registry: Pick<OperationRegistry, 'operati
40
55
  destructiveHint: boolean;
41
56
  openWorldHint: boolean;
42
57
  };
43
- ai: "read" | "preview" | "draft" | "human-only" | "hidden";
58
+ ai: "local" | "read" | "preview" | "draft" | "human-only" | "hidden" | "propose" | "one-click";
44
59
  flow: import("./descriptor.js").Flow;
45
60
  }[];
46
61
  export declare function registryReference(registry: OperationRegistry): string;
@@ -3,7 +3,8 @@ import { dirname, join, resolve, relative, isAbsolute } from 'node:path';
3
3
  import { strictJson } from './json.js';
4
4
  import { ajv, safeSchema, validateFlow } from './descriptor.js';
5
5
  import { validateNativeRegistry } from './native-registry.js';
6
- export const AI_CLASSES = ['read', 'preview', 'draft', 'human-only', 'hidden'];
6
+ import { semanticsProblem, declaredSemantics, isToolClass, mcpExposure, TOOL_EXECUTION } from './operation-semantics.js';
7
+ export const AI_CLASSES = ['read', 'preview', 'draft', 'propose', 'local', 'one-click', 'human-only', 'hidden'];
7
8
  export const INFRASTRUCTURE_METHODS = new Set(['synopkgland.describe', 'identity.status', 'identity.login', 'identity.session', 'identity.logout']);
8
9
  const METHOD = /^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/;
9
10
  export function registryFile(root, file) {
@@ -82,6 +83,9 @@ export function validateRegistry(value) {
82
83
  if (!preview || preview.ai !== 'preview' || preview.effect !== 'read')
83
84
  fail(`${name}: preview must name a non-mutating preview operation.`);
84
85
  }
86
+ const problem = semanticsProblem(name, op, value.operations);
87
+ if (problem)
88
+ fail(`${name}: ${problem}.`);
85
89
  }
86
90
  }
87
91
  export function checkRouteEquality(registry, routes) {
@@ -109,11 +113,36 @@ function toolResultSchema(op) {
109
113
  const items = op.resultSchema.type === 'array' ? op.resultSchema : { type: 'array', items: op.resultSchema };
110
114
  return { type: 'object', required: op.flow.type === 'paginate-http' ? ['items', 'incomplete'] : ['items'], properties: { items, ...(op.flow.type === 'paginate-http' ? { incomplete: { type: 'boolean' }, reason: { type: 'string' }, continuation: { type: 'object' } } : {}) }, additionalProperties: false };
111
115
  }
112
- export function registryTools(registry) {
113
- return Object.entries(registry.operations).sort(([a], [b]) => a.localeCompare(b)).filter(([, op]) => ['read', 'preview', 'draft'].includes(op.ai)).map(([name, op]) => ({ name, description: op.summary, inputSchema: op.paramsSchema, outputSchema: toolResultSchema(op), annotations: { readOnlyHint: op.effect === 'read', destructiveHint: op.effect === 'destructive', openWorldHint: false }, ai: op.ai, flow: op.flow, ...(op.preview ? { preview: op.preview } : {}), execution: op.ai === 'draft' ? 'preview-and-human-confirmation' : 'flow' }));
116
+ /** Model-facing tools. Semantic fields appear only when declared, so earlier
117
+ * registries generate byte-identical tools.json. With mcp, only tools an
118
+ * external MCP client may list (exposed, or human-only as a card) remain. */
119
+ export function registryTools(registry, options = {}) {
120
+ return Object.entries(registry.operations).sort(([a], [b]) => a.localeCompare(b)).filter(([, op]) => isToolClass(op.ai) && (!options.mcp || mcpExposure(op) !== 'hidden')).map(([name, op]) => ({ name, description: op.summary, inputSchema: op.paramsSchema, outputSchema: toolResultSchema(op), annotations: { readOnlyHint: op.effect === 'read', destructiveHint: op.effect === 'destructive', openWorldHint: false }, ai: op.ai, flow: op.flow, ...(op.preview ? { preview: op.preview } : {}), execution: TOOL_EXECUTION[op.ai], ...declaredSemantics(op) }));
121
+ }
122
+ function semanticsLine(op) {
123
+ const parts = [];
124
+ if (op.consent)
125
+ parts.push(op.consent.category ? `consent: ${op.consent.category}` : `consent: from \`${op.consent.param}\``);
126
+ if (op.targets)
127
+ parts.push(`targets: at most ${op.targets.max}${op.targets.traceable ? ', traceable' : ''}`);
128
+ if (op.risk)
129
+ parts.push(`risk: ${op.risk}`);
130
+ if (op.tier)
131
+ parts.push(`tier: ${op.tier}`);
132
+ if (op.undo)
133
+ parts.push(`undo: \`${op.undo.method}\` with ${op.undo.param} from result \`${op.undo.from}\``);
134
+ if (op.audit)
135
+ parts.push(`audit: ${op.audit}`);
136
+ if (op.mcp)
137
+ parts.push(`MCP: ${op.mcp}`);
138
+ if (op.dynamicProvider)
139
+ parts.push('runtime tools: the App adds tools that call this operation at runtime');
140
+ if (op.labels)
141
+ parts.push('labels: ' + Object.entries(op.labels).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${k}=${v}`).join(', '));
142
+ return parts.length ? `${parts.join('; ').replaceAll('<', '&lt;')}\n\n` : '';
114
143
  }
115
144
  export function registryReference(registry) {
116
- return '<!-- Generated by synopkgland ctl generate; edit the operation registry. -->\n# App operations\n\n' + Object.entries(registry.operations).sort(([a], [b]) => a.localeCompare(b)).map(([name, op]) => `## ${name}\n\n${op.summary.replaceAll('<', '&lt;')}\n\nAI: ${op.ai}; effect: ${op.effect}; permission: ${op.permission}; flow: ${op.flow.type}\n\n${op.ai === 'hidden' ? 'No ctl or AI exposure.' : `ctl: \`${op.cli.join(' ')}\``}\n${op.preview ? `\nPreview: \`${op.preview}\`; obtain human confirmation before execution.\n` : ''}`).join('\n');
145
+ return '<!-- Generated by synopkgland ctl generate; edit the operation registry. -->\n# App operations\n\n' + Object.entries(registry.operations).sort(([a], [b]) => a.localeCompare(b)).map(([name, op]) => `## ${name}\n\n${op.summary.replaceAll('<', '&lt;')}\n\nAI: ${op.ai}; effect: ${op.effect}; permission: ${op.permission}; flow: ${op.flow.type}\n\n${semanticsLine(op)}${op.ai === 'hidden' ? 'No ctl or AI exposure.' : `ctl: \`${op.cli.join(' ')}\``}\n${op.preview ? `\nPreview: \`${op.preview}\`; obtain human confirmation before execution.\n` : ''}`).join('\n');
117
146
  }
118
147
  export function writeGenerated(path, contents, check) {
119
148
  if (check) {
@@ -68,6 +68,7 @@ export const ERROR_REGISTRY = {
68
68
  COMPOSE_HEALTH_REQUIRED: { code: "COMPOSE_HEALTH_REQUIRED", description: "Compose web readiness was not selected.", suggestion: "Set compose.web.health.path and expected 2xx status for the actual App; redirects are not followed." },
69
69
  CTL_LEGACY_COMMANDS_DEPRECATED: { code: 'CTL_LEGACY_COMMANDS_DEPRECATED', description: 'The App uses the supported legacy ctl.commands declaration.', suggestion: 'Plan migration to ctl.registry when ready; check and build continue to support v1.' },
70
70
  CTL_REGISTRY_REQUIRED: { code: 'CTL_REGISTRY_REQUIRED', description: 'The App needs a single operation registry.', suggestion: 'Replace ctl.commands with ctl.registry and run synopkgland ctl generate.' },
71
+ CTL_DESCRIPTION_QUALITY: { code: 'CTL_DESCRIPTION_QUALITY', description: 'An AI tool summary is too short to choose the tool.', suggestion: 'Write one English sentence of at least five words: what the tool does and when to use it.' },
71
72
  CTL_REGISTRY_INVALID: { code: 'CTL_REGISTRY_INVALID', description: 'The operation registry is invalid.', suggestion: 'Declare every method with its required ai class, schemas, effect, permission and fixed flow.' },
72
73
  CTL_ROUTE_MISMATCH: { code: 'CTL_ROUTE_MISMATCH', description: 'Operation specs and registered handlers differ.', suggestion: 'Match all method names and permissions in both directions, including hidden methods.' },
73
74
  CTL_GENERATED_DRIFT: { code: 'CTL_GENERATED_DRIFT', description: 'Generated operation artifacts differ from the registry.', suggestion: 'Run synopkgland ctl generate, then synopkgland ctl generate --check.' },
@@ -59,6 +59,7 @@ export interface StandaloneManifest {
59
59
  enabled: boolean;
60
60
  transport?: 'native-http';
61
61
  registry?: string;
62
+ descriptions?: 'warn' | 'error';
62
63
  aliases?: string[];
63
64
  developedBy?: string;
64
65
  commands: Record<string, import("../ctl/descriptor.js").Operation>;
@@ -651,6 +651,10 @@ function readManifest(raw, c) {
651
651
  return undefined;
652
652
  }
653
653
  }
654
+ if (isRecord(raw.ctl) && raw.ctl.descriptions !== undefined && (!['warn', 'error'].includes(raw.ctl.descriptions) || typeof raw.ctl.registry !== 'string')) {
655
+ c.fail('CTL_DECLARATION_INVALID', 'ctl.descriptions must be warn or error and requires ctl.registry.');
656
+ return undefined;
657
+ }
654
658
  const manifest = {
655
659
  ...(raw.ctl ? { ctl: raw.ctl } : {}),
656
660
  ...(allowSecretFiles ? { allowSecretFiles } : {}),
@@ -2,7 +2,14 @@ import { type Descriptor } from '../ctl/descriptor.js';
2
2
  import { type StandaloneManifest } from './manifest.js';
3
3
  import type { CommandRunner } from './build.js';
4
4
  import { type NativeArtifacts } from './native-http.js';
5
+ /** Tool summary lint. Warnings by default; ctl.descriptions: error refuses generation. */
6
+ export declare function descriptionWarnings(m: StandaloneManifest, operations: Record<string, {
7
+ summary: string;
8
+ ai?: string;
9
+ }>): string[];
5
10
  export declare function operationRegistry(m: StandaloneManifest): import("../ctl/registry.js").OperationRegistry;
6
11
  export declare function registryDescriptor(m: StandaloneManifest, registry?: import("../ctl/registry.js").OperationRegistry): Descriptor;
7
12
  /** Generation writes metadata only. The exporter constructs routes without running handlers. */
8
- export declare function generateOperations(m: StandaloneManifest, run: CommandRunner, check?: boolean, bridgeMethods?: string[]): Promise<NativeArtifacts>;
13
+ export declare function generateOperations(m: StandaloneManifest, run: CommandRunner, check?: boolean, bridgeMethods?: string[]): Promise<NativeArtifacts & {
14
+ warnings?: string[];
15
+ }>;
@@ -7,6 +7,14 @@ import { readApiPermissions, API_PERMISSIONS_FILE } from './api-permissions.js';
7
7
  import { sdkBackend } from './manifest.js';
8
8
  import { describeApiRoutes } from './api-description.js';
9
9
  import { generateNativeOperations } from './native-http.js';
10
+ import { descriptionFindings } from '../ctl/operation-semantics.js';
11
+ /** Tool summary lint. Warnings by default; ctl.descriptions: error refuses generation. */
12
+ export function descriptionWarnings(m, operations) {
13
+ const findings = descriptionFindings(operations).map(f => f.message);
14
+ if (findings.length && m.ctl?.descriptions === 'error')
15
+ throw Error('CTL_DESCRIPTION_QUALITY: ' + findings.join(' '));
16
+ return findings;
17
+ }
10
18
  export function operationRegistry(m) {
11
19
  if (!m.ctl?.registry)
12
20
  throw Error('CTL_REGISTRY_REQUIRED: declare ctl.registry with a synopkgland.api v2 spec.');
@@ -34,6 +42,7 @@ export async function generateOperations(m, run, check = false, bridgeMethods) {
34
42
  if (m.ctl?.transport === 'native-http')
35
43
  return generateNativeOperations(m, run, check);
36
44
  const source = operationRegistry(m);
45
+ const warnings = descriptionWarnings(m, source.operations);
37
46
  const registry = structuredClone(source);
38
47
  if (m.backend.kind === 'binary' || m.compose)
39
48
  throw Error('CTL_UNSUPPORTED_BACKEND: operation registry requires the SDK native runtime.');
@@ -82,5 +91,5 @@ export async function generateOperations(m, run, check = false, bridgeMethods) {
82
91
  registryArtifacts(m.root, registry, check, routes);
83
92
  writeGenerated(join(m.root, 'generated', 'synopkgland-api.json'), JSON.stringify(description, null, 2) + '\n', check);
84
93
  writeGenerated(join(m.root, 'generated', 'ctl.json'), JSON.stringify({ commands: description.payload.commands }, null, 2) + '\n', check);
85
- return { description, registry: { ...Object.fromEntries(routes.map(r => [r.method, r.permission])), ...(m.capabilities.identity ? { 'identity.session': 'public', 'identity.logout': 'public' } : {}) } };
94
+ return { ...(warnings.length ? { warnings } : {}), description, registry: { ...Object.fromEntries(routes.map(r => [r.method, r.permission])), ...(m.capabilities.identity ? { 'identity.session': 'public', 'identity.logout': 'public' } : {}) } };
86
95
  }
@@ -64,11 +64,21 @@ export declare function staleUiIgnores(problems: UiProblem[], ignores: ResolvedU
64
64
  export declare function showUiMatch(text: string, limit?: number): string;
65
65
  /** A logical file with a bundler-looking hash (Name-AbCd1234.js) becomes Name-[hash].js. */
66
66
  export declare function suggestUiIgnoreFile(file: string): string;
67
+ /** The longest `match` text readUiSecretIgnores accepts. */
68
+ export declare const UI_MATCH_LIMIT = 4096;
67
69
  /**
68
- * A ready-to-paste ui_secret_ignores block for reviewed false positives. Texts that
69
- * look like real tokens or exceed 200 characters are left for the developer to copy.
70
+ * A YAML double-quoted scalar that parses back to exactly `text`. Only printable
71
+ * ASCII is written raw, so no YAML line-break or BOM rule can alter the value.
70
72
  */
71
- export declare function uiIgnoreSuggestion(problems: UiProblem[], moduleVersion?: string): string;
73
+ export declare function yamlQuote(text: string): string;
74
+ /**
75
+ * A ready-to-paste ui_secret_ignores block for reviewed false positives, one entry per
76
+ * file with every flagged text, untruncated, exactly as `match` needs it. Pass the
77
+ * resolved ignores so a file that already has an entry gets a complete replacement.
78
+ * Texts that look like real tokens are never printed, and texts over UI_MATCH_LIMIT
79
+ * cannot be listed; both leave a comment instead.
80
+ */
81
+ export declare function uiIgnoreSuggestion(problems: UiProblem[], moduleVersion?: string, ignores?: ResolvedUiSecretIgnore[]): string;
72
82
  export declare function describeUiProblem(problem: UiProblem): string;
73
83
  export declare function scanUiTree(root: string, ignores?: ResolvedUiSecretIgnore[], moduleVersion?: string, packed?: boolean): UiProblem[];
74
84
  /** Returns the resolved ignores; record them with storedUiSecretIgnores. */
@@ -28,7 +28,7 @@ export function readUiSecretIgnores(value) {
28
28
  if (match === undefined)
29
29
  return item.file.includes(UI_HASH_TOKEN);
30
30
  return !match.length || new Set(match).size !== match.length ||
31
- match.some(text => typeof text !== "string" || !text || text.length > 4096);
31
+ match.some(text => typeof text !== "string" || !text || text.length > UI_MATCH_LIMIT);
32
32
  }))
33
33
  throw invalid();
34
34
  // Replace one token with an inert character so the exact-path rules still reject
@@ -253,35 +253,53 @@ export function showUiMatch(text, limit = 80) {
253
253
  export function suggestUiIgnoreFile(file) {
254
254
  return file.replace(/^(.*\/)?([^/]*[-.])[A-Za-z0-9_-]{8}(\.[A-Za-z0-9]+)$/, (_all, dir = "", stem, ext) => `${dir}${stem}${UI_HASH_TOKEN}${ext}`);
255
255
  }
256
+ /** The longest `match` text readUiSecretIgnores accepts. */
257
+ export const UI_MATCH_LIMIT = 4096;
256
258
  /**
257
- * A ready-to-paste ui_secret_ignores block for reviewed false positives. Texts that
258
- * look like real tokens or exceed 200 characters are left for the developer to copy.
259
+ * A YAML double-quoted scalar that parses back to exactly `text`. Only printable
260
+ * ASCII is written raw, so no YAML line-break or BOM rule can alter the value.
259
261
  */
260
- export function uiIgnoreSuggestion(problems, moduleVersion) {
262
+ export function yamlQuote(text) {
263
+ return JSON.stringify(text).replace(/[^\x20-\x7e]/g, char => `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`);
264
+ }
265
+ /**
266
+ * A ready-to-paste ui_secret_ignores block for reviewed false positives, one entry per
267
+ * file with every flagged text, untruncated, exactly as `match` needs it. Pass the
268
+ * resolved ignores so a file that already has an entry gets a complete replacement.
269
+ * Texts that look like real tokens are never printed, and texts over UI_MATCH_LIMIT
270
+ * cannot be listed; both leave a comment instead.
271
+ */
272
+ export function uiIgnoreSuggestion(problems, moduleVersion, ignores = []) {
261
273
  const byFile = new Map();
262
- const manual = new Set();
263
274
  for (const problem of problems) {
264
275
  if (SOURCE_MAP_PATTERNS.includes(problem.pattern) || !problem.matches)
265
276
  continue;
266
277
  const file = logicalUiFile(problem.file, moduleVersion);
267
- const texts = byFile.get(file) ?? [];
278
+ const entry = byFile.get(file) ?? { texts: [], redacted: 0, long: 0 };
268
279
  for (const text of problem.matches) {
269
- if (text.length > 200 || showUiMatch(text, Infinity).startsWith("<redacted"))
270
- manual.add(file);
280
+ if (showUiMatch(text, Infinity).startsWith("<redacted"))
281
+ entry.redacted++;
282
+ else if (text.length > UI_MATCH_LIMIT)
283
+ entry.long++;
271
284
  else
272
- texts.push(text);
285
+ entry.texts.push(text);
273
286
  }
274
- byFile.set(file, texts);
287
+ byFile.set(file, entry);
275
288
  }
276
289
  if (!byFile.size)
277
290
  return "";
278
291
  const lines = ["ui_secret_ignores:"];
279
- for (const [file, texts] of byFile) {
280
- lines.push(` - file: ${JSON.stringify(suggestUiIgnoreFile(file))}`, " reason: \"<why this is a false positive>\"", " match:");
281
- for (const text of unique(texts))
282
- lines.push(` - ${JSON.stringify(text)}`);
283
- if (manual.has(file) || !texts.length)
284
- lines.push(` # copy any other flagged text from ui/${file} after review`);
292
+ for (const [file, { texts, redacted, long }] of byFile) {
293
+ const existing = ignores.find(item => item.file === file);
294
+ if (existing)
295
+ lines.push(` # replaces the existing entry for ui/${existing.pattern ?? existing.file}`);
296
+ lines.push(` - file: ${yamlQuote(existing?.pattern ?? suggestUiIgnoreFile(file))}`, ` reason: ${existing ? yamlQuote(existing.reason) : "\"<why this is a false positive>\""}`, " match:");
297
+ for (const text of unique([...existing?.match ?? [], ...texts]))
298
+ lines.push(` - ${yamlQuote(text)}`);
299
+ if (redacted)
300
+ lines.push(` # copy from ui/${file} after review: ${redacted} flagged text(s) look like real tokens and are not printed`);
301
+ if (long)
302
+ lines.push(` # ${long} flagged text(s) in ui/${file} exceed ${UI_MATCH_LIMIT} characters and cannot be listed; shorten them`);
285
303
  }
286
304
  return lines.join("\n");
287
305
  }
@@ -322,7 +340,7 @@ export function enforcePublicUi(root, ignores = [], moduleVersion) {
322
340
  console.warn(`[UI_SECRET_IGNORED] ui/${problem.file}: ${problem.pattern}; ${problem.ignoredBy ? `matched ui/${problem.ignoredBy}; ` : ""}reason: ${problem.ignored}`);
323
341
  const errors = problems.filter(item => !item.ignored);
324
342
  if (errors.length) {
325
- const paste = uiIgnoreSuggestion(errors, moduleVersion);
343
+ const paste = uiIgnoreSuggestion(errors, moduleVersion, resolved);
326
344
  throw Object.assign(new Error(errors.map(describeUiProblem).join("\n") +
327
345
  (paste ? `\nOnly if every hit is a reviewed false positive, add to dsm-package.yaml:\n${paste}` : "")), { code: "PUBLIC_UI_UNSAFE", hint: "Files under ui/ are public. Remove credentials and source maps; only false positives may use ui_secret_ignores with a reason and match." });
328
346
  }
package/dist/validate.js CHANGED
@@ -9,6 +9,7 @@ import { hasSdkWindow } from "./standalone/dsm-window.js";
9
9
  import { uiGuidanceWarnings } from "./standalone/ui-guidance.js";
10
10
  import { isNativeLayout, loadNativeLayout, } from "./standalone/native-layout.js";
11
11
  import { manifestPolicyProblem } from "./runtime/executor-policy-check.js";
12
+ import { descriptionFindings } from "./ctl/operation-semantics.js";
12
13
  /** All shipped Compose and native projects use the schema-2 build path. */
13
14
  export function validateProject(project, _options = {}) {
14
15
  const file = "dsm-package.yaml";
@@ -46,6 +47,16 @@ export function validateProject(project, _options = {}) {
46
47
  const manifest = loaded.manifest;
47
48
  if ('ui' in manifest)
48
49
  warnings.push(...uiGuidanceWarnings(manifest));
50
+ const ctl = 'ctl' in manifest ? manifest.ctl : undefined;
51
+ if (ctl?.enabled && ctl.registry)
52
+ for (const finding of descriptionFindings(ctl.commands)) {
53
+ const item = { code: 'CTL_DESCRIPTION_QUALITY', span: { file: ctl.registry, line: 1, column: 1 }, message: finding.message,
54
+ suggestion: 'Write one English sentence: what the tool does and when to use it. Set ctl.descriptions: error to block builds on this.' };
55
+ if (ctl.descriptions === 'error')
56
+ problems.push(item);
57
+ else
58
+ warnings.push({ ...item, severity: 'warning' });
59
+ }
49
60
  const roots = "ui" in manifest
50
61
  ? hasSdkWindow(manifest) ? [{ dir: manifest.ui.dir, prefix: "app/" }] : []
51
62
  : manifest.arches.map(arch => ({ dir: join(manifest.root, manifest.layout.payload.replaceAll("{arch}", arch), "ui"), prefix: "" }));
@@ -67,14 +78,24 @@ export function validateProject(project, _options = {}) {
67
78
  try {
68
79
  // Scan JS/CSS as build packs it (minified), so printed match texts agree with build.
69
80
  const raw = scanUiTree(dir, [], undefined, true).map(item => ({ ...item, file: prefix + item.file }));
70
- for (const stale of staleUiIgnores(raw, ignores))
81
+ const staleList = staleUiIgnores(raw, ignores);
82
+ for (const stale of staleList)
71
83
  problems.push({
72
84
  code: "UI_SECRET_IGNORE_STALE", span: { file: "dsm-package.yaml", line: 1, column: 1 },
73
85
  message: `ui_secret_ignores ui/${stale.entry} match ${showUiMatch(stale.match)} no longer occurs in ui/${stale.file}`,
74
86
  suggestion: "Remove the stale match (or the whole entry) after reviewing the file again.",
75
87
  });
76
- for (const item of applyUiIgnores(raw, ignores)) {
77
- const paste = item.ignored ? "" : uiIgnoreSuggestion([item]);
88
+ const applied = applyUiIgnores(raw, ignores);
89
+ // One complete entry per file, on its first unexempted finding, so pasting never duplicates a file.
90
+ const pasted = new Set();
91
+ // A replacement entry keeps only listed texts that still occur.
92
+ const current = ignores.map(ignore => ignore.match
93
+ ? { ...ignore, match: ignore.match.filter(text => !staleList.some(stale => stale.file === ignore.file && stale.match === text)) } : ignore);
94
+ for (const item of applied) {
95
+ const paste = item.ignored || pasted.has(item.file) ? "" :
96
+ uiIgnoreSuggestion(applied.filter(other => !other.ignored && other.file === item.file), undefined, current);
97
+ if (paste)
98
+ pasted.add(item.file);
78
99
  const finding = {
79
100
  code: item.ignored ? "UI_SECRET_IGNORED" : "PUBLIC_UI_UNSAFE",
80
101
  span: { file: `ui/${item.file}`, line: 1, column: 1 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.53.6",
3
+ "version": "0.53.8",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -456,6 +456,9 @@
456
456
  "read",
457
457
  "preview",
458
458
  "draft",
459
+ "propose",
460
+ "local",
461
+ "one-click",
459
462
  "human-only",
460
463
  "hidden"
461
464
  ]
@@ -490,6 +493,106 @@
490
493
  "pattern": "^/"
491
494
  }
492
495
  }
496
+ },
497
+ "consent": {
498
+ "type": "object",
499
+ "additionalProperties": false,
500
+ "minProperties": 1,
501
+ "maxProperties": 1,
502
+ "properties": {
503
+ "category": {
504
+ "type": "string",
505
+ "pattern": "^[a-z][a-z0-9-]{0,31}$"
506
+ },
507
+ "param": {
508
+ "type": "string",
509
+ "minLength": 2,
510
+ "maxLength": 128,
511
+ "pattern": "^/"
512
+ }
513
+ }
514
+ },
515
+ "targets": {
516
+ "type": "object",
517
+ "additionalProperties": false,
518
+ "required": [
519
+ "max"
520
+ ],
521
+ "properties": {
522
+ "max": {
523
+ "type": "integer",
524
+ "minimum": 0,
525
+ "maximum": 1000
526
+ },
527
+ "traceable": {
528
+ "type": "boolean"
529
+ }
530
+ }
531
+ },
532
+ "risk": {
533
+ "enum": [
534
+ "low",
535
+ "medium",
536
+ "high"
537
+ ]
538
+ },
539
+ "tier": {
540
+ "type": "string",
541
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,15}$"
542
+ },
543
+ "undo": {
544
+ "type": "object",
545
+ "additionalProperties": false,
546
+ "required": [
547
+ "method",
548
+ "from",
549
+ "param"
550
+ ],
551
+ "properties": {
552
+ "method": {
553
+ "type": "string"
554
+ },
555
+ "from": {
556
+ "type": "string",
557
+ "minLength": 2,
558
+ "maxLength": 128,
559
+ "pattern": "^/"
560
+ },
561
+ "param": {
562
+ "type": "string",
563
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$"
564
+ }
565
+ }
566
+ },
567
+ "audit": {
568
+ "enum": [
569
+ "change",
570
+ "sensitive-read",
571
+ "read",
572
+ "none"
573
+ ]
574
+ },
575
+ "mcp": {
576
+ "enum": [
577
+ "exposed",
578
+ "hidden",
579
+ "human-only"
580
+ ]
581
+ },
582
+ "labels": {
583
+ "type": "object",
584
+ "maxProperties": 16,
585
+ "propertyNames": {
586
+ "pattern": "^[a-z][a-z0-9-]{0,31}$"
587
+ },
588
+ "additionalProperties": {
589
+ "type": "string",
590
+ "maxLength": 128,
591
+ "pattern": "^[^\\r\\n]*$"
592
+ }
593
+ },
594
+ "dynamicProvider": {
595
+ "type": "boolean"
493
596
  }
494
597
  },
495
598
  "required": [
@@ -272,6 +272,9 @@ Each real method has one English `summary`, `paramsSchema`, `resultSchema`,
272
272
  | `read` | Read-only ctl and AI tool |
273
273
  | `preview` | Non-mutating preview/dry-run ctl and AI tool |
274
274
  | `draft` | Write/destructive tool produces preview plus plan; a human confirms separately |
275
+ | `propose` | Write that stores a proposal when the turn allows changes; a human reviews and applies it |
276
+ | `local` | Reversible App-local write; runs only with the turn's Allow changes, otherwise a card the person presses |
277
+ | `one-click` | Never runs on a model call; returns a card the person presses |
275
278
  | `human-only` | ctl with normal confirmation; absent from AI tools |
276
279
  | `hidden` | Runtime spec only; absent from ctl and AI tools |
277
280
 
@@ -279,7 +282,22 @@ A draft names its non-mutating `preview` method; both handlers must accept the
279
282
  tool input. Class never replaces backend authentication, App admission, upstream
280
283
  identity or resource ownership. `read`/`preview` with a mutating effect fail.
281
284
  Mark long operations `longRunning: true` and use a `job` flow; synchronous long
282
- operations fail. The AI layer runs whole fixed flows, including polling and
285
+ operations fail.
286
+
287
+ Optional AI semantics, all omitted by default: `consent` (`{category}` or
288
+ `{param: "/json/pointer"}`), `targets` (`{max: 0..1000, traceable}`), `risk`
289
+ (`low|medium|high`), `tier` (App token), `undo` (`{method, from, param}` receipt
290
+ contract), `audit` (`change|sensitive-read|read|none`; writes stay `change`),
291
+ `mcp` (`exposed|hidden|human-only`, narrowing only), `dynamicProvider: true` for an
292
+ operation that runtime tools bind to, and `labels` (App strings, never for
293
+ authorization). Generated `tools.json` adds a field only when it is declared.
294
+ The SDK's AI operation semantics guide has the full rules and the runtime
295
+ namespace API. Apps using them need an SDK and CLI release that lists these
296
+ fields in its changelog; older ctl clients refuse such descriptions.
297
+
298
+ Write each AI tool `summary` as one English sentence: what it does and when to
299
+ use it. `ctl generate` and `check` warn on summaries of four words or fewer;
300
+ set `ctl: {descriptions: error}` to refuse them. The AI layer runs whole fixed flows, including polling and
283
301
  pagination, rather than making the model drive individual steps.
284
302
 
285
303
  Register the real handler, then run `synopkgland ctl generate`,
@@ -316,10 +334,12 @@ Only read RPCs can refresh and replay once. Writes, AI, streams, unknown kinds
316
334
  and batches never replay. Existing `ctx.call` remains opt-in. Commit the generated
317
335
  file and use `ctl generate --check` to verify it with the other artifacts.
318
336
 
319
- For installed Apps, use `ctl tools <app> --host <profile>` and
337
+ For installed Apps, use `ctl tools <app> --host <profile>` (add `--mcp` for the
338
+ list an external MCP client may see) and
320
339
  `ctl tool <app> <method> --input <file|-> --host <profile>`. These require the
321
340
  normal approved package/descriptor pin. A draft tool returns a non-mutating
322
- preview and plan; this interface has no write-confirmation parameter. Obtain
341
+ preview and plan; propose, local and one-click tools return a dry-run plan only;
342
+ this interface has no write-confirmation parameter. Obtain
323
343
  human authorization, inspect the same normal ctl command with `--dry-run`, then
324
344
  execute with `--yes` and read back the result. Never forward a model-supplied
325
345
  confirmation as human authorization.
@@ -19,7 +19,8 @@ ui_secret_ignores:
19
19
 
20
20
  Only listed texts are exempt: a new hit in the same file still fails, and a
21
21
  listed text that disappears fails as stale. `build` and `check` print a
22
- ready-to-paste entry for each failing file; paste it only after review.
22
+ ready-to-paste entry for each failing file that lists every flagged text in
23
+ full (or replaces the file's existing entry); paste it only after review.
23
24
  Exceptions are recorded in the SPK as resolved files and reported during
24
25
  inspection. They never allow source maps and do not bypass repository secret
25
26
  checks. See docs/release-checks.md.