@ggui-ai/mcp-server-handlers 0.14.0 → 0.16.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.
Files changed (150) hide show
  1. package/dist/app-discovery/errors.d.ts +2 -2
  2. package/dist/app-discovery/errors.js +2 -2
  3. package/dist/app-discovery/list-gadgets.d.ts +8 -8
  4. package/dist/app-discovery/list-gadgets.d.ts.map +1 -1
  5. package/dist/app-discovery/list-gadgets.js +22 -6
  6. package/dist/app-discovery/list-themes.d.ts +1 -1
  7. package/dist/app-discovery/list-themes.js +2 -2
  8. package/dist/credits/get-credit-balance.d.ts +3 -3
  9. package/dist/credits/get-credit-balance.js +6 -6
  10. package/dist/credits/list-credit-transactions.d.ts +5 -6
  11. package/dist/credits/list-credit-transactions.d.ts.map +1 -1
  12. package/dist/credits/list-credit-transactions.js +4 -4
  13. package/dist/ops-apps/delete-app.d.ts +2 -2
  14. package/dist/ops-apps/delete-app.js +4 -4
  15. package/dist/ops-apps/identity.d.ts +1 -1
  16. package/dist/ops-apps/index.d.ts +2 -2
  17. package/dist/ops-apps/index.d.ts.map +1 -1
  18. package/dist/ops-apps/index.js +1 -1
  19. package/dist/ops-apps/list-apps.d.ts +3 -3
  20. package/dist/ops-apps/list-apps.js +3 -3
  21. package/dist/ops-apps/set-app-theme.d.ts +183 -62
  22. package/dist/ops-apps/set-app-theme.d.ts.map +1 -1
  23. package/dist/ops-apps/set-app-theme.js +99 -58
  24. package/dist/ops-apps/set-default-app.d.ts +1 -1
  25. package/dist/ops-apps/set-default-app.js +2 -2
  26. package/dist/ops-apps/types.d.ts +7 -7
  27. package/dist/ops-apps/types.d.ts.map +1 -1
  28. package/dist/ops-apps/types.js +1 -1
  29. package/dist/ops-apps/update-app.d.ts +3 -3
  30. package/dist/ops-apps/update-app.js +4 -4
  31. package/dist/ops-blueprint/delete.d.ts +3 -3
  32. package/dist/ops-blueprint/delete.js +5 -5
  33. package/dist/ops-blueprint/errors.d.ts +2 -2
  34. package/dist/ops-blueprint/errors.js +2 -2
  35. package/dist/ops-blueprint/register.d.ts +1 -1
  36. package/dist/ops-blueprint/register.js +1 -1
  37. package/dist/ops-blueprint/update.d.ts +4 -4
  38. package/dist/ops-blueprint/update.js +5 -5
  39. package/dist/ops-connector-keys/types.d.ts +2 -3
  40. package/dist/ops-connector-keys/types.d.ts.map +1 -1
  41. package/dist/ops-coupon/types.d.ts +2 -2
  42. package/dist/ops-orgs/list-orgs.d.ts +2 -2
  43. package/dist/ops-orgs/list-orgs.js +2 -2
  44. package/dist/ops-orgs/types.d.ts +1 -1
  45. package/dist/provider-keys/list-provider-keys.d.ts +5 -5
  46. package/dist/provider-keys/list-provider-keys.js +3 -3
  47. package/dist/provider-keys/remove-provider-key.d.ts +2 -2
  48. package/dist/provider-keys/set-provider-key.d.ts +3 -3
  49. package/dist/provider-keys/types.d.ts +4 -4
  50. package/dist/renders/apply-ggui-session-patch.d.ts +2 -2
  51. package/dist/renders/assert-gadgets.d.ts +3 -4
  52. package/dist/renders/assert-gadgets.d.ts.map +1 -1
  53. package/dist/renders/assert-gadgets.js +5 -8
  54. package/dist/renders/assert-no-duplicate-gadget-hooks.d.ts +2 -2
  55. package/dist/renders/assert-no-duplicate-gadget-hooks.d.ts.map +1 -1
  56. package/dist/renders/assert-no-duplicate-gadget-hooks.js +3 -4
  57. package/dist/renders/assert-public-env.d.ts +2 -2
  58. package/dist/renders/assert-public-env.d.ts.map +1 -1
  59. package/dist/renders/assert-public-env.js +3 -4
  60. package/dist/renders/blueprint-registry.d.ts +3 -3
  61. package/dist/renders/blueprint-registry.d.ts.map +1 -1
  62. package/dist/renders/blueprint-registry.js +6 -7
  63. package/dist/renders/cache-trace-sink.d.ts +1 -1
  64. package/dist/renders/cache-trace-sink.d.ts.map +1 -1
  65. package/dist/renders/consume.d.ts +114 -15
  66. package/dist/renders/consume.d.ts.map +1 -1
  67. package/dist/renders/consume.js +87 -88
  68. package/dist/renders/decide-handshake.d.ts +32 -29
  69. package/dist/renders/decide-handshake.d.ts.map +1 -1
  70. package/dist/renders/decide-handshake.js +13 -13
  71. package/dist/renders/errors.d.ts +7 -7
  72. package/dist/renders/errors.d.ts.map +1 -1
  73. package/dist/renders/errors.js +10 -13
  74. package/dist/renders/fetch-gadget-types.d.ts +2 -2
  75. package/dist/renders/fetch-gadget-types.d.ts.map +1 -1
  76. package/dist/renders/fetch-gadget-types.js +3 -4
  77. package/dist/renders/generation-cache.d.ts +1 -1
  78. package/dist/renders/generation-cache.js +1 -1
  79. package/dist/renders/get-render-source.d.ts +3 -3
  80. package/dist/renders/get-render-source.js +5 -5
  81. package/dist/renders/get-session.d.ts +13 -6
  82. package/dist/renders/get-session.d.ts.map +1 -1
  83. package/dist/renders/get-session.js +14 -10
  84. package/dist/renders/handshake.d.ts +6 -5
  85. package/dist/renders/handshake.d.ts.map +1 -1
  86. package/dist/renders/handshake.js +4 -5
  87. package/dist/renders/import-gate.d.ts +1 -1
  88. package/dist/renders/index.d.ts +3 -3
  89. package/dist/renders/index.d.ts.map +1 -1
  90. package/dist/renders/index.js +2 -2
  91. package/dist/renders/installed-blueprints-provider.js +0 -0
  92. package/dist/renders/list-sessions.d.ts +3 -3
  93. package/dist/renders/list-sessions.d.ts.map +1 -1
  94. package/dist/renders/list-sessions.js +3 -5
  95. package/dist/renders/match-precision/pairs.js +1 -1
  96. package/dist/renders/payload-trace-sink.d.ts +1 -1
  97. package/dist/renders/payload-trace-sink.d.ts.map +1 -1
  98. package/dist/renders/props-mutation-core.js +3 -3
  99. package/dist/renders/provisional-preview.d.ts +4 -4
  100. package/dist/renders/provisional-preview.js +3 -3
  101. package/dist/renders/refresh-ws-token.d.ts +3 -3
  102. package/dist/renders/refresh-ws-token.js +2 -2
  103. package/dist/renders/render-identity.d.ts +1 -1
  104. package/dist/renders/render-source-envelope.d.ts +2 -2
  105. package/dist/renders/{tenancy.d.ts → render-visibility.d.ts} +3 -3
  106. package/dist/renders/render-visibility.d.ts.map +1 -0
  107. package/dist/renders/{tenancy.js → render-visibility.js} +1 -1
  108. package/dist/renders/render.d.ts +93 -78
  109. package/dist/renders/render.d.ts.map +1 -1
  110. package/dist/renders/render.js +96 -53
  111. package/dist/renders/runtime-pull.d.ts +6 -6
  112. package/dist/renders/runtime-pull.js +7 -7
  113. package/dist/renders/runtime-telemetry.d.ts +2 -2
  114. package/dist/renders/runtime-telemetry.js +1 -1
  115. package/dist/renders/slice-meta-derivation.d.ts +6 -35
  116. package/dist/renders/slice-meta-derivation.d.ts.map +1 -1
  117. package/dist/renders/slice-meta-derivation.js +13 -28
  118. package/dist/renders/stream-replay-ops.d.ts +2 -2
  119. package/dist/renders/stream-replay-ops.js +1 -1
  120. package/dist/renders/stream.d.ts +3 -3
  121. package/dist/renders/stream.d.ts.map +1 -1
  122. package/dist/renders/stream.js +4 -15
  123. package/dist/renders/submit-action.d.ts +1 -1
  124. package/dist/renders/submit-action.d.ts.map +1 -1
  125. package/dist/renders/submit-action.js +8 -4
  126. package/dist/renders/sync-context.js +1 -1
  127. package/dist/renders/tool-identity-catalog-store.d.ts +1 -1
  128. package/dist/renders/tool-identity-catalog-store.js +1 -1
  129. package/dist/renders/update.d.ts +3 -3
  130. package/dist/renders/update.d.ts.map +1 -1
  131. package/dist/renders/update.js +6 -6
  132. package/dist/types.d.ts +6 -6
  133. package/dist/types.js +2 -2
  134. package/package.json +8 -12
  135. package/dist/ops-themes/delete-theme.d.ts +0 -32
  136. package/dist/ops-themes/delete-theme.d.ts.map +0 -1
  137. package/dist/ops-themes/delete-theme.js +0 -42
  138. package/dist/ops-themes/index.d.ts +0 -9
  139. package/dist/ops-themes/index.d.ts.map +0 -1
  140. package/dist/ops-themes/index.js +0 -8
  141. package/dist/ops-themes/list-themes.d.ts +0 -43
  142. package/dist/ops-themes/list-themes.d.ts.map +0 -1
  143. package/dist/ops-themes/list-themes.js +0 -52
  144. package/dist/ops-themes/register-theme.d.ts +0 -65
  145. package/dist/ops-themes/register-theme.d.ts.map +0 -1
  146. package/dist/ops-themes/register-theme.js +0 -145
  147. package/dist/ops-themes/types.d.ts +0 -63
  148. package/dist/ops-themes/types.d.ts.map +0 -1
  149. package/dist/ops-themes/types.js +0 -50
  150. package/dist/renders/tenancy.d.ts.map +0 -1
