@myagentroam/protocol 0.10.20 → 0.10.22

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
@@ -52,6 +52,7 @@ export const marAgentRuntimeCredentialCapabilitySchema = z
52
52
  namespacedTools: z.boolean().optional(),
53
53
  responsesOptionalParameters: z.boolean().optional(),
54
54
  responsesHttpContinuation: z.boolean().optional(),
55
+ conversationModels: z.boolean().optional(),
55
56
  httpVersions: z
56
57
  .array(runtimeCredentialHttpVersionSchema)
57
58
  .min(1)
@@ -288,6 +289,13 @@ export const nodeUpgradeStatusSchema = z.object({
288
289
  errorCode: z.string().trim().min(1).max(80).optional(),
289
290
  updatedAt: z.number().int().nonnegative()
290
291
  });
292
+ export const promptCompletionCapabilitySchema = z
293
+ .object({
294
+ apiVersion: z.literal(1),
295
+ contextVersion: z.union([z.literal(2), z.literal(3)]).optional(),
296
+ automaticTriggers: z.literal(true).optional()
297
+ })
298
+ .strict();
291
299
  export const nodeMetadataSchema = z
292
300
  .object({
293
301
  platform: nodePlatformSchema.optional(),
@@ -321,6 +329,7 @@ export const nodeCapabilitiesSchema = z
321
329
  conversationHosting: conversationHostingCapabilitySchema.optional(),
322
330
  computerUse: computerUseCapabilitySchema.optional(),
323
331
  marAgentRuntimeCredentials: marAgentRuntimeCredentialCapabilitySchema.optional(),
332
+ promptCompletion: promptCompletionCapabilitySchema.optional(),
324
333
  chatgptLogin: chatgptLoginCapabilitySchema.optional(),
325
334
  workspaceDirectTransfer: workspaceDirectTransferCapabilitySchema.optional(),
326
335
  terminalDirect: terminalDirectCapabilitySchema.optional()
@@ -732,6 +741,7 @@ const marAgentModelShape = {
732
741
  outputCapabilities: z.tuple([marAgentOutputCapabilitySchema]),
733
742
  reasoningEfforts: z.array(marAgentReasoningEffortSchema).max(6),
734
743
  defaultReasoningEffort: marAgentReasoningEffortSchema.optional(),
744
+ conversationModel: z.boolean().default(true),
735
745
  titleGeneration: z.boolean().default(false),
736
746
  codeMode: z.boolean().default(false),
737
747
  fastMode: z.boolean().optional(),
@@ -864,6 +874,156 @@ export const marAgentCompactConfigurationSchema = z
864
874
  message: 'Enabled compaction requires a model and reasoning effort'
865
875
  });
866
876
  });
