Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/sdk/generated/domain-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
"method": "downloadAssets",
"reason": "filesystem_io",
"specPath": "src/spec/download.ts"
},
{
"method": "getCanvasLayout",
"reason": "complex_orchestration",
"specPath": "src/spec/canvas.ts"
}
],
"reference": {
Expand Down Expand Up @@ -89,6 +94,21 @@
}
},
"bindings": [
{
"tool": "get_project",
"class": "Project",
"method": "get",
"args": {
"name": {
"from": "computed",
"template": "projects/${this.projectId}"
}
},
"returns": {
"class": "Project",
"projection": []
}
},
{
"tool": "list_projects",
"class": "Stitch",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/generated/src/designsystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DO NOT EDIT — changes will be overwritten.

Source: tools-manifest.json (sha256:88ec3dfa066c...)
domain-map.json (sha256:a6177cc7e2f4...)
domain-map.json (sha256:cd10fec78b13...)
*/
import { type StitchToolClientSpec } from "../../src/spec/client.js";
import { StitchError } from "../../src/spec/errors.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/generated/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DO NOT EDIT — changes will be overwritten.

Source: tools-manifest.json (sha256:88ec3dfa066c...)
domain-map.json (sha256:a6177cc7e2f4...)
domain-map.json (sha256:cd10fec78b13...)
*/
export { Stitch } from "./stitch.js";
export { Project } from "./project.js";
Expand Down
19 changes: 18 additions & 1 deletion packages/sdk/generated/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DO NOT EDIT — changes will be overwritten.

Source: tools-manifest.json (sha256:88ec3dfa066c...)
domain-map.json (sha256:a6177cc7e2f4...)
domain-map.json (sha256:cd10fec78b13...)
*/
import { type StitchToolClientSpec } from "../../src/spec/client.js";
import { StitchError } from "../../src/spec/errors.js";
Expand Down Expand Up @@ -40,6 +40,7 @@ import {
ProjectData,
} from "./types.generated.js";
import {
GetProjectResponse,
GenerateScreenFromTextResponse,
ListScreensResponse,
GetScreenResponse,
Expand Down Expand Up @@ -112,6 +113,22 @@ export class Project {
return this.projectId;
}

/**
* Retrieves the details of a specific Stitch project using its project name.
* Tool: get_project
*/
async get(): Promise<Project> {
try {
const raw = await this.client.callTool<GetProjectResponse>(
"get_project",
{ name: `projects/${this.projectId}` },
);
return this.client.entities.resolve(Project, ["projectId"], raw);
} catch (error) {
throw StitchError.fromUnknown(error);
}
}

/**
* Generates a new screen within a project from a text prompt.
* Tool: generate_screen_from_text
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/generated/src/responses.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
DO NOT EDIT — changes will be overwritten.

Source: tools-manifest.json (sha256:88ec3dfa066c...)
domain-map.json (sha256:a6177cc7e2f4...)
domain-map.json (sha256:cd10fec78b13...)
*/

/** Response message for create_project. */
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/generated/src/screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DO NOT EDIT — changes will be overwritten.

Source: tools-manifest.json (sha256:88ec3dfa066c...)
domain-map.json (sha256:a6177cc7e2f4...)
domain-map.json (sha256:cd10fec78b13...)
*/
import { type StitchToolClientSpec } from "../../src/spec/client.js";
import { StitchError } from "../../src/spec/errors.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/generated/src/stitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DO NOT EDIT — changes will be overwritten.

Source: tools-manifest.json (sha256:88ec3dfa066c...)
domain-map.json (sha256:a6177cc7e2f4...)
domain-map.json (sha256:cd10fec78b13...)
*/
import { type StitchToolClientSpec } from "../../src/spec/client.js";
import { StitchError } from "../../src/spec/errors.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/generated/src/tool-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DO NOT EDIT — changes will be overwritten.

Source: tools-manifest.json (sha256:88ec3dfa066c...)
domain-map.json (sha256:a6177cc7e2f4...)
domain-map.json (sha256:cd10fec78b13...)
*/
/** JSON Schema property descriptor for a tool parameter. */
export interface ToolPropertySchema {
Expand Down
11 changes: 10 additions & 1 deletion packages/sdk/generated/src/types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DO NOT EDIT — changes will be overwritten.

Source: tools-manifest.json (sha256:88ec3dfa066c...)
domain-map.json (sha256:a6177cc7e2f4...)
domain-map.json (sha256:cd10fec78b13...)
*/

/** A component style token in a design system. */
Expand Down Expand Up @@ -682,6 +682,15 @@ export interface ScreenData {
title?: string;
htmlCode?: File;
screenshot?: File;
width?: string | number;
height?: string | number;
deviceType?: string;
screenType?: string;
generatedBy?: string;
prompt?: string;
theme?: DesignTheme;
designSystem?: DesignSystemInput;
screenMetadata?: ScreenMetadata;
[key: string]: any;
}

Expand Down
12 changes: 6 additions & 6 deletions packages/sdk/generated/stitch-sdk.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"schemaVersion": 1,
"generated": {
"generatedAt": "2026-09-25T04:45:34.219Z",
"sourceHash": "sha256:aad79acad078a250f95d5e58767a9082c41be37d4f5565bf307c96f1cd654b38",
"generatedAt": "2026-09-25T05:45:19.883Z",
"sourceHash": "sha256:77d5e0d5f2a9dd242fda6962c86e75615a3211e0a8d6eea30a47e2b96bc3d24c",
"manifestHash": "sha256:88ec3dfa066ce5060be236b0a5c0b5fb51671a7dd60d05556c028e6c4c8f0e1c",
"domainMapHash": "sha256:a6177cc7e2f44d2d536928d4e0ae7bd51ed2dd3393235787216b976498c3b1b2",
"domainMapHash": "sha256:cd10fec78b1365854d5453e47970c4c73896e32bb6b33255baeb5228851e5b89",
"fileCount": 8,
"repairedTools": [
"generate_screen_from_text",
Expand All @@ -13,11 +13,11 @@
]
},
"domainMap": {
"generatedAt": "2026-09-23T18:36:09.460Z",
"sourceHash": "sha256:a6177cc7e2f44d2d536928d4e0ae7bd51ed2dd3393235787216b976498c3b1b2",
"generatedAt": "2026-09-25T05:40:41.689Z",
"sourceHash": "sha256:cd10fec78b1365854d5453e47970c4c73896e32bb6b33255baeb5228851e5b89",
"manifestHash": "sha256:88ec3dfa066ce5060be236b0a5c0b5fb51671a7dd60d05556c028e6c4c8f0e1c",
"classCount": 4,
"bindingCount": 15
"bindingCount": 16
},
"manifest": {
"capturedAt": "2026-09-23T18:42:56.588Z",
Expand Down
11 changes: 11 additions & 0 deletions packages/sdk/src/project-ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

import { Project as GeneratedProject } from "../generated/src/project.js";
import type { ScreenInstance } from "../generated/src/types.generated.js";
import { Screen } from "./screen-ext.js";
import { EntityManager } from "./entity-manager.js";
import { StitchError, StitchErrorCode } from "./spec/errors.js";
Expand Down Expand Up @@ -115,6 +116,16 @@ export class Project extends GeneratedProject {
warnings: result.warnings ?? [],
};
}

/**
* Retrieves the project's canvas layout (`screenInstances`) containing
* placement coordinates (`x`, `y`, `width`, `height`), labels, and
* `sourceScreen` resource names (#365).
*/
async getCanvasLayout(): Promise<ScreenInstance[]> {
const updated = await this.get();
return updated.data?.screenInstances ?? [];
}
}

EntityManager.registerImplementation("Project", Project);
22 changes: 22 additions & 0 deletions packages/sdk/src/spec/canvas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import type { ScreenInstance } from "../../generated/src/types.generated.js";

/**
* Contract for reading the Stitch project canvas layout (`screenInstances`) (#365).
*/
export interface CanvasLayoutSpec {
getCanvasLayout(): Promise<ScreenInstance[]>;
}
19 changes: 19 additions & 0 deletions packages/sdk/test/fixtures/responses/get_project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "projects/p-fix",
"title": "Fixture Project",
"visibility": "PRIVATE",
"projectType": "PROJECT_DESIGN",
"deviceType": "DESKTOP",
"screenInstances": [
{
"id": "inst-1",
"sourceScreen": "projects/p-fix/screens/s-1",
"x": 100,
"y": 200,
"width": 1280,
"height": 800,
"deviceType": "DESKTOP",
"label": "Home Screen"
}
]
}
Loading
Loading