@tech-leads-club/harness-toolkit 0.4.0 → 0.4.2
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/bin/tlc-cli.ts +70 -18
- package/dist/compact-before.mjs +60 -60
- package/dist/doctor.mjs +77 -77
- package/dist/help-topic.mjs +3 -3
- package/dist/init-project.mjs +86 -86
- package/dist/install-runtime.mjs +76 -76
- package/dist/lessons-cli.mjs +82 -82
- package/dist/obs-cli.mjs +73 -73
- package/dist/price-lookup.mjs +2 -2
- package/dist/prompt-submit.mjs +60 -60
- package/dist/refresh-model-prices.mjs +69 -69
- package/dist/response-after.mjs +61 -61
- package/dist/run.mjs +61 -61
- package/dist/session-end.mjs +65 -65
- package/dist/session-start.mjs +66 -66
- package/dist/shim.mjs +74 -74
- package/dist/stop.mjs +70 -70
- package/dist/subagent-start.mjs +59 -59
- package/dist/subagent-stop.mjs +61 -61
- package/dist/support.mjs +71 -71
- package/dist/tlc-cli.mjs +94 -94
- package/dist/tool-after.mjs +58 -58
- package/dist/tool-before.mjs +69 -69
- package/dist/tool-failure.mjs +60 -60
- package/dist/uninstall-runtime.mjs +4 -4
- package/package.json +1 -1
- package/src/core/core.facade.ts +7 -0
- package/src/core/policy/policy.integrity.ts +13 -1
- package/src/core/policy/policy.shadow.ts +36 -40
- package/src/platform/paths.ts +85 -3
- package/src/providers/index.ts +1 -0
- package/tools/doctor.ts +12 -33
- package/tools/install-runtime.ts +15 -21
package/dist/price-lookup.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as T}from"node:module";var
|
|
2
|
-
`)}function
|
|
1
|
+
import{createRequire as T}from"node:module";var _=T(import.meta.url);function H(P){let G=[],J=!1;for(let Q of P){if(Q==="--json"){J=!0;continue}G.push(Q)}return{json:J,rest:G}}function C(P,G=D){G(`${JSON.stringify(P)}
|
|
2
|
+
`)}function D(P){process.stdout.write(P)}import{existsSync as z,readFileSync as f}from"node:fs";import{join as k}from"node:path";import{homedir as E}from"node:os";import{delimiter as r,dirname as n,join as b,resolve as t}from"node:path";function F(){return b(E(),".tlc","harness")}function S(P=process.env){return P.TLC_HOME??F()}function U(P=process.env){return P.TLC_HOME_FROM_ENV==="0"?F():S(P)}var j="litellm",p={"cursor-grok-4.5":"grok-4.5",auto:"auto-cost"};function x(P){if(!P)return{};let{_meta:G,...J}=P;return J}function L(P){return P.trim().toLowerCase().replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[[\]]/g,"").replace(/[^a-z0-9.+]+/g,"-").replace(/^-+|-+$/g,"")}function g(P,G){let J=P.trim(),Q=[],Y=(V)=>{if(V&&!Q.includes(V))Q.push(V)};if(Y(J),Y(G[J]),Y(L(J)),Y(G[L(J)]),J.includes("/"))Y(J.slice(J.lastIndexOf("/")+1));let K=J.replace(/-(high|medium|low|max|fast|thinking)$/i,"");if(K!==J)Y(K),Y(G[K]),Y(L(K));return Q}function W(P,G){let J=P[G];if(J)return{key:G,entry:J};for(let[Q,Y]of Object.entries(P))if(G.startsWith(Q)||Q.startsWith(G))return{key:Q,entry:Y};return}function v(){return k(U(),"model-prices.json")}function y(){return k(U(),"model-prices.local.json")}var A=new Map;function N(P){if(!z(P))return A.delete(P),null;let G;try{G=f(P,"utf8")}catch{return A.delete(P),null}let J=A.get(P);if(J&&J.text===G)return J.value;let Q;try{Q=JSON.parse(G)}catch{return A.delete(P),null}return A.set(P,{text:G,value:Q}),Q}function c(){return N(v())??{}}function O(P,G){return x(P.planes?.[G]??null)}function M(P,G){let J=G.trim();if(!J)return;let Q=c(),Y=x(N(y())),K=P?O(Q,P):{},V=O(Q,j),B=g(J,p);for(let $ of B){let q=Y[$];if(q)return{entry:q,key:$,source:"override"}}for(let $ of B){let q=K[$];if(q)return{entry:q,key:$,source:"provider"}}for(let $ of B){let q=V[$];if(q)return{entry:q,key:$,source:"litellm"}}let Z=L(J),I=W(Y,Z);if(I)return{...I,source:"override"};let X=W(K,Z);if(X)return{...X,source:"provider"};let R=W(V,Z);if(R)return{...R,source:"litellm"};return}function w(P,G,J){let Q=J.inputTokens??0,Y=J.outputTokens??0,K=J.cacheReadTokens??0,V=J.cacheWriteTokens??0;if(!G||Q<=0&&Y<=0&&K<=0&&V<=0)return{costUsd:null,billing:"unknown",pool:"unknown",source:"missing"};let B=M(P,G);if(!B)return{costUsd:null,billing:"unknown",pool:"unknown",source:"missing"};let{entry:Z,key:I,source:X}=B,R=Z.pool??"unknown";if(Z.billing==="included")return{costUsd:null,billing:"included",pool:R,source:X,catalogKey:I};if(typeof Z.promptPer1M!=="number"||typeof Z.completionPer1M!=="number")return{costUsd:null,billing:Z.billing??"unknown",pool:R,source:X,catalogKey:I};let $=Q/1e6*Z.promptPer1M+Y/1e6*Z.completionPer1M;if(typeof Z.cacheReadPer1M==="number"&&K>0)$+=K/1e6*Z.cacheReadPer1M;if(typeof Z.cacheWritePer1M==="number"&&V>0)$+=V/1e6*Z.cacheWritePer1M;return{costUsd:$,billing:"metered",pool:R,source:X,catalogKey:I}}function m(P){let G=P[0];if(!G)return null;return{model:G,provider:P[1]??""}}function u(P){let G=M(P.provider,P.model),J=w(P.provider,P.model,{inputTokens:1e6,outputTokens:1e6});return{model:P.model,provider:P.provider,resolved:G,per1M:J}}function l(){let{json:P,rest:G}=H(process.argv.slice(2)),J=m(G);if(!J)console.error("usage: tlc harness prices lookup <model-id> [provider]"),console.error(" or: node --experimental-strip-types tools/price-lookup.ts <model-id> [provider] (dev)"),process.exit(1);let Q=u(J);if(P)C(Q);else console.log(JSON.stringify(Q,null,2));if(!Q.resolved)process.exit(2)}if(_.main==_.module)l();export{m as parsePriceLookupArgs,u as lookupPrice};
|