@dsh-ray/assistant-delivery 0.0.1-seed.0 → 0.2.1
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/LICENSE +21 -0
- package/README.md +610 -1
- package/bin/dsh-restart-supervisor.js +102 -0
- package/cordis.patch.yml +29 -0
- package/lib/acceptance.d.ts +54 -0
- package/lib/acceptance.d.ts.map +1 -0
- package/lib/acceptance.js +2 -0
- package/lib/acceptance.js.map +1 -0
- package/lib/agent-runtime.d.ts +247 -0
- package/lib/agent-runtime.d.ts.map +1 -0
- package/lib/agent-runtime.js +4458 -0
- package/lib/agent-runtime.js.map +1 -0
- package/lib/approval-status-context.d.ts +8 -0
- package/lib/approval-status-context.d.ts.map +1 -0
- package/lib/approval-status-context.js +55 -0
- package/lib/approval-status-context.js.map +1 -0
- package/lib/attention-audit-store.d.ts +54 -0
- package/lib/attention-audit-store.d.ts.map +1 -0
- package/lib/attention-audit-store.js +213 -0
- package/lib/attention-audit-store.js.map +1 -0
- package/lib/attention-enforcement.d.ts +75 -0
- package/lib/attention-enforcement.d.ts.map +1 -0
- package/lib/attention-enforcement.js +84 -0
- package/lib/attention-enforcement.js.map +1 -0
- package/lib/attention.d.ts +208 -0
- package/lib/attention.d.ts.map +1 -0
- package/lib/attention.js +288 -0
- package/lib/attention.js.map +1 -0
- package/lib/canonical.d.ts +28 -0
- package/lib/canonical.d.ts.map +1 -0
- package/lib/canonical.js +190 -0
- package/lib/canonical.js.map +1 -0
- package/lib/coordinator.d.ts +134 -0
- package/lib/coordinator.d.ts.map +1 -0
- package/lib/coordinator.js +746 -0
- package/lib/coordinator.js.map +1 -0
- package/lib/feedback-command.d.ts +105 -0
- package/lib/feedback-command.d.ts.map +1 -0
- package/lib/feedback-command.js +547 -0
- package/lib/feedback-command.js.map +1 -0
- package/lib/foreground-observation.d.ts +66 -0
- package/lib/foreground-observation.d.ts.map +1 -0
- package/lib/foreground-observation.js +13 -0
- package/lib/foreground-observation.js.map +1 -0
- package/lib/foreground-termination.d.ts +31 -0
- package/lib/foreground-termination.d.ts.map +1 -0
- package/lib/foreground-termination.js +42 -0
- package/lib/foreground-termination.js.map +1 -0
- package/lib/goal-wake-types.d.ts +93 -0
- package/lib/goal-wake-types.d.ts.map +1 -0
- package/lib/goal-wake-types.js +70 -0
- package/lib/goal-wake-types.js.map +1 -0
- package/lib/in-process-reload-runtime.d.ts +120 -0
- package/lib/in-process-reload-runtime.d.ts.map +1 -0
- package/lib/in-process-reload-runtime.js +1280 -0
- package/lib/in-process-reload-runtime.js.map +1 -0
- package/lib/inbound-images.d.ts +38 -0
- package/lib/inbound-images.d.ts.map +1 -0
- package/lib/inbound-images.js +269 -0
- package/lib/inbound-images.js.map +1 -0
- package/lib/index.d.ts +41 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +25 -0
- package/lib/index.js.map +1 -0
- package/lib/learning-command.d.ts +40 -0
- package/lib/learning-command.d.ts.map +1 -0
- package/lib/learning-command.js +57 -0
- package/lib/learning-command.js.map +1 -0
- package/lib/native-termination.d.ts +12 -0
- package/lib/native-termination.d.ts.map +1 -0
- package/lib/native-termination.js +57 -0
- package/lib/native-termination.js.map +1 -0
- package/lib/native-web-owner.d.ts +97 -0
- package/lib/native-web-owner.d.ts.map +1 -0
- package/lib/native-web-owner.js +338 -0
- package/lib/native-web-owner.js.map +1 -0
- package/lib/operator-snapshot.d.ts +107 -0
- package/lib/operator-snapshot.d.ts.map +1 -0
- package/lib/operator-snapshot.js +1013 -0
- package/lib/operator-snapshot.js.map +1 -0
- package/lib/operator.d.ts +25 -0
- package/lib/operator.d.ts.map +1 -0
- package/lib/operator.js +48 -0
- package/lib/operator.js.map +1 -0
- package/lib/progress-attention.d.ts +55 -0
- package/lib/progress-attention.d.ts.map +1 -0
- package/lib/progress-attention.js +128 -0
- package/lib/progress-attention.js.map +1 -0
- package/lib/reply-replay.d.ts +52 -0
- package/lib/reply-replay.d.ts.map +1 -0
- package/lib/reply-replay.js +122 -0
- package/lib/reply-replay.js.map +1 -0
- package/lib/restart-native.d.ts +47 -0
- package/lib/restart-native.d.ts.map +1 -0
- package/lib/restart-native.js +170 -0
- package/lib/restart-native.js.map +1 -0
- package/lib/restart-runtime.d.ts +38 -0
- package/lib/restart-runtime.d.ts.map +1 -0
- package/lib/restart-runtime.js +335 -0
- package/lib/restart-runtime.js.map +1 -0
- package/lib/restart-store.d.ts +132 -0
- package/lib/restart-store.d.ts.map +1 -0
- package/lib/restart-store.js +757 -0
- package/lib/restart-store.js.map +1 -0
- package/lib/restart-supervisor.d.ts +129 -0
- package/lib/restart-supervisor.d.ts.map +1 -0
- package/lib/restart-supervisor.js +615 -0
- package/lib/restart-supervisor.js.map +1 -0
- package/lib/service.d.ts +1279 -0
- package/lib/service.d.ts.map +1 -0
- package/lib/service.js +8694 -0
- package/lib/service.js.map +1 -0
- package/lib/session-commands.d.ts +52 -0
- package/lib/session-commands.d.ts.map +1 -0
- package/lib/session-commands.js +180 -0
- package/lib/session-commands.js.map +1 -0
- package/lib/session-lease-runtime.d.ts +70 -0
- package/lib/session-lease-runtime.d.ts.map +1 -0
- package/lib/session-lease-runtime.js +395 -0
- package/lib/session-lease-runtime.js.map +1 -0
- package/lib/session-lease-types.d.ts +27 -0
- package/lib/session-lease-types.d.ts.map +1 -0
- package/lib/session-lease-types.js +2 -0
- package/lib/session-lease-types.js.map +1 -0
- package/lib/sqlite.d.ts +8 -0
- package/lib/sqlite.d.ts.map +1 -0
- package/lib/sqlite.js +1665 -0
- package/lib/sqlite.js.map +1 -0
- package/lib/store.d.ts +1267 -0
- package/lib/store.d.ts.map +1 -0
- package/lib/store.js +8039 -0
- package/lib/store.js.map +1 -0
- package/lib/tools.d.ts +4 -0
- package/lib/tools.d.ts.map +1 -0
- package/lib/tools.js +73 -0
- package/lib/tools.js.map +1 -0
- package/lib/types.d.ts +1091 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +10 -0
- package/lib/types.js.map +1 -0
- package/lib/version-query.d.ts +77 -0
- package/lib/version-query.d.ts.map +1 -0
- package/lib/version-query.js +2208 -0
- package/lib/version-query.js.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +2 -0
- package/lib/version.js.map +1 -0
- package/lib/work-item-engineering-context.d.ts +127 -0
- package/lib/work-item-engineering-context.d.ts.map +1 -0
- package/lib/work-item-engineering-context.js +151 -0
- package/lib/work-item-engineering-context.js.map +1 -0
- package/lib/work-item-feedback-schema.d.ts +2 -0
- package/lib/work-item-feedback-schema.d.ts.map +1 -0
- package/lib/work-item-feedback-schema.js +29 -0
- package/lib/work-item-feedback-schema.js.map +1 -0
- package/lib/work-item-feedback-store.d.ts +29 -0
- package/lib/work-item-feedback-store.d.ts.map +1 -0
- package/lib/work-item-feedback-store.js +111 -0
- package/lib/work-item-feedback-store.js.map +1 -0
- package/lib/work-item-feedback.d.ts +157 -0
- package/lib/work-item-feedback.d.ts.map +1 -0
- package/lib/work-item-feedback.js +2 -0
- package/lib/work-item-feedback.js.map +1 -0
- package/lib/work-item-replies-schema.d.ts +3 -0
- package/lib/work-item-replies-schema.d.ts.map +1 -0
- package/lib/work-item-replies-schema.js +45 -0
- package/lib/work-item-replies-schema.js.map +1 -0
- package/lib/work-item-replies-store.d.ts +43 -0
- package/lib/work-item-replies-store.d.ts.map +1 -0
- package/lib/work-item-replies-store.js +203 -0
- package/lib/work-item-replies-store.js.map +1 -0
- package/lib/work-item-replies.d.ts +93 -0
- package/lib/work-item-replies.d.ts.map +1 -0
- package/lib/work-item-replies.js +15 -0
- package/lib/work-item-replies.js.map +1 -0
- package/lib/workflow-auto-producer.d.ts +37 -0
- package/lib/workflow-auto-producer.d.ts.map +1 -0
- package/lib/workflow-auto-producer.js +58 -0
- package/lib/workflow-auto-producer.js.map +1 -0
- package/lib/workflow-command.d.ts +16 -0
- package/lib/workflow-command.d.ts.map +1 -0
- package/lib/workflow-command.js +52 -0
- package/lib/workflow-command.js.map +1 -0
- package/package.json +174 -4
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { attentionAuditReasons, linkedReportKeyPrefix, linkedReportMetadataPrefix } from './attention.js';
|
|
2
|
+
/** Append-only WP19 stage-1 audit. One row per Outbox record; replays keep the first verdict. */
|
|
3
|
+
export const attentionAuditSchema = `
|
|
4
|
+
CREATE TABLE delivery_attention_audit (
|
|
5
|
+
outbox_id TEXT PRIMARY KEY REFERENCES outbox_messages(id),
|
|
6
|
+
audit_sequence INTEGER NOT NULL UNIQUE CHECK(audit_sequence>=1),
|
|
7
|
+
binding_id TEXT NOT NULL,
|
|
8
|
+
lane TEXT NOT NULL CHECK(lane IN ('background','background-route','owner-notification','automation-result','work-item-report','scheduled-goal-result')),
|
|
9
|
+
source_id TEXT NOT NULL,
|
|
10
|
+
purpose TEXT NOT NULL CHECK(purpose IN ('result','attention','answer')),
|
|
11
|
+
purpose_source TEXT NOT NULL CHECK(purpose_source IN ('declared','lane','default')),
|
|
12
|
+
work_item_id TEXT,
|
|
13
|
+
question_id TEXT,
|
|
14
|
+
answers_question_id TEXT,
|
|
15
|
+
word_count INTEGER NOT NULL CHECK(word_count>=0),
|
|
16
|
+
word_cap INTEGER NOT NULL CHECK(word_cap>=1),
|
|
17
|
+
verdict TEXT NOT NULL CHECK(verdict IN ('would-accept','would-attach','would-reject')),
|
|
18
|
+
reasons_json TEXT NOT NULL CHECK(json_valid(reasons_json)),
|
|
19
|
+
recorded_at INTEGER NOT NULL CHECK(recorded_at>=0)
|
|
20
|
+
) STRICT;
|
|
21
|
+
CREATE INDEX delivery_attention_audit_question ON delivery_attention_audit(binding_id,question_id);
|
|
22
|
+
CREATE INDEX delivery_attention_audit_answer ON delivery_attention_audit(binding_id,answers_question_id);
|
|
23
|
+
CREATE INDEX delivery_attention_audit_work_item ON delivery_attention_audit(binding_id,work_item_id);
|
|
24
|
+
CREATE TRIGGER delivery_attention_audit_immutable BEFORE UPDATE ON delivery_attention_audit
|
|
25
|
+
BEGIN SELECT RAISE(ABORT,'attention audit is append-only'); END;
|
|
26
|
+
CREATE TRIGGER delivery_attention_audit_no_delete BEFORE DELETE ON delivery_attention_audit
|
|
27
|
+
BEGIN SELECT RAISE(ABORT,'attention audit is durable'); END;
|
|
28
|
+
`;
|
|
29
|
+
function entry(row) {
|
|
30
|
+
const reasons = JSON.parse(row.reasons_json);
|
|
31
|
+
if (!Array.isArray(reasons) || !reasons.every(reason => attentionAuditReasons.includes(reason))) {
|
|
32
|
+
throw new Error('invalid attention audit reasons');
|
|
33
|
+
}
|
|
34
|
+
return Object.freeze({
|
|
35
|
+
sequence: row.audit_sequence, outboxId: row.outbox_id, bindingId: row.binding_id, lane: row.lane, sourceId: row.source_id,
|
|
36
|
+
purpose: row.purpose, purposeSource: row.purpose_source,
|
|
37
|
+
...(row.work_item_id === null ? {} : { workItemId: row.work_item_id }),
|
|
38
|
+
...(row.question_id === null ? {} : { questionId: row.question_id }),
|
|
39
|
+
...(row.answers_question_id === null ? {} : { answersQuestionId: row.answers_question_id }),
|
|
40
|
+
wordCount: row.word_count, wordCap: row.word_cap, verdict: row.verdict,
|
|
41
|
+
reasons: Object.freeze(reasons), recordedAt: row.recorded_at,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export class AttentionAuditStore {
|
|
45
|
+
database;
|
|
46
|
+
transaction;
|
|
47
|
+
now;
|
|
48
|
+
constructor(database, transaction, now) {
|
|
49
|
+
this.database = database;
|
|
50
|
+
this.transaction = transaction;
|
|
51
|
+
this.now = now;
|
|
52
|
+
}
|
|
53
|
+
get(outboxId) {
|
|
54
|
+
const row = this.database.prepare('SELECT * FROM delivery_attention_audit WHERE outbox_id=?').get(outboxId);
|
|
55
|
+
return row === undefined ? undefined : entry(row);
|
|
56
|
+
}
|
|
57
|
+
/** Only non-rejected rows establish question state; a would-reject notice never opens or settles a question. */
|
|
58
|
+
ledger(bindingId) {
|
|
59
|
+
return {
|
|
60
|
+
questionAsked: questionId => this.database.prepare(`SELECT 1 FROM delivery_attention_audit WHERE binding_id=? AND question_id=?
|
|
61
|
+
AND purpose='attention' AND verdict!='would-reject' LIMIT 1`).get(bindingId, questionId) !== undefined,
|
|
62
|
+
questionAnswered: questionId => this.database.prepare(`SELECT 1 FROM delivery_attention_audit WHERE binding_id=? AND answers_question_id=?
|
|
63
|
+
AND purpose='answer' AND verdict!='would-reject' LIMIT 1`).get(bindingId, questionId) !== undefined,
|
|
64
|
+
openQuestions: workItemId => this.database.prepare(`SELECT DISTINCT q.question_id AS id FROM delivery_attention_audit q
|
|
65
|
+
WHERE q.binding_id=? AND q.work_item_id=? AND q.purpose='attention' AND q.verdict!='would-reject' AND q.question_id IS NOT NULL
|
|
66
|
+
AND NOT EXISTS(SELECT 1 FROM delivery_attention_audit a WHERE a.binding_id=q.binding_id AND a.answers_question_id=q.question_id
|
|
67
|
+
AND a.purpose='answer' AND a.verdict!='would-reject') ORDER BY q.question_id`).all(bindingId, workItemId)
|
|
68
|
+
.map(row => row.id),
|
|
69
|
+
questionWorkItem: questionId => this.database.prepare(`SELECT work_item_id FROM delivery_attention_audit WHERE binding_id=? AND question_id=?
|
|
70
|
+
AND purpose='attention' AND verdict!='would-reject' AND work_item_id IS NOT NULL ORDER BY audit_sequence LIMIT 1`)
|
|
71
|
+
.get(bindingId, questionId)?.work_item_id,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Durable gap detector, derived by query (no extra state): Outbox rows that
|
|
76
|
+
* carry a durable marker of an audited lane, were created at or after the
|
|
77
|
+
* first audit row, and have no audit row. Plain `enqueueBackground` rows
|
|
78
|
+
* carry no lane marker and are not counted here. Gaps before the first
|
|
79
|
+
* successful audit write are not detectable.
|
|
80
|
+
*/
|
|
81
|
+
unauditedOutboxCount() {
|
|
82
|
+
return this.database.prepare(`SELECT count(*) AS count FROM outbox_messages o
|
|
83
|
+
WHERE o.created_at >= (SELECT min(recorded_at) FROM delivery_attention_audit)
|
|
84
|
+
AND NOT EXISTS(SELECT 1 FROM delivery_attention_audit a WHERE a.outbox_id=o.id)
|
|
85
|
+
AND (json_extract(o.intent_json,'$.metadata."dsh.native-notice"')='v1'
|
|
86
|
+
OR json_extract(o.intent_json,'$.metadata."dsh.route.authority"') IS NOT NULL
|
|
87
|
+
OR json_extract(o.intent_json,'$.metadata."dsh.learning.kind"') IN ('automation-run','goal-outcome')
|
|
88
|
+
OR EXISTS(SELECT 1 FROM delivery_goal_outcome_targets g WHERE g.outbox_id=o.id)
|
|
89
|
+
OR EXISTS(SELECT 1 FROM delivery_work_item_reports r WHERE r.outbox_id=o.id))`).get().count;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* WP19 stage 2b split-evasion input: inline bodies (Outbox text, never the
|
|
93
|
+
* attachment) of audited notices from one source on one binding and lane,
|
|
94
|
+
* recorded within the last `windowMs` of this store's clock (the same clock
|
|
95
|
+
* that stamps `recorded_at`, so the window survives restarts), in audit
|
|
96
|
+
* order. Notices that were never audited (best-effort audit write failed)
|
|
97
|
+
* are not visible here.
|
|
98
|
+
*/
|
|
99
|
+
recentInlineTexts(input) {
|
|
100
|
+
return this.database.prepare(`SELECT json_extract(o.intent_json,'$.text') AS text FROM delivery_attention_audit a
|
|
101
|
+
JOIN outbox_messages o ON o.id=a.outbox_id
|
|
102
|
+
WHERE a.binding_id=? AND a.lane=? AND a.source_id=? AND a.recorded_at>=? ORDER BY a.audit_sequence`)
|
|
103
|
+
.all(input.bindingId, input.lane, input.sourceId, Math.max(0, this.now() - input.windowMs))
|
|
104
|
+
.map(row => typeof row.text === 'string' ? row.text : '');
|
|
105
|
+
}
|
|
106
|
+
/** Assess against the committed ledger and append in one writer transaction; an existing row wins. */
|
|
107
|
+
record(input, assess) {
|
|
108
|
+
return this.transaction(() => {
|
|
109
|
+
const existing = this.get(input.outboxId);
|
|
110
|
+
if (existing !== undefined)
|
|
111
|
+
return existing;
|
|
112
|
+
const assessment = assess(this.ledger(input.bindingId));
|
|
113
|
+
const next = this.database.prepare('SELECT coalesce(max(audit_sequence),0)+1 AS next FROM delivery_attention_audit').get().next;
|
|
114
|
+
this.database.prepare(`INSERT INTO delivery_attention_audit(outbox_id,audit_sequence,binding_id,lane,source_id,purpose,purpose_source,
|
|
115
|
+
work_item_id,question_id,answers_question_id,word_count,word_cap,verdict,reasons_json,recorded_at) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`)
|
|
116
|
+
.run(input.outboxId, next, input.bindingId, input.lane, input.sourceId, assessment.purpose, assessment.purposeSource, assessment.workItemId ?? null, assessment.questionId ?? null, assessment.answersQuestionId ?? null, assessment.wordCount, assessment.wordCap, assessment.verdict, JSON.stringify(assessment.reasons), this.now());
|
|
117
|
+
return this.get(input.outboxId);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
list(afterSequence, limit) {
|
|
121
|
+
const rows = this.database.prepare('SELECT * FROM delivery_attention_audit WHERE audit_sequence>? ORDER BY audit_sequence LIMIT ?')
|
|
122
|
+
.all(afterSequence, limit + 1);
|
|
123
|
+
return { entries: Object.freeze(rows.slice(0, limit).map(entry)), hasMore: rows.length > limit };
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Current facts for exact notifications; unknown or unaudited ids are omitted.
|
|
127
|
+
* The unindexed JSON lookups (reply reactions, work-item feedback) run once
|
|
128
|
+
* per call over the whole batch rather than once per notification.
|
|
129
|
+
*/
|
|
130
|
+
outcomeFactsFor(outboxIds) {
|
|
131
|
+
const audits = outboxIds.map(id => this.get(id)).filter(item => item !== undefined);
|
|
132
|
+
if (audits.length === 0)
|
|
133
|
+
return Object.freeze([]);
|
|
134
|
+
const ids = JSON.stringify(audits.map(audit => audit.outboxId));
|
|
135
|
+
// A reply counts when it answers the provider message in the same
|
|
136
|
+
// conversation from the same principal, including after a new-session
|
|
137
|
+
// command moved the conversation to a newer binding generation.
|
|
138
|
+
const reactions = new Map(this.database.prepare(`WITH target AS (
|
|
139
|
+
SELECT o.id AS outbox_id, o.channel, o.account, o.provider_message_id, b.conversation_hash, b.principal_id
|
|
140
|
+
FROM json_each(?) j JOIN outbox_messages o ON o.id=j.value JOIN conversation_bindings b ON b.id=o.binding_id
|
|
141
|
+
WHERE o.provider_message_id IS NOT NULL)
|
|
142
|
+
SELECT t.outbox_id, min(i.received_at) AS first_at, count(*) AS count
|
|
143
|
+
FROM inbox_messages i
|
|
144
|
+
JOIN conversation_bindings ib ON ib.id=i.binding_id
|
|
145
|
+
JOIN target t ON t.channel=i.channel AND t.account=i.account
|
|
146
|
+
AND t.provider_message_id=json_extract(i.envelope_json,'$.metadata.replyToProviderMessageId')
|
|
147
|
+
AND ib.conversation_hash=t.conversation_hash AND ib.principal_id=t.principal_id
|
|
148
|
+
GROUP BY t.outbox_id`).all(ids)
|
|
149
|
+
.map(row => [row.outbox_id, row]));
|
|
150
|
+
const feedback = new Map();
|
|
151
|
+
for (const row of this.database.prepare(`SELECT json_extract(source_json,'$.target.outboxId') AS outbox_id,
|
|
152
|
+
json_extract(canonical_json,'$.version') AS version, json_extract(canonical_json,'$.objectiveStatus') AS status
|
|
153
|
+
FROM delivery_work_item_feedback WHERE state='recorded'
|
|
154
|
+
AND json_extract(source_json,'$.target.outboxId') IN (SELECT value FROM json_each(?))
|
|
155
|
+
ORDER BY version DESC, admission_sequence DESC`).all(ids)) {
|
|
156
|
+
if (!feedback.has(row.outbox_id))
|
|
157
|
+
feedback.set(row.outbox_id, row);
|
|
158
|
+
}
|
|
159
|
+
return Object.freeze(audits.map(audit => this.fact(audit, reactions.get(audit.outboxId), feedback.get(audit.outboxId)))
|
|
160
|
+
.filter(item => item !== undefined));
|
|
161
|
+
}
|
|
162
|
+
fact(audit, reaction, feedback) {
|
|
163
|
+
const outbox = this.database.prepare(`SELECT o.status, o.channel, o.account, o.provider_message_id, o.updated_at,
|
|
164
|
+
b.workspace, b.agent_preset, o.idempotency_key,
|
|
165
|
+
json_extract(o.intent_json,?) AS linked_report, json_extract(o.intent_json,?) AS linked_origin
|
|
166
|
+
FROM outbox_messages o JOIN conversation_bindings b ON b.id=o.binding_id WHERE o.id=?`)
|
|
167
|
+
.get(`$.metadata."${linkedReportMetadataPrefix}"`, `$.metadata."${linkedReportMetadataPrefix}.originBindingId"`, audit.outboxId);
|
|
168
|
+
if (outbox === undefined)
|
|
169
|
+
return undefined;
|
|
170
|
+
const accepted = this.database.prepare(`SELECT min(finished_at) AS at FROM outbox_attempts
|
|
171
|
+
WHERE outbox_id=? AND status IN ('accepted','reconciled') AND finished_at IS NOT NULL`).get(audit.outboxId).at;
|
|
172
|
+
const receipts = outbox.provider_message_id === null ? [] : this.database.prepare(`SELECT status, occurred_at FROM delivery_receipts
|
|
173
|
+
WHERE channel=? AND account=? AND provider_message_id=?`).all(outbox.channel, outbox.account, outbox.provider_message_id);
|
|
174
|
+
const receipt = (status) => receipts.find(row => row.status === status)?.occurred_at;
|
|
175
|
+
const sent = ['accepted', 'delivered', 'read'].includes(outbox.status);
|
|
176
|
+
const acceptedAt = accepted ?? receipt('accepted') ?? (sent ? outbox.updated_at : undefined);
|
|
177
|
+
const deliveredAt = receipt('delivered') ?? (outbox.status === 'delivered' || outbox.status === 'read' ? outbox.updated_at : undefined);
|
|
178
|
+
const readAt = receipt('read') ?? (outbox.status === 'read' ? outbox.updated_at : undefined);
|
|
179
|
+
// Same precedence as Delivery's own objective state: the newest accepted
|
|
180
|
+
// owner command, else the legacy first verified-task receipt as version 1.
|
|
181
|
+
const owner = feedback !== undefined ? undefined : this.database.prepare(`SELECT version, objective_status AS status
|
|
182
|
+
FROM delivery_owner_objective_commands WHERE source_outbox_id=? AND json_extract(result_json,'$.error') IS NULL
|
|
183
|
+
ORDER BY version DESC LIMIT 1`).get(audit.outboxId)
|
|
184
|
+
?? this.database.prepare(`SELECT 1 AS version, objective_status AS status FROM workflow_verified_task_feedback
|
|
185
|
+
WHERE source_outbox_id=?`).get(audit.outboxId);
|
|
186
|
+
// Only `routeWorkItemReport` writes this reserved marker + key prefix;
|
|
187
|
+
// every public enqueue rejects both.
|
|
188
|
+
const linkedOrigin = outbox.linked_report === 'v1' && outbox.idempotency_key.startsWith(linkedReportKeyPrefix)
|
|
189
|
+
&& typeof outbox.linked_origin === 'string' && outbox.linked_origin.length > 0 ? outbox.linked_origin : undefined;
|
|
190
|
+
const judged = feedback ?? owner;
|
|
191
|
+
const objectiveStatus = (status) => status === 'achieved' || status === 'partial' || status === 'not-achieved' ? status : 'unknown';
|
|
192
|
+
return Object.freeze({
|
|
193
|
+
auditSequence: audit.sequence, outboxId: audit.outboxId, bindingId: audit.bindingId,
|
|
194
|
+
scope: Object.freeze({ workspace: outbox.workspace, preset: outbox.agent_preset }),
|
|
195
|
+
lane: audit.lane, sourceId: audit.sourceId, purpose: audit.purpose, purposeSource: audit.purposeSource,
|
|
196
|
+
...(audit.workItemId === undefined ? {} : { workItemId: audit.workItemId }),
|
|
197
|
+
...(audit.questionId === undefined ? {} : { questionId: audit.questionId }),
|
|
198
|
+
...(audit.answersQuestionId === undefined ? {} : { answersQuestionId: audit.answersQuestionId }),
|
|
199
|
+
verdict: audit.verdict, reasons: audit.reasons, auditedAt: audit.recordedAt,
|
|
200
|
+
transport: Object.freeze({ status: outbox.status,
|
|
201
|
+
...(acceptedAt === undefined ? {} : { acceptedAt }),
|
|
202
|
+
...(deliveredAt === undefined ? {} : { deliveredAt }),
|
|
203
|
+
...(readAt === undefined ? {} : { readAt }) }),
|
|
204
|
+
...(reaction === undefined || outbox.provider_message_id === null ? {} : { reaction: Object.freeze({ firstAt: reaction.first_at, count: reaction.count }) }),
|
|
205
|
+
...(judged === undefined || !Number.isSafeInteger(judged.version) ? {} : { judgement: Object.freeze({
|
|
206
|
+
source: feedback !== undefined ? 'work-item-feedback' : 'owner-objective',
|
|
207
|
+
version: judged.version, objectiveStatus: objectiveStatus(judged.status)
|
|
208
|
+
}) }),
|
|
209
|
+
...(linkedOrigin === undefined ? {} : { route: Object.freeze({ kind: 'linked', originBindingId: linkedOrigin }) }),
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=attention-audit-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attention-audit-store.js","sourceRoot":"","sources":["../src/attention-audit-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAA6J,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAEpQ,iGAAiG;AACjG,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBnC,CAAA;AASD,SAAS,KAAK,CAAC,GAAQ;IACrB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAY,CAAA;IACvD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAE,qBAA4C,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QACxH,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IACpD,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,QAAQ,EAAE,GAAG,CAAC,cAAc,EAAE,QAAQ,EAAE,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,SAAS;QACzH,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC,cAAc;QACvD,GAAG,CAAC,GAAG,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,YAAY,EAAE,CAAC;QACtE,GAAG,CAAC,GAAG,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,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AC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;YAChD,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,mBAAmB,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC;YAC5J,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;oBAClG,MAAM,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,oBAA6B,CAAC,CAAC,CAAC,iBAA0B;oBAC3F,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC;iBAAE,CAAC,EAAE,CAAC;YAChF,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;SAC5H,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WP19 stage 3: purpose enforcement (opt-in Delivery config `attentionEnforce`,
|
|
3
|
+
* default off). With it on, a background/owner notice whose purpose is missing
|
|
4
|
+
* or fails the Host checks, or that exceeds its caps while
|
|
5
|
+
* `attentionAttachOverCap` is off, is rejected before it is queued.
|
|
6
|
+
*
|
|
7
|
+
* A rejected notice never becomes an Outbox row, and the v31
|
|
8
|
+
* `delivery_attention_audit` table is keyed by `outbox_id` with an Outbox
|
|
9
|
+
* foreign key and a closed `verdict` CHECK, so it cannot hold a `rejected`
|
|
10
|
+
* verdict without a schema bump. Rejections are therefore recorded in this
|
|
11
|
+
* process-local, bounded, non-durable log, like the stage 2c progress audit.
|
|
12
|
+
* A rejection never opens or settles a question, so the durable ledger that
|
|
13
|
+
* decides it is unchanged by it and a retry after restart is decided again
|
|
14
|
+
* the same way.
|
|
15
|
+
*/
|
|
16
|
+
import { type AttentionAssessment, type AttentionAuditReason, type AttentionLane } from './attention.js';
|
|
17
|
+
/** Enforcement-only reasons, appended after the audit reasons. */
|
|
18
|
+
export declare const attentionEnforcementOnlyReasons: readonly ["split-evasion", "attachment-unsupported"];
|
|
19
|
+
export type AttentionRejectionReason = AttentionAuditReason | typeof attentionEnforcementOnlyReasons[number];
|
|
20
|
+
/** Purpose reasons that reject under enforcement: the stage 1 would-reject set plus an undeclared purpose. */
|
|
21
|
+
export declare const attentionEnforcedPurposeReasons: ReadonlySet<AttentionAuditReason>;
|
|
22
|
+
/**
|
|
23
|
+
* Pure: reasons one assessment is rejected for, in fixed order. Over-cap text
|
|
24
|
+
* is rejected only when it cannot take the stage 2b attachment path.
|
|
25
|
+
* `text-exposes-*` stay audit-only.
|
|
26
|
+
*/
|
|
27
|
+
export declare function attentionEnforcementReasons(assessment: Readonly<Pick<AttentionAssessment, 'reasons'>>, attachOverCap: boolean): readonly AttentionAuditReason[];
|
|
28
|
+
export declare function orderAttentionRejectionReasons(reasons: Iterable<AttentionRejectionReason>): readonly AttentionRejectionReason[];
|
|
29
|
+
export interface AttentionRejectionEntry {
|
|
30
|
+
/** Process-local read cursor, strictly increasing from 1. */
|
|
31
|
+
sequence: number;
|
|
32
|
+
bindingId: string;
|
|
33
|
+
lane: AttentionLane;
|
|
34
|
+
sourceId: string;
|
|
35
|
+
idempotencyKey: string;
|
|
36
|
+
purpose: AttentionAssessment['purpose'];
|
|
37
|
+
purposeSource: AttentionAssessment['purposeSource'];
|
|
38
|
+
workItemId?: string;
|
|
39
|
+
questionId?: string;
|
|
40
|
+
answersQuestionId?: string;
|
|
41
|
+
wordCount: number;
|
|
42
|
+
wordCap: number;
|
|
43
|
+
verdict: 'rejected';
|
|
44
|
+
reasons: readonly AttentionRejectionReason[];
|
|
45
|
+
recordedAt: number;
|
|
46
|
+
}
|
|
47
|
+
export interface AttentionRejectionPage {
|
|
48
|
+
entries: readonly AttentionRejectionEntry[];
|
|
49
|
+
hasMore: boolean;
|
|
50
|
+
nextAfterSequence: number | null;
|
|
51
|
+
/** Always false: entries live in this Host process only. */
|
|
52
|
+
durable: false;
|
|
53
|
+
/** Entries evicted from the bounded ring since this Host started. */
|
|
54
|
+
evicted: number;
|
|
55
|
+
}
|
|
56
|
+
export declare class AttentionRejectionLog {
|
|
57
|
+
private readonly maxEntries;
|
|
58
|
+
private readonly now;
|
|
59
|
+
private readonly entries;
|
|
60
|
+
private sequence;
|
|
61
|
+
private evictedEntries;
|
|
62
|
+
constructor(maxEntries?: number, now?: () => number);
|
|
63
|
+
/** A retry of the same key rejected for the same reasons returns the retained entry instead of appending. */
|
|
64
|
+
record(input: Readonly<{
|
|
65
|
+
bindingId: string;
|
|
66
|
+
lane: AttentionLane;
|
|
67
|
+
sourceId: string;
|
|
68
|
+
idempotencyKey: string;
|
|
69
|
+
assessment: Readonly<AttentionAssessment>;
|
|
70
|
+
reasons: readonly AttentionRejectionReason[];
|
|
71
|
+
}>): AttentionRejectionEntry;
|
|
72
|
+
/** `afterSequence`/`limit` are validated by the caller. */
|
|
73
|
+
list(afterSequence: number, limit: number): AttentionRejectionPage;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=attention-enforcement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attention-enforcement.d.ts","sourceRoot":"","sources":["../src/attention-enforcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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BAAuB,EAAE,CAAA;IAC3C,OAAO,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,4DAA4D;IAC5D,OAAO,EAAE,KAAK,CAAA;IACd,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,qBAAqB;IAKpB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAAS,OAAO,CAAC,QAAQ,CAAC,GAAG;IAJpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgC;IACxD,OAAO,CAAC,QAAQ,CAAI;IACpB,OAAO,CAAC,cAAc,CAAI;gBAEG,UAAU,SAAO,EAAmB,GAAG,GAAE,MAAM,MAAiB;IAE7F,6GAA6G;IAC7G,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,aAAa,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;QACvG,UAAU,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAAC,OAAO,EAAE,SAAS,wBAAwB,EAAE,CAAA;KAAE,CAAC,GAAG,uBAAuB;IAoBtH,2DAA2D;IAC3D,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,sBAAsB;CAQnE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WP19 stage 3: purpose enforcement (opt-in Delivery config `attentionEnforce`,
|
|
3
|
+
* default off). With it on, a background/owner notice whose purpose is missing
|
|
4
|
+
* or fails the Host checks, or that exceeds its caps while
|
|
5
|
+
* `attentionAttachOverCap` is off, is rejected before it is queued.
|
|
6
|
+
*
|
|
7
|
+
* A rejected notice never becomes an Outbox row, and the v31
|
|
8
|
+
* `delivery_attention_audit` table is keyed by `outbox_id` with an Outbox
|
|
9
|
+
* foreign key and a closed `verdict` CHECK, so it cannot hold a `rejected`
|
|
10
|
+
* verdict without a schema bump. Rejections are therefore recorded in this
|
|
11
|
+
* process-local, bounded, non-durable log, like the stage 2c progress audit.
|
|
12
|
+
* A rejection never opens or settles a question, so the durable ledger that
|
|
13
|
+
* decides it is unchanged by it and a retry after restart is decided again
|
|
14
|
+
* the same way.
|
|
15
|
+
*/
|
|
16
|
+
import { attentionAuditReasons } from './attention.js';
|
|
17
|
+
/** Enforcement-only reasons, appended after the audit reasons. */
|
|
18
|
+
export const attentionEnforcementOnlyReasons = ['split-evasion', 'attachment-unsupported'];
|
|
19
|
+
const rejectionReasonOrder = [...attentionAuditReasons, ...attentionEnforcementOnlyReasons];
|
|
20
|
+
/** Purpose reasons that reject under enforcement: the stage 1 would-reject set plus an undeclared purpose. */
|
|
21
|
+
export const attentionEnforcedPurposeReasons = new Set([
|
|
22
|
+
'missing-purpose', 'invalid-envelope', 'attention-missing-work-item', 'attention-question-invalid', 'attention-question-not-current',
|
|
23
|
+
'attention-question-already-answered', 'answer-missing-question', 'answer-unknown-question', 'answer-already-used',
|
|
24
|
+
'answer-work-item-mismatch', 'attention-question-reused',
|
|
25
|
+
]);
|
|
26
|
+
const capReasons = new Set(['over-word-cap', 'over-grapheme-cap']);
|
|
27
|
+
/**
|
|
28
|
+
* Pure: reasons one assessment is rejected for, in fixed order. Over-cap text
|
|
29
|
+
* is rejected only when it cannot take the stage 2b attachment path.
|
|
30
|
+
* `text-exposes-*` stay audit-only.
|
|
31
|
+
*/
|
|
32
|
+
export function attentionEnforcementReasons(assessment, attachOverCap) {
|
|
33
|
+
return Object.freeze(assessment.reasons.filter(reason => attentionEnforcedPurposeReasons.has(reason)
|
|
34
|
+
|| (!attachOverCap && capReasons.has(reason))));
|
|
35
|
+
}
|
|
36
|
+
export function orderAttentionRejectionReasons(reasons) {
|
|
37
|
+
const set = new Set(reasons);
|
|
38
|
+
return Object.freeze(rejectionReasonOrder.filter(reason => set.has(reason)));
|
|
39
|
+
}
|
|
40
|
+
export class AttentionRejectionLog {
|
|
41
|
+
maxEntries;
|
|
42
|
+
now;
|
|
43
|
+
entries = [];
|
|
44
|
+
sequence = 0;
|
|
45
|
+
evictedEntries = 0;
|
|
46
|
+
constructor(maxEntries = 1000, now = Date.now) {
|
|
47
|
+
this.maxEntries = maxEntries;
|
|
48
|
+
this.now = now;
|
|
49
|
+
}
|
|
50
|
+
/** A retry of the same key rejected for the same reasons returns the retained entry instead of appending. */
|
|
51
|
+
record(input) {
|
|
52
|
+
const reasons = orderAttentionRejectionReasons(input.reasons);
|
|
53
|
+
const retained = this.entries.findLast(entry => entry.bindingId === input.bindingId && entry.lane === input.lane
|
|
54
|
+
&& entry.idempotencyKey === input.idempotencyKey);
|
|
55
|
+
if (retained !== undefined && retained.sourceId === input.sourceId && retained.reasons.join() === reasons.join())
|
|
56
|
+
return retained;
|
|
57
|
+
const { assessment } = input;
|
|
58
|
+
this.sequence += 1;
|
|
59
|
+
const entry = Object.freeze({
|
|
60
|
+
sequence: this.sequence, bindingId: input.bindingId, lane: input.lane, sourceId: input.sourceId, idempotencyKey: input.idempotencyKey,
|
|
61
|
+
purpose: assessment.purpose, purposeSource: assessment.purposeSource,
|
|
62
|
+
...(assessment.workItemId === undefined ? {} : { workItemId: assessment.workItemId }),
|
|
63
|
+
...(assessment.questionId === undefined ? {} : { questionId: assessment.questionId }),
|
|
64
|
+
...(assessment.answersQuestionId === undefined ? {} : { answersQuestionId: assessment.answersQuestionId }),
|
|
65
|
+
wordCount: assessment.wordCount, wordCap: assessment.wordCap, verdict: 'rejected', reasons, recordedAt: this.now(),
|
|
66
|
+
});
|
|
67
|
+
this.entries.push(entry);
|
|
68
|
+
while (this.entries.length > this.maxEntries) {
|
|
69
|
+
this.entries.shift();
|
|
70
|
+
this.evictedEntries += 1;
|
|
71
|
+
}
|
|
72
|
+
return entry;
|
|
73
|
+
}
|
|
74
|
+
/** `afterSequence`/`limit` are validated by the caller. */
|
|
75
|
+
list(afterSequence, limit) {
|
|
76
|
+
const start = this.entries.findIndex(entry => entry.sequence > afterSequence);
|
|
77
|
+
const remaining = start < 0 ? [] : this.entries.slice(start);
|
|
78
|
+
const entries = Object.freeze(remaining.slice(0, limit));
|
|
79
|
+
const hasMore = remaining.length > limit;
|
|
80
|
+
return Object.freeze({ entries, hasMore, nextAfterSequence: hasMore ? entries.at(-1).sequence : null, durable: false,
|
|
81
|
+
evicted: this.evictedEntries });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=attention-enforcement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attention-enforcement.js","sourceRoot":"","sources":["../src/attention-enforcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,qBAAqB,EAA2E,MAAM,gBAAgB,CAAA;AAE/H,kEAAkE;AAClE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,eAAe,EAAE,wBAAwB,CAAU,CAAA;AAEnG,MAAM,oBAAoB,GAAwC,CAAC,GAAG,qBAAqB,EAAE,GAAG,+BAA+B,CAAC,CAAA;AAEhI,8GAA8G;AAC9G,MAAM,CAAC,MAAM,+BAA+B,GAAsC,IAAI,GAAG,CAAC;IACxF,iBAAiB,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,gCAAgC;IACpI,qCAAqC,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,qBAAqB;IAClH,2BAA2B,EAAE,2BAA2B;CACzD,CAAC,CAAA;AAEF,MAAM,UAAU,GAAsC,IAAI,GAAG,CAAC,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC,CAAA;AAErG;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,UAA0D,EAAE,aAAsB;IAC5H,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,+BAA+B,CAAC,GAAG,CAAC,MAAM,CAAC;WAC/F,CAAC,CAAC,aAA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AM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAC,CAAA;QAC7E,MAAM,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;QACxD,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,GAAG,KAAK,CAAA;QACxC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,KAAc;YAC5H,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAA;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WP19 attention contract. Stage 1 (always on, audit only): Delivery evaluates
|
|
3
|
+
* every background/owner notification against a Host-side envelope and
|
|
4
|
+
* records the verdict. Stage 2b (opt-in `attentionAttachOverCap`, default off):
|
|
5
|
+
* over-cap notices become a short body plus a text attachment and split bursts
|
|
6
|
+
* are rejected; see `convertOverCapAttention` and `assessAttentionSplit`.
|
|
7
|
+
*/
|
|
8
|
+
import type { OutboundTextAttachment } from './types.js';
|
|
9
|
+
export type AttentionPurpose = 'result' | 'attention' | 'answer';
|
|
10
|
+
/** Exactly one structured question per attention notice. */
|
|
11
|
+
export interface AttentionQuestion {
|
|
12
|
+
id: string;
|
|
13
|
+
prompt: string;
|
|
14
|
+
choices?: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export type AttentionEnvelope = Readonly<{
|
|
17
|
+
purpose: 'result';
|
|
18
|
+
workItemId?: string;
|
|
19
|
+
}> | Readonly<{
|
|
20
|
+
purpose: 'attention';
|
|
21
|
+
workItemId: string;
|
|
22
|
+
question: Readonly<AttentionQuestion>;
|
|
23
|
+
}> | Readonly<{
|
|
24
|
+
purpose: 'answer';
|
|
25
|
+
questionId: string;
|
|
26
|
+
workItemId?: string;
|
|
27
|
+
}>;
|
|
28
|
+
export type AttentionLane = 'background' | 'background-route' | 'owner-notification' | 'automation-result' | 'work-item-report' | 'scheduled-goal-result';
|
|
29
|
+
/** `declared` by the caller, derived from a typed Host `lane`, or the legacy `default`. */
|
|
30
|
+
export type AttentionPurposeSource = 'declared' | 'lane' | 'default';
|
|
31
|
+
export type AttentionVerdict = 'would-accept' | 'would-attach' | 'would-reject';
|
|
32
|
+
export declare const attentionAuditReasons: readonly ["missing-purpose", "invalid-envelope", "attention-missing-work-item", "attention-question-invalid", "attention-question-not-current", "attention-question-already-answered", "answer-missing-question", "answer-unknown-question", "answer-already-used", "answer-work-item-mismatch", "attention-question-reused", "over-word-cap", "over-grapheme-cap", "text-exposes-estimate", "text-exposes-identifier"];
|
|
33
|
+
export type AttentionAuditReason = typeof attentionAuditReasons[number];
|
|
34
|
+
/**
|
|
35
|
+
* Hard word caps per purpose. A result may carry a short summary; attention is
|
|
36
|
+
* one question with its minimum context; an answer settles one question.
|
|
37
|
+
* With stage 2b enabled, over-cap text moves to an attachment.
|
|
38
|
+
*/
|
|
39
|
+
export declare const attentionWordCaps: Readonly<Record<AttentionPurpose, number>>;
|
|
40
|
+
/**
|
|
41
|
+
* Secondary length guard: non-whitespace graphemes, about six per capped word.
|
|
42
|
+
* It catches content the word segmenter undercounts, such as one unbroken
|
|
43
|
+
* multi-kilobyte token (one word-like segment) or long emoji runs.
|
|
44
|
+
*/
|
|
45
|
+
export declare const attentionGraphemeCaps: Readonly<Record<AttentionPurpose, number>>;
|
|
46
|
+
/** Legacy callers that declare nothing are audited as `result`, the least restrictive purpose. */
|
|
47
|
+
export declare const defaultAttentionPurpose: AttentionPurpose;
|
|
48
|
+
export interface AttentionTextMeasure {
|
|
49
|
+
/** `isWordLike` word segments. */
|
|
50
|
+
words: number;
|
|
51
|
+
/** Non-word graphemes other than whitespace, punctuation and ASCII, e.g. emoji or pictographs. */
|
|
52
|
+
symbols: number;
|
|
53
|
+
/** All non-whitespace graphemes. */
|
|
54
|
+
graphemes: number;
|
|
55
|
+
}
|
|
56
|
+
export declare function measureAttentionText(text: string): AttentionTextMeasure;
|
|
57
|
+
/** Audited word count: word-like segments plus symbol graphemes, so an emoji wall cannot count as zero. */
|
|
58
|
+
export declare function countAttentionWords(text: string): number;
|
|
59
|
+
/** Prior audited state needed for single-question and single-use checks, scoped to one binding. */
|
|
60
|
+
export interface AttentionLedgerView {
|
|
61
|
+
/** An accepted attention notice asked this question on this binding. */
|
|
62
|
+
questionAsked(questionId: string): boolean;
|
|
63
|
+
/** An accepted answer already settled this question on this binding. */
|
|
64
|
+
questionAnswered(questionId: string): boolean;
|
|
65
|
+
/** Accepted, still unanswered question ids open for this work item on this binding. */
|
|
66
|
+
openQuestions(workItemId: string): readonly string[];
|
|
67
|
+
/** Work item of the first accepted attention notice that asked this question on this binding. */
|
|
68
|
+
questionWorkItem(questionId: string): string | undefined;
|
|
69
|
+
}
|
|
70
|
+
export interface AttentionAssessment {
|
|
71
|
+
purpose: AttentionPurpose;
|
|
72
|
+
purposeSource: AttentionPurposeSource;
|
|
73
|
+
workItemId?: string;
|
|
74
|
+
questionId?: string;
|
|
75
|
+
answersQuestionId?: string;
|
|
76
|
+
wordCount: number;
|
|
77
|
+
wordCap: number;
|
|
78
|
+
verdict: AttentionVerdict;
|
|
79
|
+
reasons: readonly AttentionAuditReason[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Pure and deterministic for one (input, ledger) pair. Reasons are emitted in
|
|
83
|
+
* the fixed `attentionAuditReasons` order.
|
|
84
|
+
*/
|
|
85
|
+
export declare function assessAttention(input: Readonly<{
|
|
86
|
+
text: string;
|
|
87
|
+
envelope?: unknown;
|
|
88
|
+
lanePurpose?: Readonly<{
|
|
89
|
+
purpose: AttentionPurpose;
|
|
90
|
+
workItemId?: string;
|
|
91
|
+
}>;
|
|
92
|
+
ledger: AttentionLedgerView;
|
|
93
|
+
}>): AttentionAssessment;
|
|
94
|
+
/**
|
|
95
|
+
* WP19 stage 2b (opt-in, Delivery config `attentionAttachOverCap`): an
|
|
96
|
+
* over-cap background/owner notification is sent as a short inline body plus
|
|
97
|
+
* one text attachment carrying the full original text, never as several
|
|
98
|
+
* messages. Everything below is pure and deterministic.
|
|
99
|
+
*/
|
|
100
|
+
/** Inline body budget for a converted notice, before the fixed attachment notice. */
|
|
101
|
+
export declare const attentionAttachmentSummaryWords = 60;
|
|
102
|
+
export declare const attentionAttachmentSummaryGraphemes = 360;
|
|
103
|
+
/** True when the text exceeds the word or grapheme cap of its purpose. */
|
|
104
|
+
export declare function attentionOverCap(text: string, purpose: AttentionPurpose): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Convert one over-cap notice to a short plain body plus a text attachment.
|
|
107
|
+
* The attachment name derives from the content digest only, so a replay of the
|
|
108
|
+
* same notice converts byte-identically. Callers decide whether to convert.
|
|
109
|
+
*/
|
|
110
|
+
export declare function convertOverCapAttention(input: Readonly<{
|
|
111
|
+
text: string;
|
|
112
|
+
format: 'markdown' | 'plain';
|
|
113
|
+
digest: (text: string) => string;
|
|
114
|
+
}>): {
|
|
115
|
+
text: string;
|
|
116
|
+
format: 'plain';
|
|
117
|
+
attachment: OutboundTextAttachment;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Split-evasion window. Inline notices queued by the same source on the same
|
|
121
|
+
* binding and lane within this window are measured together; when their sum
|
|
122
|
+
* exceeds the cap of the new notice's purpose the new notice is rejected. The
|
|
123
|
+
* remedy is one notice, which the over-cap path converts to an attachment.
|
|
124
|
+
*/
|
|
125
|
+
export declare const attentionSplitWindowMs = 300000;
|
|
126
|
+
export type AttentionSplitVerdict = Readonly<{
|
|
127
|
+
split: false;
|
|
128
|
+
} | {
|
|
129
|
+
split: true;
|
|
130
|
+
words: number;
|
|
131
|
+
graphemes: number;
|
|
132
|
+
priorNotices: number;
|
|
133
|
+
}>;
|
|
134
|
+
/** Pure: `priorInlineTexts` are the inline bodies already queued in the window, current excluded. */
|
|
135
|
+
export declare function assessAttentionSplit(input: Readonly<{
|
|
136
|
+
text: string;
|
|
137
|
+
purpose: AttentionPurpose;
|
|
138
|
+
priorInlineTexts: readonly string[];
|
|
139
|
+
}>): AttentionSplitVerdict;
|
|
140
|
+
/** One durable audit row; `sequence` is the read cursor. */
|
|
141
|
+
export interface AttentionAuditEntry extends AttentionAssessment {
|
|
142
|
+
sequence: number;
|
|
143
|
+
outboxId: string;
|
|
144
|
+
bindingId: string;
|
|
145
|
+
lane: AttentionLane;
|
|
146
|
+
sourceId: string;
|
|
147
|
+
recordedAt: number;
|
|
148
|
+
}
|
|
149
|
+
/** Reserved metadata of a work-item report the Host routed to a linked alias channel. */
|
|
150
|
+
export declare const linkedReportMetadataPrefix = "dsh.linked-report";
|
|
151
|
+
/** Reserved idempotency-key prefix of a Host-routed linked report. */
|
|
152
|
+
export declare const linkedReportKeyPrefix = "linked-report:";
|
|
153
|
+
export declare const NOTIFICATION_OUTCOME_FACTS_PROTOCOL: "assistant-delivery/notification-outcome-facts/v1";
|
|
154
|
+
/**
|
|
155
|
+
* WP22 read model: durable Delivery facts about one audited notification.
|
|
156
|
+
* It never carries message or reply text; Evaluation classifies the outcome.
|
|
157
|
+
*/
|
|
158
|
+
export interface NotificationOutcomeFact {
|
|
159
|
+
auditSequence: number;
|
|
160
|
+
outboxId: string;
|
|
161
|
+
bindingId: string;
|
|
162
|
+
scope: Readonly<{
|
|
163
|
+
workspace: string;
|
|
164
|
+
preset: string;
|
|
165
|
+
}>;
|
|
166
|
+
lane: AttentionLane;
|
|
167
|
+
sourceId: string;
|
|
168
|
+
purpose: AttentionPurpose;
|
|
169
|
+
purposeSource: AttentionPurposeSource;
|
|
170
|
+
workItemId?: string;
|
|
171
|
+
questionId?: string;
|
|
172
|
+
answersQuestionId?: string;
|
|
173
|
+
verdict: AttentionVerdict;
|
|
174
|
+
reasons: readonly AttentionAuditReason[];
|
|
175
|
+
auditedAt: number;
|
|
176
|
+
transport: Readonly<{
|
|
177
|
+
status: 'pending' | 'attempting' | 'accepted' | 'delivered' | 'read' | 'retry_wait' | 'dead' | 'unknown_after_send';
|
|
178
|
+
acceptedAt?: number;
|
|
179
|
+
deliveredAt?: number;
|
|
180
|
+
readAt?: number;
|
|
181
|
+
}>;
|
|
182
|
+
/**
|
|
183
|
+
* Completeness of this channel's read receipts at classification time.
|
|
184
|
+
* Present only when the registered adapter declares it explicitly.
|
|
185
|
+
*/
|
|
186
|
+
readReceipts?: 'none' | 'best-effort' | 'complete';
|
|
187
|
+
/** Earliest owner Inbox message on the same binding that replies to this notification. */
|
|
188
|
+
reaction?: Readonly<{
|
|
189
|
+
firstAt: number;
|
|
190
|
+
count: number;
|
|
191
|
+
}>;
|
|
192
|
+
/** Current Host-recorded owner judgement; `unknown` means withdrawn. */
|
|
193
|
+
judgement?: Readonly<{
|
|
194
|
+
source: 'owner-objective' | 'work-item-feedback';
|
|
195
|
+
version: number;
|
|
196
|
+
objectiveStatus: 'achieved' | 'partial' | 'not-achieved' | 'unknown';
|
|
197
|
+
}>;
|
|
198
|
+
/**
|
|
199
|
+
* Present only for a Host-routed linked work-item report (cross-channel
|
|
200
|
+
* fallback to an owner alias); `originBindingId` is the unavailable origin.
|
|
201
|
+
* Absent means the notification went to its own binding.
|
|
202
|
+
*/
|
|
203
|
+
route?: Readonly<{
|
|
204
|
+
kind: 'linked';
|
|
205
|
+
originBindingId: string;
|
|
206
|
+
}>;
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=attention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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