@cleocode/contracts 2026.6.13 → 2026.6.15
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/dist/__tests__/operation-def.test.js +4 -1
- package/dist/__tests__/operation-def.test.js.map +1 -1
- package/dist/__tests__/provider-def.test.d.ts +12 -0
- package/dist/__tests__/provider-def.test.d.ts.map +1 -0
- package/dist/__tests__/provider-def.test.js +84 -0
- package/dist/__tests__/provider-def.test.js.map +1 -0
- package/dist/__tests__/service-provider.test.d.ts +17 -0
- package/dist/__tests__/service-provider.test.d.ts.map +1 -0
- package/dist/__tests__/service-provider.test.js +108 -0
- package/dist/__tests__/service-provider.test.js.map +1 -0
- package/dist/boundary.d.ts +52 -0
- package/dist/boundary.d.ts.map +1 -1
- package/dist/boundary.js +23 -0
- package/dist/boundary.js.map +1 -1
- package/dist/branch-lock.d.ts +4 -0
- package/dist/branch-lock.d.ts.map +1 -1
- package/dist/branch-lock.js.map +1 -1
- package/dist/conduit.d.ts +171 -0
- package/dist/conduit.d.ts.map +1 -1
- package/dist/config/index.d.ts +23 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +22 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config.d.ts +109 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.d.ts +21 -0
- package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.d.ts.map +1 -0
- package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.js +84 -0
- package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.js.map +1 -0
- package/dist/dispatch/identity.d.ts +1 -1
- package/dist/dispatch/identity.d.ts.map +1 -1
- package/dist/dispatch/identity.js +20 -0
- package/dist/dispatch/identity.js.map +1 -1
- package/dist/dispatch/operation-def.d.ts +20 -0
- package/dist/dispatch/operation-def.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +1030 -46
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/index.d.ts +17 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/lease-ipc/__tests__/freeze.test.js +92 -0
- package/dist/lease-ipc/__tests__/freeze.test.js.map +1 -1
- package/dist/lease-ipc/index.d.ts +2 -2
- package/dist/lease-ipc/index.d.ts.map +1 -1
- package/dist/lease-ipc/index.js +1 -1
- package/dist/lease-ipc/index.js.map +1 -1
- package/dist/lease-ipc/messages.d.ts +167 -3
- package/dist/lease-ipc/messages.d.ts.map +1 -1
- package/dist/lease-ipc/messages.js +93 -0
- package/dist/lease-ipc/messages.js.map +1 -1
- package/dist/llm/catalog-schema.d.ts +242 -0
- package/dist/llm/catalog-schema.d.ts.map +1 -0
- package/dist/llm/catalog-schema.js +153 -0
- package/dist/llm/catalog-schema.js.map +1 -0
- package/dist/llm/catalog-schema.json +139 -0
- package/dist/llm/index.d.ts +15 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +14 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/oauth.d.ts +16 -2
- package/dist/llm/oauth.d.ts.map +1 -1
- package/dist/llm/onboarding.d.ts +126 -0
- package/dist/llm/onboarding.d.ts.map +1 -0
- package/dist/llm/onboarding.js +34 -0
- package/dist/llm/onboarding.js.map +1 -0
- package/dist/llm/provider-def.d.ts +254 -0
- package/dist/llm/provider-def.d.ts.map +1 -0
- package/dist/llm/provider-def.js +93 -0
- package/dist/llm/provider-def.js.map +1 -0
- package/dist/llm/system-resolver.d.ts +42 -0
- package/dist/llm/system-resolver.d.ts.map +1 -1
- package/dist/operations/admin.d.ts +124 -1
- package/dist/operations/admin.d.ts.map +1 -1
- package/dist/operations/entities.d.ts +110 -0
- package/dist/operations/entities.d.ts.map +1 -0
- package/dist/operations/entities.js +695 -0
- package/dist/operations/entities.js.map +1 -0
- package/dist/operations/llm.d.ts +16 -1
- package/dist/operations/llm.d.ts.map +1 -1
- package/dist/operations/output-contracts-data.d.ts.map +1 -1
- package/dist/operations/output-contracts-data.js +230 -0
- package/dist/operations/output-contracts-data.js.map +1 -1
- package/dist/operations/service.d.ts +68 -0
- package/dist/operations/service.d.ts.map +1 -0
- package/dist/operations/service.js +336 -0
- package/dist/operations/service.js.map +1 -0
- package/dist/operations/tasks.d.ts +109 -0
- package/dist/operations/tasks.d.ts.map +1 -1
- package/dist/operations/tasks.js.map +1 -1
- package/dist/operations/worktree.d.ts +11 -1
- package/dist/operations/worktree.d.ts.map +1 -1
- package/dist/playbook.d.ts +56 -0
- package/dist/playbook.d.ts.map +1 -1
- package/dist/release/plan.d.ts +5 -5
- package/dist/spawn.d.ts +70 -0
- package/dist/spawn.d.ts.map +1 -1
- package/dist/spawn.js +1 -0
- package/dist/spawn.js.map +1 -1
- package/dist/vault/service-provider.d.ts +343 -0
- package/dist/vault/service-provider.d.ts.map +1 -0
- package/dist/vault/service-provider.js +857 -0
- package/dist/vault/service-provider.js.map +1 -0
- package/dist/workgraph.d.ts +12 -12
- package/package.json +10 -2
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/__tests__/operation-def.test.ts +6 -1
- package/src/__tests__/provider-def.test.ts +93 -0
- package/src/__tests__/service-provider.test.ts +129 -0
- package/src/boundary.ts +69 -0
- package/src/branch-lock.ts +4 -0
- package/src/conduit.ts +200 -0
- package/src/config/index.ts +35 -0
- package/src/config.ts +116 -1
- package/src/dispatch/__tests__/tasks-gateway-crud-ops.test.ts +99 -0
- package/src/dispatch/identity.ts +20 -0
- package/src/dispatch/operation-def.ts +21 -0
- package/src/dispatch/operations-registry.ts +1062 -36
- package/src/index.ts +147 -2
- package/src/lease-ipc/__tests__/freeze.test.ts +96 -0
- package/src/lease-ipc/index.ts +12 -0
- package/src/lease-ipc/messages.ts +117 -0
- package/src/llm/catalog-schema.json +139 -0
- package/src/llm/catalog-schema.ts +184 -0
- package/src/llm/index.ts +29 -0
- package/src/llm/oauth.ts +16 -2
- package/src/llm/onboarding.ts +131 -0
- package/src/llm/provider-def.ts +291 -0
- package/src/llm/system-resolver.ts +45 -0
- package/src/operations/admin.ts +144 -0
- package/src/operations/entities.ts +758 -0
- package/src/operations/llm.ts +16 -0
- package/src/operations/output-contracts-data.ts +264 -0
- package/src/operations/service.ts +360 -0
- package/src/operations/tasks.ts +119 -0
- package/src/operations/worktree.ts +11 -0
- package/src/playbook.ts +56 -0
- package/src/spawn.ts +79 -0
- package/src/vault/service-provider.ts +1137 -0
package/src/index.ts
CHANGED
|
@@ -140,12 +140,14 @@ export type {
|
|
|
140
140
|
export type {
|
|
141
141
|
BoundaryEntry,
|
|
142
142
|
CanonicalHome,
|
|
143
|
+
ChannelBoundaryEntry,
|
|
144
|
+
ChannelTrustPosture,
|
|
143
145
|
PerfBudget,
|
|
144
146
|
SafetyBudget,
|
|
145
147
|
ThroughputThreshold,
|
|
146
148
|
WorkloadIntent,
|
|
147
149
|
} from './boundary.js';
|
|
148
|
-
export { BOUNDARY_REGISTRY } from './boundary.js';
|
|
150
|
+
export { BOUNDARY_REGISTRY, CHANNEL_BOUNDARY_REGISTRY } from './boundary.js';
|
|
149
151
|
// === Brain/Memory Types ===
|
|
150
152
|
export type {
|
|
151
153
|
BackupRecoverBrainResult,
|
|
@@ -213,6 +215,11 @@ export type {
|
|
|
213
215
|
} from './code-symbol.js';
|
|
214
216
|
// === Conduit Protocol (agent-to-agent communication) ===
|
|
215
217
|
export type {
|
|
218
|
+
ChannelAdapter,
|
|
219
|
+
ChannelConfig,
|
|
220
|
+
ChannelHealth,
|
|
221
|
+
ChannelHealthStatus,
|
|
222
|
+
ChannelSession,
|
|
216
223
|
Conduit,
|
|
217
224
|
ConduitConfig,
|
|
218
225
|
ConduitMessage,
|
|
@@ -223,6 +230,8 @@ export type {
|
|
|
223
230
|
ConduitTopicPublishOptions,
|
|
224
231
|
ConduitTopicSubscribeOptions,
|
|
225
232
|
ConduitUnsubscribe,
|
|
233
|
+
InboundMsg,
|
|
234
|
+
OutboundReply,
|
|
226
235
|
} from './conduit.js';
|
|
227
236
|
// === Config Manifest (T9876 / Saga T9855) ===
|
|
228
237
|
export type {
|
|
@@ -252,6 +261,7 @@ export type {
|
|
|
252
261
|
ClaudeSpawnMode,
|
|
253
262
|
CleoConfig,
|
|
254
263
|
ConfigSource,
|
|
264
|
+
DaemonConfig,
|
|
255
265
|
DateFormat,
|
|
256
266
|
DecisionsConfig,
|
|
257
267
|
DepsRequiredAt,
|
|
@@ -276,6 +286,8 @@ export type {
|
|
|
276
286
|
OutputFormat,
|
|
277
287
|
ProviderConfig,
|
|
278
288
|
ResolvedValue,
|
|
289
|
+
ResourcesConfig,
|
|
290
|
+
ResourcesPsiConfig,
|
|
279
291
|
RoleName,
|
|
280
292
|
SessionConfig,
|
|
281
293
|
SessionSummaryInput,
|
|
@@ -759,6 +771,10 @@ export type {
|
|
|
759
771
|
LeaseRenewRequest,
|
|
760
772
|
LeaseRevokedResponse,
|
|
761
773
|
LeaseScope,
|
|
774
|
+
QueueAdmitDisposition,
|
|
775
|
+
QueueAdmitRequest,
|
|
776
|
+
QueueAdmitResultResponse,
|
|
777
|
+
QueuePriorityClass,
|
|
762
778
|
RateCheckRequest,
|
|
763
779
|
RateResultResponse,
|
|
764
780
|
ToolGrantedResponse,
|
|
@@ -786,11 +802,38 @@ export {
|
|
|
786
802
|
LeaseRenewRequestSchema,
|
|
787
803
|
LeaseRevokedResponseSchema,
|
|
788
804
|
LeaseScopeSchema,
|
|
805
|
+
QueueAdmitDispositionSchema,
|
|
806
|
+
QueueAdmitRequestSchema,
|
|
807
|
+
QueueAdmitResultResponseSchema,
|
|
808
|
+
QueuePriorityClassSchema,
|
|
789
809
|
RateCheckRequestSchema,
|
|
790
810
|
RateResultResponseSchema,
|
|
791
811
|
ToolGrantedResponseSchema,
|
|
792
812
|
ToolGrantRequestSchema,
|
|
793
813
|
} from './lease-ipc/index.js';
|
|
814
|
+
export type {
|
|
815
|
+
CatalogAuthType,
|
|
816
|
+
CatalogModelEntry,
|
|
817
|
+
CatalogModelStatus,
|
|
818
|
+
CatalogProvider,
|
|
819
|
+
CuratedCatalog,
|
|
820
|
+
ModelsCatalogRowInsert,
|
|
821
|
+
ModelsCatalogRowSelect,
|
|
822
|
+
} from './llm/catalog-schema.js';
|
|
823
|
+
// === E8 Curated Models Catalog (T11731 · offline-first catalog SSoT) ===
|
|
824
|
+
export {
|
|
825
|
+
CATALOG_AUTH_TYPES,
|
|
826
|
+
CATALOG_MODEL_STATUSES,
|
|
827
|
+
catalogCostSchema,
|
|
828
|
+
catalogLimitSchema,
|
|
829
|
+
catalogModalitiesSchema,
|
|
830
|
+
catalogModelEntrySchema,
|
|
831
|
+
catalogModelProviderSchema,
|
|
832
|
+
catalogProviderSchema,
|
|
833
|
+
curatedCatalogSchema,
|
|
834
|
+
modelsCatalogRowInsertSchema,
|
|
835
|
+
modelsCatalogRowSelectSchema,
|
|
836
|
+
} from './llm/catalog-schema.js';
|
|
794
837
|
// === LLM Error Taxonomy (T9270 — Hermes FailoverReason port) ===
|
|
795
838
|
export type { ClassifiedError, FailoverReason } from './llm/failover-reason.js';
|
|
796
839
|
// === Phase 4 Unified Architecture (T9281 / ADR-072) — Session + Executor interfaces ===
|
|
@@ -826,6 +869,14 @@ export type {
|
|
|
826
869
|
} from './llm/normalized-response.js';
|
|
827
870
|
// === OAuth types — SSoT shared between core and cleo (T9302) ===
|
|
828
871
|
export type { OAuthMode, OAuthTokens, PkceFlowConfig, ProviderOAuthConfig } from './llm/oauth.js';
|
|
872
|
+
// === Onboarding login engine result envelope (T11724 · M3) ===
|
|
873
|
+
export type {
|
|
874
|
+
OnboardingAuthMode,
|
|
875
|
+
OnboardingResult,
|
|
876
|
+
OnboardingStepName,
|
|
877
|
+
OnboardingStepResult,
|
|
878
|
+
OnboardingStepStatus,
|
|
879
|
+
} from './llm/onboarding.js';
|
|
829
880
|
// === Phase 4/5 Plugin LLM facade types (T9305 / T9313) ===
|
|
830
881
|
export type { PluginLlmComplete, PluginLlmContext } from './llm/plugin-llm.js';
|
|
831
882
|
export {
|
|
@@ -834,6 +885,23 @@ export {
|
|
|
834
885
|
PluginModelGateError,
|
|
835
886
|
PluginRateLimitedError,
|
|
836
887
|
} from './llm/plugin-llm.js';
|
|
888
|
+
export type {
|
|
889
|
+
AiSdkEndpoint,
|
|
890
|
+
AnthropicMessagesEndpoint,
|
|
891
|
+
OAuthFlowDef,
|
|
892
|
+
OpenAICompletionsEndpoint,
|
|
893
|
+
OpenAIResponsesEndpoint,
|
|
894
|
+
ProviderDef,
|
|
895
|
+
ProviderEndpoint,
|
|
896
|
+
ProviderTransport,
|
|
897
|
+
RequestQuirk,
|
|
898
|
+
RequestQuirkKind,
|
|
899
|
+
} from './llm/provider-def.js';
|
|
900
|
+
// === M3 Provider SSoT (T11702 · epic T11667) — declarative ProviderDef ===
|
|
901
|
+
export {
|
|
902
|
+
PROVIDER_TRANSPORTS,
|
|
903
|
+
REQUEST_QUIRK_KINDS,
|
|
904
|
+
} from './llm/provider-def.js';
|
|
837
905
|
// === Phase 4 Unified Architecture (T9281 / ADR-072) — Provider identity ===
|
|
838
906
|
export type { ApiMode, BuiltinProviderId, ProviderId } from './llm/provider-id.js';
|
|
839
907
|
// === Provider Profile + Plugin Contracts (T9262 — Phase 3 T-LLM-CRED) ===
|
|
@@ -1045,10 +1113,19 @@ export type {
|
|
|
1045
1113
|
AdminBackupListParams,
|
|
1046
1114
|
AdminBackupMutateParams,
|
|
1047
1115
|
AdminCleanupParams,
|
|
1116
|
+
AdminConfigGetParams,
|
|
1117
|
+
AdminConfigGetResult,
|
|
1118
|
+
AdminConfigListParams,
|
|
1119
|
+
AdminConfigListResult,
|
|
1048
1120
|
AdminConfigPresetsParams,
|
|
1121
|
+
AdminConfigScope,
|
|
1049
1122
|
AdminConfigSetParams,
|
|
1050
1123
|
AdminConfigSetPresetParams,
|
|
1051
1124
|
AdminConfigShowParams,
|
|
1125
|
+
AdminConfigUnsetParams,
|
|
1126
|
+
AdminConfigUnsetResult,
|
|
1127
|
+
AdminConfigValidateParams,
|
|
1128
|
+
AdminConfigValidateResult,
|
|
1052
1129
|
AdminContextInjectParams,
|
|
1053
1130
|
AdminContextParams,
|
|
1054
1131
|
AdminContextPullParams,
|
|
@@ -1143,6 +1220,35 @@ export {
|
|
|
1143
1220
|
taskTreeEntrySchema,
|
|
1144
1221
|
taskTreeSchema,
|
|
1145
1222
|
} from './operations/ensures-schema-registry.js';
|
|
1223
|
+
// 5-entity provider-experience op contracts (T11700 · epic T11666) — INPUT
|
|
1224
|
+
// contracts consumed by core's INPUT_CONTRACTS registry; OUTPUT contracts already
|
|
1225
|
+
// register into OUTPUT_CONTRACTS above.
|
|
1226
|
+
export {
|
|
1227
|
+
accountAddInputContract,
|
|
1228
|
+
accountAddOutputContract,
|
|
1229
|
+
accountListInputContract,
|
|
1230
|
+
accountListOutputContract,
|
|
1231
|
+
accountRemoveInputContract,
|
|
1232
|
+
accountRemoveOutputContract,
|
|
1233
|
+
modelQueryInputContract,
|
|
1234
|
+
modelQueryOutputContract,
|
|
1235
|
+
modelShowInputContract,
|
|
1236
|
+
modelShowOutputContract,
|
|
1237
|
+
profileCreateInputContract,
|
|
1238
|
+
profileCreateOutputContract,
|
|
1239
|
+
profileListInputContract,
|
|
1240
|
+
profileListOutputContract,
|
|
1241
|
+
profilePinInputContract,
|
|
1242
|
+
profilePinOutputContract,
|
|
1243
|
+
profileUseInputContract,
|
|
1244
|
+
profileUseOutputContract,
|
|
1245
|
+
providerConnectInputContract,
|
|
1246
|
+
providerConnectOutputContract,
|
|
1247
|
+
providerListInputContract,
|
|
1248
|
+
providerListOutputContract,
|
|
1249
|
+
providerShowInputContract,
|
|
1250
|
+
providerShowOutputContract,
|
|
1251
|
+
} from './operations/entities.js';
|
|
1146
1252
|
// === Operations Types (API wire format, namespaced to avoid collision with domain types) ===
|
|
1147
1253
|
export * as ops from './operations/index.js';
|
|
1148
1254
|
// === Operation Input Contracts (T9914 / Saga T9855 / E7) ===
|
|
@@ -1473,6 +1579,19 @@ export type {
|
|
|
1473
1579
|
ProposeRunResult,
|
|
1474
1580
|
SentientOps,
|
|
1475
1581
|
} from './operations/sentient.js';
|
|
1582
|
+
// Service-vault CLI op contracts (T11941 · epic T11765 · M2-W4) — INPUT contracts
|
|
1583
|
+
// consumed by core's INPUT_CONTRACTS registry; OUTPUT contracts already register
|
|
1584
|
+
// into OUTPUT_CONTRACTS above.
|
|
1585
|
+
export {
|
|
1586
|
+
serviceConnectInputContract,
|
|
1587
|
+
serviceConnectOutputContract,
|
|
1588
|
+
serviceListInputContract,
|
|
1589
|
+
serviceListOutputContract,
|
|
1590
|
+
serviceRevokeInputContract,
|
|
1591
|
+
serviceRevokeOutputContract,
|
|
1592
|
+
serviceStatusInputContract,
|
|
1593
|
+
serviceStatusOutputContract,
|
|
1594
|
+
} from './operations/service.js';
|
|
1476
1595
|
// Session operation param/result types — re-exported at top level for typed-dispatch consumers
|
|
1477
1596
|
// (T975 Wave D · ADR-051 migration)
|
|
1478
1597
|
export type {
|
|
@@ -2030,7 +2149,13 @@ export type {
|
|
|
2030
2149
|
StatsSkillLifecycleState,
|
|
2031
2150
|
StatsSkillSourceType,
|
|
2032
2151
|
} from './skills/stats.js';
|
|
2033
|
-
export type {
|
|
2152
|
+
export type {
|
|
2153
|
+
AdapterSpawnProvider,
|
|
2154
|
+
AgentContainmentMode,
|
|
2155
|
+
AgentSuiteOwnership,
|
|
2156
|
+
SpawnContext,
|
|
2157
|
+
SpawnResult,
|
|
2158
|
+
} from './spawn.js';
|
|
2034
2159
|
// === CLEO Spawn Types (distinct from adapter spawn) ===
|
|
2035
2160
|
export type {
|
|
2036
2161
|
CAAMPSpawnOptions,
|
|
@@ -2385,6 +2510,26 @@ export {
|
|
|
2385
2510
|
validatorRejectionSchema,
|
|
2386
2511
|
validatorVerdictSchema,
|
|
2387
2512
|
} from './validator/index.js';
|
|
2513
|
+
// === Universal Service Vault — declarative service-provider registry (T11937 seed + T11938 breadth, epic T11765) ===
|
|
2514
|
+
export type {
|
|
2515
|
+
CredentialHeaderRule,
|
|
2516
|
+
HostAuthStrategy,
|
|
2517
|
+
InjectionRule,
|
|
2518
|
+
InjectionValueSource,
|
|
2519
|
+
MetadataHeaderRule,
|
|
2520
|
+
RefreshBodyFormat,
|
|
2521
|
+
RefreshClientAuth,
|
|
2522
|
+
RefreshConfig,
|
|
2523
|
+
RefreshKind,
|
|
2524
|
+
ServiceAuthKind,
|
|
2525
|
+
ServiceHostRule,
|
|
2526
|
+
ServiceProviderDef,
|
|
2527
|
+
} from './vault/service-provider.js';
|
|
2528
|
+
export {
|
|
2529
|
+
REFRESH_KINDS,
|
|
2530
|
+
SERVICE_AUTH_KINDS,
|
|
2531
|
+
SERVICE_PROVIDERS,
|
|
2532
|
+
} from './vault/service-provider.js';
|
|
2388
2533
|
export type {
|
|
2389
2534
|
TasksFrontierParamsInput,
|
|
2390
2535
|
TasksRollupParamsInput,
|
|
@@ -44,6 +44,8 @@ describe('lease-ipc v1.1 freeze guard (T11627)', () => {
|
|
|
44
44
|
'lease_renew',
|
|
45
45
|
'rate_check',
|
|
46
46
|
'tool_grant',
|
|
47
|
+
'queue_admit',
|
|
48
|
+
'worker_heartbeat',
|
|
47
49
|
]);
|
|
48
50
|
});
|
|
49
51
|
|
|
@@ -56,6 +58,8 @@ describe('lease-ipc v1.1 freeze guard (T11627)', () => {
|
|
|
56
58
|
'tool_granted',
|
|
57
59
|
'lease_revoked',
|
|
58
60
|
'child_killed_unresponsive',
|
|
61
|
+
'queue_admit_result',
|
|
62
|
+
'heartbeat_ack',
|
|
59
63
|
'error',
|
|
60
64
|
]);
|
|
61
65
|
});
|
|
@@ -81,6 +85,8 @@ describe('lease-ipc v1.1 freeze guard (T11627)', () => {
|
|
|
81
85
|
'lease_renew',
|
|
82
86
|
'rate_check',
|
|
83
87
|
'tool_grant',
|
|
88
|
+
'queue_admit',
|
|
89
|
+
'worker_heartbeat',
|
|
84
90
|
'lease_granted',
|
|
85
91
|
'lease_queued',
|
|
86
92
|
'lease_denied',
|
|
@@ -88,6 +94,8 @@ describe('lease-ipc v1.1 freeze guard (T11627)', () => {
|
|
|
88
94
|
'tool_granted',
|
|
89
95
|
'lease_revoked',
|
|
90
96
|
'child_killed_unresponsive',
|
|
97
|
+
'queue_admit_result',
|
|
98
|
+
'heartbeat_ack',
|
|
91
99
|
'error',
|
|
92
100
|
]);
|
|
93
101
|
});
|
|
@@ -162,6 +170,74 @@ describe('lease-ipc v1.1 wire-shape parity with Rust serde (T11627)', () => {
|
|
|
162
170
|
expect(LeaseIpcEnvelopeSchema.safeParse(wire).success).toBe(true);
|
|
163
171
|
});
|
|
164
172
|
|
|
173
|
+
it('parses the exact JSON a Rust queue_admit request envelope serializes (T11630)', () => {
|
|
174
|
+
const wire = {
|
|
175
|
+
protocol_version: '1.1.0',
|
|
176
|
+
id: 'qa-1',
|
|
177
|
+
direction: 'request',
|
|
178
|
+
request: {
|
|
179
|
+
kind: 'queue_admit',
|
|
180
|
+
provider: 'anthropic',
|
|
181
|
+
priority_class: 'lead',
|
|
182
|
+
est_tokens: 1024,
|
|
183
|
+
child_id: 'worker-1',
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
const parsed = LeaseIpcEnvelopeSchema.safeParse(wire);
|
|
187
|
+
expect(parsed.success).toBe(true);
|
|
188
|
+
if (parsed.success && parsed.data.direction === 'request') {
|
|
189
|
+
expect(parsed.data.request.kind).toBe('queue_admit');
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('parses the exact JSON a Rust queue_admit_result response envelope serializes (T11630)', () => {
|
|
194
|
+
const wire = {
|
|
195
|
+
protocol_version: '1.1.0',
|
|
196
|
+
id: 'qa-1',
|
|
197
|
+
direction: 'response',
|
|
198
|
+
response: {
|
|
199
|
+
kind: 'queue_admit_result',
|
|
200
|
+
disposition: 'deferred',
|
|
201
|
+
retry_after_ms: 250,
|
|
202
|
+
tokens_remaining: 0,
|
|
203
|
+
queue_position: 2,
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
expect(LeaseIpcEnvelopeSchema.safeParse(wire).success).toBe(true);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('parses the exact JSON a Rust worker_heartbeat request envelope serializes (T11628)', () => {
|
|
210
|
+
const wire = {
|
|
211
|
+
protocol_version: '1.1.0',
|
|
212
|
+
id: 'hb-1',
|
|
213
|
+
direction: 'request',
|
|
214
|
+
request: {
|
|
215
|
+
kind: 'worker_heartbeat',
|
|
216
|
+
child_id: 'worker-7',
|
|
217
|
+
in_flight_llm: true,
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
const parsed = LeaseIpcEnvelopeSchema.safeParse(wire);
|
|
221
|
+
expect(parsed.success).toBe(true);
|
|
222
|
+
if (parsed.success && parsed.data.direction === 'request') {
|
|
223
|
+
expect(parsed.data.request.kind).toBe('worker_heartbeat');
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it('parses the exact JSON a Rust heartbeat_ack response envelope serializes (T11628)', () => {
|
|
228
|
+
const wire = {
|
|
229
|
+
protocol_version: '1.1.0',
|
|
230
|
+
id: 'hb-1',
|
|
231
|
+
direction: 'response',
|
|
232
|
+
response: { kind: 'heartbeat_ack' },
|
|
233
|
+
};
|
|
234
|
+
const parsed = LeaseIpcEnvelopeSchema.safeParse(wire);
|
|
235
|
+
expect(parsed.success).toBe(true);
|
|
236
|
+
if (parsed.success && parsed.data.direction === 'response') {
|
|
237
|
+
expect(parsed.data.response.kind).toBe('heartbeat_ack');
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
165
241
|
it('rejects an unknown message kind (proves the union is closed)', () => {
|
|
166
242
|
const wire = {
|
|
167
243
|
protocol_version: '1.1.0',
|
|
@@ -212,6 +288,16 @@ function sampleRequestFor(kind: (typeof LEASE_IPC_REQUEST_KINDS)[number]): unkno
|
|
|
212
288
|
return { kind, scope: 'global', lane: 'bulk', est_bytes: 4096 };
|
|
213
289
|
case 'tool_grant':
|
|
214
290
|
return { kind, tool: 'browser', holder_id: 'h' };
|
|
291
|
+
case 'queue_admit':
|
|
292
|
+
return {
|
|
293
|
+
kind,
|
|
294
|
+
provider: 'anthropic',
|
|
295
|
+
priority_class: 'lead',
|
|
296
|
+
est_tokens: 1024,
|
|
297
|
+
child_id: 'worker-1',
|
|
298
|
+
};
|
|
299
|
+
case 'worker_heartbeat':
|
|
300
|
+
return { kind, child_id: 'worker-1', in_flight_llm: true };
|
|
215
301
|
}
|
|
216
302
|
}
|
|
217
303
|
|
|
@@ -240,6 +326,16 @@ function sampleResponseFor(kind: (typeof LEASE_IPC_RESPONSE_KINDS)[number]): unk
|
|
|
240
326
|
return { kind, scope: 'project', lane: 'tasks', holder_id: 'h', reason: 'ttl expired' };
|
|
241
327
|
case 'child_killed_unresponsive':
|
|
242
328
|
return { kind, child_id: 'w1', holder_id: 'h', scope: 'project', reason: 'unresponsive' };
|
|
329
|
+
case 'queue_admit_result':
|
|
330
|
+
return {
|
|
331
|
+
kind,
|
|
332
|
+
disposition: 'deferred',
|
|
333
|
+
retry_after_ms: 250,
|
|
334
|
+
tokens_remaining: 0,
|
|
335
|
+
queue_position: 2,
|
|
336
|
+
};
|
|
337
|
+
case 'heartbeat_ack':
|
|
338
|
+
return { kind };
|
|
243
339
|
case 'error':
|
|
244
340
|
return { kind, code: 'E_X', message: 'x' };
|
|
245
341
|
}
|
package/src/lease-ipc/index.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
export type {
|
|
16
16
|
ChildKilledUnresponsiveResponse,
|
|
17
|
+
HeartbeatAckResponse,
|
|
17
18
|
LeaseAcquireRequest,
|
|
18
19
|
LeaseDeniedResponse,
|
|
19
20
|
LeaseErrorResponse,
|
|
@@ -29,14 +30,20 @@ export type {
|
|
|
29
30
|
LeaseRenewRequest,
|
|
30
31
|
LeaseRevokedResponse,
|
|
31
32
|
LeaseScope,
|
|
33
|
+
QueueAdmitDisposition,
|
|
34
|
+
QueueAdmitRequest,
|
|
35
|
+
QueueAdmitResultResponse,
|
|
36
|
+
QueuePriorityClass,
|
|
32
37
|
RateCheckRequest,
|
|
33
38
|
RateResultResponse,
|
|
34
39
|
ToolGrantedResponse,
|
|
35
40
|
ToolGrantRequest,
|
|
41
|
+
WorkerHeartbeatRequest,
|
|
36
42
|
} from './messages.js';
|
|
37
43
|
|
|
38
44
|
export {
|
|
39
45
|
ChildKilledUnresponsiveResponseSchema,
|
|
46
|
+
HeartbeatAckResponseSchema,
|
|
40
47
|
LEASE_IPC_MESSAGE_KINDS,
|
|
41
48
|
LEASE_IPC_REQUEST_KINDS,
|
|
42
49
|
LEASE_IPC_RESPONSE_KINDS,
|
|
@@ -55,9 +62,14 @@ export {
|
|
|
55
62
|
LeaseRenewRequestSchema,
|
|
56
63
|
LeaseRevokedResponseSchema,
|
|
57
64
|
LeaseScopeSchema,
|
|
65
|
+
QueueAdmitDispositionSchema,
|
|
66
|
+
QueueAdmitRequestSchema,
|
|
67
|
+
QueueAdmitResultResponseSchema,
|
|
68
|
+
QueuePriorityClassSchema,
|
|
58
69
|
RateCheckRequestSchema,
|
|
59
70
|
RateResultResponseSchema,
|
|
60
71
|
ToolGrantedResponseSchema,
|
|
61
72
|
ToolGrantRequestSchema,
|
|
73
|
+
WorkerHeartbeatRequestSchema,
|
|
62
74
|
} from './messages.js';
|
|
63
75
|
export { isFrozenLeaseIpcVersion, LEASE_IPC_PROTOCOL_VERSION } from './version.js';
|
|
@@ -169,6 +169,66 @@ export const ToolGrantRequestSchema = z
|
|
|
169
169
|
/** Tool-grant request payload (inferred from {@link ToolGrantRequestSchema}). */
|
|
170
170
|
export type ToolGrantRequest = z.infer<typeof ToolGrantRequestSchema>;
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* The priority class of a `queue_admit` request (T11630). Mirrors the Rust
|
|
174
|
+
* `QueuePriorityClass` enum and `cleo_supervisor::llm_queue::PriorityClass`.
|
|
175
|
+
*
|
|
176
|
+
* `lead > worker > background` — a lead/orchestrator agent is never starved by a
|
|
177
|
+
* background consolidation (AC1).
|
|
178
|
+
*/
|
|
179
|
+
export const QueuePriorityClassSchema = z.enum(['lead', 'worker', 'background']);
|
|
180
|
+
|
|
181
|
+
/** A `queue_admit` priority class (inferred from {@link QueuePriorityClassSchema}). */
|
|
182
|
+
export type QueuePriorityClass = z.infer<typeof QueuePriorityClassSchema>;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Admit (or defer) an outbound LLM call through the supervisor's priority
|
|
186
|
+
* scheduler + per-provider rate governor (T11630 · AC1-AC4). Mirrors
|
|
187
|
+
* `QueueAdmitReq`. `[wired]`
|
|
188
|
+
*/
|
|
189
|
+
export const QueueAdmitRequestSchema = z
|
|
190
|
+
.object({
|
|
191
|
+
/** Tag discriminating this request variant. */
|
|
192
|
+
kind: z.literal('queue_admit'),
|
|
193
|
+
/** The LLM provider id the call targets (rate budget is per-provider). */
|
|
194
|
+
provider: z.string().min(1),
|
|
195
|
+
/** The caller's priority class (lead > worker > background). */
|
|
196
|
+
priority_class: QueuePriorityClassSchema,
|
|
197
|
+
/** The caller's estimate of the request's token cost (debited on admit). */
|
|
198
|
+
est_tokens: z.number().int().nonnegative(),
|
|
199
|
+
/** The child the call belongs to (in-flight tracking — the watchdog seam). */
|
|
200
|
+
child_id: z.string().min(1),
|
|
201
|
+
})
|
|
202
|
+
.strict();
|
|
203
|
+
|
|
204
|
+
/** Queue-admit request payload (inferred from {@link QueueAdmitRequestSchema}). */
|
|
205
|
+
export type QueueAdmitRequest = z.infer<typeof QueueAdmitRequestSchema>;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* A liveness heartbeat from a managed worker (T11628). Mirrors
|
|
209
|
+
* `WorkerHeartbeatReq`. `[wired]`
|
|
210
|
+
*
|
|
211
|
+
* The worker sends this periodically (well inside the watchdog's NORMAL
|
|
212
|
+
* deadline) so the supervisor knows it is alive. `in_flight_llm` is the worker's
|
|
213
|
+
* OWN view of whether it is currently waiting on an LLM call: when true the
|
|
214
|
+
* watchdog grants the EXTENDED deadline even if the call never went through the
|
|
215
|
+
* `queue_admit` seam, so a slow-but-healthy long call is never false-killed
|
|
216
|
+
* (AC2 · RISK-7).
|
|
217
|
+
*/
|
|
218
|
+
export const WorkerHeartbeatRequestSchema = z
|
|
219
|
+
.object({
|
|
220
|
+
/** Tag discriminating this request variant. */
|
|
221
|
+
kind: z.literal('worker_heartbeat'),
|
|
222
|
+
/** The logical id of the heartbeating child (matches the registry key). */
|
|
223
|
+
child_id: z.string().min(1),
|
|
224
|
+
/** The worker's own view of whether it is currently inside an LLM call. */
|
|
225
|
+
in_flight_llm: z.boolean(),
|
|
226
|
+
})
|
|
227
|
+
.strict();
|
|
228
|
+
|
|
229
|
+
/** Worker-heartbeat request payload (inferred from {@link WorkerHeartbeatRequestSchema}). */
|
|
230
|
+
export type WorkerHeartbeatRequest = z.infer<typeof WorkerHeartbeatRequestSchema>;
|
|
231
|
+
|
|
172
232
|
/**
|
|
173
233
|
* The discriminated union of all client → arbiter lease requests. The `kind`
|
|
174
234
|
* field selects the variant, matching the serde `#[serde(tag = "kind")]`
|
|
@@ -180,6 +240,8 @@ export const LeaseIpcRequestSchema = z.discriminatedUnion('kind', [
|
|
|
180
240
|
LeaseRenewRequestSchema,
|
|
181
241
|
RateCheckRequestSchema,
|
|
182
242
|
ToolGrantRequestSchema,
|
|
243
|
+
QueueAdmitRequestSchema,
|
|
244
|
+
WorkerHeartbeatRequestSchema,
|
|
183
245
|
]);
|
|
184
246
|
|
|
185
247
|
/** Any lease IPC request (inferred from {@link LeaseIpcRequestSchema}). */
|
|
@@ -334,6 +396,55 @@ export const ChildKilledUnresponsiveResponseSchema = z
|
|
|
334
396
|
/** Child-killed event payload (inferred from {@link ChildKilledUnresponsiveResponseSchema}). */
|
|
335
397
|
export type ChildKilledUnresponsiveResponse = z.infer<typeof ChildKilledUnresponsiveResponseSchema>;
|
|
336
398
|
|
|
399
|
+
/**
|
|
400
|
+
* The disposition of a `queue_admit` request (T11630). Mirrors
|
|
401
|
+
* `QueueAdmitDisposition` in Rust — `admitted` (execute now) or `deferred`
|
|
402
|
+
* (back off `retry_after_ms` and re-request; AC4 — never a silent drop).
|
|
403
|
+
*/
|
|
404
|
+
export const QueueAdmitDispositionSchema = z.enum(['admitted', 'deferred']);
|
|
405
|
+
|
|
406
|
+
/** A `queue_admit` disposition (inferred from {@link QueueAdmitDispositionSchema}). */
|
|
407
|
+
export type QueueAdmitDisposition = z.infer<typeof QueueAdmitDispositionSchema>;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Reply to a `queue_admit`: the LLM call was admitted or deferred (T11630).
|
|
411
|
+
* Mirrors `QueueAdmitResult`.
|
|
412
|
+
*/
|
|
413
|
+
export const QueueAdmitResultResponseSchema = z
|
|
414
|
+
.object({
|
|
415
|
+
/** Tag discriminating this response variant. */
|
|
416
|
+
kind: z.literal('queue_admit_result'),
|
|
417
|
+
/** Whether the LLM call was admitted or deferred. */
|
|
418
|
+
disposition: QueueAdmitDispositionSchema,
|
|
419
|
+
/** Back-off in ms before re-requesting (0 when admitted). */
|
|
420
|
+
retry_after_ms: z.number().int().nonnegative(),
|
|
421
|
+
/** Remaining provider token budget after this decision. */
|
|
422
|
+
tokens_remaining: z.number().int().nonnegative(),
|
|
423
|
+
/** Number of higher/equal-priority waiters ahead (0 when admitted). */
|
|
424
|
+
queue_position: z.number().int().nonnegative(),
|
|
425
|
+
})
|
|
426
|
+
.strict();
|
|
427
|
+
|
|
428
|
+
/** Queue-admit result payload (inferred from {@link QueueAdmitResultResponseSchema}). */
|
|
429
|
+
export type QueueAdmitResultResponse = z.infer<typeof QueueAdmitResultResponseSchema>;
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Acknowledge a `worker_heartbeat` (T11628). Mirrors `HeartbeatAck`.
|
|
433
|
+
*
|
|
434
|
+
* Deliberately carries only its `kind` — the ack's presence (correlated by id)
|
|
435
|
+
* is the signal that the watchdog recorded the beat and reset the child's
|
|
436
|
+
* deadline. Matches the Rust unit-struct wire shape `{ "kind": "heartbeat_ack" }`.
|
|
437
|
+
*/
|
|
438
|
+
export const HeartbeatAckResponseSchema = z
|
|
439
|
+
.object({
|
|
440
|
+
/** Tag discriminating this response variant. */
|
|
441
|
+
kind: z.literal('heartbeat_ack'),
|
|
442
|
+
})
|
|
443
|
+
.strict();
|
|
444
|
+
|
|
445
|
+
/** Heartbeat-ack response payload (inferred from {@link HeartbeatAckResponseSchema}). */
|
|
446
|
+
export type HeartbeatAckResponse = z.infer<typeof HeartbeatAckResponseSchema>;
|
|
447
|
+
|
|
337
448
|
/**
|
|
338
449
|
* An error response correlated to a request. Mirrors the v1.0
|
|
339
450
|
* `crate::ipc::ErrorResult` shape reused by the Rust `LeaseResponse::Error`
|
|
@@ -366,6 +477,8 @@ export const LeaseIpcResponseSchema = z.discriminatedUnion('kind', [
|
|
|
366
477
|
ToolGrantedResponseSchema,
|
|
367
478
|
LeaseRevokedResponseSchema,
|
|
368
479
|
ChildKilledUnresponsiveResponseSchema,
|
|
480
|
+
QueueAdmitResultResponseSchema,
|
|
481
|
+
HeartbeatAckResponseSchema,
|
|
369
482
|
LeaseErrorResponseSchema,
|
|
370
483
|
]);
|
|
371
484
|
|
|
@@ -444,6 +557,8 @@ export const LEASE_IPC_REQUEST_KINDS = [
|
|
|
444
557
|
'lease_renew',
|
|
445
558
|
'rate_check',
|
|
446
559
|
'tool_grant',
|
|
560
|
+
'queue_admit',
|
|
561
|
+
'worker_heartbeat',
|
|
447
562
|
] as const;
|
|
448
563
|
|
|
449
564
|
/**
|
|
@@ -458,6 +573,8 @@ export const LEASE_IPC_RESPONSE_KINDS = [
|
|
|
458
573
|
'tool_granted',
|
|
459
574
|
'lease_revoked',
|
|
460
575
|
'child_killed_unresponsive',
|
|
576
|
+
'queue_admit_result',
|
|
577
|
+
'heartbeat_ack',
|
|
461
578
|
'error',
|
|
462
579
|
] as const;
|
|
463
580
|
|