pantheon-opencode 1.6.2-beta.1 → 1.6.2-beta.3
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/CHANGELOG.md +27 -0
- package/README.md +41 -29
- package/README.pt-BR.md +12 -1
- package/bin/pantheon-init.mjs +51 -13
- package/package.json +2 -1
- package/plugin.json +1 -1
- package/prompts/README.md +58 -0
- package/prompts/debug-issue.prompt.md +46 -0
- package/prompts/dynamic/agora-generated.txt +38 -0
- package/prompts/dynamic/orchestrate-generated.txt +51 -0
- package/prompts/focus.prompt.md +42 -0
- package/prompts/implement-feature.prompt.md +39 -0
- package/prompts/optimize-database.prompt.md +58 -0
- package/prompts/orchestrate-with-zeus.prompt.md +441 -0
- package/prompts/plan-architecture.prompt.md +59 -0
- package/prompts/quick-discovery-large-codebase.prompt.md +294 -0
- package/prompts/quick-plan-large-feature.prompt.md +197 -0
- package/prompts/semantic-summarize.md +50 -0
- package/prompts/sketch.prompt.md +91 -0
- package/prompts/subtask.prompt.md +131 -0
- package/pyproject.toml +1 -1
- package/scripts/install/component-selection.mjs +9 -4
- package/scripts/install/health-check.mjs +20 -11
- package/scripts/install/interactive.mjs +9 -16
- package/scripts/install/interrupt.mjs +4 -3
- package/scripts/install/migrate.mjs +123 -72
- package/scripts/install/opencode.mjs +150 -114
- package/scripts/install/plan.mjs +8 -1
- package/scripts/install/state.mjs +7 -0
- package/scripts/install/strings.mjs +6 -0
- package/scripts/install/venv.mjs +34 -17
- package/scripts/restore.mjs +22 -10
- package/scripts/test-opencode-v2-sandbox.sh +10 -6
- package/src/pantheon/cost-command.ts +30 -133
- package/src/pantheon/model-pricing.ts +1 -536
- package/src/plugins/tui/THIRD_PARTY_NOTICES.md +24 -0
- package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js +749 -0
- package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js.map +1 -0
- package/src/plugins/tui/dist/quota-adapters.d.ts.map +1 -1
- package/src/plugins/tui/dist/quota-adapters.js +1 -1
- package/src/plugins/tui/dist/{quota-rpc-UL2HuFRJ.js → quota-rpc-DMmXBhBe.js} +295 -1
- package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js.map +1 -0
- package/src/plugins/tui/dist/server-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/server-v2.js +135 -12
- package/src/plugins/tui/dist/server-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui-v2.d.ts +132 -5
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +3720 -337
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js +118 -0
- package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js.map +1 -0
- package/src/plugins/tui/dist/usage-history-worker.js +25 -0
- package/src/plugins/tui/dist/usage-history-worker.js.map +1 -0
- package/src/plugins/tui/package-lock.json +17 -2
- package/src/plugins/tui/package.json +4 -2
- package/src/plugins/tui/src/cost-data.ts +607 -0
- package/src/plugins/tui/src/index-v2.tsx +32 -0
- package/src/plugins/tui/src/model-pricing.ts +536 -0
- package/src/plugins/tui/src/quota-rpc.ts +164 -0
- package/src/plugins/tui/src/quota-v2-model.ts +2 -2
- package/src/plugins/tui/src/quota-v2.tsx +338 -86
- package/src/plugins/tui/src/server-v2.ts +159 -15
- package/src/plugins/tui/src/usage-history-contract.ts +217 -0
- package/src/plugins/tui/src/usage-history-validation.ts +104 -0
- package/src/plugins/tui/src/usage-history-view.tsx +236 -0
- package/src/plugins/tui/src/usage-history-worker.ts +25 -0
- package/src/plugins/tui/src/usage-view-model.ts +272 -0
- package/src/plugins/tui/tsconfig.typecheck.json +6 -1
- package/src/plugins/tui/tsdown.config.ts +36 -4
- package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js.map +0 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const MAX_HISTORY_QUERY_MS = 5e3;
|
|
2
|
+
const USAGE_HISTORY_PERIODS = [
|
|
3
|
+
"7d",
|
|
4
|
+
"15d",
|
|
5
|
+
"30d",
|
|
6
|
+
"total"
|
|
7
|
+
];
|
|
8
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
9
|
+
const SAFE_LABEL = /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;
|
|
10
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
11
|
+
function safeCount(value, markTruncated) {
|
|
12
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
13
|
+
markTruncated();
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
if (!Number.isSafeInteger(value)) {
|
|
17
|
+
markTruncated();
|
|
18
|
+
return Math.min(Math.floor(value), MAX_SAFE_INTEGER);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function safeEstimate(value, markTruncated) {
|
|
23
|
+
if (value === void 0) return void 0;
|
|
24
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
25
|
+
markTruncated();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const rounded = Math.round(value * 1e8) / 1e8;
|
|
29
|
+
if (!Number.isFinite(rounded)) {
|
|
30
|
+
markTruncated();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
return rounded;
|
|
34
|
+
}
|
|
35
|
+
function safeLabel(value, markTruncated) {
|
|
36
|
+
if (!SAFE_LABEL.test(value)) {
|
|
37
|
+
markTruncated();
|
|
38
|
+
return "unknown";
|
|
39
|
+
}
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
function projectTotals(value, markTruncated) {
|
|
43
|
+
return {
|
|
44
|
+
input: safeCount(value.input, markTruncated),
|
|
45
|
+
output: safeCount(value.output, markTruncated),
|
|
46
|
+
cacheRead: safeCount(value.cacheRead, markTruncated),
|
|
47
|
+
cacheWrite: safeCount(value.cacheWrite, markTruncated),
|
|
48
|
+
total: safeCount(value.total, markTruncated)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Project cost-command output to a bounded, non-identifying TUI contract. */
|
|
52
|
+
function projectUsageHistoryResult(result) {
|
|
53
|
+
let unsafeOrTruncated = false;
|
|
54
|
+
const markTruncated = () => {
|
|
55
|
+
unsafeOrTruncated = true;
|
|
56
|
+
};
|
|
57
|
+
const sourceBuckets = result.buckets;
|
|
58
|
+
const sourceModels = result.models;
|
|
59
|
+
if (sourceBuckets.length > 366 || sourceModels.length > 64) markTruncated();
|
|
60
|
+
const buckets = sourceBuckets.slice(-366).flatMap((bucket) => {
|
|
61
|
+
if (!ISO_DATE.test(bucket.date)) {
|
|
62
|
+
markTruncated();
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
const estimatedUsd = safeEstimate(bucket.estimatedUsd, markTruncated);
|
|
66
|
+
return [{
|
|
67
|
+
date: bucket.date,
|
|
68
|
+
...projectTotals(bucket, markTruncated),
|
|
69
|
+
...estimatedUsd === void 0 ? {} : { estimatedUsd },
|
|
70
|
+
pricingComplete: bucket.pricingComplete === true
|
|
71
|
+
}];
|
|
72
|
+
});
|
|
73
|
+
const models = sourceModels.slice(0, 64).map((model) => {
|
|
74
|
+
const estimatedUsd = safeEstimate(model.estimatedUsd, markTruncated);
|
|
75
|
+
return {
|
|
76
|
+
providerID: safeLabel(model.providerID, markTruncated),
|
|
77
|
+
modelID: safeLabel(model.modelID, markTruncated),
|
|
78
|
+
totals: projectTotals(model.totals, markTruncated),
|
|
79
|
+
...estimatedUsd === void 0 ? {} : { estimatedUsd },
|
|
80
|
+
pricingComplete: model.pricingComplete === true
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
let coverageStart = result.coverageStart;
|
|
84
|
+
if (coverageStart !== null && !ISO_DATE.test(coverageStart)) {
|
|
85
|
+
markTruncated();
|
|
86
|
+
coverageStart = null;
|
|
87
|
+
}
|
|
88
|
+
const pricingEstimate = safeEstimate(result.pricing.estimatedUsd, markTruncated);
|
|
89
|
+
const rows = safeCount(result.rows, markTruncated);
|
|
90
|
+
const totals = projectTotals(result.totals, markTruncated);
|
|
91
|
+
const unpricedModels = safeCount(result.pricing.unpricedModels, markTruncated);
|
|
92
|
+
const truncated = unsafeOrTruncated;
|
|
93
|
+
return {
|
|
94
|
+
status: result.partial || truncated ? "partial" : "available",
|
|
95
|
+
period: result.period,
|
|
96
|
+
coverageStart,
|
|
97
|
+
partial: result.partial,
|
|
98
|
+
truncated,
|
|
99
|
+
rows,
|
|
100
|
+
buckets,
|
|
101
|
+
totals,
|
|
102
|
+
models,
|
|
103
|
+
pricing: {
|
|
104
|
+
status: result.pricing.status,
|
|
105
|
+
complete: result.pricing.complete === true,
|
|
106
|
+
billed: false,
|
|
107
|
+
...pricingEstimate === void 0 ? {} : { estimatedUsd: pricingEstimate },
|
|
108
|
+
unpricedModels
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function isUsageHistoryPeriod(value) {
|
|
113
|
+
return typeof value === "string" && USAGE_HISTORY_PERIODS.includes(value);
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { projectUsageHistoryResult as i, USAGE_HISTORY_PERIODS as n, isUsageHistoryPeriod as r, MAX_HISTORY_QUERY_MS as t };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=usage-history-contract-nt1rnBPE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage-history-contract-nt1rnBPE.js","names":[],"sources":["../src/usage-history-contract.ts"],"sourcesContent":["export const MAX_HISTORY_BUCKETS = 366\nexport const MAX_HISTORY_MODELS = 64\nexport const MAX_HISTORY_QUERY_MS = 5_000\n\nexport type UsageHistoryRpcPeriod = '7d' | '15d' | '30d' | 'total'\n\ninterface UsageHistorySourceTotals {\n input: number\n output: number\n cacheRead: number\n cacheWrite: number\n total: number\n}\n\ninterface UsageHistorySourceBucket extends UsageHistorySourceTotals {\n date: string\n estimatedUsd?: number\n pricingComplete: boolean\n}\n\ninterface UsageHistorySourceModel {\n providerID: string\n modelID: string\n totals: UsageHistorySourceTotals\n buckets: UsageHistorySourceBucket[]\n estimatedUsd?: number\n pricingComplete: boolean\n}\n\ninterface UsageHistorySourceResult {\n period: UsageHistoryRpcPeriod\n coverageStart: string | null\n partial: boolean\n rows: number\n buckets: UsageHistorySourceBucket[]\n totals: UsageHistorySourceTotals\n models: UsageHistorySourceModel[]\n pricing: {\n status: 'empty' | 'unavailable' | 'partial' | 'complete'\n complete: boolean\n estimatedUsd?: number\n unpricedModels: number\n }\n}\n\nexport interface UsageHistoryRpcTotals {\n input: number\n output: number\n cacheRead: number\n cacheWrite: number\n total: number\n}\n\nexport interface UsageHistoryRpcBucket extends UsageHistoryRpcTotals {\n date: string\n estimatedUsd?: number\n pricingComplete: boolean\n}\n\nexport interface UsageHistoryRpcModel {\n providerID: string\n modelID: string\n totals: UsageHistoryRpcTotals\n estimatedUsd?: number\n pricingComplete: boolean\n}\n\nexport interface UsageHistoryRpcAvailable {\n status: 'available' | 'partial'\n period: UsageHistoryRpcPeriod\n coverageStart: string | null\n partial: boolean\n truncated: boolean\n rows: number\n buckets: UsageHistoryRpcBucket[]\n totals: UsageHistoryRpcTotals\n models: UsageHistoryRpcModel[]\n pricing: {\n status: 'empty' | 'unavailable' | 'partial' | 'complete'\n complete: boolean\n billed: false\n estimatedUsd?: number\n unpricedModels: number\n }\n}\n\nexport interface UsageHistoryRpcUnavailable {\n status: 'unavailable'\n reason: 'invalid_period' | 'history_unavailable' | 'history_timeout'\n}\n\nexport type UsageHistoryRpcResult = UsageHistoryRpcAvailable | UsageHistoryRpcUnavailable\n\nexport const USAGE_HISTORY_PERIODS: readonly UsageHistoryRpcPeriod[] = ['7d', '15d', '30d', 'total']\n\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER\nconst SAFE_LABEL = /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/\nconst ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}$/\n\nfunction safeCount(value: number, markTruncated: () => void): number {\n if (!Number.isFinite(value) || value < 0) {\n markTruncated()\n return 0\n }\n if (!Number.isSafeInteger(value)) {\n markTruncated()\n return Math.min(Math.floor(value), MAX_SAFE_INTEGER)\n }\n return value\n}\n\nfunction safeEstimate(value: number | undefined, markTruncated: () => void): number | undefined {\n if (value === undefined) return undefined\n if (!Number.isFinite(value) || value < 0) {\n markTruncated()\n return undefined\n }\n const rounded = Math.round(value * 1e8) / 1e8\n if (!Number.isFinite(rounded)) {\n markTruncated()\n return undefined\n }\n return rounded\n}\n\nfunction safeLabel(value: string, markTruncated: () => void): string {\n if (!SAFE_LABEL.test(value)) {\n markTruncated()\n return 'unknown'\n }\n return value\n}\n\nfunction projectTotals(\n value: UsageHistorySourceTotals,\n markTruncated: () => void,\n): UsageHistoryRpcTotals {\n return {\n input: safeCount(value.input, markTruncated),\n output: safeCount(value.output, markTruncated),\n cacheRead: safeCount(value.cacheRead, markTruncated),\n cacheWrite: safeCount(value.cacheWrite, markTruncated),\n total: safeCount(value.total, markTruncated),\n }\n}\n\n/** Project cost-command output to a bounded, non-identifying TUI contract. */\nexport function projectUsageHistoryResult(\n result: UsageHistorySourceResult,\n): UsageHistoryRpcAvailable {\n let unsafeOrTruncated = false\n const markTruncated = (): void => {\n unsafeOrTruncated = true\n }\n const sourceBuckets = result.buckets\n const sourceModels = result.models\n if (sourceBuckets.length > MAX_HISTORY_BUCKETS || sourceModels.length > MAX_HISTORY_MODELS) {\n markTruncated()\n }\n const buckets = sourceBuckets.slice(-MAX_HISTORY_BUCKETS).flatMap((bucket) => {\n if (!ISO_DATE.test(bucket.date)) {\n markTruncated()\n return []\n }\n const estimatedUsd = safeEstimate(bucket.estimatedUsd, markTruncated)\n return [\n {\n date: bucket.date,\n ...projectTotals(bucket, markTruncated),\n ...(estimatedUsd === undefined ? {} : { estimatedUsd }),\n pricingComplete: bucket.pricingComplete === true,\n },\n ]\n })\n const models = sourceModels.slice(0, MAX_HISTORY_MODELS).map((model) => {\n const estimatedUsd = safeEstimate(model.estimatedUsd, markTruncated)\n return {\n providerID: safeLabel(model.providerID, markTruncated),\n modelID: safeLabel(model.modelID, markTruncated),\n totals: projectTotals(model.totals, markTruncated),\n ...(estimatedUsd === undefined ? {} : { estimatedUsd }),\n pricingComplete: model.pricingComplete === true,\n }\n })\n let coverageStart = result.coverageStart\n if (coverageStart !== null && !ISO_DATE.test(coverageStart)) {\n markTruncated()\n coverageStart = null\n }\n const pricingEstimate = safeEstimate(result.pricing.estimatedUsd, markTruncated)\n const rows = safeCount(result.rows, markTruncated)\n const totals = projectTotals(result.totals, markTruncated)\n const unpricedModels = safeCount(result.pricing.unpricedModels, markTruncated)\n const truncated = unsafeOrTruncated\n return {\n status: result.partial || truncated ? 'partial' : 'available',\n period: result.period,\n coverageStart,\n partial: result.partial,\n truncated,\n rows,\n buckets,\n totals,\n models,\n pricing: {\n status: result.pricing.status,\n complete: result.pricing.complete === true,\n billed: false,\n ...(pricingEstimate === undefined ? {} : { estimatedUsd: pricingEstimate }),\n unpricedModels,\n },\n }\n}\n\nexport function isUsageHistoryPeriod(value: unknown): value is UsageHistoryRpcPeriod {\n return typeof value === 'string' && USAGE_HISTORY_PERIODS.includes(value as UsageHistoryRpcPeriod)\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { i as projectUsageHistoryResult, r as isUsageHistoryPeriod } from "./usage-history-contract-nt1rnBPE.js";
|
|
2
|
+
import { n as queryUsageHistory, r as resolveCostDbPath } from "./cost-data-CCZUs1aJ.js";
|
|
3
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
4
|
+
//#region src/usage-history-worker.ts
|
|
5
|
+
const port = parentPort;
|
|
6
|
+
if (port) (async () => {
|
|
7
|
+
try {
|
|
8
|
+
const input = workerData;
|
|
9
|
+
if (!isUsageHistoryPeriod(input.period)) {
|
|
10
|
+
port.postMessage({ ok: false });
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const result = await queryUsageHistory(resolveCostDbPath(), input.period);
|
|
14
|
+
port.postMessage({
|
|
15
|
+
ok: true,
|
|
16
|
+
result: projectUsageHistoryResult(result)
|
|
17
|
+
});
|
|
18
|
+
} catch {
|
|
19
|
+
port.postMessage({ ok: false });
|
|
20
|
+
}
|
|
21
|
+
})();
|
|
22
|
+
//#endregion
|
|
23
|
+
export {};
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=usage-history-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage-history-worker.js","names":[],"sources":["../src/usage-history-worker.ts"],"sourcesContent":["import { parentPort, workerData } from 'node:worker_threads'\nimport { queryUsageHistory, resolveCostDbPath } from './cost-data'\nimport { isUsageHistoryPeriod, projectUsageHistoryResult } from './usage-history-contract'\n\ninterface UsageHistoryWorkerInput {\n period?: unknown\n}\n\nconst port = parentPort\nif (port) {\n void (async () => {\n try {\n const input = workerData as UsageHistoryWorkerInput\n if (!isUsageHistoryPeriod(input.period)) {\n port.postMessage({ ok: false })\n return\n }\n const result = await queryUsageHistory(resolveCostDbPath(), input.period)\n port.postMessage({ ok: true, result: projectUsageHistoryResult(result) })\n } catch {\n // Database errors may contain the local path, SQL, or private ledger data.\n port.postMessage({ ok: false })\n }\n })()\n}\n"],"mappings":";;;;AAQA,MAAM,OAAO;AACb,IAAI,MACF,CAAM,YAAY;CAChB,IAAI;EACF,MAAM,QAAQ;EACd,IAAI,CAAC,qBAAqB,MAAM,MAAM,GAAG;GACvC,KAAK,YAAY,EAAE,IAAI,MAAM,CAAC;GAC9B;EACF;EACA,MAAM,SAAS,MAAM,kBAAkB,kBAAkB,GAAG,MAAM,MAAM;EACxE,KAAK,YAAY;GAAE,IAAI;GAAM,QAAQ,0BAA0B,MAAM;EAAE,CAAC;CAC1E,QAAQ;EAEN,KAAK,YAAY,EAAE,IAAI,MAAM,CAAC;CAChC;AACF,EAAA,CAAG"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon-tui",
|
|
3
|
-
"version": "1.6.2-beta.
|
|
3
|
+
"version": "1.6.2-beta.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pantheon-tui",
|
|
9
|
-
"version": "1.6.2-beta.
|
|
9
|
+
"version": "1.6.2-beta.3",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@opencode-ai/plugin": "1.18.33",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"solid-js": "1.9.12"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
+
"@profullstack/hqtui": "0.11.1",
|
|
19
20
|
"rolldown-plugin-solid": "0.2.1",
|
|
20
21
|
"tsdown": "0.23.0"
|
|
21
22
|
},
|
|
@@ -2469,6 +2470,20 @@
|
|
|
2469
2470
|
"node": ">=14"
|
|
2470
2471
|
}
|
|
2471
2472
|
},
|
|
2473
|
+
"node_modules/@profullstack/hqtui": {
|
|
2474
|
+
"version": "0.11.1",
|
|
2475
|
+
"resolved": "https://registry.npmjs.org/@profullstack/hqtui/-/hqtui-0.11.1.tgz",
|
|
2476
|
+
"integrity": "sha512-c/UzTmiRDjdLZQEO/gdVinUKtx6Q0WBPdixIm90MBTvC3DqFPqpersRs0BIDPS7XVokCSr1DtELI91kj5J1kCg==",
|
|
2477
|
+
"dev": true,
|
|
2478
|
+
"license": "MIT",
|
|
2479
|
+
"bin": {
|
|
2480
|
+
"hqtui": "bin/hqtui.mjs"
|
|
2481
|
+
},
|
|
2482
|
+
"engines": {
|
|
2483
|
+
"bun": ">=1.1",
|
|
2484
|
+
"node": ">=22.6"
|
|
2485
|
+
}
|
|
2486
|
+
},
|
|
2472
2487
|
"node_modules/@quansync/fs": {
|
|
2473
2488
|
"version": "1.0.0",
|
|
2474
2489
|
"resolved": "https://registry.npmjs.org/@quansync/fs/-/fs-1.0.0.tgz",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon-tui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.6.2-beta.
|
|
4
|
+
"version": "1.6.2-beta.3",
|
|
5
5
|
"description": "Pantheon TUI plugin — V1 rich sidebar and usage gauges; native V2 status, session and delegation sidebar",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"src",
|
|
19
19
|
"tui.ts",
|
|
20
20
|
"tui-v2.ts",
|
|
21
|
-
"index-v2.ts"
|
|
21
|
+
"index-v2.ts",
|
|
22
|
+
"THIRD_PARTY_NOTICES.md"
|
|
22
23
|
],
|
|
23
24
|
"scripts": {
|
|
24
25
|
"build": "tsdown",
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
"solid-js": "1.9.12"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
34
|
+
"@profullstack/hqtui": "0.11.1",
|
|
33
35
|
"rolldown-plugin-solid": "0.2.1",
|
|
34
36
|
"tsdown": "0.23.0"
|
|
35
37
|
},
|