Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codecs breakout 2 #332

Merged
merged 39 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f32133e
Small cleanup
avaer Oct 16, 2024
80eb0a5
Break out reat agents client to builder and runtime
avaer Oct 16, 2024
03ece83
More react agents client work
avaer Oct 16, 2024
73f3182
Move multiplayer install to codecs
avaer Oct 16, 2024
b834fb1
Fix audio-worker references
avaer Oct 16, 2024
ed6025c
Move ws-codec-runtime files to audio-worker
avaer Oct 16, 2024
27fe792
More audio-worker paths fixing
avaer Oct 16, 2024
89a72c3
Revert "Move multiplayer install to codecs"
avaer Oct 16, 2024
d881033
Fix codec runtime refs
avaer Oct 16, 2024
efc0215
Move ws-codec-util
avaer Oct 16, 2024
8c6235e
Codecs error checking
avaer Oct 16, 2024
efee87c
Move ws-codec.mjs
avaer Oct 16, 2024
701672d
Fix ws-codec paths
avaer Oct 16, 2024
2ace313
Move audio encode/decode to audio-worker
avaer Oct 16, 2024
dd5120f
Fix audio encode/decode paths
avaer Oct 16, 2024
ccc7fcd
Move audio-client
avaer Oct 16, 2024
e4b7c51
Remove dead audio-decode.mjs
avaer Oct 16, 2024
582e127
Remove old multiplayer chat.html
avaer Oct 16, 2024
36b8a5a
Update audio-client paths
avaer Oct 16, 2024
fbc4cac
Move audio-classes to audio-worker
avaer Oct 16, 2024
53f12a9
Move audio-util to audio-worker
avaer Oct 16, 2024
7ea14f5
Dead code cleanup
avaer Oct 16, 2024
d0705d3
Dead imports cleanup
avaer Oct 16, 2024
0f392c1
Merge pull request #331 from UpstreetAI/codecs-breakout
avaer Oct 16, 2024
9f7eed9
Move multiplayer/public/audio-worker to codecs
avaer Oct 16, 2024
ecc35b4
Move multiplayer install to codecs
avaer Oct 16, 2024
12572b7
Add package.json to codecs lib
avaer Oct 16, 2024
5830cc6
Clean up multiplayer package.json
avaer Oct 16, 2024
0030925
Update root package-lock.json
avaer Oct 16, 2024
a699f33
Small cli cleanup
avaer Oct 16, 2024
b8fb0c9
Add codecs dep to chat app
avaer Oct 16, 2024
1a8dcb2
Update root package-lock.json
avaer Oct 16, 2024
fc3666a
Update codecs refs
avaer Oct 16, 2024
abd25eb
Update queue-manager imports
avaer Oct 16, 2024
a8281a0
Move codecs packages into place
avaer Oct 16, 2024
33a35e3
Update package-lock.json
avaer Oct 16, 2024
8bf6fe7
Update packages paths
avaer Oct 16, 2024
76252a6
Bugfix cli imports
avaer Oct 16, 2024
985bcea
Dead code cleanup
avaer Oct 16, 2024
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
3 changes: 2 additions & 1 deletion apps/chat/app/new/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ import { env } from '@/lib/env'
import { makeAgentSourceCode } from 'react-agents/util/agent-source-code-formatter.mjs';
import { currencies, intervals } from 'react-agents/constants.mjs';
import type { FetchableWorker } from 'react-agents-client/types';
import { buildAgentSrc, ReactAgentsWorker } from 'react-agents-client';
import { buildAgentSrc } from 'react-agents-client/builder';
import { ReactAgentsWorker } from 'react-agents-client/runtime';
import { IconButton } from 'ucom';

//
Expand Down
5 changes: 2 additions & 3 deletions apps/chat/components/account/voices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import { makeAnonymousClient } from '@/utils/supabase/supabase-client';
import { getJWT } from '@/lib/jwt';
import { env } from '@/lib/env'
import { AutoVoiceEndpoint, VoiceEndpointVoicer } from 'react-agents/lib/voice-output/voice-endpoint-voicer.mjs';
import { AudioDecodeStream } from '@upstreet/multiplayer/public/audio/audio-decode.mjs';
import { AudioContextOutputStream } from '@/lib/audio/audio-context-output';
import { aiProxyHost } from '../../utils/const/endpoints';
import * as codecs from '@upstreet/multiplayer/public/audio/ws-codec-runtime-worker.mjs';
import { AudioDecodeStream } from 'codecs/audio-decode.mjs';
import * as codecs from 'codecs/ws-codec-runtime-worker.mjs';

// const voicesEndpointProxyUrl = `https://${aiProxyHost}/api/ai/voices`;
const voicesEndpointApiUrl = `https://${aiProxyHost}/api/ai-voice/voices`;

