terminalhire 0.16.0 → 0.17.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/bin/cache-store.js +33 -0
- package/dist/bin/jpi-bounties.js +148 -29
- package/dist/bin/jpi-chat-read.js +90 -1
- package/dist/bin/jpi-chat.js +108 -8
- package/dist/bin/jpi-contribute.js +148 -31
- package/dist/bin/jpi-devs.js +89 -1
- package/dist/bin/jpi-dispatch.js +23160 -457
- package/dist/bin/jpi-inbox.js +111 -11
- package/dist/bin/jpi-init.js +292 -20
- package/dist/bin/jpi-intro.js +89 -1
- package/dist/bin/jpi-jobs.js +142 -28
- package/dist/bin/jpi-learn.js +89 -1
- package/dist/bin/jpi-login.js +90 -2
- package/dist/bin/jpi-mcp.js +22364 -0
- package/dist/bin/jpi-profile.js +89 -1
- package/dist/bin/jpi-refresh.js +234 -93
- package/dist/bin/jpi-save.js +89 -1
- package/dist/bin/jpi-spinner.js +20 -3
- package/dist/bin/jpi-statusline.js +2 -2
- package/dist/bin/jpi-sync.js +89 -1
- package/dist/bin/jpi-trajectory.js +89 -1
- package/dist/bin/jpi.js +5 -5
- package/dist/bin/mcp-config.js +239 -0
- package/dist/bin/spinner.js +22 -3
- package/dist/keytar-KOAAH267.node +0 -0
- package/dist/src/chat-client.js +95 -1
- package/dist/src/chat-keystore.js +95 -1
- package/dist/src/config.js +4 -0
- package/dist/src/github-auth.js +95 -1
- package/dist/src/intro.js +89 -1
- package/dist/src/profile.js +95 -1
- package/dist/src/trajectory.js +89 -1
- package/package.json +3 -2
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// bin/cache-store.js
|
|
2
|
+
import { readFileSync, writeFileSync, mkdirSync, renameSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { homedir } from "os";
|
|
5
|
+
var TERMINALHIRE_DIR = process.env.TERMINALHIRE_DIR || join(homedir(), ".terminalhire");
|
|
6
|
+
var INDEX_CACHE_FILE = join(TERMINALHIRE_DIR, "index-cache.json");
|
|
7
|
+
var SCHEMA_VERSION = 1;
|
|
8
|
+
var tmpCounter = 0;
|
|
9
|
+
function readCacheEntry() {
|
|
10
|
+
try {
|
|
11
|
+
return JSON.parse(readFileSync(INDEX_CACHE_FILE, "utf8"));
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function updateIndexCache(patch) {
|
|
17
|
+
mkdirSync(TERMINALHIRE_DIR, { recursive: true });
|
|
18
|
+
const existing = readCacheEntry() ?? {};
|
|
19
|
+
const entry = {
|
|
20
|
+
...existing,
|
|
21
|
+
...patch,
|
|
22
|
+
schemaVersion: SCHEMA_VERSION,
|
|
23
|
+
ts: Date.now()
|
|
24
|
+
};
|
|
25
|
+
const tmp = `${INDEX_CACHE_FILE}.${process.pid}.${tmpCounter++}.tmp`;
|
|
26
|
+
writeFileSync(tmp, JSON.stringify(entry), "utf8");
|
|
27
|
+
renameSync(tmp, INDEX_CACHE_FILE);
|
|
28
|
+
return entry;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
readCacheEntry,
|
|
32
|
+
updateIndexCache
|
|
33
|
+
};
|
package/dist/bin/jpi-bounties.js
CHANGED
|
@@ -1,13 +1,42 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
4
14
|
var __esm = (fn, res) => function __init() {
|
|
5
15
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
6
16
|
};
|
|
17
|
+
var __commonJS = (cb, mod2) => function __require2() {
|
|
18
|
+
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
|
|
19
|
+
};
|
|
7
20
|
var __export = (target, all) => {
|
|
8
21
|
for (var name in all)
|
|
9
22
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
23
|
};
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
+
for (let key of __getOwnPropNames(from))
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
+
}
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
33
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
34
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
35
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
36
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
37
|
+
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
38
|
+
mod2
|
|
39
|
+
));
|
|
11
40
|
|
|
12
41
|
// ../../packages/core/src/types.ts
|
|
13
42
|
function isBounty(job) {
|
|
@@ -2790,21 +2819,21 @@ var init_contributions = __esm({
|
|
|
2790
2819
|
});
|
|
2791
2820
|
|
|
2792
2821
|
// ../../packages/core/src/partners.ts
|
|
2793
|
-
import { readFileSync } from "fs";
|
|
2794
|
-
import { join } from "path";
|
|
2822
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
2823
|
+
import { join as join2 } from "path";
|
|
2795
2824
|
import { fileURLToPath } from "url";
|
|
2796
2825
|
function resolveDataPath() {
|
|
2797
2826
|
try {
|
|
2798
2827
|
const dir = fileURLToPath(new URL("../../../data", import.meta.url));
|
|
2799
|
-
return
|
|
2828
|
+
return join2(dir, "partner-roles.json");
|
|
2800
2829
|
} catch {
|
|
2801
|
-
return
|
|
2830
|
+
return join2(process.cwd(), "data", "partner-roles.json");
|
|
2802
2831
|
}
|
|
2803
2832
|
}
|
|
2804
2833
|
function loadPartnerRoles() {
|
|
2805
2834
|
const filePath = resolveDataPath();
|
|
2806
2835
|
try {
|
|
2807
|
-
const raw =
|
|
2836
|
+
const raw = readFileSync2(filePath, "utf-8");
|
|
2808
2837
|
const parsed = JSON.parse(raw);
|
|
2809
2838
|
if (!Array.isArray(parsed)) {
|
|
2810
2839
|
console.warn("[partners] partner-roles.json is not an array \u2014 skipping");
|
|
@@ -6429,6 +6458,65 @@ var init_src = __esm({
|
|
|
6429
6458
|
}
|
|
6430
6459
|
});
|
|
6431
6460
|
|
|
6461
|
+
// ../../node_modules/keytar/build/Release/keytar.node
|
|
6462
|
+
var keytar_default;
|
|
6463
|
+
var init_keytar = __esm({
|
|
6464
|
+
"../../node_modules/keytar/build/Release/keytar.node"() {
|
|
6465
|
+
keytar_default = "../keytar-KOAAH267.node";
|
|
6466
|
+
}
|
|
6467
|
+
});
|
|
6468
|
+
|
|
6469
|
+
// node-file:/Users/ericgang/job-placement-inline/node_modules/keytar/build/Release/keytar.node
|
|
6470
|
+
var require_keytar = __commonJS({
|
|
6471
|
+
"node-file:/Users/ericgang/job-placement-inline/node_modules/keytar/build/Release/keytar.node"(exports, module) {
|
|
6472
|
+
"use strict";
|
|
6473
|
+
init_keytar();
|
|
6474
|
+
try {
|
|
6475
|
+
module.exports = __require(keytar_default);
|
|
6476
|
+
} catch {
|
|
6477
|
+
}
|
|
6478
|
+
}
|
|
6479
|
+
});
|
|
6480
|
+
|
|
6481
|
+
// ../../node_modules/keytar/lib/keytar.js
|
|
6482
|
+
var require_keytar2 = __commonJS({
|
|
6483
|
+
"../../node_modules/keytar/lib/keytar.js"(exports, module) {
|
|
6484
|
+
"use strict";
|
|
6485
|
+
var keytar = require_keytar();
|
|
6486
|
+
function checkRequired(val, name) {
|
|
6487
|
+
if (!val || val.length <= 0) {
|
|
6488
|
+
throw new Error(name + " is required.");
|
|
6489
|
+
}
|
|
6490
|
+
}
|
|
6491
|
+
module.exports = {
|
|
6492
|
+
getPassword: function(service, account) {
|
|
6493
|
+
checkRequired(service, "Service");
|
|
6494
|
+
checkRequired(account, "Account");
|
|
6495
|
+
return keytar.getPassword(service, account);
|
|
6496
|
+
},
|
|
6497
|
+
setPassword: function(service, account, password) {
|
|
6498
|
+
checkRequired(service, "Service");
|
|
6499
|
+
checkRequired(account, "Account");
|
|
6500
|
+
checkRequired(password, "Password");
|
|
6501
|
+
return keytar.setPassword(service, account, password);
|
|
6502
|
+
},
|
|
6503
|
+
deletePassword: function(service, account) {
|
|
6504
|
+
checkRequired(service, "Service");
|
|
6505
|
+
checkRequired(account, "Account");
|
|
6506
|
+
return keytar.deletePassword(service, account);
|
|
6507
|
+
},
|
|
6508
|
+
findPassword: function(service) {
|
|
6509
|
+
checkRequired(service, "Service");
|
|
6510
|
+
return keytar.findPassword(service);
|
|
6511
|
+
},
|
|
6512
|
+
findCredentials: function(service) {
|
|
6513
|
+
checkRequired(service, "Service");
|
|
6514
|
+
return keytar.findCredentials(service);
|
|
6515
|
+
}
|
|
6516
|
+
};
|
|
6517
|
+
}
|
|
6518
|
+
});
|
|
6519
|
+
|
|
6432
6520
|
// src/profile.ts
|
|
6433
6521
|
var profile_exports = {};
|
|
6434
6522
|
__export(profile_exports, {
|
|
@@ -6449,16 +6537,16 @@ import {
|
|
|
6449
6537
|
randomBytes as randomBytes3
|
|
6450
6538
|
} from "crypto";
|
|
6451
6539
|
import {
|
|
6452
|
-
readFileSync as
|
|
6453
|
-
writeFileSync,
|
|
6454
|
-
mkdirSync,
|
|
6540
|
+
readFileSync as readFileSync3,
|
|
6541
|
+
writeFileSync as writeFileSync2,
|
|
6542
|
+
mkdirSync as mkdirSync2,
|
|
6455
6543
|
existsSync
|
|
6456
6544
|
} from "fs";
|
|
6457
|
-
import { join as
|
|
6458
|
-
import { homedir } from "os";
|
|
6545
|
+
import { join as join3 } from "path";
|
|
6546
|
+
import { homedir as homedir2 } from "os";
|
|
6459
6547
|
async function loadKey() {
|
|
6460
6548
|
try {
|
|
6461
|
-
const kt = await
|
|
6549
|
+
const kt = await Promise.resolve().then(() => __toESM(require_keytar2(), 1));
|
|
6462
6550
|
const stored = await kt.getPassword("terminalhire", "profile-key");
|
|
6463
6551
|
if (stored) {
|
|
6464
6552
|
return Buffer.from(stored, "hex");
|
|
@@ -6468,12 +6556,12 @@ async function loadKey() {
|
|
|
6468
6556
|
return key2;
|
|
6469
6557
|
} catch {
|
|
6470
6558
|
}
|
|
6471
|
-
|
|
6559
|
+
mkdirSync2(TERMINALHIRE_DIR2, { recursive: true });
|
|
6472
6560
|
if (existsSync(KEY_FILE)) {
|
|
6473
|
-
return Buffer.from(
|
|
6561
|
+
return Buffer.from(readFileSync3(KEY_FILE, "utf8").trim(), "hex");
|
|
6474
6562
|
}
|
|
6475
6563
|
const key = randomBytes3(KEY_BYTES);
|
|
6476
|
-
|
|
6564
|
+
writeFileSync2(KEY_FILE, key.toString("hex"), { mode: 384, encoding: "utf8" });
|
|
6477
6565
|
return key;
|
|
6478
6566
|
}
|
|
6479
6567
|
function encrypt(plaintext, key) {
|
|
@@ -6534,7 +6622,7 @@ async function readProfile() {
|
|
|
6534
6622
|
if (!existsSync(PROFILE_FILE)) return blankProfile();
|
|
6535
6623
|
try {
|
|
6536
6624
|
const key = await loadKey();
|
|
6537
|
-
const raw =
|
|
6625
|
+
const raw = readFileSync3(PROFILE_FILE, "utf8");
|
|
6538
6626
|
const blob = JSON.parse(raw);
|
|
6539
6627
|
const plaintext = decrypt(blob, key);
|
|
6540
6628
|
const parsed = JSON.parse(plaintext);
|
|
@@ -6545,12 +6633,12 @@ async function readProfile() {
|
|
|
6545
6633
|
}
|
|
6546
6634
|
}
|
|
6547
6635
|
async function writeProfile(profile) {
|
|
6548
|
-
|
|
6636
|
+
mkdirSync2(TERMINALHIRE_DIR2, { recursive: true });
|
|
6549
6637
|
const key = await loadKey();
|
|
6550
6638
|
profile.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6551
6639
|
profile.skillTags = deriveSkillTags(profile.tagWeights);
|
|
6552
6640
|
const blob = encrypt(JSON.stringify(profile), key);
|
|
6553
|
-
|
|
6641
|
+
writeFileSync2(PROFILE_FILE, JSON.stringify(blob, null, 2), { encoding: "utf8" });
|
|
6554
6642
|
}
|
|
6555
6643
|
function accumulateSession(profile, tags, isEmployerContext, inferredSeniority, seniorityIsAuthoritative = false) {
|
|
6556
6644
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -6634,14 +6722,14 @@ function profileToFingerprint(profile) {
|
|
|
6634
6722
|
}
|
|
6635
6723
|
};
|
|
6636
6724
|
}
|
|
6637
|
-
var
|
|
6725
|
+
var TERMINALHIRE_DIR2, PROFILE_FILE, KEY_FILE, ALGO, KEY_BYTES, IV_BYTES, DECAY_HALF_LIFE_MS, LANGUAGE_TAGS, MIN_FINGERPRINT_SCORE;
|
|
6638
6726
|
var init_profile = __esm({
|
|
6639
6727
|
"src/profile.ts"() {
|
|
6640
6728
|
"use strict";
|
|
6641
6729
|
init_src();
|
|
6642
|
-
|
|
6643
|
-
PROFILE_FILE =
|
|
6644
|
-
KEY_FILE =
|
|
6730
|
+
TERMINALHIRE_DIR2 = join3(homedir2(), ".terminalhire");
|
|
6731
|
+
PROFILE_FILE = join3(TERMINALHIRE_DIR2, "profile.enc");
|
|
6732
|
+
KEY_FILE = join3(TERMINALHIRE_DIR2, "key");
|
|
6645
6733
|
ALGO = "aes-256-gcm";
|
|
6646
6734
|
KEY_BYTES = 32;
|
|
6647
6735
|
IV_BYTES = 12;
|
|
@@ -6670,12 +6758,44 @@ var init_profile = __esm({
|
|
|
6670
6758
|
});
|
|
6671
6759
|
|
|
6672
6760
|
// bin/jpi-bounties.js
|
|
6673
|
-
import { readFileSync as
|
|
6674
|
-
import { join as
|
|
6675
|
-
import { homedir as
|
|
6761
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
6762
|
+
import { join as join4 } from "path";
|
|
6763
|
+
import { homedir as homedir3 } from "os";
|
|
6676
6764
|
import { createInterface } from "readline";
|
|
6677
|
-
|
|
6678
|
-
|
|
6765
|
+
|
|
6766
|
+
// bin/cache-store.js
|
|
6767
|
+
import { readFileSync, writeFileSync, mkdirSync, renameSync } from "fs";
|
|
6768
|
+
import { join } from "path";
|
|
6769
|
+
import { homedir } from "os";
|
|
6770
|
+
var TERMINALHIRE_DIR = process.env.TERMINALHIRE_DIR || join(homedir(), ".terminalhire");
|
|
6771
|
+
var INDEX_CACHE_FILE = join(TERMINALHIRE_DIR, "index-cache.json");
|
|
6772
|
+
var SCHEMA_VERSION = 1;
|
|
6773
|
+
var tmpCounter = 0;
|
|
6774
|
+
function readCacheEntry() {
|
|
6775
|
+
try {
|
|
6776
|
+
return JSON.parse(readFileSync(INDEX_CACHE_FILE, "utf8"));
|
|
6777
|
+
} catch {
|
|
6778
|
+
return null;
|
|
6779
|
+
}
|
|
6780
|
+
}
|
|
6781
|
+
function updateIndexCache(patch) {
|
|
6782
|
+
mkdirSync(TERMINALHIRE_DIR, { recursive: true });
|
|
6783
|
+
const existing = readCacheEntry() ?? {};
|
|
6784
|
+
const entry = {
|
|
6785
|
+
...existing,
|
|
6786
|
+
...patch,
|
|
6787
|
+
schemaVersion: SCHEMA_VERSION,
|
|
6788
|
+
ts: Date.now()
|
|
6789
|
+
};
|
|
6790
|
+
const tmp = `${INDEX_CACHE_FILE}.${process.pid}.${tmpCounter++}.tmp`;
|
|
6791
|
+
writeFileSync(tmp, JSON.stringify(entry), "utf8");
|
|
6792
|
+
renameSync(tmp, INDEX_CACHE_FILE);
|
|
6793
|
+
return entry;
|
|
6794
|
+
}
|
|
6795
|
+
|
|
6796
|
+
// bin/jpi-bounties.js
|
|
6797
|
+
var TERMINALHIRE_DIR3 = process.env.TERMINALHIRE_DIR || join4(homedir3(), ".terminalhire");
|
|
6798
|
+
var INDEX_CACHE_FILE2 = join4(TERMINALHIRE_DIR3, "index-cache.json");
|
|
6679
6799
|
var INDEX_TTL_MS = 15 * 60 * 1e3;
|
|
6680
6800
|
var API_URL = process.env["TERMINALHIRE_API_URL"] ?? process.env["JPI_API_URL"] ?? "https://terminalhire.com";
|
|
6681
6801
|
var DEFAULT_LIMIT = 15;
|
|
@@ -6687,7 +6807,7 @@ var SHOW_ALL = args.includes("--all");
|
|
|
6687
6807
|
var WINNABLE_ONLY = args.includes("--winnable");
|
|
6688
6808
|
function readIndexCache() {
|
|
6689
6809
|
try {
|
|
6690
|
-
const entry = JSON.parse(
|
|
6810
|
+
const entry = JSON.parse(readFileSync4(INDEX_CACHE_FILE2, "utf8"));
|
|
6691
6811
|
if (Date.now() - entry.ts < INDEX_TTL_MS) return entry.index;
|
|
6692
6812
|
return null;
|
|
6693
6813
|
} catch {
|
|
@@ -6695,8 +6815,7 @@ function readIndexCache() {
|
|
|
6695
6815
|
}
|
|
6696
6816
|
}
|
|
6697
6817
|
function writeIndexCache(index) {
|
|
6698
|
-
|
|
6699
|
-
writeFileSync2(INDEX_CACHE_FILE, JSON.stringify({ ts: Date.now(), index }), "utf8");
|
|
6818
|
+
updateIndexCache({ index });
|
|
6700
6819
|
}
|
|
6701
6820
|
async function fetchIndex() {
|
|
6702
6821
|
const cached = readIndexCache();
|
|
@@ -1,8 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
3
14
|
var __esm = (fn, res) => function __init() {
|
|
4
15
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
16
|
};
|
|
17
|
+
var __commonJS = (cb, mod2) => function __require2() {
|
|
18
|
+
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
34
|
+
mod2
|
|
35
|
+
));
|
|
6
36
|
|
|
7
37
|
// ../../packages/core/src/types.ts
|
|
8
38
|
var init_types = __esm({
|
|
@@ -3854,6 +3884,65 @@ var init_src = __esm({
|
|
|
3854
3884
|
}
|
|
3855
3885
|
});
|
|
3856
3886
|
|
|
3887
|
+
// ../../node_modules/keytar/build/Release/keytar.node
|
|
3888
|
+
var keytar_default;
|
|
3889
|
+
var init_keytar = __esm({
|
|
3890
|
+
"../../node_modules/keytar/build/Release/keytar.node"() {
|
|
3891
|
+
keytar_default = "../keytar-KOAAH267.node";
|
|
3892
|
+
}
|
|
3893
|
+
});
|
|
3894
|
+
|
|
3895
|
+
// node-file:/Users/ericgang/job-placement-inline/node_modules/keytar/build/Release/keytar.node
|
|
3896
|
+
var require_keytar = __commonJS({
|
|
3897
|
+
"node-file:/Users/ericgang/job-placement-inline/node_modules/keytar/build/Release/keytar.node"(exports, module) {
|
|
3898
|
+
"use strict";
|
|
3899
|
+
init_keytar();
|
|
3900
|
+
try {
|
|
3901
|
+
module.exports = __require(keytar_default);
|
|
3902
|
+
} catch {
|
|
3903
|
+
}
|
|
3904
|
+
}
|
|
3905
|
+
});
|
|
3906
|
+
|
|
3907
|
+
// ../../node_modules/keytar/lib/keytar.js
|
|
3908
|
+
var require_keytar2 = __commonJS({
|
|
3909
|
+
"../../node_modules/keytar/lib/keytar.js"(exports, module) {
|
|
3910
|
+
"use strict";
|
|
3911
|
+
var keytar = require_keytar();
|
|
3912
|
+
function checkRequired(val, name) {
|
|
3913
|
+
if (!val || val.length <= 0) {
|
|
3914
|
+
throw new Error(name + " is required.");
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
module.exports = {
|
|
3918
|
+
getPassword: function(service, account) {
|
|
3919
|
+
checkRequired(service, "Service");
|
|
3920
|
+
checkRequired(account, "Account");
|
|
3921
|
+
return keytar.getPassword(service, account);
|
|
3922
|
+
},
|
|
3923
|
+
setPassword: function(service, account, password) {
|
|
3924
|
+
checkRequired(service, "Service");
|
|
3925
|
+
checkRequired(account, "Account");
|
|
3926
|
+
checkRequired(password, "Password");
|
|
3927
|
+
return keytar.setPassword(service, account, password);
|
|
3928
|
+
},
|
|
3929
|
+
deletePassword: function(service, account) {
|
|
3930
|
+
checkRequired(service, "Service");
|
|
3931
|
+
checkRequired(account, "Account");
|
|
3932
|
+
return keytar.deletePassword(service, account);
|
|
3933
|
+
},
|
|
3934
|
+
findPassword: function(service) {
|
|
3935
|
+
checkRequired(service, "Service");
|
|
3936
|
+
return keytar.findPassword(service);
|
|
3937
|
+
},
|
|
3938
|
+
findCredentials: function(service) {
|
|
3939
|
+
checkRequired(service, "Service");
|
|
3940
|
+
return keytar.findCredentials(service);
|
|
3941
|
+
}
|
|
3942
|
+
};
|
|
3943
|
+
}
|
|
3944
|
+
});
|
|
3945
|
+
|
|
3857
3946
|
// src/github-auth.ts
|
|
3858
3947
|
import {
|
|
3859
3948
|
createCipheriv,
|
|
@@ -3871,7 +3960,7 @@ import { join as join2 } from "path";
|
|
|
3871
3960
|
import { homedir } from "os";
|
|
3872
3961
|
async function loadKey() {
|
|
3873
3962
|
try {
|
|
3874
|
-
const kt = await
|
|
3963
|
+
const kt = await Promise.resolve().then(() => __toESM(require_keytar2(), 1));
|
|
3875
3964
|
const stored = await kt.getPassword("terminalhire", "profile-key");
|
|
3876
3965
|
if (stored) return Buffer.from(stored, "hex");
|
|
3877
3966
|
const key2 = randomBytes3(KEY_BYTES);
|
package/dist/bin/jpi-chat.js
CHANGED
|
@@ -1,13 +1,42 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
4
14
|
var __esm = (fn, res) => function __init() {
|
|
5
15
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
6
16
|
};
|
|
17
|
+
var __commonJS = (cb, mod2) => function __require2() {
|
|
18
|
+
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
|
|
19
|
+
};
|
|
7
20
|
var __export = (target, all) => {
|
|
8
21
|
for (var name in all)
|
|
9
22
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
23
|
};
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
+
for (let key of __getOwnPropNames(from))
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
+
}
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
33
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
34
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
35
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
36
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
37
|
+
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
38
|
+
mod2
|
|
39
|
+
));
|
|
11
40
|
|
|
12
41
|
// ../../packages/core/src/types.ts
|
|
13
42
|
var init_types = __esm({
|
|
@@ -3883,6 +3912,65 @@ var init_src = __esm({
|
|
|
3883
3912
|
}
|
|
3884
3913
|
});
|
|
3885
3914
|
|
|
3915
|
+
// ../../node_modules/keytar/build/Release/keytar.node
|
|
3916
|
+
var keytar_default;
|
|
3917
|
+
var init_keytar = __esm({
|
|
3918
|
+
"../../node_modules/keytar/build/Release/keytar.node"() {
|
|
3919
|
+
keytar_default = "../keytar-KOAAH267.node";
|
|
3920
|
+
}
|
|
3921
|
+
});
|
|
3922
|
+
|
|
3923
|
+
// node-file:/Users/ericgang/job-placement-inline/node_modules/keytar/build/Release/keytar.node
|
|
3924
|
+
var require_keytar = __commonJS({
|
|
3925
|
+
"node-file:/Users/ericgang/job-placement-inline/node_modules/keytar/build/Release/keytar.node"(exports, module) {
|
|
3926
|
+
"use strict";
|
|
3927
|
+
init_keytar();
|
|
3928
|
+
try {
|
|
3929
|
+
module.exports = __require(keytar_default);
|
|
3930
|
+
} catch {
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
});
|
|
3934
|
+
|
|
3935
|
+
// ../../node_modules/keytar/lib/keytar.js
|
|
3936
|
+
var require_keytar2 = __commonJS({
|
|
3937
|
+
"../../node_modules/keytar/lib/keytar.js"(exports, module) {
|
|
3938
|
+
"use strict";
|
|
3939
|
+
var keytar = require_keytar();
|
|
3940
|
+
function checkRequired(val, name) {
|
|
3941
|
+
if (!val || val.length <= 0) {
|
|
3942
|
+
throw new Error(name + " is required.");
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
module.exports = {
|
|
3946
|
+
getPassword: function(service, account) {
|
|
3947
|
+
checkRequired(service, "Service");
|
|
3948
|
+
checkRequired(account, "Account");
|
|
3949
|
+
return keytar.getPassword(service, account);
|
|
3950
|
+
},
|
|
3951
|
+
setPassword: function(service, account, password) {
|
|
3952
|
+
checkRequired(service, "Service");
|
|
3953
|
+
checkRequired(account, "Account");
|
|
3954
|
+
checkRequired(password, "Password");
|
|
3955
|
+
return keytar.setPassword(service, account, password);
|
|
3956
|
+
},
|
|
3957
|
+
deletePassword: function(service, account) {
|
|
3958
|
+
checkRequired(service, "Service");
|
|
3959
|
+
checkRequired(account, "Account");
|
|
3960
|
+
return keytar.deletePassword(service, account);
|
|
3961
|
+
},
|
|
3962
|
+
findPassword: function(service) {
|
|
3963
|
+
checkRequired(service, "Service");
|
|
3964
|
+
return keytar.findPassword(service);
|
|
3965
|
+
},
|
|
3966
|
+
findCredentials: function(service) {
|
|
3967
|
+
checkRequired(service, "Service");
|
|
3968
|
+
return keytar.findCredentials(service);
|
|
3969
|
+
}
|
|
3970
|
+
};
|
|
3971
|
+
}
|
|
3972
|
+
});
|
|
3973
|
+
|
|
3886
3974
|
// src/github-auth.ts
|
|
3887
3975
|
import {
|
|
3888
3976
|
createCipheriv,
|
|
@@ -3900,7 +3988,7 @@ import { join as join2 } from "path";
|
|
|
3900
3988
|
import { homedir } from "os";
|
|
3901
3989
|
async function loadKey() {
|
|
3902
3990
|
try {
|
|
3903
|
-
const kt = await
|
|
3991
|
+
const kt = await Promise.resolve().then(() => __toESM(require_keytar2(), 1));
|
|
3904
3992
|
const stored = await kt.getPassword("terminalhire", "profile-key");
|
|
3905
3993
|
if (stored) return Buffer.from(stored, "hex");
|
|
3906
3994
|
const key2 = randomBytes3(KEY_BYTES);
|
|
@@ -4720,7 +4808,7 @@ import { join as join8 } from "path";
|
|
|
4720
4808
|
import { homedir as homedir7 } from "os";
|
|
4721
4809
|
async function loadKey2() {
|
|
4722
4810
|
try {
|
|
4723
|
-
const kt = await
|
|
4811
|
+
const kt = await Promise.resolve().then(() => __toESM(require_keytar2(), 1));
|
|
4724
4812
|
const stored = await kt.getPassword("terminalhire", "profile-key");
|
|
4725
4813
|
if (stored) {
|
|
4726
4814
|
return Buffer.from(stored, "hex");
|
|
@@ -5816,7 +5904,7 @@ async function runInboxTui(deps = {}) {
|
|
|
5816
5904
|
const sel = await runInboxPane({ input, output, ...paneDeps });
|
|
5817
5905
|
if (!sel || sel.action === "quit") break;
|
|
5818
5906
|
if (sel.action === "open" && sel.login) {
|
|
5819
|
-
await openChatPane({ login: sel.login, input, output });
|
|
5907
|
+
await openChatPane({ login: sel.login, input, output, backHint: "inbox" });
|
|
5820
5908
|
}
|
|
5821
5909
|
}
|
|
5822
5910
|
return { ok: true };
|
|
@@ -5994,7 +6082,7 @@ function formatPresence(presence, now = /* @__PURE__ */ new Date()) {
|
|
|
5994
6082
|
return "\u25D0 reachable";
|
|
5995
6083
|
}
|
|
5996
6084
|
function formatThread(state) {
|
|
5997
|
-
const { peerLogin, presence, self, messages, inputBuffer, banner } = state;
|
|
6085
|
+
const { peerLogin, presence, self, messages, inputBuffer, banner, backHint } = state;
|
|
5998
6086
|
const safePeer = sanitizeLine(peerLogin);
|
|
5999
6087
|
const status = formatPresence(presence);
|
|
6000
6088
|
const lines = [];
|
|
@@ -6022,7 +6110,9 @@ function formatThread(state) {
|
|
|
6022
6110
|
}
|
|
6023
6111
|
lines.push(" " + "\u2500".repeat(56));
|
|
6024
6112
|
lines.push(` > ${inputBuffer}`);
|
|
6025
|
-
lines.push(
|
|
6113
|
+
lines.push(
|
|
6114
|
+
backHint ? ` Esc back to ${sanitizeLine(backHint)} \xB7 Enter send \xB7 Ctrl-S safety number \xB7 /safety \xB7 /block \xB7 q quit` : " Enter send \xB7 Ctrl-S safety number \xB7 /safety \xB7 /block \xB7 q quit"
|
|
6115
|
+
);
|
|
6026
6116
|
return CLEAR2 + lines.join("\n") + "\n";
|
|
6027
6117
|
}
|
|
6028
6118
|
function mergeMessages(existing, incoming) {
|
|
@@ -6065,7 +6155,10 @@ async function runChatPane(opts = {}) {
|
|
|
6065
6155
|
pollIntervalMs = 1500,
|
|
6066
6156
|
setTimer = (fn, ms) => setInterval(fn, ms),
|
|
6067
6157
|
clearTimer = (t) => clearInterval(t),
|
|
6068
|
-
markRead = defaultMarkThreadRead
|
|
6158
|
+
markRead = defaultMarkThreadRead,
|
|
6159
|
+
// Where Esc returns to, when opened from a parent surface (the inbox TUI
|
|
6160
|
+
// passes 'inbox'). Copy-only — the caller's loop does the actual returning.
|
|
6161
|
+
backHint = null
|
|
6069
6162
|
} = opts;
|
|
6070
6163
|
const target = String(login ?? "").replace(/^@/, "").trim();
|
|
6071
6164
|
if (!target) {
|
|
@@ -6195,7 +6288,8 @@ async function runChatPane(opts = {}) {
|
|
|
6195
6288
|
self: { login: selfLogin, expired: selfExpired, shareActivity: selfShareActivity },
|
|
6196
6289
|
messages,
|
|
6197
6290
|
inputBuffer,
|
|
6198
|
-
banner
|
|
6291
|
+
banner,
|
|
6292
|
+
backHint
|
|
6199
6293
|
})
|
|
6200
6294
|
);
|
|
6201
6295
|
}
|
|
@@ -6388,6 +6482,11 @@ async function runChatPane(opts = {}) {
|
|
|
6388
6482
|
function onData(chunk) {
|
|
6389
6483
|
if (cleaned) return;
|
|
6390
6484
|
const s = chunk.toString("utf8");
|
|
6485
|
+
if (s === KEY_ESC2) {
|
|
6486
|
+
finish("back");
|
|
6487
|
+
return;
|
|
6488
|
+
}
|
|
6489
|
+
if (s.charCodeAt(0) === 27) return;
|
|
6391
6490
|
for (const ch of s) {
|
|
6392
6491
|
if (ch === KEY_CTRL_C2) {
|
|
6393
6492
|
finish("sigint");
|
|
@@ -6629,7 +6728,7 @@ async function run2() {
|
|
|
6629
6728
|
process.exit(1);
|
|
6630
6729
|
}
|
|
6631
6730
|
}
|
|
6632
|
-
var CHAT_BASE3, GH_SESSION_COOKIE4, HIDE_CURSOR2, SHOW_CURSOR2, ENTER_ALT2, EXIT_ALT2, CLEAR2, KEY_CTRL_C2, KEY_CTRL_S, KEY_ENTER_A2, KEY_ENTER_B2, KEY_BACKSPACE_A2, KEY_BACKSPACE_B2, MAX_INPUT_LEN, ANSI_CSI, ANSI_OSC, ANSI_OTHER, C0_C1_DEL, CHAT_DISCLOSURE, CHAT_AT_REST, CHAT_CODE_OF_CONDUCT, CHAT_MIN_AGE, DEPOSIT_CTA, ACTIVE_WINDOW_MS;
|
|
6731
|
+
var CHAT_BASE3, GH_SESSION_COOKIE4, HIDE_CURSOR2, SHOW_CURSOR2, ENTER_ALT2, EXIT_ALT2, CLEAR2, KEY_CTRL_C2, KEY_ESC2, KEY_CTRL_S, KEY_ENTER_A2, KEY_ENTER_B2, KEY_BACKSPACE_A2, KEY_BACKSPACE_B2, MAX_INPUT_LEN, ANSI_CSI, ANSI_OSC, ANSI_OTHER, C0_C1_DEL, CHAT_DISCLOSURE, CHAT_AT_REST, CHAT_CODE_OF_CONDUCT, CHAT_MIN_AGE, DEPOSIT_CTA, ACTIVE_WINDOW_MS;
|
|
6633
6732
|
var init_jpi_chat = __esm({
|
|
6634
6733
|
"bin/jpi-chat.js"() {
|
|
6635
6734
|
init_chat_client();
|
|
@@ -6643,6 +6742,7 @@ var init_jpi_chat = __esm({
|
|
|
6643
6742
|
EXIT_ALT2 = "\x1B[?1049l";
|
|
6644
6743
|
CLEAR2 = "\x1B[2J\x1B[H";
|
|
6645
6744
|
KEY_CTRL_C2 = "";
|
|
6745
|
+
KEY_ESC2 = "\x1B";
|
|
6646
6746
|
KEY_CTRL_S = "";
|
|
6647
6747
|
KEY_ENTER_A2 = "\r";
|
|
6648
6748
|
KEY_ENTER_B2 = "\n";
|