@humain/humain-code 0.4.9 → 0.4.11

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 (112) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/bundle/agent-monitor.js +1 -1
  3. package/dist/bundle/chunks/bedrock-converse-stream.js +39 -45
  4. package/dist/bundle/chunks/{chunk-KRMTBTWU.js → chunk-77EWF2NW.js} +1 -1
  5. package/dist/bundle/chunks/{chunk-RBKDBF5G.js → chunk-AS2Y2MO6.js} +36 -36
  6. package/dist/bundle/chunks/{chunk-P4YMUUSK.js → chunk-DX3OMELJ.js} +741 -733
  7. package/dist/bundle/chunks/{chunk-W2QRCQBX.js → chunk-FF26YENK.js} +3 -4
  8. package/dist/bundle/chunks/{chunk-UZ5FVVCP.js → chunk-HMWAH7ZY.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-F7UMX5BV.js → chunk-HSDTSUZE.js} +13 -2
  10. package/dist/bundle/chunks/chunk-I2ZWZAIV.js +751 -0
  11. package/dist/bundle/chunks/{chunk-GUUAEK6G.js → chunk-LCOHFEZZ.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-6FVNSW6B.js → chunk-PIX6AAU6.js} +3354 -3939
  13. package/dist/bundle/chunks/{chunk-Z5LYSSTY.js → chunk-QSPDLT2R.js} +2 -2
  14. package/dist/bundle/chunks/{chunk-UBQSONVR.js → chunk-R5VIAWGA.js} +103 -145
  15. package/dist/bundle/chunks/{chunk-4LAKI5IL.js → chunk-SZRZXVVZ.js} +9 -9
  16. package/dist/bundle/chunks/{chunk-EMYNPLY5.js → chunk-V5ZF7Q7L.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-LQ4S7CRR.js → chunk-VYIIPF57.js} +1 -1
  18. package/dist/bundle/chunks/chunk-WBJN6PEI.js +43 -0
  19. package/dist/bundle/chunks/{chunk-SWRU4BOC.js → chunk-XGO43DKL.js} +1 -1
  20. package/dist/bundle/chunks/chunk-XKSDVBMN.js +28 -0
  21. package/dist/bundle/chunks/{chunk-PMISFIBM.js → chunk-XMHLSV3I.js} +1 -1
  22. package/dist/bundle/chunks/{chunk-3E4SMILM.js → chunk-YJBE3IGR.js} +14 -14
  23. package/dist/bundle/chunks/{cli-ZKT34WPW.js → cli-5ACW3WND.js} +2 -2
  24. package/dist/bundle/chunks/{compat-HEUVP6UJ.js → compat-KXKKCXPQ.js} +1 -1
  25. package/dist/bundle/chunks/{dist-NU2EIVT6.js → dist-7DVXM77G.js} +742 -615
  26. package/dist/bundle/chunks/dist-cjs-RL2OCAP2.js +179 -0
  27. package/dist/bundle/chunks/{easter-egg-3d-5KKDWEIA.js → easter-egg-3d-3L3IKAT6.js} +1 -1
  28. package/dist/bundle/chunks/{esm-NCUV2DF7.js → esm-763X2IA7.js} +1 -1
  29. package/dist/bundle/chunks/event-streams-R5OECII4.js +2 -0
  30. package/dist/bundle/chunks/{execute-OSBDNQU5.js → execute-4X6G65NZ.js} +1 -1
  31. package/dist/bundle/chunks/{extract-PYRMDATF.js → extract-DLZ425VI.js} +4 -4
  32. package/dist/bundle/chunks/github-copilot.js +32 -31
  33. package/dist/bundle/chunks/{google-generative-ai-H2F5Y5H2.js → google-generative-ai-JD2FVOIX.js} +1 -1
  34. package/dist/bundle/chunks/{google-vertex-LFWD2AOO.js → google-vertex-PFBMDCBW.js} +1 -1
  35. package/dist/bundle/chunks/{host-6ZA6LK4C.js → host-4J7H7KDS.js} +1 -1
  36. package/dist/bundle/chunks/{node-XGNY74WT.js → node-W47VUEGE.js} +1 -1
  37. package/dist/bundle/chunks/{runtime-JFLZUNYP.js → runtime-SI76JZNE.js} +1 -1
  38. package/dist/bundle/chunks/virtual-modules-E3FQAR5T.js +5 -0
  39. package/dist/bundle/cli-runtime.js +3 -3
  40. package/dist/bundle/flow/package.json +1 -1
  41. package/dist/bundle/index.js +17 -17
  42. package/dist/bundle/rpc-entry.js +3 -2
  43. package/dist/core/account-reporting.d.ts +109 -0
  44. package/dist/core/account-reporting.d.ts.map +1 -0
  45. package/dist/core/account-reporting.js +328 -0
  46. package/dist/core/account-reporting.js.map +1 -0
  47. package/dist/core/agent-session.d.ts +22 -2
  48. package/dist/core/agent-session.d.ts.map +1 -1
  49. package/dist/core/agent-session.js +131 -0
  50. package/dist/core/agent-session.js.map +1 -1
  51. package/dist/core/anthropic-account-reporting.d.ts +76 -0
  52. package/dist/core/anthropic-account-reporting.d.ts.map +1 -0
  53. package/dist/core/anthropic-account-reporting.js +380 -0
  54. package/dist/core/anthropic-account-reporting.js.map +1 -0
  55. package/dist/core/bedrock-account-reporting.d.ts +82 -0
  56. package/dist/core/bedrock-account-reporting.d.ts.map +1 -0
  57. package/dist/core/bedrock-account-reporting.js +402 -0
  58. package/dist/core/bedrock-account-reporting.js.map +1 -0
  59. package/dist/core/model-runtime.d.ts +17 -0
  60. package/dist/core/model-runtime.d.ts.map +1 -1
  61. package/dist/core/model-runtime.js +64 -10
  62. package/dist/core/model-runtime.js.map +1 -1
  63. package/dist/core/oauth-account-pool.d.ts +4 -0
  64. package/dist/core/oauth-account-pool.d.ts.map +1 -1
  65. package/dist/core/oauth-account-pool.js +10 -3
  66. package/dist/core/oauth-account-pool.js.map +1 -1
  67. package/dist/humain/flow-accounts-host.d.ts +120 -0
  68. package/dist/humain/flow-accounts-host.d.ts.map +1 -0
  69. package/dist/humain/flow-accounts-host.js +346 -0
  70. package/dist/humain/flow-accounts-host.js.map +1 -0
  71. package/dist/humain/flow-command.d.ts +28 -0
  72. package/dist/humain/flow-command.d.ts.map +1 -0
  73. package/dist/humain/flow-command.js +226 -0
  74. package/dist/humain/flow-command.js.map +1 -0
  75. package/dist/humain/flow-loader.d.ts +4 -2
  76. package/dist/humain/flow-loader.d.ts.map +1 -1
  77. package/dist/humain/flow-loader.js +120 -91
  78. package/dist/humain/flow-loader.js.map +1 -1
  79. package/dist/humain/node-account-failure.d.ts +18 -0
  80. package/dist/humain/node-account-failure.d.ts.map +1 -0
  81. package/dist/humain/node-account-failure.js +73 -0
  82. package/dist/humain/node-account-failure.js.map +1 -0
  83. package/dist/humain/node-account-fallback.d.ts +85 -0
  84. package/dist/humain/node-account-fallback.d.ts.map +1 -0
  85. package/dist/humain/node-account-fallback.js +175 -0
  86. package/dist/humain/node-account-fallback.js.map +1 -0
  87. package/dist/humain/node-http.d.ts.map +1 -1
  88. package/dist/humain/node-http.js +11 -0
  89. package/dist/humain/node-http.js.map +1 -1
  90. package/dist/humain/node-provider.d.ts +4 -0
  91. package/dist/humain/node-provider.d.ts.map +1 -1
  92. package/dist/humain/node-provider.js +11 -0
  93. package/dist/humain/node-provider.js.map +1 -1
  94. package/dist/index.d.ts +4 -0
  95. package/dist/index.d.ts.map +1 -1
  96. package/dist/index.js.map +1 -1
  97. package/dist/modes/interactive/components/login-dialog.d.ts +2 -0
  98. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  99. package/dist/modes/interactive/components/login-dialog.js +5 -0
  100. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  101. package/dist/modes/interactive/interactive-mode.d.ts +26 -0
  102. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  103. package/dist/modes/interactive/interactive-mode.js +242 -19
  104. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  105. package/docs/flow-profiles.md +57 -5
  106. package/docs/flow.md +119 -37
  107. package/docs/providers.md +37 -0
  108. package/npm-shrinkwrap.json +48 -6
  109. package/package.json +3 -2
  110. package/dist/bundle/chunks/chunk-JOKJ3CEL.js +0 -27
  111. package/dist/bundle/chunks/event-streams-CGCQQL5M.js +0 -2
  112. package/dist/bundle/chunks/virtual-modules-NPWQ6NBS.js +0 -5
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{VisualLinePreview,getTextOutput,replaceTabs,str}from"./chunk-PMISFIBM.js";import{Container,Spacer,Text,highlightCode,keyHint}from"./chunk-LQ4S7CRR.js";import{getDocsPath}from"./chunk-3E4SMILM.js";import{typebox_exports}from"./chunk-BHM75BJJ.js";function createUsageTotals(){return{input:0,output:0,cacheRead:0,cacheWrite:0,cost:0}}function addUsageToTotals(totals,usage){usage.usageIncomplete&&(totals.usageIncomplete=!0),totals.input+=usage.input,totals.output+=usage.output,totals.cacheRead+=usage.cacheRead,totals.cacheWrite+=usage.cacheWrite,totals.cost+=usage.cost.total}function combineUsage(first,second){return{...first.usageIncomplete||second.usageIncomplete?{usageIncomplete:!0}:{},input:first.input+second.input,output:first.output+second.
2
+ import{VisualLinePreview,getTextOutput,replaceTabs,str}from"./chunk-XMHLSV3I.js";import{Container,Spacer,Text,highlightCode,keyHint}from"./chunk-VYIIPF57.js";import{getDocsPath}from"./chunk-YJBE3IGR.js";import{typebox_exports}from"./chunk-BHM75BJJ.js";function createUsageTotals(){return{input:0,output:0,cacheRead:0,cacheWrite:0,cost:0}}function addUsageToTotals(totals,usage){usage.usageIncomplete&&(totals.usageIncomplete=!0),totals.input+=usage.input,totals.output+=usage.output,totals.cacheRead+=usage.cacheRead,totals.cacheWrite+=usage.cacheWrite,totals.cost+=usage.cost.total}function combineUsage(first,second){return{...first.usageIncomplete||second.usageIncomplete?{usageIncomplete:!0}:{},input:first.input+second.input,output:first.output+second.
3
3
  output,cacheRead:first.cacheRead+second.cacheRead,cacheWrite:first.cacheWrite+second.cacheWrite,...first.cacheWrite1h!==void 0||second.cacheWrite1h!==void 0?{cacheWrite1h:(first.cacheWrite1h??0)+(second.cacheWrite1h??0)}:{},...first.reasoning!==void 0||second.reasoning!==void 0?{reasoning:(first.reasoning??0)+(second.reasoning??0)}:{},totalTokens:first.totalTokens+second.totalTokens,cost:{input:first.cost.input+second.cost.input,output:first.cost.output+second.cost.output,cacheRead:first.cost.cacheRead+
4
4
  second.cost.cacheRead,cacheWrite:first.cost.cacheWrite+second.cost.cacheWrite,total:first.cost.total+second.cost.total}}}function getUsageCostBreakdown(entries){let totalsByKey=new Map;for(let entry of entries){let key,usage;if(entry.type==="message"&&entry.message.role==="assistant"?(key=`${entry.message.provider}/${entry.message.responseModel??entry.message.model}`,usage=entry.message.usage):entry.type==="usage"?(key=`${entry.provider}/${entry.model}`,usage=entry.usage):entry.type==="message"&&
5
5
  entry.message.role==="toolResult"&&entry.message.usage?(key="Tools/summaries",usage=entry.message.usage):(entry.type==="branch_summary"||entry.type==="compaction")&&entry.usage&&(key="Tools/summaries",usage=entry.usage),!key||!usage)continue;let totals=totalsByKey.get(key);totals||(totals=createUsageTotals(),totalsByKey.set(key,totals)),addUsageToTotals(totals,usage)}return Array.from(totalsByKey,([key,totals])=>({key,...totals.usageIncomplete?{usageIncomplete:!0}:{},cost:totals.cost,tokens:totals.
@@ -120,7 +120,7 @@ Searches over deferred tool metadata with BM25 and exposes matching tools for th
120
120
  Some of the tools, such as tools of MCP servers, may not have been provided to you upfront, and you should use this tool (\`${TOOL_SEARCH_TOOL_NAME}\`) to search for the required tools. For MCP tool discovery, always use \`${TOOL_SEARCH_TOOL_NAME}\`.`;function createToolSearchToolDefinition(options={}){return{name:TOOL_SEARCH_TOOL_NAME,label:TOOL_SEARCH_TOOL_NAME,description:TOOL_SEARCH_DESCRIPTION,promptSnippet:"Search for tools that are not loaded yet and load the matches",parameters:toolSearchSchema,
121
121
  exposure:"model-only",async execute(_toolCallId,{query,limit}){if(query.trim()==="")throw new Error("query must not be empty");let max=limit??DEFAULT_TOOL_SEARCH_LIMIT;if(!Number.isInteger(max)||max<=0)throw new Error("limit must be a positive integer");let tools=options.tools?searchAndLoad(options.tools,query,max):[];return{content:[{type:"text",text:tools.length===0?"No matching tools found.":`Loaded ${tools.length} tool${tools.length===1?"":"s"}. They are available from your next call:
122
122
  ${tools.map(tool=>`- ${tool.name}: ${tool.description.trim().split(/\r?\n/)[0]}`).join(`
123
- `)}`}],details:{loaded:tools.map(tool=>tool.name)}}}}}import{join}from"node:path";function wrapToolDefinition(definition,ctxFactory){return{name:definition.name,label:definition.label,description:definition.description,parameters:definition.parameters,outputSchema:definition.outputSchema,constrainedSampling:definition.constrainedSampling,prepareArguments:definition.prepareArguments,executionMode:definition.executionMode,execute:(toolCallId,params,signal,onUpdate,ctx)=>definition.execute(toolCallId,params,signal,onUpdate,ctx??ctxFactory?.(toolCallId,signal))}}function createToolDefinitionFromAgentTool(tool){return{name:tool.name,label:tool.label,description:tool.description,parameters:tool.parameters,outputSchema:tool.outputSchema,constrainedSampling:tool.constrainedSampling,prepareArguments:tool.prepareArguments,executionMode:tool.executionMode,execute:async(toolCallId,params,signal,onUpdate)=>tool.execute(toolCallId,params,signal,onUpdate)}}var loadCodemodeExecutor=()=>import("./execute-OSBDNQU5.js");var CODE_PREVIEW_LINES=10,CALL_PREVIEW_COUNT=8,OUTPUT_PREVIEW_LINES=5,COLLAPSED_ARGS_CHARS=80,SCRIPT_HEADER=/^Script (completed|failed)\nWall time [\d.]+ seconds\nOutput:\n$/;function expandHint(theme,hidden,noun){return`${theme.fg("muted",`... (${hidden} more ${noun},`)} ${keyHint("app.tools.expand","to expand")}${theme.fg("muted",")")}`}function formatDuration(ms){return ms===void 0?"":ms<1e3?`${Math.round(ms)}ms`:`${(ms/1e3).toFixed(1)}s`}function formatCost(cost){return`$${cost>=.01?cost.toFixed(
123
+ `)}`}],details:{loaded:tools.map(tool=>tool.name)}}}}}import{join}from"node:path";function wrapToolDefinition(definition,ctxFactory){return{name:definition.name,label:definition.label,description:definition.description,parameters:definition.parameters,outputSchema:definition.outputSchema,constrainedSampling:definition.constrainedSampling,prepareArguments:definition.prepareArguments,executionMode:definition.executionMode,execute:(toolCallId,params,signal,onUpdate,ctx)=>definition.execute(toolCallId,params,signal,onUpdate,ctx??ctxFactory?.(toolCallId,signal))}}function createToolDefinitionFromAgentTool(tool){return{name:tool.name,label:tool.label,description:tool.description,parameters:tool.parameters,outputSchema:tool.outputSchema,constrainedSampling:tool.constrainedSampling,prepareArguments:tool.prepareArguments,executionMode:tool.executionMode,execute:async(toolCallId,params,signal,onUpdate)=>tool.execute(toolCallId,params,signal,onUpdate)}}var loadCodemodeExecutor=()=>import("./execute-4X6G65NZ.js");var CODE_PREVIEW_LINES=10,CALL_PREVIEW_COUNT=8,OUTPUT_PREVIEW_LINES=5,COLLAPSED_ARGS_CHARS=80,SCRIPT_HEADER=/^Script (completed|failed)\nWall time [\d.]+ seconds\nOutput:\n$/;function expandHint(theme,hidden,noun){return`${theme.fg("muted",`... (${hidden} more ${noun},`)} ${keyHint("app.tools.expand","to expand")}${theme.fg("muted",")")}`}function formatDuration(ms){return ms===void 0?"":ms<1e3?`${Math.round(ms)}ms`:`${(ms/1e3).toFixed(1)}s`}function formatCost(cost){return`$${cost>=.01?cost.toFixed(
124
124
  2):cost.toPrecision(2)}`}function statusIcon(call,theme){switch(call.status){case"running":return theme.fg("warning","\u2026");case"ok":return theme.fg("success","\u2713");case"error":return theme.fg("error","\u2717");case"cancelled":return theme.fg("muted","\u2298")}}function formatCall(call,theme,expanded){let args=!expanded&&call.args.length>COLLAPSED_ARGS_CHARS?`${call.args.slice(0,COLLAPSED_ARGS_CHARS-3)}...`:call.args,duration=formatDuration(call.durationMs),line=`${statusIcon(call,theme)}\
125
125
  ${theme.fg("toolTitle",call.name)}`;return args&&(line+=` ${theme.fg("muted",args)}`),duration&&(line+=` ${theme.fg("dim",duration)}`),call.cost&&(line+=` ${theme.fg("dim",formatCost(call.cost))}`),expanded&&call.error&&(line+=`
126
126
  ${theme.fg("error",call.error.split(`