@capybara-hq/plugin-sdk 0.1.0-rc.3 → 0.1.0-rc.31
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/agent-docs/agent-templates.md +15 -3
- package/agent-docs/concepts.md +5 -0
- package/agent-docs/connector-templates.md +2 -1
- package/agent-docs/extension-points/channel.md +1 -1
- package/agent-docs/extension-points/config-source.md +1 -1
- package/agent-docs/extension-points/connector.md +1 -1
- package/agent-docs/extension-points/context.md +15 -0
- package/agent-docs/extension-points/counter.md +1 -1
- package/agent-docs/extension-points/directory.md +1 -1
- package/agent-docs/extension-points/file-preview.md +1 -1
- package/agent-docs/extension-points/identity-source.md +1 -1
- package/agent-docs/extension-points/model-provider.md +4 -2
- package/agent-docs/extension-points/object-store.md +3 -1
- package/agent-docs/extension-points/sandbox.md +3 -3
- package/agent-docs/extension-points/secret-store.md +1 -1
- package/agent-docs/extension-points/web-fetch.md +1 -1
- package/agent-docs/extension-points/web-search.md +1 -1
- package/agent-docs/extensions.md +29 -4
- package/agent-docs/plugin-format.md +43 -3
- package/agent-docs/setup.md +46 -0
- package/agent-docs/skills.md +1 -1
- package/agent-docs/tool-naming.md +1 -1
- package/dist/agent-template.d.ts +15 -6
- package/dist/agent-template.js +32 -13
- package/dist/bootstrap.d.ts +15 -1
- package/dist/bootstrap.js +17 -1
- package/dist/cards.d.ts +56 -13
- package/dist/cards.js +90 -20
- package/dist/channel.d.ts +111 -48
- package/dist/channel.js +10 -5
- package/dist/client-css.d.ts +36 -0
- package/dist/client-css.js +326 -0
- package/dist/client-section.d.ts +35 -0
- package/dist/client-section.js +133 -0
- package/dist/config-ui.d.ts +22 -0
- package/dist/config-ui.js +64 -4
- package/dist/connector-auth.d.ts +7 -2
- package/dist/connector-auth.js +29 -8
- package/dist/connector.d.ts +74 -32
- package/dist/context.d.ts +40 -0
- package/dist/context.js +2 -0
- package/dist/ctx.d.ts +135 -26
- package/dist/define-extension.d.ts +26 -12
- package/dist/define-extension.js +11 -4
- package/dist/device-protocol-v3.d.ts +117 -0
- package/dist/device-protocol-v3.js +409 -0
- package/dist/device-protocol.d.ts +330 -0
- package/dist/device-protocol.js +567 -0
- package/dist/extension-point.d.ts +2 -0
- package/dist/extension-point.js +5 -2
- package/dist/file-preview.d.ts +1 -1
- package/dist/git-hosts.d.ts +44 -0
- package/dist/git-hosts.js +81 -0
- package/dist/hooks.d.ts +111 -21
- package/dist/hooks.js +5 -0
- package/dist/http-access.d.ts +52 -0
- package/dist/http-access.js +12 -0
- package/dist/identity.d.ts +22 -9
- package/dist/index.d.ts +23 -1
- package/dist/index.js +24 -1
- package/dist/marketplace.d.ts +26 -0
- package/dist/marketplace.js +43 -1
- package/dist/model-params.d.ts +41 -22
- package/dist/model-params.js +28 -15
- package/dist/model.d.ts +180 -71
- package/dist/model.js +71 -19
- package/dist/net.d.ts +52 -0
- package/dist/net.js +34 -0
- package/dist/permissions.d.ts +42 -20
- package/dist/permissions.js +97 -40
- package/dist/plugin-manifest.d.ts +45 -5
- package/dist/plugin-manifest.js +169 -6
- package/dist/plugin-package.d.ts +82 -38
- package/dist/plugin-package.js +61 -29
- package/dist/sandbox-linux-runtime-source.d.ts +1 -0
- package/dist/sandbox-linux-runtime-source.js +1886 -0
- package/dist/sandbox-native-runtime-source.d.ts +8 -0
- package/dist/sandbox-native-runtime-source.js +325 -0
- package/dist/sandbox-operation.d.ts +248 -0
- package/dist/sandbox-operation.js +245 -0
- package/dist/sandbox-runtime-source.d.ts +19 -0
- package/dist/sandbox-runtime-source.js +28 -0
- package/dist/sandbox-write-denies.d.ts +60 -0
- package/dist/sandbox-write-denies.js +630 -0
- package/dist/sandbox.d.ts +201 -16
- package/dist/sandbox.js +89 -14
- package/dist/secret.d.ts +4 -1
- package/dist/secret.js +4 -1
- package/dist/setup-check.d.ts +115 -0
- package/dist/setup-check.js +142 -0
- package/dist/setup-guide-parse.d.ts +121 -0
- package/dist/setup-guide-parse.js +350 -0
- package/dist/setup-guide-render.d.ts +45 -0
- package/dist/setup-guide-render.js +351 -0
- package/dist/setup-guide.d.ts +94 -0
- package/dist/setup-guide.js +336 -0
- package/dist/skill-invocation.d.ts +4 -3
- package/dist/skill-invocation.js +5 -4
- package/dist/skill.d.ts +34 -21
- package/dist/skill.js +48 -31
- package/dist/storage.d.ts +52 -25
- package/dist/theme-assets.d.ts +39 -0
- package/dist/theme-assets.js +449 -0
- package/dist/theme-readability.d.ts +37 -0
- package/dist/theme-readability.js +145 -0
- package/dist/theme-tokens.generated.d.ts +279 -0
- package/dist/theme-tokens.generated.js +174 -0
- package/dist/theme.d.ts +152 -0
- package/dist/theme.js +392 -0
- package/dist/tool.d.ts +69 -26
- package/dist/tool.js +29 -9
- package/dist/ui-parts.d.ts +23 -0
- package/dist/ui-parts.js +337 -0
- package/dist/ui-resolve.d.ts +35 -0
- package/dist/ui-resolve.js +42 -0
- package/dist/ui-slots.d.ts +53 -0
- package/dist/ui-slots.js +238 -0
- package/dist/ui.d.ts +191 -79
- package/dist/ui.js +101 -27
- package/dist/url.d.ts +4 -1
- package/dist/url.js +4 -1
- package/package.json +7 -1
- package/schemas/bootstrap.v1.schema.json +6 -0
- package/schemas/connector-template.v1.schema.json +35 -0
- package/schemas/marketplace.v1.schema.json +14 -0
- package/schemas/plugin.v1.schema.json +115 -3
- package/schemas/theme.v1.schema.json +225 -0
package/dist/tool.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ParamSchema } from "./model-params.js";
|
|
2
|
-
/**
|
|
2
|
+
/** Tool annotations (hints aligned with MCP, used to derive the default policy). */
|
|
3
3
|
export interface ToolAnnotations {
|
|
4
4
|
readOnlyHint?: boolean;
|
|
5
5
|
destructiveHint?: boolean;
|
|
@@ -7,17 +7,26 @@ export interface ToolAnnotations {
|
|
|
7
7
|
openWorldHint?: boolean;
|
|
8
8
|
requiresUserInteraction?: boolean;
|
|
9
9
|
}
|
|
10
|
+
/** Where a conversation comes from; a tool may limit itself to some of these. */
|
|
11
|
+
export declare const CONVERSATION_SOURCES: readonly ["web", "channel_dm", "channel_group", "subagent"];
|
|
12
|
+
/** A conversation source (see {@link CONVERSATION_SOURCES}). */
|
|
13
|
+
export type ConversationSource = (typeof CONVERSATION_SOURCES)[number];
|
|
10
14
|
export interface ToolSpec {
|
|
11
15
|
name: string;
|
|
12
16
|
description: string;
|
|
13
17
|
inputSchema: Record<string, unknown>;
|
|
14
18
|
annotations?: ToolAnnotations;
|
|
15
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Only plugin / builtin tools may declare it; when omitted it is derived from the annotations.
|
|
21
|
+
*/
|
|
16
22
|
defaultPolicy?: "allow" | "ask";
|
|
17
23
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
24
|
+
* Connector tools only: the connector's own opaque data (e.g. OpenAPI's method, path template,
|
|
25
|
+
* parameter locations, server address), JSON-serializable.
|
|
26
|
+
* The kernel stores it with the definition in the snapshot and counts it in the fingerprint (a
|
|
27
|
+
* change means drift and needs review), and hands it back unchanged via `ctx.spec` of `callTool`
|
|
28
|
+
* on a call;
|
|
29
|
+
* never sent to the model.
|
|
21
30
|
*/
|
|
22
31
|
connectorData?: Record<string, unknown>;
|
|
23
32
|
/**
|
|
@@ -33,6 +42,11 @@ export interface ToolSpec {
|
|
|
33
42
|
* model and not part of the definition fingerprint.
|
|
34
43
|
*/
|
|
35
44
|
keyArgs?: string[];
|
|
45
|
+
/**
|
|
46
|
+
* The conversation sources this tool is offered in; absent = every source. A non-empty list of
|
|
47
|
+
* {@link CONVERSATION_SOURCES}.
|
|
48
|
+
*/
|
|
49
|
+
sources?: ConversationSource[];
|
|
36
50
|
}
|
|
37
51
|
/** Longest {@link ToolSpec.title}, in code points. */
|
|
38
52
|
export declare const TOOL_TITLE_MAX = 80;
|
|
@@ -58,7 +72,10 @@ export type ToolContent = {
|
|
|
58
72
|
name?: string;
|
|
59
73
|
mimeType?: string;
|
|
60
74
|
};
|
|
61
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* A one-sentence description of a tool call, shown in the UI (Chinese and English each ≤ 200
|
|
77
|
+
* characters); does not enter the model context.
|
|
78
|
+
*/
|
|
62
79
|
export interface ToolDisplay {
|
|
63
80
|
summary: {
|
|
64
81
|
zh: string;
|
|
@@ -68,33 +85,44 @@ export interface ToolDisplay {
|
|
|
68
85
|
export interface ToolResult {
|
|
69
86
|
content: ToolContent[];
|
|
70
87
|
isError?: boolean;
|
|
71
|
-
/**
|
|
88
|
+
/** Optional: show this description in the conversation stream in place of the raw input JSON. */
|
|
72
89
|
display?: ToolDisplay;
|
|
73
90
|
/**
|
|
74
91
|
* Optional: an inline card under this call in the conversation: `view` is a ui contribution of
|
|
75
|
-
* the same extension
|
|
76
|
-
* (recorded on the `tool_result` event, never in the model's
|
|
77
|
-
* with a warning and the result is kept.
|
|
92
|
+
* the same extension in the `conversation.tool-result.card` slot, rendered with
|
|
93
|
+
* `card: { callId, key }`. Display only (recorded on the `tool_result` event, never in the model's
|
|
94
|
+
* context); an unknown view is dropped with a warning and the result is kept.
|
|
78
95
|
*/
|
|
79
96
|
card?: {
|
|
80
97
|
view: string;
|
|
81
98
|
key?: string;
|
|
82
99
|
};
|
|
83
100
|
}
|
|
84
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Validates a {@link ToolDisplay} and returns the list of problems (empty = valid); length is
|
|
103
|
+
* counted in Unicode code points.
|
|
104
|
+
*/
|
|
85
105
|
export declare function validateToolDisplay(d: unknown): string[];
|
|
86
106
|
/** Text shown to people: bilingual (`zh` / `en`) or a single string shown as is. */
|
|
87
107
|
export type LocalizedText = {
|
|
88
108
|
zh: string;
|
|
89
109
|
en: string;
|
|
90
110
|
} | string;
|
|
91
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Interactive form: field schemas use only the ParamSchema subset of M2; enum fields may set
|
|
113
|
+
* multiSelect and allowOther.
|
|
114
|
+
*/
|
|
92
115
|
export interface InputForm {
|
|
93
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* A plugin may give both languages; builtin kernel tools give English (model-generated questions
|
|
118
|
+
* are displayed as is).
|
|
119
|
+
*/
|
|
94
120
|
title: LocalizedText;
|
|
95
121
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
122
|
+
* Optional: an external page the user must open in a browser (e.g. an MCP URL-mode elicitation:
|
|
123
|
+
* go to the other party's page to authorize / pay / enter sensitive information).
|
|
124
|
+
* The UI shows it as a link (the full address visible); only absolute http(s) addresses, ≤ 2000
|
|
125
|
+
* characters, are accepted.
|
|
98
126
|
*/
|
|
99
127
|
url?: string;
|
|
100
128
|
fields: {
|
|
@@ -108,8 +136,9 @@ export interface InputForm {
|
|
|
108
136
|
}[];
|
|
109
137
|
}
|
|
110
138
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
139
|
+
* The tool needs user input: the kernel pauses the run and renders a form; after the user submits,
|
|
140
|
+
* the tool is called again with the same input,
|
|
141
|
+
* and state and answer are brought back in ctx.resume. state ≤ 16 KB, JSON-serializable.
|
|
113
142
|
*/
|
|
114
143
|
export interface InputRequired {
|
|
115
144
|
kind: "input_required";
|
|
@@ -124,7 +153,7 @@ export interface ToolCallContext {
|
|
|
124
153
|
conversationId: string;
|
|
125
154
|
callId: string;
|
|
126
155
|
signal: AbortSignal;
|
|
127
|
-
/** null =
|
|
156
|
+
/** null = the user cancelled or it timed out. */
|
|
128
157
|
resume?: {
|
|
129
158
|
state: unknown;
|
|
130
159
|
answer: FormAnswer | null;
|
|
@@ -137,26 +166,40 @@ export interface ToolCallContext {
|
|
|
137
166
|
* always passes it.
|
|
138
167
|
*/
|
|
139
168
|
config?: unknown;
|
|
169
|
+
/** Where the conversation comes from. The kernel always passes it. */
|
|
170
|
+
source?: ConversationSource;
|
|
171
|
+
/** The conversation's owner (`conversations.account_id`). The kernel always passes it; `accountId` stays the run's trigger account. */
|
|
172
|
+
ownerAccountId?: string;
|
|
173
|
+
/** The trigger account's role in the org. The kernel always passes it. */
|
|
174
|
+
role?: "owner" | "admin" | "member" | "guest";
|
|
140
175
|
}
|
|
141
176
|
export type ToolHandler = (input: unknown, ctx: ToolCallContext) => Promise<ToolResult | InputRequired>;
|
|
142
177
|
/**
|
|
143
|
-
*
|
|
144
|
-
* - `error
|
|
145
|
-
*
|
|
178
|
+
* Tool error categories:
|
|
179
|
+
* - `error` (default): the remote is available but this call failed (bad parameters, business
|
|
180
|
+
* error, auth failure, etc.), not counted toward the connector circuit breaker;
|
|
181
|
+
* - `unavailable`: the remote is unavailable (connection / transport error, timeout, HTTP 5xx),
|
|
182
|
+
* counted toward the connector circuit breaker (connectors use it to tell the kernel).
|
|
146
183
|
*/
|
|
147
184
|
export type ToolErrorKind = "error" | "unavailable";
|
|
148
|
-
/**
|
|
185
|
+
/** A tool execution failure: message is for the model and must be in English and actionable. */
|
|
149
186
|
export declare class ToolError extends Error {
|
|
150
187
|
readonly kind: ToolErrorKind;
|
|
151
188
|
constructor(message: string, opts?: {
|
|
152
189
|
kind?: ToolErrorKind;
|
|
153
190
|
});
|
|
154
191
|
}
|
|
155
|
-
/**
|
|
192
|
+
/** Plugin tool name rule. */
|
|
156
193
|
export declare const EXTENSION_TOOL_NAME: RegExp;
|
|
157
|
-
/**
|
|
194
|
+
/**
|
|
195
|
+
* Validates the tool declarations a plugin registers and returns the list of problems (empty =
|
|
196
|
+
* valid).
|
|
197
|
+
*/
|
|
158
198
|
export declare function validateToolSpec(spec: ToolSpec): string[];
|
|
159
|
-
/**
|
|
199
|
+
/** Validates an interactive form declaration and returns the list of problems (empty = valid). */
|
|
160
200
|
export declare function validateInputForm(form: InputForm): string[];
|
|
161
|
-
/**
|
|
201
|
+
/**
|
|
202
|
+
* Validates whether the answer a user submitted conforms to the form and returns the list of
|
|
203
|
+
* problems (empty = valid).
|
|
204
|
+
*/
|
|
162
205
|
export declare function validateAnswer(form: InputForm, answer: FormAnswer): string[];
|
package/dist/tool.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { checkParamValue } from "./model-params.js";
|
|
2
2
|
import { isHttpUrl } from "./url.js";
|
|
3
|
+
/** Where a conversation comes from; a tool may limit itself to some of these. */
|
|
4
|
+
export const CONVERSATION_SOURCES = ["web", "channel_dm", "channel_group", "subagent"];
|
|
3
5
|
/** Longest {@link ToolSpec.title}, in code points. */
|
|
4
6
|
export const TOOL_TITLE_MAX = 80;
|
|
5
7
|
/** Most {@link ToolSpec.keyArgs}. */
|
|
@@ -52,7 +54,10 @@ export function validateToolPresentation(spec) {
|
|
|
52
54
|
return out;
|
|
53
55
|
}
|
|
54
56
|
const DISPLAY_MAX = 200;
|
|
55
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Validates a {@link ToolDisplay} and returns the list of problems (empty = valid); length is
|
|
59
|
+
* counted in Unicode code points.
|
|
60
|
+
*/
|
|
56
61
|
export function validateToolDisplay(d) {
|
|
57
62
|
if (typeof d !== "object" || d === null || Array.isArray(d))
|
|
58
63
|
return ["display must be an object"];
|
|
@@ -67,7 +72,7 @@ export function validateToolDisplay(d) {
|
|
|
67
72
|
}
|
|
68
73
|
return out;
|
|
69
74
|
}
|
|
70
|
-
/**
|
|
75
|
+
/** A tool execution failure: message is for the model and must be in English and actionable. */
|
|
71
76
|
export class ToolError extends Error {
|
|
72
77
|
kind;
|
|
73
78
|
constructor(message, opts) {
|
|
@@ -76,9 +81,12 @@ export class ToolError extends Error {
|
|
|
76
81
|
this.kind = opts?.kind ?? "error";
|
|
77
82
|
}
|
|
78
83
|
}
|
|
79
|
-
/**
|
|
84
|
+
/** Plugin tool name rule. */
|
|
80
85
|
export const EXTENSION_TOOL_NAME = /^[a-zA-Z0-9_-]{1,40}$/;
|
|
81
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Validates the tool declarations a plugin registers and returns the list of problems (empty =
|
|
88
|
+
* valid).
|
|
89
|
+
*/
|
|
82
90
|
export function validateToolSpec(spec) {
|
|
83
91
|
const out = [];
|
|
84
92
|
if (typeof spec?.name !== "string" || !EXTENSION_TOOL_NAME.test(spec.name))
|
|
@@ -93,6 +101,12 @@ export function validateToolSpec(spec) {
|
|
|
93
101
|
out.push('defaultPolicy must be "allow" or "ask"');
|
|
94
102
|
if (typeof spec?.inputSchema === "object" && spec.inputSchema !== null)
|
|
95
103
|
out.push(...validateToolPresentation(spec));
|
|
104
|
+
const sources = spec?.sources;
|
|
105
|
+
if (sources !== undefined &&
|
|
106
|
+
(!Array.isArray(sources) ||
|
|
107
|
+
sources.length === 0 ||
|
|
108
|
+
sources.some((s) => !CONVERSATION_SOURCES.includes(s))))
|
|
109
|
+
out.push(`sources must be a non-empty list of ${CONVERSATION_SOURCES.join(", ")}`);
|
|
96
110
|
return out;
|
|
97
111
|
}
|
|
98
112
|
const SCHEMA_KEYS = {
|
|
@@ -101,7 +115,7 @@ const SCHEMA_KEYS = {
|
|
|
101
115
|
number: ["type", "minimum", "maximum"],
|
|
102
116
|
integer: ["type", "minimum", "maximum"],
|
|
103
117
|
};
|
|
104
|
-
/**
|
|
118
|
+
/** Checks whether a schema falls within the ParamSchema subset and returns the list of problems. */
|
|
105
119
|
function schemaProblems(schema) {
|
|
106
120
|
if (typeof schema !== "object" || schema === null || Array.isArray(schema))
|
|
107
121
|
return ["schema must be an object"];
|
|
@@ -130,7 +144,7 @@ function schemaProblems(schema) {
|
|
|
130
144
|
return out;
|
|
131
145
|
}
|
|
132
146
|
const isEnum = (s) => s.type === "string" && "enum" in s;
|
|
133
|
-
/**
|
|
147
|
+
/** Validates an interactive form declaration and returns the list of problems (empty = valid). */
|
|
134
148
|
export function validateInputForm(form) {
|
|
135
149
|
const out = [];
|
|
136
150
|
if (!form || !Array.isArray(form.fields))
|
|
@@ -159,7 +173,10 @@ export function validateInputForm(form) {
|
|
|
159
173
|
}
|
|
160
174
|
return out;
|
|
161
175
|
}
|
|
162
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Validates whether the answer a user submitted conforms to the form and returns the list of
|
|
178
|
+
* problems (empty = valid).
|
|
179
|
+
*/
|
|
163
180
|
export function validateAnswer(form, answer) {
|
|
164
181
|
const out = [];
|
|
165
182
|
const byKey = new Map(form.fields.map((f) => [f.key, f]));
|
|
@@ -168,7 +185,8 @@ export function validateAnswer(form, answer) {
|
|
|
168
185
|
out.push(`unknown field ${JSON.stringify(k)}`);
|
|
169
186
|
for (const f of form.fields) {
|
|
170
187
|
const at = `field ${JSON.stringify(f.key)}`;
|
|
171
|
-
//
|
|
188
|
+
// Look only at the answer's own keys: inherited properties such as `toString` / `constructor`
|
|
189
|
+
// do not count as answered
|
|
172
190
|
const v = Object.hasOwn(answer, f.key) ? answer[f.key] : undefined;
|
|
173
191
|
if (v === undefined) {
|
|
174
192
|
if (f.required)
|
|
@@ -209,7 +227,9 @@ export function validateAnswer(form, answer) {
|
|
|
209
227
|
}
|
|
210
228
|
return out;
|
|
211
229
|
}
|
|
212
|
-
/**
|
|
230
|
+
/**
|
|
231
|
+
* An allowOther enum field accepts any non-empty text; the rest are validated against the schema.
|
|
232
|
+
*/
|
|
213
233
|
function otherOrValue(f, v) {
|
|
214
234
|
if (f.allowOther && isEnum(f.schema)) {
|
|
215
235
|
return typeof v === "string" && v !== "" ? undefined : "other text must be a non-empty string";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The ARIA / data states a part promises (client extensions spec §7.1). */
|
|
2
|
+
export type UiPartState = "aria-current" | "aria-selected" | "aria-expanded" | "aria-busy" | "aria-checked" | "aria-pressed" | "disabled";
|
|
3
|
+
/** Every part name of the catalog, in catalog order. */
|
|
4
|
+
export declare const UI_PART_NAMES: readonly ["shell", "sidebar", "sidebar.brand", "sidebar.item", "title-bar", "page-header", "thread", "message.user", "message.user.bubble", "message.assistant", "tool-row", "composer", "properties-panel", "section", "right-panel", "status-bar", "button", "button.primary", "card", "input", "dialog", "code-block", "menu", "segmented", "stat-card", "switch", "switch.knob", "org-avatar", "agent-chip"];
|
|
5
|
+
export type UiPartName = (typeof UI_PART_NAMES)[number];
|
|
6
|
+
/** One built-in element plugin CSS may select with `[data-cap-part~="<name>"]`. */
|
|
7
|
+
export interface UiPartSpec {
|
|
8
|
+
name: UiPartName;
|
|
9
|
+
/** Bumped when the part is renamed, removed or drops a promised state. */
|
|
10
|
+
version: number;
|
|
11
|
+
/**
|
|
12
|
+
* The files (relative to the repository root) that render the element: one concept can be drawn
|
|
13
|
+
* by several components (a sidebar row, a card). `check:ui-parts` pins each literal to one of them.
|
|
14
|
+
*/
|
|
15
|
+
owner: readonly string[];
|
|
16
|
+
states: readonly UiPartState[];
|
|
17
|
+
description: {
|
|
18
|
+
en: string;
|
|
19
|
+
zh: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare const UI_PARTS: readonly UiPartSpec[];
|
|
23
|
+
export declare function uiPart(name: string): UiPartSpec | undefined;
|
package/dist/ui-parts.js
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/** Every part name of the catalog, in catalog order. */
|
|
2
|
+
export const UI_PART_NAMES = [
|
|
3
|
+
"shell",
|
|
4
|
+
"sidebar",
|
|
5
|
+
"sidebar.brand",
|
|
6
|
+
"sidebar.item",
|
|
7
|
+
"title-bar",
|
|
8
|
+
"page-header",
|
|
9
|
+
"thread",
|
|
10
|
+
"message.user",
|
|
11
|
+
"message.user.bubble",
|
|
12
|
+
"message.assistant",
|
|
13
|
+
"tool-row",
|
|
14
|
+
"composer",
|
|
15
|
+
"properties-panel",
|
|
16
|
+
"section",
|
|
17
|
+
"right-panel",
|
|
18
|
+
"status-bar",
|
|
19
|
+
"button",
|
|
20
|
+
"button.primary",
|
|
21
|
+
"card",
|
|
22
|
+
"input",
|
|
23
|
+
"dialog",
|
|
24
|
+
"code-block",
|
|
25
|
+
"menu",
|
|
26
|
+
"segmented",
|
|
27
|
+
"stat-card",
|
|
28
|
+
"switch",
|
|
29
|
+
"switch.knob",
|
|
30
|
+
"org-avatar",
|
|
31
|
+
"agent-chip",
|
|
32
|
+
];
|
|
33
|
+
export const UI_PARTS = [
|
|
34
|
+
{
|
|
35
|
+
name: "shell",
|
|
36
|
+
version: 1,
|
|
37
|
+
owner: ["packages/design/src/shell/app-shell.tsx"],
|
|
38
|
+
states: [],
|
|
39
|
+
description: {
|
|
40
|
+
en: "The App Shell root.",
|
|
41
|
+
zh: "应用外壳的根节点。",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "sidebar",
|
|
46
|
+
version: 1,
|
|
47
|
+
owner: ["packages/design/src/shell/sidebar.tsx"],
|
|
48
|
+
states: [],
|
|
49
|
+
description: {
|
|
50
|
+
en: "The left sidebar.",
|
|
51
|
+
zh: "左侧边栏。",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "sidebar.brand",
|
|
56
|
+
version: 1,
|
|
57
|
+
owner: ["packages/design/src/shell/sidebar.tsx"],
|
|
58
|
+
states: [],
|
|
59
|
+
description: {
|
|
60
|
+
en: "The brand row of the sidebar.",
|
|
61
|
+
zh: "侧边栏的品牌行。",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "sidebar.item",
|
|
66
|
+
version: 1,
|
|
67
|
+
owner: [
|
|
68
|
+
"packages/design/src/shell/sidebar.tsx",
|
|
69
|
+
"packages/design/src/shell/sidebar-conversations.tsx",
|
|
70
|
+
],
|
|
71
|
+
states: ["aria-current"],
|
|
72
|
+
description: {
|
|
73
|
+
en: "A navigation or conversation row of the sidebar.",
|
|
74
|
+
zh: "侧边栏的导航行或对话行。",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "title-bar",
|
|
79
|
+
version: 1,
|
|
80
|
+
owner: ["packages/design/src/conversation/title-bar.tsx"],
|
|
81
|
+
states: [],
|
|
82
|
+
description: {
|
|
83
|
+
en: "The conversation title bar.",
|
|
84
|
+
zh: "对话标题栏。",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "page-header",
|
|
89
|
+
version: 1,
|
|
90
|
+
owner: ["packages/design/src/shell/page-header.tsx"],
|
|
91
|
+
states: [],
|
|
92
|
+
description: {
|
|
93
|
+
en: "The header of a page.",
|
|
94
|
+
zh: "页面头部。",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "thread",
|
|
99
|
+
version: 1,
|
|
100
|
+
owner: ["packages/design/src/templates/conversation-page.tsx"],
|
|
101
|
+
states: ["aria-busy"],
|
|
102
|
+
description: {
|
|
103
|
+
en: "The conversation stream.",
|
|
104
|
+
zh: "对话消息流。",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "message.user",
|
|
109
|
+
version: 1,
|
|
110
|
+
owner: ["packages/design/src/conversation/bubble.tsx"],
|
|
111
|
+
states: [],
|
|
112
|
+
description: {
|
|
113
|
+
en: "A person's message.",
|
|
114
|
+
zh: "用户发出的消息。",
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "message.user.bubble",
|
|
119
|
+
version: 1,
|
|
120
|
+
owner: ["packages/design/src/conversation/bubble.tsx"],
|
|
121
|
+
states: [],
|
|
122
|
+
description: {
|
|
123
|
+
en: "The bubble of a person's message (inside the full-width `message.user` row).",
|
|
124
|
+
zh: "用户消息的气泡本身(在占满宽度的 message.user 行之内)。",
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "message.assistant",
|
|
129
|
+
version: 1,
|
|
130
|
+
owner: ["apps/web/src/components/conversation/Thread.tsx"],
|
|
131
|
+
states: ["aria-busy"],
|
|
132
|
+
description: {
|
|
133
|
+
en: "An assistant turn; `aria-busy` while its text is still streaming (the live reply).",
|
|
134
|
+
zh: "智能体的一轮回复;正在流式输出时带 aria-busy(正在生成的回复)。",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "tool-row",
|
|
139
|
+
version: 1,
|
|
140
|
+
owner: ["packages/design/src/conversation/tool-row.tsx"],
|
|
141
|
+
states: ["aria-expanded"],
|
|
142
|
+
description: {
|
|
143
|
+
en: "A tool call line.",
|
|
144
|
+
zh: "工具调用行。",
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "composer",
|
|
149
|
+
version: 1,
|
|
150
|
+
owner: ["packages/design/src/conversation/composer.tsx"],
|
|
151
|
+
states: ["aria-busy"],
|
|
152
|
+
description: {
|
|
153
|
+
en: "The composer box.",
|
|
154
|
+
zh: "输入框。",
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "properties-panel",
|
|
159
|
+
version: 1,
|
|
160
|
+
owner: ["packages/design/src/conversation/panels.tsx"],
|
|
161
|
+
states: [],
|
|
162
|
+
description: {
|
|
163
|
+
en: "The conversation properties panel.",
|
|
164
|
+
zh: "对话属性面板。",
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "section",
|
|
169
|
+
version: 1,
|
|
170
|
+
owner: [
|
|
171
|
+
"packages/design/src/conversation/panels.tsx",
|
|
172
|
+
"packages/design/src/templates/form-page.tsx",
|
|
173
|
+
],
|
|
174
|
+
states: [],
|
|
175
|
+
description: {
|
|
176
|
+
en: "A property section or form section.",
|
|
177
|
+
zh: "属性分区或表单分区。",
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "right-panel",
|
|
182
|
+
version: 1,
|
|
183
|
+
owner: ["packages/design/src/conversation/panels.tsx"],
|
|
184
|
+
states: [],
|
|
185
|
+
description: {
|
|
186
|
+
en: "A full-height right pane.",
|
|
187
|
+
zh: "占满高度的右侧窗格。",
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "status-bar",
|
|
192
|
+
version: 1,
|
|
193
|
+
owner: ["packages/design/src/shell/status-bar.tsx"],
|
|
194
|
+
states: [],
|
|
195
|
+
description: {
|
|
196
|
+
en: "The status bar.",
|
|
197
|
+
zh: "状态栏。",
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "button",
|
|
202
|
+
version: 1,
|
|
203
|
+
owner: ["packages/design/src/controls/button.tsx"],
|
|
204
|
+
states: ["disabled"],
|
|
205
|
+
description: {
|
|
206
|
+
en: "Every button.",
|
|
207
|
+
zh: "所有按钮。",
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "button.primary",
|
|
212
|
+
version: 1,
|
|
213
|
+
owner: ["packages/design/src/controls/button.tsx"],
|
|
214
|
+
states: ["disabled"],
|
|
215
|
+
description: {
|
|
216
|
+
en: "A primary button (carried together with `button`).",
|
|
217
|
+
zh: "主按钮(与 button 同时出现)。",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "card",
|
|
222
|
+
version: 1,
|
|
223
|
+
owner: [
|
|
224
|
+
"packages/design/src/layout/index.tsx",
|
|
225
|
+
"packages/design/src/conversation/panels.tsx",
|
|
226
|
+
"packages/design/src/display/card-grid.tsx",
|
|
227
|
+
],
|
|
228
|
+
states: [],
|
|
229
|
+
description: {
|
|
230
|
+
en: "A card, inline card or object card.",
|
|
231
|
+
zh: "卡片、行内卡片或对象卡片。",
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: "input",
|
|
236
|
+
version: 1,
|
|
237
|
+
owner: ["packages/design/src/controls/inputs.tsx", "packages/design/src/controls/select.tsx"],
|
|
238
|
+
states: ["disabled"],
|
|
239
|
+
description: {
|
|
240
|
+
en: "Text inputs, textareas and selects.",
|
|
241
|
+
zh: "文本框、多行文本框和下拉选择。",
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: "dialog",
|
|
246
|
+
version: 1,
|
|
247
|
+
owner: ["packages/design/src/overlays/dialog.tsx", "packages/design/src/overlays/sheet.tsx"],
|
|
248
|
+
states: [],
|
|
249
|
+
description: {
|
|
250
|
+
en: "A dialog or sheet.",
|
|
251
|
+
zh: "对话框或抽屉。",
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: "code-block",
|
|
256
|
+
version: 1,
|
|
257
|
+
owner: ["packages/design/src/display/chat.tsx"],
|
|
258
|
+
states: [],
|
|
259
|
+
description: {
|
|
260
|
+
en: "A code block (Markdown code, setup guides, diffs).",
|
|
261
|
+
zh: "代码块(Markdown 代码、设置指引、差异)。",
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: "menu",
|
|
266
|
+
version: 1,
|
|
267
|
+
owner: ["packages/design/src/overlays/menus.tsx", "packages/design/src/conversation/menu.tsx"],
|
|
268
|
+
states: [],
|
|
269
|
+
description: {
|
|
270
|
+
en: "A menu, submenu, popover or the composer's menus.",
|
|
271
|
+
zh: "菜单、子菜单、弹出层或输入框的菜单。",
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
name: "segmented",
|
|
276
|
+
version: 1,
|
|
277
|
+
owner: ["packages/design/src/display/tabs.tsx"],
|
|
278
|
+
states: [],
|
|
279
|
+
description: {
|
|
280
|
+
en: "A segmented control (its segments are radios with `aria-checked`).",
|
|
281
|
+
zh: "分段控件(各段是带 aria-checked 的单选项)。",
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: "stat-card",
|
|
286
|
+
version: 1,
|
|
287
|
+
owner: ["packages/design/src/display/stat-cards.tsx"],
|
|
288
|
+
states: [],
|
|
289
|
+
description: {
|
|
290
|
+
en: "A metric card of a StatCards row.",
|
|
291
|
+
zh: "指标卡片行里的一张指标卡。",
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: "switch",
|
|
296
|
+
version: 1,
|
|
297
|
+
owner: ["packages/design/src/controls/toggles.tsx"],
|
|
298
|
+
states: ["aria-checked", "disabled"],
|
|
299
|
+
description: {
|
|
300
|
+
en: "A switch; `aria-checked` says on or off.",
|
|
301
|
+
zh: "开关;aria-checked 表示开或关。",
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: "switch.knob",
|
|
306
|
+
version: 1,
|
|
307
|
+
owner: ["packages/design/src/controls/toggles.tsx"],
|
|
308
|
+
states: [],
|
|
309
|
+
description: {
|
|
310
|
+
en: "The knob inside a `switch` (style it from the switch's state).",
|
|
311
|
+
zh: "开关里的滑块(按所在开关的状态设置样式)。",
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: "org-avatar",
|
|
316
|
+
version: 1,
|
|
317
|
+
owner: ["packages/design/src/shell/sidebar.tsx"],
|
|
318
|
+
states: [],
|
|
319
|
+
description: {
|
|
320
|
+
en: "The org's initial block in the sidebar's org switcher.",
|
|
321
|
+
zh: "侧边栏组织切换器里的组织首字方块。",
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: "agent-chip",
|
|
326
|
+
version: 1,
|
|
327
|
+
owner: ["packages/design/src/conversation/agent-row.tsx"],
|
|
328
|
+
states: ["aria-pressed"],
|
|
329
|
+
description: {
|
|
330
|
+
en: "An agent chip of the new conversation's agents row; `aria-pressed` on the selected one.",
|
|
331
|
+
zh: "新会话智能体行里的智能体标签;选中的那个带 aria-pressed。",
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
];
|
|
335
|
+
export function uiPart(name) {
|
|
336
|
+
return UI_PARTS.find((p) => p.name === name);
|
|
337
|
+
}
|