@capybara-hq/plugin-sdk 0.1.0-rc.9 → 0.1.0-rc.90
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/README.md +3 -1
- package/agent-docs/agent-templates.md +14 -2
- package/agent-docs/concepts.md +14 -5
- package/agent-docs/connector-templates.md +11 -3
- package/agent-docs/extension-points/channel.md +1 -1
- package/agent-docs/extension-points/context.md +15 -0
- package/agent-docs/extension-points/device-provider.md +15 -0
- package/agent-docs/extension-points/file-preview.md +3 -1
- package/agent-docs/extension-points/identity-source.md +2 -0
- package/agent-docs/extension-points/model-provider.md +5 -1
- package/agent-docs/extension-points/object-store.md +2 -0
- package/agent-docs/extension-points/push-provider.md +17 -0
- package/agent-docs/extension-points/trigger-source.md +19 -0
- package/agent-docs/extensions.md +98 -4
- package/agent-docs/plugin-format.md +45 -10
- package/agent-docs/setup.md +54 -0
- package/api/plugin-sdk.api.md +5983 -0
- package/dist/agent-template.d.ts +15 -6
- package/dist/agent-template.js +32 -13
- package/dist/agents-ctx.d.ts +116 -0
- package/dist/agents-ctx.js +22 -0
- package/dist/avatar-presets.d.ts +8 -0
- package/dist/avatar-presets.js +17 -0
- package/dist/bootstrap.d.ts +109 -1
- package/dist/bootstrap.js +185 -2
- package/dist/cards.d.ts +121 -13
- package/dist/cards.js +161 -19
- package/dist/channel.d.ts +133 -47
- 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 +28 -6
- package/dist/config-ui.js +88 -25
- package/dist/config-url-fetch.d.ts +19 -0
- package/dist/config-url-fetch.js +43 -0
- package/dist/connector-auth.d.ts +13 -2
- package/dist/connector-auth.js +82 -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 +344 -31
- package/dist/ctx.js +9 -1
- package/dist/define-extension.d.ts +18 -12
- package/dist/define-extension.js +18 -5
- package/dist/device-denied-paths.d.ts +20 -0
- package/dist/device-denied-paths.js +118 -0
- package/dist/device-operation.d.ts +348 -0
- package/dist/device-operation.js +312 -0
- package/dist/device-protocol.d.ts +286 -49
- package/dist/device-protocol.js +766 -89
- package/dist/device-provider.d.ts +820 -0
- package/dist/device-provider.js +432 -0
- package/dist/device-service.d.ts +204 -0
- package/dist/device-service.js +291 -0
- package/dist/dial-in.d.ts +286 -0
- package/dist/dial-in.js +213 -0
- package/dist/directory.d.ts +15 -12
- package/dist/extension-point.d.ts +2 -0
- package/dist/extension-point.js +8 -3
- package/dist/field-meta.d.ts +19 -0
- package/dist/field-meta.js +54 -0
- package/dist/file-preview.d.ts +46 -9
- package/dist/git-hosts.d.ts +53 -0
- package/dist/git-hosts.js +98 -0
- package/dist/hooks.d.ts +185 -22
- package/dist/hooks.js +6 -0
- package/dist/http-access.d.ts +71 -0
- package/dist/http-access.js +12 -0
- package/dist/identity.d.ts +70 -9
- package/dist/identity.js +46 -1
- package/dist/inbox.d.ts +103 -0
- package/dist/inbox.js +173 -0
- package/dist/index.d.ts +30 -4
- package/dist/index.js +30 -4
- package/dist/model-params.d.ts +41 -22
- package/dist/model-params.js +28 -15
- package/dist/model.d.ts +295 -77
- package/dist/model.js +249 -21
- package/dist/native-failure.d.ts +13 -0
- package/dist/native-failure.js +31 -0
- package/dist/net.d.ts +52 -0
- package/dist/net.js +34 -0
- package/dist/network-classes.d.ts +98 -0
- package/dist/network-classes.js +291 -0
- package/dist/permissions.d.ts +95 -25
- package/dist/permissions.js +175 -54
- package/dist/platform-only.d.ts +27 -0
- package/dist/platform-only.js +35 -0
- package/dist/plugin-manifest.d.ts +30 -6
- package/dist/plugin-manifest.js +147 -55
- package/dist/plugin-package.d.ts +82 -39
- package/dist/plugin-package.js +68 -41
- package/dist/push.d.ts +75 -0
- package/dist/push.js +87 -0
- package/dist/sandbox-linux-runtime-source.d.ts +1 -0
- package/dist/sandbox-linux-runtime-source.js +2343 -0
- package/dist/sandbox-native-runtime-source.d.ts +10 -0
- package/dist/sandbox-native-runtime-source.js +480 -0
- package/dist/sandbox-runtime-source.d.ts +47 -0
- package/dist/sandbox-runtime-source.js +73 -0
- package/dist/sandbox-write-denies.d.ts +139 -0
- package/dist/sandbox-write-denies.js +869 -0
- package/dist/secret.d.ts +8 -2
- package/dist/secret.js +11 -4
- package/dist/setup-check.d.ts +128 -0
- package/dist/setup-check.js +142 -0
- package/dist/setup-guide-parse.d.ts +121 -0
- package/dist/setup-guide-parse.js +356 -0
- package/dist/setup-guide-render.d.ts +45 -0
- package/dist/setup-guide-render.js +351 -0
- package/dist/setup-guide.d.ts +86 -72
- package/dist/setup-guide.js +340 -108
- package/dist/shell-capabilities.d.ts +216 -0
- package/dist/shell-capabilities.js +44 -0
- package/dist/shell-environment.d.ts +57 -0
- package/dist/shell-environment.js +21 -0
- package/dist/skill-invocation.d.ts +5 -0
- package/dist/skill-invocation.js +4 -3
- package/dist/skill.d.ts +27 -17
- package/dist/skill.js +40 -26
- package/dist/storage.d.ts +52 -25
- package/dist/svg-viewbox.d.ts +10 -0
- package/dist/svg-viewbox.js +24 -0
- package/dist/theme-assets.d.ts +25 -9
- package/dist/theme-assets.js +87 -47
- package/dist/theme-tokens.generated.d.ts +40 -12
- package/dist/theme-tokens.generated.js +36 -8
- package/dist/theme.d.ts +56 -10
- package/dist/theme.js +117 -23
- package/dist/tool.d.ts +242 -28
- package/dist/tool.js +135 -13
- package/dist/trigger-source.d.ts +35 -0
- package/dist/trigger-source.js +2 -0
- package/dist/triggers.d.ts +88 -0
- package/dist/triggers.js +71 -0
- package/dist/ui-parts.d.ts +23 -0
- package/dist/ui-parts.js +374 -0
- package/dist/ui-resolve.d.ts +2 -7
- package/dist/ui-resolve.js +7 -19
- package/dist/ui-slots.d.ts +27 -5
- package/dist/ui-slots.js +112 -19
- package/dist/ui.d.ts +203 -64
- package/dist/ui.js +117 -23
- package/dist/url.d.ts +4 -1
- package/dist/url.js +4 -1
- package/dist/web.d.ts +26 -20
- package/package.json +13 -1
- package/schemas/bootstrap-extra.v1.schema.json +186 -0
- package/schemas/bootstrap.v1.schema.json +20 -0
- package/schemas/connector-template.v1.schema.json +62 -4
- package/schemas/plugin.v1.schema.json +74 -143
- package/schemas/theme.v1.schema.json +77 -0
- package/agent-docs/extension-points/sandbox.md +0 -15
- package/dist/org-access.d.ts +0 -27
- package/dist/org-access.js +0 -35
- package/dist/sandbox.d.ts +0 -254
- package/dist/sandbox.js +0 -153
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ToolCallContext } from "./tool.js";
|
|
2
|
+
/** The value of one fact on a trigger event: filters compare facts, never free text. */
|
|
3
|
+
export type TriggerFactValue = string | number | boolean | string[];
|
|
4
|
+
/** What an event is about (a task, a document, ...). */
|
|
5
|
+
export interface TriggerSubject {
|
|
6
|
+
kind: string;
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Who caused an event: a tool call of the extension (`call`, the context the kernel passed to the
|
|
13
|
+
* handler), a handle the kernel made from such a call ({@link TriggersCtx.causeOf}; for an event
|
|
14
|
+
* emitted later, from a queue job), or an account acting outside a call.
|
|
15
|
+
*/
|
|
16
|
+
export type TriggerCause = {
|
|
17
|
+
call: ToolCallContext;
|
|
18
|
+
} | {
|
|
19
|
+
handle: string;
|
|
20
|
+
} | {
|
|
21
|
+
accountId: string;
|
|
22
|
+
};
|
|
23
|
+
/** An event an extension emits through `ctx.triggers.emit`. */
|
|
24
|
+
export interface TriggerEvent {
|
|
25
|
+
orgId: string;
|
|
26
|
+
/** One of the types the extension declares in `permissions.triggers.emit`. */
|
|
27
|
+
type: string;
|
|
28
|
+
subject: TriggerSubject;
|
|
29
|
+
facts: Record<string, TriggerFactValue>;
|
|
30
|
+
/** Short text for the agent; at most {@link TRIGGER_SUMMARY_MAX_BYTES} UTF-8 bytes. */
|
|
31
|
+
summary: string;
|
|
32
|
+
/** Idempotency key: the same key for the same type and org emits once. */
|
|
33
|
+
dedupeKey: string;
|
|
34
|
+
cause?: TriggerCause;
|
|
35
|
+
/** A directed event: only this agent of this account is woken. */
|
|
36
|
+
audience?: {
|
|
37
|
+
accountId: string;
|
|
38
|
+
agentId: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface EventFilterClause {
|
|
42
|
+
fact: string;
|
|
43
|
+
op: "eq" | "in" | "contains";
|
|
44
|
+
value: TriggerFactValue;
|
|
45
|
+
}
|
|
46
|
+
/** A conjunction: every clause must match. An empty filter matches every event. */
|
|
47
|
+
export type EventFilter = EventFilterClause[];
|
|
48
|
+
/** `ctx.triggers` (requires `permissions.triggers`). */
|
|
49
|
+
export interface TriggersCtx {
|
|
50
|
+
emit(event: TriggerEvent): Promise<{
|
|
51
|
+
eventId: string;
|
|
52
|
+
duplicate: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* A serializable cause for an event emitted after the tool call returned: an opaque handle for
|
|
56
|
+
* `call` (the context the kernel passed to the handler) that the kernel binds to the call's org
|
|
57
|
+
* and run and to this extension, valid for 24 hours. Pass it in the `ctx.queue` job's payload
|
|
58
|
+
* and emit with `cause: { handle }`: the event keeps the call's chain depth and self-trigger
|
|
59
|
+
* check. One handle may be used for several events of that org. Throws `TriggerError`
|
|
60
|
+
* (`invalid_event`) for a context the kernel did not make; `emit` refuses an expired handle, or
|
|
61
|
+
* one of another org or extension, the same way.
|
|
62
|
+
*/
|
|
63
|
+
causeOf(call: ToolCallContext): Promise<string>;
|
|
64
|
+
}
|
|
65
|
+
export type TriggerErrorCode = "type_not_declared" | "invalid_event" | "org_disabled";
|
|
66
|
+
/** A {@link TriggersCtx} call was refused. */
|
|
67
|
+
export declare class TriggerError extends Error {
|
|
68
|
+
readonly code: TriggerErrorCode;
|
|
69
|
+
constructor(code: TriggerErrorCode, message: string, opts?: {
|
|
70
|
+
cause?: unknown;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export declare const TRIGGER_SUMMARY_MAX_BYTES = 4096;
|
|
74
|
+
/** The shape of a trigger event type name (also the entries of `permissions.triggers.emit`). */
|
|
75
|
+
export declare const TRIGGER_TYPE_RE: RegExp;
|
|
76
|
+
/** Most event types one extension may declare. */
|
|
77
|
+
export declare const TRIGGER_MAX_TYPES = 64;
|
|
78
|
+
/**
|
|
79
|
+
* Checks an event before it is stored; returns error codes (empty = valid): `type_not_declared`,
|
|
80
|
+
* `summary_too_long` (UTF-8 bytes), and `missing_<field>` for each empty required field.
|
|
81
|
+
*/
|
|
82
|
+
export declare function validateTriggerEvent(e: TriggerEvent, declared: readonly string[]): string[];
|
|
83
|
+
/**
|
|
84
|
+
* Whether the facts satisfy every clause. A missing fact never matches. `eq` compares scalars (an
|
|
85
|
+
* array fact never matches); `in` takes an array value and matches a scalar fact contained in it;
|
|
86
|
+
* `contains` matches an array fact containing the scalar value.
|
|
87
|
+
*/
|
|
88
|
+
export declare function matchesFilter(filter: EventFilter, facts: Record<string, TriggerFactValue>): boolean;
|
package/dist/triggers.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** A {@link TriggersCtx} call was refused. */
|
|
2
|
+
export class TriggerError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
constructor(code, message, opts) {
|
|
5
|
+
super(message, opts && "cause" in opts ? { cause: opts.cause } : undefined);
|
|
6
|
+
this.name = "TriggerError";
|
|
7
|
+
this.code = code;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export const TRIGGER_SUMMARY_MAX_BYTES = 4096;
|
|
11
|
+
/** The shape of a trigger event type name (also the entries of `permissions.triggers.emit`). */
|
|
12
|
+
export const TRIGGER_TYPE_RE = /^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/;
|
|
13
|
+
/** Most event types one extension may declare. */
|
|
14
|
+
export const TRIGGER_MAX_TYPES = 64;
|
|
15
|
+
/**
|
|
16
|
+
* Checks an event before it is stored; returns error codes (empty = valid): `type_not_declared`,
|
|
17
|
+
* `summary_too_long` (UTF-8 bytes), and `missing_<field>` for each empty required field.
|
|
18
|
+
*/
|
|
19
|
+
export function validateTriggerEvent(e, declared) {
|
|
20
|
+
const errs = [];
|
|
21
|
+
const blank = (v) => typeof v !== "string" || v === "";
|
|
22
|
+
if (blank(e.orgId))
|
|
23
|
+
errs.push("missing_org_id");
|
|
24
|
+
if (blank(e.type))
|
|
25
|
+
errs.push("missing_type");
|
|
26
|
+
else if (!declared.includes(e.type))
|
|
27
|
+
errs.push("type_not_declared");
|
|
28
|
+
if (blank(e.subject?.kind))
|
|
29
|
+
errs.push("missing_subject_kind");
|
|
30
|
+
if (blank(e.subject?.id))
|
|
31
|
+
errs.push("missing_subject_id");
|
|
32
|
+
if (blank(e.subject?.title))
|
|
33
|
+
errs.push("missing_subject_title");
|
|
34
|
+
if (blank(e.dedupeKey))
|
|
35
|
+
errs.push("missing_dedupe_key");
|
|
36
|
+
if (typeof e.summary !== "string")
|
|
37
|
+
errs.push("missing_summary");
|
|
38
|
+
else if (new TextEncoder().encode(e.summary).length > TRIGGER_SUMMARY_MAX_BYTES)
|
|
39
|
+
errs.push("summary_too_long");
|
|
40
|
+
return errs;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Whether the facts satisfy every clause. A missing fact never matches. `eq` compares scalars (an
|
|
44
|
+
* array fact never matches); `in` takes an array value and matches a scalar fact contained in it;
|
|
45
|
+
* `contains` matches an array fact containing the scalar value.
|
|
46
|
+
*/
|
|
47
|
+
export function matchesFilter(filter, facts) {
|
|
48
|
+
return filter.every((c) => {
|
|
49
|
+
if (!Object.hasOwn(facts, c.fact))
|
|
50
|
+
return false;
|
|
51
|
+
const f = facts[c.fact];
|
|
52
|
+
if (f === undefined)
|
|
53
|
+
return false;
|
|
54
|
+
switch (c.op) {
|
|
55
|
+
case "eq":
|
|
56
|
+
return !Array.isArray(f) && !Array.isArray(c.value) && f === c.value;
|
|
57
|
+
case "in":
|
|
58
|
+
return (Array.isArray(c.value) &&
|
|
59
|
+
!Array.isArray(f) &&
|
|
60
|
+
typeof f === "string" &&
|
|
61
|
+
c.value.includes(f));
|
|
62
|
+
case "contains":
|
|
63
|
+
return (Array.isArray(f) &&
|
|
64
|
+
!Array.isArray(c.value) &&
|
|
65
|
+
typeof c.value === "string" &&
|
|
66
|
+
f.includes(c.value));
|
|
67
|
+
default:
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -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", "composer.box", "composer.options", "composer.send", "properties-panel", "section", "right-panel", "button", "button.primary", "card", "input", "dialog", "code-block", "menu", "segmented", "stat-card", "switch", "switch.knob", "org-avatar", "agent-chip", "image-placeholder"];
|
|
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,374 @@
|
|
|
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
|
+
"composer.box",
|
|
16
|
+
"composer.options",
|
|
17
|
+
"composer.send",
|
|
18
|
+
"properties-panel",
|
|
19
|
+
"section",
|
|
20
|
+
"right-panel",
|
|
21
|
+
"button",
|
|
22
|
+
"button.primary",
|
|
23
|
+
"card",
|
|
24
|
+
"input",
|
|
25
|
+
"dialog",
|
|
26
|
+
"code-block",
|
|
27
|
+
"menu",
|
|
28
|
+
"segmented",
|
|
29
|
+
"stat-card",
|
|
30
|
+
"switch",
|
|
31
|
+
"switch.knob",
|
|
32
|
+
"org-avatar",
|
|
33
|
+
"agent-chip",
|
|
34
|
+
"image-placeholder",
|
|
35
|
+
];
|
|
36
|
+
export const UI_PARTS = [
|
|
37
|
+
{
|
|
38
|
+
name: "shell",
|
|
39
|
+
version: 1,
|
|
40
|
+
owner: ["packages/design/src/shell/app-shell.tsx"],
|
|
41
|
+
states: [],
|
|
42
|
+
description: {
|
|
43
|
+
en: "The App Shell root.",
|
|
44
|
+
zh: "应用外壳的根节点。",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "sidebar",
|
|
49
|
+
version: 1,
|
|
50
|
+
owner: ["packages/design/src/shell/sidebar.tsx"],
|
|
51
|
+
states: [],
|
|
52
|
+
description: {
|
|
53
|
+
en: "The left sidebar.",
|
|
54
|
+
zh: "左侧边栏。",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "sidebar.brand",
|
|
59
|
+
version: 1,
|
|
60
|
+
owner: ["packages/design/src/shell/sidebar.tsx"],
|
|
61
|
+
states: [],
|
|
62
|
+
description: {
|
|
63
|
+
en: "The brand row of the sidebar.",
|
|
64
|
+
zh: "侧边栏的品牌行。",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "sidebar.item",
|
|
69
|
+
version: 1,
|
|
70
|
+
owner: [
|
|
71
|
+
"packages/design/src/shell/sidebar.tsx",
|
|
72
|
+
"packages/design/src/shell/sidebar-conversations.tsx",
|
|
73
|
+
],
|
|
74
|
+
states: ["aria-current"],
|
|
75
|
+
description: {
|
|
76
|
+
en: "A navigation or conversation row of the sidebar.",
|
|
77
|
+
zh: "侧边栏的导航行或对话行。",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "title-bar",
|
|
82
|
+
version: 1,
|
|
83
|
+
owner: ["packages/design/src/conversation/title-bar.tsx"],
|
|
84
|
+
states: [],
|
|
85
|
+
description: {
|
|
86
|
+
en: "The conversation title bar.",
|
|
87
|
+
zh: "对话标题栏。",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "page-header",
|
|
92
|
+
version: 1,
|
|
93
|
+
owner: ["packages/design/src/shell/page-header.tsx"],
|
|
94
|
+
states: [],
|
|
95
|
+
description: {
|
|
96
|
+
en: "The header of a page.",
|
|
97
|
+
zh: "页面头部。",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "thread",
|
|
102
|
+
version: 1,
|
|
103
|
+
owner: ["packages/design/src/templates/conversation-page.tsx"],
|
|
104
|
+
states: ["aria-busy"],
|
|
105
|
+
description: {
|
|
106
|
+
en: "The conversation stream.",
|
|
107
|
+
zh: "对话消息流。",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "message.user",
|
|
112
|
+
version: 1,
|
|
113
|
+
owner: ["packages/design/src/conversation/bubble.tsx"],
|
|
114
|
+
states: [],
|
|
115
|
+
description: {
|
|
116
|
+
en: "A person's message.",
|
|
117
|
+
zh: "用户发出的消息。",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "message.user.bubble",
|
|
122
|
+
version: 1,
|
|
123
|
+
owner: ["packages/design/src/conversation/bubble.tsx"],
|
|
124
|
+
states: [],
|
|
125
|
+
description: {
|
|
126
|
+
en: "The bubble of a person's message (inside the full-width `message.user` row).",
|
|
127
|
+
zh: "用户消息的气泡本身(在占满宽度的 message.user 行之内)。",
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "message.assistant",
|
|
132
|
+
version: 1,
|
|
133
|
+
owner: ["apps/web/src/components/conversation/Thread.tsx"],
|
|
134
|
+
states: ["aria-busy"],
|
|
135
|
+
description: {
|
|
136
|
+
en: "An assistant turn; `aria-busy` while its text is still streaming (the live reply).",
|
|
137
|
+
zh: "智能体的一轮回复;正在流式输出时带 aria-busy(正在生成的回复)。",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "tool-row",
|
|
142
|
+
version: 1,
|
|
143
|
+
owner: ["packages/design/src/conversation/tool-row.tsx"],
|
|
144
|
+
states: ["aria-expanded"],
|
|
145
|
+
description: {
|
|
146
|
+
en: "A tool call line.",
|
|
147
|
+
zh: "工具调用行。",
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "composer",
|
|
152
|
+
version: 1,
|
|
153
|
+
owner: ["packages/design/src/conversation/composer.tsx"],
|
|
154
|
+
states: ["aria-busy"],
|
|
155
|
+
description: {
|
|
156
|
+
en: "The whole composer: the token warning, the attachments, the text box and the control row. From 600 up with a fine pointer it is the box; in the mobile form (below 600, or a touch device at any width) it draws nothing and `composer.box` is the floating pill, the control row around it.",
|
|
157
|
+
zh: "整个输入框:令牌提醒、附件、文本框与控件行。600 及以上且为精确指针时它就是那个框;移动形态(600 以下,或任意宽度的触屏设备)下它不画任何东西,`composer.box` 是浮动的胶囊,控件行在其上下。",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "composer.box",
|
|
162
|
+
version: 1,
|
|
163
|
+
owner: ["packages/design/src/conversation/composer.tsx"],
|
|
164
|
+
states: [],
|
|
165
|
+
description: {
|
|
166
|
+
en: "The composer's text box: the text with the attach and send buttons. In the mobile form it is the floating pill (round ends, `:focus-within` while the text or one of its buttons has focus, never for the control row); from 600 up with a fine pointer it draws no box of its own (`display: contents`).",
|
|
167
|
+
zh: "输入框的文本框:文字与添加、发送按钮。移动形态下它是浮动胶囊(圆头;文字或其中按钮获得焦点时 `:focus-within`,控件行获得焦点时不会);600 及以上且为精确指针时它不画自己的框(`display: contents`)。",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "composer.options",
|
|
172
|
+
version: 1,
|
|
173
|
+
owner: ["packages/design/src/conversation/composer-options.tsx"],
|
|
174
|
+
states: ["aria-expanded"],
|
|
175
|
+
description: {
|
|
176
|
+
en: "The composer's settings chip (model, effort, device, permission) opening the options sheet: in the mobile form only, above the pill.",
|
|
177
|
+
zh: "输入框的设置胶囊(模型、推理强度、设备、权限),打开选项面板:仅移动形态,位于胶囊上方。",
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "composer.send",
|
|
182
|
+
version: 1,
|
|
183
|
+
owner: ["packages/design/src/conversation/composer.tsx"],
|
|
184
|
+
states: ["disabled", "aria-busy"],
|
|
185
|
+
description: {
|
|
186
|
+
en: "The composer's send button, and the stop button in its place while a run is going (its `aria-label` tells them apart). In the mobile form a round button inside `composer.box`.",
|
|
187
|
+
zh: "输入框的发送按钮,运行中同一位置的停止按钮(以 `aria-label` 区分)。移动形态下是 `composer.box` 内的圆形按钮。",
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "properties-panel",
|
|
192
|
+
version: 1,
|
|
193
|
+
owner: ["packages/design/src/conversation/panels.tsx"],
|
|
194
|
+
states: [],
|
|
195
|
+
description: {
|
|
196
|
+
en: "The conversation properties panel.",
|
|
197
|
+
zh: "对话属性面板。",
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "section",
|
|
202
|
+
version: 1,
|
|
203
|
+
owner: [
|
|
204
|
+
"packages/design/src/conversation/panels.tsx",
|
|
205
|
+
"packages/design/src/templates/form-page.tsx",
|
|
206
|
+
],
|
|
207
|
+
states: [],
|
|
208
|
+
description: {
|
|
209
|
+
en: "A property section or form section.",
|
|
210
|
+
zh: "属性分区或表单分区。",
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: "right-panel",
|
|
215
|
+
version: 1,
|
|
216
|
+
owner: ["packages/design/src/conversation/panels.tsx"],
|
|
217
|
+
states: [],
|
|
218
|
+
description: {
|
|
219
|
+
en: "A full-height right pane.",
|
|
220
|
+
zh: "占满高度的右侧窗格。",
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "button",
|
|
225
|
+
version: 1,
|
|
226
|
+
owner: [
|
|
227
|
+
"packages/design/src/controls/button.tsx",
|
|
228
|
+
"packages/design/src/conversation/composer.tsx",
|
|
229
|
+
"packages/design/src/conversation/composer-options.tsx",
|
|
230
|
+
],
|
|
231
|
+
states: ["disabled"],
|
|
232
|
+
description: {
|
|
233
|
+
en: "Every button.",
|
|
234
|
+
zh: "所有按钮。",
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "button.primary",
|
|
239
|
+
version: 1,
|
|
240
|
+
owner: ["packages/design/src/controls/button.tsx"],
|
|
241
|
+
states: ["disabled"],
|
|
242
|
+
description: {
|
|
243
|
+
en: "A primary button (carried together with `button`).",
|
|
244
|
+
zh: "主按钮(与 button 同时出现)。",
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: "card",
|
|
249
|
+
version: 1,
|
|
250
|
+
owner: [
|
|
251
|
+
"packages/design/src/layout/index.tsx",
|
|
252
|
+
"packages/design/src/conversation/panels.tsx",
|
|
253
|
+
"packages/design/src/display/card-grid.tsx",
|
|
254
|
+
],
|
|
255
|
+
states: [],
|
|
256
|
+
description: {
|
|
257
|
+
en: "A card, inline card or object card.",
|
|
258
|
+
zh: "卡片、行内卡片或对象卡片。",
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: "input",
|
|
263
|
+
version: 1,
|
|
264
|
+
owner: ["packages/design/src/controls/inputs.tsx", "packages/design/src/controls/select.tsx"],
|
|
265
|
+
states: ["disabled"],
|
|
266
|
+
description: {
|
|
267
|
+
en: "Text inputs, textareas and selects.",
|
|
268
|
+
zh: "文本框、多行文本框和下拉选择。",
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: "dialog",
|
|
273
|
+
version: 1,
|
|
274
|
+
owner: ["packages/design/src/overlays/dialog.tsx", "packages/design/src/overlays/sheet.tsx"],
|
|
275
|
+
states: [],
|
|
276
|
+
description: {
|
|
277
|
+
en: "A dialog or sheet.",
|
|
278
|
+
zh: "对话框或抽屉。",
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "code-block",
|
|
283
|
+
version: 1,
|
|
284
|
+
owner: ["packages/design/src/display/chat.tsx"],
|
|
285
|
+
states: [],
|
|
286
|
+
description: {
|
|
287
|
+
en: "A code block (Markdown code, setup guides, diffs).",
|
|
288
|
+
zh: "代码块(Markdown 代码、设置指引、差异)。",
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: "menu",
|
|
293
|
+
version: 1,
|
|
294
|
+
owner: ["packages/design/src/overlays/menus.tsx", "packages/design/src/conversation/menu.tsx"],
|
|
295
|
+
states: [],
|
|
296
|
+
description: {
|
|
297
|
+
en: "A menu, submenu, popover or the composer's menus.",
|
|
298
|
+
zh: "菜单、子菜单、弹出层或输入框的菜单。",
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: "segmented",
|
|
303
|
+
version: 1,
|
|
304
|
+
owner: ["packages/design/src/display/tabs.tsx"],
|
|
305
|
+
states: [],
|
|
306
|
+
description: {
|
|
307
|
+
en: "A segmented control (its segments are radios with `aria-checked`).",
|
|
308
|
+
zh: "分段控件(各段是带 aria-checked 的单选项)。",
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
name: "stat-card",
|
|
313
|
+
version: 1,
|
|
314
|
+
owner: ["packages/design/src/display/stat-cards.tsx"],
|
|
315
|
+
states: [],
|
|
316
|
+
description: {
|
|
317
|
+
en: "A metric card of a StatCards row.",
|
|
318
|
+
zh: "指标卡片行里的一张指标卡。",
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: "switch",
|
|
323
|
+
version: 1,
|
|
324
|
+
owner: ["packages/design/src/controls/toggles.tsx"],
|
|
325
|
+
states: ["aria-checked", "disabled"],
|
|
326
|
+
description: {
|
|
327
|
+
en: "A switch; `aria-checked` says on or off.",
|
|
328
|
+
zh: "开关;aria-checked 表示开或关。",
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "switch.knob",
|
|
333
|
+
version: 1,
|
|
334
|
+
owner: ["packages/design/src/controls/toggles.tsx"],
|
|
335
|
+
states: [],
|
|
336
|
+
description: {
|
|
337
|
+
en: "The knob inside a `switch` (style it from the switch's state).",
|
|
338
|
+
zh: "开关里的滑块(按所在开关的状态设置样式)。",
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
name: "org-avatar",
|
|
343
|
+
version: 1,
|
|
344
|
+
owner: ["packages/design/src/shell/sidebar.tsx"],
|
|
345
|
+
states: [],
|
|
346
|
+
description: {
|
|
347
|
+
en: "The org's initial block in the sidebar's org switcher.",
|
|
348
|
+
zh: "侧边栏组织切换器里的组织首字方块。",
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
name: "agent-chip",
|
|
353
|
+
version: 1,
|
|
354
|
+
owner: ["packages/design/src/conversation/agent-row.tsx"],
|
|
355
|
+
states: ["aria-pressed"],
|
|
356
|
+
description: {
|
|
357
|
+
en: "An agent chip of the new conversation's agents row; `aria-pressed` on the selected one.",
|
|
358
|
+
zh: "新会话智能体行里的智能体标签;选中的那个带 aria-pressed。",
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
name: "image-placeholder",
|
|
363
|
+
version: 1,
|
|
364
|
+
owner: ["packages/design/src/conversation/files.tsx"],
|
|
365
|
+
states: ["aria-busy"],
|
|
366
|
+
description: {
|
|
367
|
+
en: "A generating image's placeholder in the conversation.",
|
|
368
|
+
zh: "对话中正在生成的图片的占位框。",
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
];
|
|
372
|
+
export function uiPart(name) {
|
|
373
|
+
return UI_PARTS.find((p) => p.name === name);
|
|
374
|
+
}
|
package/dist/ui-resolve.d.ts
CHANGED
|
@@ -19,15 +19,11 @@ export interface DroppedUiContribution {
|
|
|
19
19
|
ref: string;
|
|
20
20
|
reason: UiDropReason;
|
|
21
21
|
}
|
|
22
|
-
/** The slot reference a contribution names: its `slot`, or the slot of its deprecated `place`. */
|
|
23
|
-
export declare function slotRefOf(c: UiContribution): string;
|
|
24
22
|
/**
|
|
25
23
|
* Resolves the slots of a manifest's `ui` against the catalog (UI slots spec §3.2). Assumes
|
|
26
24
|
* `validateUiContributions` passed; never throws. A contribution to an unknown slot or to a version
|
|
27
|
-
* other than the slot's is dropped
|
|
28
|
-
*
|
|
29
|
-
* `unknownAnchors` and the contribution keeps the slot's default position. `deprecatedPlace` lists
|
|
30
|
-
* the ids that still say `place`. Both lists keep manifest order.
|
|
25
|
+
* other than the slot's is dropped; an `after` that is not an anchor of the slot is listed in
|
|
26
|
+
* `unknownAnchors` and the contribution keeps the slot's default position. Both lists keep manifest order.
|
|
31
27
|
*/
|
|
32
28
|
export declare function resolveUiSlots(ui: readonly UiContribution[] | undefined): {
|
|
33
29
|
resolved: ResolvedUiContribution[];
|
|
@@ -36,5 +32,4 @@ export declare function resolveUiSlots(ui: readonly UiContribution[] | undefined
|
|
|
36
32
|
id: string;
|
|
37
33
|
after: string;
|
|
38
34
|
}[];
|
|
39
|
-
deprecatedPlace: string[];
|
|
40
35
|
};
|
package/dist/ui-resolve.js
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/** The slot reference a contribution names: its `slot`, or the slot of its deprecated `place`. */
|
|
3
|
-
export function slotRefOf(c) {
|
|
4
|
-
// biome-ignore lint/style/noNonNullAssertion: validateUiContributions requires slot or place
|
|
5
|
-
return c.slot ?? PLACE_SLOTS[c.place];
|
|
6
|
-
}
|
|
1
|
+
import { parseSlotRef, uiSlot } from "./ui-slots.js";
|
|
7
2
|
/**
|
|
8
3
|
* Resolves the slots of a manifest's `ui` against the catalog (UI slots spec §3.2). Assumes
|
|
9
4
|
* `validateUiContributions` passed; never throws. A contribution to an unknown slot or to a version
|
|
10
|
-
* other than the slot's is dropped
|
|
11
|
-
*
|
|
12
|
-
* `unknownAnchors` and the contribution keeps the slot's default position. `deprecatedPlace` lists
|
|
13
|
-
* the ids that still say `place`. Both lists keep manifest order.
|
|
5
|
+
* other than the slot's is dropped; an `after` that is not an anchor of the slot is listed in
|
|
6
|
+
* `unknownAnchors` and the contribution keeps the slot's default position. Both lists keep manifest order.
|
|
14
7
|
*/
|
|
15
8
|
export function resolveUiSlots(ui) {
|
|
16
9
|
const list = ui ?? [];
|
|
17
10
|
const own = new Map();
|
|
18
11
|
for (const c of list) {
|
|
19
|
-
const ref = parseSlotRef(
|
|
12
|
+
const ref = parseSlotRef(c.slot);
|
|
20
13
|
const slot = ref === null ? undefined : uiSlot(ref.id);
|
|
21
14
|
own.set(c.id, ref === null || slot === undefined
|
|
22
15
|
? { ok: false, reason: "unknown-slot" }
|
|
@@ -27,15 +20,10 @@ export function resolveUiSlots(ui) {
|
|
|
27
20
|
const resolved = [];
|
|
28
21
|
const dropped = [];
|
|
29
22
|
const unknownAnchors = [];
|
|
30
|
-
const deprecatedPlace = [];
|
|
31
23
|
for (const c of list) {
|
|
32
|
-
|
|
33
|
-
deprecatedPlace.push(c.id);
|
|
34
|
-
const mine = own.get(c.id);
|
|
35
|
-
const target = c.aliasOf === undefined ? undefined : own.get(c.aliasOf);
|
|
36
|
-
const r = mine.ok && target !== undefined && !target.ok ? target : mine;
|
|
24
|
+
const r = own.get(c.id);
|
|
37
25
|
if (!r.ok) {
|
|
38
|
-
dropped.push({ id: c.id, ref:
|
|
26
|
+
dropped.push({ id: c.id, ref: c.slot, reason: r.reason });
|
|
39
27
|
continue;
|
|
40
28
|
}
|
|
41
29
|
const anchors = r.slot.anchors ?? [];
|
|
@@ -50,5 +38,5 @@ export function resolveUiSlots(ui) {
|
|
|
50
38
|
...(anchors.length > 0 && { after }),
|
|
51
39
|
});
|
|
52
40
|
}
|
|
53
|
-
return { resolved, dropped, unknownAnchors
|
|
41
|
+
return { resolved, dropped, unknownAnchors };
|
|
54
42
|
}
|