@adecore/agent-contracts 0.23.1 → 0.24.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.
@@ -175,6 +175,22 @@ export declare const AGENT_REQUEST_SCHEMAS: {
175
175
  async: z.ZodOptional<z.ZodBoolean>;
176
176
  }, z.core.$strip>>;
177
177
  }, z.core.$strip>>>;
178
+ goal: z.ZodOptional<z.ZodObject<{
179
+ objective: z.ZodString;
180
+ status: z.ZodEnum<{
181
+ active: "active";
182
+ blocked: "blocked";
183
+ "budget-limited": "budget-limited";
184
+ complete: "complete";
185
+ paused: "paused";
186
+ "usage-limited": "usage-limited";
187
+ }>;
188
+ checks: z.ZodOptional<z.ZodNumber>;
189
+ lastCheck: z.ZodOptional<z.ZodString>;
190
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
191
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
192
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
193
+ }, z.core.$strip>>;
178
194
  createdAt: z.ZodNumber;
179
195
  }, z.core.$strip>;
180
196
  };
@@ -673,6 +689,22 @@ export declare const AGENT_REQUEST_SCHEMAS: {
673
689
  async: z.ZodOptional<z.ZodBoolean>;
674
690
  }, z.core.$strip>>;
675
691
  }, z.core.$strip>>>;
692
+ goal: z.ZodOptional<z.ZodObject<{
693
+ objective: z.ZodString;
694
+ status: z.ZodEnum<{
695
+ active: "active";
696
+ blocked: "blocked";
697
+ "budget-limited": "budget-limited";
698
+ complete: "complete";
699
+ paused: "paused";
700
+ "usage-limited": "usage-limited";
701
+ }>;
702
+ checks: z.ZodOptional<z.ZodNumber>;
703
+ lastCheck: z.ZodOptional<z.ZodString>;
704
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
705
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
706
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
707
+ }, z.core.$strip>>;
676
708
  createdAt: z.ZodNumber;
677
709
  }, z.core.$strip>;
678
710
  items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -1864,6 +1896,22 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1864
1896
  async: z.ZodOptional<z.ZodBoolean>;
1865
1897
  }, z.core.$strip>>;
1866
1898
  }, z.core.$strip>>>;
1899
+ goal: z.ZodOptional<z.ZodObject<{
1900
+ objective: z.ZodString;
1901
+ status: z.ZodEnum<{
1902
+ active: "active";
1903
+ blocked: "blocked";
1904
+ "budget-limited": "budget-limited";
1905
+ complete: "complete";
1906
+ paused: "paused";
1907
+ "usage-limited": "usage-limited";
1908
+ }>;
1909
+ checks: z.ZodOptional<z.ZodNumber>;
1910
+ lastCheck: z.ZodOptional<z.ZodString>;
1911
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
1912
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
1913
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
1914
+ }, z.core.$strip>>;
1867
1915
  createdAt: z.ZodNumber;
1868
1916
  }, z.core.$strip>;
1869
1917
  }, z.core.$strip>, z.ZodObject<{
@@ -2018,6 +2066,22 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2018
2066
  async: z.ZodOptional<z.ZodBoolean>;
2019
2067
  }, z.core.$strip>>;
2020
2068
  }, z.core.$strip>>>;
2069
+ goal: z.ZodOptional<z.ZodObject<{
2070
+ objective: z.ZodString;
2071
+ status: z.ZodEnum<{
2072
+ active: "active";
2073
+ blocked: "blocked";
2074
+ "budget-limited": "budget-limited";
2075
+ complete: "complete";
2076
+ paused: "paused";
2077
+ "usage-limited": "usage-limited";
2078
+ }>;
2079
+ checks: z.ZodOptional<z.ZodNumber>;
2080
+ lastCheck: z.ZodOptional<z.ZodString>;
2081
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
2082
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
2083
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
2084
+ }, z.core.$strip>>;
2021
2085
  createdAt: z.ZodNumber;
2022
2086
  }, z.core.$strip>;
2023
2087
  items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -2723,6 +2787,22 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2723
