Commit Graph

51 Commits

Author SHA1 Message Date
KernelDeimos 59984bb930 dev: recursive log toggle for puter.js 2024-11-09 15:14:37 -05:00
KernelDeimos 28adcf533f feat(ai): add xAI grok-beta 2024-11-07 15:01:13 -05:00
KernelDeimos 5caa2c0e3a fix: logging in AppConnection 2024-11-07 14:26:30 -05:00
KernelDeimos 5d416e2316 refactor: simplify module constructors
This was a really small refactor - about 30mins - that moves the concern
of common constructor args for modules outside of each individual call.

A Context object is now used for common constructor arguments. Some of
the values on this object - such as APIOrigin and authToken - are
following values on the instance of the Puter class. This means that for
some modules it is already possible to eliminate the setAuthToken and
setAPIOrigin listeners (out of scope for this commit). Any which remain
could eventually be replaced with a listener on the Context object
itself.

This commit also moves the initSubmodules method to the top of the class
so that it's easier for new devs to find, in case they're looking into
an issue on a specific module rather than the Puter class itself.
2024-11-07 13:29:18 -05:00
KernelDeimos ba2eb716f5 dev: add prefix logger 2024-11-05 15:57:55 -05:00
KernelDeimos da0022abf0 feat: add puter.auth.whoami() 2024-11-05 15:49:51 -05:00
KernelDeimos 755736edee feat: add puter.log 2024-11-05 15:31:44 -05:00
KernelDeimos fe8d6af1b5 sync: update claude model (take 2) 2024-11-04 22:46:57 -05:00
ProgrammerIn-wonderland 891e799e5e WIP symlink, net_device virtio, move fixes, upload binary fixes 2024-10-21 17:04:57 -04:00
Nariman Jelveh 90e7098cc7 Merge pull request #787 from 4nshuman/issue/zip-operation
Issue/zip operation
2024-10-19 15:45:39 -07:00
KernelDeimos 0fb4f73d76 chore: remove noisy logs 2024-10-19 17:31:46 -04:00
4nshuman fabc21ecf7 fixed sorting logic on directory list 2024-10-20 02:00:58 +05:30
4nshuman a646b02e45 provide incremental directories to mkdir 2024-10-20 02:00:35 +05:30
4nshuman f32b1cfce8 added option to create parent directories for programmatic file drops 2024-10-20 00:05:40 +05:30
4nshuman fc461c8735 added absolute file path processing 2024-10-20 00:04:36 +05:30
4nshuman d39b7a8972 record unique directory list 2024-10-19 23:52:21 +05:30
KernelDeimos 480d996279 dev: proof-of-concept for fs postMessage relay
Adds a filesystem relay service to GUI-side which currently reports an
exmaple fsentry for /stat and /readdir. Added filesystem services for
both sides. Moved filesystem implementations from src/modules to src/lib
since they're being called by services now rather than modules.

This functionality is effectively disabled unless
src/puter-js/src/services/Filesystem.js is updated to use init_app_fs_()
when the environment is 'app'.
2024-10-19 03:46:47 -04:00
KernelDeimos c2a475f3c0 dev: lay the groundwork for client FS relay
Adds XDIncomingService to manage messages from another window. IPC now
registers with XDIncoming and reports whether it was handled, that way
messages intended to reach GUI can be reliably ignored.

On GUI-side, XDIncomingService will be used by FSRelayService (not yet
implemented) to handle requests for filesystem operations from another
window.

On App-side, XDIncomingService might be used by the PostMessageFS
client-side filesystem implementation terminal to listen for filesystem
events that were relayed by GUI (after a permission check) from their
original websocket source. Either that, or we'll open a filesystem
socket for each app using that app's token.

NoPuterYetService was added because IPC.js is loaded before
globalThis.puter exists, and was the easiest way to still allow IPC's
listener to be registered with XDIncomingService.

APIAccessService was added. This service currently holds auth_token and
api_token and does nothing else. FilesystemService listens to this to
maintain a websocket connection. APIAccessService will help to manage
the complexity of all further code dependent on being informed about
changes to the auth token or origin. Currently in puter.js these are
passed around to several modules which manage the same piece of state
information independantly.
2024-10-18 23:10:19 -04:00
jelveh b1411cd622 Add dedupeName for to puter.apps and Dev Center 2024-10-18 18:02:37 -07:00
KernelDeimos 7980aafbd9 doc: add devlog from puter.js 2024-10-17 01:19:06 -04:00
KernelDeimos e011df1a20 move: PuterAPIFilesystem 2024-10-14 15:19:18 -04:00
KernelDeimos 3762037576 dev: oops 2024-10-12 00:01:33 -04:00
KernelDeimos 11fbcb27b0 dev: cache readdir 2024-10-11 23:51:38 -04:00
KernelDeimos 77f6bdcd6d dev: make puter.fs cache togglable 2024-10-11 18:39:58 -04:00
KernelDeimos 6ee7caaee1 dev: apply TTL cache for stat entries
Adds CachedFilesystem layer to client filesystem chain. Currently only
stat is implemented. The stat implementation will hold onto an entry for
3 seconds as per hardcoded configuration. Eventually, once invalidation
via websockets is working, this TTL should be extended.
2024-10-11 18:39:58 -04:00
KernelDeimos c12ae2a923 dev: prepare puter.js fs for decorator pattern
- de-coupled xhr callback passing from the interface of the underlying
  filesystem implementation.
