@agenticprimitives/coordination 0.0.0-alpha.3 → 0.0.0-alpha.31

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.
Files changed (61) hide show
  1. package/README.md +7 -1
  2. package/dist/attribution/index.d.ts +69 -0
  3. package/dist/attribution/index.d.ts.map +1 -0
  4. package/dist/attribution/index.js +165 -0
  5. package/dist/attribution/index.js.map +1 -0
  6. package/dist/attribution/scenarios.d.ts +26 -0
  7. package/dist/attribution/scenarios.d.ts.map +1 -0
  8. package/dist/attribution/scenarios.js +59 -0
  9. package/dist/attribution/scenarios.js.map +1 -0
  10. package/dist/core/commands.d.ts +53 -3
  11. package/dist/core/commands.d.ts.map +1 -1
  12. package/dist/core/commands.js +6 -0
  13. package/dist/core/commands.js.map +1 -1
  14. package/dist/core/events.d.ts +47 -3
  15. package/dist/core/events.d.ts.map +1 -1
  16. package/dist/core/ids.d.ts +4 -0
  17. package/dist/core/ids.d.ts.map +1 -1
  18. package/dist/core/ids.js +2 -0
  19. package/dist/core/ids.js.map +1 -1
  20. package/dist/core/index.d.ts +3 -3
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +1 -1
  23. package/dist/core/index.js.map +1 -1
  24. package/dist/core/provenance.d.ts.map +1 -1
  25. package/dist/core/provenance.js +44 -1
  26. package/dist/core/provenance.js.map +1 -1
  27. package/dist/core/reducer.d.ts +21 -2
  28. package/dist/core/reducer.d.ts.map +1 -1
  29. package/dist/core/reducer.js +450 -32
  30. package/dist/core/reducer.js.map +1 -1
  31. package/dist/decisions/index.d.ts +2 -8
  32. package/dist/decisions/index.d.ts.map +1 -1
  33. package/dist/decisions/index.js +1 -1
  34. package/dist/decisions/index.js.map +1 -1
  35. package/dist/decisions/types.d.ts +53 -1
  36. package/dist/decisions/types.d.ts.map +1 -1
  37. package/dist/index.d.ts +9 -4
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +6 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/participation/index.d.ts +2 -0
  42. package/dist/participation/index.d.ts.map +1 -1
  43. package/dist/participation/index.js +1 -1
  44. package/dist/participation/index.js.map +1 -1
  45. package/dist/participation/payload.d.ts +17 -0
  46. package/dist/participation/payload.d.ts.map +1 -0
  47. package/dist/participation/payload.js +35 -0
  48. package/dist/participation/payload.js.map +1 -0
  49. package/dist/participation/types.d.ts +1 -1
  50. package/dist/participation/types.d.ts.map +1 -1
  51. package/dist/planning/types.d.ts +2 -0
  52. package/dist/planning/types.d.ts.map +1 -1
  53. package/dist/projections/continuation.d.ts +53 -0
  54. package/dist/projections/continuation.d.ts.map +1 -0
  55. package/dist/projections/continuation.js +44 -0
  56. package/dist/projections/continuation.js.map +1 -0
  57. package/dist/projections/index.d.ts +2 -0
  58. package/dist/projections/index.d.ts.map +1 -1
  59. package/dist/projections/index.js +5 -1
  60. package/dist/projections/index.js.map +1 -1
  61. package/package.json +20 -6
