@enhance-eng/enhance 0.1.166 → 0.1.168
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{cli-output-identity.lib-DTdmAFNC.mjs → cli-output-identity.lib-DMHqCPUz.mjs} +303 -28
- package/dist/main.mjs +167 -113
- package/dist/{mcp-invocation.adapter-C8vXAND1.mjs → mcp-invocation.adapter-YFCrLzlc.mjs} +20 -15
- package/dist/mcp-main.mjs +9 -9
- package/dist/{mcp-server.adapter-BgNggWKN.mjs → mcp-server.adapter-CUuoL6AI.mjs} +83 -72
- package/dist/mcp.mjs +2 -2
- package/dist/remote-mcp-main.mjs +15 -5
- package/dist/{zod-messages.lib-CH-SDeX_.mjs → zod-messages.lib-T23QiUQO.mjs} +43 -12
- package/package.json +1 -1
|
@@ -1518,6 +1518,7 @@ const CANVAS_RICH_TEXT_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
|
|
|
1518
1518
|
"boxSizing",
|
|
1519
1519
|
"color",
|
|
1520
1520
|
"columnGap",
|
|
1521
|
+
"direction",
|
|
1521
1522
|
"display",
|
|
1522
1523
|
"flexDirection",
|
|
1523
1524
|
"fontFamily",
|
|
@@ -1561,6 +1562,7 @@ const CANVAS_RICH_TEXT_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
|
|
|
1561
1562
|
"textShadow",
|
|
1562
1563
|
"textTransform",
|
|
1563
1564
|
"textUnderlineOffset",
|
|
1565
|
+
"unicodeBidi",
|
|
1564
1566
|
"verticalAlign",
|
|
1565
1567
|
"whiteSpace",
|
|
1566
1568
|
"wordBreak",
|
|
@@ -2533,7 +2535,8 @@ const canvasConversionIssueSchema = z.object({
|
|
|
2533
2535
|
"nodes-truncated",
|
|
2534
2536
|
"responsive-behavior-not-editable",
|
|
2535
2537
|
"style-degraded",
|
|
2536
|
-
"unsupported-surface"
|
|
2538
|
+
"unsupported-surface",
|
|
2539
|
+
"vertical-writing-unsupported"
|
|
2537
2540
|
]),
|
|
2538
2541
|
message: z.string().min(1),
|
|
2539
2542
|
temporaryId: temporaryIdSchema.optional()
|
|
@@ -2588,15 +2591,23 @@ const canvasSubtreeDraftRelationshipSchema = z.object({
|
|
|
2588
2591
|
parentTemporaryId: temporaryIdSchema,
|
|
2589
2592
|
sortKey: z.string().min(1)
|
|
2590
2593
|
});
|
|
2594
|
+
/**
|
|
2595
|
+
* A report that cannot be read says so, rather than reading as "nothing left out". The kind is an
|
|
2596
|
+
* existing one, because installed clients check kinds strictly and would refuse the whole answer.
|
|
2597
|
+
*/
|
|
2598
|
+
const UNREADABLE_REPORT = {
|
|
2599
|
+
nodeCount: 0,
|
|
2600
|
+
issues: [{
|
|
2601
|
+
code: "content-omitted",
|
|
2602
|
+
message: "The converter's report could not be read, so what it left out of this insert is unknown."
|
|
2603
|
+
}]
|
|
2604
|
+
};
|
|
2591
2605
|
const canvasSubtreeDraftSchema = z.object({
|
|
2592
2606
|
version: z.literal(1),
|
|
2593
2607
|
rootTemporaryId: temporaryIdSchema,
|
|
2594
2608
|
nodes: z.array(canvasSubtreeDraftNodeSchema).min(1),
|
|
2595
2609
|
relationships: z.array(canvasSubtreeDraftRelationshipSchema),
|
|
2596
|
-
report: canvasConversionReportSchema.catch(
|
|
2597
|
-
nodeCount: 0,
|
|
2598
|
-
issues: []
|
|
2599
|
-
})
|
|
2610
|
+
report: canvasConversionReportSchema.catch(UNREADABLE_REPORT)
|
|
2600
2611
|
}).transform((draft) => ({
|
|
2601
2612
|
...draft,
|
|
2602
2613
|
report: {
|
|
@@ -9582,7 +9593,17 @@ const clientPerformanceInputSchema = z.discriminatedUnion("name", [
|
|
|
9582
9593
|
builtLayerCount: countSchema,
|
|
9583
9594
|
zoomPercent: countSchema,
|
|
9584
9595
|
frameNumber: countSchema,
|
|
9585
|
-
skippedCount: countSchema
|
|
9596
|
+
skippedCount: countSchema,
|
|
9597
|
+
isPageFocused: z.boolean().optional()
|
|
9598
|
+
}),
|
|
9599
|
+
z.object({
|
|
9600
|
+
...base$1,
|
|
9601
|
+
name: z.literal("canvas_long_frames_skipped"),
|
|
9602
|
+
action: longFrameActionSchema,
|
|
9603
|
+
frameCount: countSchema,
|
|
9604
|
+
totalMs: durationSchema$1,
|
|
9605
|
+
worstMs: durationSchema$1,
|
|
9606
|
+
reason: z.enum(["bound", "not-blocking"]).optional()
|
|
9586
9607
|
}),
|
|
9587
9608
|
z.object({
|
|
9588
9609
|
...base$1,
|
|
@@ -10508,6 +10529,191 @@ var PartialBatchError = class extends CliError {
|
|
|
10508
10529
|
}
|
|
10509
10530
|
};
|
|
10510
10531
|
|
|
10532
|
+
//#endregion
|
|
10533
|
+
//#region src/application/skill-texts.use-case.ts
|
|
10534
|
+
/** The skills, by the short name each has before a surface names it. */
|
|
10535
|
+
const SKILL_NAMES = [
|
|
10536
|
+
"capture",
|
|
10537
|
+
"design-on-canvas",
|
|
10538
|
+
"publish-prototype",
|
|
10539
|
+
"respond-to-feedback",
|
|
10540
|
+
"apply-canvas-design"
|
|
10541
|
+
];
|
|
10542
|
+
/** A skill's name could not be written for a surface: the surface has no name for a capability. */
|
|
10543
|
+
var SkillTextError = class extends Error {
|
|
10544
|
+
constructor(skill, capability, surface) {
|
|
10545
|
+
super(`The ${skill} skill names ${capability}, which has no ${surface === "cli" ? "command" : "tool"}.`);
|
|
10546
|
+
this.name = "SkillTextError";
|
|
10547
|
+
}
|
|
10548
|
+
};
|
|
10549
|
+
const wordsOf = (skill, wording) => {
|
|
10550
|
+
const named = (capability) => {
|
|
10551
|
+
const name = wording.nameOf(capability);
|
|
10552
|
+
if (name === void 0) throw new SkillTextError(skill, capability, wording.surface);
|
|
10553
|
+
return wording.surface === "cli" ? `${wording.command} ${name}` : name;
|
|
10554
|
+
};
|
|
10555
|
+
const isTool = wording.surface === "cli";
|
|
10556
|
+
return {
|
|
10557
|
+
call: (capability) => `\`${named(capability)}\``,
|
|
10558
|
+
two: (words) => words[wording.surface],
|
|
10559
|
+
learn: (capability, what) => isTool ? `\`${named(capability)} --help\` shows how to ${what}.` : `The description of \`${named(capability)}\` shows how to ${what}.`,
|
|
10560
|
+
learnBoth: (first, second, what) => isTool ? `\`${named(first)} --help\` and \`${named(second)} --help\` show how to ${what}.` : `The descriptions of \`${named(first)}\` and \`${named(second)}\` show how to ${what}.`,
|
|
10561
|
+
command: isTool ? wording.command : ""
|
|
10562
|
+
};
|
|
10563
|
+
};
|
|
10564
|
+
/** The heading over a skill's list: the tool has commands, and the plugin has tools. */
|
|
10565
|
+
const listHeading = ({ two }) => two({
|
|
10566
|
+
cli: "## Commands",
|
|
10567
|
+
mcp: "## Tools"
|
|
10568
|
+
});
|
|
10569
|
+
/**
|
|
10570
|
+
* Each skill states its goal and names what the surface offers for it; the commands' own help
|
|
10571
|
+
* and the tools' own descriptions teach the rest. A line is added only when measured runs are
|
|
10572
|
+
* worse without it; `skill-evaluation` holds the cases and what the last runs found. The design
|
|
10573
|
+
* skill's small-edit line and its two sections on the look of a screen were added without runs,
|
|
10574
|
+
* and the record marks each as not measured.
|
|
10575
|
+
*/
|
|
10576
|
+
const SKILLS = {
|
|
10577
|
+
capture: {
|
|
10578
|
+
job: "capturing screens",
|
|
10579
|
+
description: "Put the screens a thread is changing onto an Enhance canvas as editable frames and return the link. Use when asked to capture, share or review screens, or to put work on a canvas. Also applies whenever a thread has changed how a screen looks: when that work is done, offer once, in one line, to put the changed screens on an Enhance canvas for review, and capture only on a yes.",
|
|
10580
|
+
body: ({ call, two, command }) => `# Capture screens to Enhance
|
|
10581
|
+
|
|
10582
|
+
Put each screen this thread is changing onto one Enhance canvas as an editable frame, and return the canvas link.
|
|
10583
|
+
|
|
10584
|
+
${two({
|
|
10585
|
+
cli: `## Commands
|
|
10586
|
+
|
|
10587
|
+
- \`${command} canvas create --title "<what this thread is changing>"\` makes the canvas and answers with its id and its link.
|
|
10588
|
+
- \`${command} canvas capture-page --help\` shows the two calls one capture takes, with an example. Read it before the first capture.
|
|
10589
|
+
- \`${command} auth status\` says who is signed in. If nobody is, ask the person to run \`${command} setup\`.`,
|
|
10590
|
+
mcp: `## Tools
|
|
10591
|
+
|
|
10592
|
+
- ${call("canvas.create")} with a \`title\` of what this thread is changing makes the canvas and answers with its id and its link.
|
|
10593
|
+
- ${call("canvas.capturePage")} puts one page on the canvas. Its description gives the two calls one capture takes. Read it before the first capture.
|
|
10594
|
+
- ${call("auth.status")} says who is signed in. If nobody is, call ${call("auth.login")}.`
|
|
10595
|
+
})}
|
|
10596
|
+
`
|
|
10597
|
+
},
|
|
10598
|
+
"design-on-canvas": {
|
|
10599
|
+
job: "designing on a canvas",
|
|
10600
|
+
description: "Create or revise editable product designs on an Enhance canvas using the product's real screens, components, tokens, and visual language. Use for mocks, screen exploration, and canvas design iteration.",
|
|
10601
|
+
body: (words) => {
|
|
10602
|
+
const { call, two, learn } = words;
|
|
10603
|
+
return `# Design on the canvas
|
|
10604
|
+
|
|
10605
|
+
Create or change editable screens on an Enhance canvas, look at what you made, and give the canvas link.
|
|
10606
|
+
|
|
10607
|
+
${listHeading(words)}
|
|
10608
|
+
|
|
10609
|
+
- ${two({
|
|
10610
|
+
cli: `\`${words.command} canvas create --title "<what this is>"\``,
|
|
10611
|
+
mcp: `${call("canvas.create")} with a \`title\``
|
|
10612
|
+
})} makes a canvas and answers with its id and its link.
|
|
10613
|
+
- ${learn("canvas.read", "read what a canvas holds: its outline, or one screen as HTML")}
|
|
10614
|
+
- ${learn("canvas.insertHtml", "add a screen as HTML, with an example")} Read it before the first insert.
|
|
10615
|
+
- ${learn("canvas.edit", "change text, styles, names and order on layers that are already there, and copy a layer, many in one call")} Use it for any change to existing work.
|
|
10616
|
+
- ${learn("canvas.updateHtml", "rebuild the inside of a layer")} Use it only when the structure itself changes.
|
|
10617
|
+
- ${learn("canvas.importAsset", "bring in an image or a font")}
|
|
10618
|
+
- ${learn("canvas.render", "get a picture of a screen")}
|
|
10619
|
+
|
|
10620
|
+
## Decide the look before the markup
|
|
10621
|
+
|
|
10622
|
+
A change to an existing screen keeps that screen's look. A new screen on a canvas that holds a product's screens takes their fonts, sizes, colours, spacing and corner radii. With no product to follow:
|
|
10623
|
+
|
|
10624
|
+
- White background, near-black text and one accent colour, used for the main action and little else, unless the brief asks otherwise.
|
|
10625
|
+
- Three type sizes, far apart: one large, one body, one small. No text under 13px, and body text at 4.5:1 contrast or more.
|
|
10626
|
+
- Make the thing that matters most much bigger than the rest. A page of equal cards has no first read.
|
|
10627
|
+
- Put content straight on the page and separate it with space: tight inside a group, generous between groups. Add a card, border or shadow only to show grouping or something clickable.
|
|
10628
|
+
- Real words and numbers of realistic length. SVG for icons, not emoji.
|
|
10629
|
+
- In repeated rows, give icons, values and trailing actions a fixed width, and keep the slot when a row has nothing in it.
|
|
10630
|
+
- Asked for several directions, change the layout or the idea, not only the accent colour, and keep the content the same.
|
|
10631
|
+
|
|
10632
|
+
## Look at what you made
|
|
10633
|
+
|
|
10634
|
+
After each screen, and after any change a person would notice, get a picture and check, in this order:
|
|
10635
|
+
|
|
10636
|
+
1. Is everything that was asked for there, and readable?
|
|
10637
|
+
2. Is anything cut off or overflowing its frame? Fix the frame's size or the content's wrapping; do not shrink the text.
|
|
10638
|
+
3. Do repeated rows line up down the page?
|
|
10639
|
+
4. Is the first thing you notice the thing that matters most?
|
|
10640
|
+
5. Is spacing even where it should be even?
|
|
10641
|
+
|
|
10642
|
+
Fix what you see with ${call("canvas.edit")}, not by rebuilding the screen, then look again.
|
|
10643
|
+
`;
|
|
10644
|
+
}
|
|
10645
|
+
},
|
|
10646
|
+
"publish-prototype": {
|
|
10647
|
+
job: "publishing a prototype",
|
|
10648
|
+
description: "Publish a selected product build to an Enhance canvas and visually verify its prototype. Use for publishing, attaching, refreshing or validating a local build folder or an authorized uploaded build artifact.",
|
|
10649
|
+
body: (words) => {
|
|
10650
|
+
const { learn } = words;
|
|
10651
|
+
return `# Publish a prototype
|
|
10652
|
+
|
|
10653
|
+
Publish a built site to an Enhance canvas as a prototype people can click through, and give the canvas link.
|
|
10654
|
+
|
|
10655
|
+
${listHeading(words)}
|
|
10656
|
+
|
|
10657
|
+
- ${learn("prototype.publish", "publish a build folder to a canvas, and how to update a prototype that is already there")} Read it before the first publish.
|
|
10658
|
+
- ${learn("canvas.read", "read what the canvas holds, including a prototype already on it")}
|
|
10659
|
+
`;
|
|
10660
|
+
}
|
|
10661
|
+
},
|
|
10662
|
+
"respond-to-feedback": {
|
|
10663
|
+
job: "responding to feedback",
|
|
10664
|
+
description: "Act on clear Enhance canvas and prototype feedback, implement the underlying change, republish when needed, and verify the result. Use when a user asks to address, resolve, or work through review comments.",
|
|
10665
|
+
body: (words) => {
|
|
10666
|
+
const { learn, learnBoth } = words;
|
|
10667
|
+
return `# Respond to feedback
|
|
10668
|
+
|
|
10669
|
+
Do what each clear review comment on an Enhance canvas asks, on the canvas or in the source its prototype was published from. Reply to and resolve the ones you finished, and leave open the ones you could not act on.
|
|
10670
|
+
|
|
10671
|
+
${listHeading(words)}
|
|
10672
|
+
|
|
10673
|
+
- ${learn("comment.list", "read the comment threads on a canvas")}
|
|
10674
|
+
- ${learnBoth("comment.reply", "comment.resolve", "answer a thread and resolve it")}
|
|
10675
|
+
- ${learnBoth("canvas.read", "canvas.updateHtml", "read a screen and change it")}
|
|
10676
|
+
- ${learn("prototype.publish", "update a prototype from changed source")}
|
|
10677
|
+
`;
|
|
10678
|
+
}
|
|
10679
|
+
},
|
|
10680
|
+
"apply-canvas-design": {
|
|
10681
|
+
job: "applying a canvas design",
|
|
10682
|
+
description: "Implement an approved or edited Enhance canvas design in the owning product source, republish it, and verify source-to-design fidelity. Use for canvas-to-code or canvas-to-prototype handoff.",
|
|
10683
|
+
body: (words) => {
|
|
10684
|
+
const { learn } = words;
|
|
10685
|
+
return `# Apply a canvas design
|
|
10686
|
+
|
|
10687
|
+
Make the product's source match an approved design on an Enhance canvas, then update the prototype on that canvas from the new build.
|
|
10688
|
+
|
|
10689
|
+
${listHeading(words)}
|
|
10690
|
+
|
|
10691
|
+
- ${learn("canvas.read", "read the design: the canvas's outline, or one screen as HTML")}
|
|
10692
|
+
- ${learn("canvas.render", "get a picture of a screen")}
|
|
10693
|
+
- ${learn("prototype.publish", "update the prototype that is already on the canvas")} Read it before publishing.
|
|
10694
|
+
`;
|
|
10695
|
+
}
|
|
10696
|
+
}
|
|
10697
|
+
};
|
|
10698
|
+
/**
|
|
10699
|
+
* Every skill, written for one surface. The tool's are named after its command, so the production
|
|
10700
|
+
* and development tools never overwrite one another's; the plugin's host names them itself.
|
|
10701
|
+
*/
|
|
10702
|
+
const skillTextsFor = (wording) => SKILL_NAMES.map((skill) => {
|
|
10703
|
+
const source = SKILLS[skill];
|
|
10704
|
+
const name = wording.surface === "cli" ? `${wording.commandName}-${skill}` : skill;
|
|
10705
|
+
const body = source.body(wordsOf(skill, wording));
|
|
10706
|
+
return {
|
|
10707
|
+
skill,
|
|
10708
|
+
name,
|
|
10709
|
+
description: source.description,
|
|
10710
|
+
body,
|
|
10711
|
+
text: `---\nname: ${name}\ndescription: ${source.description}\n---\n\n${body}`
|
|
10712
|
+
};
|
|
10713
|
+
});
|
|
10714
|
+
/** The job each skill is for, in the order of the skills, for a sentence that lists them. */
|
|
10715
|
+
const SKILL_JOBS = SKILL_NAMES.map((skill) => SKILLS[skill].job);
|
|
10716
|
+
|
|
10511
10717
|
//#endregion
|
|
10512
10718
|
//#region src/infrastructure/mcp-tool-names.consts.ts
|
|
10513
10719
|
/** The tool a hosted assistant calls for each capability that has one of its own. */
|
|
@@ -10534,6 +10740,7 @@ const MCP_TOOL_BY_CAPABILITY = {
|
|
|
10534
10740
|
"comment.resolve": "feedback_set_resolved",
|
|
10535
10741
|
"comment.start": "feedback_create",
|
|
10536
10742
|
"operation.status": "operation_status",
|
|
10743
|
+
"prototype.publish": "prototype_publish",
|
|
10537
10744
|
"prototype.publishCanvas": "prototype_publish"
|
|
10538
10745
|
};
|
|
10539
10746
|
|
|
@@ -10936,8 +11143,8 @@ const canvasSourceEvidenceSchema = z.discriminatedUnion("kind", [
|
|
|
10936
11143
|
|
|
10937
11144
|
//#endregion
|
|
10938
11145
|
//#region src/application/canvas-exchange.schema.ts
|
|
10939
|
-
const MAX_PREPARATION_WAIT_MS =
|
|
10940
|
-
const DEFAULT_PREPARATION_WAIT_MS =
|
|
11146
|
+
const MAX_PREPARATION_WAIT_MS = 12e4;
|
|
11147
|
+
const DEFAULT_PREPARATION_WAIT_MS = 3e4;
|
|
10941
11148
|
const MAX_TOKEN_LENGTH = 16384;
|
|
10942
11149
|
const MAX_TARGETS = 1e3;
|
|
10943
11150
|
const MAX_OUTLINE_PAGE = 100;
|
|
@@ -11360,8 +11567,8 @@ const canvasEditCapabilityInputSchema = z.object({
|
|
|
11360
11567
|
|
|
11361
11568
|
//#endregion
|
|
11362
11569
|
//#region src/application/canvas-conversion-command.schema.ts
|
|
11363
|
-
const MAX_WAIT_MS$1 =
|
|
11364
|
-
const DEFAULT_WAIT_MS$1 =
|
|
11570
|
+
const MAX_WAIT_MS$1 = 12e4;
|
|
11571
|
+
const DEFAULT_WAIT_MS$1 = 3e4;
|
|
11365
11572
|
const canvasInsertHtmlInputSchema = z.strictObject({
|
|
11366
11573
|
canvasRef: z.string().min(1),
|
|
11367
11574
|
baseVersion: z.number().int().positive(),
|
|
@@ -11502,8 +11709,8 @@ const canvasRenderFileSchema = z.object({
|
|
|
11502
11709
|
|
|
11503
11710
|
//#endregion
|
|
11504
11711
|
//#region src/application/canvas-render-request.schema.ts
|
|
11505
|
-
const MAX_WAIT_MS =
|
|
11506
|
-
const DEFAULT_WAIT_MS =
|
|
11712
|
+
const MAX_WAIT_MS = 12e4;
|
|
11713
|
+
const DEFAULT_WAIT_MS = 3e4;
|
|
11507
11714
|
const canvasRenderRequestSchema = z.strictObject({
|
|
11508
11715
|
canvasRef: z.string().min(1),
|
|
11509
11716
|
expectedVersion: z.number().int().positive(),
|
|
@@ -11669,7 +11876,7 @@ const canvasEditOutputSchema = z.union([canvasEditReceiptSchema, canvasWriteRece
|
|
|
11669
11876
|
const common = {
|
|
11670
11877
|
canvasRef: z.string().min(1),
|
|
11671
11878
|
baseVersion: z.number().int().positive(),
|
|
11672
|
-
waitMs: z.number().int().min(0).max(
|
|
11879
|
+
waitMs: z.number().int().min(0).max(12e4).default(3e4).describe("Additional polling after the initial server call; this does not bound initial native preparation time."),
|
|
11673
11880
|
clientToken: z.uuid()
|
|
11674
11881
|
};
|
|
11675
11882
|
const canvasArrangeInputSchema = z.strictObject({
|
|
@@ -11989,7 +12196,7 @@ const canvasPrototypeOutputSchema = z.strictObject({
|
|
|
11989
12196
|
//#region src/application/capture-page.schema.ts
|
|
11990
12197
|
const canvasCapturePageCapabilityInputSchema = z.strictObject({
|
|
11991
12198
|
...canvasRenderRequestSchema.pick({ canvasRef: true }).shape,
|
|
11992
|
-
waitMs: canvasRenderRequestSchema.shape.waitMs.describe("How long this call waits for the page to become editable, in milliseconds: at most
|
|
12199
|
+
waitMs: canvasRenderRequestSchema.shape.waitMs.describe("How long this call waits for the page to become editable, in milliseconds: at most 120000. Call again with the same captureId to keep waiting."),
|
|
11993
12200
|
captureId: z.uuid().optional().describe("The captureId the snippet answered with. Omit it to get a snippet to run in the page."),
|
|
11994
12201
|
title: z.string().optional().describe("Optional: a name for the frame. Without it, or when it is blank, the frame takes the captured page's own title."),
|
|
11995
12202
|
extent: z.enum(["full-page", "viewport"]).default("full-page").describe("What the snippet captures: the whole page, or only the visible window."),
|
|
@@ -14657,19 +14864,21 @@ const PROCEDURES_WITHOUT_GENERIC_RECEIPTS = /* @__PURE__ */ new Set([
|
|
|
14657
14864
|
"screen.create",
|
|
14658
14865
|
"canvas.copyFromWork"
|
|
14659
14866
|
]);
|
|
14867
|
+
/**
|
|
14868
|
+
* The answer a token keeps: a success, or a refusal the same input would hear again. A fault of
|
|
14869
|
+
* ours (internal, rate limited, or no named error at all) is not an answer about the write, so
|
|
14870
|
+
* the token keeps nothing and the caller's retry with the same token runs it again.
|
|
14871
|
+
*/
|
|
14660
14872
|
const outcomeFrom = (result) => {
|
|
14661
14873
|
if (result.ok) return {
|
|
14662
14874
|
kind: "success",
|
|
14663
14875
|
data: result.data
|
|
14664
14876
|
};
|
|
14665
14877
|
const onWire = toWireAppError(result.error);
|
|
14666
|
-
if (onWire
|
|
14667
|
-
kind: "failure",
|
|
14668
|
-
error: onWire
|
|
14669
|
-
};
|
|
14878
|
+
if (onWire === null || onWire.code === "INTERNAL" || onWire.code === "RATE_LIMITED") return null;
|
|
14670
14879
|
return {
|
|
14671
14880
|
kind: "failure",
|
|
14672
|
-
error:
|
|
14881
|
+
error: onWire
|
|
14673
14882
|
};
|
|
14674
14883
|
};
|
|
14675
14884
|
const replay = (claim) => {
|
|
@@ -14695,13 +14904,17 @@ const idempotentMutations = trpcMiddleware(async ({ ctx, type, path, getRawInput
|
|
|
14695
14904
|
if (claimed.isErr()) throw toTrpcError(internalError(claimed.error.message));
|
|
14696
14905
|
if (claimed.value.kind !== "started") return replay(claimed.value);
|
|
14697
14906
|
const result = await next();
|
|
14698
|
-
const
|
|
14907
|
+
const key = {
|
|
14699
14908
|
personId: ctx.viewer.personId,
|
|
14700
14909
|
clientToken: ctx.idempotencyKey,
|
|
14701
|
-
procedure: path
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14910
|
+
procedure: path
|
|
14911
|
+
};
|
|
14912
|
+
const outcome = outcomeFrom(result);
|
|
14913
|
+
const settled = await (outcome === null ? ctx.idempotency.release(key) : ctx.idempotency.complete({
|
|
14914
|
+
...key,
|
|
14915
|
+
outcome
|
|
14916
|
+
}));
|
|
14917
|
+
if (settled.isErr()) throw toTrpcError(internalError(settled.error.message));
|
|
14705
14918
|
return result;
|
|
14706
14919
|
});
|
|
14707
14920
|
|
|
@@ -14812,7 +15025,7 @@ const rpcValidationDiagnostic = (cause) => {
|
|
|
14812
15025
|
};
|
|
14813
15026
|
|
|
14814
15027
|
//#endregion
|
|
14815
|
-
//#region ../api/src/shared/trpc/
|
|
15028
|
+
//#region ../api/src/shared/trpc/request-log.procedure.ts
|
|
14816
15029
|
/** Query timings are logged to the hundredth of a millisecond; finer is noise. */
|
|
14817
15030
|
const HUNDREDTHS = 100;
|
|
14818
15031
|
/** A message on the log index is a message somebody pays to keep for 400 days. */
|
|
@@ -14851,6 +15064,16 @@ const failureOf = (error) => {
|
|
|
14851
15064
|
message: reasonOf(error).slice(0, MESSAGE_CAP)
|
|
14852
15065
|
};
|
|
14853
15066
|
};
|
|
15067
|
+
/** Which agent made a call, as the API worked it out when the call arrived; nothing for a person. */
|
|
15068
|
+
const agentLogFields = (viewer) => {
|
|
15069
|
+
if (viewer.kind !== "agent" || viewer.agentAttribution === void 0) return {};
|
|
15070
|
+
const agent = viewer.agentAttribution;
|
|
15071
|
+
return {
|
|
15072
|
+
agentClient: agent.agent_client,
|
|
15073
|
+
agentClientVersion: agent.agent_client_version ?? null,
|
|
15074
|
+
connectionPath: agent.connection_path
|
|
15075
|
+
};
|
|
15076
|
+
};
|
|
14854
15077
|
/**
|
|
14855
15078
|
* @justified amplification
|
|
14856
15079
|
* The canonical line: one per procedure call, and the whole of the profile.
|
|
@@ -14878,6 +15101,7 @@ const timed = trpcMiddleware(async ({ ctx, path, type, next }) => {
|
|
|
14878
15101
|
const failure = call.outcome.ok ? null : failureOf(call.outcome.error);
|
|
14879
15102
|
const line = {
|
|
14880
15103
|
...ctx.taggedFields(),
|
|
15104
|
+
...agentLogFields(ctx.viewer),
|
|
14881
15105
|
event: "ProcedureCalled",
|
|
14882
15106
|
procedure: path,
|
|
14883
15107
|
kind: type,
|
|
@@ -14903,6 +15127,9 @@ const timed = trpcMiddleware(async ({ ctx, path, type, next }) => {
|
|
|
14903
15127
|
}, "query");
|
|
14904
15128
|
return call.outcome;
|
|
14905
15129
|
});
|
|
15130
|
+
|
|
15131
|
+
//#endregion
|
|
15132
|
+
//#region ../api/src/shared/trpc/base.procedure.ts
|
|
14906
15133
|
const RENDER_GRANT_PROCEDURES = /* @__PURE__ */ new Set([
|
|
14907
15134
|
"canvas.document.get",
|
|
14908
15135
|
"canvas.document.parts",
|
|
@@ -18855,6 +19082,8 @@ const clientConversionTelemetryRoute = () => baseProcedure.input(clientConversio
|
|
|
18855
19082
|
//#endregion
|
|
18856
19083
|
//#region ../api/src/shared/observability/client-performance-telemetry.router.ts
|
|
18857
19084
|
const SLOW_PROTOTYPE_OPEN_MS = 5e3;
|
|
19085
|
+
/** A number, like the other flags, so a query can filter and sum it; 1 unless the line says no. */
|
|
19086
|
+
const focusedPageFlagOf = (input) => input.name === "canvas_long_frame" && input.isPageFocused === false ? 0 : 1;
|
|
18858
19087
|
const fieldsOf$1 = (input) => {
|
|
18859
19088
|
const { name, ...fields } = input;
|
|
18860
19089
|
const isPrototypeOpen = input.name === "prototype_open" && (input.kind ?? "open") === "open";
|
|
@@ -18870,6 +19099,7 @@ const fieldsOf$1 = (input) => {
|
|
|
18870
19099
|
"unavailable"
|
|
18871
19100
|
].includes(input.outcome) ? 1 : 0,
|
|
18872
19101
|
isJanky: input.name === "canvas_interaction" && input.outcome === "janky" ? 1 : 0,
|
|
19102
|
+
isFocusedPage: focusedPageFlagOf(input),
|
|
18873
19103
|
isRealtimeFailure: input.name === "canvas_realtime" && input.outcome === "failed" ? 1 : 0,
|
|
18874
19104
|
isPrototypeOpen: Number(isPrototypeOpen),
|
|
18875
19105
|
isPrototypeOpenFailure: isPrototypeOpen && input.outcome !== "loaded" && input.reason !== "denied" ? 1 : 0,
|
|
@@ -18882,7 +19112,7 @@ const isFailure$1 = (input) => {
|
|
|
18882
19112
|
if (input.name === "canvas_interaction") return input.outcome !== "smooth";
|
|
18883
19113
|
if (input.name === "prototype_open") return input.outcome !== "loaded";
|
|
18884
19114
|
if (input.name === "canvas_measurement") return true;
|
|
18885
|
-
if (input.name === "canvas_long_frame") return false;
|
|
19115
|
+
if (input.name === "canvas_long_frame" || input.name === "canvas_long_frames_skipped") return false;
|
|
18886
19116
|
return input.outcome !== "succeeded";
|
|
18887
19117
|
};
|
|
18888
19118
|
const clientPerformanceTelemetryRoute = () => baseProcedure.input(clientPerformanceInputSchema).output(clientPerformanceOutputSchema).mutation(({ input, ctx }) => {
|
|
@@ -19722,6 +19952,47 @@ const boundedEntries = (compact, key, entries) => {
|
|
|
19722
19952
|
}
|
|
19723
19953
|
return kept;
|
|
19724
19954
|
};
|
|
19955
|
+
/**
|
|
19956
|
+
* An insert's count of problems, whether it is partial and the step that says to tell the person
|
|
19957
|
+
* come before any id list: an agent can read ids again, but not what the converter left out.
|
|
19958
|
+
*/
|
|
19959
|
+
const reportFields = (compact, original) => {
|
|
19960
|
+
const report = recordFrom(original["report"]);
|
|
19961
|
+
if (report === null) return {};
|
|
19962
|
+
const summary = {
|
|
19963
|
+
issueCount: report["issueCount"],
|
|
19964
|
+
partial: report["partial"]
|
|
19965
|
+
};
|
|
19966
|
+
const next = original["next"];
|
|
19967
|
+
const fields = {
|
|
19968
|
+
report: summary,
|
|
19969
|
+
...Array.isArray(next) && canFitReceipt({
|
|
19970
|
+
...compact,
|
|
19971
|
+
report: summary,
|
|
19972
|
+
next
|
|
19973
|
+
}) && { next }
|
|
19974
|
+
};
|
|
19975
|
+
const issues = Array.isArray(report["issues"]) ? report["issues"] : [];
|
|
19976
|
+
const kept = [];
|
|
19977
|
+
for (const issue of issues) {
|
|
19978
|
+
if (!canFitReceipt({
|
|
19979
|
+
...compact,
|
|
19980
|
+
...fields,
|
|
19981
|
+
report: {
|
|
19982
|
+
...summary,
|
|
19983
|
+
issues: [...kept, issue]
|
|
19984
|
+
}
|
|
19985
|
+
})) break;
|
|
19986
|
+
kept.push(issue);
|
|
19987
|
+
}
|
|
19988
|
+
return {
|
|
19989
|
+
...fields,
|
|
19990
|
+
report: {
|
|
19991
|
+
...summary,
|
|
19992
|
+
issues: kept
|
|
19993
|
+
}
|
|
19994
|
+
};
|
|
19995
|
+
};
|
|
19725
19996
|
const toCanvasAuthoringResult = (value) => {
|
|
19726
19997
|
const original = recordFrom(value);
|
|
19727
19998
|
if (original === null) return null;
|
|
@@ -19735,10 +20006,14 @@ const toCanvasAuthoringResult = (value) => {
|
|
|
19735
20006
|
value: complete,
|
|
19736
20007
|
detail: null
|
|
19737
20008
|
};
|
|
19738
|
-
const
|
|
20009
|
+
const shortened = {
|
|
19739
20010
|
...receipt,
|
|
19740
20011
|
detailTruncated: true
|
|
19741
20012
|
};
|
|
20013
|
+
const compact = {
|
|
20014
|
+
...shortened,
|
|
20015
|
+
...reportFields(shortened, original)
|
|
20016
|
+
};
|
|
19742
20017
|
for (const key of [
|
|
19743
20018
|
"mode",
|
|
19744
20019
|
"targetNodeId",
|
|
@@ -19799,4 +20074,4 @@ const withCommandInFailure = (value, commandName) => ({
|
|
|
19799
20074
|
});
|
|
19800
20075
|
|
|
19801
20076
|
//#endregion
|
|
19802
|
-
export { canvasAssetImportInputSchema as $,
|
|
20077
|
+
export { canvasAssetImportInputSchema as $, applyCanvasTypographyPatch as $n, canvasAxisStyleProperties as $r, inSurfaceWords as $t, recordingSnapshotCapabilityInputSchema as A, createAgentTokenOutputSchema as An, textOf as Ar, canvasSnapshotToken as At, operationStatusImageSchema as B, domLocatorSchema as Bn, canvasRenderTargetSchema as Br, canvasResourcesCursorSchema as Bt, PROCEDURE_DESCRIPTIONS as C, getPrototypePublishStatusOutputSchema as Cn, RECTANGLE_KIND as Cr, ROOT_FIELD as Ct, canvasWriteHtmlCapabilityInputSchema as D, getMeOutputSchema as Dn, applyCanvasOperationsOutputSchema as Dr, objectFieldNames as Dt, canvasRenderCapabilityInputSchema as E, submitPrototypeArtifactOutputSchema as En, applyCanvasOperationsInputSchema as Er, isInputRecord as Et, canvasPrototypeCapabilityInputSchema as F, commentAuthorSchema as Fn, canvasNodeStylePatchSchema as Fr, canvasReadInputSchema as Ft, canvasCaptureOutputSchema as G, replyCommentInputSchema as Gn, getCanvasRenderOutputSchema as Gr, hasCanvasReferenceScope as Gt, operationStatusOutputSchema as H, getCommentOutputSchema as Hn, createCanvasRenderOutputSchema as Hr, canvasReferenceNodeIds as Ht, canvasPrototypeInputSchema as I, commentCanvasContextSchema as In, createCanvasConversionOutputSchema as Ir, canvasReadOutputSchema as It, canvasDuplicateCapabilityInputSchema as J, screenElementCommentTargetSchema as Jn, emptyCanvasSceneDocument as Jr, callOf as Jt, canvasArrangeCapabilityInputSchema as K, replyCommentOutputSchema as Kn, canvasReadableSceneDocumentSchema as Kr, parseCanvasReference as Kt, canvasPrototypeIntentSchema as L, commentMessageSchema as Ln, getCanvasConversionOutputSchema as Lr, canvasUpdateHtmlCapabilityInputSchema as Lt, canvasCapturePageCapabilityInputSchema as M, listOrganisationsOutputSchema as Mn, saveCanvasDocumentOutputSchema as Mr, encodeCanvasExchangeToken as Mt, canvasCapturePageInputSchema as N, emptyFixtureDocument as Nn, wholeCanvasDocumentOutputSchema as Nr, resolveCanvasSnapshot as Nt, commentAttentionCapabilityInputSchema as O, MCP_AUTH_SCOPE as On, getCanvasMutationOutputSchema as Or, quotedValue as Ot, canvasCapturePageOutputSchema as P, withFixtureScreen as Pn, canvasOperationSchema as Pr, canvasOutlineCursorSchema as Pt, canvasAssetImportCapabilityInputSchema as Q, createCapturePassOutputSchema as Qn, canvasAuthoredStyleDeclarations as Qr, diagnosisStep as Qt, canvasPrototypeOutputSchema as R, commentResolverSchema as Rn, canvasRenderSourceStateSchema as Rr, canvasUpdateHtmlInputSchema as Rt, PROTOTYPE_UPDATE_GUIDANCE as S, getPrototypeArtifactCapabilitiesOutputSchema as Sn, PAGE_KIND as Sr, canvasEditsSchema as St, canvasReadCapabilityInputSchema as T, prototypeArtifactPathSchema as Tn, TEXT_KIND as Tr, inputProblemSummary as Tt, canvasCaptureCapabilityInputSchema as U, listCommentsInputSchema as Un, createRecordingSnapshotOutputSchema as Ur, canvasReferenceRenderTarget as Ut, operationStatusInputSchema as V, elementAnchorSchema as Vn, canvasWorldBoundsSchema as Vr, assertCanvasReferenceNodes as Vt, canvasCaptureInputSchema as W, listCommentsOutputSchema as Wn, downloadCanvasRenderOutputSchema as Wr, fromCanvasReference as Wt, canvasPreparationOutputSchema as X, screenTextCommentTargetSchema as Xn, canvasRecordedBoxNoteFor as Xr, commandName as Xt, canvasDuplicateInputSchema as Y, screenElementsCommentTargetSchema as Yn, canvasBoxSourceOf as Yr, cliPathOf as Yt, canvasWriteReceiptSchema as Z, startCommentInputSchema as Zn, canvasAuthoredLayoutValueOf as Zr, currentNodeIdStep as Zt, CANVAS_UPDATE_HTML_INPUT_EXAMPLE as _, CANVAS_BLEND_MODES as _i, startRecordingOutputSchema as _n, createCanvasPreparationOutputSchema as _r, canvasInsertHtmlCapabilityInputSchema as _t, createRouterShapeAdapter as a, canvasCssValue as ai, SKILL_NAMES as an, canvasCaptureSchema as ar, canvasRenderScopedToolInputSchema as at, ProcessExitError as b, canvasSchema as bi, createPrototypeArtifactOutputSchema as bn, GROUP_KIND as br, canvasMakeEditableInputSchema as bt, toKebabCase as c, reserveCanvasAssetOutputSchema as ci, CliError as cn, canvasRecordingPropsSchema as cr, canvasRemoveCapabilityInputSchema as ct, createMcpCapabilityDiscoveryAdapter as d, signedDownloadSchema as di, appErrorSchema as dn, canvasReferencePageOf as dr, canvasCreateToolOutputSchema as dt, canvasCssPixelValue as ei, inputName as en, canvasCssTypographyOwners as er, canvasAssetImportOutputSchema as et, toExitCode as f, canvasRichTextOf as fi, completeScreenOutputSchema as fn, resolveCanvasReference as fr, canvasFindCursorSchema as ft, toRemoteError as g, canvasAdditionalStyleSchema as gi, getRecordingOutputSchema as gn, agentClientMetadata as gr, listedCanvasesAnswerSchema as gt, toPublishedExitTable as h, CANVAS_RICH_TEXT_STYLE_PROPERTIES as hi, completeRecordingOutputSchema as hn, AGENT_CLIENT_HEADER as hr, createdCanvasAnswerSchema as ht, createLazyCapabilityCatalogAdapter as i, canvasCssTokens as ii, SKILL_JOBS as in, CAPTURE_LANDING_CONVERTING as ir, canvasRenderScopedInputSchema as it, transcriptReadCapabilityInputSchema as j, createOrganisationOutputSchema as jn, mapCanvasFontSources as jr, decodeCanvasExchangeToken as jt, prototypePublishCapabilityInputSchema as k, cliAuthConfigurationSchema as kn, canvasLayoutWithoutCssProperties as kr, canvasExchangeDigest as kt, toPresentedCapabilities as l, canvasFontAssetIdentityFromPath as li, isFormatRefusalError as ln, captureLandingSchema as lr, canvasRemoveInputSchema as lt, toMcpFailurePayload as m, hasCanvasRichTextPaints as mi, appendRecordingChunkOutputSchema as mn, canvasAgentActivityPhaseSchema as mr, canvasFindOutputSchema as mt, withCommandName as n, canvasLayoutPositionOf as ni, onSurface as nn, canvasTextPropsWithContent as nr, canvasRenderBatchResultSchema as nt, CAPTURE_PAGE_CALLS as o, canvasAssetUploadOutputSchema as oi, skillTextsFor as on, canvasConversionMetadataSchema as or, canvasRenderRequestSchema as ot, toFailurePayload as p, canvasRichTextValueOf as pi, createScreenOutputSchema as pn, beginCanvasActivityOutputSchema as pr, canvasFindInputSchema as pt, canvasArrangeInputSchema as q, screenAreaCommentTargetSchema as qn, canvasSceneDocumentSchema as qr, readStoredCanvasScene as qt, toCanvasAuthoringResult as r, canvasLayoutPriorityDeclarations as ri, MCP_TOOL_BY_CAPABILITY as rn, canvasTextRunsOf as rr, canvasRenderPendingSchema as rt, toCapabilityDefinition as s, reserveCanvasAssetInputSchema as si, PartialBatchError as sn, canvasPrototypePropsSchema as sr, canvasRenderFileSchema as st, withCommandInFailure as t, canvasLayoutMainAxisOf as ti, layerListName as tn, canvasTextChangeBetween as tr, canvasRenderBatchRequestSchema as tt, toSharedCapabilities as u, canvasImageAssetIdentityFromPath as ui, transcriptOutputSchema as un, DEFAULT_CANVAS_REFERENCE_PAGE_ID as ur, canvasCreateToolInputSchema as ut, CAPABILITY_UUID_EXAMPLE as v, canvasBlendModeSchema as vi, PROTOTYPE_ARTIFACT_MANIFEST_PATH as vn, getCanvasPreparationOutputSchema as vr, canvasInsertHtmlInputSchema as vt, canvasApplyCapabilityInputSchema as w, prototypeArtifactManifestSchema as wn, SCREEN_KIND as wr, inputProblemFields as wt, OPTION_DESCRIPTIONS as x, foldPrototypeArtifactPath as xn, IMAGE_KIND as xr, canvasEditCapabilityInputSchema as xt, createCapabilityPolicyAdapter as y, canvasPaintSchema as yi, attachPrototypeArtifactOutputSchema as yn, FRAME_KIND as yr, canvasMakeEditableCapabilityInputSchema as yt, canvasConversionStatusSchema as z, commentThreadSchema as zn, canvasRenderStateSchema as zr, canvasTranscriptCursorSchema as zt };
|