export interface AgentsProps {
Expand Down
5 changes: 1 addition & 4 deletions apps/chat/components/prompt-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ import type {
} from 'react-agents/types';
import { shuffle } from 'react-agents/util/util.mjs';
import { Icon } from 'ucom';
import { createPcmF32MicrophoneSource } from '@upstreet/multiplayer/public/audio/audio-client.mjs';
import { createPcmF32MicrophoneSource } from 'codecs/audio-client.mjs';
import { createVideoSource } from '@upstreet/multiplayer/public/video/video-client.mjs';
import { ensureAudioContext } from '@/lib/audio/audio-context-output';
// import { consoleImageWidth } from 'react-agents/constants.mjs'

export function PromptForm({
input,
Expand Down Expand Up @@ -272,8 +271,6 @@ export function PromptForm({
className={cn("flex justify-start relative rounded bg-background mx-2 p-2 overflow-hidden")}
onClick={async () => {
if (!screenSource) {
// list the available mics
const devices = await navigator.mediaDevices.enumerateDevices();
// console.log('got devices', devices);
// const videoInputDevices = devices.filter((device) => device.kind === 'videoinput');
const mediaStream = await navigator.mediaDevices.getDisplayMedia({
Expand Down
4 changes: 2 additions & 2 deletions apps/chat/components/ui/multiplayer-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { multiplayerEndpointUrl } from '@/utils/const/endpoints';
import { getAgentEndpointUrl, getAgentHost } from '@/lib/utils'
import { r2EndpointUrl } from '@/utils/const/endpoints';
import { getJWT } from '@/lib/jwt';
import { AudioDecodeStream } from '@upstreet/multiplayer/public/audio/audio-decode.mjs';
import { AudioContextOutputStream } from '@/lib/audio/audio-context-output';
import type {
ActionMessage,
Expand All @@ -17,7 +16,8 @@ import type {
PlayableVideoStream,
} from 'react-agents/types';
import { useLoading } from '@/lib/client/hooks/use-loading';
import * as codecs from '@upstreet/multiplayer/public/audio/ws-codec-runtime-worker.mjs';
import { AudioDecodeStream } from 'codecs/audio-decode.mjs';
import * as codecs from 'codecs/ws-codec-runtime-worker.mjs';

//

Expand Down
3 changes: 0 additions & 3 deletions apps/chat/lib/audio/audio-context-output.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// import { createMp3DecodeTransformStream } from '../lib/multiplayer/public/audio/audio-client.mjs';
// import { QueueManager } from '../../utils/queue-manager.mjs';

type LoadableAudioContext = AudioContext & {
waitForLoad: () => Promise<void>;
};
Expand Down
1 change: 1 addition & 0 deletions apps/chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"class-variance-authority": "0.7.0",
"classnames": "2.5.1",
"clsx": "2.1.0",
"codecs": "file:../../packages/usdk/packages/upstreet-agent/packages/react-agents/lib/codecs",
"cookie": "^0.6.0",
"d3-scale": "4.0.2",
"date-fns": "3.3.1",
Expand Down
84 changes: 61 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions packages/usdk/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import stream from 'stream';
import repl from 'repl';

import { program } from 'commander';
import WebSocket, { WebSocketServer } from 'ws';
import WebSocket from 'ws';
import EventSource from 'eventsource';
import toml from '@iarna/toml';
import open from 'open';
Expand Down Expand Up @@ -68,11 +68,9 @@ import {
import { NetworkRealms } from './packages/upstreet-agent/packages/react-agents/lib/multiplayer/public/network-realms.mjs'; // XXX should be a deduplicated import, in a separate npm module

import { AutoVoiceEndpoint, VoiceEndpointVoicer } from './packages/upstreet-agent/packages/react-agents/lib/voice-output/voice-endpoint-voicer.mjs';
import { AudioDecodeStream } from './packages/upstreet-agent/packages/react-agents/lib/multiplayer/public/audio/audio-decode.mjs';
import { AudioDecodeStream } from './packages/upstreet-agent/packages/react-agents/lib/codecs/audio-decode.mjs';

// import * as codecs from './packages/upstreet-agent/packages/react-agents/lib/multiplayer/public/audio/ws-codec-runtime-worker.mjs';
// import * as codecs from './packages/upstreet-agent/packages/react-agents/lib/multiplayer/public/audio/ws-codec-runtime-edge.mjs';
import * as codecs from './packages/upstreet-agent/packages/react-agents/lib/multiplayer/public/audio/ws-codec-runtime-fs.mjs';
import * as codecs from './packages/upstreet-agent/packages/react-agents/lib/codecs/ws-codec-runtime-fs.mjs';

import { webbrowserActionsToText } from './packages/upstreet-agent/packages/react-agents/util/browser-action-utils.mjs';

Expand Down
2 changes: 1 addition & 1 deletion packages/usdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"ansi-escapes": "^7.0.0",
"chalk": "^5.3.0",
"cli-table3": "^0.6.4",
"codecs": "file:./packages/upstreet-agent/packages/react-agents/lib/codecs",
"commander": "^12.0.0",
"cookie": "^0.6.0",
"dedent": "^1.5.3",
Expand All @@ -49,7 +50,6 @@
"jimp": "^0.22.12",
"jszip": "^3.10.1",
"memoize-one": "^6.0.0",
"multiplayer": "file:./packages/upstreet-agent/packages/react-agents/lib/multiplayer",
"mime": "^4.0.1",
"mkdirp": "^3.0.1",
"open": "^10.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/usdk/packages/upstreet-agent/durable-object.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DurableObjectImpl } from './durable-object-impl.tsx';

import userRender from '../../agent.tsx'; // note: this will be overwritten by the build process
import * as codecs from 'react-agents/lib/multiplayer/public/audio/ws-codec-runtime-edge.mjs';
import * as codecs from 'codecs/ws-codec-runtime-edge.mjs';

Error.stackTraceLimit = 300;

Expand Down
2 changes: 1 addition & 1 deletion packages/usdk/packages/upstreet-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@tsndr/cloudflare-worker-jwt": "2.5.3",
"@types/react": "^18.3.3",
"browser-util-inspect": "^0.2.0",
"codecs": "file:./packages/react-agents/lib/codecs",
"dedent": "^1.5.3",
"ethers": "^6.12.0",
"format-util": "^1.0.5",
Expand All @@ -15,7 +16,6 @@
"jimp": "^0.22.12",
"memoize-one": "^6.0.0",
"minimatch": "^9.0.4",
"multiplayer": "file:./packages/react-agents/lib/multiplayer",
"openai": "^4.56.0",
"react": "^19.0.0-rc-df5f2736-20240712",
"react-agents": "file:./packages/react-agents",
Expand Down
Loading
Loading