877
+ export const promptCompletionConfigurationSchema = z
878
+ .object({
879
+ enabled: z.boolean(),
880
+ modelId: boundedIdentifierSchema.nullable(),
881
+ reasoningEffort: marAgentReasoningEffortSchema.nullable()
882
+ })
883
+ .strict()
884
+ .refine((value) => (value.modelId === null) === (value.reasoningEffort === null), {
885
+ message: 'A completion model and reasoning effort must be configured together'
886
+ });
887
+ export const promptCompletionPreferencesSchema = z
888
+ .object({
889
+ work: z.boolean()
890
+ })
891
+ .strict();
892
+ export const promptCompletionAttentionSchema = z
893
+ .object({
894
+ fileId: boundedIdentifierSchema.optional(),
895
+ worktreePath: z.string().max(1024).optional(),
896
+ kind: z.enum(['FILE', 'DIFF']),
897
+ path: z.string().min(1).max(1024),
898
+ observedAt: nonnegativeSafeIntegerSchema,
899
+ revision: z.string().min(1).max(128).optional(),
900
+ startLine: z.number().int().positive().max(10_000_000).optional(),
901
+ endLine: z.number().int().positive().max(10_000_000).optional(),
902
+ source: z.enum(['WORKING_TREE', 'HISTORY', 'TOOL_CHANGE']).optional()
903
+ })
904
+ .strict()
905
+ .refine((value) => (value.startLine === undefined) === (value.endLine === undefined) &&
906
+ (value.startLine === undefined || value.endLine >= value.startLine), 'Invalid visible range');
907
+ export const promptCompletionRequestSchema = z
908
+ .object({
909
+ trigger: z.enum(['MANUAL', 'AUTO']),
910
+ completionMode: z.enum(['NEXT', 'COMPLETE', 'REWRITE']),
911
+ attention: z.array(promptCompletionAttentionSchema).max(20).optional(),
912
+ draft: z
913
+ .string()
914
+ .max(8192)
915
+ .refine((value) => utf8ByteLength(value) <= 8192),
916
+ cursorPosition: nonnegativeSafeIntegerSchema,
917
+ draftRevision: nonnegativeSafeIntegerSchema,
918
+ contextVersion: boundedIdentifierSchema,
919
+ historyGeneration: boundedIdentifierSchema,
920
+ requestId: boundedIdentifierSchema,
921
+ pageEpoch: boundedIdentifierSchema,
922
+ intentSequence: positiveSafeIntegerSchema,
923
+ runner: runnerNameSchema,
924
+ sessionId: boundedIdentifierSchema.nullable()
925
+ })
926
+ .strict()
927
+ .superRefine((value, context) => {
928
+ if (value.trigger === 'AUTO' && value.draft !== '')
929
+ context.addIssue({
930
+ code: 'custom',
931
+ path: ['draft'],
932
+ message: 'Automatic prediction requires an empty draft'
933
+ });
934
+ const offset = value.cursorPosition;
935
+ const before = value.draft.charCodeAt(offset - 1);
936
+ const after = value.draft.charCodeAt(offset);
937
+ if (offset > value.draft.length ||
938
+ (before >= 0xd800 && before <= 0xdbff && after >= 0xdc00 && after <= 0xdfff)) {
939
+ context.addIssue({
940
+ code: 'custom',
941
+ path: ['cursorPosition'],
942
+ message: 'Invalid draft cursor'
943
+ });
944
+ }
945
+ if ((value.completionMode === 'NEXT') !== (value.draft.length === 0)) {
946
+ context.addIssue({
947
+ code: 'custom',
948
+ path: ['completionMode'],
949
+ message: 'Completion mode must match the draft'
950
+ });
951
+ }
952
+ });
953
+ export const promptCompletionCancelSchema = z
954
+ .object({
955
+ requestId: boundedIdentifierSchema,
956
+ pageEpoch: boundedIdentifierSchema,
957
+ intentSequence: positiveSafeIntegerSchema
958
+ })
959
+ .strict();
960
+ export const promptCompletionContextSchema = z
961
+ .object({
962
+ contextVersion: boundedIdentifierSchema,
963
+ historyGeneration: boundedIdentifierSchema,
964
+ progressRevision: nonnegativeSafeIntegerSchema
965
+ })
966
+ .strict();
967
+ const promptCompletionResponseIdentity = {
968
+ requestId: boundedIdentifierSchema,
969
+ contextVersion: boundedIdentifierSchema,
970
+ historyGeneration: boundedIdentifierSchema,
971
+ draftRevision: nonnegativeSafeIntegerSchema,
972
+ cursorPosition: nonnegativeSafeIntegerSchema
973
+ };
974
+ export const promptCompletionResponseSchema = z.discriminatedUnion('status', [
975
+ z
976
+ .object({
977
+ ...promptCompletionResponseIdentity,
978
+ status: z.literal('ready'),
979
+ suggestion: z.string().min(1).max(4000),
980
+ source: z.enum(['generated', 'cache']),
981
+ expiresAt: nonnegativeSafeIntegerSchema
982
+ })
983
+ .strict(),
984
+ z.object({ ...promptCompletionResponseIdentity, status: z.literal('empty') }).strict(),
985
+ z.object({ ...promptCompletionResponseIdentity, status: z.literal('cancelled') }).strict(),
986
+ z
987
+ .object({
988
+ ...promptCompletionResponseIdentity,
989
+ status: z.literal('skipped'),
990
+ reason: z.enum(['IN_FLIGHT', 'RATE_LIMITED', 'STALE_CONTEXT', 'UNAVAILABLE', 'CAPACITY']),
991
+ retryAfterMs: nonnegativeSafeIntegerSchema.optional()
992
+ })
993
+ .strict()
994
+ ]);
995
+ export const promptCompletionTargetSchema = z
996
+ .object({ kind: z.literal('WORKSPACE'), workspaceId: boundedIdentifierSchema })
997
+ .strict();
998
+ export const promptCompletionContextInputSchema = z
999
+ .object({
1000
+ target: promptCompletionTargetSchema,
1001
+ runner: runnerNameSchema,
1002
+ sessionId: boundedIdentifierSchema.nullable(),
1003
+ workbenchConnectionId: boundedIdentifierSchema,
1004
+ pageEpoch: boundedIdentifierSchema
1005
+ })
1006
+ .strict();
1007
+ export const promptCompletionGenerateInputSchema = z
1008
+ .object({
1009
+ target: promptCompletionTargetSchema,
1010
+ workbenchConnectionId: boundedIdentifierSchema,
1011
+ request: promptCompletionRequestSchema
1012
+ })
1013
+ .strict();
1014
+ /** Server-only execution authority; never part of a browser response or Session DTO. */
1015
+ export const promptCompletionRuntimeSchema = z
1016
+ .object({
1017
+ workspaceId: boundedIdentifierSchema,
1018
+ authorizationView: boundedIdentifierSchema,
1019
+ expiresAt: nonnegativeSafeIntegerSchema,
1020
+ runtimeScopeId: boundedIdentifierSchema,
1021
+ modelRevision: boundedIdentifierSchema,
1022
+ credentialScope: boundedIdentifierSchema,
1023
+ model: marAgentRuntimeModelConfigurationSchema,
1024
+ reasoningEffort: marAgentReasoningEffortSchema
1025
+ })
1026
+ .strict();
867
1027
  export const marAgentRuntimeCompactConfigurationSchema = z
