skein-js 0.1.0
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/LICENSE +202 -0
- package/README.md +82 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +501 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# skein-js
|
|
2
|
+
|
|
3
|
+
> The skein-js CLI — a drop-in replacement for the LangGraph CLI (dev/up/build/dockerfile).
|
|
4
|
+
|
|
5
|
+
Part of **[skein-js](https://github.com/mainawycliffe/skein)** — a TypeScript [Agent Protocol](https://github.com/langchain-ai/agent-protocol) server for [LangGraph.js](https://github.com/langchain-ai/langgraphjs), and a drop-in replacement for the LangGraph CLI.
|
|
6
|
+
|
|
7
|
+
**Status:** 🚧 Pre-alpha — `dev`, `up`, `build`, and `dockerfile` all work today.
|
|
8
|
+
|
|
9
|
+
## Why skein-js
|
|
10
|
+
|
|
11
|
+
I wanted to self-host my LangGraph.js graphs behind the standard Agent Protocol — on my own infrastructure, without paying for a license to do it. That turns out to be the catch: the LangGraph Platform server that serves your graphs in production (`langgraph-api`) is under the **Elastic License 2.0**, and self-hosting it requires a paid **enterprise license key** (`LANGGRAPH_CLOUD_LICENSE_KEY`) — without one, the server won't start. So your options today are the hosted platform, or an enterprise contract to run it yourself.
|
|
12
|
+
|
|
13
|
+
skein-js is the third option. It's **Apache-2.0**, built only on the **MIT-licensed** `@langchain/*` packages, so you can self-host your graphs with **no license key and no per-deployment fee**.
|
|
14
|
+
|
|
15
|
+
None of this is a knock on LangGraph — skein-js exists _because_ of it. The agent runtime, checkpointers, SDK, and even the MIT JavaScript dev server (`@langchain/langgraph-api`, whose `langgraph.json` parser and schemas skein-js reuses) are all open source, and skein-js doesn't reinvent any of them — it stands on them. A commercially-licensed production server is a fair way for LangChain to fund that open work. skein-js simply fills the one gap that leaves for TypeScript teams: an open, self-hostable way to serve those graphs in production.
|
|
16
|
+
|
|
17
|
+
**Why not just the LangGraph CLI?** `skein` reads your existing `langgraph.json` and mirrors `dev`/`up`/`build`/`dockerfile`, so the swap is one word. What differs is what happens when you go to production and self-host:
|
|
18
|
+
|
|
19
|
+
| | `langgraph` CLI | `skein` CLI |
|
|
20
|
+
| -------------------------- | -------------------------------------------------------- | ----------------------------------------------- |
|
|
21
|
+
| Local `dev` | free in-memory dev server (Hono) | free in-process dev server, hot reload |
|
|
22
|
+
| Self-hosting in production | requires an enterprise license key (Elastic License 2.0) | Apache-2.0, **no license key** |
|
|
23
|
+
| Production path | LangGraph Platform (hosted, or licensed self-host) | self-hosted Docker Compose you own (`skein up`) |
|
|
24
|
+
| Persistence | platform-managed | your Postgres (+ pgvector) and Redis |
|
|
25
|
+
| HTTP framework | Hono | Express (Fastify / NestJS to follow) |
|
|
26
|
+
|
|
27
|
+
### When the LangGraph Platform is the better call
|
|
28
|
+
|
|
29
|
+
skein-js isn't strictly better — it's a different trade, and it's worth being clear about what the Enterprise plan actually buys. It isn't hosting: even on LangGraph's self-hosted tier you still run your own Postgres, Redis, and infrastructure. What you're paying for is **LangChain's support** — dedicated support, response-time SLAs, and architectural guidance from the team that builds LangGraph — plus enterprise features like SSO, RBAC, and SOC2. If you're an established product with real revenue and you want a vendor standing behind your agent stack, that's genuine value, and the Platform is a sound choice.
|
|
30
|
+
|
|
31
|
+
skein-js gives you the code and full ownership — not a support contract. **It's for you if** you're earlier-stage or cost-sensitive, don't need (or don't want to buy) an enterprise support relationship, want to keep data in your own infrastructure, run a TypeScript/Node stack, or just want to own your agent infrastructure end to end with no license and no vendor lock-in.
|
|
32
|
+
|
|
33
|
+
The graph code and `langgraph.json` stay unchanged — see the full [Why skein-js comparison](../../README.md#why-skein-js) and the [reuse-first architecture](../../docs/reuse.md).
|
|
34
|
+
|
|
35
|
+
## What it does
|
|
36
|
+
|
|
37
|
+
`skein dev` (in-process, hot reload, no Docker), `skein up` (Docker Compose: app + Postgres + Redis), `skein build` / `skein dockerfile`. The one-word swap from `langgraph dev` → `skein dev`.
|
|
38
|
+
|
|
39
|
+
## Reuse
|
|
40
|
+
|
|
41
|
+
Mirrors `@langchain/langgraph-cli` semantics and reads an unchanged `langgraph.json`. Reuses `@skein-js/config` (built on `@langchain/langgraph-api`'s parser) for graph loading.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pnpm add skein-js
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
Swap it into your `package.json` scripts (`"dev": "skein dev"`, `"up": "skein up"`) — your
|
|
52
|
+
`langgraph.json` is unchanged.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx skein dev --port 2024
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Commands
|
|
59
|
+
|
|
60
|
+
| Command | What it does | Key flags |
|
|
61
|
+
| ------------------ | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `skein dev` | In-process dev server, hot reload, no Docker. | `-p, --port` (2024) · `--host` (127.0.0.1) · `--no-reload` · `--no-persist` · `--store memory\|postgres` · `--queue memory\|redis` |
|
|
63
|
+
| `skein up` | Self-hosted stack via Docker Compose (app + Postgres + Redis). | `-p, --port` (8123) · `--host` (0.0.0.0) |
|
|
64
|
+
| `skein build` | Build a deployable Docker image from the config. | `-t, --tag` (defaults to the project dir name) |
|
|
65
|
+
| `skein dockerfile` | Emit a standalone Dockerfile (stdout by default). | `-o, --output <path>` |
|
|
66
|
+
|
|
67
|
+
All commands take `-c, --config <path>` (default `langgraph.json`).
|
|
68
|
+
|
|
69
|
+
`skein dev --store postgres --queue redis` is a capability the LangGraph CLI does **not** offer: it
|
|
70
|
+
lets you develop against **production-shaped** storage (durable Postgres checkpoints, pgvector
|
|
71
|
+
search, cross-instance Redis streaming) with hot reload and no Docker. Connection URLs come from
|
|
72
|
+
`DATABASE_URL` / `REDIS_URL`.
|
|
73
|
+
|
|
74
|
+
## Learn more
|
|
75
|
+
|
|
76
|
+
- [skein-js overview](../../docs/index.md)
|
|
77
|
+
- [Reuse-first architecture](../../docs/reuse.md)
|
|
78
|
+
- [Roadmap](../../docs/roadmap.md)
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
[Apache-2.0](../../LICENSE)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { createRequire } from "module";
|
|
5
|
+
import { Command, InvalidArgumentError } from "@commander-js/extra-typings";
|
|
6
|
+
|
|
7
|
+
// src/dev-command.ts
|
|
8
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
9
|
+
import path from "path";
|
|
10
|
+
import { loadConfig, parseEnvFile, resolveEnv } from "@skein-js/config";
|
|
11
|
+
import {
|
|
12
|
+
createExpressServer
|
|
13
|
+
} from "@skein-js/express";
|
|
14
|
+
import { buildRuntime } from "@skein-js/runtime";
|
|
15
|
+
|
|
16
|
+
// src/vite-graph-loader.ts
|
|
17
|
+
import { createServer as createNetServer } from "net";
|
|
18
|
+
import { createServer, createServerModuleRunner } from "vite";
|
|
19
|
+
function findFreePort() {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
const probe = createNetServer();
|
|
22
|
+
probe.on("error", reject);
|
|
23
|
+
probe.listen(0, "127.0.0.1", () => {
|
|
24
|
+
const address = probe.address();
|
|
25
|
+
const port = address !== null && typeof address !== "string" ? address.port : 0;
|
|
26
|
+
probe.close(() => resolve(port));
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async function createViteGraphLoader(root, ignored = []) {
|
|
31
|
+
const server = await createServer({
|
|
32
|
+
root,
|
|
33
|
+
configFile: false,
|
|
34
|
+
appType: "custom",
|
|
35
|
+
logLevel: "warn",
|
|
36
|
+
server: {
|
|
37
|
+
middlewareMode: true,
|
|
38
|
+
// We drive reloads manually, so vite's HMR WebSocket server is unused. In middleware mode vite
|
|
39
|
+
// binds it anyway (ignoring `hmr: false`) on a fixed default port, which collides — with a red
|
|
40
|
+
// "port 24678 already in use" error — when two `skein dev`s run at once. Give it an ephemeral
|
|
41
|
+
// port so instances never clash.
|
|
42
|
+
hmr: { port: await findFreePort() },
|
|
43
|
+
watch: { ignored: ["**/node_modules/**", "**/.git/**", "**/dist/**", ...ignored] }
|
|
44
|
+
},
|
|
45
|
+
optimizeDeps: { noDiscovery: true }
|
|
46
|
+
});
|
|
47
|
+
const runner = createServerModuleRunner(server.environments.ssr, { hmr: false });
|
|
48
|
+
return {
|
|
49
|
+
importModule: (sourceFile) => runner.import(sourceFile),
|
|
50
|
+
watcher: server.watcher,
|
|
51
|
+
clearCache: () => runner.clearCache(),
|
|
52
|
+
close: async () => {
|
|
53
|
+
await runner.close();
|
|
54
|
+
await server.close();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/dev-command.ts
|
|
60
|
+
var RELOAD_DEBOUNCE_MS = 120;
|
|
61
|
+
var AUTOSAVE_MS = 2e3;
|
|
62
|
+
var FORCE_EXIT_MS = 5e3;
|
|
63
|
+
var STATE_DIR = ".skein";
|
|
64
|
+
var STATE_FILE = "dev-state.json";
|
|
65
|
+
var devLogger = {
|
|
66
|
+
debug: (message) => console.debug(message),
|
|
67
|
+
info: (message) => console.log(message),
|
|
68
|
+
warn: (message, meta) => meta === void 0 ? console.warn(message) : console.warn(message, meta),
|
|
69
|
+
error: (message, meta) => meta === void 0 ? console.error(message) : console.error(message, meta)
|
|
70
|
+
};
|
|
71
|
+
function applyEnv(resolved) {
|
|
72
|
+
for (const [key, value] of Object.entries(resolved)) {
|
|
73
|
+
if (process.env[key] === void 0) process.env[key] = value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function readConventionalDotEnv(dir) {
|
|
77
|
+
const envPath = path.join(dir, ".env");
|
|
78
|
+
if (!existsSync(envPath)) return {};
|
|
79
|
+
try {
|
|
80
|
+
return parseEnvFile(readFileSync(envPath, "utf8"));
|
|
81
|
+
} catch {
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function runDev(options) {
|
|
86
|
+
const configPath = path.resolve(process.cwd(), options.config);
|
|
87
|
+
const { config, configDir } = await loadConfig({ configPath });
|
|
88
|
+
const declaredEnvPath = typeof config.env === "string" ? path.resolve(configDir, config.env) : void 0;
|
|
89
|
+
const conventional = declaredEnvPath === path.join(configDir, ".env") ? {} : readConventionalDotEnv(configDir);
|
|
90
|
+
applyEnv({ ...conventional, ...await resolveEnv(config, configDir) });
|
|
91
|
+
if (declaredEnvPath !== void 0 && !existsSync(declaredEnvPath)) {
|
|
92
|
+
console.warn(`skein: env file "${config.env}" not found; continuing without it.`);
|
|
93
|
+
}
|
|
94
|
+
const stateDir = path.join(configDir, STATE_DIR);
|
|
95
|
+
const stateFile = path.join(stateDir, STATE_FILE);
|
|
96
|
+
const loader = await createViteGraphLoader(configDir, [`${STATE_DIR}/**`, `**/${STATE_DIR}/**`]);
|
|
97
|
+
const runtime = await buildRuntime({
|
|
98
|
+
configPath,
|
|
99
|
+
importModule: loader.importModule,
|
|
100
|
+
store: options.store,
|
|
101
|
+
queue: options.queue
|
|
102
|
+
});
|
|
103
|
+
const { port, host } = options;
|
|
104
|
+
const canPersist = options.persist && runtime.snapshotState !== void 0;
|
|
105
|
+
if (options.persist && runtime.snapshotState === void 0) {
|
|
106
|
+
console.log(
|
|
107
|
+
`skein: state persists in ${options.store}/${options.queue}; skipping .skein snapshot.`
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
if (canPersist && existsSync(stateFile)) {
|
|
111
|
+
try {
|
|
112
|
+
runtime.hydrateState?.(JSON.parse(readFileSync(stateFile, "utf8")));
|
|
113
|
+
console.log("skein: restored dev state.");
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.warn(
|
|
116
|
+
`skein: could not restore dev state: ${error instanceof Error ? error.message : String(error)}`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (options.verbose) runtime.deps.logRunActivity = true;
|
|
121
|
+
let server;
|
|
122
|
+
try {
|
|
123
|
+
server = await createExpressServer({
|
|
124
|
+
deps: runtime.deps,
|
|
125
|
+
cors: runtime.cors,
|
|
126
|
+
warm: true,
|
|
127
|
+
logger: devLogger
|
|
128
|
+
});
|
|
129
|
+
await server.listen(port, host);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
await Promise.allSettled([loader.close(), runtime.dispose()]);
|
|
132
|
+
const code = error.code;
|
|
133
|
+
console.error(
|
|
134
|
+
code === "EADDRINUSE" ? `skein: port ${port} is already in use. Stop the other process or pass --port.` : `skein: failed to start dev server: ${error instanceof Error ? error.message : String(error)}`
|
|
135
|
+
);
|
|
136
|
+
process.exitCode = 1;
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
console.log(`skein-js listening on http://${host}:${port}`);
|
|
140
|
+
let lastSaved;
|
|
141
|
+
const saveState = () => {
|
|
142
|
+
if (!canPersist || runtime.snapshotState === void 0) return;
|
|
143
|
+
try {
|
|
144
|
+
const serialized = JSON.stringify(runtime.snapshotState());
|
|
145
|
+
if (serialized === lastSaved) return;
|
|
146
|
+
mkdirSync(path.dirname(stateFile), { recursive: true });
|
|
147
|
+
const tmp = `${stateFile}.tmp`;
|
|
148
|
+
writeFileSync(tmp, serialized);
|
|
149
|
+
renameSync(tmp, stateFile);
|
|
150
|
+
lastSaved = serialized;
|
|
151
|
+
} catch (error) {
|
|
152
|
+
console.warn(
|
|
153
|
+
`skein: could not persist dev state: ${error instanceof Error ? error.message : String(error)}`
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
let autosave;
|
|
158
|
+
if (canPersist) {
|
|
159
|
+
autosave = setInterval(saveState, AUTOSAVE_MS);
|
|
160
|
+
autosave.unref();
|
|
161
|
+
}
|
|
162
|
+
if (options.reload) {
|
|
163
|
+
let reloading = false;
|
|
164
|
+
let dirty = false;
|
|
165
|
+
let pending;
|
|
166
|
+
const reload = async () => {
|
|
167
|
+
if (reloading) {
|
|
168
|
+
dirty = true;
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
reloading = true;
|
|
172
|
+
try {
|
|
173
|
+
console.log("skein: change detected, reloading\u2026");
|
|
174
|
+
loader.clearCache();
|
|
175
|
+
await runtime.reloadGraphs();
|
|
176
|
+
await Promise.all(
|
|
177
|
+
runtime.deps.graphs.ids.map(
|
|
178
|
+
(id) => runtime.deps.graphs.load(id).catch((error) => {
|
|
179
|
+
console.error(`skein: graph "${id}" failed to load: ${String(error)}`);
|
|
180
|
+
})
|
|
181
|
+
)
|
|
182
|
+
);
|
|
183
|
+
console.log("skein: reloaded.");
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.error(
|
|
186
|
+
`skein: reload failed: ${error instanceof Error ? error.message : String(error)}`
|
|
187
|
+
);
|
|
188
|
+
} finally {
|
|
189
|
+
reloading = false;
|
|
190
|
+
if (dirty) {
|
|
191
|
+
dirty = false;
|
|
192
|
+
void reload();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
loader.watcher.on("change", (file) => {
|
|
197
|
+
if (`${path.resolve(file)}${path.sep}`.startsWith(`${stateDir}${path.sep}`)) return;
|
|
198
|
+
if (pending) clearTimeout(pending);
|
|
199
|
+
pending = setTimeout(() => void reload(), RELOAD_DEBOUNCE_MS);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
let shuttingDown = false;
|
|
203
|
+
const shutdown = () => {
|
|
204
|
+
if (shuttingDown) return;
|
|
205
|
+
shuttingDown = true;
|
|
206
|
+
if (autosave) clearInterval(autosave);
|
|
207
|
+
const forceExit = setTimeout(() => process.exit(0), FORCE_EXIT_MS);
|
|
208
|
+
forceExit.unref();
|
|
209
|
+
saveState();
|
|
210
|
+
void Promise.allSettled([server.close(), loader.close(), runtime.dispose()]).then(
|
|
211
|
+
() => process.exit(0)
|
|
212
|
+
);
|
|
213
|
+
};
|
|
214
|
+
process.on("SIGINT", shutdown);
|
|
215
|
+
process.on("SIGTERM", shutdown);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// src/docker/commands.ts
|
|
219
|
+
import { spawn, spawnSync } from "child_process";
|
|
220
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
221
|
+
import path3 from "path";
|
|
222
|
+
import { loadConfig as loadConfig2 } from "@skein-js/config";
|
|
223
|
+
|
|
224
|
+
// src/docker/compose.ts
|
|
225
|
+
function portMapping(options) {
|
|
226
|
+
const { hostPort, host, containerPort } = options;
|
|
227
|
+
const bindsAllInterfaces = host === void 0 || host === "0.0.0.0" || host === "::";
|
|
228
|
+
return bindsAllInterfaces ? `"${hostPort}:${containerPort}"` : `"${host}:${hostPort}:${containerPort}"`;
|
|
229
|
+
}
|
|
230
|
+
function generateCompose(options) {
|
|
231
|
+
const ports = portMapping(options);
|
|
232
|
+
return `# Generated by skein \u2014 regenerated by \`skein up\`. Edit with care.
|
|
233
|
+
services:
|
|
234
|
+
app:
|
|
235
|
+
build: .
|
|
236
|
+
ports:
|
|
237
|
+
- ${ports}
|
|
238
|
+
environment:
|
|
239
|
+
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/skein
|
|
240
|
+
REDIS_URL: redis://redis:6379
|
|
241
|
+
depends_on:
|
|
242
|
+
postgres:
|
|
243
|
+
condition: service_healthy
|
|
244
|
+
redis:
|
|
245
|
+
condition: service_healthy
|
|
246
|
+
restart: unless-stopped
|
|
247
|
+
|
|
248
|
+
postgres:
|
|
249
|
+
image: pgvector/pgvector:pg16
|
|
250
|
+
environment:
|
|
251
|
+
POSTGRES_USER: postgres
|
|
252
|
+
POSTGRES_PASSWORD: postgres
|
|
253
|
+
POSTGRES_DB: skein
|
|
254
|
+
volumes:
|
|
255
|
+
- skein-pgdata:/var/lib/postgresql/data
|
|
256
|
+
healthcheck:
|
|
257
|
+
test: ["CMD-SHELL", "pg_isready -U postgres -d skein"]
|
|
258
|
+
interval: 5s
|
|
259
|
+
timeout: 5s
|
|
260
|
+
retries: 10
|
|
261
|
+
restart: unless-stopped
|
|
262
|
+
|
|
263
|
+
redis:
|
|
264
|
+
image: redis:7
|
|
265
|
+
healthcheck:
|
|
266
|
+
test: ["CMD", "redis-cli", "ping"]
|
|
267
|
+
interval: 5s
|
|
268
|
+
timeout: 5s
|
|
269
|
+
retries: 10
|
|
270
|
+
restart: unless-stopped
|
|
271
|
+
|
|
272
|
+
volumes:
|
|
273
|
+
skein-pgdata:
|
|
274
|
+
`;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// src/docker/dockerfile.ts
|
|
278
|
+
import { existsSync as existsSync2 } from "fs";
|
|
279
|
+
import path2 from "path";
|
|
280
|
+
function baseImage(nodeVersion) {
|
|
281
|
+
const major = nodeVersion?.trim().match(/^\d+/)?.[0] ?? "20";
|
|
282
|
+
return `node:${major}-slim`;
|
|
283
|
+
}
|
|
284
|
+
function detectPackageManager(projectDir) {
|
|
285
|
+
if (existsSync2(path2.join(projectDir, "pnpm-lock.yaml"))) return "pnpm";
|
|
286
|
+
if (existsSync2(path2.join(projectDir, "yarn.lock"))) return "yarn";
|
|
287
|
+
return "npm";
|
|
288
|
+
}
|
|
289
|
+
function installSteps(manager) {
|
|
290
|
+
switch (manager) {
|
|
291
|
+
case "pnpm":
|
|
292
|
+
return {
|
|
293
|
+
copyLock: "COPY package.json pnpm-lock.yaml* ./",
|
|
294
|
+
install: "RUN corepack enable && pnpm install --frozen-lockfile"
|
|
295
|
+
};
|
|
296
|
+
case "yarn":
|
|
297
|
+
return {
|
|
298
|
+
copyLock: "COPY package.json yarn.lock* ./",
|
|
299
|
+
install: "RUN corepack enable && yarn install --frozen-lockfile"
|
|
300
|
+
};
|
|
301
|
+
case "npm":
|
|
302
|
+
return {
|
|
303
|
+
copyLock: "COPY package.json package-lock.json* ./",
|
|
304
|
+
// `npm ci` needs a lockfile; fall back to `npm install` when there isn't one.
|
|
305
|
+
install: "RUN npm ci || npm install"
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function generateDockerignore() {
|
|
310
|
+
return [
|
|
311
|
+
"# Generated by skein \u2014 regenerated by `skein build` / `skein up`.",
|
|
312
|
+
".git",
|
|
313
|
+
"node_modules",
|
|
314
|
+
".env",
|
|
315
|
+
".env.*",
|
|
316
|
+
".skein",
|
|
317
|
+
"Dockerfile",
|
|
318
|
+
"compose.yaml",
|
|
319
|
+
".dockerignore",
|
|
320
|
+
"npm-debug.log*",
|
|
321
|
+
""
|
|
322
|
+
].join("\n");
|
|
323
|
+
}
|
|
324
|
+
function generateDockerfile(options) {
|
|
325
|
+
const { nodeVersion, dockerfileLines = [], port, packageManager } = options;
|
|
326
|
+
const { copyLock, install } = installSteps(packageManager);
|
|
327
|
+
const lines = [
|
|
328
|
+
`# Generated by skein \u2014 do not edit by hand (regenerated by \`skein build\` / \`skein up\`).`,
|
|
329
|
+
`FROM ${baseImage(nodeVersion)}`,
|
|
330
|
+
`WORKDIR /app`,
|
|
331
|
+
``,
|
|
332
|
+
`# Install dependencies first for better layer caching.`,
|
|
333
|
+
copyLock,
|
|
334
|
+
install,
|
|
335
|
+
``,
|
|
336
|
+
`# Copy the rest of the project (graphs, langgraph.json, source).`,
|
|
337
|
+
`COPY . .`,
|
|
338
|
+
``,
|
|
339
|
+
`ENV NODE_ENV=production`,
|
|
340
|
+
`EXPOSE ${port}`,
|
|
341
|
+
...dockerfileLines,
|
|
342
|
+
``,
|
|
343
|
+
`# Serve the Agent Protocol against Postgres + Redis (DATABASE_URL / REDIS_URL from the environment).`,
|
|
344
|
+
`CMD ["npx", "skein", "dev", "--no-reload", "--no-persist", "--store", "postgres", "--queue", "redis", "--host", "0.0.0.0", "--port", "${port}"]`
|
|
345
|
+
];
|
|
346
|
+
return `${lines.join("\n")}
|
|
347
|
+
`;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// src/docker/commands.ts
|
|
351
|
+
var CONTAINER_PORT = 8123;
|
|
352
|
+
var DOCKERFILE_NAME = "Dockerfile";
|
|
353
|
+
var COMPOSE_NAME = "compose.yaml";
|
|
354
|
+
var DOCKERIGNORE_NAME = ".dockerignore";
|
|
355
|
+
var GENERATED_MARKER = "# Generated by skein";
|
|
356
|
+
async function loadConfigContext(configOption) {
|
|
357
|
+
const configPath = path3.resolve(process.cwd(), configOption);
|
|
358
|
+
const { config, configDir } = await loadConfig2({ configPath });
|
|
359
|
+
return { config, configDir };
|
|
360
|
+
}
|
|
361
|
+
function renderDockerfile({ config, configDir }, port) {
|
|
362
|
+
return generateDockerfile({
|
|
363
|
+
nodeVersion: config.node_version,
|
|
364
|
+
dockerfileLines: config.dockerfile_lines,
|
|
365
|
+
port,
|
|
366
|
+
packageManager: detectPackageManager(configDir)
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
function defaultImageTag(configDir) {
|
|
370
|
+
const base = path3.basename(configDir).toLowerCase().replace(/[^a-z0-9._-]+/g, "-");
|
|
371
|
+
const trimmed = base.replace(/^[-.]+|[-.]+$/g, "");
|
|
372
|
+
return trimmed.length > 0 ? trimmed : "skein-app";
|
|
373
|
+
}
|
|
374
|
+
function dockerAvailable() {
|
|
375
|
+
const probe = spawnSync("docker", ["--version"], { stdio: "ignore" });
|
|
376
|
+
return probe.status === 0;
|
|
377
|
+
}
|
|
378
|
+
function requireDocker() {
|
|
379
|
+
if (dockerAvailable()) return true;
|
|
380
|
+
console.error("skein: the `docker` CLI was not found on PATH. Install Docker and try again.");
|
|
381
|
+
process.exitCode = 1;
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
function runToCompletion(command, args, cwd) {
|
|
385
|
+
return new Promise((resolve) => {
|
|
386
|
+
const child = spawn(command, args, { cwd, stdio: "inherit" });
|
|
387
|
+
child.on("error", (error) => {
|
|
388
|
+
console.error(`skein: failed to run \`${command}\`: ${error.message}`);
|
|
389
|
+
resolve({ code: null, signal: null });
|
|
390
|
+
});
|
|
391
|
+
child.on("exit", (code, signal) => resolve({ code, signal }));
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
function succeeded(result) {
|
|
395
|
+
return result.code === 0 && result.signal === null;
|
|
396
|
+
}
|
|
397
|
+
function wasInterrupted(result) {
|
|
398
|
+
return result.code === 130 || result.signal === "SIGINT" || result.signal === "SIGTERM";
|
|
399
|
+
}
|
|
400
|
+
function describeExit(result) {
|
|
401
|
+
return result.signal !== null ? `killed by ${result.signal}` : `exit ${result.code}`;
|
|
402
|
+
}
|
|
403
|
+
function writeGeneratedFile(file, contents) {
|
|
404
|
+
const name = path3.basename(file);
|
|
405
|
+
if (existsSync3(file) && !readFileSync2(file, "utf8").startsWith(GENERATED_MARKER)) {
|
|
406
|
+
console.log(`skein: ${name} exists and wasn't generated by skein \u2014 using it as-is.`);
|
|
407
|
+
return "kept-user";
|
|
408
|
+
}
|
|
409
|
+
writeFileSync2(file, contents);
|
|
410
|
+
console.log(`skein: wrote ${name}.`);
|
|
411
|
+
return "wrote";
|
|
412
|
+
}
|
|
413
|
+
async function runDockerfile(options) {
|
|
414
|
+
const context = await loadConfigContext(options.config);
|
|
415
|
+
const contents = renderDockerfile(context, CONTAINER_PORT);
|
|
416
|
+
if (options.output !== void 0) {
|
|
417
|
+
const target = path3.resolve(process.cwd(), options.output);
|
|
418
|
+
writeFileSync2(target, contents);
|
|
419
|
+
console.log(`skein: wrote ${target}.`);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
process.stdout.write(contents);
|
|
423
|
+
}
|
|
424
|
+
async function runBuild(options) {
|
|
425
|
+
const context = await loadConfigContext(options.config);
|
|
426
|
+
if (!requireDocker()) return;
|
|
427
|
+
const dockerfilePath = path3.join(context.configDir, DOCKERFILE_NAME);
|
|
428
|
+
writeGeneratedFile(dockerfilePath, renderDockerfile(context, CONTAINER_PORT));
|
|
429
|
+
writeGeneratedFile(path3.join(context.configDir, DOCKERIGNORE_NAME), generateDockerignore());
|
|
430
|
+
const tag = options.tag ?? defaultImageTag(context.configDir);
|
|
431
|
+
console.log(`skein: building image "${tag}"\u2026`);
|
|
432
|
+
const result = await runToCompletion(
|
|
433
|
+
"docker",
|
|
434
|
+
["build", "-t", tag, "-f", dockerfilePath, "."],
|
|
435
|
+
context.configDir
|
|
436
|
+
);
|
|
437
|
+
if (!succeeded(result)) {
|
|
438
|
+
console.error(`skein: docker build failed (${describeExit(result)}).`);
|
|
439
|
+
process.exitCode = 1;
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
console.log(`skein: built image "${tag}".`);
|
|
443
|
+
}
|
|
444
|
+
async function runUp(options) {
|
|
445
|
+
const context = await loadConfigContext(options.config);
|
|
446
|
+
if (!requireDocker()) return;
|
|
447
|
+
writeGeneratedFile(
|
|
448
|
+
path3.join(context.configDir, DOCKERFILE_NAME),
|
|
449
|
+
renderDockerfile(context, CONTAINER_PORT)
|
|
450
|
+
);
|
|
451
|
+
writeGeneratedFile(path3.join(context.configDir, DOCKERIGNORE_NAME), generateDockerignore());
|
|
452
|
+
writeGeneratedFile(
|
|
453
|
+
path3.join(context.configDir, COMPOSE_NAME),
|
|
454
|
+
generateCompose({ hostPort: options.port, host: options.host, containerPort: CONTAINER_PORT })
|
|
455
|
+
);
|
|
456
|
+
console.log(
|
|
457
|
+
`skein: bringing up the stack (app + Postgres + Redis) on http://${options.host}:${options.port}\u2026`
|
|
458
|
+
);
|
|
459
|
+
const result = await runToCompletion(
|
|
460
|
+
"docker",
|
|
461
|
+
["compose", "-f", COMPOSE_NAME, "up", "--build"],
|
|
462
|
+
context.configDir
|
|
463
|
+
);
|
|
464
|
+
if (!succeeded(result) && !wasInterrupted(result)) {
|
|
465
|
+
console.error(`skein: docker compose up failed (${describeExit(result)}).`);
|
|
466
|
+
process.exitCode = 1;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// src/index.ts
|
|
471
|
+
var require2 = createRequire(import.meta.url);
|
|
472
|
+
var { version } = require2("../package.json");
|
|
473
|
+
function parsePort(value) {
|
|
474
|
+
const port = Number(value);
|
|
475
|
+
if (!Number.isInteger(port) || port < 0 || port > 65535) {
|
|
476
|
+
throw new InvalidArgumentError("Port must be an integer between 0 and 65535.");
|
|
477
|
+
}
|
|
478
|
+
return port;
|
|
479
|
+
}
|
|
480
|
+
function parseChoice(choices) {
|
|
481
|
+
return (value) => {
|
|
482
|
+
if (!choices.includes(value)) {
|
|
483
|
+
throw new InvalidArgumentError(`Must be one of: ${choices.join(", ")}.`);
|
|
484
|
+
}
|
|
485
|
+
return value;
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
var parseStore = parseChoice(["memory", "postgres"]);
|
|
489
|
+
var parseQueue = parseChoice(["memory", "redis"]);
|
|
490
|
+
var program = new Command().name("skein").description(
|
|
491
|
+
"Agent Protocol server for LangGraph.js \u2014 a drop-in replacement for the LangGraph CLI."
|
|
492
|
+
).version(version, "-v, --version");
|
|
493
|
+
program.command("dev").description("Run the in-process dev server with hot reload (no Docker).").option("-c, --config <path>", "Path to langgraph.json", "langgraph.json").option("-p, --port <port>", "Port to bind", parsePort, 2024).option("--host <host>", "Host to bind", "127.0.0.1").option("--no-reload", "Disable hot reload").option("--no-persist", "Don't persist dev state to .skein/ between restarts").option("--store <driver>", "Store driver: memory | postgres", parseStore, "memory").option("--queue <driver>", "Queue driver: memory | redis", parseQueue, "memory").option("-v, --verbose", "Log per-run activity: start/finish, tool calls, and interrupts").action((options) => runDev(options));
|
|
494
|
+
program.command("up").description("Bring up the production stack (Docker Compose: app + Postgres + Redis).").option("-c, --config <path>", "Path to langgraph.json", "langgraph.json").option("-p, --port <port>", "Port to expose", parsePort, 8123).option("--host <host>", "Host to bind", "0.0.0.0").action((options) => runUp(options));
|
|
495
|
+
program.command("build").description("Build a deployable Docker image from the config.").option("-c, --config <path>", "Path to langgraph.json", "langgraph.json").option("-t, --tag <tag>", "Image tag (defaults to the project directory name)").action((options) => runBuild(options));
|
|
496
|
+
program.command("dockerfile").description("Emit a standalone Dockerfile from the config.").option("-c, --config <path>", "Path to langgraph.json", "langgraph.json").option("-o, --output <path>", "Write the Dockerfile here instead of stdout").action((options) => runDockerfile(options));
|
|
497
|
+
try {
|
|
498
|
+
await program.parseAsync(process.argv);
|
|
499
|
+
} catch (error) {
|
|
500
|
+
program.error(error instanceof Error ? error.message : String(error));
|
|
501
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "skein-js",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The skein-js CLI — a drop-in replacement for the LangGraph CLI (dev/up/build/dockerfile).",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "Maina Wycliffe <wmmaina7@gmail.com>",
|
|
7
|
+
"homepage": "https://github.com/mainawycliffe/skein/tree/main/packages/cli#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/mainawycliffe/skein.git",
|
|
11
|
+
"directory": "packages/cli"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/mainawycliffe/skein/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"langgraph",
|
|
18
|
+
"cli",
|
|
19
|
+
"agent-protocol",
|
|
20
|
+
"langgraph-cli",
|
|
21
|
+
"self-hosted"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"bin": {
|
|
34
|
+
"skein": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"LICENSE",
|
|
39
|
+
"README.md"
|
|
40
|
+
],
|
|
41
|
+
"sideEffects": false,
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=20"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@commander-js/extra-typings": "~13.1.0",
|
|
47
|
+
"@langchain/langgraph-checkpoint-postgres": "^1.0.4",
|
|
48
|
+
"commander": "~13.1.0",
|
|
49
|
+
"vite": "^8.1.0",
|
|
50
|
+
"@skein-js/config": "0.1.0",
|
|
51
|
+
"@skein-js/express": "0.1.0",
|
|
52
|
+
"@skein-js/core": "0.1.0",
|
|
53
|
+
"@skein-js/runtime": "0.1.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@langchain/langgraph": "^1.4.0"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
}
|
|
61
|
+
}
|