@@ -6,10 +6,10 @@
6
6
  * handler-flow diagnostics, not contract-shape violations.
7
7
  */
8
8
  /**
9
- * Thrown by `ggui_list_gadgets` (and any future tenant-
9
+ * Thrown by `ggui_list_gadgets` (and any future app-
10
10
  * scoped app-discovery tool) when the caller supplies an explicit
11
11
  * `appId` that does NOT match `ctx.appId` resolved by the upstream
12
- * auth adapter. Cross-tenant probes get a uniform error so the
12
+ * auth adapter. Cross-app probes get a uniform error so the
13
13
  * existence of an alternate `appId` is not leaked.
14
14
  *
15
15
  * Recovery: omit `appId` to default to `ctx.appId`, or call from a
@@ -6,10 +6,10 @@
6
6
  * handler-flow diagnostics, not contract-shape violations.
7
7
  */
8
8
  /**
9
- * Thrown by `ggui_list_gadgets` (and any future tenant-
9
+ * Thrown by `ggui_list_gadgets` (and any future app-
10
10
  * scoped app-discovery tool) when the caller supplies an explicit
11
11
  * `appId` that does NOT match `ctx.appId` resolved by the upstream
12
- * auth adapter. Cross-tenant probes get a uniform error so the
12
+ * auth adapter. Cross-app probes get a uniform error so the
13
13
  * existence of an alternate `appId` is not leaked.
14
14
  *
15
15
  * Recovery: omit `appId` to default to `ctx.appId`, or call from a
@@ -14,7 +14,7 @@
14
14
  * `appId` defaults to `ctx.appId` resolved by the upstream auth
15
15
  * adapter.
16
16
  * 2. When `appId` is supplied explicitly, asserts it matches
17
- * `ctx.appId`; cross-tenant requests fail with
17
+ * `ctx.appId`; cross-app requests fail with
18
18
  * {@link AppAccessDeniedError}.
19
19
  * 3. Reads `app.gadgets` from the bound {@link AppMetadataStore}
20
20
  * and resolves the effective catalog via `resolveAppGadgets`
@@ -22,7 +22,7 @@
22
22
  * `null` (app not registered — common for OSS sandbox apps that
23
23
  * bypass an explicit register call) the resolution yields
24
24
  * exactly `STDLIB_GADGETS`, so callers always get a meaningful
25
- * catalog. This is a permitted-error path, not a tenancy
25
+ * catalog. This is a permitted-error path, not an app-scope
26
26
  * escape — `ctx.appId` was already proved by the auth adapter;
27
27
  * the absence of a registry row just means the deployment runs
28
28
  * default-seeded.
@@ -67,8 +67,8 @@ declare const outputSchema: {
67
67
  bundleHost: z.ZodOptional<z.ZodString>;
68
68
  bundleSri: z.ZodOptional<z.ZodString>;
69
69
  styleUrl: z.ZodOptional<z.ZodURL>;
70
- connect: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodURL>>>;
71
- requires: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
70
+ connect: z.ZodOptional<z.ZodArray<z.ZodURL>>;
71
+ requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
72
  typesUrl: z.ZodOptional<z.ZodURL>;
73
73
  typesSri: z.ZodOptional<z.ZodString>;
74
74
  }, z.core.$strict>>;
@@ -109,8 +109,8 @@ export declare function createGguiListGadgetsHandler(deps: GguiListGadgetsHandle
109
109
  bundleHost: z.ZodOptional<z.ZodString>;
110
110
  bundleSri: z.ZodOptional<z.ZodString>;
111
111
  styleUrl: z.ZodOptional<z.ZodURL>;
112
- connect: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodURL>>>;
113
- requires: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
112
+ connect: z.ZodOptional<z.ZodArray<z.ZodURL>>;
113
+ requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
114
114
  typesUrl: z.ZodOptional<z.ZodURL>;
115
115
  typesSri: z.ZodOptional<z.ZodString>;
116
116
  }, z.core.$strict>>;
@@ -137,8 +137,8 @@ export declare function createGguiListGadgetsHandler(deps: GguiListGadgetsHandle
137
137
  bundleHost?: string | undefined;
138
138
  bundleSri?: string | undefined;
139
139
  styleUrl?: string | undefined;
140
- connect?: readonly string[] | undefined;
141
- requires?: readonly string[] | undefined;
140
+ connect?: string[] | undefined;
141
+ requires?: string[] | undefined;
142
142
  typesUrl?: string | undefined;
143
143
  typesSri?: string | undefined;
144
144
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"list-gadgets.d.ts","sourceRoot":"","sources":["../../src/app-discovery/list-gadgets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AA6BnF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAER,CAAC;AAEX,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAC7C;AAED,oFAAoF;AACpF,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAErE,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+B5E"}
1
+ {"version":3,"file":"list-gadgets.d.ts","sourceRoot":"","sources":["../../src/app-discovery/list-gadgets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AA6BnF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAER,CAAC;AAEX,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAC7C;AAED,oFAAoF;AACpF,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAiBrE,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiC5E"}
@@ -14,7 +14,7 @@
14
14
  * `appId` defaults to `ctx.appId` resolved by the upstream auth
15
15
  * adapter.
16
16
  * 2. When `appId` is supplied explicitly, asserts it matches
17
- * `ctx.appId`; cross-tenant requests fail with
17
+ * `ctx.appId`; cross-app requests fail with
18
18
  * {@link AppAccessDeniedError}.
19
19
  * 3. Reads `app.gadgets` from the bound {@link AppMetadataStore}
20
20
  * and resolves the effective catalog via `resolveAppGadgets`
@@ -22,7 +22,7 @@
22
22
  * `null` (app not registered — common for OSS sandbox apps that
23
23
  * bypass an explicit register call) the resolution yields
24
24
  * exactly `STDLIB_GADGETS`, so callers always get a meaningful
25
- * catalog. This is a permitted-error path, not a tenancy
25
+ * catalog. This is a permitted-error path, not an app-scope
26
26
  * escape — `ctx.appId` was already proved by the auth adapter;
27
27
  * the absence of a registry row just means the deployment runs
28
28
  * default-seeded.
@@ -50,7 +50,7 @@ const inputSchema = {
50
50
  .string()
51
51
  .min(1)
52
52
  .optional()
53
- .describe('The app id whose gadget catalog to return. Defaults to the caller-resolved app id from the auth header. Cross-tenant requests fail with app_access_denied.'),
53
+ .describe('The app id whose gadget catalog to return. Defaults to the caller-resolved app id from the auth header. Cross-app requests fail with app_access_denied.'),
54
54
  };
55
55
  /**
56
56
  * Output wire schema for one catalog entry. The handler returns
@@ -70,6 +70,20 @@ const gadgetEntryWireSchema = gadgetDescriptorSchema;
70
70
  const outputSchema = {
71
71
  gadgets: z.array(gadgetEntryWireSchema),
72
72
  };
73
+ /**
74
+ * One descriptor as the wire carries it: the seam type (`GadgetDescriptor`)
75
+ * keeps `connect` / `requires` readonly for every consumer; the advertised
76
+ * output schema is mutable JSON (ggui#824). Copying the two arrays is the
77
+ * whole projection — no field is renamed, dropped or invented.
78
+ */
79
+ function toWireGadget(g) {
80
+ const { connect, requires, ...rest } = g;
81
+ return {
82
+ ...rest,
83
+ ...(connect === undefined ? {} : { connect: [...connect] }),
84
+ ...(requires === undefined ? {} : { requires: [...requires] }),
85
+ };
86
+ }
73
87
  export function createGguiListGadgetsHandler(deps) {
74
88
  return defineHandler({
75
89
  name: 'ggui_list_gadgets',
@@ -91,9 +105,11 @@ export function createGguiListGadgetsHandler(deps) {
91
105
  // get a meaningful catalog. This mirrors the cloud DDB adapter's
92
106
  // default-on-read pattern at the row-projection site.
93
107
  const gadgets = resolveAppGadgets(app?.gadgets);
94
- // A fresh copy: the resolver may hand back the stdlib singleton, which is
95
- // a resolver-internal guard, never a wire fact — the wire is mutable JSON.
96
- return { gadgets: [...gadgets] };
108
+ // Projected onto the wire row by row: the resolver may hand back the
109
+ // stdlib singleton (a resolver-internal guard, never a wire fact), and
110
+ // the seam type keeps its arrays readonly while the wire is mutable
111
+ // JSON (ggui#824) — so the two readonly arrays are copied, not cast.
112
+ return { gadgets: gadgets.map(toWireGadget) };
97
113
  },
98
114
  });
99
115
  }
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * ## Behavior
11
11
  *
