@abelxiaoxing/cadence 2.0.21 → 2.0.23

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.
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "schema": "cadence-web-assets/1",
3
- "sourceHash": "510488e018a4eea488a0059bf4e1f64cf37a108e51a85f8e36ea195e92f5e7a6",
4
- "contractHash": "d19e63723270a27a4c00776d8301849e08480e054bc832ca455f889d061c65c9",
5
- "buildId": "1e3f1bf5557f78d96be1cd0c3ccaa2043fe8865e553b50679a3dc47a87031c3f",
3
+ "sourceHash": "893e862f3d75d9f785390a932c5f4c0926693e57f2f6fe3f0a72d2c39151744c",
4
+ "contractHash": "f0ff0c9d0481dab9fd21cdbc7c0d72b427bee60033a9af4c789f859c4c83fe75",
5
+ "buildId": "489c8a8d322ab1d43ac577231cb8effcb3248b1925c1730d574f239f2dacbeb3",
6
6
  "assets": [
7
7
  {
8
8
  "name": "assets/cadence.css",
9
- "bytes": 109556,
10
- "sha256": "9d6fb6d9702de9e88e88c936462f3e538b29c1cb07d885a7978cde84079951b2",
9
+ "bytes": 105593,
10
+ "sha256": "a97efc81ec6e4e0677ed71d243f41c6a13e0075042e8d6622adcc758d55b43f5",
11
11
  "references": [
12
12
  "assets/KaTeX_AMS-Regular.ttf",
13
13
  "assets/KaTeX_AMS-Regular.woff",
@@ -73,8 +73,8 @@
73
73
  },
74
74
  {
75
75
  "name": "assets/cadence.js",
76
- "bytes": 313128,
77
- "sha256": "d0d00c513ae20829080be600c9fd8c0cae5bbd52acd310dfa68c85fa78ece779",
76
+ "bytes": 282636,
77
+ "sha256": "ade266022c00ef8e523443976e82d271babed26cffb288afd64d80bd02a55805",
78
78
  "references": [
79
79
  "assets/markdown.js",
80
80
  "assets/react.js",
@@ -1,7 +0,0 @@
1
- {
2
- "schema": "cadence-assistant-checks/1",
3
- "checks": [
4
- { "name": "Type check", "command": "bun run check", "timeoutMs": 120000 },
5
- { "name": "Tests", "command": "bun run test", "timeoutMs": 120000 }
6
- ]
7
- }
@@ -1,87 +0,0 @@
1
- /** Portable local proposal only. UUID/hash are prospective, not stored membership. */
2
-
3
- import { text } from "./service/contracts/core.ts";
4
- import {
5
- type Action,
6
- type Assignment,
7
- ContractError,
8
- type CurrentView,
9
- canonicalJson,
10
- decodeAction,
11
- decodeCurrentView,
12
- roleForPurpose,
13
- utf8Bytes,
14
- } from "./service-contract.ts";
15
-
16
- export interface ProposalCrypto {
17
- uuid(): string;
18
- sha256(bytes: Uint8Array): string | Promise<string>;
19
- }
20
- export async function proposePlan(
21
- input: CurrentView,
22
- readablePlan: string,
23
- assignments: readonly Assignment[],
24
- crypto: ProposalCrypto,
25
- ): Promise<Extract<Action, { kind: "save-plan" }>> {
26
- // Decode/copy BEFORE the digest await. Caller mutation cannot retarget a draft.
27
- const current = decodeCurrentView(input);
28
- if (
29
- current.context.status !== "available" ||
30
- !current.context.version.task ||
31
- !current.readablePlan?.editable ||
32
- current.savedGraph.status === "unavailable"
33
- )
34
- throw new ContractError("unavailable");
35
- const context = current.context.version;
36
- const task = context.task;
37
- if (!task) throw new ContractError("stale");
38
- const plan = text(readablePlan, 32768);
39
- // The shared action/graph decoder checks every role/capability/dependency/UTF8
40
- // and aggregate bound before invoking asynchronous caller-supplied crypto.
41
- const action = decodeAction({
42
- kind: "save-plan",
43
- taskId: task.id,
44
- plan,
45
- graph: {
46
- schema: "cadence-graph/2",
47
- taskId: task.id,
48
- taskKind: task.kind,
49
- taskRevision: task.revision + 1,
50
- revision: (task.graphRevision ?? 0) + 1,
51
- planRevision:
52
- current.savedGraph.status === "saved"
53
- ? current.savedGraph.planRevision + 1
54
- : 1,
55
- plan: {
56
- recordId: crypto.uuid(),
57
- version:
58
- current.savedGraph.status === "saved"
59
- ? current.savedGraph.planRevision + 1
60
- : 1,
61
- field: "plan",
62
- bytes: utf8Bytes(plan),
63
- // Structural placeholder only, replaced by the exact digest below.
64
- sha256: "0".repeat(64),
65
- },
66
- assignments,
67
- },
68
- });
69
- if (action.kind !== "save-plan") throw new ContractError("invalid");
70
- for (const assignment of action.graph.assignments) {
71
- const role = current.roles.find(
72
- (r) => r.role === roleForPurpose(assignment.purpose),
73
- );
74
- if (
75
- !role ||
76
- canonicalJson(role) !== canonicalJson(assignment.role) ||
77
- canonicalJson(context.model) !== canonicalJson(assignment.model)
78
- )
79
- throw new ContractError("stale");
80
- }
81
- action.graph.plan.sha256 = await crypto.sha256(
82
- new TextEncoder().encode(plan),
83
- );
84
- const proposal = decodeAction(action);
85
- if (proposal.kind !== "save-plan") throw new ContractError("invalid");
86
- return proposal;
87
- }