@humain/humain-code-contracts 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/README.md +92 -0
- package/dist/index.d.ts +224 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +218 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestration.d.ts +327 -0
- package/dist/orchestration.d.ts.map +1 -0
- package/dist/orchestration.js +307 -0
- package/dist/orchestration.js.map +1 -0
- package/dist/rpc.d.ts +63 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +147 -0
- package/dist/rpc.js.map +1 -0
- package/dist/subagent-progress.d.ts +106 -0
- package/dist/subagent-progress.d.ts.map +1 -0
- package/dist/subagent-progress.js +440 -0
- package/dist/subagent-progress.js.map +1 -0
- package/dist/testing.d.ts +390 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +431 -0
- package/dist/testing.js.map +1 -0
- package/dist/trace-api.d.ts +293 -0
- package/dist/trace-api.d.ts.map +1 -0
- package/dist/trace-api.js +202 -0
- package/dist/trace-api.js.map +1 -0
- package/dist/trace-artifact.d.ts +94 -0
- package/dist/trace-artifact.d.ts.map +1 -0
- package/dist/trace-artifact.js +168 -0
- package/dist/trace-artifact.js.map +1 -0
- package/dist/trace-canonical.d.ts +23 -0
- package/dist/trace-canonical.d.ts.map +1 -0
- package/dist/trace-canonical.js +240 -0
- package/dist/trace-canonical.js.map +1 -0
- package/dist/trace-export.d.ts +94 -0
- package/dist/trace-export.d.ts.map +1 -0
- package/dist/trace-export.js +374 -0
- package/dist/trace-export.js.map +1 -0
- package/dist/trace-http.d.ts +1294 -0
- package/dist/trace-http.d.ts.map +1 -0
- package/dist/trace-http.js +1481 -0
- package/dist/trace-http.js.map +1 -0
- package/dist/trace-payload.d.ts +425 -0
- package/dist/trace-payload.d.ts.map +1 -0
- package/dist/trace-payload.js +1519 -0
- package/dist/trace-payload.js.map +1 -0
- package/dist/trace.d.ts +257 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/trace.js +1014 -0
- package/dist/trace.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestration.js","sourceRoot":"","sources":["../src/orchestration.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,IAAI,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACN,8BAA8B,EAC9B,sBAAsB,EACtB,sCAAsC,EACtC,oCAAoC,EACpC,0BAA0B,EAC1B,qCAAqC,EACrC,sCAAsC,EACtC,+BAA+B,EAC/B,+CAA+C,EAC/C,gCAAgC,EAChC,qCAAqC,EACrC,8BAA8B,EAC9B,6CAA6C,EAC7C,sCAAsC,EACtC,8BAA8B,EAC9B,kBAAkB,EAClB,wBAAwB,GAIxB,MAAM,wBAAwB,CAAC;AAEhC,cAAc,wBAAwB,CAAC;AAEvC,MAAM,YAAY,GAAG,CAAoD,UAAa,EAAE,EAAE,CACzF,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1D,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;AACvF,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC1F,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAU,CAAC;AAEzD,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACzC,WAAW;IACX,gBA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AQ,EAAE,0BAA0B,EAAE,CAAC;CACrF,CAAC,CAAC;AAWH,SAAS,UAAU,CAAI,KAAQ;IAC9B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACxF,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5D,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import { type Static, type TSchema, Type } from \"typebox\";\nimport { Compile } from \"typebox/compile\";\nimport {\n\tSUBAGENT_CANCELLATION_OUTCOMES,\n\tSUBAGENT_FAILURE_KINDS,\n\tSUBAGENT_PROGRESS_AGENT_MAX_CODE_UNITS,\n\tSUBAGENT_PROGRESS_IDENTIFIER_PATTERN,\n\tSUBAGENT_PROGRESS_MAX_RUNS,\n\tSUBAGENT_PROGRESS_MAX_WORKERS_PER_RUN,\n\tSUBAGENT_PROGRESS_MODEL_MAX_CODE_UNITS,\n\tSUBAGENT_PROGRESS_MODEL_PATTERN,\n\tSUBAGENT_PROGRESS_RESULT_PREVIEW_MAX_CODE_UNITS,\n\tSUBAGENT_PROGRESS_SCHEMA_VERSION,\n\tSUBAGENT_PROGRESS_TASK_MAX_CODE_UNITS,\n\tSUBAGENT_PROGRESS_TEXT_PATTERN,\n\tSUBAGENT_PROGRESS_TOOL_CALL_ID_MAX_CODE_UNITS,\n\tSUBAGENT_PROGRESS_TOOL_CALL_ID_PATTERN,\n\tSUBAGENT_PROGRESS_UUID_PATTERN,\n\tSUBAGENT_RUN_MODES,\n\tSUBAGENT_WORKER_STATUSES,\n\ttype SubagentProgressSnapshot,\n\ttype SubagentRunSnapshot,\n\ttype SubagentWorkerSnapshot,\n} from \"./subagent-progress.ts\";\n\nexport * from \"./subagent-progress.ts\";\n\nconst StrictObject = <const T extends Parameters<typeof Type.Object>[0]>(properties: T) =>\n\tType.Object(properties, { additionalProperties: false });\nconst PositiveInteger = Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER });\nconst NonnegativeInteger = Type.Integer({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER });\nconst Digest = Type.String({ pattern: \"^[a-f0-9]{64}$\" });\n\nexport const ORCHESTRATION_CONTRACT_VERSION = 1 as const;\n\nexport const ORCHESTRATION_CAPABILITIES = [\n\t\"architect\",\n\t\"technical_lead\",\n\t\"implementation_fast\",\n\t\"implementation_strong\",\n\t\"technical_review\",\n\t\"security_review\",\n] as const;\nexport type OrchestrationCapability = (typeof ORCHESTRATION_CAPABILITIES)[number];\n\nexport const ORCHESTRATION_EFFORTS = [\"low\", \"medium\", \"high\"] as const;\nexport type OrchestrationEffort = (typeof ORCHESTRATION_EFFORTS)[number];\n\nexport const ORCHESTRATION_RISKS = [\"low\", \"medium\", \"high\", \"critical\"] as const;\nexport type OrchestrationRisk = (typeof ORCHESTRATION_RISKS)[number];\n\nexport const OrchestrationCapabilitySchema = Type.Union([\n\tType.Literal(ORCHESTRATION_CAPABILITIES[0]),\n\tType.Literal(ORCHESTRATION_CAPABILITIES[1]),\n\tType.Literal(ORCHESTRATION_CAPABILITIES[2]),\n\tType.Literal(ORCHESTRATION_CAPABILITIES[3]),\n\tType.Literal(ORCHESTRATION_CAPABILITIES[4]),\n\tType.Literal(ORCHESTRATION_CAPABILITIES[5]),\n]);\nexport type OrchestrationCapabilityLiteral = Static<typeof OrchestrationCapabilitySchema>;\n\nexport const OrchestrationEffortSchema = Type.Union([\n\tType.Literal(ORCHESTRATION_EFFORTS[0]),\n\tType.Literal(ORCHESTRATION_EFFORTS[1]),\n\tType.Literal(ORCHESTRATION_EFFORTS[2]),\n]);\nexport type OrchestrationEffortLiteral = Static<typeof OrchestrationEffortSchema>;\n\nexport const OrchestrationRiskSchema = Type.Union([\n\tType.Literal(ORCHESTRATION_RISKS[0]),\n\tType.Literal(ORCHESTRATION_RISKS[1]),\n\tType.Literal(ORCHESTRATION_RISKS[2]),\n\tType.Literal(ORCHESTRATION_RISKS[3]),\n]);\nexport type OrchestrationRiskLiteral = Static<typeof OrchestrationRiskSchema>;\n\nexport const OrchestrationPackageSchema = StrictObject({\n\troute: Type.String({ minLength: 1 }),\n\teffort: OrchestrationEffortSchema,\n\tcontextBudget: PositiveInteger,\n\tmodel: Type.String({ minLength: 1 }),\n\tindependentFrom: Type.Optional(Type.Array(OrchestrationCapabilitySchema)),\n});\nexport type OrchestrationPackage = Static<typeof OrchestrationPackageSchema>;\n\nexport const OrchestrationTopologySchema = StrictObject({\n\tmaxDepth: Type.Integer({ minimum: 1, maximum: 3 }),\n\tmaxWorkers: Type.Integer({ minimum: 1, maximum: 16 }),\n\tmaxConcurrent: Type.Integer({ minimum: 1, maximum: 8 }),\n\tmaxWorktrees: Type.Integer({ minimum: 0, maximum: 8 }),\n});\nexport type OrchestrationTopology = Static<typeof OrchestrationTopologySchema>;\n\nexport const OrchestrationRunClassSchema = StrictObject({\n\ttaskClass: Type.String({ minLength: 1 }),\n\tcomplexity: Type.Integer({ minimum: 1, maximum: 10 }),\n\trisk: OrchestrationRiskSchema,\n\tclassificationSource: Type.Union([\n\t\tType.Literal(\"deterministic\"),\n\t\tType.Literal(\"classifier\"),\n\t\tType.Literal(\"fallback\"),\n\t\tType.Literal(\"architect\"),\n\t]),\n});\nexport type OrchestrationRunClass = Static<typeof OrchestrationRunClassSchema>;\n\nexport const OrchestrationFeaturesSchema = StrictObject({\n\tadaptiveRouting: Type.Union([\n\t\tType.Literal(\"off\"),\n\t\tType.Literal(\"observe\"),\n\t\tType.Literal(\"recommend\"),\n\t\tType.Literal(\"enforce\"),\n\t]),\n\texploration: Type.Boolean(),\n\tshadowRouting: Type.Union([Type.Literal(\"off\"), Type.Literal(\"estimate\")]),\n\tbudget: Type.Union([Type.Literal(\"monitor\"), Type.Literal(\"warn\"), Type.Literal(\"enforce\")]),\n\tbudgetMicrocents: NonnegativeInteger,\n\ttimeBudgetMs: NonnegativeInteger,\n\tautoMerge: Type.Literal(false),\n\tdestructiveOps: Type.Literal(\"deny\"),\n\tdependencyChanges: Type.Union([Type.Literal(\"deny\"), Type.Literal(\"ask\")]),\n});\nexport type OrchestrationFeatures = Static<typeof OrchestrationFeaturesSchema>;\n\nexport const OrchestrationDecisionV1Schema = StrictObject({\n\tdefaultPackage: Type.Optional(Type.Record(Type.String(), OrchestrationPackageSchema)),\n\trecommendedPackage: Type.Optional(Type.Record(Type.String(), OrchestrationPackageSchema)),\n\tselected: Type.Union([\n\t\tType.Literal(\"default\"),\n\t\tType.Literal(\"recommended\"),\n\t\tType.Literal(\"explored\"),\n\t\tType.Literal(\"canary\"),\n\t]),\n\tsampleCount: NonnegativeInteger,\n\tminSamples: PositiveInteger,\n\texplored: Type.Boolean(),\n\tcanary: Type.Boolean(),\n\tshadowEstimate: Type.Optional(StrictObject({ costMicrocents: NonnegativeInteger, durationMs: NonnegativeInteger })),\n});\nexport type OrchestrationDecisionV1 = Static<typeof OrchestrationDecisionV1Schema>;\n\nexport const OrchestrationPolicyV1Schema = StrictObject({\n\tcontractVersion: Type.Literal(ORCHESTRATION_CONTRACT_VERSION),\n\tpolicyId: Digest,\n\trunClass: OrchestrationRunClassSchema,\n\ttopology: OrchestrationTopologySchema,\n\tpackages: Type.Record(Type.String(), OrchestrationPackageSchema),\n\tagentCapabilities: Type.Record(Type.String(), OrchestrationCapabilitySchema),\n\tescalation: Type.Array(OrchestrationCapabilitySchema),\n\tverification: StrictObject({\n\t\tdepth: Type.Union([Type.Literal(\"none\"), Type.Literal(\"targeted\"), Type.Literal(\"broad\"), Type.Literal(\"full\")]),\n\t\treview: Type.Union([\n\t\t\tType.Literal(\"off\"),\n\t\t\tType.Literal(\"sampled\"),\n\t\t\tType.Literal(\"risk_based\"),\n\t\t\tType.Literal(\"always\"),\n\t\t]),\n\t\tgate: Type.Union([Type.Literal(\"off\"), Type.Literal(\"on\")]),\n\t}),\n\tfeatures: OrchestrationFeaturesSchema,\n\tdecision: OrchestrationDecisionV1Schema,\n\tapprovedDependencyChanges: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n});\nexport type OrchestrationPolicyV1 = Static<typeof OrchestrationPolicyV1Schema>;\n\nconst OrchestrationPolicyValidator = Compile(OrchestrationPolicyV1Schema);\n\nconst ORCHESTRATION_CAPABILITY_SET: ReadonlySet<string> = new Set(ORCHESTRATION_CAPABILITIES);\n\nexport function parseOrchestrationPolicy(value: unknown): OrchestrationPolicyV1 {\n\tif (!OrchestrationPolicyValidator.Check(value)) {\n\t\tthrow new Error(\"Invalid orchestration policy\");\n\t}\n\tif (Object.keys(value.packages).some((capability) => !ORCHESTRATION_CAPABILITY_SET.has(capability))) {\n\t\tthrow new Error(\"Invalid orchestration policy: packages keyed by an unknown capability\");\n\t}\n\treturn deepFreeze(structuredClone(value));\n}\n\nexport const RunOrchestrationDecisionV1Schema = StrictObject({\n\tschemaVersion: Type.Literal(1),\n\tpolicyId: Type.Union([Digest, Type.Null()]),\n\tcontractVersion: Type.Literal(ORCHESTRATION_CONTRACT_VERSION),\n\trunClass: Type.Union([OrchestrationRunClassSchema, Type.Null()]),\n\ttopology: Type.Union([OrchestrationTopologySchema, Type.Null()]),\n\tdecision: Type.Union([OrchestrationDecisionV1Schema, Type.Null()]),\n\tdegradationReason: Type.Union([\n\t\tType.Literal(\"orchestration-unsupported\"),\n\t\tType.Literal(\"orchestration-disabled\"),\n\t\tType.Null(),\n\t]),\n});\nexport type RunOrchestrationDecisionV1 = Static<typeof RunOrchestrationDecisionV1Schema>;\n\n// Runtime -> host wire shapes, mirroring packages/coding-agent/src/core/tools/subagent.ts\n// (SubagentTaskEvent) and src/modes/json-event.ts (OrchestrationEnvelope). Field names\n// match the runtime exactly.\nexport const SubagentTaskEventSchema = Type.Union([\n\tStrictObject({\n\t\ttype: Type.Literal(\"schedule\"),\n\t\ttaskId: Type.String(),\n\t\tdependsOn: Type.Array(Type.String()),\n\t\townerPaths: Type.Array(Type.String()),\n\t\tbaseRevision: Type.Optional(Type.String()),\n\t\tat: NonnegativeInteger,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"wait\"),\n\t\ttaskId: Type.String(),\n\t\treason: Type.Literal(\"concurrency\"),\n\t\tat: NonnegativeInteger,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"serialize\"),\n\t\ttaskId: Type.String(),\n\t\tafter: Type.Array(Type.String()),\n\t\tat: NonnegativeInteger,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"start\"),\n\t\ttaskId: Type.String(),\n\t\tattempt: PositiveInteger,\n\t\tat: NonnegativeInteger,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"complete\"),\n\t\ttaskId: Type.String(),\n\t\tattempt: PositiveInteger,\n\t\tat: NonnegativeInteger,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"fail\"),\n\t\ttaskId: Type.String(),\n\t\tattempt: PositiveInteger,\n\t\treason: Type.String(),\n\t\tat: NonnegativeInteger,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"escalate\"),\n\t\ttaskId: Type.String(),\n\t\tfromAttempt: PositiveInteger,\n\t\ttoAttempt: PositiveInteger,\n\t\tmodel: Type.Optional(Type.String()),\n\t\tthinking: Type.Optional(Type.String()),\n\t\tat: NonnegativeInteger,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"skip\"),\n\t\ttaskId: Type.String(),\n\t\tfailedDependency: Type.String(),\n\t\tat: NonnegativeInteger,\n\t}),\n]);\nexport type SubagentTaskEvent = Static<typeof SubagentTaskEventSchema>;\n\nconst SubagentTaskEventValidator = Compile(SubagentTaskEventSchema);\n\nexport function parseSubagentTaskEvent(value: unknown): SubagentTaskEvent {\n\tif (!SubagentTaskEventValidator.Check(value)) {\n\t\tthrow new Error(\"Invalid subagent task event\");\n\t}\n\treturn deepFreeze(structuredClone(value));\n}\n\nexport const SubagentIdentityEnvelopeSchema = StrictObject({\n\ttaskId: Type.Optional(Type.String({ minLength: 1 })),\n\tparentTaskId: Type.Optional(Type.String({ minLength: 1 })),\n\tdepth: Type.Optional(Type.Integer({ minimum: 1, maximum: 3 })),\n});\nexport type SubagentIdentityEnvelope = Static<typeof SubagentIdentityEnvelopeSchema>;\n\nconst ProgressUuid = Type.String({\n\tpattern: SUBAGENT_PROGRESS_UUID_PATTERN,\n\tminLength: 36,\n\tmaxLength: 36,\n});\nconst Nullable = <const T extends TSchema>(schema: T) => Type.Union([schema, Type.Null()]);\nconst ProgressIdentifier = Nullable(\n\tType.String({\n\t\tpattern: SUBAGENT_PROGRESS_IDENTIFIER_PATTERN,\n\t\tminLength: 1,\n\t\tmaxLength: SUBAGENT_PROGRESS_AGENT_MAX_CODE_UNITS,\n\t}),\n);\nconst ProgressModel = Nullable(\n\tType.String({\n\t\tpattern: SUBAGENT_PROGRESS_MODEL_PATTERN,\n\t\tminLength: 1,\n\t\tmaxLength: SUBAGENT_PROGRESS_MODEL_MAX_CODE_UNITS,\n\t}),\n);\nconst ProgressToolCallId = Nullable(\n\tType.String({\n\t\tpattern: SUBAGENT_PROGRESS_TOOL_CALL_ID_PATTERN,\n\t\tminLength: 1,\n\t\tmaxLength: SUBAGENT_PROGRESS_TOOL_CALL_ID_MAX_CODE_UNITS,\n\t}),\n);\nconst ProgressText = (maxLength: number) =>\n\tNullable(Type.String({ pattern: SUBAGENT_PROGRESS_TEXT_PATTERN, minLength: 1, maxLength }));\n\nexport const SubagentWorkerStatusSchema = Type.Union([\n\tType.Literal(SUBAGENT_WORKER_STATUSES[0]),\n\tType.Literal(SUBAGENT_WORKER_STATUSES[1]),\n\tType.Literal(SUBAGENT_WORKER_STATUSES[2]),\n\tType.Literal(SUBAGENT_WORKER_STATUSES[3]),\n\tType.Literal(SUBAGENT_WORKER_STATUSES[4]),\n\tType.Literal(SUBAGENT_WORKER_STATUSES[5]),\n\tType.Literal(SUBAGENT_WORKER_STATUSES[6]),\n\tType.Literal(SUBAGENT_WORKER_STATUSES[7]),\n]);\n\nexport const SubagentCancellationOutcomeSchema = Type.Union([\n\tType.Literal(SUBAGENT_CANCELLATION_OUTCOMES[0]),\n\tType.Literal(SUBAGENT_CANCELLATION_OUTCOMES[1]),\n\tType.Literal(SUBAGENT_CANCELLATION_OUTCOMES[2]),\n\tType.Literal(SUBAGENT_CANCELLATION_OUTCOMES[3]),\n]);\n\nexport const SubagentFailureKindSchema = Type.Union([\n\tType.Literal(SUBAGENT_FAILURE_KINDS[0]),\n\tType.Literal(SUBAGENT_FAILURE_KINDS[1]),\n\tType.Literal(SUBAGENT_FAILURE_KINDS[2]),\n\tType.Literal(SUBAGENT_FAILURE_KINDS[3]),\n\tType.Null(),\n]);\n\nexport const SubagentRunModeSchema = Type.Union([\n\tType.Literal(SUBAGENT_RUN_MODES[0]),\n\tType.Literal(SUBAGENT_RUN_MODES[1]),\n\tType.Literal(SUBAGENT_RUN_MODES[2]),\n]);\n\n/**\n * Structural TypeBox description of the C1 worker. The hand-written parsers in `subagent-progress.ts` are\n * authoritative: they also enforce lone-surrogate and edge-whitespace rules and the cross-field invariants.\n */\nexport const SubagentWorkerSnapshotSchema = StrictObject({\n\tworkerId: ProgressUuid,\n\tattempt: NonnegativeInteger,\n\tstatus: SubagentWorkerStatusSchema,\n\tcancelRequested: Type.Boolean(),\n\tcancellationOutcome: SubagentCancellationOutcomeSchema,\n\tagent: ProgressIdentifier,\n\tlabel: ProgressIdentifier,\n\ttask: ProgressText(SUBAGENT_PROGRESS_TASK_MAX_CODE_UNITS),\n\tmodel: ProgressModel,\n\tstartedAt: Nullable(NonnegativeInteger),\n\tendedAt: Nullable(NonnegativeInteger),\n\tturns: NonnegativeInteger,\n\ttoolCalls: NonnegativeInteger,\n\tfailureKind: SubagentFailureKindSchema,\n\tresultPreview: ProgressText(SUBAGENT_PROGRESS_RESULT_PREVIEW_MAX_CODE_UNITS),\n});\n\nexport const SubagentRunSnapshotSchema = StrictObject({\n\trunId: ProgressUuid,\n\tseq: PositiveInteger,\n\tfinal: Type.Boolean(),\n\tworkers: Type.Array(SubagentWorkerSnapshotSchema, { maxItems: SUBAGENT_PROGRESS_MAX_WORKERS_PER_RUN }),\n\ttoolCallId: ProgressToolCallId,\n\tmode: SubagentRunModeSchema,\n\tstartedAt: NonnegativeInteger,\n\tendedAt: Nullable(NonnegativeInteger),\n});\n\nexport const SubagentProgressSnapshotSchema = StrictObject({\n\tschemaVersion: Type.Literal(SUBAGENT_PROGRESS_SCHEMA_VERSION),\n\truntimeId: ProgressUuid,\n\tsessionEpoch: ProgressUuid,\n\tcomplete: Type.Boolean(),\n\truns: Type.Array(SubagentRunSnapshotSchema, { maxItems: SUBAGENT_PROGRESS_MAX_RUNS }),\n});\n\n// Compile-time guard: the TypeBox schemas and the hand-declared types must describe the same shapes.\ntype SchemaMatchesType<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype AssertTrue<T extends true> = T;\ntype _ProgressSchemasMatchTypes = AssertTrue<\n\tSchemaMatchesType<Static<typeof SubagentWorkerSnapshotSchema>, SubagentWorkerSnapshot> &\n\t\tSchemaMatchesType<Static<typeof SubagentRunSnapshotSchema>, SubagentRunSnapshot> &\n\t\tSchemaMatchesType<Static<typeof SubagentProgressSnapshotSchema>, SubagentProgressSnapshot>\n>;\n\nfunction deepFreeze<T>(value: T): T {\n\tif (value === null || typeof value !== \"object\" || Object.isFrozen(value)) return value;\n\tObject.freeze(value);\n\tfor (const child of Object.values(value)) deepFreeze(child);\n\treturn value;\n}\n"]}
|
package/dist/rpc.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type SubagentProgressSnapshot } from "./subagent-progress.ts";
|
|
2
|
+
export declare const MAX_RPC_FRAME_LENGTH: number;
|
|
3
|
+
export declare const MAX_GET_STATE_RESPONSE_UTF8_BYTES: number;
|
|
4
|
+
export declare const MAX_GET_STATE_RESPONSE_CODE_UNITS: number;
|
|
5
|
+
export declare const SUBAGENT_PROGRESS_FIELD: "subagentProgress";
|
|
6
|
+
export type RpcWireCommand = {
|
|
7
|
+
id: string;
|
|
8
|
+
type: "prompt";
|
|
9
|
+
message: string;
|
|
10
|
+
} | {
|
|
11
|
+
id: string;
|
|
12
|
+
type: "abort";
|
|
13
|
+
} | {
|
|
14
|
+
id: string;
|
|
15
|
+
type: "get_state";
|
|
16
|
+
} | {
|
|
17
|
+
type: "set_model";
|
|
18
|
+
provider: string;
|
|
19
|
+
modelId: string;
|
|
20
|
+
} | {
|
|
21
|
+
id: string;
|
|
22
|
+
type: "switch_session";
|
|
23
|
+
sessionPath: string;
|
|
24
|
+
};
|
|
25
|
+
export type RpcReadyFrame = {
|
|
26
|
+
type: "ready";
|
|
27
|
+
protocolVersion: 1;
|
|
28
|
+
sessionId: string;
|
|
29
|
+
pid: number;
|
|
30
|
+
};
|
|
31
|
+
export type RpcResponseFrame = {
|
|
32
|
+
type: "response";
|
|
33
|
+
id?: string;
|
|
34
|
+
command: string;
|
|
35
|
+
success: boolean;
|
|
36
|
+
error?: string;
|
|
37
|
+
data?: unknown;
|
|
38
|
+
};
|
|
39
|
+
export type RpcNativeEventFrame = {
|
|
40
|
+
type: string;
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
};
|
|
43
|
+
export type RpcSubagentProgressMetadata = {
|
|
44
|
+
subagentProgress?: SubagentProgressSnapshot;
|
|
45
|
+
};
|
|
46
|
+
export type RpcToolExecutionUpdateProgressFrame = RpcNativeEventFrame & {
|
|
47
|
+
type: "tool_execution_update";
|
|
48
|
+
} & RpcSubagentProgressMetadata;
|
|
49
|
+
export type RpcToolExecutionEndProgressFrame = RpcNativeEventFrame & {
|
|
50
|
+
type: "tool_execution_end";
|
|
51
|
+
} & RpcSubagentProgressMetadata;
|
|
52
|
+
export type RpcGetStateProgressData = Record<string, unknown> & RpcSubagentProgressMetadata;
|
|
53
|
+
export type RpcWireFrame = RpcReadyFrame | RpcResponseFrame | RpcNativeEventFrame;
|
|
54
|
+
export declare function encodeRpcWireCommand(command: RpcWireCommand): string;
|
|
55
|
+
export declare function parseRpcWireFrame(input: unknown): RpcWireFrame;
|
|
56
|
+
/**
|
|
57
|
+
* Reads optional subagent progress metadata. Absent field means unsupported/unavailable
|
|
58
|
+
* (returns undefined); a present field is strictly parsed and throws when invalid.
|
|
59
|
+
* Update/end piggyback envelopes must carry exactly one run (0 or 2+ throws); get_state accepts 0..64 runs.
|
|
60
|
+
* No other frame fields are inspected or validated.
|
|
61
|
+
*/
|
|
62
|
+
export declare function readRpcSubagentProgress(frame: RpcWireFrame): SubagentProgressSnapshot | undefined;
|
|
63
|
+
//# sourceMappingURL=rpc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAMtG,eAAO,MAAM,oBAAoB,QAAmB,CAAC;AACrD,eAAO,MAAM,iCAAiC,QAAmB,CAAC;AAClE,eAAO,MAAM,iCAAiC,QAAmB,CAAC;AAClE,eAAO,MAAM,uBAAuB,EAAG,kBAA2B,CAAC;AAEnE,MAAM,MAAM,cAAc,GACvB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC7B;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAC;IAAC,WAAW,EAA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SAAS,CAMjG"}
|
package/dist/rpc.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { parseSubagentProgressSnapshot } from "./subagent-progress.js";
|
|
2
|
+
const MAX_IDENTIFIER_LENGTH = 256;
|
|
3
|
+
const MAX_MESSAGE_LENGTH = 100_000;
|
|
4
|
+
const MAX_ERROR_LENGTH = 10_000;
|
|
5
|
+
const MAX_SESSION_PATH_LENGTH = 4_096;
|
|
6
|
+
export const MAX_RPC_FRAME_LENGTH = 16 * 1024 * 1024;
|
|
7
|
+
export const MAX_GET_STATE_RESPONSE_UTF8_BYTES = 16 * 1024 * 1024;
|
|
8
|
+
export const MAX_GET_STATE_RESPONSE_CODE_UNITS = 16 * 1024 * 1024;
|
|
9
|
+
export const SUBAGENT_PROGRESS_FIELD = "subagentProgress";
|
|
10
|
+
export function encodeRpcWireCommand(command) {
|
|
11
|
+
if (!isRpcWireCommand(command))
|
|
12
|
+
throw new Error("Invalid HUMAIN Code CLI RPC command");
|
|
13
|
+
return `${JSON.stringify(command)}\n`;
|
|
14
|
+
}
|
|
15
|
+
export function parseRpcWireFrame(input) {
|
|
16
|
+
if (typeof input === "string" && input.length > MAX_RPC_FRAME_LENGTH) {
|
|
17
|
+
throw new Error(`HUMAIN Code CLI RPC frame exceeds the ${MAX_RPC_FRAME_LENGTH}-character limit`);
|
|
18
|
+
}
|
|
19
|
+
let frame = input;
|
|
20
|
+
if (typeof input === "string") {
|
|
21
|
+
try {
|
|
22
|
+
frame = JSON.parse(input);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
throw new Error("Invalid HUMAIN Code CLI RPC frame");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (!isRecord(frame) || typeof frame.type !== "string" || frame.type.length === 0) {
|
|
29
|
+
throw new Error("Invalid HUMAIN Code CLI RPC frame");
|
|
30
|
+
}
|
|
31
|
+
if (frame.type === "ready") {
|
|
32
|
+
if (!hasOnlyKeys(frame, ["type", "protocolVersion", "sessionId", "pid"]) ||
|
|
33
|
+
frame.protocolVersion !== 1 ||
|
|
34
|
+
!isNonemptyBoundedString(frame.sessionId, MAX_IDENTIFIER_LENGTH) ||
|
|
35
|
+
!Number.isSafeInteger(frame.pid) ||
|
|
36
|
+
frame.pid <= 0) {
|
|
37
|
+
throw new Error("Invalid HUMAIN Code CLI RPC frame");
|
|
38
|
+
}
|
|
39
|
+
return frame;
|
|
40
|
+
}
|
|
41
|
+
if (frame.type === "response") {
|
|
42
|
+
if (!hasOnlyKeys(frame, ["type", "id", "command", "success", "error", "data"]) ||
|
|
43
|
+
(frame.id !== undefined && !isNonemptyBoundedString(frame.id, MAX_IDENTIFIER_LENGTH)) ||
|
|
44
|
+
!isNonemptyBoundedString(frame.command, MAX_IDENTIFIER_LENGTH) ||
|
|
45
|
+
typeof frame.success !== "boolean" ||
|
|
46
|
+
(frame.error !== undefined && !isBoundedString(frame.error, MAX_ERROR_LENGTH))) {
|
|
47
|
+
throw new Error("Invalid HUMAIN Code CLI RPC frame");
|
|
48
|
+
}
|
|
49
|
+
return frame;
|
|
50
|
+
}
|
|
51
|
+
return frame;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Reads optional subagent progress metadata. Absent field means unsupported/unavailable
|
|
55
|
+
* (returns undefined); a present field is strictly parsed and throws when invalid.
|
|
56
|
+
* Update/end piggyback envelopes must carry exactly one run (0 or 2+ throws); get_state accepts 0..64 runs.
|
|
57
|
+
* No other frame fields are inspected or validated.
|
|
58
|
+
*/
|
|
59
|
+
export function readRpcSubagentProgress(frame) {
|
|
60
|
+
try {
|
|
61
|
+
return extractRpcSubagentProgress(frame);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
throw new Error(INVALID_PROGRESS_MESSAGE);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const INVALID_PROGRESS_MESSAGE = "Invalid subagent progress snapshot";
|
|
68
|
+
/** Own data property lookup: never invokes getters; `inherited` is true when only a non-own property exists. */
|
|
69
|
+
function readOwnData(target, key) {
|
|
70
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
71
|
+
if (descriptor === undefined)
|
|
72
|
+
return { found: false, inherited: key in target };
|
|
73
|
+
if (!("value" in descriptor))
|
|
74
|
+
throw new Error(INVALID_PROGRESS_MESSAGE);
|
|
75
|
+
return { found: true, value: descriptor.value, inherited: false };
|
|
76
|
+
}
|
|
77
|
+
function extractRpcSubagentProgress(frame) {
|
|
78
|
+
if (!isRecord(frame))
|
|
79
|
+
return undefined;
|
|
80
|
+
const type = readOwnData(frame, "type").value;
|
|
81
|
+
let carrier;
|
|
82
|
+
let singleRun = false;
|
|
83
|
+
if (type === "tool_execution_update" || type === "tool_execution_end") {
|
|
84
|
+
carrier = frame;
|
|
85
|
+
singleRun = true;
|
|
86
|
+
}
|
|
87
|
+
else if (type === "response") {
|
|
88
|
+
if (readOwnData(frame, "command").value !== "get_state" || readOwnData(frame, "success").value !== true) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
carrier = readOwnData(frame, "data").value;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
if (!isRecord(carrier))
|
|
97
|
+
return undefined;
|
|
98
|
+
const field = readOwnData(carrier, SUBAGENT_PROGRESS_FIELD);
|
|
99
|
+
if (field.inherited)
|
|
100
|
+
throw new Error(INVALID_PROGRESS_MESSAGE);
|
|
101
|
+
if (!field.found)
|
|
102
|
+
return undefined;
|
|
103
|
+
const snapshot = parseSubagentProgressSnapshot(field.value);
|
|
104
|
+
if (singleRun && snapshot.runs.length !== 1)
|
|
105
|
+
throw new Error(INVALID_PROGRESS_MESSAGE);
|
|
106
|
+
return snapshot;
|
|
107
|
+
}
|
|
108
|
+
function isRpcWireCommand(value) {
|
|
109
|
+
if (!isRecord(value))
|
|
110
|
+
return false;
|
|
111
|
+
switch (value.type) {
|
|
112
|
+
case "prompt":
|
|
113
|
+
return (hasOnlyKeys(value, ["id", "type", "message"]) &&
|
|
114
|
+
isNonemptyBoundedString(value.id, MAX_IDENTIFIER_LENGTH) &&
|
|
115
|
+
isNonemptyBoundedString(value.message, MAX_MESSAGE_LENGTH));
|
|
116
|
+
case "abort":
|
|
117
|
+
case "get_state":
|
|
118
|
+
return hasOnlyKeys(value, ["id", "type"]) && isNonemptyBoundedString(value.id, MAX_IDENTIFIER_LENGTH);
|
|
119
|
+
case "set_model":
|
|
120
|
+
return (hasOnlyKeys(value, ["type", "provider", "modelId"]) &&
|
|
121
|
+
isNonemptyBoundedString(value.provider, MAX_IDENTIFIER_LENGTH) &&
|
|
122
|
+
isNonemptyBoundedString(value.modelId, MAX_IDENTIFIER_LENGTH));
|
|
123
|
+
case "switch_session":
|
|
124
|
+
return (hasOnlyKeys(value, ["id", "type", "sessionPath"]) &&
|
|
125
|
+
isNonemptyBoundedString(value.id, MAX_IDENTIFIER_LENGTH) &&
|
|
126
|
+
isNonemptyBoundedString(value.sessionPath, MAX_SESSION_PATH_LENGTH));
|
|
127
|
+
default:
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function isRecord(value) {
|
|
132
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
133
|
+
}
|
|
134
|
+
function isNonemptyBoundedString(value, maxLength) {
|
|
135
|
+
return typeof value === "string" && value.length > 0 && value.length <= maxLength;
|
|
136
|
+
}
|
|
137
|
+
function isBoundedString(value, maxLength) {
|
|
138
|
+
return typeof value === "string" && value.length <= maxLength;
|
|
139
|
+
}
|
|
140
|
+
function hasOnlyKeys(value, allowed) {
|
|
141
|
+
const keys = Object.keys(value);
|
|
142
|
+
return keys.every((key) => allowed.includes(key)) && allowed.every((key) => key in value || isOptionalKey(key));
|
|
143
|
+
}
|
|
144
|
+
function isOptionalKey(key) {
|
|
145
|
+
return key === "id" || key === "error" || key === "data";
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=rpc.js.map
|
package/dist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CAAC;AAED,SAAS,WAAW,CAAC,KAA8B,EAAE,OAA0B;IAC9E,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;AACjH,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IACjC,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,MAAM,CAAC;AAC1D,CAAC","sourcesContent":["import { parseSubagentProgressSnapshot, type SubagentProgressSnapshot } from \"./subagent-progress.ts\";\n\nconst MAX_IDENTIFIER_LENGTH = 256;\nconst MAX_MESSAGE_LENGTH = 100_000;\nconst MAX_ERROR_LENGTH = 10_000;\nconst MAX_SESSION_PATH_LENGTH = 4_096;\nexport const MAX_RPC_FRAME_LENGTH = 16 * 1024 * 1024;\nexport const MAX_GET_STATE_RESPONSE_UTF8_BYTES = 16 * 1024 * 1024;\nexport const MAX_GET_STATE_RESPONSE_CODE_UNITS = 16 * 1024 * 1024;\nexport const SUBAGENT_PROGRESS_FIELD = \"subagentProgress\" as const;\n\nexport type RpcWireCommand =\n\t| { id: string; type: \"prompt\"; message: string }\n\t| { id: string; type: \"abort\" }\n\t| { id: string; type: \"get_state\" }\n\t| { type: \"set_model\"; provider: string; modelId: string }\n\t| { id: string; type: \"switch_session\"; sessionPath: string };\n\nexport type RpcReadyFrame = {\n\ttype: \"ready\";\n\tprotocolVersion: 1;\n\tsessionId: string;\n\tpid: number;\n};\n\nexport type RpcResponseFrame = {\n\ttype: \"response\";\n\tid?: string;\n\tcommand: string;\n\tsuccess: boolean;\n\terror?: string;\n\tdata?: unknown;\n};\n\nexport type RpcNativeEventFrame = { type: string; [key: string]: unknown };\nexport type RpcSubagentProgressMetadata = { subagentProgress?: SubagentProgressSnapshot };\nexport type RpcToolExecutionUpdateProgressFrame = RpcNativeEventFrame & {\n\ttype: \"tool_execution_update\";\n} & RpcSubagentProgressMetadata;\nexport type RpcToolExecutionEndProgressFrame = RpcNativeEventFrame & {\n\ttype: \"tool_execution_end\";\n} & RpcSubagentProgressMetadata;\nexport type RpcGetStateProgressData = Record<string, unknown> & RpcSubagentProgressMetadata;\nexport type RpcWireFrame = RpcReadyFrame | RpcResponseFrame | RpcNativeEventFrame;\n\nexport function encodeRpcWireCommand(command: RpcWireCommand): string {\n\tif (!isRpcWireCommand(command)) throw new Error(\"Invalid HUMAIN Code CLI RPC command\");\n\treturn `${JSON.stringify(command)}\\n`;\n}\n\nexport function parseRpcWireFrame(input: unknown): RpcWireFrame {\n\tif (typeof input === \"string\" && input.length > MAX_RPC_FRAME_LENGTH) {\n\t\tthrow new Error(`HUMAIN Code CLI RPC frame exceeds the ${MAX_RPC_FRAME_LENGTH}-character limit`);\n\t}\n\tlet frame: unknown = input;\n\tif (typeof input === \"string\") {\n\t\ttry {\n\t\t\tframe = JSON.parse(input);\n\t\t} catch {\n\t\t\tthrow new Error(\"Invalid HUMAIN Code CLI RPC frame\");\n\t\t}\n\t}\n\tif (!isRecord(frame) || typeof frame.type !== \"string\" || frame.type.length === 0) {\n\t\tthrow new Error(\"Invalid HUMAIN Code CLI RPC frame\");\n\t}\n\tif (frame.type === \"ready\") {\n\t\tif (\n\t\t\t!hasOnlyKeys(frame, [\"type\", \"protocolVersion\", \"sessionId\", \"pid\"]) ||\n\t\t\tframe.protocolVersion !== 1 ||\n\t\t\t!isNonemptyBoundedString(frame.sessionId, MAX_IDENTIFIER_LENGTH) ||\n\t\t\t!Number.isSafeInteger(frame.pid) ||\n\t\t\t(frame.pid as number) <= 0\n\t\t) {\n\t\t\tthrow new Error(\"Invalid HUMAIN Code CLI RPC frame\");\n\t\t}\n\t\treturn frame as RpcReadyFrame;\n\t}\n\tif (frame.type === \"response\") {\n\t\tif (\n\t\t\t!hasOnlyKeys(frame, [\"type\", \"id\", \"command\", \"success\", \"error\", \"data\"]) ||\n\t\t\t(frame.id !== undefined && !isNonemptyBoundedString(frame.id, MAX_IDENTIFIER_LENGTH)) ||\n\t\t\t!isNonemptyBoundedString(frame.command, MAX_IDENTIFIER_LENGTH) ||\n\t\t\ttypeof frame.success !== \"boolean\" ||\n\t\t\t(frame.error !== undefined && !isBoundedString(frame.error, MAX_ERROR_LENGTH))\n\t\t) {\n\t\t\tthrow new Error(\"Invalid HUMAIN Code CLI RPC frame\");\n\t\t}\n\t\treturn frame as RpcResponseFrame;\n\t}\n\treturn frame as RpcNativeEventFrame;\n}\n\n/**\n * Reads optional subagent progress metadata. Absent field means unsupported/unavailable\n * (returns undefined); a present field is strictly parsed and throws when invalid.\n * Update/end piggyback envelopes must carry exactly one run (0 or 2+ throws); get_state accepts 0..64 runs.\n * No other frame fields are inspected or validated.\n */\nexport function readRpcSubagentProgress(frame: RpcWireFrame): SubagentProgressSnapshot | undefined {\n\ttry {\n\t\treturn extractRpcSubagentProgress(frame);\n\t} catch {\n\t\tthrow new Error(INVALID_PROGRESS_MESSAGE);\n\t}\n}\n\nconst INVALID_PROGRESS_MESSAGE = \"Invalid subagent progress snapshot\";\n\n/** Own data property lookup: never invokes getters; `inherited` is true when only a non-own property exists. */\nfunction readOwnData(target: object, key: string): { found: boolean; value?: unknown; inherited: boolean } {\n\tconst descriptor = Object.getOwnPropertyDescriptor(target, key);\n\tif (descriptor === undefined) return { found: false, inherited: key in target };\n\tif (!(\"value\" in descriptor)) throw new Error(INVALID_PROGRESS_MESSAGE);\n\treturn { found: true, value: descriptor.value, inherited: false };\n}\n\nfunction extractRpcSubagentProgress(frame: RpcWireFrame): SubagentProgressSnapshot | undefined {\n\tif (!isRecord(frame)) return undefined;\n\tconst type = readOwnData(frame, \"type\").value;\n\tlet carrier: unknown;\n\tlet singleRun = false;\n\tif (type === \"tool_execution_update\" || type === \"tool_execution_end\") {\n\t\tcarrier = frame;\n\t\tsingleRun = true;\n\t} else if (type === \"response\") {\n\t\tif (readOwnData(frame, \"command\").value !== \"get_state\" || readOwnData(frame, \"success\").value !== true) {\n\t\t\treturn undefined;\n\t\t}\n\t\tcarrier = readOwnData(frame, \"data\").value;\n\t} else {\n\t\treturn undefined;\n\t}\n\tif (!isRecord(carrier)) return undefined;\n\tconst field = readOwnData(carrier, SUBAGENT_PROGRESS_FIELD);\n\tif (field.inherited) throw new Error(INVALID_PROGRESS_MESSAGE);\n\tif (!field.found) return undefined;\n\tconst snapshot = parseSubagentProgressSnapshot(field.value);\n\tif (singleRun && snapshot.runs.length !== 1) throw new Error(INVALID_PROGRESS_MESSAGE);\n\treturn snapshot;\n}\n\nfunction isRpcWireCommand(value: unknown): value is RpcWireCommand {\n\tif (!isRecord(value)) return false;\n\tswitch (value.type) {\n\t\tcase \"prompt\":\n\t\t\treturn (\n\t\t\t\thasOnlyKeys(value, [\"id\", \"type\", \"message\"]) &&\n\t\t\t\tisNonemptyBoundedString(value.id, MAX_IDENTIFIER_LENGTH) &&\n\t\t\t\tisNonemptyBoundedString(value.message, MAX_MESSAGE_LENGTH)\n\t\t\t);\n\t\tcase \"abort\":\n\t\tcase \"get_state\":\n\t\t\treturn hasOnlyKeys(value, [\"id\", \"type\"]) && isNonemptyBoundedString(value.id, MAX_IDENTIFIER_LENGTH);\n\t\tcase \"set_model\":\n\t\t\treturn (\n\t\t\t\thasOnlyKeys(value, [\"type\", \"provider\", \"modelId\"]) &&\n\t\t\t\tisNonemptyBoundedString(value.provider, MAX_IDENTIFIER_LENGTH) &&\n\t\t\t\tisNonemptyBoundedString(value.modelId, MAX_IDENTIFIER_LENGTH)\n\t\t\t);\n\t\tcase \"switch_session\":\n\t\t\treturn (\n\t\t\t\thasOnlyKeys(value, [\"id\", \"type\", \"sessionPath\"]) &&\n\t\t\t\tisNonemptyBoundedString(value.id, MAX_IDENTIFIER_LENGTH) &&\n\t\t\t\tisNonemptyBoundedString(value.sessionPath, MAX_SESSION_PATH_LENGTH)\n\t\t\t);\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isNonemptyBoundedString(value: unknown, maxLength: number): value is string {\n\treturn typeof value === \"string\" && value.length > 0 && value.length <= maxLength;\n}\n\nfunction isBoundedString(value: unknown, maxLength: number): value is string {\n\treturn typeof value === \"string\" && value.length <= maxLength;\n}\n\nfunction hasOnlyKeys(value: Record<string, unknown>, allowed: readonly string[]): boolean {\n\tconst keys = Object.keys(value);\n\treturn keys.every((key) => allowed.includes(key)) && allowed.every((key) => key in value || isOptionalKey(key));\n}\n\nfunction isOptionalKey(key: string): boolean {\n\treturn key === \"id\" || key === \"error\" || key === \"data\";\n}\n"]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subagent progress projection contract (C1, schemaVersion 1).
|
|
3
|
+
*
|
|
4
|
+
* This module is the runtime-neutral core of the contract: it imports nothing, uses no Node APIs and no
|
|
5
|
+
* schema library, so the `./rpc` entry can validate progress metadata without pulling TypeBox. The
|
|
6
|
+
* TypeBox schemas in `orchestration.ts` describe the same shapes and are checked against the types here
|
|
7
|
+
* at compile time.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SUBAGENT_PROGRESS_SCHEMA_VERSION: 1;
|
|
10
|
+
export declare const SUBAGENT_WORKER_STATUSES: readonly ["queued", "waiting", "running", "completed", "failed", "cancelled", "skipped", "unresolved"];
|
|
11
|
+
export type SubagentWorkerStatus = (typeof SUBAGENT_WORKER_STATUSES)[number];
|
|
12
|
+
export declare const SUBAGENT_CANCELLATION_OUTCOMES: readonly ["none", "not_started", "direct_worker_terminated", "unconfirmed"];
|
|
13
|
+
export type SubagentCancellationOutcome = (typeof SUBAGENT_CANCELLATION_OUTCOMES)[number];
|
|
14
|
+
export declare const SUBAGENT_FAILURE_KINDS: readonly ["spawn_failed", "process_error", "model_error", "merge_failed"];
|
|
15
|
+
export type SubagentFailureKind = (typeof SUBAGENT_FAILURE_KINDS)[number];
|
|
16
|
+
export declare const SUBAGENT_RUN_MODES: readonly ["single", "parallel", "chain"];
|
|
17
|
+
export type SubagentRunMode = (typeof SUBAGENT_RUN_MODES)[number];
|
|
18
|
+
export declare const SUBAGENT_PROGRESS_MAX_RUNS = 64;
|
|
19
|
+
export declare const SUBAGENT_PROGRESS_MAX_FINALIZED_RUNS = 16;
|
|
20
|
+
export declare const SUBAGENT_PROGRESS_MAX_WORKERS_PER_RUN = 32;
|
|
21
|
+
export declare const SUBAGENT_PROGRESS_MAX_RUN_UTF8_BYTES: number;
|
|
22
|
+
export declare const SUBAGENT_PROGRESS_MAX_RUN_CODE_UNITS: number;
|
|
23
|
+
export declare const SUBAGENT_PROGRESS_MAX_RETAINED_RUNS_UTF8_BYTES: number;
|
|
24
|
+
export declare const SUBAGENT_PROGRESS_MAX_ENVELOPE_UTF8_BYTES: number;
|
|
25
|
+
export declare const SUBAGENT_PROGRESS_MAX_ENVELOPE_CODE_UNITS: number;
|
|
26
|
+
export declare const SUBAGENT_PROGRESS_TASK_MAX_CODE_UNITS = 120;
|
|
27
|
+
export declare const SUBAGENT_PROGRESS_RESULT_PREVIEW_MAX_CODE_UNITS = 160;
|
|
28
|
+
export declare const SUBAGENT_PROGRESS_AGENT_MAX_CODE_UNITS = 64;
|
|
29
|
+
export declare const SUBAGENT_PROGRESS_LABEL_MAX_CODE_UNITS = 64;
|
|
30
|
+
export declare const SUBAGENT_PROGRESS_MODEL_MAX_CODE_UNITS = 128;
|
|
31
|
+
export declare const SUBAGENT_PROGRESS_TOOL_CALL_ID_MAX_CODE_UNITS = 256;
|
|
32
|
+
/** Regular-expression sources shared with the TypeBox schemas in `orchestration.ts`. */
|
|
33
|
+
export declare const 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}$";
|
|
34
|
+
export declare const SUBAGENT_PROGRESS_IDENTIFIER_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$";
|
|
35
|
+
export declare const SUBAGENT_PROGRESS_MODEL_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._:/@+-]{0,127}$";
|
|
36
|
+
export declare const SUBAGENT_PROGRESS_TOOL_CALL_ID_PATTERN = "^[\\x21-\\x7E]{1,256}$";
|
|
37
|
+
/** Structural subset of the presentation-text rule; the parsers additionally reject lone surrogates and edge whitespace. */
|
|
38
|
+
export declare const SUBAGENT_PROGRESS_TEXT_PATTERN = "^[^\\u0000-\\u001F\\u007F-\\u009F\\u00AD\\u034F\\u061C\\u180E\\u200B-\\u200F\\u2028-\\u202E\\u2060-\\u2069\\uFEFF]+$";
|
|
39
|
+
export interface SubagentWorkerSnapshot {
|
|
40
|
+
workerId: string;
|
|
41
|
+
attempt: number;
|
|
42
|
+
status: SubagentWorkerStatus;
|
|
43
|
+
cancelRequested: boolean;
|
|
44
|
+
cancellationOutcome: SubagentCancellationOutcome;
|
|
45
|
+
agent: string | null;
|
|
46
|
+
label: string | null;
|
|
47
|
+
task: string | null;
|
|
48
|
+
model: string | null;
|
|
49
|
+
startedAt: number | null;
|
|
50
|
+
endedAt: number | null;
|
|
51
|
+
turns: number;
|
|
52
|
+
toolCalls: number;
|
|
53
|
+
failureKind: SubagentFailureKind | null;
|
|
54
|
+
resultPreview: string | null;
|
|
55
|
+
}
|
|
56
|
+
export interface SubagentRunSnapshot {
|
|
57
|
+
runId: string;
|
|
58
|
+
seq: number;
|
|
59
|
+
final: boolean;
|
|
60
|
+
workers: SubagentWorkerSnapshot[];
|
|
61
|
+
toolCallId: string | null;
|
|
62
|
+
mode: SubagentRunMode;
|
|
63
|
+
startedAt: number;
|
|
64
|
+
endedAt: number | null;
|
|
65
|
+
}
|
|
66
|
+
export interface SubagentProgressSnapshot {
|
|
67
|
+
schemaVersion: typeof SUBAGENT_PROGRESS_SCHEMA_VERSION;
|
|
68
|
+
runtimeId: string;
|
|
69
|
+
sessionEpoch: string;
|
|
70
|
+
complete: boolean;
|
|
71
|
+
runs: SubagentRunSnapshot[];
|
|
72
|
+
}
|
|
73
|
+
/** True only for lowercase canonical v4 UUIDs as produced by `crypto.randomUUID()`. */
|
|
74
|
+
export declare function isCanonicalSubagentProgressUuid(value: unknown): value is string;
|
|
75
|
+
/**
|
|
76
|
+
* Compact JSON size in UTF-8 bytes and UTF-16 code units.
|
|
77
|
+
* Intended for plain normalized snapshots only; it does not sanitize arbitrary input.
|
|
78
|
+
* Throws a fixed error if the value does not serialize to a JSON string.
|
|
79
|
+
*/
|
|
80
|
+
export declare function measureSubagentProgressJson(value: unknown): {
|
|
81
|
+
utf8Bytes: number;
|
|
82
|
+
codeUnits: number;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Presentation text: non-empty, at most `max` UTF-16 code units, no leading/trailing whitespace,
|
|
86
|
+
* no lone surrogates and no control, bidirectional-control, zero-width or line/paragraph separator characters.
|
|
87
|
+
*/
|
|
88
|
+
export declare function isSubagentPresentationText(value: unknown, max: number): value is string;
|
|
89
|
+
/** Code units examined by `toSubagentPresentationText`: once while skipping leading blanks, once while collecting. */
|
|
90
|
+
export declare const SUBAGENT_PRESENTATION_SCAN_WINDOW_CODE_UNITS = 4096;
|
|
91
|
+
/**
|
|
92
|
+
* Producer helper: turns arbitrary input into presentation text or null.
|
|
93
|
+
* Forbidden characters, whitespace and lone surrogates act as separators; separator runs collapse to one space and
|
|
94
|
+
* leading/trailing separators are dropped. Output longer than `max` is cut on a code-point boundary to `max - 1`
|
|
95
|
+
* code units plus "…".
|
|
96
|
+
*
|
|
97
|
+
* Work is bounded regardless of input size: at most `SUBAGENT_PRESENTATION_SCAN_WINDOW_CODE_UNITS` code units are
|
|
98
|
+
* skipped at the start (an input that is only separators within that window yields null) and at most that many more
|
|
99
|
+
* are examined while collecting at most `max` code units of output. Input left unexamined when the collecting window
|
|
100
|
+
* ends is treated as truncated. The input is never passed to replace/split/trim.
|
|
101
|
+
* A non-null result always satisfies `isSubagentPresentationText(result, max)`.
|
|
102
|
+
*/
|
|
103
|
+
export declare function toSubagentPresentationText(input: unknown, max: number): string | null;
|
|
104
|
+
export declare function parseSubagentRunSnapshot(value: unknown): SubagentRunSnapshot;
|
|
105
|
+
export declare function parseSubagentProgressSnapshot(value: unknown): SubagentProgressSnapshot;
|
|
106
|
+
//# sourceMappingURL=subagent-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-progress.d.ts","sourceRoot":"","sources":["../src/subagent-progress.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,gCAAgC,EAAG,CAAU,CAAC;AAE3D,eAAO,MAAM,wBAAwB,YACpC,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,WAAW,EACX,SAAS,EACT,YAAY,CACH,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,eAAO,MAAM,8BAA8B,YAC1C,MAAM,EACN,aAAa,EACb,0BAA0B,EAC1B,aAAa,CACJ,CAAC;AACX,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1F,eAAO,MAAM,sBAAsB,YAAI,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,CAAU,CAAC;AAChH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,eAAO,MAAM,kBAAkB,YAAI,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAU,CAAC;AAC3E,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAA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