@peer-agent/protocol 0.1.0-rc.44 → 0.1.0-rc.45

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.
@@ -102,6 +102,7 @@ export interface WorkSessionConversationMeta extends SessionQueueFacts {
102
102
  readonly obligationDisposition?: 'indexed' | 'suspended' | 'current';
103
103
  }
104
104
  export interface WorkSession extends SessionQueueFacts {
105
+ readonly followUpEpoch?: number;
105
106
  readonly executionOwnership?: ExecutionOwnership;
106
107
  readonly followUp?: import('./task-overview.ts').FollowUpProjection;
107
108
  readonly verificationProgress?: VerificationProgress;
package/dist/index.d.ts CHANGED
@@ -935,3 +935,4 @@ export * from './interactive-result.ts';
935
935
  export * from './interactive-verification.ts';
936
936
  export { normalizeConversationExecution, conversationExecutionPermitsNewRun } from './conversation-execution.ts';
937
937
  export type { ConversationExecutionIdentity, ConversationExecution } from './conversation-execution.ts';
938
+ export * from './quiet-reply.js';
package/dist/index.js CHANGED
@@ -66,3 +66,4 @@ export * from "./input-prediction.js";
66
66
  export * from "./interactive-result.js";
67
67
  export * from "./interactive-verification.js";
68
68
  export { normalizeConversationExecution, conversationExecutionPermitsNewRun } from "./conversation-execution.js";
69
+ export * from './quiet-reply.js';
@@ -0,0 +1,9 @@
1
+ export declare const QUIET_REPLY_MARKER: "NO_REPLY";
2
+ export interface QuietReplyParse {
3
+ readonly isQuiet: boolean;
4
+ readonly leadingText: string;
5
+ readonly isPureQuiet: boolean;
6
+ }
7
+ export declare function parseQuietReply(raw: string): QuietReplyParse;
8
+ export declare function isQuietReply(raw: string): boolean;
9
+ export declare function withoutGrowingQuietMarker(raw: string): string;
@@ -0,0 +1,43 @@
1
+ export const QUIET_REPLY_MARKER = 'NO_REPLY';
2
+ // Match Rust char::is_whitespace and char::is_alphanumeric, including non-ASCII letters.
3
+ const alphanumeric = /[\p{Alphabetic}\p{Number}]/u;
4
+ const markup = /^[`*_]*/u;
5
+ const validSuffix = /^[`*_.!]*$/u;
6
+ const trimEnd = (text) => text.replace(/\p{White_Space}+$/u, '');
7
+ function inlineReference(before, decorations) {
8
+ return decorations.includes('`') && alphanumeric.test(before.slice(before.lastIndexOf('\n') + 1));
9
+ }
10
+ function wordParts(text, separator) {
11
+ let start = text.length;
12
+ while (start > 0 && !separator.test(text[start - 1] ?? ''))
13
+ start--;
14
+ const word = text.slice(start);
15
+ const before = text.slice(0, start);
16
+ const decorations = markup.exec(word)?.[0] ?? '';
17
+ return { before, decorations, bare: word.slice(decorations.length) };
18
+ }
19
+ function exactMarker(bare) {
20
+ return bare.startsWith(QUIET_REPLY_MARKER) && validSuffix.test(bare.slice(QUIET_REPLY_MARKER.length));
21
+ }
22
+ export function parseQuietReply(raw) {
23
+ let remaining = trimEnd(raw);
24
+ let isQuiet = false;
25
+ while (true) {
26
+ const { before, decorations, bare } = wordParts(remaining, /\p{White_Space}/u);
27
+ if (!exactMarker(bare) || inlineReference(before, decorations))
28
+ break;
29
+ isQuiet = true;
30
+ remaining = trimEnd(before);
31
+ }
32
+ const isPureQuiet = isQuiet && !alphanumeric.test(remaining);
33
+ return { isQuiet, isPureQuiet, leadingText: isPureQuiet ? '' : isQuiet ? remaining : raw };
34
+ }
35
+ export function isQuietReply(raw) {
36
+ return parseQuietReply(raw).isQuiet;
37
+ }
38
+ export function withoutGrowingQuietMarker(raw) {
39
+ const { before, decorations, bare } = wordParts(trimEnd(raw), /[ \n\t]/u);
40
+ return bare && (QUIET_REPLY_MARKER.startsWith(bare) || exactMarker(bare)) && !inlineReference(before, decorations)
41
+ ? trimEnd(before)
42
+ : raw;
43
+ }
@@ -1,6 +1,7 @@
1
1
  import type { ProjectInputAttachment } from './delegation.ts';
2
2
  import { type ResourceFeedback } from './resource-feedback.ts';
3
3
  export declare const INTERACTIVE_FEEDBACK_TRANSPORT = "peer-interactive-selection-1";
4
+ export declare const INPUT_ATTACHMENT_LIMIT = 100;
4
5
  export declare function isInteractiveFeedbackAttachment(raw: unknown): boolean;
5
6
  export declare function interactiveFeedbackAttachment(raw: unknown): ProjectInputAttachment;
6
7
  export declare function readInteractiveFeedbackAttachment(raw: unknown): ResourceFeedback | undefined;
@@ -1,5 +1,6 @@
1
1
  import { normalizeResourceFeedback, normalizeResourceFeedbackList } from "./resource-feedback.js";
2
2
  export const INTERACTIVE_FEEDBACK_TRANSPORT = 'peer-interactive-selection-1';
3
+ export const INPUT_ATTACHMENT_LIMIT = 100;
3
4
  const fail = (code) => { throw Object.assign(new TypeError(code), { code }); };
4
5
  const bytes = (value) => new TextEncoder().encode(value).byteLength;
5
6
  const equal = (a, b) => JSON.stringify(a) === JSON.stringify(b);
@@ -74,7 +75,7 @@ export function encodeResourceFeedbackTransport(rawRows, rawAttachments = []) {
74
75
  if (!previous)
75
76
  attachments.push(attachment);
76
77
  }
77
- if (attachments.length > 8)
78
+ if (attachments.length > INPUT_ATTACHMENT_LIMIT)
78
79
  return fail('RESOURCE_FEEDBACK_ATTACHMENT_LIMIT');
79
80
  return { ...(legacy.length ? { resourceFeedback: legacy } : {}), ...(attachments.length ? { attachments } : {}) };
80
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peer-agent/protocol",
3
- "version": "0.1.0-rc.44",
3
+ "version": "0.1.0-rc.45",
4
4
  "description": "Shared host-neutral protocol contracts for Peer Agent runtimes and clients.",
5
5
  "type": "module",
6
6
  "license": "MIT",