omp-superagent 0.1.17 → 0.1.19
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/DESIGN.md +15 -12
- package/config.example.json +4 -1
- package/docs/OPERATIONS.en.md +205 -59
- package/docs/OPERATIONS.md +173 -47
- package/docs/design/execution.md +119 -37
- package/docs/design/messaging.md +160 -45
- package/docs/releases/0.1.18.md +10 -0
- package/docs/releases/0.1.19.md +10 -0
- package/gateway/bin/omp-gateway-darwin-arm64 +0 -0
- package/gateway/bin/omp-gateway-darwin-x64 +0 -0
- package/gateway/bin/omp-gateway-linux-arm64 +0 -0
- package/gateway/bin/omp-gateway-linux-x64 +0 -0
- package/host-owner/bin/omp-host-owner-darwin-arm64 +0 -0
- package/host-owner/bin/omp-host-owner-darwin-x64 +0 -0
- package/host-owner/bin/omp-host-owner-linux-arm64 +0 -0
- package/host-owner/bin/omp-host-owner-linux-x64 +0 -0
- package/package.json +1 -1
- package/skills/head/SKILL.md +6 -5
- package/skills/head/references/model-selection.md +8 -22
- package/skills/head/references/routing.md +36 -17
- package/skills/lane/SKILL.md +24 -76
- package/skills/lane/references/workflow.md +7 -94
- package/src/cli.ts +36 -16
- package/src/config/config.ts +21 -2
- package/src/contracts.ts +66 -7
- package/src/cron/cron-jobs.ts +135 -92
- package/src/cron/cron-pr-intake.ts +18 -11
- package/src/extension.ts +25 -10
- package/src/gateway/gateway-client.ts +3 -1
- package/src/host-extension.ts +76 -8
- package/src/lane/lane-report.ts +1 -1
- package/src/lane/lane-rows.ts +2 -1
- package/src/lane/workflow.ts +12 -6
- package/src/lane-extension.ts +4 -21
- package/src/managed-super-probe.ts +21 -15
- package/src/messaging/messenger-command-catalog.json +1 -1
- package/src/messaging/messenger-commands.ts +8 -3
- package/src/messaging/result-attachment.ts +77 -19
- package/src/messaging/slack-context.ts +50 -0
- package/src/messaging/written-directives.ts +56 -0
- package/src/omp/exit-record.ts +27 -0
- package/src/omp/host-protocol.ts +20 -0
- package/src/omp/host.ts +73 -20
- package/src/omp/installed-omp.ts +15 -12
- package/src/omp/managed-super.ts +135 -65
- package/src/omp/superkit-skills.ts +15 -2
- package/src/pr/pr-intake-order.ts +62 -0
- package/src/pr/pr-intake-review.ts +49 -31
- package/src/pr/pr-intake-work.ts +3 -2
- package/src/routing/message-order.ts +22 -1
- package/src/routing/topic-request.ts +48 -4
- package/src/runtime/controller.ts +968 -338
- package/src/runtime/deferred-routing.ts +12 -4
- package/src/runtime/dm-timeline.ts +3 -3
- package/src/runtime/inbound-attachments.ts +70 -0
- package/src/runtime/local-host-fence.ts +85 -0
- package/src/runtime/model-journal.ts +14 -9
- package/src/runtime/native-frames.ts +5 -1
- package/src/runtime/result-attachments.ts +151 -24
- package/src/runtime/worker-result-download.ts +36 -0
- package/src/storage/deferred-routing.ts +25 -4
- package/src/storage/store.ts +445 -75
- package/src/worker/worker-checkout.ts +89 -9
- package/src/worker/worker-destination.ts +8 -7
- package/src/worker/worker-doctor.ts +29 -9
- package/src/worker/worker-enrollment.ts +44 -12
- package/src/worker/worker-git-startup.ts +157 -0
- package/src/worker/worker-host.ts +16 -26
- package/src/worker/worker-ledger.ts +42 -18
- package/src/worker/worker-placement-intent.ts +13 -0
- package/src/worker/worker-placement.ts +204 -28
- package/src/worker/worker-profile.ts +18 -65
- package/src/worker/worker-project-startup.ts +106 -0
- package/src/worker/worker-registration.ts +85 -30
- package/src/worker/worker-repository.ts +55 -6
- package/src/worker/worker-request.ts +13 -6
- package/src/worker/worker-result-attachments.ts +185 -0
- package/src/worker/worker-result-wire.ts +12 -0
- package/src/worker/worker-service.ts +51 -23
- package/src/worker/worker-trust.ts +19 -4
- package/src/worker/worker-wire.ts +47 -14
- package/upstream/super.json +2 -3
|
@@ -2,6 +2,7 @@ import type { Database } from "bun:sqlite";
|
|
|
2
2
|
import { deferredRecoveryCandidate, physicalRouteKey, routingConversation, type DeferredRoutingPort, type Inbound, type Lane } from "../contracts";
|
|
3
3
|
|
|
4
4
|
const LEGACY_QUEUE = "intake:deferred-routing";
|
|
5
|
+
const SLACK_CHOICE_CLOCK = "intake:slack-choice-clock";
|
|
5
6
|
const SCHEMA = `
|
|
6
7
|
CREATE TABLE IF NOT EXISTS deferred_routing (
|
|
7
8
|
sequence INTEGER PRIMARY KEY AUTOINCREMENT, id TEXT NOT NULL UNIQUE,
|
|
@@ -34,9 +35,12 @@ interface IdRow { readonly id: string }
|
|
|
34
35
|
export interface DeferredChoiceRow {
|
|
35
36
|
readonly id: string;
|
|
36
37
|
readonly text: string;
|
|
38
|
+
readonly routingText: string | null;
|
|
39
|
+
readonly verifiedSlackBody: 0 | 1;
|
|
37
40
|
readonly messageId: string | null;
|
|
38
41
|
readonly replyId: string | null;
|
|
39
42
|
readonly authoredAt: number;
|
|
43
|
+
readonly attached: 0 | 1;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
export class DeferredRoutingQueue implements DeferredRoutingPort {
|
|
@@ -44,6 +48,18 @@ export class DeferredRoutingQueue implements DeferredRoutingPort {
|
|
|
44
48
|
private readonly reconcileInbound: (existing: Inbound, incoming: Inbound) => Inbound | null) {
|
|
45
49
|
this.db.transaction(() => {
|
|
46
50
|
this.db.run(SCHEMA);
|
|
51
|
+
if (!this.db.query("SELECT 1 FROM metadata WHERE key = ?").get(SLACK_CHOICE_CLOCK)) {
|
|
52
|
+
// Older HEADs saved fractional Slack times in the payload but left the
|
|
53
|
+
// choice index null. Recover pending messages before the drain starts.
|
|
54
|
+
this.db.run(`UPDATE deferred_routing
|
|
55
|
+
SET choice_at = json_extract(data, '$.receivedAt')
|
|
56
|
+
WHERE choice_at IS NULL AND message_id IS NOT NULL
|
|
57
|
+
AND json_extract(data, '$.route.platform') = 'slack'
|
|
58
|
+
AND json_type(data, '$.pickerSelection') IS NULL
|
|
59
|
+
AND json_type(data, '$.receivedAt') = 'real'
|
|
60
|
+
AND abs(json_extract(data, '$.receivedAt')) <= 9007199254740991`);
|
|
61
|
+
this.db.run("INSERT INTO metadata (key, value) VALUES (?, 'true')", [SLACK_CHOICE_CLOCK]);
|
|
62
|
+
}
|
|
47
63
|
const legacy = this.db.query<{ value: string }, [string]>("SELECT value FROM metadata WHERE key = ?").get(LEGACY_QUEUE);
|
|
48
64
|
if (!legacy) return;
|
|
49
65
|
const queue: readonly Inbound[] = JSON.parse(legacy.value);
|
|
@@ -56,7 +72,8 @@ export class DeferredRoutingQueue implements DeferredRoutingPort {
|
|
|
56
72
|
enqueue(input: Inbound): void {
|
|
57
73
|
const candidate = deferredRecoveryCandidate(input.text);
|
|
58
74
|
const choiceAt = !input.pickerSelection && (typeof input.messageId === "string" || typeof input.interactionId === "string")
|
|
59
|
-
&& Number.isSafeInteger(input.
|
|
75
|
+
&& Number.isSafeInteger(input.route.platform === "slack" ? Math.trunc(input.receivedAt) : input.receivedAt)
|
|
76
|
+
? input.receivedAt : null;
|
|
60
77
|
this.db.query(`INSERT INTO deferred_routing
|
|
61
78
|
(id, conversation, physical_route, message_id, priority, stop_lane, choice_at, data)
|
|
62
79
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(
|
|
@@ -104,7 +121,7 @@ export class DeferredRoutingQueue implements DeferredRoutingPort {
|
|
|
104
121
|
}
|
|
105
122
|
|
|
106
123
|
*earlierLaneStops(lane: Pick<Lane, "id" | "route">, beforeId: string): Iterable<Inbound> {
|
|
107
|
-
// A bare stop binds only by its exact
|
|
124
|
+
// A bare stop binds only by its exact physical work thread. Named stops
|
|
108
125
|
// can come from any conversation but need not read other lanes' candidates.
|
|
109
126
|
const rows = this.db.query<DataRow, [string, string, string]>(`
|
|
110
127
|
SELECT data, sequence FROM deferred_routing INDEXED BY deferred_routing_named_stop WHERE stop_lane = ?2 AND ${EARLIER}
|
|
@@ -134,8 +151,12 @@ export class DeferredRoutingQueue implements DeferredRoutingPort {
|
|
|
134
151
|
|
|
135
152
|
choices(input: Pick<Inbound, "id" | "route" | "receivedAt">, deadline: number): Iterable<DeferredChoiceRow> {
|
|
136
153
|
return this.db.query<DeferredChoiceRow, [string, number, number, string]>(`
|
|
137
|
-
SELECT id, json_extract(data, '$.text') AS text,
|
|
138
|
-
|
|
154
|
+
SELECT id, json_extract(data, '$.text') AS text, json_extract(data, '$.routingText') AS routingText,
|
|
155
|
+
json_type(data, '$.slackVerifiedRoutingBody') IS 'true' AS verifiedSlackBody, message_id AS messageId,
|
|
156
|
+
json_extract(data, '$.reply.messageId') AS replyId, choice_at AS authoredAt,
|
|
157
|
+
coalesce(json_extract(data, '$.unresolvedReply'), 0)
|
|
158
|
+
OR json_type(data, '$.attachments') IS NOT 'array'
|
|
159
|
+
OR json_array_length(data, '$.attachments') > 0 AS attached
|
|
139
160
|
FROM deferred_routing INDEXED BY deferred_routing_choice
|
|
140
161
|
WHERE physical_route = ? AND choice_at BETWEEN ? AND ? AND id <> ?
|
|
141
162
|
`).iterate(physicalRouteKey(input.route), input.receivedAt, deadline, input.id);
|