@getpochi/cli 0.5.22 → 0.5.23
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/cli.js +425 -72
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -62,6 +62,337 @@ var __export = (target, all) => {
|
|
|
62
62
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
63
63
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
64
64
|
|
|
65
|
+
// ../../node_modules/minimal-polyfills/Map.js
|
|
66
|
+
var require_Map = __commonJS((exports) => {
|
|
67
|
+
exports.__esModule = true;
|
|
68
|
+
exports.Polyfill = exports.LightMapImpl = undefined;
|
|
69
|
+
var LightMapImpl = function() {
|
|
70
|
+
function LightMapImpl2() {
|
|
71
|
+
this.record = [];
|
|
72
|
+
}
|
|
73
|
+
LightMapImpl2.prototype.has = function(key) {
|
|
74
|
+
return this.record.map(function(_a) {
|
|
75
|
+
var _key = _a[0];
|
|
76
|
+
return _key;
|
|
77
|
+
}).indexOf(key) >= 0;
|
|
78
|
+
};
|
|
79
|
+
LightMapImpl2.prototype.get = function(key) {
|
|
80
|
+
var entry = this.record.filter(function(_a) {
|
|
81
|
+
var _key = _a[0];
|
|
82
|
+
return _key === key;
|
|
83
|
+
})[0];
|
|
84
|
+
if (entry === undefined) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
return entry[1];
|
|
88
|
+
};
|
|
89
|
+
LightMapImpl2.prototype.set = function(key, value2) {
|
|
90
|
+
var entry = this.record.filter(function(_a) {
|
|
91
|
+
var _key = _a[0];
|
|
92
|
+
return _key === key;
|
|
93
|
+
})[0];
|
|
94
|
+
if (entry === undefined) {
|
|
95
|
+
this.record.push([key, value2]);
|
|
96
|
+
} else {
|
|
97
|
+
entry[1] = value2;
|
|
98
|
+
}
|
|
99
|
+
return this;
|
|
100
|
+
};
|
|
101
|
+
LightMapImpl2.prototype["delete"] = function(key) {
|
|
102
|
+
var index = this.record.map(function(_a) {
|
|
103
|
+
var key2 = _a[0];
|
|
104
|
+
return key2;
|
|
105
|
+
}).indexOf(key);
|
|
106
|
+
if (index < 0) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
this.record.splice(index, 1);
|
|
110
|
+
return true;
|
|
111
|
+
};
|
|
112
|
+
LightMapImpl2.prototype.keys = function() {
|
|
113
|
+
return this.record.map(function(_a) {
|
|
114
|
+
var key = _a[0];
|
|
115
|
+
return key;
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
return LightMapImpl2;
|
|
119
|
+
}();
|
|
120
|
+
exports.LightMapImpl = LightMapImpl;
|
|
121
|
+
exports.Polyfill = typeof Map !== "undefined" ? Map : LightMapImpl;
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// ../../node_modules/minimal-polyfills/WeakMap.js
|
|
125
|
+
var require_WeakMap = __commonJS((exports) => {
|
|
126
|
+
exports.__esModule = true;
|
|
127
|
+
exports.Polyfill = undefined;
|
|
128
|
+
var Map_1 = require_Map();
|
|
129
|
+
exports.Polyfill = typeof WeakMap !== "undefined" ? WeakMap : Map_1.Polyfill;
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// ../../node_modules/run-exclusive/lib/runExclusive.js
|
|
133
|
+
var require_runExclusive = __commonJS((exports) => {
|
|
134
|
+
var __spreadArrays = exports && exports.__spreadArrays || function() {
|
|
135
|
+
for (var s = 0, i = 0, il = arguments.length;i < il; i++)
|
|
136
|
+
s += arguments[i].length;
|
|
137
|
+
for (var r = Array(s), k = 0, i = 0;i < il; i++)
|
|
138
|
+
for (var a = arguments[i], j = 0, jl = a.length;j < jl; j++, k++)
|
|
139
|
+
r[k] = a[j];
|
|
140
|
+
return r;
|
|
141
|
+
};
|
|
142
|
+
exports.__esModule = true;
|
|
143
|
+
exports.buildMethodCb = exports.buildCb = exports.getPrComplete = exports.isRunning = exports.cancelAllQueuedCalls = exports.getQueuedCallCount = exports.buildMethod = exports.build = exports.createGroupRef = undefined;
|
|
144
|
+
var WeakMap_1 = require_WeakMap();
|
|
145
|
+
var ExecQueue = function() {
|
|
146
|
+
function ExecQueue2() {
|
|
147
|
+
this.queuedCalls = [];
|
|
148
|
+
this.isRunning = false;
|
|
149
|
+
this.prComplete = Promise.resolve();
|
|
150
|
+
}
|
|
151
|
+
ExecQueue2.prototype.cancelAllQueuedCalls = function() {
|
|
152
|
+
var n;
|
|
153
|
+
this.queuedCalls.splice(0, n = this.queuedCalls.length);
|
|
154
|
+
return n;
|
|
155
|
+
};
|
|
156
|
+
return ExecQueue2;
|
|
157
|
+
}();
|
|
158
|
+
var globalContext = {};
|
|
159
|
+
var clusters = new WeakMap_1.Polyfill;
|
|
160
|
+
function getOrCreateExecQueue(context, groupRef) {
|
|
161
|
+
var execQueueByGroup = clusters.get(context);
|
|
162
|
+
if (!execQueueByGroup) {
|
|
163
|
+
execQueueByGroup = new WeakMap_1.Polyfill;
|
|
164
|
+
clusters.set(context, execQueueByGroup);
|
|
165
|
+
}
|
|
166
|
+
var execQueue = execQueueByGroup.get(groupRef);
|
|
167
|
+
if (!execQueue) {
|
|
168
|
+
execQueue = new ExecQueue;
|
|
169
|
+
execQueueByGroup.set(groupRef, execQueue);
|
|
170
|
+
}
|
|
171
|
+
return execQueue;
|
|
172
|
+
}
|
|
173
|
+
function createGroupRef() {
|
|
174
|
+
return new Array(0);
|
|
175
|
+
}
|
|
176
|
+
exports.createGroupRef = createGroupRef;
|
|
177
|
+
function build() {
|
|
178
|
+
var inputs = [];
|
|
179
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
180
|
+
inputs[_i] = arguments[_i];
|
|
181
|
+
}
|
|
182
|
+
switch (inputs.length) {
|
|
183
|
+
case 1:
|
|
184
|
+
return buildFnPromise(true, createGroupRef(), inputs[0]);
|
|
185
|
+
case 2:
|
|
186
|
+
return buildFnPromise(true, inputs[0], inputs[1]);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.build = build;
|
|
190
|
+
function buildMethod() {
|
|
191
|
+
var inputs = [];
|
|
192
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
193
|
+
inputs[_i] = arguments[_i];
|
|
194
|
+
}
|
|
195
|
+
switch (inputs.length) {
|
|
196
|
+
case 1:
|
|
197
|
+
return buildFnPromise(false, createGroupRef(), inputs[0]);
|
|
198
|
+
case 2:
|
|
199
|
+
return buildFnPromise(false, inputs[0], inputs[1]);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
exports.buildMethod = buildMethod;
|
|
203
|
+
function getQueuedCallCount(runExclusiveFunction, classInstanceObject) {
|
|
204
|
+
var execQueue = getExecQueueByFunctionAndContext(runExclusiveFunction, classInstanceObject);
|
|
205
|
+
return execQueue ? execQueue.queuedCalls.length : 0;
|
|
206
|
+
}
|
|
207
|
+
exports.getQueuedCallCount = getQueuedCallCount;
|
|
208
|
+
function cancelAllQueuedCalls(runExclusiveFunction, classInstanceObject) {
|
|
209
|
+
var execQueue = getExecQueueByFunctionAndContext(runExclusiveFunction, classInstanceObject);
|
|
210
|
+
return execQueue ? execQueue.cancelAllQueuedCalls() : 0;
|
|
211
|
+
}
|
|
212
|
+
exports.cancelAllQueuedCalls = cancelAllQueuedCalls;
|
|
213
|
+
function isRunning(runExclusiveFunction, classInstanceObject) {
|
|
214
|
+
var execQueue = getExecQueueByFunctionAndContext(runExclusiveFunction, classInstanceObject);
|
|
215
|
+
return execQueue ? execQueue.isRunning : false;
|
|
216
|
+
}
|
|
217
|
+
exports.isRunning = isRunning;
|
|
218
|
+
function getPrComplete(runExclusiveFunction, classInstanceObject) {
|
|
219
|
+
var execQueue = getExecQueueByFunctionAndContext(runExclusiveFunction, classInstanceObject);
|
|
220
|
+
return execQueue ? execQueue.prComplete : Promise.resolve();
|
|
221
|
+
}
|
|
222
|
+
exports.getPrComplete = getPrComplete;
|
|
223
|
+
var groupByRunExclusiveFunction = new WeakMap_1.Polyfill;
|
|
224
|
+
function getExecQueueByFunctionAndContext(runExclusiveFunction, context) {
|
|
225
|
+
if (context === undefined) {
|
|
226
|
+
context = globalContext;
|
|
227
|
+
}
|
|
228
|
+
var groupRef = groupByRunExclusiveFunction.get(runExclusiveFunction);
|
|
229
|
+
if (!groupRef) {
|
|
230
|
+
throw Error("Not a run exclusiveFunction");
|
|
231
|
+
}
|
|
232
|
+
var execQueueByGroup = clusters.get(context);
|
|
233
|
+
if (!execQueueByGroup) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
return execQueueByGroup.get(groupRef);
|
|
237
|
+
}
|
|
238
|
+
function buildFnPromise(isGlobal, groupRef, fun) {
|
|
239
|
+
var execQueue;
|
|
240
|
+
var runExclusiveFunction = function() {
|
|
241
|
+
var _this = this;
|
|
242
|
+
var inputs = [];
|
|
243
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
244
|
+
inputs[_i] = arguments[_i];
|
|
245
|
+
}
|
|
246
|
+
if (!isGlobal) {
|
|
247
|
+
if (!(this instanceof Object)) {
|
|
248
|
+
throw new Error("Run exclusive, <this> should be an object");
|
|
249
|
+
}
|
|
250
|
+
execQueue = getOrCreateExecQueue(this, groupRef);
|
|
251
|
+
}
|
|
252
|
+
return new Promise(function(resolve, reject) {
|
|
253
|
+
var onPrCompleteResolve;
|
|
254
|
+
execQueue.prComplete = new Promise(function(resolve2) {
|
|
255
|
+
return onPrCompleteResolve = function() {
|
|
256
|
+
return resolve2();
|
|
257
|
+
};
|
|
258
|
+
});
|
|
259
|
+
var onComplete = function(result2) {
|
|
260
|
+
onPrCompleteResolve();
|
|
261
|
+
execQueue.isRunning = false;
|
|
262
|
+
if (execQueue.queuedCalls.length) {
|
|
263
|
+
execQueue.queuedCalls.shift()();
|
|
264
|
+
}
|
|
265
|
+
if ("data" in result2) {
|
|
266
|
+
resolve(result2.data);
|
|
267
|
+
} else {
|
|
268
|
+
reject(result2.reason);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
(function callee() {
|
|
272
|
+
var _this2 = this;
|
|
273
|
+
var inputs2 = [];
|
|
274
|
+
for (var _i2 = 0;_i2 < arguments.length; _i2++) {
|
|
275
|
+
inputs2[_i2] = arguments[_i2];
|
|
276
|
+
}
|
|
277
|
+
if (execQueue.isRunning) {
|
|
278
|
+
execQueue.queuedCalls.push(function() {
|
|
279
|
+
return callee.apply(_this2, inputs2);
|
|
280
|
+
});
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
execQueue.isRunning = true;
|
|
284
|
+
try {
|
|
285
|
+
fun.apply(this, inputs2).then(function(data) {
|
|
286
|
+
return onComplete({ data });
|
|
287
|
+
})["catch"](function(reason) {
|
|
288
|
+
return onComplete({ reason });
|
|
289
|
+
});
|
|
290
|
+
} catch (error40) {
|
|
291
|
+
onComplete({ reason: error40 });
|
|
292
|
+
}
|
|
293
|
+
}).apply(_this, inputs);
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
if (isGlobal) {
|
|
297
|
+
execQueue = getOrCreateExecQueue(globalContext, groupRef);
|
|
298
|
+
}
|
|
299
|
+
groupByRunExclusiveFunction.set(runExclusiveFunction, groupRef);
|
|
300
|
+
return runExclusiveFunction;
|
|
301
|
+
}
|
|
302
|
+
function buildCb() {
|
|
303
|
+
var inputs = [];
|
|
304
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
305
|
+
inputs[_i] = arguments[_i];
|
|
306
|
+
}
|
|
307
|
+
switch (inputs.length) {
|
|
308
|
+
case 1:
|
|
309
|
+
return buildFnCallback(true, createGroupRef(), inputs[0]);
|
|
310
|
+
case 2:
|
|
311
|
+
return buildFnCallback(true, inputs[0], inputs[1]);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
exports.buildCb = buildCb;
|
|
315
|
+
function buildMethodCb() {
|
|
316
|
+
var inputs = [];
|
|
317
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
318
|
+
inputs[_i] = arguments[_i];
|
|
319
|
+
}
|
|
320
|
+
switch (inputs.length) {
|
|
321
|
+
case 1:
|
|
322
|
+
return buildFnCallback(false, createGroupRef(), inputs[0]);
|
|
323
|
+
case 2:
|
|
324
|
+
return buildFnCallback(false, inputs[0], inputs[1]);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
exports.buildMethodCb = buildMethodCb;
|
|
328
|
+
function buildFnCallback(isGlobal, groupRef, fun) {
|
|
329
|
+
var execQueue;
|
|
330
|
+
var runExclusiveFunction = function() {
|
|
331
|
+
var _this = this;
|
|
332
|
+
var inputs = [];
|
|
333
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
334
|
+
inputs[_i] = arguments[_i];
|
|
335
|
+
}
|
|
336
|
+
if (!isGlobal) {
|
|
337
|
+
if (!(this instanceof Object)) {
|
|
338
|
+
throw new Error("Run exclusive, <this> should be an object");
|
|
339
|
+
}
|
|
340
|
+
execQueue = getOrCreateExecQueue(this, groupRef);
|
|
341
|
+
}
|
|
342
|
+
var callback = undefined;
|
|
343
|
+
if (inputs.length && typeof inputs[inputs.length - 1] === "function") {
|
|
344
|
+
callback = inputs.pop();
|
|
345
|
+
}
|
|
346
|
+
var onPrCompleteResolve;
|
|
347
|
+
execQueue.prComplete = new Promise(function(resolve) {
|
|
348
|
+
return onPrCompleteResolve = function() {
|
|
349
|
+
return resolve();
|
|
350
|
+
};
|
|
351
|
+
});
|
|
352
|
+
var onComplete = function() {
|
|
353
|
+
var inputs2 = [];
|
|
354
|
+
for (var _i2 = 0;_i2 < arguments.length; _i2++) {
|
|
355
|
+
inputs2[_i2] = arguments[_i2];
|
|
356
|
+
}
|
|
357
|
+
onPrCompleteResolve();
|
|
358
|
+
execQueue.isRunning = false;
|
|
359
|
+
if (execQueue.queuedCalls.length) {
|
|
360
|
+
execQueue.queuedCalls.shift()();
|
|
361
|
+
}
|
|
362
|
+
if (callback) {
|
|
363
|
+
callback.apply(_this, inputs2);
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
onComplete.hasCallback = !!callback;
|
|
367
|
+
(function callee() {
|
|
368
|
+
var _this2 = this;
|
|
369
|
+
var inputs2 = [];
|
|
370
|
+
for (var _i2 = 0;_i2 < arguments.length; _i2++) {
|
|
371
|
+
inputs2[_i2] = arguments[_i2];
|
|
372
|
+
}
|
|
373
|
+
if (execQueue.isRunning) {
|
|
374
|
+
execQueue.queuedCalls.push(function() {
|
|
375
|
+
return callee.apply(_this2, inputs2);
|
|
376
|
+
});
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
execQueue.isRunning = true;
|
|
380
|
+
try {
|
|
381
|
+
fun.apply(this, __spreadArrays(inputs2, [onComplete]));
|
|
382
|
+
} catch (error40) {
|
|
383
|
+
error40.message += " ( This exception should not have been thrown, miss use of run-exclusive buildCb )";
|
|
384
|
+
throw error40;
|
|
385
|
+
}
|
|
386
|
+
}).apply(this, inputs);
|
|
387
|
+
};
|
|
388
|
+
if (isGlobal) {
|
|
389
|
+
execQueue = getOrCreateExecQueue(globalContext, groupRef);
|
|
390
|
+
}
|
|
391
|
+
groupByRunExclusiveFunction.set(runExclusiveFunction, groupRef);
|
|
392
|
+
return runExclusiveFunction;
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
|
|
65
396
|
// ../../node_modules/node-machine-id/dist/index.js
|
|
66
397
|
var require_dist = __commonJS((exports, module) => {
|
|
67
398
|
(function(t2, n2) {
|
|
@@ -74201,10 +74532,10 @@ var init_debug_info = __esm(() => {
|
|
|
74201
74532
|
MutableDebugInfo = exports_Schema2.mutable(DebugInfo);
|
|
74202
74533
|
});
|
|
74203
74534
|
|
|
74204
|
-
// ../../node_modules
|
|
74535
|
+
// ../../node_modules/nanoid/url-alphabet/index.js
|
|
74205
74536
|
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
74206
74537
|
|
|
74207
|
-
// ../../node_modules
|
|
74538
|
+
// ../../node_modules/nanoid/index.js
|
|
74208
74539
|
import { webcrypto as crypto4 } from "node:crypto";
|
|
74209
74540
|
function fillPool(bytes) {
|
|
74210
74541
|
if (!pool || pool.length < bytes) {
|
|
@@ -270967,7 +271298,7 @@ var require_document = __commonJS((exports, module) => {
|
|
|
270967
271298
|
Document.default = Document;
|
|
270968
271299
|
});
|
|
270969
271300
|
|
|
270970
|
-
// ../../node_modules/nanoid/non-secure/index.cjs
|
|
271301
|
+
// ../../node_modules/postcss/node_modules/nanoid/non-secure/index.cjs
|
|
270971
271302
|
var require_non_secure = __commonJS((exports, module) => {
|
|
270972
271303
|
var urlAlphabet2 = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
270973
271304
|
var customAlphabet = (alphabet, defaultSize = 21) => {
|
|
@@ -327368,6 +327699,9 @@ var ModelOptions = v4_default.object({
|
|
|
327368
327699
|
contextWindow: v4_default.number().optional(),
|
|
327369
327700
|
useToolCallMiddleware: v4_default.boolean().optional()
|
|
327370
327701
|
});
|
|
327702
|
+
// ../common/src/vendor/base.ts
|
|
327703
|
+
var runExclusive = __toESM(require_runExclusive(), 1);
|
|
327704
|
+
|
|
327371
327705
|
// ../common/src/configuration/config-manager.ts
|
|
327372
327706
|
import * as fs from "node:fs";
|
|
327373
327707
|
import * as fsPromise from "node:fs/promises";
|
|
@@ -345085,17 +345419,17 @@ class VendorBase {
|
|
|
345085
345419
|
constructor(vendorId) {
|
|
345086
345420
|
this.vendorId = vendorId;
|
|
345087
345421
|
}
|
|
345088
|
-
getCredentials = async () => {
|
|
345422
|
+
getCredentials = runExclusive.buildMethod(async () => {
|
|
345089
345423
|
const { credentials } = this.getVendorConfig();
|
|
345090
345424
|
const newCredentials = await this.renewCredentials(credentials);
|
|
345091
345425
|
if (credentials !== newCredentials) {
|
|
345092
|
-
updateVendorConfig(this.vendorId, {
|
|
345426
|
+
await updateVendorConfig(this.vendorId, {
|
|
345093
345427
|
credentials: newCredentials
|
|
345094
345428
|
});
|
|
345095
345429
|
}
|
|
345096
345430
|
return newCredentials;
|
|
345097
|
-
};
|
|
345098
|
-
async
|
|
345431
|
+
});
|
|
345432
|
+
getUserInfo = runExclusive.buildMethod(async () => {
|
|
345099
345433
|
const { user } = this.getVendorConfig();
|
|
345100
345434
|
if (user)
|
|
345101
345435
|
return user;
|
|
@@ -345106,7 +345440,7 @@ class VendorBase {
|
|
|
345106
345440
|
credentials
|
|
345107
345441
|
});
|
|
345108
345442
|
return newUser;
|
|
345109
|
-
}
|
|
345443
|
+
});
|
|
345110
345444
|
logout() {
|
|
345111
345445
|
return updateVendorConfig(this.vendorId, null);
|
|
345112
345446
|
}
|
|
@@ -346898,7 +347232,7 @@ var buildCustomFetchImpl = () => {
|
|
|
346898
347232
|
var authClient = createAuthClient2();
|
|
346899
347233
|
function isJWTExpiring(jwt2) {
|
|
346900
347234
|
const { exp } = decodeJwt(jwt2);
|
|
346901
|
-
return exp ? Date.now() >= (exp -
|
|
347235
|
+
return exp ? Date.now() >= (exp - 5 * 60) * 1000 : true;
|
|
346902
347236
|
}
|
|
346903
347237
|
|
|
346904
347238
|
// ../vendor-pochi/src/node.ts
|
|
@@ -351974,7 +352308,7 @@ var {
|
|
|
351974
352308
|
// package.json
|
|
351975
352309
|
var package_default = {
|
|
351976
352310
|
name: "@getpochi/cli",
|
|
351977
|
-
version: "0.5.
|
|
352311
|
+
version: "0.5.23",
|
|
351978
352312
|
type: "module",
|
|
351979
352313
|
bin: {
|
|
351980
352314
|
pochi: "src/cli.ts"
|
|
@@ -352000,6 +352334,7 @@ var package_default = {
|
|
|
352000
352334
|
"@getpochi/vendor-pochi": "workspace:*",
|
|
352001
352335
|
"@livestore/adapter-node": "catalog:",
|
|
352002
352336
|
"@livestore/livestore": "catalog:",
|
|
352337
|
+
"@livestore/utils": "catalog:",
|
|
352003
352338
|
"@livestore/wa-sqlite": "catalog:",
|
|
352004
352339
|
"@livestore/sync-cf": "catalog:",
|
|
352005
352340
|
"@preact/signals-core": "^1.6.2",
|
|
@@ -386962,7 +387297,7 @@ ${followUpText}`,
|
|
|
386962
387297
|
if (part.type === "tool-attemptCompletion") {
|
|
386963
387298
|
const { result: result2 = "" } = part.input || {};
|
|
386964
387299
|
const text12 = `${source_default2.bold(source_default2.green("\uD83C\uDF89 Task Completed"))}
|
|
386965
|
-
${
|
|
387300
|
+
${result2}`;
|
|
386966
387301
|
return {
|
|
386967
387302
|
text: text12,
|
|
386968
387303
|
stop: "stopAndPersist",
|
|
@@ -387064,6 +387399,9 @@ function renderSubtaskMessages(messages2) {
|
|
|
387064
387399
|
return output2;
|
|
387065
387400
|
}
|
|
387066
387401
|
|
|
387402
|
+
// src/task/cmd.ts
|
|
387403
|
+
init_effect();
|
|
387404
|
+
|
|
387067
387405
|
// src/livekit/store.ts
|
|
387068
387406
|
import os10 from "node:os";
|
|
387069
387407
|
import path21 from "node:path";
|
|
@@ -387099,7 +387437,67 @@ async function getPochiCredentials3() {
|
|
|
387099
387437
|
const credentials = await pochi.getCredentials().catch(() => null);
|
|
387100
387438
|
return credentials;
|
|
387101
387439
|
}
|
|
387440
|
+
// src/livekit/chat.node.ts
|
|
387441
|
+
class NodeChatState {
|
|
387442
|
+
signal = {
|
|
387443
|
+
status: d("ready"),
|
|
387444
|
+
error: d(undefined),
|
|
387445
|
+
messages: d([])
|
|
387446
|
+
};
|
|
387447
|
+
get status() {
|
|
387448
|
+
return this.signal.status.value;
|
|
387449
|
+
}
|
|
387450
|
+
set status(chatStatus) {
|
|
387451
|
+
this.signal.status.value = chatStatus;
|
|
387452
|
+
}
|
|
387453
|
+
get error() {
|
|
387454
|
+
return this.signal.error.value;
|
|
387455
|
+
}
|
|
387456
|
+
set error(error44) {
|
|
387457
|
+
this.signal.error.value = error44;
|
|
387458
|
+
}
|
|
387459
|
+
get messages() {
|
|
387460
|
+
return this.signal.messages.value;
|
|
387461
|
+
}
|
|
387462
|
+
set messages(messages2) {
|
|
387463
|
+
this.signal.messages.value = messages2;
|
|
387464
|
+
}
|
|
387465
|
+
constructor(initialMessages = []) {
|
|
387466
|
+
this.messages = initialMessages;
|
|
387467
|
+
}
|
|
387468
|
+
pushMessage = (message) => {
|
|
387469
|
+
this.messages = this.messages.concat(message);
|
|
387470
|
+
};
|
|
387471
|
+
popMessage = () => {
|
|
387472
|
+
this.messages = this.messages.slice(0, -1);
|
|
387473
|
+
};
|
|
387474
|
+
replaceMessage = (index3, message) => {
|
|
387475
|
+
this.messages = [
|
|
387476
|
+
...this.messages.slice(0, index3),
|
|
387477
|
+
this.snapshot(message),
|
|
387478
|
+
...this.messages.slice(index3 + 1)
|
|
387479
|
+
];
|
|
387480
|
+
};
|
|
387481
|
+
snapshot = (value9) => structuredClone(value9);
|
|
387482
|
+
}
|
|
387102
387483
|
|
|
387484
|
+
class Chat extends AbstractChat {
|
|
387485
|
+
constructor({ messages: messages2, ...init4 }) {
|
|
387486
|
+
const state2 = new NodeChatState(messages2);
|
|
387487
|
+
super({ ...init4, state: state2 });
|
|
387488
|
+
}
|
|
387489
|
+
appendOrReplaceMessage(message) {
|
|
387490
|
+
const index3 = this.state.messages.findIndex((m13) => m13.id === message.id);
|
|
387491
|
+
if (index3 === -1) {
|
|
387492
|
+
this.state.pushMessage(message);
|
|
387493
|
+
} else {
|
|
387494
|
+
this.state.replaceMessage(index3, message);
|
|
387495
|
+
}
|
|
387496
|
+
}
|
|
387497
|
+
getState() {
|
|
387498
|
+
return this.state;
|
|
387499
|
+
}
|
|
387500
|
+
}
|
|
387103
387501
|
// src/task/list.ts
|
|
387104
387502
|
function registerTaskListCommand(taskCommand) {
|
|
387105
387503
|
taskCommand.command("list", { isDefault: true }).description("List all recent tasks, showing their status and IDs.").option("-n, --limit <number>", "The maximum number of tasks to display.", "10").action(async (options4) => {
|
|
@@ -387204,10 +387602,24 @@ function registerTaskShareCommand(taskCommand) {
|
|
|
387204
387602
|
// src/task/cmd.ts
|
|
387205
387603
|
function registerTaskCommand(program5) {
|
|
387206
387604
|
const taskCommand = program5.command("task").description("Manage and interact with tasks.").addHelpCommand(true);
|
|
387605
|
+
taskCommand.hook("preAction", waitForSync);
|
|
387207
387606
|
registerTaskListCommand(taskCommand);
|
|
387208
387607
|
registerTaskShareCommand(taskCommand);
|
|
387209
387608
|
return taskCommand;
|
|
387210
387609
|
}
|
|
387610
|
+
async function waitForSync() {
|
|
387611
|
+
const store = await createStore4(process.cwd());
|
|
387612
|
+
await exports_Effect2.gen(function* (_8) {
|
|
387613
|
+
while (true) {
|
|
387614
|
+
const nextChange = store.syncProcessor.syncState.changes.pipe(exports_Stream2.take(1), exports_Stream2.runCollect, exports_Effect2.as(false));
|
|
387615
|
+
const timeout5 = exports_Effect2.sleep("1 second").pipe(exports_Effect2.as(true));
|
|
387616
|
+
if (yield* exports_Effect2.raceFirst(nextChange, timeout5)) {
|
|
387617
|
+
break;
|
|
387618
|
+
}
|
|
387619
|
+
}
|
|
387620
|
+
}).pipe(exports_Effect2.runPromise);
|
|
387621
|
+
await store.shutdown();
|
|
387622
|
+
}
|
|
387211
387623
|
// ../livekit/src/task.ts
|
|
387212
387624
|
function toTaskStatus(message, finishReason) {
|
|
387213
387625
|
let lastStepStart = -1;
|
|
@@ -389860,67 +390272,7 @@ class StepCount {
|
|
|
389860
390272
|
return stepToString(this);
|
|
389861
390273
|
}
|
|
389862
390274
|
}
|
|
389863
|
-
// src/livekit/chat.node.ts
|
|
389864
|
-
class NodeChatState {
|
|
389865
|
-
signal = {
|
|
389866
|
-
status: d("ready"),
|
|
389867
|
-
error: d(undefined),
|
|
389868
|
-
messages: d([])
|
|
389869
|
-
};
|
|
389870
|
-
get status() {
|
|
389871
|
-
return this.signal.status.value;
|
|
389872
|
-
}
|
|
389873
|
-
set status(chatStatus) {
|
|
389874
|
-
this.signal.status.value = chatStatus;
|
|
389875
|
-
}
|
|
389876
|
-
get error() {
|
|
389877
|
-
return this.signal.error.value;
|
|
389878
|
-
}
|
|
389879
|
-
set error(error44) {
|
|
389880
|
-
this.signal.error.value = error44;
|
|
389881
|
-
}
|
|
389882
|
-
get messages() {
|
|
389883
|
-
return this.signal.messages.value;
|
|
389884
|
-
}
|
|
389885
|
-
set messages(messages2) {
|
|
389886
|
-
this.signal.messages.value = messages2;
|
|
389887
|
-
}
|
|
389888
|
-
constructor(initialMessages = []) {
|
|
389889
|
-
this.messages = initialMessages;
|
|
389890
|
-
}
|
|
389891
|
-
pushMessage = (message) => {
|
|
389892
|
-
this.messages = this.messages.concat(message);
|
|
389893
|
-
};
|
|
389894
|
-
popMessage = () => {
|
|
389895
|
-
this.messages = this.messages.slice(0, -1);
|
|
389896
|
-
};
|
|
389897
|
-
replaceMessage = (index3, message) => {
|
|
389898
|
-
this.messages = [
|
|
389899
|
-
...this.messages.slice(0, index3),
|
|
389900
|
-
this.snapshot(message),
|
|
389901
|
-
...this.messages.slice(index3 + 1)
|
|
389902
|
-
];
|
|
389903
|
-
};
|
|
389904
|
-
snapshot = (value9) => structuredClone(value9);
|
|
389905
|
-
}
|
|
389906
390275
|
|
|
389907
|
-
class Chat extends AbstractChat {
|
|
389908
|
-
constructor({ messages: messages2, ...init4 }) {
|
|
389909
|
-
const state2 = new NodeChatState(messages2);
|
|
389910
|
-
super({ ...init4, state: state2 });
|
|
389911
|
-
}
|
|
389912
|
-
appendOrReplaceMessage(message) {
|
|
389913
|
-
const index3 = this.state.messages.findIndex((m13) => m13.id === message.id);
|
|
389914
|
-
if (index3 === -1) {
|
|
389915
|
-
this.state.pushMessage(message);
|
|
389916
|
-
} else {
|
|
389917
|
-
this.state.replaceMessage(index3, message);
|
|
389918
|
-
}
|
|
389919
|
-
}
|
|
389920
|
-
getState() {
|
|
389921
|
-
return this.state;
|
|
389922
|
-
}
|
|
389923
|
-
}
|
|
389924
390276
|
// src/tools/apply-diff.ts
|
|
389925
390277
|
import * as fs11 from "node:fs/promises";
|
|
389926
390278
|
import * as nodePath from "node:path";
|
|
@@ -390596,7 +390948,7 @@ function toError2(e11) {
|
|
|
390596
390948
|
// package.json
|
|
390597
390949
|
var package_default2 = {
|
|
390598
390950
|
name: "@getpochi/cli",
|
|
390599
|
-
version: "0.5.
|
|
390951
|
+
version: "0.5.23",
|
|
390600
390952
|
type: "module",
|
|
390601
390953
|
bin: {
|
|
390602
390954
|
pochi: "src/cli.ts"
|
|
@@ -390622,6 +390974,7 @@ var package_default2 = {
|
|
|
390622
390974
|
"@getpochi/vendor-pochi": "workspace:*",
|
|
390623
390975
|
"@livestore/adapter-node": "catalog:",
|
|
390624
390976
|
"@livestore/livestore": "catalog:",
|
|
390977
|
+
"@livestore/utils": "catalog:",
|
|
390625
390978
|
"@livestore/wa-sqlite": "catalog:",
|
|
390626
390979
|
"@livestore/sync-cf": "catalog:",
|
|
390627
390980
|
"@preact/signals-core": "^1.6.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpochi/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pochi": "src/cli.ts"
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@getpochi/vendor-pochi": "0.0.1",
|
|
27
27
|
"@livestore/adapter-node": "0.4.0-dev.7",
|
|
28
28
|
"@livestore/livestore": "0.4.0-dev.7",
|
|
29
|
+
"@livestore/utils": "0.4.0-dev.7",
|
|
29
30
|
"@livestore/wa-sqlite": "0.4.0-dev.7",
|
|
30
31
|
"@livestore/sync-cf": "0.4.0-dev.7",
|
|
31
32
|
"@preact/signals-core": "^1.6.2",
|