@@ -0,0 +1,53 @@
1
+ import type { Address, Hex32 } from '@agenticprimitives/types';
2
+ import type { CoordinationStateV1 } from '../core/reducer.js';
3
+ import type { EndeavorId, CommitmentId } from '../core/ids.js';
4
+ import type { OutcomeSpecificationV1 } from '../core/types.js';
5
+ /** One run this endeavor has claimed, with what a reader needs to decide whether to trust it. */
6
+ export interface ContinuationRunV1 {
7
+ runRef: string;
8
+ /** The digest as attached. A reader comparing this to the record it fetched learns whether it is the same one. */
9
+ recordDigest: Hex32;
10
+ attachedBy: Address;
11
+ attachedAt: string;
12
+ /** Spec 438 §4 — the five-dimensional reading, supplied by the caller that can read the record. Absent when
13
+ * the caller did not look: ABSENT IS NOT "FINE". A continuation package that silently reported every
14
+ * unexamined run as complete would be the exact falsehood §4 exists to prevent. */
15
+ evidenceStatus?: unknown;
16
+ }
17
+ /** A commitment still outstanding when the work changed hands. */
18
+ export interface ContinuationCommitmentV1 {
19
+ commitmentId: CommitmentId;
20
+ participant: Address;
21
+ steps: string[];
22
+ deadline?: string;
23
+ }
24
+ export interface ContinuationPackageV1 {
25
+ schema: 'apcoord/ContinuationPackageV1';
26
+ endeavorId: EndeavorId;
27
+ title: string;
28
+ managingPrincipal: Address;
29
+ /** The OBSERVABLE success definition, not a prose restatement: the next agent is told what "done" means in
30
+ * the same terms the assessment will be judged against (spec 438 §5). */
31
+ outcome?: OutcomeSpecificationV1;
32
+ /** Raised and not yet decided. What the next actor must not assume was settled. */
33
+ openDecisions: Array<{
34
+ decisionId: string;
35
+ question: string;
36
+ dueAt?: string;
37
+ }>;
38
+ /** Still `active`: neither discharged, breached, lapsed nor withdrawn. */
39
+ liveCommitments: ContinuationCommitmentV1[];
40
+ attachedRuns: ContinuationRunV1[];
41
+ /** The state revision this was read at, so a reader can tell whether it has since moved. */
42
+ atRevision: number;
43
+ }
44
+ /**
45
+ * Project the continuation package from coordination state.
46
+ *
47
+ * `evidenceStatusOf` is injected rather than imported: coordination does not depend on orchestration (that
48
+ * would be a back-edge), and a caller holding the run records is the only party that can read them anyway.
49
+ */
50
+ export declare function projectContinuationPackage(state: CoordinationStateV1, opts?: {
51
+ evidenceStatusByRunRef?: Readonly<Record<string, unknown>>;
52
+ }): ContinuationPackageV1 | null;
53
+ //# sourceMappingURL=continuation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continuation.d.ts","sourceRoot":"","sources":["../../src/projections/continuation.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,iGAAiG;AACjG,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,kHAAkH;IAClH,YAAY,EAAE,KAAK,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB;;wFAEoF;IACpF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,kEAAkE;AAClE,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,+BAA+B,CAAC;IACxC,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,OAAO,CAAC;IAC3B;8EAC0E;IAC1E,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,mFAAmF;IACnF,aAAa,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/E,0EAA0E;IAC1E,eAAe,EAAE,wBAAwB,EAAE,CAAC;IAC5C,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,4FAA4F;IAC5F,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,mBAAmB,EAC1B,IAAI,GAAE;IAAE,sBAAsB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAO,GACxE,qBAAqB,GAAG,IAAI,CAuC9B"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Project the continuation package from coordination state.
3
+ *
4
+ * `evidenceStatusOf` is injected rather than imported: coordination does not depend on orchestration (that
5
+ * would be a back-edge), and a caller holding the run records is the only party that can read them anyway.
6
+ */
7
+ export function projectContinuationPackage(state, opts = {}) {
8
+ const endeavor = state.endeavor;
9
+ if (!endeavor)
10
+ return null;
11
+ const liveCommitments = Object.values(state.commitments)
12
+ .filter((c) => c.status === 'active')
13
+ .map((c) => ({
14
+ commitmentId: c.commitmentId,
15
+ participant: c.participant,
16
+ steps: [...c.steps],
17
+ ...(c.bounds?.deadline ? { deadline: c.bounds.deadline } : {}),
18
+ }));
19
+ const openDecisions = Object.values(state.decisionRequests)
20
+ .filter((d) => d.status === 'pending')
21
+ .map((d) => ({ decisionId: d.decisionId, question: d.title, ...(d.dueAt ? { dueAt: d.dueAt } : {}) }));
22
+ const attachedRuns = Object.values(state.attachedRuns).map((r) => ({
23
+ runRef: r.runRef,
24
+ recordDigest: r.recordDigest,
25
+ attachedBy: r.attachedBy,
26
+ attachedAt: r.attachedAt,
27
+ // Own property only (spec 445 / COV-4): `runRef` is a participant's string, and `'constructor' in {}` is true.
28
+ ...(opts.evidenceStatusByRunRef && Object.hasOwn(opts.evidenceStatusByRunRef, r.runRef)
29
+ ? { evidenceStatus: opts.evidenceStatusByRunRef[r.runRef] }
30
+ : {}),
31
+ }));
32
+ return {
33
+ schema: 'apcoord/ContinuationPackageV1',
34
+ endeavorId: endeavor.endeavorId,
35
+ title: endeavor.title,
36
+ managingPrincipal: endeavor.managingPrincipal,
37
+ ...(state.outcome ? { outcome: state.outcome } : {}),
38
+ openDecisions,
39
+ liveCommitments,
40
+ attachedRuns,
41
+ atRevision: state.revision,
42
+ };
43
+ }
44
+ //# sourceMappingURL=continuation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continuation.js","sourceRoot":"","sources":["../../src/projections/continuation.ts"],"names":[],"mappings":"AAwDA;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAA0B,EAC1B,OAAuE,EAAE;IAEzE,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAChC,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,W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,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC;YACrF,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;YAC3D,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC,CAAC;IAEJ,OAAO;QACL,MAAM,EAAE,+BAA+B;QACvC,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB;QAC7C,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,aAAa;QACb,eAAe;QACf,YAAY;QACZ,UAAU,EAAE,KAAK,CAAC,QAAQ;KAC3B,CAAC;AACJ,CAAC"}
@@ -5,4 +5,6 @@ export type WorkBoardProjectionV1 = {
5
5
  export type MyWorkProjectionV1 = {
6
6
  readonly __reserved: 'apcoord/MyWorkProjectionV1 (spec 334)';
7
7
  };
8
+ export type { ContinuationPackageV1, ContinuationCommitmentV1, ContinuationRunV1, } from './continuation.js';
9
+ export { projectContinuationPackage } from './continuation.js';
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/projections/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,0CAA0C,CAAA;CAAE,CAAC;AACxG,MAAM,MAAM,kBAAkB,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,uCAAuC,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/projections/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,0CAA0C,CAAA;CAAE,CAAC;AACxG,MAAM,MAAM,kBAAkB,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,uCAAuC,CAAA;CAAE,CAAC;AAElG,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,3 +1,7 @@
1
- // Reserved API surface for spec 333/334 (derived read models — board, calendar, My Work). No logic ships here.
1
+ // Reserved API surface for spec 333/334 (derived read models — board, calendar, My Work).
2
+ //
3
+ // The continuation package (spec 438 §3) is the first real projection here: what a SECOND agent needs to carry
4
+ // the work on. Everything else below is still reserved.
2
5
  export const PROJECTIONS_STATUS = 'reserved-spec-333';
6
+ export { projectContinuationPackage } from './continuation.js';
3
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/projections/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAE/G,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/projections/index.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,EAAE;AACF,+GAA+G;AAC/G,wDAAwD;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAUtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@agenticprimitives/coordination",
3
- "version": "0.0.0-alpha.3",
3
+ "version": "0.0.0-alpha.31",
4
4
  "description": "Coordination core: Endeavor, OutcomeSpecification, CoordinationPlan, Participation — spec 332 W1.",
5
+ "homepage": "https://agenticprimitives.dev",
6
+ "bugs": {
7
+ "url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
8
+ },
9
+ "author": {
10
+ "name": "Agentic Trust Labs",
11
+ "url": "https://agenticprimitives.dev"
12
+ },
5
13
  "license": "MIT",
6
14
  "repository": {
7
15
  "type": "git",
@@ -56,23 +64,29 @@
56
64
  },
57
65
  "dependencies": {
58
66
  "@noble/hashes": "^2.2.0",
59
- "@agenticprimitives/ontology": "1.0.0-alpha.20",
60
- "@agenticprimitives/situations": "0.0.0-alpha.4",
61
- "@agenticprimitives/types": "1.0.0-alpha.20"
67
+ "@agenticprimitives/ontology": "1.0.0-alpha.48",
68
+ "@agenticprimitives/situations": "0.0.0-alpha.32",
69
+ "@agenticprimitives/types": "1.0.0-alpha.48"
62
70
  },
63
71
  "devDependencies": {
64
- "vitest": "^4.1.8"
72
+ "vitest": "^4.1.11"
65
73
  },
66
74
  "keywords": [
67
75
  "agentic",
68
76
  "coordination",
69
77
  "endeavor",
70
- "p-plan"
78
+ "p-plan",
79
+ "agentic-primitives",
80
+ "agenticprimitives",
81
+ "ai-agents",
82
+ "agent-authority",
83
+ "agentic-trust"
71
84
  ],
72
85
  "scripts": {
73
86
  "build": "tsc -p tsconfig.build.json",
74
87
  "typecheck": "tsc -p tsconfig.json --noEmit",
75
88
  "test": "vitest run",
89
+ "test:unit": "vitest run",
76
90
  "clean": "rm -rf dist"
77
91
  }
78
92
  }