@cotal-ai/delivery 0.56.0 → 0.57.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/index.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/pending.d.ts +10 -0
- package/dist/pending.d.ts.map +1 -0
- package/dist/pending.js +186 -0
- package/dist/pending.js.map +1 -0
- package/package.json +4 -4
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kCAAkC,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAChL,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kCAAkC,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAChL,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAmDzD,OAAO,EAAE,kCAAkC,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,WAAW,EAAE,CAAC;AAC3J,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,23 +8,28 @@
|
|
|
8
8
|
import { registry } from "@cotal-ai/core";
|
|
9
9
|
import { assertUninjectedCredsSharesCwdRoot, DELIVERY_CREDS_KIND, deliveryCredsKey, reloadStoreIdentityFromCredsPath, reloadStoreIdentityOf, runDelivery } from "./delivery.js";
|
|
10
10
|
import { runFeedbackIntake } from "./feedback-intake.js";
|
|
11
|
+
import { runPending } from "./pending.js";
|
|
11
12
|
const deliveryCommands = [
|
|
12
13
|
{
|
|
13
14
|
kind: "command",
|
|
14
15
|
name: "deliver",
|
|
15
16
|
group: "Manager",
|
|
16
|
-
summary: "run the delivery daemon — the server-side Plane-3 durable backstop [--space <s>] [--server <url>] [--creds <file>] (auth mode only; N=1)",
|
|
17
|
+
summary: "run the delivery daemon — the server-side Plane-3 durable backstop [--space <s>] [--server <url>] [--creds <file>] (auth mode only; N=1); or `deliver pending <name>` to inspect a recipient's held DMs",
|
|
18
|
+
positionals: "[pending <name> [--limit <n>] [--durable <name>]]",
|
|
17
19
|
flags: [
|
|
18
20
|
{ name: "space", type: "string", value: "<s>", description: "space to serve (required; the scoped cred doesn't encode it)" },
|
|
19
21
|
{ name: "server", type: "string", value: "<url>", description: "broker URL (default: the broker recorded for --space, else the local mesh)" },
|
|
20
22
|
{ name: "tls", type: "boolean", description: "REQUIRE TLS to the broker - refuse to connect if it is not offered" },
|
|
21
|
-
{ name: "creds", type: "string", value: "<file>", description: "pre-minted scoped delivery cred" },
|
|
23
|
+
{ name: "creds", type: "string", value: "<file>", description: "pre-minted scoped delivery cred, or (with `pending`) an admin cred" },
|
|
22
24
|
{ name: "shard", type: "string", value: "<n>", description: "shard index (N=1 only; non-zero is rejected)" },
|
|
23
25
|
{ name: "shards", type: "string", value: "<n>", description: "shard count (N=1 only; >1 is rejected)" },
|
|
24
26
|
{ name: "dev-mint", type: "boolean", description: "standalone dev: mint a scoped delivery cred from the local signer" },
|
|
27
|
+
{ name: "limit", type: "string", value: "<n>", description: "pending: max recent candidate ids to print (default 20)" },
|
|
28
|
+
{ name: "durable", type: "string", value: "<name>", description: "pending: read this exact DM durable (a live read's printed name) instead of resolving <name>" },
|
|
29
|
+
{ name: "json", type: "boolean", description: "pending: print the facts as one JSON object" },
|
|
25
30
|
],
|
|
26
31
|
prepareMeshTarget: false,
|
|
27
|
-
run: (args) => runDelivery(args),
|
|
32
|
+
run: (args) => (args.positionals[0] === "pending" ? runPending(args) : runDelivery(args)),
|
|
28
33
|
},
|
|
29
34
|
{
|
|
30
35
|
kind: "command",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,kCAAkC,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAChL,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,kCAAkC,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAChL,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,gBAAgB,GAAc;IAClC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;QAChB,OAAO,EACL,yMAAyM;QAC3M,WAAW,EAAE,mDAAmD;QAChE,KAAK,EAAE;YACL,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,8DAA8D,EAAE;YAC5H,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,4EAA4E,EAAE;YAC7I,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE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C,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,WAAW,EAAE,CAAC;AAC3J,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cotal deliver pending <name>` — an operator inspection read over one recipient's DM durable.
|
|
3
|
+
* Never starts the daemon. Answers exactly the question issue #417 asks after a suspected drop:
|
|
4
|
+
* what does the broker hold for this recipient right now. Reads only; never acks, never creates
|
|
5
|
+
* a durable, never claims delivery — the only truthful facts here are what JetStream reports about
|
|
6
|
+
* a consumer that already exists.
|
|
7
|
+
*/
|
|
8
|
+
import { type ParsedArgs } from "@cotal-ai/core";
|
|
9
|
+
export declare function runPending(args: ParsedArgs): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=pending.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending.d.ts","sourceRoot":"","sources":["../src/pending.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EASL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAyCxB,wBAAsB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAiIhE"}
|
package/dist/pending.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cotal deliver pending <name>` — an operator inspection read over one recipient's DM durable.
|
|
3
|
+
* Never starts the daemon. Answers exactly the question issue #417 asks after a suspected drop:
|
|
4
|
+
* what does the broker hold for this recipient right now. Reads only; never acks, never creates
|
|
5
|
+
* a durable, never claims delivery — the only truthful facts here are what JetStream reports about
|
|
6
|
+
* a consumer that already exists.
|
|
7
|
+
*/
|
|
8
|
+
import { CotalEndpoint, dialerFor, dmDurable, dmStream, parsePrincipalKey, resolvePeer, standaloneConnectOpts, unicastSubject, } from "@cotal-ai/core";
|
|
9
|
+
import { connectOrExit } from "@cotal-ai/workspace";
|
|
10
|
+
import { jetstream, jetstreamManager, JetStreamApiCodes, JetStreamApiError } from "@nats-io/jetstream";
|
|
11
|
+
/** A short presence watch, the shape `send.ts` polls: an `offline` card still counts as a resolved
|
|
12
|
+
* peer (the recipient may be dead, that is exactly what this verb exists to inspect). */
|
|
13
|
+
async function pollPresence(ep, target) {
|
|
14
|
+
let peer;
|
|
15
|
+
for (let i = 0; i < 20 && !peer; i++) {
|
|
16
|
+
peer = resolvePeer(ep.getRoster(), target);
|
|
17
|
+
if (!peer)
|
|
18
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
19
|
+
}
|
|
20
|
+
return peer;
|
|
21
|
+
}
|
|
22
|
+
function notFound(name, space) {
|
|
23
|
+
console.error(`✗ not-found: no agent "${name}" and no DM durable for it in space ${space}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
function notFoundDurable(durable, space) {
|
|
27
|
+
console.error(`✗ not-found: no DM durable "${durable}" in space ${space}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
/** Inverse of {@link dmDurable} for the `dm_<owner>-<actor>-<lifecycleUid>` name form. Owner/actor
|
|
31
|
+
* tokens ban `-` ({@link assertValidOwnerToken}) and the lifecycleUid token is `[a-z0-9]{26,32}`
|
|
32
|
+
* (also `-`-free), so splitting the part after the well-known `dm_` prefix on `-` is unambiguous
|
|
33
|
+
* exactly when it yields three parts each matching its own token grammar; anything else (a name
|
|
34
|
+
* typed by hand, a different durable kind) is reported as unparseable rather than guessed at. */
|
|
35
|
+
function parseDmDurable(durable) {
|
|
36
|
+
if (!durable.startsWith("dm_"))
|
|
37
|
+
return null;
|
|
38
|
+
const parts = durable.slice(3).split("-");
|
|
39
|
+
if (parts.length !== 3)
|
|
40
|
+
return null;
|
|
41
|
+
const [owner, actor, uid] = parts;
|
|
42
|
+
if (!/^[A-Za-z0-9_]+$/.test(owner) || !/^[A-Za-z0-9_]+$/.test(actor) || !/^[a-z0-9]{26,32}$/.test(uid))
|
|
43
|
+
return null;
|
|
44
|
+
return { owner, actor };
|
|
45
|
+
}
|
|
46
|
+
export async function runPending(args) {
|
|
47
|
+
const values = args.values;
|
|
48
|
+
const name = args.positionals[1];
|
|
49
|
+
if (!name || args.positionals.length > 2) {
|
|
50
|
+
console.error('usage: cotal deliver pending <name> [--limit <n>] [--durable <name>] [--space <s>] [--server <url>] [--creds <file>]');
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
const limit = values.limit ? Number(values.limit) : 20;
|
|
54
|
+
if (!Number.isSafeInteger(limit) || limit <= 0) {
|
|
55
|
+
console.error(`✗ --limit must be a positive integer, got ${JSON.stringify(values.limit)}`);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
// Admin-only, static-mesh route (the same route `cotal mint --profile admin` takes): this verb
|
|
59
|
+
// grants no new authority, it rides the existing admin profile's STREAM.INFO/CONSUMER.INFO rows.
|
|
60
|
+
// A user-mode mesh has no equivalent read authority yet (see brief "Maintainer's calls"); refuse
|
|
61
|
+
// naming that rather than widening any other profile.
|
|
62
|
+
const conn = await connectOrExit(values, "admin");
|
|
63
|
+
const { server, space, tls } = conn;
|
|
64
|
+
// `<name>` stays required and is only echoed in error text; `--durable` (the exact consumer
|
|
65
|
+
// name a live read prints, via dmDurable/lifecycleNameKey) skips the presence watch entirely so
|
|
66
|
+
// an old lifecycle's held DMs stay reachable once its card is gone from the roster (a same-name
|
|
67
|
+
// respawn's card can never be steered back to a dead lifecycle's owner/actor by name alone).
|
|
68
|
+
let durable;
|
|
69
|
+
let recip;
|
|
70
|
+
if (values.durable) {
|
|
71
|
+
durable = values.durable;
|
|
72
|
+
recip = parseDmDurable(durable) ?? undefined;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
const ep = new CotalEndpoint({
|
|
76
|
+
space,
|
|
77
|
+
servers: server,
|
|
78
|
+
creds: conn.creds,
|
|
79
|
+
channels: [],
|
|
80
|
+
consume: false,
|
|
81
|
+
registerPresence: false,
|
|
82
|
+
watchPresence: true,
|
|
83
|
+
card: { name: "deliver-pending", kind: "endpoint" },
|
|
84
|
+
});
|
|
85
|
+
let peer;
|
|
86
|
+
await ep.start();
|
|
87
|
+
try {
|
|
88
|
+
peer = await pollPresence(ep, name);
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
await ep.stop();
|
|
92
|
+
}
|
|
93
|
+
if (!peer?.lifecycleUid)
|
|
94
|
+
notFound(name, space);
|
|
95
|
+
recip = parsePrincipalKey(peer.card.id) ?? undefined;
|
|
96
|
+
durable = dmDurable(recip?.owner ?? name, recip?.actor ?? name, peer.lifecycleUid);
|
|
97
|
+
}
|
|
98
|
+
const stream = dmStream(space);
|
|
99
|
+
const nc = await dialerFor(server)({ servers: server, ...standaloneConnectOpts({ creds: conn.creds, tls }), maxReconnectAttempts: 0 });
|
|
100
|
+
try {
|
|
101
|
+
const jsm = await jetstreamManager(nc);
|
|
102
|
+
let info;
|
|
103
|
+
try {
|
|
104
|
+
info = await jsm.consumers.info(stream, durable);
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
if (e instanceof JetStreamApiError && e.code === JetStreamApiCodes.ConsumerNotFound) {
|
|
108
|
+
if (values.durable)
|
|
109
|
+
notFoundDurable(durable, space);
|
|
110
|
+
notFound(name, space);
|
|
111
|
+
}
|
|
112
|
+
throw e;
|
|
113
|
+
}
|
|
114
|
+
const streamInfo = await jsm.streams.info(stream);
|
|
115
|
+
const frontier = Math.max(0, (info.config.opt_start_seq ?? 1) - 1);
|
|
116
|
+
const facts = {
|
|
117
|
+
durable,
|
|
118
|
+
pending: info.num_pending,
|
|
119
|
+
ackPending: info.num_ack_pending,
|
|
120
|
+
delivered: info.delivered.stream_seq,
|
|
121
|
+
ackFloor: info.ack_floor.stream_seq,
|
|
122
|
+
created: info.created,
|
|
123
|
+
frontier,
|
|
124
|
+
max_age: streamInfo.config.max_age,
|
|
125
|
+
max_msgs_per_subject: streamInfo.config.max_msgs_per_subject,
|
|
126
|
+
discard: streamInfo.config.discard,
|
|
127
|
+
};
|
|
128
|
+
if (values.json) {
|
|
129
|
+
console.log(JSON.stringify(facts));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
console.log(durable);
|
|
133
|
+
console.log(`pending ${facts.pending}`);
|
|
134
|
+
console.log(`ack-pending ${facts.ackPending}`);
|
|
135
|
+
console.log(`delivered ${facts.delivered}`);
|
|
136
|
+
console.log(`ack-floor ${facts.ackFloor}`);
|
|
137
|
+
console.log(`created ${facts.created}`);
|
|
138
|
+
console.log(`frontier ${facts.frontier}`);
|
|
139
|
+
console.log(`max_age ${facts.max_age} max_msgs_per_subject ${facts.max_msgs_per_subject} discard ${facts.discard}`);
|
|
140
|
+
}
|
|
141
|
+
// Bounded read of recent candidate ids from the ack floor - an ephemeral ordered consumer,
|
|
142
|
+
// never acked, never durable. Not proof of a hole: it names what is there, nothing more.
|
|
143
|
+
// Needs owner/actor to filter subjects; skipped (and said so) when neither a resolved card
|
|
144
|
+
// nor an unambiguous --durable parse supplied them.
|
|
145
|
+
if (!recip) {
|
|
146
|
+
console.log("recent candidate ids: not read (no resolved card)");
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const js = jetstream(nc);
|
|
150
|
+
const subjects = [unicastSubject(space, recip.owner, recip.actor, "*", "*")];
|
|
151
|
+
const start = facts.ackFloor + 1;
|
|
152
|
+
const consumer = await js.consumers.get(stream, { filter_subjects: subjects, opt_start_seq: start });
|
|
153
|
+
try {
|
|
154
|
+
const cinfo = await consumer.info(true);
|
|
155
|
+
const pendingCandidates = Math.min(cinfo.num_pending, limit);
|
|
156
|
+
console.log("recent candidate ids (from the ack floor; not proof of a hole)");
|
|
157
|
+
if (pendingCandidates > 0) {
|
|
158
|
+
const iter = await consumer.consume({ max_messages: pendingCandidates });
|
|
159
|
+
let seen = 0;
|
|
160
|
+
try {
|
|
161
|
+
for await (const m of iter) {
|
|
162
|
+
const body = JSON.parse(new TextDecoder().decode(m.data));
|
|
163
|
+
console.log(` ${body.id} from=${body.from} ts=${body.ts}`);
|
|
164
|
+
seen++;
|
|
165
|
+
if (seen >= pendingCandidates)
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
finally {
|
|
170
|
+
iter.stop();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
try {
|
|
176
|
+
await consumer.delete();
|
|
177
|
+
}
|
|
178
|
+
catch { /* ephemeral, best-effort cleanup */ }
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
await nc.drain();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=pending.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending.js","sourceRoot":"","sources":["../src/pending.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,aAAa,EACb,SAAS,EACT,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,cAAc,GAGf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIvG;0FAC0F;AAC1F,KAAK,UAAU,YAAY,CAAC,EAAiB,EAAE,MAAc;IAC3D,IAAI,IAA0B,CAAC;IAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,GAAG,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,OAAO,CAAC,CAAC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CAAC;gBAC9E,IAAI,iBAAiB,GAAG,CAAC,EAAE,CAAC;oBAC1B,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC,CAAC;oBACzE,IAAI,IAAI,GAAG,CAAC,CAAC;oBACb,IAAI,CAAC;wBACH,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;4BAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAA6C,CAAC;4BACtG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,EAAE,UAAU,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;4BAC9D,IAAI,EAAE,CAAC;4BACP,IAAI,IAAI,IAAI,iBAAiB;gCAAE,MAAM;wBACvC,CAAC;oBACH,CAAC;4BAAS,CAAC;wBACT,IAAI,CAAC,IAAI,EAAE,CAAC;oBACd,CAAC;gBACH,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC;oBAAC,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAAC,CAAC;gBAAC,MAAM,CAAC,CAAC,oCAAoC,CAAC,CAAC;YACjF,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cotal-ai/delivery",
|
|
3
3
|
"description": "Cotal delivery daemon: the server-side Plane-3 durable backstop (fan-out writer + trusted reader + membership/ACL authority), a scoped least-privilege NATS client co-located with the broker.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.57.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@
|
|
22
|
-
"@cotal-ai/
|
|
21
|
+
"@nats-io/jetstream": "^3.4.0",
|
|
22
|
+
"@cotal-ai/core": "0.57.0",
|
|
23
|
+
"@cotal-ai/workspace": "0.57.0"
|
|
23
24
|
},
|
|
24
25
|
"files": [
|
|
25
26
|
"dist"
|
|
@@ -28,7 +29,6 @@
|
|
|
28
29
|
"access": "public"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@nats-io/jetstream": "^3.4.0",
|
|
32
32
|
"@nats-io/kv": "^3.4.0",
|
|
33
33
|
"@nats-io/transport-node": "^3.4.0",
|
|
34
34
|
"@cotal-ai/smoke-kit": "0.0.0"
|