@drisp/protocol 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v2.d.ts +3 -1
- package/dist/v2.js +5 -1
- package/package.json +1 -1
package/dist/v2.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ declare const SIZE_CLASS_CAPS: Readonly<Record<SizeClass, number>>;
|
|
|
15
15
|
declare const SIZE_CLASS_FORECASTS: Readonly<Record<SizeClass, number>>;
|
|
16
16
|
/** The smallest class whose cap is at least the declared one; above the largest cap is `L`. A cap that is no number reads as `S`. */
|
|
17
17
|
declare function classOfCap(declaredCap: number): SizeClass;
|
|
18
|
+
/** What a Run declaring `declaredCap` is expected to use: its class's forecast. */
|
|
19
|
+
declare function forecastOfCap(declaredCap: number): number;
|
|
18
20
|
/**
|
|
19
21
|
* What one attempt holds against the budget: a closed attempt (finished, failed, cancelled) its forecast, never more
|
|
20
22
|
* than its own declared cap (so the rule stays looser than the cap sum it replaces); a running or queued one still its
|
|
@@ -1425,4 +1427,4 @@ type ConnectPendingResponse = z.infer<typeof connectPendingResponseSchema>;
|
|
|
1425
1427
|
type TeamDefault = z.infer<typeof teamDefaultSchema>;
|
|
1426
1428
|
type RunsGoTo = z.infer<typeof runsGoToSchema>;
|
|
1427
1429
|
|
|
1428
|
-
export { type Audience, type BuildCloseReason, type Checkpoint, type Command, type ConnectAlreadyConnected, type ConnectPendingResponse, type ConnectRedeemRequest, type ConnectRedeemResponse, type ConnectStartRequest, type ConnectStartResponse, type ControlRecord, type Delegation, type ExecutionFact, type Grant, type Harness, type HarnessReadiness, type HistoryRecord, type InstalledWorkflow, type RepositoryBinding, type RepositorySource, type RunCloseReason, type RunParent, type RunView, type RunnerAdoptRequest, type RunnerDisconnectPreview, type RunnerDisconnectResponse, type RunnerFrame, type RunnerList, type RunnerListEntry, type RunnerReadiness, type RunsGoTo, SIZE_CLASS_CAPS, SIZE_CLASS_FORECASTS, type Scope, type SizeClass, type TeamDefault, type WorkflowIdentity, type WorkflowInstallReference, type WorkflowReference, abandonedConversationContinuationCapability, attemptCost, audienceSchema, buildCloseReasonSchema, canonicalJson, checkpointPathSchema, checkpointSchema, classOfCap, clientFrameSchema, commandSchema, connectAlreadyConnectedSchema, connectApproveRequestSchema, connectCodeAlphabet, connectCodeRequestSchema, connectCodeResponseSchema, connectCodeSchema, connectDenyRequestSchema, connectPendingResponseSchema, connectPollRequestSchema, connectRedeemRequestSchema, connectRedeemResponseSchema, connectStartRequestSchema, connectStartResponseSchema, controlRecordSchema, conversationContinuationCapability, delegationSchema, delegationTokenPrefix, grantSchema, harnessReadinessSchema, harnessSchema, historyRecordSchema, hubEpochRequestSchema, installReference, installedWorkflowsSchema, interruptionSchema, permissionAnswerSchema, protocolVersion, readableHistory, readinessFixCommand, repositoryAccessCapability, repositoryBindingSchema, repositoryRefSchema, repositorySourceSchema, repositoryWorkingDirectorySchema, runArtifactMaxBytes, runArtifactNameSchema, runCloseReasonSchema, runDelegationCapability, runKeySchema, runParentIntentSchema, runParentSchema, runSpecSchema, runViewSchema, runnerAdoptRequestSchema, runnerDisconnectPreviewSchema, runnerDisconnectRequestSchema, runnerDisconnectResponseSchema, runnerFrameSchema, runnerListEntrySchema, runnerListSchema, runnerReadinessSchema, runnerUpdateCommand, runnerUpdateRequestSchema, runsGoToSchema, sameWorkflow, scopeSchema, secretEnvironmentSchema, sequence, teamDefaultRequestSchema, teamDefaultSchema, workflowIdentitySchema, workflowInstallCapability, workflowName, workflowReferenceSchema, workflowSourceSchema };
|
|
1430
|
+
export { type Audience, type BuildCloseReason, type Checkpoint, type Command, type ConnectAlreadyConnected, type ConnectPendingResponse, type ConnectRedeemRequest, type ConnectRedeemResponse, type ConnectStartRequest, type ConnectStartResponse, type ControlRecord, type Delegation, type ExecutionFact, type Grant, type Harness, type HarnessReadiness, type HistoryRecord, type InstalledWorkflow, type RepositoryBinding, type RepositorySource, type RunCloseReason, type RunParent, type RunView, type RunnerAdoptRequest, type RunnerDisconnectPreview, type RunnerDisconnectResponse, type RunnerFrame, type RunnerList, type RunnerListEntry, type RunnerReadiness, type RunsGoTo, SIZE_CLASS_CAPS, SIZE_CLASS_FORECASTS, type Scope, type SizeClass, type TeamDefault, type WorkflowIdentity, type WorkflowInstallReference, type WorkflowReference, abandonedConversationContinuationCapability, attemptCost, audienceSchema, buildCloseReasonSchema, canonicalJson, checkpointPathSchema, checkpointSchema, classOfCap, clientFrameSchema, commandSchema, connectAlreadyConnectedSchema, connectApproveRequestSchema, connectCodeAlphabet, connectCodeRequestSchema, connectCodeResponseSchema, connectCodeSchema, connectDenyRequestSchema, connectPendingResponseSchema, connectPollRequestSchema, connectRedeemRequestSchema, connectRedeemResponseSchema, connectStartRequestSchema, connectStartResponseSchema, controlRecordSchema, conversationContinuationCapability, delegationSchema, delegationTokenPrefix, forecastOfCap, grantSchema, harnessReadinessSchema, harnessSchema, historyRecordSchema, hubEpochRequestSchema, installReference, installedWorkflowsSchema, interruptionSchema, permissionAnswerSchema, protocolVersion, readableHistory, readinessFixCommand, repositoryAccessCapability, repositoryBindingSchema, repositoryRefSchema, repositorySourceSchema, repositoryWorkingDirectorySchema, runArtifactMaxBytes, runArtifactNameSchema, runCloseReasonSchema, runDelegationCapability, runKeySchema, runParentIntentSchema, runParentSchema, runSpecSchema, runViewSchema, runnerAdoptRequestSchema, runnerDisconnectPreviewSchema, runnerDisconnectRequestSchema, runnerDisconnectResponseSchema, runnerFrameSchema, runnerListEntrySchema, runnerListSchema, runnerReadinessSchema, runnerUpdateCommand, runnerUpdateRequestSchema, runsGoToSchema, sameWorkflow, scopeSchema, secretEnvironmentSchema, sequence, teamDefaultRequestSchema, teamDefaultSchema, workflowIdentitySchema, workflowInstallCapability, workflowName, workflowReferenceSchema, workflowSourceSchema };
|
package/dist/v2.js
CHANGED
|
@@ -63,9 +63,12 @@ function classOfCap(declaredCap) {
|
|
|
63
63
|
if (declaredCap <= SIZE_CLASS_CAPS.M) return "M";
|
|
64
64
|
return "L";
|
|
65
65
|
}
|
|
66
|
+
function forecastOfCap(declaredCap) {
|
|
67
|
+
return SIZE_CLASS_FORECASTS[classOfCap(declaredCap)];
|
|
68
|
+
}
|
|
66
69
|
function attemptCost(attempt) {
|
|
67
70
|
if (!attempt.closed) return attempt.tokenCap;
|
|
68
|
-
const forecast =
|
|
71
|
+
const forecast = forecastOfCap(attempt.tokenCap);
|
|
69
72
|
return attempt.tokenCap > 0 ? Math.min(attempt.tokenCap, forecast) : forecast;
|
|
70
73
|
}
|
|
71
74
|
|
|
@@ -650,6 +653,7 @@ export {
|
|
|
650
653
|
conversationContinuationCapability,
|
|
651
654
|
delegationSchema,
|
|
652
655
|
delegationTokenPrefix,
|
|
656
|
+
forecastOfCap,
|
|
653
657
|
grantSchema,
|
|
654
658
|
harnessReadinessSchema,
|
|
655
659
|
harnessSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drisp/protocol",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Wire contract between a drisp runner and the hub: zod schemas, inferred types, and JSON Schema for the instance-socket frames, Run, Turn, Interruption, and the event stream",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|