@colixsystems/widget-sdk 0.338.0 → 0.339.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
@@ -91,7 +91,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
91
91
 
92
92
  ## Status
93
93
 
94
- `v0.338.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
+ `v0.339.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**.
95
+
96
+ ### What's new in 0.339.0 (contract 1.277.0)
97
+
98
+ **An Action a widget runs gets its 500 ms to itself.** The 500 ms now counts from the script's first statement, so the time AppStudio spends setting the run up no longer eats into it. The whole press is still bounded: it waits at most 200 ms for a free sandbox and is over 1 s after it reaches the server, so a press can now wait up to about 1 s before `run()` rejects with `ACTION_TIMEOUT` (504), whose outcome stays unknown. A press that could not start its script in time (the sandboxes were busy, or setup ran past 1 s) now rejects with `RATE_LIMITED` (429, `Retry-After: 1`) instead of `ACTION_TIMEOUT`: nothing ran, so a retry is safe. No hook, export or code was added.
95
99
 
96
100
  ### What's new in 0.338.0 (contract 1.276.0)
97
101
 
@@ -582,7 +586,7 @@ const { available, run, running, result, error } = useAction(props.actionId);
582
586
 
583
587
  **Bind it with an `actionRef` property.** Declare `{ type: "actionRef" }` in your `propertySchema` and the Studio renders an Action picker that warns when the chosen Action lacks the app trigger. The value is a bare Action id, so Copy Workspace remaps it like `pageRef`.
584
588
 
585
- When nothing is bound, or the host brokers no actions client, `available` is `false` and `run()` rejects `UNAVAILABLE`: render a visible "pick an action" state, never a blank box. A changed binding clears `result` and `error`, and a run that settles after the binding changed or the widget unmounted writes nothing. When runs overlap, `result` and `error` follow the newest one. Branch on `error.code`: `ACTION_NOT_APP_INVOKABLE` and `ACTION_NOT_FOUND` will not clear on a retry, `RATE_LIMITED` will, `INVALID_ACTION_INPUT` means the input was refused, `AUTH_REQUIRED`, `TOKEN_EXPIRED` and `TOKEN_INVALID` mean the app user must sign in, `ACTION_FAILED` means the Action ran and failed, and `ACTION_TIMEOUT` means it was still running 500 ms after the press and was stopped, so its outcome is unknown: some of its writes may have happened. Never show an app user the raw message. A text answer from a bot is often markdown, so render it with `<RichText>`.
589
+ When nothing is bound, or the host brokers no actions client, `available` is `false` and `run()` rejects `UNAVAILABLE`: render a visible "pick an action" state, never a blank box. A changed binding clears `result` and `error`, and a run that settles after the binding changed or the widget unmounted writes nothing. When runs overlap, `result` and `error` follow the newest one. Branch on `error.code`: `ACTION_NOT_APP_INVOKABLE` and `ACTION_NOT_FOUND` will not clear on a retry, `RATE_LIMITED` will (from `run()` it can also mean the server was too busy to start the script, so nothing ran), `INVALID_ACTION_INPUT` means the input was refused, `AUTH_REQUIRED`, `TOKEN_EXPIRED` and `TOKEN_INVALID` mean the app user must sign in, `ACTION_FAILED` means the Action ran and failed, and `ACTION_TIMEOUT` means its script ran for 500 ms of its own, or the press reached 1 s, and was stopped, so its outcome is unknown: some of its writes may have happened. Never show an app user the raw message. A text answer from a bot is often markdown, so render it with `<RichText>`.
586
590
 
587
591
  The linter rejects `useAction()` unless your manifest declares `actions.run:*` in `requestedScopes`.
588
592
 
