@humain/humain-code 0.3.8 → 0.4.1
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 +45 -0
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +45 -39
- package/dist/bundle/chunks/{chunk-REZ7FW4X.js → chunk-2KKLZK2N.js} +1 -1
- package/dist/bundle/chunks/{chunk-3ZYKCI45.js → chunk-3ZI2TEVB.js} +1 -1
- package/dist/bundle/chunks/{chunk-WQN4VIAM.js → chunk-7LDXR4AN.js} +424 -378
- package/dist/bundle/chunks/{chunk-YEG6NREY.js → chunk-DUZY4PDA.js} +16 -16
- package/dist/bundle/chunks/{chunk-QJZ5QYKE.js → chunk-E22S6D55.js} +1 -1
- package/dist/bundle/chunks/{chunk-74L7EWMA.js → chunk-E7WGCXWK.js} +1 -1
- package/dist/bundle/chunks/{chunk-MNB52OYZ.js → chunk-ERT2BD7V.js} +36 -36
- package/dist/bundle/chunks/{chunk-2KVH67UZ.js → chunk-H5CZL7M5.js} +1 -1
- package/dist/bundle/chunks/{chunk-TEOX3AWC.js → chunk-ICLZNV4V.js} +2 -2
- package/dist/bundle/chunks/{chunk-VHVY22A2.js → chunk-JQZ7BIAI.js} +2 -13
- package/dist/bundle/chunks/{chunk-HL54JCNV.js → chunk-KMMH6Z2Y.js} +3 -3
- package/dist/bundle/chunks/{chunk-6HQRNHO7.js → chunk-N23FFKJU.js} +40 -25
- package/dist/bundle/chunks/{chunk-X5JUC5RE.js → chunk-OXJXKCLB.js} +1 -1
- package/dist/bundle/chunks/{chunk-QWB2GGVH.js → chunk-OYDXJK4L.js} +731 -736
- package/dist/bundle/chunks/{chunk-7CYWKPFS.js → chunk-UBQSONVR.js} +9 -8
- package/dist/bundle/chunks/{chunk-6MMGBL46.js → chunk-VZV7GLZT.js} +2 -2
- package/dist/bundle/chunks/{chunk-FF26YENK.js → chunk-W2QRCQBX.js} +4 -3
- package/dist/bundle/chunks/{cli-5NYUGRWC.js → cli-5YRA5PFB.js} +2 -2
- package/dist/bundle/chunks/{compat-UPJNJCGF.js → compat-GXD2ZGMZ.js} +1 -1
- package/dist/bundle/chunks/dist-IKSCGVMG.js +1953 -0
- package/dist/bundle/chunks/{easter-egg-3d-XUJ4HNAR.js → easter-egg-3d-ARXMB2RN.js} +1 -1
- package/dist/bundle/chunks/{esm-763X2IA7.js → esm-NCUV2DF7.js} +1 -1
- package/dist/bundle/chunks/{event-streams-4Q22QRY2.js → event-streams-CGCQQL5M.js} +1 -1
- package/dist/bundle/chunks/{execute-IAU7EI3P.js → execute-KEUC5IWA.js} +1 -1
- package/dist/bundle/chunks/{extract-QIC545HI.js → extract-WUAT5T4V.js} +4 -4
- package/dist/bundle/chunks/{google-generative-ai-ICWD4YIE.js → google-generative-ai-MDUVUFFQ.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-XIACVW6H.js → google-vertex-UQGG6LEW.js} +1 -1
- package/dist/bundle/chunks/{host-QBIXSMNN.js → host-SPBJ4YAA.js} +1 -1
- package/dist/bundle/chunks/{node-W47VUEGE.js → node-XGNY74WT.js} +1 -1
- package/dist/bundle/chunks/{runtime-NBGMTCI6.js → runtime-HBWXEJT3.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-P2MH665T.js → virtual-modules-BYOLP3HY.js} +2 -2
- package/dist/bundle/cli-runtime.js +2 -2
- package/dist/bundle/flow/agents/.gitkeep +0 -0
- package/dist/bundle/flow/agents/orch-architect.md +33 -0
- package/dist/bundle/flow/agents/orch-implementation-fast.md +13 -0
- package/dist/bundle/flow/agents/orch-implementation-strong.md +28 -0
- package/dist/bundle/flow/agents/orch-qa-agent.md +29 -0
- package/dist/bundle/flow/agents/orch-scout.md +35 -0
- package/dist/bundle/flow/agents/orch-security-review.md +28 -0
- package/dist/bundle/flow/agents/orch-technical-lead.md +37 -0
- package/dist/bundle/flow/agents/orch-technical-review.md +28 -0
- package/dist/bundle/flow/agents/orch-worker.md +13 -0
- package/dist/bundle/flow/agents/orchestrator-lead.md +55 -0
- package/dist/bundle/flow/assets/.gitkeep +0 -0
- package/dist/bundle/flow/assets/contract.json +84 -0
- package/dist/bundle/flow/assets/forge-protocol-schema.sha256 +1 -0
- package/dist/bundle/flow/assets/method.json +193 -0
- package/dist/bundle/flow/assets/orchestrator-profiles.json +131 -0
- package/dist/bundle/flow/assets/profiles/anthropic.json +189 -0
- package/dist/bundle/flow/assets/profiles/openai.json +177 -0
- package/dist/bundle/flow/assets/profiles/oss-first.json +236 -0
- package/dist/bundle/flow/assets/profiles/premium.json +203 -0
- package/dist/bundle/flow/package.json +48 -0
- package/dist/bundle/index.js +5 -5
- package/dist/bundle/rpc-entry.js +2 -2
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +21 -0
- package/dist/config.js.map +1 -1
- package/dist/core/tools/subagent.d.ts +20 -0
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +124 -12
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/humain/flow-loader.d.ts +62 -0
- package/dist/humain/flow-loader.d.ts.map +1 -0
- package/dist/humain/flow-loader.js +291 -0
- package/dist/humain/flow-loader.js.map +1 -0
- package/dist/humain/index.d.ts.map +1 -1
- package/dist/humain/index.js +2 -0
- package/dist/humain/index.js.map +1 -1
- package/dist/humain/trace-capture/child-launch.d.ts +1 -0
- package/dist/humain/trace-capture/child-launch.d.ts.map +1 -1
- package/dist/humain/trace-capture/child-launch.js +2 -1
- package/dist/humain/trace-capture/child-launch.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +136 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/docs/docs.json +8 -0
- package/docs/environment-variables.md +1 -0
- package/docs/flow-profiles.md +173 -0
- package/docs/flow.md +112 -0
- package/docs/index.md +2 -0
- package/npm-shrinkwrap.json +6 -6
- package/package.json +6 -5
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{ENV_PREFIX,getAgentDir,getPackageDir,isBunBinary,isBunRuntime,isBundledNode}from"./chunk-
|
|
2
|
+
import{ENV_PREFIX,getAgentDir,getPackageDir,isBunBinary,isBunRuntime,isBundledNode}from"./chunk-DUZY4PDA.js";import{Compile}from"./chunk-QMUIATLD.js";import{typebox_exports}from"./chunk-BHM75BJJ.js";var FLOW_ID_PATTERN="^[a-z0-9][a-z0-9_.:-]{0,127}$",FLOW_MODEL_ID_PATTERN="^(?=.{1,128}$)[a-z0-9][a-z0-9_.:-]*(?:/[a-z0-9][a-z0-9_.:-]*)?$",FLOW_DIGEST_PATTERN="^[a-f0-9]{64}$",FLOW_TS_PATTERN="^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\d|3[01])T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d{1,9})?(?:Z|[+-](?:[01]\\d|2[0-3]):[0-5]\\d)$",FLOW_CONTRACT_ERROR_CODES={profile_invalid:"Invalid flow profile",admission_invalid:"Invalid flow run admission",event_invalid:"Invalid flow event",command_invalid:"\
|
|
3
|
+
Invalid flow control command",receipt_invalid:"Invalid flow control receipt",status_invalid:"Invalid flow status",digest_mismatch:"Flow digest mismatch",digest_unverifiable:"Flow digest cannot be verified",canonical_invalid:"Flow data cannot be canonicalized",receipt_conflict:"Flow receipt conflicts with the first receipt"},FlowContractError=class extends Error{code;constructor(code){super(FLOW_CONTRACT_ERROR_CODES[code]),this.name="FlowContractError",this.code=code}},lit=(...values)=>typebox_exports.
|
|
4
|
+
Union(values.map(value=>typebox_exports.Literal(value))),StrictObject=properties=>typebox_exports.Object(properties,{additionalProperties:!1}),FlowIdSchema=typebox_exports.String({pattern:FLOW_ID_PATTERN}),FlowDigestSchema=typebox_exports.String({pattern:FLOW_DIGEST_PATTERN}),DAYS_IN_MONTH=[31,28,31,30,31,30,31,31,30,31,30,31];function isRealCalendarDate(timestamp){let year=Number(timestamp.slice(0,4)),month=Number(timestamp.slice(5,7)),day=Number(timestamp.slice(8,10)),leap=year%4===0&&year%100!==
|
|
5
|
+
0||year%400===0;return day<=(month===2&&leap?29:DAYS_IN_MONTH[month-1]??0)}var FlowTimestampSchema=typebox_exports.Refine(typebox_exports.String({pattern:FLOW_TS_PATTERN}),isRealCalendarDate),FlowMicrousdSchema=typebox_exports.Integer({minimum:0,maximum:Number.MAX_SAFE_INTEGER}),FlowCountSchema=typebox_exports.Integer({minimum:0,maximum:Number.MAX_SAFE_INTEGER}),FlowPositiveIntSchema=typebox_exports.Integer({minimum:1,maximum:Number.MAX_SAFE_INTEGER}),FlowModelRefSchema=StrictObject({provider:FlowIdSchema,
|
|
6
|
+
model:typebox_exports.String({pattern:FLOW_MODEL_ID_PATTERN})}),FLOW_ROLES=["scout","worker","implementer","lead","lead_large","architect","reviewer","security_reviewer","qa","triage"],FlowRoleSchema=typebox_exports.Union([typebox_exports.Literal("scout"),typebox_exports.Literal("worker"),typebox_exports.Literal("implementer"),typebox_exports.Literal("lead"),typebox_exports.Literal("lead_large"),typebox_exports.Literal("architect"),typebox_exports.Literal("reviewer"),typebox_exports.Literal("sec\
|
|
7
|
+
urity_reviewer"),typebox_exports.Literal("qa"),typebox_exports.Literal("triage")]),partialByRole=schema=>StrictObject({scout:typebox_exports.Optional(schema),worker:typebox_exports.Optional(schema),implementer:typebox_exports.Optional(schema),lead:typebox_exports.Optional(schema),lead_large:typebox_exports.Optional(schema),architect:typebox_exports.Optional(schema),reviewer:typebox_exports.Optional(schema),security_reviewer:typebox_exports.Optional(schema),qa:typebox_exports.Optional(schema),triage:typebox_exports.
|
|
8
|
+
Optional(schema)});var FlowSizeSchema=typebox_exports.Union([typebox_exports.Literal("small"),typebox_exports.Literal("medium"),typebox_exports.Literal("large")]);var FlowFailureClassSchema=typebox_exports.Union([typebox_exports.Literal("provider_error"),typebox_exports.Literal("rate_limit"),typebox_exports.Literal("timeout"),typebox_exports.Literal("check_failed"),typebox_exports.Literal("review_rejected"),typebox_exports.Literal("qa_failed"),typebox_exports.Literal("budget_stop"),typebox_exports.Literal("cancelled"),typebox_exports.Literal("crash"),typebox_exports.Literal("unsafe_scope"),typebox_exports.Literal("stalled"),typebox_exports.Literal("config\
|
|
9
|
+
_invalid"),typebox_exports.Literal("internal")]),FlowReasonClassSchema=typebox_exports.Union([FlowFailureClassSchema,typebox_exports.Literal("size_underestimated")]),FlowProfileRefSchema=StrictObject({id:FlowIdSchema,version:FlowPositiveIntSchema,digest:FlowDigestSchema});function verifyFlowDigest(hasher,text,expected){let actual;try{actual=hasher.sha256Hex(text)}catch{throw new FlowContractError("digest_unverifiable")}if(typeof actual!="string")throw new FlowContractError("digest_unverifiable");
|
|
10
|
+
return actual===expected}var MAX_SNAPSHOT_DEPTH=16,MAX_SNAPSHOT_NODES=1e4,MAX_SNAPSHOT_STRING=65536;function isIndexKey(key,length){let index=Number(key);return Number.isInteger(index)&&index>=0&&index<length&&String(index)===key}function snapshotValue(value,depth,budget){if(budget.nodes+=1,depth>MAX_SNAPSHOT_DEPTH||budget.nodes>MAX_SNAPSHOT_NODES)throw new Error("bounds");if(value===null||typeof value=="boolean")return value;if(typeof value=="string"){if(value.length>MAX_SNAPSHOT_STRING||!value.
|
|
11
|
+
isWellFormed())throw new Error("string");return value}if(typeof value=="number"){if(!Number.isFinite(value))throw new Error("number");return value}if(typeof value!="object")throw new Error("type");if(Array.isArray(value)){let length=value.length;if(length>MAX_SNAPSHOT_NODES)throw new Error("bounds");for(let key of Reflect.ownKeys(value))if(typeof key!="string"||key!=="length"&&!isIndexKey(key,length))throw new Error("array");let out2=[];for(let index=0;index<length;index+=1){let descriptor=Object.
|
|
12
|
+
getOwnPropertyDescriptor(value,String(index));if(descriptor===void 0||!("value"in descriptor))throw new Error("array");out2.push(snapshotValue(descriptor.value,depth+1,budget))}return out2}let proto=Object.getPrototypeOf(value);if(proto!==null&&Object.getPrototypeOf(proto)!==null)throw new Error("prototype");let out={};for(let key of Reflect.ownKeys(value)){if(typeof key!="string"||!key.isWellFormed())throw new Error("key");let descriptor=Object.getOwnPropertyDescriptor(value,key);if(descriptor===
|
|
13
|
+
void 0||!("value"in descriptor)||descriptor.enumerable!==!0)throw new Error("property");descriptor.value!==void 0&&Object.defineProperty(out,key,{value:snapshotValue(descriptor.value,depth+1,budget),enumerable:!0,writable:!0,configurable:!0})}return out}function snapshotFlowData(input){return snapshotValue(input,0,{nodes:0})}function parseFlowData(code,input,validate){let snapshot=trySnapshotFlowData(code,input);if(!validate(snapshot))throw new FlowContractError(code);return snapshot}function trySnapshotFlowData(code,input){
|
|
14
|
+
try{return snapshotFlowData(input)}catch{throw new FlowContractError(code)}}function compileFlow(schema){return Compile(schema)}function modelKey(ref){return`${ref.provider}\0${ref.model}`}function hasDuplicateModels(refs){return new Set(refs.map(modelKey)).size!==refs.length}function canonicalFlowJson(value){if(value===null||typeof value=="boolean")return JSON.stringify(value);if(typeof value=="string"){if(!value.isWellFormed())throw new FlowContractError("canonical_invalid");return JSON.stringify(
|
|
15
|
+
value)}if(typeof value=="number"){if(!Number.isFinite(value))throw new FlowContractError("canonical_invalid");return JSON.stringify(value)}if(Array.isArray(value))return`[${value.map(canonicalFlowJson).join(",")}]`;if(typeof value!="object")throw new FlowContractError("canonical_invalid");let record=value,parts=[];for(let key of Object.keys(record).sort()){if(!key.isWellFormed())throw new FlowContractError("canonical_invalid");record[key]!==void 0&&parts.push(`${JSON.stringify(key)}:${canonicalFlowJson(
|
|
16
|
+
record[key])}`)}return`{${parts.join(",")}}`}function canonicalWithout(doc,omit){let copy={...doc};return delete copy[omit],canonicalFlowJson(copy)}var SUBAGENT_WORKER_STATUSES=["queued","waiting","running","completed","failed","cancelled","skipped","unresolved"],SUBAGENT_CANCELLATION_OUTCOMES=["none","not_started","direct_worker_terminated","unconfirmed"],SUBAGENT_FAILURE_KINDS=["spawn_failed","process_error","model_error","merge_failed"],SUBAGENT_RUN_MODES=["single","parallel","chain"];var SUBAGENT_PROGRESS_UUID_PATTERN="^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",SUBAGENT_PROGRESS_IDENTIFIER_PATTERN="^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",SUBAGENT_PROGRESS_MODEL_PATTERN="^[A-Za-z0-9][A-Za-z0-9._:/@+-]{0,127}$",SUBAGENT_PROGRESS_TOOL_CALL_ID_PATTERN="^[\\x21-\\x7E]{1,256}$",SUBAGENT_PROGRESS_TEXT_PATTERN="^[^\\u0000-\\u001F\\u007F-\\u009F\\u00AD\\u034F\\u061C\\u180E\\u200B-\\u200F\\u2028-\\u202E\\u2060-\\u2069\\uFEFF]+$",UUID_REGEX=new RegExp(SUBAGENT_PROGRESS_UUID_PATTERN),
|
|
3
17
|
IDENTIFIER_REGEX=new RegExp(SUBAGENT_PROGRESS_IDENTIFIER_PATTERN),MODEL_REGEX=new RegExp(SUBAGENT_PROGRESS_MODEL_PATTERN),TOOL_CALL_ID_REGEX=new RegExp(SUBAGENT_PROGRESS_TOOL_CALL_ID_PATTERN);function isCanonicalSubagentProgressUuid(value){return typeof value=="string"&&value.length===36&&UUID_REGEX.test(value)}var progressTextEncoder=new TextEncoder;function measureSubagentProgressJson(value){let text;try{text=JSON.stringify(value)}catch{throw invalidSnapshot()}if(typeof text!="string")throw invalidSnapshot();
|
|
4
18
|
return{utf8Bytes:progressTextEncoder.encode(text).length,codeUnits:text.length}}function isForbiddenTextCodeUnit(unit){return unit<=31||unit>=127&&unit<=159||unit===173||unit===847||unit===1564||unit===6158||unit>=8203&&unit<=8207||unit>=8232&&unit<=8238||unit>=8288&&unit<=8297||unit===65279}function isHighSurrogate(unit){return unit>=55296&&unit<=56319}function isLowSurrogate(unit){return unit>=56320&&unit<=57343}function isSubagentPresentationText(value,max){if(typeof value!="string"||value.length===
|
|
5
19
|
0||value.length>max||value!==value.trim())return!1;for(let i=0;i<value.length;i++){let unit=value.charCodeAt(i);if(isHighSurrogate(unit)){if(!isLowSurrogate(value.charCodeAt(i+1)))return!1;i+=1}else if(isLowSurrogate(unit)||isForbiddenTextCodeUnit(unit))return!1}return!0}var SUBAGENT_PRESENTATION_SCAN_WINDOW_CODE_UNITS=4096,WHITESPACE_UNIT_REGEX=/\s/;function isSeparatorAt(input,index){let unit=input.charCodeAt(index);return isHighSurrogate(unit)?!isLowSurrogate(input.charCodeAt(index+1)):isLowSurrogate(
|
|
@@ -17,34 +31,34 @@ if(typeof value!="string"||!pattern.test(value))throw invalidSnapshot();return v
|
|
|
17
31
|
cancellationOutcome,SUBAGENT_CANCELLATION_OUTCOMES),agent:readNullablePattern(f.agent,IDENTIFIER_REGEX),label:readNullablePattern(f.label,IDENTIFIER_REGEX),task:readNullableText(f.task,120),model:readNullablePattern(f.model,MODEL_REGEX),startedAt:readNullableInteger(f.startedAt),endedAt:readNullableInteger(f.endedAt),turns:readInteger(f.turns,0),toolCalls:readInteger(f.toolCalls,0),failureKind:readNullableMember(f.failureKind,SUBAGENT_FAILURE_KINDS),resultPreview:readNullableText(f.resultPreview,
|
|
18
32
|
160)}}function readRun(value){let f=readPlainFields(value,RUN_KEYS);return{runId:readUuid(f.runId),seq:readInteger(f.seq,1),final:readBoolean(f.final),workers:readPlainArray(f.workers,32).map(readWorker),toolCallId:readNullablePattern(f.toolCallId,TOOL_CALL_ID_REGEX),mode:readMember(f.mode,SUBAGENT_RUN_MODES),startedAt:readInteger(f.startedAt,0),endedAt:readNullableInteger(f.endedAt)}}function readEnvelope(value){let f=readPlainFields(value,ENVELOPE_KEYS);if(f.schemaVersion!==1)throw invalidSnapshot();
|
|
19
33
|
return{schemaVersion:1,runtimeId:readUuid(f.runtimeId),sessionEpoch:readUuid(f.sessionEpoch),complete:readBoolean(f.complete),runs:readPlainArray(f.runs,64).map(readRun)}}function parseSubagentRunSnapshot(value){try{let run=readRun(value);return assertRunInvariants(run),deepFreeze(run)}catch{throw invalidSnapshot()}}function parseSubagentProgressSnapshot(value){try{let snapshot=readEnvelope(value),runIds=new Set,finalized=0;for(let run of snapshot.runs){if(runIds.has(run.runId))throw invalidSnapshot();
|
|
20
|
-
runIds.add(run.runId),run.final&&(finalized+=1),assertRunInvariants(run)}if(finalized>16)throw invalidSnapshot();let size=measureSubagentProgressJson(snapshot);if(size.utf8Bytes>4259840||size.codeUnits>4259840)throw invalidSnapshot();return deepFreeze(snapshot)}catch{throw invalidSnapshot()}}function deepFreeze(value){if(value===null||typeof value!="object"||Object.isFrozen(value))return value;Object.freeze(value);for(let child of Object.values(value))deepFreeze(child);return value}var
|
|
34
|
+
runIds.add(run.runId),run.final&&(finalized+=1),assertRunInvariants(run)}if(finalized>16)throw invalidSnapshot();let size=measureSubagentProgressJson(snapshot);if(size.utf8Bytes>4259840||size.codeUnits>4259840)throw invalidSnapshot();return deepFreeze(snapshot)}catch{throw invalidSnapshot()}}function deepFreeze(value){if(value===null||typeof value!="object"||Object.isFrozen(value))return value;Object.freeze(value);for(let child of Object.values(value))deepFreeze(child);return value}var StrictObject2=properties=>typebox_exports.Object(properties,{additionalProperties:!1}),PositiveInteger=typebox_exports.Integer({minimum:1,maximum:Number.MAX_SAFE_INTEGER}),NonnegativeInteger=typebox_exports.Integer({minimum:0,maximum:Number.MAX_SAFE_INTEGER}),Digest=typebox_exports.String({pattern:"^[a-f0-9]{64}$"}),ORCHESTRATION_CONTRACT_VERSION=1,ORCHESTRATION_CAPABILITIES=["architect","technical_lead","implementation_fast","implementation_strong","technical_review","security_review"],ORCHESTRATION_EFFORTS=[
|
|
21
35
|
"low","medium","high"],ORCHESTRATION_RISKS=["low","medium","high","critical"],OrchestrationCapabilitySchema=typebox_exports.Union([typebox_exports.Literal(ORCHESTRATION_CAPABILITIES[0]),typebox_exports.Literal(ORCHESTRATION_CAPABILITIES[1]),typebox_exports.Literal(ORCHESTRATION_CAPABILITIES[2]),typebox_exports.Literal(ORCHESTRATION_CAPABILITIES[3]),typebox_exports.Literal(ORCHESTRATION_CAPABILITIES[4]),typebox_exports.Literal(ORCHESTRATION_CAPABILITIES[5])]),OrchestrationEffortSchema=typebox_exports.
|
|
22
|
-
Union([typebox_exports.Literal(ORCHESTRATION_EFFORTS[0]),typebox_exports.Literal(ORCHESTRATION_EFFORTS[1]),typebox_exports.Literal(ORCHESTRATION_EFFORTS[2])]),OrchestrationRiskSchema=typebox_exports.Union([typebox_exports.Literal(ORCHESTRATION_RISKS[0]),typebox_exports.Literal(ORCHESTRATION_RISKS[1]),typebox_exports.Literal(ORCHESTRATION_RISKS[2]),typebox_exports.Literal(ORCHESTRATION_RISKS[3])]),OrchestrationPackageSchema=
|
|
23
|
-
contextBudget:PositiveInteger,model:typebox_exports.String({minLength:1}),independentFrom:typebox_exports.Optional(typebox_exports.Array(OrchestrationCapabilitySchema))}),OrchestrationTopologySchema=
|
|
24
|
-
String({minLength:1}),complexity:typebox_exports.Integer({minimum:1,maximum:10}),risk:OrchestrationRiskSchema,classificationSource:typebox_exports.Union([typebox_exports.Literal("deterministic"),typebox_exports.Literal("classifier"),typebox_exports.Literal("fallback"),typebox_exports.Literal("architect")])}),OrchestrationFeaturesSchema=
|
|
36
|
+
Union([typebox_exports.Literal(ORCHESTRATION_EFFORTS[0]),typebox_exports.Literal(ORCHESTRATION_EFFORTS[1]),typebox_exports.Literal(ORCHESTRATION_EFFORTS[2])]),OrchestrationRiskSchema=typebox_exports.Union([typebox_exports.Literal(ORCHESTRATION_RISKS[0]),typebox_exports.Literal(ORCHESTRATION_RISKS[1]),typebox_exports.Literal(ORCHESTRATION_RISKS[2]),typebox_exports.Literal(ORCHESTRATION_RISKS[3])]),OrchestrationPackageSchema=StrictObject2({route:typebox_exports.String({minLength:1}),effort:OrchestrationEffortSchema,
|
|
37
|
+
contextBudget:PositiveInteger,model:typebox_exports.String({minLength:1}),independentFrom:typebox_exports.Optional(typebox_exports.Array(OrchestrationCapabilitySchema))}),OrchestrationTopologySchema=StrictObject2({maxDepth:typebox_exports.Integer({minimum:1,maximum:3}),maxWorkers:typebox_exports.Integer({minimum:1,maximum:16}),maxConcurrent:typebox_exports.Integer({minimum:1,maximum:8}),maxWorktrees:typebox_exports.Integer({minimum:0,maximum:8})}),OrchestrationRunClassSchema=StrictObject2({taskClass:typebox_exports.
|
|
38
|
+
String({minLength:1}),complexity:typebox_exports.Integer({minimum:1,maximum:10}),risk:OrchestrationRiskSchema,classificationSource:typebox_exports.Union([typebox_exports.Literal("deterministic"),typebox_exports.Literal("classifier"),typebox_exports.Literal("fallback"),typebox_exports.Literal("architect")])}),OrchestrationFeaturesSchema=StrictObject2({adaptiveRouting:typebox_exports.Union([typebox_exports.Literal("off"),typebox_exports.Literal("observe"),typebox_exports.Literal("recommend"),typebox_exports.
|
|
25
39
|
Literal("enforce")]),exploration:typebox_exports.Boolean(),shadowRouting:typebox_exports.Union([typebox_exports.Literal("off"),typebox_exports.Literal("estimate")]),budget:typebox_exports.Union([typebox_exports.Literal("monitor"),typebox_exports.Literal("warn"),typebox_exports.Literal("enforce")]),budgetMicrocents:NonnegativeInteger,timeBudgetMs:NonnegativeInteger,autoMerge:typebox_exports.Literal(!1),destructiveOps:typebox_exports.Literal("deny"),dependencyChanges:typebox_exports.Union([typebox_exports.
|
|
26
|
-
Literal("deny"),typebox_exports.Literal("ask")])}),OrchestrationDecisionV1Schema=
|
|
27
|
-
canary")]),sampleCount:NonnegativeInteger,minSamples:PositiveInteger,explored:typebox_exports.Boolean(),canary:typebox_exports.Boolean(),shadowEstimate:typebox_exports.Optional(
|
|
28
|
-
String(),OrchestrationPackageSchema),agentCapabilities:typebox_exports.Record(typebox_exports.String(),OrchestrationCapabilitySchema),escalation:typebox_exports.Array(OrchestrationCapabilitySchema),verification:
|
|
29
|
-
Literal("risk_based"),typebox_exports.Literal("always")]),gate:typebox_exports.Union([typebox_exports.Literal("off"),typebox_exports.Literal("on")])}),features:OrchestrationFeaturesSchema,decision:OrchestrationDecisionV1Schema,approvedDependencyChanges:typebox_exports.Optional(typebox_exports.Array(typebox_exports.String({minLength:1})))}),OrchestrationPolicyValidator=Compile(OrchestrationPolicyV1Schema),ORCHESTRATION_CAPABILITY_SET=new Set(ORCHESTRATION_CAPABILITIES);var RunOrchestrationDecisionV1Schema=
|
|
30
|
-
Union([typebox_exports.Literal("orchestration-unsupported"),typebox_exports.Literal("orchestration-disabled"),typebox_exports.Null()])}),SubagentTaskEventSchema=typebox_exports.Union([
|
|
31
|
-
Literal("wait"),taskId:typebox_exports.String(),reason:typebox_exports.Literal("concurrency"),at:NonnegativeInteger}),
|
|
32
|
-
attempt:PositiveInteger,at:NonnegativeInteger}),
|
|
33
|
-
{type:typebox_exports.Literal("skip"),taskId:typebox_exports.String(),failedDependency:typebox_exports.String(),at:NonnegativeInteger})]),SubagentTaskEventValidator=Compile(SubagentTaskEventSchema);var SubagentIdentityEnvelopeSchema=
|
|
40
|
+
Literal("deny"),typebox_exports.Literal("ask")])}),OrchestrationDecisionV1Schema=StrictObject2({defaultPackage:typebox_exports.Optional(typebox_exports.Record(typebox_exports.String(),OrchestrationPackageSchema)),recommendedPackage:typebox_exports.Optional(typebox_exports.Record(typebox_exports.String(),OrchestrationPackageSchema)),selected:typebox_exports.Union([typebox_exports.Literal("default"),typebox_exports.Literal("recommended"),typebox_exports.Literal("explored"),typebox_exports.Literal(
|
|
41
|
+
"canary")]),sampleCount:NonnegativeInteger,minSamples:PositiveInteger,explored:typebox_exports.Boolean(),canary:typebox_exports.Boolean(),shadowEstimate:typebox_exports.Optional(StrictObject2({costMicrocents:NonnegativeInteger,durationMs:NonnegativeInteger}))}),OrchestrationPolicyV1Schema=StrictObject2({contractVersion:typebox_exports.Literal(ORCHESTRATION_CONTRACT_VERSION),policyId:Digest,runClass:OrchestrationRunClassSchema,topology:OrchestrationTopologySchema,packages:typebox_exports.Record(typebox_exports.
|
|
42
|
+
String(),OrchestrationPackageSchema),agentCapabilities:typebox_exports.Record(typebox_exports.String(),OrchestrationCapabilitySchema),escalation:typebox_exports.Array(OrchestrationCapabilitySchema),verification:StrictObject2({depth:typebox_exports.Union([typebox_exports.Literal("none"),typebox_exports.Literal("targeted"),typebox_exports.Literal("broad"),typebox_exports.Literal("full")]),review:typebox_exports.Union([typebox_exports.Literal("off"),typebox_exports.Literal("sampled"),typebox_exports.
|
|
43
|
+
Literal("risk_based"),typebox_exports.Literal("always")]),gate:typebox_exports.Union([typebox_exports.Literal("off"),typebox_exports.Literal("on")])}),features:OrchestrationFeaturesSchema,decision:OrchestrationDecisionV1Schema,approvedDependencyChanges:typebox_exports.Optional(typebox_exports.Array(typebox_exports.String({minLength:1})))}),OrchestrationPolicyValidator=Compile(OrchestrationPolicyV1Schema),ORCHESTRATION_CAPABILITY_SET=new Set(ORCHESTRATION_CAPABILITIES);var RunOrchestrationDecisionV1Schema=StrictObject2({schemaVersion:typebox_exports.Literal(1),policyId:typebox_exports.Union([Digest,typebox_exports.Null()]),contractVersion:typebox_exports.Literal(ORCHESTRATION_CONTRACT_VERSION),runClass:typebox_exports.Union([OrchestrationRunClassSchema,typebox_exports.Null()]),topology:typebox_exports.Union([OrchestrationTopologySchema,typebox_exports.Null()]),decision:typebox_exports.Union([OrchestrationDecisionV1Schema,typebox_exports.Null()]),degradationReason:typebox_exports.
|
|
44
|
+
Union([typebox_exports.Literal("orchestration-unsupported"),typebox_exports.Literal("orchestration-disabled"),typebox_exports.Null()])}),SubagentTaskEventSchema=typebox_exports.Union([StrictObject2({type:typebox_exports.Literal("schedule"),taskId:typebox_exports.String(),dependsOn:typebox_exports.Array(typebox_exports.String()),ownerPaths:typebox_exports.Array(typebox_exports.String()),baseRevision:typebox_exports.Optional(typebox_exports.String()),at:NonnegativeInteger}),StrictObject2({type:typebox_exports.
|
|
45
|
+
Literal("wait"),taskId:typebox_exports.String(),reason:typebox_exports.Literal("concurrency"),at:NonnegativeInteger}),StrictObject2({type:typebox_exports.Literal("serialize"),taskId:typebox_exports.String(),after:typebox_exports.Array(typebox_exports.String()),at:NonnegativeInteger}),StrictObject2({type:typebox_exports.Literal("start"),taskId:typebox_exports.String(),attempt:PositiveInteger,at:NonnegativeInteger}),StrictObject2({type:typebox_exports.Literal("complete"),taskId:typebox_exports.String(),
|
|
46
|
+
attempt:PositiveInteger,at:NonnegativeInteger}),StrictObject2({type:typebox_exports.Literal("fail"),taskId:typebox_exports.String(),attempt:PositiveInteger,reason:typebox_exports.String(),at:NonnegativeInteger}),StrictObject2({type:typebox_exports.Literal("escalate"),taskId:typebox_exports.String(),fromAttempt:PositiveInteger,toAttempt:PositiveInteger,model:typebox_exports.Optional(typebox_exports.String()),thinking:typebox_exports.Optional(typebox_exports.String()),at:NonnegativeInteger}),StrictObject2(
|
|
47
|
+
{type:typebox_exports.Literal("skip"),taskId:typebox_exports.String(),failedDependency:typebox_exports.String(),at:NonnegativeInteger})]),SubagentTaskEventValidator=Compile(SubagentTaskEventSchema);var SubagentIdentityEnvelopeSchema=StrictObject2({taskId:typebox_exports.Optional(typebox_exports.String({minLength:1})),parentTaskId:typebox_exports.Optional(typebox_exports.String({minLength:1})),depth:typebox_exports.Optional(typebox_exports.Integer({minimum:1,maximum:3}))}),ProgressUuid=typebox_exports.String({pattern:SUBAGENT_PROGRESS_UUID_PATTERN,minLength:36,maxLength:36}),Nullable=schema=>typebox_exports.Union([schema,typebox_exports.Null()]),ProgressIdentifier=Nullable(typebox_exports.String(
|
|
34
48
|
{pattern:SUBAGENT_PROGRESS_IDENTIFIER_PATTERN,minLength:1,maxLength:64})),ProgressModel=Nullable(typebox_exports.String({pattern:SUBAGENT_PROGRESS_MODEL_PATTERN,minLength:1,maxLength:128})),ProgressToolCallId=Nullable(typebox_exports.String({pattern:SUBAGENT_PROGRESS_TOOL_CALL_ID_PATTERN,minLength:1,maxLength:256})),ProgressText=maxLength=>Nullable(typebox_exports.String({pattern:SUBAGENT_PROGRESS_TEXT_PATTERN,minLength:1,maxLength})),SubagentWorkerStatusSchema=typebox_exports.Union([typebox_exports.
|
|
35
49
|
Literal(SUBAGENT_WORKER_STATUSES[0]),typebox_exports.Literal(SUBAGENT_WORKER_STATUSES[1]),typebox_exports.Literal(SUBAGENT_WORKER_STATUSES[2]),typebox_exports.Literal(SUBAGENT_WORKER_STATUSES[3]),typebox_exports.Literal(SUBAGENT_WORKER_STATUSES[4]),typebox_exports.Literal(SUBAGENT_WORKER_STATUSES[5]),typebox_exports.Literal(SUBAGENT_WORKER_STATUSES[6]),typebox_exports.Literal(SUBAGENT_WORKER_STATUSES[7])]),SubagentCancellationOutcomeSchema=typebox_exports.Union([typebox_exports.Literal(SUBAGENT_CANCELLATION_OUTCOMES[0]),
|
|
36
50
|
typebox_exports.Literal(SUBAGENT_CANCELLATION_OUTCOMES[1]),typebox_exports.Literal(SUBAGENT_CANCELLATION_OUTCOMES[2]),typebox_exports.Literal(SUBAGENT_CANCELLATION_OUTCOMES[3])]),SubagentFailureKindSchema=typebox_exports.Union([typebox_exports.Literal(SUBAGENT_FAILURE_KINDS[0]),typebox_exports.Literal(SUBAGENT_FAILURE_KINDS[1]),typebox_exports.Literal(SUBAGENT_FAILURE_KINDS[2]),typebox_exports.Literal(SUBAGENT_FAILURE_KINDS[3]),typebox_exports.Null()]),SubagentRunModeSchema=typebox_exports.Union(
|
|
37
|
-
[typebox_exports.Literal(SUBAGENT_RUN_MODES[0]),typebox_exports.Literal(SUBAGENT_RUN_MODES[1]),typebox_exports.Literal(SUBAGENT_RUN_MODES[2])]),SubagentWorkerSnapshotSchema=
|
|
38
|
-
NonnegativeInteger),turns:NonnegativeInteger,toolCalls:NonnegativeInteger,failureKind:SubagentFailureKindSchema,resultPreview:ProgressText(160)}),SubagentRunSnapshotSchema=
|
|
39
|
-
{schemaVersion:typebox_exports.Literal(1),runtimeId:ProgressUuid,sessionEpoch:ProgressUuid,complete:typebox_exports.Boolean(),runs:typebox_exports.Array(SubagentRunSnapshotSchema,{maxItems:64})});var HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION=1,HUMAIN_AGENT_ARTIFACT_KINDS=["candidate-patch","dependency-output","source-observation","validation-report"],
|
|
40
|
-
String({pattern:"^[a-f0-9]{64}$"}),SafeArtifactReference=typebox_exports.String({minLength:1,maxLength:512,pattern:"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))[A-Za-z0-9._-]+(?:/[A-Za-z0-9._-]+)*$"}),HumainAgentRouteRefSchema=typebox_exports.Union([typebox_exports.Literal("route:fast"),typebox_exports.Literal("route:balanced"),typebox_exports.Literal("route:thorough")]),HumainAgentArtifactSchema=
|
|
41
|
-
typebox_exports.Literal(HUMAIN_AGENT_ARTIFACT_KINDS[1]),typebox_exports.Literal(HUMAIN_AGENT_ARTIFACT_KINDS[2]),typebox_exports.Literal(HUMAIN_AGENT_ARTIFACT_KINDS[3])]),reference:SafeArtifactReference,digest:Digest2}),HumainAgentExecutionControlsSchema=
|
|
42
|
-
HumainAgentExecutionClaimSchema=
|
|
43
|
-
Literal(HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION),kind:typebox_exports.Literal("execute"),mode:typebox_exports.Union([typebox_exports.Literal("node"),typebox_exports.Literal("workflow")]),invocationId:StableIdentifier,batchId:typebox_exports.Optional(StableIdentifier),claims:typebox_exports.Array(HumainAgentExecutionClaimSchema,{minItems:1,maxItems:8})}),HumainAgentUsageSchema=typebox_exports.Union([
|
|
51
|
+
[typebox_exports.Literal(SUBAGENT_RUN_MODES[0]),typebox_exports.Literal(SUBAGENT_RUN_MODES[1]),typebox_exports.Literal(SUBAGENT_RUN_MODES[2])]),SubagentWorkerSnapshotSchema=StrictObject2({workerId:ProgressUuid,attempt:NonnegativeInteger,status:SubagentWorkerStatusSchema,cancelRequested:typebox_exports.Boolean(),cancellationOutcome:SubagentCancellationOutcomeSchema,agent:ProgressIdentifier,label:ProgressIdentifier,task:ProgressText(120),model:ProgressModel,startedAt:Nullable(NonnegativeInteger),endedAt:Nullable(
|
|
52
|
+
NonnegativeInteger),turns:NonnegativeInteger,toolCalls:NonnegativeInteger,failureKind:SubagentFailureKindSchema,resultPreview:ProgressText(160)}),SubagentRunSnapshotSchema=StrictObject2({runId:ProgressUuid,seq:PositiveInteger,final:typebox_exports.Boolean(),workers:typebox_exports.Array(SubagentWorkerSnapshotSchema,{maxItems:32}),toolCallId:ProgressToolCallId,mode:SubagentRunModeSchema,startedAt:NonnegativeInteger,endedAt:Nullable(NonnegativeInteger)}),SubagentProgressSnapshotSchema=StrictObject2(
|
|
53
|
+
{schemaVersion:typebox_exports.Literal(1),runtimeId:ProgressUuid,sessionEpoch:ProgressUuid,complete:typebox_exports.Boolean(),runs:typebox_exports.Array(SubagentRunSnapshotSchema,{maxItems:64})});var HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION=1,HUMAIN_AGENT_ARTIFACT_KINDS=["candidate-patch","dependency-output","source-observation","validation-report"],StrictObject3=properties=>typebox_exports.Object(properties,{additionalProperties:!1}),StableIdentifier=typebox_exports.String({minLength:1,maxLength:256}),PositiveInteger2=typebox_exports.Integer({minimum:1,maximum:Number.MAX_SAFE_INTEGER}),NonnegativeInteger2=typebox_exports.Integer({minimum:0,maximum:Number.MAX_SAFE_INTEGER}),Digest2=typebox_exports.
|
|
54
|
+
String({pattern:"^[a-f0-9]{64}$"}),SafeArtifactReference=typebox_exports.String({minLength:1,maxLength:512,pattern:"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))[A-Za-z0-9._-]+(?:/[A-Za-z0-9._-]+)*$"}),HumainAgentRouteRefSchema=typebox_exports.Union([typebox_exports.Literal("route:fast"),typebox_exports.Literal("route:balanced"),typebox_exports.Literal("route:thorough")]),HumainAgentArtifactSchema=StrictObject3({id:StableIdentifier,kind:typebox_exports.Union([typebox_exports.Literal(HUMAIN_AGENT_ARTIFACT_KINDS[0]),
|
|
55
|
+
typebox_exports.Literal(HUMAIN_AGENT_ARTIFACT_KINDS[1]),typebox_exports.Literal(HUMAIN_AGENT_ARTIFACT_KINDS[2]),typebox_exports.Literal(HUMAIN_AGENT_ARTIFACT_KINDS[3])]),reference:SafeArtifactReference,digest:Digest2}),HumainAgentExecutionControlsSchema=StrictObject3({maxConcurrency:typebox_exports.Integer({minimum:1,maximum:16}),maxDepth:typebox_exports.Integer({minimum:1,maximum:16}),depth:typebox_exports.Integer({minimum:0,maximum:16}),timeoutMs:typebox_exports.Integer({minimum:1,maximum:864e5})}),
|
|
56
|
+
HumainAgentExecutionClaimSchema=StrictObject3({workUnitId:StableIdentifier,nodeId:StableIdentifier,attemptNumber:PositiveInteger2,attemptFence:PositiveInteger2,segmentFence:PositiveInteger2,routeRef:HumainAgentRouteRefSchema,task:typebox_exports.String({minLength:1,maxLength:1e5}),controls:HumainAgentExecutionControlsSchema,input:StrictObject3({artifacts:typebox_exports.Array(HumainAgentArtifactSchema,{maxItems:16})})}),HumainAgentExecutionRequestSchema=StrictObject3({schemaVersion:typebox_exports.
|
|
57
|
+
Literal(HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION),kind:typebox_exports.Literal("execute"),mode:typebox_exports.Union([typebox_exports.Literal("node"),typebox_exports.Literal("workflow")]),invocationId:StableIdentifier,batchId:typebox_exports.Optional(StableIdentifier),claims:typebox_exports.Array(HumainAgentExecutionClaimSchema,{minItems:1,maxItems:8})}),HumainAgentUsageSchema=typebox_exports.Union([StrictObject3({status:typebox_exports.Literal("unknown")}),StrictObject3({status:typebox_exports.Literal(
|
|
44
58
|
"measured"),totalCalls:typebox_exports.Optional(NonnegativeInteger2),totalTurns:typebox_exports.Optional(NonnegativeInteger2),totalTokens:NonnegativeInteger2,costMicrocents:NonnegativeInteger2})]),HUMAIN_AGENT_EXECUTION_FAILURE_CODES=["adapter_execution_failed","incompatible_adapter_capability","invalid_adapter_result","invalid_execution_request","provider_timeout","provider_unavailable","reused_execution_context","transport_interrupted"],HumainAgentExecutionFailureCodeSchema=typebox_exports.Union(
|
|
45
59
|
[typebox_exports.Literal(HUMAIN_AGENT_EXECUTION_FAILURE_CODES[0]),typebox_exports.Literal(HUMAIN_AGENT_EXECUTION_FAILURE_CODES[1]),typebox_exports.Literal(HUMAIN_AGENT_EXECUTION_FAILURE_CODES[2]),typebox_exports.Literal(HUMAIN_AGENT_EXECUTION_FAILURE_CODES[3]),typebox_exports.Literal(HUMAIN_AGENT_EXECUTION_FAILURE_CODES[4]),typebox_exports.Literal(HUMAIN_AGENT_EXECUTION_FAILURE_CODES[5]),typebox_exports.Literal(HUMAIN_AGENT_EXECUTION_FAILURE_CODES[6]),typebox_exports.Literal(HUMAIN_AGENT_EXECUTION_FAILURE_CODES[7])]),
|
|
46
|
-
OutcomeIdentity={workUnitId:StableIdentifier,nodeId:StableIdentifier,attemptNumber:PositiveInteger2,attemptFence:PositiveInteger2,segmentFence:PositiveInteger2},HumainAgentExecutionOutcomeSchema=typebox_exports.Union([
|
|
47
|
-
kind:typebox_exports.Literal("failed"),failureCode:HumainAgentExecutionFailureCodeSchema,usage:HumainAgentUsageSchema}),
|
|
60
|
+
OutcomeIdentity={workUnitId:StableIdentifier,nodeId:StableIdentifier,attemptNumber:PositiveInteger2,attemptFence:PositiveInteger2,segmentFence:PositiveInteger2},HumainAgentExecutionOutcomeSchema=typebox_exports.Union([StrictObject3({...OutcomeIdentity,kind:typebox_exports.Literal("succeeded"),output:StrictObject3({summary:typebox_exports.String({minLength:1,maxLength:512}),artifacts:typebox_exports.Array(HumainAgentArtifactSchema,{maxItems:16})}),usage:HumainAgentUsageSchema}),StrictObject3({...OutcomeIdentity,
|
|
61
|
+
kind:typebox_exports.Literal("failed"),failureCode:HumainAgentExecutionFailureCodeSchema,usage:HumainAgentUsageSchema}),StrictObject3({...OutcomeIdentity,kind:typebox_exports.Literal("cancelled"),terminationConfirmed:typebox_exports.Boolean(),usage:HumainAgentUsageSchema})]),HumainAgentExecutionResponseSchema=StrictObject3({schemaVersion:typebox_exports.Literal(HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION),kind:typebox_exports.Literal("result"),mode:typebox_exports.Union([typebox_exports.Literal("node"),
|
|
48
62
|
typebox_exports.Literal("workflow")]),invocationId:StableIdentifier,batchId:typebox_exports.Optional(StableIdentifier),termination:typebox_exports.Union([typebox_exports.Literal("not-requested"),typebox_exports.Literal("confirmed"),typebox_exports.Literal("unconfirmed")]),outcomes:typebox_exports.Array(HumainAgentExecutionOutcomeSchema,{minItems:1,maxItems:8})}),RequestValidator=Compile(HumainAgentExecutionRequestSchema),ResponseValidator=Compile(HumainAgentExecutionResponseSchema),ArtifactReferenceValidator=Compile(
|
|
49
63
|
SafeArtifactReference);function isSafeHumainAgentExecutionSummary(value){return typeof value=="string"&&value.length>=1&&value.length<=512&&value===value.trim()&&/^[\p{L}\p{N}][\p{L}\p{N} .,;:!?()&'-]*$/u.test(value)&&!/\b(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}(?::\d{1,5})?\b/u.test(value)&&!/\b(?:\d{1,3}\.){3}\d{1,3}(?::\d{1,5})?\b/u.test(value)&&!/^(?:rm|curl|wget|sh|bash|zsh|fish|pwsh|powershell|cmd|node|bun|deno|npx|npm|pnpm|yarn|python(?:3)?|perl|ruby|git|docker|kubectl|ssh|scp|sudo|cat|ls|cd|mkdir|touch|chmod|chown|env|export|set|eval|exec)\b/iu.
|
|
50
64
|
test(value)&&!/\b(?:api[- ]?key|secret|token|credential|password)\s*:/iu.test(value)&&!/\b(?:claude|gpt|gemini|llama|mistral|zai|glm|qwen|deepseek|grok|nova|o\d+)[-_.:][A-Za-z0-9._:-]+\b/iu.test(value)}function parseHumainAgentExecutionRequest(input){if(!RequestValidator.Check(input))throw new Error("Invalid HUMAIN agent execution request");if(input.mode==="node"&&(input.claims.length!==1||input.batchId!==void 0))throw new Error("Invalid HUMAIN agent execution request: node mode requires one cla\
|
|
@@ -105,6 +119,7 @@ name,...session.cwd?{cwd:session.cwd}:{},pid:consumer.pid,status:session.status,
|
|
|
105
119
|
all),note=[truncated?TRUNCATED_NOTE:void 0,childrenTruncated?TRUNCATED_CHILDREN_NOTE:void 0,this.external.note].filter(note2=>note2!==void 0).join(" ");return{type:"snapshot",agents,coverage:truncated||childrenTruncated||this.external.coverage==="partial"?"partial":"complete",...note?{note}:{}}}schedulePush(){this.pushTimer||this.stopped||(this.pushTimer=setTimeout(()=>{this.pushTimer=void 0,this.push()},this.pushDelayMs))}push(){let snapshot=this.snapshot(),payload=JSON.stringify(snapshot);for(let[
|
|
106
120
|
socket,consumer]of this.consumers)consumer.lastSent!==payload&&(consumer.lastSent=payload,writeMessage(socket,snapshot))}armIdle(){this.idleTimer||this.stopped||(this.idleTimer=setTimeout(()=>{this.idleTimer=void 0,this.hasViewer()||this.shutdown()},this.idleShutdownMs))}cancelIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=void 0}shutdown(){if(!this.stopped){this.stopped=!0,this.cancelIdle(),this.stopScanning(),this.pushTimer&&clearTimeout(this.pushTimer);for(let consumer of this.
|
|
107
121
|
consumers.values())clearTimeout(consumer.revealTimer);for(let socket of this.connections)socket.destroy();this.serving&&(unlinkQuietly(this.paths.socketPath),unlinkQuietly(this.paths.pidPath)),this.server.close(),this.onExit(0)}}};async function runAgentMonitorCommand(env){let role=env[COORDINATION_ROLE_ENV];if(delete env[COORDINATION_ROLE_ENV],role!==AGENT_MONITOR_ROLE)return console.error("This command is internal to HUMAIN Code CLI."),2;process.stderr.on("error",()=>{}),process.stdout.on("error",()=>{});let server;try{server=new AgentMonitorServer({paths:resolveAgentMonitorPaths(getAgentDir())}),await server.start()}catch(error){return console.error(error instanceof MonitorAlreadyRunningError?error.message:`Agent monit\
|
|
108
|
-
or failed to start: ${error instanceof Error?error.message:String(error)}`),1}let stop=()=>server.shutdown();return process.on("SIGTERM",stop),process.on("SIGINT",stop),process.on("SIGHUP",stop),await new Promise(()=>{})}export{COORDINATION_BROKER_COMMAND,COORDINATION_ROLE_ENV,COORDINATION_ROLE,detectLaunchRuntime,getInternalCommandLaunchSpec,getBrokerLaunchSpec,
|
|
109
|
-
|
|
110
|
-
|
|
122
|
+
or failed to start: ${error instanceof Error?error.message:String(error)}`),1}let stop=()=>server.shutdown();return process.on("SIGTERM",stop),process.on("SIGINT",stop),process.on("SIGHUP",stop),await new Promise(()=>{})}export{COORDINATION_BROKER_COMMAND,COORDINATION_ROLE_ENV,COORDINATION_ROLE,detectLaunchRuntime,getInternalCommandLaunchSpec,getBrokerLaunchSpec,FLOW_ID_PATTERN,FLOW_MODEL_ID_PATTERN,FlowContractError,lit,StrictObject,FlowIdSchema,FlowDigestSchema,FlowTimestampSchema,FlowMicrousdSchema,FlowCountSchema,FlowPositiveIntSchema,FlowModelRefSchema,FLOW_ROLES,FlowRoleSchema,partialByRole,FlowSizeSchema,FlowFailureClassSchema,FlowReasonClassSchema,FlowProfileRefSchema,verifyFlowDigest,parseFlowData,compileFlow,
|
|
123
|
+
hasDuplicateModels,canonicalFlowJson,canonicalWithout,SUBAGENT_FAILURE_KINDS,SUBAGENT_RUN_MODES,SUBAGENT_PROGRESS_IDENTIFIER_PATTERN,SUBAGENT_PROGRESS_MODEL_PATTERN,SUBAGENT_PROGRESS_TOOL_CALL_ID_PATTERN,isCanonicalSubagentProgressUuid,toSubagentPresentationText,parseSubagentRunSnapshot,parseSubagentProgressSnapshot,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentRouteRefSchema,HumainAgentArtifactSchema,HumainAgentExecutionControlsSchema,HumainAgentExecutionClaimSchema,HumainAgentExecutionRequestSchema,
|
|
124
|
+
HumainAgentUsageSchema,HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HumainAgentExecutionOutcomeSchema,HumainAgentExecutionResponseSchema,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse,COORDINATION_FILE_MODE,COORDINATION_PROTOCOL_NAME,COORDINATION_PROTOCOL_VERSION,MAX_MESSAGE_TEXT_BYTES,getCoordinationRuntimePaths,resolveCoordinationRuntimePaths,assertSafeAncestors,assertCanonicalRuntimeDir,ensureRuntimeDir,ensureCoordinationRuntimeDir,assertPrivateSocket,restrictRuntimeFile,AGENT_MONITOR_PROTOCOL,
|
|
125
|
+
AGENT_MONITOR_COMMAND,AGENT_MONITOR_ROLE,MAX_SNAPSHOT_FRAME_BYTES,MAX_CHILDREN,MAX_ID,resolveAgentMonitorPaths,parseSnapshot,MAX_RUNTIME_TEXT_FILE_BYTES,fsyncDirectory,writeJsonAtomic,writeTextAtomic,createFileExclusive,readBoundedTextFile,readTextFile,readJsonFile,framePayloadBytes,writeMessage,createMessageReader,runAgentMonitorCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{Text,getCapabilities,getImageDimensions,hyperlink,imageFallback,truncateToWidth}from"./chunk-
|
|
2
|
+
import{Text,getCapabilities,getImageDimensions,hyperlink,imageFallback,truncateToWidth}from"./chunk-ICLZNV4V.js";import{getBinDir,resolvePath}from"./chunk-DUZY4PDA.js";import{existsSync}from"node:fs";import{delimiter,join}from"node:path";import{spawn,spawnSync}from"child_process";function isLegacyWslBashPath(path){let normalized=path.replace(/\//g,"\\").toLowerCase();return/^[a-z]:\\windows\\(?:system32|sysnative)\\bash\.exe$/.test(normalized)}function getBashShellConfig(shell){return isLegacyWslBashPath(shell)?{shell,args:["-s"],commandTransport:"stdin"}:{shell,args:["-c"]}}function findExecutableOnPath(executable){if(process.platform==="win32"){try{let result=spawnSync("where",[executable],{encoding:"utf-8",timeout:5e3,windowsHide:!0});if(result.status===0&&result.stdout){
|
|
3
3
|
let firstMatch=result.stdout.trim().split(/\r?\n/)[0];if(firstMatch&&existsSync(firstMatch))return firstMatch}}catch{}return null}try{let result=spawnSync("which",[executable],{encoding:"utf-8",timeout:5e3});if(result.status===0&&result.stdout){let firstMatch=result.stdout.trim().split(/\r?\n/)[0];if(firstMatch)return firstMatch}}catch{}return null}function getShellConfig(customShellPath){if(customShellPath){if(existsSync(customShellPath))return getBashShellConfig(customShellPath);throw new Error(
|
|
4
4
|
`Custom shell path not found: ${customShellPath}`)}if(process.platform==="win32"){let paths=[],programFiles=process.env.ProgramFiles;programFiles&&paths.push(`${programFiles}\\Git\\bin\\bash.exe`);let programFilesX86=process.env["ProgramFiles(x86)"];programFilesX86&&paths.push(`${programFilesX86}\\Git\\bin\\bash.exe`);for(let path of paths)if(existsSync(path))return getBashShellConfig(path);let bashOnPath2=findExecutableOnPath("bash.exe");if(bashOnPath2)return getBashShellConfig(bashOnPath2);throw new Error(
|
|
5
5
|
`No bash shell found. Options:
|