@agenticprimitives/coordination 0.0.0-alpha.10

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 (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +87 -0
  3. package/dist/core/commands.d.ts +204 -0
  4. package/dist/core/commands.d.ts.map +1 -0
  5. package/dist/core/commands.js +28 -0
  6. package/dist/core/commands.js.map +1 -0
  7. package/dist/core/events.d.ts +177 -0
  8. package/dist/core/events.d.ts.map +1 -0
  9. package/dist/core/events.js +2 -0
  10. package/dist/core/events.js.map +1 -0
  11. package/dist/core/ids.d.ts +35 -0
  12. package/dist/core/ids.d.ts.map +1 -0
  13. package/dist/core/ids.js +38 -0
  14. package/dist/core/ids.js.map +1 -0
  15. package/dist/core/index.d.ts +12 -0
  16. package/dist/core/index.d.ts.map +1 -0
  17. package/dist/core/index.js +6 -0
  18. package/dist/core/index.js.map +1 -0
  19. package/dist/core/provenance.d.ts +29 -0
  20. package/dist/core/provenance.d.ts.map +1 -0
  21. package/dist/core/provenance.js +175 -0
  22. package/dist/core/provenance.js.map +1 -0
  23. package/dist/core/reducer.d.ts +53 -0
  24. package/dist/core/reducer.d.ts.map +1 -0
  25. package/dist/core/reducer.js +1288 -0
  26. package/dist/core/reducer.js.map +1 -0
  27. package/dist/core/types.d.ts +106 -0
  28. package/dist/core/types.d.ts.map +1 -0
  29. package/dist/core/types.js +22 -0
  30. package/dist/core/types.js.map +1 -0
  31. package/dist/decisions/index.d.ts +11 -0
  32. package/dist/decisions/index.d.ts.map +1 -0
  33. package/dist/decisions/index.js +6 -0
  34. package/dist/decisions/index.js.map +1 -0
  35. package/dist/decisions/triage.d.ts +30 -0
  36. package/dist/decisions/triage.d.ts.map +1 -0
  37. package/dist/decisions/triage.js +66 -0
  38. package/dist/decisions/triage.js.map +1 -0
  39. package/dist/decisions/types.d.ts +87 -0
  40. package/dist/decisions/types.d.ts.map +1 -0
  41. package/dist/decisions/types.js +2 -0
  42. package/dist/decisions/types.js.map +1 -0
  43. package/dist/execution/compile.d.ts +60 -0
  44. package/dist/execution/compile.d.ts.map +1 -0
  45. package/dist/execution/compile.js +83 -0
  46. package/dist/execution/compile.js.map +1 -0
  47. package/dist/execution/index.d.ts +3 -0
  48. package/dist/execution/index.d.ts.map +1 -0
  49. package/dist/execution/index.js +2 -0
  50. package/dist/execution/index.js.map +1 -0
  51. package/dist/index.d.ts +13 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +10 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/participation/index.d.ts +2 -0
  56. package/dist/participation/index.d.ts.map +1 -0
  57. package/dist/participation/index.js +2 -0
  58. package/dist/participation/index.js.map +1 -0
  59. package/dist/participation/types.d.ts +66 -0
  60. package/dist/participation/types.d.ts.map +1 -0
  61. package/dist/participation/types.js +2 -0
  62. package/dist/participation/types.js.map +1 -0
  63. package/dist/planning/hash.d.ts +8 -0
  64. package/dist/planning/hash.d.ts.map +1 -0
  65. package/dist/planning/hash.js +20 -0
  66. package/dist/planning/hash.js.map +1 -0
  67. package/dist/planning/index.d.ts +5 -0
  68. package/dist/planning/index.d.ts.map +1 -0
  69. package/dist/planning/index.js +3 -0
  70. package/dist/planning/index.js.map +1 -0
  71. package/dist/planning/types.d.ts +75 -0
  72. package/dist/planning/types.d.ts.map +1 -0
  73. package/dist/planning/types.js +2 -0
  74. package/dist/planning/types.js.map +1 -0
  75. package/dist/planning/validate.d.ts +13 -0
  76. package/dist/planning/validate.d.ts.map +1 -0
  77. package/dist/planning/validate.js +55 -0
  78. package/dist/planning/validate.js.map +1 -0
  79. package/dist/profiles/index.d.ts +11 -0
  80. package/dist/profiles/index.d.ts.map +1 -0
  81. package/dist/profiles/index.js +3 -0
  82. package/dist/profiles/index.js.map +1 -0
  83. package/dist/projections/index.d.ts +8 -0
  84. package/dist/projections/index.d.ts.map +1 -0
  85. package/dist/projections/index.js +3 -0
  86. package/dist/projections/index.js.map +1 -0
  87. package/package.json +91 -0
  88. package/spec.md +1 -0
@@ -0,0 +1,83 @@
1
+ const fail = (reason) => ({ ok: false, reason });
2
+ /**
3
+ * Compile the adopted plan's committed steps into ExecutionIntent descriptors — one per
4
+ * (active commitment × step), ordered by the plan's own step order. Steps without an active
5
+ * commitment are OMITTED (not yet executable — an answer, not an error; ADR-0013); a stale
6
+ * commitment hash, an unknown step, an ambiguous double-commitment, or a snapshot bound to a
7
+ * different revision rejects the whole compilation fail-closed.
8
+ */
9
+ export function compilePlanToExecutionIntents(input) {
10
+ const { endeavor, plan, commitments } = input;
11
+ const adopted = endeavor.adoptedPlanRef;
12
+ if (!adopted)
13
+ return fail('endeavor has no adopted plan');
14
+ if (plan.endeavorId !== endeavor.endeavorId) {
15
+ return fail(`plan belongs to ${plan.endeavorId}, not ${endeavor.endeavorId}`);
16
+ }
17
+ if (adopted.planId !== plan.planId || adopted.revision !== plan.revision) {
18
+ return fail(`plan ${plan.planId}@${plan.revision} is not the adopted revision ${adopted.planId}@${adopted.revision}`);
19
+ }
20
+ if (adopted.hash !== plan.contentHash) {
21
+ return fail('adopted plan ref hash does not match the plan contentHash — refusing to compile a mismatched revision');
22
+ }
23
+ const stepIds = new Set(plan.steps.map((s) => s.stepId));
24
+ // Join: stepId → the ONE active commitment covering it. Ambiguity rejects (an execution must
25
+ // bind exactly one commitmentRef); stale plan hashes reject (spec 332 §9.2).
26
+ const commitmentByStep = new Map();
27
+ for (const c of commitments) {
28
+ if (c.status !== 'active')
29
+ continue;
30
+ if (c.endeavorId !== endeavor.endeavorId) {
31
+ return fail(`commitment ${c.commitmentId} belongs to ${c.endeavorId}, not ${endeavor.endeavorId}`);
32
+ }
33
+ if (c.planRef.planId !== adopted.planId || c.planRef.revision !== adopted.revision || c.planRef.hash !== adopted.hash) {
34
+ return fail(`commitment ${c.commitmentId} binds a stale plan revision hash — recommit against the adopted revision`);
35
+ }
36
+ for (const stepId of c.steps) {
37
+ if (!stepIds.has(stepId))
38
+ return fail(`commitment ${c.commitmentId} names step ${stepId} which is not in the adopted revision`);
39
+ const prior = commitmentByStep.get(stepId);
40
+ if (prior)
41
+ return fail(`step ${stepId} is covered by two active commitments (${prior.commitmentId}, ${c.commitmentId}) — ambiguous actor`);
42
+ commitmentByStep.set(stepId, c);
43
+ }
44
+ }
45
+ // Snapshots: at most one per step, and it must bind the SAME adopted revision.
46
+ const snapshotByStep = new Map();
47
+ for (const s of input.contextSnapshots ?? []) {
48
+ if (s.endeavorId !== endeavor.endeavorId)
49
+ return fail(`snapshot ${s.snapshotId} belongs to ${s.endeavorId}, not ${endeavor.endeavorId}`);
50
+ if (s.planRef.planId !== adopted.planId || s.planRef.revision !== adopted.revision || s.planRef.hash !== adopted.hash) {
51
+ return fail(`snapshot ${s.snapshotId} binds a different plan revision — cut a fresh snapshot against the adopted revision`);
52
+ }
53
+ if (snapshotByStep.has(s.stepId))
54
+ return fail(`step ${s.stepId} has two context snapshots — ambiguous contextSnapshotHash`);
55
+ snapshotByStep.set(s.stepId, s);
56
+ }
57
+ const intents = [];
58
+ for (const step of plan.steps) {
59
+ const commitment = commitmentByStep.get(step.stepId);
60
+ if (!commitment)
61
+ continue; // no active commitment — the step is not yet executable
62
+ const snapshot = snapshotByStep.get(step.stepId);
63
+ intents.push({
64
+ schema: 'apcoord/ExecutionIntentDescriptorV1',
65
+ goal: step.description,
66
+ stepKind: step.kind,
67
+ ...(step.capabilityRequirements?.length ? { capabilityRequirements: step.capabilityRequirements } : {}),
68
+ provenance: {
69
+ endeavorId: endeavor.endeavorId,
70
+ planId: plan.planId,
71
+ planRevision: plan.revision,
72
+ planHash: plan.contentHash,
73
+ stepId: step.stepId,
74
+ commitmentRef: commitment.commitmentId,
75
+ actor: commitment.participant,
76
+ principal: endeavor.managingPrincipal,
77
+ ...(snapshot ? { contextSnapshotHash: snapshot.snapshotHash } : {}),
78
+ },
79
+ });
80
+ }
81
+ return { ok: true, intents };
82
+ }
83
+ //# sourceMappingURL=compile.js.map
@@ -0,0 +1 @@
1
+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;gBACV,UAAU,EAAE,QAAQ,CAAC,UAAU;gBAC/B,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,YAAY,EAAE,IAAI,CAAC,QAAQ;gBAC3B,QAAQ,EAAE,IAAI,CAAC,WAAW;gBAC1B,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,aAAa,EAAE,UAAU,CAAC,YAAY;gBACtC,KAAK,EAAE,UAAU,CAAC,WAAW;gBAC7B,SAAS,EAAE,QAAQ,CAAC,iBAAiB;gBACrC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpE;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { CompilePlanInput, CompilePlanResult, ExecutionIntentDescriptorV1, ExecutionProvenanceKeysV1, } from './compile.js';
2
+ export { compilePlanToExecutionIntents } from './compile.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/execution/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { compilePlanToExecutionIntents } from './compile.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/execution/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const PACKAGE_NAME = "@agenticprimitives/coordination";
2
+ export declare const PACKAGE_STATUS = "w4-execution-and-recommendations";
3
+ export declare const SPEC_REF = "specs/332-coordination-endeavor-core.md";
4
+ export type { AllocationId, CommitmentId, CommandValidationResult, ContextRef, CoordinationCommandV1, CoordinationContextSnapshotV1, CoordinationEventV1, CoordinationPlanId, CoordinationStateV1, EndeavorEntryPoint, EndeavorId, EndeavorLifecycle, EndeavorRelationKind, EndeavorRelationV1, EndeavorRequestId, EndeavorRequestStatus, EndeavorRequestV1, EndeavorV1, ExternalObjectBindingV1, ExternalSyncMode, OutcomeCriterionKind, OutcomeCriterionV1, OutcomeSpecificationV1, ParticipationId, PlanStepId, ProposalId, ProvenanceActivitySummary, ProvenanceCorrespondenceSummary, ProvenanceEntitySummary, ProvenanceInputsV1, RecommendationId, DecisionId, SatisfiedStepV1, } from './core/index.js';
5
+ export { COORDINATION_CLASS_IRIS, COORDINATION_COMMAND_KINDS, CoordinationEventError, CoordinationIdError, applyCoordinationEvent, assertAllocationId, assertCommitmentId, assertCoordinationPlanId, assertEndeavorId, assertEndeavorRequestId, assertParticipationId, assertPlanStepId, assertProposalId, assertRecommendationId, assertDecisionId, deriveProvenanceInputs, initialCoordinationState, makeAllocationId, makeCommitmentId, makeCoordinationPlanId, makeEndeavorId, makeEndeavorRequestId, makeParticipationId, makePlanStepId, makeProposalId, makeRecommendationId, makeDecisionId, planKey, validateCoordinationCommand, } from './core/index.js';
6
+ export type { CapabilityRequirementRef, CoordinationPlanStatus, CoordinationPlanV1, CriterionRef, MilestoneAchievementV1, MilestoneDefinitionV1, PlanContentV1, PlanEdgeKind, PlanEdgeV1, PlanRevisionRef, PlanStepKind, PlanStepV1, PlanValidationResult, PlanVariableV1, } from './planning/index.js';
7
+ export { planContentHash, validatePlanContent } from './planning/index.js';
8
+ export type { AllocationDecisionV1, CommitmentStatus, ContributionCommitmentV1, ContributionProposalV1, EndeavorParticipationV1, ParticipationAssertion, ParticipationRole, ParticipationStatus, SignedPayloadRef, } from './participation/index.js';
9
+ export type { CompilePlanInput, CompilePlanResult, ExecutionIntentDescriptorV1, ExecutionProvenanceKeysV1, } from './execution/index.js';
10
+ export { compilePlanToExecutionIntents } from './execution/index.js';
11
+ export type { CoordinationCommandTemplate, RecommendationStatus, RecommendationSubjectV1, RecommendationV1, ApprovalRequirementV1, DecisionOutcome, DecisionRequestV1, DecisionRecordV1, TriageRecommendationDraftV1, TriageRequestRowV1, } from './decisions/index.js';
12
+ export { goalTokens, projectTriageRecommendations } from './decisions/index.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,oCAAoC,CAAC;AAC9D,eAAO,MAAM,cAAc,qCAAqC,CAAC;AACjE,eAAO,MAAM,QAAQ,4CAA4C,CAAC;AAElE,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,uBAAuB,EACvB,UAAU,EACV,qBAAqB,EACrB,6BAA6B,EAC7B,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,UAAU,EACV,UAAU,EACV,yBAAyB,EACzB,+BAA+B,EAC/B,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,OAAO,EACP,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAErE,YAAY,EACV,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ // @agenticprimitives/coordination — Endeavor coordination core (spec 332 W1; spec 334 W4
2
+ // execution compilation + recommendation slice).
3
+ export const PACKAGE_NAME = '@agenticprimitives/coordination';
4
+ export const PACKAGE_STATUS = 'w4-execution-and-recommendations';
5
+ export const SPEC_REF = 'specs/332-coordination-endeavor-core.md';
6
+ export { COORDINATION_CLASS_IRIS, COORDINATION_COMMAND_KINDS, CoordinationEventError, CoordinationIdError, applyCoordinationEvent, assertAllocationId, assertCommitmentId, assertCoordinationPlanId, assertEndeavorId, assertEndeavorRequestId, assertParticipationId, assertPlanStepId, assertProposalId, assertRecommendationId, assertDecisionId, deriveProvenanceInputs, initialCoordinationState, makeAllocationId, makeCommitmentId, makeCoordinationPlanId, makeEndeavorId, makeEndeavorRequestId, makeParticipationId, makePlanStepId, makeProposalId, makeRecommendationId, makeDecisionId, planKey, validateCoordinationCommand, } from './core/index.js';
7
+ export { planContentHash, validatePlanContent } from './planning/index.js';
8
+ export { compilePlanToExecutionIntents } from './execution/index.js';
9
+ export { goalTokens, projectTriageRecommendations } from './decisions/index.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,iDAAiD;AAEjD,MAAM,CAAC,MAAM,YAAY,GAAG,iCAAiC,CAAC;AAC9D,MAAM,CAAC,MAAM,cAAc,GAAG,kCAAkC,CAAC;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG,yCAAyC,CAAC;AAqClE,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,OAAO,EACP,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC;AAkBzB,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAoB3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAcrE,OAAO,EAAE,UAAU,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type { AllocationDecisionV1, CommitmentStatus, ContributionCommitmentV1, ContributionProposalV1, EndeavorParticipationV1, ParticipationAssertion, ParticipationRole, ParticipationStatus, SignedPayloadRef, } from './types.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/participation/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/participation/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,66 @@
1
+ import type { Address, Hex, Hex32 } from '@agenticprimitives/types';
2
+ import type { EntityRef, SituationValidity } from '@agenticprimitives/situations';
3
+ import type { AllocationId, CommitmentId, EndeavorId, ParticipationId, PlanStepId, ProposalId } from '../core/ids.js';
4
+ import type { PlanRevisionRef } from '../planning/types.js';
5
+ /** Reference to a signature over a canonical payload hash. Carrying the proof is never itself
6
+ * authorization; verification (ERC-1271/6492/ECDSA/WebAuthn) is the serving plane's job. */
7
+ export interface SignedPayloadRef {
8
+ payloadHash: Hex32;
9
+ signer: Address;
10
+ scheme: 'erc1271' | 'erc6492' | 'ecdsa' | 'webauthn';
11
+ signature: Hex;
12
+ }
13
+ export type ParticipationRole = 'sponsor' | 'coordinator' | 'contributor' | 'validator' | 'beneficiary' | 'observer';
14
+ export type ParticipationAssertion = 'invitation-acceptance' | 'allocation-commitment' | 'self-sponsor';
15
+ export type ParticipationStatus = 'invited' | 'active' | 'withdrawn';
16
+ export interface EndeavorParticipationV1 {
17
+ schema: 'apcoord/EndeavorParticipationV1';
18
+ participationId: ParticipationId;
19
+ endeavorId: EndeavorId;
20
+ participant: Address;
21
+ role: ParticipationRole;
22
+ scope?: PlanStepId[];
23
+ validity: SituationValidity;
24
+ assertedBy: ParticipationAssertion;
25
+ status: ParticipationStatus;
26
+ }
27
+ export interface ContributionProposalV1 {
28
+ schema: 'apcoord/ContributionProposalV1';
29
+ proposalId: ProposalId;
30
+ endeavorId: EndeavorId;
31
+ proposer: Address;
32
+ planRef: PlanRevisionRef;
33
+ steps: PlanStepId[];
34
+ note?: string;
35
+ proposedAt: string;
36
+ status: 'open' | 'allocated' | 'declined';
37
+ }
38
+ /** The Endeavor's selection of a participant for a contribution. Grants nothing (spec 332 §9). */
39
+ export interface AllocationDecisionV1 {
40
+ schema: 'apcoord/AllocationDecisionV1';
41
+ allocationId: AllocationId;
42
+ endeavorId: EndeavorId;
43
+ proposalRef: ProposalId;
44
+ participant: Address;
45
+ steps: PlanStepId[];
46
+ decidedBy: Address;
47
+ decidedAt: string;
48
+ status: 'allocated' | 'committed' | 'reallocated';
49
+ }
50
+ export type CommitmentStatus = 'active' | 'fulfilled' | 'withdrawn' | 'reallocated';
51
+ export interface ContributionCommitmentV1 {
52
+ schema: 'apcoord/ContributionCommitmentV1';
53
+ commitmentId: CommitmentId;
54
+ endeavorId: EndeavorId;
55
+ allocationRef: AllocationId;
56
+ participant: Address;
57
+ planRef: PlanRevisionRef;
58
+ steps: PlanStepId[];
59
+ signature: SignedPayloadRef;
60
+ bounds?: {
61
+ deadline?: string;
62
+ effortEstimateRef?: EntityRef;
63
+ };
64
+ status: CommitmentStatus;
65
+ }
66
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 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1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/participation/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { Hex32 } from '@agenticprimitives/types';
2
+ import type { PlanContentV1 } from './types.js';
3
+ /**
4
+ * Content hash of a plan revision: `sha256(JCS({ steps, edges, milestones }))`.
5
+ * Adoption and every ContributionCommitment bind to this exact hash (spec 332 §5/§6/§9).
6
+ */
7
+ export declare function planContentHash(content: PlanContentV1): Hex32;
8
+ //# sourceMappingURL=hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/planning/hash.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,KAAK,CAU7D"}
@@ -0,0 +1,20 @@
1
+ import { sha256 } from '@noble/hashes/sha2.js';
2
+ import { utf8ToBytes } from '@noble/hashes/utils.js';
3
+ import { jcsCanonicalize } from '@agenticprimitives/situations';
4
+ /**
5
+ * Content hash of a plan revision: `sha256(JCS({ steps, edges, milestones }))`.
6
+ * Adoption and every ContributionCommitment bind to this exact hash (spec 332 §5/§6/§9).
7
+ */
8
+ export function planContentHash(content) {
9
+ const canonical = jcsCanonicalize({
10
+ steps: content.steps,
11
+ edges: content.edges,
12
+ milestones: content.milestones,
13
+ });
14
+ const digest = sha256(utf8ToBytes(canonical));
15
+ let hex = '';
16
+ for (const b of digest)
17
+ hex += b.toString(16).padStart(2, '0');
18
+ return `0x${hex}`;
19
+ }
20
+ //# sourceMappingURL=hash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/planning/hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAIhE;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAsB;IACpD,MAAM,SAAS,GAAG,eAAe,CAAC;QAChC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,CAAC,IAAI,MAAM;QAAE,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC/D,OAAO,KAAK,GAAG,EAAW,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type { CapabilityRequirementRef, CoordinationPlanStatus, CoordinationPlanV1, CriterionRef, MilestoneAchievementV1, MilestoneDefinitionV1, PlanContentV1, PlanEdgeKind, PlanEdgeV1, PlanRevisionRef, PlanStepKind, PlanStepV1, PlanVariableV1, } from './types.js';
2
+ export { planContentHash } from './hash.js';
3
+ export { validatePlanContent } from './validate.js';
4
+ export type { PlanValidationResult } from './validate.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/planning/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,YAAY,EACZ,UAAU,EACV,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { planContentHash } from './hash.js';
2
+ export { validatePlanContent } from './validate.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/planning/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,75 @@
1
+ import type { Hex32 } from '@agenticprimitives/types';
2
+ import type { Address } from '@agenticprimitives/types';
3
+ import type { EntityRef } from '@agenticprimitives/situations';
4
+ import type { CoordinationPlanId, EndeavorId, PlanStepId } from '../core/ids.js';
5
+ /** Pointer to an OutcomeCriterion / criterion record governing activation or completion of a step. */
6
+ export interface CriterionRef {
7
+ criterionId: string;
8
+ hash?: Hex32;
9
+ }
10
+ /** `aps:Capability` requirement + minimum assertion strength (ADR-0053) — reference only, never authority. */
11
+ export interface CapabilityRequirementRef {
12
+ capabilityIri: string;
13
+ minAssertionStrength: 'declared' | 'claimed' | 'demonstrated';
14
+ }
15
+ /** Exact (planId, revision, contentHash) triple — what adoption and commitments bind to. */
16
+ export interface PlanRevisionRef {
17
+ planId: CoordinationPlanId;
18
+ revision: number;
19
+ hash: Hex32;
20
+ }
21
+ /** `p-plan:Variable` binding on a step. */
22
+ export interface PlanVariableV1 {
23
+ name: string;
24
+ description?: string;
25
+ bindingRef?: EntityRef;
26
+ }
27
+ export type PlanStepKind = 'contribution' | 'interaction' | 'decision' | 'aggregation' | 'validation';
28
+ export interface PlanStepV1 {
29
+ stepId: PlanStepId;
30
+ kind: PlanStepKind;
31
+ description: string;
32
+ capabilityRequirements?: CapabilityRequirementRef[];
33
+ inputs?: PlanVariableV1[];
34
+ outputs?: PlanVariableV1[];
35
+ activation?: CriterionRef;
36
+ completion?: CriterionRef;
37
+ }
38
+ export type PlanEdgeKind = 'precedes' | 'depends-on' | 'alternative' | 'condition' | 'compensates' | 'refines';
39
+ export interface PlanEdgeV1 {
40
+ from: PlanStepId;
41
+ to: PlanStepId;
42
+ kind: PlanEdgeKind;
43
+ }
44
+ export interface MilestoneDefinitionV1 {
45
+ milestoneId: string;
46
+ title: string;
47
+ criteria: CriterionRef[];
48
+ }
49
+ export interface MilestoneAchievementV1 {
50
+ schema: 'apcoord/MilestoneAchievementV1';
51
+ milestoneId: string;
52
+ endeavorId: EndeavorId;
53
+ evidenceRefs: EntityRef[];
54
+ achievedAt: string;
55
+ }
56
+ export type CoordinationPlanStatus = 'proposed' | 'adopted' | 'superseded' | 'rejected';
57
+ export interface CoordinationPlanV1 {
58
+ schema: 'apcoord/CoordinationPlanV1';
59
+ planId: CoordinationPlanId;
60
+ endeavorId: EndeavorId;
61
+ revision: number;
62
+ contentHash: Hex32;
63
+ steps: PlanStepV1[];
64
+ edges: PlanEdgeV1[];
65
+ milestones: MilestoneDefinitionV1[];
66
+ proposedBy: Address;
67
+ status: CoordinationPlanStatus;
68
+ }
69
+ /** The hash preimage of a plan revision — steps + edges + milestones, JCS-canonicalized. */
70
+ export interface PlanContentV1 {
71
+ steps: PlanStepV1[];
72
+ edges: PlanEdgeV1[];
73
+ milestones: MilestoneDefinitionV1[];
74
+ }
75
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/planning/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,E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qB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,gCAAgC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,YAAY,EAAE,SAAS,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;AAExF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,4BAA4B,CAAC;IACrC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,KAAK,CAAC;IACnB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,sBAAsB,CAAC;CAChC;AAED,4FAA4F;AAC5F,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,UAAU,EAAE,qBAAqB,EAAE,CAAC;CACrC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/planning/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import type { PlanContentV1 } from './types.js';
2
+ export type PlanValidationResult = {
3
+ ok: true;
4
+ } | {
5
+ ok: false;
6
+ reason: string;
7
+ };
8
+ /**
9
+ * Structural plan validation (spec 332 §6, `ProposePlan`): step ids unique, every edge endpoint
10
+ * exists, and the `precedes` edges form a DAG. Fail-closed: first violation rejects.
11
+ */
12
+ export declare function validatePlanContent(content: PlanContentV1): PlanValidationResult;
13
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/planning/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,oBAAoB,CA+ChF"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Structural plan validation (spec 332 §6, `ProposePlan`): step ids unique, every edge endpoint
3
+ * exists, and the `precedes` edges form a DAG. Fail-closed: first violation rejects.
4
+ */
5
+ export function validatePlanContent(content) {
6
+ if (content.steps.length === 0)
7
+ return { ok: false, reason: 'plan has no steps' };
8
+ const stepIds = new Set();
9
+ for (const step of content.steps) {
10
+ if (stepIds.has(step.stepId))
11
+ return { ok: false, reason: `duplicate step id ${step.stepId}` };
12
+ stepIds.add(step.stepId);
13
+ }
14
+ for (const edge of content.edges) {
15
+ if (!stepIds.has(edge.from))
16
+ return { ok: false, reason: `edge references unknown step ${edge.from}` };
17
+ if (!stepIds.has(edge.to))
18
+ return { ok: false, reason: `edge references unknown step ${edge.to}` };
19
+ if (edge.from === edge.to)
20
+ return { ok: false, reason: `self-edge on step ${edge.from}` };
21
+ }
22
+ const adjacency = new Map();
23
+ for (const edge of content.edges) {
24
+ if (edge.kind !== 'precedes')
25
+ continue;
26
+ const list = adjacency.get(edge.from) ?? [];
27
+ list.push(edge.to);
28
+ adjacency.set(edge.from, list);
29
+ }
30
+ const WHITE = 0;
31
+ const GRAY = 1;
32
+ const BLACK = 2;
33
+ const color = new Map();
34
+ for (const id of stepIds)
35
+ color.set(id, WHITE);
36
+ const visit = (node) => {
37
+ color.set(node, GRAY);
38
+ for (const next of adjacency.get(node) ?? []) {
39
+ const c = color.get(next);
40
+ if (c === GRAY)
41
+ return false;
42
+ if (c === WHITE && !visit(next))
43
+ return false;
44
+ }
45
+ color.set(node, BLACK);
46
+ return true;
47
+ };
48
+ for (const id of stepIds) {
49
+ if (color.get(id) === WHITE && !visit(id)) {
50
+ return { ok: false, reason: 'precedes edges contain a cycle' };
51
+ }
52
+ }
53
+ return { ok: true };
54
+ }
55
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/planning/validate.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAsB;IACxD,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAElF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,qBAAqB,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QAC/F,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,gCAAgC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACvG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CAAC,CAAC;YAC1B,IAAI,CAAC,KAAK,IAAI;gBAAE,OAAO,KAAK,CAAC;YAC7B,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBAAE,OAAO,KAAK,CAAC;QAChD,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;QACzB,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;YAC1C,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,gCAAgC,EAAE,CAAC;QACjE,CAAC;IACH,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const PROFILES_STATUS = "reserved-spec-333";
2
+ export type CoordinationProfileV1 = {
3
+ readonly __reserved: 'apcoord/CoordinationProfileV1 (spec 333)';
4
+ };
5
+ export type CustomFieldDefinitionV1 = {
6
+ readonly __reserved: 'apcoord/CustomFieldDefinitionV1 (spec 333)';
7
+ };
8
+ export type IntakeConfigurationV1 = {
9
+ readonly __reserved: 'apcoord/IntakeConfigurationV1 (spec 333)';
10
+ };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/profiles/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,0CAA0C,CAAA;CAAE,CAAC;AACxG,MAAM,MAAM,uBAAuB,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,4CAA4C,CAAA;CAAE,CAAC;AAC5G,MAAM,MAAM,qBAAqB,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,0CAA0C,CAAA;CAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Reserved API surface for spec 333 (profiles / custom fields / lifecycles / intake). No logic ships here.
2
+ export const PROFILES_STATUS = 'reserved-spec-333';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/profiles/index.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAE3G,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const PROJECTIONS_STATUS = "reserved-spec-333";
2
+ export type WorkBoardProjectionV1 = {
3
+ readonly __reserved: 'apcoord/WorkBoardProjectionV1 (spec 334)';
4
+ };
5
+ export type MyWorkProjectionV1 = {
6
+ readonly __reserved: 'apcoord/MyWorkProjectionV1 (spec 334)';
7
+ };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
1
+ // Reserved API surface for spec 333/334 (derived read models — board, calendar, My Work). No logic ships here.
2
+ export const PROJECTIONS_STATUS = 'reserved-spec-333';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"}
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@agenticprimitives/coordination",
3
+ "version": "0.0.0-alpha.10",
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
+ },
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/agentictrustlabs/agenticprimitives.git",
17
+ "directory": "packages/coordination"
18
+ },
19
+ "type": "module",
20
+ "main": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js"
26
+ },
27
+ "./core": {
28
+ "types": "./dist/core/index.d.ts",
29
+ "import": "./dist/core/index.js"
30
+ },
31
+ "./planning": {
32
+ "types": "./dist/planning/index.d.ts",
33
+ "import": "./dist/planning/index.js"
34
+ },
35
+ "./participation": {
36
+ "types": "./dist/participation/index.d.ts",
37
+ "import": "./dist/participation/index.js"
38
+ },
39
+ "./profiles": {
40
+ "types": "./dist/profiles/index.d.ts",
41
+ "import": "./dist/profiles/index.js"
42
+ },
43
+ "./decisions": {
44
+ "types": "./dist/decisions/index.d.ts",
45
+ "import": "./dist/decisions/index.js"
46
+ },
47
+ "./execution": {
48
+ "types": "./dist/execution/index.d.ts",
49
+ "import": "./dist/execution/index.js"
50
+ },
51
+ "./projections": {
52
+ "types": "./dist/projections/index.d.ts",
53
+ "import": "./dist/projections/index.js"
54
+ }
55
+ },
56
+ "files": [
57
+ "LICENSE",
58
+ "dist",
59
+ "spec.md",
60
+ "README.md"
61
+ ],
62
+ "publishConfig": {
63
+ "access": "public"
64
+ },
65
+ "dependencies": {
66
+ "@noble/hashes": "^2.2.0",
67
+ "@agenticprimitives/ontology": "1.0.0-alpha.27",
68
+ "@agenticprimitives/situations": "0.0.0-alpha.11",
69
+ "@agenticprimitives/types": "1.0.0-alpha.27"
70
+ },
71
+ "devDependencies": {
72
+ "vitest": "^4.1.8"
73
+ },
74
+ "keywords": [
75
+ "agentic",
76
+ "coordination",
77
+ "endeavor",
78
+ "p-plan",
79
+ "agentic-primitives",
80
+ "agenticprimitives",
81
+ "ai-agents",
82
+ "agent-authority",
83
+ "agentic-trust"
84
+ ],
85
+ "scripts": {
86
+ "build": "tsc -p tsconfig.build.json",
87
+ "typecheck": "tsc -p tsconfig.json --noEmit",
88
+ "test": "vitest run",
89
+ "clean": "rm -rf dist"
90
+ }
91
+ }
package/spec.md ADDED
@@ -0,0 +1 @@
1
+ See [spec 332](../../specs/332-coordination-endeavor-core.md) (Wave 1) + [ADR-0054](../../docs/architecture/decisions/0054-coordination-endeavor-doctrine.md).