2787
  async: z.ZodOptional<z.ZodBoolean>;
2724
2788
  }, z.core.$strip>>;
2725
2789
  }, z.core.$strip>>>;
2790
+ goal: z.ZodOptional<z.ZodObject<{
2791
+ objective: z.ZodString;
2792
+ status: z.ZodEnum<{
2793
+ active: "active";
2794
+ blocked: "blocked";
2795
+ "budget-limited": "budget-limited";
2796
+ complete: "complete";
2797
+ paused: "paused";
2798
+ "usage-limited": "usage-limited";
2799
+ }>;
2800
+ checks: z.ZodOptional<z.ZodNumber>;
2801
+ lastCheck: z.ZodOptional<z.ZodString>;
2802
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
2803
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
2804
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
2805
+ }, z.core.$strip>>;
2726
2806
  createdAt: z.ZodNumber;
2727
2807
  }, z.core.$strip>;
2728
2808
  };
@@ -2975,6 +3055,22 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2975
3055
  async: z.ZodOptional<z.ZodBoolean>;
2976
3056
  }, z.core.$strip>>;
2977
3057
  }, z.core.$strip>>>;
3058
+ goal: z.ZodOptional<z.ZodObject<{
3059
+ objective: z.ZodString;
3060
+ status: z.ZodEnum<{
3061
+ active: "active";
3062
+ blocked: "blocked";
3063
+ "budget-limited": "budget-limited";
3064
+ complete: "complete";
3065
+ paused: "paused";
3066
+ "usage-limited": "usage-limited";
3067
+ }>;
3068
+ checks: z.ZodOptional<z.ZodNumber>;
3069
+ lastCheck: z.ZodOptional<z.ZodString>;
3070
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
3071
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
3072
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
3073
+ }, z.core.$strip>>;
2978
3074
  createdAt: z.ZodNumber;
2979
3075
  }, z.core.$strip>;
2980
3076
  nodeId: z.ZodString;
@@ -3160,6 +3256,22 @@ export declare const AGENT_REQUEST_SCHEMAS: {
3160
3256
  async: z.ZodOptional<z.ZodBoolean>;
3161
3257
  }, z.core.$strip>>;
3162
3258
  }, z.core.$strip>>>;
3259
+ goal: z.ZodOptional<z.ZodObject<{
3260
+ objective: z.ZodString;
3261
+ status: z.ZodEnum<{
3262
+ active: "active";
3263
+ blocked: "blocked";
3264
+ "budget-limited": "budget-limited";
3265
+ complete: "complete";
3266
+ paused: "paused";
3267
+ "usage-limited": "usage-limited";
3268
+ }>;
3269
+ checks: z.ZodOptional<z.ZodNumber>;
3270
+ lastCheck: z.ZodOptional<z.ZodString>;
3271
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
3272
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
3273
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
3274
+ }, z.core.$strip>>;
3163
3275
  createdAt: z.ZodNumber;
3164
3276
  }, z.core.$strip>;
3165
3277
  nodeId: z.ZodString;
@@ -3625,6 +3737,17 @@ export declare const AGENT_REQUEST_SCHEMAS: {
3625
3737
  }, z.core.$strip>;
3626
3738
  readonly result: z.ZodObject<{}, z.core.$strip>;
3627
3739
  };