868
1028
  .object({
869
1029
  model: marAgentRuntimeModelConfigurationSchema,
@@ -2777,6 +2937,9 @@ export const workbenchNodeOperationSchema = z.enum([
2777
2937
  'runner.profiles.list',
2778
2938
  'runner.defaults.save',
2779
2939
  'mar-agent.model.test',
2940
+ 'prompt-completion.context',
2941
+ 'prompt-completion.generate',
2942
+ 'prompt-completion.cancel',
2780
2943
  'workspace.files.list',
2781
2944
  'workspace.file.read',
2782
2945
  'workspace.file.write',
@@ -6,7 +6,7 @@ export declare const MODEL_USAGE_BATCH_LIMIT = 64;
6
6
  export declare const MODEL_USAGE_BATCH_BYTES = 262144;
7
7
  export declare const usageCountSchema: z.ZodString;
8
8
  export declare const usageRunnerSchema: z.ZodEnum<["mar-agent", "codex", "claude-code", "opencode"]>;
9
- export declare const usagePurposeSchema: z.ZodEnum<["conversation", "compact", "title", "other"]>;
9
+ export declare const usagePurposeSchema: z.ZodEnum<["conversation", "compact", "title", "prompt_completion", "other"]>;
10
10
  export declare const modelUsageCapabilitySchema: z.ZodObject<{
11
11
  apiVersion: z.ZodLiteral<1>;
12
12
  }, "strict", z.ZodTypeAny, {
@@ -67,7 +67,7 @@ export declare const modelUsageRecordSchema: z.ZodEffects<z.ZodObject<{
67
67
  requestedModel: z.ZodOptional<z.ZodString>;
68
68
  actualModel: z.ZodOptional<z.ZodString>;
69
69
  responseId: z.ZodOptional<z.ZodString>;
70
- purpose: z.ZodEnum<["conversation", "compact", "title", "other"]>;
70
+ purpose: z.ZodEnum<["conversation", "compact", "title", "prompt_completion", "other"]>;
71
71
  agentRole: z.ZodEnum<["root", "subagent"]>;
72
72
  startedAt: z.ZodNumber;
73
73
  endedAt: z.ZodOptional<z.ZodNumber>;
@@ -81,7 +81,7 @@ export declare const modelUsageRecordSchema: z.ZodEffects<z.ZodObject<{
81
81
  }, "strict", z.ZodTypeAny, {
82
82
  revision: number;
83
83
  requestId: string;
84
- purpose: "conversation" | "compact" | "title" | "other";
84
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
85
85
  runId: string;
86
86
  sessionId: string;
87
87
  scopeId: string;
@@ -107,7 +107,7 @@ export declare const modelUsageRecordSchema: z.ZodEffects<z.ZodObject<{
107
107
  }, {
108
108
  revision: number;
109
109
  requestId: string;
110
- purpose: "conversation" | "compact" | "title" | "other";
110
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
111
111
  runId: string;
112
112
  sessionId: string;
113
113
  scopeId: string;
@@ -133,7 +133,7 @@ export declare const modelUsageRecordSchema: z.ZodEffects<z.ZodObject<{
133
133
  }>, {
134
134
  revision: number;
135
135
  requestId: string;
136
- purpose: "conversation" | "compact" | "title" | "other";
136
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
137
137
  runId: string;
138
138
  sessionId: string;
139
139
  scopeId: string;
@@ -159,7 +159,7 @@ export declare const modelUsageRecordSchema: z.ZodEffects<z.ZodObject<{
159
159
  }, {
160
160
  revision: number;
161
161
  requestId: string;
162
- purpose: "conversation" | "compact" | "title" | "other";
162
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
163
163
  runId: string;
164
164
  sessionId: string;
165
165
  scopeId: string;
@@ -212,7 +212,7 @@ export declare const modelUsageBatchSchema: z.ZodObject<{
212
212
  requestedModel: z.ZodOptional<z.ZodString>;
213
213
  actualModel: z.ZodOptional<z.ZodString>;
214
214
  responseId: z.ZodOptional<z.ZodString>;
215
- purpose: z.ZodEnum<["conversation", "compact", "title", "other"]>;
215
+ purpose: z.ZodEnum<["conversation", "compact", "title", "prompt_completion", "other"]>;
216
216
  agentRole: z.ZodEnum<["root", "subagent"]>;
217
217
  startedAt: z.ZodNumber;
218
218
  endedAt: z.ZodOptional<z.ZodNumber>;
@@ -226,7 +226,7 @@ export declare const modelUsageBatchSchema: z.ZodObject<{
226
226
  }, "strict", z.ZodTypeAny, {
227
227
  revision: number;
228
228
  requestId: string;
229
- purpose: "conversation" | "compact" | "title" | "other";
229
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
230
230
  runId: string;
231
231
  sessionId: string;
232
232
  scopeId: string;
@@ -252,7 +252,7 @@ export declare const modelUsageBatchSchema: z.ZodObject<{
252
252
  }, {
253
253
  revision: number;
254
254
  requestId: string;
255
- purpose: "conversation" | "compact" | "title" | "other";
255
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
256
256
  runId: string;
257
257
  sessionId: string;
258
258
  scopeId: string;
@@ -278,7 +278,7 @@ export declare const modelUsageBatchSchema: z.ZodObject<{
278
278
  }>, {
279
279
  revision: number;
280
280
  requestId: string;
281
- purpose: "conversation" | "compact" | "title" | "other";
281
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
282
282
  runId: string;
283
283
  sessionId: string;
284
284
  scopeId: string;
@@ -304,7 +304,7 @@ export declare const modelUsageBatchSchema: z.ZodObject<{
304
304
  }, {
305
305
  revision: number;
306
306
  requestId: string;
307
- purpose: "conversation" | "compact" | "title" | "other";
307
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
308
308
  runId: string;
309
309
  sessionId: string;
310
310
  scopeId: string;
@@ -336,7 +336,7 @@ export declare const modelUsageBatchSchema: z.ZodObject<{
336
336
  record: {
337
337
  revision: number;
338
338
  requestId: string;
339
- purpose: "conversation" | "compact" | "title" | "other";
339
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
340
340
  runId: string;
341
341
  sessionId: string;
342
342
  scopeId: string;
@@ -368,7 +368,7 @@ export declare const modelUsageBatchSchema: z.ZodObject<{
368
368
  record: {
369
369
  revision: number;
370
370
  requestId: string;
371
- purpose: "conversation" | "compact" | "title" | "other";
371
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
372
372
  runId: string;
373
373
  sessionId: string;
374
374
  scopeId: string;
@@ -402,7 +402,7 @@ export declare const modelUsageBatchSchema: z.ZodObject<{
402
402
  record: {
403
403
  revision: number;
404
404
  requestId: string;
405
- purpose: "conversation" | "compact" | "title" | "other";
405
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
406
406
  runId: string;
407
407
  sessionId: string;
408
408
  scopeId: string;
@@ -437,7 +437,7 @@ export declare const modelUsageBatchSchema: z.ZodObject<{
437
437
  record: {
438
438
  revision: number;
439
439
  requestId: string;
440
- purpose: "conversation" | "compact" | "title" | "other";
440
+ purpose: "conversation" | "compact" | "title" | "prompt_completion" | "other";
441
441
  runId: string;
442
442
  sessionId: string;
443
443
  scopeId: string;
@@ -508,12 +508,12 @@ export declare const personalUsageQuerySchema: z.ZodEffects<z.ZodObject<{
508
508
  runner: z.ZodOptional<z.ZodEnum<["mar-agent", "codex", "claude-code", "opencode"]>>;
509
509
  model: z.ZodOptional<z.ZodString>;
510
510
  mode: z.ZodOptional<z.ZodEnum<["work", "conversation"]>>;
511
- purpose: z.ZodOptional<z.ZodEnum<["conversation", "compact", "title", "other"]>>;
511
+ purpose: z.ZodOptional<z.ZodEnum<["conversation", "compact", "title", "prompt_completion", "other"]>>;
512
512
  }, "strict", z.ZodTypeAny, {
513
513
  from: number;
514
514
  to: number;
515
515
  timeZone: string;
516
- purpose?: "conversation" | "compact" | "title" | "other" | undefined;
516
+ purpose?: "conversation" | "compact" | "title" | "prompt_completion" | "other" | undefined;
517
517
  mode?: "conversation" | "work" | undefined;
518
518
  runner?: "mar-agent" | "codex" | "claude-code" | "opencode" | undefined;
519
519
  model?: string | undefined;
@@ -521,7 +521,7 @@ export declare const personalUsageQuerySchema: z.ZodEffects<z.ZodObject<{
521
521
  from: number;
522
522
  to: number;
523
523
  timeZone: string;
524
- purpose?: "conversation" | "compact" | "title" | "other" | undefined;
524
+ purpose?: "conversation" | "compact" | "title" | "prompt_completion" | "other" | undefined;
525
525
  mode?: "conversation" | "work" | undefined;
526
526
  runner?: "mar-agent" | "codex" | "claude-code" | "opencode" | undefined;
527
527
  model?: string | undefined;
@@ -529,7 +529,7 @@ export declare const personalUsageQuerySchema: z.ZodEffects<z.ZodObject<{
529
529
  from: number;
530
530
  to: number;
531
531
  timeZone: string;
532
- purpose?: "conversation" | "compact" | "title" | "other" | undefined;
532
+ purpose?: "conversation" | "compact" | "title" | "prompt_completion" | "other" | undefined;
533
533
  mode?: "conversation" | "work" | undefined;
534
534
  runner?: "mar-agent" | "codex" | "claude-code" | "opencode" | undefined;
535
535
  model?: string | undefined;
@@ -537,7 +537,7 @@ export declare const personalUsageQuerySchema: z.ZodEffects<z.ZodObject<{
537
537
  from: number;
538
538
  to: number;
539
539
  timeZone: string;
540
- purpose?: "conversation" | "compact" | "title" | "other" | undefined;
540
+ purpose?: "conversation" | "compact" | "title" | "prompt_completion" | "other" | undefined;
541
541
  mode?: "conversation" | "work" | undefined;
542
542
  runner?: "mar-agent" | "codex" | "claude-code" | "opencode" | undefined;
543
543
  model?: string | undefined;
@@ -8,7 +8,13 @@ const identifier = z.string().min(1).max(256);
8
8
  const time = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
9
9
  export const usageCountSchema = z.string().regex(/^(0|[1-9][0-9]{0,37})$/);
10
10
  export const usageRunnerSchema = z.enum(['mar-agent', 'codex', 'claude-code', 'opencode']);
11
- export const usagePurposeSchema = z.enum(['conversation', 'compact', 'title', 'other']);
11
+ export const usagePurposeSchema = z.enum([
12
+ 'conversation',
13
+ 'compact',
14
+ 'title',
15
+ 'prompt_completion',
16
+ 'other'
17
+ ]);
12
18
  export const modelUsageCapabilitySchema = z.object({ apiVersion: z.literal(1) }).strict();
13
19
  /** A non-executable assertion, signed and verified only by the Server. */
14
20
  export const modelUsageGrantClaimsSchema = z
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/protocol",
3
- "version": "0.10.20",
3
+ "version": "0.10.22",
4
4
  "description": "Shared runtime protocol schemas for MyAgentRoam.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",