@ascenda-one/agent-mcp 0.1.6 → 0.1.8
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.
- package/dist/cli.js +239 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -69,6 +69,75 @@ var require_commandClassifier = __commonJS({
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
+
// ../packages/tool-kit/out/commandHeads.js
|
|
73
|
+
var require_commandHeads = __commonJS({
|
|
74
|
+
"../packages/tool-kit/out/commandHeads.js"(exports) {
|
|
75
|
+
"use strict";
|
|
76
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
|
+
exports.commandHeads = commandHeads;
|
|
78
|
+
function commandHeads(value) {
|
|
79
|
+
const stripped = stripQuoted(stripHeredocBodies(value));
|
|
80
|
+
return stripped.split(/[;&|()\n]+/).map((segment) => {
|
|
81
|
+
let head = segment.trim();
|
|
82
|
+
for (; ; ) {
|
|
83
|
+
const env = /^[a-z_][a-z0-9_]*=\S*\s+/.exec(head);
|
|
84
|
+
if (!env)
|
|
85
|
+
break;
|
|
86
|
+
head = head.slice(env[0].length);
|
|
87
|
+
}
|
|
88
|
+
return head;
|
|
89
|
+
}).filter((head) => head.length > 0);
|
|
90
|
+
}
|
|
91
|
+
function stripHeredocBodies(value) {
|
|
92
|
+
const marker = /<<-?\s*(["']?)(\w+)\1/;
|
|
93
|
+
let kept = "";
|
|
94
|
+
let rest = value;
|
|
95
|
+
for (; ; ) {
|
|
96
|
+
const opened = marker.exec(rest);
|
|
97
|
+
if (!opened)
|
|
98
|
+
return kept + rest;
|
|
99
|
+
const introLineEnd = rest.indexOf("\n", opened.index + opened[0].length);
|
|
100
|
+
if (introLineEnd === -1)
|
|
101
|
+
return kept + rest;
|
|
102
|
+
kept += rest.slice(0, introLineEnd + 1);
|
|
103
|
+
const body = rest.slice(introLineEnd + 1);
|
|
104
|
+
const terminator = new RegExp(`^\\s*${opened[2]}\\s*$`, "m").exec(body);
|
|
105
|
+
if (!terminator)
|
|
106
|
+
return kept;
|
|
107
|
+
rest = body.slice(terminator.index + terminator[0].length);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function stripQuoted(value) {
|
|
111
|
+
let out = "";
|
|
112
|
+
let i = 0;
|
|
113
|
+
while (i < value.length) {
|
|
114
|
+
const ch = value[i];
|
|
115
|
+
if (ch === "'") {
|
|
116
|
+
const close = value.indexOf("'", i + 1);
|
|
117
|
+
if (close === -1)
|
|
118
|
+
return out;
|
|
119
|
+
i = close + 1;
|
|
120
|
+
} else if (ch === '"') {
|
|
121
|
+
let j = i + 1;
|
|
122
|
+
while (j < value.length && value[j] !== '"') {
|
|
123
|
+
j += value[j] === "\\" ? 2 : 1;
|
|
124
|
+
}
|
|
125
|
+
if (j >= value.length)
|
|
126
|
+
return out;
|
|
127
|
+
i = j + 1;
|
|
128
|
+
} else if (ch === "\\") {
|
|
129
|
+
out += value.slice(i, i + 2);
|
|
130
|
+
i += 2;
|
|
131
|
+
} else {
|
|
132
|
+
out += ch;
|
|
133
|
+
i += 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
72
141
|
// ../packages/tool-kit/out/gitActionClassifier.js
|
|
73
142
|
var require_gitActionClassifier = __commonJS({
|
|
74
143
|
"../packages/tool-kit/out/gitActionClassifier.js"(exports) {
|
|
@@ -76,25 +145,27 @@ var require_gitActionClassifier = __commonJS({
|
|
|
76
145
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
146
|
exports.classifyGitAction = classifyGitAction;
|
|
78
147
|
exports.isReworkGitAction = isReworkGitAction;
|
|
148
|
+
var commandHeads_1 = require_commandHeads();
|
|
79
149
|
function classifyGitAction(command) {
|
|
80
150
|
if (!command)
|
|
81
151
|
return void 0;
|
|
82
152
|
const value = command.toLowerCase().trim();
|
|
83
153
|
if (!/\bgit\b/.test(value))
|
|
84
154
|
return void 0;
|
|
85
|
-
|
|
155
|
+
const heads = (0, commandHeads_1.commandHeads)(value);
|
|
156
|
+
if (heads.some((h) => /^git\s+commit\b/.test(h) && /\s--amend\b/.test(h)))
|
|
86
157
|
return "amend";
|
|
87
|
-
if (
|
|
158
|
+
if (heads.some((h) => /^git\s+revert\b/.test(h)))
|
|
88
159
|
return "revert";
|
|
89
|
-
if (
|
|
160
|
+
if (heads.some((h) => /^git\s+reset\b/.test(h) && /\s--hard\b/.test(h)))
|
|
90
161
|
return "reset_hard";
|
|
91
|
-
if (
|
|
162
|
+
if (heads.some((h) => /^git\s+restore\b/.test(h) && !/\s--staged\b/.test(h)))
|
|
92
163
|
return "restore";
|
|
93
|
-
if (
|
|
164
|
+
if (heads.some((h) => /^git\s+checkout\b.*\s--\s/.test(h)))
|
|
94
165
|
return "restore";
|
|
95
|
-
if (
|
|
166
|
+
if (heads.some((h) => /^git\s+push\b/.test(h)))
|
|
96
167
|
return "push";
|
|
97
|
-
if (
|
|
168
|
+
if (heads.some((h) => /^git\s+commit\b/.test(h)))
|
|
98
169
|
return "commit";
|
|
99
170
|
return void 0;
|
|
100
171
|
}
|
|
@@ -111,17 +182,19 @@ var require_workMilestoneClassifier = __commonJS({
|
|
|
111
182
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
112
183
|
exports.classifyWorkMilestone = classifyWorkMilestone;
|
|
113
184
|
exports.invitesDebrief = invitesDebrief;
|
|
185
|
+
var commandHeads_1 = require_commandHeads();
|
|
114
186
|
function classifyWorkMilestone(command) {
|
|
115
187
|
if (!command)
|
|
116
188
|
return void 0;
|
|
117
189
|
const value = command.toLowerCase().trim();
|
|
118
190
|
if (!/\bgh\b/.test(value))
|
|
119
191
|
return void 0;
|
|
120
|
-
|
|
192
|
+
const heads = (0, commandHeads_1.commandHeads)(value);
|
|
193
|
+
if (heads.some((head) => /^gh\s+pr\s+merge\b/.test(head)))
|
|
121
194
|
return "pr_merged";
|
|
122
|
-
if (
|
|
195
|
+
if (heads.some((head) => /^gh\s+issue\s+close\b/.test(head)))
|
|
123
196
|
return "issue_closed";
|
|
124
|
-
if (
|
|
197
|
+
if (heads.some((head) => /^gh\s+pr\s+create\b/.test(head)))
|
|
125
198
|
return "pr_opened";
|
|
126
199
|
return void 0;
|
|
127
200
|
}
|
|
@@ -208,6 +281,7 @@ var require_payload = __commonJS({
|
|
|
208
281
|
exports.getNestedString = getNestedString;
|
|
209
282
|
exports.getNestedNumber = getNestedNumber;
|
|
210
283
|
exports.inferOutcome = inferOutcome;
|
|
284
|
+
exports.outcomeForHook = outcomeForHook;
|
|
211
285
|
exports.looksLikeCorrection = looksLikeCorrection;
|
|
212
286
|
function getString(input, keys) {
|
|
213
287
|
for (const key of keys) {
|
|
@@ -259,6 +333,18 @@ var require_payload = __commonJS({
|
|
|
259
333
|
return "failure";
|
|
260
334
|
return "unknown";
|
|
261
335
|
}
|
|
336
|
+
function outcomeForHook(hookName, input) {
|
|
337
|
+
if (hookName === "PostToolUseFailure") {
|
|
338
|
+
const interrupted = input["is_interrupt"] === true || getNested(input, ["tool_response", "interrupted"]) === true;
|
|
339
|
+
return interrupted ? "cancelled" : "failure";
|
|
340
|
+
}
|
|
341
|
+
if (hookName === "PostToolUse") {
|
|
342
|
+
if (getNested(input, ["tool_response", "interrupted"]) === true)
|
|
343
|
+
return "cancelled";
|
|
344
|
+
return "success";
|
|
345
|
+
}
|
|
346
|
+
return "unknown";
|
|
347
|
+
}
|
|
262
348
|
function looksLikeCorrection(text) {
|
|
263
349
|
if (!text)
|
|
264
350
|
return false;
|
|
@@ -717,12 +803,138 @@ var require_salt = __commonJS({
|
|
|
717
803
|
}
|
|
718
804
|
});
|
|
719
805
|
|
|
806
|
+
// ../packages/tool-kit/out/liveBus.js
|
|
807
|
+
var require_liveBus = __commonJS({
|
|
808
|
+
"../packages/tool-kit/out/liveBus.js"(exports) {
|
|
809
|
+
"use strict";
|
|
810
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
811
|
+
if (k2 === void 0) k2 = k;
|
|
812
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
813
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
814
|
+
desc = { enumerable: true, get: function() {
|
|
815
|
+
return m[k];
|
|
816
|
+
} };
|
|
817
|
+
}
|
|
818
|
+
Object.defineProperty(o, k2, desc);
|
|
819
|
+
} : function(o, m, k, k2) {
|
|
820
|
+
if (k2 === void 0) k2 = k;
|
|
821
|
+
o[k2] = m[k];
|
|
822
|
+
});
|
|
823
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
824
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
825
|
+
} : function(o, v) {
|
|
826
|
+
o["default"] = v;
|
|
827
|
+
});
|
|
828
|
+
var __importStar = exports && exports.__importStar || /* @__PURE__ */ function() {
|
|
829
|
+
var ownKeys = function(o) {
|
|
830
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
831
|
+
var ar = [];
|
|
832
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
833
|
+
return ar;
|
|
834
|
+
};
|
|
835
|
+
return ownKeys(o);
|
|
836
|
+
};
|
|
837
|
+
return function(mod) {
|
|
838
|
+
if (mod && mod.__esModule) return mod;
|
|
839
|
+
var result = {};
|
|
840
|
+
if (mod != null) {
|
|
841
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
842
|
+
}
|
|
843
|
+
__setModuleDefault(result, mod);
|
|
844
|
+
return result;
|
|
845
|
+
};
|
|
846
|
+
}();
|
|
847
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
848
|
+
exports.liveBusSocketCandidates = liveBusSocketCandidates;
|
|
849
|
+
exports.liveBusSocketPath = liveBusSocketPath;
|
|
850
|
+
exports.bucketPromptSize = bucketPromptSize;
|
|
851
|
+
exports.emitLiveSignal = emitLiveSignal;
|
|
852
|
+
var fs = __importStar(__require("fs"));
|
|
853
|
+
var net = __importStar(__require("net"));
|
|
854
|
+
var os = __importStar(__require("os"));
|
|
855
|
+
var path = __importStar(__require("path"));
|
|
856
|
+
var WRITE_TIMEOUT_MS = 50;
|
|
857
|
+
var APP_BUNDLE_ID = "one.ascenda.ascendaMissionControl";
|
|
858
|
+
function liveBusSocketCandidates() {
|
|
859
|
+
const override = process.env.ASCENDA_LIVE_BUS_SOCKET;
|
|
860
|
+
if (override)
|
|
861
|
+
return [override];
|
|
862
|
+
const home = os.homedir();
|
|
863
|
+
return [
|
|
864
|
+
path.join(home, ".ascenda", "live.sock"),
|
|
865
|
+
path.join(home, "Library", "Containers", APP_BUNDLE_ID, "Data", ".ascenda", "live.sock")
|
|
866
|
+
];
|
|
867
|
+
}
|
|
868
|
+
function liveBusSocketPath() {
|
|
869
|
+
const candidates = liveBusSocketCandidates();
|
|
870
|
+
for (const candidate of candidates) {
|
|
871
|
+
try {
|
|
872
|
+
if (fs.statSync(candidate).isSocket())
|
|
873
|
+
return candidate;
|
|
874
|
+
} catch {
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
return candidates[0];
|
|
878
|
+
}
|
|
879
|
+
function bucketPromptSize(text) {
|
|
880
|
+
const length = typeof text === "string" ? text.length : 0;
|
|
881
|
+
if (length <= 280)
|
|
882
|
+
return "s";
|
|
883
|
+
if (length <= 2e3)
|
|
884
|
+
return "m";
|
|
885
|
+
if (length <= 8e3)
|
|
886
|
+
return "l";
|
|
887
|
+
return "xl";
|
|
888
|
+
}
|
|
889
|
+
function emitLiveSignal(signal) {
|
|
890
|
+
return new Promise((resolve) => {
|
|
891
|
+
let settled = false;
|
|
892
|
+
const done = () => {
|
|
893
|
+
if (settled)
|
|
894
|
+
return;
|
|
895
|
+
settled = true;
|
|
896
|
+
try {
|
|
897
|
+
socket.destroy();
|
|
898
|
+
} catch {
|
|
899
|
+
}
|
|
900
|
+
resolve();
|
|
901
|
+
};
|
|
902
|
+
let socket;
|
|
903
|
+
try {
|
|
904
|
+
socket = net.createConnection(liveBusSocketPath());
|
|
905
|
+
} catch {
|
|
906
|
+
resolve();
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
const timer = setTimeout(done, WRITE_TIMEOUT_MS);
|
|
910
|
+
if (typeof timer.unref === "function")
|
|
911
|
+
timer.unref();
|
|
912
|
+
if (typeof socket.unref === "function")
|
|
913
|
+
socket.unref();
|
|
914
|
+
socket.on("error", done);
|
|
915
|
+
socket.on("connect", () => {
|
|
916
|
+
try {
|
|
917
|
+
socket.write(`${JSON.stringify(signal)}
|
|
918
|
+
`, () => {
|
|
919
|
+
clearTimeout(timer);
|
|
920
|
+
done();
|
|
921
|
+
});
|
|
922
|
+
} catch {
|
|
923
|
+
clearTimeout(timer);
|
|
924
|
+
done();
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
|
|
720
932
|
// ../packages/tool-kit/out/index.js
|
|
721
933
|
var require_out2 = __commonJS({
|
|
722
934
|
"../packages/tool-kit/out/index.js"(exports) {
|
|
723
935
|
"use strict";
|
|
724
936
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
725
|
-
exports.parseIngestResponse = exports.postToolEventsBatch = exports.postToolEvent = exports.renewToolToken = exports.getPairingStatus = exports.createPairingSession = exports.AscendaApiError = exports.hashWithMachineSalt = exports.readOrCreateMachineSalt = exports.machineSaltFilePath = exports.readTokenFile = exports.persistEventWriteToken = exports.defaultTokenFilePath = exports.AscendaSemanticEventError = exports.AscendaEventSender = exports.looksLikeCorrection = exports.inferOutcome = exports.getNestedNumber = exports.getNestedString = exports.getNested = exports.getNumber = exports.getString = exports.isAfterHours = exports.bucketDurationMs = exports.bucketLinesChanged = exports.invitesDebrief = exports.classifyWorkMilestone = exports.isReworkGitAction = exports.classifyGitAction = exports.isVerificationCommand = exports.classifyCommand = void 0;
|
|
937
|
+
exports.parseIngestResponse = exports.postToolEventsBatch = exports.postToolEvent = exports.renewToolToken = exports.getPairingStatus = exports.createPairingSession = exports.AscendaApiError = exports.liveBusSocketCandidates = exports.liveBusSocketPath = exports.bucketPromptSize = exports.emitLiveSignal = exports.hashWithMachineSalt = exports.readOrCreateMachineSalt = exports.machineSaltFilePath = exports.readTokenFile = exports.persistEventWriteToken = exports.defaultTokenFilePath = exports.AscendaSemanticEventError = exports.AscendaEventSender = exports.looksLikeCorrection = exports.outcomeForHook = exports.inferOutcome = exports.getNestedNumber = exports.getNestedString = exports.getNested = exports.getNumber = exports.getString = exports.isAfterHours = exports.bucketDurationMs = exports.bucketLinesChanged = exports.invitesDebrief = exports.classifyWorkMilestone = exports.isReworkGitAction = exports.classifyGitAction = exports.isVerificationCommand = exports.classifyCommand = void 0;
|
|
726
938
|
var commandClassifier_1 = require_commandClassifier();
|
|
727
939
|
Object.defineProperty(exports, "classifyCommand", { enumerable: true, get: function() {
|
|
728
940
|
return commandClassifier_1.classifyCommand;
|
|
@@ -774,6 +986,9 @@ var require_out2 = __commonJS({
|
|
|
774
986
|
Object.defineProperty(exports, "inferOutcome", { enumerable: true, get: function() {
|
|
775
987
|
return payload_1.inferOutcome;
|
|
776
988
|
} });
|
|
989
|
+
Object.defineProperty(exports, "outcomeForHook", { enumerable: true, get: function() {
|
|
990
|
+
return payload_1.outcomeForHook;
|
|
991
|
+
} });
|
|
777
992
|
Object.defineProperty(exports, "looksLikeCorrection", { enumerable: true, get: function() {
|
|
778
993
|
return payload_1.looksLikeCorrection;
|
|
779
994
|
} });
|
|
@@ -804,6 +1019,19 @@ var require_out2 = __commonJS({
|
|
|
804
1019
|
Object.defineProperty(exports, "hashWithMachineSalt", { enumerable: true, get: function() {
|
|
805
1020
|
return salt_1.hashWithMachineSalt;
|
|
806
1021
|
} });
|
|
1022
|
+
var liveBus_1 = require_liveBus();
|
|
1023
|
+
Object.defineProperty(exports, "emitLiveSignal", { enumerable: true, get: function() {
|
|
1024
|
+
return liveBus_1.emitLiveSignal;
|
|
1025
|
+
} });
|
|
1026
|
+
Object.defineProperty(exports, "bucketPromptSize", { enumerable: true, get: function() {
|
|
1027
|
+
return liveBus_1.bucketPromptSize;
|
|
1028
|
+
} });
|
|
1029
|
+
Object.defineProperty(exports, "liveBusSocketPath", { enumerable: true, get: function() {
|
|
1030
|
+
return liveBus_1.liveBusSocketPath;
|
|
1031
|
+
} });
|
|
1032
|
+
Object.defineProperty(exports, "liveBusSocketCandidates", { enumerable: true, get: function() {
|
|
1033
|
+
return liveBus_1.liveBusSocketCandidates;
|
|
1034
|
+
} });
|
|
807
1035
|
var http_1 = require_http();
|
|
808
1036
|
Object.defineProperty(exports, "AscendaApiError", { enumerable: true, get: function() {
|
|
809
1037
|
return http_1.AscendaApiError;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"publishConfig": { "access": "public" },
|
|
3
3
|
"name": "@ascenda-one/agent-mcp",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.8",
|
|
5
5
|
"description": "MCP server exposing ascenda_emit_work_signal — the one submission interface for agent-observed (semantic) work-friction signals.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|