@cotal-ai/connector-core 0.79.0 → 0.82.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/agent.d.ts +8 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +25 -13
- package/dist/agent.js.map +1 -1
- package/dist/agui-emitter.d.ts +139 -5
- package/dist/agui-emitter.d.ts.map +1 -1
- package/dist/agui-emitter.js +310 -28
- package/dist/agui-emitter.js.map +1 -1
- package/dist/agui-holder.d.ts +113 -25
- package/dist/agui-holder.d.ts.map +1 -1
- package/dist/agui-holder.js +288 -84
- package/dist/agui-holder.js.map +1 -1
- package/dist/docs-bundle.generated.d.ts +1 -1
- package/dist/docs-bundle.generated.js +20 -20
- package/dist/docs-bundle.generated.js.map +1 -1
- package/dist/durable-source.d.ts +55 -2
- package/dist/durable-source.d.ts.map +1 -1
- package/dist/durable-source.js +98 -27
- package/dist/durable-source.js.map +1 -1
- package/dist/tool-specs.d.ts +3 -2
- package/dist/tool-specs.d.ts.map +1 -1
- package/dist/tool-specs.js +12 -8
- package/dist/tool-specs.js.map +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +2 -2
- package/dist/tools.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-bundle.generated.js","sourceRoot":"","sources":["../src/docs-bundle.generated.ts"],"names":[],"mappings":"AAKA,yFAAyF;AACzF,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AAErC,MAAM,UAAU,cAAc;IAC5B,OAAO;QACP,SAAS,EAAE,QAAQ;QACnB,eAAe,EAAE,mEAAmE;QACpF,OAAO,EAAE;YACP;gBACE,MAAM,EAAE,eAAe;gBACvB,OAAO,EAAE,eAAe;gBACxB,MAAM,EAAE,0BAA0B;gBAClC,SAAS,EAAE,+FAA+F;gBAC1G,MAAM,EAAE,81IAA81I;aACv2I;YACD;gBACE,MAAM,EAAE,iBAAiB;gBACzB,OAAO,EAAE,YAAY;gBACrB,MAAM,EAAE,0BAA0B;gBAClC,SAAS,EAAE,gHAAgH;gBAC3H,MAAM,EAAE,g2XAAg2X;aACz2X;YACD;gBACE,MAAM,EAAE,cAAc;gBACtB,OAAO,EAAE,cAAc;gBACvB,MAAM,EAAE,uBAAuB;gBAC/B,SAAS,EAAE,wMAAwM;gBACnN,MAAM,EAAE,upnBAAupnB;aAChqnB;YACD;gBACE,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,kBAAkB;gBAC3B,MAAM,EAAE,mEAAmE;gBAC3E,SAAS,EAAE,wMAAwM;gBACnN,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"docs-bundle.generated.js","sourceRoot":"","sources":["../src/docs-bundle.generated.ts"],"names":[],"mappings":"AAKA,yFAAyF;AACzF,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AAErC,MAAM,UAAU,cAAc;IAC5B,OAAO;QACP,SAAS,EAAE,QAAQ;QACnB,eAAe,EAAE,mEAAmE;QACpF,OAAO,EAAE;YACP;gBACE,MAAM,EAAE,eAAe;gBACvB,OAAO,EAAE,eAAe;gBACxB,MAAM,EAAE,0BAA0B;gBAClC,SAAS,EAAE,+FAA+F;gBAC1G,MAAM,EAAE,81IAA81I;aACv2I;YACD;gBACE,MAAM,EAAE,iBAAiB;gBACzB,OAAO,EAAE,YAAY;gBACrB,MAAM,EAAE,0BAA0B;gBAClC,SAAS,EAAE,gHAAgH;gBAC3H,MAAM,EAAE,g2XAAg2X;aACz2X;YACD;gBACE,MAAM,EAAE,cAAc;gBACtB,OAAO,EAAE,cAAc;gBACvB,MAAM,EAAE,uBAAuB;gBAC/B,SAAS,EAAE,wMAAwM;gBACnN,MAAM,EAAE,upnBAAupnB;aAChqnB;YACD;gBACE,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,kBAAkB;gBAC3B,MAAM,EAAE,mEAAmE;gBAC3E,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vP;YACD;gBACE,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,uBAAuB;gBAChC,MAAM,EAAE,uBAAuB;gBAC/B,SAAS,EAAE,kGAAkG;gBAC7G,MAAM,EAAE,09OAA09O;aACn+O;YACD;gBACE,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,gCAAgC;gBACzC,MAAM,EAAE,qBAAqB;gBAC7B,SAAS,EAAE,iEAAiE;gBAC5E,MAAM,EAAE,qi5EAAqi5E;aAC9i5E;YACD;gBACE,MAAM,EAAE,cAAc;gBACtB,OAAO,EAAE,cAAc;gBACvB,MAAM,EAAE,qBAAqB;gBAC7B,SAAS,EAAE,uHAAuH;gBAClI,MAAM,EAAE,0tsBAA0tsB;aACnusB;YACD;gBACE,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,eAAe;gBACxB,MAAM,EAAE,uBAAuB;gBAC/B,SAAS,EAAE,kHAAkH;gBAC7H,MAAM,EAAE,wq8CAAwq8C;aACjr8C;SACF;QACD,MAAM,EAAE;YACN,OAAO,EAAE,0BAA0B;YACnC,MAAM,EAAE,ip7iBAAip7iB;SAC1p7iB;QACD,MAAM,EAAE;YACN,OAAO,EAAE,mCAAmC;YAC5C,MAAM,EAAE,i9mGAAi9mG;SAC19mG;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,oCAAoC;YAC7C,MAAM,EAAE,m4pBAAm4pB;SAC54pB;KACF,CAAC;AACF,CAAC"}
|
package/dist/durable-source.d.ts
CHANGED
|
@@ -36,9 +36,36 @@ export interface SourceRecord<T> {
|
|
|
36
36
|
/** Pass to the next {@link DurableSource.read} to resume immediately after this record. */
|
|
37
37
|
cursor: string;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* One complete line of the source that is not a record, stepped over and reported.
|
|
41
|
+
*
|
|
42
|
+
* The writer is a process this reader does not own, and a write it cut short leaves bytes that
|
|
43
|
+
* never become a record: a full disk ends a write part way through one record, and the next append
|
|
44
|
+
* lands a whole record behind the fragment on the same line. Such a line is a hole in the record
|
|
45
|
+
* from the moment it is written. Reporting it names the hole; halting on it would end the plane
|
|
46
|
+
* for good at that byte, because every later start resumes at the same cursor and meets the same
|
|
47
|
+
* line (measured on two live sessions after one full disk).
|
|
48
|
+
*/
|
|
49
|
+
export interface SourceGap {
|
|
50
|
+
/** Byte offset of the line's first byte. */
|
|
51
|
+
offset: number;
|
|
52
|
+
/** The line's length in bytes, newline excluded. */
|
|
53
|
+
bytes: number;
|
|
54
|
+
/** Why the line is not a record: `not valid UTF-8` or `not a JSON record`, and nothing else.
|
|
55
|
+
* Never built from the parser's message: that message quotes a span of the line, which is the
|
|
56
|
+
* record's own text, and even a number read out of it can come from that span. */
|
|
57
|
+
reason: "not valid UTF-8" | "not a JSON record";
|
|
58
|
+
}
|
|
39
59
|
/** One read: the records that became available, and the cursor to resume from AFTER them. */
|
|
40
60
|
export interface SourceRead<T> {
|
|
41
61
|
records: SourceRecord<T>[];
|
|
62
|
+
/**
|
|
63
|
+
* Complete lines inside this read that were not records, in file order. The cursor is past them.
|
|
64
|
+
* Absent when every line was a record, so a consumer can tell "no gap" from "nobody looked".
|
|
65
|
+
* A consumer that never looks is the silent one, which is why the emitter refuses to advance
|
|
66
|
+
* over a gap it was given nowhere to report.
|
|
67
|
+
*/
|
|
68
|
+
unreadable?: SourceGap[];
|
|
42
69
|
/**
|
|
43
70
|
* Pass to the next {@link DurableSource.read}. Advances ONLY past fully-consumed records.
|
|
44
71
|
*
|
|
@@ -60,6 +87,14 @@ export interface DurableSource<T> {
|
|
|
60
87
|
* MUST NOT return a partially-written record, and MUST NOT advance the cursor past one.
|
|
61
88
|
*/
|
|
62
89
|
read(cursor: string | undefined): Promise<SourceRead<T>>;
|
|
90
|
+
/**
|
|
91
|
+
* The cursor after the last complete record now in the source, consuming nothing. A connector
|
|
92
|
+
* takes it when it reports a turn terminal, so the emitter can later tell which records the
|
|
93
|
+
* source held when the turn ended: see `AguiEmitter.queueTerminal`. The position is the
|
|
94
|
+
* source's AT THE CALL: a source that can read it synchronously does so before returning, so a
|
|
95
|
+
* record the session appends after the call is after the position.
|
|
96
|
+
*/
|
|
97
|
+
end(): Promise<string>;
|
|
63
98
|
}
|
|
64
99
|
/** The file no longer has the identity or consumed prefix recorded by its cursor. */
|
|
65
100
|
export declare class JsonlFileResetError extends Error {
|
|
@@ -75,8 +110,11 @@ export declare class JsonlFileResetError extends Error {
|
|
|
75
110
|
* and the cursor advances only that far. A trailing fragment is left for the next read, when the
|
|
76
111
|
* writer has finished it.
|
|
77
112
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
113
|
+
* A COMPLETE line that is not a record is a different case: it is stepped over and reported as a
|
|
114
|
+
* {@link SourceGap} on the read, never dropped on the quiet. It used to halt the read instead, and
|
|
115
|
+
* that halt was permanent: the line never changes, the cursor never passes it, and every restart
|
|
116
|
+
* met it again. A reader that halts for good on one torn line of a file it does not write loses
|
|
117
|
+
* every record after it, which is the larger hole.
|
|
80
118
|
*/
|
|
81
119
|
export declare class JsonlFileSource<T = unknown> implements DurableSource<T> {
|
|
82
120
|
private readonly path;
|
|
@@ -140,7 +178,21 @@ export declare class JsonlFileSource<T = unknown> implements DurableSource<T> {
|
|
|
140
178
|
readFromBeginning(): Promise<SourceRead<T>>;
|
|
141
179
|
/** Cursor at byte zero for this file's current identity. */
|
|
142
180
|
cursorAtBeginning(): Promise<string>;
|
|
181
|
+
/**
|
|
182
|
+
* The cursor at the last COMPLETE line boundary, minted exactly as a read mints one, so a later
|
|
183
|
+
* `read` from it resumes at the first record written after this moment.
|
|
184
|
+
*
|
|
185
|
+
* READ SYNCHRONOUSLY, before this returns: the moment is the call, not the thread pool's next
|
|
186
|
+
* turn. Issued asynchronously, the position was read after a record the caller appended right
|
|
187
|
+
* after calling, and a terminal reported before that record was placed after it. The read is a
|
|
188
|
+
* few small reads of a local file, the same bytes `read` reads.
|
|
189
|
+
*/
|
|
190
|
+
end(): Promise<string>;
|
|
143
191
|
read(cursor: string | undefined): Promise<SourceRead<T>>;
|
|
192
|
+
/** The lines of `buf` as byte slices, split on the newline byte; `buf` carries no trailing newline. */
|
|
193
|
+
private static lines;
|
|
194
|
+
/** True when every byte is ASCII whitespace, including the empty line. */
|
|
195
|
+
private static isBlank;
|
|
144
196
|
}
|
|
145
197
|
/**
|
|
146
198
|
* Substitutes a captured boundary for the caller's cursor on the ONE read where that cursor is
|
|
@@ -170,5 +222,6 @@ export declare class BoundStartSource<T> implements DurableSource<T> {
|
|
|
170
222
|
readonly kind: string;
|
|
171
223
|
constructor(inner: DurableSource<T>, start: string);
|
|
172
224
|
read(cursor: string | undefined): Promise<SourceRead<T>>;
|
|
225
|
+
end(): Promise<string>;
|
|
173
226
|
}
|
|
174
227
|
//# sourceMappingURL=durable-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable-source.d.ts","sourceRoot":"","sources":["../src/durable-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC;IACT,2FAA2F;IAC3F,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,6FAA6F;AAC7F,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,8EAA8E;AAC9E,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"durable-source.d.ts","sourceRoot":"","sources":["../src/durable-source.ts"],"names":[],"mappings":"AAAA;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IAQ1B;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;mBACkB,MAAM;IAO3B,mGAAmG;mBAC9E,oBAAoB;IAgBzC;;;;;;;;;;;OAWG;IACG,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAOjD,4DAA4D;IACtD,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAU1C;;;;;;;;OAQG;IACH,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;IA8BhB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IA0H9D,uGAAuG;IACvG,OAAO,CAAC,MAAM,CAAE,KAAK;IAarB,0EAA0E;IAC1E,OAAO,CAAC,MAAM,CAAC,OAAO;CAIvB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,gBAAgB,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAIxD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAGH,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,KAAK,EAAE,MAAM;IAKhC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAIxD,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;CAGvB"}
|
package/dist/durable-source.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* hands it back — it never parses it.
|
|
17
17
|
*/
|
|
18
18
|
import { createHash } from "node:crypto";
|
|
19
|
-
import { constants } from "node:fs";
|
|
19
|
+
import { closeSync, constants, fstatSync, openSync, readSync } from "node:fs";
|
|
20
20
|
import { open } from "node:fs/promises";
|
|
21
21
|
/** The file no longer has the identity or consumed prefix recorded by its cursor. */
|
|
22
22
|
export class JsonlFileResetError extends Error {
|
|
@@ -35,8 +35,11 @@ export class JsonlFileResetError extends Error {
|
|
|
35
35
|
* and the cursor advances only that far. A trailing fragment is left for the next read, when the
|
|
36
36
|
* writer has finished it.
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* A COMPLETE line that is not a record is a different case: it is stepped over and reported as a
|
|
39
|
+
* {@link SourceGap} on the read, never dropped on the quiet. It used to halt the read instead, and
|
|
40
|
+
* that halt was permanent: the line never changes, the cursor never passes it, and every restart
|
|
41
|
+
* met it again. A reader that halts for good on one torn line of a file it does not write loses
|
|
42
|
+
* every record after it, which is the larger hole.
|
|
40
43
|
*/
|
|
41
44
|
export class JsonlFileSource {
|
|
42
45
|
path;
|
|
@@ -146,6 +149,45 @@ export class JsonlFileSource {
|
|
|
146
149
|
await fh.close();
|
|
147
150
|
}
|
|
148
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* The cursor at the last COMPLETE line boundary, minted exactly as a read mints one, so a later
|
|
154
|
+
* `read` from it resumes at the first record written after this moment.
|
|
155
|
+
*
|
|
156
|
+
* READ SYNCHRONOUSLY, before this returns: the moment is the call, not the thread pool's next
|
|
157
|
+
* turn. Issued asynchronously, the position was read after a record the caller appended right
|
|
158
|
+
* after calling, and a terminal reported before that record was placed after it. The read is a
|
|
159
|
+
* few small reads of a local file, the same bytes `read` reads.
|
|
160
|
+
*/
|
|
161
|
+
end() {
|
|
162
|
+
const fd = openSync(this.path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
163
|
+
try {
|
|
164
|
+
const st = fstatSync(fd);
|
|
165
|
+
const readAt = (len, position) => {
|
|
166
|
+
const buf = Buffer.allocUnsafe(len);
|
|
167
|
+
return buf.subarray(0, readSync(fd, buf, 0, len, position));
|
|
168
|
+
};
|
|
169
|
+
// The last complete line boundary, as `lastCompleteBoundary` finds it.
|
|
170
|
+
let at = 0;
|
|
171
|
+
const window = 64 * 1024;
|
|
172
|
+
for (let searched = 0; searched < st.size;) {
|
|
173
|
+
const len = Math.min(window, st.size - searched);
|
|
174
|
+
const from = st.size - searched - len;
|
|
175
|
+
const idx = readAt(len, from).lastIndexOf(0x0a);
|
|
176
|
+
if (idx !== -1) {
|
|
177
|
+
at = from + idx + 1;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
searched += len;
|
|
181
|
+
}
|
|
182
|
+
// The seal over the window before it, as `sealAt` computes it.
|
|
183
|
+
const span = Math.min(at, 512);
|
|
184
|
+
const seal = createHash("sha256").update(readAt(span, at - span)).digest("hex").slice(0, 16);
|
|
185
|
+
return Promise.resolve(`${String(st.dev)}:${String(st.ino)}:${at}:${seal}`);
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
closeSync(fd);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
149
191
|
async read(cursor) {
|
|
150
192
|
// O_NOFOLLOW: a symlinked source is REFUSED, not followed.
|
|
151
193
|
//
|
|
@@ -197,39 +239,45 @@ export class JsonlFileSource {
|
|
|
197
239
|
const lastNl = chunk.lastIndexOf(0x0a);
|
|
198
240
|
if (lastNl === -1)
|
|
199
241
|
return { records: [], cursor: await here(from.offset) };
|
|
200
|
-
// FATAL decode. `Buffer.toString("utf8")` substitutes U+FFFD for invalid bytes, so a
|
|
201
|
-
// malformed byte inside an otherwise valid JSON string survives `JSON.parse` as CHANGED DATA
|
|
202
|
-
// and would publish as if it were what the agent did. Silently rewriting a record is the same
|
|
203
|
-
// class of harm as consuming a truncated one.
|
|
204
|
-
let complete;
|
|
205
|
-
try {
|
|
206
|
-
complete = new TextDecoder("utf-8", { fatal: true }).decode(chunk.subarray(0, lastNl));
|
|
207
|
-
}
|
|
208
|
-
catch (e) {
|
|
209
|
-
throw new Error(`JsonlFileSource: invalid UTF-8 at offset ~${from.offset} in ${this.path}: ${e.message}`);
|
|
210
|
-
}
|
|
211
242
|
// PER-RECORD CURSORS, AND THE ARITHMETIC IS IN BYTES BECAUSE THE FILE IS.
|
|
212
243
|
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
//
|
|
217
|
-
//
|
|
218
|
-
//
|
|
244
|
+
// The complete region is split on the newline BYTE and each line is decoded on its own, so a
|
|
245
|
+
// line's byte length is its own length and the cursor after it is exact whatever the line
|
|
246
|
+
// holds. Decoding a line is FATAL: `Buffer.toString("utf8")` substitutes U+FFFD for invalid
|
|
247
|
+
// bytes, so a malformed byte inside an otherwise valid JSON string would survive `JSON.parse`
|
|
248
|
+
// as CHANGED DATA and publish as if it were what the agent did.
|
|
249
|
+
//
|
|
250
|
+
// A line that does not decode, or decodes to something that is not JSON, is a GAP: reported
|
|
251
|
+
// with its offset and length, stepped over, and never a halt. The writer is not this process,
|
|
252
|
+
// and the shape a full disk leaves behind (part of one record glued to the next on one line)
|
|
253
|
+
// never becomes readable, so halting on it is halting for good at that byte while the records
|
|
254
|
+
// after it keep arriving unread.
|
|
219
255
|
//
|
|
220
256
|
// A blank line is not a record but it IS bytes, so it advances the offset like any other.
|
|
221
257
|
const records = [];
|
|
258
|
+
const unreadable = [];
|
|
259
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
222
260
|
let at = from.offset;
|
|
223
|
-
for (const line of
|
|
224
|
-
|
|
225
|
-
|
|
261
|
+
for (const line of JsonlFileSource.lines(chunk.subarray(0, lastNl))) {
|
|
262
|
+
const start = at;
|
|
263
|
+
at += line.length + 1; // + the newline that terminated it
|
|
264
|
+
if (JsonlFileSource.isBlank(line))
|
|
226
265
|
continue; // blank separators are not records
|
|
266
|
+
let text;
|
|
267
|
+
try {
|
|
268
|
+
text = decoder.decode(line);
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
unreadable.push({ offset: start, bytes: line.length, reason: "not valid UTF-8" });
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
227
274
|
let value;
|
|
228
275
|
try {
|
|
229
|
-
value = JSON.parse(
|
|
276
|
+
value = JSON.parse(text);
|
|
230
277
|
}
|
|
231
|
-
catch
|
|
232
|
-
|
|
278
|
+
catch {
|
|
279
|
+
unreadable.push({ offset: start, bytes: line.length, reason: "not a JSON record" });
|
|
280
|
+
continue;
|
|
233
281
|
}
|
|
234
282
|
// One seal per record, computed by the SAME function the batch cursor uses. It is a 512-byte
|
|
235
283
|
// read each, which is the honest cost of not having a second sealing path here — and two
|
|
@@ -245,12 +293,32 @@ export class JsonlFileSource {
|
|
|
245
293
|
// RUNS rather than asserted in a comment.
|
|
246
294
|
if (at !== end)
|
|
247
295
|
throw new Error(`JsonlFileSource: internal cursor walk ended at ${at} but the batch ends at ${end} in ${this.path}`);
|
|
248
|
-
return { records, cursor: await here(end) };
|
|
296
|
+
return { records, cursor: await here(end), ...(unreadable.length > 0 ? { unreadable } : {}) };
|
|
249
297
|
}
|
|
250
298
|
finally {
|
|
251
299
|
await fh.close();
|
|
252
300
|
}
|
|
253
301
|
}
|
|
302
|
+
/** The lines of `buf` as byte slices, split on the newline byte; `buf` carries no trailing newline. */
|
|
303
|
+
static *lines(buf) {
|
|
304
|
+
let start = 0;
|
|
305
|
+
for (;;) {
|
|
306
|
+
const nl = buf.indexOf(0x0a, start);
|
|
307
|
+
if (nl === -1) {
|
|
308
|
+
yield buf.subarray(start);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
yield buf.subarray(start, nl);
|
|
312
|
+
start = nl + 1;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/** True when every byte is ASCII whitespace, including the empty line. */
|
|
316
|
+
static isBlank(line) {
|
|
317
|
+
for (const b of line)
|
|
318
|
+
if (b !== 0x20 && b !== 0x09 && b !== 0x0d && b !== 0x0b && b !== 0x0c)
|
|
319
|
+
return false;
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
254
322
|
}
|
|
255
323
|
/**
|
|
256
324
|
* Substitutes a captured boundary for the caller's cursor on the ONE read where that cursor is
|
|
@@ -286,5 +354,8 @@ export class BoundStartSource {
|
|
|
286
354
|
read(cursor) {
|
|
287
355
|
return this.inner.read(cursor ?? this.start);
|
|
288
356
|
}
|
|
357
|
+
end() {
|
|
358
|
+
return this.inner.end();
|
|
359
|
+
}
|
|
289
360
|
}
|
|
290
361
|
//# sourceMappingURL=durable-source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable-source.js","sourceRoot":"","sources":["../src/durable-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"durable-source.js","sourceRoot":"","sources":["../src/durable-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAmB,MAAM,kBAAkB,CAAC;AAuFzD,qFAAqF;AACrF,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,eAAe;IAGG;IAFpB,IAAI,GAAG,YAAY,CAAC;IAE7B,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAE7C;;;;;;;;;;;OAWG;IACK,MAAM,CAAC,WAAW,CAAC,MAAc;QACvC,MAAM,CAAC,GAAG,2CAA2C,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnE,IAAI,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,C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;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,gBAAgB;IAIR;IACA;IAJV,IAAI,CAAS;IAEtB,YACmB,KAAuB,EACvB,KAAa;QADb,UAAK,GAAL,KAAK,CAAkB;QACvB,UAAK,GAAL,KAAK,CAAQ;QAE9B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,MAA0B;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,GAAG;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IAC1B,CAAC;CACF"}
|
package/dist/tool-specs.d.ts
CHANGED
|
@@ -118,6 +118,7 @@ export declare function renderInbox(opts: {
|
|
|
118
118
|
/** Routing context for a `<channel …>` tag. Keys must be [A-Za-z0-9_] (others are dropped). */
|
|
119
119
|
export declare function channelMeta(i: InboxItem): Record<string, string>;
|
|
120
120
|
/** The full Cotal tool set for a given config. Renderers iterate this; `source` names the
|
|
121
|
-
* hosting connector and is stamped onto outgoing feedback.
|
|
122
|
-
|
|
121
|
+
* hosting connector and is stamped onto outgoing feedback. An explicit env restricts feedback's
|
|
122
|
+
* Git lookup to its global config; omitted preserves process inheritance and repository lookup. */
|
|
123
|
+
export declare function cotalToolSpecs(config: AgentConfig, source?: string, env?: NodeJS.ProcessEnv): CotalToolSpec[];
|
|
123
124
|
//# sourceMappingURL=tool-specs.d.ts.map
|
package/dist/tool-specs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-specs.d.ts","sourceRoot":"","sources":["../src/tool-specs.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAI7E,OAAO,EAA+C,KA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AG,aAAa,EAAE,CA4nClH"}
|
package/dist/tool-specs.js
CHANGED
|
@@ -478,13 +478,16 @@ function renderChannelInfo(channel, info) {
|
|
|
478
478
|
return lines.join("\n");
|
|
479
479
|
}
|
|
480
480
|
/** Contact email for keyless feedback: explicit arg → COTAL_FEEDBACK_EMAIL → git config. */
|
|
481
|
-
function resolveFeedbackEmail(explicit) {
|
|
481
|
+
function resolveFeedbackEmail(explicit, env) {
|
|
482
482
|
if (explicit?.trim())
|
|
483
483
|
return explicit.trim();
|
|
484
|
-
|
|
485
|
-
|
|
484
|
+
const lookupEnv = env ?? process.env;
|
|
485
|
+
if (lookupEnv.COTAL_FEEDBACK_EMAIL?.trim())
|
|
486
|
+
return lookupEnv.COTAL_FEEDBACK_EMAIL.trim();
|
|
487
|
+
// A hosted session must not discover a contact in the host repository.
|
|
488
|
+
const args = env === undefined ? ["config", "user.email"] : ["config", "--global", "--includes", "user.email"];
|
|
486
489
|
try {
|
|
487
|
-
const email = execFileSync("git",
|
|
490
|
+
const email = execFileSync("git", args, { encoding: "utf8", env }).trim();
|
|
488
491
|
return email || undefined;
|
|
489
492
|
}
|
|
490
493
|
catch {
|
|
@@ -507,8 +510,9 @@ export function channelMeta(i) {
|
|
|
507
510
|
return m;
|
|
508
511
|
}
|
|
509
512
|
/** The full Cotal tool set for a given config. Renderers iterate this; `source` names the
|
|
510
|
-
* hosting connector and is stamped onto outgoing feedback.
|
|
511
|
-
|
|
513
|
+
* hosting connector and is stamped onto outgoing feedback. An explicit env restricts feedback's
|
|
514
|
+
* Git lookup to its global config; omitted preserves process inheritance and repository lookup. */
|
|
515
|
+
export function cotalToolSpecs(config, source = "connector", env) {
|
|
512
516
|
// Manager-op tools (cotal_spawn / cotal_persona / cotal_personas) ride the `spawn` capability — publish to the
|
|
513
517
|
// privileged control subject. The AUTH layer is the real boundary: on an authed mesh an agent
|
|
514
518
|
// without the capability is denied at the wire (nats-server); open mode mints no identity, so
|
|
@@ -1002,7 +1006,7 @@ export function cotalToolSpecs(config, source = "connector") {
|
|
|
1002
1006
|
if (status)
|
|
1003
1007
|
await agent.setStatus(status, activity);
|
|
1004
1008
|
else if (activity !== undefined)
|
|
1005
|
-
await agent.
|
|
1009
|
+
await agent.setActivity(activity);
|
|
1006
1010
|
if (attention)
|
|
1007
1011
|
await agent.setAttention(attention);
|
|
1008
1012
|
const lines = [];
|
|
@@ -1263,7 +1267,7 @@ export function cotalToolSpecs(config, source = "connector") {
|
|
|
1263
1267
|
headers.authorization = `Bearer ${config.feedbackKey}`;
|
|
1264
1268
|
}
|
|
1265
1269
|
else {
|
|
1266
|
-
const contact = resolveFeedbackEmail(email);
|
|
1270
|
+
const contact = resolveFeedbackEmail(email, env);
|
|
1267
1271
|
if (!contact)
|
|
1268
1272
|
return err("Keyless feedback goes to the public cotal.ai intake, which requires a traceable contact email — ask the user for one and retry with the email argument (or set COTAL_FEEDBACK_EMAIL).");
|
|
1269
1273
|
body.email = contact;
|