@agent-native/core 0.114.9 → 0.114.11
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 +2 -2
- package/corpus/core/CHANGELOG.md +19 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +31 -3
- package/corpus/core/src/agent/engine/anthropic-engine.ts +20 -3
- package/corpus/core/src/agent/engine/builder-engine.ts +56 -9
- package/corpus/core/src/agent/engine/first-event-timeout.ts +64 -0
- package/corpus/core/src/cli/pr-visual-recap-workflow.ts +2 -3
- package/corpus/core/src/client/AssistantChat.tsx +7 -3
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +1 -1
- package/corpus/core/src/extensions/actions.ts +219 -0
- package/corpus/core/src/integrations/computer-supervision-store.ts +4 -4
- package/corpus/core/src/integrations/pending-tasks-store.ts +1 -1
- package/corpus/core/src/integrations/remote-commands-store.ts +5 -5
- package/corpus/core/src/integrations/remote-devices-store.ts +3 -3
- package/corpus/core/src/integrations/remote-push-store.ts +3 -3
- package/corpus/core/src/observability/traces.ts +38 -1
- package/corpus/core/src/server/action-routes.ts +23 -1
- package/corpus/core/src/server/http-response-telemetry.ts +6 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +19 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/observability/SKILL.md +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +1 -1
- package/corpus/templates/analytics/actions/account-deep-dive.ts +41 -6
- package/corpus/templates/analytics/changelog/2026-07-20-account-deep-dives-finish-with-partial-data-when-hubspot-lo.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-20-dashboard-email-reports-now-include-an-image-when-a-single-p.md +6 -0
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +11 -3
- package/corpus/templates/calendar/actions/create-event.ts +5 -0
- package/corpus/templates/calendar/app/components/ThemeToggle.tsx +4 -1
- package/corpus/templates/calendar/app/components/calendar/EventDetailPanel.tsx +0 -1
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +309 -421
- package/corpus/templates/calendar/app/components/calendar/InlineEventPickers.tsx +349 -0
- package/corpus/templates/calendar/app/i18n-data.ts +110 -0
- package/corpus/templates/calendar/app/lib/event-form-utils.ts +6 -0
- package/corpus/templates/calendar/app/pages/CalendarView.tsx +3 -0
- package/corpus/templates/calendar/app/root.tsx +4 -2
- package/corpus/templates/calendar/changelog/2026-07-20-events-can-be-updated-inline-with-date-time-timezone-and-rep.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-20-public-booking-pages-no-longer-hydrate-with-a-theme-mismatch.md +6 -0
- package/corpus/templates/calendar/shared/api.ts +1 -0
- package/corpus/templates/clips/AGENTS.md +7 -0
- package/corpus/templates/clips/actions/create-recording.ts +51 -10
- package/corpus/templates/clips/actions/get-recording-player-data.ts +34 -5
- package/corpus/templates/clips/actions/lib/transcript-preview.ts +48 -0
- package/corpus/templates/clips/actions/list-recordings.ts +15 -4
- package/corpus/templates/clips/actions/regenerate-summary.ts +32 -0
- package/corpus/templates/clips/actions/search-recordings.ts +28 -6
- package/corpus/templates/clips/actions/view-screen.ts +54 -47
- package/corpus/templates/clips/app/components/library/library-grid.tsx +1 -5
- package/corpus/templates/clips/app/components/library/recording-card.tsx +29 -32
- package/corpus/templates/clips/app/components/meetings/quick-ask-sidebar.tsx +13 -0
- package/corpus/templates/clips/app/components/player/video-player.tsx +48 -0
- package/corpus/templates/clips/app/lib/fmp4.ts +26 -4
- package/corpus/templates/clips/app/lib/mse-video-loader.ts +13 -2
- package/corpus/templates/clips/changelog/2026-07-20-agent-summaries-use-bounded-transcript-context.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-20-clip-summaries-now-finish-without-sending-a-long-transcript-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-20-clips-agents-only-discover-recordings-you-own-or-have-alread.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-20-hosted-recordings-no-longer-start-with-an-impossible-buffered-upload.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-20-meeting-recordings-now-offer-a-cleaner-transcript-view-with-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-20-rewind-capture-status.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-20-shared-clips-can-be-shared-with-limited-access-and-cards-sho.md +6 -0
- package/corpus/templates/clips/desktop/src/app.tsx +81 -71
- package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +12 -8
- package/corpus/templates/clips/desktop/src/lib/rewind-status.ts +103 -0
- package/corpus/templates/clips/desktop/src/overlays/pill-logo.tsx +2 -15
- package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +107 -340
- package/corpus/templates/clips/desktop/src/styles.css +37 -145
- package/corpus/templates/clips/desktop/src-tauri/src/recording_indicator.rs +6 -7
- package/corpus/templates/clips/server/lib/agent-recording-access.ts +73 -0
- package/corpus/templates/clips/server/plugins/agent-chat.ts +5 -2
- package/corpus/templates/plan/app/lib/plan-local-bridge.ts +18 -0
- package/corpus/templates/plan/app/pages/PlansPage.tsx +10 -11
- package/corpus/templates/plan/changelog/2026-07-20-bridged-local-plans-now-load-comments-from-the-local-workspace.md +6 -0
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +27 -4
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
- package/dist/agent/engine/anthropic-engine.js +19 -4
- package/dist/agent/engine/anthropic-engine.js.map +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +40 -7
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/first-event-timeout.d.ts +25 -0
- package/dist/agent/engine/first-event-timeout.d.ts.map +1 -0
- package/dist/agent/engine/first-event-timeout.js +49 -0
- package/dist/agent/engine/first-event-timeout.js.map +1 -0
- package/dist/cli/pr-visual-recap-workflow.d.ts +2 -2
- package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -1
- package/dist/cli/pr-visual-recap-workflow.js +2 -2
- package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +7 -3
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +1 -1
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +193 -1
- package/dist/extensions/actions.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/integrations/computer-supervision-store.js +4 -4
- package/dist/integrations/computer-supervision-store.js.map +1 -1
- package/dist/integrations/pending-tasks-store.js +1 -1
- package/dist/integrations/pending-tasks-store.js.map +1 -1
- package/dist/integrations/remote-commands-store.js +5 -5
- package/dist/integrations/remote-commands-store.js.map +1 -1
- package/dist/integrations/remote-devices-store.js +3 -3
- package/dist/integrations/remote-devices-store.js.map +1 -1
- package/dist/integrations/remote-push-store.js +3 -3
- package/dist/integrations/remote-push-store.js.map +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/routes.d.ts +3 -3
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +23 -1
- package/dist/observability/traces.js.map +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/routes.d.ts +3 -3
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +23 -1
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/http-response-telemetry.d.ts +2 -0
- package/dist/server/http-response-telemetry.d.ts.map +1 -1
- package/dist/server/http-response-telemetry.js +5 -1
- package/dist/server/http-response-telemetry.js.map +1 -1
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +19 -0
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +1 -1
- package/package.json +2 -2
- package/src/agent/engine/ai-sdk-engine.ts +31 -3
- package/src/agent/engine/anthropic-engine.ts +20 -3
- package/src/agent/engine/builder-engine.ts +56 -9
- package/src/agent/engine/first-event-timeout.ts +64 -0
- package/src/cli/pr-visual-recap-workflow.ts +2 -3
- package/src/client/AssistantChat.tsx +7 -3
- package/src/client/resources/ResourcesPanel.tsx +1 -1
- package/src/extensions/actions.ts +219 -0
- package/src/integrations/computer-supervision-store.ts +4 -4
- package/src/integrations/pending-tasks-store.ts +1 -1
- package/src/integrations/remote-commands-store.ts +5 -5
- package/src/integrations/remote-devices-store.ts +3 -3
- package/src/integrations/remote-push-store.ts +3 -3
- package/src/observability/traces.ts +38 -1
- package/src/server/action-routes.ts +23 -1
- package/src/server/http-response-telemetry.ts +6 -1
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +19 -0
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +1 -1
|
@@ -62,11 +62,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
|
|
|
62
62
|
error: string;
|
|
63
63
|
states?: undefined;
|
|
64
64
|
} | {
|
|
65
|
+
error?: undefined;
|
|
65
66
|
states: {
|
|
66
67
|
clientId: number;
|
|
67
68
|
state: string;
|
|
68
69
|
}[];
|
|
69
|
-
error?: undefined;
|
|
70
70
|
}>>;
|
|
71
71
|
/**
|
|
72
72
|
* GET /_agent-native/collab/:docId/users
|
|
@@ -77,10 +77,10 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
|
|
|
77
77
|
error: string;
|
|
78
78
|
users?: undefined;
|
|
79
79
|
} | {
|
|
80
|
+
error?: undefined;
|
|
80
81
|
users: {
|
|
81
82
|
clientId: number;
|
|
82
83
|
lastSeen: number;
|
|
83
84
|
}[];
|
|
84
|
-
error?: undefined;
|
|
85
85
|
}>>;
|
|
86
86
|
//# sourceMappingURL=awareness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"awareness.d.ts","sourceRoot":"","sources":["../../src/collab/awareness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgB3C,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAOD,eAAO,MAAM,sBAAsB,EAAG,kBAA2B,CAAC;AAElE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,MAAM,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAOD,wBAAgB,mBAAmB,IAAI,YAAY,CAElD;AAED,wBAAgB,sBAAsB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GAoB1D,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;kBAYM,MAAM;kBAAY,MAAM;;GAMvD,CAAC"}
|
package/dist/collab/routes.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
|
|
|
26
26
|
* Body: { update: string (base64), requestSource?: string }
|
|
27
27
|
*/
|
|
28
28
|
export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
29
|
-
ok?: undefined;
|
|
30
29
|
error: string;
|
|
30
|
+
ok?: undefined;
|
|
31
31
|
} | {
|
|
32
32
|
error?: undefined;
|
|
33
33
|
ok: boolean;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
|
|
14
14
|
*/
|
|
15
15
|
export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
16
|
-
error: string;
|
|
17
16
|
ok?: undefined;
|
|
17
|
+
error: string;
|
|
18
18
|
} | {
|
|
19
19
|
error?: undefined;
|
|
20
20
|
ok: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/extensions/actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/extensions/actions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAkEhE,wBAAgB,4BAA4B,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAgyC1E"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
1
2
|
import { ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER } from "../action-ui.js";
|
|
2
3
|
import { AgentActionStopError } from "../action.js";
|
|
3
4
|
import { writeAppState } from "../application-state/script-helpers.js";
|
|
5
|
+
import { getDbExec, isPostgres } from "../db/client.js";
|
|
4
6
|
import { readResource } from "../resources/script-helpers.js";
|
|
5
7
|
import { getRequestOrgId, getRequestRunContext, getRequestUserEmail, } from "../server/request-context.js";
|
|
6
8
|
import { resolveAccess } from "../sharing/access.js";
|
|
@@ -9,7 +11,7 @@ import { ExtensionContentEditError } from "./content-patch.js";
|
|
|
9
11
|
import { getLocalExtension, isLocalExtensionRow, listLocalExtensions, } from "./local.js";
|
|
10
12
|
import { extensionPath } from "./path.js";
|
|
11
13
|
import { addExtensionSlotTarget, installExtensionSlot, uninstallExtensionSlot, listExtensionsForSlot, listSlotsForExtension, } from "./slots/store.js";
|
|
12
|
-
import { createExtension, deleteExtension, findRecentDuplicateExtension, getHiddenExtensionIdsForCurrentUser, getExtension, getExtensionHistoryVersion, globalHideExtension, globalUnhideExtension, hideExtension, listExtensionHistory, listExtensions, restoreExtensionHistoryVersion, unhideExtension, updateExtension, updateExtensionContent, } from "./store.js";
|
|
14
|
+
import { createExtension, deleteExtension, ensureExtensionsTables, findRecentDuplicateExtension, getHiddenExtensionIdsForCurrentUser, getExtension, getExtensionHistoryVersion, globalHideExtension, globalUnhideExtension, hideExtension, listExtensionHistory, listExtensions, notifyExtensionChangeForResource, restoreExtensionHistoryVersion, unhideExtension, updateExtension, updateExtensionContent, } from "./store.js";
|
|
13
15
|
// A 200k extension body containing JSON-sensitive HTML/JS characters (quotes,
|
|
14
16
|
// backslashes, and newlines) expands to about 400k characters when pretty-JSON
|
|
15
17
|
// serialized by the agent loop. A history detail can carry the current and
|
|
@@ -689,6 +691,196 @@ export function createExtensionActionEntries() {
|
|
|
689
691
|
};
|
|
690
692
|
},
|
|
691
693
|
},
|
|
694
|
+
"extension-data-set": {
|
|
695
|
+
tool: {
|
|
696
|
+
description: "Write a value to an extension's extensionData store (the tool_data table) from the agent side. Use this when the agent needs to update or seed data that an extension reads via extensionData.get() at render time. Requires editor access to the extension.",
|
|
697
|
+
parameters: {
|
|
698
|
+
type: "object",
|
|
699
|
+
properties: {
|
|
700
|
+
extensionId: {
|
|
701
|
+
type: "string",
|
|
702
|
+
description: "Extension id whose data store to write to.",
|
|
703
|
+
},
|
|
704
|
+
collection: {
|
|
705
|
+
type: "string",
|
|
706
|
+
description: "Collection name within the extension's data store.",
|
|
707
|
+
},
|
|
708
|
+
itemId: {
|
|
709
|
+
type: "string",
|
|
710
|
+
description: "Item id within the collection. Upserts if it already exists.",
|
|
711
|
+
},
|
|
712
|
+
data: {
|
|
713
|
+
description: "The data value to store. Objects are JSON-serialized automatically.",
|
|
714
|
+
},
|
|
715
|
+
scope: {
|
|
716
|
+
type: "string",
|
|
717
|
+
enum: ["user", "org"],
|
|
718
|
+
description: "Storage scope. 'user' (default) is private to the current user; 'org' is shared across the organization.",
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
required: ["extensionId", "collection", "itemId", "data"],
|
|
722
|
+
},
|
|
723
|
+
},
|
|
724
|
+
run: async (args) => {
|
|
725
|
+
const extensionId = String(args?.extensionId ?? "").trim();
|
|
726
|
+
const collection = String(args?.collection ?? "").trim();
|
|
727
|
+
const itemId = String(args?.itemId ?? "").trim();
|
|
728
|
+
if (!extensionId || !collection || !itemId)
|
|
729
|
+
return "Error: extensionId, collection, and itemId are required.";
|
|
730
|
+
if (args?.data === undefined)
|
|
731
|
+
return "Error: data is required.";
|
|
732
|
+
await ensureExtensionsTables();
|
|
733
|
+
const access = await resolveAccess("extension", extensionId);
|
|
734
|
+
if (!access || access.role === "viewer")
|
|
735
|
+
return `Error: editor access required for extension ${extensionId}.`;
|
|
736
|
+
const userEmail = getRequestUserEmail()?.toLowerCase() ?? "";
|
|
737
|
+
const scope = args?.scope === "org" ? "org" : "user";
|
|
738
|
+
const orgId = getRequestOrgId();
|
|
739
|
+
if (scope === "org" && !orgId)
|
|
740
|
+
return "Error: org context required for scope=org.";
|
|
741
|
+
const data = typeof args.data === "string" ? args.data : JSON.stringify(args.data);
|
|
742
|
+
const MAX_BYTES = 1024 * 1024;
|
|
743
|
+
if (Buffer.byteLength(data, "utf8") > MAX_BYTES)
|
|
744
|
+
return `Error: data exceeds ${MAX_BYTES} byte limit. Store large payloads in file storage instead.`;
|
|
745
|
+
const now = new Date().toISOString();
|
|
746
|
+
const scopeKey = scope === "org" ? `org:${orgId}` : userEmail;
|
|
747
|
+
const client = getDbExec();
|
|
748
|
+
const pg = isPostgres();
|
|
749
|
+
const conflictClause = pg
|
|
750
|
+
? `ON CONFLICT (tool_id, collection, scope_key, item_id)
|
|
751
|
+
DO UPDATE SET data = EXCLUDED.data, updated_at = EXCLUDED.updated_at`
|
|
752
|
+
: `ON CONFLICT (tool_id, collection, scope_key, item_id)
|
|
753
|
+
DO UPDATE SET data = excluded.data, updated_at = excluded.updated_at`;
|
|
754
|
+
await client.execute({
|
|
755
|
+
sql: `UPDATE tools SET updated_at = ? WHERE id = ?`,
|
|
756
|
+
args: [now, extensionId],
|
|
757
|
+
});
|
|
758
|
+
await client.execute({
|
|
759
|
+
sql: `INSERT INTO tool_data (id, tool_id, collection, item_id, data, owner_email, scope, org_id, scope_key, created_at, updated_at)
|
|
760
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
761
|
+
${conflictClause}`,
|
|
762
|
+
args: [
|
|
763
|
+
randomUUID(),
|
|
764
|
+
extensionId,
|
|
765
|
+
collection,
|
|
766
|
+
itemId,
|
|
767
|
+
data,
|
|
768
|
+
userEmail,
|
|
769
|
+
scope,
|
|
770
|
+
scope === "org" ? orgId : null,
|
|
771
|
+
scopeKey,
|
|
772
|
+
now,
|
|
773
|
+
now,
|
|
774
|
+
],
|
|
775
|
+
});
|
|
776
|
+
await notifyExtensionChangeForResource(extensionId);
|
|
777
|
+
return {
|
|
778
|
+
ok: true,
|
|
779
|
+
id: itemId,
|
|
780
|
+
extensionId,
|
|
781
|
+
collection,
|
|
782
|
+
scope,
|
|
783
|
+
updatedAt: now,
|
|
784
|
+
};
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
"extension-data-get": {
|
|
788
|
+
tool: {
|
|
789
|
+
description: "Read items from an extension's extensionData store (the tool_data table) from the agent side. Use this to inspect what data an extension currently has stored, or to verify a write succeeded. Requires viewer access to the extension.",
|
|
790
|
+
parameters: {
|
|
791
|
+
type: "object",
|
|
792
|
+
properties: {
|
|
793
|
+
extensionId: {
|
|
794
|
+
type: "string",
|
|
795
|
+
description: "Extension id whose data store to read from.",
|
|
796
|
+
},
|
|
797
|
+
collection: {
|
|
798
|
+
type: "string",
|
|
799
|
+
description: "Collection name within the extension's data store.",
|
|
800
|
+
},
|
|
801
|
+
itemId: {
|
|
802
|
+
type: "string",
|
|
803
|
+
description: "Optional specific item id. If omitted, lists all items in the collection.",
|
|
804
|
+
},
|
|
805
|
+
scope: {
|
|
806
|
+
type: "string",
|
|
807
|
+
enum: ["user", "org", "all"],
|
|
808
|
+
description: "Storage scope to read. 'user' (default) reads the current user's items; 'org' reads organization-shared items; 'all' reads both.",
|
|
809
|
+
},
|
|
810
|
+
limit: {
|
|
811
|
+
type: "number",
|
|
812
|
+
description: "Maximum items to return when listing (default 100, max 1000).",
|
|
813
|
+
},
|
|
814
|
+
},
|
|
815
|
+
required: ["extensionId", "collection"],
|
|
816
|
+
},
|
|
817
|
+
},
|
|
818
|
+
run: async (args) => {
|
|
819
|
+
const extensionId = String(args?.extensionId ?? "").trim();
|
|
820
|
+
const collection = String(args?.collection ?? "").trim();
|
|
821
|
+
if (!extensionId || !collection)
|
|
822
|
+
return "Error: extensionId and collection are required.";
|
|
823
|
+
await ensureExtensionsTables();
|
|
824
|
+
const access = await resolveAccess("extension", extensionId);
|
|
825
|
+
if (!access)
|
|
826
|
+
return `Error: no access to extension ${extensionId}.`;
|
|
827
|
+
const userEmail = getRequestUserEmail()?.toLowerCase() ?? "";
|
|
828
|
+
const scope = args?.scope ?? "user";
|
|
829
|
+
const orgId = getRequestOrgId();
|
|
830
|
+
if ((scope === "org" || scope === "all") && !orgId)
|
|
831
|
+
return "Error: org context required for scope=org or scope=all.";
|
|
832
|
+
const itemId = args?.itemId ? String(args.itemId).trim() : null;
|
|
833
|
+
const limit = Math.min(Math.max(1, Number(args?.limit) || 100), 1000);
|
|
834
|
+
const client = getDbExec();
|
|
835
|
+
if (itemId) {
|
|
836
|
+
const scopeClause = scope === "org"
|
|
837
|
+
? `AND scope = 'org' AND org_id = ?`
|
|
838
|
+
: scope === "all"
|
|
839
|
+
? `AND ((scope = 'user' AND lower(owner_email) = ?) OR (scope = 'org' AND org_id = ?))`
|
|
840
|
+
: `AND scope = 'user' AND lower(owner_email) = ?`;
|
|
841
|
+
const scopeArgs = scope === "org"
|
|
842
|
+
? [orgId ?? ""]
|
|
843
|
+
: scope === "all"
|
|
844
|
+
? [userEmail, orgId ?? ""]
|
|
845
|
+
: [userEmail];
|
|
846
|
+
const result = await client.execute({
|
|
847
|
+
sql: `SELECT COALESCE(item_id, id) AS id, data, scope, owner_email, updated_at
|
|
848
|
+
FROM tool_data
|
|
849
|
+
WHERE tool_id = ? AND collection = ? AND COALESCE(item_id, id) = ? ${scopeClause}`,
|
|
850
|
+
args: [extensionId, collection, itemId, ...scopeArgs],
|
|
851
|
+
});
|
|
852
|
+
const row = result.rows?.[0];
|
|
853
|
+
if (!row)
|
|
854
|
+
return { found: false, extensionId, collection, itemId };
|
|
855
|
+
return { found: true, ...row };
|
|
856
|
+
}
|
|
857
|
+
const scopeClause = scope === "org"
|
|
858
|
+
? `AND scope = 'org' AND org_id = ?`
|
|
859
|
+
: scope === "all"
|
|
860
|
+
? `AND ((scope = 'user' AND lower(owner_email) = ?) OR (scope = 'org' AND org_id = ?))`
|
|
861
|
+
: `AND scope = 'user' AND lower(owner_email) = ?`;
|
|
862
|
+
const scopeArgs = scope === "org"
|
|
863
|
+
? [orgId ?? ""]
|
|
864
|
+
: scope === "all"
|
|
865
|
+
? [userEmail, orgId ?? ""]
|
|
866
|
+
: [userEmail];
|
|
867
|
+
const result = await client.execute({
|
|
868
|
+
sql: `SELECT COALESCE(item_id, id) AS id, data, scope, owner_email, updated_at
|
|
869
|
+
FROM tool_data
|
|
870
|
+
WHERE tool_id = ? AND collection = ? ${scopeClause}
|
|
871
|
+
ORDER BY updated_at DESC
|
|
872
|
+
LIMIT ?`,
|
|
873
|
+
args: [extensionId, collection, ...scopeArgs, limit],
|
|
874
|
+
});
|
|
875
|
+
return {
|
|
876
|
+
extensionId,
|
|
877
|
+
collection,
|
|
878
|
+
scope,
|
|
879
|
+
count: result.rows?.length ?? 0,
|
|
880
|
+
items: result.rows ?? [],
|
|
881
|
+
};
|
|
882
|
+
},
|
|
883
|
+
},
|
|
692
884
|
"delete-extension": {
|
|
693
885
|
tool: {
|
|
694
886
|
description: "Permanently delete an extension everywhere it is shared. Requires owner/admin access. If the user only wants a shared extension removed from their own sidebar/list, use hide-extension instead.",
|