3740
+ readonly 'chat.goal': {
3741
+ readonly payload: z.ZodObject<{
3742
+ chatId: z.ZodString;
3743
+ action: z.ZodEnum<{
3744
+ clear: "clear";
3745
+ pause: "pause";
3746
+ resume: "resume";
3747
+ }>;
3748
+ }, z.core.$strip>;
3749
+ readonly result: z.ZodObject<{}, z.core.$strip>;
3750
+ };
3628
3751
  readonly 'chat.addBookmark': {
3629
3752
  readonly payload: z.ZodObject<{
3630
3753
  chatId: z.ZodString;
@@ -3761,6 +3884,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
3761
3884
  denyReason: z.ZodBoolean;
3762
3885
  allowAlways: z.ZodBoolean;
3763
3886
  asyncQuestions: z.ZodBoolean;
3887
+ steer: z.ZodOptional<z.ZodBoolean>;
3764
3888
  compaction: z.ZodEnum<{
3765
3889
  native: "native";
3766
3890
  none: "none";
@@ -3770,6 +3894,10 @@ export declare const AGENT_REQUEST_SCHEMAS: {
3770
3894
  reportsContextWindow: z.ZodBoolean;
3771
3895
  reportsThinking: z.ZodBoolean;
3772
3896
  slashCommands: z.ZodBoolean;
3897
+ goals: z.ZodOptional<z.ZodEnum<{
3898
+ command: "command";
3899
+ native: "native";
3900
+ }>>;
3773
3901
  }, z.core.$strip>;
3774
3902
  resumeCommand: z.ZodString;
3775
3903
  }, z.core.$strip>>;
@@ -4240,6 +4368,12 @@ export declare const AGENT_REQUEST_SCHEMAS: {
4240
4368
  }, z.core.$strip>;
4241
4369
  readonly result: z.ZodObject<{}, z.core.$strip>;
4242
4370
  };
4371
+ readonly 'chat.restart': {
4372
+ readonly payload: z.ZodObject<{
4373
+ chatId: z.ZodString;
4374
+ }, z.core.$strip>;
4375
+ readonly result: z.ZodObject<{}, z.core.$strip>;
4376
+ };
4243
4377
  readonly 'chat.list': {
4244
4378
  readonly payload: z.ZodObject<{}, z.core.$strip>;
4245
4379
  readonly result: z.ZodObject<{
@@ -4393,6 +4527,22 @@ export declare const AGENT_REQUEST_SCHEMAS: {
4393
4527
  async: z.ZodOptional<z.ZodBoolean>;
4394
4528
  }, z.core.$strip>>;
4395
4529
  }, z.core.$strip>>>;
4530
+ goal: z.ZodOptional<z.ZodObject<{
4531
+ objective: z.ZodString;
4532
+ status: z.ZodEnum<{
4533
+ active: "active";
4534
+ blocked: "blocked";
4535
+ "budget-limited": "budget-limited";
4536
+ complete: "complete";
4537
+ paused: "paused";
4538
+ "usage-limited": "usage-limited";
4539
+ }>;
4540
+ checks: z.ZodOptional<z.ZodNumber>;
4541
+ lastCheck: z.ZodOptional<z.ZodString>;
4542
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
4543
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
4544
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
4545
+ }, z.core.$strip>>;
4396
4546
  createdAt: z.ZodNumber;
4397
4547
  }, z.core.$strip>>;
4398
4548
  }, z.core.$strip>;
@@ -4935,6 +5085,22 @@ export declare const AGENT_EVENT_SCHEMAS: {
4935
5085
  async: z.ZodOptional<z.ZodBoolean>;
4936
5086
  }, z.core.$strip>>;
4937
5087
  }, z.core.$strip>>>;
5088
+ goal: z.ZodOptional<z.ZodObject<{
5089
+ objective: z.ZodString;
5090
+ status: z.ZodEnum<{
5091
+ active: "active";
5092
+ blocked: "blocked";
5093
+ "budget-limited": "budget-limited";
5094
+ complete: "complete";
5095
+ paused: "paused";
5096
+ "usage-limited": "usage-limited";
5097
+ }>;
5098
+ checks: z.ZodOptional<z.ZodNumber>;
5099
+ lastCheck: z.ZodOptional<z.ZodString>;
5100
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
5101
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
5102
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
5103
+ }, z.core.$strip>>;
4938
5104
  createdAt: z.ZodNumber;
4939
5105
  }, z.core.$strip>;
4940
5106
  }, z.core.$strip>, z.ZodObject<{
@@ -5089,6 +5255,22 @@ export declare const AGENT_EVENT_SCHEMAS: {
5089
5255
  async: z.ZodOptional<z.ZodBoolean>;
5090
5256
  }, z.core.$strip>>;
5091
5257
  }, z.core.$strip>>>;
