@synopackageland/cli 0.52.9 → 0.52.10

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,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.52.10
4
+
5
+ - Supply the file-delegate declaration to desktop and mobile executor approval so WebAPI-only Apps can approve without file scope queries
6
+ - Accept purpose_i18n display metadata for WebAPI profiles, warn about missing UI languages and keep translations outside executor policy bytes
7
+
3
8
  ## 0.52.9
4
9
 
5
10
  - Pin CLI-owned SDK defaults and the Compose administrator adapter to 0.53.11
@@ -46,6 +46,7 @@ export const ERROR_REGISTRY = {
46
46
  INIT_UPSTREAM_INVALID: { code: "INIT_UPSTREAM_INVALID", description: "The upstream repository URL is invalid.", suggestion: "Supply --upstream with an HTTPS repository URL without credentials." },
47
47
  INIT_PUBLISHER_INVALID: { code: "INIT_PUBLISHER_INVALID", description: "The attribution name or publisher URL is invalid.", suggestion: "Use plain single-line project/publisher names and an http(s) publisher URL without credentials." },
48
48
  UPSTREAM_ATTRIBUTION: { code: "UPSTREAM_ATTRIBUTION", description: "Upstream App attribution is incomplete or names the distributor as maintainer.", suggestion: "Name the original project/team or owner as maintainer; set metadata.maintainer_url to the upstream repository and metadata.distributor/distributor_url to your publisher; resolve TODOs before release." },
49
+ WEBAPI_PURPOSE_I18N_MISSING: { code: 'WEBAPI_PURPOSE_I18N_MISSING', description: 'A WebAPI profile lacks purpose translations for one or more UI languages', suggestion: 'Add purpose_i18n entries for en, zh-TW, zh-CN, de, fr, ja, ko, es and it without trailing periods; missing locales fall back to English' },
49
50
  DSM_WINDOW_COLOR_SCHEME: { code: 'DSM_WINDOW_COLOR_SCHEME', description: 'A DSM-window Vue component combines OS theme detection with a dynamic color-scheme binding', suggestion: 'Leave color-scheme unset in DSM windows; follow OS preferences only on the App\'s own full page' },
50
51
  STANDALONE_IDENTITY_WITHOUT_PORTAL: { code: 'STANDALONE_IDENTITY_WITHOUT_PORTAL', description: 'Standalone identity is enabled without an Application Portal declaration', suggestion: 'Use HTTPS-only standalone login outside DSM windows; declare portal only when an alias is needed' },
51
52
  INSTALL_SETTINGS_INVALID: { "code": "INSTALL_SETTINGS_INVALID", "description": "The installation setting declaration is invalid.", "suggestion": "Declare 1–32 lowercase identifier keys in install.settings, each with type https-origin, a plain label and an explicit boolean required; omit defaults and values." },
@@ -32,7 +32,7 @@ export const executorPolicyText = (policy) => JSON.stringify(policy) + '\n';
32
32
  export function executorPolicy(m, arch) {
33
33
  if (m.capabilities.delegate && !validDelegate(m.capabilities.delegate))
34
34
  throw new Error('[EXECUTOR_POLICY] Invalid delegate operations or scope.');
35
- if (m.capabilities.webapi && !validWebAPIProfiles(m.capabilities.webapi))
35
+ if (m.capabilities.webapi && !validWebAPIProfiles(m.capabilities.webapi, true))
36
36
  throw new Error('[EXECUTOR_POLICY] Invalid WebAPI profiles.');
37
37
  const portal = executorPortal(m);
38
38
  const operations = ['status', ...(portal ? PORTAL_OPERATIONS : [])];
@@ -1,9 +1,12 @@
1
1
  /** WebAPI profiles, independently enforced again by the pinned executor. */
2
2
  export interface WebAPIProfile {
3
3
  purpose: string;
4
+ purpose_i18n?: Partial<Record<WebAPIPurposeLocale, string>>;
4
5
  apis: Record<string, Record<string, number[]>>;
5
6
  raw_max_bytes?: number;
6
7
  }
8
+ export declare const webapiPurposeLocales: readonly ["en", "zh-TW", "zh-CN", "de", "fr", "ja", "ko", "es", "it"];
9
+ export type WebAPIPurposeLocale = typeof webapiPurposeLocales[number];
7
10
  export type WebAPIProfiles = Record<string, WebAPIProfile>;
8
- export declare function validWebAPIProfiles(value: unknown): value is WebAPIProfiles;
11
+ export declare function validWebAPIProfiles(value: unknown, allowPurposeI18n?: boolean): value is WebAPIProfiles;
9
12
  export declare function sortedWebAPIProfiles(profiles: WebAPIProfiles): WebAPIProfiles;
@@ -1,10 +1,13 @@
1
+ export const webapiPurposeLocales = ['en', 'zh-TW', 'zh-CN', 'de', 'fr', 'ja', 'ko', 'es', 'it'];
1
2
  const record = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
2
- export function validWebAPIProfiles(value) {
3
+ export function validWebAPIProfiles(value, allowPurposeI18n = false) {
3
4
  if (!record(value) || !Object.keys(value).length || Object.keys(value).length > 32)
4
5
  return false;
5
6
  let total = 0;
6
7
  for (const [name, p] of Object.entries(value)) {
7
- if (!/^[a-z][a-z0-9_-]{0,63}$/.test(name) || name === 'home' || !record(p) || Object.keys(p).some(k => !['purpose', 'apis', 'raw_max_bytes'].includes(k)) || typeof p.purpose !== 'string' || !p.purpose.trim() || Buffer.byteLength(p.purpose) > 1024 || /[\x00-\x1f\x7f]/.test(p.purpose) || !record(p.apis) || !Object.keys(p.apis).length)
8
+ if (!/^[a-z][a-z0-9_-]{0,63}$/.test(name) || name === 'home' || !record(p) || Object.keys(p).some(k => !['purpose', 'apis', 'raw_max_bytes', ...(allowPurposeI18n ? ['purpose_i18n'] : [])].includes(k)) || typeof p.purpose !== 'string' || !p.purpose.trim() || Buffer.byteLength(p.purpose) > 1024 || /[\x00-\x1f\x7f]/.test(p.purpose) || !record(p.apis) || !Object.keys(p.apis).length)
9
+ return false;
10
+ if (p.purpose_i18n !== undefined && (!record(p.purpose_i18n) || Object.entries(p.purpose_i18n).some(([locale, text]) => !webapiPurposeLocales.includes(locale) || typeof text !== 'string' || !text.trim() || Buffer.byteLength(text) > 1024 || /[\x00-\x1f\x7f]/.test(text) || /[.。]$/.test(text.trim()))))
8
11
  return false;
9
12
  if (p.raw_max_bytes !== undefined && (!Number.isSafeInteger(p.raw_max_bytes) || Number(p.raw_max_bytes) < 0 || Number(p.raw_max_bytes) > 10737418240))
10
13
  return false;
@@ -12,6 +12,7 @@ ${PASSWORD_CONFIRM}
12
12
  })();
13
13
  ${ns}.createExecutorAccess = function (options) {
14
14
  options.tasks = ${ns}.rootTasks;
15
+ options.fileDelegate = ${!!manifest.capabilities.delegate};
15
16
  options.webapiProfiles = ${JSON.stringify(manifest.capabilities.webapi ?? {})};
16
17
  options.pins = ${JSON.stringify({ package: manifest.package, executorDigest: manifest.executor.executorDigest, policyDigest: manifest.executor.policyDigest })};
17
18
  options.wait = function (ms) { return new Promise(function (resolve) { setTimeout(resolve, ms); }); };
@@ -1135,10 +1135,10 @@ function readCapabilities(value, c) {
1135
1135
  if (name === "composeMounts" && setting === true)
1136
1136
  result.composeMounts = true;
1137
1137
  else if (name === "webapi") {
1138
- if (validWebAPIProfiles(setting))
1138
+ if (validWebAPIProfiles(setting, true))
1139
1139
  result.webapi = setting;
1140
1140
  else
1141
- c.fail("CAPABILITY_INVALID", "webapi requires named profiles with purpose and exact API/method/version lists.");
1141
+ c.fail("CAPABILITY_INVALID", "webapi requires named profiles with purpose and exact API/method/version lists; optional purpose_i18n uses supported locales and nonempty text without trailing periods.");
1142
1142
  }
1143
1143
  else if (name === "delegate") {
1144
1144
  if (validDelegate(setting))
@@ -399,6 +399,7 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
399
399
  }, verify);
400
400
  }
401
401
  return {
402
+ fileDelegate: options.fileDelegate,
402
403
  webapiProfiles: options.webapiProfiles || {},
403
404
  status: function () { return (isAdmin() ? adminStatus() : userStatus()).then(publish); },
404
405
  authorize: function (password, selectedScope) {
@@ -1,3 +1,4 @@
1
+ import { webapiPurposeLocales } from '../runtime/webapi-profile.js';
1
2
  import { lstatSync, readFileSync, readdirSync } from 'node:fs';
2
3
  import { join, relative } from 'node:path';
3
4
  import { resolvedSdkLaunch } from '../contract/app-launch.js';
@@ -6,6 +7,16 @@ const SKIP_DIRECTORIES = new Set(['node_modules', 'dist', 'build', 'coverage', '
6
7
  /** Advisory source heuristic, not Vue compilation or cross-file data-flow analysis. */
7
8
  export function uiGuidanceWarnings(manifest) {
8
9
  const warnings = [];
10
+ for (const [name, profile] of Object.entries(manifest.capabilities.webapi ?? {})) {
11
+ const missing = webapiPurposeLocales.filter(locale => !profile.purpose_i18n?.[locale]);
12
+ if (missing.length)
13
+ warnings.push({
14
+ code: 'WEBAPI_PURPOSE_I18N_MISSING', severity: 'warning',
15
+ span: { file: 'dsm-package.yaml', line: 1, column: 1 },
16
+ message: `WebAPI profile ${name} is missing purpose_i18n locales: ${missing.join(', ')}`,
17
+ suggestion: 'Add all nine purpose_i18n translations without trailing periods; missing locales fall back to English',
18
+ });
19
+ }
9
20
  if (manifest.capabilities.identity === 'standalone' && !manifest.portal) {
10
21
  warnings.push({
11
22
  code: 'STANDALONE_IDENTITY_WITHOUT_PORTAL', severity: 'warning',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.52.9",
3
+ "version": "0.52.10",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -45,6 +45,88 @@
45
45
  "additionalProperties": false
46
46
  }
47
47
  },
48
+ "capabilities": {
49
+ "type": "object",
50
+ "properties": {
51
+ "webapi": {
52
+ "type": "object",
53
+ "additionalProperties": {
54
+ "type": "object",
55
+ "required": [
56
+ "purpose",
57
+ "apis"
58
+ ],
59
+ "properties": {
60
+ "purpose": {
61
+ "type": "string",
62
+ "minLength": 1
63
+ },
64
+ "purpose_i18n": {
65
+ "type": "object",
66
+ "properties": {
67
+ "en": {
68
+ "type": "string",
69
+ "minLength": 1,
70
+ "maxLength": 1024
71
+ },
72
+ "zh-TW": {
73
+ "type": "string",
74
+ "minLength": 1,
75
+ "maxLength": 1024
76
+ },
77
+ "zh-CN": {
78
+ "type": "string",
79
+ "minLength": 1,
80
+ "maxLength": 1024
81
+ },
82
+ "de": {
83
+ "type": "string",
84
+ "minLength": 1,
85
+ "maxLength": 1024
86
+ },
87
+ "fr": {
88
+ "type": "string",
89
+ "minLength": 1,
90
+ "maxLength": 1024
91
+ },
92
+ "ja": {
93
+ "type": "string",
94
+ "minLength": 1,
95
+ "maxLength": 1024
96
+ },
97
+ "ko": {
98
+ "type": "string",
99
+ "minLength": 1,
100
+ "maxLength": 1024
101
+ },
102
+ "es": {
103
+ "type": "string",
104
+ "minLength": 1,
105
+ "maxLength": 1024
106
+ },
107
+ "it": {
108
+ "type": "string",
109
+ "minLength": 1,
110
+ "maxLength": 1024
111
+ }
112
+ },
113
+ "additionalProperties": false
114
+ },
115
+ "apis": {
116
+ "type": "object"
117
+ },
118
+ "raw_max_bytes": {
119
+ "type": "integer",
120
+ "minimum": 0,
121
+ "maximum": 10737418240
122
+ }
123
+ },
124
+ "additionalProperties": false
125
+ }
126
+ }
127
+ },
128
+ "additionalProperties": true
129
+ },
48
130
  "identity_gateway": {"$ref": "identity-gateway.v1.schema.json"},
49
131
  "mobile": {"$ref": "mobile.v1.schema.json"},
50
132
  "i18n": {
package/skills/SKILL.md CHANGED
@@ -470,3 +470,5 @@ npm pack and tarball content checks. Run `npm run gates:full` only when the user
470
470
  explicitly requests extended matrices and integration checks. Publishing does
471
471
  not require a full-gate result. Application fixture acceptance remains scoped
472
472
  to the application task's authorization.
473
+
474
+ WebAPI profile consent: supply all nine `purpose_i18n` locales, keep English `purpose`, and heed `WEBAPI_PURPOSE_I18N_MISSING` from `check`. See [files](reference/files.md). WebAPI-only Apps need no file delegate to approve system privileges.
@@ -172,3 +172,19 @@ never widens access, and files from different users never share a grant.
172
172
  ## Container mounts
173
173
 
174
174
  Containers use a fixed package identity and never inherit the signed-in user's File Station ACL. Mount grants are distinct from user destination grants. Per-user file access requires a session/Broker Adapter, outside this change. Read [compose.md](compose.md); official ACL/project control remains blocked.
175
+
176
+
177
+ WebAPI-only Apps use the shared executor approval without a file delegate.
178
+ Do not add a delegate capability solely to enable approval. The generated entry
179
+ passes `fileDelegate` from `capabilities.delegate` to the SDK; older backends
180
+ that answer `unknown_method` to `delegate.status` have no file scope to approve.
181
+
182
+ For every `capabilities.webapi.<profile>`, retain an English `purpose` and add
183
+ `purpose_i18n` with `en`, `zh-TW`, `zh-CN`, `de`, `fr`, `ja`, `ko`, `es`, `it`.
184
+ Write nonempty descriptions without trailing periods. `check` warns about
185
+ missing locales; the UI falls back to `purpose_i18n.en`, then `purpose`.
186
+ Translations are display metadata; only the original English purpose and exact
187
+ API/method/version allowlist enter the executor policy. Use matching SDK support
188
+ for localized consent and WebAPI-only approval. Test a WebAPI-only approval form
189
+ with a backend that does not register `delegate.status`, as well as a declared
190
+ file delegate with scope selection.
@@ -132,3 +132,13 @@ the endpoint, key location and model. Do not print keys or put them in argv.
132
132
 
133
133
  Set `APP_TEST_AI_ACTION` to one authorized fixture action. Keep a deterministic
134
134
  selector/result assertion after `agent.act`; an AI assertion alone is insufficient.
135
+
136
+
137
+ For the WebAPI-only executor approval regression, build the CLI and matching SDK,
138
+ then run `node test/browser/mobile-executor.mjs --webapi-only`. Set
139
+ `SYNOPKGLAND_BROWSER_DEPS` to a directory containing the SDK, Vue/UI peers and
140
+ `playwright-core`, and `SYNOPKGLAND_SDK_DIR` to that SDK checkout. Use
141
+ `CHROMIUM_PATH` for a system Chromium. The synthetic backend omits
142
+ `delegate.status`; first approval, password retry, upgrade, non-admin and
143
+ anonymous paths verify that no file-scope query is made. This smoke does not
144
+ establish NAS runtime acceptance.