@jini-ai/agent-plugins 0.7.2 → 0.7.3-next.2
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/CHANGELOG.md +4 -4
- package/NOTICE +2 -0
- package/README.md +11 -15
- package/calendly/plugin.json +3 -3
- package/cloudflare/lib/forms.mjs +9 -10
- package/cloudflare/lib/target.mjs +1 -1
- package/cloudflare/plugin.json +3 -3
- package/cloudflare/worker/forms-receiver.mjs +9 -9
- package/composio/plugin.json +3 -3
- package/core/persistent-state.js +227 -163
- package/dist/admin-surfaces/connections/connections.d.ts +11 -6
- package/dist/admin-surfaces/connections/connections.js +102 -85
- package/dist/admin-surfaces/node.d.ts +27 -0
- package/dist/admin-surfaces/node.js +32 -0
- package/dist/admin-surfaces/plugin-state.js +21 -18
- package/dist/admin-surfaces/surface-client.d.ts +4 -0
- package/dist/admin-surfaces/surface-client.js +124 -117
- package/dist/admin-surfaces/surface-handlers.js +21 -17
- package/dist/admin-surfaces/theme.d.ts +5 -1
- package/dist/admin-surfaces/theme.js +3 -3
- package/dist/connect/access-token-tool.d.ts +3 -1
- package/dist/connect/access-token-tool.js +3 -2
- package/dist/connect/apply-connect-defaults.js +2 -2
- package/dist/connect/apply-tool-renames.js +9 -8
- package/dist/connect/connect-tool.d.ts +2 -0
- package/dist/connect/connect-tool.js +3 -2
- package/dist/connect/credential-cards.js +3 -2
- package/dist/connect/credential-save-tool.d.ts +14 -11
- package/dist/connect/credential-save-tool.js +128 -121
- package/dist/connect/enable-access.d.ts +2 -2
- package/dist/connect/enable-access.js +6 -6
- package/dist/connect/executable/register.js +40 -34
- package/dist/connect/federate-mcp.d.ts +21 -11
- package/dist/connect/federate-mcp.js +28 -21
- package/dist/connect/grant-signed-in-defaults.js +3 -3
- package/dist/connect/import-access-token.js +2 -1
- package/dist/connect/index.d.ts +1 -0
- package/dist/connect/index.js +1 -0
- package/dist/connect/plugin-credential-card.js +2 -1
- package/dist/connect/plugin-host/index.d.ts +10 -5
- package/dist/connect/plugin-host/index.js +113 -100
- package/dist/connect/ports.d.ts +1 -1
- package/dist/connect/row-update.d.ts +22 -0
- package/dist/connect/row-update.js +18 -0
- package/dist/connect/switch-on-saved-token.d.ts +4 -2
- package/dist/connect/switch-on-saved-token.js +1 -1
- package/dist/connect/token-map.d.ts +44 -0
- package/dist/connect/token-map.js +49 -0
- package/dist/core/identity-namespace.js +5 -0
- package/dist/folder-zip.d.ts +3 -1
- package/dist/folder-zip.js +2 -2
- package/dist/lifecycle/activation.d.ts +4 -4
- package/dist/lifecycle/activation.js +4 -5
- package/dist/lifecycle/automatic-use.js +236 -210
- package/dist/lifecycle/bundled-digests.d.ts +75 -12
- package/dist/lifecycle/bundled-digests.js +213 -212
- package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
- package/dist/lifecycle/bundled-source-archive.js +263 -264
- package/dist/lifecycle/capability-projection.d.ts +1 -1
- package/dist/lifecycle/capability-projection.js +1 -1
- package/dist/lifecycle/credential-card-metadata.d.ts +1 -1
- package/dist/lifecycle/credential-card-metadata.js +27 -3
- package/dist/lifecycle/exports.js +9 -4
- package/dist/lifecycle/fetch-archive.d.ts +1 -1
- package/dist/lifecycle/fetch-archive.js +1 -1
- package/dist/lifecycle/host-tools/identity.js +3 -2
- package/dist/lifecycle/host-tools/ports.d.ts +2 -0
- package/dist/lifecycle/host-tools/search-tool.d.ts +4 -2
- package/dist/lifecycle/host-tools/search-tool.js +9 -8
- package/dist/lifecycle/host-tools/skill-tool.d.ts +18 -2
- package/dist/lifecycle/host-tools/skill-tool.js +16 -8
- package/dist/lifecycle/index.d.ts +118 -110
- package/dist/lifecycle/index.js +45 -12
- package/dist/lifecycle/install-errors.d.ts +1 -1
- package/dist/lifecycle/install-from-url.d.ts +1 -1
- package/dist/lifecycle/install-from-url.js +1 -1
- package/dist/lifecycle/install.d.ts +7 -2
- package/dist/lifecycle/install.js +414 -396
- package/dist/lifecycle/installed-package-index.js +45 -42
- package/dist/lifecycle/layout.d.ts +1 -1
- package/dist/lifecycle/layout.js +1 -1
- package/dist/lifecycle/mail/catalog.d.ts +8 -32
- package/dist/lifecycle/mail/catalog.js +25 -20
- package/dist/lifecycle/mail/contribution.d.ts +2 -2
- package/dist/lifecycle/mail/contribution.js +34 -34
- package/dist/lifecycle/mail/selection.js +6 -2
- package/dist/lifecycle/manifest.d.ts +3 -3
- package/dist/lifecycle/manifest.js +4 -4
- package/dist/lifecycle/mcp-provisioning.d.ts +3 -3
- package/dist/lifecycle/mcp-provisioning.js +3 -3
- package/dist/lifecycle/package-paths.d.ts +1 -1
- package/dist/lifecycle/package-paths.js +1 -1
- package/dist/lifecycle/persistent-state.js +1 -2
- package/dist/lifecycle/ports.d.ts +5 -1
- package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +30 -8
- package/dist/lifecycle/resolve-agent-plugin-refs.js +227 -228
- package/dist/lifecycle/retire-bundled.d.ts +1 -52
- package/dist/lifecycle/retire-bundled.js +134 -84
- package/dist/lifecycle/search.d.ts +2 -1
- package/dist/lifecycle/search.js +1 -1
- package/dist/lifecycle/seed-bundled.d.ts +1 -1
- package/dist/lifecycle/seed-bundled.js +154 -155
- package/dist/lifecycle/set-enabled.d.ts +1 -1
- package/dist/lifecycle/set-enabled.js +1 -1
- package/dist/lifecycle/skill-file-reader.js +53 -50
- package/dist/lifecycle/tools/projection.d.ts +4 -7
- package/dist/lifecycle/tools/projection.js +109 -108
- package/dist/lifecycle/trusted-plugin-files.d.ts +2 -2
- package/dist/lifecycle/trusted-plugin-files.js +1 -1
- package/dist/lifecycle/uninstall.d.ts +1 -1
- package/dist/lifecycle/uninstall.js +237 -241
- package/dist/lifecycle/update-store.js +20 -17
- package/dist/lifecycle/update.js +287 -281
- package/dist/lifecycle/yauzl-archive-reader.d.ts +2 -2
- package/dist/lifecycle/yauzl-archive-reader.js +8 -2
- package/dist/manifest.d.ts +11 -3
- package/dist/manifest.js +9 -9
- package/fly/jini-credential-schemes.json +11 -0
- package/fly/plugin.json +3 -4
- package/github/plugin.json +3 -3
- package/github/source-control/backup-push.mjs +11 -11
- package/github/source-control/commit-site.mjs +23 -13
- package/github/source-control/github.mjs +12 -6
- package/github/source-control/write-files.mjs +27 -28
- package/github-pages/{tovu-deploy-targets.json → jini-deploy-targets.json} +22 -22
- package/github-pages/plugin.json +3 -3
- package/github-pages/targets/github-pages.mjs +3 -3
- package/google-login/plugin.json +3 -3
- package/google-workspace/README.md +14 -14
- package/google-workspace/form-destinations/README.md +3 -3
- package/google-workspace/form-destinations/dedupe.mjs +1 -1
- package/google-workspace/form-destinations/mapping.mjs +8 -9
- package/google-workspace/form-destinations/sheets.mjs +1 -1
- package/google-workspace/{tovu-admin-surfaces.json → jini-admin-surfaces.json} +2 -2
- package/google-workspace/{tovu-agent-tools.json → jini-agent-tools.json} +28 -28
- package/google-workspace/{tovu-connections.json → jini-connections.json} +2 -2
- package/google-workspace/lib/auth.mjs +2 -2
- package/google-workspace/lib/form-destination-settings.mjs +1 -1
- package/google-workspace/lib/picker-flow.mjs +2 -2
- package/google-workspace/lib/request-policy.mjs +1 -1
- package/google-workspace/lib/surface-actions.mjs +1 -1
- package/google-workspace/plugin.json +3 -3
- package/google-workspace/tools/sheets/README.md +3 -3
- package/google-workspace/tools/sheets-admin/README.md +3 -3
- package/google-workspace/ui/README.md +4 -4
- package/google-workspace/ui/connection-panel.mjs +51 -51
- package/google-workspace/ui/destination-panel.mjs +34 -34
- package/google-workspace/ui/dom.mjs +15 -16
- package/google-workspace/ui/picker-flow.mjs +2 -2
- package/google-workspace/ui/picker.mjs +19 -19
- package/google-workspace/ui/surface-client.mjs +96 -69
- package/higgsfield-media/plugin.json +3 -3
- package/jev/plugin.json +3 -3
- package/kuinetic/CHANGELOG.md +12 -0
- package/kuinetic/mcp.json +4 -0
- package/kuinetic/plugin.json +27 -0
- package/kuinetic/skills/kuinetic/SKILL.md +120 -0
- package/kuinetic/skills/kuinetic/references/effects-by-family.md +32 -0
- package/kuinetic/skills/kuinetic/references/opt-in-tiers.md +12 -0
- package/kuinetic/skills/kuinetic/references/reserved-keys.md +36 -0
- package/meilisearch/plugin.json +5 -5
- package/netlify/plugin.json +3 -3
- package/netlify/targets/netlify.mjs +14 -4
- package/opentelemetry/plugin.json +3 -3
- package/package.json +27 -22
- package/posthog/plugin.json +3 -3
- package/railway/plugin.json +3 -3
- package/render/plugin.json +3 -3
- package/resend/NOTES.md +2 -2
- package/resend/adapters/resend.mjs +1 -1
- package/resend/{tovu-mail-adapters.json → jini-mail-adapters.json} +1 -1
- package/resend/lib/domains.mjs +8 -8
- package/resend/plugin.json +3 -3
- package/s3-compatible/{tovu-deploy-targets.json → jini-deploy-targets.json} +68 -68
- package/s3-compatible/jini-object-stores.json +29 -0
- package/s3-compatible/object-stores/s3-compatible.mjs +19 -13
- package/s3-compatible/plugin.json +3 -3
- package/s3-compatible/targets/s3-compatible.mjs +25 -25
- package/sentry/plugin.json +3 -3
- package/shadcn-ui/CHANGELOG.md +7 -0
- package/shadcn-ui/LICENSE +201 -0
- package/shadcn-ui/NOTICE +10 -0
- package/shadcn-ui/mcp.json +4 -0
- package/shadcn-ui/plugin.json +26 -0
- package/shopify/plugin.json +3 -3
- package/site-compliance/plugin.json +3 -3
- package/site-import/plugin.json +3 -3
- package/supabase/mcp.json +1 -4
- package/supabase/plugin.json +3 -3
- package/ui-ux-design/CHANGELOG.md +13 -0
- package/ui-ux-design/NOTICE +2 -0
- package/ui-ux-design/README.md +17 -7
- package/ui-ux-design/plugin.json +6 -3
- package/ui-ux-design/skills/ui-ux-design/SKILL.md +38 -152
- package/ui-ux-design/skills/ui-ux-design/references/full-workflow.md +156 -0
- package/ui-ux-design/skills/ui-ux-design/references/ui-animation.md +4 -4
- package/vercel/NOTES.md +1 -1
- package/vercel/object-stores/vercel-blob.mjs +12 -2
- package/vercel/plugin.json +3 -3
- package/vercel/targets/vercel.mjs +3 -3
- package/wordpress/plugin.json +3 -3
- package/dist/lifecycle/node.d.ts +0 -11
- package/dist/lifecycle/node.js +0 -38
- package/fly/tovu-credential-schemes.json +0 -11
- package/github/deployments/github.mjs +0 -415
- package/s3-compatible/tovu-object-stores.json +0 -29
- package/ui-ux-design/skills/ui-ux-design/references/kuinetic-reference.md +0 -184
- /package/cloudflare/{tovu-consent.json → jini-consent.json} +0 -0
- /package/cloudflare/{tovu-deploy-targets.json → jini-deploy-targets.json} +0 -0
- /package/cloudflare/{tovu-form-destinations.json → jini-form-destinations.json} +0 -0
- /package/fly/{tovu-deploy-configs.json → jini-deploy-configs.json} +0 -0
- /package/fly/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
- /package/github/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
- /package/github/{tovu-source-control.json → jini-source-control.json} +0 -0
- /package/google-login/{tovu-login-providers.json → jini-login-providers.json} +0 -0
- /package/google-workspace/{tovu-form-destinations.json → jini-form-destinations.json} +0 -0
- /package/meilisearch/{tovu-search-providers.json → jini-search-providers.json} +0 -0
- /package/netlify/{tovu-consent.json → jini-consent.json} +0 -0
- /package/netlify/{tovu-deploy-targets.json → jini-deploy-targets.json} +0 -0
- /package/railway/{tovu-deploy-configs.json → jini-deploy-configs.json} +0 -0
- /package/railway/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
- /package/render/{tovu-deploy-configs.json → jini-deploy-configs.json} +0 -0
- /package/render/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/README.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/SKILL.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/examples/auth-layout.tsx +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/examples/data-table.tsx +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/examples/form-pattern.tsx +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/component-catalog.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/customization-guide.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/migration-guide.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/setup-guide.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/scripts/verify-setup.sh +0 -0
- /package/vercel/{tovu-consent.json → jini-consent.json} +0 -0
- /package/vercel/{tovu-deploy-targets.json → jini-deploy-targets.json} +0 -0
- /package/vercel/{tovu-object-stores.json → jini-object-stores.json} +0 -0
|
@@ -31,7 +31,7 @@ async function step(work) {
|
|
|
31
31
|
try {
|
|
32
32
|
await work();
|
|
33
33
|
} catch (error) {
|
|
34
|
-
status = failureText(error);
|
|
34
|
+
status = failureText({ error });
|
|
35
35
|
statusTone = 'error';
|
|
36
36
|
statusRetry = error?.retryable === true ? () => step(work) : undefined;
|
|
37
37
|
}
|
|
@@ -45,44 +45,44 @@ async function useSpreadsheet(spreadsheetId) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function savedList() {
|
|
48
|
-
if (view.destinations.length === 0) return h('p', { class: 'muted empty' }, ['No form sends to Google Sheets yet.']);
|
|
49
|
-
return h('ul', { class: 'rows' }, view.destinations.map((entry) => h('li', { class: 'card destination' }, [
|
|
50
|
-
h('p', {}, [h('strong', {}, [entry.formSlug]), ` → ${entry.title} / ${entry.tabTitle}`]),
|
|
51
|
-
entry.sameAccount === false ? h('p', { class: 'notice warn' }, ['Chosen with a different Google account than the one connected now. Choose its spreadsheet again.']) : null,
|
|
52
|
-
h('div', { class: 'actions' }, [h('button', { type: 'button', class: 'small', onClick: () => step(async () => { view = await call('remove-destination', { formSlug: entry.formSlug }); status = `Removed ${entry.formSlug}. ${EXTERNAL_ROWS_NOTE}`; statusTone = 'ok'; }) }, ['Remove'])]),
|
|
53
|
-
])));
|
|
48
|
+
if (view.destinations.length === 0) return h({ tag: 'p' }, { props: { class: 'muted empty' }, children: ['No form sends to Google Sheets yet.'] });
|
|
49
|
+
return h({ tag: 'ul' }, { props: { class: 'rows' }, children: view.destinations.map((entry) => h({ tag: 'li' }, { props: { class: 'card destination' }, children: [
|
|
50
|
+
h({ tag: 'p' }, { props: {}, children: [h({ tag: 'strong' }, { props: {}, children: [entry.formSlug] }), ` → ${entry.title} / ${entry.tabTitle}`] }),
|
|
51
|
+
entry.sameAccount === false ? h({ tag: 'p' }, { props: { class: 'notice warn' }, children: ['Chosen with a different Google account than the one connected now. Choose its spreadsheet again.'] }) : null,
|
|
52
|
+
h({ tag: 'div' }, { props: { class: 'actions' }, children: [h({ tag: 'button' }, { props: { type: 'button', class: 'small', onClick: () => step(async () => { view = await call('remove-destination', { formSlug: entry.formSlug }); status = `Removed ${entry.formSlug}. ${EXTERNAL_ROWS_NOTE}`; statusTone = 'ok'; }) }, children: ['Remove'] })] }),
|
|
53
|
+
] })) });
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
function spreadsheetChooser() {
|
|
57
|
-
const options = view.picked.map((sheet) => h('option', { value: sheet.spreadsheetId, ...(draft.spreadsheet?.spreadsheetId === sheet.spreadsheetId ? { selected: true } : {}) }, [sheet.title]));
|
|
58
|
-
return h('div', { class: 'field-stack' }, [
|
|
59
|
-
view.picked.length > 0 ? h('label', {}, ['Spreadsheet', h('select', { onChange: (event) => step(() => useSpreadsheet(event.target.value)) }, [h('option', { value: '' }, ['Choose…']), ...options])]) : null,
|
|
57
|
+
const options = view.picked.map((sheet) => h({ tag: 'option' }, { props: { value: sheet.spreadsheetId, ...(draft.spreadsheet?.spreadsheetId === sheet.spreadsheetId ? { selected: true } : {}) }, children: [sheet.title] }));
|
|
58
|
+
return h({ tag: 'div' }, { props: { class: 'field-stack' }, children: [
|
|
59
|
+
view.picked.length > 0 ? h({ tag: 'label' }, { props: {}, children: ['Spreadsheet', h({ tag: 'select' }, { props: { onChange: (event) => step(() => useSpreadsheet(event.target.value)) }, children: [h({ tag: 'option' }, { props: { value: '' }, children: ['Choose…'] }), ...options] })] }) : null,
|
|
60
60
|
// Same rule as the Picker panel: no start data (or an unavailable mode) means nothing to open.
|
|
61
|
-
bootstrap !== undefined && bootstrap.mode !== 'unavailable' ? h('button', { type: 'button', onClick: () => step(async () => {
|
|
61
|
+
bootstrap !== undefined && bootstrap.mode !== 'unavailable' ? h({ tag: 'button' }, { props: { type: 'button', onClick: () => step(async () => {
|
|
62
62
|
const chosen = await chooseSpreadsheet({ client, bootstrap, onStatus: (text) => { status = text; render(); } });
|
|
63
63
|
if (chosen === null) { status = CANCELLED_TEXT; return; }
|
|
64
64
|
status = '';
|
|
65
65
|
await useSpreadsheet(chosen.spreadsheetId);
|
|
66
66
|
view = await call('list-destinations');
|
|
67
|
-
}) }, ['Choose another spreadsheet']) : null,
|
|
68
|
-
]);
|
|
67
|
+
}) }, children: ['Choose another spreadsheet'] }) : null,
|
|
68
|
+
] });
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
function tabChooser() {
|
|
72
72
|
if (draft.spreadsheet === null) return null;
|
|
73
|
-
return h('label', {}, ['Tab', h('select', { onChange: (event) => { draft.sheetId = Number(event.target.value); } },
|
|
74
|
-
draft.tabs.map((tab) => h('option', { value: String(tab.sheetId), ...(tab.sheetId === draft.sheetId ? { selected: true } : {}) }, [tab.title])))]);
|
|
73
|
+
return h({ tag: 'label' }, { props: {}, children: ['Tab', h({ tag: 'select' }, { props: { onChange: (event) => { draft.sheetId = Number(event.target.value); } },
|
|
74
|
+
children: draft.tabs.map((tab) => h({ tag: 'option' }, { props: { value: String(tab.sheetId), ...(tab.sheetId === draft.sheetId ? { selected: true } : {}) }, children: [tab.title] })) })] });
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/** Site choices use their stable slug as the value and their title as plain text. An empty list
|
|
78
78
|
* still means discovery is supported; typing is only for hosts that lack the capability.
|
|
79
79
|
* @complexity O(f) for the host's at most 200 choices. */
|
|
80
80
|
function formChooser() {
|
|
81
|
-
if (view.forms === undefined) return h('label', {}, ['Form short name', h('input', { type: 'text', value: draft.formSlug, maxlength: '64', autocomplete: 'off', onInput: (event) => { draft.formSlug = event.target.value.trim(); } })]);
|
|
82
|
-
return h('label', {}, ['Form', h('select', { name: 'formSlug', ...(view.forms.length === 0 ? { disabled: true } : {}), onChange: (event) => { draft.formSlug = event.target.value; } }, [
|
|
83
|
-
h('option', { value: '' }, [view.forms.length === 0 ? 'No forms available' : 'Choose a form…']),
|
|
84
|
-
...view.forms.map((form) => h('option', { value: form.slug, ...(draft.formSlug === form.slug ? { selected: true } : {}) }, [form.title])),
|
|
85
|
-
])]);
|
|
81
|
+
if (view.forms === undefined) return h({ tag: 'label' }, { props: {}, children: ['Form short name', h({ tag: 'input' }, { props: { type: 'text', value: draft.formSlug, maxlength: '64', autocomplete: 'off', onInput: (event) => { draft.formSlug = event.target.value.trim(); } } })] });
|
|
82
|
+
return h({ tag: 'label' }, { props: {}, children: ['Form', h({ tag: 'select' }, { props: { name: 'formSlug', ...(view.forms.length === 0 ? { disabled: true } : {}), onChange: (event) => { draft.formSlug = event.target.value; } }, children: [
|
|
83
|
+
h({ tag: 'option' }, { props: { value: '' }, children: [view.forms.length === 0 ? 'No forms available' : 'Choose a form…'] }),
|
|
84
|
+
...view.forms.map((form) => h({ tag: 'option' }, { props: { value: form.slug, ...(draft.formSlug === form.slug ? { selected: true } : {}) }, children: [form.title] })),
|
|
85
|
+
] })] });
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/** What the person still has to fill in before a save can work, or null. @complexity O(f), at most 200 form choices. */
|
|
@@ -96,16 +96,16 @@ function missingForSave() {
|
|
|
96
96
|
|
|
97
97
|
function editor() {
|
|
98
98
|
const ready = bootstrap !== undefined && bootstrap.mode !== 'unavailable';
|
|
99
|
-
return h('section', { class: 'card', 'aria-labelledby': 'add-heading' }, [
|
|
100
|
-
h('div', { class: 'head' }, [
|
|
101
|
-
h('h2', { id: 'add-heading' }, ['Send a form to a spreadsheet']),
|
|
102
|
-
ready ? tip('About choosing a spreadsheet', pickerIntro({ bootstrap }), { bodyClass: 'intro' }) : null,
|
|
103
|
-
]),
|
|
99
|
+
return h({ tag: 'section' }, { props: { class: 'card', 'aria-labelledby': 'add-heading' }, children: [
|
|
100
|
+
h({ tag: 'div' }, { props: { class: 'head' }, children: [
|
|
101
|
+
h({ tag: 'h2' }, { props: { id: 'add-heading' }, children: ['Send a form to a spreadsheet'] }),
|
|
102
|
+
ready ? tip({ label: 'About choosing a spreadsheet', text: pickerIntro({ bootstrap }) }, { bodyClass: 'intro' }) : null,
|
|
103
|
+
] }),
|
|
104
104
|
formChooser(),
|
|
105
105
|
spreadsheetChooser(),
|
|
106
106
|
tabChooser(),
|
|
107
|
-
h('label', { class: 'check confirm-rows' }, [h('input', { type: 'checkbox', ...(draft.confirmed ? { checked: true } : {}), onChange: (event) => { draft.confirmed = event.target.checked; } }), EXTERNAL_ROWS_NOTE]),
|
|
108
|
-
h('div', { class: 'actions' }, [h('button', { type: 'button', class: 'primary', onClick: () => step(async () => {
|
|
107
|
+
h({ tag: 'label' }, { props: { class: 'check confirm-rows' }, children: [h({ tag: 'input' }, { props: { type: 'checkbox', ...(draft.confirmed ? { checked: true } : {}), onChange: (event) => { draft.confirmed = event.target.checked; } } }), EXTERNAL_ROWS_NOTE] }),
|
|
108
|
+
h({ tag: 'div' }, { props: { class: 'actions' }, children: [h({ tag: 'button' }, { props: { type: 'button', class: 'primary', onClick: () => step(async () => {
|
|
109
109
|
// Checked here first so the person reads what is missing, not the host's schema refusal.
|
|
110
110
|
const missing = missingForSave();
|
|
111
111
|
if (missing !== null) { status = missing; statusTone = 'error'; return; }
|
|
@@ -114,20 +114,20 @@ function editor() {
|
|
|
114
114
|
// spreadsheetId (minLength 1), and that id is non-empty only once `draft.spreadsheet` is set.
|
|
115
115
|
status = `Saved: ${draft.formSlug} sends to ${draft.spreadsheet.title}.`;
|
|
116
116
|
statusTone = 'ok';
|
|
117
|
-
}) }, ['Save destination'])]),
|
|
118
|
-
]);
|
|
117
|
+
}) }, children: ['Save destination'] })] }),
|
|
118
|
+
] });
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function render() {
|
|
122
122
|
// Not ready (no start data, Sheets off, not connected): the reason is the visible notice.
|
|
123
123
|
const ready = bootstrap !== undefined && bootstrap.mode !== 'unavailable';
|
|
124
|
-
show(app,
|
|
125
|
-
ready ? null : h('p', { class: 'notice warn intro' }, [pickerIntro({ bootstrap })]),
|
|
124
|
+
show({ root: app },
|
|
125
|
+
{ nodes: [ready ? null : h({ tag: 'p' }, { props: { class: 'notice warn intro' }, children: [pickerIntro({ bootstrap })] }),
|
|
126
126
|
status ? notice({ text: status, tone: statusTone, retry: statusRetry }) : null,
|
|
127
127
|
...(view === undefined ? [] : [
|
|
128
|
-
h('section', { class: 'card', 'aria-labelledby': 'saved-heading' }, [h('h2', { id: 'saved-heading' }, ['Saved destinations']), savedList()]),
|
|
128
|
+
h({ tag: 'section' }, { props: { class: 'card', 'aria-labelledby': 'saved-heading' }, children: [h({ tag: 'h2' }, { props: { id: 'saved-heading' }, children: ['Saved destinations'] }), savedList()] }),
|
|
129
129
|
editor(),
|
|
130
|
-
]));
|
|
130
|
+
])] });
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
/**
|
|
@@ -136,7 +136,7 @@ function render() {
|
|
|
136
136
|
* last line starts the real one.
|
|
137
137
|
* @param {{ window: Window, document: Document }} required
|
|
138
138
|
*/
|
|
139
|
-
export function initDestinationPanel(required) {
|
|
139
|
+
export function initDestinationPanel(required, _optional = {}) {
|
|
140
140
|
client = connectToHost({ window: required.window });
|
|
141
141
|
app = required.document.getElementById('app');
|
|
142
142
|
draft = { formSlug: '', spreadsheet: null, tabs: [], sheetId: null, confirmed: false };
|
|
@@ -13,7 +13,7 @@ import { createAdminSurfaceClient } from './surface-client.mjs';
|
|
|
13
13
|
* and applies the admin's design tokens to this frame's root so `panel.css` matches the admin.
|
|
14
14
|
* @param {{ window: Window }} required - the frame's window (a test passes its own jsdom window).
|
|
15
15
|
*/
|
|
16
|
-
export function connectToHost(required) {
|
|
16
|
+
export function connectToHost(required, _optional = {}) {
|
|
17
17
|
const { window: frame } = required;
|
|
18
18
|
closeTipsOnOutsideClick(frame.document);
|
|
19
19
|
return createAdminSurfaceClient({
|
|
@@ -29,7 +29,7 @@ export function connectToHost(required) {
|
|
|
29
29
|
* @param {Array<Node | string | null | undefined>} [children]
|
|
30
30
|
* @returns {HTMLElement}
|
|
31
31
|
*/
|
|
32
|
-
export function h(tag, props = {}, children = []) {
|
|
32
|
+
export function h({ tag }, { props = {}, children = [] } = {}) {
|
|
33
33
|
const element = document.createElement(tag);
|
|
34
34
|
for (const [name, value] of Object.entries(props)) {
|
|
35
35
|
if (typeof value === 'function') element.addEventListener(name.slice(2).toLowerCase(), value);
|
|
@@ -49,11 +49,10 @@ let nextTip = 0;
|
|
|
49
49
|
* An "i" toggletip: the explanation shows on hover, keyboard focus or tap, instead of a paragraph
|
|
50
50
|
* on screen. The trigger is a focusable span (not a `<button>`), so the panels' button lists stay
|
|
51
51
|
* their actions only; its text stays in the DOM and is the trigger's accessible description.
|
|
52
|
-
* @param {string}
|
|
53
|
-
* @param {string} text
|
|
52
|
+
* @param {{ label: string, text: string }} required - what the explanation is about ("About Products") and its text.
|
|
54
53
|
* @param {{ bodyClass?: string }} [optional] - an extra class on the explanation (e.g. `intro`).
|
|
55
54
|
*/
|
|
56
|
-
export function tip(label, text, optional = {}) {
|
|
55
|
+
export function tip({ label, text }, optional = {}) {
|
|
57
56
|
nextTip += 1;
|
|
58
57
|
const id = `tip-${nextTip}`;
|
|
59
58
|
const toggle = (event) => {
|
|
@@ -64,10 +63,10 @@ export function tip(label, text, optional = {}) {
|
|
|
64
63
|
wrapper.classList.toggle('open', open);
|
|
65
64
|
event.currentTarget.setAttribute('aria-expanded', String(open));
|
|
66
65
|
};
|
|
67
|
-
return h('span', { class: 'tip' }, [
|
|
68
|
-
h('span', { class: 'tip-icon', role: 'button', tabindex: '0', 'aria-label': label, 'aria-describedby': id, 'aria-expanded': 'false', onClick: toggle, onKeydown: toggle }, ['i']),
|
|
69
|
-
h('span', { class: optional.bodyClass ? `tip-body ${optional.bodyClass}` : 'tip-body', role: 'tooltip', id }, [text]),
|
|
70
|
-
]);
|
|
66
|
+
return h({ tag: 'span' }, { props: { class: 'tip' }, children: [
|
|
67
|
+
h({ tag: 'span' }, { props: { class: 'tip-icon', role: 'button', tabindex: '0', 'aria-label': label, 'aria-describedby': id, 'aria-expanded': 'false', onClick: toggle, onKeydown: toggle }, children: ['i'] }),
|
|
68
|
+
h({ tag: 'span' }, { props: { class: optional.bodyClass ? `tip-body ${optional.bodyClass}` : 'tip-body', role: 'tooltip', id }, children: [text] }),
|
|
69
|
+
] });
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
/** Taps elsewhere close an open toggletip (once per document). */
|
|
@@ -86,11 +85,11 @@ function closeTipsOnOutsideClick(doc) {
|
|
|
86
85
|
* `retry`, a "Try again" button sits inside the same box (outside the `.notice` text).
|
|
87
86
|
* @param {{ text: string, tone?: string, retry?: () => void }} required
|
|
88
87
|
*/
|
|
89
|
-
export function notice(required) {
|
|
88
|
+
export function notice(required, _optional = {}) {
|
|
90
89
|
const { text, tone = 'error', retry } = required;
|
|
91
|
-
const line = h('p', { class: tone === 'error' ? 'notice' : `notice ${tone}`, role: 'status' }, [text]);
|
|
90
|
+
const line = h({ tag: 'p' }, { props: { class: tone === 'error' ? 'notice' : `notice ${tone}`, role: 'status' }, children: [text] });
|
|
92
91
|
if (!retry) return line;
|
|
93
|
-
return h('div', { class: `notice-group ${tone}` }, [line, h('button', { type: 'button', class: 'small', onClick: retry }, ['Try again'])]);
|
|
92
|
+
return h({ tag: 'div' }, { props: { class: `notice-group ${tone}` }, children: [line, h({ tag: 'button' }, { props: { type: 'button', class: 'small', onClick: retry }, children: ['Try again'] })] });
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
const FOCUSABLE = 'button:not([disabled]), input:not([disabled]), select:not([disabled]), a[href], [tabindex="0"]';
|
|
@@ -110,7 +109,7 @@ function matchesFocusKey({ control, key }, _options = {}) {
|
|
|
110
109
|
* Replaces a region's content, keeping keyboard focus where the person was: on the same control
|
|
111
110
|
* when it is still there, else on the first control of the new content (never lost to `<body>`).
|
|
112
111
|
*/
|
|
113
|
-
export function show(root,
|
|
112
|
+
export function show({ root }, { nodes = [] } = {}) {
|
|
114
113
|
const key = focusKey(root.ownerDocument.activeElement, root) ?? root.pendingFocus ?? null;
|
|
115
114
|
root.pendingFocus = null;
|
|
116
115
|
root.replaceChildren(...nodes.filter(Boolean));
|
|
@@ -121,14 +120,14 @@ export function show(root, ...nodes) {
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
/** The sentence to show for a failed call: the host's or plugin's fixed message. */
|
|
124
|
-
export function failureText(error) {
|
|
123
|
+
export function failureText({ error }, _optional = {}) {
|
|
125
124
|
// The host's schema check names JSON paths ("$.spreadsheetId has the wrong length"): developer text.
|
|
126
125
|
if (error?.code === 'invalid-payload') return 'Some details are missing or not valid. Check them and try again.';
|
|
127
126
|
return typeof error?.message === 'string' && error.message ? error.message : 'Something went wrong. Try again.';
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
/** Runs `work` with every button in `root` disabled, so one click sends one request. */
|
|
131
|
-
export async function busy(root, work) {
|
|
130
|
+
export async function busy({ root, work }, _optional = {}) {
|
|
132
131
|
// Disabling the focused button drops focus to <body>; `show` restores it from here.
|
|
133
132
|
root.pendingFocus = focusKey(root.ownerDocument.activeElement, root);
|
|
134
133
|
const buttons = [...root.querySelectorAll('button')];
|
|
@@ -137,4 +136,4 @@ export async function busy(root, work) {
|
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
/** Resolves after `ms` (the desktop Picker and sign-in polls). */
|
|
140
|
-
export const wait = (ms) => new Promise((resolve) => { setTimeout(resolve, ms); });
|
|
139
|
+
export const wait = ({ ms }, _optional = {}) => new Promise((resolve) => { setTimeout(resolve, ms); });
|
|
@@ -67,7 +67,7 @@ async function chooseInSystemBrowser({ client, onStatus, stopped }) {
|
|
|
67
67
|
const { expiresAt } = await client.call({ action: 'start-system-picker', payload: {} });
|
|
68
68
|
onStatus(pollText({ status: 'waiting' }));
|
|
69
69
|
while (!stopped() && Date.now() < Date.parse(expiresAt) + POLL_MS) {
|
|
70
|
-
await wait(POLL_MS);
|
|
70
|
+
await wait({ ms: POLL_MS });
|
|
71
71
|
const outcome = await client.call({ action: 'finish-system-picker', payload: {} });
|
|
72
72
|
if (outcome.status === 'selected') return outcome.spreadsheet;
|
|
73
73
|
if (outcome.status !== 'waiting') { onStatus(pollText(outcome)); return null; }
|
|
@@ -81,7 +81,7 @@ async function chooseInSystemBrowser({ client, onStatus, stopped }) {
|
|
|
81
81
|
* @param {{ client: { call: Function }, bootstrap: { mode: string, picker?: object }, onStatus: (text: string) => void, stopped?: () => boolean }} required
|
|
82
82
|
* @returns {Promise<{ spreadsheetId: string, title: string, url: string } | null>} null = nothing chosen, nothing saved.
|
|
83
83
|
*/
|
|
84
|
-
export function chooseSpreadsheet(required) {
|
|
84
|
+
export function chooseSpreadsheet(required, _optional = {}) {
|
|
85
85
|
const { client, bootstrap, onStatus, stopped = () => false } = required;
|
|
86
86
|
return bootstrap.mode === 'hosted' ? chooseHosted({ client, bootstrap }) : chooseInSystemBrowser({ client, onStatus, stopped });
|
|
87
87
|
}
|
|
@@ -20,22 +20,22 @@ function render(bootstrap) {
|
|
|
20
20
|
const ready = bootstrap !== undefined && bootstrap.mode !== 'unavailable';
|
|
21
21
|
// Ready: the intro is the heading's explanation and Choose sits in the header; otherwise the
|
|
22
22
|
// reason it is unavailable is the visible notice.
|
|
23
|
-
show(app,
|
|
24
|
-
ready ? null : h('p', { class: 'notice warn intro' }, [pickerIntro({ bootstrap })]),
|
|
23
|
+
show({ root: app },
|
|
24
|
+
{ nodes: [ready ? null : h({ tag: 'p' }, { props: { class: 'notice warn intro' }, children: [pickerIntro({ bootstrap })] }),
|
|
25
25
|
status ? notice({ text: status, tone: statusTone }) : null,
|
|
26
|
-
h('section', { class: 'card', 'aria-labelledby': 'picked-heading' }, [
|
|
27
|
-
h('div', { class: 'head' }, [
|
|
28
|
-
h('h2', { id: 'picked-heading' }, ['Chosen spreadsheets']),
|
|
29
|
-
ready ? tip('About choosing a spreadsheet', pickerIntro({ bootstrap }), { bodyClass: 'intro' }) : null,
|
|
30
|
-
ready ? h('div', { class: 'actions end' }, [
|
|
31
|
-
h('button', { type: 'button', class: 'primary', disabled: waiting, onClick: () => choose(bootstrap) }, ['Choose spreadsheet']),
|
|
32
|
-
waiting && bootstrap.mode === 'system-browser' ? h('button', { type: 'button', onClick: () => { stopRequested = true; status = 'Stopping…'; render(bootstrap); } }, ['Stop waiting']) : null,
|
|
33
|
-
]) : null,
|
|
34
|
-
]),
|
|
35
|
-
picked.length === 0 ? h('p', { class: 'muted empty' }, ['None yet.']) : h('ul', { class: 'rows' }, picked.map((sheet) => h('li', { class: 'sheet' }, [
|
|
36
|
-
h('strong', {}, [sheet.title]), ' ', h('code', {}, [sheet.spreadsheetId]),
|
|
37
|
-
]))),
|
|
38
|
-
]));
|
|
26
|
+
h({ tag: 'section' }, { props: { class: 'card', 'aria-labelledby': 'picked-heading' }, children: [
|
|
27
|
+
h({ tag: 'div' }, { props: { class: 'head' }, children: [
|
|
28
|
+
h({ tag: 'h2' }, { props: { id: 'picked-heading' }, children: ['Chosen spreadsheets'] }),
|
|
29
|
+
ready ? tip({ label: 'About choosing a spreadsheet', text: pickerIntro({ bootstrap }) }, { bodyClass: 'intro' }) : null,
|
|
30
|
+
ready ? h({ tag: 'div' }, { props: { class: 'actions end' }, children: [
|
|
31
|
+
h({ tag: 'button' }, { props: { type: 'button', class: 'primary', disabled: waiting, onClick: () => choose(bootstrap) }, children: ['Choose spreadsheet'] }),
|
|
32
|
+
waiting && bootstrap.mode === 'system-browser' ? h({ tag: 'button' }, { props: { type: 'button', onClick: () => { stopRequested = true; status = 'Stopping…'; render(bootstrap); } }, children: ['Stop waiting'] }) : null,
|
|
33
|
+
] }) : null,
|
|
34
|
+
] }),
|
|
35
|
+
picked.length === 0 ? h({ tag: 'p' }, { props: { class: 'muted empty' }, children: ['None yet.'] }) : h({ tag: 'ul' }, { props: { class: 'rows' }, children: picked.map((sheet) => h({ tag: 'li' }, { props: { class: 'sheet' }, children: [
|
|
36
|
+
h({ tag: 'strong' }, { props: {}, children: [sheet.title] }), ' ', h({ tag: 'code' }, { props: {}, children: [sheet.spreadsheetId] }),
|
|
37
|
+
] })) }),
|
|
38
|
+
] })] });
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
async function refresh(bootstrap) {
|
|
@@ -55,12 +55,12 @@ async function choose(bootstrap) {
|
|
|
55
55
|
if (chosen) status = selectedText({ spreadsheet: chosen });
|
|
56
56
|
else status ||= CANCELLED_TEXT;
|
|
57
57
|
} catch (error) {
|
|
58
|
-
status = failureText(error);
|
|
58
|
+
status = failureText({ error });
|
|
59
59
|
statusTone = 'error';
|
|
60
60
|
}
|
|
61
61
|
waiting = false;
|
|
62
62
|
// A failed refresh must still re-render: the last render showed Choose disabled (waiting).
|
|
63
|
-
await refresh(bootstrap).catch((error) => { status = failureText(error); statusTone = 'error'; render(bootstrap); });
|
|
63
|
+
await refresh(bootstrap).catch((error) => { status = failureText({ error }); statusTone = 'error'; render(bootstrap); });
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -69,7 +69,7 @@ async function choose(bootstrap) {
|
|
|
69
69
|
* last line starts the real one.
|
|
70
70
|
* @param {{ window: Window, document: Document }} required
|
|
71
71
|
*/
|
|
72
|
-
export function initPickerPanel(required) {
|
|
72
|
+
export function initPickerPanel(required, _optional = {}) {
|
|
73
73
|
client = connectToHost({ window: required.window });
|
|
74
74
|
app = required.document.getElementById('app');
|
|
75
75
|
status = '';
|
|
@@ -82,7 +82,7 @@ export function initPickerPanel(required) {
|
|
|
82
82
|
|
|
83
83
|
/** The first list; a failure the host calls retryable offers "Try again" (another list). */
|
|
84
84
|
function load() {
|
|
85
|
-
return refresh(client.bootstrap()).catch((error) => show(app, notice({ text: failureText(error), retry: error?.retryable === true ? load : undefined })));
|
|
85
|
+
return refresh(client.bootstrap()).catch((error) => show({ root: app }, { nodes: [notice({ text: failureText({ error }), retry: error?.retryable === true ? load : undefined })] }));
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
initPickerPanel({ window, document });
|
|
@@ -96,33 +96,8 @@ function documentSize() {
|
|
|
96
96
|
function isWellFormedResponse(message) {
|
|
97
97
|
return message.ok === true ? Object.hasOwn(message, 'result') : message.ok === false && isFailure(message.error);
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
* Connects a surface to its host. In a browser:
|
|
101
|
-
* `createAdminSurfaceClient({ parent: window.parent, listen: (h) => { addEventListener('message', h); return () => removeEventListener('message', h); } })`.
|
|
102
|
-
* @param optional.timeoutMs - How long `call` waits for a response before rejecting with `timeout`.
|
|
103
|
-
* @complexity O(1) per message.
|
|
104
|
-
*/
|
|
105
|
-
export function createAdminSurfaceClient(required, optional = {}) {
|
|
106
|
-
const timeoutMs = optional.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
107
|
-
const nowMs = optional.nowMs ?? Date.now;
|
|
108
|
-
const pending = new Map();
|
|
109
|
-
let init;
|
|
110
|
-
let nextRequest = 0;
|
|
111
|
-
// The Promise executor runs synchronously, so `resolveReady` is assigned before anything can call it.
|
|
112
|
-
let resolveReady;
|
|
113
|
-
const ready = new Promise((resolve) => { resolveReady = resolve; });
|
|
114
|
-
const themeRoot = optional.themeRoot === undefined ? documentRoot() : optional.themeRoot;
|
|
99
|
+
function createSurfaceTheme(themeRoot) {
|
|
115
100
|
let currentTheme;
|
|
116
|
-
const size = optional.size === undefined ? documentSize() : optional.size;
|
|
117
|
-
let stopSize;
|
|
118
|
-
let lastHeight = -1;
|
|
119
|
-
/** Tells the host this surface's height (only when it changed), so the frame fits its content. */
|
|
120
|
-
function reportHeight(height) {
|
|
121
|
-
if (init === undefined || !Number.isFinite(height) || height === lastHeight)
|
|
122
|
-
return;
|
|
123
|
-
lastHeight = height;
|
|
124
|
-
required.parent.postMessage({ protocol: PROTOCOL, version: VERSION, kind: 'resize', mountId: init.mountId, height }, init.origin);
|
|
125
|
-
}
|
|
126
101
|
/** Replaces the applied tokens: a token the new theme no longer sends falls back to the surface's CSS. */
|
|
127
102
|
function applyTheme(value) {
|
|
128
103
|
const next = acceptedTheme(value);
|
|
@@ -139,15 +114,16 @@ export function createAdminSurfaceClient(required, optional = {}) {
|
|
|
139
114
|
}
|
|
140
115
|
currentTheme = next;
|
|
141
116
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
init = { mountId: data.mountId, origin: event.origin, bootstrap: data.bootstrap };
|
|
146
|
-
applyTheme(data.theme);
|
|
147
|
-
stopSize = size?.(reportHeight);
|
|
148
|
-
resolveReady();
|
|
117
|
+
/** The host's theme as applied, or `undefined` when the host sent none. */
|
|
118
|
+
function theme() {
|
|
119
|
+
return currentTheme;
|
|
149
120
|
}
|
|
150
|
-
|
|
121
|
+
return { applyTheme, theme };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function createSurfaceResponseReceiver(pending, current) {
|
|
125
|
+
return function onResponse(event, data) {
|
|
126
|
+
const init = current();
|
|
151
127
|
if (event.origin !== init?.origin || data.mountId !== init.mountId || typeof data.requestId !== 'string')
|
|
152
128
|
return;
|
|
153
129
|
const waiting = pending.get(data.requestId);
|
|
@@ -160,26 +136,15 @@ export function createAdminSurfaceClient(required, optional = {}) {
|
|
|
160
136
|
else
|
|
161
137
|
waiting.reject(new AdminSurfaceCallError(data.error));
|
|
162
138
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
onInit(event, event.data);
|
|
168
|
-
else if (isMessage(event.data, 'theme')) {
|
|
169
|
-
if (event.origin === init?.origin && event.data.mountId === init.mountId)
|
|
170
|
-
applyTheme(event.data.theme);
|
|
171
|
-
}
|
|
172
|
-
else if (isMessage(event.data, 'action-response'))
|
|
173
|
-
onResponse(event, event.data);
|
|
174
|
-
else {
|
|
175
|
-
// Ignore message kinds outside the admin-surface protocol.
|
|
176
|
-
}
|
|
177
|
-
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function createSurfaceSender(required, { pending, ready, timeoutMs }, current) {
|
|
142
|
+
let nextRequest = 0;
|
|
178
143
|
/** Posts one request of `kind` to the host origin and waits for its `action-response`. */
|
|
179
|
-
async function send(kind, fields) {
|
|
180
|
-
if (
|
|
144
|
+
return async function send(kind, fields) {
|
|
145
|
+
if (current() === undefined)
|
|
181
146
|
await ready;
|
|
182
|
-
const { mountId, origin } =
|
|
147
|
+
const { mountId, origin } = current();
|
|
183
148
|
nextRequest += 1;
|
|
184
149
|
const requestId = `r${nextRequest}`;
|
|
185
150
|
return new Promise((resolve, reject) => {
|
|
@@ -191,37 +156,99 @@ export function createAdminSurfaceClient(required, optional = {}) {
|
|
|
191
156
|
required.parent.postMessage({ protocol: PROTOCOL, version: VERSION, kind, mountId, requestId, ...fields }, origin);
|
|
192
157
|
});
|
|
193
158
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
/** Asks the host to open `url` outside the sandbox; only https links on the surface's declared
|
|
199
|
-
* `linkOrigins` open, and the host decides how (new tab, system browser). Rejects with the host's refusal. */
|
|
200
|
-
async function openLink(input) {
|
|
201
|
-
await send('open-link', { url: input.url });
|
|
202
|
-
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function createSurfaceBootstrapReader(current, nowMs) {
|
|
203
162
|
/** The bootstrap `data` the host sent with init, or `undefined` once it has expired (or none was sent). */
|
|
204
|
-
function bootstrap() {
|
|
205
|
-
const envelope =
|
|
163
|
+
return function bootstrap() {
|
|
164
|
+
const envelope = current()?.bootstrap;
|
|
206
165
|
if (typeof envelope !== 'object' || envelope === null)
|
|
207
166
|
return undefined;
|
|
208
167
|
const { expiresAt, data } = envelope;
|
|
209
168
|
return typeof expiresAt === 'number' && nowMs() < expiresAt ? data : undefined;
|
|
210
169
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function createSurfaceCloser(pending, unsubscribe, stopSize) {
|
|
215
173
|
/** Stops listening and rejects every pending call. */
|
|
216
|
-
function close() {
|
|
174
|
+
return function close() {
|
|
217
175
|
unsubscribe();
|
|
218
|
-
stopSize
|
|
176
|
+
stopSize();
|
|
219
177
|
for (const [requestId, waiting] of pending) {
|
|
220
178
|
clearTimeout(waiting.timer);
|
|
221
179
|
waiting.reject(new AdminSurfaceCallError({ code: 'closed', message: 'The surface was closed before the host answered.', retryable: false }));
|
|
222
180
|
pending.delete(requestId);
|
|
223
181
|
}
|
|
224
182
|
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function createSurfaceHeightReporter(required, current) {
|
|
186
|
+
let lastHeight = -1;
|
|
187
|
+
/** Tells the host this surface's height (only when it changed), so the frame fits its content. */
|
|
188
|
+
return function reportHeight(height) {
|
|
189
|
+
const init = current();
|
|
190
|
+
if (init === undefined || !Number.isFinite(height) || height === lastHeight)
|
|
191
|
+
return;
|
|
192
|
+
lastHeight = height;
|
|
193
|
+
required.parent.postMessage({ protocol: PROTOCOL, version: VERSION, kind: 'resize', mountId: init.mountId, height }, init.origin);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Connects a surface to its host. In a browser:
|
|
199
|
+
* `createAdminSurfaceClient({ parent: window.parent, listen: (h) => { addEventListener('message', h); return () => removeEventListener('message', h); } })`.
|
|
200
|
+
* @param optional.timeoutMs - How long `call` waits for a response before rejecting with `timeout`.
|
|
201
|
+
* @complexity O(1) per message.
|
|
202
|
+
*/
|
|
203
|
+
export function createAdminSurfaceClient(required, optional = {}) {
|
|
204
|
+
const timeoutMs = optional.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
205
|
+
const nowMs = optional.nowMs ?? Date.now;
|
|
206
|
+
const pending = new Map();
|
|
207
|
+
let init;
|
|
208
|
+
// The Promise executor runs synchronously, so `resolveReady` is assigned before anything can call it.
|
|
209
|
+
let resolveReady;
|
|
210
|
+
const ready = new Promise((resolve) => { resolveReady = resolve; });
|
|
211
|
+
const themeRoot = optional.themeRoot === undefined ? documentRoot() : optional.themeRoot;
|
|
212
|
+
const size = optional.size === undefined ? documentSize() : optional.size;
|
|
213
|
+
let stopSize;
|
|
214
|
+
const reportHeight = createSurfaceHeightReporter(required, () => init);
|
|
215
|
+
const { applyTheme, theme } = createSurfaceTheme(themeRoot);
|
|
216
|
+
function onInit(event, data) {
|
|
217
|
+
if (init !== undefined || typeof data.mountId !== 'string')
|
|
218
|
+
return;
|
|
219
|
+
init = { mountId: data.mountId, origin: event.origin, bootstrap: data.bootstrap };
|
|
220
|
+
applyTheme(data.theme);
|
|
221
|
+
stopSize = size?.(reportHeight);
|
|
222
|
+
resolveReady();
|
|
223
|
+
}
|
|
224
|
+
const onResponse = createSurfaceResponseReceiver(pending, () => init);
|
|
225
|
+
const unsubscribe = required.listen((event) => {
|
|
226
|
+
if (event.source !== required.parent)
|
|
227
|
+
return;
|
|
228
|
+
if (isMessage(event.data, 'init'))
|
|
229
|
+
onInit(event, event.data);
|
|
230
|
+
else if (isMessage(event.data, 'theme')) {
|
|
231
|
+
if (event.origin === init?.origin && event.data.mountId === init.mountId)
|
|
232
|
+
applyTheme(event.data.theme);
|
|
233
|
+
}
|
|
234
|
+
else if (isMessage(event.data, 'action-response'))
|
|
235
|
+
onResponse(event, event.data);
|
|
236
|
+
else {
|
|
237
|
+
// Ignore message kinds outside the admin-surface protocol.
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
const send = createSurfaceSender(required, { pending, ready, timeoutMs }, () => init);
|
|
241
|
+
/** Asks the host to run one declared action; resolves with its result. */
|
|
242
|
+
function call(input) {
|
|
243
|
+
return send('action-request', { action: input.action, payload: input.payload });
|
|
244
|
+
}
|
|
245
|
+
/** Asks the host to open `url` outside the sandbox; only https links on the surface's declared
|
|
246
|
+
* `linkOrigins` open, and the host decides how (new tab, system browser). Rejects with the host's refusal. */
|
|
247
|
+
async function openLink(input) {
|
|
248
|
+
await send('open-link', { url: input.url });
|
|
249
|
+
}
|
|
250
|
+
const bootstrap = createSurfaceBootstrapReader(() => init, nowMs);
|
|
251
|
+
const close = createSurfaceCloser(pending, unsubscribe, () => stopSize?.());
|
|
225
252
|
return { ready, call, openLink, bootstrap, theme, close };
|
|
226
253
|
}
|
|
227
254
|
//# sourceMappingURL=surface-client.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "higgsfield-media",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"description": "Generates images or video through Higgsfield's hosted MCP server, follows asynchronous jobs, then imports the returned asset into this site's Media library. Connect the account through the person's browser sign-in, never an API key. Discover this account's current tools, schemas and model entitlements; the worked model and plan examples are historical, not guarantees. Covers operator write grants, polling without sync:true, connection recovery and importing media from its URL.",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "Jini",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"higgsfield",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
|
-
"id": "
|
|
81
|
+
"id": "jini/higgsfield-media",
|
|
82
82
|
"provides": [
|
|
83
83
|
"media:image",
|
|
84
84
|
"media:video"
|
package/jev/plugin.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "jev",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"description": "Teaches an agent what Jev (TypeSafe's 'System One' model) is and when it belongs in a design: a fast, cheap, non-generative model that takes state plus a typed Choice/Score/Noul question and returns a typed answer with a calibrated probability distribution, for classification, routing, scoring, and confidence-gated automation \u2014 not for writing prose. Covers the three primitives' exact request/response shapes, how to read and threshold confidence, the documented architectural patterns, jev-1.13's known jaggedness (counting, dates, indirection, adversarial content, generation), and both the HTTP API and the JavaScript SDK. This plugin declares no MCP server: Jev has no official MCP integration, so a host's assistant cannot call it directly through chat yet. The skill exists for designing and writing code that calls Jev itself, authenticated with an API key (TYPESAFE_API_KEY, the documented SDK env var) the operator sets outside of chat.",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "Jini",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"extensions": {
|
|
9
9
|
"jini": {
|
|
10
10
|
"summary": "Helps you plan and write software that uses Jev, TypeSafe's fast AI model for sorting and scoring. Needs your own TypeSafe key.",
|
|
11
|
-
"id": "
|
|
11
|
+
"id": "jini/jev",
|
|
12
12
|
"provides": [
|
|
13
13
|
"skill-discovery"
|
|
14
14
|
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# @jini-ai/agent-plugins/kuinetic
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
- First release as its own plugin, so kUInetic guidance can be updated without touching
|
|
6
|
+
`ui-ux-design`. The content is the former `ui-ux-design` reference
|
|
7
|
+
`skills/ui-ux-design/references/kuinetic-reference.md`, moved verbatim and split so the
|
|
8
|
+
always-delivered `SKILL.md` stays under the 8 KiB automatic guidance limit: Detect, Install
|
|
9
|
+
And Initialise, Attribute Grammar, Reduced Motion and Gotchas stay in `SKILL.md`; Reserved Keys,
|
|
10
|
+
Effects By Family and Opt-In Tiers moved to `references/`, each named in a load-before-use table.
|
|
11
|
+
- Near the top, `SKILL.md` names the `load_agent_plugin` call that loads the `ui-ux-design` core
|
|
12
|
+
before designing or redesigning a theme or page, since a kUInetic request can rank this plugin first.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
|
+
"name": "kuinetic",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "kUInetic, the declarative data-kui animation library: detection, setup, attribute grammar, effect names, reduced motion and opt-in tiers, as one portable Agent Plugin.",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"extensions": {
|
|
8
|
+
"jini": {
|
|
9
|
+
"displayName": "kUInetic",
|
|
10
|
+
"summary": "Helps the assistant add kUInetic animation with the right attributes and effect names.",
|
|
11
|
+
"id": "jini/kuinetic",
|
|
12
|
+
"provides": [
|
|
13
|
+
"kuinetic"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"kuinetic",
|
|
19
|
+
"animation",
|
|
20
|
+
"motion",
|
|
21
|
+
"data-kui",
|
|
22
|
+
"scroll",
|
|
23
|
+
"reveal",
|
|
24
|
+
"transition",
|
|
25
|
+
"lightbox"
|
|
26
|
+
]
|
|
27
|
+
}
|