@humain/humain-code 0.8.1 → 0.8.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 +36 -0
- package/dist/bundle/chunks/{chunk-E7OBH44W.js → chunk-2XD7TLKB.js} +6 -6
- package/dist/bundle/chunks/{chunk-3CGMVKHA.js → chunk-3E37CJCE.js} +1 -1
- package/dist/bundle/chunks/{chunk-ROFZVEFN.js → chunk-4GB7A76U.js} +77 -72
- package/dist/bundle/chunks/{chunk-P2Y2H7SD.js → chunk-6JTCRCNF.js} +2 -2
- package/dist/bundle/chunks/{chunk-6TTMNQXI.js → chunk-7LSTTCSC.js} +145 -120
- package/dist/bundle/chunks/{chunk-QRRVZYTG.js → chunk-AW24RHGJ.js} +2 -2
- package/dist/bundle/chunks/{chunk-7X6DNT45.js → chunk-B3ZLWVDA.js} +8 -6
- package/dist/bundle/chunks/{chunk-APNPBT7Y.js → chunk-BRSLXHED.js} +1 -1
- package/dist/bundle/chunks/{chunk-KONLZKPL.js → chunk-E4VUW4RI.js} +1 -1
- package/dist/bundle/chunks/{chunk-NICPFMOP.js → chunk-JKX5EGOT.js} +1 -1
- package/dist/bundle/chunks/{chunk-D3KYOSQY.js → chunk-JSHKS7VH.js} +1 -1
- package/dist/bundle/chunks/{chunk-SXOIQWNX.js → chunk-JX6YIPNK.js} +1 -1
- package/dist/bundle/chunks/{chunk-WBSGWISD.js → chunk-M5TVWJ5T.js} +5 -4
- package/dist/bundle/chunks/{chunk-XZ7FTBXS.js → chunk-MUN4ZZZP.js} +1189 -1195
- package/dist/bundle/chunks/{chunk-CQ2CE3RB.js → chunk-QFDZEUFU.js} +2 -2
- package/dist/bundle/chunks/{chunk-DD5UT56Y.js → chunk-R2KD2HFT.js} +67 -66
- package/dist/bundle/chunks/chunk-S2US54IU.js +37 -0
- package/dist/bundle/chunks/{chunk-IMUFBWEK.js → chunk-T2ZGMEMV.js} +42 -41
- package/dist/bundle/chunks/{chunk-FQ4KS5S4.js → chunk-UZOIHLNU.js} +1 -1
- package/dist/bundle/chunks/{chunk-6YVORXTX.js → chunk-VSXVZVBE.js} +253 -232
- package/dist/bundle/chunks/{chunk-P42E6YY6.js → chunk-ZAHVC5V2.js} +206 -194
- package/dist/bundle/chunks/{chunk-DJG2WUNM.js → chunk-ZSWU5KKA.js} +1 -1
- package/dist/bundle/chunks/{compat-SRCNS6OQ.js → compat-4ILE5BEC.js} +1 -1
- package/dist/bundle/chunks/{dist-TRAK7EXI.js → dist-I6CI3CG5.js} +6 -6
- package/dist/bundle/chunks/{dist-4OMLHRJE.js → dist-NXHRL2KY.js} +1 -1
- package/dist/bundle/chunks/{easter-egg-3d-VVUF3C3X.js → easter-egg-3d-VZC5WOYV.js} +1 -1
- package/dist/bundle/chunks/{entry-SRYLSS5P.js → entry-6XDR2IDE.js} +1 -1
- package/dist/bundle/chunks/{execute-I3WGGPWL.js → execute-6MEJJF2T.js} +2 -2
- package/dist/bundle/chunks/{flow-implementer-4KO3Q4B5.js → flow-implementer-XOP4MG5X.js} +4 -4
- package/dist/bundle/chunks/{inprocess-TOBRVK4C.js → inprocess-MBKFGDM2.js} +4 -4
- package/dist/bundle/chunks/{interactive-mode-BJJKPBXD.js → interactive-mode-3322RQEH.js} +2 -2
- package/dist/bundle/chunks/{session-picker-4JQEGLDD.js → session-picker-EYKCMFQR.js} +1 -1
- package/dist/bundle/chunks/{startup-ui-AKTA4NDP.js → startup-ui-7ODOR34R.js} +2 -2
- package/dist/bundle/chunks/{trace-command-7ORDQ3JS.js → trace-command-VM7FBWPE.js} +4 -4
- package/dist/bundle/chunks/{virtual-modules-3CT5BMBA.js → virtual-modules-47MGUPYN.js} +8 -8
- package/dist/bundle/cli-runtime.js +3 -3
- package/dist/bundle/index.js +8 -8
- package/dist/bundle/rpc-entry.js +3 -3
- package/dist/coordination/adapter/delivery.d.ts +27 -0
- package/dist/coordination/adapter/delivery.d.ts.map +1 -1
- package/dist/coordination/adapter/delivery.js +164 -4
- package/dist/coordination/adapter/delivery.js.map +1 -1
- package/dist/coordination/adapter/index.d.ts.map +1 -1
- package/dist/coordination/adapter/index.js +31 -5
- package/dist/coordination/adapter/index.js.map +1 -1
- package/dist/coordination/adapter/presence.d.ts +5 -0
- package/dist/coordination/adapter/presence.d.ts.map +1 -1
- package/dist/coordination/adapter/presence.js +25 -3
- package/dist/coordination/adapter/presence.js.map +1 -1
- package/dist/coordination/adapter/question-routing.d.ts +7 -0
- package/dist/coordination/adapter/question-routing.d.ts.map +1 -0
- package/dist/coordination/adapter/question-routing.js +40 -0
- package/dist/coordination/adapter/question-routing.js.map +1 -0
- package/dist/coordination/adapter/receipts.d.ts +7 -0
- package/dist/coordination/adapter/receipts.d.ts.map +1 -1
- package/dist/coordination/adapter/receipts.js +25 -2
- package/dist/coordination/adapter/receipts.js.map +1 -1
- package/dist/coordination/adapter/tool.d.ts +19 -3
- package/dist/coordination/adapter/tool.d.ts.map +1 -1
- package/dist/coordination/adapter/tool.js +93 -19
- package/dist/coordination/adapter/tool.js.map +1 -1
- package/dist/coordination/client/client.d.ts +2 -2
- package/dist/coordination/client/client.d.ts.map +1 -1
- package/dist/coordination/client/client.js +4 -0
- package/dist/coordination/client/client.js.map +1 -1
- package/dist/coordination/transport/protocol.d.ts.map +1 -1
- package/dist/coordination/transport/protocol.js +23 -0
- package/dist/coordination/transport/protocol.js.map +1 -1
- package/dist/coordination/transport/types.d.ts +11 -1
- package/dist/coordination/transport/types.d.ts.map +1 -1
- package/dist/coordination/transport/types.js.map +1 -1
- package/dist/core/model-resolver.js +2 -2
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +14 -8
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/oauth-account-pool.d.ts +14 -0
- package/dist/core/oauth-account-pool.d.ts.map +1 -1
- package/dist/core/oauth-account-pool.js +166 -14
- package/dist/core/oauth-account-pool.js.map +1 -1
- package/dist/core/run-outcome.d.ts +1 -1
- package/dist/core/run-outcome.d.ts.map +1 -1
- package/dist/core/run-outcome.js +2 -2
- package/dist/core/run-outcome.js.map +1 -1
- package/dist/core/run-preflight.d.ts.map +1 -1
- package/dist/core/run-preflight.js +15 -8
- package/dist/core/run-preflight.js.map +1 -1
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +17 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +2 -0
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +10 -0
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/extensions/usage/index.js +5 -5
- package/dist/extensions/usage/index.js.map +1 -1
- package/dist/humain/gateway/client.d.ts.map +1 -1
- package/dist/humain/gateway/client.js +36 -9
- package/dist/humain/gateway/client.js.map +1 -1
- package/dist/humain/gateway/http.d.ts.map +1 -1
- package/dist/humain/gateway/http.js +26 -6
- package/dist/humain/gateway/http.js.map +1 -1
- package/dist/humain/gateway/provider.d.ts.map +1 -1
- package/dist/humain/gateway/provider.js +9 -2
- package/dist/humain/gateway/provider.js.map +1 -1
- package/dist/humain/hcode/facade.d.ts +12 -1
- package/dist/humain/hcode/facade.d.ts.map +1 -1
- package/dist/humain/hcode/facade.js +35 -8
- package/dist/humain/hcode/facade.js.map +1 -1
- package/dist/humain/hcode/login-copy.d.ts.map +1 -1
- package/dist/humain/hcode/login-copy.js +10 -0
- package/dist/humain/hcode/login-copy.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +6 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +26 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +35 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +179 -3
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/working-indicator-engine.d.ts +32 -0
- package/dist/modes/interactive/components/working-indicator-engine.d.ts.map +1 -0
- package/dist/modes/interactive/components/working-indicator-engine.js +112 -0
- package/dist/modes/interactive/components/working-indicator-engine.js.map +1 -0
- package/dist/modes/interactive/fullscreen.d.ts +13 -0
- package/dist/modes/interactive/fullscreen.d.ts.map +1 -0
- package/dist/modes/interactive/fullscreen.js +25 -0
- package/dist/modes/interactive/fullscreen.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +4 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +117 -19
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/humain-dark.json +5 -4
- package/dist/modes/interactive/theme/humain-light.json +6 -5
- package/docs/cli.md +6 -0
- package/docs/coordination.md +16 -4
- package/docs/development.md +7 -0
- package/docs/environment-variables.md +2 -1
- package/docs/providers.md +19 -5
- package/docs/settings.md +20 -0
- package/docs/usage.md +2 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/schemas/settings.schema.json +29 -0
- package/dist/bundle/chunks/chunk-UEW6TUSP.js +0 -36
- package/dist/bundle/chunks/chunk-YPZPCHNV.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
2
|
import{ALL_CAPABILITIES,CI_ID_RE,DEFAULT_PROVIDER_PREFERENCE,FLOW_APPROVED_INPUTS_FILE,LINEAGE_ENV,MAX_RECOVERY_RAW_BYTES,METHOD,THINKING_LEVELS,TIER_CAPABILITIES,TIER_LITERALS,billingRouteFor,buildAliasTable,classifyModelName,classifyTimeout,dispatchAdmissionBlocked,dispatchCustody,dispatchCustodyDiagnostic,exactModelBindingsFor,formatDuration,isCredentialName,isQuotaError,isThinkingLevel,killProcessTree,lineageMarker,listDispatchProcesses,liveDispatchPids,mergeLayers,ownedDispatchIdentities,providerFallbacksFor,
|
|
3
|
-
readFlowAssetJson,redactCheckArgv,redactCredentials,registerDispatchPid,rereviewFloor,resolveAlias,resolveExactAlias,sanitizeControlChars,sanitizeRepairFeedback,scanEvents,scanLineage,shortName,summarizeStderr,tierIndex,tierOf,tierOfModel,tiersToBindings}from"./chunk-HQMUDHC3.js";import{ScrollView,getKeybindings,truncateToWidth,visibleWidth,wrapTextWithAnsi}from"./chunk-
|
|
3
|
+
readFlowAssetJson,redactCheckArgv,redactCredentials,registerDispatchPid,rereviewFloor,resolveAlias,resolveExactAlias,sanitizeControlChars,sanitizeRepairFeedback,scanEvents,scanLineage,shortName,summarizeStderr,tierIndex,tierOf,tierOfModel,tiersToBindings}from"./chunk-HQMUDHC3.js";import{ScrollView,getKeybindings,truncateToWidth,visibleWidth,wrapTextWithAnsi}from"./chunk-M5TVWJ5T.js";import{assertDhRetryAdmission,resolveDhEffectiveTerminals}from"./chunk-L4J7SMJB.js";import{FLOW_ID_PATTERN,
|
|
4
4
|
FLOW_MODEL_ID_PATTERN,FlowContractError,FlowCountSchema,FlowDigestSchema,FlowFailureClassSchema,FlowIdSchema,FlowMicrousdSchema,FlowModelRefSchema,FlowPositiveIntSchema,FlowProfileRefSchema,FlowReasonClassSchema,FlowRoleSchema,FlowSelectionEffortSchema,FlowSizeSchema,FlowTimestampSchema,StrictObject,canonicalWithout,compileFlow,hasDuplicateModels,lit,parseFlowData,partialByRole,verifyFlowDigest}from"./chunk-PVNXN2TC.js";import{typebox_exports}from"./chunk-VEGJT52D.js";var FlowProfileError=class extends Error{code;path;constructor(code2,message,path){super(message),this.name="FlowProfileError",this.code=code2,path!==void 0&&(this.path=path)}};import{stripVTControlCharacters}from"node:util";var FlowEffortSchema=typebox_exports.Union([typebox_exports.Literal("low"),typebox_exports.Literal("medium"),typebox_exports.Literal("high")]),FlowRoleBindingSchema=StrictObject({primary:FlowModelRefSchema,backups:typebox_exports.Array(FlowModelRefSchema,{maxItems:8}),effort:FlowEffortSchema}),FLOW_MODEL_SELECTION_TIERS=["cheap","mid","premium","frontier"],FLOW_MODEL_SELECTION_CAPABILITIES=["scout","scope_scout","worker","implementation_fast","analysis_mid","technical_lead","lead_small","lead","\
|
|
5
5
|
lead_large","implementation_strong","technical_review","integration_review","migration_review","performance_review","api_contract_review","qa_agent","analysis_strong","architect","security_review","triage"],FlowTierSelectionSchema=StrictObject({primary:typebox_exports.Optional(FlowModelRefSchema),backups:typebox_exports.Optional(typebox_exports.Array(FlowModelRefSchema,{maxItems:8}))}),FlowCapabilitySelectionSchema=StrictObject({primary:typebox_exports.Optional(FlowModelRefSchema),backups:typebox_exports.
|
|
6
6
|
Optional(typebox_exports.Array(FlowModelRefSchema,{maxItems:8})),effort:typebox_exports.Optional(FlowSelectionEffortSchema)}),optionalEach=(keys,schema)=>StrictObject(Object.fromEntries(keys.map(key=>[key,typebox_exports.Optional(schema)]))),FlowModelSelectionSchema=StrictObject({tiers:typebox_exports.Optional(optionalEach(FLOW_MODEL_SELECTION_TIERS,FlowTierSelectionSchema)),capabilities:typebox_exports.Optional(optionalEach(FLOW_MODEL_SELECTION_CAPABILITIES,FlowCapabilitySelectionSchema))}),FlowProfileV1Schema=StrictObject(
|
|
@@ -1728,7 +1728,7 @@ file,{size:stat.size,mtimeMs:stat.mtimeMs,evidence}),evidence}catch{return unava
|
|
|
1728
1728
|
]`,i=close}else re+=ch.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${re}$`)},matches=["/"];for(let component of word.split("/").filter(Boolean)){let next=[];for(let dir of matches){if(!/[*?[]/.test(component)){let path=`${dir==="/"?"":dir}/${component}`;(component==="."||component===".."||existsSync6(path))&&next.push(path);continue}let entries;try{entries=readdirSync4(dir)}catch{continue}let re=pattern(component);for(let entry of entries)(component.startsWith(".")||!entry.startsWith(
|
|
1729
1729
|
"."))&&re.test(entry)&&next.push(`${dir==="/"?"":dir}/${entry}`)}if(matches=next,!matches.length)return word;if(matches.length>64)return null}return matches.length===1?matches[0]:null}function resolveCdTarget(raw){if(!raw.startsWith("/"))return{uncertain:raw};let components=raw.split("/").filter(c=>c!==""),current="/";for(let i=0;i<components.length;i++){let component=components[i];if(component===".")continue;if(component===".."){current=dirname11(current);continue}let next=join15(current,component);
|
|
1730
1730
|
try{current=realpathSync7(next)}catch(err){if(err.code!=="ENOENT")return{uncertain:raw};try{return lstatSync9(next),{uncertain:raw}}catch{}let rest=components.slice(i);return rest.includes("..")?{uncertain:raw}:{path:join15(current,...rest.filter(c=>c!=="."))}}}return{path:current}}function hasGitEntryAbove(abs){for(let dir=abs;;dir=dirname11(dir)){try{return lstatSync9(join15(dir,".git")),!0}catch(error){let code2=error.code;if(code2!=="ENOENT"&&code2!=="ENOTDIR")return!0}if(dirname11(dir)===dir)
|
|
1731
|
-
return!1}}function dispatchRepairChildren(tasks,deps){return deps.dispatchParallel(deps.cwd,deps.runId,tasks,deps.adapter,deps.ctx,deps.run)}function createChildDispatch(deps){let inProcess=process.env.HUMAIN_TERMINAL_FLOW_INPROCESS==="1";return async(tasks,input)=>{for(let task of tasks)task.trace?.logicalTaskId&&deps.repairBudget.inherit(task.trace.logicalTaskId,task.taskId);if(inProcess&&input&&tasks.length===1&&tasks[0].stage==="implementation"){let{inProcessContext}=await import("./inprocess-
|
|
1731
|
+
return!1}}function dispatchRepairChildren(tasks,deps){return deps.dispatchParallel(deps.cwd,deps.runId,tasks,deps.adapter,deps.ctx,deps.run)}function createChildDispatch(deps){let inProcess=process.env.HUMAIN_TERMINAL_FLOW_INPROCESS==="1";return async(tasks,input)=>{for(let task of tasks)task.trace?.logicalTaskId&&deps.repairBudget.inherit(task.trace.logicalTaskId,task.taskId);if(inProcess&&input&&tasks.length===1&&tasks[0].stage==="implementation"){let{inProcessContext}=await import("./inprocess-MBKFGDM2.js");
|
|
1732
1732
|
return deps.dispatchParallel(deps.cwd,deps.runId,tasks,deps.adapter,inProcessContext(deps.ctx,input),deps.run)}return deps.dispatchParallel(deps.cwd,deps.runId,tasks,deps.adapter,deps.ctx,deps.run)}}var RETRY_SUFFIX=/-retry-(\d+)$/;function leadTaskIdFor(taskId){return taskId.replace(RETRY_SUFFIX,"")}function retryNumberFor(taskId){let m=RETRY_SUFFIX.exec(taskId);return m?Number(m[1]):null}var ESCALATION_RETRY_LABEL=/^retry-\d+$/;function finalAttemptFor(attempts){let last=attempts[attempts.length-1];if(last.result.exitCode===0)return{final:last.result,succeeded:!0};for(let i=attempts.length-2;i>=0&&attempts.slice(i+1).every(a=>ESCALATION_RETRY_LABEL.test(a.label));i--)if(attempts[i].result.
|
|
1733
1733
|
exitCode===0)return{final:attempts[i].result,succeeded:!0};return{final:last.result,succeeded:!1}}function collectLeadAttempts(leadResults,resumedAttemptResults,escalationResults,retriedLeadTaskIds=[],resumedLeadTaskIds=[]){let resumedByTaskId=new Map;for(let r of resumedAttemptResults){let list2=resumedByTaskId.get(r.taskId)??[];list2.push(r),resumedByTaskId.set(r.taskId,list2)}let retriedSet=new Set(retriedLeadTaskIds),resumedSet=new Set(resumedLeadTaskIds),retriesByLead=new Map;for(let r of escalationResults){
|
|
1734
1734
|
if(retryNumberFor(r.taskId)===null)continue;let leadTaskId=leadTaskIdFor(r.taskId),list2=retriesByLead.get(leadTaskId)??[];list2.push(r),retriesByLead.set(leadTaskId,list2)}for(let list2 of retriesByLead.values())list2.sort((a,b)=>(retryNumberFor(a.taskId)??0)-(retryNumberFor(b.taskId)??0));return leadResults.map(r=>{let leadTaskId=r.taskId,attempts=[...resumedByTaskId.get(leadTaskId)??[],r].map((result,i)=>({label:i===0?"original":resumedSet.has(leadTaskId)&&i===1?"resume":retriedSet.has(leadTaskId)?
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{ANTHROPIC_USAGE_PROVIDER_ID,HCODE_PROVIDER,fetchWithRetry,getCodexAvailability,getPiUserAgent,isWSL,parseAnthropicSubscriptionUsage,parseSubscriptionCreditAmount}from"./chunk-
|
|
3
|
-
import{getThemeInstance,keyHint,theme}from"./chunk-
|
|
2
|
+
import{ANTHROPIC_USAGE_PROVIDER_ID,HCODE_PROVIDER,fetchWithRetry,getCodexAvailability,getPiUserAgent,isWSL,parseAnthropicSubscriptionUsage,parseSubscriptionCreditAmount}from"./chunk-ZAHVC5V2.js";import{addUsageToTotals,createUsageTotals,getSessionUsage,stripAnsi}from"./chunk-3E37CJCE.js";import{raceWithAbortSignal}from"./chunk-JWOPWHVH.js";import{areExperimentalFeaturesEnabled}from"./chunk-UZOIHLNU.js";import{hcodeDisplayName,require_semver}from"./chunk-T2ZGMEMV.js";
|
|
3
|
+
import{getThemeInstance,keyHint,theme}from"./chunk-E4VUW4RI.js";import{Container,Text,getNativeClipboard,hyperlink,sanitizeTerminalText,truncateToWidth,visibleWidth,wrapTextWithAnsi}from"./chunk-M5TVWJ5T.js";import{killTrackedDetachedChildrenAsync}from"./chunk-SKCJ25SX.js";import{APP_COMMAND,ENV_OFFLINE,ENV_SKIP_VERSION_CHECK,getVersionCheckUrl}from"./chunk-VFLVWPLZ.js";import{__toESM}from"./chunk-JXWJOIH4.js";var HCODE_LOGIN_MISMATCH_DETAILS="HUMAIN Code's sign-in settings (/api/cli/config or issuer discovery) don't match what this CLI version accepts. Update the CLI with `humain-code update`, or ask the HUMAIN Code platform team to check the server's CLI sign-in configuration.",EMPTY_REASONS={no_cli_models_approved:{reason:"no model is approved for CLI",fix:"Ask an admin to set a model to Web + CLI or CLI only in Settings > Model Access."},provider_key_not_cli_enabled:{reason:"the provider key isn't\
|
|
4
4
|
enabled for CLI",fix:"Ask an admin to enable CLI on the key in Settings > Provider Keys."},cli_capacity_unconfigured:{reason:"CLI capacity hasn't been configured",fix:"Ask the HUMAIN Code platform team to check the deployment's CLI capacity limits."},provider_key_not_dedicated:{reason:"the provider key is shared or isn't approved for CLI use",fix:"Ask an admin to configure a dedicated key for HUMAIN Code CLI."},models_not_qualified:{reason:"this server hasn't finished CLI setup for the approved\
|
|
5
5
|
models",fix:"Ask an admin to report it to the HUMAIN Code platform team."}};function hcodeEmptyCatalogMessage(reason){if(!reason)return"Your admin hasn't enabled CLI models yet.";let{reason:why,fix}=EMPTY_REASONS[reason];return`No models are available in the CLI: ${why}. ${fix}`}function hcodeEmptyCatalogReason(cause){return cause.kind==="failed"?{reason:"the model list couldn't be loaded",fix:"Check your network, VPN or Zscaler."}:cause.reason?EMPTY_REASONS[cause.reason]:{reason:"your admin ha\
|
|
6
6
|
sn't enabled CLI models yet",fix:"Ask an admin to enable a model for CLI."}}function hcodeEmptyCatalogNotice(environmentId,email,cause){let{reason,fix}=hcodeEmptyCatalogReason(cause);return[`\u2713 Signed in to ${hcodeDisplayName(environmentId)}${email?` as ${email}`:""}`,` No models available in the CLI yet: ${reason}.`,` ${fix}`," You can keep using your other providers. I'll check again automatically."," /model to retry \xB7 /login status for details"].join(`
|
|
7
|
-
`)}function hcodeLoginAvailability(readiness){if(!readiness)return{state:"pending",text:"checking connection\u2026"};switch(readiness.kind){case"ready":return{state:"ready",text:"connected"};case"unreachable":return{state:"failed",text:`Can't reach ${readiness.host}: check VPN/Zscaler [Retry]`};case"
|
|
8
|
-
|
|
7
|
+
`)}function hcodeLoginAvailability(readiness){if(!readiness)return{state:"pending",text:"checking connection\u2026"};switch(readiness.kind){case"ready":return{state:"ready",text:"connected"};case"unreachable":return{state:"failed",text:`Can't reach ${readiness.host}: check VPN/Zscaler [Retry]`};case"not-configured":return{state:"failed",text:`HUMAIN Code isn't available on ${readiness.environmentId} yet (server: hcode_unavailable). Try another environment or contact support. [Retry]`};case"http-\
|
|
8
|
+
error":return{state:"failed",text:`Sign-in server returned HTTP ${readiness.status}${readiness.message?`: ${readiness.message}`:"."} [Retry]`};case"mismatch":return{state:"failed",text:"Server sign-in settings don't match this CLI version [Details]"};case"unavailable":return{state:"failed",text:"Sign-in is not available in this environment [Retry]"}}}function hcodeSignedInElsewhereNotice(environmentId,elsewhere){let other=elsewhere[0];if(other)return`${hcodeDisplayName(environmentId)}: not signe\
|
|
9
|
+
d in. HUMAIN Code now defaults to production. Your saved sign-in is for ${hcodeDisplayName(other)} and was not moved: start humain-code with --env ${other} to use it, or /login to sign in here.`}import{randomUUID}from"node:crypto";import{unlinkSync,writeFileSync}from"node:fs";import{platform,tmpdir}from"node:os";import{join}from"node:path";import{spawn}from"node:child_process";function runClipboardCommand(command,args,options){return new Promise(resolve2=>{let child=spawn(command,args,{stdio:["pipe",options?.input===void 0?"pipe":"ignore","ignore"],cwd:"/",detached:process.platform!=="win32",windowsHide:!0}),chunks=[],length=0,settled=!1,finish=result=>{settled||(settled=!0,clearTimeout(timer),resolve2(result))},abort=()=>{child.kill("SIGKILL"),child.stdout?.destroy(),child.stdin?.destroy(),finish(void 0)},timer=setTimeout(abort,options?.
|
|
9
10
|
timeoutMs??3e3);child.on("error",()=>finish(void 0)),child.on("close",code=>{settled||finish(code===0?Buffer.concat(chunks,length):void 0)}),child.stdout?.on("data",chunk=>{settled||(length+=chunk.length,length>(options?.maxBufferBytes??50*1024*1024)?abort():chunks.push(chunk))}),child.stdin?.on("error",()=>{}),child.stdin?.end(options?.input)})}var MAX_OSC52_ENCODED_LENGTH=1e5;function isRemoteSession(env){return!!(env.SSH_CONNECTION||env.SSH_CLIENT||env.MOSH_CONNECTION||env.HUMAIN_TERMINAL_CLIPBOARD_OSC52==="1")}function emitOsc52(text){let encoded=Buffer.from(text).toString("base64");return encoded.length>MAX_OSC52_ENCODED_LENGTH?!1:(process.stdout.write(`\x1B]52;c;${encoded}\x07`),!0)}async function copyViaWindowsClipboard(text){let tmpFile=join(tmpdir(),`pi-wsl-clip-${randomUUID()}.txt`);try{writeFileSync(tmpFile,text,{encoding:"ut\
|
|
10
11
|
f8",mode:384});let winPath=(await runClipboardCommand("wslpath",["-w",tmpFile],{timeoutMs:1e3}))?.toString("utf8").trim();if(!winPath)return!1;let script=`Set-Clipboard -Value ([System.IO.File]::ReadAllText('${winPath.replaceAll("'","''")}', [System.Text.Encoding]::UTF8))`;return await runClipboardCommand("powershell.exe",["-NoProfile","-Command",script],{timeoutMs:5e3})!==void 0}catch{return!1}finally{try{unlinkSync(tmpFile)}catch{}}}async function readClipboardText(){let commands=[];process.env.
|
|
11
12
|
TERMUX_VERSION&&commands.push(["termux-clipboard-get",[]]),platform()==="linux"&&(process.env.WAYLAND_DISPLAY&&commands.push(["wl-paste",["--no-newline","--type","text"]]),process.env.DISPLAY&&commands.push(["xclip",["-selection","clipboard","-out"]],["xsel",["--clipboard","--output"]]));for(let[command,args]of commands){let bytes=await runClipboardCommand(command,args,{timeoutMs:5e3});if(bytes!==void 0)return bytes.toString("utf8")||null}try{return await getNativeClipboard()?.getText()||null}catch{
|
|
@@ -61,7 +62,8 @@ at(-1)??""}return line&&lines.push(line),lines.map(rendered=>truncateToWidth(ren
|
|
|
61
62
|
aborted,errors})=>({aborted,errors:new Map([...errors].filter(([provider])=>provider===HCODE_PROVIDER))}));let operation=raceWithAbortSignal(runtime.refresh({providers:[HCODE_PROVIDER],signal}),signal).finally(()=>this.hcodeOnlyByRuntime.delete(runtime));return this.hcodeOnlyByRuntime.set(runtime,operation),operation}refresh(modelRuntime,signal){signal.throwIfAborted();let active=this.activeByRuntime.get(modelRuntime);if(!active){let controller=new AbortController,created,hcode=this.hcodeOnlyByRuntime.
|
|
62
63
|
get(modelRuntime),operation=hcode?raceWithAbortSignal(hcode,controller.signal).then(result=>(controller.signal.throwIfAborted(),result.aborted?result:modelRuntime.refresh({signal:controller.signal}))):modelRuntime.refresh({signal:controller.signal}),promise=raceWithAbortSignal(operation,controller.signal).finally(()=>{this.activeByRuntime.get(modelRuntime)===created&&this.activeByRuntime.delete(modelRuntime)});created={controller,promise,waiters:0},active=created,this.activeByRuntime.set(modelRuntime,
|
|
63
64
|
active)}return active.waiters++,raceWithAbortSignal(active.promise,signal).finally(()=>{active.waiters--,active.waiters===0&&this.activeByRuntime.get(modelRuntime)===active&&active.controller.abort()})}},modelCatalogRefreshCoordinator=new ModelCatalogRefreshCoordinator;async function checkWatchedHcodeCatalog(modelRuntime,signal){return modelCatalogRefreshCoordinator.checkWatchedHcode(modelRuntime,signal)}async function retryHcodeCatalog(modelRuntime,signal){return modelCatalogRefreshCoordinator.
|
|
64
|
-
refreshHcode(modelRuntime,signal)}function refreshModelCatalogs(modelRuntime,signal){return modelCatalogRefreshCoordinator.refresh(modelRuntime,signal)}function refreshStartupModelCatalogs(modelRuntime,signal){return signal.throwIfAborted(),raceWithAbortSignal(modelRuntime.refresh({providers:modelRuntime.getProviders().filter(provider=>provider.id!==HCODE_PROVIDER).map(provider=>provider.id),signal}),signal)}var
|
|
65
|
+
refreshHcode(modelRuntime,signal)}function refreshModelCatalogs(modelRuntime,signal){return modelCatalogRefreshCoordinator.refresh(modelRuntime,signal)}function refreshStartupModelCatalogs(modelRuntime,signal){return signal.throwIfAborted(),raceWithAbortSignal(modelRuntime.refresh({providers:modelRuntime.getProviders().filter(provider=>provider.id!==HCODE_PROVIDER).map(provider=>provider.id),signal}),signal)}var FULLSCREEN_OVERLAY={overlay:!0,overlayOptions:{width:"100%",maxHeight:"100%",margin:0}};function fullscreenSurface(component,height){let render=component.render.bind(component);return component.render=width=>{let lines=render(width);if(lines.length===0)return[];let black="\x1B[48;2;0;0;0m";return Array.from({length:Math.max(0,height())},(_,index)=>{let line=truncateToWidth(lines[index]??"",width);return black+line.replace(/\x1b\[(?:0|49)?m/g,`$&${black}`)+" ".repeat(Math.max(0,width-visibleWidth(
|
|
66
|
+
line)))+"\x1B[0m"})},component}var AuthCommandError=class extends Error{},AUTH_COMMAND_USAGE={check:`${APP_COMMAND} auth check --provider <provider> [--json] [--credentials] [--no-refresh]`,api_key:`${APP_COMMAND} auth print-api-key --provider <provider> [--model <model>]`,bearer_token:`${APP_COMMAND} auth print-bearer-token --provider <provider> [--model <model>] [--min-expiry <duration>]`};function getAuthCommandName(kind){return kind==="check"?"auth check":kind==="api_key"?"auth print-api-key":"auth print-bearer-token"}function getAuthCommandUsage(kind){
|
|
65
67
|
return AUTH_COMMAND_USAGE[kind]}function isAuthCommandHelp(args){return args[0]==="auth"&&(args[1]===void 0||args[1]==="help"||args.includes("--help")||args.includes("-h"))}function printAuthCommandHelp(){console.log(`Usage:
|
|
66
68
|
${APP_COMMAND} auth print-api-key [--provider <provider>] [--model <model>]
|
|
67
69
|
${APP_COMMAND} auth print-bearer-token [--provider <provider>] [--model <model>] [--min-expiry <duration>]
|
|
@@ -75,4 +77,4 @@ credentials,noRefresh,minExpiryMs}}function validateAuthCommandArgs(args,kind){l
|
|
|
75
77
|
exec(authorization)?.[1]:void 0}var AuthUrlComponent=class extends Container{url;tui;hint;constructor(tui,url){super(),this.tui=tui,this.url=url,this.addChild(new Text(theme.fg("accent",hyperlink(url,url)),1,0)),this.hint=new Text("",1,0),this.addChild(this.hint),this.setHint(keyHint("app.message.copy","to copy"))}setHint(suffix){let clickHint=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open";this.hint.setText(`${theme.fg("dim",hyperlink(clickHint,this.url))} ${theme.fg("dim","\u2022")} ${suffix}`),this.tui.
|
|
76
78
|
requestRender()}async copy(){try{await copyToClipboard(this.url),this.setHint(theme.fg("success","Copied URL to clipboard"))}catch(error){this.setHint(theme.fg("error",error instanceof Error?error.message:String(error)))}}};function usagePaneRow(theme2,list,detail,listWidth){return truncateToWidth(list,listWidth,"\u2026",!0)+theme2.fg("dim"," \u2502 ")+detail}function renderUsageBar(theme2,bar,width){let fraction=bar.total&&bar.total>0?Math.min(1,Math.max(0,bar.used/bar.total)):0,filled=Math.round(fraction*width);return theme2.fg(bar.tone,"\u2588".repeat(filled))+theme2.fg("muted","\u2591".repeat(width-filled))}export{AuthCommandError,getAuthCommandName,getAuthCommandUsage,isAuthCommandHelp,printAuthCommandHelp,parseAuthCommand,validateAuthCommandArgs,getAuthCredential,HCODE_LOGIN_MISMATCH_DETAILS,hcodeEmptyCatalogMessage,hcodeEmptyCatalogReason,hcodeEmptyCatalogNotice,hcodeLoginAvailability,hcodeSignedInElsewhereNotice,runClipboardCommand,readClipboardText,readClipboardFilePaths,copyToClipboard,AuthUrlComponent,trackUserWait,currentUserWait,onUserWaitChange,bindClaudeUsageReconnect,getClaudeUsageReconnect,
|
|
77
79
|
subscriptionAccountUsage,formatOAuthAccountResetTime,formatOAuthAccountUsage,formatOAuthAccountOption,usageDisplayText,buildUsageOverview,formatUsageOverview,weeklyResetLines,paidUsageLines,claudeUsageBars,codexUsageBars,usageAge,readClaudeUsage,nextQuotaResetLines,formatVersionCheckError,isNewerPackageVersion,getLatestPiRelease,checkForNewPiVersion,waitForSignalShutdown,exitAfterSignalShutdown,usagePaneRow,renderUsageBar,formatTokens2 as formatTokens,formatCwdForFooter,FooterComponent,checkWatchedHcodeCatalog,
|
|
78
|
-
retryHcodeCatalog,refreshModelCatalogs,refreshStartupModelCatalogs};
|
|
80
|
+
retryHcodeCatalog,refreshModelCatalogs,refreshStartupModelCatalogs,FULLSCREEN_OVERLAY,fullscreenSurface};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{theme}from"./chunk-
|
|
2
|
+
import{theme}from"./chunk-E4VUW4RI.js";var ARMIN_WIDTH=31,ARMIN_HEIGHT=36,WIDTH=ARMIN_WIDTH,HEIGHT=ARMIN_HEIGHT,BITS=[255,255,255,127,255,240,255,127,255,237,255,127,255,219,255,127,255,183,255,127,255,119,254,127,63,248,254,127,223,255,254,127,223,63,252,127,159,195,251,127,111,252,244,127,247,15,247,127,247,255,247,127,247,255,227,127,247,7,232,127,239,248,103,112,15,255,187,111,241,0,208,91,253,63,236,83,193,255,239,87,159,253,238,95,159,252,174,95,31,120,172,95,63,0,80,108,127,0,220,119,255,192,63,120,255,1,248,127,255,3,156,120,
|
|
3
3
|
255,7,140,124,255,15,206,120,255,255,207,127,255,255,207,120,255,255,223,120,255,255,223,125,255,255,63,126,255,255,255,127],BYTES_PER_ROW=Math.ceil(WIDTH/8),DISPLAY_HEIGHT=Math.ceil(HEIGHT/2),EFFECTS=["typewriter","scanline","rain","fade","crt","glitch","dissolve"];function isArminPixel(x,y){if(y>=HEIGHT)return!1;let byteIndex=y*BYTES_PER_ROW+Math.floor(x/8),bitIndex=x%8;return(BITS[byteIndex]>>bitIndex&1)===0}function getChar(x,row){let upper=isArminPixel(x,row*2),lower=isArminPixel(x,row*2+1);
|
|
4
4
|
return upper&&lower?"\u2588":upper?"\u2580":lower?"\u2584":" "}function buildFinalGrid(){let grid=[];for(let row=0;row<DISPLAY_HEIGHT;row++){let line=[];for(let x=0;x<WIDTH;x++)line.push(getChar(x,row));grid.push(line)}return grid}var ArminComponent=class{ui;interval=null;effect;finalGrid;currentGrid;effectState={};cachedLines=[];cachedWidth=0;gridVersion=0;cachedVersion=-1;constructor(ui){this.ui=ui,this.effect=EFFECTS[Math.floor(Math.random()*EFFECTS.length)],this.finalGrid=buildFinalGrid(),this.
|
|
5
5
|
currentGrid=this.createEmptyGrid(),this.initEffect(),this.startAnimation()}invalidate(){this.cachedWidth=0}render(width){if(width===this.cachedWidth&&this.cachedVersion===this.gridVersion)return this.cachedLines;let padding=1,availableWidth=width-padding;this.cachedLines=this.currentGrid.map(row=>{let clipped=row.slice(0,availableWidth).join(""),padRight=Math.max(0,width-padding-clipped.length);return` ${theme.fg("accent",clipped)}${" ".repeat(padRight)}`});let message="ARMIN SAYS HI",msgPadRight=Math.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{source_default}from"./chunk-XQRYOCHA.js";import{backgroundAnsi,colorToHex,colorToOkhsl,colorToOklch,colorToRgb,foregroundAnsi,getKeybindings,getTerminalColorMode,indexedColor,mixColors,okhslColor,oklabToOkhslLightness,oklchColor,parseColor,rgbColor,styleTextWithAnsi}from"./chunk-
|
|
2
|
+
import{source_default}from"./chunk-XQRYOCHA.js";import{backgroundAnsi,colorToHex,colorToOkhsl,colorToOklch,colorToRgb,foregroundAnsi,getKeybindings,getTerminalColorMode,indexedColor,mixColors,okhslColor,oklabToOkhslLightness,oklchColor,parseColor,rgbColor,styleTextWithAnsi}from"./chunk-M5TVWJ5T.js";import{require_core}from"./chunk-DNGJMRJW.js";import{getCustomThemesDir,getThemesDir,stripBom}from"./chunk-VFLVWPLZ.js";import{__toESM}from"./chunk-JXWJOIH4.js";var import_core=__toESM(require_core(),1);var core_default=import_core.default;function bash(hljs2){let regex=hljs2.regex,VAR={},BRACED_VAR={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[VAR]}]};Object.assign(VAR,{className:"variable",variants:[{begin:regex.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},BRACED_VAR]});let SUBST={className:"subst",begin:/\$\(/,end:/\)/,contains:[hljs2.BACKSLASH_ESCAPE]},COMMENT=hljs2.inherit(hljs2.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),HERE_DOC={begin:/<<-?\s*(?=\w+)/,starts:{contains:[hljs2.END_SAME_AS_BEGIN(
|
|
3
3
|
{begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},QUOTE_STRING={className:"string",begin:/"/,end:/"/,contains:[hljs2.BACKSLASH_ESCAPE,VAR,SUBST]};SUBST.contains.push(QUOTE_STRING);let ESCAPED_QUOTE={match:/\\"/},APOS_STRING={className:"string",begin:/'/,end:/'/},ESCAPED_APOS={match:/\\'/},ARITHMETIC={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},hljs2.NUMBER_MODE,VAR]},SH_LIKE_SHELLS=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],KNOWN_SHEBANG=hljs2.
|
|
4
4
|
SHEBANG({binary:`(${SH_LIKE_SHELLS.join("|")})`,relevance:10}),FUNCTION={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[hljs2.inherit(hljs2.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},KEYWORDS3=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],LITERALS3=["true","false"],PATH_MODE={match:/(\/[a-z._-]+)+/},SHELL_BUILT_INS=["break","cd","continue","eval","exec","exit","export","getopts","hash",
|
|
5
5
|
"pwd","readonly","return","shift","test","times","trap","umask","unset"],BASH_BUILT_INS=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],ZSH_BUILT_INS=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","e\
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{DynamicBorder,KeybindingsManager}from"./chunk-
|
|
2
|
+
import{DynamicBorder,KeybindingsManager}from"./chunk-UZOIHLNU.js";import{keyHint,keyText,theme}from"./chunk-E4VUW4RI.js";import{Container,Input,Spacer,Text,fuzzyMatch,getKeybindings,truncateToWidth,visibleWidth}from"./chunk-M5TVWJ5T.js";import{canonicalizePath,getPathComparisonKey,shortenHomePath}from"./chunk-VFLVWPLZ.js";import{spawnSync}from"node:child_process";import{existsSync}from"node:fs";import{unlink}from"node:fs/promises";function normalizeWhitespaceLower(text){return text.toLowerCase().replace(/\s+/g," ").trim()}var TIER_NAME=0,TIER_TEXT=1,TIER_FUZZY=2,TIER_WEIGHT=1e6,messageTextCache=new WeakMap;function getMessageText(session){let cached=messageTextCache.get(session);return(!cached||cached.source!==session.allMessagesText)&&(cached={source:session.allMessagesText,lower:session.allMessagesText.toLowerCase()},messageTextCache.set(session,cached)),cached}function getNormalizedMessageText(session){let cached=getMessageText(
|
|
3
3
|
session);return cached.normalized??=cached.lower.replace(/\s+/g," ").trim(),cached.normalized}function tierScore(tier,score=0){return tier*TIER_WEIGHT+score}function matchLiteralToken(session,value){let name=session.name?.toLowerCase()??"";if(name.includes(value))return tierScore(TIER_NAME,fuzzyMatch(value,name).score);if(session.id.toLowerCase().includes(value)||getMessageText(session).lower.includes(value)||session.cwd.toLowerCase().includes(value))return tierScore(TIER_TEXT)}function matchFuzzyToken(session,value){
|
|
4
4
|
let literal=matchLiteralToken(session,value.toLowerCase());if(literal!==void 0)return literal;let best;for(let field of[session.name??"",session.cwd]){let m=fuzzyMatch(value,field);m.matches&&(best===void 0||m.score<best)&&(best=m.score)}return best===void 0?void 0:tierScore(TIER_FUZZY,best)}function matchPhraseToken(session,phrase){let name=normalizeWhitespaceLower(session.name??"");if(name.includes(phrase))return tierScore(TIER_NAME,fuzzyMatch(phrase,name).score);if(session.id.toLowerCase().includes(
|
|
5
5
|
phrase)||getNormalizedMessageText(session).includes(phrase)||normalizeWhitespaceLower(session.cwd).includes(phrase))return tierScore(TIER_TEXT)}function matchRegex(session,regex){if(session.name&®ex.test(session.name))return tierScore(TIER_NAME);if(regex.test(session.id)||regex.test(session.allMessagesText)||regex.test(session.cwd))return tierScore(TIER_TEXT)}function hasSessionName(session){return!!session.name?.trim()}function matchesNameFilter(session,filter){return filter==="all"?!0:hasSessionName(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{resolveSchemaRef}from"./chunk-
|
|
2
|
+
import{resolveSchemaRef}from"./chunk-6JTCRCNF.js";import{typebox_exports}from"./chunk-VEGJT52D.js";var TOOL_SEARCH_TOOL_NAME="tool_search",DEFAULT_TOOL_SEARCH_LIMIT=8,wordSegmenter=new Intl.Segmenter(void 0,{granularity:"word"}),STOP_WORDS=new Set(["a","an","and","are","as","at","be","by","for","from","in","is","it","of","on","or","that","the","this","to","with"]);function stem(term){return term.length>4&&term.endsWith("ies")?`${term.slice(0,-3)}y`:term.length>4&&/(ches|shes|sses|xes|zes)$/.test(term)?term.slice(0,-2):term.length>3&&term.endsWith("s")&&!term.endsWith("ss")?term.slice(0,-1):term}
|
|
3
3
|
function tokenize(text){let normalized=text.normalize("NFC").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().replace(/[^\p{L}\p{M}\p{N}]+/gu," ");return(/^[a-z0-9 ]*$/.test(normalized)?normalized.split(" "):Array.from(wordSegmenter.segment(normalized),segment=>segment.isWordLike?segment.segment:"")).filter(word=>word.length>0&&!STOP_WORDS.has(word)).map(word=>/^[a-z0-9]+$/.test(word)?stem(word):word)}function isObject(value){return typeof value=="obje\
|
|
4
4
|
ct"&&value!==null&&!Array.isArray(value)}function schemaText(schema,root,parts,seen){if(isObject(schema)){if(typeof schema.$ref=="string"){let target=resolveSchemaRef(schema.$ref,root);isObject(target)&&!seen.has(target)&&(seen.add(target),schemaText(target,root,parts,seen))}if(typeof schema.description=="string"&&parts.push(schema.description),isObject(schema.properties))for(let[name,property]of Object.entries(schema.properties))parts.push(name),schemaText(property,root,parts,seen);schemaText(schema.
|
|
5
5
|
items,root,parts,seen);for(let key of["anyOf","oneOf","allOf"]){let variants=schema[key];if(Array.isArray(variants))for(let variant of variants)schemaText(variant,root,parts,seen)}}}function createToolSearchDocument(tool,namespace){let parts=[tool.description];schemaText(tool.parameters,tool.parameters,parts,new Set([tool.parameters]));let namespaceText=namespace?[namespace.name,namespace.description??"",namespace.instructions??""].join(" "):"";return{name:tool.name,text:parts.filter(part=>part.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{HUMAIN_CODE_LOGO_LINES}from"./chunk-
|
|
2
|
+
import{HUMAIN_CODE_LOGO_LINES}from"./chunk-ZSWU5KKA.js";import{DynamicBorder}from"./chunk-UZOIHLNU.js";import{resolveHcodeEnvironment}from"./chunk-T2ZGMEMV.js";import{getTerminalTheme,keyHint,theme}from"./chunk-E4VUW4RI.js";import{Container,ScrollView,Spacer,Text,getKeybindings}from"./chunk-M5TVWJ5T.js";import{APP_TITLE}from"./chunk-VFLVWPLZ.js";var THEME_OPTIONS=[{value:"humain-dark",label:"HUMAIN Dark",detectedTheme:"dark"},{value:"humain-light",label:"HUMAIN Light",detectedTheme:"light"}];function getDefaultThemeIndex(terminalTheme=getTerminalTheme()){return Math.max(0,THEME_OPTIONS.findIndex(option=>option.detectedTheme===terminalTheme))}function getDefaultThemeName(terminalTheme=getTerminalTheme()){return THEME_OPTIONS[getDefaultThemeIndex(terminalTheme)].value}var FirstTimeSetupComponent=class extends Container{step;themeIndex;disclosureDisplayed=!1;disclosureText=new Text(
|
|
3
3
|
"",1,0);disclosure=new ScrollView(this.disclosureText);options;constructor(options){super(),this.options=options,this.step=options.initialStep??"theme",this.themeIndex=getDefaultThemeIndex(),this.update()}invalidate(){this.update(),super.invalidate()}render(width){if(this.step==="theme")return super.render(width);let parts=this.children.map(child=>child.render(width)),index=this.children.indexOf(this.disclosure),content=parts[index],chromeHeight=parts.reduce((height2,lines,i)=>height2+(i===index?
|
|
4
4
|
0:lines.length),0),height=this.options.tui?Math.max(1,this.options.tui.terminal.rows-chromeHeight):content.length;return this.disclosure.updateLayout(content.length,height,()=>this.options.tui?.requestRender()),parts[index]=content.slice(this.disclosure.scrollTop,this.disclosure.scrollTop+height),this.disclosureDisplayed=!0,parts.flat()}update(){this.clear(),this.addChild(new DynamicBorder),this.addChild(new Spacer(1)),this.step==="theme"?(this.addChild(new Text(theme.fg("accent",HUMAIN_CODE_LOGO_LINES.
|
|
5
5
|
join(`
|
|
@@ -935,10 +935,11 @@ this.rendered=void 0,reportRenderChange(this)}invalidate(){this.invalidateCache(
|
|
|
935
935
|
childHeight=rendered?rendered.heights[i]:child.render(contentWidth).length;if(contentY>=childY&&contentY<childY+childHeight)return dispatchMouseEvent(child,{...event,x:contentX,y:contentY-childY,width:contentWidth,height:childHeight});childY+=childHeight}}render(width){let children=this.ownChildren();if(children.length===0)return setSubtreeReportsChanges(this,children===this.childList),this.emptyLines;let contentWidth=Math.max(1,width-this.paddingX*2),leftPad=" ".repeat(this.paddingX),rendered=renderChildren(
|
|
936
936
|
children,contentWidth,this.rendered);this.rendered=rendered;let reports=children===this.childList&&(this.bgFn===void 0||this.backgroundReported);for(let child of children)setRenderOwner(child,this),reportsChanges(child)||(reports=!1);setSubtreeReportsChanges(this,reports);let childLines=rendered.lines;if(childLines.length===0)return this.emptyLines;let bgSample=this.bgFn?this.bgFn("test"):void 0,cache=this.cache&&this.cache.width===width&&this.cache.bgSample===bgSample?this.cache:void 0;if(cache?.
|
|
937
937
|
childLines===childLines)return cache.lines;let result=[],reused=cache!==void 0&&cache.childLines.length===childLines.length;for(let i=0;i<this.paddingY;i++)result.push(cache?cache.lines[i]:this.applyBg("",width));for(let i=0;i<childLines.length;i++){let line=childLines[i];cache!==void 0&&i<cache.childLines.length&&cache.childLines[i]===line?result.push(cache.lines[this.paddingY+i]):(reused=!1,result.push(this.applyBg(leftPad+line,width)))}for(let i=0;i<this.paddingY;i++)result.push(cache?cache.lines[cache.
|
|
938
|
-
lines.length-this.paddingY+i]:this.applyBg("",width));return reused?(cache.childLines=childLines,cache.lines):(flattenLines(result),this.cache={childLines,width,bgSample,lines:result},result)}applyBg(line,width){let visLen=visibleWidth(line),padNeeded=Math.max(0,width-visLen),padded=line+" ".repeat(padNeeded),result=this.bgFn?this.bgFn(padded):padded;return line.length<=INTERNED_LINE_LENGTH?internLine(result):result}};markStableRender(Box);markReportsChanges(Box);var DEFAULT_FRAMES=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],DEFAULT_INTERVAL_MS=80,STEP_FRAME_DELAY_MS=40,Loader=class extends Text{frames=[...DEFAULT_FRAMES];intervalMs=DEFAULT_INTERVAL_MS;currentFrame=0;intervalId=null;ui=null;renderIndicatorVerbatim=!1;spinnerColorFn;messageColorFn;message="Loading...";displayText="";constructor(ui,spinnerColorFn,messageColorFn,message="Loading...",indicator){super("",1,0),
|
|
939
|
-
this.messageColorFn=messageColorFn,this.message=message,this.setIndicator(indicator)}render(width){return["",...super.render(width)]}start(){this.updateDisplay(),this.restartAnimation()}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}setText(text){this.displayText=text,super.setText(text)}getDisplayText(){return this.displayText}setMessage(message){this.message=message,this.updateDisplay()}invalidate(){
|
|
940
|
-
this.renderIndicatorVerbatim=indicator!==void 0,this.frames=indicator?.frames!==void 0?[...indicator.frames]:[...DEFAULT_FRAMES],this.intervalMs=indicator?.intervalMs&&indicator.intervalMs>0?indicator.intervalMs:DEFAULT_INTERVAL_MS,this.currentFrame=0,this.start()}restartAnimation(){this.stop(),!(this.frames.length<=1)&&(this.intervalId=setInterval(()=>{this.currentFrame=(this.currentFrame+1)%this.frames.
|
|
941
|
-
let frame=this.frames[this.currentFrame]??"";return this.renderIndicatorVerbatim?frame:this.spinnerColorFn(frame)}updateDisplay(frameDelayMs){let renderedFrame=this.getRenderedIndicator(),indicator=renderedFrame.length>0?`${renderedFrame} `:"";this.setText(`${indicator}${this.messageColorFn(this.message)}`),this.ui&&(frameDelayMs!==void 0&&this.ui.requestRenderWithin?this.ui.requestRenderWithin(
|
|
938
|
+
lines.length-this.paddingY+i]:this.applyBg("",width));return reused?(cache.childLines=childLines,cache.lines):(flattenLines(result),this.cache={childLines,width,bgSample,lines:result},result)}applyBg(line,width){let visLen=visibleWidth(line),padNeeded=Math.max(0,width-visLen),padded=line+" ".repeat(padNeeded),result=this.bgFn?this.bgFn(padded):padded;return line.length<=INTERNED_LINE_LENGTH?internLine(result):result}};markStableRender(Box);markReportsChanges(Box);var DEFAULT_FRAMES=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],DEFAULT_INTERVAL_MS=80,STEP_FRAME_DELAY_MS=40,Loader=class extends Text{frames=[...DEFAULT_FRAMES];intervalMs=DEFAULT_INTERVAL_MS;minimumIntervalMs;currentFrame=0;intervalId=null;ui=null;renderIndicatorVerbatim=!1;spinnerColorFn;messageColorFn;message="Loading...";displayText="";constructor(ui,spinnerColorFn,messageColorFn,message="Loading...",indicator,minimumIntervalMs=0){super("",1,0),
|
|
939
|
+
this.minimumIntervalMs=minimumIntervalMs,this.ui=ui,this.spinnerColorFn=spinnerColorFn,this.messageColorFn=messageColorFn,this.message=message,this.setIndicator(indicator)}render(width){return["",...super.render(width)]}start(){this.updateDisplay(),this.restartAnimation()}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}setText(text){this.displayText=text,super.setText(text)}getDisplayText(){return this.displayText}setMessage(message){this.message=message,this.updateDisplay()}invalidate(){
|
|
940
|
+
super.invalidate(),this.updateDisplay()}setIndicator(indicator){this.renderIndicatorVerbatim=indicator!==void 0,this.frames=indicator?.frames!==void 0?[...indicator.frames]:[...DEFAULT_FRAMES],this.intervalMs=Math.max(this.minimumIntervalMs,indicator?.intervalMs&&indicator.intervalMs>0?indicator.intervalMs:DEFAULT_INTERVAL_MS),this.currentFrame=0,this.start()}restartAnimation(){this.stop(),!(this.frames.length<=1)&&(this.intervalId=setInterval(()=>{this.currentFrame=(this.currentFrame+1)%this.frames.
|
|
941
|
+
length,this.updateDisplay(Math.min(STEP_FRAME_DELAY_MS,this.intervalMs/2))},this.intervalMs))}getRenderedIndicator(){let frame=this.frames[this.currentFrame]??"";return this.renderIndicatorVerbatim?frame:this.spinnerColorFn(frame)}updateDisplay(frameDelayMs){let renderedFrame=this.getRenderedIndicator(),indicator=renderedFrame.length>0?`${renderedFrame} `:"";this.setText(`${indicator}${this.messageColorFn(this.message)}`),this.ui&&(frameDelayMs!==void 0&&this.ui.requestRenderWithin?this.ui.requestRenderWithin(
|
|
942
|
+
frameDelayMs):this.ui.requestRender())}};var CancellableLoader=class extends Loader{abortController=new AbortController;onAbort;get signal(){return this.abortController.signal}get aborted(){return this.abortController.signal.aborted}handleInput(data){getKeybindings().matches(data,"tui.select.cancel")&&(this.abortController.abort(),this.onAbort?.())}dispose(){this.stop()}};var PASTE_MARKER_REGEX=/\[paste #(\d+)( (\+\d+ lines|\d+ chars))?\]/g,PASTE_MARKER_SINGLE=/^\[paste #(\d+)( (\+\d+ lines|\d+ chars))?\]$/;function isPasteMarker(segment){return segment.length>=10&&PASTE_MARKER_SINGLE.test(segment)}function segmentWithMarkers(text,baseSegmenter,validIds){if(validIds.size===0||!text.includes("[paste #"))return baseSegmenter.segment(text);let markers=[];for(let m of text.matchAll(PASTE_MARKER_REGEX)){let id=Number.parseInt(m[1],10);validIds.has(id)&&markers.push({start:m.
|
|
942
943
|
index,end:m.index+m[0].length})}if(markers.length===0)return baseSegmenter.segment(text);let baseSegments=baseSegmenter.segment(text),result=[],markerIdx=0;for(let seg of baseSegments){for(;markerIdx<markers.length&&markers[markerIdx].end<=seg.index;)markerIdx++;let marker=markerIdx<markers.length?markers[markerIdx]:null;if(marker&&seg.index>=marker.start&&seg.index<marker.end){if(seg.index===marker.start){let markerText=text.slice(marker.start,marker.end);result.push({segment:markerText,index:marker.
|
|
943
944
|
start,input:text})}}else result.push(seg)}return result}function graphemeAt(text,index){let code=text.charCodeAt(index);if(code>=55296&&code<=56319){let next=text.charCodeAt(index+1);if(next>=56320&&next<=57343)return getGraphemeSegmenter().segment(text).containing(index+1)}return getGraphemeSegmenter().segment(text).containing(index)}function wordWrapLine(line,maxWidth,preSegmented){if(!line||maxWidth<=0)return[{text:"",startIndex:0,endIndex:0}];if(!preSegmented){let standaloneWidth=standaloneTextWidth(
|
|
944
945
|
line);if(canWrapStandalone(line,standaloneWidth,maxWidth))return wordWrapStandaloneLine(line,maxWidth,standaloneWidth)}if(visibleWidth(line)<=maxWidth)return[{text:line,startIndex:0,endIndex:line.length}];let chunks=[],segments=preSegmented??[...getGraphemeSegmenter().segment(line)],currentWidth=0,chunkStart=0,wrapOppIndex=-1,wrapOppWidth=0;for(let i=0;i<segments.length;i++){let seg=segments[i],grapheme=seg.segment,gWidth=visibleWidth(grapheme),charIndex=seg.index,isWs=!isPasteMarker(grapheme)&&
|