@guyghost/swarm-dao-core 0.1.4 → 0.3.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.
Files changed (103) hide show
  1. package/dist/config.d.ts.map +1 -1
  2. package/dist/config.js +3 -1
  3. package/dist/config.js.map +1 -1
  4. package/dist/control/gates.js +4 -4
  5. package/dist/control/gates.js.map +1 -1
  6. package/dist/delivery/artefacts.d.ts.map +1 -1
  7. package/dist/delivery/artefacts.js +4 -3
  8. package/dist/delivery/artefacts.js.map +1 -1
  9. package/dist/delivery/dry-run.d.ts.map +1 -1
  10. package/dist/delivery/dry-run.js +14 -17
  11. package/dist/delivery/dry-run.js.map +1 -1
  12. package/dist/delivery/plans.d.ts.map +1 -1
  13. package/dist/delivery/plans.js +19 -7
  14. package/dist/delivery/plans.js.map +1 -1
  15. package/dist/governance/agents.d.ts +4 -0
  16. package/dist/governance/agents.d.ts.map +1 -1
  17. package/dist/governance/agents.js +86 -1
  18. package/dist/governance/agents.js.map +1 -1
  19. package/dist/governance/index.d.ts +2 -0
  20. package/dist/governance/index.d.ts.map +1 -1
  21. package/dist/governance/index.js +2 -0
  22. package/dist/governance/index.js.map +1 -1
  23. package/dist/governance/lifecycle.js +5 -5
  24. package/dist/governance/lifecycle.js.map +1 -1
  25. package/dist/governance/proposal.machine.d.ts +131 -0
  26. package/dist/governance/proposal.machine.d.ts.map +1 -0
  27. package/dist/governance/proposal.machine.js +378 -0
  28. package/dist/governance/proposal.machine.js.map +1 -0
  29. package/dist/governance/proposal.utils.d.ts +166 -0
  30. package/dist/governance/proposal.utils.d.ts.map +1 -0
  31. package/dist/governance/proposal.utils.js +126 -0
  32. package/dist/governance/proposal.utils.js.map +1 -0
  33. package/dist/host-tools/github-config.d.ts +7 -0
  34. package/dist/host-tools/github-config.d.ts.map +1 -0
  35. package/dist/host-tools/github-config.js +33 -0
  36. package/dist/host-tools/github-config.js.map +1 -0
  37. package/dist/host-tools/handlers.d.ts +87 -0
  38. package/dist/host-tools/handlers.d.ts.map +1 -0
  39. package/dist/host-tools/handlers.js +548 -0
  40. package/dist/host-tools/handlers.js.map +1 -0
  41. package/dist/host-tools/index.d.ts +5 -0
  42. package/dist/host-tools/index.d.ts.map +1 -0
  43. package/dist/host-tools/index.js +5 -0
  44. package/dist/host-tools/index.js.map +1 -0
  45. package/dist/host-tools/messages.d.ts +6 -0
  46. package/dist/host-tools/messages.d.ts.map +1 -0
  47. package/dist/host-tools/messages.js +37 -0
  48. package/dist/host-tools/messages.js.map +1 -0
  49. package/dist/host-tools/utils.d.ts +3 -0
  50. package/dist/host-tools/utils.d.ts.map +1 -0
  51. package/dist/host-tools/utils.js +29 -0
  52. package/dist/host-tools/utils.js.map +1 -0
  53. package/dist/index.d.ts +2 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +3 -0
  56. package/dist/index.js.map +1 -1
  57. package/dist/integrations/bitbucket.d.ts.map +1 -1
  58. package/dist/integrations/bitbucket.js +9 -2
  59. package/dist/integrations/bitbucket.js.map +1 -1
  60. package/dist/integrations/github.d.ts.map +1 -1
  61. package/dist/integrations/github.js +9 -2
  62. package/dist/integrations/github.js.map +1 -1
  63. package/dist/integrations/gitlab.d.ts.map +1 -1
  64. package/dist/integrations/gitlab.js +9 -2
  65. package/dist/integrations/gitlab.js.map +1 -1
  66. package/dist/intelligence/index.d.ts +1 -0
  67. package/dist/intelligence/index.d.ts.map +1 -1
  68. package/dist/intelligence/index.js +1 -0
  69. package/dist/intelligence/index.js.map +1 -1
  70. package/dist/intelligence/model.d.ts +17 -0
  71. package/dist/intelligence/model.d.ts.map +1 -0
  72. package/dist/intelligence/model.js +41 -0
  73. package/dist/intelligence/model.js.map +1 -0
  74. package/dist/intelligence/roundtable.d.ts +2 -1
  75. package/dist/intelligence/roundtable.d.ts.map +1 -1
  76. package/dist/intelligence/roundtable.js +5 -3
  77. package/dist/intelligence/roundtable.js.map +1 -1
  78. package/dist/intelligence/swarm.d.ts +9 -3
  79. package/dist/intelligence/swarm.d.ts.map +1 -1
  80. package/dist/intelligence/swarm.js +24 -12
  81. package/dist/intelligence/swarm.js.map +1 -1
  82. package/dist/observability/index.d.ts +1 -0
  83. package/dist/observability/index.d.ts.map +1 -1
  84. package/dist/observability/index.js +1 -0
  85. package/dist/observability/index.js.map +1 -1
  86. package/dist/observability/logging.d.ts +14 -0
  87. package/dist/observability/logging.d.ts.map +1 -0
  88. package/dist/observability/logging.js +38 -0
  89. package/dist/observability/logging.js.map +1 -0
  90. package/dist/persistence.d.ts.map +1 -1
  91. package/dist/persistence.js +70 -40
  92. package/dist/persistence.js.map +1 -1
  93. package/dist/types/index.d.ts +11 -1
  94. package/dist/types/index.d.ts.map +1 -1
  95. package/dist/types/index.js +24 -22
  96. package/dist/types/index.js.map +1 -1
  97. package/dist/utils/host.js +2 -2
  98. package/dist/utils/host.js.map +1 -1
  99. package/dist/utils/security.d.ts +7 -0
  100. package/dist/utils/security.d.ts.map +1 -0
  101. package/dist/utils/security.js +32 -0
  102. package/dist/utils/security.js.map +1 -0
  103. package/package.json +8 -3