5258
+ goal: z.ZodOptional<z.ZodObject<{
5259
+ objective: z.ZodString;
5260
+ status: z.ZodEnum<{
5261
+ active: "active";
5262
+ blocked: "blocked";
5263
+ "budget-limited": "budget-limited";
5264
+ complete: "complete";
5265
+ paused: "paused";
5266
+ "usage-limited": "usage-limited";
5267
+ }>;
5268
+ checks: z.ZodOptional<z.ZodNumber>;
5269
+ lastCheck: z.ZodOptional<z.ZodString>;
5270
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
5271
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
5272
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
5273
+ }, z.core.$strip>>;
5092
5274
  createdAt: z.ZodNumber;
5093
5275
  }, z.core.$strip>;
5094
5276
  items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -5571,6 +5753,22 @@ export declare const AGENT_EVENT_SCHEMAS: {
5571
5753
  async: z.ZodOptional<z.ZodBoolean>;
5572
5754
  }, z.core.$strip>>;
5573
5755
  }, z.core.$strip>>>;
5756
+ goal: z.ZodOptional<z.ZodObject<{
5757
+ objective: z.ZodString;
5758
+ status: z.ZodEnum<{
5759
+ active: "active";
5760
+ blocked: "blocked";
5761
+ "budget-limited": "budget-limited";
5762
+ complete: "complete";
5763
+ paused: "paused";
5764
+ "usage-limited": "usage-limited";
5765
+ }>;
5766
+ checks: z.ZodOptional<z.ZodNumber>;
5767
+ lastCheck: z.ZodOptional<z.ZodString>;
5768
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
5769
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
5770
+ secondsUsed: z.ZodOptional<z.ZodNumber>;
5771
+ }, z.core.$strip>>;
5574
5772
  createdAt: z.ZodNumber;
5575
5773
  }, z.core.$strip>;
5576
5774
  }, z.core.$strip>;
package/dist/protocol.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ChatAddBookmarkPayloadSchema, ChatAnswerPayloadSchema, ChatApprovePayloadSchema, ChatAttachPayloadSchema, ChatAttachResultSchema, ChatBookmarksEventSchema, ChatBookmarksResultSchema, ChatCancelPayloadSchema, ChatClearPayloadSchema, ChatConfigurePayloadSchema, ChatContinueOnPayloadSchema, ChatContinueOnResultSchema, ChatCreatePayloadSchema, ChatDismissPayloadSchema, ChatEventEnvelopeSchema, ChatForkInfoPayloadSchema, ChatForkInfoResultSchema, ChatForkPayloadSchema, ChatForkResultSchema, ChatHistoryPayloadSchema, ChatHistoryResultSchema, ChatInfoSchema, ChatListResultSchema, ChatPreferencesPayloadSchema, ChatQueuePayloadSchema, ChatRemoveBookmarkPayloadSchema, ChatRemoveVisualPayloadSchema, ChatRenameBookmarkPayloadSchema, ChatSendPayloadSchema, ChatSendResultSchema, ChatUiChoicePayloadSchema, ChatUiLinkPayloadSchema, ChatUiLinkReadingSchema, ChatUiQueryPayloadSchema, ChatUiQueryReadingSchema, ChatStatusEventSchema, ChatStopSubagentPayloadSchema, ChatStopTaskPayloadSchema, ChatSubagentChangedEventSchema, ChatSubagentPayloadSchema, ChatSubagentResultSchema, ChatSummarizePayloadSchema, ChatSummarizeResultSchema, ChatTargetPayloadSchema, ChatTurnDiffPayloadSchema, ChatTurnDiffResultSchema, ChatUnqueueResultSchema, ChatVisualsEventSchema, ChatVisualsResultSchema, SkillsListPayloadSchema, SkillsListResultSchema } from './chat.js';
2
+ import { ChatAddBookmarkPayloadSchema, ChatAnswerPayloadSchema, ChatApprovePayloadSchema, ChatAttachPayloadSchema, ChatAttachResultSchema, ChatBookmarksEventSchema, ChatBookmarksResultSchema, ChatCancelPayloadSchema, ChatClearPayloadSchema, ChatConfigurePayloadSchema, ChatContinueOnPayloadSchema, ChatContinueOnResultSchema, ChatCreatePayloadSchema, ChatDismissPayloadSchema, ChatEventEnvelopeSchema, ChatForkInfoPayloadSchema, ChatForkInfoResultSchema, ChatForkPayloadSchema, ChatForkResultSchema, ChatGoalPayloadSchema, ChatHistoryPayloadSchema, ChatHistoryResultSchema, ChatInfoSchema, ChatListResultSchema, ChatPreferencesPayloadSchema, ChatQueuePayloadSchema, ChatRemoveBookmarkPayloadSchema, ChatRemoveVisualPayloadSchema, ChatRenameBookmarkPayloadSchema, ChatSendPayloadSchema, ChatSendResultSchema, ChatUiChoicePayloadSchema, ChatUiLinkPayloadSchema, ChatUiLinkReadingSchema, ChatUiQueryPayloadSchema, ChatUiQueryReadingSchema, ChatStatusEventSchema, ChatStopSubagentPayloadSchema, ChatStopTaskPayloadSchema, ChatSubagentChangedEventSchema, ChatSubagentPayloadSchema, ChatSubagentResultSchema, ChatSummarizePayloadSchema, ChatSummarizeResultSchema, ChatTargetPayloadSchema, ChatTurnDiffPayloadSchema, ChatTurnDiffResultSchema, ChatUnqueueResultSchema, ChatVisualsEventSchema, ChatVisualsResultSchema, SkillsListPayloadSchema, SkillsListResultSchema } from './chat.js';
3
3
  import { ProviderListResultSchema } from './model.js';
