@tech-leads-club/harness-toolkit 0.10.5 → 0.11.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.
Files changed (81) hide show
  1. package/README.md +6 -4
  2. package/bin/tlc-cli.ts +73 -12
  3. package/capabilities/catalog.json +18 -1
  4. package/dist/compact-before.mjs +80 -79
  5. package/dist/doctor.mjs +83 -82
  6. package/dist/init-project.mjs +86 -85
  7. package/dist/install-runtime.mjs +80 -79
  8. package/dist/lessons-cli.mjs +82 -81
  9. package/dist/new-provider.mjs +126 -0
  10. package/dist/obs-cli.mjs +86 -85
  11. package/dist/price-lookup.mjs +1 -1
  12. package/dist/prompt-submit.mjs +80 -79
  13. package/dist/refresh-model-prices.mjs +80 -79
  14. package/dist/response-after.mjs +80 -79
  15. package/dist/run.mjs +80 -79
  16. package/dist/session-end.mjs +85 -84
  17. package/dist/session-start.mjs +87 -86
  18. package/dist/shim.mjs +81 -80
  19. package/dist/ship-gate.mjs +80 -79
  20. package/dist/stop.mjs +86 -85
  21. package/dist/subagent-start.mjs +80 -79
  22. package/dist/subagent-stop.mjs +81 -80
  23. package/dist/support.mjs +84 -83
  24. package/dist/tlc-cli.mjs +224 -96
  25. package/dist/tool-after.mjs +80 -79
  26. package/dist/tool-before.mjs +81 -80
  27. package/dist/tool-failure.mjs +80 -79
  28. package/dist/uninstall-runtime.mjs +4 -4
  29. package/docs/architecture.md +16 -3
  30. package/docs/concepts.md +11 -0
  31. package/docs/log.md +8 -0
  32. package/docs/providers/claude-code.md +42 -21
  33. package/docs/providers/cursor.md +23 -7
  34. package/docs/troubleshooting.md +1 -0
  35. package/package.json +1 -1
  36. package/schema.json +12 -0
  37. package/skills/harness-init/references/capabilities.md +1 -0
  38. package/src/contracts/capabilities.ts +8 -1
  39. package/src/contracts/decision.ts +2 -1
  40. package/src/core/core.facade.ts +14 -0
  41. package/src/core/floor/floor.catalog.ts +5 -0
  42. package/src/core/floor/floor.paths.ts +17 -1
  43. package/src/core/floor/floor.policy-surface.ts +26 -9
  44. package/src/core/floor/floor.service.ts +37 -5
  45. package/src/core/gate/gate.lock.ts +8 -32
  46. package/src/core/handoff/handoff.service.ts +110 -27
  47. package/src/core/handoff/handoff.session-store.ts +200 -0
  48. package/src/core/handoff/handoff.store.ts +5 -20
  49. package/src/core/handoff/handoff.types.ts +42 -9
  50. package/src/core/policy/policy.defaults.ts +3 -0
  51. package/src/core/policy/policy.loader.ts +1 -0
  52. package/src/core/policy/policy.types.ts +4 -0
  53. package/src/core/presence/presence.service.ts +59 -13
  54. package/src/core/secret-scan/secret-scan.service.ts +96 -0
  55. package/src/core/secret-scan/secret-scan.store.ts +56 -0
  56. package/src/entrypoints/prompt-submit.ts +1 -1
  57. package/src/entrypoints/response-after.ts +4 -4
  58. package/src/entrypoints/run.ts +3 -1
  59. package/src/entrypoints/session-end.ts +1 -1
  60. package/src/entrypoints/session-start.ts +5 -4
  61. package/src/entrypoints/ship-gate.ts +2 -2
  62. package/src/entrypoints/stop.ts +18 -18
  63. package/src/entrypoints/subagent-stop.ts +4 -3
  64. package/src/entrypoints/support.ts +5 -3
  65. package/src/entrypoints/tool-after.ts +21 -1
  66. package/src/entrypoints/tool-before.ts +2 -1
  67. package/src/platform/paths.ts +4 -0
  68. package/src/platform/process.ts +36 -0
  69. package/src/providers/claude/claude.capabilities.ts +3 -1
  70. package/src/providers/claude/claude.inbound.ts +37 -22
  71. package/src/providers/claude/claude.outbound.ts +4 -0
  72. package/src/providers/claude/claude.wiring.ts +4 -0
  73. package/src/providers/claude/index.ts +2 -1
  74. package/src/providers/cursor/cursor.capabilities.ts +3 -1
  75. package/src/providers/cursor/cursor.inbound.ts +1 -1
  76. package/src/providers/cursor/cursor.outbound.ts +9 -0
  77. package/src/providers/cursor/cursor.wiring.ts +9 -1
  78. package/src/providers/cursor/index.ts +2 -1
  79. package/src/providers/provider.degrade.ts +19 -0
  80. package/src/providers/provider.port.ts +1 -0
  81. package/tools/new-provider.ts +251 -0
@@ -1,2 +1,2 @@
1
1
  import{createRequire as T}from"node:module";var _=T(import.meta.url);function C(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 F(P,G=E){G(`${JSON.stringify(P)}
2
- `)}function E(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 b}from"node:os";import{delimiter as r,dirname as n,join as D,resolve as t}from"node:path";function H(){return D(b(),".tlc","harness")}function S(P=process.env){return P.TLC_HOME??H()}function U(P=process.env){return P.TLC_HOME_FROM_ENV==="0"?H():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 u(){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=u(),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 c(P){let G=P[0];if(!G)return null;return{model:G,provider:P[1]??""}}function m(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}=C(process.argv.slice(2)),J=c(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=m(J);if(P)F(Q);else console.log(JSON.stringify(Q,null,2));if(!Q.resolved)process.exit(2)}if(_.main==_.module)l();export{c as parsePriceLookupArgs,m as lookupPrice};
2
+ `)}function E(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 b}from"node:os";import{delimiter as r,dirname as n,join as D,resolve as t}from"node:path";function H(){return D(b(),".tlc","harness")}function S(P=process.env){return P.TLC_HOME??H()}function U(P=process.env){return P.TLC_HOME_FROM_ENV==="0"?H():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 u(){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=u(),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 c(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}=C(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=c(J);if(P)F(Q);else console.log(JSON.stringify(Q,null,2));if(!Q.resolved)process.exit(2)}if(_.main==_.module)l();export{m as parsePriceLookupArgs,c as lookupPrice};