- This makes the interface to delegate calls more suitable for use with
  the decorator pattern.
- The decorator pattern will be used to manage the complexity of the
  caching layer by separating the concerns of different caching methods.
2024-10-11 18:39:58 -04:00
KernelDeimos 4febd81169 dev: app pseudonyms 2024-09-30 19:35:34 -04:00
KernelDeimos 4311b482fd fix: second half of connectToInstance 2024-09-18 21:02:51 -04:00
KernelDeimos 404fbaa4cb dev: add terminal multiplexing
This involves establishing the protocol through which phoenix instances
run a command on the emulator. The pty is able to communicate with the
terminal in both directions. This commit adds logs to be removed later.

There are a few things left that this commit does not address:
- handling close of delegate process
- handling sigint from phoenix to delegate process
- closing the connection to twisp
2024-09-18 16:21:07 -04:00
KernelDeimos e3d4a5f3b3 dev: multi-instance many-to-many app-to-app comms
I'll elaborate here because the commit name is confusing. Any time an
app gets a connection to another app, either because it launched that
app (or was launched by that app) or requested a connection to that app,
the ID the app gets to represent the app it's communicating with is now
a pseudo app id rather than the app instance ID. This accomplishes two
things:

1. It's more secure. There are multiple places where GUI assumes that
   knowing an app's instance ID means you can do things as that app.
2. Between the same two apps, there may now be more than one connection.
   This is useful for situations like Phoenix shell talking to the
   emulator in multiple separate instances to pipe commands. (this is
   coming later)
2024-09-18 16:21:07 -04:00
KernelDeimos 62634b0afe feat: add connectToInstance method to puter.ui 2024-09-18 16:21:07 -04:00
KernelDeimos 5ab3d88393 cleanup 2024-09-02 17:37:38 -04:00
KernelDeimos 18a24f614f dev: update ipc ready and app launched events 2024-09-02 17:37:38 -04:00
Nariman Jelveh da5635b576 Show an error if file containing puter.js is loaded using the file: protocol 2024-08-25 14:38:19 -07:00
KernelDeimos eb18550f41 fix(puterai): close streams 2024-08-23 19:42:53 -04:00
KernelDeimos 5a616f67dd fix(puterjs): fix settings object check 2024-08-23 16:39:30 -04:00
KernelDeimos 53e7a91f18 feat(puterai): add groq 2024-08-23 00:16:29 -04:00
Nariman Jelveh 2d39b9be77 Update index.js 2024-08-22 20:47:02 -07:00
KernelDeimos 055c628afd feat(puterai): add mistral 2024-08-22 23:28:08 -04:00
KernelDeimos 7600d9b07c feat: add streaming to XHR driver client 2024-08-22 14:28:43 -04:00
Nariman Jelveh 6135054b3b add stream flag to the chat() method of puter.ai 2024-08-21 20:59:42 -07:00
Nariman Jelveh 3bface8c66 if first args in puter.chat is a string, it's the prompt 2024-08-21 20:38:03 -07:00
Nariman Jelveh 43c18377eb Add support for multiple AI drivers via puter.js 2024-08-21 20:19:26 -07:00
KernelDeimos 439f52b5a3 feat(puterjs): add drivers module 2024-08-21 18:31:16 -04:00
KernelDeimos e60632343b sync: cross origin + small gui updates 2024-08-08 21:24:10 -04:00
Nariman Jelveh 22d7134802 Pass window.crossOriginIsolated value to the popup 2024-07-24 12:36:19 -07:00
KernelDeimos 7aadae58ce fix: remove flag that breaks puter-js webpack 2024-07-10 17:18:54 -04:00
Nariman Jelveh 10d77f17aa retry npm 3 times to account for the flakiness of the process 2024-07-09 15:12:19 -07:00
Nariman Jelveh 00eabd7b10 remove duplicate and/or incorrect license headers 2024-07-09 13:50:20 -07:00
KernelDeimos bda4aed2e8 chore: add missing license headers 2024-07-09 04:10:33 -04:00