@colixsystems/widget-sdk 0.342.0 → 0.343.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 +6 -2
- package/dist/contract.cjs +8 -3
- package/dist/contract.js +8 -3
- package/dist/index.d.ts +4 -3
- package/package.json +1 -1
- package/src/contract.js +8 -3
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.
|
|
94
|
+
`v0.343.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.343.0 (contract 1.280.0)
|
|
97
|
+
|
|
98
|
+
**A tools server whose sign-in is not set up yet says so.** Some servers let people sign in only through an app the app's administrator registers first, such as one that signs in with Microsoft Entra ID. Until that is done, `connections.add` and `connections.signIn` reject with an `AgentError` whose `code` is `SIGN_IN_NEEDS_SETUP` (422). Tell the person to ask the app's administrator to set the sign-in up; no access token fixes it, so do not open the token field for it. `SIGN_IN_NOT_SUPPORTED` keeps its meaning: the server takes an access token. Additive.
|
|
95
99
|
|
|
96
100
|
### What's new in 0.342.0 (contract 1.279.0)
|
|
97
101
|
|
|
@@ -136,7 +140,7 @@ A template never carries a credential (a token, password, API key value or clien
|
|
|
136
140
|
|
|
137
141
|
### What's new in 0.337.0 (contract 1.275.0)
|
|
138
142
|
|
|
139
|
-
**An app user can sign in to a tools server that asks for it.** Call `connections.add({ name, server_url, token: "" })` for a server that asks people to sign in and the item comes back with `auth_kind: "oauth"` and `status: "needs_sign_in"`. Offer a "Sign in" action on an `oauth` item whose `status` is not `connected`, and only when `connections.signIn` is a function: the host runs the sign-in, and it is absent on the Studio canvas and on older hosts, so a widget never shows a dead button. `signIn(id)` resolves to the connected item, or rejects with an `AgentError` whose `code` is `SIGN_IN_CANCELLED`, `SIGN_IN_FAILED`, `CONFIRM_INVALID`, `NOT_A_SIGN_IN_SERVER`, `SERVER_UNREACHABLE` or `RATE_LIMITED`. In a phone app the sign-in opens in the in-app browser and the call settles when it closes. On the web the page itself goes to the sign-in, so the call never settles; when the page loads again, `connections.signInResult` is `{ connection, error }` for that sign-in (otherwise `null`), and the item is already connected. A server whose sign-in this app cannot use is refused on `add` with `SIGN_IN_NOT_SUPPORTED`. Additive.
|
|
143
|
+
**An app user can sign in to a tools server that asks for it.** Call `connections.add({ name, server_url, token: "" })` for a server that asks people to sign in and the item comes back with `auth_kind: "oauth"` and `status: "needs_sign_in"`. Offer a "Sign in" action on an `oauth` item whose `status` is not `connected`, and only when `connections.signIn` is a function: the host runs the sign-in, and it is absent on the Studio canvas and on older hosts, so a widget never shows a dead button. `signIn(id)` resolves to the connected item, or rejects with an `AgentError` whose `code` is `SIGN_IN_CANCELLED`, `SIGN_IN_FAILED`, `CONFIRM_INVALID`, `NOT_A_SIGN_IN_SERVER`, `SIGN_IN_NEEDS_SETUP`, `SERVER_UNREACHABLE` or `RATE_LIMITED`. In a phone app the sign-in opens in the in-app browser and the call settles when it closes. On the web the page itself goes to the sign-in, so the call never settles; when the page loads again, `connections.signInResult` is `{ connection, error }` for that sign-in (otherwise `null`), and the item is already connected. A server whose sign-in this app cannot use is refused on `add` with `SIGN_IN_NOT_SUPPORTED`. Additive.
|
|
140
144
|
|
|
141
145
|
```jsx
|
|
142
146
|
const { connections } = useAgent(props.agentId, { connections: true });
|
package/dist/contract.cjs
CHANGED
|
@@ -2292,13 +2292,15 @@ const HOOKS = [
|
|
|
2292
2292
|
"false on a 403 — APP_USER_SESSION_REQUIRED (the studio canvas, a preview or a signed-out visitor) or " +
|
|
2293
2293
|
"TOOLS_NOT_ENABLED (the author has not let app users connect tools to this agent). add, test and " +
|
|
2294
2294
|
"remove reject with AgentError: TOO_MANY_CONNECTIONS and NAME_IN_USE (409), INVALID_SERVER_URL, " +
|
|
2295
|
-
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN
|
|
2295
|
+
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN, SIGN_IN_NOT_SUPPORTED and " +
|
|
2296
|
+
"SIGN_IN_NEEDS_SETUP (422). SIGN_IN_NEEDS_SETUP means the server's sign-in needs the app's " +
|
|
2297
|
+
"administrator to register it first: tell the user to ask them, and do NOT open a token field for it. " +
|
|
2296
2298
|
"SIGN-IN (sc-17590): add with an empty token to a server that asks people to sign in answers " +
|
|
2297
2299
|
"auth_kind 'oauth', status 'needs_sign_in'. Offer a Sign in action on an 'oauth' item whose status is " +
|
|
2298
2300
|
"not 'connected', and ONLY when `connections.signIn` is a function (the host runs the sign-in; it is " +
|
|
2299
2301
|
"absent on the studio canvas and on older hosts, so never show a dead button). signIn(id) resolves to " +
|
|
2300
2302
|
"the connected item or rejects AgentError: SIGN_IN_CANCELLED, SIGN_IN_FAILED, CONFIRM_INVALID, " +
|
|
2301
|
-
"NOT_A_SIGN_IN_SERVER, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2303
|
+
"NOT_A_SIGN_IN_SERVER, SIGN_IN_NEEDS_SETUP, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2302
2304
|
"the call never settles; when the page loads again `connections.signInResult` is " +
|
|
2303
2305
|
"{ connection, error } for that sign-in (null otherwise): show the outcome from it. " +
|
|
2304
2306
|
"A turn that used one of them carries an activity entry { tool: 'mcp', ok, server } " +
|
|
@@ -7144,7 +7146,10 @@ const CONTRACT = deepFreeze({
|
|
|
7144
7146
|
// contract is shared with the action SDK (`./connector-template`).
|
|
7145
7147
|
// 1.279.0: additive (sc-18049) — useI18n() returns formatDate(value, { time }?),
|
|
7146
7148
|
// a date in the app's language with its month named; "—" when empty.
|
|
7147
|
-
|
|
7149
|
+
// 1.280.0: additive (sc-18010) — connections.add and connections.signIn
|
|
7150
|
+
// may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
|
|
7151
|
+
// app's administrator to register it first. No token fixes it.
|
|
7152
|
+
version: "1.280.0",
|
|
7148
7153
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7149
7154
|
hooks: HOOKS,
|
|
7150
7155
|
primitives: PRIMITIVES,
|
package/dist/contract.js
CHANGED
|
@@ -2287,13 +2287,15 @@ const HOOKS = [
|
|
|
2287
2287
|
"false on a 403 — APP_USER_SESSION_REQUIRED (the studio canvas, a preview or a signed-out visitor) or " +
|
|
2288
2288
|
"TOOLS_NOT_ENABLED (the author has not let app users connect tools to this agent). add, test and " +
|
|
2289
2289
|
"remove reject with AgentError: TOO_MANY_CONNECTIONS and NAME_IN_USE (409), INVALID_SERVER_URL, " +
|
|
2290
|
-
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN
|
|
2290
|
+
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN, SIGN_IN_NOT_SUPPORTED and " +
|
|
2291
|
+
"SIGN_IN_NEEDS_SETUP (422). SIGN_IN_NEEDS_SETUP means the server's sign-in needs the app's " +
|
|
2292
|
+
"administrator to register it first: tell the user to ask them, and do NOT open a token field for it. " +
|
|
2291
2293
|
"SIGN-IN (sc-17590): add with an empty token to a server that asks people to sign in answers " +
|
|
2292
2294
|
"auth_kind 'oauth', status 'needs_sign_in'. Offer a Sign in action on an 'oauth' item whose status is " +
|
|
2293
2295
|
"not 'connected', and ONLY when `connections.signIn` is a function (the host runs the sign-in; it is " +
|
|
2294
2296
|
"absent on the studio canvas and on older hosts, so never show a dead button). signIn(id) resolves to " +
|
|
2295
2297
|
"the connected item or rejects AgentError: SIGN_IN_CANCELLED, SIGN_IN_FAILED, CONFIRM_INVALID, " +
|
|
2296
|
-
"NOT_A_SIGN_IN_SERVER, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2298
|
+
"NOT_A_SIGN_IN_SERVER, SIGN_IN_NEEDS_SETUP, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2297
2299
|
"the call never settles; when the page loads again `connections.signInResult` is " +
|
|
2298
2300
|
"{ connection, error } for that sign-in (null otherwise): show the outcome from it. " +
|
|
2299
2301
|
"A turn that used one of them carries an activity entry { tool: 'mcp', ok, server } " +
|
|
@@ -7139,7 +7141,10 @@ const CONTRACT = deepFreeze({
|
|
|
7139
7141
|
// contract is shared with the action SDK (`./connector-template`).
|
|
7140
7142
|
// 1.279.0: additive (sc-18049) — useI18n() returns formatDate(value, { time }?),
|
|
7141
7143
|
// a date in the app's language with its month named; "—" when empty.
|
|
7142
|
-
|
|
7144
|
+
// 1.280.0: additive (sc-18010) — connections.add and connections.signIn
|
|
7145
|
+
// may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
|
|
7146
|
+
// app's administrator to register it first. No token fixes it.
|
|
7147
|
+
version: "1.280.0",
|
|
7143
7148
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7144
7149
|
hooks: HOOKS,
|
|
7145
7150
|
primitives: PRIMITIVES,
|
package/dist/index.d.ts
CHANGED
|
@@ -2249,8 +2249,9 @@ export interface AgentConnections {
|
|
|
2249
2249
|
error: AgentError | null;
|
|
2250
2250
|
/**
|
|
2251
2251
|
* Rejects AgentError: TOO_MANY_CONNECTIONS, NAME_IN_USE, INVALID_SERVER_URL, SERVER_UNREACHABLE,
|
|
2252
|
-
* NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN, SIGN_IN_NOT_SUPPORTED
|
|
2253
|
-
*
|
|
2252
|
+
* NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN, SIGN_IN_NOT_SUPPORTED, SIGN_IN_NEEDS_SETUP (the server's
|
|
2253
|
+
* sign-in needs the app's administrator to register it first; no token fixes it). An empty token to a
|
|
2254
|
+
* server that asks people to sign in answers an `oauth` item with status `needs_sign_in`.
|
|
2254
2255
|
*/
|
|
2255
2256
|
add(body: { name: string; server_url: string; token: string }): Promise<AgentMcpConnection>;
|
|
2256
2257
|
/** Reconnects and re-reads the server's tools. */
|
|
@@ -2260,7 +2261,7 @@ export interface AgentConnections {
|
|
|
2260
2261
|
/**
|
|
2261
2262
|
* sc-17590 — signs the person in to an `oauth` server, run by the host. Absent where the host
|
|
2262
2263
|
* cannot (the studio canvas, older hosts): offer no Sign in action then. Rejects AgentError:
|
|
2263
|
-
* SIGN_IN_CANCELLED, SIGN_IN_FAILED, CONFIRM_INVALID, NOT_A_SIGN_IN_SERVER, SERVER_UNREACHABLE,
|
|
2264
|
+
* SIGN_IN_CANCELLED, SIGN_IN_FAILED, CONFIRM_INVALID, NOT_A_SIGN_IN_SERVER, SIGN_IN_NEEDS_SETUP, SERVER_UNREACHABLE,
|
|
2264
2265
|
* RATE_LIMITED. On web the page leaves for the sign-in and the promise never settles.
|
|
2265
2266
|
*/
|
|
2266
2267
|
signIn?(id: string): Promise<AgentMcpConnection>;
|
package/package.json
CHANGED
package/src/contract.js
CHANGED
|
@@ -2287,13 +2287,15 @@ const HOOKS = [
|
|
|
2287
2287
|
"false on a 403 — APP_USER_SESSION_REQUIRED (the studio canvas, a preview or a signed-out visitor) or " +
|
|
2288
2288
|
"TOOLS_NOT_ENABLED (the author has not let app users connect tools to this agent). add, test and " +
|
|
2289
2289
|
"remove reject with AgentError: TOO_MANY_CONNECTIONS and NAME_IN_USE (409), INVALID_SERVER_URL, " +
|
|
2290
|
-
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN
|
|
2290
|
+
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN, SIGN_IN_NOT_SUPPORTED and " +
|
|
2291
|
+
"SIGN_IN_NEEDS_SETUP (422). SIGN_IN_NEEDS_SETUP means the server's sign-in needs the app's " +
|
|
2292
|
+
"administrator to register it first: tell the user to ask them, and do NOT open a token field for it. " +
|
|
2291
2293
|
"SIGN-IN (sc-17590): add with an empty token to a server that asks people to sign in answers " +
|
|
2292
2294
|
"auth_kind 'oauth', status 'needs_sign_in'. Offer a Sign in action on an 'oauth' item whose status is " +
|
|
2293
2295
|
"not 'connected', and ONLY when `connections.signIn` is a function (the host runs the sign-in; it is " +
|
|
2294
2296
|
"absent on the studio canvas and on older hosts, so never show a dead button). signIn(id) resolves to " +
|
|
2295
2297
|
"the connected item or rejects AgentError: SIGN_IN_CANCELLED, SIGN_IN_FAILED, CONFIRM_INVALID, " +
|
|
2296
|
-
"NOT_A_SIGN_IN_SERVER, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2298
|
+
"NOT_A_SIGN_IN_SERVER, SIGN_IN_NEEDS_SETUP, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2297
2299
|
"the call never settles; when the page loads again `connections.signInResult` is " +
|
|
2298
2300
|
"{ connection, error } for that sign-in (null otherwise): show the outcome from it. " +
|
|
2299
2301
|
"A turn that used one of them carries an activity entry { tool: 'mcp', ok, server } " +
|
|
@@ -7139,7 +7141,10 @@ const CONTRACT = deepFreeze({
|
|
|
7139
7141
|
// contract is shared with the action SDK (`./connector-template`).
|
|
7140
7142
|
// 1.279.0: additive (sc-18049) — useI18n() returns formatDate(value, { time }?),
|
|
7141
7143
|
// a date in the app's language with its month named; "—" when empty.
|
|
7142
|
-
|
|
7144
|
+
// 1.280.0: additive (sc-18010) — connections.add and connections.signIn
|
|
7145
|
+
// may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
|
|
7146
|
+
// app's administrator to register it first. No token fixes it.
|
|
7147
|
+
version: "1.280.0",
|
|
7143
7148
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7144
7149
|
hooks: HOOKS,
|
|
7145
7150
|
primitives: PRIMITIVES,
|