package/dist/contract.cjs CHANGED
@@ -2341,9 +2341,11 @@ const HOOKS = [
2341
2341
  "(or after unmount) writes nothing. ActionError.code: " +
2342
2342
  "INVALID_ACTION_INPUT (400) — the input was refused; " +
2343
2343
  "ACTION_NOT_APP_INVOKABLE (403) and ACTION_NOT_FOUND (404) will NOT " +
2344
- "clear on a retry, so hide the affordance; RATE_LIMITED (429) will; " +
2345
- "ACTION_TIMEOUT (504) — the run was still going 500 ms after the press " +
2346
- "and was stopped, so its OUTCOME IS UNKNOWN: some of its writes may " +
2344
+ "clear on a retry, so hide the affordance; RATE_LIMITED (429) will, and " +
2345
+ "from run() it can also mean the server was too busy to start the " +
2346
+ "script, so nothing ran; " +
2347
+ "ACTION_TIMEOUT (504) — the script ran for 500 ms of its own, or the " +
2348
+ "press reached 1 s, and was stopped, so its OUTCOME IS UNKNOWN: some of its writes may " +
2347
2349
  "have happened. Never retry it blindly and never tell the user it did " +
2348
2350
  "nothing; an Action a widget runs must do its writes as one call or be " +
2349
2351
  "safe to repeat, and slow or multi-step work belongs in a " +
@@ -7117,7 +7119,11 @@ const CONTRACT = deepFreeze({
7117
7119
  // 1.276.0: stricter lint (sc-17764) — a widget that calls a key
7118
7120
  // useDatastoreMutation() does not return is the publish-blocking
7119
7121
  // `datastore-method-unknown` finding.
7120
- version: "1.276.0",
7122
+ // 1.277.0: behaviour (sc-17821) — an app run's 500 ms counts only the
7123
+ // script's own run, inside a 1 s cap on the whole press, so a press can
7124
+ // wait up to about 1 s before ACTION_TIMEOUT. A press that never started
7125
+ // its script rejects RATE_LIMITED (429, Retry-After: 1): nothing ran.
7126
+ version: "1.277.0",
7121
7127
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7122
7128
  hooks: HOOKS,
7123
7129
  primitives: PRIMITIVES,
package/dist/contract.js CHANGED
@@ -2336,9 +2336,11 @@ const HOOKS = [
2336
2336
  "(or after unmount) writes nothing. ActionError.code: " +
2337
2337
  "INVALID_ACTION_INPUT (400) — the input was refused; " +
2338
2338
  "ACTION_NOT_APP_INVOKABLE (403) and ACTION_NOT_FOUND (404) will NOT " +
2339
- "clear on a retry, so hide the affordance; RATE_LIMITED (429) will; " +
2340
- "ACTION_TIMEOUT (504) — the run was still going 500 ms after the press " +
2341
- "and was stopped, so its OUTCOME IS UNKNOWN: some of its writes may " +
2339
+ "clear on a retry, so hide the affordance; RATE_LIMITED (429) will, and " +
2340
+ "from run() it can also mean the server was too busy to start the " +
2341
+ "script, so nothing ran; " +
2342
+ "ACTION_TIMEOUT (504) — the script ran for 500 ms of its own, or the " +
2343
+ "press reached 1 s, and was stopped, so its OUTCOME IS UNKNOWN: some of its writes may " +
2342
2344
  "have happened. Never retry it blindly and never tell the user it did " +
2343
2345
  "nothing; an Action a widget runs must do its writes as one call or be " +
2344
2346
  "safe to repeat, and slow or multi-step work belongs in a " +
@@ -7112,7 +7114,11 @@ const CONTRACT = deepFreeze({
7112
7114
  // 1.276.0: stricter lint (sc-17764) — a widget that calls a key
7113
7115
  // useDatastoreMutation() does not return is the publish-blocking
7114
7116
  // `datastore-method-unknown` finding.
7115
- version: "1.276.0",
7117
+ // 1.277.0: behaviour (sc-17821) — an app run's 500 ms counts only the
7118
+ // script's own run, inside a 1 s cap on the whole press, so a press can
7119
+ // wait up to about 1 s before ACTION_TIMEOUT. A press that never started
7120
+ // its script rejects RATE_LIMITED (429, Retry-After: 1): nothing ran.
7121
+ version: "1.277.0",
7116
7122
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7117
7123
  hooks: HOOKS,
7118
7124
  primitives: PRIMITIVES,
package/dist/index.d.ts CHANGED
@@ -3720,7 +3720,10 @@ export class AgentError extends Error {
3720
3720
  /**
3721
3721
  * sc-13843 — structured error thrown by `useAction().run` and `.enqueue`. Branch on `code`:
3722
3722
  * `ACTION_NOT_APP_INVOKABLE` and `ACTION_NOT_FOUND` will not clear on a retry,
3723
- * `RATE_LIMITED` will. `AUTH_REQUIRED`, `TOKEN_EXPIRED` and `TOKEN_INVALID`
3723
+ * `RATE_LIMITED` will; from `run` it can also mean the server was too busy to
3724
+ * start the script, so nothing ran. `ACTION_TIMEOUT`: the script ran for 500 ms
3725
+ * of its own, or the press reached 1 s, and was stopped; its outcome is unknown.
3726
+ * `AUTH_REQUIRED`, `TOKEN_EXPIRED` and `TOKEN_INVALID`
3724
3727
  * mean the app user must sign in. Never show an app user the raw message.
3725
3728
  */
3726
3729
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.338.0",
3
+ "version": "0.339.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
@@ -2336,9 +2336,11 @@ const HOOKS = [
2336
2336
  "(or after unmount) writes nothing. ActionError.code: " +
2337
2337
  "INVALID_ACTION_INPUT (400) — the input was refused; " +
2338
2338
  "ACTION_NOT_APP_INVOKABLE (403) and ACTION_NOT_FOUND (404) will NOT " +
2339
- "clear on a retry, so hide the affordance; RATE_LIMITED (429) will; " +
2340
- "ACTION_TIMEOUT (504) — the run was still going 500 ms after the press " +
2341
- "and was stopped, so its OUTCOME IS UNKNOWN: some of its writes may " +
2339
+ "clear on a retry, so hide the affordance; RATE_LIMITED (429) will, and " +
2340
+ "from run() it can also mean the server was too busy to start the " +
2341
+ "script, so nothing ran; " +
2342
+ "ACTION_TIMEOUT (504) — the script ran for 500 ms of its own, or the " +
2343
+ "press reached 1 s, and was stopped, so its OUTCOME IS UNKNOWN: some of its writes may " +
2342
2344
  "have happened. Never retry it blindly and never tell the user it did " +
2343
2345
  "nothing; an Action a widget runs must do its writes as one call or be " +
2344
2346
  "safe to repeat, and slow or multi-step work belongs in a " +
@@ -7112,7 +7114,11 @@ const CONTRACT = deepFreeze({
7112
7114
  // 1.276.0: stricter lint (sc-17764) — a widget that calls a key
7113
7115
  // useDatastoreMutation() does not return is the publish-blocking
7114
7116
  // `datastore-method-unknown` finding.
7115
- version: "1.276.0",
7117
+ // 1.277.0: behaviour (sc-17821) — an app run's 500 ms counts only the
7118
+ // script's own run, inside a 1 s cap on the whole press, so a press can
7119
+ // wait up to about 1 s before ACTION_TIMEOUT. A press that never started
7120
+ // its script rejects RATE_LIMITED (429, Retry-After: 1): nothing ran.
7121
+ version: "1.277.0",
7116
7122
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7117
7123
  hooks: HOOKS,
7118
7124
  primitives: PRIMITIVES,