@google/stitch-sdk 0.0.1

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 (86) hide show
  1. package/README.md +271 -0
  2. package/dist/generated/src/index.d.ts +13 -0
  3. package/dist/generated/src/index.d.ts.map +1 -0
  4. package/dist/generated/src/index.js +13 -0
  5. package/dist/generated/src/index.js.map +1 -0
  6. package/dist/generated/src/project.d.ts +35 -0
  7. package/dist/generated/src/project.d.ts.map +1 -0
  8. package/dist/generated/src/project.js +62 -0
  9. package/dist/generated/src/project.js.map +1 -0
  10. package/dist/generated/src/screen.d.ts +40 -0
  11. package/dist/generated/src/screen.d.ts.map +1 -0
  12. package/dist/generated/src/screen.js +82 -0
  13. package/dist/generated/src/screen.js.map +1 -0
  14. package/dist/generated/src/stitch.d.ts +23 -0
  15. package/dist/generated/src/stitch.d.ts.map +1 -0
  16. package/dist/generated/src/stitch.js +27 -0
  17. package/dist/generated/src/stitch.js.map +1 -0
  18. package/dist/generated/src/tool-definitions.d.ts +20 -0
  19. package/dist/generated/src/tool-definitions.d.ts.map +1 -0
  20. package/dist/generated/src/tool-definitions.js +333 -0
  21. package/dist/generated/src/tool-definitions.js.map +1 -0
  22. package/dist/src/ai.d.ts +17 -0
  23. package/dist/src/ai.d.ts.map +1 -0
  24. package/dist/src/ai.js +30 -0
  25. package/dist/src/ai.js.map +1 -0
  26. package/dist/src/client.d.ts +77 -0
  27. package/dist/src/client.d.ts.map +1 -0
  28. package/dist/src/client.js +135 -0
  29. package/dist/src/client.js.map +1 -0
  30. package/dist/src/constants.d.ts +2 -0
  31. package/dist/src/constants.d.ts.map +1 -0
  32. package/dist/src/constants.js +15 -0
  33. package/dist/src/constants.js.map +1 -0
  34. package/dist/src/index.d.ts +10 -0
  35. package/dist/src/index.d.ts.map +1 -0
  36. package/dist/src/index.js +25 -0
  37. package/dist/src/index.js.map +1 -0
  38. package/dist/src/proxy/client.d.ts +22 -0
  39. package/dist/src/proxy/client.d.ts.map +1 -0
  40. package/dist/src/proxy/client.js +87 -0
  41. package/dist/src/proxy/client.js.map +1 -0
  42. package/dist/src/proxy/core.d.ts +16 -0
  43. package/dist/src/proxy/core.d.ts.map +1 -0
  44. package/dist/src/proxy/core.js +68 -0
  45. package/dist/src/proxy/core.js.map +1 -0
  46. package/dist/src/proxy/handlers/callTool.d.ts +7 -0
  47. package/dist/src/proxy/handlers/callTool.d.ts.map +1 -0
  48. package/dist/src/proxy/handlers/callTool.js +40 -0
  49. package/dist/src/proxy/handlers/callTool.js.map +1 -0
  50. package/dist/src/proxy/handlers/listTools.d.ts +7 -0
  51. package/dist/src/proxy/handlers/listTools.d.ts.map +1 -0
  52. package/dist/src/proxy/handlers/listTools.js +36 -0
  53. package/dist/src/proxy/handlers/listTools.js.map +1 -0
  54. package/dist/src/proxy/index.d.ts +4 -0
  55. package/dist/src/proxy/index.d.ts.map +1 -0
  56. package/dist/src/proxy/index.js +17 -0
  57. package/dist/src/proxy/index.js.map +1 -0
  58. package/dist/src/singleton.d.ts +25 -0
  59. package/dist/src/singleton.d.ts.map +1 -0
  60. package/dist/src/singleton.js +76 -0
  61. package/dist/src/singleton.js.map +1 -0
  62. package/dist/src/spec/client.d.ts +52 -0
  63. package/dist/src/spec/client.d.ts.map +1 -0
  64. package/dist/src/spec/client.js +52 -0
  65. package/dist/src/spec/client.js.map +1 -0
  66. package/dist/src/spec/errors.d.ts +39 -0
  67. package/dist/src/spec/errors.d.ts.map +1 -0
  68. package/dist/src/spec/errors.js +56 -0
  69. package/dist/src/spec/errors.js.map +1 -0
  70. package/dist/src/spec/proxy.d.ts +22 -0
  71. package/dist/src/spec/proxy.d.ts.map +1 -0
  72. package/dist/src/spec/proxy.js +31 -0
  73. package/dist/src/spec/proxy.js.map +1 -0
  74. package/dist/src/tools-adapter.d.ts +27 -0
  75. package/dist/src/tools-adapter.d.ts.map +1 -0
  76. package/dist/src/tools-adapter.js +66 -0
  77. package/dist/src/tools-adapter.js.map +1 -0
  78. package/dist/src/types.d.ts +38 -0
  79. package/dist/src/types.d.ts.map +1 -0
  80. package/dist/src/types.js +15 -0
  81. package/dist/src/types.js.map +1 -0
  82. package/dist/src/version.d.ts +2 -0
  83. package/dist/src/version.d.ts.map +1 -0
  84. package/dist/src/version.js +3 -0
  85. package/dist/src/version.js.map +1 -0
  86. package/package.json +63 -0
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Exhaustive error codes for Stitch operations.
4
+ * Add new codes here as needed.
5
+ */
6
+ export declare const StitchErrorCode: z.ZodEnum<{
7
+ AUTH_FAILED: "AUTH_FAILED";
8
+ NOT_FOUND: "NOT_FOUND";
9
+ PERMISSION_DENIED: "PERMISSION_DENIED";
10
+ RATE_LIMITED: "RATE_LIMITED";
11
+ NETWORK_ERROR: "NETWORK_ERROR";
12
+ VALIDATION_ERROR: "VALIDATION_ERROR";
13
+ UNKNOWN_ERROR: "UNKNOWN_ERROR";
14
+ }>;
15
+ export type StitchErrorCode = z.infer<typeof StitchErrorCode>;
16
+ /**
17
+ * Structured error data for internal Result types.
18
+ */
19
+ export interface StitchErrorData {
20
+ code: StitchErrorCode;
21
+ message: string;
22
+ suggestion?: string;
23
+ recoverable: boolean;
24
+ }
25
+ /**
26
+ * Throwable error class for the public API.
27
+ * Extends Error so it works with try/catch and instanceof checks.
28
+ */
29
+ export declare class StitchError extends Error {
30
+ readonly code: StitchErrorCode;
31
+ readonly suggestion?: string;
32
+ readonly recoverable: boolean;
33
+ constructor(data: StitchErrorData);
34
+ /**
35
+ * Create a StitchError from an unknown caught error.
36
+ */
37
+ static fromUnknown(error: unknown): StitchError;
38
+ }
39
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/spec/errors.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;EAQ1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,SAAgB,IAAI,EAAE,eAAe,CAAC;IACtC,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,SAAgB,WAAW,EAAE,OAAO,CAAC;gBAEzB,IAAI,EAAE,eAAe;IAQnC;;OAEG;IACD,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW;CAQhD"}
@@ -0,0 +1,56 @@
1
+ // Copyright 2026 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // https://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { z } from 'zod';
15
+ /**
16
+ * Exhaustive error codes for Stitch operations.
17
+ * Add new codes here as needed.
18
+ */
19
+ export const StitchErrorCode = z.enum([
20
+ 'AUTH_FAILED',
21
+ 'NOT_FOUND',
22
+ 'PERMISSION_DENIED',
23
+ 'RATE_LIMITED',
24
+ 'NETWORK_ERROR',
25
+ 'VALIDATION_ERROR',
26
+ 'UNKNOWN_ERROR',
27
+ ]);
28
+ /**
29
+ * Throwable error class for the public API.
30
+ * Extends Error so it works with try/catch and instanceof checks.
31
+ */
32
+ export class StitchError extends Error {
33
+ code;
34
+ suggestion;
35
+ recoverable;
36
+ constructor(data) {
37
+ super(data.message);
38
+ this.name = 'StitchError';
39
+ this.code = data.code;
40
+ this.suggestion = data.suggestion;
41
+ this.recoverable = data.recoverable;
42
+ }
43
+ /**
44
+ * Create a StitchError from an unknown caught error.
45
+ */
46
+ static fromUnknown(error) {
47
+ if (error instanceof StitchError)
48
+ return error;
49
+ return new StitchError({
50
+ code: 'UNKNOWN_ERROR',
51
+ message: error instanceof Error ? error.message : String(error),
52
+ recoverable: false,
53
+ });
54
+ }
55
+ }
56
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/spec/errors.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,aAAa;IACb,WAAW;IACX,mBAAmB;IACnB,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,eAAe;CAChB,CAAC,CAAC;AAcH;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpB,IAAI,CAAkB;IACtB,UAAU,CAAU;IACpB,WAAW,CAAU;IAErC,YAAY,IAAqB;QAC/B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACtC,CAAC;IAEH;;OAEG;IACD,MAAM,CAAC,WAAW,CAAC,KAAc;QAC/B,IAAI,KAAK,YAAY,WAAW;YAAE,OAAO,KAAK,CAAC;QAC/C,OAAO,IAAI,WAAW,CAAC;YACrB,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC/D,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
3
+ export declare const StitchProxyConfigSchema: z.ZodObject<{
4
+ apiKey: z.ZodOptional<z.ZodString>;
5
+ url: z.ZodDefault<z.ZodString>;
6
+ name: z.ZodDefault<z.ZodString>;
7
+ version: z.ZodDefault<z.ZodString>;
8
+ protocolVersion: z.ZodDefault<z.ZodString>;
9
+ }, z.core.$strip>;
10
+ export type StitchProxyConfig = z.infer<typeof StitchProxyConfigSchema>;
11
+ export interface StitchProxySpec {
12
+ /**
13
+ * Connect to Stitch and start the proxy server on the given transport.
14
+ * @param transport The transport to listen on (e.g. StdioServerTransport)
15
+ */
16
+ start(transport: Transport): Promise<void>;
17
+ /**
18
+ * Stop the proxy server.
19
+ */
20
+ close(): Promise<void>;
21
+ }
22
+ //# sourceMappingURL=proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/spec/proxy.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAM1E,eAAO,MAAM,uBAAuB;;;;;;iBAelC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAKxE,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3C;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
@@ -0,0 +1,31 @@
1
+ // Copyright 2026 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // https://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { z } from 'zod';
15
+ import { DEFAULT_STITCH_API_URL } from '../constants.js';
16
+ // ─────────────────────────────────────────────────────────────────────────────
17
+ // 1. INPUT SCHEMA
18
+ // ─────────────────────────────────────────────────────────────────────────────
19
+ export const StitchProxyConfigSchema = z.object({
20
+ /** API key for Stitch authentication. Falls back to STITCH_API_KEY. */
21
+ apiKey: z.string().optional(),
22
+ /** Target Stitch MCP URL. Default: https://stitch.googleapis.com/mcp */
23
+ url: z.string().default(DEFAULT_STITCH_API_URL),
24
+ /** Name of the local proxy server. Default: stitch-proxy */
25
+ name: z.string().default('stitch-proxy'),
26
+ /** Version of the local proxy server. Default: 1.0.0 */
27
+ version: z.string().default('1.0.0'),
28
+ /** Protocol version to use for Stitch JSON-RPC connection. Default: '2024-11-05' */
29
+ protocolVersion: z.string().default('2024-11-05'),
30
+ });
31
+ //# sourceMappingURL=proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/spec/proxy.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,uEAAuE;IACvE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE7B,wEAAwE;IACxE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAE/C,4DAA4D;IAC5D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC;IAExC,wDAAwD;IACxD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;IAEpC,oFAAoF;IACpF,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC;CAClD,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Tool } from "ai";
2
+ /**
3
+ * Returns Stitch tools in Vercel AI SDK format.
4
+ *
5
+ * Each tool is pre-wired with `execute` → `callTool` against the Stitch MCP server.
6
+ * Drop directly into `generateText({ tools: stitchTools(), ... })`.
7
+ *
8
+ * @example
9
+ * import { generateText } from "ai";
10
+ * import { stitchTools } from "@google/stitch-sdk";
11
+ *
12
+ * const { text } = await generateText({
13
+ * model: "google/gemini-2.5-pro",
14
+ * tools: stitchTools(),
15
+ * prompt: "Create a login page",
16
+ * maxSteps: 5,
17
+ * });
18
+ *
19
+ * @param options - Optional config
20
+ * @param options.apiKey - Override STITCH_API_KEY env var
21
+ * @param options.include - Only include specific tool names
22
+ */
23
+ export declare function stitchTools(options?: {
24
+ apiKey?: string;
25
+ include?: string[];
26
+ }): Record<string, Tool>;
27
+ //# sourceMappingURL=tools-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools-adapter.d.ts","sourceRoot":"","sources":["../../src/tools-adapter.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAW/B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CA2BvB"}
@@ -0,0 +1,66 @@
1
+ // Copyright 2026 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // https://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { toolDefinitions } from "../generated/src/tool-definitions.js";
15
+ import { getOrCreateClient } from "./singleton.js";
16
+ /**
17
+ * Well-known symbol used by the Vercel AI SDK to identify schema objects.
18
+ * Using Symbol.for() ensures we match the exact same symbol the SDK uses
19
+ * internally, without importing any runtime code from `ai`.
20
+ */
21
+ const schemaSymbol = Symbol.for("vercel.ai.schema");
22
+ /**
23
+ * Returns Stitch tools in Vercel AI SDK format.
24
+ *
25
+ * Each tool is pre-wired with `execute` → `callTool` against the Stitch MCP server.
26
+ * Drop directly into `generateText({ tools: stitchTools(), ... })`.
27
+ *
28
+ * @example
29
+ * import { generateText } from "ai";
30
+ * import { stitchTools } from "@google/stitch-sdk";
31
+ *
32
+ * const { text } = await generateText({
33
+ * model: "google/gemini-2.5-pro",
34
+ * tools: stitchTools(),
35
+ * prompt: "Create a login page",
36
+ * maxSteps: 5,
37
+ * });
38
+ *
39
+ * @param options - Optional config
40
+ * @param options.apiKey - Override STITCH_API_KEY env var
41
+ * @param options.include - Only include specific tool names
42
+ */
43
+ export function stitchTools(options) {
44
+ const client = getOrCreateClient(options);
45
+ const filtered = options?.include
46
+ ? toolDefinitions.filter(t => options.include.includes(t.name))
47
+ : toolDefinitions;
48
+ return Object.fromEntries(filtered.map(t => [
49
+ t.name,
50
+ // Construct a plain object that is runtime-identical to what
51
+ // dynamicTool() + jsonSchema() would produce. The `ai` package
52
+ // is NOT imported at runtime — only the type is used above.
53
+ {
54
+ type: 'dynamic',
55
+ description: t.description,
56
+ inputSchema: {
57
+ [schemaSymbol]: true,
58
+ _type: undefined,
59
+ validate: undefined,
60
+ get jsonSchema() { return t.inputSchema; },
61
+ },
62
+ execute: async (args) => client.callTool(t.name, args),
63
+ },
64
+ ]));
65
+ }
66
+ //# sourceMappingURL=tools-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools-adapter.js","sourceRoot":"","sources":["../../src/tools-adapter.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,OAG3B;IACC,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,QAAQ,GAAG,OAAO,EAAE,OAAO;QAC/B,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,OAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC,CAAC,eAAe,CAAC;IAEpB,OAAO,MAAM,CAAC,WAAW,CACvB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,CAAC,CAAC,IAAI;QACN,6DAA6D;QAC7D,+DAA+D;QAC/D,4DAA4D;QAC5D;YACE,IAAI,EAAE,SAAkB;YACxB,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,WAAW,EAAE;gBACX,CAAC,YAAY,CAAC,EAAE,IAAI;gBACpB,KAAK,EAAE,SAAoB;gBAC3B,QAAQ,EAAE,SAAS;gBACnB,IAAI,UAAU,KAAK,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;aAC3C;YACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE,CAC/B,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,IAA2B,CAAC;SACpC;KACrB,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,38 @@
1
+ export { StitchConfig, StitchConfigInput, StitchConfigSchema } from './spec/client.js';
2
+ export interface ThumbnailScreenshot {
3
+ name: string;
4
+ downloadUrl: string;
5
+ }
6
+ export interface DesignTheme {
7
+ colorMode?: string;
8
+ font?: string;
9
+ roundness?: string;
10
+ customColor?: string;
11
+ saturation?: number;
12
+ }
13
+ export interface ScreenInstance {
14
+ id: string;
15
+ sourceScreen: string;
16
+ width?: number;
17
+ height?: number;
18
+ x?: number;
19
+ y?: number;
20
+ }
21
+ export interface ProjectData {
22
+ name: string;
23
+ title?: string;
24
+ visibility: string;
25
+ createTime: string;
26
+ updateTime: string;
27
+ projectType?: string;
28
+ origin?: string;
29
+ deviceType?: string;
30
+ thumbnailScreenshot?: ThumbnailScreenshot;
31
+ designTheme: DesignTheme;
32
+ screenInstances?: ScreenInstance[];
33
+ }
34
+ export interface GenerateScreenParams {
35
+ prompt: string;
36
+ deviceType?: "MOBILE" | "DESKTOP" | "DEVICE_TYPE_UNSPECIFIED";
37
+ }
38
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEvF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,yBAAyB,CAAC;CAC/D"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2026 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // https://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ export { StitchConfigSchema } from './spec/client.js';
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAmC,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const SDK_VERSION = "0.0.1";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Auto-generated by scripts/inject-version.ts — do not edit.
2
+ export const SDK_VERSION = '0.0.1';
3
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@google/stitch-sdk",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "private": false,
6
+ "description": "Generate UI screens from text prompts and extract their HTML and screenshots programmatically.",
7
+ "license": "Apache-2.0",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/google-labs-code/stitch-sdk.git",
11
+ "directory": "packages/sdk"
12
+ },
13
+ "keywords": [
14
+ "stitch",
15
+ "mcp",
16
+ "ui",
17
+ "generative-ai",
18
+ "google"
19
+ ],
20
+ "engines": {
21
+ "node": ">=18"
22
+ },
23
+ "main": "dist/src/index.js",
24
+ "types": "dist/src/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "import": "./dist/src/index.js",
28
+ "types": "./dist/src/index.d.ts"
29
+ },
30
+ "./ai": {
31
+ "import": "./dist/src/ai.js",
32
+ "types": "./dist/src/ai.d.ts"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "!dist/tsconfig.tsbuildinfo",
38
+ "!dist/package.json",
39
+ "README.md"
40
+ ],
41
+ "publishConfig": {
42
+ "registry": "https://wombat-dressing-room.appspot.com",
43
+ "access": "public"
44
+ },
45
+ "scripts": {
46
+ "build": "bun scripts/inject-version.ts && tsc",
47
+ "typecheck": "tsc --noEmit",
48
+ "test": "vitest run",
49
+ "test:watch": "vitest",
50
+ "test:integration": "vitest run --dir test/integration"
51
+ },
52
+ "dependencies": {
53
+ "@modelcontextprotocol/sdk": "^1.23.0",
54
+ "zod": "^4.3.5"
55
+ },
56
+ "devDependencies": {
57
+ "@swc/core": "^1.15.18",
58
+ "@types/node": "^20.0.0",
59
+ "ai": "^6.0.116",
60
+ "typescript": "^5.5.0",
61
+ "vitest": "^1.6.0"
62
+ }
63
+ }