inistate-mcp 1.3.1 → 1.3.3
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/build/authorize-app-routes.d.ts +3 -0
- package/build/authorize-app-routes.js +90 -0
- package/build/client-store.js +6 -1
- package/build/http.js +15 -1
- package/build/oauth-provider.d.ts +20 -0
- package/build/oauth-provider.js +67 -1
- package/build/schema.d.ts +3 -0
- package/build/schema.js +22 -1
- package/build/tools.js +9 -0
- package/inistate-schema.json +10 -0
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
import { browserSecretCookieName, browserSecretCookieOptions, readCookie, } from "./oauth-provider.js";
|
|
3
|
+
/**
|
|
4
|
+
* SS06370: the Inistate App approves a flow natively (no cookie), then hands the user to the
|
|
5
|
+
* browser that started it. See ParkedApproval in oauth-provider.ts for why both the cookie and
|
|
6
|
+
* the finish token are required.
|
|
7
|
+
*
|
|
8
|
+
* POST /authorize/app-callback the App: nonce, jwt, refreshToken -> 302 to /authorize/finish
|
|
9
|
+
* GET /authorize/finish the browser: confirmation page (cookie + token)
|
|
10
|
+
* POST /authorize/finish the browser: Confirm -> 302 to the client with the code
|
|
11
|
+
*/
|
|
12
|
+
const escapeHtml = (s) => s.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
13
|
+
function page(res, status, title, body) {
|
|
14
|
+
res
|
|
15
|
+
.status(status)
|
|
16
|
+
.set({
|
|
17
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
18
|
+
"Cache-Control": "no-store",
|
|
19
|
+
"Referrer-Policy": "no-referrer",
|
|
20
|
+
// The Confirm button must not be clickjackable from another origin.
|
|
21
|
+
"X-Frame-Options": "DENY",
|
|
22
|
+
"Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; form-action 'self'; frame-ancestors 'none'",
|
|
23
|
+
})
|
|
24
|
+
.send(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">` +
|
|
25
|
+
`<title>${escapeHtml(title)}</title><style>body{font:16px system-ui,sans-serif;max-width:28rem;margin:3rem auto;padding:0 1rem}` +
|
|
26
|
+
`button{font:inherit;padding:.6rem 1.2rem}</style></head><body>${body}</body></html>`);
|
|
27
|
+
}
|
|
28
|
+
function failure(res, error) {
|
|
29
|
+
const message = error instanceof Error ? error.message : "Authorization failed";
|
|
30
|
+
if (/does not belong to this browser|Invalid finish token/.test(message)) {
|
|
31
|
+
page(res, 400, "Open this link in the original browser", `<h1>Open this link in the original browser</h1><p>Finish connecting in the same browser where you started from ChatGPT or Claude, then try again.</p>`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
res.status(400).type("text/plain").send(message);
|
|
35
|
+
}
|
|
36
|
+
export function registerAppAuthorizeRoutes(app, provider, issuerUrl) {
|
|
37
|
+
const secure = issuerUrl.startsWith("https:");
|
|
38
|
+
const base = issuerUrl.replace(/\/$/, "");
|
|
39
|
+
app.post("/authorize/app-callback", express.urlencoded({ extended: false }), async (req, res) => {
|
|
40
|
+
try {
|
|
41
|
+
const { nonce, jwt, refreshToken } = req.body ?? {};
|
|
42
|
+
if (!nonce || !jwt) {
|
|
43
|
+
res.status(400).send("Missing nonce or jwt");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const { finishToken } = await provider.parkAppApproval(String(nonce), String(jwt), refreshToken ? String(refreshToken) : undefined);
|
|
47
|
+
const finish = new URL(`${base}/authorize/finish`);
|
|
48
|
+
finish.searchParams.set("nonce", String(nonce));
|
|
49
|
+
finish.searchParams.set("token", finishToken);
|
|
50
|
+
res.redirect(302, finish.toString());
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error("App authorize callback error:", error);
|
|
54
|
+
const message = error instanceof Error ? error.message : "Authorization failed";
|
|
55
|
+
// The App maps a 401 to "sign in again" and the exact nonce message to "expired or used".
|
|
56
|
+
res.status(/^Bearer token is invalid/.test(message) ? 401 : 400).send(message);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
app.get("/authorize/finish", (req, res) => {
|
|
60
|
+
try {
|
|
61
|
+
const nonce = String(req.query.nonce ?? "");
|
|
62
|
+
const token = String(req.query.token ?? "");
|
|
63
|
+
const cookie = readCookie(req.headers.cookie, browserSecretCookieName(nonce));
|
|
64
|
+
const info = provider.getFinishInfo(nonce, token, cookie);
|
|
65
|
+
page(res, 200, "Confirm connection", `<h1>Connect ${escapeHtml(info.clientName || "this app")}?</h1>` +
|
|
66
|
+
`<p>It will act as <strong>${escapeHtml(info.account)}</strong> in Inistate.</p>` +
|
|
67
|
+
`<p>Only continue if you just started this from ChatGPT or Claude.</p>` +
|
|
68
|
+
`<form method="post" action="/authorize/finish">` +
|
|
69
|
+
`<input type="hidden" name="nonce" value="${escapeHtml(nonce)}">` +
|
|
70
|
+
`<input type="hidden" name="token" value="${escapeHtml(token)}">` +
|
|
71
|
+
`<button type="submit">Confirm</button></form>`);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
failure(res, error);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
app.post("/authorize/finish", express.urlencoded({ extended: false }), (req, res) => {
|
|
78
|
+
try {
|
|
79
|
+
const nonce = String(req.body?.nonce ?? "");
|
|
80
|
+
const token = String(req.body?.token ?? "");
|
|
81
|
+
const cookieName = browserSecretCookieName(nonce);
|
|
82
|
+
const { redirectUrl } = provider.completeParkedAuthorization(nonce, token, readCookie(req.headers.cookie, cookieName));
|
|
83
|
+
res.clearCookie(cookieName, { path: browserSecretCookieOptions(secure).path });
|
|
84
|
+
res.redirect(302, redirectUrl);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
failure(res, error);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
package/build/client-store.js
CHANGED
|
@@ -61,7 +61,12 @@ export class FileClientsStore {
|
|
|
61
61
|
try {
|
|
62
62
|
if (!existsSync(this.file))
|
|
63
63
|
return;
|
|
64
|
-
const
|
|
64
|
+
const raw = readFileSync(this.file, "utf8");
|
|
65
|
+
// A zero-byte file (e.g. pre-created with `touch`) is an empty store, not corruption;
|
|
66
|
+
// treating it as corrupt would disable persistence for the whole process.
|
|
67
|
+
if (!raw.trim())
|
|
68
|
+
return;
|
|
69
|
+
const parsed = JSON.parse(raw);
|
|
65
70
|
if (!Array.isArray(parsed)) {
|
|
66
71
|
console.error(`OAuth client store at ${this.file} is not a JSON array — ignoring it`);
|
|
67
72
|
return;
|
package/build/http.js
CHANGED
|
@@ -11,6 +11,7 @@ import { createServer } from "./server.js";
|
|
|
11
11
|
import { requestContext } from "./context.js";
|
|
12
12
|
import { InistateOAuthProvider, decodeJwtSub, isConnectionToken, connectionModeKey, browserSecretCookieName, browserSecretCookieOptions, readCookie, SUPPORTED_SCOPES, } from "./oauth-provider.js";
|
|
13
13
|
import { getUserMode } from "./mode-store.js";
|
|
14
|
+
import { registerAppAuthorizeRoutes } from "./authorize-app-routes.js";
|
|
14
15
|
const PORT = parseInt(process.env.PORT || "3000", 10);
|
|
15
16
|
const BASE_URL = process.env.INISTATE_API_BASE ||
|
|
16
17
|
process.env.INISTATE_API_URL ||
|
|
@@ -20,8 +21,18 @@ const ISSUER_URL = process.env.OAUTH_ISSUER_URL || `http://localhost:${PORT}`;
|
|
|
20
21
|
const APP_URL = process.env.INISTATE_APP_URL || "https://app.inistate.com";
|
|
21
22
|
const APP_LOGIN_PATH = process.env.INISTATE_APP_LOGIN_PATH || "/#/login";
|
|
22
23
|
const app = express();
|
|
24
|
+
// Behind nginx (+ CloudFront) every socket peer is the proxy, so without this req.ip is the
|
|
25
|
+
// same for every caller and the per-IP rate limiters share one bucket across all users.
|
|
26
|
+
// Set TRUST_PROXY to the number of proxy hops in front of this process (nginx + CloudFront = 2).
|
|
27
|
+
const TRUST_PROXY = process.env.TRUST_PROXY;
|
|
28
|
+
if (TRUST_PROXY) {
|
|
29
|
+
app.set("trust proxy", /^\d+$/.test(TRUST_PROXY) ? Number(TRUST_PROXY) : TRUST_PROXY);
|
|
30
|
+
}
|
|
31
|
+
// DCR is unauthenticated and Claude registers from shared Anthropic egress IPs, so the SDK's
|
|
32
|
+
// default of 20/hour per IP locks out new users ("Couldn't register with Inistate's sign-in service").
|
|
33
|
+
const REGISTRATION_RATE_LIMIT = Number(process.env.OAUTH_REGISTRATION_RATE_LIMIT) || 300;
|
|
23
34
|
/* ------------------------------------------------------------------ */
|
|
24
|
-
/* CORS (must come before routes)
|
|
35
|
+
/* CORS (must come before routes) */
|
|
25
36
|
/* ------------------------------------------------------------------ */
|
|
26
37
|
app.use((_req, res, next) => {
|
|
27
38
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
@@ -47,6 +58,7 @@ app.use(mcpAuthRouter({
|
|
|
47
58
|
baseUrl: new URL(ISSUER_URL),
|
|
48
59
|
resourceServerUrl: new URL("/mcp", ISSUER_URL),
|
|
49
60
|
scopesSupported: SUPPORTED_SCOPES,
|
|
61
|
+
clientRegistrationOptions: { rateLimit: { max: REGISTRATION_RATE_LIMIT } },
|
|
50
62
|
}));
|
|
51
63
|
/* ------------------------------------------------------------------ */
|
|
52
64
|
/* OAuth authorize callback (login page POSTs here) */
|
|
@@ -71,6 +83,8 @@ app.post("/authorize/callback", express.urlencoded({ extended: false }), (req, r
|
|
|
71
83
|
res.status(400).send(error instanceof Error ? error.message : "Authorization failed");
|
|
72
84
|
}
|
|
73
85
|
});
|
|
86
|
+
// SS06370: the Inistate App approves natively (no cookie); the originating browser finishes.
|
|
87
|
+
registerAppAuthorizeRoutes(app, oauthProvider, ISSUER_URL);
|
|
74
88
|
/* ------------------------------------------------------------------ */
|
|
75
89
|
/* Health check */
|
|
76
90
|
/* ------------------------------------------------------------------ */
|
|
@@ -82,6 +82,26 @@ export declare class InistateOAuthProvider implements OAuthServerProvider {
|
|
|
82
82
|
completeAuthorization(nonce: string, jwt: string, refreshToken?: string, browserSecret?: string): {
|
|
83
83
|
redirectUrl: string;
|
|
84
84
|
};
|
|
85
|
+
private issueCode;
|
|
86
|
+
/**
|
|
87
|
+
* SS06370: the Inistate App approves a flow it did not start. No cookie is needed (it has
|
|
88
|
+
* none); the approval is parked and the one-time token returned goes back to the App only.
|
|
89
|
+
* The JWT is checked against the backend first so the finish page can name a real account.
|
|
90
|
+
*/
|
|
91
|
+
parkAppApproval(nonce: string, jwt: string, refreshToken?: string): Promise<{
|
|
92
|
+
finishToken: string;
|
|
93
|
+
}>;
|
|
94
|
+
/** What the finish page shows before the user confirms. Needs the cookie and the token. */
|
|
95
|
+
getFinishInfo(nonce: string, finishToken: string, browserSecret?: string): {
|
|
96
|
+
clientName: string;
|
|
97
|
+
account: string;
|
|
98
|
+
};
|
|
99
|
+
/** Finish an App-approved flow: the originating browser (cookie) plus the App's token. */
|
|
100
|
+
completeParkedAuthorization(nonce: string, finishToken: string, browserSecret?: string): {
|
|
101
|
+
redirectUrl: string;
|
|
102
|
+
};
|
|
103
|
+
private livePending;
|
|
104
|
+
private finishablePending;
|
|
85
105
|
challengeForAuthorizationCode(_client: OAuthClientInformationFull, authorizationCode: string): Promise<string>;
|
|
86
106
|
exchangeAuthorizationCode(client: OAuthClientInformationFull, authorizationCode: string): Promise<OAuthTokens>;
|
|
87
107
|
/**
|
package/build/oauth-provider.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
1
|
+
import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
2
2
|
import { FileClientsStore } from "./client-store.js";
|
|
3
3
|
import { InvalidGrantError, TemporarilyUnavailableError } from "@modelcontextprotocol/sdk/server/auth/errors.js";
|
|
4
4
|
const CODE_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
@@ -133,6 +133,12 @@ function expiresInFromExp(exp) {
|
|
|
133
133
|
export function browserSecretCookieName(nonce) {
|
|
134
134
|
return `mcp_auth_${nonce}`;
|
|
135
135
|
}
|
|
136
|
+
/** Constant-time string comparison for secrets. */
|
|
137
|
+
function safeEqual(a, b) {
|
|
138
|
+
const x = Buffer.from(a);
|
|
139
|
+
const y = Buffer.from(b);
|
|
140
|
+
return x.length === y.length && timingSafeEqual(x, y);
|
|
141
|
+
}
|
|
136
142
|
/** The value of one cookie out of a raw Cookie header, or undefined. */
|
|
137
143
|
export function readCookie(header, name) {
|
|
138
144
|
if (!header)
|
|
@@ -198,6 +204,7 @@ export class InistateOAuthProvider {
|
|
|
198
204
|
const browserSecret = randomUUID();
|
|
199
205
|
this.pendingAuth.set(nonce, {
|
|
200
206
|
clientId: client.client_id,
|
|
207
|
+
clientName: client.client_name,
|
|
201
208
|
params,
|
|
202
209
|
createdAt: Date.now(),
|
|
203
210
|
browserSecret,
|
|
@@ -249,6 +256,9 @@ export class InistateOAuthProvider {
|
|
|
249
256
|
throw new Error("Authorization session does not belong to this browser");
|
|
250
257
|
}
|
|
251
258
|
this.pendingAuth.delete(nonce);
|
|
259
|
+
return this.issueCode(pending, jwt, refreshToken);
|
|
260
|
+
}
|
|
261
|
+
issueCode(pending, jwt, refreshToken) {
|
|
252
262
|
const code = randomUUID();
|
|
253
263
|
this.codes.set(code, {
|
|
254
264
|
codeChallenge: pending.params.codeChallenge,
|
|
@@ -266,6 +276,62 @@ export class InistateOAuthProvider {
|
|
|
266
276
|
url.searchParams.set("state", pending.params.state);
|
|
267
277
|
return { redirectUrl: url.toString() };
|
|
268
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* SS06370: the Inistate App approves a flow it did not start. No cookie is needed (it has
|
|
281
|
+
* none); the approval is parked and the one-time token returned goes back to the App only.
|
|
282
|
+
* The JWT is checked against the backend first so the finish page can name a real account.
|
|
283
|
+
*/
|
|
284
|
+
async parkAppApproval(nonce, jwt, refreshToken) {
|
|
285
|
+
const pending = this.livePending(nonce);
|
|
286
|
+
if (pending.parked)
|
|
287
|
+
throw new Error("This authorization was already approved");
|
|
288
|
+
const res = await fetch(`${this.baseUrl}/v1/whoami`, {
|
|
289
|
+
headers: { Authorization: `Bearer ${jwt}`, Accept: "application/json" },
|
|
290
|
+
});
|
|
291
|
+
if (!res.ok)
|
|
292
|
+
throw new Error("Bearer token is invalid or expired");
|
|
293
|
+
const who = (await res.json().catch(() => ({})));
|
|
294
|
+
const account = String(who.userName || who.userId || "your Inistate account");
|
|
295
|
+
// The whoami round trip is a window: re-check, the first approval wins.
|
|
296
|
+
const current = this.livePending(nonce);
|
|
297
|
+
if (current.parked)
|
|
298
|
+
throw new Error("This authorization was already approved");
|
|
299
|
+
const finishToken = randomUUID();
|
|
300
|
+
current.parked = { jwt, refreshToken, finishToken, account };
|
|
301
|
+
return { finishToken };
|
|
302
|
+
}
|
|
303
|
+
/** What the finish page shows before the user confirms. Needs the cookie and the token. */
|
|
304
|
+
getFinishInfo(nonce, finishToken, browserSecret) {
|
|
305
|
+
const pending = this.finishablePending(nonce, finishToken, browserSecret);
|
|
306
|
+
return { clientName: pending.clientName, account: pending.parked.account };
|
|
307
|
+
}
|
|
308
|
+
/** Finish an App-approved flow: the originating browser (cookie) plus the App's token. */
|
|
309
|
+
completeParkedAuthorization(nonce, finishToken, browserSecret) {
|
|
310
|
+
const pending = this.finishablePending(nonce, finishToken, browserSecret);
|
|
311
|
+
this.pendingAuth.delete(nonce);
|
|
312
|
+
return this.issueCode(pending, pending.parked.jwt, pending.parked.refreshToken);
|
|
313
|
+
}
|
|
314
|
+
livePending(nonce) {
|
|
315
|
+
const pending = this.pendingAuth.get(nonce);
|
|
316
|
+
if (!pending)
|
|
317
|
+
throw new Error("Invalid or expired authorization nonce");
|
|
318
|
+
if (Date.now() - pending.createdAt > CODE_TTL_MS) {
|
|
319
|
+
this.pendingAuth.delete(nonce);
|
|
320
|
+
throw new Error("Authorization session expired");
|
|
321
|
+
}
|
|
322
|
+
return pending;
|
|
323
|
+
}
|
|
324
|
+
finishablePending(nonce, finishToken, browserSecret) {
|
|
325
|
+
const pending = this.livePending(nonce);
|
|
326
|
+
if (!browserSecret || browserSecret !== pending.browserSecret) {
|
|
327
|
+
throw new Error("Authorization session does not belong to this browser");
|
|
328
|
+
}
|
|
329
|
+
const parked = pending.parked;
|
|
330
|
+
if (!parked || !finishToken || !safeEqual(finishToken, parked.finishToken)) {
|
|
331
|
+
throw new Error("Invalid finish token");
|
|
332
|
+
}
|
|
333
|
+
return { ...pending, parked, clientName: pending.clientName ?? "" };
|
|
334
|
+
}
|
|
269
335
|
/* ---- PKCE ---- */
|
|
270
336
|
async challengeForAuthorizationCode(_client, authorizationCode) {
|
|
271
337
|
const stored = this.codes.get(authorizationCode);
|
package/build/schema.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export declare const FRONTEND_GUIDE: string;
|
|
|
4
4
|
export declare const SCHEMA_RUNTIME: Record<string, any>;
|
|
5
5
|
export declare const SCHEMA_CONFIGURE: Record<string, any>;
|
|
6
6
|
export declare const VALID_FIELD_TYPES: string[];
|
|
7
|
+
export declare const AI_BLOCKED_CREATE_TYPES: Set<string>;
|
|
8
|
+
/** The field types an AI may create: what design_workflow offers. */
|
|
9
|
+
export declare const AI_CREATABLE_FIELD_TYPES: string[];
|
|
7
10
|
export declare const RESERVED_ACTIVITY_NAMES: string[];
|
|
8
11
|
export declare const RESERVED_INFORMATION_NAMES: string[];
|
|
9
12
|
export declare const VALID_ACTOR_TYPES: string[];
|
package/build/schema.js
CHANGED
|
@@ -95,6 +95,19 @@ export const SCHEMA_RUNTIME = buildSchemaView(RUNTIME_DEFINITIONS, RUNTIME_WORKF
|
|
|
95
95
|
export const SCHEMA_CONFIGURE = buildSchemaView(CONFIGURE_DEFINITIONS, CONFIGURE_WORKFLOW_KEYS);
|
|
96
96
|
// ---------- Derived lookups ----------
|
|
97
97
|
export const VALID_FIELD_TYPES = SCHEMA.definitions.FieldType.enum;
|
|
98
|
+
// SS06300 (ruled 2026-10-16) - the types the platform refuses on a NEW field made by AI
|
|
99
|
+
// (McpCanvasTransformer.AiBlockedCreateTypeKeys): Date Range is internal, and a Formula needs an
|
|
100
|
+
// expression no MCP schema carries, so it would never compute. Existing fields of these types (they
|
|
101
|
+
// carry an id) round-trip on update untouched.
|
|
102
|
+
export const AI_BLOCKED_CREATE_TYPES = new Set(["daterange", "formula"]);
|
|
103
|
+
/** The field types an AI may create: what design_workflow offers. */
|
|
104
|
+
export const AI_CREATABLE_FIELD_TYPES = VALID_FIELD_TYPES.filter((t) => !AI_BLOCKED_CREATE_TYPES.has(t.toLowerCase()));
|
|
105
|
+
/** The platform's wording (McpCanvasTransformer.AiBlockedCreateTypeHintFor). */
|
|
106
|
+
function aiBlockedCreateHint(baseType) {
|
|
107
|
+
return baseType === "formula"
|
|
108
|
+
? "'Formula' is an internal field type that cannot be created by AI: a formula field needs an expression, which cannot be given here, so it would never compute. Model the value as a Number or Currency field instead, and set the formula in Studio if it should be calculated."
|
|
109
|
+
: "'Date Range' is an internal field type that cannot be created by AI. Model a date range as two Date fields instead (e.g. 'Start Date' and 'End Date').";
|
|
110
|
+
}
|
|
98
111
|
// SS06168 — Studio's reserved words (webApp src/components/commons/designValidator.js
|
|
99
112
|
// activityReservedKeywords / informationReservedKeywords). Studio refuses a custom activity or
|
|
100
113
|
// information field with one of these names and shows the module as "Configuration incomplete";
|
|
@@ -622,6 +635,10 @@ export function validateDesign(schema, mode = "create") {
|
|
|
622
635
|
}
|
|
623
636
|
const base = baseTypeOf(ftype);
|
|
624
637
|
const hasConnection = typeof f.connection === "string" && f.connection.trim() !== "";
|
|
638
|
+
// SS06300: mirrors the platform - new fields only, so validate_design cannot pass what create_module refuses.
|
|
639
|
+
if (AI_BLOCKED_CREATE_TYPES.has(base) && (mode === "create" || !f.id)) {
|
|
640
|
+
errors.push(`Information field '${f.name}': ${aiBlockedCreateHint(base)}`);
|
|
641
|
+
}
|
|
625
642
|
if ((base === "selection" || base === "tag")
|
|
626
643
|
&& (!f.options || f.options.length === 0)
|
|
627
644
|
&& !ftype.includes("(")) {
|
|
@@ -651,6 +668,10 @@ export function validateDesign(schema, mode = "create") {
|
|
|
651
668
|
if (subType && !isValidFieldType(subType)) {
|
|
652
669
|
errors.push(`Table field '${f.name}' sub-field '${sf.name}' has invalid type '${sf.type}'.`);
|
|
653
670
|
}
|
|
671
|
+
if (subType && AI_BLOCKED_CREATE_TYPES.has(baseTypeOf(subType))
|
|
672
|
+
&& (mode === "create" || !sf.id)) {
|
|
673
|
+
errors.push(`Sub-field '${sf.name}' in '${f.name}': ${aiBlockedCreateHint(baseTypeOf(subType))}`);
|
|
674
|
+
}
|
|
654
675
|
if (subType && REFERENCE_TYPES_LOWER.has(baseTypeOf(subType))) {
|
|
655
676
|
errors.push(`Table field '${f.name}' sub-field '${sf.name}' has type '${sf.type}' — Module/Modules/User/Users reference types are not supported inside Table sub-fields.`);
|
|
656
677
|
}
|
|
@@ -1025,7 +1046,7 @@ export function normalizeIndustry(industry) {
|
|
|
1025
1046
|
// Returned with every design_workflow call — the design funnel's first step is
|
|
1026
1047
|
// where agents form their vocabulary, so the constraints ride along.
|
|
1027
1048
|
const DESIGN_CONSTRAINTS = {
|
|
1028
|
-
field_types:
|
|
1049
|
+
field_types: AI_CREATABLE_FIELD_TYPES,
|
|
1029
1050
|
state_colors: VALID_COLORS,
|
|
1030
1051
|
reference_fields: "User/Users/Module/Modules fields require 'connection': the name of a module that exists in this workspace. Not supported inside Table sub-fields.",
|
|
1031
1052
|
actors: VALID_ACTOR_TYPES,
|
package/build/tools.js
CHANGED
|
@@ -1162,6 +1162,11 @@ Load resource inistate://schema before modifying to know valid field types, colo
|
|
|
1162
1162
|
body.due = due;
|
|
1163
1163
|
if (ai)
|
|
1164
1164
|
body.ai = ai;
|
|
1165
|
+
// SS06044: the platform checks the approval itself where it matters - the `comment`
|
|
1166
|
+
// standard (hybrid) and an App module's hybrid-tier email recipients (SS05963) - so
|
|
1167
|
+
// the guard's `confirmed` has to travel with the call, not stop at the guard.
|
|
1168
|
+
if (confirmed === true)
|
|
1169
|
+
body.confirmed = true;
|
|
1165
1170
|
if (idempotencyKey)
|
|
1166
1171
|
body.idempotencyKey = idempotencyKey;
|
|
1167
1172
|
if (expectedVersion !== undefined)
|
|
@@ -1423,6 +1428,10 @@ Load resource inistate://schema before modifying to know valid field types, colo
|
|
|
1423
1428
|
};
|
|
1424
1429
|
if (ai)
|
|
1425
1430
|
body.ai = ai;
|
|
1431
|
+
// SS06342: as submit_activity (SS06044) - the platform re-checks the approval itself for
|
|
1432
|
+
// an App send whose recipients need one, so the guard's `confirmed` travels with the call.
|
|
1433
|
+
if (confirmed === true)
|
|
1434
|
+
body.confirmed = true;
|
|
1426
1435
|
log("submit_activities", `module=${moduleName} activity=${activity} count=${items.length}`);
|
|
1427
1436
|
const data = (await backend.submitActivities(body));
|
|
1428
1437
|
const results = Array.isArray(data.results)
|
package/inistate-schema.json
CHANGED
|
@@ -186,6 +186,16 @@
|
|
|
186
186
|
"type": "array",
|
|
187
187
|
"items": { "type": "string" },
|
|
188
188
|
"description": "Subset of allowed options for Selection/Tag fields in this activity. Options may include emoji prefixes. Omit to allow all options."
|
|
189
|
+
},
|
|
190
|
+
"hidden": {
|
|
191
|
+
"type": "boolean",
|
|
192
|
+
"readOnly": true,
|
|
193
|
+
"description": "Read back only (get_module_canvas): this activity's form never shows the field - the designer turned it off and gave it no condition. Same rule get_form reports; submit_activity refuses a value for it. Ignored on input (update_module does not set visibility)."
|
|
194
|
+
},
|
|
195
|
+
"visibleWhen": {
|
|
196
|
+
"type": "string",
|
|
197
|
+
"readOnly": true,
|
|
198
|
+
"description": "Read back only (get_module_canvas): the form shows the field only while this condition holds, written in display names, e.g. {{Skip Reason}}=='Other'. A required field with a condition is required only while it is shown. Ignored on input."
|
|
189
199
|
}
|
|
190
200
|
},
|
|
191
201
|
"additionalProperties": false
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"url": "https://github.com/inistate/inistate-mcp",
|
|
9
9
|
"source": "github"
|
|
10
10
|
},
|
|
11
|
-
"version": "1.3.
|
|
11
|
+
"version": "1.3.3",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
16
16
|
"identifier": "inistate-mcp",
|
|
17
|
-
"version": "1.3.
|
|
17
|
+
"version": "1.3.3",
|
|
18
18
|
"transport": {
|
|
19
19
|
"type": "stdio"
|
|
20
20
|
},
|