12
- * 1. Validates input shape (`{appId?: string}`). Cross-tenant
12
+ * 1. Validates input shape (`{appId?: string}`). Cross-app
13
13
  * access protected the same way as `ggui_list_gadgets`.
14
14
  * 2. Reads the global theme catalog via the bound `themes` dep
15
15
  * (a `() => readonly ThemeCatalogEntry[]` resolver — keeps the
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * ## Behavior
11
11
  *
12
- * 1. Validates input shape (`{appId?: string}`). Cross-tenant
12
+ * 1. Validates input shape (`{appId?: string}`). Cross-app
13
13
  * access protected the same way as `ggui_list_gadgets`.
14
14
  * 2. Reads the global theme catalog via the bound `themes` dep
15
15
  * (a `() => readonly ThemeCatalogEntry[]` resolver — keeps the
@@ -31,7 +31,7 @@ const inputSchema = {
31
31
  .string()
32
32
  .min(1)
33
33
  .optional()
34
- .describe('App id whose theme catalog to return. Defaults to the caller-resolved app id from the auth header. Cross-tenant requests fail with app_access_denied.'),
34
+ .describe('App id whose theme catalog to return. Defaults to the caller-resolved app id from the auth header. Cross-app requests fail with app_access_denied.'),
35
35
  };
36
36
  /**
37
37
  * Wire shape for a single theme entry. Mirrors `@ggui-ai/design`'s
@@ -11,13 +11,13 @@
11
11
  *
12
12
  * Identity scope: credit rows are keyed by USER identity, so the
13
13
  * handler reads `ctx.userId` when the host's auth layer resolves a
14
- * distinct per-user identity (multi-tenant hosts where `ctx.appId`
14
+ * distinct per-user identity (multi-app hosts where `ctx.appId`
15
15
  * names the caller's active app, not the caller), and falls back to
16
- * `ctx.appId` for single-tenant hosts whose auth adapter folds the
16
+ * `ctx.appId` for single-app hosts whose auth adapter folds the
17
17
  * user into the app slot (`appId = workspaceId ?? userId` — see
18
18
  * `packages/mcp-server/src/auth.ts#defaultAppIdFromIdentity`).
19
19
  * Reading `ctx.appId` alone silently returns the zero-row fallback
20
- * for every multi-tenant caller — an app id never keys a credit row.
20
+ * for every multi-app caller — an app id never keys a credit row.
21
21
  * The tool is registered on every deployment kind; callers without a
22
22
  * credit account (e.g. agent-builder identities) get the zero-row
23
23
  * fallback.
@@ -11,13 +11,13 @@
11
11
  *
12
12
  * Identity scope: credit rows are keyed by USER identity, so the
13
13
  * handler reads `ctx.userId` when the host's auth layer resolves a
14
- * distinct per-user identity (multi-tenant hosts where `ctx.appId`
14
+ * distinct per-user identity (multi-app hosts where `ctx.appId`
15
15
  * names the caller's active app, not the caller), and falls back to
16
- * `ctx.appId` for single-tenant hosts whose auth adapter folds the
16
+ * `ctx.appId` for single-app hosts whose auth adapter folds the
17
17
  * user into the app slot (`appId = workspaceId ?? userId` — see
18
18
  * `packages/mcp-server/src/auth.ts#defaultAppIdFromIdentity`).
19
19
  * Reading `ctx.appId` alone silently returns the zero-row fallback
20
- * for every multi-tenant caller — an app id never keys a credit row.
20
+ * for every multi-app caller — an app id never keys a credit row.
21
21
  * The tool is registered on every deployment kind; callers without a
22
22
  * credit account (e.g. agent-builder identities) get the zero-row
23
23
  * fallback.
@@ -43,13 +43,13 @@ export function createGetCreditBalanceHandler(deps) {
43
43
  description: "Returns the calling user's prepaid Anthropic-pool credit balance. Surfaces balanceCents (current spendable), lifetimeGrantedCents (total received including the $5 welcome credit), and lifetimeSpentCents (cumulative charges). For non-Anthropic providers, configure a BYOK key at console.ggui.ai/keys/providers — credit doesn't apply. Composing blueprints in Claude Desktop bypasses credits entirely.",
44
44
  inputSchema,
45
45
  outputSchema,
46
- // No `allowedFor` — same toolset on every pod kind. Callers
46
+ // No `allowedFor` — same toolset on every deployment kind. Callers
47
47
  // without a credit account get the zero-row fallback below; no
48
48
  // separate "tool not registered" UX needed.
49
49
  async handler(_input, ctx) {
50
- // USER identity first — on multi-tenant hosts `ctx.appId` is the
50
+ // USER identity first — on multi-app hosts `ctx.appId` is the
51
51
  // caller's active app, which never keys a credit row (see the
52
- // module docstring). Single-tenant hosts leave `ctx.userId`
52
+ // module docstring). Single-app hosts leave `ctx.userId`
53
53
  // unset and fold the user into the app slot.
54
54
  const userId = ctx.userId ?? ctx.appId;
55
55
  if (!userId) {
@@ -12,15 +12,14 @@
12
12
  *
13
13
  * Identity scope mirrors get-credit-balance: `ctx.userId` when the
14
14
  * host resolves a distinct per-user identity, else `ctx.appId` (the
15
- * single-tenant fold) — see that module's docstring for why reading
16
- * `ctx.appId` alone loses every multi-tenant caller.
15
+ * single-app fold) — see that module's docstring for why reading
16
+ * `ctx.appId` alone loses every multi-app caller.
17
17
  */
18
18
  import { z } from 'zod';
19
19
  /**
20
- * Read-only seam for the credit-transaction ledger. The pod's
21
- * `DdbCreditStore.listTransactions` (in
22
- * `mcp-servers/ggui-protocol/src/adapters/credit-store.ts`) implements
23
- * this directly via raw DDB Query.
20
+ * Read-only seam for the credit-transaction ledger. A production deployment
21
+ * implements this against its own ledger store; tests use in-memory
22
+ * state.
24
23
  */
25
24
  export interface CreditTransactionSource {
26
25
  list(args: {
@@ -1 +1 @@
1
- {"version":3,"file":"list-credit-transactions.d.ts","sourceRoot":"","sources":["../../src/credits/list-credit-transactions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,EAAE,MAAM,CAAC;QACf,oCAAoC;QACpC,KAAK,EAAE,MAAM,CAAC;QACd,4EAA4E;QAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC;QACV,YAAY,EAAE,qBAAqB,EAAE,CAAC;QACtC,6CAA6C;QAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,eAAe,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,kBAAkB,EAAE,uBAAuB,CAAC;CACtD;AAyBD,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,YAAY,EAAE,qBAAqB,EAAE,CAAC;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,mCAAmC,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C,CACjD,IAAI,EAAE,0BAA0B;IA5BhC,2BAA2B;;IAE3B,kEAAkE;;;;;;;;;;;;;;;;;IAgBlE,oFAAoF;;;;;GAgDrF"}
@@ -12,8 +12,8 @@
12
12
  *
13
13
  * Identity scope mirrors get-credit-balance: `ctx.userId` when the
14
14
  * host resolves a distinct per-user identity, else `ctx.appId` (the
15
- * single-tenant fold) — see that module's docstring for why reading
16
- * `ctx.appId` alone loses every multi-tenant caller.
15
+ * single-app fold) — see that module's docstring for why reading
16
+ * `ctx.appId` alone loses every multi-app caller.
17
17
  */
18
18
  import { z } from 'zod';
19
19
  import { defineHandler } from '../types.js';
@@ -44,11 +44,11 @@ export function createListCreditTransactionsHandler(deps) {
44
44
  description: "Returns the calling user's credit transaction ledger, newest-first. Each row carries kind ('free_credit' | 'render_charge' | 'topup' | 'refund'), deltaCents (signed — positive for grants/topups, negative for charges), balanceAfterCents (snapshot at time of write), reason (human-readable), and optional relatedSessionId for render_charge rows. Default limit 20, cap 100; pass `cursor` from the previous response's `nextCursor` for paging.",
45
45
  inputSchema,
46
46
  outputSchema,
47
- // No `allowedFor` — same toolset on every pod kind. Callers
47
+ // No `allowedFor` — same toolset on every deployment kind. Callers
48
48
  // without a credit account see an empty ledger.
49
49
  async handler(rawInput, ctx) {
50
50
  // USER identity first — `ctx.appId` is the active app on
51
- // multi-tenant hosts and never keys a ledger row (see
51
+ // multi-app hosts and never keys a ledger row (see
52
52
  // get-credit-balance's module docstring).
53
53
  const userId = ctx.userId ?? ctx.appId;
54
54
  if (!userId) {
@@ -2,7 +2,7 @@
2
2
  * `ggui_ops_delete_app` — hard-delete an app record owned by the
3
3
  * caller.
4
4
  *
5
- * Tenancy: cross-tenant probes return the success shape WITHOUT
5
+ * Ownership: cross-user probes return the success shape WITHOUT
6
6
  * touching the row (uniform shape; no existence leak). Idempotent —
7
7
  * a second delete of the same id resolves cleanly.
8
8
  *
@@ -12,7 +12,7 @@
12
12
  *
13
13
  * The check runs AFTER the ownership read. `getDefault(ownerSub)`
14
14
  * only ever reads the caller's own row, so ordering is not what keeps
15
- * another tenant's default secret — nothing here could read it under
15
+ * another owner's default secret — nothing here could read it under
16
16
  * any ordering. What ordering buys is SHAPE UNIFORMITY in the one
17
17
  * state where the two branches disagree: the caller's own default
18
18
  * naming an app the caller does not own. Ownership first answers that
@@ -2,7 +2,7 @@
2
2
  * `ggui_ops_delete_app` — hard-delete an app record owned by the
3
3
  * caller.
4
4
  *
5
- * Tenancy: cross-tenant probes return the success shape WITHOUT
5
+ * Ownership: cross-user probes return the success shape WITHOUT
6
6
  * touching the row (uniform shape; no existence leak). Idempotent —
7
7
  * a second delete of the same id resolves cleanly.
8
8
  *
@@ -12,7 +12,7 @@
12
12
  *
13
13
  * The check runs AFTER the ownership read. `getDefault(ownerSub)`
14
14
  * only ever reads the caller's own row, so ordering is not what keeps
15
- * another tenant's default secret — nothing here could read it under
15
+ * another owner's default secret — nothing here could read it under
16
16
  * any ordering. What ordering buys is SHAPE UNIFORMITY in the one
17
17
  * state where the two branches disagree: the caller's own default
18
18
  * naming an app the caller does not own. Ownership first answers that
@@ -48,7 +48,7 @@ export function createDeleteAppHandler(deps) {
48
48
  name: 'ggui_ops_delete_app',
49
49
  title: 'Delete app',
50
50
  audience: ['ops'],
51
- description: "Hard-delete an app owned by the calling user. Removes the APP RECORD only — data other stores hold for that app (saved blueprints, per-app provider keys, marketplace installs, issued keys) is not removed by this call, and whether the deployment cleans it up separately is the deployment's own policy. Idempotent — a second delete returns `{deleted: true}`. Cross-tenant probes return the same shape without touching foreign rows (no existence leak). Throws `default_app_delete_blocked` when the target is the caller's default app — set a different default first.",
51
+ description: "Hard-delete an app owned by the calling user. Removes the APP RECORD only — data other stores hold for that app (saved blueprints, per-app provider keys, marketplace installs, issued keys) is not removed by this call, and whether the deployment cleans it up separately is the deployment's own policy. Idempotent — a second delete returns `{deleted: true}`. Probes at an app owned by another user return the same shape without touching foreign rows (no existence leak). Throws `default_app_delete_blocked` when the target is the caller's default app — set a different default first.",
52
52
  inputSchema,
53
53
  outputSchema,
54
54
  async handler(rawInput, ctx) {
@@ -62,7 +62,7 @@ export function createDeleteAppHandler(deps) {
62
62
  // Either the row doesn't exist or it lives under a different
63
63
  // owner. Either way: return the success shape without
64
64
  // touching the store. Uniform across "missing" and
65
- // "cross-tenant" prevents id-existence leak.
65
+ // "cross-user" prevents id-existence leak.
66
66
  return { deleted: true };
67
67
  }
68
68
  // AFTER the ownership read, so a caller whose own default names
@@ -2,7 +2,7 @@
2
2
  * Per-call identity resolution for `ops-apps` handlers. The console
3
3
  * surfaces these tools call against `kind: 'user'` identities — the
4
4
  * upstream `AuthAdapter` populates `ctx.userId` directly. OSS
5
- * single-tenant mode (where the auth adapter collapses `appId =
5
+ * single-app mode (where the auth adapter collapses `appId =
6
6
  * workspaceId ?? userId`) leaves `ctx.userId` undefined and the same
7
7
  * value sits on `ctx.appId`. Read whichever is set; fail when neither
8
8
  * is.
@@ -21,8 +21,8 @@ export { createCreateAppHandler } from './create-app.js';
21
21
  export type { CreateAppDeps, CreateAppOutput } from './create-app.js';
22
22
  export { createUpdateAppHandler } from './update-app.js';
23
23
  export type { UpdateAppDeps, UpdateAppOutput } from './update-app.js';
24
- export { createSetAppThemeHandler } from './set-app-theme.js';
25
- export type { SetAppThemeDeps, SetAppThemeOutput, } from './set-app-theme.js';
24
+ export { createSetAppThemeHandler, admitAppTheme } from './set-app-theme.js';
25
+ export type { SetAppThemeDeps, SetAppThemeOutput, OverlayCoverageValidator, AppThemeAdmission, } from './set-app-theme.js';
26
26
  export { createDeleteAppHandler } from './delete-app.js';
27
27
  export type { DeleteAppDeps, DeleteAppOutput } from './delete-app.js';
28
28
  export { createSetDefaultAppHandler } from './set-default-app.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ops-apps/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,YAAY,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd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,MAAM,iBAAiB,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7E,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,EACV,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC"}
@@ -17,6 +17,6 @@ export { AppNotFoundError, DefaultAppDeleteBlockedError, OpsAppsAccessDeniedErro
17
17
  export { createListAppsHandler } from './list-apps.js';
18
18
  export { createCreateAppHandler } from './create-app.js';
19
19
  export { createUpdateAppHandler } from './update-app.js';
20
- export { createSetAppThemeHandler } from './set-app-theme.js';
20
+ export { createSetAppThemeHandler, admitAppTheme } from './set-app-theme.js';
21
21
  export { createDeleteAppHandler } from './delete-app.js';
22
22
  export { createSetDefaultAppHandler } from './set-default-app.js';
@@ -2,12 +2,12 @@
2
2
  * `ggui_ops_list_apps` — enumerate the calling user's `GguiApp` rows.
3
3
  *
4
4
  * Sibling of the console's Apps section (`apps/console/src/.../apps/`)
5
- * — same data, MCP surface. Pure over the {@link AppsSource} seam; the
6
- * cloud pod binds an AppSync-backed implementation, tests bind an
5
+ * — same data, MCP surface. Pure over the {@link AppsSource} seam; a
6
+ * production deployment binds its own implementation, tests bind an
7
7
  * in-memory Map.
8
8
  *
9
9
  * Identity scope: caller's Cognito sub from `ctx.userId` (or
10
- * `ctx.appId` in OSS single-tenant mode). Cross-user list is impossible
10
+ * `ctx.appId` in OSS single-app mode). Cross-user list is impossible
11
11
  * by construction — `AppsSource.list` only returns rows whose
12
12
  * `ownerSub` matches.
13
13
  */
@@ -2,12 +2,12 @@
2
2
  * `ggui_ops_list_apps` — enumerate the calling user's `GguiApp` rows.
3
3
  *
4
4
  * Sibling of the console's Apps section (`apps/console/src/.../apps/`)
5
- * — same data, MCP surface. Pure over the {@link AppsSource} seam; the
6
- * cloud pod binds an AppSync-backed implementation, tests bind an
5
+ * — same data, MCP surface. Pure over the {@link AppsSource} seam; a
6
+ * production deployment binds its own implementation, tests bind an
7
7
  * in-memory Map.
8
8
  *
9
9
  * Identity scope: caller's Cognito sub from `ctx.userId` (or
10
- * `ctx.appId` in OSS single-tenant mode). Cross-user list is impossible
10
+ * `ctx.appId` in OSS single-app mode). Cross-user list is impossible
11
11
  * by construction — `AppsSource.list` only returns rows whose
12
12
  * `ownerSub` matches.
13
13
  */