omp-superagent 0.1.7 → 0.1.8

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.
Files changed (52) hide show
  1. package/DESIGN.md +21 -14
  2. package/README.ko.md +33 -15
  3. package/README.md +35 -14
  4. package/THIRD_PARTY_NOTICES.md +3 -3
  5. package/config.example.json +2 -1
  6. package/docs/OPERATIONS.md +232 -74
  7. package/docs/design/execution.md +54 -10
  8. package/docs/design/messaging.md +177 -43
  9. package/docs/discord-voice.md +8 -4
  10. package/docs/releases/0.1.8.md +21 -0
  11. package/gateway/bin/omp-gateway-darwin-arm64 +0 -0
  12. package/gateway/bin/omp-gateway-darwin-x64 +0 -0
  13. package/gateway/bin/omp-gateway-linux-arm64 +0 -0
  14. package/gateway/bin/omp-gateway-linux-x64 +0 -0
  15. package/host-owner/bin/omp-host-owner-darwin-arm64 +0 -0
  16. package/host-owner/bin/omp-host-owner-darwin-x64 +0 -0
  17. package/host-owner/bin/omp-host-owner-linux-arm64 +0 -0
  18. package/host-owner/bin/omp-host-owner-linux-x64 +0 -0
  19. package/package.json +8 -8
  20. package/scripts/ci.ts +3 -3
  21. package/scripts/test-omp.sh +2 -1
  22. package/src/cli.ts +3 -0
  23. package/src/config.ts +5 -0
  24. package/src/contracts.ts +26 -5
  25. package/src/cron-jobs.ts +443 -19
  26. package/src/cron-pr-intake.ts +257 -0
  27. package/src/discord-markdown.ts +350 -123
  28. package/src/extension.ts +9 -1
  29. package/src/head-quota.ts +80 -0
  30. package/src/head-recovery.ts +40 -1
  31. package/src/host-extension.ts +120 -4
  32. package/src/host-protocol.ts +11 -0
  33. package/src/host-sdk-helper.ts +105 -10
  34. package/src/host.ts +111 -29
  35. package/src/installed-omp.ts +116 -4
  36. package/src/managed-ulw.ts +137 -24
  37. package/src/messenger-command-catalog.json +1 -1
  38. package/src/native-presets.ts +32 -5
  39. package/src/omp-usage.ts +254 -36
  40. package/src/pr-github.ts +4 -2
  41. package/src/pr-intake-automation.ts +316 -0
  42. package/src/pr-intake-comment.ts +226 -0
  43. package/src/pr-intake-fix.ts +233 -0
  44. package/src/pr-intake-github.ts +480 -0
  45. package/src/pr-intake-material.ts +230 -0
  46. package/src/pr-intake-mode.ts +59 -0
  47. package/src/pr-intake-review.ts +397 -0
  48. package/src/pr-intake-tree.ts +69 -0
  49. package/src/pr-intake-work.ts +29 -0
  50. package/src/runtime.ts +1504 -192
  51. package/src/store.ts +249 -49
  52. package/src/topic-history.ts +30 -17
package/src/contracts.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import type { ModelPreset as NativeModelPreset } from "@oh-my-pi/pi-coding-agent/config/model-settings";
2
2
  import type { LaneEvidence, LaneReport, LaneWaitTarget } from "./lane-report";
3
3
  import type { CronUpdate } from "./cron-jobs";
4
+ import type { ReviewRound } from "./pr-intake-review";
4
5
  import type { GroupReply, GroupRequest } from "./group-policy";
5
6
  import type { StagedResultAttachment } from "./result-attachment";
6
7
  import type { RemotePlacement } from "./worker-wire";
8
+ import type { OmpResetAccount } from "./omp-usage";
7
9
 
8
10
  /** Coordination records only. OMP owns transcripts and execution state. */
9
11
  export type Platform = "discord" | "telegram" | "slack";
@@ -38,6 +40,9 @@ export function physicalRouteKey(route: Route): string {
38
40
  return routeKey(physicalRoute(route));
39
41
  }
40
42
 
