@cotal-ai/connector-core 0.33.3 → 0.33.5
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/agui-holder.d.ts +12 -9
- package/dist/agui-holder.d.ts.map +1 -1
- package/dist/agui-holder.js +16 -10
- package/dist/agui-holder.js.map +1 -1
- package/dist/docs-bundle.generated.js +48 -48
- package/dist/docs-bundle.generated.js.map +1 -1
- package/dist/docs.d.ts.map +1 -1
- package/dist/docs.js +19 -21
- package/dist/docs.js.map +1 -1
- package/dist/durable-source.d.ts +13 -0
- package/dist/durable-source.d.ts.map +1 -1
- package/dist/durable-source.js +26 -0
- package/dist/durable-source.js.map +1 -1
- package/dist/tool-specs.js +10 -10
- package/dist/tool-specs.js.map +1 -1
- package/package.json +2 -2
package/dist/agui-holder.d.ts
CHANGED
|
@@ -21,11 +21,12 @@ import type { AguiEmitter } from "./agui.js";
|
|
|
21
21
|
/**
|
|
22
22
|
* Holds at most one {@link AguiEmitter}, started on first adopt.
|
|
23
23
|
*
|
|
24
|
-
* `T` is the connector's source record type; the holder never inspects one. It owns
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* `T` is the connector's source record type; the holder never inspects one. It owns four things —
|
|
25
|
+
* WHEN the emitter starts, that it starts AT MOST ONCE, that everything touching it is serialized,
|
|
26
|
+
* and carrying the first adopt's opaque context to the connector-owned factory — and deliberately
|
|
27
|
+
* owns no policy about what that context, an event, or a frame means.
|
|
27
28
|
*/
|
|
28
|
-
export declare class AguiEmitterHolder<T> {
|
|
29
|
+
export declare class AguiEmitterHolder<T, StartContext = undefined> {
|
|
29
30
|
private readonly startEmitter;
|
|
30
31
|
private readonly onError;
|
|
31
32
|
private readonly onRunClosed?;
|
|
@@ -55,9 +56,11 @@ export declare class AguiEmitterHolder<T> {
|
|
|
55
56
|
* without it two flushes could read the source at the same cursor. */
|
|
56
57
|
private chain;
|
|
57
58
|
/**
|
|
58
|
-
* @param startEmitter Builds and starts the emitter for an adopted path.
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* @param startEmitter Builds and starts the emitter for an adopted path. `context` is the opaque
|
|
60
|
+
* value supplied with the FIRST adopt (if any); the holder only carries it, while the connector
|
|
61
|
+
* decides what it means. Injected rather than assembled here: the WAL location, the source, and
|
|
62
|
+
* the record mapper are all connector decisions, and a holder that made them would be a second
|
|
63
|
+
* place they are decided.
|
|
61
64
|
* @param onError Where a failure goes. Required, and not defaulted to a swallow: this class runs
|
|
62
65
|
* behind a hook that must not throw, so the only way a failure reaches a human is if the caller
|
|
63
66
|
* is made to say where it goes.
|
|
@@ -68,7 +71,7 @@ export declare class AguiEmitterHolder<T> {
|
|
|
68
71
|
* mapper that still believes the run is open would emit under a `runId` the published stream has
|
|
69
72
|
* already closed, and the emitter would refuse the batch.
|
|
70
73
|
*/
|
|
71
|
-
constructor(startEmitter: (path: string) => Promise<AguiEmitter<T>>, onError: (e: Error) => void, onRunClosed?: ((runId: string) => void) | undefined);
|
|
74
|
+
constructor(startEmitter: (path: string, context: StartContext | undefined) => Promise<AguiEmitter<T>>, onError: (e: Error) => void, onRunClosed?: ((runId: string) => void) | undefined);
|
|
72
75
|
/** True once an emitter is running here. False while a start is still in flight — it reports what
|
|
73
76
|
* IS, never what is about to be. */
|
|
74
77
|
get running(): boolean;
|
|
@@ -106,7 +109,7 @@ export declare class AguiEmitterHolder<T> {
|
|
|
106
109
|
*
|
|
107
110
|
* Synchronous and non-throwing by contract, because a hook calls it. The work lands on the chain.
|
|
108
111
|
*/
|
|
109
|
-
adopt(path: unknown): void;
|
|
112
|
+
adopt(path: unknown, context?: StartContext): void;
|
|
110
113
|
/**
|
|
111
114
|
* Adopt if necessary, then drain the source into frames.
|
|
112
115
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agui-holder.d.ts","sourceRoot":"","sources":["../src/agui-holder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,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G,SAAS,CAE7B;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAOlD;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAQ1B;;;;;OAKG;IACH;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;YAW/D,aAAa;IAwE3B,OAAO,CAAC,GAAG;IAQX,OAAO,CAAC,OAAO;IAOf,4FAA4F;IACtF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
|
package/dist/agui-holder.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Holds at most one {@link AguiEmitter}, started on first adopt.
|
|
3
3
|
*
|
|
4
|
-
* `T` is the connector's source record type; the holder never inspects one. It owns
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* `T` is the connector's source record type; the holder never inspects one. It owns four things —
|
|
5
|
+
* WHEN the emitter starts, that it starts AT MOST ONCE, that everything touching it is serialized,
|
|
6
|
+
* and carrying the first adopt's opaque context to the connector-owned factory — and deliberately
|
|
7
|
+
* owns no policy about what that context, an event, or a frame means.
|
|
7
8
|
*/
|
|
8
9
|
export class AguiEmitterHolder {
|
|
9
10
|
startEmitter;
|
|
@@ -35,9 +36,11 @@ export class AguiEmitterHolder {
|
|
|
35
36
|
* without it two flushes could read the source at the same cursor. */
|
|
36
37
|
chain = Promise.resolve();
|
|
37
38
|
/**
|
|
38
|
-
* @param startEmitter Builds and starts the emitter for an adopted path.
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* @param startEmitter Builds and starts the emitter for an adopted path. `context` is the opaque
|
|
40
|
+
* value supplied with the FIRST adopt (if any); the holder only carries it, while the connector
|
|
41
|
+
* decides what it means. Injected rather than assembled here: the WAL location, the source, and
|
|
42
|
+
* the record mapper are all connector decisions, and a holder that made them would be a second
|
|
43
|
+
* place they are decided.
|
|
41
44
|
* @param onError Where a failure goes. Required, and not defaulted to a swallow: this class runs
|
|
42
45
|
* behind a hook that must not throw, so the only way a failure reaches a human is if the caller
|
|
43
46
|
* is made to say where it goes.
|
|
@@ -101,8 +104,11 @@ export class AguiEmitterHolder {
|
|
|
101
104
|
*
|
|
102
105
|
* Synchronous and non-throwing by contract, because a hook calls it. The work lands on the chain.
|
|
103
106
|
*/
|
|
104
|
-
adopt(path) {
|
|
105
|
-
|
|
107
|
+
adopt(path, context) {
|
|
108
|
+
// Capture the context in THIS queued operation. A shared mutable slot would let a later hook
|
|
109
|
+
// overwrite the first session's startup fact while the connector-owned factory is still waiting
|
|
110
|
+
// on its own async preconditions.
|
|
111
|
+
this.enqueue(() => this.ensureStarted(path, context).then(() => undefined));
|
|
106
112
|
}
|
|
107
113
|
/**
|
|
108
114
|
* Adopt if necessary, then drain the source into frames.
|
|
@@ -152,7 +158,7 @@ export class AguiEmitterHolder {
|
|
|
152
158
|
this.onRunClosed?.(runId);
|
|
153
159
|
});
|
|
154
160
|
}
|
|
155
|
-
async ensureStarted(path) {
|
|
161
|
+
async ensureStarted(path, context) {
|
|
156
162
|
if (this.dead)
|
|
157
163
|
return undefined;
|
|
158
164
|
if (typeof path !== "string" || path.length === 0)
|
|
@@ -210,7 +216,7 @@ export class AguiEmitterHolder {
|
|
|
210
216
|
// What this file does own is the bracket interleave, and it is OPEN: two emitters would
|
|
211
217
|
// each keep their own bracket machine and nothing detects the interleave. That is the
|
|
212
218
|
// stated writer-cardinality limit.
|
|
213
|
-
this.emitter = await this.startEmitter(path);
|
|
219
|
+
this.emitter = await this.startEmitter(path, context);
|
|
214
220
|
return this.emitter;
|
|
215
221
|
}
|
|
216
222
|
catch (e) {
|
package/dist/agui-holder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agui-holder.js","sourceRoot":"","sources":["../src/agui-holder.ts"],"names":[],"mappings":"AAqBA
|
|
1
|
+
{"version":3,"file":"agui-holder.js","sourceRoot":"","sources":["../src/agui-holder.ts"],"names":[],"mappings":"AAqBA;;;;;;;GAOG;AACH,MAAM,OAAO,iBAAiB;IA4CT;IACA;IACA;IA7CX,OAAO,CAAkB;IACjC;oDACgD;IACxC,SAAS,CAAU;IAC3B;;;;;;;;;OASG;IACK,IAAI,CAAS;IACrB;;;;;OAKG;IACK,IAAI,GAAG,KAAK,CAAC;IACrB;2EACuE;IAC/D,KAAK,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAEjD;;;;;;;;;;;;;;;OAeG;IACH,YACmB,YAA0F,EAC1F,OAA2B,EAC3B,WAAqC;QAFrC,iBAAY,GAAZ,YAAY,CAA8E;QAC1F,YAAO,GAAP,OAAO,CAAoB;QAC3B,gBAAW,GAAX,WAAW,CAA0B;IACrD,CAAC;IAEJ;yCACqC;IACrC,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7D,CAAC;IAED,uDAAuD;IACvD,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,4FAA4F;IAC5F,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,MAAM,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAGD,uEAAuE;IACvE,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAa,EAAE,OAAsB;QACzC,6FAA6F;QAC7F,gGAAgG;QAChG,kCAA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