@mono-agent/agent-app 0.11.3 → 0.11.4
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/README.md +222 -26
- package/dist/adapter-send-tools-main.js +7 -1
- package/dist/adapter-send-tools-main.js.map +1 -1
- package/dist/adapter-send-tools.d.ts +19 -1
- package/dist/adapter-send-tools.d.ts.map +1 -1
- package/dist/adapter-send-tools.js +127 -13
- package/dist/adapter-send-tools.js.map +1 -1
- package/dist/app-config.d.ts.map +1 -1
- package/dist/app-config.js +15 -2
- package/dist/app-config.js.map +1 -1
- package/dist/app-controller-channels.d.ts +8 -0
- package/dist/app-controller-channels.d.ts.map +1 -0
- package/dist/app-controller-channels.js +207 -0
- package/dist/app-controller-channels.js.map +1 -0
- package/dist/app-controller-continuation.d.ts +26 -0
- package/dist/app-controller-continuation.d.ts.map +1 -0
- package/dist/app-controller-continuation.js +198 -0
- package/dist/app-controller-continuation.js.map +1 -0
- package/dist/app-controller-lifecycle.d.ts +6 -0
- package/dist/app-controller-lifecycle.d.ts.map +1 -0
- package/dist/app-controller-lifecycle.js +81 -0
- package/dist/app-controller-lifecycle.js.map +1 -0
- package/dist/app-controller-maintenance.d.ts +13 -0
- package/dist/app-controller-maintenance.d.ts.map +1 -0
- package/dist/app-controller-maintenance.js +180 -0
- package/dist/app-controller-maintenance.js.map +1 -0
- package/dist/app-controller-memory-health.d.ts +12 -0
- package/dist/app-controller-memory-health.d.ts.map +1 -0
- package/dist/app-controller-memory-health.js +160 -0
- package/dist/app-controller-memory-health.js.map +1 -0
- package/dist/app-controller-memory.d.ts +9 -0
- package/dist/app-controller-memory.d.ts.map +1 -0
- package/dist/app-controller-memory.js +83 -0
- package/dist/app-controller-memory.js.map +1 -0
- package/dist/app-controller-responder.d.ts +20 -0
- package/dist/app-controller-responder.d.ts.map +1 -0
- package/dist/app-controller-responder.js +246 -0
- package/dist/app-controller-responder.js.map +1 -0
- package/dist/app-controller-traceability.d.ts +25 -0
- package/dist/app-controller-traceability.d.ts.map +1 -0
- package/dist/app-controller-traceability.js +418 -0
- package/dist/app-controller-traceability.js.map +1 -0
- package/dist/app-controller-utils.d.ts +38 -0
- package/dist/app-controller-utils.d.ts.map +1 -0
- package/dist/app-controller-utils.js +185 -0
- package/dist/app-controller-utils.js.map +1 -0
- package/dist/app-controller.d.ts +400 -0
- package/dist/app-controller.d.ts.map +1 -0
- package/dist/app-controller.js +336 -0
- package/dist/app-controller.js.map +1 -0
- package/dist/app.d.ts +7 -115
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +6 -1912
- package/dist/app.js.map +1 -1
- package/dist/artifact-retention.d.ts +4 -0
- package/dist/artifact-retention.d.ts.map +1 -1
- package/dist/artifact-retention.js +38 -0
- package/dist/artifact-retention.js.map +1 -1
- package/dist/backfill.d.ts +3 -1
- package/dist/backfill.d.ts.map +1 -1
- package/dist/backfill.js +5 -1
- package/dist/backfill.js.map +1 -1
- package/dist/background-runtime.d.ts +27 -0
- package/dist/background-runtime.d.ts.map +1 -1
- package/dist/background-runtime.js +383 -205
- package/dist/background-runtime.js.map +1 -1
- package/dist/background-worker-lease.d.ts.map +1 -1
- package/dist/background-worker-lease.js +41 -241
- package/dist/background-worker-lease.js.map +1 -1
- package/dist/background.d.ts +31 -9
- package/dist/background.d.ts.map +1 -1
- package/dist/background.js +543 -272
- package/dist/background.js.map +1 -1
- package/dist/channel-drivers/cron.d.ts +11 -0
- package/dist/channel-drivers/cron.d.ts.map +1 -0
- package/dist/channel-drivers/cron.js +168 -0
- package/dist/channel-drivers/cron.js.map +1 -0
- package/dist/channel-drivers/live.d.ts +11 -0
- package/dist/channel-drivers/live.d.ts.map +1 -0
- package/dist/channel-drivers/live.js +47 -0
- package/dist/channel-drivers/live.js.map +1 -0
- package/dist/channel-drivers/native-notify.d.ts +27 -0
- package/dist/channel-drivers/native-notify.d.ts.map +1 -0
- package/dist/channel-drivers/native-notify.js +94 -0
- package/dist/channel-drivers/native-notify.js.map +1 -0
- package/dist/channel-drivers/openai-api.d.ts +7 -0
- package/dist/channel-drivers/openai-api.d.ts.map +1 -0
- package/dist/channel-drivers/openai-api.js +63 -0
- package/dist/channel-drivers/openai-api.js.map +1 -0
- package/dist/channel-drivers/shared.d.ts +4 -0
- package/dist/channel-drivers/shared.d.ts.map +1 -0
- package/dist/channel-drivers/shared.js +5 -0
- package/dist/channel-drivers/shared.js.map +1 -0
- package/dist/channel-drivers/slack.d.ts +14 -0
- package/dist/channel-drivers/slack.d.ts.map +1 -0
- package/dist/channel-drivers/slack.js +227 -0
- package/dist/channel-drivers/slack.js.map +1 -0
- package/dist/channel-drivers/telegram.d.ts +11 -0
- package/dist/channel-drivers/telegram.d.ts.map +1 -0
- package/dist/channel-drivers/telegram.js +244 -0
- package/dist/channel-drivers/telegram.js.map +1 -0
- package/dist/channel-drivers/tui.d.ts +15 -0
- package/dist/channel-drivers/tui.d.ts.map +1 -0
- package/dist/channel-drivers/tui.js +108 -0
- package/dist/channel-drivers/tui.js.map +1 -0
- package/dist/channel-drivers/webhook.d.ts +7 -0
- package/dist/channel-drivers/webhook.d.ts.map +1 -0
- package/dist/channel-drivers/webhook.js +115 -0
- package/dist/channel-drivers/webhook.js.map +1 -0
- package/dist/channels.d.ts +21 -81
- package/dist/channels.d.ts.map +1 -1
- package/dist/channels.js +11 -1174
- package/dist/channels.js.map +1 -1
- package/dist/cli-args.d.ts +121 -0
- package/dist/cli-args.d.ts.map +1 -0
- package/dist/cli-args.js +532 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli-background-command.d.ts +59 -0
- package/dist/cli-background-command.d.ts.map +1 -0
- package/dist/cli-background-command.js +475 -0
- package/dist/cli-background-command.js.map +1 -0
- package/dist/cli-cancellation.d.ts +6 -0
- package/dist/cli-cancellation.d.ts.map +1 -0
- package/dist/cli-cancellation.js +23 -0
- package/dist/cli-cancellation.js.map +1 -0
- package/dist/cli-commands.d.ts +12 -0
- package/dist/cli-commands.d.ts.map +1 -0
- package/dist/cli-commands.js +306 -0
- package/dist/cli-commands.js.map +1 -0
- package/dist/cli-help.d.ts +11 -0
- package/dist/cli-help.d.ts.map +1 -0
- package/dist/cli-help.js +262 -0
- package/dist/cli-help.js.map +1 -0
- package/dist/cli-init-command.d.ts +60 -0
- package/dist/cli-init-command.d.ts.map +1 -0
- package/dist/cli-init-command.js +1910 -0
- package/dist/cli-init-command.js.map +1 -0
- package/dist/cli-install-skill-command.d.ts +3 -0
- package/dist/cli-install-skill-command.d.ts.map +1 -0
- package/dist/cli-install-skill-command.js +51 -0
- package/dist/cli-install-skill-command.js.map +1 -0
- package/dist/cli-sandbox-command.d.ts +10 -0
- package/dist/cli-sandbox-command.d.ts.map +1 -0
- package/dist/cli-sandbox-command.js +100 -0
- package/dist/cli-sandbox-command.js.map +1 -0
- package/dist/cli-validate-config-command.d.ts +36 -0
- package/dist/cli-validate-config-command.d.ts.map +1 -0
- package/dist/cli-validate-config-command.js +317 -0
- package/dist/cli-validate-config-command.js.map +1 -0
- package/dist/cli.d.ts +6 -248
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -3792
- package/dist/cli.js.map +1 -1
- package/dist/config-reference.d.ts +2 -1
- package/dist/config-reference.d.ts.map +1 -1
- package/dist/config-reference.js +14 -3
- package/dist/config-reference.js.map +1 -1
- package/dist/configured-agent.d.ts +23 -0
- package/dist/configured-agent.d.ts.map +1 -1
- package/dist/configured-agent.js +89 -12
- package/dist/configured-agent.js.map +1 -1
- package/dist/continuation-dispatch-worker.d.ts +21 -0
- package/dist/continuation-dispatch-worker.d.ts.map +1 -0
- package/dist/continuation-dispatch-worker.js +425 -0
- package/dist/continuation-dispatch-worker.js.map +1 -0
- package/dist/continuation-http-routes.d.ts +15 -0
- package/dist/continuation-http-routes.d.ts.map +1 -0
- package/dist/continuation-http-routes.js +265 -0
- package/dist/continuation-http-routes.js.map +1 -0
- package/dist/continuation-operator-api.d.ts +18 -0
- package/dist/continuation-operator-api.d.ts.map +1 -0
- package/dist/continuation-operator-api.js +164 -0
- package/dist/continuation-operator-api.js.map +1 -0
- package/dist/continuation-origin-store.d.ts +19 -0
- package/dist/continuation-origin-store.d.ts.map +1 -0
- package/dist/continuation-origin-store.js +273 -0
- package/dist/continuation-origin-store.js.map +1 -0
- package/dist/continuation-service-errors.d.ts +18 -0
- package/dist/continuation-service-errors.d.ts.map +1 -0
- package/dist/continuation-service-errors.js +35 -0
- package/dist/continuation-service-errors.js.map +1 -0
- package/dist/continuation-service-helpers.d.ts +39 -0
- package/dist/continuation-service-helpers.d.ts.map +1 -0
- package/dist/continuation-service-helpers.js +308 -0
- package/dist/continuation-service-helpers.js.map +1 -0
- package/dist/continuation-service-origin.d.ts +55 -0
- package/dist/continuation-service-origin.d.ts.map +1 -0
- package/dist/continuation-service-origin.js +325 -0
- package/dist/continuation-service-origin.js.map +1 -0
- package/dist/continuation-service-types.d.ts +110 -0
- package/dist/continuation-service-types.d.ts.map +1 -0
- package/dist/continuation-service-types.js +11 -0
- package/dist/continuation-service-types.js.map +1 -0
- package/dist/continuation-service.d.ts +4 -97
- package/dist/continuation-service.d.ts.map +1 -1
- package/dist/continuation-service.js +9 -1525
- package/dist/continuation-service.js.map +1 -1
- package/dist/continuation-store-fs.d.ts +15 -0
- package/dist/continuation-store-fs.d.ts.map +1 -0
- package/dist/continuation-store-fs.js +247 -0
- package/dist/continuation-store-fs.js.map +1 -0
- package/dist/continuation-store-policy.d.ts +21 -0
- package/dist/continuation-store-policy.d.ts.map +1 -0
- package/dist/continuation-store-policy.js +278 -0
- package/dist/continuation-store-policy.js.map +1 -0
- package/dist/continuation-store-records.d.ts +9 -0
- package/dist/continuation-store-records.d.ts.map +1 -0
- package/dist/continuation-store-records.js +221 -0
- package/dist/continuation-store-records.js.map +1 -0
- package/dist/continuation-store-types.d.ts +173 -0
- package/dist/continuation-store-types.d.ts.map +1 -0
- package/dist/continuation-store-types.js +26 -0
- package/dist/continuation-store-types.js.map +1 -0
- package/dist/continuation-store.d.ts +4 -138
- package/dist/continuation-store.d.ts.map +1 -1
- package/dist/continuation-store.js +145 -1049
- package/dist/continuation-store.js.map +1 -1
- package/dist/doctor.d.ts +5 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +575 -38
- package/dist/doctor.js.map +1 -1
- package/dist/init.d.ts +2 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +92 -239
- package/dist/init.js.map +1 -1
- package/dist/interaction-bridge.d.ts +19 -0
- package/dist/interaction-bridge.d.ts.map +1 -1
- package/dist/interaction-bridge.js +130 -0
- package/dist/interaction-bridge.js.map +1 -1
- package/dist/launchd-logs.d.ts +91 -0
- package/dist/launchd-logs.d.ts.map +1 -0
- package/dist/launchd-logs.js +1499 -0
- package/dist/launchd-logs.js.map +1 -0
- package/dist/launchd.d.ts +27 -0
- package/dist/launchd.d.ts.map +1 -1
- package/dist/launchd.js +89 -10
- package/dist/launchd.js.map +1 -1
- package/dist/memory-command.d.ts +2 -0
- package/dist/memory-command.d.ts.map +1 -1
- package/dist/memory-command.js +161 -48
- package/dist/memory-command.js.map +1 -1
- package/dist/memory-recall-settings.d.ts +64 -0
- package/dist/memory-recall-settings.d.ts.map +1 -0
- package/dist/memory-recall-settings.js +51 -0
- package/dist/memory-recall-settings.js.map +1 -0
- package/dist/memory-recall.d.ts +7 -95
- package/dist/memory-recall.d.ts.map +1 -1
- package/dist/memory-recall.js +8 -143
- package/dist/memory-recall.js.map +1 -1
- package/dist/memory-rituals.d.ts +3 -3
- package/dist/memory-rituals.d.ts.map +1 -1
- package/dist/memory-rituals.js +16 -111
- package/dist/memory-rituals.js.map +1 -1
- package/dist/modules/catalog.js +2 -2
- package/dist/modules/catalog.js.map +1 -1
- package/dist/modules/known-tools.d.ts +8 -6
- package/dist/modules/known-tools.d.ts.map +1 -1
- package/dist/modules/known-tools.js +8 -6
- package/dist/modules/known-tools.js.map +1 -1
- package/dist/notify-destinations.d.ts +5 -0
- package/dist/notify-destinations.d.ts.map +1 -1
- package/dist/notify-destinations.js +7 -1
- package/dist/notify-destinations.js.map +1 -1
- package/dist/owner-private-lock.d.ts +95 -0
- package/dist/owner-private-lock.d.ts.map +1 -0
- package/dist/owner-private-lock.js +566 -0
- package/dist/owner-private-lock.js.map +1 -0
- package/dist/pi-oauth-login.d.ts +2 -0
- package/dist/pi-oauth-login.d.ts.map +1 -1
- package/dist/pi-oauth-login.js +39 -5
- package/dist/pi-oauth-login.js.map +1 -1
- package/dist/posted-message-index.d.ts +35 -16
- package/dist/posted-message-index.d.ts.map +1 -1
- package/dist/posted-message-index.js +1068 -52
- package/dist/posted-message-index.js.map +1 -1
- package/dist/posted-reply-history.d.ts +17 -0
- package/dist/posted-reply-history.d.ts.map +1 -0
- package/dist/posted-reply-history.js +169 -0
- package/dist/posted-reply-history.js.map +1 -0
- package/dist/proactive-notify.d.ts.map +1 -1
- package/dist/proactive-notify.js +6 -4
- package/dist/proactive-notify.js.map +1 -1
- package/dist/project-skills.d.ts +4 -0
- package/dist/project-skills.d.ts.map +1 -1
- package/dist/project-skills.js +99 -130
- package/dist/project-skills.js.map +1 -1
- package/dist/provider-setup.d.ts +0 -1
- package/dist/provider-setup.d.ts.map +1 -1
- package/dist/provider-setup.js +0 -3
- package/dist/provider-setup.js.map +1 -1
- package/dist/readiness-probe-worker.d.ts +61 -1
- package/dist/readiness-probe-worker.d.ts.map +1 -1
- package/dist/readiness-probe-worker.js +49 -56
- package/dist/readiness-probe-worker.js.map +1 -1
- package/dist/readiness-probe.d.ts +6 -9
- package/dist/readiness-probe.d.ts.map +1 -1
- package/dist/readiness-probe.js +23 -56
- package/dist/readiness-probe.js.map +1 -1
- package/dist/redact-secrets.d.ts +15 -0
- package/dist/redact-secrets.d.ts.map +1 -0
- package/dist/redact-secrets.js +65 -0
- package/dist/redact-secrets.js.map +1 -0
- package/dist/run-history.js +34 -24
- package/dist/run-history.js.map +1 -1
- package/dist/runtime-provenance.d.ts +8 -0
- package/dist/runtime-provenance.d.ts.map +1 -0
- package/dist/runtime-provenance.js +225 -0
- package/dist/runtime-provenance.js.map +1 -0
- package/dist/sandbox-manager.d.ts +4 -1
- package/dist/sandbox-manager.d.ts.map +1 -1
- package/dist/sandbox-manager.js +114 -273
- package/dist/sandbox-manager.js.map +1 -1
- package/dist/secure-file-replace.d.ts +49 -0
- package/dist/secure-file-replace.d.ts.map +1 -0
- package/dist/secure-file-replace.js +270 -0
- package/dist/secure-file-replace.js.map +1 -0
- package/dist/seen-conversations.d.ts +32 -5
- package/dist/seen-conversations.d.ts.map +1 -1
- package/dist/seen-conversations.js +145 -15
- package/dist/seen-conversations.js.map +1 -1
- package/dist/sessions.d.ts +20 -0
- package/dist/sessions.d.ts.map +1 -1
- package/dist/sessions.js +41 -6
- package/dist/sessions.js.map +1 -1
- package/dist/wizard/index.d.ts +2 -2
- package/dist/wizard/index.d.ts.map +1 -1
- package/dist/wizard/index.js +1 -1
- package/dist/wizard/index.js.map +1 -1
- package/dist/wizard/presets.d.ts +2 -1
- package/dist/wizard/presets.d.ts.map +1 -1
- package/dist/wizard/presets.js +2 -1
- package/dist/wizard/presets.js.map +1 -1
- package/dist/wizard/run.d.ts +0 -26
- package/dist/wizard/run.d.ts.map +1 -1
- package/dist/wizard/run.js +0 -53
- package/dist/wizard/run.js.map +1 -1
- package/package.json +21 -16
- package/schema/mono-agent.config.schema.json +17 -6
- package/skills/mono-agent-composer/SKILL.md +3 -3
- package/skills/mono-agent-composer/references/config-blueprint.md +41 -22
- package/skills/mono-agent-composer/references/discovery-questions.md +4 -4
- package/skills/mono-agent-composer/references/feature-coverage.md +14 -14
- package/skills/mono-agent-composer/references/package-map.md +3 -3
- package/skills/mono-agent-composer/references/playbooks.md +38 -20
- package/skills/mono-agent-composer/references/validation.md +16 -3
package/dist/pi-oauth-login.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { constants as fsConstants } from "node:fs";
|
|
2
|
+
import { open } from "node:fs/promises";
|
|
2
3
|
import { createInterface } from "node:readline";
|
|
3
4
|
import { getOAuthProvider, } from "@earendil-works/pi-ai/oauth";
|
|
4
5
|
/**
|
|
@@ -16,6 +17,7 @@ export async function runPiOAuthLogin(providerId, options = {}) {
|
|
|
16
17
|
if (provider === undefined || provider.id !== providerId) {
|
|
17
18
|
throw new Error(`Unknown bundled Pi OAuth provider: ${providerId}`);
|
|
18
19
|
}
|
|
20
|
+
assertPiOAuthLoginPersistenceSupported(process.platform);
|
|
19
21
|
const readline = options.io === undefined
|
|
20
22
|
? createInterface({ input: process.stdin, output: process.stdout })
|
|
21
23
|
: undefined;
|
|
@@ -49,31 +51,63 @@ export async function runPiOAuthLogin(providerId, options = {}) {
|
|
|
49
51
|
const credentials = await provider.login(callbacks);
|
|
50
52
|
const authPath = options.authPath ?? "auth.json";
|
|
51
53
|
const auth = await readAuth(authPath);
|
|
52
|
-
await
|
|
54
|
+
await writeAuth(authPath, `${JSON.stringify({
|
|
53
55
|
...auth,
|
|
54
56
|
[providerId]: { type: "oauth", ...credentials },
|
|
55
|
-
}, null, 2)}\n
|
|
56
|
-
await chmod(authPath, 0o600);
|
|
57
|
+
}, null, 2)}\n`);
|
|
57
58
|
io.write(`\nCredentials saved to ${authPath}\n`);
|
|
58
59
|
}
|
|
59
60
|
finally {
|
|
60
61
|
readline?.close();
|
|
61
62
|
}
|
|
62
63
|
}
|
|
64
|
+
/** @internal Exported only for deterministic platform-policy tests. */
|
|
65
|
+
export function assertPiOAuthLoginPersistenceSupported(platform) {
|
|
66
|
+
if (platform === "win32") {
|
|
67
|
+
throw new Error("Direct Pi OAuth credential persistence is unavailable on Windows because symlink-safe owner-only writes cannot be verified.");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
63
70
|
async function readAuth(path) {
|
|
71
|
+
let handle;
|
|
64
72
|
let contents;
|
|
65
73
|
try {
|
|
66
|
-
|
|
74
|
+
handle = await open(path, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK);
|
|
75
|
+
if (!(await handle.stat()).isFile()) {
|
|
76
|
+
throw new Error(`${path} must be a regular file.`);
|
|
77
|
+
}
|
|
78
|
+
contents = await handle.readFile("utf8");
|
|
67
79
|
}
|
|
68
80
|
catch (error) {
|
|
69
81
|
if (error.code === "ENOENT")
|
|
70
82
|
return {};
|
|
71
83
|
throw error;
|
|
72
84
|
}
|
|
85
|
+
finally {
|
|
86
|
+
await handle?.close();
|
|
87
|
+
}
|
|
73
88
|
const parsed = JSON.parse(contents);
|
|
74
89
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
75
90
|
throw new Error(`${path} must contain a JSON object.`);
|
|
76
91
|
}
|
|
77
92
|
return parsed;
|
|
78
93
|
}
|
|
94
|
+
async function writeAuth(path, contents) {
|
|
95
|
+
let handle;
|
|
96
|
+
try {
|
|
97
|
+
handle = await open(path, fsConstants.O_WRONLY | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK | fsConstants.O_CREAT, 0o600);
|
|
98
|
+
if (!(await handle.stat()).isFile()) {
|
|
99
|
+
throw new Error(`${path} must be a regular file.`);
|
|
100
|
+
}
|
|
101
|
+
// Tighten an existing file through the already-open inode before replacing
|
|
102
|
+
// its contents, so new credentials are never exposed under an old mode.
|
|
103
|
+
await handle.chmod(0o600);
|
|
104
|
+
// O_WRONLY opens at offset zero. Truncate explicitly so a shorter JSON
|
|
105
|
+
// replacement cannot retain bytes from the prior credential store.
|
|
106
|
+
await handle.truncate(0);
|
|
107
|
+
await handle.writeFile(contents, "utf8");
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
await handle?.close();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
79
113
|
//# sourceMappingURL=pi-oauth-login.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi-oauth-login.js","sourceRoot":"","sources":["../src/pi-oauth-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pi-oauth-login.js","sourceRoot":"","sources":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M,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -11,14 +11,27 @@
|
|
|
11
11
|
* producing conversationId`; the consumer (inbound dispatch) looks it up and
|
|
12
12
|
* aliases the reply onto the producing conversation.
|
|
13
13
|
*
|
|
14
|
-
* Storage is
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* Storage is a JSONL file inside the run-artifact dir. Appenders, readers,
|
|
15
|
+
* startup maintenance, recovery, and compaction serialize through one
|
|
16
|
+
* owner-only SQLite coordinator. Compaction appends a durable recovery trailer
|
|
17
|
+
* to the verified index inode, then rewrites that same inode through its pinned
|
|
18
|
+
* descriptor; it never promotes or later reopens a source pathname. The index
|
|
19
|
+
* and coordinator are opened no-follow and must remain current-owner, regular,
|
|
20
|
+
* single-link files. These files are ignored by the `.summary.json` artifact
|
|
21
|
+
* scanners (see `seen-conversations.ts`), so they never collide with run-artifact
|
|
22
|
+
* tooling.
|
|
20
23
|
*/
|
|
21
24
|
export declare const POSTED_MESSAGE_INDEX_FILENAME = "posted-message-index.jsonl";
|
|
25
|
+
interface PostedMessageIndexCompactionHooks {
|
|
26
|
+
readonly beforePrepare?: () => Promise<void>;
|
|
27
|
+
/** Test-only boundary after recovery bytes but before the commit footer. */
|
|
28
|
+
readonly afterPrepareBody?: () => Promise<void>;
|
|
29
|
+
readonly beforeReplace?: () => Promise<void>;
|
|
30
|
+
/** Test-only boundary after the final pathname checks and before pinned-FD rewrite. */
|
|
31
|
+
readonly afterPromotionChecks?: (indexPath: string) => Promise<void>;
|
|
32
|
+
/** Test-only boundary after the replacement prefix is durable but before truncate. */
|
|
33
|
+
readonly afterRewriteSync?: () => Promise<void>;
|
|
34
|
+
}
|
|
22
35
|
export interface PostedMessageEntry {
|
|
23
36
|
/** Slack channel/DM id the message was posted to. */
|
|
24
37
|
readonly channelId: string;
|
|
@@ -34,17 +47,22 @@ export declare function resolvePostedMessageIndexPath(artifactDir: string): stri
|
|
|
34
47
|
/** Strip a trailing daily-rollover bucket so the stored id is the base producing id. */
|
|
35
48
|
export declare function basePostedConversationId(conversationId: string): string;
|
|
36
49
|
/**
|
|
37
|
-
* Record that `conversationId` posted a message at `(channelId, ts)`.
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* the
|
|
50
|
+
* Record that `conversationId` posted a message at `(channelId, ts)`. Appenders in
|
|
51
|
+
* both the adapter and its stdio child share a filesystem lock with compaction, so
|
|
52
|
+
* a rewrite cannot discard a completed concurrent append. Once the cap is reached,
|
|
53
|
+
* compaction drops a batch of oldest entries before appending; this keeps the file
|
|
54
|
+
* at or below the cap without a full rewrite on every later send.
|
|
55
|
+
*
|
|
56
|
+
* Best-effort: a failed index write or lock acquisition must never fail the Slack
|
|
57
|
+
* post, so this function swallows errors. The stored conversationId is de-bucketed
|
|
58
|
+
* so the consumer can let the responder re-bucket to the reply's own day
|
|
59
|
+
* (consistent with daily session rollover).
|
|
42
60
|
*/
|
|
43
61
|
export declare function appendPostedMessage(indexPath: string, entry: {
|
|
44
62
|
channelId: string;
|
|
45
63
|
ts: string;
|
|
46
64
|
conversationId: string;
|
|
47
|
-
}, now?: () => Date): Promise<void>;
|
|
65
|
+
}, now?: () => Date, maxEntries?: number, compactionHooks?: PostedMessageIndexCompactionHooks): Promise<void>;
|
|
48
66
|
/**
|
|
49
67
|
* Resolve the producing conversationId for a posted message, newest write wins.
|
|
50
68
|
* Returns `undefined` when the file is missing or has no matching entry, so the
|
|
@@ -53,9 +71,10 @@ export declare function appendPostedMessage(indexPath: string, entry: {
|
|
|
53
71
|
export declare function lookupProducingConversation(indexPath: string, channelId: string, ts: string): Promise<string | undefined>;
|
|
54
72
|
/**
|
|
55
73
|
* Bound file growth by rewriting the index with only the newest `maxEntries`
|
|
56
|
-
* (by write time, de-duped to the newest entry per `channel+ts`).
|
|
57
|
-
*
|
|
58
|
-
*
|
|
74
|
+
* (by write time, de-duped to the newest entry per `channel+ts`). Slack-driver
|
|
75
|
+
* startup invokes this exact routine, and every appender also uses the same
|
|
76
|
+
* unlocked implementation after taking this cross-process lock. Best-effort.
|
|
59
77
|
*/
|
|
60
|
-
export declare function compactPostedMessageIndex(indexPath: string, maxEntries?: number): Promise<void>;
|
|
78
|
+
export declare function compactPostedMessageIndex(indexPath: string, maxEntries?: number, hooks?: PostedMessageIndexCompactionHooks): Promise<void>;
|
|
79
|
+
export {};
|
|
61
80
|
//# sourceMappingURL=posted-message-index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posted-message-index.d.ts","sourceRoot":"","sources":["../src/posted-message-index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"posted-message-index.d.ts","sourceRoot":"","sources":["../src/posted-message-index.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,eAAO,MAAM,6BAA6B,+BAA+B,CAAC;AAuD1E,UAAU,iCAAiC;IACzC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,4EAA4E;IAC5E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,uFAAuF;IACvF,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,sFAAsF;IACtF,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;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