43
+ /** Store meta key: owner inputs acknowledged to Gateway whose topic routing is still pending, in delivery order. */
44
+ export const DEFERRED_ROUTING_META = "intake:deferred-routing";
45
+
41
46
  export interface Attachment {
42
47
  id: string;
43
48
  name: string;
@@ -113,6 +118,8 @@ export interface Inbound {
113
118
  readonly cardId: string;
114
119
  readonly group: number;
115
120
  readonly option: number;
121
+ /** Emitted only by the reset picker's separate Confirm action. */
122
+ readonly confirmed?: true;
116
123
  };
117
124
  text: string;
118
125
  /** Physical Discord content when `text` is an addressed command or a confirmed voice draft. */
@@ -226,6 +233,7 @@ export type HeadPicker = {
226
233
  } & (
227
234
  | { readonly kind: "model"; readonly currentProvider?: string }
228
235
  | { readonly kind: "effort"; readonly forModel: LaneModel }
236
+ | { readonly kind: "usage-reset"; readonly accounts: readonly Pick<OmpResetAccount, "target" | "label" | "identity" | "offer">[] }
229
237
  );
230
238
 
231
239
  export interface KickoffHold {
@@ -238,6 +246,10 @@ export interface OutputRecord {
238
246
  route: Route;
239
247
  /** Durable original owner message, only in the same physical conversation. */
240
248
  replyTo?: MessageReference;
249
+ /** Discord status message replaced in place; fixed when the output is claimed. */
250
+ readonly editOf?: MessageReference;
251
+ /** Initial Discord status message; overflow falls back to one attachment instead of multi-message split. */
252
+ readonly status?: boolean;
241
253
  readonly picker?: HeadPicker;
242
254
  readonly resultAttachment?: StagedResultAttachment;
243
255
  text: string;
@@ -303,9 +315,13 @@ export interface HeadRecoveryEffect {
303
315
  }
304
316
 
305
317
  export interface StorePort {
318
+ /** Typed, noninteractive work on the confirmed bot offer; never valid for ordinary owner intake. */
319
+ receivePrWork(input: Inbound, target: string | null, round: ReviewRound): boolean;
306
320
  receive(input: Inbound, target: string | null, metadata?: Readonly<Record<string, string>>, workflow?: WorkflowActivation | null): boolean;
307
321
  input(id: string): InputRecord | null;
308
322
  ownerSource(id: string): InputRecord | null;
323
+ /** Manager handoff's verified reply route, pinned if a bound reply joined its run. */
324
+ laneReplyRoute(input: InputRecord, source: InputRecord): Route;
309
325
  /** Exact original owner and authorized delivery route for a topic-owned lane input. */
310
326
  topicDelivery(id: string): { readonly source: InputRecord; readonly route: Route; readonly outputSourceId: string } | null;
311
327
  /** Whether an unowned dialog could belong to a durable topic admission on this native generation. */
@@ -316,6 +332,11 @@ export interface StorePort {
316
332
  tryAutoTopicChoice(input: InputRecord, deadline: number, pin: string): boolean;
317
333
  inputs(target?: string, state?: ActiveInputState): InputRecord[];
318
334
  hasInput(target: string, state: ActiveInputState): boolean;
335
+ /** Latest admitted lane run, excluding inputs joined to another run. */
336
+ latestLaneRun(target: string): InputRecord | null;
337
+ /** A successful lane run still has an unresolved final report or delivery. */
338
+ hasPendingLaneResult(target: string): boolean;
339
+ hasPendingLanePlacement(target: string): boolean;
319
340
  /** An uncertain HEAD input with a nonempty original native-owner record. */
320
341
  hasHeadRecoveryInput(): boolean;
321
342
  /** No automatic head replacement while an original HEAD delivery is unresolved. */
@@ -342,19 +363,19 @@ export interface StorePort {
342
363
  bindInput(id: string, target: string): void;
343
364
  submit(id: string, requestId: string, generation: number): boolean;
344
365
  /** Nonterminal native assistant observation; never settles or dispatches its owner. */
345
- progress(id: string, generation: number, sessionId: string, eventId: string, text: string): boolean;
366
+ progress(id: string, generation: number, sessionId: string, eventId: string, text: string, editInPlace?: boolean): boolean;
346
367
  recordLaneReport(id: string, generation: number, sessionId: string, eventId: string, report: LaneReport, observedAt?: number): boolean;
347
368
  resolveLaneWaiting(id: string, generation: number, sessionId: string, kind: "tool" | "approval", nativeId: string): boolean;
348
- settle(id: string, state: "done" | "uncertain" | "cancelled", output?: Pick<OutputRecord, "id" | "text" | "picker">, headModel?: HeadModelChange): boolean;
369
+ settle(id: string, state: "done" | "uncertain" | "cancelled", output?: Pick<OutputRecord, "id" | "text" | "picker">, headModel?: HeadModelChange, editInPlace?: boolean): boolean;
349
370
  settleCronControl(inputId: string, update: CronUpdate): boolean;
350
371
  resolveLaneInput(controlId: string, laneId: string, inputId: string, output: { readonly id: string; readonly text: string }): boolean;
351
372
  headRecoveryEffects(inputId: string): HeadRecoveryEffect[];
352
373
  prepareHeadRecovery(attempt: HeadRecoveryAttempt): boolean;
353
374
  commitHeadRecovery(expected: HeadRecoveryAttempt, decided: HeadRecoveryAttempt): boolean;
354
- queueOutput(output: Omit<OutputRecord, "state" | "remoteId" | "error">): boolean;
375
+ queueOutput(output: Omit<OutputRecord, "state" | "remoteId" | "error" | "editOf">): boolean;
355
376
  output(id: string): OutputRecord | null;
356
- outputs(): OutputRecord[];
357
- claimOutput(id: string): boolean;
377
+ outputs(physicalRoute?: string): OutputRecord[];
378
+ claimOutput(id: string, editInPlace?: boolean): boolean;
358
379
  finishOutput(id: string, state: "sent" | "uncertain" | "failed" | "pending", remoteId?: string, error?: string): void;
359
380
  createLane(lane: Lane & { model: LaneModel; modelReason: string }, sourceId: string): Lane;
360
381
  lane(id: string): Lane | null;