@ascenda-one/agent-mcp 0.1.6 → 0.1.7

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 (2) hide show
  1. package/dist/cli.js +100 -11
  2. 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
- if (/\bgit\s+commit\b[^\n]*--amend\b/.test(value))
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 (/\bgit\s+revert\b/.test(value))
158
+ if (heads.some((h) => /^git\s+revert\b/.test(h)))
88
159
  return "revert";
89
- if (/\bgit\s+reset\b[^\n]*--hard\b/.test(value))
160
+ if (heads.some((h) => /^git\s+reset\b/.test(h) && /\s--hard\b/.test(h)))
90
161
  return "reset_hard";
91
- if (/\bgit\s+restore\b/.test(value) && !/--staged\b/.test(value))
162
+ if (heads.some((h) => /^git\s+restore\b/.test(h) && !/\s--staged\b/.test(h)))
92
163
  return "restore";
93
- if (/\bgit\s+checkout\b[^\n]*\s--\s/.test(value))
164
+ if (heads.some((h) => /^git\s+checkout\b.*\s--\s/.test(h)))
94
165
  return "restore";
95
- if (/\bgit\s+push\b/.test(value))
166
+ if (heads.some((h) => /^git\s+push\b/.test(h)))
96
167
  return "push";
97
- if (/\bgit\s+commit\b/.test(value))
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
- if (/\bgh\s+pr\s+merge\b/.test(value))
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 (/\bgh\s+issue\s+close\b/.test(value))
195
+ if (heads.some((head) => /^gh\s+issue\s+close\b/.test(head)))
123
196
  return "issue_closed";
124
- if (/\bgh\s+pr\s+create\b/.test(value))
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;
@@ -722,7 +808,7 @@ var require_out2 = __commonJS({
722
808
  "../packages/tool-kit/out/index.js"(exports) {
723
809
  "use strict";
724
810
  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;
811
+ 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.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
812
  var commandClassifier_1 = require_commandClassifier();
727
813
  Object.defineProperty(exports, "classifyCommand", { enumerable: true, get: function() {
728
814
  return commandClassifier_1.classifyCommand;
@@ -774,6 +860,9 @@ var require_out2 = __commonJS({
774
860
  Object.defineProperty(exports, "inferOutcome", { enumerable: true, get: function() {
775
861
  return payload_1.inferOutcome;
776
862
  } });
863
+ Object.defineProperty(exports, "outcomeForHook", { enumerable: true, get: function() {
864
+ return payload_1.outcomeForHook;
865
+ } });
777
866
  Object.defineProperty(exports, "looksLikeCorrection", { enumerable: true, get: function() {
778
867
  return payload_1.looksLikeCorrection;
779
868
  } });
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.6",
4
+ "version": "0.1.7",
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",