@agentchatme/agent-core 0.5.3 → 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-CQSL6X4D.js";
94
+ } from "./chunk-NYSMAN4N.js";
88
95
  import {
89
96
  HOSTED_MCP_PATH,
90
97
  PROBE_KILL_WAIT_MS,
@@ -92,13 +99,15 @@ import {
92
99
  hostedMcpUrl,
93
100
  probeHostedMcp,
94
101
  runProbe
95
- } from "./chunk-JL2L4WRG.js";
102
+ } from "./chunk-PTKQIKCI.js";
96
103
  import {
97
104
  DEFAULT_RUN_BUDGET_MS,
98
105
  DEFAULT_RUN_PROFILE,
106
+ FALLBACK_RUN_PROFILE,
99
107
  INTEGRATION_ENV,
100
108
  INTEGRATION_ENV_LEGACY,
101
109
  INTEGRATION_ENV_LEGACY_REMOVAL,
110
+ OWN_RUN_WARNING,
102
111
  PEER_RUN_WARNING,
103
112
  RUN_BUDGET_ENV,
104
113
  RUN_PROFILES,
@@ -108,10 +117,12 @@ import {
108
117
  clientHeadersOf,
109
118
  clientIdentityOf,
110
119
  clientNameOf,
120
+ describeRunProfile,
111
121
  integrationDisabled,
112
122
  integrationDisabledBy,
113
123
  isRunProfile,
114
124
  log,
125
+ ownProfileLine,
115
126
  readJsonFile,
116
127
  resolveRunBudgetMs,
117
128
  resolveRunProfile,
@@ -119,7 +130,7 @@ import {
119
130
  spawnCommand,
120
131
  spawnCommandSync,
121
132
  workdirExposesHome
122
- } from "./chunk-3OUDKIQV.js";
133
+ } from "./chunk-C2ARQLZ7.js";
123
134
 
124
135
  // src/integration/tray.ts
125
136
  import { INBOX_TRAY_MAX_LIMIT } from "agentchatme";
@@ -360,6 +371,26 @@ function renderDeclinedBlock(copy) {
360
371
  ].join("\n");
361
372
  }
362
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
+
363
394
  // src/identity/commands.ts
364
395
  import * as readline from "readline";
365
396
  import { AgentChatClient, integration as kit2 } from "agentchatme";
@@ -1085,6 +1116,32 @@ The key was not saved.`);
1085
1116
  } : { name: "wake-cycles", verdict: "PASS", detail: `last cycle ${last.outcome} at ${last.at} (${cycles.length} recent)` }
1086
1117
  );
1087
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
+ }
1088
1145
  if (profile.extraDoctorChecks !== void 0) {
1089
1146
  try {
1090
1147
  checks.push(...await profile.extraDoctorChecks({ ...opts, ...texts }));
@@ -1760,11 +1817,13 @@ export {
1760
1817
  AGENT_LOCK_DIR_ENV,
1761
1818
  ANCHOR_END,
1762
1819
  ANCHOR_START,
1820
+ COULD_NOT_PROCESS_FILE,
1763
1821
  DAEMON_LOCK_FILE,
1764
1822
  DEFAULT_API_BASE,
1765
1823
  DEFAULT_RUN_BUDGET_MS,
1766
1824
  DEFAULT_RUN_PROFILE,
1767
1825
  FAILED_CYCLE_OUTCOMES,
1826
+ FALLBACK_RUN_PROFILE,
1768
1827
  HEARTBEAT_FILE,
1769
1828
  HOSTED_MCP_PATH,
1770
1829
  INTEGRATION_ENV,
@@ -1781,10 +1840,13 @@ export {
1781
1840
  MANUAL_MAX_REDIRECTS,
1782
1841
  MANUAL_SKILL_NAME,
1783
1842
  MANUAL_URL,
1843
+ OWN_RUN_WARNING,
1784
1844
  PEER_RUN_WARNING,
1785
1845
  PROBE_KILL_WAIT_MS,
1846
+ PausedConversations,
1786
1847
  REPEATED_FAILED_CYCLES,
1787
1848
  RUN_BUDGET_ENV,
1849
+ RUN_CONTEXT_ENV,
1788
1850
  RUN_PROFILES,
1789
1851
  RUN_PROFILE_ENV,
1790
1852
  SOCKET_STATES,
@@ -1819,9 +1881,13 @@ export {
1819
1881
  clientHeadersOf,
1820
1882
  clientIdentityOf,
1821
1883
  clientNameOf,
1884
+ couldNotProcessPath,
1822
1885
  createIdentityCommands,
1823
1886
  credentialsPath,
1887
+ describeCouldNotProcessCounts,
1824
1888
  describeManualSync,
1889
+ describePausedConversations,
1890
+ describeRunProfile,
1825
1891
  envApiKey,
1826
1892
  envKeyConflict,
1827
1893
  failedCyclesInARow,
@@ -1854,6 +1920,7 @@ export {
1854
1920
  markStandby,
1855
1921
  normalizeHandle,
1856
1922
  offerDeclined,
1923
+ ownProfileLine,
1857
1924
  parseLease,
1858
1925
  parseServiceHome,
1859
1926
  pendingPath,
@@ -1875,12 +1942,15 @@ export {
1875
1942
  renderAnchorBlock,
1876
1943
  renderDeclinedBlock,
1877
1944
  renderUnregisteredBlock,
1945
+ repeatedFailedRuns,
1878
1946
  resetLeaseObservations,
1879
1947
  resolveIdentity,
1880
1948
  resolveRunBudgetMs,
1881
1949
  resolveRunProfile,
1950
+ runContextEnv,
1882
1951
  runProbe,
1883
1952
  runProfileWarning,
1953
+ runtimeCheckFailingNow,
1884
1954
  serviceDefinitionCurrent,
1885
1955
  serviceInstalled,
1886
1956
  serviceLabelFor,