4
4
  import { ProviderAccountCreatePayloadSchema, ProviderAccountCreateResultSchema, ProviderAccountWatchLoginPayloadSchema, ProviderAccountsSavePayloadSchema, ProviderAccountsSchema } from './provider-accounts.js';
5
5
  import { UsageChangedEventSchema, UsageLimitsSnapshotSchema, UsageSummaryPayloadSchema, UsageSummaryResultSchema } from './usage.js';
@@ -36,6 +36,7 @@ export const AGENT_REQUEST_SCHEMAS = {
36
36
  'chat.subagent': { payload: ChatSubagentPayloadSchema, result: ChatSubagentResultSchema },
37
37
  'chat.stopSubagent': { payload: ChatStopSubagentPayloadSchema, result: EmptySchema },
38
38
  'chat.stopTask': { payload: ChatStopTaskPayloadSchema, result: EmptySchema },
39
+ 'chat.goal': { payload: ChatGoalPayloadSchema, result: EmptySchema },
39
40
  'chat.addBookmark': { payload: ChatAddBookmarkPayloadSchema, result: ChatBookmarksResultSchema },
40
41
  'chat.renameBookmark': { payload: ChatRenameBookmarkPayloadSchema, result: ChatBookmarksResultSchema },
41
42
  'chat.removeBookmark': { payload: ChatRemoveBookmarkPayloadSchema, result: ChatBookmarksResultSchema },
@@ -55,6 +56,8 @@ export const AGENT_REQUEST_SCHEMAS = {
55
56
  'usage.limits': { payload: EmptySchema, result: UsageLimitsSnapshotSchema },
56
57
  'usage.refreshLimits': { payload: EmptySchema, result: UsageLimitsSnapshotSchema },
57
58
  'chat.kill': { payload: ChatTargetPayloadSchema, result: EmptySchema },
59
+ // Ends the chat's CLI and keeps the conversation, which the next message resumes in a fresh process.
60
+ 'chat.restart': { payload: ChatTargetPayloadSchema, result: EmptySchema },
58
61
  'chat.list': { payload: EmptySchema, result: ChatListResultSchema }
59
62
  };
60
63
  export const AGENT_EVENT_SCHEMAS = {
@@ -0,0 +1 @@
1
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
package/dist/record.js ADDED
@@ -0,0 +1,4 @@
1
+ /* A plain object read off the wire or a file, whose fields are still unchecked; an array is not one. */
2
+ export function isRecord(value) {
3
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
4
+ }
package/dist/text.d.ts CHANGED
@@ -1 +1,3 @@
1
1
  export declare function clipText(text: string, max: number): string;
2
+ export declare const TOOL_OUTPUT_TAIL: number;
3
+ export declare function appendToolOutput(output: string | null, text: string): string;
package/dist/text.js CHANGED
@@ -17,3 +17,18 @@ export function clipText(text, max) {
17
17
  }
18
18
  return text.slice(0, end);
19
19
  }
20
+ // What a running tool call keeps of the output it streams; the host and every client cut it alike, so a delta grows both the same way.
21
+ export const TOOL_OUTPUT_TAIL = 64 * 1024;
22
+ /* `output` with `text` after it, cut to its last `TOOL_OUTPUT_TAIL` UTF-16 units, never between the halves of a surrogate pair. */
23
+ export function appendToolOutput(output, text) {
24
+ const whole = (output ?? '') + text;
25
+ let start = whole.length - TOOL_OUTPUT_TAIL;
26
+ if (start <= 0) {
27
+ return whole;
28
+ }
29
+ const unit = whole.charCodeAt(start);
30
+ if (unit >= 0xdc00 && unit <= 0xdfff) {
31
+ start += 1;
32
+ }
33
+ return whole.slice(start);
34
+ }
package/dist/visual.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { isRecord } from './record.js';
2
3
  import { visualViewportScript } from './visual-viewport.js';
3
4
  /*
4
5
  * What a host accepts when an agent publishes a visual. The schemas below check shapes only, so a
@@ -113,9 +114,6 @@ export function visualOpenLinkRequest(id, url) {
113
114
  export function visualOpenLinkResult(id) {
114
115
  return { jsonrpc: '2.0', id, result: {} };
115
116
  }
116
- function isRecord(value) {
117
- return typeof value === 'object' && value !== null && !Array.isArray(value);
118
- }
119
117
  function sizeOf(value) {
120
118
  return typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : undefined;
121
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agent-contracts",
3
- "version": "0.23.1",
3
+ "version": "0.24.0",
4
4
  "description": "Schemas and port contracts for agent chats, provider accounts, models and usage.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -49,6 +49,11 @@
49
49
  "types": "./dist/provider-accounts.d.ts",
50
50
  "default": "./dist/provider-accounts.js"
51
51
  },
52
+ "./record": {
53
+ "source": "./src/record.ts",
54
+ "types": "./dist/record.d.ts",
55
+ "default": "./dist/record.js"
56
+ },
52
57
  "./task": {
53
58
  "source": "./src/task.ts",
54
59
  "types": "./dist/task.d.ts",
@@ -81,7 +86,7 @@
81
86
  "test": "bun --conditions=source test"
82
87
  },
83
88
  "dependencies": {
84
- "@adecore/intelligent-ui": "0.23.1",
89
+ "@adecore/intelligent-ui": "0.24.0",
85
90
  "zod": "^4.6.5"
86
91
  },
87
92
  "devDependencies": {
package/src/chat.ts CHANGED
@@ -167,6 +167,28 @@ export const ChatTurnLimitSchema = z.object({
167
167
  });
168
168
  export type ChatTurnLimit = z.infer<typeof ChatTurnLimitSchema>;
169
169
 
170
+ /*
171
+ * A goal the chat's CLI works toward on its own, turn after turn, until it is met: Claude Code's and Codex's
172
+ * `/goal`. The statuses are this schema's own, so a client that validates a chat payload whole never meets
173
+ * a new value inside one it already knew. `usage-limited` and `budget-limited` are Codex's: the plan's limit,
174
+ * or the token budget the goal was given.
175
+ */
176
+ export const ChatGoalStatusSchema = z.enum(['active', 'paused', 'blocked', 'usage-limited', 'budget-limited', 'complete']);
177
+ export type ChatGoalStatus = z.infer<typeof ChatGoalStatusSchema>;
178
+
179
+ export const ChatGoalSchema = z.object({
180
+ objective: z.string(),
181
+ status: ChatGoalStatusSchema,
182
+ // How often the CLI's own check found the goal not met yet and sent the agent on; absent from a CLI that counts tokens instead.
183
+ checks: z.number().int().nonnegative().optional(),
184
+ // What that check last said was still missing.
185
+ lastCheck: z.string().optional(),
186
+ tokensUsed: z.number().int().nonnegative().optional(),
187
+ tokenBudget: z.number().int().positive().optional(),
188
+ secondsUsed: z.number().int().nonnegative().optional()
189
+ });
190
+ export type ChatGoal = z.infer<typeof ChatGoalSchema>;
191
+
170
192
  export const ChatQuestionSchema = z.object({
171
193
  id: z.string(),
172
194
  header: z.string(),
@@ -274,6 +296,8 @@ export const ChatInfoSchema = z.object({
274
296
  resumeAt: z.number().optional(),
275
297
  // What the chat waits on a person for, oldest first and at most `CHAT_REQUEST_LIMITS.perChat`; absent while nothing waits.
276
298
  requests: z.array(ChatRequestSummarySchema).optional(),
299
+ // The goal the CLI works toward, from the moment one is set until it is cleared; absent while there is none.
300
+ goal: ChatGoalSchema.optional(),
277
301
  createdAt: z.number()
278
302
  });
279
303
  export type ChatInfo = z.infer<typeof ChatInfoSchema>;
@@ -469,6 +493,9 @@ export type ChatSubagentUsage = z.infer<typeof ChatSubagentUsageSchema>;
469
493
  * ordinary items that carry `parentToolUseId`, so streaming keeps working; the timeline gathers
470
494
  * them under this row. `result` is the report it ended with, as markdown.
471
495
  */
496
+ // The `origin` of a subagent row a host opened with a task of its own rather than the CLI with its tool; a legacy spelling that stored threads carry.
497
+ export const HOST_TASK_ORIGIN = 'ruimte';
498
+
472
499
  export const ChatSubagentItemSchema = z.object({
473
500
  ...base,
474
501
  kind: z.literal('subagent'),
@@ -497,8 +524,7 @@ export const ChatSubagentItemSchema = z.object({
497
524
  // Where the CLI keeps this subagent's own conversation; set once the daemon found it.
498
525
  native: z.object({ agentId: z.string().optional(), threadId: z.string().optional() }).optional(),
499
526
  // Who opened it: the CLI with its own tool, or a verb with `--task` that made a node; absent is `native`.
500
- // The second value keeps its legacy spelling, since stored threads carry it.
501
- origin: z.enum(['native', 'ruimte']).optional(),
527
+ origin: z.enum(['native', HOST_TASK_ORIGIN]).optional(),
502
528
  // The node a `--task` opened, whose own conversation this row stands for.
503
529
  childId: z.string().optional(),
504
530
  // Set for an agent a subagent opened, with the id of that subagent's own Agent call; its row hangs under that one.
@@ -765,6 +791,13 @@ export const ChatStopSubagentPayloadSchema = ChatTargetPayloadSchema.extend({
765
791
  });
766
792
  export type ChatStopSubagentPayload = z.infer<typeof ChatStopSubagentPayloadSchema>;
767
793
 
794
+ // What a person does to a chat's goal without a turn of its own; `pause` and `resume` only where the CLI's protocol has them.
795
+ export const ChatGoalActionSchema = z.enum(['pause', 'resume', 'clear']);
796
+ export type ChatGoalAction = z.infer<typeof ChatGoalActionSchema>;
797
+
798
+ export const ChatGoalPayloadSchema = ChatTargetPayloadSchema.extend({ action: ChatGoalActionSchema });
799
+ export type ChatGoalPayload = z.infer<typeof ChatGoalPayloadSchema>;
800
+
768
801
  export const ChatStopTaskPayloadSchema = ChatTargetPayloadSchema.extend({ taskId: z.string().min(1).max(256) });
769
802
  export type ChatStopTaskPayload = z.infer<typeof ChatStopTaskPayloadSchema>;
770
803