@drisp/protocol 0.8.0 → 0.8.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/dist/v2.d.ts +22 -1
- package/dist/v2.js +26 -0
- package/package.json +1 -1
package/dist/v2.d.ts
CHANGED
|
@@ -4,6 +4,27 @@ import { f as InstalledWorkflowSchema } from './domain-B-kg2pa_.js';
|
|
|
4
4
|
/** Presentation of canonical fragment records; archive/cursor accounting always uses the original records. */
|
|
5
5
|
declare function readableHistory(records: HistoryRecord[]): HistoryRecord[];
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* What a Build's children cost against its token budget (root ADR-0011). Tokens exclude cache reads. The forecasts
|
|
9
|
+
* are defaults, not measured; the caps are the per-Run ceilings the size classes declare.
|
|
10
|
+
*/
|
|
11
|
+
type SizeClass = 'S' | 'M' | 'L';
|
|
12
|
+
/** Per-Run token cap of each size class. The largest class also bounds anything above it. */
|
|
13
|
+
declare const SIZE_CLASS_CAPS: Readonly<Record<SizeClass, number>>;
|
|
14
|
+
/** What a Run of each class is expected to use: default, not measured. */
|
|
15
|
+
declare const SIZE_CLASS_FORECASTS: Readonly<Record<SizeClass, number>>;
|
|
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
|
+
declare function classOfCap(declaredCap: number): SizeClass;
|
|
18
|
+
/**
|
|
19
|
+
* What one attempt holds against the budget: a closed attempt (finished, failed, cancelled) its forecast, never more
|
|
20
|
+
* than its own declared cap (so the rule stays looser than the cap sum it replaces); a running or queued one still its
|
|
21
|
+
* declared cap. A closed attempt whose cap is no positive number counts its forecast.
|
|
22
|
+
*/
|
|
23
|
+
declare function attemptCost(attempt: {
|
|
24
|
+
tokenCap: number;
|
|
25
|
+
closed: boolean;
|
|
26
|
+
}): number;
|
|
27
|
+
|
|
7
28
|
declare const protocolVersion: {
|
|
8
29
|
readonly major: 2;
|
|
9
30
|
readonly minor: 2;
|
|
@@ -1404,4 +1425,4 @@ type ConnectPendingResponse = z.infer<typeof connectPendingResponseSchema>;
|
|
|
1404
1425
|
type TeamDefault = z.infer<typeof teamDefaultSchema>;
|
|
1405
1426
|
type RunsGoTo = z.infer<typeof runsGoToSchema>;
|
|
1406
1427
|
|
|
1407
|
-
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, type Scope, type TeamDefault, type WorkflowIdentity, type WorkflowInstallReference, type WorkflowReference, abandonedConversationContinuationCapability, audienceSchema, buildCloseReasonSchema, canonicalJson, checkpointPathSchema, checkpointSchema, 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 };
|
|
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 };
|
package/dist/v2.js
CHANGED
|
@@ -47,6 +47,28 @@ function readableHistory(records) {
|
|
|
47
47
|
return result;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// src/budget.ts
|
|
51
|
+
var SIZE_CLASS_CAPS = {
|
|
52
|
+
S: 3e6,
|
|
53
|
+
M: 6e6,
|
|
54
|
+
L: 12e6
|
|
55
|
+
};
|
|
56
|
+
var SIZE_CLASS_FORECASTS = {
|
|
57
|
+
S: 15e4,
|
|
58
|
+
M: 4e5,
|
|
59
|
+
L: 12e5
|
|
60
|
+
};
|
|
61
|
+
function classOfCap(declaredCap) {
|
|
62
|
+
if (Number.isNaN(declaredCap) || declaredCap <= SIZE_CLASS_CAPS.S) return "S";
|
|
63
|
+
if (declaredCap <= SIZE_CLASS_CAPS.M) return "M";
|
|
64
|
+
return "L";
|
|
65
|
+
}
|
|
66
|
+
function attemptCost(attempt) {
|
|
67
|
+
if (!attempt.closed) return attempt.tokenCap;
|
|
68
|
+
const forecast = SIZE_CLASS_FORECASTS[classOfCap(attempt.tokenCap)];
|
|
69
|
+
return attempt.tokenCap > 0 ? Math.min(attempt.tokenCap, forecast) : forecast;
|
|
70
|
+
}
|
|
71
|
+
|
|
50
72
|
// src/v2.ts
|
|
51
73
|
var protocolVersion = { major: 2, minor: 2 };
|
|
52
74
|
var conversationContinuationCapability = "conversation_continuation";
|
|
@@ -599,12 +621,16 @@ var connectApproveRequestSchema = z.strictObject({
|
|
|
599
621
|
});
|
|
600
622
|
var connectDenyRequestSchema = z.strictObject({ code: z.string().min(8).max(16) });
|
|
601
623
|
export {
|
|
624
|
+
SIZE_CLASS_CAPS,
|
|
625
|
+
SIZE_CLASS_FORECASTS,
|
|
602
626
|
abandonedConversationContinuationCapability,
|
|
627
|
+
attemptCost,
|
|
603
628
|
audienceSchema,
|
|
604
629
|
buildCloseReasonSchema,
|
|
605
630
|
canonicalJson,
|
|
606
631
|
checkpointPathSchema,
|
|
607
632
|
checkpointSchema,
|
|
633
|
+
classOfCap,
|
|
608
634
|
clientFrameSchema,
|
|
609
635
|
commandSchema,
|
|
610
636
|
connectAlreadyConnectedSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drisp/protocol",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
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",
|