@circuitwall/jarela 2.5.1 → 2.5.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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +5 -5
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/credentials/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/events/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +22 -1
- package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +22 -1
- package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +22 -1
- package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +19 -2
- package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +19 -2
- package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +19 -2
- package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +12 -2
- package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +12 -2
- package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/route.js +12 -2
- package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +52 -45
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/tools/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/watchers/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page.js +72982 -72980
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +5 -5
- package/.next/standalone/.next/server/chunks/1433.js +1 -1
- package/.next/standalone/.next/server/chunks/210.js +6 -6
- package/.next/standalone/.next/server/chunks/2471.js +17 -17
- package/.next/standalone/.next/server/chunks/3524.js +31 -15
- package/.next/standalone/.next/server/chunks/3566.js +1 -1
- package/.next/standalone/.next/server/chunks/4189.js +1 -1
- package/.next/standalone/.next/server/chunks/{9590.js → 423.js} +10 -3
- package/.next/standalone/.next/server/chunks/4508.js +2 -2
- package/.next/standalone/.next/server/chunks/4596.js +5 -2
- package/.next/standalone/.next/server/chunks/46.js +7 -0
- package/.next/standalone/.next/server/chunks/540.js +29 -5
- package/.next/standalone/.next/server/chunks/5585.js +41 -3
- package/.next/standalone/.next/server/chunks/5908.js +10 -10
- package/.next/standalone/.next/server/chunks/{3399.js → 6058.js} +882 -400
- package/.next/standalone/.next/server/chunks/{9164.js → 6190.js} +13777 -13530
- package/.next/standalone/.next/server/chunks/6649.js +1 -1
- package/.next/standalone/.next/server/chunks/{1388.js → 8842.js} +5961 -5793
- package/.next/standalone/.next/server/chunks/9032.js +5 -5
- package/.next/standalone/.next/server/chunks/{7547.js → 9217.js} +485 -3
- package/.next/standalone/.next/server/instrumentation.js +7 -0
- package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
- package/.next/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/standalone/.next/server/middleware.js +7 -0
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/preview-props.json +3 -3
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/app/{page-dd05bcb5f5b81157.js → page-4112e14360a9909e.js} +1576 -1574
- package/.next/standalone/docs/adoption/changesets.json +139 -0
- package/.next/standalone/package.json +2 -1
- package/CHANGELOG.md +38 -0
- package/browser-extension/background.js +5 -539
- package/browser-extension/lib/form-editing.mjs +541 -0
- package/components/chat/MessageBubble.tsx +4 -736
- package/components/chat/MessageContent.tsx +749 -0
- package/components/layout/MenuPanel.tsx +1 -1
- package/hooks/useSSE.test.ts +46 -0
- package/lib/agents/llm.ts +1 -1
- package/lib/agents/output-validator/validator.test.ts +4 -0
- package/lib/agents/output-validator/validator.ts +1 -1
- package/lib/agents/prompt-registry.test.ts +11 -0
- package/lib/agents/prompt-registry.ts +13 -0
- package/lib/agents/retry-prompts.ts +17 -0
- package/lib/agents/run-retry.ts +671 -0
- package/lib/agents/run-thread.retry.test.ts +176 -2
- package/lib/agents/run-thread.test.ts +6 -6
- package/lib/agents/run-thread.ts +9 -717
- package/lib/agents/stream-collector.test.ts +28 -4
- package/lib/agents/stream-collector.ts +5 -28
- package/lib/agents/tool-outcomes.ts +61 -0
- package/lib/documents/remote/confluence.test.ts +65 -0
- package/lib/documents/remote/confluence.ts +35 -9
- package/lib/documents/remote/jira.ts +1 -1
- package/lib/health/probes.test.ts +32 -0
- package/lib/health/probes.ts +29 -14
- package/lib/integrations/atlassian/manifest.ts +5 -3
- package/lib/integrations/github/manifest.ts +7 -4
- package/lib/integrations/gmail-oauth.ts +16 -1
- package/lib/integrations/microsoft-oauth.ts +17 -2
- package/lib/integrations/outlook/manifest.ts +10 -8
- package/lib/stores/integrations.ts +1 -0
- package/lib/tools/communications/calendar-aliases.test.ts +77 -1
- package/lib/tools/communications/gmail.test.ts +13 -0
- package/lib/tools/communications/ms-graph.test.ts +26 -3
- package/lib/tools/communications/ms-graph.ts +9 -11
- package/lib/tools/communications/outlook-calendar.ts +94 -17
- package/lib/tools/packages/default-packages/atlassian.ts +8 -2
- package/package.json +2 -1
- package/scripts/standalone-footprint.mjs +1 -1
- /package/.next/standalone/.next/static/{XFZTDssHBZKKX2mzH2ld0 → VZXMorlOmSmi3dUr7K5UX}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{XFZTDssHBZKKX2mzH2ld0 → VZXMorlOmSmi3dUr7K5UX}/_ssgManifest.js +0 -0
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
2
|
import { outlookCalendarCreateEventTool, outlookCalendarUpdateEventTool } from "@/lib/tools/communications/outlook-calendar";
|
|
3
3
|
import { calendarCreateEventTool, calendarUpdateEventTool } from "@/lib/tools/communications/calendar";
|
|
4
4
|
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
vi.unstubAllGlobals();
|
|
7
|
+
vi.unstubAllEnvs();
|
|
8
|
+
});
|
|
9
|
+
|
|
5
10
|
// The Outlook tools take `subject`; the Google tools take `summary`.
|
|
6
11
|
// Agents routinely mix the two — accept each platform's foreign name as an
|
|
7
12
|
// alias so the first tool call doesn't fail schema validation.
|
|
@@ -33,6 +38,77 @@ describe("calendar event title aliasing", () => {
|
|
|
33
38
|
expect(parsed.subject).toBe("Native");
|
|
34
39
|
});
|
|
35
40
|
|
|
41
|
+
it("rejects impossible RFC3339 calendar dates and offsets", () => {
|
|
42
|
+
const schema = outlookCalendarCreateEventTool.schema!;
|
|
43
|
+
expect(() => schema.parse({
|
|
44
|
+
subject: "Invalid date",
|
|
45
|
+
start_iso: "2026-02-31T10:00:00Z",
|
|
46
|
+
end_iso: "2026-03-01T11:00:00Z",
|
|
47
|
+
})).toThrow();
|
|
48
|
+
expect(() => schema.parse({
|
|
49
|
+
subject: "Invalid offset",
|
|
50
|
+
start_iso: "2026-01-01T10:00:00+24:00",
|
|
51
|
+
end_iso: "2026-01-01T11:00:00Z",
|
|
52
|
+
})).toThrow();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("converts RFC3339 instants to offset-free Graph times in the requested IANA zone", async () => {
|
|
56
|
+
vi.stubEnv("OUTLOOK_CLIENT_ID", "test-client");
|
|
57
|
+
vi.stubEnv("OUTLOOK_CLIENT_SECRET", "test-secret");
|
|
58
|
+
vi.stubEnv("OUTLOOK_REFRESH_TOKEN", "outlook-calendar-timezone-contract");
|
|
59
|
+
const calls: Array<{ url: string; body?: string }> = [];
|
|
60
|
+
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
61
|
+
const url = String(input);
|
|
62
|
+
if (url.includes("/oauth2/")) {
|
|
63
|
+
return new Response(JSON.stringify({ access_token: "at", expires_in: 3600 }), { status: 200 });
|
|
64
|
+
}
|
|
65
|
+
calls.push({ url, body: init?.body as string | undefined });
|
|
66
|
+
return new Response(JSON.stringify({ id: "event-1" }), {
|
|
67
|
+
status: 201,
|
|
68
|
+
headers: { "content-type": "application/json" },
|
|
69
|
+
});
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
await outlookCalendarCreateEventTool.invoke({
|
|
73
|
+
subject: "Appointment",
|
|
74
|
+
start_iso: "2026-01-01T18:00:00.000001Z",
|
|
75
|
+
end_iso: "2026-01-01T19:30:00.123456Z",
|
|
76
|
+
time_zone: "America/Los_Angeles",
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const body = JSON.parse(calls[0].body ?? "{}");
|
|
80
|
+
expect(body.start).toEqual({ dateTime: "2026-01-01T10:00:00.000001", timeZone: "America/Los_Angeles" });
|
|
81
|
+
expect(body.end).toEqual({ dateTime: "2026-01-01T11:30:00.123456", timeZone: "America/Los_Angeles" });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("maps Windows timezone names for conversion and preserves them for Graph", async () => {
|
|
85
|
+
vi.stubEnv("OUTLOOK_CLIENT_ID", "test-client");
|
|
86
|
+
vi.stubEnv("OUTLOOK_CLIENT_SECRET", "test-secret");
|
|
87
|
+
vi.stubEnv("OUTLOOK_REFRESH_TOKEN", "outlook-calendar-windows-timezone");
|
|
88
|
+
const calls: Array<{ url: string; body?: string }> = [];
|
|
89
|
+
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
90
|
+
const url = String(input);
|
|
91
|
+
if (url.includes("/oauth2/")) {
|
|
92
|
+
return new Response(JSON.stringify({ access_token: "at", expires_in: 3600 }), { status: 200 });
|
|
93
|
+
}
|
|
94
|
+
calls.push({ url, body: init?.body as string | undefined });
|
|
95
|
+
return new Response(JSON.stringify({ id: "event-1" }), {
|
|
96
|
+
status: 201,
|
|
97
|
+
headers: { "content-type": "application/json" },
|
|
98
|
+
});
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
await outlookCalendarCreateEventTool.invoke({
|
|
102
|
+
subject: "Appointment",
|
|
103
|
+
start_iso: "2026-01-01T18:00:00Z",
|
|
104
|
+
end_iso: "2026-01-01T19:00:00Z",
|
|
105
|
+
time_zone: "Pacific Standard Time",
|
|
106
|
+
});
|
|
107
|
+
const body = JSON.parse(calls[0].body ?? "{}");
|
|
108
|
+
expect(body.start).toEqual({ dateTime: "2026-01-01T10:00:00", timeZone: "Pacific Standard Time" });
|
|
109
|
+
expect(body.end).toEqual({ dateTime: "2026-01-01T11:00:00", timeZone: "Pacific Standard Time" });
|
|
110
|
+
});
|
|
111
|
+
|
|
36
112
|
it("google create accepts `subject` alias", () => {
|
|
37
113
|
const schema = calendarCreateEventTool.schema!;
|
|
38
114
|
const parsed = schema.parse({
|
|
@@ -59,6 +59,19 @@ describe("gmail source links", () => {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
describe("gmail tools", () => {
|
|
62
|
+
it("rejects external absolute Google API URLs before refreshing or sending a bearer token", async () => {
|
|
63
|
+
const fetchMock = vi.fn();
|
|
64
|
+
vi.stubGlobal("fetch", fetchMock);
|
|
65
|
+
const result = await googleFetch(
|
|
66
|
+
{ client_id: "test-client", client_secret: "test-secret", refresh_token: "external-url-test-refresh-token" },
|
|
67
|
+
"Gmail",
|
|
68
|
+
"https://gmail.googleapis.com/gmail/v1/users/me",
|
|
69
|
+
"https://attacker.example/collect",
|
|
70
|
+
);
|
|
71
|
+
expect(result.error).toMatch(/gmail.googleapis.com/);
|
|
72
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
73
|
+
});
|
|
74
|
+
|
|
62
75
|
it("decodes gzip Google API responses without a Content-Encoding header", async () => {
|
|
63
76
|
const baseUrl = "https://gmail.googleapis.com/gmail/v1/users/me";
|
|
64
77
|
const fetchMock = vi.fn()
|
|
@@ -77,6 +77,15 @@ afterEach(() => {
|
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
describe("graphFetch resilience", () => {
|
|
80
|
+
it("rejects external absolute URLs before refreshing or sending a Graph token", async () => {
|
|
81
|
+
const { graphFetch, resolveMicrosoftAuth } = await import("@/lib/integrations/microsoft-oauth");
|
|
82
|
+
const auth = resolveMicrosoftAuth() as { client_id: string; client_secret: string; refresh_token: string };
|
|
83
|
+
const result = await graphFetch(auth, "https://attacker.example/collect") as { error?: string };
|
|
84
|
+
expect(result.error).toMatch(/graph.microsoft.com/);
|
|
85
|
+
expect(graphCalls).toHaveLength(0);
|
|
86
|
+
expect(tokenCalls).toBe(0);
|
|
87
|
+
});
|
|
88
|
+
|
|
80
89
|
it("retries once on 401 after refreshing the access token", { timeout: 10_000 }, async () => {
|
|
81
90
|
const { graphFetch, resolveMicrosoftAuth } = await import("@/lib/integrations/microsoft-oauth");
|
|
82
91
|
const auth = resolveMicrosoftAuth() as { client_id: string; client_secret: string; refresh_token: string };
|
|
@@ -206,6 +215,20 @@ describe("ms_graph_get", () => {
|
|
|
206
215
|
});
|
|
207
216
|
|
|
208
217
|
describe("ms_search", () => {
|
|
218
|
+
it("requests scopes for its default mail, event, file, and SharePoint search types", async () => {
|
|
219
|
+
const { MICROSOFT_SCOPES } = await import("@/lib/integrations/microsoft-oauth");
|
|
220
|
+
expect(MICROSOFT_SCOPES).toContain("Mail.ReadWrite");
|
|
221
|
+
expect(MICROSOFT_SCOPES).toContain("Calendars.ReadWrite");
|
|
222
|
+
expect(MICROSOFT_SCOPES).toContain("Files.Read.All");
|
|
223
|
+
expect(MICROSOFT_SCOPES).toContain("Sites.Read.All");
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it("rejects entity types whose scopes are not requested", async () => {
|
|
227
|
+
const { search } = await loadTools();
|
|
228
|
+
expect(search.schema.safeParse({ query: "q4", entity_types: ["chatMessage"] }).success).toBe(false);
|
|
229
|
+
expect(search.schema.safeParse({ query: "q4", entity_types: ["person"] }).success).toBe(false);
|
|
230
|
+
});
|
|
231
|
+
|
|
209
232
|
it("POSTs /search/query with default entity types and slims hits", async () => {
|
|
210
233
|
const { search } = await loadTools();
|
|
211
234
|
queueGraph({
|
|
@@ -258,12 +281,12 @@ describe("ms_search", () => {
|
|
|
258
281
|
});
|
|
259
282
|
});
|
|
260
283
|
|
|
261
|
-
it("respects custom
|
|
284
|
+
it("respects a supported custom entity type and size", async () => {
|
|
262
285
|
const { search } = await loadTools();
|
|
263
286
|
queueGraph({ status: 200, body: { value: [] } });
|
|
264
|
-
await search.invoke({ query: "alice", entity_types: ["
|
|
287
|
+
await search.invoke({ query: "alice", entity_types: ["site"], size: 3 });
|
|
265
288
|
const sent = JSON.parse(graphCalls[0].init.body as string);
|
|
266
|
-
expect(sent.requests[0].entityTypes).toEqual(["
|
|
289
|
+
expect(sent.requests[0].entityTypes).toEqual(["site"]);
|
|
267
290
|
expect(sent.requests[0].size).toBe(3);
|
|
268
291
|
});
|
|
269
292
|
|
|
@@ -182,7 +182,10 @@ const msSearchTool = tool(
|
|
|
182
182
|
body: JSON.stringify(body),
|
|
183
183
|
})) as { value?: SearchContainer[]; error?: string };
|
|
184
184
|
if (result && typeof result === "object" && "error" in result && result.error) {
|
|
185
|
-
return JSON.stringify({
|
|
185
|
+
return JSON.stringify({
|
|
186
|
+
error: result.error,
|
|
187
|
+
requested_entity_types: entityTypes,
|
|
188
|
+
});
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
const containers = result.value ?? [];
|
|
@@ -205,11 +208,12 @@ const msSearchTool = tool(
|
|
|
205
208
|
{
|
|
206
209
|
name: "ms_search",
|
|
207
210
|
description:
|
|
208
|
-
"Search
|
|
209
|
-
"
|
|
211
|
+
"Search Microsoft 365 mail, calendar events, OneDrive/SharePoint files, lists, and sites " +
|
|
212
|
+
"in one call. Requires a work or school account; personal Microsoft accounts are not " +
|
|
213
|
+
"supported by Microsoft Search. Use ms_people_resolve for people lookup. Returns slimmed hits with " +
|
|
210
214
|
"{kind,id,title,summary,url,last_modified,rank}. Defaults to entity_types=" +
|
|
211
215
|
"['message','event','driveItem','listItem']. Override entity_types for narrower searches " +
|
|
212
|
-
"(e.g. ['
|
|
216
|
+
"(e.g. ['site'] for SharePoint sites).",
|
|
213
217
|
schema: z.object({
|
|
214
218
|
query: z.string().min(1).max(300).regex(SAFE_SEARCH_QUERY, "Use a simple Microsoft Search query without quotes, braces, or newlines").describe("Free-text search query. Keep it simple; quotes/braces/newlines are rejected to avoid malformed KQL."),
|
|
215
219
|
entity_types: z
|
|
@@ -219,17 +223,11 @@ const msSearchTool = tool(
|
|
|
219
223
|
"event",
|
|
220
224
|
"driveItem",
|
|
221
225
|
"listItem",
|
|
222
|
-
"list",
|
|
223
226
|
"site",
|
|
224
|
-
"person",
|
|
225
|
-
"chatMessage",
|
|
226
|
-
"bookmark",
|
|
227
|
-
"acronym",
|
|
228
|
-
"qna",
|
|
229
227
|
]),
|
|
230
228
|
)
|
|
231
229
|
.optional()
|
|
232
|
-
.describe("Which workloads to search.
|
|
230
|
+
.describe("Which workloads to search. Supported: message,event,driveItem,listItem,site. File and SharePoint results need their corresponding delegated scopes."),
|
|
233
231
|
size: z.number().int().min(1).max(25).optional().describe("Max hits to return (default 10)"),
|
|
234
232
|
}),
|
|
235
233
|
},
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* carries over between providers.
|
|
5
5
|
*
|
|
6
6
|
* Graph differences vs Google Calendar worth knowing:
|
|
7
|
-
* - Each event's start/end is { dateTime, timeZone }
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* - Each event's start/end is { dateTime, timeZone }; dateTime is a local
|
|
8
|
+
* wall-clock value without an offset. Inputs are RFC3339 instants and
|
|
9
|
+
* are converted to that shape in the requested IANA or Windows zone (UTC by default).
|
|
10
|
+
* We pass an explicit `Prefer: outlook.timezone="UTC"`
|
|
10
11
|
* header so reads come back in UTC and the agent doesn't have to
|
|
11
12
|
* navigate two TZ namespaces.
|
|
12
13
|
* - Listing events in a window uses /calendarView (auto-expands
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
*/
|
|
19
20
|
import { tool } from "@langchain/core/tools";
|
|
20
21
|
import { z } from "zod";
|
|
22
|
+
import { findIanaFromWindows } from "winzones";
|
|
21
23
|
import { registerLangChainPackage } from "../packages/langchain-package";
|
|
22
24
|
import { citeAs } from "@/lib/utils/source-link";
|
|
23
25
|
import {
|
|
@@ -40,6 +42,72 @@ interface GraphDateTimeTimeZone {
|
|
|
40
42
|
timeZone?: string;
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
const RFC3339_DATETIME = /^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})T(?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})(?<fraction>\.\d+)?(?<zone>Z|(?<sign>[+-])(?<offsetHour>\d{2}):(?<offsetMinute>\d{2}))$/;
|
|
46
|
+
|
|
47
|
+
function isValidRfc3339DateTime(value: string): boolean {
|
|
48
|
+
const match = RFC3339_DATETIME.exec(value);
|
|
49
|
+
const fields = match?.groups;
|
|
50
|
+
if (!fields) return false;
|
|
51
|
+
const year = Number(fields.year);
|
|
52
|
+
const month = Number(fields.month);
|
|
53
|
+
const day = Number(fields.day);
|
|
54
|
+
const hour = Number(fields.hour);
|
|
55
|
+
const minute = Number(fields.minute);
|
|
56
|
+
const second = Number(fields.second);
|
|
57
|
+
const offsetHour = Number(fields.offsetHour ?? 0);
|
|
58
|
+
const offsetMinute = Number(fields.offsetMinute ?? 0);
|
|
59
|
+
const leapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
60
|
+
const daysInMonth = [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
61
|
+
|
|
62
|
+
return month >= 1 && month <= 12
|
|
63
|
+
&& day >= 1 && day <= daysInMonth[month - 1]
|
|
64
|
+
&& hour <= 23 && minute <= 59 && second <= 59
|
|
65
|
+
&& offsetHour <= 23 && offsetMinute <= 59;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const rfc3339DateTime = z.string().refine(
|
|
69
|
+
isValidRfc3339DateTime,
|
|
70
|
+
"Use a valid full RFC3339 datetime with an offset, such as 2026-05-19T16:00:00-07:00 or 2026-05-19T23:00:00Z",
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
function toGraphDateTime(value: string, timeZone: string): GraphDateTimeTimeZone | { error: string } {
|
|
74
|
+
const instant = new Date(value);
|
|
75
|
+
if (Number.isNaN(instant.getTime())) return { error: `invalid RFC3339 datetime: ${value}` };
|
|
76
|
+
const fractionalSecond = RFC3339_DATETIME.exec(value)?.groups?.fraction ?? "";
|
|
77
|
+
let ianaTimeZone = timeZone;
|
|
78
|
+
try {
|
|
79
|
+
new Intl.DateTimeFormat("en", { timeZone: ianaTimeZone });
|
|
80
|
+
} catch {
|
|
81
|
+
ianaTimeZone = findIanaFromWindows(timeZone)?.[0] ?? "";
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
if (!ianaTimeZone) throw new RangeError("Unknown timezone");
|
|
85
|
+
const parts = new Intl.DateTimeFormat("en-CA", {
|
|
86
|
+
calendar: "gregory",
|
|
87
|
+
numberingSystem: "latn",
|
|
88
|
+
timeZone: ianaTimeZone,
|
|
89
|
+
year: "numeric",
|
|
90
|
+
month: "2-digit",
|
|
91
|
+
day: "2-digit",
|
|
92
|
+
hour: "2-digit",
|
|
93
|
+
minute: "2-digit",
|
|
94
|
+
second: "2-digit",
|
|
95
|
+
hourCycle: "h23",
|
|
96
|
+
}).formatToParts(instant);
|
|
97
|
+
const values = Object.fromEntries(parts.map((part) => [part.type, part.value]));
|
|
98
|
+
const { year, month, day, hour, minute, second } = values;
|
|
99
|
+
if (!year || !month || !day || !hour || !minute || !second) {
|
|
100
|
+
return { error: "could not convert datetime to Microsoft Graph local time" };
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
dateTime: `${year}-${month}-${day}T${hour}:${minute}:${second}${fractionalSecond}`,
|
|
104
|
+
timeZone,
|
|
105
|
+
};
|
|
106
|
+
} catch {
|
|
107
|
+
return { error: `unsupported timezone "${timeZone}"; use an IANA or Windows timezone such as America/Los_Angeles or Pacific Standard Time` };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
43
111
|
interface GraphAttendee {
|
|
44
112
|
emailAddress?: { name?: string; address?: string };
|
|
45
113
|
status?: { response?: string; time?: string };
|
|
@@ -210,14 +278,15 @@ export const outlookCalendarCreateEventTool = tool(
|
|
|
210
278
|
isOnlineMeeting?: boolean;
|
|
211
279
|
onlineMeetingProvider?: string;
|
|
212
280
|
}
|
|
213
|
-
// Graph uses Windows TZ names by default but also accepts IANA names
|
|
214
|
-
// when the body specifies them per-field. Default to UTC if the
|
|
215
|
-
// caller omits time_zone (matches the list endpoint's behavior).
|
|
216
281
|
const tz = time_zone ?? "UTC";
|
|
282
|
+
const start = toGraphDateTime(start_iso, tz);
|
|
283
|
+
const end = toGraphDateTime(end_iso, tz);
|
|
284
|
+
if ("error" in start) return JSON.stringify(start);
|
|
285
|
+
if ("error" in end) return JSON.stringify(end);
|
|
217
286
|
const body: EventBody = {
|
|
218
287
|
subject: eventSubject,
|
|
219
|
-
start
|
|
220
|
-
end
|
|
288
|
+
start,
|
|
289
|
+
end,
|
|
221
290
|
};
|
|
222
291
|
if (description) body.body = { contentType: "text", content: description };
|
|
223
292
|
if (location) body.location = { displayName: location };
|
|
@@ -247,7 +316,7 @@ export const outlookCalendarCreateEventTool = tool(
|
|
|
247
316
|
name: "outlook_calendar_create_event",
|
|
248
317
|
description:
|
|
249
318
|
"Create an Outlook calendar event. Datetimes are RFC3339 strings; pair " +
|
|
250
|
-
"with `time_zone` (IANA like 'America/Los_Angeles' or Windows
|
|
319
|
+
"with `time_zone` (IANA like 'America/Los_Angeles' or Windows ID like " +
|
|
251
320
|
"'Pacific Standard Time') so Outlook interprets them correctly. Defaults " +
|
|
252
321
|
"to UTC if omitted. Attendees are automatically sent invites. Set " +
|
|
253
322
|
"`add_teams_link: true` to provision a Teams meeting URL (requires a " +
|
|
@@ -257,12 +326,12 @@ export const outlookCalendarCreateEventTool = tool(
|
|
|
257
326
|
calendar_id: z.string().optional().describe("Calendar id (default: user's default calendar)"),
|
|
258
327
|
subject: z.string().min(1).optional().describe("Event title shown on the calendar (alias: summary)"),
|
|
259
328
|
summary: z.string().min(1).optional().describe("Alias for subject (Google Calendar vocabulary)"),
|
|
260
|
-
start_iso:
|
|
261
|
-
end_iso:
|
|
329
|
+
start_iso: rfc3339DateTime.describe("Start instant, RFC3339 with offset"),
|
|
330
|
+
end_iso: rfc3339DateTime.describe("End instant, RFC3339 with offset (must be after start)"),
|
|
262
331
|
description: z.string().optional().describe("Long-form event body (plain text)"),
|
|
263
332
|
location: z.string().optional().describe("Free-text location string"),
|
|
264
333
|
attendees: z.array(z.string().email()).optional().describe("Invitee email addresses"),
|
|
265
|
-
time_zone: z.string().optional().describe("IANA or Windows timezone (default 'UTC')"),
|
|
334
|
+
time_zone: z.string().optional().describe("IANA or Windows timezone used to express the instant in Graph (default 'UTC')"),
|
|
266
335
|
add_teams_link: z.boolean().optional().describe("Provision a Teams meeting URL on this event"),
|
|
267
336
|
}),
|
|
268
337
|
},
|
|
@@ -282,8 +351,16 @@ export const outlookCalendarUpdateEventTool = tool(
|
|
|
282
351
|
if (eventSubject !== undefined) patch.subject = eventSubject;
|
|
283
352
|
if (description !== undefined) patch.body = { contentType: "text", content: description };
|
|
284
353
|
if (location !== undefined) patch.location = { displayName: location };
|
|
285
|
-
if (start_iso !== undefined)
|
|
286
|
-
|
|
354
|
+
if (start_iso !== undefined) {
|
|
355
|
+
const start = toGraphDateTime(start_iso, tz);
|
|
356
|
+
if ("error" in start) return JSON.stringify(start);
|
|
357
|
+
patch.start = start;
|
|
358
|
+
}
|
|
359
|
+
if (end_iso !== undefined) {
|
|
360
|
+
const end = toGraphDateTime(end_iso, tz);
|
|
361
|
+
if ("error" in end) return JSON.stringify(end);
|
|
362
|
+
patch.end = end;
|
|
363
|
+
}
|
|
287
364
|
if (attendees !== undefined) {
|
|
288
365
|
patch.attendees = attendees.map((address) => ({
|
|
289
366
|
emailAddress: { address },
|
|
@@ -316,12 +393,12 @@ export const outlookCalendarUpdateEventTool = tool(
|
|
|
316
393
|
event_id: z.string().describe("Event id"),
|
|
317
394
|
subject: z.string().optional().describe("New event title (alias: summary)"),
|
|
318
395
|
summary: z.string().optional().describe("Alias for subject (Google Calendar vocabulary)"),
|
|
319
|
-
start_iso:
|
|
320
|
-
end_iso:
|
|
396
|
+
start_iso: rfc3339DateTime.optional().describe("New start instant, RFC3339 with offset"),
|
|
397
|
+
end_iso: rfc3339DateTime.optional().describe("New end instant, RFC3339 with offset"),
|
|
321
398
|
description: z.string().optional().describe("New event body (plain text)"),
|
|
322
399
|
location: z.string().optional().describe("New location string"),
|
|
323
400
|
attendees: z.array(z.string().email()).optional().describe("Replacement attendee list"),
|
|
324
|
-
time_zone: z.string().optional().describe("IANA or Windows
|
|
401
|
+
time_zone: z.string().optional().describe("IANA or Windows timezone used to express the instant in Graph (default 'UTC')"),
|
|
325
402
|
}),
|
|
326
403
|
},
|
|
327
404
|
);
|
|
@@ -25,11 +25,17 @@ export const atlassianDefaultPackage: DefaultPackageDescriptor = {
|
|
|
25
25
|
setAuthResolver,
|
|
26
26
|
resolveAuthFromEnv,
|
|
27
27
|
mapStoreFields: (raw) => raw.url && raw.email && raw.api_token
|
|
28
|
-
? {
|
|
28
|
+
? {
|
|
29
|
+
url: raw.url.replace(/\/+$/, ""),
|
|
30
|
+
email: raw.email,
|
|
31
|
+
apiToken: raw.api_token,
|
|
32
|
+
...(raw.cloud_id ? { cloudId: raw.cloud_id } : {}),
|
|
33
|
+
}
|
|
29
34
|
: null,
|
|
30
35
|
notConfiguredError:
|
|
31
36
|
"Atlassian not configured. Open Settings → Credentials and add your Atlassian site URL, " +
|
|
32
|
-
"email, and API token.
|
|
37
|
+
"email, and API token. Scoped API tokens also need the Cloud ID. " +
|
|
38
|
+
"(Or set ATLASSIAN_URL / ATLASSIAN_EMAIL / ATLASSIAN_API_TOKEN and optional ATLASSIAN_CLOUD_ID env vars.)",
|
|
33
39
|
},
|
|
34
40
|
}),
|
|
35
41
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@circuitwall/jarela",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "Jarela — local chat interface for LangGraph agents (multi-provider, single-process, SQLite-backed).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Andrew Ge Wu",
|
|
@@ -172,6 +172,7 @@
|
|
|
172
172
|
"simple-icons": "^16.32.0",
|
|
173
173
|
"tailwindcss": "^4.3.3",
|
|
174
174
|
"undici": "^8.11.2",
|
|
175
|
+
"winzones": "^1.0.0",
|
|
175
176
|
"ws": "^8.21.3",
|
|
176
177
|
"zod": "^4.6.5"
|
|
177
178
|
},
|
|
@@ -17,7 +17,7 @@ export function pruneStandaloneFootprint(standalone, { platform = process.platfo
|
|
|
17
17
|
const removed = [];
|
|
18
18
|
const remove = (path) => {
|
|
19
19
|
if (!existsSync(path)) return;
|
|
20
|
-
rmSync(path, { recursive: true, force: true });
|
|
20
|
+
rmSync(path, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
|
|
21
21
|
removed.push(path);
|
|
22
22
|
};
|
|
23
23
|
remove(join(standalone, ".git"));
|
|
File without changes
|
|
File without changes
|