@agent-native/core 0.151.2 → 0.152.0
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/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/analytics/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/analytics/actions/bigquery-query.ts +21 -0
- package/corpus/templates/analytics/app/components/ConnectionTestStatus.tsx +65 -0
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +3 -3
- package/corpus/templates/analytics/app/pages/DataSources.tsx +15 -37
- package/corpus/templates/analytics/app/root.tsx +0 -1
- package/corpus/templates/analytics/changelog/2026-08-11-analytics-custom-blocks-keep-loading-with-legacy-bigquery-action.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-11-analytics-routes-company-knowledge-and-slack-context-questio.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/analytics/public/manifest.json +0 -1
- package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +5 -0
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +5 -0
- package/corpus/templates/assets/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/assets/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/assets/app/root.tsx +0 -1
- package/corpus/templates/assets/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/assets/public/manifest.json +0 -1
- package/corpus/templates/brain/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/brain/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/brain/app/root.tsx +0 -1
- package/corpus/templates/brain/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/brain/public/manifest.json +0 -1
- package/corpus/templates/calendar/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/calendar/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/calendar/app/components/calendar/GoogleConnectBanner.tsx +0 -53
- package/corpus/templates/calendar/app/i18n-data.ts +0 -80
- package/corpus/templates/calendar/app/root.tsx +0 -1
- package/corpus/templates/calendar/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/calendar/changelog/2026-08-11-google-calendar-connection-buttons-now-open-the-sign-in-flow.md +6 -0
- package/corpus/templates/calendar/public/manifest.json +0 -1
- package/corpus/templates/calendar/server/plugins/auth.ts +0 -10
- package/corpus/templates/chat/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/chat/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/chat/app/root.tsx +0 -1
- package/corpus/templates/chat/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/chat/public/manifest.json +0 -1
- package/corpus/templates/clips/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/clips/app/components/player/playback-comment-overlay.tsx +1 -1
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +6 -0
- package/corpus/templates/clips/app/components/sharing/share-ui.tsx +20 -3
- package/corpus/templates/clips/app/i18n/en-US.ts +4 -4
- package/corpus/templates/clips/app/root.tsx +0 -1
- package/corpus/templates/clips/app/routes/_app.meetings._index.tsx +1 -3
- package/corpus/templates/clips/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-11-clips-desktop-settings-are-now-easier-to-scan-with-a-wider-t.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-11-google-calendar-connections-from-meetings-now-open-directly.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-11-recording-viewers-can-comment-and-react.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-11-system-audio-recording-now-lives-inside-the-microphone-menu-.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-11-timestamped-comments-stay-on-the-video-for-three-seconds-wh.md +6 -0
- package/corpus/templates/clips/desktop/src/app.tsx +773 -1001
- package/corpus/templates/clips/desktop/src/components/MediaDeviceRow.tsx +15 -27
- package/corpus/templates/clips/desktop/src/styles.css +364 -5
- package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +1 -1
- package/corpus/templates/clips/public/manifest.json +0 -1
- package/corpus/templates/content/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/content/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/content/AGENTS.md +3 -0
- package/corpus/templates/content/actions/resolve-content-landing.ts +120 -0
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +9 -0
- package/corpus/templates/content/app/i18n-data.ts +58 -0
- package/corpus/templates/content/app/lib/content-landing.ts +22 -0
- package/corpus/templates/content/app/root.tsx +0 -1
- package/corpus/templates/content/app/routes/_app._index.tsx +36 -26
- package/corpus/templates/content/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/content/changelog/2026-08-11-content-opens-your-last-page-on-return-and-gives-new-users-a.md +6 -0
- package/corpus/templates/content/docs/product/capabilities/content.workspace.session-restore.md +7 -1
- package/corpus/templates/content/parity/matrix.md +1 -0
- package/corpus/templates/content/parity/matrix.ts +22 -0
- package/corpus/templates/content/public/manifest.json +0 -1
- package/corpus/templates/content/shared/content-landing.ts +17 -0
- package/corpus/templates/crm/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/crm/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/crm/app/root.tsx +0 -1
- package/corpus/templates/crm/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/crm/public/manifest.json +0 -1
- package/corpus/templates/design/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/design/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/design/app/i18n/en-US.ts +5 -0
- package/corpus/templates/design/app/root.tsx +0 -1
- package/corpus/templates/design/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/design/changelog/2026-08-11-design-sharing-now-identifies-viewers-who-can-add-review-com.md +6 -0
- package/corpus/templates/design/public/manifest.json +0 -1
- package/corpus/templates/dispatch/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/dispatch/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/dispatch/AGENTS.md +9 -0
- package/corpus/templates/dispatch/actions/list-dispatch-usage-metrics.ts +5 -19
- package/corpus/templates/dispatch/actions/view-screen.ts +10 -3
- package/corpus/templates/dispatch/app/root.tsx +0 -1
- package/corpus/templates/dispatch/app/routes/settings.tsx +13 -1
- package/corpus/templates/dispatch/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-08-11-clicking-the-dispatch-logo-returns-to-the-overview-page.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-08-11-dispatch-no-longer-links-to-itself-from-the-app-switcher.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-08-11-dispatch-settings-now-link-directly-to-admin.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-08-11-dispatch-shows-usage-trends-recent-prompts-and-an-agent-revi.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-08-11-human-friendly-app-names.md +6 -0
- package/corpus/templates/dispatch/public/manifest.json +0 -1
- package/corpus/templates/dispatch/server/lib/identity-sso.ts +432 -158
- package/corpus/templates/dispatch/server/plugins/identity-sso.ts +204 -123
- package/corpus/templates/dispatch/server/plugins/setup-dispatch.ts +1 -0
- package/corpus/templates/factory/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/factory/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/factory/app/root.tsx +0 -1
- package/corpus/templates/factory/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/factory/public/manifest.json +0 -1
- package/corpus/templates/forms/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/forms/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/forms/app/root.tsx +0 -1
- package/corpus/templates/forms/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/forms/public/manifest.json +0 -1
- package/corpus/templates/macros/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/macros/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/mail/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/mail/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/mail/app/root.tsx +0 -1
- package/corpus/templates/mail/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/mail/changelog/2026-08-11-google-sign-in-now-opens-the-gmail-connection-flow-directly.md +6 -0
- package/corpus/templates/mail/public/manifest.json +0 -1
- package/corpus/templates/mail/server/plugins/auth.ts +0 -10
- package/corpus/templates/plan/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/plan/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/plan/app/i18n/en-US.ts +2 -0
- package/corpus/templates/plan/app/pages/PlansPage.tsx +6 -0
- package/corpus/templates/plan/app/root.tsx +0 -1
- package/corpus/templates/plan/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/plan/changelog/2026-08-11-plan-sharing-now-identifies-viewers-who-can-add-comments.md +6 -0
- package/corpus/templates/plan/public/manifest.json +0 -1
- package/corpus/templates/slides/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/slides/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +6 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +2 -0
- package/corpus/templates/slides/app/root.tsx +0 -1
- package/corpus/templates/slides/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-share-dialog-uses-commenter-terminology.md +6 -0
- package/corpus/templates/slides/public/manifest.json +0 -1
- package/corpus/templates/tasks/.agents/skills/sharing/SKILL.md +1 -1
- package/corpus/templates/tasks/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/tasks/app/root.tsx +0 -1
- package/corpus/templates/tasks/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/corpus/templates/tasks/public/manifest.json +0 -1
- package/dist/agent/production-agent.js +1 -22
- package/dist/agent/run-manager.d.ts +7 -0
- package/dist/agent/run-manager.js +46 -3
- package/dist/agent/tool-approval-migrations.d.ts +40 -0
- package/dist/agent/tool-approval-migrations.js +51 -0
- package/dist/agent/tool-approval-store.js +5 -20
- package/dist/cli/templates-meta.js +2 -2
- package/dist/client/AgentPanel.js +10 -1
- package/dist/client/AssistantChat.d.ts +3 -0
- package/dist/client/AssistantChat.js +148 -140
- package/dist/client/agent-page/AgentTabsPage.js +2 -2
- package/dist/client/chat/attachment-adapters.js +8 -2
- package/dist/client/chat/tool-call-display.d.ts +1 -0
- package/dist/client/chat/tool-call-display.js +3 -1
- package/dist/client/chat-first.js +11 -5
- package/dist/client/hooks/index.d.ts +1 -1
- package/dist/client/hooks/index.js +1 -1
- package/dist/client/org/OrgSwitcher.d.ts +3 -1
- package/dist/client/org/OrgSwitcher.js +22 -16
- package/dist/client/org/WorkspaceNotice.js +3 -1
- package/dist/client/resources/index.d.ts +1 -1
- package/dist/client/resources/index.js +1 -1
- package/dist/client/resources/use-mcp-servers.d.ts +1 -0
- package/dist/client/resources/use-mcp-servers.js +14 -0
- package/dist/client/settings/AccountSettingsCard.js +8 -4
- package/dist/client/settings/SettingsPanel.js +46 -13
- package/dist/client/settings/SettingsTabsPage.js +8 -3
- package/dist/client/sharing/ShareButton.d.ts +7 -1
- package/dist/client/sharing/ShareButton.js +14 -7
- package/dist/client/sharing/ShareDialog.js +5 -1
- package/dist/client/sharing/useShareButtonController.d.ts +4 -0
- package/dist/client/sharing/useShareButtonController.js +15 -0
- package/dist/client/sharing/useShareDialogController.d.ts +7 -0
- package/dist/client/sharing/useShareDialogController.js +14 -0
- package/dist/client/sse-event-processor.js +37 -0
- package/dist/client/use-session.d.ts +2 -0
- package/dist/client/use-session.js +69 -5
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/deploy/build.js +1 -1
- package/dist/file-upload/pre-upload-attachments.d.ts +3 -4
- package/dist/file-upload/pre-upload-attachments.js +65 -17
- package/dist/ingestion/index.d.ts +1 -0
- package/dist/ingestion/index.js +1 -0
- package/dist/ingestion/office.d.ts +3 -3
- package/dist/ingestion/office.js +24 -2
- package/dist/ingestion/spreadsheet.d.ts +41 -0
- package/dist/ingestion/spreadsheet.js +172 -0
- package/dist/integrations/adapters/slack.js +7 -3
- package/dist/localization/default-messages.d.ts +3 -0
- package/dist/localization/default-messages.js +3 -0
- package/dist/mcp/embed-app.js +20 -9
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/notifications/routes.d.ts +6 -6
- package/dist/oauth-tokens/migrations.d.ts +8 -0
- package/dist/oauth-tokens/migrations.js +36 -0
- package/dist/org/workspace-url.d.ts +8 -0
- package/dist/org/workspace-url.js +26 -2
- package/dist/secrets/routes.d.ts +3 -3
- package/dist/server/agent-chat-plugin.js +16 -8
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/auth.d.ts +0 -11
- package/dist/server/auth.js +37 -20
- package/dist/server/better-auth-migrations.js +23 -0
- package/dist/server/email-template.d.ts +5 -0
- package/dist/server/email-template.js +9 -0
- package/dist/server/embed-route.js +17 -5
- package/dist/server/identity-sso-store.d.ts +40 -66
- package/dist/server/identity-sso-store.js +187 -150
- package/dist/server/identity-sso.d.ts +17 -73
- package/dist/server/identity-sso.js +294 -297
- package/dist/server/onboarding-html.d.ts +0 -12
- package/dist/server/onboarding-html.js +46 -269
- package/dist/server/release-migrations.js +8 -0
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/workspace-app-id.d.ts +2 -0
- package/dist/shared/workspace-app-id.js +10 -0
- package/dist/sharing/actions/share-resource.d.ts +1 -0
- package/dist/sharing/actions/share-resource.js +20 -5
- package/dist/templates/chat/.agents/skills/sharing/SKILL.md +1 -1
- package/dist/templates/chat/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/dist/templates/chat/app/root.tsx +0 -1
- package/dist/templates/chat/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/dist/templates/chat/public/manifest.json +0 -1
- package/dist/templates/default/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/dist/templates/default/app/root.tsx +0 -1
- package/dist/templates/default/public/manifest.json +0 -1
- package/dist/templates/headless/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +22 -11
- package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/docs/content/cross-app-sso.mdx +85 -27
- package/docs/content/template-mail.mdx +0 -6
- package/package.json +4 -3
- package/src/templates/chat/.agents/skills/sharing/SKILL.md +1 -1
- package/src/templates/chat/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/src/templates/chat/app/root.tsx +0 -1
- package/src/templates/chat/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
- package/src/templates/chat/public/manifest.json +0 -1
- package/src/templates/default/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/src/templates/default/app/root.tsx +0 -1
- package/src/templates/default/public/manifest.json +0 -1
- package/src/templates/headless/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +22 -11
- package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +24 -0
- package/corpus/templates/calendar/changelog/2026-06-23-added-a-heads-up-explaining-google-s-app-not-verified-screen.md +0 -6
- package/corpus/templates/clips/app/components/meetings/google-oauth-identity-notice.tsx +0 -51
- package/corpus/templates/clips/changelog/2026-07-30-google-calendar-warning.md +0 -6
package/dist/ingestion/office.js
CHANGED
|
@@ -12,6 +12,24 @@ export async function parseOfficeDocument(input, parser) {
|
|
|
12
12
|
warnings: [],
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
+
if (fileType === "xlsx" || fileType === "xls") {
|
|
16
|
+
const workbook = await parseSpreadsheetDocument(input);
|
|
17
|
+
return {
|
|
18
|
+
text: workbook.text,
|
|
19
|
+
fileType,
|
|
20
|
+
title: workbook.title,
|
|
21
|
+
parser: workbook.parser,
|
|
22
|
+
parts: workbook.parts.map((part) => ({
|
|
23
|
+
kind: "sheet",
|
|
24
|
+
index: part.index,
|
|
25
|
+
title: part.title,
|
|
26
|
+
text: part.text,
|
|
27
|
+
metadata: part.metadata,
|
|
28
|
+
})),
|
|
29
|
+
metadata: workbook.metadata,
|
|
30
|
+
warnings: workbook.warnings,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
15
33
|
if (fileType === "pptx") {
|
|
16
34
|
const presentation = await parsePptxPresentation(input.data);
|
|
17
35
|
const parts = presentation.slides.map((slide, index) => {
|
|
@@ -107,12 +125,15 @@ export function detectOfficeDocumentType(fileName, mimeType) {
|
|
|
107
125
|
return "md";
|
|
108
126
|
if (mime.includes("csv"))
|
|
109
127
|
return "csv";
|
|
128
|
+
const spreadsheetType = detectSpreadsheetDocumentType(fileName, mimeType);
|
|
129
|
+
if (spreadsheetType)
|
|
130
|
+
return spreadsheetType;
|
|
110
131
|
if (mime.startsWith("text/"))
|
|
111
132
|
return "txt";
|
|
112
133
|
const extension = fileName.toLowerCase().match(/\.([a-z0-9]+)$/)?.[1];
|
|
113
134
|
if (isOfficeDocumentType(extension))
|
|
114
135
|
return extension;
|
|
115
|
-
throw new Error(`Unsupported upload type ${mimeType ?? extension ?? "unknown"}; supported formats are PPTX, DOCX, PDF, and text.`);
|
|
136
|
+
throw new Error(`Unsupported upload type ${mimeType ?? extension ?? "unknown"}; supported formats are PPTX, DOCX, PDF, XLS, XLSX, and text.`);
|
|
116
137
|
}
|
|
117
138
|
export function normalizeDocumentText(value) {
|
|
118
139
|
return value
|
|
@@ -133,7 +154,8 @@ async function loadOfficeParser() {
|
|
|
133
154
|
}
|
|
134
155
|
function isOfficeDocumentType(value) {
|
|
135
156
|
return (typeof value === "string" &&
|
|
136
|
-
["pptx", "docx", "pdf", "txt", "md", "csv"].includes(value));
|
|
157
|
+
["pptx", "docx", "pdf", "txt", "md", "csv", "xlsx", "xls"].includes(value));
|
|
137
158
|
}
|
|
138
159
|
import { parseDocxDocument, sanitizeInertDocumentHtml } from "./docx.js";
|
|
139
160
|
import { parsePptxPresentation, } from "./pptx.js";
|
|
161
|
+
import { detectSpreadsheetDocumentType, parseSpreadsheetDocument, } from "./spreadsheet.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type SpreadsheetDocumentType = "xlsx" | "xls";
|
|
2
|
+
export interface ParseSpreadsheetDocumentInput {
|
|
3
|
+
data: Uint8Array;
|
|
4
|
+
fileName: string;
|
|
5
|
+
mimeType?: string;
|
|
6
|
+
maxBytes?: number;
|
|
7
|
+
maxChars?: number;
|
|
8
|
+
maxColumns?: number;
|
|
9
|
+
maxRowsPerSheet?: number;
|
|
10
|
+
maxSheets?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ParsedSpreadsheetSheet {
|
|
13
|
+
index: number;
|
|
14
|
+
title: string;
|
|
15
|
+
text: string;
|
|
16
|
+
metadata: {
|
|
17
|
+
sheetName: string;
|
|
18
|
+
rowCount: number;
|
|
19
|
+
columnCount: number;
|
|
20
|
+
sampledRowCount: number;
|
|
21
|
+
sampledColumnCount: number;
|
|
22
|
+
truncated: boolean;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface ParsedSpreadsheetDocument {
|
|
26
|
+
text: string;
|
|
27
|
+
fileType: SpreadsheetDocumentType;
|
|
28
|
+
title: string;
|
|
29
|
+
parser: "sheetjs-workbook";
|
|
30
|
+
parts: ParsedSpreadsheetSheet[];
|
|
31
|
+
metadata: {
|
|
32
|
+
sheetNames: string[];
|
|
33
|
+
sheetCount: number;
|
|
34
|
+
sampledSheetCount: number;
|
|
35
|
+
truncated: boolean;
|
|
36
|
+
};
|
|
37
|
+
warnings: string[];
|
|
38
|
+
}
|
|
39
|
+
export declare function isSpreadsheetDocument(fileName: string, mimeType?: string): boolean;
|
|
40
|
+
export declare function detectSpreadsheetDocumentType(fileName: string, mimeType?: string): SpreadsheetDocumentType | null;
|
|
41
|
+
export declare function parseSpreadsheetDocument(input: ParseSpreadsheetDocumentInput): Promise<ParsedSpreadsheetDocument>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
const DEFAULT_MAX_BYTES = 20 * 1024 * 1024;
|
|
2
|
+
const DEFAULT_MAX_CHARS = 24_000;
|
|
3
|
+
const DEFAULT_MAX_COLUMNS = 24;
|
|
4
|
+
const DEFAULT_MAX_ROWS_PER_SHEET = 40;
|
|
5
|
+
const DEFAULT_MAX_SHEETS = 12;
|
|
6
|
+
const MAX_CELL_CHARS = 500;
|
|
7
|
+
export function isSpreadsheetDocument(fileName, mimeType) {
|
|
8
|
+
return detectSpreadsheetDocumentType(fileName, mimeType) !== null;
|
|
9
|
+
}
|
|
10
|
+
export function detectSpreadsheetDocumentType(fileName, mimeType) {
|
|
11
|
+
const normalizedMime = mimeType?.toLowerCase().split(";")[0].trim() ?? "";
|
|
12
|
+
if (normalizedMime ===
|
|
13
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
|
|
14
|
+
normalizedMime === "application/vnd.ms-excel") {
|
|
15
|
+
return normalizedMime.includes("openxml") ? "xlsx" : "xls";
|
|
16
|
+
}
|
|
17
|
+
const extension = fileName.toLowerCase().match(/\.([a-z0-9]+)$/)?.[1];
|
|
18
|
+
return extension === "xlsx" || extension === "xls" ? extension : null;
|
|
19
|
+
}
|
|
20
|
+
function normalizeCell(value) {
|
|
21
|
+
if (value === null || value === undefined)
|
|
22
|
+
return "";
|
|
23
|
+
if (value instanceof Date)
|
|
24
|
+
return value.toISOString();
|
|
25
|
+
return String(value)
|
|
26
|
+
.replace(/\r\n?/g, " ")
|
|
27
|
+
.replace(/[\t\n]+/g, " ")
|
|
28
|
+
.trim()
|
|
29
|
+
.slice(0, MAX_CELL_CHARS);
|
|
30
|
+
}
|
|
31
|
+
function escapePreviewValue(value) {
|
|
32
|
+
return value
|
|
33
|
+
.replace(/&/g, "&")
|
|
34
|
+
.replace(/</g, "<")
|
|
35
|
+
.replace(/>/g, ">");
|
|
36
|
+
}
|
|
37
|
+
async function loadXlsx() {
|
|
38
|
+
try {
|
|
39
|
+
return await import("xlsx");
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
throw new Error("Parsing Excel workbooks requires the optional xlsx dependency.");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function appendBoundedText(current, next, maxChars) {
|
|
46
|
+
if (maxChars <= 0)
|
|
47
|
+
return { text: "", truncated: true };
|
|
48
|
+
const separator = current ? "\n\n" : "";
|
|
49
|
+
const remaining = maxChars - current.length - separator.length;
|
|
50
|
+
if (remaining <= 0)
|
|
51
|
+
return { text: current, truncated: true };
|
|
52
|
+
if (next.length <= remaining) {
|
|
53
|
+
return { text: `${current}${separator}${next}`, truncated: false };
|
|
54
|
+
}
|
|
55
|
+
const marker = "\n[Spreadsheet preview truncated.]";
|
|
56
|
+
const markerText = marker.slice(0, remaining);
|
|
57
|
+
const available = Math.max(0, remaining - markerText.length);
|
|
58
|
+
return {
|
|
59
|
+
text: `${current}${separator}${next.slice(0, available)}${markerText}`,
|
|
60
|
+
truncated: true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export async function parseSpreadsheetDocument(input) {
|
|
64
|
+
const fileType = detectSpreadsheetDocumentType(input.fileName, input.mimeType);
|
|
65
|
+
if (!fileType) {
|
|
66
|
+
throw new Error(`Unsupported spreadsheet type ${input.mimeType ?? input.fileName}. Expected XLS or XLSX.`);
|
|
67
|
+
}
|
|
68
|
+
const maxBytes = input.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
69
|
+
if (input.data.byteLength > maxBytes) {
|
|
70
|
+
throw new Error(`Spreadsheet exceeds the ${Math.round(maxBytes / 1024 / 1024)} MB parsing limit.`);
|
|
71
|
+
}
|
|
72
|
+
const maxChars = input.maxChars ?? DEFAULT_MAX_CHARS;
|
|
73
|
+
const maxColumns = input.maxColumns ?? DEFAULT_MAX_COLUMNS;
|
|
74
|
+
const maxRowsPerSheet = input.maxRowsPerSheet ?? DEFAULT_MAX_ROWS_PER_SHEET;
|
|
75
|
+
const maxSheets = input.maxSheets ?? DEFAULT_MAX_SHEETS;
|
|
76
|
+
const xlsx = await loadXlsx();
|
|
77
|
+
const workbook = xlsx.read(input.data, {
|
|
78
|
+
type: "array",
|
|
79
|
+
cellDates: true,
|
|
80
|
+
cellNF: false,
|
|
81
|
+
cellText: true,
|
|
82
|
+
});
|
|
83
|
+
const sheetNames = workbook.SheetNames.map(String);
|
|
84
|
+
if (sheetNames.length === 0) {
|
|
85
|
+
throw new Error("Spreadsheet does not contain any worksheets.");
|
|
86
|
+
}
|
|
87
|
+
const parts = [];
|
|
88
|
+
let text = "";
|
|
89
|
+
let truncated = false;
|
|
90
|
+
for (const [index, sheetName] of sheetNames.slice(0, maxSheets).entries()) {
|
|
91
|
+
const sheet = workbook.Sheets[sheetName];
|
|
92
|
+
if (!sheet)
|
|
93
|
+
continue;
|
|
94
|
+
const range = sheet["!ref"]
|
|
95
|
+
? xlsx.utils.decode_range(sheet["!ref"])
|
|
96
|
+
: null;
|
|
97
|
+
const rowCount = range ? range.e.r - range.s.r + 1 : 0;
|
|
98
|
+
const columnCount = range ? range.e.c - range.s.c + 1 : 0;
|
|
99
|
+
const rows = xlsx.utils.sheet_to_json(sheet, {
|
|
100
|
+
header: 1,
|
|
101
|
+
raw: false,
|
|
102
|
+
blankrows: false,
|
|
103
|
+
defval: "",
|
|
104
|
+
});
|
|
105
|
+
const sampledRows = rows.slice(0, maxRowsPerSheet);
|
|
106
|
+
const sampledColumnCount = Math.min(maxColumns, sampledRows.reduce((max, row) => Math.max(max, row.length), 0));
|
|
107
|
+
const lines = [
|
|
108
|
+
`Sheet: ${sheetName}`,
|
|
109
|
+
`Rows: ${rowCount}; columns: ${columnCount}`,
|
|
110
|
+
`Preview rows: ${sampledRows.length}; preview columns: ${sampledColumnCount}`,
|
|
111
|
+
];
|
|
112
|
+
if (sampledRows.length === 0) {
|
|
113
|
+
lines.push("(empty sheet)");
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
for (const row of sampledRows) {
|
|
117
|
+
lines.push(row
|
|
118
|
+
.slice(0, maxColumns)
|
|
119
|
+
.map((cell) => escapePreviewValue(normalizeCell(cell)))
|
|
120
|
+
.join("\t"));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const sheetTruncated = sampledRows.length < rowCount || sampledColumnCount < columnCount;
|
|
124
|
+
if (sheetTruncated) {
|
|
125
|
+
lines.push("[This sheet preview is bounded; use the original workbook for the remaining rows or columns.]");
|
|
126
|
+
}
|
|
127
|
+
const sheetText = lines.join("\n");
|
|
128
|
+
const bounded = appendBoundedText(text, sheetText, maxChars);
|
|
129
|
+
text = bounded.text;
|
|
130
|
+
if (bounded.truncated) {
|
|
131
|
+
truncated = true;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
parts.push({
|
|
135
|
+
index,
|
|
136
|
+
title: sheetName,
|
|
137
|
+
text: sheetText,
|
|
138
|
+
metadata: {
|
|
139
|
+
sheetName,
|
|
140
|
+
rowCount,
|
|
141
|
+
columnCount,
|
|
142
|
+
sampledRowCount: sampledRows.length,
|
|
143
|
+
sampledColumnCount,
|
|
144
|
+
truncated: sheetTruncated,
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
if (sheetNames.length > maxSheets)
|
|
149
|
+
truncated = true;
|
|
150
|
+
const warnings = [];
|
|
151
|
+
if (sheetNames.length > maxSheets) {
|
|
152
|
+
warnings.push(`Only the first ${maxSheets} of ${sheetNames.length} worksheets were included in the preview.`);
|
|
153
|
+
}
|
|
154
|
+
if (truncated &&
|
|
155
|
+
!warnings.some((warning) => warning.includes("worksheets"))) {
|
|
156
|
+
warnings.push(`The preview was limited to ${maxChars.toLocaleString()} characters.`);
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
text,
|
|
160
|
+
fileType,
|
|
161
|
+
title: input.fileName,
|
|
162
|
+
parser: "sheetjs-workbook",
|
|
163
|
+
parts,
|
|
164
|
+
metadata: {
|
|
165
|
+
sheetNames,
|
|
166
|
+
sheetCount: sheetNames.length,
|
|
167
|
+
sampledSheetCount: parts.length,
|
|
168
|
+
truncated,
|
|
169
|
+
},
|
|
170
|
+
warnings,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
@@ -493,10 +493,11 @@ export function slackAdapter(options = {}) {
|
|
|
493
493
|
};
|
|
494
494
|
const token = await resolveBotToken(targetContext);
|
|
495
495
|
if (!token) {
|
|
496
|
-
|
|
496
|
+
const errorMessage = "[slack] no bot token for outbound target" +
|
|
497
497
|
(target.tenantId ? ` (tenant ${target.tenantId})` : "") +
|
|
498
|
-
"; set SLACK_BOT_TOKEN or pass installationKey to name the app"
|
|
499
|
-
|
|
498
|
+
"; set SLACK_BOT_TOKEN or pass installationKey to name the app";
|
|
499
|
+
console.error(errorMessage);
|
|
500
|
+
throw new Error(errorMessage);
|
|
500
501
|
}
|
|
501
502
|
const chunks = splitNonEmptyMessage(message.text, SLACK_MAX_LENGTH);
|
|
502
503
|
if (chunks.length === 0)
|
|
@@ -520,6 +521,9 @@ export function slackAdapter(options = {}) {
|
|
|
520
521
|
if (!data.ok) {
|
|
521
522
|
throw new Error(data.error || "chat.postMessage failed");
|
|
522
523
|
}
|
|
524
|
+
if (!data.ts) {
|
|
525
|
+
throw new Error("chat.postMessage returned no message timestamp; delivery was not confirmed");
|
|
526
|
+
}
|
|
523
527
|
}
|
|
524
528
|
catch (err) {
|
|
525
529
|
console.error("[slack] Failed to send proactive message:", err);
|
|
@@ -679,6 +679,9 @@ declare const messages: {
|
|
|
679
679
|
shareLink: string;
|
|
680
680
|
addPeopleByEmail: string;
|
|
681
681
|
notifyPeople: string;
|
|
682
|
+
addMessage: string;
|
|
683
|
+
hideMessage: string;
|
|
684
|
+
messagePlaceholder: string;
|
|
682
685
|
peopleWithAccess: string;
|
|
683
686
|
ownerRole: string;
|
|
684
687
|
remove: string;
|
|
@@ -685,6 +685,9 @@ const messages = {
|
|
|
685
685
|
shareLink: "Share link",
|
|
686
686
|
addPeopleByEmail: "Add people by email",
|
|
687
687
|
notifyPeople: "Notify people",
|
|
688
|
+
addMessage: "Add a message",
|
|
689
|
+
hideMessage: "Hide message",
|
|
690
|
+
messagePlaceholder: "Add a short note (optional)",
|
|
688
691
|
peopleWithAccess: "People with access",
|
|
689
692
|
ownerRole: "Owner",
|
|
690
693
|
remove: "Remove",
|
package/dist/mcp/embed-app.js
CHANGED
|
@@ -1459,10 +1459,21 @@ export function embedApp(options = {}) {
|
|
|
1459
1459
|
});
|
|
1460
1460
|
|
|
1461
1461
|
window.addEventListener("message", (event) => {
|
|
1462
|
-
|
|
1463
|
-
|
|
1462
|
+
const message = event.data;
|
|
1463
|
+
const expiredSessionMessage =
|
|
1464
|
+
message?.type === "agentNative.embedSessionExpired" &&
|
|
1465
|
+
typeof message.embedStartUrl === "string" &&
|
|
1466
|
+
event.source === null &&
|
|
1467
|
+
(message.embedStartUrl === appFrame?.src ||
|
|
1468
|
+
message.embedStartUrl === lastFrameSrc);
|
|
1469
|
+
if (
|
|
1470
|
+
!appFrame ||
|
|
1471
|
+
(!expiredSessionMessage && event.source !== appFrame.contentWindow)
|
|
1472
|
+
)
|
|
1473
|
+
return;
|
|
1474
|
+
if (!message) return;
|
|
1464
1475
|
const data = event.data.data || {};
|
|
1465
|
-
if (
|
|
1476
|
+
if (message.type === "agentNative.embeddedAppReady") {
|
|
1466
1477
|
appFrameReady = true;
|
|
1467
1478
|
embedSessionRefreshAttempts = 0;
|
|
1468
1479
|
clearFrameLoadTimer();
|
|
@@ -1470,7 +1481,7 @@ export function embedApp(options = {}) {
|
|
|
1470
1481
|
notifyOuterMcpAppReady();
|
|
1471
1482
|
return;
|
|
1472
1483
|
}
|
|
1473
|
-
if (
|
|
1484
|
+
if (message.type === "agentNative.contentHeight") {
|
|
1474
1485
|
const next = finiteNumber(data && data.height);
|
|
1475
1486
|
if (next && Math.abs(next - reportedContentHeight) >= 1) {
|
|
1476
1487
|
reportedContentHeight = next;
|
|
@@ -1478,23 +1489,23 @@ export function embedApp(options = {}) {
|
|
|
1478
1489
|
}
|
|
1479
1490
|
return;
|
|
1480
1491
|
}
|
|
1481
|
-
if (
|
|
1492
|
+
if (message.type === "agentNative.embedSessionExpired") {
|
|
1482
1493
|
refreshExpiredEmbedSession();
|
|
1483
1494
|
return;
|
|
1484
1495
|
}
|
|
1485
|
-
if (
|
|
1496
|
+
if (message.type === "agentNative.submitChat") {
|
|
1486
1497
|
void sendHostChat(data);
|
|
1487
1498
|
return;
|
|
1488
1499
|
}
|
|
1489
|
-
if (
|
|
1500
|
+
if (message.type === "agentNative.mcpHost.updateModelContext") {
|
|
1490
1501
|
respondToAppFrame(data.requestId, updateHostModelContext(data));
|
|
1491
1502
|
return;
|
|
1492
1503
|
}
|
|
1493
|
-
if (
|
|
1504
|
+
if (message.type === "agentNative.mcpHost.openLink") {
|
|
1494
1505
|
respondToAppFrame(data.requestId, openHostLink(data));
|
|
1495
1506
|
return;
|
|
1496
1507
|
}
|
|
1497
|
-
if (
|
|
1508
|
+
if (message.type === "agentNative.mcpHost.requestDisplayMode") {
|
|
1498
1509
|
respondToAppFrame(data.requestId, requestHostDisplayMode(data.mode));
|
|
1499
1510
|
}
|
|
1500
1511
|
});
|
|
@@ -137,13 +137,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
137
137
|
inputSchema: {
|
|
138
138
|
type: string;
|
|
139
139
|
properties: {
|
|
140
|
+
count?: undefined;
|
|
140
141
|
query?: undefined;
|
|
141
142
|
minutes?: undefined;
|
|
142
143
|
limit?: undefined;
|
|
143
144
|
clientHint?: undefined;
|
|
144
145
|
timestamp?: undefined;
|
|
145
146
|
chapterId?: undefined;
|
|
146
|
-
count?: undefined;
|
|
147
147
|
startAt?: undefined;
|
|
148
148
|
endAt?: undefined;
|
|
149
149
|
reason?: undefined;
|
|
@@ -159,6 +159,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
159
159
|
inputSchema: {
|
|
160
160
|
type: string;
|
|
161
161
|
properties: {
|
|
162
|
+
count?: undefined;
|
|
162
163
|
query: {
|
|
163
164
|
type: string;
|
|
164
165
|
description: string;
|
|
@@ -174,7 +175,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
174
175
|
clientHint?: undefined;
|
|
175
176
|
timestamp?: undefined;
|
|
176
177
|
chapterId?: undefined;
|
|
177
|
-
count?: undefined;
|
|
178
178
|
startAt?: undefined;
|
|
179
179
|
endAt?: undefined;
|
|
180
180
|
reason?: undefined;
|
|
@@ -190,6 +190,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
190
190
|
inputSchema: {
|
|
191
191
|
type: string;
|
|
192
192
|
properties: {
|
|
193
|
+
count?: undefined;
|
|
193
194
|
minutes: {
|
|
194
195
|
type: string;
|
|
195
196
|
description: string;
|
|
@@ -199,7 +200,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
199
200
|
clientHint?: undefined;
|
|
200
201
|
timestamp?: undefined;
|
|
201
202
|
chapterId?: undefined;
|
|
202
|
-
count?: undefined;
|
|
203
203
|
startAt?: undefined;
|
|
204
204
|
endAt?: undefined;
|
|
205
205
|
reason?: undefined;
|
|
@@ -216,6 +216,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
216
216
|
type: string;
|
|
217
217
|
required: string[];
|
|
218
218
|
properties: {
|
|
219
|
+
count?: undefined;
|
|
219
220
|
query: {
|
|
220
221
|
type: string;
|
|
221
222
|
description: string;
|
|
@@ -234,7 +235,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
234
235
|
};
|
|
235
236
|
timestamp?: undefined;
|
|
236
237
|
chapterId?: undefined;
|
|
237
|
-
count?: undefined;
|
|
238
238
|
startAt?: undefined;
|
|
239
239
|
endAt?: undefined;
|
|
240
240
|
reason?: undefined;
|
|
@@ -250,6 +250,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
250
250
|
type: string;
|
|
251
251
|
required: string[];
|
|
252
252
|
properties: {
|
|
253
|
+
count?: undefined;
|
|
253
254
|
query?: undefined;
|
|
254
255
|
minutes?: undefined;
|
|
255
256
|
limit?: undefined;
|
|
@@ -263,7 +264,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
263
264
|
description: string;
|
|
264
265
|
};
|
|
265
266
|
chapterId?: undefined;
|
|
266
|
-
count?: undefined;
|
|
267
267
|
startAt?: undefined;
|
|
268
268
|
endAt?: undefined;
|
|
269
269
|
includeMicrophone?: undefined;
|
|
@@ -314,13 +314,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
314
314
|
type: string;
|
|
315
315
|
required: string[];
|
|
316
316
|
properties: {
|
|
317
|
+
count?: undefined;
|
|
317
318
|
query?: undefined;
|
|
318
319
|
minutes?: undefined;
|
|
319
320
|
limit?: undefined;
|
|
320
321
|
clientHint?: undefined;
|
|
321
322
|
timestamp?: undefined;
|
|
322
323
|
chapterId?: undefined;
|
|
323
|
-
count?: undefined;
|
|
324
324
|
startAt: {
|
|
325
325
|
type: string;
|
|
326
326
|
description: string;
|
|
@@ -349,13 +349,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
349
349
|
type: string;
|
|
350
350
|
required: string[];
|
|
351
351
|
properties: {
|
|
352
|
+
count?: undefined;
|
|
352
353
|
query?: undefined;
|
|
353
354
|
minutes?: undefined;
|
|
354
355
|
limit?: undefined;
|
|
355
356
|
clientHint?: undefined;
|
|
356
357
|
timestamp?: undefined;
|
|
357
358
|
chapterId?: undefined;
|
|
358
|
-
count?: undefined;
|
|
359
359
|
startAt?: undefined;
|
|
360
360
|
endAt?: undefined;
|
|
361
361
|
reason?: undefined;
|
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
|
|
14
14
|
count: number;
|
|
15
15
|
updated?: undefined;
|
|
16
|
-
error?: undefined;
|
|
17
16
|
ok?: undefined;
|
|
17
|
+
error?: undefined;
|
|
18
18
|
} | {
|
|
19
|
+
count?: undefined;
|
|
19
20
|
updated: number;
|
|
20
|
-
error?: undefined;
|
|
21
21
|
ok?: undefined;
|
|
22
|
-
|
|
22
|
+
error?: undefined;
|
|
23
23
|
} | {
|
|
24
|
+
count?: undefined;
|
|
24
25
|
updated?: undefined;
|
|
25
26
|
error: string;
|
|
26
27
|
ok?: undefined;
|
|
27
|
-
count?: undefined;
|
|
28
28
|
} | {
|
|
29
|
+
count?: undefined;
|
|
29
30
|
updated?: undefined;
|
|
30
|
-
error?: undefined;
|
|
31
31
|
ok: boolean;
|
|
32
|
-
|
|
32
|
+
error?: undefined;
|
|
33
33
|
}>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MigrationEntry } from "../db/migrations.js";
|
|
2
|
+
export declare const OAUTH_TOKEN_MIGRATIONS_TABLE = "_oauth_token_migrations";
|
|
3
|
+
/**
|
|
4
|
+
* Framework-owned OAuth token storage. The token store still probes for
|
|
5
|
+
* compatibility with local and older deployments, but production release
|
|
6
|
+
* jobs own this schema so request functions never issue DDL.
|
|
7
|
+
*/
|
|
8
|
+
export declare const OAUTH_TOKEN_MIGRATIONS: MigrationEntry[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const OAUTH_TOKEN_MIGRATIONS_TABLE = "_oauth_token_migrations";
|
|
2
|
+
/**
|
|
3
|
+
* Framework-owned OAuth token storage. The token store still probes for
|
|
4
|
+
* compatibility with local and older deployments, but production release
|
|
5
|
+
* jobs own this schema so request functions never issue DDL.
|
|
6
|
+
*/
|
|
7
|
+
export const OAUTH_TOKEN_MIGRATIONS = [
|
|
8
|
+
{
|
|
9
|
+
version: 1,
|
|
10
|
+
name: "oauth-tokens-table",
|
|
11
|
+
sql: `
|
|
12
|
+
CREATE TABLE IF NOT EXISTS oauth_tokens (
|
|
13
|
+
provider TEXT NOT NULL,
|
|
14
|
+
account_id TEXT NOT NULL,
|
|
15
|
+
tokens TEXT NOT NULL,
|
|
16
|
+
updated_at INTEGER NOT NULL,
|
|
17
|
+
PRIMARY KEY (provider, account_id)
|
|
18
|
+
)
|
|
19
|
+
`,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
version: 2,
|
|
23
|
+
name: "oauth-tokens-owner-column",
|
|
24
|
+
sql: "ALTER TABLE oauth_tokens ADD COLUMN IF NOT EXISTS owner TEXT",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
version: 3,
|
|
28
|
+
name: "oauth-tokens-display-name-column",
|
|
29
|
+
sql: "ALTER TABLE oauth_tokens ADD COLUMN IF NOT EXISTS display_name TEXT",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
version: 4,
|
|
33
|
+
name: "oauth-tokens-owner-backfill",
|
|
34
|
+
sql: "UPDATE oauth_tokens SET owner = account_id WHERE owner IS NULL",
|
|
35
|
+
},
|
|
36
|
+
];
|
|
@@ -22,6 +22,14 @@ export type ParsedWorkspaceUrl = {
|
|
|
22
22
|
* app they arrive at.
|
|
23
23
|
*/
|
|
24
24
|
export declare function parseWorkspaceUrl(raw: string): ParsedWorkspaceUrl;
|
|
25
|
+
/**
|
|
26
|
+
* Whether a URL points at a browser-local development origin.
|
|
27
|
+
*
|
|
28
|
+
* Local development may use a loopback hostname or a subdomain of the
|
|
29
|
+
* reserved `.localhost` domain. Hosted previews must remain eligible for
|
|
30
|
+
* workspace guidance.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isLocalDevelopmentOrigin(currentUrl: string): boolean;
|
|
25
33
|
/**
|
|
26
34
|
* Whether a member currently on `currentUrl` should be pointed at the org's
|
|
27
35
|
* workspace. False when the org has no workspace, when the stored value is
|
|
@@ -28,7 +28,8 @@ export function parseWorkspaceUrl(raw) {
|
|
|
28
28
|
try {
|
|
29
29
|
parsed = new URL(withScheme);
|
|
30
30
|
}
|
|
31
|
-
catch {
|
|
31
|
+
catch (error) {
|
|
32
|
+
void error;
|
|
32
33
|
return { ok: false, reason: "Not a valid URL" };
|
|
33
34
|
}
|
|
34
35
|
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
@@ -39,6 +40,28 @@ export function parseWorkspaceUrl(raw) {
|
|
|
39
40
|
}
|
|
40
41
|
return { ok: true, url: parsed.origin };
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Whether a URL points at a browser-local development origin.
|
|
45
|
+
*
|
|
46
|
+
* Local development may use a loopback hostname or a subdomain of the
|
|
47
|
+
* reserved `.localhost` domain. Hosted previews must remain eligible for
|
|
48
|
+
* workspace guidance.
|
|
49
|
+
*/
|
|
50
|
+
export function isLocalDevelopmentOrigin(currentUrl) {
|
|
51
|
+
let hostname;
|
|
52
|
+
try {
|
|
53
|
+
hostname = new URL(currentUrl).hostname.toLowerCase();
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
void error;
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return (hostname === "localhost" ||
|
|
60
|
+
hostname.endsWith(".localhost") ||
|
|
61
|
+
hostname === "127.0.0.1" ||
|
|
62
|
+
hostname === "::1" ||
|
|
63
|
+
hostname === "[::1]");
|
|
64
|
+
}
|
|
42
65
|
/**
|
|
43
66
|
* Whether a member currently on `currentUrl` should be pointed at the org's
|
|
44
67
|
* workspace. False when the org has no workspace, when the stored value is
|
|
@@ -55,7 +78,8 @@ export function shouldOfferWorkspace(currentUrl, workspaceUrl) {
|
|
|
55
78
|
try {
|
|
56
79
|
currentOrigin = new URL(currentUrl).origin;
|
|
57
80
|
}
|
|
58
|
-
catch {
|
|
81
|
+
catch (error) {
|
|
82
|
+
void error;
|
|
59
83
|
return false;
|
|
60
84
|
}
|
|
61
85
|
return currentOrigin !== parsed.url;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -34,16 +34,16 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
|
|
|
34
34
|
/** POST /_agent-native/secrets/:key — write a secret. */
|
|
35
35
|
export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
36
36
|
error: string;
|
|
37
|
-
ok?: undefined;
|
|
38
37
|
status?: undefined;
|
|
38
|
+
ok?: undefined;
|
|
39
39
|
} | {
|
|
40
40
|
ok: boolean;
|
|
41
41
|
status: string;
|
|
42
42
|
error?: undefined;
|
|
43
43
|
} | {
|
|
44
|
-
ok?: undefined;
|
|
45
44
|
error: string;
|
|
46
45
|
removed?: undefined;
|
|
46
|
+
ok?: undefined;
|
|
47
47
|
} | {
|
|
48
48
|
ok: boolean;
|
|
49
49
|
removed: boolean;
|
|
@@ -54,9 +54,9 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
|
|
|
54
54
|
* or the current stored value without changing anything.
|
|
55
55
|
*/
|
|
56
56
|
export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
57
|
-
ok?: undefined;
|
|
58
57
|
error: string;
|
|
59
58
|
note?: undefined;
|
|
59
|
+
ok?: undefined;
|
|
60
60
|
} | {
|
|
61
61
|
ok: boolean;
|
|
62
62
|
note?: undefined;
|