@abyss-project/runtime 2.0.1 → 3.0.0

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.
@@ -13,7 +13,6 @@ export declare const RESOURCE_PROFILES: Readonly<Record<ResourceProfile, Resourc
13
13
  export declare const COST_RATES: {
14
14
  readonly executionMillicredits: 10;
15
15
  readonly cpuMillicreditsPerSecond: 500;
16
- readonly guaranteedCpuCoefficient: 1.5;
17
16
  readonly memoryMillicreditsPerGbSecond: 100;
18
17
  readonly networkOutMillicreditsPerMb: 1000;
19
18
  readonly httpCallMillicredits: 10;
@@ -34,7 +33,6 @@ export interface StepUsage {
34
33
  export interface ExecutionCostInput extends StepUsage {
35
34
  status: CostedExecutionStatus;
36
35
  profile: ResourceProfile;
37
- guaranteedCpu: boolean;
38
36
  resumedSegment?: boolean;
39
37
  }
40
38
  export interface StepCostInput {
@@ -19,7 +19,6 @@ exports.RESOURCE_PROFILES = {
19
19
  exports.COST_RATES = {
20
20
  executionMillicredits: 10,
21
21
  cpuMillicreditsPerSecond: 500,
22
- guaranteedCpuCoefficient: 1.5,
23
22
  memoryMillicreditsPerGbSecond: 100,
24
23
  networkOutMillicreditsPerMb: 1000,
25
24
  httpCallMillicredits: 10,
@@ -32,10 +31,10 @@ var CostedExecutionStatus;
32
31
  CostedExecutionStatus["REFUSED"] = "REFUSED";
33
32
  })(CostedExecutionStatus || (exports.CostedExecutionStatus = CostedExecutionStatus = {}));
34
33
  const MICROS_PER_SECOND = BigInt(1_000_000);
35
- const CPU_DENOMINATOR = MICROS_PER_SECOND * BigInt(100) * BigInt(1000);
34
+ const CPU_DENOMINATOR = MICROS_PER_SECOND * BigInt(100);
36
35
  const MEMORY_DENOMINATOR = BigInt(1024) * MICROS_PER_SECOND;
37
36
  const NETWORK_DENOMINATOR = BigInt(1024 * 1024);
38
- const UNITS_PER_MILLICREDIT = BigInt(1_048_576) * BigInt(48_828_125);
37
+ const UNITS_PER_MILLICREDIT = BigInt(1_048_576) * BigInt(390_625);
39
38
  const ZERO = BigInt(0);
40
39
  const ONE = BigInt(1);
41
40
  const TWO = BigInt(2);
@@ -50,14 +49,11 @@ const assertUsage = (usage, subject) => {
50
49
  const micros = (ms) => BigInt(Math.round(ms * 1000));
51
50
  const whole = (count) => BigInt(Math.round(count));
52
51
  const hundredths = (coefficient) => BigInt(Math.round(coefficient * 100));
53
- const thousandths = (coefficient) => BigInt(Math.round(coefficient * 1000));
54
52
  const variableUnits = (usage, execution) => {
55
53
  const profile = exports.RESOURCE_PROFILES[execution.profile];
56
- const guaranteed = execution.guaranteedCpu ? exports.COST_RATES.guaranteedCpuCoefficient : 1;
57
54
  const cpu = (micros(usage.cpuMs) *
58
55
  BigInt(exports.COST_RATES.cpuMillicreditsPerSecond) *
59
56
  hundredths(profile.cpuCoefficient) *
60
- thousandths(guaranteed) *
61
57
  UNITS_PER_MILLICREDIT) /
62
58
  CPU_DENOMINATOR;
63
59
  const memory = (BigInt(profile.memoryMb) *
@@ -1 +1 @@
1
- {"version":3,"file":"execution-cost.js","sourceRoot":"","sources":["../../src/cost/execution-cost.ts"],"names":[],"mappings":";;;AAIA,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,0BAAO,CAAA;IACP,0BAAO,CAAA;IACP,0BAAO,CAAA;IACP,4BAAS,CAAA;IACT,8BAAW,CAAA;AACb,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AASY,QAAA,iBAAiB,GAA2D;IACvF,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC,EAAE;IACzD,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE;IAC5D,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE;IAC3D,CAAC,eAAe,CAAC,EAAE,CA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B,EAAY,EAAE;IAChE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACnC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACpC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC;IACrE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,MAAM,KAAK,GAAG,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAClD,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC/B,UAAU,GAAG,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,GAAG,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC9F,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,OAAO,GAAG,QAAQ,CAAC;QAChC,QAAQ,GAAG,OAAO,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AApBW,QAAA,eAAe,mBAoB1B"}
@@ -26,7 +26,6 @@ export interface ExecutionLimits {
26
26
  memoryMb: number;
27
27
  cpuTimeMs: number;
28
28
  wallTimeMs: number;
29
- guaranteedCpu: boolean;
30
29
  }
31
30
  export interface ExecutionBudget {
32
31
  maxSteps: number;
@@ -1 +1 @@
1
- {"version":3,"file":"execution-protocol.types.js","sourceRoot":"","sources":["../../src/runner-protocol/execution-protocol.types.ts"],"names":[],"mappings":";;;AAQa,QAAA,kBAAkB,GAAG,kBAAkB,CAAC;AAGxC,QAAA,sBAAsB,GAAG,SAAS,CAAC;AAGnC,QAAA,yBAAyB,GAAG,KAAK,CAAC;AAM/C,IAAY,cASX;AATD,WAAY,cAAc;IAExB,2CAAyB,CAAA;IAEzB,+BAAa,CAAA;IAEb,yCAAuB,CAAA;IAEvB,+CAA6B,CAAA;AAC/B,CAAC,EATW,cAAc,8BAAd,cAAc,QASzB;AAED,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,2CAAmB,CAAA;IACnB,qCAAa,CAAA;IACb,kDAA0B,CAAA;IAC1B,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;AACvB,CAAC,EAPW,oBAAoB,oCAApB,oBAAoB,QAO/B;AAcY,QAAA,qBAAqB,GAAsB;IACtD,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,SAAS;CACV,CAAC;AAqFF,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,gCAAmB,CAAA;IACnB,kCAAqB,CAAA;AACvB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,qCAAuB,CAAA;IACvB,+BAAiB,CAAA;IAEjB,qCAAuB,CAAA;AACzB,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAuBD,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;IACjB,0CAAuB,CAAA;AACzB,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B"}
1
+ {"version":3,"file":"execution-protocol.types.js","sourceRoot":"","sources":["../../src/runner-protocol/execution-protocol.types.ts"],"names":[],"mappings":";;;AAQa,QAAA,kBAAkB,GAAG,kBAAkB,CAAC;AAGxC,QAAA,sBAAsB,GAAG,SAAS,CAAC;AAGnC,QAAA,yBAAyB,GAAG,KAAK,CAAC;AAM/C,IAAY,cASX;AATD,WAAY,cAAc;IAExB,2CAAyB,CAAA;IAEzB,+BAAa,CAAA;IAEb,yCAAuB,CAAA;IAEvB,+CAA6B,CAAA;AAC/B,CAAC,EATW,cAAc,8BAAd,cAAc,QASzB;AAED,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,2CAAmB,CAAA;IACnB,qCAAa,CAAA;IACb,kDAA0B,CAAA;IAC1B,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;AACvB,CAAC,EAPW,oBAAoB,oCAApB,oBAAoB,QAO/B;AAcY,QAAA,qBAAqB,GAAsB;IACtD,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,SAAS;CACV,CAAC;AAyFF,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,gCAAmB,CAAA;IACnB,kCAAqB,CAAA;AACvB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,qCAAuB,CAAA;IACvB,+BAAiB,CAAA;IAEjB,qCAAuB,CAAA;AACzB,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAuBD,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;IACjB,0CAAuB,CAAA;AACzB,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/runtime",
3
- "version": "2.0.1",
3
+ "version": "3.0.0",
4
4
  "description": "Abyss automation core: definitions, interpreter, runner protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,7 +14,6 @@ const execution = (overrides: Partial<ExecutionCostInput> = {}): ExecutionCostIn
14
14
  ...NO_USAGE,
15
15
  status: CostedExecutionStatus.RAN,
16
16
  profile: ResourceProfile.S,
17
- guaranteedCpu: false,
18
17
  ...overrides,
19
18
  });
20
19
 
@@ -34,7 +33,6 @@ describe('resource profiles and rates', () => {
34
33
  expect(COST_RATES).toEqual({
35
34
  executionMillicredits: 10,
36
35
  cpuMillicreditsPerSecond: 500,
37
- guaranteedCpuCoefficient: 1.5,
38
36
  memoryMillicreditsPerGbSecond: 100,
39
37
  networkOutMillicreditsPerMb: 1000,
40
38
  httpCallMillicredits: 10,
@@ -68,16 +66,15 @@ describe('computeExecutionCost', () => {
68
66
  );
69
67
  });
70
68
 
71
- it('applies the profile coefficient and the guaranteed CPU coefficient to the CPU part', () => {
69
+ it('applies the profile coefficient to the CPU part', () => {
72
70
  const cpu = { cpuMs: 1_000 };
73
71
  expect(computeExecutionCost(execution(cpu))).toBe(10 + 500);
74
- expect(computeExecutionCost(execution({ ...cpu, guaranteedCpu: true }))).toBe(10 + 750);
72
+ expect(computeExecutionCost(execution({ ...cpu, profile: ResourceProfile.M }))).toBe(10 + 525);
75
73
  expect(computeExecutionCost(execution({ ...cpu, profile: ResourceProfile.XXL }))).toBe(
76
74
  10 + 675,
77
75
  );
78
- expect(
79
- computeExecutionCost(execution({ ...cpu, profile: ResourceProfile.M, guaranteedCpu: true })),
80
- ).toBe(10 + 788); // 500 × 1.05 × 1.5 = 787.5
76
+ // 500 × 1.05 × 0.001 = 0.525: rounded half-up once, at the end.
77
+ expect(computeExecutionCost(execution({ cpuMs: 1, profile: ResourceProfile.M }))).toBe(10 + 1);
81
78
  });
82
79
 
83
80
  it('prices the allocated memory, the network out and the effects', () => {
@@ -126,7 +123,6 @@ describe('computeStepCost', () => {
126
123
  ];
127
124
  const total = execution({
128
125
  profile: ResourceProfile.M,
129
- guaranteedCpu: true,
130
126
  // The engine between the steps adds CPU and time measured at the execution level only.
131
127
  cpuMs: 140,
132
128
  wallMs: 3_500,
@@ -155,7 +151,7 @@ describe('computeStepCost', () => {
155
151
  { cpuMs: 0.37 * n, wallMs: 1.9 * n, httpCalls: 0 },
156
152
  );
157
153
  for (const profile of Object.values(ResourceProfile)) {
158
- const total = execution({ ...totals, profile, guaranteedCpu: n % 2 === 0 });
154
+ const total = execution({ ...totals, profile });
159
155
  const costs = computeStepCost({ execution: total, steps });
160
156
  expect(sum(costs) + COST_RATES.executionMillicredits).toBe(computeExecutionCost(total));
161
157
  }
@@ -30,8 +30,6 @@ export const COST_RATES = {
30
30
  /** Once per execution, whatever its number of segments. */
31
31
  executionMillicredits: 10,
32
32
  cpuMillicreditsPerSecond: 500,
33
- /** Multiplies the CPU part of an execution with a guaranteed core. */
34
- guaranteedCpuCoefficient: 1.5,
35
33
  /** Per GB-second of ALLOCATED memory (the profile's), GB = 1024 MB. */
36
34
  memoryMillicreditsPerGbSecond: 100,
37
35
  /** Per MB sent out, MB = 1024 × 1024 bytes. */
@@ -61,7 +59,6 @@ export interface StepUsage {
61
59
  export interface ExecutionCostInput extends StepUsage {
62
60
  status: CostedExecutionStatus;
63
61
  profile: ResourceProfile;
64
- guaranteedCpu: boolean;
65
62
  /**
66
63
  * True for the second and later segments of a suspended execution: they add their measure
67
64
  * but not the execution price, paid once by the first segment.
@@ -77,14 +74,14 @@ export interface StepCostInput {
77
74
  }
78
75
 
79
76
  // Exact unit: 1 / UNITS_PER_MILLICREDIT of a millicredit. Durations are taken in microseconds
80
- // (cpuMs and wallMs may carry fractions of a millisecond), coefficients in hundredths or
81
- // thousandths. Each part is a product divided by a fixed denominator; UNITS_PER_MILLICREDIT is
82
- // their least common multiple, 2^20 × 5^11, so that every part is an exact integer of units.
77
+ // (cpuMs and wallMs may carry fractions of a millisecond), coefficients in hundredths. Each part
78
+ // is a product divided by a fixed denominator; UNITS_PER_MILLICREDIT is their least common
79
+ // multiple, 2^20 × 5^8, so that every part is an exact integer of units.
83
80
  const MICROS_PER_SECOND = BigInt(1_000_000);
84
- const CPU_DENOMINATOR = MICROS_PER_SECOND * BigInt(100) * BigInt(1000);
81
+ const CPU_DENOMINATOR = MICROS_PER_SECOND * BigInt(100);
85
82
  const MEMORY_DENOMINATOR = BigInt(1024) * MICROS_PER_SECOND;
86
83
  const NETWORK_DENOMINATOR = BigInt(1024 * 1024);
87
- const UNITS_PER_MILLICREDIT = BigInt(1_048_576) * BigInt(48_828_125);
84
+ const UNITS_PER_MILLICREDIT = BigInt(1_048_576) * BigInt(390_625);
88
85
  const ZERO = BigInt(0);
89
86
  const ONE = BigInt(1);
90
87
  const TWO = BigInt(2);
@@ -100,20 +97,17 @@ const assertUsage = (usage: StepUsage, subject: string): void => {
100
97
 
101
98
  const micros = (ms: number): bigint => BigInt(Math.round(ms * 1000));
102
99
  const whole = (count: number): bigint => BigInt(Math.round(count));
103
- /** Coefficients have at most two decimals (1.05) or one (1.5): exact as integers. */
100
+ /** Profile coefficients have at most two decimals (1.05): exact as integers. */
104
101
  const hundredths = (coefficient: number): bigint => BigInt(Math.round(coefficient * 100));
105
- const thousandths = (coefficient: number): bigint => BigInt(Math.round(coefficient * 1000));
106
102
 
107
103
  /** Variable cost (everything but the execution price) of a usage, in exact units. */
108
104
  const variableUnits = (usage: StepUsage, execution: ExecutionCostInput): bigint => {
109
105
  const profile = RESOURCE_PROFILES[execution.profile];
110
- const guaranteed = execution.guaranteedCpu ? COST_RATES.guaranteedCpuCoefficient : 1;
111
- // cpuUs / 10^6 s × rate × coefficient% / 100 × guaranteed‰ / 1000
106
+ // cpuUs / 10^6 s × rate × coefficient% / 100
112
107
  const cpu =
113
108
  (micros(usage.cpuMs) *
114
109
  BigInt(COST_RATES.cpuMillicreditsPerSecond) *
115
110
  hundredths(profile.cpuCoefficient) *
116
- thousandths(guaranteed) *
117
111
  UNITS_PER_MILLICREDIT) /
118
112
  CPU_DENOMINATOR;
119
113
  // memoryMb / 1024 GB × wallUs / 10^6 s × rate
@@ -66,8 +66,6 @@ export interface ExecutionLimits {
66
66
  cpuTimeMs: number;
67
67
  /** Wall-clock time of the whole execution (one segment when it suspends). */
68
68
  wallTimeMs: number;
69
- /** Whether the execution holds a core of the runner for itself. */
70
- guaranteedCpu: boolean;
71
69
  }
72
70
 
73
71
  export interface ExecutionBudget {
@@ -130,6 +128,12 @@ export type ExecutionCallResultMessage =
130
128
 
131
129
  export interface StepMetrics {
132
130
  cpuMs: number;
131
+ /**
132
+ * What the step itself grew the heap by: the highest reading during the step minus the reading
133
+ * at its start, never below 0. An estimate that can err both ways (a late sample misses a short
134
+ * peak, a delayed GC keeps freed memory), and blind to the isolate's base heap and to what earlier
135
+ * steps left.
136
+ */
133
137
  heapPeakBytes: number;
134
138
  wallMs: number;
135
139
  }
@@ -21,7 +21,7 @@ const request: ExecutionRequest = {
21
21
  executionId: 'exec-1',
22
22
  definition: { formatVersion: CURRENT_FORMAT_VERSION, accesses: [], steps: [] },
23
23
  input: { a: 1 },
24
- limits: { memoryMb: 128, cpuTimeMs: 1_000, wallTimeMs: 300, guaranteedCpu: false },
24
+ limits: { memoryMb: 128, cpuTimeMs: 1_000, wallTimeMs: 300 },
25
25
  budget: { maxSteps: 10, maxEffects: 10 },
26
26
  };
27
27