anycodex 0.0.7 → 0.0.8

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.
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ ToolRegistry
4
+ } from "./chunk-FSJHVC5R.js";
5
+ import "./chunk-6SEC53MI.js";
6
+ import "./chunk-RKQHI4QK.js";
7
+ import "./chunk-H3TAXRCT.js";
8
+ import "./chunk-DU4BGORD.js";
9
+ import "./chunk-LD436475.js";
10
+ import "./chunk-3KUWIT4H.js";
11
+ import "./chunk-XXVDY7BO.js";
12
+ import "./chunk-77HVPD4G.js";
13
+ export {
14
+ ToolRegistry
15
+ };
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ MessageID,
4
+ PartID,
5
+ SessionID
6
+ } from "./chunk-LD436475.js";
7
+ import "./chunk-3KUWIT4H.js";
8
+ import "./chunk-XXVDY7BO.js";
9
+ import "./chunk-77HVPD4G.js";
10
+ export {
11
+ MessageID,
12
+ PartID,
13
+ SessionID
14
+ };
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ Session,
4
+ SessionService,
5
+ SessionStatus,
6
+ Todo
7
+ } from "./chunk-6SEC53MI.js";
8
+ import "./chunk-RKQHI4QK.js";
9
+ import "./chunk-H3TAXRCT.js";
10
+ import "./chunk-DU4BGORD.js";
11
+ import "./chunk-LD436475.js";
12
+ import "./chunk-3KUWIT4H.js";
13
+ import "./chunk-XXVDY7BO.js";
14
+ import "./chunk-77HVPD4G.js";
15
+ export {
16
+ Session,
17
+ SessionService,
18
+ SessionStatus,
19
+ Todo
20
+ };
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ Database,
4
+ MessageTable,
5
+ NotFoundError,
6
+ PartTable,
7
+ ProjectTable,
8
+ SessionTable,
9
+ SqliteNoSqlDb,
10
+ Storage,
11
+ Timestamps,
12
+ TodoTable
13
+ } from "./chunk-RKQHI4QK.js";
14
+ import "./chunk-H3TAXRCT.js";
15
+ import "./chunk-3KUWIT4H.js";
16
+ import "./chunk-XXVDY7BO.js";
17
+ import "./chunk-77HVPD4G.js";
18
+ export {
19
+ Database,
20
+ MessageTable,
21
+ NotFoundError,
22
+ PartTable,
23
+ ProjectTable,
24
+ SessionTable,
25
+ SqliteNoSqlDb,
26
+ Storage,
27
+ Timestamps,
28
+ TodoTable
29
+ };
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ require_token_util
4
+ } from "./chunk-5UMV2W7N.js";
5
+ import {
6
+ require_token_error
7
+ } from "./chunk-DU4BGORD.js";
8
+ import {
9
+ __commonJS
10
+ } from "./chunk-77HVPD4G.js";
11
+
12
+ // ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js
13
+ var require_token = __commonJS({
14
+ "../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js"(exports, module) {
15
+ var __defProp = Object.defineProperty;
16
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
17
+ var __getOwnPropNames = Object.getOwnPropertyNames;
18
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
22
+ };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+ var token_exports = {};
33
+ __export(token_exports, {
34
+ refreshToken: () => refreshToken
35
+ });
36
+ module.exports = __toCommonJS(token_exports);
37
+ var import_token_error = require_token_error();
38
+ var import_token_util = require_token_util();
39
+ async function refreshToken() {
40
+ const { projectId, teamId } = (0, import_token_util.findProjectInfo)();
41
+ let maybeToken = (0, import_token_util.loadToken)(projectId);
42
+ if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {
43
+ const authToken = await (0, import_token_util.getVercelCliToken)();
44
+ if (!authToken) {
45
+ throw new import_token_error.VercelOidcTokenError(
46
+ "Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`"
47
+ );
48
+ }
49
+ if (!projectId) {
50
+ throw new import_token_error.VercelOidcTokenError(
51
+ "Failed to refresh OIDC token: Try re-linking your project with `vc link`"
52
+ );
53
+ }
54
+ maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
55
+ if (!maybeToken) {
56
+ throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
57
+ }
58
+ (0, import_token_util.saveToken)(maybeToken, projectId);
59
+ }
60
+ process.env.VERCEL_OIDC_TOKEN = maybeToken.token;
61
+ return;
62
+ }
63
+ }
64
+ });
65
+ export default require_token();
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ require_token_util
4
+ } from "./chunk-5UMV2W7N.js";
5
+ import "./chunk-DU4BGORD.js";
6
+ import "./chunk-77HVPD4G.js";
7
+ export default require_token_util();
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "anycodex",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "anycode": "dist/bin.js",
7
7
  "anycodex": "dist/bin.js"
