@photon-ai/flux 0.3.4 → 0.3.6
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/README.md +15 -13
- package/dist/index.js +29 -18
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
Flux is an open-sourced CLI tool that lets developers build and deploy LangChain agents that connect to iMessage at no cost and under 5 seconds.
|
|
18
18
|
|
|
19
|
-
---
|
|
19
|
+
<!-- --- -->
|
|
20
20
|
|
|
21
21
|
## Features
|
|
22
22
|
|
|
@@ -26,16 +26,18 @@ Flux is an open-sourced CLI tool that lets developers build and deploy LangChain
|
|
|
26
26
|
- **Phone Number Authentication**: Log in with just your phone number and iMessage.
|
|
27
27
|
- **Agent Validation**: Automatically validate your LangChain agent in the CLI.
|
|
28
28
|
|
|
29
|
-
---
|
|
29
|
+
<!-- --- -->
|
|
30
30
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
33
|
+
###
|
|
33
34
|
```
|
|
34
35
|
npm install @photon-ai/flux
|
|
36
|
+
#or
|
|
35
37
|
bun add @photon-ai/flux
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
---
|
|
40
|
+
<!-- --- -->
|
|
39
41
|
|
|
40
42
|
## CLI Commands
|
|
41
43
|
|
|
@@ -49,13 +51,13 @@ bun add @photon-ai/flux
|
|
|
49
51
|
| `npx @photon-ai/flux run --prod` | Start with live iMessage bridge |
|
|
50
52
|
| `npx @photon-ai/flux validate` | Check your code for errors |
|
|
51
53
|
|
|
52
|
-
---
|
|
54
|
+
<!-- --- -->
|
|
53
55
|
|
|
54
56
|
## Flux Number
|
|
55
57
|
|
|
56
|
-
Message
|
|
58
|
+
Message `+16286298650` with you phone number to text the LangChain agent that you built.
|
|
57
59
|
|
|
58
|
-
---
|
|
60
|
+
<!-- --- -->
|
|
59
61
|
|
|
60
62
|
## Log in
|
|
61
63
|
|
|
@@ -64,13 +66,13 @@ Authentication is based on iMessage:
|
|
|
64
66
|
- The server generates a UUID per login attempt. It then waits for the iMessage text from the client with the UUID. Once verified, it will issue a token.
|
|
65
67
|
- Credentials (token, phone, timestamp) are saved to credentials.json. This way, the user only has to log in once.
|
|
66
68
|
|
|
67
|
-
---
|
|
69
|
+
<!-- --- -->
|
|
68
70
|
|
|
69
71
|
## Usage
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
### Step 1: Create LangChain Agent
|
|
72
74
|
|
|
73
|
-
Create agent.ts file with your LangChain agent:
|
|
75
|
+
Create an `agent.ts` file with your LangChain agent. Make sure to have `export default agent`. Below is one simple example:
|
|
74
76
|
|
|
75
77
|
```
|
|
76
78
|
// agent.ts
|
|
@@ -155,7 +157,7 @@ npx @photon-ai/flux run --prod
|
|
|
155
157
|
|
|
156
158
|
```
|
|
157
159
|
|
|
158
|
-
---
|
|
160
|
+
<!-- --- -->
|
|
159
161
|
|
|
160
162
|
## Why Flux
|
|
161
163
|
|
|
@@ -169,7 +171,7 @@ Flux solves these problems in the following ways:
|
|
|
169
171
|
- **Open source**: Fully community driven.
|
|
170
172
|
- **Free to use**: No subscription fees.
|
|
171
173
|
|
|
172
|
-
---
|
|
174
|
+
<!-- --- -->
|
|
173
175
|
|
|
174
176
|
## Examples
|
|
175
177
|
|
|
@@ -244,7 +246,7 @@ export default {
|
|
|
244
246
|
};
|
|
245
247
|
```
|
|
246
248
|
|
|
247
|
-
---
|
|
249
|
+
<!-- --- -->
|
|
248
250
|
|
|
249
251
|
## Requirements
|
|
250
252
|
|
|
@@ -252,7 +254,7 @@ export default {
|
|
|
252
254
|
- **Python** 3.9+ (for the agent)
|
|
253
255
|
- **LLM Keys (e.g. OpenAI API key)**
|
|
254
256
|
|
|
255
|
-
---
|
|
257
|
+
<!-- --- -->
|
|
256
258
|
|
|
257
259
|
|
|
258
260
|
<div align="center">
|
package/dist/index.js
CHANGED
|
@@ -51691,20 +51691,20 @@ var require_src32 = __commonJS2({
|
|
|
51691
51691
|
})();
|
|
51692
51692
|
}
|
|
51693
51693
|
});
|
|
51694
|
-
function
|
|
51694
|
+
function bidi() {
|
|
51695
51695
|
const descriptor = {
|
|
51696
|
-
serviceType: "
|
|
51697
|
-
methodType: "
|
|
51696
|
+
serviceType: "bidi",
|
|
51697
|
+
methodType: "bidi"
|
|
51698
51698
|
};
|
|
51699
|
-
const
|
|
51699
|
+
const configFn = (config) => {
|
|
51700
51700
|
descriptor.config = {
|
|
51701
|
-
metadata:
|
|
51702
|
-
ack: false
|
|
51701
|
+
metadata: config.metadata !== void 0,
|
|
51702
|
+
ack: config.ack ?? false
|
|
51703
51703
|
};
|
|
51704
51704
|
return descriptor;
|
|
51705
51705
|
};
|
|
51706
|
-
Object.assign(
|
|
51707
|
-
return
|
|
51706
|
+
Object.assign(configFn, descriptor);
|
|
51707
|
+
return configFn;
|
|
51708
51708
|
}
|
|
51709
51709
|
function client() {
|
|
51710
51710
|
return {
|
|
@@ -51712,20 +51712,20 @@ function client() {
|
|
|
51712
51712
|
methodType: "unary"
|
|
51713
51713
|
};
|
|
51714
51714
|
}
|
|
51715
|
-
function
|
|
51715
|
+
function server() {
|
|
51716
51716
|
const descriptor = {
|
|
51717
|
-
serviceType: "
|
|
51718
|
-
methodType: "
|
|
51717
|
+
serviceType: "server",
|
|
51718
|
+
methodType: "unary"
|
|
51719
51719
|
};
|
|
51720
|
-
const
|
|
51720
|
+
const contextFn = (context) => {
|
|
51721
51721
|
descriptor.config = {
|
|
51722
|
-
metadata:
|
|
51723
|
-
ack:
|
|
51722
|
+
metadata: context.metadata !== void 0,
|
|
51723
|
+
ack: false
|
|
51724
51724
|
};
|
|
51725
51725
|
return descriptor;
|
|
51726
51726
|
};
|
|
51727
|
-
Object.assign(
|
|
51728
|
-
return
|
|
51727
|
+
Object.assign(contextFn, descriptor);
|
|
51728
|
+
return contextFn;
|
|
51729
51729
|
}
|
|
51730
51730
|
var ServiceImpl = class {
|
|
51731
51731
|
implementation;
|
|
@@ -51843,6 +51843,7 @@ function buildServiceProto(base) {
|
|
|
51843
51843
|
}`;
|
|
51844
51844
|
}
|
|
51845
51845
|
var GrpcClient = class {
|
|
51846
|
+
clientID;
|
|
51846
51847
|
address;
|
|
51847
51848
|
serviceImpls;
|
|
51848
51849
|
channel;
|
|
@@ -51855,6 +51856,7 @@ var GrpcClient = class {
|
|
|
51855
51856
|
// bidi that is waiting for context
|
|
51856
51857
|
pendingBidiAck = /* @__PURE__ */ new Map();
|
|
51857
51858
|
constructor(address, grpcOptions, serviceImpls) {
|
|
51859
|
+
this.clientID = crypto.randomUUID();
|
|
51858
51860
|
this.address = address;
|
|
51859
51861
|
this.serviceImpls = serviceImpls;
|
|
51860
51862
|
this.proto = loadProtoFromString(buildProtoString(serviceImpls));
|
|
@@ -51899,7 +51901,11 @@ var GrpcClient = class {
|
|
|
51899
51901
|
switch (`${descriptor.serviceType}:${descriptor.methodType}`) {
|
|
51900
51902
|
case "client:unary": {
|
|
51901
51903
|
const incomingStream = pushable({ objectMode: true });
|
|
51902
|
-
const incomingMessages = client2[name.toUpperCase()](incomingStream
|
|
51904
|
+
const incomingMessages = client2[name.toUpperCase()](incomingStream, {
|
|
51905
|
+
metadata: encodeMetadata({
|
|
51906
|
+
BETTER_GRPC_CLIENT_ID: this.clientID
|
|
51907
|
+
})
|
|
51908
|
+
});
|
|
51903
51909
|
(async () => {
|
|
51904
51910
|
try {
|
|
51905
51911
|
for await (const message of incomingMessages) {
|
|
@@ -51923,7 +51929,12 @@ var GrpcClient = class {
|
|
|
51923
51929
|
outStream
|
|
51924
51930
|
);
|
|
51925
51931
|
this.setStream(`${serviceImpl.serviceClass.serviceName}_IN`, name.toUpperCase(), inStream);
|
|
51926
|
-
const incomingMessages =
|
|
51932
|
+
const incomingMessages = client2[name.toUpperCase()](outStream, {
|
|
51933
|
+
metadata: encodeMetadata({
|
|
51934
|
+
...context?.metadata ?? {},
|
|
51935
|
+
BETTER_GRPC_CLIENT_ID: this.clientID
|
|
51936
|
+
})
|
|
51937
|
+
});
|
|
51927
51938
|
(async () => {
|
|
51928
51939
|
try {
|
|
51929
51940
|
for await (const message of incomingMessages) {
|