@@ -0,0 +1,166 @@
1
+ import type { PipelineStage, Proposal } from "../types/index.js";
2
+ import { type ProposalContext, type ProposalEvent, type ProposalMachineInput } from "./proposal.machine.js";
3
+ /**
4
+ * Creates an XState actor for a proposal
5
+ */
6
+ export declare function createProposalActor(proposal: Proposal, initialStage?: PipelineStage): import("xstate").Actor<import("xstate").StateMachine<ProposalContext, {
7
+ type: "SUBMIT";
8
+ } | {
9
+ type: "QUALIFY";
10
+ } | {
11
+ type: "ANALYZE";
12
+ } | {
13
+ type: "CRITIQUE";
14
+ } | {
15
+ type: "SCORE";
16
+ } | {
17
+ type: "SEND_TO_COUNCIL";
18
+ } | {
19
+ type: "VOTE";
20
+ } | {
21
+ type: "APPROVE";
22
+ } | {
23
+ type: "REJECT";
24
+ } | {
25
+ type: "REQUEST_SPEC";
26
+ } | {
27
+ type: "REVIEW_SPEC";
28
+ } | {
29
+ type: "APPROVE_SPEC";
30
+ } | {
31
+ type: "EXECUTION_GATE_PASS";
32
+ } | {
33
+ type: "EXECUTION_GATE_FAIL";
34
+ } | {
35
+ type: "EXECUTE";
36
+ } | {
37
+ type: "EXECUTION_SUCCESS";
38
+ } | {
39
+ type: "EXECUTION_FAILED";
40
+ } | {
41
+ type: "POSTMORTEM";
42
+ } | {
43
+ type: "RETRY";
44
+ } | {
45
+ type: "DISCARD";
46
+ } | {
47
+ type: "ERROR";
48
+ message: string;
49
+ }, {}, never, never, never, never, "intake" | "qualification" | "analysis" | "critique" | "scoring" | "council" | "postmortem" | "rejected" | "draft" | "voting" | "specDraft" | "specReview" | "executionGate" | "executing" | "executionError" | "completed", string, ProposalMachineInput, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
50
+ id: "proposalLifecycle";
51
+ states: {
52
+ readonly draft: {};
53
+ readonly intake: {};
54
+ readonly qualification: {};
55
+ readonly analysis: {};
56
+ readonly critique: {};
57
+ readonly scoring: {};
58
+ readonly council: {};
59
+ readonly voting: {};
60
+ readonly specDraft: {};
61
+ readonly specReview: {};
62
+ readonly executionGate: {};
63
+ readonly executing: {};
64
+ readonly executionError: {};
65
+ readonly postmortem: {};
66
+ readonly rejected: {};
67
+ readonly completed: {};
68
+ };
69
+ }>>;
70
+ /**
71
+ * Moves a proposal through its states sequentially
72
+ */
73
+ export declare function sendProposalEvent(actor: ReturnType<typeof createProposalActor>, event: ProposalEvent): import("xstate").MachineSnapshot<ProposalContext, {
74
+ type: "SUBMIT";
75
+ } | {
76
+ type: "QUALIFY";
77
+ } | {
78
+ type: "ANALYZE";
79
+ } | {
80
+ type: "CRITIQUE";
81
+ } | {
82
+ type: "SCORE";
83
+ } | {
84
+ type: "SEND_TO_COUNCIL";
85
+ } | {
86
+ type: "VOTE";
87
+ } | {
88
+ type: "APPROVE";
89
+ } | {
90
+ type: "REJECT";
91
+ } | {
92
+ type: "REQUEST_SPEC";
93
+ } | {
94
+ type: "REVIEW_SPEC";
95
+ } | {
96
+ type: "APPROVE_SPEC";
97
+ } | {
98
+ type: "EXECUTION_GATE_PASS";
99
+ } | {
100
+ type: "EXECUTION_GATE_FAIL";
101
+ } | {
102
+ type: "EXECUTE";
103
+ } | {
104
+ type: "EXECUTION_SUCCESS";
105
+ } | {
106
+ type: "EXECUTION_FAILED";
107
+ } | {
108
+ type: "POSTMORTEM";
109
+ } | {
110
+ type: "RETRY";
111
+ } | {
112
+ type: "DISCARD";
113
+ } | {
114
+ type: "ERROR";
115
+ message: string;
116
+ }, {}, "intake" | "qualification" | "analysis" | "critique" | "scoring" | "council" | "postmortem" | "rejected" | "draft" | "voting" | "specDraft" | "specReview" | "executionGate" | "executing" | "executionError" | "completed", string, import("xstate").NonReducibleUnknown, import("xstate").MetaObject, {
117
+ id: "proposalLifecycle";
118
+ states: {
119
+ readonly draft: {};
120
+ readonly intake: {};
121
+ readonly qualification: {};
122
+ readonly analysis: {};
123
+ readonly critique: {};
124
+ readonly scoring: {};
125
+ readonly council: {};
126
+ readonly voting: {};
127
+ readonly specDraft: {};
128
+ readonly specReview: {};
129
+ readonly executionGate: {};
130
+ readonly executing: {};
131
+ readonly executionError: {};
132
+ readonly postmortem: {};
133
+ readonly rejected: {};
134
+ readonly completed: {};
135
+ };
136
+ }>;
137
+ /**
138
+ * Returns the machine's current context
139
+ */
140
+ export declare function getProposalContext(actor: ReturnType<typeof createProposalActor>): ProposalContext;
141
+ /**
142
+ * Returns the machine's current state
143
+ */
144
+ export declare function getProposalState(actor: ReturnType<typeof createProposalActor>): "intake" | "qualification" | "analysis" | "critique" | "scoring" | "council" | "postmortem" | "rejected" | "draft" | "voting" | "specDraft" | "specReview" | "executionGate" | "executing" | "executionError" | "completed";
145
+ /**
146
+ * Checks whether the proposal can take a given transition
147
+ */
148
+ export declare function canSendProposalEvent(actor: ReturnType<typeof createProposalActor>, eventType: string): boolean;
149
+ /**
150
+ * Returns all possible transitions from the current state
151
+ */
152
+ export declare function getAvailableProposalEvents(actor: ReturnType<typeof createProposalActor>): string[];
153
+ /**
154
+ * Helper for auto-progressing a proposal through the pipeline
155
+ * Uses linear progression events
156
+ */
157
+ export declare function progressProposal(actor: ReturnType<typeof createProposalActor>): string | null;
158
+ /**
159
+ * Creates a helper to trigger rejection events easily
160
+ */
161
+ export declare function rejectProposal(actor: ReturnType<typeof createProposalActor>): "intake" | "qualification" | "analysis" | "critique" | "scoring" | "council" | "postmortem" | "rejected" | "draft" | "voting" | "specDraft" | "specReview" | "executionGate" | "executing" | "executionError" | "completed";
162
+ /**
163
+ * Listener for observing state changes
164
+ */
165
+ export declare function onProposalStateChange(actor: ReturnType<typeof createProposalActor>, callback: (state: string, context: ProposalContext) => void): () => void;
166
+ //# sourceMappingURL=proposal.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposal.utils.d.ts","sourceRoot":"","sources":["../../src/governance/proposal.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAE1B,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAenF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,EAAE,KAAK,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGpG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,mBAE/E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,+NAE7E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAW9G;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,GAAG,MAAM,EAAE,CAyBlG;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,GAAG,MAAM,GAAG,IAAI,CAwB7F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,+NAG3E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,EAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,KAAK,IAAI,cAM5D"}
@@ -0,0 +1,126 @@
1
+ import { createActor } from "xstate";
2
+ import { proposalMachine, } from "./proposal.machine.js";
3
+ /**
4
+ * Creates an XState actor for a proposal
5
+ */
6
+ export function createProposalActor(proposal, initialStage) {
7
+ const initialContext = {
8
+ proposal,
9
+ deliberationCount: 0,
10
+ retryCount: 0,
11
+ lastTransitionTime: new Date().toISOString(),
12
+ stage: initialStage ?? "intake",
13
+ status: proposal.status,
14
+ };
15
+ const actor = createActor(proposalMachine, {
16
+ input: initialContext,
17
+ });
18
+ actor.start();
19
+ return actor;
20
+ }
21
+ /**
22
+ * Moves a proposal through its states sequentially
23
+ */
24
+ export function sendProposalEvent(actor, event) {
25
+ actor.send(event);
26
+ return actor.getSnapshot();
27
+ }
28
+ /**
29
+ * Returns the machine's current context
30
+ */
31
+ export function getProposalContext(actor) {
32
+ return actor.getSnapshot().context;
33
+ }
34
+ /**
35
+ * Returns the machine's current state
36
+ */
37
+ export function getProposalState(actor) {
38
+ return actor.getSnapshot().value;
39
+ }
40
+ /**
41
+ * Checks whether the proposal can take a given transition
42
+ */
43
+ export function canSendProposalEvent(actor, eventType) {
44
+ try {
45
+ if (eventType === "ERROR") {
46
+ return false;
47
+ }
48
+ const state = actor.getSnapshot();
49
+ return state.can({ type: eventType });
50
+ }
51
+ catch {
52
+ return false;
53
+ }
54
+ }
55
+ /**
56
+ * Returns all possible transitions from the current state
57
+ */
58
+ export function getAvailableProposalEvents(actor) {
59
+ const eventTypes = [
60
+ "SUBMIT",
61
+ "QUALIFY",
62
+ "ANALYZE",
63
+ "CRITIQUE",
64
+ "SCORE",
65
+ "SEND_TO_COUNCIL",
66
+ "VOTE",
67
+ "APPROVE",
68
+ "REJECT",
69
+ "REQUEST_SPEC",
70
+ "REVIEW_SPEC",
71
+ "APPROVE_SPEC",
72
+ "EXECUTION_GATE_PASS",
73
+ "EXECUTION_GATE_FAIL",
74
+ "EXECUTE",
75
+ "EXECUTION_SUCCESS",
76
+ "EXECUTION_FAILED",
77
+ "POSTMORTEM",
78
+ "RETRY",
79
+ "DISCARD",
80
+ ];
81
+ return eventTypes.filter((eventType) => canSendProposalEvent(actor, eventType));
82
+ }
83
+ /**
84
+ * Helper for auto-progressing a proposal through the pipeline
85
+ * Uses linear progression events
86
+ */
87
+ export function progressProposal(actor) {
88
+ const current = actor.getSnapshot().value;
89
+ const progressMap = {
90
+ draft: "SUBMIT",
91
+ intake: "QUALIFY",
92
+ qualification: "ANALYZE",
93
+ analysis: "CRITIQUE",
94
+ critique: "SCORE",
95
+ scoring: "SEND_TO_COUNCIL",
96
+ council: "VOTE",
97
+ voting: "APPROVE",
98
+ specDraft: "REQUEST_SPEC",
99
+ specReview: "APPROVE_SPEC",
100
+ executionGate: "EXECUTION_GATE_PASS",
101
+ };
102
+ const nextEventType = progressMap[String(current)];
103
+ if (nextEventType && canSendProposalEvent(actor, nextEventType)) {
104
+ const event = { type: nextEventType };
105
+ sendProposalEvent(actor, event);
106
+ return nextEventType;
107
+ }
108
+ return null;
109
+ }
110
+ /**
111
+ * Creates a helper to trigger rejection events easily
112
+ */
113
+ export function rejectProposal(actor) {
114
+ sendProposalEvent(actor, { type: "REJECT" });
115
+ return getProposalState(actor);
116
+ }
117
+ /**
118
+ * Listener for observing state changes
119
+ */
120
+ export function onProposalStateChange(actor, callback) {
121
+ const subscription = actor.subscribe((snapshot) => {
122
+ callback(String(snapshot.value), snapshot.context);
123
+ });
124
+ return () => subscription.unsubscribe();
125
+ }
126
+ //# sourceMappingURL=proposal.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposal.utils.js","sourceRoot":"","sources":["../../src/governance/proposal.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAIL,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAkB,EAAE,YAA4B;IAClF,MAAM,cAAc,GAAyB;QAC3C,QAAQ;QACR,iBAAiB,EAAE,CAAC;QACpB,UAAU,EAAE,CAAC;QACb,kBAAkB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC5C,KAAK,EAAE,YAAY,IAAI,QAAQ;QAC/B,MAAM,EAAE,QAAQ,CAAC,MAAM;KACxB,CAAC;IAEF,MAAM,KAAK,GAAG,WAAW,CAAC,eAAe,EAAE;QACzC,KAAK,EAAE,cAAc;KACtB,CAAC,CAAC;IACH,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6C,EAAE,KAAoB;IACnG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClB,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,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SAAS;QACxB,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,OAAO;QACjB,OAAO,EAAE,iBAAiB;QAC1B,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,cAAc;QACzB,UAAU,EAAE,cAAc;QAC1B,aAAa,EAAE,qBAAqB;KACrC,CAAC;IAEF,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,IAAI,aAAa,IAAI,oBAAoB,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC;QAChE,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,aAAa,EAAmB,CAAC;QACvD,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAChC,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAA6C;IAC1E,iBAAiB,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7C,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAA6C,EAC7C,QAA2D;IAE3D,MAAM,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChD,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function loadGitHubConfigFromDaoRoot(daoRoot: string): Promise<boolean>;
2
+ export declare function saveGitHubConfigToDaoRoot(daoRoot: string, githubConfig: {
3
+ token: string;
4
+ owner: string;
5
+ repo: string;
6
+ }): Promise<void>;
7
+ //# sourceMappingURL=github-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-config.d.ts","sourceRoot":"","sources":["../../src/host-tools/github-config.ts"],"names":[],"mappings":"AAIA,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAenF;AAED,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,MAAM,EACf,YAAY,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC3D,OAAO,CAAC,IAAI,CAAC,CAYf"}
@@ -0,0 +1,33 @@
1
+ import { promises as fs } from "node:fs";
2
+ import path from "node:path";
3
+ import { configureGitHub, isGitHubEnabled } from "../integrations/github.js";
4
+ export async function loadGitHubConfigFromDaoRoot(daoRoot) {
5
+ const configPath = path.join(daoRoot, "config.json");
6
+ try {
7
+ const configData = JSON.parse(await fs.readFile(configPath, "utf-8"));
8
+ const github = configData.github;
9
+ if (github?.owner && github?.repo) {
10
+ configureGitHub({ ...github, enabled: github.enabled ?? true });
11
+ return isGitHubEnabled();
12
+ }
13
+ }
14
+ catch {
15
+ // no config file
16
+ }
17
+ return false;
18
+ }
19
+ export async function saveGitHubConfigToDaoRoot(daoRoot, githubConfig) {
20
+ await fs.mkdir(daoRoot, { recursive: true });
21
+ const configPath = path.join(daoRoot, "config.json");
22
+ let configData = {};
23
+ try {
24
+ configData = JSON.parse(await fs.readFile(configPath, "utf-8"));
25
+ }
26
+ catch {
27
+ // no existing config
28
+ }
29
+ configData.github = { ...githubConfig, enabled: true, token: "[REDACTED]" };
30
+ await fs.writeFile(configPath, JSON.stringify(configData, null, 2), "utf-8");
31
+ configureGitHub({ ...githubConfig, enabled: true });
32
+ }
33
+ //# sourceMappingURL=github-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-config.js","sourceRoot":"","sources":["../../src/host-tools/github-config.ts"],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vB,CAAC;IACD,UAAU,CAAC,MAAM,GAAG,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;IAC5E,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC7E,eAAe,CAAC,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,87 @@
1
+ import type { AmendmentPayload, HostAdapter, ProposalType } from "../types/index.js";
2
+ import { PROPOSAL_TYPES } from "../types/index.js";
3
+ import { DAO_ONBOARDING_MESSAGE } from "./messages.js";
4
+ export type DeliberationMode = "auto" | "manual";
5
+ export type ControlToolName = "dao_check" | "dao_control";
6
+ export interface DaoToolContext {
7
+ adapter: HostAdapter;
8
+ workDir: string;
9
+ deliberationMode: DeliberationMode;
10
+ controlToolName: ControlToolName;
11
+ /** Pi transitions to fail on gate failure; OpenCode/MCP do not */
12
+ failOnGateFailure?: boolean;
13
+ getSessionModel?: () => string | undefined;
14
+ hostDefaultModel?: string | undefined;
15
+ onDeliberationProgress?: (update: {
16
+ agentName: string;
17
+ phase: string;
18
+ }) => void;
19
+ }
20
+ export interface RecordOutputInput {
21
+ agentId: string;
22
+ content: string;
23
+ durationMs?: number;
24
+ error?: string;
25
+ }
26
+ export declare function handleDaoSetup(ctx: DaoToolContext, useDefaults?: boolean): Promise<string>;
27
+ export interface DaoProposeArgs {
28
+ title: string;
29
+ type: ProposalType;
30
+ description: string;
31
+ context?: string;
32
+ problemStatement?: string;
33
+ acceptanceCriteria?: string[];
34
+ successMetrics?: string[];
35
+ rollbackConditions?: string[];
36
+ affectedPaths?: string[];
37
+ }
38
+ export declare function handleDaoPropose(args: DaoProposeArgs): Promise<string>;
39
+ export declare function handleDaoDeliberate(ctx: DaoToolContext, proposalId: number): Promise<string>;
40
+ export declare function handleDaoRecordOutputs(ctx: DaoToolContext, proposalId: number, outputs: RecordOutputInput[]): Promise<string>;
41
+ export declare function handleDaoControl(ctx: DaoToolContext, proposalId: number): Promise<string>;
42
+ export declare function handleDaoExecute(proposalId: number): Promise<string>;
43
+ export declare function handleDaoShip(ctx: DaoToolContext, proposalId: number, options?: {
44
+ cascade?: boolean;
45
+ force?: boolean;
46
+ }): Promise<string>;
47
+ export declare function handleDaoList(): Promise<string>;
48
+ export declare function handleDaoAgents(): Promise<string>;
49
+ export declare function handleDaoPlan(proposalId: number, controlToolName: ControlToolName): Promise<string>;
50
+ export declare function handleDaoArtefacts(proposalId: number): Promise<string>;
51
+ export declare function handleDaoDryRun(proposalId: number): Promise<string>;
52
+ export declare function handleDaoRollback(proposalId: number): Promise<string>;
53
+ export declare function handleDaoDashboard(): Promise<string>;
54
+ export declare function handleDaoRoundtable(ctx: DaoToolContext): Promise<string>;
55
+ export declare function handleDaoAudit(proposalId?: number): Promise<string>;
56
+ export declare function handleDaoRate(proposalId: number, score: 1 | 2 | 3 | 4 | 5, comment: string): Promise<string>;
57
+ export declare function handleDaoUpdateProposal(proposalId: number, fields: {
58
+ problemStatement?: string;
59
+ acceptanceCriteria?: string[];
60
+ successMetrics?: string[];
61
+ rollbackConditions?: string[];
62
+ }): Promise<string>;
63
+ export interface DaoAmendmentArgs {
64
+ title: string;
65
+ description: string;
66
+ amendmentType: AmendmentPayload["type"] extends infer T ? T : never;
67
+ agentId?: string;
68
+ agentChanges?: string;
69
+ newAgentId?: string;
70
+ newAgentName?: string;
71
+ newAgentRole?: string;
72
+ newAgentWeight?: number;
73
+ configChanges?: string;
74
+ quorumChanges?: string;
75
+ addGates?: string[];
76
+ removeGates?: string[];
77
+ }
78
+ export declare function handleDaoProposeAmendment(args: DaoAmendmentArgs): Promise<string>;
79
+ export declare function handleDaoConfigGithub(_ctx: DaoToolContext, args: {
80
+ token: string;
81
+ owner: string;
82
+ repo: string;
83
+ }): Promise<string>;
84
+ export declare function handleDaoGithubCreateBranch(_ctx: DaoToolContext, proposalId: number): Promise<string>;
85
+ export declare function handleDaoGithubOpenPr(_ctx: DaoToolContext, proposalId: number, headBranch: string): Promise<string>;
86
+ export { DAO_ONBOARDING_MESSAGE, PROPOSAL_TYPES };
87
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/host-tools/handlers.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAe,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,EAAwB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGvD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,CAAC;AACjD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,aAAa,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,eAAe,EAAE,eAAe,CAAC;IACjC,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAC3C,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,sBAAsB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACjF;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD,wBAAsB,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