@cotal-ai/workspace 0.159.1 → 0.160.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/dist/broker-policy.d.ts +18 -1
- package/dist/broker-policy.d.ts.map +1 -1
- package/dist/broker-policy.js +23 -2
- package/dist/broker-policy.js.map +1 -1
- package/dist/chat/remembered.d.ts +16 -2
- package/dist/chat/remembered.d.ts.map +1 -1
- package/dist/chat/remembered.js +80 -12
- package/dist/chat/remembered.js.map +1 -1
- package/package.json +2 -2
package/dist/broker-policy.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BrokerTransport } from "@cotal-ai/core";
|
|
1
|
+
import { type AccountResolver, type BrokerTransport } from "@cotal-ai/core";
|
|
2
2
|
/** What was recorded about how this broker is served. */
|
|
3
3
|
export interface BrokerPolicy {
|
|
4
4
|
/** Schema version, so a future reader can refuse a shape it does not understand rather than
|
|
@@ -12,6 +12,12 @@ export interface BrokerPolicy {
|
|
|
12
12
|
* A renderer outside `up` - a hosted tenant provisioner, say - reads it from here rather than
|
|
13
13
|
* from the rendered config, so every render of this broker carries the same limit. */
|
|
14
14
|
readonly maxPayload?: number;
|
|
15
|
+
/** `"full"` when the broker resolves space accounts from a directory (`cotal up --account-resolver
|
|
16
|
+
* full`), so a host can add and retire accounts on the running broker without a reload. Absent:
|
|
17
|
+
* the MEMORY resolver, which only knows the accounts its configuration lists. A renderer outside
|
|
18
|
+
* `up` passes {@link brokerAccountResolver} for it, because nats-server switches resolvers only at
|
|
19
|
+
* start and refuses a reload that changes one. */
|
|
20
|
+
readonly accountResolver?: "full";
|
|
15
21
|
}
|
|
16
22
|
/** Thrown for every unreadable, unparseable or unusable policy. Distinct so callers can report a
|
|
17
23
|
* POLICY cause and refuse, instead of reporting a generic failure and continuing. */
|
|
@@ -37,6 +43,17 @@ export declare function writeBrokerPolicy(root: string, policy: BrokerPolicy): v
|
|
|
37
43
|
* because a cert file moved — reachable by an operator who did nothing wrong.
|
|
38
44
|
*/
|
|
39
45
|
export declare function readBrokerPolicy(root: string): BrokerPolicy | undefined;
|
|
46
|
+
/** `<root>/.cotal/account-jwts`, where a broker on the full account resolver stores the account
|
|
47
|
+
* claims it was pushed. It sits beside `auth/` rather than inside it, where every subdirectory is
|
|
48
|
+
* read as a space. */
|
|
49
|
+
export declare function accountJwtsDir(root: string): string;
|
|
50
|
+
/** Accounts the full resolver may hold: a space uses its data account and, with user auth, a callout
|
|
51
|
+
* account, so this is room for 50000 spaces on one broker. nats-server refuses a push beyond it. */
|
|
52
|
+
export declare const ACCOUNT_JWT_LIMIT = 100000;
|
|
53
|
+
/** The account resolver every render of this root's broker carries, from the recorded choice
|
|
54
|
+
* (`readBrokerPolicy(root)?.accountResolver`). `up` and a host that renders the same broker both
|
|
55
|
+
* call this, so the two renders cannot name different directories or limits. */
|
|
56
|
+
export declare function brokerAccountResolver(root: string, recorded: BrokerPolicy["accountResolver"]): AccountResolver;
|
|
40
57
|
/** Node's codes for a certificate chain this client does not trust: a self-signed certificate, or
|
|
41
58
|
* one whose CA is not among Node's trusted CAs, which `NODE_EXTRA_CA_CERTS` adds. An expired
|
|
42
59
|
* certificate, or one that names another host, is not among them. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broker-policy.d.ts","sourceRoot":"","sources":["../src/broker-policy.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAsC,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"broker-policy.d.ts","sourceRoot":"","sources":["../src/broker-policy.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAsC,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEhH,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B;wBACoB;IACpB,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC;8FAC0F;IAC1F,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;2FAEuF;IACvF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;uDAImD;IACnD,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;sFACsF;AACtF,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED;;+BAE+B;AAC/B,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;+BAE+B;AAC/B,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAI1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CA0DvE;AAED;;uBAEuB;AACvB,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;qGACqG;AACrG,eAAO,MAAM,iBAAiB,SAAU,CAAC;AAEzC;;iFAEiF;AACjF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAC,iBAAiB,CAAC,GAAG,eAAe,CAI9G;AAED;;sEAEsE;AACtE,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAgM,CAAC"}
|
package/dist/broker-policy.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* entirely sensible-sounding basis would be handing over the broker's identity.
|
|
22
22
|
*/
|
|
23
23
|
import { existsSync, readFileSync } from "node:fs";
|
|
24
|
-
import { join } from "node:path";
|
|
24
|
+
import { join, resolve } from "node:path";
|
|
25
25
|
import { mkSecretDir, writeSecretFileAtomic } from "@cotal-ai/core";
|
|
26
26
|
/** Thrown for every unreadable, unparseable or unusable policy. Distinct so callers can report a
|
|
27
27
|
* POLICY cause and refuse, instead of reporting a generic failure and continuing. */
|
|
@@ -85,7 +85,11 @@ export function readBrokerPolicy(root) {
|
|
|
85
85
|
const maxPayload = doc.maxPayload;
|
|
86
86
|
if (maxPayload !== undefined && (!Number.isSafeInteger(maxPayload) || maxPayload <= 0))
|
|
87
87
|
throw new BrokerPolicyError(`broker policy at ${path} names a payload limit that is not a positive whole number of bytes: ${JSON.stringify(maxPayload)}`);
|
|
88
|
-
const
|
|
88
|
+
const accountResolver = doc.accountResolver;
|
|
89
|
+
if (accountResolver !== undefined && accountResolver !== "full")
|
|
90
|
+
throw new BrokerPolicyError(`broker policy at ${path} names an unknown account resolver ${JSON.stringify(accountResolver)}; expected "full" or none`);
|
|
91
|
+
const limits = { ...(authTimeout !== undefined ? { authTimeout } : {}), ...(maxPayload !== undefined ? { maxPayload } : {}),
|
|
92
|
+
...(accountResolver !== undefined ? { accountResolver } : {}) };
|
|
89
93
|
if (t.kind === "plaintext")
|
|
90
94
|
return { version: 1, transport: { kind: "plaintext" }, ...limits };
|
|
91
95
|
if (t.kind !== "tls-required")
|
|
@@ -102,6 +106,23 @@ export function readBrokerPolicy(root) {
|
|
|
102
106
|
}
|
|
103
107
|
return { version: 1, transport: { kind: "tls-required", certFile: t.certFile, keyFile: t.keyFile }, ...limits };
|
|
104
108
|
}
|
|
109
|
+
/** `<root>/.cotal/account-jwts`, where a broker on the full account resolver stores the account
|
|
110
|
+
* claims it was pushed. It sits beside `auth/` rather than inside it, where every subdirectory is
|
|
111
|
+
* read as a space. */
|
|
112
|
+
export function accountJwtsDir(root) {
|
|
113
|
+
return join(resolve(root), ".cotal", "account-jwts");
|
|
114
|
+
}
|
|
115
|
+
/** Accounts the full resolver may hold: a space uses its data account and, with user auth, a callout
|
|
116
|
+
* account, so this is room for 50000 spaces on one broker. nats-server refuses a push beyond it. */
|
|
117
|
+
export const ACCOUNT_JWT_LIMIT = 100_000;
|
|
118
|
+
/** The account resolver every render of this root's broker carries, from the recorded choice
|
|
119
|
+
* (`readBrokerPolicy(root)?.accountResolver`). `up` and a host that renders the same broker both
|
|
120
|
+
* call this, so the two renders cannot name different directories or limits. */
|
|
121
|
+
export function brokerAccountResolver(root, recorded) {
|
|
122
|
+
return recorded === "full"
|
|
123
|
+
? { kind: "full", directory: accountJwtsDir(root), limit: ACCOUNT_JWT_LIMIT, intervalMs: 60_000 }
|
|
124
|
+
: { kind: "memory" };
|
|
125
|
+
}
|
|
105
126
|
/** Node's codes for a certificate chain this client does not trust: a self-signed certificate, or
|
|
106
127
|
* one whose CA is not among Node's trusted CAs, which `NODE_EXTRA_CA_CERTS` adds. An expired
|
|
107
128
|
* certificate, or one that names another host, is not among them. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broker-policy.js","sourceRoot":"","sources":["../src/broker-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"broker-policy.js","sourceRoot":"","sources":["../src/broker-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAA8C,MAAM,gBAAgB,CAAC;AAuBhH;sFACsF;AACtF,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;+BAE+B;AAC/B,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,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IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AACvD,CAAC;AAED;qGACqG;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAEzC;;iFAEiF;AACjF,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,QAAyC;IAC3F,OAAO,QAAQ,KAAK,MAAM;QACxB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE;QACjG,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACzB,CAAC;AAED;;sEAEsE;AACtE,MAAM,CAAC,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC,CAAC,6BAA6B,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,mCAAmC,EAAE,iCAAiC,EAAE,gBAAgB,CAAC,CAAC,CAAC"}
|
|
@@ -25,6 +25,9 @@ export interface RememberedChatSessions {
|
|
|
25
25
|
}
|
|
26
26
|
/** How many sessions a space keeps. Remembering one more removes the oldest. */
|
|
27
27
|
export declare const REMEMBERED_CHAT_SESSIONS = 20;
|
|
28
|
+
/** How many read marks a space keeps, the newest messages first. The app loads a few hundred direct
|
|
29
|
+
* messages at most, and fewer read ones than this are newer than any of those. */
|
|
30
|
+
export declare const READ_MARKS = 1000;
|
|
28
31
|
/** Records `identity`, a session just opened at `target`, then removes the space's oldest records past
|
|
29
32
|
* {@link REMEMBERED_CHAT_SESSIONS}. Each session has its own file, which a rename writes whole, so two
|
|
30
33
|
* app runs on one space never write the same file and a reader never sees half of one. */
|
|
@@ -34,7 +37,18 @@ export declare function rememberChatSession(target: Pick<MeshTarget, "space" | "
|
|
|
34
37
|
* link or that another account could write throws: a record planted there would make the app read
|
|
35
38
|
* that principal's direct messages as the human's. */
|
|
36
39
|
export declare function rememberedChatSessions(target: Pick<MeshTarget, "space" | "server">): RememberedChatSessions;
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
40
|
+
/** The ids of the direct messages the terminal app showed the human on `space`, in any run. Message
|
|
41
|
+
* ids are unique across brokers, so the marks are the space's. A record that does not parse throws,
|
|
42
|
+
* as does a folder or file another account could write. */
|
|
43
|
+
export declare function readMarks(space: string): ReadonlySet<string>;
|
|
44
|
+
/** Adds `messages` to `space`'s read marks and keeps the newest {@link READ_MARKS}. A lock holds the
|
|
45
|
+
* read and the write together, so two app runs on one space never drop each other's marks. An id
|
|
46
|
+
* longer than 128 characters throws, and nothing is written. */
|
|
47
|
+
export declare function markRead(space: string, messages: readonly {
|
|
48
|
+
readonly id: string;
|
|
49
|
+
readonly ts: number;
|
|
50
|
+
}[]): void;
|
|
51
|
+
/** Removes every session remembered for `space`, and its read marks, so a later space of the same name
|
|
52
|
+
* starts with none. Returns how many sessions there were. */
|
|
39
53
|
export declare function forgetChatSessions(space: string): number;
|
|
40
54
|
//# sourceMappingURL=remembered.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remembered.d.ts","sourceRoot":"","sources":["../../src/chat/remembered.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;yDACyD;AACzD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gGAAgG;IAChG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;A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F,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,QAAQ,CAAC,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI,CAYjH;AAED;;;uDAGuD;AACvD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,QAAQ,CAAC,GAAG,sBAAsB,CAG3G;AAED;;4DAE4D;AAC5D,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAE5D;AAED;;iEAEiE;AACjE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,IAAI,CAY/G;AAyBD;8DAC8D;AAC9D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOxD"}
|
package/dist/chat/remembered.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readdirSync, rmSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { assertLifecycleToken, ensureDirNoSymlink, hardenPrivate, parsePrincipalKey, unlinkFileNoFollow, writeSecretFileAtomic } from "@cotal-ai/core";
|
|
3
|
+
import { acquireLock, assertLifecycleToken, ensureDirNoSymlink, hardenPrivate, parsePrincipalKey, unlinkFileNoFollow, writeSecretFileAtomic } from "@cotal-ai/core";
|
|
4
4
|
import { spaceSegment } from "../auth-paths.js";
|
|
5
5
|
import { homeCotalDir } from "../cotal-home.js";
|
|
6
6
|
import { decodeLocalJson, localRecordObject, localRecordText, prepareCotalHomeForWrite, protectedLocalDirectory, readLocalRecordSource } from "../protected-records.js";
|
|
@@ -10,18 +10,33 @@ const VERSION = 1;
|
|
|
10
10
|
const FIELDS = ["v", "space", "server", "principal", "lifecycleUid", "label", "openedAt"];
|
|
11
11
|
const RECORD_LIMIT = 4096;
|
|
12
12
|
const FOLDER = "the folder of remembered chat sessions";
|
|
13
|
+
/** How many read marks a space keeps, the newest messages first. The app loads a few hundred direct
|
|
14
|
+
* messages at most, and fewer read ones than this are newer than any of those. */
|
|
15
|
+
export const READ_MARKS = 1000;
|
|
16
|
+
const READ_FILE = "read.json";
|
|
17
|
+
const READ_FIELDS = ["v", "space", "read"];
|
|
18
|
+
const READ_LIMIT = 256 * 1024;
|
|
19
|
+
const ID_LIMIT = 128;
|
|
13
20
|
const folder = (space) => join(homeCotalDir(), "chat-sessions", spaceSegment(space));
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
// A name without `.json` is a write in progress or a lock. The read marks share the folder, so
|
|
22
|
+
// forgetting a space forgets them too.
|
|
23
|
+
const sessionFiles = (dir) => readdirSync(dir).filter((name) => name.endsWith(".json") && name !== READ_FILE);
|
|
24
|
+
/** The space's folder, made private when it is new. */
|
|
25
|
+
function prepareFolder(space) {
|
|
18
26
|
prepareCotalHomeForWrite();
|
|
19
|
-
const dir = folder(
|
|
27
|
+
const dir = folder(space);
|
|
20
28
|
const created = [join(homeCotalDir(), "chat-sessions"), dir].filter((path) => !existsSync(path));
|
|
21
|
-
ensureDirNoSymlink(homeCotalDir(), "chat-sessions", spaceSegment(
|
|
29
|
+
ensureDirNoSymlink(homeCotalDir(), "chat-sessions", spaceSegment(space));
|
|
22
30
|
for (const path of created)
|
|
23
31
|
hardenPrivate(path, "dir");
|
|
24
32
|
protectedLocalDirectory(dir, FOLDER);
|
|
33
|
+
return dir;
|
|
34
|
+
}
|
|
35
|
+
/** Records `identity`, a session just opened at `target`, then removes the space's oldest records past
|
|
36
|
+
* {@link REMEMBERED_CHAT_SESSIONS}. Each session has its own file, which a rename writes whole, so two
|
|
37
|
+
* app runs on one space never write the same file and a reader never sees half of one. */
|
|
38
|
+
export function rememberChatSession(target, identity) {
|
|
39
|
+
const dir = prepareFolder(target.space);
|
|
25
40
|
const record = { v: VERSION, space: target.space, server: target.server, principal: identity.principal, lifecycleUid: identity.lifecycleUid, label: identity.label, openedAt: Date.now() };
|
|
26
41
|
writeSecretFileAtomic(join(dir, `${assertLifecycleToken(identity.lifecycleUid)}.json`), `${JSON.stringify(record, null, 2)}\n`);
|
|
27
42
|
for (const { path } of scan(target.space).records.slice(REMEMBERED_CHAT_SESSIONS)) {
|
|
@@ -43,14 +58,68 @@ export function rememberedChatSessions(target) {
|
|
|
43
58
|
const { records, skipped } = scan(target.space);
|
|
44
59
|
return { sessions: records.map((r) => r.record).filter((r) => r.server === target.server), skipped };
|
|
45
60
|
}
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
61
|
+
/** The ids of the direct messages the terminal app showed the human on `space`, in any run. Message
|
|
62
|
+
* ids are unique across brokers, so the marks are the space's. A record that does not parse throws,
|
|
63
|
+
* as does a folder or file another account could write. */
|
|
64
|
+
export function readMarks(space) {
|
|
65
|
+
return new Set(loadMarks(space).keys());
|
|
66
|
+
}
|
|
67
|
+
/** Adds `messages` to `space`'s read marks and keeps the newest {@link READ_MARKS}. A lock holds the
|
|
68
|
+
* read and the write together, so two app runs on one space never drop each other's marks. An id
|
|
69
|
+
* longer than 128 characters throws, and nothing is written. */
|
|
70
|
+
export function markRead(space, messages) {
|
|
71
|
+
if (messages.some((m) => !m.id || m.id.length > ID_LIMIT))
|
|
72
|
+
throw new Error(`a message id is empty or longer than ${ID_LIMIT} characters`);
|
|
73
|
+
const path = join(prepareFolder(space), READ_FILE);
|
|
74
|
+
const lock = acquireLock(`${path}.lock`, { label: "a read-marks write", waitMs: 10_000 });
|
|
75
|
+
try {
|
|
76
|
+
const marks = loadMarks(space);
|
|
77
|
+
for (const m of messages)
|
|
78
|
+
marks.set(m.id, m.ts);
|
|
79
|
+
const read = Object.fromEntries([...marks].sort((a, b) => b[1] - a[1]).slice(0, READ_MARKS));
|
|
80
|
+
writeSecretFileAtomic(path, `${JSON.stringify({ v: VERSION, space, read })}\n`);
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
lock.release();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function loadMarks(space) {
|
|
87
|
+
const dir = folder(space);
|
|
88
|
+
if (!existsSync(dir))
|
|
89
|
+
return new Map();
|
|
90
|
+
protectedLocalDirectory(dir, FOLDER);
|
|
91
|
+
const path = join(dir, READ_FILE);
|
|
92
|
+
const bytes = readLocalRecordSource(path, READ_LIMIT, true);
|
|
93
|
+
if (!bytes)
|
|
94
|
+
return new Map();
|
|
95
|
+
try {
|
|
96
|
+
const value = decodeLocalJson(bytes);
|
|
97
|
+
const v = value?.v;
|
|
98
|
+
if (v !== VERSION)
|
|
99
|
+
throw new Error(`it is record version ${JSON.stringify(v)}, and this release reads version ${VERSION}`);
|
|
100
|
+
const r = localRecordObject(value, READ_FIELDS);
|
|
101
|
+
if (r.space !== space)
|
|
102
|
+
throw new Error("it names another space");
|
|
103
|
+
if (!r.read || typeof r.read !== "object" || Array.isArray(r.read))
|
|
104
|
+
throw new Error("its marks are not an object");
|
|
105
|
+
return new Map(Object.entries(r.read).map(([id, ts]) => {
|
|
106
|
+
if (!id || id.length > ID_LIMIT || typeof ts !== "number" || !Number.isFinite(ts))
|
|
107
|
+
throw new Error("a mark is not a message id with its time");
|
|
108
|
+
return [id, ts];
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
throw new Error(`${path} was not read: ${e.message}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** Removes every session remembered for `space`, and its read marks, so a later space of the same name
|
|
116
|
+
* starts with none. Returns how many sessions there were. */
|
|
48
117
|
export function forgetChatSessions(space) {
|
|
49
118
|
const dir = folder(space);
|
|
50
119
|
if (!existsSync(dir))
|
|
51
120
|
return 0;
|
|
52
121
|
protectedLocalDirectory(dir, FOLDER);
|
|
53
|
-
const count =
|
|
122
|
+
const count = sessionFiles(dir).length;
|
|
54
123
|
rmSync(dir, { recursive: true, force: true });
|
|
55
124
|
return count;
|
|
56
125
|
}
|
|
@@ -61,8 +130,7 @@ function scan(space) {
|
|
|
61
130
|
protectedLocalDirectory(dir, FOLDER);
|
|
62
131
|
const records = [];
|
|
63
132
|
const skipped = [];
|
|
64
|
-
|
|
65
|
-
for (const name of readdirSync(dir).filter((n) => n.endsWith(".json"))) {
|
|
133
|
+
for (const name of sessionFiles(dir)) {
|
|
66
134
|
const path = join(dir, name);
|
|
67
135
|
try {
|
|
68
136
|
const bytes = readLocalRecordSource(path, RECORD_LIMIT, true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remembered.js","sourceRoot":"","sources":["../../src/chat/remembered.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"remembered.js","sourceRoot":"","sources":["../../src/chat/remembered.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACpK,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,wBAAwB,EAAE,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@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cotal-ai/workspace",
|
|
3
3
|
"description": "Cotal machine-local operator and client-surface layer: the ~/.cotal mesh registry, target resolution, preflight, on-disk auth-path I/O, the command-copy renderer, and the live space model (`MeshView`), observer, manager control calls, managed-launch request, chat session and terminal attach that terminal surfaces share — operator concerns over a local checkout, kept separate from the wire protocol in @cotal-ai/core.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.160.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@cotal-ai/core": "0.
|
|
45
|
+
"@cotal-ai/core": "0.160.0",
|
|
46
46
|
"@nats-io/jetstream": "^3.4.0",
|
|
47
47
|
"@nats-io/transport-node": "^3.4.0",
|
|
48
48
|
"ajv": "^8.20.0",
|