@agentchatme/agent-core 0.0.1313111111111 → 0.0.1313111111113

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.
@@ -1,7 +1,7 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import { z } from 'zod';
3
- import { T as TurnContext, a as TurnDisposition, R as RuntimeAdapter } from './adapter-types-CV0DSi4F.js';
4
- export { A as AutonomyMode, F as FullAutonomyTurnContext, P as PendingReason, b as PendingTurnRequest, S as SilentReason, c as TurnBatchContext, d as TurnMentionContext, e as TurnResult } from './adapter-types-CV0DSi4F.js';
3
+ import { T as TurnContext, a as TurnDisposition, R as RuntimeAdapter } from './adapter-types-DrrsKZYk.js';
4
+ export { A as AutonomyMode, F as FullAutonomyTurnContext, P as PendingReason, b as PendingTurnRequest, S as SilentReason, c as TurnBatchContext, d as TurnMentionContext, e as TurnResult } from './adapter-types-DrrsKZYk.js';
5
5
 
6
6
  declare const SyncRowSchema: z.ZodObject<{
7
7
  id: z.ZodString;
@@ -15,7 +15,7 @@ import {
15
15
  recordDaemonActivity,
16
16
  recordPendingRequest,
17
17
  resolveIdentity
18
- } from "./chunk-D62LD5UE.js";
18
+ } from "./chunk-ATDAOJ27.js";
19
19
 
20
20
  // src/daemon/ws-client.ts
21
21
  import { WebSocket } from "ws";
package/dist/index.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- import { H as HostCopy, a as TurnDisposition } from './adapter-types-CV0DSi4F.js';
2
- export { f as AlwaysOnState, A as AutonomyMode, g as FullAutonomyPolicy, h as HEARTBEAT_FILE, M as MessageContext, P as PendingReason, i as PendingRequest, j as RecordPendingRequestInput, k as SyncRow, W as WireConfig, l as WireError, m as allowFullAutonomyAgent, n as alwaysOnHealth, o as alwaysOnOptedOut, p as alwaysOnState, q as alwaysOnWanted, r as autonomyPath, s as beat, t as claimReply, u as claimReplyBatch, v as clearAlwaysOnInstalledVersion, w as clearAlwaysOnOptOut, x as clearAlwaysOnWanted, y as clearForegroundTurn, z as clearSessionActive, B as contextOf, C as formatAlwaysOnDown, D as formatPendingRequestsNotice, E as formatRegistrationOffer, G as formatSessionStart, I as formatStopPickup, J as fullAutonomyAllows, K as getMeLite, L as getPendingRequest, N as idle, O as lastDeliveryId, Q as listPendingRequests, U as markAlwaysOnInstalledVersion, V as markAlwaysOnOptOut, X as markAlwaysOnWanted, Y as markForegroundTurn, Z as markSessionActive, _ as normalizeAgentHandle, $ as pendingRequestId, a0 as pendingRequestsFingerprint, a1 as readAlwaysOnInstalledVersion, a2 as readFullAutonomyPolicy, a3 as recordPendingRequest, a4 as removeFullAutonomyAgent, a5 as renderDeclinedBlock, a6 as renderUnregisteredBlock, a7 as resolvePendingRequest, a8 as setFullAutonomyMode, a9 as syncAck, aa as syncPeek, ab as writeFullAutonomyPolicy } from './adapter-types-CV0DSi4F.js';
1
+ import { H as HostCopy, a as TurnDisposition } from './adapter-types-DrrsKZYk.js';
2
+ export { f as AlwaysOnState, A as AutonomyMode, g as FullAutonomyPolicy, h as HEARTBEAT_FILE, M as MessageContext, P as PendingReason, i as PendingRequest, j as RecordPendingRequestInput, k as SyncRow, W as WireConfig, l as WireError, m as allowFullAutonomyAgent, n as alwaysOnHealth, o as alwaysOnOptedOut, p as alwaysOnState, q as alwaysOnWanted, r as autonomyPath, s as beat, t as claimReply, u as claimReplyBatch, v as clearAlwaysOnInstalledVersion, w as clearAlwaysOnOptOut, x as clearAlwaysOnWanted, y as clearForegroundTurn, z as clearSessionActive, B as contextOf, C as formatAlwaysOnDown, D as formatPendingRequestsNotice, E as formatPendingRequestsSystemMessage, G as formatRegistrationOffer, I as formatSessionStart, J as formatStopPickup, K as fullAutonomyAllows, L as getMeLite, N as getPendingRequest, O as idle, Q as lastDeliveryId, U as listPendingRequests, V as markAlwaysOnInstalledVersion, X as markAlwaysOnOptOut, Y as markAlwaysOnWanted, Z as markForegroundTurn, _ as markSessionActive, $ as normalizeAgentHandle, a0 as pendingRequestId, a1 as pendingRequestsFingerprint, a2 as readAlwaysOnInstalledVersion, a3 as readFullAutonomyPolicy, a4 as recordPendingRequest, a5 as removeFullAutonomyAgent, a6 as renderDeclinedBlock, a7 as renderUnregisteredBlock, a8 as resolvePendingRequest, a9 as setFullAutonomyMode, aa as syncAck, ab as syncPeek, ac as writeFullAutonomyPolicy } from './adapter-types-DrrsKZYk.js';
3
3
  import { z } from 'zod';
