@superblocksteam/shared 0.9622.3 → 0.9623.2

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.
Files changed (110) hide show
  1. package/dist/front-door/index.d.ts +167 -0
  2. package/dist/front-door/index.d.ts.map +1 -0
  3. package/dist/front-door/index.js +85 -0
  4. package/dist/front-door/index.js.map +1 -0
  5. package/dist/front-door/index.test.d.ts +2 -0
  6. package/dist/front-door/index.test.d.ts.map +1 -0
  7. package/dist/front-door/index.test.js +91 -0
  8. package/dist/front-door/index.test.js.map +1 -0
  9. package/dist/jwt/index.d.ts +1 -0
  10. package/dist/jwt/index.d.ts.map +1 -1
  11. package/dist/jwt/index.js +1 -0
  12. package/dist/jwt/index.js.map +1 -1
  13. package/dist/jwt/jwksUri.d.ts +3 -0
  14. package/dist/jwt/jwksUri.d.ts.map +1 -0
  15. package/dist/jwt/jwksUri.js +27 -0
  16. package/dist/jwt/jwksUri.js.map +1 -0
  17. package/dist/jwt/jwksUri.test.d.ts +2 -0
  18. package/dist/jwt/jwksUri.test.d.ts.map +1 -0
  19. package/dist/jwt/jwksUri.test.js +35 -0
  20. package/dist/jwt/jwksUri.test.js.map +1 -0
  21. package/dist/socket/protocol.d.ts +2 -0
  22. package/dist/socket/protocol.d.ts.map +1 -1
  23. package/dist/types/ai/index.d.ts +4 -0
  24. package/dist/types/ai/index.d.ts.map +1 -1
  25. package/dist/types/ai/index.js +2 -0
  26. package/dist/types/ai/index.js.map +1 -1
  27. package/dist/types/ai/native-builder-model.d.ts +13 -1
  28. package/dist/types/ai/native-builder-model.d.ts.map +1 -1
  29. package/dist/types/ai/native-builder-model.js +50 -8
  30. package/dist/types/ai/native-builder-model.js.map +1 -1
  31. package/dist/types/ai/native-builder-model.test.js +15 -0
  32. package/dist/types/ai/native-builder-model.test.js.map +1 -1
  33. package/dist/types/ai/prompt-failure-shown-in-chat.d.ts +13 -0
  34. package/dist/types/ai/prompt-failure-shown-in-chat.d.ts.map +1 -0
  35. package/dist/types/ai/prompt-failure-shown-in-chat.js +16 -0
  36. package/dist/types/ai/prompt-failure-shown-in-chat.js.map +1 -0
  37. package/dist/types/ai/turn-in-progress.d.ts +11 -0
  38. package/dist/types/ai/turn-in-progress.d.ts.map +1 -0
  39. package/dist/types/ai/turn-in-progress.js +17 -0
  40. package/dist/types/ai/turn-in-progress.js.map +1 -0
  41. package/dist/types/ai/turn-in-progress.test.d.ts +2 -0
  42. package/dist/types/ai/turn-in-progress.test.d.ts.map +1 -0
  43. package/dist/types/ai/turn-in-progress.test.js +13 -0
  44. package/dist/types/ai/turn-in-progress.test.js.map +1 -0
  45. package/dist/types/application/index.d.ts +2 -0
  46. package/dist/types/application/index.d.ts.map +1 -1
  47. package/dist/types/application/index.js.map +1 -1
  48. package/dist/types/audit/ocsf.d.ts.map +1 -1
  49. package/dist/types/audit/ocsf.js +12 -1
  50. package/dist/types/audit/ocsf.js.map +1 -1
  51. package/dist/types/index.d.ts +2 -0
  52. package/dist/types/index.d.ts.map +1 -1
  53. package/dist/types/index.js +2 -0
  54. package/dist/types/index.js.map +1 -1
  55. package/dist/types/runs/index.d.ts +156 -0
  56. package/dist/types/runs/index.d.ts.map +1 -0
  57. package/dist/types/runs/index.js +52 -0
  58. package/dist/types/runs/index.js.map +1 -0
  59. package/dist/types/runs/index.test.d.ts +2 -0
  60. package/dist/types/runs/index.test.d.ts.map +1 -0
  61. package/dist/types/runs/index.test.js +47 -0
  62. package/dist/types/runs/index.test.js.map +1 -0
  63. package/dist/types/scheduleTriggers/index.d.ts +60 -0
  64. package/dist/types/scheduleTriggers/index.d.ts.map +1 -0
  65. package/dist/types/scheduleTriggers/index.js +17 -0
  66. package/dist/types/scheduleTriggers/index.js.map +1 -0
  67. package/dist/types/scheduleTriggers/index.test.d.ts +2 -0
  68. package/dist/types/scheduleTriggers/index.test.d.ts.map +1 -0
  69. package/dist/types/scheduleTriggers/index.test.js +16 -0
  70. package/dist/types/scheduleTriggers/index.test.js.map +1 -0
  71. package/dist/utils/data-plane-routing.d.ts +24 -0
  72. package/dist/utils/data-plane-routing.d.ts.map +1 -0
  73. package/dist/utils/data-plane-routing.js +29 -0
  74. package/dist/utils/data-plane-routing.js.map +1 -0
  75. package/dist/utils/data-plane-routing.test.d.ts +2 -0
  76. package/dist/utils/data-plane-routing.test.d.ts.map +1 -0
  77. package/dist/utils/data-plane-routing.test.js +37 -0
  78. package/dist/utils/data-plane-routing.test.js.map +1 -0
  79. package/dist/utils/index.d.ts +1 -0
  80. package/dist/utils/index.d.ts.map +1 -1
  81. package/dist/utils/index.js +1 -0
  82. package/dist/utils/index.js.map +1 -1
  83. package/dist/utils/platform-mcp-server-routes.d.ts +50 -1
  84. package/dist/utils/platform-mcp-server-routes.d.ts.map +1 -1
  85. package/dist/utils/platform-mcp-server-routes.js +6 -0
  86. package/dist/utils/platform-mcp-server-routes.js.map +1 -1
  87. package/package.json +11 -6
  88. package/src/front-door/index.test.ts +116 -0
  89. package/src/front-door/index.ts +116 -0
  90. package/src/jwt/index.ts +1 -0
  91. package/src/jwt/jwksUri.test.ts +50 -0
  92. package/src/jwt/jwksUri.ts +30 -0
  93. package/src/socket/protocol.ts +8 -1
  94. package/src/types/ai/index.ts +4 -0
  95. package/src/types/ai/native-builder-model.test.ts +16 -0
  96. package/src/types/ai/native-builder-model.ts +58 -10
  97. package/src/types/ai/prompt-failure-shown-in-chat.ts +18 -0
  98. package/src/types/ai/turn-in-progress.test.ts +15 -0
  99. package/src/types/ai/turn-in-progress.ts +19 -0
  100. package/src/types/application/index.ts +2 -0
  101. package/src/types/audit/ocsf.ts +12 -1
  102. package/src/types/index.ts +2 -0
  103. package/src/types/runs/index.test.ts +66 -0
  104. package/src/types/runs/index.ts +277 -0
  105. package/src/types/scheduleTriggers/index.test.ts +24 -0
  106. package/src/types/scheduleTriggers/index.ts +103 -0
  107. package/src/utils/data-plane-routing.test.ts +41 -0
  108. package/src/utils/data-plane-routing.ts +36 -0
  109. package/src/utils/index.ts +1 -0
  110. package/src/utils/platform-mcp-server-routes.ts +39 -0
