@colixsystems/widget-sdk 0.315.2 → 0.317.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -90,7 +90,15 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
90
90
 
91
91
  ## Status
92
92
 
93
- `v0.315.2` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
93
+ `v0.317.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
94
+
95
+ ### What's new in 0.317.0 (contract 1.257.0)
96
+
97
+ **An action script can store a PIN without keeping it — `crypto` joins `CONTRACT.actionScriptGlobals` (sc-15531).** `await crypto.hashSecret(value)` returns a salted one-way hash to store in place of a PIN, passcode or password an app's users choose, and `await crypto.verifySecret(attempt, storedHash)` resolves `true` or `false`. The hash is scrypt, computed on the host, and the value never reaches a log. Keep a count of wrong tries in a table to limit attempts. The action-sdk README has the limits. Nothing changes for widget authors.
98
+
99
+ ### What's new in 0.315.3 (contract 1.255.1)
100
+
101
+ **`useAction()` is no longer refused with `ACTION_PAUSED`.** No plan caps how many Actions a workspace runs, so an Action is never paused: a switched-on Action runs, and `enqueue` is refused only when the Action is switched off (`ACTION_DISABLED`) or the workspace already has 10 queued runs (`RATE_LIMITED`). Code that still handles `ACTION_PAUSED` keeps working; it is simply never reached.
94
102
 
95
103
  ### What's new in 0.315.2 (contract 1.255.0)
96
104
 
@@ -174,7 +182,7 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
174
182
 
175
183
  ### What's new in 0.299.0 (contract 1.246.0)
176
184
 
177
- **`useAction()` can queue a run instead of waiting for it.** The hook now returns `enqueue(input)` beside `run(input)`. `run` still waits for the Action and hands back its `respond()` value, and must finish within 500 ms of the press. `enqueue` resolves as soon as the server has queued the run, with the same refusals as `run` (`ACTION_NOT_APP_INVOKABLE`, `ACTION_NOT_FOUND`, `INVALID_ACTION_INPUT`, `RATE_LIMITED`, a signed-out caller). The Action then runs away from the request with its normal time limits, the way a scheduled run does, and a pod restart does not lose it. Nothing comes back: `running`, `result` and `error` stay as they were. Use it to start work the widget needs no answer from (a batch, a sync, a long send), and tell the user it has started, not that it is done. It is also refused, rather than queued, when the Action is switched off (`ACTION_DISABLED`) or paused (`ACTION_PAUSED`), and with `RATE_LIMITED` when the workspace already has 10 queued runs waiting or running. It can run twice: a scheduler restarted mid-run starts it again, so write the Action to be safe to repeat. On a host whose actions client cannot queue, `enqueue` rejects `UNAVAILABLE`. The injected client is `@colixsystems/actions-client` 0.4.0.
185
+ **`useAction()` can queue a run instead of waiting for it.** The hook now returns `enqueue(input)` beside `run(input)`. `run` still waits for the Action and hands back its `respond()` value, and must finish within 500 ms of the press. `enqueue` resolves as soon as the server has queued the run, with the same refusals as `run` (`ACTION_NOT_APP_INVOKABLE`, `ACTION_NOT_FOUND`, `INVALID_ACTION_INPUT`, `RATE_LIMITED`, a signed-out caller). The Action then runs away from the request with its normal time limits, the way a scheduled run does, and a pod restart does not lose it. Nothing comes back: `running`, `result` and `error` stay as they were. Use it to start work the widget needs no answer from (a batch, a sync, a long send), and tell the user it has started, not that it is done. It is also refused, rather than queued, when the Action is switched off (`ACTION_DISABLED`), and with `RATE_LIMITED` when the workspace already has 10 queued runs waiting or running. It can run twice: a scheduler restarted mid-run starts it again, so write the Action to be safe to repeat. On a host whose actions client cannot queue, `enqueue` rejects `UNAVAILABLE`. The injected client is `@colixsystems/actions-client` 0.4.0.
178
186
 
179
187
  ```jsx
180
188
  const { available, enqueue } = useAction(props.actionId);
@@ -357,7 +365,7 @@ const fresh = seen ? data.length - shown.length : 0;
357
365
 
358
366
  ### What's new in 0.268.0 (contract 1.218.0)
359
367
 