4
4
  import { spawn, spawnSync } from 'node:child_process';
5
5
 
6
6
  /** Low-cardinality identity attached to every coding-agent API operation. */
7
7
  declare const CODING_AGENTS_CLIENT_IDENTITY: {
8
8
  readonly name: "coding_agents";
9
- readonly version: "0.0.1313111111111";
9
+ readonly version: "0.0.1313111111113";
10
10
  };
11
11
  /** Headers for raw HTTP and WebSocket transports that bypass the SDK. */
12
12
  declare const CODING_AGENTS_CLIENT_HEADERS: Readonly<Record<string, string>>;
13
13
 
14
14
  /** Published package version, kept in lockstep with package.json by tests. */
15
- declare const VERSION = "0.0.1313111111111";
15
+ declare const VERSION = "0.0.1313111111113";
16
16
 
17
17
  declare const DEFAULT_API_BASE = "https://api.agentchat.me";
18
18
  declare const CredentialsSchema: z.ZodObject<{
@@ -211,10 +211,16 @@ interface HookContext {
211
211
  interface SessionStartResult {
212
212
  /** Text to inject into the session, or null for "say nothing". */
213
213
  context: string | null;
214
+ /** Deterministic text for the host's user-visible hook surface. */
215
+ notification: string | null;
216
+ /** Record the notice only after the integration printed it successfully. */
217
+ stage: () => void;
214
218
  }
215
219
  interface UserPromptResult {
216
220
  /** Text to add to this prompt, or null when the inbox has nothing new. */
217
221
  context: string | null;
222
+ /** Deterministic text for the host's user-visible hook surface. */
223
+ notification: string | null;
218
224
  /**
219
225
  * Persist the surfaced cursor locally. Call only after the host has accepted
220
226
  * `context`; the following Stop is the first boundary allowed to ACK it.
@@ -247,8 +253,8 @@ declare function sessionEnd(ctx: HookContext, input: HookInput): Promise<void>;
247
253
  * between them would be one more place to pick the wrong one.
248
254
  */
249
255
  interface HookDialect {
250
- sessionStartOutput(context: string): Record<string, unknown>;
251
- userPromptOutput(context: string): Record<string, unknown>;
256
+ sessionStartOutput(context: string, notification: string | null): Record<string, unknown>;
257
+ userPromptOutput(context: string, notification: string | null): Record<string, unknown>;
252
258
  stopOutput(reason: string): Record<string, unknown>;
253
259
  printJson(payload: Record<string, unknown>): void;
254
260
  }
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ import {
31
31
  external_exports,
32
32
  formatDaemonActivities,
33
33
  formatPendingRequestsNotice,
34
+ formatPendingRequestsSystemMessage,
34
35
  formatWhen,
35
36
  fullAutonomyAllows,
36
37
  getMeLite,
@@ -68,7 +69,7 @@ import {
68
69
  writeCredentials,
69
70
  writeFullAutonomyPolicy,
70
71
  writePending
71
- } from "./chunk-D62LD5UE.js";
72
+ } from "./chunk-ATDAOJ27.js";
72
73
 
73
74
  // src/identity/state.ts
74
75
  var SESSION_TTL_MS = 48 * 60 * 60 * 1e3;
@@ -584,7 +585,12 @@ async function claimContiguousPrefix(cfg, rows, holder) {
584
585
  return prefix;
585
586
  }
586
587
  async function sessionStart(ctx, input) {
587
- const none = { context: null };
588
+ const none = {
589
+ context: null,
590
+ notification: null,
591
+ stage: () => {
592
+ }
593
+ };
588
594
  try {
589
595
  if (hooksDisabled()) return none;
590
596
  if (input.source === "compact") return none;
@@ -593,7 +599,12 @@ async function sessionStart(ctx, input) {
593
599
  if (identity === null) {
594
600
  if (shouldOfferRegistration(ctx.home)) {
595
601
  recordRegistrationOffer(ctx.home);
596
- return { context: formatRegistrationOffer(ctx.copy, alwaysOnState(ctx.home)) };
602
+ return {
603
+ context: formatRegistrationOffer(ctx.copy, alwaysOnState(ctx.home)),
604
+ notification: null,
605
+ stage: () => {
606
+ }
607
+ };
597
608
  }
598
609
  return none;
599
610
  }
@@ -614,19 +625,28 @@ async function sessionStart(ctx, input) {
614
625
  input.sessionId,
615
626
  fingerprint
616
627
  ) ? formatPendingRequestsNotice(requests, ctx.copy) : null;
617
- if (pendingNotice !== null) {
618
- recordPendingNotice(ctx.home, input.sessionId, fingerprint);
619
- }
620
628
  const context = [alert, pendingNotice].filter((value) => value !== null).join("\n\n");
621
- return { context: context || null };
629
+ return {
630
+ context: context || null,
631
+ notification: pendingNotice === null ? null : formatPendingRequestsSystemMessage(requests),
632
+ stage: () => {
633
+ if (pendingNotice !== null) {
634
+ recordPendingNotice(ctx.home, input.sessionId, fingerprint);
635
+ }
636
+ }
637
+ };
622
638
  } catch (err) {
623
639
  log.warn(`session-start hook degraded to no-op: ${String(err)}`);
624
640
  return none;
625
641
  }
626
642
  }
627
643
  async function userPrompt(ctx, input) {
628
- const none = { context: null, stage: () => {
629
- } };
644
+ const none = {
645
+ context: null,
646
+ notification: null,
647
+ stage: () => {
648
+ }
649
+ };
630
650
  try {
631
651
  if (hooksDisabled()) return none;
632
652
  const identity = resolveIdentity(ctx.home);
@@ -666,6 +686,7 @@ async function userPrompt(ctx, input) {
666
686
  if (!localContext) return none;
667
687
  return {
668
688
  context: localContext,
689
+ notification: pendingContext === null ? null : formatPendingRequestsSystemMessage(pendingRequests),
669
690
  stage: stageLocalContext
670
691
  };
671
692
  }
@@ -678,15 +699,21 @@ async function userPrompt(ctx, input) {
678
699
  if (!localContext) return none;
679
700
  return {
680
701
  context: localContext,
702
+ notification: pendingContext === null ? null : formatPendingRequestsSystemMessage(pendingRequests),
681
703
  stage: stageLocalContext
682
704
  };
683
705
  }
684
706
  const cursor = lastDeliveryId(rows);
685
707
  if (cursor === null) {
686
- return localContext ? { context: localContext, stage: stageLocalContext } : none;
708
+ return localContext ? {
709
+ context: localContext,
710
+ notification: pendingContext === null ? null : formatPendingRequestsSystemMessage(pendingRequests),
711
+ stage: stageLocalContext
712
+ } : none;
687
713
  }
688
714
  return {
689
715
  context: [pendingContext, activityContext, formatSessionStart(handle, rows)].filter((value) => value !== null).join("\n\n"),
716
+ notification: pendingContext === null ? null : formatPendingRequestsSystemMessage(pendingRequests),
690
717
  stage: () => {
691
718
  stageLocalContext();
692
719
  setPendingAck(ctx.home, input.sessionId, cursor);
@@ -840,8 +867,13 @@ function createHookRunners(context, dialect) {
840
867
  async runSessionStart() {
841
868
  try {
842
869
  const input = await readHookInput();
843
- const { context: text } = await sessionStart(context(), input);
844
- if (text !== null) dialect.printJson(dialect.sessionStartOutput(text));
870
+ const result = await sessionStart(context(), input);
871
+ if (result.context !== null) {
872
+ dialect.printJson(
873
+ dialect.sessionStartOutput(result.context, result.notification)
874
+ );
875
+ result.stage();
876
+ }
845
877
  } catch (err) {
846
878
  log.warn(`session-start hook degraded to no-op: ${String(err)}`);
847
879
  }
@@ -849,9 +881,9 @@ function createHookRunners(context, dialect) {
849
881
  async runUserPrompt() {
850
882
  try {
851
883
  const input = await readHookInput();
852
- const { context: text, stage } = await userPrompt(context(), input);
884
+ const { context: text, notification, stage } = await userPrompt(context(), input);
853
885
  if (text === null) return;
854
- dialect.printJson(dialect.userPromptOutput(text));
886
+ dialect.printJson(dialect.userPromptOutput(text, notification));
855
887
  stage();
856
888
  } catch (err) {
857
889
  log.warn(`user-prompt hook degraded to no-op: ${String(err)}`);
@@ -2216,6 +2248,7 @@ export {
2216
2248
  formatAlwaysOnDown,
2217
2249
  formatDaemonActivities,
2218
2250
  formatPendingRequestsNotice,
2251
+ formatPendingRequestsSystemMessage,
2219
2252
  formatRegistrationOffer,
2220
2253
  formatSessionStart,
2221
2254
  formatStopPickup,