8
8
  },
9
+ "dependencies": {
10
+ "node-pty": "^1.1.0",
11
+ "sql.js": "^1.12.0"
12
+ },
9
13
  "devDependencies": {
10
14
  "@types/node": "^25.5.0",
11
15
  "tsup": "^8.4.0",
package/src/bin.ts CHANGED
@@ -4,6 +4,7 @@ import os from "os";
4
4
  import fs from "fs";
5
5
  import readline from "readline";
6
6
  import { fileURLToPath } from "url";
7
+ import { startServer } from "@any-code/server";
7
8
 
8
9
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
10
 
@@ -204,26 +205,20 @@ function getPm2Process(): any | null {
204
205
  }
205
206
  }
206
207
 
207
- // ── Resolve server entry ──────────────────────────────────────────────────
208
+ // ── PM2 ecosystem config ──────────────────────────────────────────────────
208
209
 
209
- function getServerScript(): string {
210
- try {
211
- const serverPkg = path.dirname(
212
- fileURLToPath(import.meta.resolve("@any-code/server/package.json"))
213
- );
214
- return path.join(serverPkg, "dist", "cli.js");
215
- } catch {
216
- const fallback = path.resolve(__dirname, "../../server/dist/cli.js");
217
- return fallback;
218
- }
210
+ function getBinScript(): string {
211
+ return path.resolve(__dirname, "bin.js");
219
212
  }
220
213
 
221
- function writeEcosystem(script: string): string {
214
+ function writeEcosystem(): string {
222
215
  const ecosystemPath = path.join(ANYCODE_DIR, "ecosystem.config.cjs");
216
+ const script = getBinScript();
223
217
  const content = `module.exports = {
224
218
  apps: [{
225
219
  name: ${JSON.stringify(PROCESS_NAME)},
226
220
  script: ${JSON.stringify(script)},
221
+ args: "server",
227
222
  interpreter: "node"
228
223
  }]
229
224
  };
@@ -272,10 +267,9 @@ async function cmdServer() {
272
267
  banner();
273
268
  await ensureSettings();
274
269
 
275
- const script = getServerScript();
276
270
  info("Starting server in foreground...");
277
271
  blank();
278
- await import(script);
272
+ startServer();
279
273
  }
280
274
 
281
275
  async function cmdStart() {
@@ -286,8 +280,7 @@ async function cmdStart() {
286
280
  step("Checking pm2");
287
281
  ensurePm2();
288
282
 
289
- const script = getServerScript();
290
- const ecosystemPath = writeEcosystem(script);
283
+ const ecosystemPath = writeEcosystem();
291
284
 
292
285
  // Register pm2 startup (silent)
293
286
  step("Registering auto-start on boot");
@@ -460,8 +453,7 @@ async function cmdUpdate() {
460
453
 
461
454
  // Restart/start via pm2
462
455
  ensurePm2();
463
- const script = getServerScript();
464
- const ecosystemPath = writeEcosystem(script);
456
+ const ecosystemPath = writeEcosystem();
465
457
  const existing = hasPm2() ? getPm2Process() : null;
466
458
  if (existing) {
467
459
  step("Restarting server");
@@ -498,8 +490,7 @@ async function cmdUpdate() {
498
490
  const existing = getPm2Process();
499
491
  if (existing) {
500
492
  step("Restarting server");
501
- const script = getServerScript();
502
- const ecosystemPath = writeEcosystem(script);
493
+ const ecosystemPath = writeEcosystem();
503
494
  pm2Silent(`delete ${PROCESS_NAME}`);
504
495
  pm2Silent(`start ${ecosystemPath}`);
505
496
  pm2Silent("save");
package/tsup.config.ts CHANGED
@@ -9,4 +9,5 @@ export default defineConfig({
9
9
  banner: {
10
10
  js: "#!/usr/bin/env node",
11
11
  },
12
+ external: ["node-pty", "sql.js"],
12
13
  });