Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tiptap-link-starterkit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@agent-native/core": patch
---

Avoid duplicate TipTap link extensions when editors provide custom link behavior.
1 change: 1 addition & 0 deletions packages/core/src/client/resources/ResourceEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ function VisualMarkdownEditor({
StarterKit.configure({
heading: { levels: [1, 2, 3] },
codeBlock: {},
link: false,
dropcursor: { color: "hsl(var(--ring))", width: 2 },
}),
Placeholder.configure({
Expand Down
1 change: 1 addition & 0 deletions templates/calendar/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ title: <event title>
````

- `id` — the Google Calendar event id (raw id like `abc123xyz`, or the prefixed form `google-abc123xyz`)
- `htmlLink` — Google Calendar web URL for opening a Google event in the browser when available
- `calendarId` — calendar id, almost always `primary`
- `aspect` — recommended `3/2` for a compact card

Expand Down
1 change: 1 addition & 0 deletions templates/calendar/actions/create-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export default defineAction({
calEvent.id = `google-${result.id}`;
calEvent.googleEventId = result.id;
}
if (result.htmlLink) calEvent.htmlLink = result.htmlLink;
if (result.meetLink) calEvent.hangoutLink = result.meetLink;
if (result.conferenceData) calEvent.conferenceData = result.conferenceData;
if (zoomMeetingLink) calEvent.meetingLink = zoomMeetingLink;
Expand Down
1 change: 1 addition & 0 deletions templates/calendar/actions/get-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default defineAction({
allDay: !evt.start?.dateTime,
source: "google",
googleEventId: evt.id || undefined,
htmlLink: evt.htmlLink || undefined,
accountEmail: acctEmail,
responseStatus: selfAttendee?.responseStatus || undefined,
attendees: evt.attendees?.map((a: any) => ({
Expand Down
1 change: 1 addition & 0 deletions templates/calendar/actions/search-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export default defineAction({
location: e.location || undefined,
accountEmail: e.accountEmail || undefined,
googleEventId: e.googleEventId || undefined,
htmlLink: e.htmlLink || undefined,
attendees: e.attendees || [],
conferenceData: e.conferenceData || undefined,
hangoutLink: e.hangoutLink || undefined,
Expand Down
1 change: 1 addition & 0 deletions templates/calendar/actions/update-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export default defineAction({
id: `google-${googleEventId}`,
accountEmail,
updated: updatedKeys,
htmlLink: result.htmlLink,
hangoutLink: result.meetLink,
meetingLink: zoomMeetingLink,
conferenceData: result.conferenceData,
Expand Down
37 changes: 36 additions & 1 deletion templates/calendar/app/components/calendar/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
IconArrowRight,
IconUsers,
IconLink,
IconExternalLink,
} from "@tabler/icons-react";
import { CommandMenu } from "@agent-native/core/client";
import { cn } from "@/lib/utils";
Expand All @@ -24,6 +25,8 @@ interface CommandPaletteProps {
onCreateEvent: () => void;
onViewChange: (view: ViewMode) => void;
onToday: () => void;
selectedEvent?: CalendarEvent | null;
onOpenSelectedEventInGoogleCalendar?: (event: CalendarEvent) => void;
onAddPeopleCalendar?: () => void;
onAddUrlCalendar?: () => void;
}
Expand All @@ -47,6 +50,8 @@ export function CommandPalette({
onCreateEvent,
onViewChange,
onToday,
selectedEvent,
onOpenSelectedEventInGoogleCalendar,
onAddPeopleCalendar,
onAddUrlCalendar,
}: CommandPaletteProps) {
Expand Down Expand Up @@ -86,6 +91,11 @@ export function CommandPalette({
}
}

const selectedGoogleEvent =
selectedEvent?.source === "google" && selectedEvent.htmlLink
? selectedEvent
: null;

return (
<CommandMenu
open={open}
Expand Down Expand Up @@ -137,7 +147,32 @@ export function CommandPalette({
</CommandMenu.Group>
)}

{(parsedDate || matchingEvents.length > 0) && <CommandMenu.Separator />}
{selectedGoogleEvent && onOpenSelectedEventInGoogleCalendar && (
<CommandMenu.Group heading="Selected event">
<CommandMenu.Item
onSelect={() =>
onOpenSelectedEventInGoogleCalendar(selectedGoogleEvent)
}
keywords={[
"open",
"google",
"calendar",
"selected",
"event",
selectedGoogleEvent.title.toLowerCase(),
]}
>
<IconExternalLink className="h-4 w-4" />
<span className="min-w-0 flex-1 truncate">
Open in Google Calendar
</span>
</CommandMenu.Item>
</CommandMenu.Group>
)}

{(parsedDate || matchingEvents.length > 0 || selectedGoogleEvent) && (
<CommandMenu.Separator />
)}

<CommandMenu.Group heading="Actions">
<CommandMenu.Item
Expand Down
42 changes: 42 additions & 0 deletions templates/calendar/app/pages/CalendarView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ export default function CalendarView() {
[events, viewMode, selectedDate],
);

const selectedEvent = useMemo(() => {
const candidate = sidebarEvent ?? focusedEvent;
if (!candidate) return null;
return events.find((event) => event.id === candidate.id) ?? candidate;
}, [events, sidebarEvent, focusedEvent]);

function handleNavigate(direction: "prev" | "next") {
const fns =
direction === "next"
Expand All @@ -271,6 +277,38 @@ export default function CalendarView() {
setViewMode("day");
}

function handleOpenSelectedEventInGoogleCalendar(event: CalendarEvent) {
if (!event.htmlLink) {
toast.error("Google Calendar link unavailable");
return;
}

try {
const url = new URL(event.htmlLink);
const isGoogleCalendarUrl =
url.protocol === "https:" &&
(url.hostname === "calendar.google.com" ||
(url.hostname === "www.google.com" &&
url.pathname.startsWith("/calendar/")));

if (!isGoogleCalendarUrl) {
toast.error("Google Calendar link unavailable");
return;
}

const opened = window.open(
url.toString(),
"_blank",
"noopener,noreferrer",
);
if (!opened) {
window.location.assign(url.toString());
}
} catch {
toast.error("Google Calendar link unavailable");
}
}

function handleDirectDelete(ev: CalendarEvent) {
const isOrganizer =
ev.organizer?.self ||
Expand Down Expand Up @@ -829,6 +867,10 @@ export default function CalendarView() {
}}
onViewChange={setViewMode}
onToday={handleToday}
selectedEvent={selectedEvent}
onOpenSelectedEventInGoogleCalendar={
handleOpenSelectedEventInGoogleCalendar
}
onAddPeopleCalendar={() => {
setCommandPaletteOpen(false);
setAddCalendarDefaultTab("people");
Expand Down
3 changes: 3 additions & 0 deletions templates/calendar/server/handlers/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const getEvent = defineEventHandler(async (event: H3Event) => {
allDay: !evt.start?.dateTime,
source: "google",
googleEventId: evt.id || undefined,
htmlLink: evt.htmlLink || undefined,
accountEmail: acctEmail,
responseStatus: selfAttendee?.responseStatus || undefined,
attendees: evt.attendees?.map((a: any) => ({
Expand Down Expand Up @@ -270,6 +271,7 @@ export const createEvent = defineEventHandler(async (event: H3Event) => {
calEvent.id = `google-${result.id}`;
calEvent.googleEventId = result.id;
}
if (result.htmlLink) calEvent.htmlLink = result.htmlLink;
if (result.meetLink) calEvent.hangoutLink = result.meetLink;
if (result.conferenceData) calEvent.conferenceData = result.conferenceData;
if (zoomMeetingLink) calEvent.meetingLink = zoomMeetingLink;
Expand Down Expand Up @@ -369,6 +371,7 @@ export const updateEvent = defineEventHandler(async (event: H3Event) => {
sendUpdates,
addGoogleMeet: addGoogleMeet === true,
});
if (result.htmlLink) updates.htmlLink = result.htmlLink;
if (result.meetLink) updates.hangoutLink = result.meetLink;
if (result.conferenceData) updates.conferenceData = result.conferenceData;
if (zoomMeetingLink) updates.meetingLink = zoomMeetingLink;
Expand Down
7 changes: 7 additions & 0 deletions templates/calendar/server/lib/google-calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ export async function listEvents(
allDay: !event.start?.dateTime,
source: "google" as const,
googleEventId: event.id || undefined,
htmlLink: event.htmlLink || undefined,
accountEmail: email,
responseStatus: selfAttendee?.responseStatus,
attendees: event.attendees?.map((a: any) => ({
Expand Down Expand Up @@ -527,6 +528,7 @@ export async function listOverlayEvents(
allDay: !event.start?.dateTime,
source: "google" as const,
googleEventId: event.id || undefined,
htmlLink: event.htmlLink || undefined,
accountEmail: undefined,
overlayEmail,
createdAt: event.created || new Date().toISOString(),
Expand Down Expand Up @@ -574,6 +576,7 @@ export async function getEvent(
allDay: !event.start?.dateTime,
source: "google",
googleEventId: event.id || undefined,
htmlLink: event.htmlLink || undefined,
accountEmail,
responseStatus: selfAttendee?.responseStatus || undefined,
attendees: event.attendees?.map((a: any) => ({
Expand Down Expand Up @@ -621,6 +624,7 @@ export async function createEvent(
},
): Promise<{
id?: string;
htmlLink?: string;
meetLink?: string;
conferenceData?: CalendarEvent["conferenceData"];
}> {
Expand Down Expand Up @@ -664,6 +668,7 @@ export async function createEvent(

return {
id: response.id || undefined,
htmlLink: response.htmlLink || undefined,
meetLink: response.hangoutLink || undefined,
conferenceData: mapConferenceData(response.conferenceData),
};
Expand All @@ -674,6 +679,7 @@ export async function updateEvent(
event: Partial<CalendarEvent>,
options?: { sendUpdates?: "all" | "none"; addGoogleMeet?: boolean },
): Promise<{
htmlLink?: string;
meetLink?: string;
conferenceData?: CalendarEvent["conferenceData"];
}> {
Expand Down Expand Up @@ -725,6 +731,7 @@ export async function updateEvent(
);

return {
htmlLink: response?.htmlLink || undefined,
meetLink: response?.hangoutLink || undefined,
conferenceData: mapConferenceData(response?.conferenceData),
};
Expand Down
2 changes: 2 additions & 0 deletions templates/calendar/shared/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export interface CalendarEvent {
allDay: boolean;
source: "local" | "google" | "ical";
googleEventId?: string;
/** Absolute Google Calendar web URL for Google events */
htmlLink?: string;
accountEmail?: string;
/** Set when this event belongs to an overlaid person's calendar */
overlayEmail?: string;
Expand Down
84 changes: 83 additions & 1 deletion templates/clips/desktop/src/lib/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,86 @@ function createSyntheticAudioStream(): {
}
}

interface RecordingStartCue {
play(): void;
cleanup(): void;
}

const noopRecordingStartCue: RecordingStartCue = {
play() {},
cleanup() {},
};

function createRecordingStartCue(): RecordingStartCue {
try {
const AudioCtx = window.AudioContext || (window as any).webkitAudioContext;
if (!AudioCtx) return noopRecordingStartCue;

const ctx = new AudioCtx();
let played = false;
let closed = false;
let cleanupTimer: ReturnType<typeof window.setTimeout> | null = null;

const close = () => {
if (closed) return;
closed = true;
if (cleanupTimer) {
window.clearTimeout(cleanupTimer);
cleanupTimer = null;
}
ctx.close().catch(() => {});
};

const play = () => {
if (played || closed) return;
played = true;

const startedAt = ctx.currentTime + 0.005;
const oscillator = ctx.createOscillator();
const gain = ctx.createGain();

oscillator.type = "sine";
oscillator.frequency.setValueAtTime(880, startedAt);
oscillator.frequency.exponentialRampToValueAtTime(660, startedAt + 0.14);

gain.gain.setValueAtTime(0.0001, startedAt);
gain.gain.exponentialRampToValueAtTime(0.07, startedAt + 0.018);
gain.gain.exponentialRampToValueAtTime(0.0001, startedAt + 0.18);

oscillator.connect(gain);
gain.connect(ctx.destination);

oscillator.addEventListener("ended", close, { once: true });
oscillator.start(startedAt);
oscillator.stop(startedAt + 0.2);
};

const cue: RecordingStartCue = {
play() {
if (ctx.state === "running") {
play();
return;
}
ctx
.resume()
.then(play)
.catch((err) => {
console.warn("[clips-recorder] start cue unavailable:", err);
close();
});
},
cleanup: close,
};

ctx.resume().catch(() => {});
cleanupTimer = window.setTimeout(() => cue.cleanup(), 5 * 60_000);
return cue;
} catch (err) {
console.warn("[clips-recorder] start cue unavailable:", err);
return noopRecordingStartCue;
}
}

export async function startNativeRecording(
params: StartParams,
): Promise<RecorderHandle> {
Expand All @@ -469,6 +549,7 @@ async function startNativeRecordingInner(
const wantsScreen = params.mode !== "camera";
const wantsCamera = params.mode !== "screen" && params.cameraOn;
const wantsAudio = params.micOn;
const recordingStartCue = createRecordingStartCue();
console.log("[clips-recorder] startNativeRecording", {
serverUrl: params.serverUrl,
mode: params.mode,
Expand Down Expand Up @@ -505,7 +586,7 @@ async function startNativeRecordingInner(
if (wantsAudio) {
console.log("[clips-recorder] acquiring audioStream (mic only)");
}
const streamCleanups: Array<() => void> = [];
const streamCleanups: Array<() => void> = [recordingStartCue.cleanup];

const displayStreamPromise: Promise<MediaStream> | null = wantsScreen
? (() => {
Expand Down Expand Up @@ -832,6 +913,7 @@ async function startNativeRecordingInner(
stateUnlistens = toolbarUnlistens;

recorder.start(2_000);
recordingStartCue.play();
// The toolbar is already open (the popover's bubble-session effect
// spawns it alongside the bubble in its pre-record, disabled state).
// Now that MediaRecorder is actually ticking, flip the toolbar's
Expand Down
1 change: 1 addition & 0 deletions templates/content/app/components/editor/VisualEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ export function VisualEditor({
heading: { levels: [1, 2, 3] },
codeBlock: false,
paragraph: false,
link: false,
horizontalRule: {},
dropcursor: { color: "hsl(243 75% 59%)", width: 2 },
// Disable built-in history when Collaboration is active (Yjs tracks undo)
Expand Down
Loading
Loading