@@ -1 +1 @@
1
- {"version":3,"file":"platform-mcp-server-routes.d.ts","sourceRoot":"","sources":["../../src/utils/platform-mcp-server-routes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,YACrC,sBAAsB,EACtB,0BAA0B,EAC1B,4BAA4B,EAC5B,yCAAyC,EACzC,qCAAqC,EACrC,oCAAoC,EACpC,+CAA+C,EAE/C,0CAA0C,EAC1C,yCAAyC,EAEzC,2CAA2C,EAC3C,2CAA2C,EAC3C,2CAA2C,EAC3C,wCAAwC,EAExC,+CAA+C,EAC/C,uDAAuD,EACvD,8CAA8C,EAC9C,yCAAyC,EAEzC,wCAAwC,EACxC,4CAA4C,EAC5C,4CAA4C,EAC5C,oCAAoC,EACpC,+CAA+C,EAC/C,sCAAsC,EACtC,+CAA+C,EAC/C,mCAAmC,EACnC,4BAA4B,EAC5B,sCAAsC,EACtC,2BAA2B,EAC3B,mCAAmC,EAEnC,4BAA4B,EAE5B,6BAA6B,EAE7B,2BAA2B,CACnB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF,qDAAqD;AACrD,KAAK,aAAa,CAAC,KAAK,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,EAAE,GAAG,EAAE,IAAI,KAAK,SAAS,GAAG,MAAM,IAAI,MAAM,IAAI,EAAE,GAC5G,aAAa,CAAC,IAAI,EAAE,CAAC,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,GACxC,MAAM,CAAC;AAEX;;;GAGG;AACH,qBAAa,wBAAwB;IAIjC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAJvB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAQ;IAEtC,OAAO,eAGH;IAEJ,wEAAwE;IACxE,MAAM,CAAC,EAAE,CAAC,KAAK,SAAS,sBAAsB,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,wBAAwB,CAQzH;CACF"}
1
+ {"version":3,"file":"platform-mcp-server-routes.d.ts","sourceRoot":"","sources":["../../src/utils/platform-mcp-server-routes.ts"],"names":[],"mappings":"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"}
@@ -30,6 +30,9 @@ export const PLATFORM_MCP_SERVER_ROUTES = [
30
30
  'GET /api/v2/applications/*/deploy-status/*',
31
31
  'GET /api/v3/applications/*/connect',
32
32
  'GET /api/v3/applications/*/branches/*/connect',
33
+ // Which entry point and export an SDK API's registered name runs, deployed or on a branch.
34
+ 'GET /api/v3/applications/*/apis/*/entry',
35
+ 'GET /api/v3/applications/*/branches/*/apis/*/entry',
33
36
  'POST /api/v3/applications/*/*/builds',
34
37
  'POST /api/v3/applications/*/build-bulk-status',
35
38
  'GET /api/v1/integrations/superset',
@@ -39,6 +42,9 @@ export const PLATFORM_MCP_SERVER_ROUTES = [
39
42
  'POST /api/v1/ai/generate-app-name',
40
43
  // Reports what the Builder tools did, for usage analytics.
41
44
  'POST /api/v1/builder-usage',
45
+ 'POST /api/v1/mcp/data-plane',
46
+ // Where the hosted live canvas sends the app's API calls; never an agent record an organization registered.
47
+ 'GET /api/v1/mcp/data-plane/destination',
42
48
  // The plan check every Builder tool runs first, assertEnterprisePlan in @superblocksteam/mcp-server.
43
49
  'GET /api/v1/public/users/me',
44
50
  // The server limits the tools token here to the scopes the Builder tools mint.
@@ -1 +1 @@
1
- {"version":3,"file":"platform-mcp-server-routes.js","sourceRoot":"","sources":["../../src/utils/platform-mcp-server-routes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,sBAAsB;IACtB,0BAA0B;IAC1B,4BAA4B;IAC5B,yCAAyC;IACzC,qCAAqC;IACrC,oCAAoC;IACpC,+CAA+C;IAC/C,kGAAkG;IAClG,0CAA0C;IAC1C,yCAAyC;IACzC,yFAAyF;IACzF,2CAA2C;IAC3C,2CAA2C;IAC3C,2CAA2C;IAC3C,wCAAwC;IACxC,0GAA0G;IAC1G,+CAA+C;IAC/C,uDAAuD;IACvD,8CAA8C;IAC9C,yCAAyC;IACzC,yGAAyG;IACzG,wCAAwC;IACxC,4CAA4C;IAC5C,4CAA4C;IAC5C,oCAAoC;IACpC,+CAA+C;IAC/C,sCAAsC;IACtC,+CAA+C;IAC/C,mCAAmC;IACnC,4BAA4B;IAC5B,sCAAsC;IACtC,2BAA2B;IAC3B,mCAAmC;IACnC,2DAA2D;IAC3D,4BAA4B;IAC5B,qGAAqG;IACrG,6BAA6B;IAC7B,+EAA+E;IAC/E,2BAA2B;CACnB,CAAC;AASX;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAIxB,MAAM;IACN,IAAI;IAJE,aAAa,GAAG,IAAI,CAAC;IAEtC,YACW,MAAc,EACd,IAAY;sBADZ,MAAM;oBACN,IAAI;IACZ,CAAC;IAEJ,wEAAwE;IACxE,MAAM,CAAC,EAAE,CAAuC,KAAY,EAAE,GAAG,QAA8B;QAC7F,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,QAAQ,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtD,kHAAkH;QAClH,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC;QACnF,IAAI,UAAU,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,IAAI,UAAU,qCAAqC,KAAK,EAAE,CAAC,CAAC;QAC1G,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACzF,OAAO,IAAI,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF"}
1
+ {"version":3,"file":"platform-mcp-server-routes.js","sourceRoot":"","sources":["../../src/utils/platform-mcp-server-routes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,sBAAsB;IACtB,0BAA0B;IAC1B,4BAA4B;IAC5B,yCAAyC;IACzC,qCAAqC;IACrC,oCAAoC;IACpC,+CAA+C;IAC/C,kGAAkG;IAClG,0CAA0C;IAC1C,yCAAyC;IACzC,yFAAyF;IACzF,2CAA2C;IAC3C,2CAA2C;IAC3C,2CAA2C;IAC3C,wCAAwC;IACxC,0GAA0G;IAC1G,+CAA+C;IAC/C,uDAAuD;IACvD,8CAA8C;IAC9C,yCAAyC;IACzC,yGAAyG;IACzG,wCAAwC;IACxC,4CAA4C;IAC5C,4CAA4C;IAC5C,oCAAoC;IACpC,+CAA+C;IAC/C,2FAA2F;IAC3F,yCAAyC;IACzC,oDAAoD;IACpD,sCAAsC;IACtC,+CAA+C;IAC/C,mCAAmC;IACnC,4BAA4B;IAC5B,sCAAsC;IACtC,2BAA2B;IAC3B,mCAAmC;IACnC,2DAA2D;IAC3D,4BAA4B;IAC5B,6BAA6B;IAC7B,4GAA4G;IAC5G,wCAAwC;IACxC,qGAAqG;IACrG,6BAA6B;IAC7B,+EAA+E;IAC/E,2BAA2B;CACnB,CAAC;AA0CX;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAIxB,MAAM;IACN,IAAI;IAJE,aAAa,GAAG,IAAI,CAAC;IAEtC,YACW,MAAc,EACd,IAAY;sBADZ,MAAM;oBACN,IAAI;IACZ,CAAC;IAEJ,wEAAwE;IACxE,MAAM,CAAC,EAAE,CAAuC,KAAY,EAAE,GAAG,QAA8B;QAC7F,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,QAAQ,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtD,kHAAkH;QAClH,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC;QACnF,IAAI,UAAU,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,IAAI,UAAU,qCAAqC,KAAK,EAAE,CAAC,CAAC;QAC1G,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACzF,OAAO,IAAI,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/shared",
3
- "version": "0.9622.3",
3
+ "version": "0.9623.2",
4
4
  "description": "Superblocks Shared Resources",
5
5
  "license": "Superblocks Community Software License",
6
6
  "repository": {
@@ -25,6 +25,10 @@
25
25
  "./js-tokenizer": {
26
26
  "types": "./dist/types/plugin/js-tokenizer.d.ts",
27
27
  "default": "./dist/types/plugin/js-tokenizer.js"
28
+ },
29
+ "./front-door": {
30
+ "types": "./dist/front-door/index.d.ts",
31
+ "default": "./dist/front-door/index.js"
28
32
  }
29
33
  },
30
34
  "publishConfig": {
@@ -51,7 +55,8 @@
51
55
  "pdf-lib": "1.17.1",
52
56
  "semver": "^7.8.5",
53
57
  "slugify": "^1.6.9",
54
- "uuid": "^11.1.1"
58
+ "uuid": "^11.1.1",
59
+ "zod": "^4.6.7"
55
60
  },
56
61
  "devDependencies": {
57
62
  "@eslint/js": "^9.39.5",
@@ -61,12 +66,12 @@
61
66
  "@typescript/native": "npm:typescript@^7.0.2",
62
67
  "@vitest/coverage-v8": "^4.1.12",
63
68
  "chokidar-cli": "3.0.0",
64
- "eslint": "^9.39.2",
69
+ "eslint": "^9.39.5",
65
70
  "eslint-config-prettier": "^10.1.8",
66
- "eslint-config-turbo": "^2.9.16",
67
- "eslint-import-resolver-typescript": "^4.4.4",
71
+ "eslint-config-turbo": "^2.11.11",
72
+ "eslint-import-resolver-typescript": "^4.4.5",
68
73
  "eslint-plugin-import": "^2.32.0",
69
- "eslint-plugin-oxlint": "1.90.0",
74
+ "eslint-plugin-oxlint": "1.93.0",
70
75
  "globals": "^17.13.0",
71
76
  "typescript": "npm:@typescript/typescript6@^6.0.2",
72
77
  "typescript-eslint": "^8.72.0",
@@ -0,0 +1,116 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import {
4
+ frontDoorCancelRequestSchema,
5
+ frontDoorTurnEventSchema,
6
+ frontDoorTurnRequestSchema,
7
+ mintRefusalSchema,
8
+ mintRequestSchema,
9
+ mintResponseSchema,
10
+ turnStartRefusalSchema
11
+ } from './index.js';
12
+
13
+ const thread = { enterpriseOrTeamId: 'E123', channelId: 'C123', threadTs: '1700000000.000100' };
14
+
15
+ const turnRequest = {
16
+ eventId: 'Ev123',
17
+ channel: 'slack',
18
+ thread,
19
+ message: { ts: '1700000001.000200', text: 'Expense checker: is this receipt OK?' },
20
+ threadContext: [{ ts: '1700000000.000100', userId: 'U1', text: 'root message' }]
21
+ };
22
+
23
+ describe('frontDoorTurnRequestSchema', () => {
24
+ it('accepts a full turn request', () => {
25
+ expect(frontDoorTurnRequestSchema.parse(turnRequest)).toEqual(turnRequest);
26
+ });
27
+
28
+ it('keeps accepting a request with a field it does not know', () => {
29
+ expect(frontDoorTurnRequestSchema.safeParse({ ...turnRequest, addedLater: true }).success).toBe(true);
30
+ });
31
+
32
+ it.each([
33
+ ['another channel', { ...turnRequest, channel: 'teams' }],
34
+ ['no thread context', { ...turnRequest, threadContext: undefined }],
35
+ ['an empty event id', { ...turnRequest, eventId: '' }]
36
+ ])('refuses a request with %s', (_, request) => {
37
+ expect(frontDoorTurnRequestSchema.safeParse(request).success).toBe(false);
38
+ });
39
+ });
40
+
41
+ describe('mint', () => {
42
+ const facts = { externalChannel: false, stranger: false, userEnterpriseOrTeamId: 'E123', guest: false };
43
+
44
+ it('accepts a mint request with the Slack facts, and refuses one without them', () => {
45
+ const request = { slackUserId: 'U1', thread, facts };
46
+ expect(mintRequestSchema.parse(request)).toEqual(request);
47
+ expect(mintRequestSchema.safeParse({ slackUserId: 'U1', thread }).success).toBe(false);
48
+ expect(mintRequestSchema.safeParse({ slackUserId: 'U1', thread, facts: { ...facts, stranger: undefined } }).success).toBe(false);
49
+ });
50
+
51
+ it('accepts the Slack names for the link page, and an older gateway that sends none', () => {
52
+ const request = { slackUserId: 'U1', thread, facts, names: { workspaceName: 'Sandbox Workspace', userName: 'Ada Lovelace' } };
53
+ expect(mintRequestSchema.parse(request)).toEqual(request);
54
+ expect(mintRequestSchema.parse({ slackUserId: 'U1', thread, facts, names: {} }).names).toEqual({});
55
+ expect(mintRequestSchema.safeParse({ slackUserId: 'U1', thread, facts, names: { userName: 'x'.repeat(201) } }).success).toBe(false);
56
+ });
57
+
58
+ it('refuses a Slack fact it does not know, so an unknown fact cannot be dropped', () => {
59
+ expect(mintRequestSchema.safeParse({ slackUserId: 'U1', thread, facts: { ...facts, addedLater: true } }).success).toBe(false);
60
+ });
61
+
62
+ it('accepts a person token, and refuses one with no expiry', () => {
63
+ expect(mintResponseSchema.parse({ token: 'jwt', expiresAt: 1700000000000 })).toEqual({ token: 'jwt', expiresAt: 1700000000000 });
64
+ expect(mintResponseSchema.safeParse({ token: 'jwt' }).success).toBe(false);
65
+ });
66
+ });
67
+
68
+ describe('frontDoorTurnEventSchema', () => {
69
+ it.each([
70
+ { type: 'turn.started', agentName: 'Expense checker' },
71
+ { type: 'status', text: 'Getting the receipt' },
72
+ { type: 'text-delta', text: 'The receipt ' },
73
+ { type: 'finish', cancelled: false, toolNames: ['Get receipt', 'Check policy'] },
74
+ { type: 'error', code: 'agent_error', message: 'The agent failed' },
75
+ { type: 'error', code: 'internal_error', message: 'The server failed' }
76
+ ])('accepts a $type event', (event) => {
77
+ expect(frontDoorTurnEventSchema.parse(event)).toEqual(event);
78
+ });
79
+
80
+ it.each([
81
+ ['an unknown type', { type: 'tool-call', toolName: 'List users' }],
82
+ ['a start without the agent name', { type: 'turn.started' }],
83
+ ['an unknown error code', { type: 'error', code: 'SESSION_EXPIRED', message: 'expired' }]
84
+ ])('refuses %s', (_, event) => {
85
+ expect(frontDoorTurnEventSchema.safeParse(event).success).toBe(false);
86
+ });
87
+ });
88
+
89
+ describe('refusal codes', () => {
90
+ it.each(['external_context', 'user_inactive', 'slack_disabled', 'install_mismatch'])('accepts the mint refusal %s', (code) => {
91
+ expect(mintRefusalSchema.parse({ code })).toEqual({ code });
92
+ });
93
+
94
+ it('requires the link page with not_linked', () => {
95
+ const notLinked = { code: 'not_linked', linkUrl: 'https://app.example.com/slack/link?token=abc' };
96
+ expect(mintRefusalSchema.parse(notLinked)).toEqual(notLinked);
97
+ expect(mintRefusalSchema.safeParse({ code: 'not_linked' }).success).toBe(false);
98
+ });
99
+
100
+ it.each(['duplicate_event', 'turn_in_progress', 'external_context'])('accepts the turn-start refusal %s', (code) => {
101
+ expect(turnStartRefusalSchema.parse({ code })).toEqual({ code });
102
+ });
103
+
104
+ it('refuses an unknown code, and a code from the other endpoint', () => {
105
+ expect(mintRefusalSchema.safeParse({ code: 'rate_limited' }).success).toBe(false);
106
+ expect(mintRefusalSchema.safeParse({ code: 'turn_in_progress' }).success).toBe(false);
107
+ expect(turnStartRefusalSchema.safeParse({ code: 'not_linked' }).success).toBe(false);
108
+ });
109
+ });
110
+
111
+ describe('frontDoorCancelRequestSchema', () => {
112
+ it('accepts a cancel request and refuses one with no Slack user', () => {
113
+ expect(frontDoorCancelRequestSchema.parse({ thread, slackUserId: 'U1' })).toEqual({ thread, slackUserId: 'U1' });
114
+ expect(frontDoorCancelRequestSchema.safeParse({ thread }).success).toBe(false);
115
+ });
116
+ });
@@ -0,0 +1,116 @@
1
+ // Wire contract between the Slack gateway and the server's front-door endpoints.
2
+ // Objects strip unknown keys, so an added field is safe during a rollout. A new event type, code or
3
+ // Slack fact is not: the older side refuses it, so the reader must ship before the writer uses it.
4
+ import { z } from 'zod';
5
+
6
+ const slackId = z.string().min(1);
7
+
8
+ /** A Slack thread. The enterprise ID is used for org-wide installs, else the team ID. */
9
+ export const slackThreadRefSchema = z.object({
10
+ enterpriseOrTeamId: slackId,
11
+ channelId: slackId,
12
+ threadTs: slackId
13
+ });
14
+ export type SlackThreadRef = z.infer<typeof slackThreadRefSchema>;
15
+
16
+ /**
17
+ * What the gateway read from Slack about the asker and the channel. The server decides whether they are external.
18
+ * Strict, so a fact the server does not know refuses the mint instead of being dropped and letting the turn through.
19
+ */
20
+ export const slackFactsSchema = z
21
+ .object({
22
+ externalChannel: z.boolean(),
23
+ /** Slack's `is_stranger`: the user is from an organization outside the install. */
24
+ stranger: z.boolean(),
25
+ /** The user's enterprise ID, else team ID. */
26
+ userEnterpriseOrTeamId: slackId,
27
+ guest: z.boolean()
28
+ })
29
+ .strict();
30
+ export type SlackFacts = z.infer<typeof slackFactsSchema>;
31
+
32
+ /** The Slack names the link page shows, so a person sees which Slack account and workspace they are linking. */
33
+ export const slackDisplayNamesSchema = z.object({
34
+ workspaceName: z.string().trim().min(1).max(200).optional(),
35
+ userName: z.string().trim().min(1).max(200).optional()
36
+ });
37
+ export type SlackDisplayNames = z.infer<typeof slackDisplayNamesSchema>;
38
+
39
+ /** Asks the server to act for the Slack user. The server resolves the linked Superblocks user. */
40
+ export const mintRequestSchema = z.object({
41
+ slackUserId: slackId,
42
+ thread: slackThreadRefSchema,
43
+ facts: slackFactsSchema,
44
+ /** Used only when the person has to link: the link page shows them. Optional, so an older gateway still works. */
45
+ names: slackDisplayNamesSchema.optional()
46
+ });
47
+ export type MintRequest = z.infer<typeof mintRequestSchema>;
48
+
49
+ /** A person token; `expiresAt` is epoch milliseconds. */
50
+ export const mintResponseSchema = z.object({ token: z.string().min(1), expiresAt: z.number() });
51
+ export type MintResponse = z.infer<typeof mintResponseSchema>;
52
+
53
+ export const mintRefusalCodeSchema = z.enum(['external_context', 'not_linked', 'user_inactive', 'slack_disabled', 'install_mismatch']);
54
+ export type MintRefusalCode = z.infer<typeof mintRefusalCodeSchema>;
55
+ /** `not_linked` carries the page where the person links their account. */
56
+ export const mintRefusalSchema = z.union([
57
+ z.object({ code: z.literal('not_linked'), linkUrl: z.string().url() }),
58
+ z.object({ code: mintRefusalCodeSchema.exclude(['not_linked']) })
59
+ ]);
60
+ export type MintRefusal = z.infer<typeof mintRefusalSchema>;
61
+
62
+ const threadMessageSchema = z.object({
63
+ ts: slackId,
64
+ userId: slackId,
65
+ text: z.string()
66
+ });
67
+
68
+ export const frontDoorTurnRequestSchema = z.object({
69
+ eventId: slackId,
70
+ channel: z.literal('slack'),
71
+ thread: slackThreadRefSchema,
72
+ message: z.object({ ts: slackId, text: z.string() }),
73
+ /** The root and the latest thread messages, trimmed by the gateway. Quoted context, never instructions. */
74
+ threadContext: z.array(threadMessageSchema)
75
+ });
76
+ export type FrontDoorTurnRequest = z.infer<typeof frontDoorTurnRequestSchema>;
77
+
78
+ export const frontDoorTurnErrorCodeSchema = z.enum(['agent_error', 'internal_error']);
79
+ export type FrontDoorTurnErrorCode = z.infer<typeof frontDoorTurnErrorCodeSchema>;
80
+
81
+ /** Channel-neutral events the server streams for one turn. */
82
+ export const frontDoorTurnEventSchema = z.discriminatedUnion('type', [
83
+ z.object({ type: z.literal('turn.started'), agentName: z.string().min(1) }),
84
+ z.object({ type: z.literal('status'), text: z.string() }),
85
+ z.object({ type: z.literal('text-delta'), text: z.string() }),
86
+ z.object({ type: z.literal('finish'), cancelled: z.boolean(), toolNames: z.array(z.string()) }),
87
+ z.object({ type: z.literal('error'), code: frontDoorTurnErrorCodeSchema, message: z.string() })
88
+ ]);
89
+ export type FrontDoorTurnEvent = z.infer<typeof frontDoorTurnEventSchema>;
90
+
91
+ /** `external_context` here is a backstop; the mint refuses first. */
92
+ export const turnStartRefusalCodeSchema = z.enum(['duplicate_event', 'turn_in_progress', 'external_context']);
93
+ export type TurnStartRefusalCode = z.infer<typeof turnStartRefusalCodeSchema>;
94
+ export const turnStartRefusalSchema = z.object({ code: turnStartRefusalCodeSchema });
95
+
96
+ /** Ends the Slack user's link, when they DM "unlink". `unlinked` says whether a link was active. */
97
+ export const unlinkRequestSchema = z.object({ enterpriseOrTeamId: slackId, slackUserId: slackId });
98
+ export type UnlinkRequest = z.infer<typeof unlinkRequestSchema>;
99
+ export const unlinkResponseSchema = z.object({ unlinked: z.boolean() });
100
+ export type UnlinkResponse = z.infer<typeof unlinkResponseSchema>;
101
+
102
+ /** Ends every link of the install, on Slack's `app_uninstalled` or `tokens_revoked`. People link again after a reinstall. */
103
+ export const uninstallRequestSchema = z.object({ enterpriseOrTeamId: slackId });
104
+ export type UninstallRequest = z.infer<typeof uninstallRequestSchema>;
105
+ export const uninstallResponseSchema = z.object({ linksEnded: z.number().int().nonnegative() });
106
+ export type UninstallResponse = z.infer<typeof uninstallResponseSchema>;
107
+
108
+ /** The unlink and uninstall routes refuse an install other than the gateway's, as the mint does. */
109
+ export const installRefusalSchema = z.object({ code: z.literal('install_mismatch') });
110
+
111
+ /** Stops the running turn in a thread. Only the person whose turn it is can stop it. */
112
+ export const frontDoorCancelRequestSchema = z.object({
113
+ thread: slackThreadRefSchema,
114
+ slackUserId: slackId
115
+ });
116
+ export type FrontDoorCancelRequest = z.infer<typeof frontDoorCancelRequestSchema>;
package/src/jwt/index.ts CHANGED
@@ -1 +1,2 @@
1
+ export * from './jwksUri.js';
1
2
  export * from './verifier.js';
@@ -0,0 +1,50 @@
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2
+
3
+ import { getJwksUriWithBaseUrl } from './jwksUri.js';
4
+
5
+ const PROD = 'https://prod-cdn.superblocks.com/.well-known/jwks.json';
6
+ const STAGING = 'https://staging-cdn.superblocks.com/.well-known/jwks.json';
7
+
8
+ beforeEach(() => {
9
+ vi.stubEnv('SUPERBLOCKS_JWKS_URI', '');
10
+ vi.stubEnv('SUPERBLOCKS_BASE_URL', '');
11
+ });
12
+
13
+ afterEach(() => {
14
+ vi.unstubAllEnvs();
15
+ });
16
+
17
+ describe('getJwksUriWithBaseUrl', () => {
18
+ it('returns SUPERBLOCKS_JWKS_URI when set', () => {
19
+ vi.stubEnv('SUPERBLOCKS_JWKS_URI', 'https://override.example/.well-known/jwks.json');
20
+ expect(getJwksUriWithBaseUrl('https://app.superblocks.com')).toBe('https://override.example/.well-known/jwks.json');
21
+ });
22
+
23
+ it.each(['https://app.superblocks.com', 'https://app.superblockshq.com', 'https://eu.superblocks.com'])(
24
+ 'maps %s to the prod CDN',
25
+ (baseUrl) => {
26
+ expect(getJwksUriWithBaseUrl(baseUrl)).toBe(PROD);
27
+ }
28
+ );
29
+
30
+ it.each(['https://app.staging.superblocks.com', 'http://localhost:3000', 'http://127.0.0.1:8080'])(
31
+ 'maps %s to the staging CDN',
32
+ (baseUrl) => {
33
+ expect(getJwksUriWithBaseUrl(baseUrl)).toBe(STAGING);
34
+ }
35
+ );
36
+
37
+ it('maps any other origin to that origin', () => {
38
+ expect(getJwksUriWithBaseUrl('https://cloud.example.com:8443/app')).toBe('https://cloud.example.com:8443/.well-known/jwks.json');
39
+ });
40
+
41
+ it('falls back to staging when the base URL cannot be parsed', () => {
42
+ expect(getJwksUriWithBaseUrl('not a url')).toBe(STAGING);
43
+ expect(getJwksUriWithBaseUrl('')).toBe(STAGING);
44
+ });
45
+
46
+ it('reads SUPERBLOCKS_BASE_URL when no base URL is passed', () => {
47
+ vi.stubEnv('SUPERBLOCKS_BASE_URL', 'https://eu.superblocks.com');
48
+ expect(getJwksUriWithBaseUrl()).toBe(PROD);
49
+ });
50
+ });
@@ -0,0 +1,30 @@
1
+ const PROD_JWKS_URI = 'https://prod-cdn.superblocks.com/.well-known/jwks.json';
2
+ const STAGING_JWKS_URI = 'https://staging-cdn.superblocks.com/.well-known/jwks.json';
3
+
4
+ const PROD_CLOUD_HOSTS = ['app.superblocks.com', 'app.superblockshq.com', 'eu.superblocks.com'];
5
+ const STAGING_CLOUD_HOSTS = ['app.staging.superblocks.com'];
6
+
7
+ /** JWKS URL for `superblocksBaseUrl`, or `SUPERBLOCKS_JWKS_URI` when that override is set. */
8
+ export function getJwksUriWithBaseUrl(superblocksBaseUrl?: string): string {
9
+ if (process.env.SUPERBLOCKS_JWKS_URI) {
10
+ return process.env.SUPERBLOCKS_JWKS_URI;
11
+ }
12
+
13
+ const baseUrl = superblocksBaseUrl || process.env.SUPERBLOCKS_BASE_URL || '';
14
+
15
+ try {
16
+ const url = new URL(baseUrl);
17
+ const hostname = url.hostname;
18
+
19
+ if (PROD_CLOUD_HOSTS.includes(hostname)) {
20
+ return PROD_JWKS_URI;
21
+ }
22
+ if (STAGING_CLOUD_HOSTS.includes(hostname) || hostname === 'localhost' || hostname === '127.0.0.1') {
23
+ return STAGING_JWKS_URI;
24
+ }
25
+ // Cloud-prem without an override uses the base URL's own origin.
26
+ return `${url.origin}/.well-known/jwks.json`;
27
+ } catch {
28
+ return STAGING_JWKS_URI;
29
+ }
30
+ }
@@ -200,7 +200,14 @@ export interface ServerMethods {
200
200
  * one, unbound or on Clark, or when the harness does not offer the model.
201
201
  */
202
202
  setBuilderModel: ServerMethodSchema<
203
- { applicationId: string; branchName?: string | null; expectedChatSessionId: string; model: string },
203
+ {
204
+ applicationId: string;
205
+ branchName?: string | null;
206
+ expectedChatSessionId: string;
207
+ model: string;
208
+ /** When set, saved on the chat. Omitted leaves a previously saved effort in place. */
209
+ effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max';
210
+ },
204
211
  { chatSessionId: string; model: string }
205
212
  >;
206
213
  /** Makes an existing chat of the caller's branch the active one. */
@@ -2,6 +2,8 @@ export * from './native-builder-model.js';
2
2
  export * from './builder-caller.js';
3
3
  export * from './chat-changed-elsewhere.js';
4
4
  export * from './editor-restart-required.js';
5
+ export * from './turn-in-progress.js';
6
+ export * from './prompt-failure-shown-in-chat.js';
5
7
  import type { DeploymentTypeEnum, RegionEnum } from '../common/index.js';
6
8
 
7
9
  export type AiChatMessagePayload = Record<string, unknown>;
@@ -200,6 +202,8 @@ export interface AiBuilderBinding {
200
202
  chatSessionId: string;
201
203
  harness: 'clark' | 'codex' | 'claude_code';
202
204
  model?: string;
205
+ /** Saved thinking effort for a native chat. Absent means the organization default. */
206
+ effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max';
203
207
  /** Per-chat conversation id. */
204
208
  runtimeSessionId: string;
205
209
  nativeSessionId?: string;
@@ -15,6 +15,22 @@ describe('NativeBuilderModel', () => {
15
15
  expect(NativeBuilderModel.resolve(harness)).toBe(expected);
16
16
  });
17
17
 
18
+ it('marks only the models whose proxy applies a chosen effort', () => {
19
+ const accepting = Object.values(NATIVE_BUILDER_MODELS)
20
+ .flat()
21
+ .filter((model) => model.acceptsThinkingEffort)
22
+ .map((model) => model.id);
23
+ expect(accepting).toEqual([
24
+ 'gpt-6.1-sol',
25
+ 'gpt-6-astra',
26
+ 'gpt-6.1-terra',
27
+ 'gpt-6-luna',
28
+ 'gpt-5.5',
29
+ 'claude-opus-5-5',
30
+ 'claude-sonnet-5-5'
31
+ ]);
32
+ });
33
+
18
34
  it('accepts every advertised model only for its harness', () => {
19
35
  for (const [harness, models] of Object.entries(NATIVE_BUILDER_MODELS)) {
20
36
  for (const { id } of models) {
@@ -4,19 +4,58 @@ import { BadRequestError } from '../../errors/http.js';
4
4
  /** Total input tokens above which OpenAI Standard long-context rates apply. */
5
5
  const OPENAI_LONG_CONTEXT_THRESHOLD = 272_000;
6
6
 
7
- /** Ordered picker choices; the first model of each harness is its default. */
7
+ /**
8
+ * Ordered picker choices; the first model of each harness is its default.
9
+ * `acceptsThinkingEffort` is true when the inference proxy writes a chosen effort onto that model's request.
10
+ */
8
11
  export const NATIVE_BUILDER_MODELS = {
9
12
  codex: [
10
- { id: 'gpt-6.1-sol', label: 'GPT-6.1 Sol', bedrockRegion: 'us-east-1', longContextThreshold: OPENAI_LONG_CONTEXT_THRESHOLD },
11
- { id: 'gpt-6-astra', label: 'GPT-6 Astra', bedrockRegion: 'us-west-2', longContextThreshold: OPENAI_LONG_CONTEXT_THRESHOLD },
12
- { id: 'gpt-6.1-terra', label: 'GPT-6.1 Terra', bedrockRegion: 'us-east-1', longContextThreshold: OPENAI_LONG_CONTEXT_THRESHOLD },
13
- { id: 'gpt-6-luna', label: 'GPT-6 Luna', bedrockRegion: 'us-east-1', longContextThreshold: OPENAI_LONG_CONTEXT_THRESHOLD },
14
- { id: 'gpt-5.5', label: 'GPT-5.5', bedrockRegion: undefined, longContextThreshold: OPENAI_LONG_CONTEXT_THRESHOLD }
15
- ] as const satisfies readonly { id: string; label: string; bedrockRegion: string | undefined; longContextThreshold: number }[],
13
+ {
14
+ id: 'gpt-6.1-sol',
15
+ label: 'GPT-6.1 Sol',
16
+ bedrockRegion: 'us-east-1',
17
+ longContextThreshold: OPENAI_LONG_CONTEXT_THRESHOLD,
18
+ acceptsThinkingEffort: true
19
+ },
20
+ {
21
+ id: 'gpt-6-astra',
22
+ label: 'GPT-6 Astra',
23
+ bedrockRegion: 'us-west-2',
24
+ longContextThreshold: OPENAI_LONG_CONTEXT_THRESHOLD,
25
+ acceptsThinkingEffort: true
26
+ },
27
+ {
28
+ id: 'gpt-6.1-terra',
29
+ label: 'GPT-6.1 Terra',
30
+ bedrockRegion: 'us-east-1',
31
+ longContextThreshold: OPENAI_LONG_CONTEXT_THRESHOLD,
32
+ acceptsThinkingEffort: true
33
+ },
34
+ {
35
+ id: 'gpt-6-luna',
36
+ label: 'GPT-6 Luna',
37
+ bedrockRegion: 'us-east-1',
38
+ longContextThreshold: OPENAI_LONG_CONTEXT_THRESHOLD,
39
+ acceptsThinkingEffort: true
40
+ },
41
+ {
42
+ id: 'gpt-5.5',
43
+ label: 'GPT-5.5',
44
+ bedrockRegion: undefined,
45
+ longContextThreshold: OPENAI_LONG_CONTEXT_THRESHOLD,
46
+ acceptsThinkingEffort: true
47
+ }
48
+ ] as const satisfies readonly {
49
+ id: string;
50
+ label: string;
51
+ bedrockRegion: string | undefined;
52
+ longContextThreshold: number;
53
+ acceptsThinkingEffort: boolean;
54
+ }[],
16
55
  claude_code: [
17
- { id: 'claude-opus-5-5', label: 'Opus 5.5' },
18
- { id: 'claude-sonnet-5-5', label: 'Sonnet 5.5' }
19
- ]
56
+ { id: 'claude-opus-5-5', label: 'Opus 5.5', acceptsThinkingEffort: true },
57
+ { id: 'claude-sonnet-5-5', label: 'Sonnet 5.5', acceptsThinkingEffort: true }
58
+ ] as const satisfies readonly { id: string; label: string; acceptsThinkingEffort: boolean }[]
20
59
  } as const;
21
60
 
22
61
  /** Model identifiers accepted by a native builder harness. */
@@ -40,4 +79,13 @@ export class NativeBuilderModel {
40
79
  if (!selected) throw new BadRequestError('Unsupported builder model for this harness');
41
80
  return selected.id;
42
81
  }
82
+
83
+ /** True when the inference proxy writes a chosen effort onto this model's request. */
84
+ static acceptsThinkingEffort(modelId: unknown): boolean {
85
+ for (const models of Object.values(NATIVE_BUILDER_MODELS)) {
86
+ const match = models.find((model) => model.id === modelId);
87
+ if (match) return match.acceptsThinkingEffort;
88
+ }
89
+ return false;
90
+ }
43
91
  }
@@ -0,0 +1,18 @@
1
+ import { SocketErrorException } from '../../socket/types.js';
2
+
3
+ /**
4
+ * Refusal for a prompt whose failure the dev server already saved to the chat as the user's message and an error row.
5
+ * Errors cross the editor socket as plain `{ code, message }` objects, so the editor recognizes this one by its code.
6
+ */
7
+ export const PROMPT_FAILURE_SHOWN_IN_CHAT_CODE = 4220;
8
+
9
+ export class PromptFailureShownInChatError extends SocketErrorException {
10
+ constructor(message: string, options?: { cause?: unknown }) {
11
+ super(PROMPT_FAILURE_SHOWN_IN_CHAT_CODE, message);
12
+ this.name = 'PromptFailureShownInChatError';
13
+ if (options && 'cause' in options) this.cause = options.cause;
14
+ }
15
+ }
16
+
17
+ export const isPromptFailureShownInChatError = (error: unknown): boolean =>
18
+ typeof error === 'object' && error !== null && 'code' in error && error.code === PROMPT_FAILURE_SHOWN_IN_CHAT_CODE;
@@ -0,0 +1,15 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { getSwitchStopsTurnMessage, SWITCH_ENDS_WAITING_TURN_MESSAGE, SWITCH_STOPS_WORKING_TURN_MESSAGE } from './turn-in-progress.js';
4
+
5
+ describe('getSwitchStopsTurnMessage', () => {
6
+ it('recognizes each refusal, with or without the socket\'s "Error: " prefix', () => {
7
+ expect(getSwitchStopsTurnMessage({ message: SWITCH_STOPS_WORKING_TURN_MESSAGE })).toBe(SWITCH_STOPS_WORKING_TURN_MESSAGE);
8
+ expect(getSwitchStopsTurnMessage({ message: `Error: ${SWITCH_ENDS_WAITING_TURN_MESSAGE}` })).toBe(SWITCH_ENDS_WAITING_TURN_MESSAGE);
9
+ });
10
+
11
+ it('ignores other failures', () => {
12
+ expect(getSwitchStopsTurnMessage({ message: 'Error: A prompt is starting.' })).toBeUndefined();
13
+ expect(getSwitchStopsTurnMessage(undefined)).toBeUndefined();
14
+ });
15
+ });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Refusals for a harness or model switch while a turn runs. The editor shows them in the switch dialog and, if the
3
+ * user confirms, retries with `stopTurn`. Errors cross the editor socket as plain `{ code, message }` objects, so the
4
+ * editor recognizes these by message.
5
+ */
6
+ export const SWITCH_STOPS_WORKING_TURN_MESSAGE = "The agent is still working. Switching stops it, and work it hasn't finished is lost.";
7
+ export const SWITCH_ENDS_WAITING_TURN_MESSAGE =
8
+ "The agent is waiting for your answer. Switching ends this turn, and you won't be able to answer its question.";
9
+
10
+ /** A harness switch cannot carry a turn's changes to another chat; stopping first would cost the turn and not switch. */
11
+ export const SWITCH_NEEDS_DRAFT_SETTLED_MESSAGE =
12
+ 'The agent has already changed files. Stop it, then accept or reject its changes before switching the harness.';
13
+
14
+ export const getSwitchStopsTurnMessage = (error: unknown): string | undefined => {
15
+ const message = typeof error === 'object' && error !== null && 'message' in error ? error.message : undefined;
16
+ if (typeof message !== 'string') return undefined;
17
+ // A path that rethrows the refusal as a plain Error crosses the socket as "Error: <message>".
18
+ return [SWITCH_STOPS_WORKING_TURN_MESSAGE, SWITCH_ENDS_WAITING_TURN_MESSAGE].find((notice) => message.includes(notice));
19
+ };
@@ -538,6 +538,8 @@ export type PostApplicationCreateRequestBody = {
538
538
  initialPrompt?: string;
539
539
  builderHarness?: AiBuilderBinding['harness'];
540
540
  builderModel?: NativeBuilderModelId;
541
+ /** Saved thinking effort for the first chat. Absent keeps the organization default. */
542
+ builderEffort?: AiBuilderBinding['effort'];
541
543
  };
542
544
  export interface ApplicationPageClonePayload {
543
545
  applicationId: string;
@@ -266,6 +266,7 @@ export const AUDIT_EVENT_TYPE_CATALOG: AuditEventTypeEntry[] = [
266
266
  operations: [
267
267
  'organization.mcp_allowed_clients.update',
268
268
  'organization.mcp_client_approval.update',
269
+ 'organization.mcp_client_request.delete',
269
270
  'organization.npm_allow_install_scripts_changed',
270
271
  'organization.npm_registry.create',
271
272
  'organization.npm_registry.delete',
@@ -311,6 +312,14 @@ export const AUDIT_EVENT_TYPE_CATALOG: AuditEventTypeEntry[] = [
311
312
  'reviewpolicy.enable'
312
313
  ]
313
314
  },
315
+ {
316
+ class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
317
+ class_name: 'ENTITY_MANAGEMENT',
318
+ category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
319
+ category_name: 'APPLICATION_ACTIVITY',
320
+ resource_type: 'Schedule',
321
+ operations: ['schedule.create', 'schedule.delete', 'schedule.pause', 'schedule.resume', 'schedule.update']
322
+ },
314
323
  {
315
324
  class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
316
325
  class_name: 'ENTITY_MANAGEMENT',
@@ -398,7 +407,9 @@ export const AUDIT_EVENT_TYPE_CATALOG: AuditEventTypeEntry[] = [
398
407
  'user.email.update',
399
408
  'user.invite',
400
409
  'user.role.update',
401
- 'user.roles.bulk_update'
410
+ 'user.roles.bulk_update',
411
+ 'user.slack_link.create',
412
+ 'user.slack_link.revoke'
402
413
  ]
403
414
  }
404
415
  ];