360
- **`useAction().available` tells the truth about the Action.** It used to be true whenever an Action was bound, so a widget offered a run that could never happen. It now turns false once the server says a run would not reach the script: the Action is switched off or paused, not allowed from the app, gone, or the viewer is not a signed-in app user (signed-out visitors and anonymous accounts can't run Actions). It is asked again when the binding or the signed-in user changes, and stays true while no answer has come. The actions client (`@colixsystems/actions-client` 0.2.0) gains `status(actionId)` for it.
368
+ **`useAction().available` tells the truth about the Action.** It used to be true whenever an Action was bound, so a widget offered a run that could never happen. It now turns false once the server says a run would not reach the script: the Action is switched off, not allowed from the app, gone, or the viewer is not a signed-in app user (signed-out visitors and anonymous accounts can't run Actions). It is asked again when the binding or the signed-in user changes, and stays true while no answer has come. The actions client (`@colixsystems/actions-client` 0.2.0) gains `status(actionId)` for it.
361
369
 
362
370
  ### What's new in 0.267.1 (contract 1.217.0)
363
371
 
package/dist/contract.cjs CHANGED
@@ -2299,7 +2299,7 @@ const HOOKS = [
2299
2299
  "`available` is false and run() rejects UNAVAILABLE; render a visible " +
2300
2300
  "'pick an action' state, NEVER a blank box. sc-14224: `available` also " +
2301
2301
  "turns false once the server says a run would not reach the script — " +
2302
- "the Action is switched off or paused, not allowed from the app, gone, " +
2302
+ "the Action is switched off, not allowed from the app, gone, " +
2303
2303
  "or the viewer is not a signed-in app user (signed-out visitors and " +
2304
2304
  "anonymous accounts can't run Actions) — so render an 'isn't available' " +
2305
2305
  "state then too. It stays true while no answer has come. A changed binding clears " +
@@ -2324,15 +2324,15 @@ const HOOKS = [
2324
2324
  "respond() value, and running/result/error are untouched — so use it to " +
2325
2325
  "start work the widget needs no answer from (a batch, a sync, a long " +
2326
2326
  "send) and tell the user it has started, never that it is done. " +
2327
- "It is also refused when the Action is switched off (ACTION_DISABLED) " +
2328
- "or paused (ACTION_PAUSED), and with RATE_LIMITED when the workspace " +
2327
+ "It is also refused when the Action is switched off (ACTION_DISABLED), " +
2328
+ "and with RATE_LIMITED when the workspace " +
2329
2329
  "already has 10 queued runs waiting. A queued run can run twice (a " +
2330
2330
  "restart mid-run starts it again), so its Action must be safe to repeat. " +
2331
2331
  "Reads ctx.actions.",
2332
2332
  returnShape: {
2333
2333
  available: "boolean // false when no Action is bound, the host brokers none, or the server says a run would not reach the script",
2334
2334
  run: "(input) => Promise<unknown> // input is optional; resolves with the Action's respond() value, or null; rejects with ActionError",
2335
- enqueue: "(input) => Promise<void> // input is optional; resolves once the run is queued, returns nothing; rejects with ActionError (run's codes plus ACTION_DISABLED, ACTION_PAUSED)",
2335
+ enqueue: "(input) => Promise<void> // input is optional; resolves once the run is queued, returns nothing; rejects with ActionError (run's codes plus ACTION_DISABLED)",
2336
2336
  running: "boolean // true while any run is in flight",
2337
2337
  result: "unknown // the last successful run's result; null before the first run",
2338
2338
  error: "ActionError | null",
@@ -4093,6 +4093,8 @@ const ACTION_SCRIPT_GLOBALS = [
4093
4093
  "respond",
4094
4094
  // sc-16548 — one turn of a workspace AI agent.
4095
4095
  "agents",
4096
+ // sc-15531 — hashSecret / verifySecret, so a PIN is never stored plain.
4097
+ "crypto",
4096
4098
  ];
4097
4099
  // Mirrors action.service.js SCRIPT_MAX_BYTES.
4098
4100
  const ACTION_SCRIPT_MAX_BYTES = 200 * 1024;
@@ -6965,7 +6967,11 @@ const CONTRACT = deepFreeze({
6965
6967
  // 1.255.0: fix (sc-16654) — `minFontPx` (12) publishes the smallest page text
6966
6968
  // the render check accepts. The theme's six text tiers and its Buttons and
6967
6969
  // Text component sizes now clamp up to it instead of to 8.
6968
- version: "1.255.0",
6970
+ // 1.255.1: fix (sc-16882) — `ACTION_PAUSED` is gone from useAction's
6971
+ // refusals: no plan caps how many Actions run, so none is paused.
6972
+ // 1.257.0: additive (sc-15531) — `crypto` joins `actionScriptGlobals`:
6973
+ // `crypto.hashSecret` / `crypto.verifySecret` hash a PIN or passcode.
6974
+ version: "1.257.0",
6969
6975
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
6970
6976
  hooks: HOOKS,
6971
6977
  primitives: PRIMITIVES,
package/dist/contract.js CHANGED
@@ -2294,7 +2294,7 @@ const HOOKS = [
2294
2294
  "`available` is false and run() rejects UNAVAILABLE; render a visible " +
2295
2295
  "'pick an action' state, NEVER a blank box. sc-14224: `available` also " +
2296
2296
  "turns false once the server says a run would not reach the script — " +
2297
- "the Action is switched off or paused, not allowed from the app, gone, " +
2297
+ "the Action is switched off, not allowed from the app, gone, " +
2298
2298
  "or the viewer is not a signed-in app user (signed-out visitors and " +
2299
2299
  "anonymous accounts can't run Actions) — so render an 'isn't available' " +
2300
2300
  "state then too. It stays true while no answer has come. A changed binding clears " +
@@ -2319,15 +2319,15 @@ const HOOKS = [
2319
2319
  "respond() value, and running/result/error are untouched — so use it to " +
2320
2320
  "start work the widget needs no answer from (a batch, a sync, a long " +
2321
2321
  "send) and tell the user it has started, never that it is done. " +
2322
- "It is also refused when the Action is switched off (ACTION_DISABLED) " +
2323
- "or paused (ACTION_PAUSED), and with RATE_LIMITED when the workspace " +
2322
+ "It is also refused when the Action is switched off (ACTION_DISABLED), " +
2323
+ "and with RATE_LIMITED when the workspace " +
2324
2324
  "already has 10 queued runs waiting. A queued run can run twice (a " +
2325
2325
  "restart mid-run starts it again), so its Action must be safe to repeat. " +
2326
2326
  "Reads ctx.actions.",
2327
2327
  returnShape: {
2328
2328
  available: "boolean // false when no Action is bound, the host brokers none, or the server says a run would not reach the script",
2329
2329
  run: "(input) => Promise<unknown> // input is optional; resolves with the Action's respond() value, or null; rejects with ActionError",
2330
- enqueue: "(input) => Promise<void> // input is optional; resolves once the run is queued, returns nothing; rejects with ActionError (run's codes plus ACTION_DISABLED, ACTION_PAUSED)",
2330
+ enqueue: "(input) => Promise<void> // input is optional; resolves once the run is queued, returns nothing; rejects with ActionError (run's codes plus ACTION_DISABLED)",
2331
2331
  running: "boolean // true while any run is in flight",
2332
2332
  result: "unknown // the last successful run's result; null before the first run",
2333
2333
  error: "ActionError | null",
@@ -4088,6 +4088,8 @@ const ACTION_SCRIPT_GLOBALS = [
4088
4088
  "respond",
4089
4089
  // sc-16548 — one turn of a workspace AI agent.
4090
4090
  "agents",
4091
+ // sc-15531 — hashSecret / verifySecret, so a PIN is never stored plain.
4092
+ "crypto",
4091
4093
  ];
4092
4094
  // Mirrors action.service.js SCRIPT_MAX_BYTES.
4093
4095
  const ACTION_SCRIPT_MAX_BYTES = 200 * 1024;
@@ -6960,7 +6962,11 @@ const CONTRACT = deepFreeze({
6960
6962
  // 1.255.0: fix (sc-16654) — `minFontPx` (12) publishes the smallest page text
6961
6963
  // the render check accepts. The theme's six text tiers and its Buttons and
6962
6964
  // Text component sizes now clamp up to it instead of to 8.
6963
- version: "1.255.0",
6965
+ // 1.255.1: fix (sc-16882) — `ACTION_PAUSED` is gone from useAction's
6966
+ // refusals: no plan caps how many Actions run, so none is paused.
6967
+ // 1.257.0: additive (sc-15531) — `crypto` joins `actionScriptGlobals`:
6968
+ // `crypto.hashSecret` / `crypto.verifySecret` hash a PIN or passcode.
6969
+ version: "1.257.0",
6964
6970
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
6965
6971
  hooks: HOOKS,
6966
6972
  primitives: PRIMITIVES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.315.2",
3
+ "version": "0.317.0",
4
4
  "description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/contract.js CHANGED
@@ -2294,7 +2294,7 @@ const HOOKS = [
2294
2294
  "`available` is false and run() rejects UNAVAILABLE; render a visible " +
2295
2295
  "'pick an action' state, NEVER a blank box. sc-14224: `available` also " +
2296
2296
  "turns false once the server says a run would not reach the script — " +
2297
- "the Action is switched off or paused, not allowed from the app, gone, " +
2297
+ "the Action is switched off, not allowed from the app, gone, " +
2298
2298
  "or the viewer is not a signed-in app user (signed-out visitors and " +
2299
2299
  "anonymous accounts can't run Actions) — so render an 'isn't available' " +
2300
2300
  "state then too. It stays true while no answer has come. A changed binding clears " +
@@ -2319,15 +2319,15 @@ const HOOKS = [
2319
2319
  "respond() value, and running/result/error are untouched — so use it to " +
2320
2320
  "start work the widget needs no answer from (a batch, a sync, a long " +
2321
2321
  "send) and tell the user it has started, never that it is done. " +
2322
- "It is also refused when the Action is switched off (ACTION_DISABLED) " +
2323
- "or paused (ACTION_PAUSED), and with RATE_LIMITED when the workspace " +
2322
+ "It is also refused when the Action is switched off (ACTION_DISABLED), " +
2323
+ "and with RATE_LIMITED when the workspace " +
2324
2324
  "already has 10 queued runs waiting. A queued run can run twice (a " +
2325
2325
  "restart mid-run starts it again), so its Action must be safe to repeat. " +
2326
2326
  "Reads ctx.actions.",
2327
2327
  returnShape: {
2328
2328
  available: "boolean // false when no Action is bound, the host brokers none, or the server says a run would not reach the script",
2329
2329
  run: "(input) => Promise<unknown> // input is optional; resolves with the Action's respond() value, or null; rejects with ActionError",
2330
- enqueue: "(input) => Promise<void> // input is optional; resolves once the run is queued, returns nothing; rejects with ActionError (run's codes plus ACTION_DISABLED, ACTION_PAUSED)",
2330
+ enqueue: "(input) => Promise<void> // input is optional; resolves once the run is queued, returns nothing; rejects with ActionError (run's codes plus ACTION_DISABLED)",
2331
2331
  running: "boolean // true while any run is in flight",
2332
2332
  result: "unknown // the last successful run's result; null before the first run",
2333
2333
  error: "ActionError | null",
@@ -4088,6 +4088,8 @@ const ACTION_SCRIPT_GLOBALS = [
4088
4088
  "respond",
4089
4089
  // sc-16548 — one turn of a workspace AI agent.
4090
4090
  "agents",
4091
+ // sc-15531 — hashSecret / verifySecret, so a PIN is never stored plain.
4092
+ "crypto",
4091
4093
  ];
4092
4094
  // Mirrors action.service.js SCRIPT_MAX_BYTES.
4093
4095
  const ACTION_SCRIPT_MAX_BYTES = 200 * 1024;
@@ -6960,7 +6962,11 @@ const CONTRACT = deepFreeze({
6960
6962
  // 1.255.0: fix (sc-16654) — `minFontPx` (12) publishes the smallest page text
6961
6963
  // the render check accepts. The theme's six text tiers and its Buttons and
6962
6964
  // Text component sizes now clamp up to it instead of to 8.
6963
- version: "1.255.0",
6965
+ // 1.255.1: fix (sc-16882) — `ACTION_PAUSED` is gone from useAction's
6966
+ // refusals: no plan caps how many Actions run, so none is paused.
6967
+ // 1.257.0: additive (sc-15531) — `crypto` joins `actionScriptGlobals`:
6968
+ // `crypto.hashSecret` / `crypto.verifySecret` hash a PIN or passcode.
6969
+ version: "1.257.0",
6964
6970
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
6965
6971
  hooks: HOOKS,
6966
6972
  primitives: PRIMITIVES,