@otto-code/protocol 0.7.5 → 0.7.6

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.
@@ -2,6 +2,7 @@ export type AgentAttentionReason = "finished" | "error" | "permission";
2
2
  export interface AgentAttentionNotificationData {
3
3
  [key: string]: unknown;
4
4
  serverId: string;
5
+ workspaceId?: string;
5
6
  agentId: string;
6
7
  reason: AgentAttentionReason;
7
8
  }
@@ -13,6 +14,7 @@ export interface AgentAttentionNotificationPayload {
13
14
  interface BuildAgentAttentionNotificationPayloadInput {
14
15
  reason: AgentAttentionReason;
15
16
  serverId: string;
17
+ workspaceId: string;
16
18
  agentId: string;
17
19
  assistantMessage?: string | null;
18
20
  permissionRequest?: NotificationPermissionRequest | null;
@@ -180,6 +180,7 @@ export function buildAgentAttentionNotificationPayload(input) {
180
180
  body,
181
181
  data: {
182
182
  serverId: input.serverId,
183
+ workspaceId: input.workspaceId,
183
184
  agentId: input.agentId,
184
185
  reason: input.reason,
185
186
  },
@@ -0,0 +1,8 @@
1
+ export interface AgentDeepLinkTarget {
2
+ serverId: string;
3
+ agentId: string;
4
+ }
5
+ export declare function buildAgentDeepLinkRoute(target: AgentDeepLinkTarget): `/h/${string}/agent/${string}`;
6
+ export declare function buildAgentDeepLink(target: AgentDeepLinkTarget): string;
7
+ export declare function parseAgentDeepLink(input: string): AgentDeepLinkTarget | null;
8
+ //# sourceMappingURL=agent-deep-link.d.ts.map
@@ -0,0 +1,49 @@
1
+ function normalizeSegment(value) {
2
+ return value.trim();
3
+ }
4
+ function normalizeAgentDeepLinkTarget(target) {
5
+ const serverId = normalizeSegment(target.serverId);
6
+ const agentId = normalizeSegment(target.agentId);
7
+ if (!serverId || !agentId) {
8
+ throw new Error("Agent deep links require a server ID and agent ID.");
9
+ }
10
+ return { serverId, agentId };
11
+ }
12
+ export function buildAgentDeepLinkRoute(target) {
13
+ const { serverId, agentId } = normalizeAgentDeepLinkTarget(target);
14
+ return `/h/${encodeURIComponent(serverId)}/agent/${encodeURIComponent(agentId)}`;
15
+ }
16
+ export function buildAgentDeepLink(target) {
17
+ return `otto:/${buildAgentDeepLinkRoute(target)}`;
18
+ }
19
+ export function parseAgentDeepLink(input) {
20
+ let url;
21
+ try {
22
+ url = new URL(input);
23
+ }
24
+ catch {
25
+ return null;
26
+ }
27
+ if (url.protocol !== "otto:" ||
28
+ url.hostname !== "h" ||
29
+ url.username ||
30
+ url.password ||
31
+ url.port ||
32
+ url.search ||
33
+ url.hash) {
34
+ return null;
35
+ }
36
+ const segments = url.pathname.split("/").filter(Boolean);
37
+ if (segments.length !== 3 || segments[1] !== "agent") {
38
+ return null;
39
+ }
40
+ try {
41
+ const serverId = normalizeSegment(decodeURIComponent(segments[0] ?? ""));
42
+ const agentId = normalizeSegment(decodeURIComponent(segments[2] ?? ""));
43
+ return serverId && agentId ? { serverId, agentId } : null;
44
+ }
45
+ catch {
46
+ return null;
47
+ }
48
+ }
49
+ //# sourceMappingURL=agent-deep-link.js.map
@@ -110,6 +110,7 @@ export interface ProviderSnapshotEntry {
110
110
  provider: AgentProvider;
111
111
  status: ProviderStatus;
112
112
  enabled: boolean;
113
+ source?: "builtin" | "custom";
113
114
  error?: string;
114
115
  models?: AgentModelDefinition[];
115
116
  modes?: AgentMode[];
@@ -373,6 +374,7 @@ export type AgentTimelineItem = {
373
374
  type: "user_message";
374
375
  text: string;
375
376
  messageId?: string;
377
+ clientMessageId?: string;
376
378
  } | {
377
379
  type: "assistant_message";
378
380
  text: string;
@@ -13,6 +13,7 @@ export declare const FileBeginMetadataSchema: z.ZodObject<{
13
13
  "utf-8": "utf-8";
14
14
  }>;
15
15
  modifiedAt: z.ZodString;
16
+ revision: z.ZodOptional<z.ZodString>;
16
17
  fileName: z.ZodOptional<z.ZodString>;
17
18
  }, z.core.$strip>;
18
19
  export interface FileBegin {
@@ -10,6 +10,7 @@ export const FileBeginMetadataSchema = z.object({
10
10
  size: z.number().int().nonnegative(),
11
11
  encoding: z.enum(["utf-8", "binary"]),
12
12
  modifiedAt: z.string(),
13
+ revision: z.string().optional(),
13
14
  fileName: z.string().optional(),
14
15
  });
15
16
  export function encodeFileTransferFrame(input) {
@@ -1,7 +1,10 @@
1
1
  export declare const CLIENT_CAPS: {
2
+ readonly selectiveAgentTimeline: "selective_agent_timeline";
2
3
  readonly reasoningMergeEnum: "reasoning_merge_enum";
3
4
  readonly customModeIcons: "custom_mode_icons";
4
5
  readonly terminalReflowableSnapshot: "terminal_reflowable_snapshot";
6
+ readonly providerSubagents: "provider_subagents";
7
+ readonly projectUpdates: "project_updates";
5
8
  readonly browserHost: "browser_host";
6
9
  };
7
10
  export type ClientCapability = (typeof CLIENT_CAPS)[keyof typeof CLIENT_CAPS];
@@ -1,4 +1,8 @@
1
1
  export const CLIENT_CAPS = {
2
+ // COMPAT(selectiveAgentTimeline): added in v0.1.106. Capable clients receive
3
+ // agent streams only for their explicit viewed set. Remove after 2027-01-12
4
+ // once the supported client floor is >= v0.1.106.
5
+ selectiveAgentTimeline: "selective_agent_timeline",
2
6
  reasoningMergeEnum: "reasoning_merge_enum",
3
7
  // COMPAT(customModeIcons): added in v0.1.84. Old clients pin AgentModeIcon to
4
8
  // a closed enum and crash rendering unknown values; daemon downgrades icons
@@ -11,6 +15,11 @@ export const CLIENT_CAPS = {
11
15
  // Old clients use a strict TerminalState schema and would reject the extra fields.
12
16
  // Drop the gate (always send the flags) when floor >= v0.1.88.
13
17
  terminalReflowableSnapshot: "terminal_reflowable_snapshot",
18
+ // COMPAT(providerSubagents): added in v0.1.107. The daemon emits provider-owned
19
+ // child descriptors and timelines only to clients that understand the new messages.
20
+ providerSubagents: "provider_subagents",
21
+ // COMPAT(projectUpdates): added in v0.1.109, remove gate after 2027-01-15.
22
+ projectUpdates: "project_updates",
14
23
  browserHost: "browser_host",
15
24
  };
16
25
  //# sourceMappingURL=client-capabilities.js.map
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Declarative manifest of the git forges Otto knows how to present, mirroring
3
+ * provider-manifest.ts. Pure build-time data shared by BOTH the client (icon,
4
+ * brand label, PR↔MR relabel) and the server (registry host-matching, prompt
5
+ * branding). It is NEVER serialized over the wire, so adding a forge here is not
6
+ * a protocol change.
7
+ *
8
+ * Keep this a pure leaf: no imports, no zod, no functions with runtime deps.
9
+ * Behavioural concerns (CLI invocation, host probing, REST adapters) live in the
10
+ * server adapter keyed by {@link ForgeDefinition.id}; this file is only the
11
+ * declarative half.
12
+ */
13
+ /**
14
+ * Declarative sign-in recipe for a forge. The client renders install/sign-in
15
+ * hints from this data alone — no per-CLI switch — so a new forge wires its auth
16
+ * UX entirely from the manifest. Behavioural auth (the actual host probe) stays
17
+ * in the server adapter; this is only what the user is told to run.
18
+ */
19
+ export interface ForgeSignInCommand {
20
+ /** Binary the user installs, e.g. "gh" — shown in the install-CLI hint. */
21
+ cli: string;
22
+ /** Full sign-in command, e.g. "gh auth login". */
23
+ command: string;
24
+ /**
25
+ * Flag that targets a self-hosted host, e.g. "--hostname". When present and a
26
+ * host is known, the client appends `${command} ${hostnameFlag} ${host}`.
27
+ * Omit when the command already targets the right host on its own.
28
+ */
29
+ hostnameFlag?: string;
30
+ }
31
+ export interface ForgeDefinition {
32
+ /** Registry id, matches the server adapter and the wire `forge` value. */
33
+ id: string;
34
+ /** Human brand name, e.g. for "Open on GitLab". */
35
+ displayName: string;
36
+ /** Short change-request noun: "PR" for GitHub, "MR" for GitLab. */
37
+ changeRequestAbbrev: string;
38
+ /** Full change-request noun: "pull request" vs "merge request". */
39
+ changeRequestNoun: string;
40
+ /** Prefix before a change-request number: "#" vs "!". */
41
+ changeRequestNumberPrefix: string;
42
+ /** Prefix before an issue number ("#" on every forge so far). */
43
+ issueNumberPrefix: string;
44
+ /** Icon key; the client falls back to a generic git icon for unknown values. */
45
+ iconKind: string;
46
+ /** Sign-in recipe, or null when the forge has no Otto-driven sign-in. */
47
+ signIn: ForgeSignInCommand | null;
48
+ /**
49
+ * Public cloud hosts this forge owns exactly. A BOUNDED list, never an
50
+ * allowlist for self-hosted detection — self-hosted/Enterprise instances are
51
+ * recognized at runtime by the adapter's host probe, not by this field.
52
+ */
53
+ cloudHosts?: string[];
54
+ }
55
+ export declare const FORGE_DEFINITIONS: ForgeDefinition[];
56
+ /** Forge definitions only present in dev builds (none today; mirrors providers). */
57
+ export declare const DEV_FORGE_DEFINITIONS: ForgeDefinition[];
58
+ export declare const FORGE_IDS: string[];
59
+ export declare function getForgeDefinition(id: string, definitions?: ForgeDefinition[]): ForgeDefinition | null;
60
+ /**
61
+ * Resolve a forge definition, synthesizing a neutral one for a forge id the
62
+ * client has never heard of (e.g. a self-hosted forge a newer daemon reports to
63
+ * an older client). The neutral shape renders generic, never GitHub-branded.
64
+ */
65
+ export declare function getForgeDefinitionOrNeutral(id: string): ForgeDefinition;
66
+ //# sourceMappingURL=forge-manifest.d.ts.map
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Declarative manifest of the git forges Otto knows how to present, mirroring
3
+ * provider-manifest.ts. Pure build-time data shared by BOTH the client (icon,
4
+ * brand label, PR↔MR relabel) and the server (registry host-matching, prompt
5
+ * branding). It is NEVER serialized over the wire, so adding a forge here is not
6
+ * a protocol change.
7
+ *
8
+ * Keep this a pure leaf: no imports, no zod, no functions with runtime deps.
9
+ * Behavioural concerns (CLI invocation, host probing, REST adapters) live in the
10
+ * server adapter keyed by {@link ForgeDefinition.id}; this file is only the
11
+ * declarative half.
12
+ */
13
+ export const FORGE_DEFINITIONS = [
14
+ {
15
+ id: "github",
16
+ displayName: "GitHub",
17
+ changeRequestAbbrev: "PR",
18
+ changeRequestNoun: "pull request",
19
+ changeRequestNumberPrefix: "#",
20
+ issueNumberPrefix: "#",
21
+ iconKind: "github",
22
+ signIn: { cli: "gh", command: "gh auth login" },
23
+ cloudHosts: ["github.com", "ssh.github.com"],
24
+ },
25
+ {
26
+ id: "gitlab",
27
+ displayName: "GitLab",
28
+ changeRequestAbbrev: "MR",
29
+ changeRequestNoun: "merge request",
30
+ changeRequestNumberPrefix: "!",
31
+ issueNumberPrefix: "#",
32
+ iconKind: "gitlab",
33
+ signIn: { cli: "glab", command: "glab auth login", hostnameFlag: "--hostname" },
34
+ cloudHosts: ["gitlab.com"],
35
+ },
36
+ {
37
+ id: "gitea",
38
+ displayName: "Gitea",
39
+ changeRequestAbbrev: "PR",
40
+ changeRequestNoun: "pull request",
41
+ changeRequestNumberPrefix: "#",
42
+ issueNumberPrefix: "#",
43
+ iconKind: "gitea",
44
+ signIn: { cli: "tea", command: "tea login add" },
45
+ cloudHosts: ["gitea.com"],
46
+ },
47
+ {
48
+ id: "forgejo",
49
+ displayName: "Forgejo",
50
+ changeRequestAbbrev: "PR",
51
+ changeRequestNoun: "pull request",
52
+ changeRequestNumberPrefix: "#",
53
+ issueNumberPrefix: "#",
54
+ iconKind: "forgejo",
55
+ signIn: { cli: "tea", command: "tea login add" },
56
+ },
57
+ {
58
+ id: "codeberg",
59
+ displayName: "Codeberg",
60
+ changeRequestAbbrev: "PR",
61
+ changeRequestNoun: "pull request",
62
+ changeRequestNumberPrefix: "#",
63
+ issueNumberPrefix: "#",
64
+ iconKind: "codeberg",
65
+ signIn: { cli: "tea", command: "tea login add" },
66
+ cloudHosts: ["codeberg.org"],
67
+ },
68
+ ];
69
+ /** Forge definitions only present in dev builds (none today; mirrors providers). */
70
+ export const DEV_FORGE_DEFINITIONS = [];
71
+ export const FORGE_IDS = FORGE_DEFINITIONS.map((definition) => definition.id);
72
+ export function getForgeDefinition(id, definitions = [...FORGE_DEFINITIONS, ...DEV_FORGE_DEFINITIONS]) {
73
+ return definitions.find((definition) => definition.id === id) ?? null;
74
+ }
75
+ /**
76
+ * Resolve a forge definition, synthesizing a neutral one for a forge id the
77
+ * client has never heard of (e.g. a self-hosted forge a newer daemon reports to
78
+ * an older client). The neutral shape renders generic, never GitHub-branded.
79
+ */
80
+ export function getForgeDefinitionOrNeutral(id) {
81
+ return (getForgeDefinition(id) ?? {
82
+ id,
83
+ displayName: id,
84
+ changeRequestAbbrev: "PR",
85
+ changeRequestNoun: "pull request",
86
+ changeRequestNumberPrefix: "#",
87
+ issueNumberPrefix: "#",
88
+ iconKind: "git",
89
+ signIn: null,
90
+ });
91
+ }
92
+ //# sourceMappingURL=forge-manifest.js.map