@threadbase-sh/streamer 1.15.0 → 1.15.1
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/README.md +15 -1
- package/dist/cli.cjs +81 -74
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +32 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +32 -26
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -4,7 +4,21 @@ PTY session management, WebSocket streaming, and REST API server for Claude Code
|
|
|
4
4
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
7
|
-
### Install via
|
|
7
|
+
### Install via npm (recommended)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @threadbase-sh/streamer
|
|
11
|
+
|
|
12
|
+
# One-time setup:
|
|
13
|
+
tb-streamer set-key <YOUR_API_KEY>
|
|
14
|
+
|
|
15
|
+
# Start the server:
|
|
16
|
+
tb-streamer serve
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This installs the `tb-streamer` (and `threadbase-streamer`) CLI globally. Only `node-pty` compiles on install; everything else ships prebuilt. Optional automatic updates: see [docs/guides/auto-update.md](docs/guides/auto-update.md).
|
|
20
|
+
|
|
21
|
+
### Install via Homebrew (macOS + Linux)
|
|
8
22
|
|
|
9
23
|
```bash
|
|
10
24
|
brew tap RonenMars/threadbase
|
package/dist/cli.cjs
CHANGED
|
@@ -37792,9 +37792,9 @@ var require_failure = __commonJS({
|
|
|
37792
37792
|
}
|
|
37793
37793
|
});
|
|
37794
37794
|
|
|
37795
|
-
// node_modules
|
|
37795
|
+
// node_modules/ms/dist/index.cjs
|
|
37796
37796
|
var require_dist2 = __commonJS({
|
|
37797
|
-
"node_modules
|
|
37797
|
+
"node_modules/ms/dist/index.cjs"(exports2, module2) {
|
|
37798
37798
|
"use strict";
|
|
37799
37799
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
37800
37800
|
var s3 = 1e3;
|
|
@@ -44936,26 +44936,6 @@ var require_float3 = __commonJS({
|
|
|
44936
44936
|
}
|
|
44937
44937
|
});
|
|
44938
44938
|
|
|
44939
|
-
// node_modules/@protobufjs/inquire/index.js
|
|
44940
|
-
var require_inquire = __commonJS({
|
|
44941
|
-
"node_modules/@protobufjs/inquire/index.js"(exports2, module2) {
|
|
44942
|
-
"use strict";
|
|
44943
|
-
module2.exports = inquire;
|
|
44944
|
-
function inquire(moduleName) {
|
|
44945
|
-
try {
|
|
44946
|
-
if (typeof require !== "function") {
|
|
44947
|
-
return null;
|
|
44948
|
-
}
|
|
44949
|
-
var mod = require(moduleName);
|
|
44950
|
-
if (mod && (mod.length || Object.keys(mod).length)) return mod;
|
|
44951
|
-
return null;
|
|
44952
|
-
} catch (err) {
|
|
44953
|
-
return null;
|
|
44954
|
-
}
|
|
44955
|
-
}
|
|
44956
|
-
}
|
|
44957
|
-
});
|
|
44958
|
-
|
|
44959
44939
|
// node_modules/@protobufjs/utf8/index.js
|
|
44960
44940
|
var require_utf8 = __commonJS({
|
|
44961
44941
|
"node_modules/@protobufjs/utf8/index.js"(exports2) {
|
|
@@ -45170,7 +45150,6 @@ var require_minimal = __commonJS({
|
|
|
45170
45150
|
util.base64 = require_base64();
|
|
45171
45151
|
util.EventEmitter = require_eventemitter();
|
|
45172
45152
|
util.float = require_float3();
|
|
45173
|
-
util.inquire = require_inquire();
|
|
45174
45153
|
util.utf8 = require_utf8();
|
|
45175
45154
|
util.pool = require_pool();
|
|
45176
45155
|
util.LongBits = require_longbits();
|
|
@@ -45206,7 +45185,7 @@ var require_minimal = __commonJS({
|
|
|
45206
45185
|
*/
|
|
45207
45186
|
util.isSet = function isSet(obj, prop) {
|
|
45208
45187
|
var value = obj[prop];
|
|
45209
|
-
if (value != null &&
|
|
45188
|
+
if (value != null && Object.hasOwnProperty.call(obj, prop))
|
|
45210
45189
|
return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
|
|
45211
45190
|
return false;
|
|
45212
45191
|
};
|
|
@@ -46608,7 +46587,6 @@ var require_service3 = __commonJS({
|
|
|
46608
46587
|
var Method = require_method();
|
|
46609
46588
|
var util = require_util();
|
|
46610
46589
|
var rpc = require_rpc();
|
|
46611
|
-
var reservedRe = util.patterns.reservedRe;
|
|
46612
46590
|
function Service(name, options) {
|
|
46613
46591
|
Namespace.call(this, name, options);
|
|
46614
46592
|
this.methods = {};
|
|
@@ -46701,11 +46679,11 @@ var require_service3 = __commonJS({
|
|
|
46701
46679
|
for (var i = 0, method; i < /* initializes */
|
|
46702
46680
|
this.methodsArray.length; ++i) {
|
|
46703
46681
|
var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
|
|
46704
|
-
rpcService[methodName] =
|
|
46705
|
-
|
|
46706
|
-
|
|
46707
|
-
|
|
46708
|
-
});
|
|
46682
|
+
rpcService[methodName] = /* @__PURE__ */ (function(method2, requestType, responseType) {
|
|
46683
|
+
return function rpcMethod(request, callback) {
|
|
46684
|
+
return rpc.Service.prototype.rpcCall.call(this, method2, requestType, responseType, request, callback);
|
|
46685
|
+
};
|
|
46686
|
+
})(method, method.resolvedRequestType.ctor, method.resolvedResponseType.ctor);
|
|
46709
46687
|
}
|
|
46710
46688
|
return rpcService;
|
|
46711
46689
|
};
|
|
@@ -46804,7 +46782,7 @@ var require_decoder = __commonJS({
|
|
|
46804
46782
|
gen("default:")("r.skipType(t&7,n)")("break")("}")("}");
|
|
46805
46783
|
for (i = 0; i < mtype._fieldsArray.length; ++i) {
|
|
46806
46784
|
var rfield = mtype._fieldsArray[i];
|
|
46807
|
-
if (rfield.required) gen("if(!
|
|
46785
|
+
if (rfield.required) gen("if(!Object.hasOwnProperty.call(m,%j))", rfield.name)("throw util.ProtocolError(%j,{instance:m})", missing(rfield));
|
|
46808
46786
|
}
|
|
46809
46787
|
return gen("return m");
|
|
46810
46788
|
}
|
|
@@ -46892,7 +46870,7 @@ var require_verifier = __commonJS({
|
|
|
46892
46870
|
for (var i = 0; i < /* initializes */
|
|
46893
46871
|
mtype.fieldsArray.length; ++i) {
|
|
46894
46872
|
var field = mtype._fieldsArray[i].resolve(), ref = "m" + util.safeProp(field.name);
|
|
46895
|
-
if (field.optional) gen("if(%s!=null&&
|
|
46873
|
+
if (field.optional) gen("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name);
|
|
46896
46874
|
if (field.map) {
|
|
46897
46875
|
gen("if(!util.isObject(%s))", ref)("return%j", invalid(field, "object"))("var k=Object.keys(%s)", ref)("for(var i=0;i<k.length;++i){");
|
|
46898
46876
|
genVerifyKey(gen, field, "k[i]");
|
|
@@ -46978,8 +46956,9 @@ var require_converter = __commonJS({
|
|
|
46978
46956
|
}
|
|
46979
46957
|
converter.fromObject = function fromObject(mtype) {
|
|
46980
46958
|
var fields = mtype.fieldsArray;
|
|
46981
|
-
var gen = util.codegen(["d", "n"], mtype.name + "$fromObject")("if(d instanceof this.ctor)")("return d")
|
|
46959
|
+
var gen = util.codegen(["d", "n"], mtype.name + "$fromObject")("if(d instanceof this.ctor)")("return d");
|
|
46982
46960
|
if (!fields.length) return gen("return new this.ctor");
|
|
46961
|
+
gen("if(!util.isObject(d))")("throw TypeError(%j)", mtype.fullName + ": object expected")("if(n===undefined)n=0")("if(n>util.recursionLimit)")('throw Error("maximum nesting depth exceeded")');
|
|
46983
46962
|
gen("var m=new this.ctor");
|
|
46984
46963
|
for (var i = 0; i < fields.length; ++i) {
|
|
46985
46964
|
var field = fields[i].resolve(), prop = util.safeProp(field.name);
|
|
@@ -47105,7 +47084,7 @@ var require_converter = __commonJS({
|
|
|
47105
47084
|
prop + "[j]"
|
|
47106
47085
|
)("}");
|
|
47107
47086
|
} else {
|
|
47108
|
-
gen("if(m%s!=null&&
|
|
47087
|
+
gen("if(m%s!=null&&Object.hasOwnProperty.call(m,%j)){", prop, field.name);
|
|
47109
47088
|
genValuePartial_toObject(
|
|
47110
47089
|
gen,
|
|
47111
47090
|
field,
|
|
@@ -47411,7 +47390,7 @@ var require_type = __commonJS({
|
|
|
47411
47390
|
throw Error("duplicate id " + object2.id + " in " + this);
|
|
47412
47391
|
if (this.isReservedId(object2.id))
|
|
47413
47392
|
throw Error("id " + object2.id + " is reserved in " + this);
|
|
47414
|
-
if (this.isReservedName(object2.name))
|
|
47393
|
+
if (this.isReservedName(object2.name) || object2.name.charAt(0) === "$")
|
|
47415
47394
|
throw Error("name '" + object2.name + "' is reserved in " + this);
|
|
47416
47395
|
if (object2.name === "__proto__")
|
|
47417
47396
|
return this;
|
|
@@ -47423,6 +47402,8 @@ var require_type = __commonJS({
|
|
|
47423
47402
|
return clearCache(this);
|
|
47424
47403
|
}
|
|
47425
47404
|
if (object2 instanceof OneOf) {
|
|
47405
|
+
if (object2.name.charAt(0) === "$")
|
|
47406
|
+
throw Error("name '" + object2.name + "' is reserved in " + this);
|
|
47426
47407
|
if (object2.name === "__proto__")
|
|
47427
47408
|
return this;
|
|
47428
47409
|
if (!this.oneofs)
|
|
@@ -63836,6 +63817,26 @@ var require_pkg = __commonJS({
|
|
|
63836
63817
|
}
|
|
63837
63818
|
});
|
|
63838
63819
|
|
|
63820
|
+
// node_modules/@protobufjs/inquire/index.js
|
|
63821
|
+
var require_inquire = __commonJS({
|
|
63822
|
+
"node_modules/@protobufjs/inquire/index.js"(exports2, module2) {
|
|
63823
|
+
"use strict";
|
|
63824
|
+
module2.exports = inquire;
|
|
63825
|
+
function inquire(moduleName) {
|
|
63826
|
+
try {
|
|
63827
|
+
if (typeof require !== "function") {
|
|
63828
|
+
return null;
|
|
63829
|
+
}
|
|
63830
|
+
var mod = require(moduleName);
|
|
63831
|
+
if (mod && (mod.length || Object.keys(mod).length)) return mod;
|
|
63832
|
+
return null;
|
|
63833
|
+
} catch (err) {
|
|
63834
|
+
return null;
|
|
63835
|
+
}
|
|
63836
|
+
}
|
|
63837
|
+
}
|
|
63838
|
+
});
|
|
63839
|
+
|
|
63839
63840
|
// node_modules/@temporalio/proto/node_modules/protobufjs/src/util/longbits.js
|
|
63840
63841
|
var require_longbits2 = __commonJS({
|
|
63841
63842
|
"node_modules/@temporalio/proto/node_modules/protobufjs/src/util/longbits.js"(exports2, module2) {
|
|
@@ -101853,9 +101854,9 @@ var require_braces = __commonJS({
|
|
|
101853
101854
|
}
|
|
101854
101855
|
});
|
|
101855
101856
|
|
|
101856
|
-
// node_modules/
|
|
101857
|
+
// node_modules/picomatch/lib/constants.js
|
|
101857
101858
|
var require_constants5 = __commonJS({
|
|
101858
|
-
"node_modules/
|
|
101859
|
+
"node_modules/picomatch/lib/constants.js"(exports2, module2) {
|
|
101859
101860
|
"use strict";
|
|
101860
101861
|
var path = require("path");
|
|
101861
101862
|
var WIN_SLASH = "\\\\/";
|
|
@@ -102054,9 +102055,9 @@ var require_constants5 = __commonJS({
|
|
|
102054
102055
|
}
|
|
102055
102056
|
});
|
|
102056
102057
|
|
|
102057
|
-
// node_modules/
|
|
102058
|
+
// node_modules/picomatch/lib/utils.js
|
|
102058
102059
|
var require_utils2 = __commonJS({
|
|
102059
|
-
"node_modules/
|
|
102060
|
+
"node_modules/picomatch/lib/utils.js"(exports2) {
|
|
102060
102061
|
"use strict";
|
|
102061
102062
|
var path = require("path");
|
|
102062
102063
|
var win32 = process.platform === "win32";
|
|
@@ -102115,9 +102116,9 @@ var require_utils2 = __commonJS({
|
|
|
102115
102116
|
}
|
|
102116
102117
|
});
|
|
102117
102118
|
|
|
102118
|
-
// node_modules/
|
|
102119
|
+
// node_modules/picomatch/lib/scan.js
|
|
102119
102120
|
var require_scan = __commonJS({
|
|
102120
|
-
"node_modules/
|
|
102121
|
+
"node_modules/picomatch/lib/scan.js"(exports2, module2) {
|
|
102121
102122
|
"use strict";
|
|
102122
102123
|
var utils = require_utils2();
|
|
102123
102124
|
var {
|
|
@@ -102445,9 +102446,9 @@ var require_scan = __commonJS({
|
|
|
102445
102446
|
}
|
|
102446
102447
|
});
|
|
102447
102448
|
|
|
102448
|
-
// node_modules/
|
|
102449
|
+
// node_modules/picomatch/lib/parse.js
|
|
102449
102450
|
var require_parse4 = __commonJS({
|
|
102450
|
-
"node_modules/
|
|
102451
|
+
"node_modules/picomatch/lib/parse.js"(exports2, module2) {
|
|
102451
102452
|
"use strict";
|
|
102452
102453
|
var constants = require_constants5();
|
|
102453
102454
|
var utils = require_utils2();
|
|
@@ -103447,9 +103448,9 @@ var require_parse4 = __commonJS({
|
|
|
103447
103448
|
}
|
|
103448
103449
|
});
|
|
103449
103450
|
|
|
103450
|
-
// node_modules/
|
|
103451
|
+
// node_modules/picomatch/lib/picomatch.js
|
|
103451
103452
|
var require_picomatch = __commonJS({
|
|
103452
|
-
"node_modules/
|
|
103453
|
+
"node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
|
|
103453
103454
|
"use strict";
|
|
103454
103455
|
var path = require("path");
|
|
103455
103456
|
var scan = require_scan();
|
|
@@ -103588,9 +103589,9 @@ var require_picomatch = __commonJS({
|
|
|
103588
103589
|
}
|
|
103589
103590
|
});
|
|
103590
103591
|
|
|
103591
|
-
// node_modules/
|
|
103592
|
+
// node_modules/picomatch/index.js
|
|
103592
103593
|
var require_picomatch2 = __commonJS({
|
|
103593
|
-
"node_modules/
|
|
103594
|
+
"node_modules/picomatch/index.js"(exports2, module2) {
|
|
103594
103595
|
"use strict";
|
|
103595
103596
|
module2.exports = require_picomatch();
|
|
103596
103597
|
}
|
|
@@ -139059,28 +139060,37 @@ var StreamerServer = class {
|
|
|
139059
139060
|
projectName: body.projectName,
|
|
139060
139061
|
branch: body.branch
|
|
139061
139062
|
});
|
|
139062
|
-
|
|
139063
|
-
|
|
139064
|
-
|
|
139065
|
-
|
|
139066
|
-
|
|
139067
|
-
|
|
139068
|
-
|
|
139069
|
-
|
|
139070
|
-
|
|
139071
|
-
|
|
139072
|
-
|
|
139073
|
-
|
|
139074
|
-
session.
|
|
139075
|
-
session.
|
|
139076
|
-
|
|
139077
|
-
|
|
139078
|
-
|
|
139079
|
-
|
|
139080
|
-
const
|
|
139081
|
-
if (
|
|
139082
|
-
|
|
139083
|
-
|
|
139063
|
+
this.sessionStore.addManaged(session);
|
|
139064
|
+
void this.watchConversationFile(sessionId);
|
|
139065
|
+
const resp = this.sessionStore.get(session.id, this.ptyAttachedIds());
|
|
139066
|
+
this.broadcastOrUnicastSessionList(req);
|
|
139067
|
+
json2(res, 201, resp ?? session);
|
|
139068
|
+
this.enrichResumedSessionAsync(sessionId, projectPath, conv);
|
|
139069
|
+
}
|
|
139070
|
+
enrichResumedSessionAsync(sessionId, projectPath, conv) {
|
|
139071
|
+
try {
|
|
139072
|
+
const session = this.sessionStore.get(sessionId, this.ptyAttachedIds());
|
|
139073
|
+
if (!session) return;
|
|
139074
|
+
if (conv) {
|
|
139075
|
+
session.sessionName = conv.sessionName ?? void 0;
|
|
139076
|
+
session.messageCount = conv.messageCount ?? 0;
|
|
139077
|
+
session.account = conv.account ?? void 0;
|
|
139078
|
+
session.filePath = conv.filePath ?? void 0;
|
|
139079
|
+
}
|
|
139080
|
+
if (!this.cache || !this.projectsRepo || !this.conversationsRepo) return;
|
|
139081
|
+
const cached3 = this.cache.getMetaById(sessionId);
|
|
139082
|
+
if (cached3) {
|
|
139083
|
+
session.model = cached3.model ?? void 0;
|
|
139084
|
+
session.preview = cached3.preview ?? void 0;
|
|
139085
|
+
const first = cached3.firstMessage ? JSON.parse(cached3.firstMessage) : null;
|
|
139086
|
+
const last = cached3.lastMessage ? JSON.parse(cached3.lastMessage) : null;
|
|
139087
|
+
session.firstMessageText = first?.text ?? void 0;
|
|
139088
|
+
session.firstMessageAt = first?.timestamp ? new Date(first.timestamp).toISOString() : void 0;
|
|
139089
|
+
session.lastMessageText = last?.text ?? void 0;
|
|
139090
|
+
session.lastMessageAt = last?.timestamp ? new Date(last.timestamp).toISOString() : void 0;
|
|
139091
|
+
}
|
|
139092
|
+
let resolvedProjectId = cached3?.projectId ?? null;
|
|
139093
|
+
if (!resolvedProjectId) {
|
|
139084
139094
|
const project = this.projectsRepo.upsertProjectByPath(projectPath);
|
|
139085
139095
|
resolvedProjectId = project.id;
|
|
139086
139096
|
this.conversationsRepo.updateConversationProjectId({
|
|
@@ -139092,12 +139102,9 @@ var StreamerServer = class {
|
|
|
139092
139102
|
session.projectId = resolvedProjectId;
|
|
139093
139103
|
session.resumedFromConversationId = sessionId;
|
|
139094
139104
|
}
|
|
139105
|
+
} catch (err) {
|
|
139106
|
+
console.error(`[enrichResumedSessionAsync] ${sessionId}:`, err);
|
|
139095
139107
|
}
|
|
139096
|
-
this.sessionStore.addManaged(session);
|
|
139097
|
-
void this.watchConversationFile(sessionId);
|
|
139098
|
-
const resp = this.sessionStore.get(session.id, this.ptyAttachedIds());
|
|
139099
|
-
this.broadcastOrUnicastSessionList(req);
|
|
139100
|
-
json2(res, 201, resp ?? session);
|
|
139101
139108
|
}
|
|
139102
139109
|
async handleSendInput(sessionId, req, res) {
|
|
139103
139110
|
if (this.agentConfig.enabled) {
|