@agentchatme/agent-core 0.6.0 → 0.7.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.
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  AGENT_LOCK_DIR_ENV,
3
+ COULD_NOT_PROCESS_FILE,
3
4
  DAEMON_LOCK_FILE,
4
5
  DEFAULT_API_BASE,
5
6
  FAILED_CYCLE_OUTCOMES,
@@ -15,6 +16,7 @@ import {
15
16
  MANUAL_MAX_REDIRECTS,
16
17
  MANUAL_SKILL_NAME,
17
18
  MANUAL_URL,
19
+ PausedConversations,
18
20
  REPEATED_FAILED_CYCLES,
19
21
  SOCKET_STATES,
20
22
  STANDBY_MARKER_FRESH_MS,
@@ -39,8 +41,11 @@ import {
39
41
  clearIntegrationStatus,
40
42
  clearPending,
41
43
  clearStandby,
44
+ couldNotProcessPath,
42
45
  credentialsPath,
46
+ describeCouldNotProcessCounts,
43
47
  describeManualSync,
48
+ describePausedConversations,
44
49
  envApiKey,
45
50
  envKeyConflict,
46
51
  external_exports,
@@ -74,8 +79,10 @@ import {
74
79
  readIntegrationStatus,
75
80
  readManualVersion,
76
81
  readPending,
82
+ repeatedFailedRuns,
77
83
  resetLeaseObservations,
78
84
  resolveIdentity,
85
+ runtimeCheckFailingNow,
79
86
  standbyMarkerPath,
80
87
  standbyWaiting,
81
88
  statePath,
@@ -84,7 +91,7 @@ import {
84
91
  writeCredentials,
85
92
  writeIntegrationStatus,
86
93
  writePending
87
- } from "./chunk-EDB33Z22.js";
94
+ } from "./chunk-NYSMAN4N.js";
88
95
  import {
89
96
  HOSTED_MCP_PATH,
90
97
  PROBE_KILL_WAIT_MS,
@@ -92,7 +99,7 @@ import {
92
99
  hostedMcpUrl,
93
100
  probeHostedMcp,
94
101
  runProbe
95
- } from "./chunk-QUANHUVW.js";
102
+ } from "./chunk-PTKQIKCI.js";
96
103
  import {
97
104
  DEFAULT_RUN_BUDGET_MS,
98
105
  DEFAULT_RUN_PROFILE,
@@ -123,7 +130,7 @@ import {
123
130
  spawnCommand,
124
131
  spawnCommandSync,
125
132
  workdirExposesHome
126
- } from "./chunk-AVLI55C5.js";
133
+ } from "./chunk-C2ARQLZ7.js";
127
134
 
128
135
  // src/integration/tray.ts
129
136
  import { INBOX_TRAY_MAX_LIMIT } from "agentchatme";
@@ -364,6 +371,26 @@ function renderDeclinedBlock(copy) {
364
371
  ].join("\n");
365
372
  }
366
373
 
374
+ // src/integration/run-context.ts
375
+ var RUN_CONTEXT_ENV = {
376
+ wakeKind: "AGENTCHAT_WAKE_KIND",
377
+ runId: "AGENTCHAT_RUN_ID",
378
+ conversationId: "AGENTCHAT_CONVERSATION_ID"
379
+ };
380
+ function without(env, name) {
381
+ for (const key of Object.keys(env)) if (key.toUpperCase() === name) delete env[key];
382
+ }
383
+ function runContextEnv(env, request) {
384
+ const out = { ...env };
385
+ for (const name of Object.values(RUN_CONTEXT_ENV)) without(out, name);
386
+ out[RUN_CONTEXT_ENV.wakeKind] = request.kind;
387
+ out[RUN_CONTEXT_ENV.runId] = request.runId;
388
+ if (request.kind === "conversation" && request.conversationId !== void 0 && request.conversationId.length > 0) {
389
+ out[RUN_CONTEXT_ENV.conversationId] = request.conversationId;
390
+ }
391
+ return out;
392
+ }
393
+
367
394
  // src/identity/commands.ts
368
395
  import * as readline from "readline";
369
396
  import { AgentChatClient, integration as kit2 } from "agentchatme";
@@ -1089,6 +1116,32 @@ The key was not saved.`);
1089
1116
  } : { name: "wake-cycles", verdict: "PASS", detail: `last cycle ${last.outcome} at ${last.at} (${cycles.length} recent)` }
1090
1117
  );
1091
1118
  }
1119
+ const failedRuns = repeatedFailedRuns(integration);
1120
+ if (failedRuns !== null) {
1121
+ const lastRun = integration?.last_run ?? null;
1122
+ checks.push({
1123
+ name: "runs",
1124
+ verdict: "WARN",
1125
+ detail: `the last ${failedRuns} runs did not get done${lastRun !== null ? ` (latest: ${lastRun.state}${lastRun.detail ? ` \u2014 ${lastRun.detail}` : ""})` : ""}; the cards stay on the tray`
1126
+ });
1127
+ }
1128
+ const cnp = integration?.could_not_process ?? null;
1129
+ if (cnp !== null) {
1130
+ const paused = describePausedConversations(cnp.paused_conversations);
1131
+ const lastCheck = cnp.last_runtime_check;
1132
+ const counts = describeCouldNotProcessCounts(cnp);
1133
+ if (paused !== null) {
1134
+ checks.push({ name: "could-not-process", verdict: "WARN", detail: paused.replace(/^could not process: /, "") });
1135
+ } else if (lastCheck !== null && runtimeCheckFailingNow(integration)) {
1136
+ checks.push({
1137
+ name: "could-not-process",
1138
+ verdict: "WARN",
1139
+ detail: `the runtime check failed (${lastCheck.detail ?? "no detail"}; ${lastCheck.at}): while it fails, a conversation whose run fails is not reported, its card stays on the tray and the server wakes the agent again`
1140
+ });
1141
+ } else if (counts !== null) {
1142
+ checks.push({ name: "could-not-process", verdict: "PASS", detail: counts.replace(/^could not process: /, "") });
1143
+ }
1144
+ }
1092
1145
  if (profile.extraDoctorChecks !== void 0) {
1093
1146
  try {
1094
1147
  checks.push(...await profile.extraDoctorChecks({ ...opts, ...texts }));
@@ -1764,6 +1817,7 @@ export {
1764
1817
  AGENT_LOCK_DIR_ENV,
1765
1818
  ANCHOR_END,
1766
1819
  ANCHOR_START,
1820
+ COULD_NOT_PROCESS_FILE,
1767
1821
  DAEMON_LOCK_FILE,
1768
1822
  DEFAULT_API_BASE,
1769
1823
  DEFAULT_RUN_BUDGET_MS,
@@ -1789,8 +1843,10 @@ export {
1789
1843
  OWN_RUN_WARNING,
1790
1844
  PEER_RUN_WARNING,
1791
1845
  PROBE_KILL_WAIT_MS,
1846
+ PausedConversations,
1792
1847
  REPEATED_FAILED_CYCLES,
1793
1848
  RUN_BUDGET_ENV,
1849
+ RUN_CONTEXT_ENV,
1794
1850
  RUN_PROFILES,
1795
1851
  RUN_PROFILE_ENV,
1796
1852
  SOCKET_STATES,
@@ -1825,9 +1881,12 @@ export {
1825
1881
  clientHeadersOf,
1826
1882
  clientIdentityOf,
1827
1883
  clientNameOf,
1884
+ couldNotProcessPath,
1828
1885
  createIdentityCommands,
1829
1886
  credentialsPath,
1887
+ describeCouldNotProcessCounts,
1830
1888
  describeManualSync,
1889
+ describePausedConversations,
1831
1890
  describeRunProfile,
1832
1891
  envApiKey,
1833
1892
  envKeyConflict,
@@ -1883,12 +1942,15 @@ export {
1883
1942
  renderAnchorBlock,
1884
1943
  renderDeclinedBlock,
1885
1944
  renderUnregisteredBlock,
1945
+ repeatedFailedRuns,
1886
1946
  resetLeaseObservations,
1887
1947
  resolveIdentity,
1888
1948
  resolveRunBudgetMs,
1889
1949
  resolveRunProfile,
1950
+ runContextEnv,
1890
1951
  runProbe,
1891
1952
  runProfileWarning,
1953
+ runtimeCheckFailingNow,
1892
1954
  serviceDefinitionCurrent,
1893
1955
  serviceInstalled,
1894
1956
  serviceLabelFor,