@teammy/cli 0.0.2 → 0.0.3
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 +1 -1
- package/dist/main.js +34 -17
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/main.js
CHANGED
|
@@ -66,6 +66,21 @@ var ChangesSchema = z2.object({
|
|
|
66
66
|
});
|
|
67
67
|
var BlobCheckSchema = z2.object({ hashes: z2.array(HashSchema).max(MAX_BATCH_FILES) }).strict();
|
|
68
68
|
var MissingBlobsSchema = z2.object({ missing: z2.array(HashSchema) });
|
|
69
|
+
var FileTreeEntrySchema = z2.discriminatedUnion("kind", [
|
|
70
|
+
FileEntrySchema.extend({ kind: z2.literal("file") }),
|
|
71
|
+
z2.object({
|
|
72
|
+
kind: z2.literal("directory"),
|
|
73
|
+
path: FilePathSchema,
|
|
74
|
+
fileCount: z2.number().int().positive()
|
|
75
|
+
})
|
|
76
|
+
]);
|
|
77
|
+
var FileTreeSchema = z2.object({
|
|
78
|
+
revision: RevisionSchema,
|
|
79
|
+
path: z2.union([z2.literal(""), FilePathSchema]),
|
|
80
|
+
entries: z2.array(FileTreeEntrySchema),
|
|
81
|
+
nextCursor: z2.string().nullable()
|
|
82
|
+
});
|
|
83
|
+
var FileSelectionSchema = z2.object({ revision: RevisionSchema, file: FileEntrySchema });
|
|
69
84
|
|
|
70
85
|
// packages/protocol/devices.ts
|
|
71
86
|
var CredentialSchema = z3.string().regex(/^tmy_[a-f0-9]{64}$/);
|
|
@@ -173,7 +188,6 @@ var MemberUpdateSchema = z4.object({
|
|
|
173
188
|
}).strict();
|
|
174
189
|
|
|
175
190
|
// packages/protocol/sessions.ts
|
|
176
|
-
import { createHash } from "node:crypto";
|
|
177
191
|
import { z as z5 } from "zod";
|
|
178
192
|
var AgentSchema = z5.enum(["claude-code", "codex", "cursor", "pi", "dsh"]);
|
|
179
193
|
var SessionSnapshotSchema = z5.object({
|
|
@@ -194,9 +208,6 @@ var SessionSnapshotSchema = z5.object({
|
|
|
194
208
|
(s) => new Set(s.messages.map((m) => m.id)).size === s.messages.length,
|
|
195
209
|
"Duplicate message IDs."
|
|
196
210
|
);
|
|
197
|
-
function sessionKey(agent, nativeId) {
|
|
198
|
-
return createHash("sha256").update(JSON.stringify([agent, nativeId])).digest("hex");
|
|
199
|
-
}
|
|
200
211
|
var SessionCommitSchema = z5.object({
|
|
201
212
|
operationId: z5.uuid(),
|
|
202
213
|
sessionKey: HashSchema,
|
|
@@ -235,7 +246,7 @@ var SessionSearchSchema = z5.object({
|
|
|
235
246
|
|
|
236
247
|
// packages/transport/hub-client.ts
|
|
237
248
|
import { z as z7 } from "zod";
|
|
238
|
-
import { createHash
|
|
249
|
+
import { createHash } from "node:crypto";
|
|
239
250
|
|
|
240
251
|
// packages/protocol/index.ts
|
|
241
252
|
import { z as z6 } from "zod";
|
|
@@ -332,7 +343,7 @@ var HubClient = class {
|
|
|
332
343
|
reader.releaseLock();
|
|
333
344
|
}
|
|
334
345
|
const bytes = Buffer.concat(parts, size);
|
|
335
|
-
if (
|
|
346
|
+
if (createHash("sha256").update(bytes).digest("hex") !== hash2)
|
|
336
347
|
throw new Error("Downloaded content failed integrity verification.");
|
|
337
348
|
return bytes;
|
|
338
349
|
}
|
|
@@ -504,10 +515,10 @@ var ClientProjectState = class {
|
|
|
504
515
|
};
|
|
505
516
|
|
|
506
517
|
// apps/client/project-file.ts
|
|
507
|
-
import { createHash as
|
|
518
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
508
519
|
|
|
509
520
|
// apps/client/files/local-fs.ts
|
|
510
|
-
import { createHash as
|
|
521
|
+
import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
|
|
511
522
|
import { constants } from "node:fs";
|
|
512
523
|
import { lstat, mkdir, open, readdir, realpath, rename, rmdir, unlink } from "node:fs/promises";
|
|
513
524
|
import { dirname, join, relative, sep } from "node:path";
|
|
@@ -623,7 +634,7 @@ async function readStable(root, path) {
|
|
|
623
634
|
return {
|
|
624
635
|
bytes,
|
|
625
636
|
signature: signature(after),
|
|
626
|
-
sha256:
|
|
637
|
+
sha256: createHash2("sha256").update(bytes).digest("hex")
|
|
627
638
|
};
|
|
628
639
|
} finally {
|
|
629
640
|
await file.close();
|
|
@@ -700,7 +711,7 @@ async function applyProjectFile(local, input) {
|
|
|
700
711
|
if (cached && config.configRevision < cached.config.configRevision)
|
|
701
712
|
throw new Error("Server project configuration moved backwards.");
|
|
702
713
|
const bytes = Buffer.from(JSON.stringify(config, null, 2) + "\n");
|
|
703
|
-
const hash2 =
|
|
714
|
+
const hash2 = createHash3("sha256").update(bytes).digest("hex");
|
|
704
715
|
const entry = await metadata(local.root, name);
|
|
705
716
|
let signature2 = null;
|
|
706
717
|
if (entry) {
|
|
@@ -828,7 +839,7 @@ import { readFile, mkdir as mkdir2 } from "node:fs/promises";
|
|
|
828
839
|
import { createInterface } from "node:readline/promises";
|
|
829
840
|
|
|
830
841
|
// apps/client/root-lock.ts
|
|
831
|
-
import { createHash as
|
|
842
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
832
843
|
import { join as join2 } from "node:path";
|
|
833
844
|
|
|
834
845
|
// packages/state/sqlite.ts
|
|
@@ -875,7 +886,7 @@ function acquireRootLock(root, stateDirectory) {
|
|
|
875
886
|
let lock;
|
|
876
887
|
try {
|
|
877
888
|
lock = openDatabase(
|
|
878
|
-
join2(stateDirectory, "locks", `${
|
|
889
|
+
join2(stateDirectory, "locks", `${createHash4("sha256").update(root).digest("hex")}.sqlite3`),
|
|
879
890
|
[]
|
|
880
891
|
);
|
|
881
892
|
lock.exec("PRAGMA busy_timeout=0; BEGIN IMMEDIATE");
|
|
@@ -1324,7 +1335,7 @@ var ClientState = class {
|
|
|
1324
1335
|
};
|
|
1325
1336
|
|
|
1326
1337
|
// apps/client/sessions/command.ts
|
|
1327
|
-
import { createHash as
|
|
1338
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
1328
1339
|
import { realpath as realpath3 } from "node:fs/promises";
|
|
1329
1340
|
import { homedir } from "node:os";
|
|
1330
1341
|
import { dirname as dirname3, join as join5, resolve as resolve2 } from "node:path";
|
|
@@ -1348,7 +1359,7 @@ async function stateLocation(root, directory) {
|
|
|
1348
1359
|
}
|
|
1349
1360
|
|
|
1350
1361
|
// apps/client/sessions/hooks.ts
|
|
1351
|
-
import { createHash as
|
|
1362
|
+
import { createHash as createHash5, randomUUID as randomUUID4 } from "node:crypto";
|
|
1352
1363
|
import { mkdir as mkdir4, open as open2, opendir, rename as rename2, unlink as unlink2 } from "node:fs/promises";
|
|
1353
1364
|
import { isAbsolute as isAbsolute2, join as join4 } from "node:path";
|
|
1354
1365
|
import { z as z9 } from "zod";
|
|
@@ -1475,7 +1486,7 @@ var HintSchema = z9.object({
|
|
|
1475
1486
|
projectDir: z9.string().min(1).max(4096).refine(isAbsolute2)
|
|
1476
1487
|
});
|
|
1477
1488
|
function inbox(directory, root) {
|
|
1478
|
-
return join4(directory, "session-hints",
|
|
1489
|
+
return join4(directory, "session-hints", createHash5("sha256").update(root).digest("hex"));
|
|
1479
1490
|
}
|
|
1480
1491
|
async function recordHint(directory, root, input) {
|
|
1481
1492
|
const hint = HintSchema.parse(input);
|
|
@@ -1483,7 +1494,7 @@ async function recordHint(directory, root, input) {
|
|
|
1483
1494
|
await mkdir4(targetDir, { recursive: true, mode: 448 });
|
|
1484
1495
|
const target = join4(
|
|
1485
1496
|
targetDir,
|
|
1486
|
-
`${
|
|
1497
|
+
`${createHash5("sha256").update(JSON.stringify(hint)).digest("hex")}.json`
|
|
1487
1498
|
);
|
|
1488
1499
|
const temporary = `${target}.${randomUUID4()}.tmp`;
|
|
1489
1500
|
const handle = await open2(temporary, "wx", 384);
|
|
@@ -1638,7 +1649,7 @@ async function runSessionCommand(args) {
|
|
|
1638
1649
|
cursor: join5(
|
|
1639
1650
|
process.env.CURSOR_CONFIG_DIR ?? join5(homedir(), ".cursor"),
|
|
1640
1651
|
"chats",
|
|
1641
|
-
|
|
1652
|
+
createHash6("md5").update(projectDir).digest("hex")
|
|
1642
1653
|
),
|
|
1643
1654
|
pi: join5(process.env.PI_CODING_AGENT_DIR ?? join5(homedir(), ".pi", "agent"), "sessions"),
|
|
1644
1655
|
dsh: void 0
|
|
@@ -1690,6 +1701,12 @@ import { parseArgs as parseArgs2 } from "node:util";
|
|
|
1690
1701
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
1691
1702
|
import { join as join8 } from "node:path";
|
|
1692
1703
|
|
|
1704
|
+
// packages/protocol/session-key.ts
|
|
1705
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
1706
|
+
function sessionKey(agent, nativeId) {
|
|
1707
|
+
return createHash7("sha256").update(JSON.stringify([agent, nativeId])).digest("hex");
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1693
1710
|
// packages/storage/local-blob-store.ts
|
|
1694
1711
|
import { createHash as createHash8, randomUUID as randomUUID5 } from "node:crypto";
|
|
1695
1712
|
import { link, mkdir as mkdir5, open as open3, readFile as readFile2, unlink as unlink3 } from "node:fs/promises";
|