@jungjaehoon/mama-os 0.78.0 → 0.79.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/CHANGELOG.md +341 -0
- package/README.md +38 -24
- package/db/migrations/002-model-runs-parent-index.sql +11 -0
- package/db/migrations/003-upkeep-settled.sql +15 -0
- package/dist/api/google-read-actions.d.ts +30 -0
- package/dist/api/google-read-actions.d.ts.map +1 -0
- package/dist/api/google-read-actions.js +256 -0
- package/dist/api/google-read-actions.js.map +1 -0
- package/dist/api/record-actions.d.ts.map +1 -1
- package/dist/api/record-actions.js +23 -5
- package/dist/api/record-actions.js.map +1 -1
- package/dist/api/report-handler.d.ts +0 -6
- package/dist/api/report-handler.d.ts.map +1 -1
- package/dist/api/report-handler.js +0 -54
- package/dist/api/report-handler.js.map +1 -1
- package/dist/api/security-events.d.ts +1 -1
- package/dist/api/security-events.d.ts.map +1 -1
- package/dist/api/security-events.js.map +1 -1
- package/dist/api/source-actions.d.ts +9 -0
- package/dist/api/source-actions.d.ts.map +1 -1
- package/dist/api/source-actions.js +49 -0
- package/dist/api/source-actions.js.map +1 -1
- package/dist/api/viewer-request-security.d.ts +14 -1
- package/dist/api/viewer-request-security.d.ts.map +1 -1
- package/dist/api/viewer-request-security.js +26 -3
- package/dist/api/viewer-request-security.js.map +1 -1
- package/dist/api/viewer-server.d.ts +7 -0
- package/dist/api/viewer-server.d.ts.map +1 -1
- package/dist/api/viewer-server.js +32 -0
- package/dist/api/viewer-server.js.map +1 -1
- package/dist/api/work-actions.d.ts +19 -2
- package/dist/api/work-actions.d.ts.map +1 -1
- package/dist/api/work-actions.js +15 -0
- package/dist/api/work-actions.js.map +1 -1
- package/dist/cli/commands/backup.d.ts +7 -6
- package/dist/cli/commands/backup.d.ts.map +1 -1
- package/dist/cli/commands/backup.js +44 -7
- package/dist/cli/commands/backup.js.map +1 -1
- package/dist/cli/commands/control.d.ts +22 -4
- package/dist/cli/commands/control.d.ts.map +1 -1
- package/dist/cli/commands/control.js +172 -11
- package/dist/cli/commands/control.js.map +1 -1
- package/dist/cli/commands/daemon.d.ts +13 -2
- package/dist/cli/commands/daemon.d.ts.map +1 -1
- package/dist/cli/commands/daemon.js +211 -5
- package/dist/cli/commands/daemon.js.map +1 -1
- package/dist/cli/commands/init-questions.d.ts +110 -0
- package/dist/cli/commands/init-questions.d.ts.map +1 -0
- package/dist/cli/commands/init-questions.js +445 -0
- package/dist/cli/commands/init-questions.js.map +1 -0
- package/dist/cli/commands/init-section.d.ts +13 -0
- package/dist/cli/commands/init-section.d.ts.map +1 -0
- package/dist/cli/commands/init-section.js +439 -0
- package/dist/cli/commands/init-section.js.map +1 -0
- package/dist/cli/commands/init.d.ts +56 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +562 -351
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/node-move.d.ts +20 -0
- package/dist/cli/commands/node-move.d.ts.map +1 -0
- package/dist/cli/commands/node-move.js +289 -0
- package/dist/cli/commands/node-move.js.map +1 -0
- package/dist/cli/commands/register-owner.d.ts +3 -0
- package/dist/cli/commands/register-owner.d.ts.map +1 -1
- package/dist/cli/commands/register-owner.js +2 -0
- package/dist/cli/commands/register-owner.js.map +1 -1
- package/dist/cli/commands/restore.d.ts +2 -0
- package/dist/cli/commands/restore.d.ts.map +1 -1
- package/dist/cli/commands/restore.js +7 -0
- package/dist/cli/commands/restore.js.map +1 -1
- package/dist/cli/commands/service.d.ts +16 -0
- package/dist/cli/commands/service.d.ts.map +1 -1
- package/dist/cli/commands/service.js +36 -8
- package/dist/cli/commands/service.js.map +1 -1
- package/dist/cli/commands/tools.d.ts +1 -1
- package/dist/cli/commands/tools.d.ts.map +1 -1
- package/dist/cli/commands/tools.js +8 -3
- package/dist/cli/commands/tools.js.map +1 -1
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/commands/uninstall.js +123 -15
- package/dist/cli/commands/uninstall.js.map +1 -1
- package/dist/cli/commands/update.d.ts +59 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +948 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/index.js +8 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/launch-files.d.ts +36 -0
- package/dist/cli/launch-files.d.ts.map +1 -1
- package/dist/cli/launch-files.js +94 -1
- package/dist/cli/launch-files.js.map +1 -1
- package/dist/cli/prompt.d.ts +2 -1
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +5 -2
- package/dist/cli/prompt.js.map +1 -1
- package/dist/cli/runtime/backup.d.ts +17 -1
- package/dist/cli/runtime/backup.d.ts.map +1 -1
- package/dist/cli/runtime/backup.js +32 -4
- package/dist/cli/runtime/backup.js.map +1 -1
- package/dist/cli/runtime/daemon-control.d.ts +92 -7
- package/dist/cli/runtime/daemon-control.d.ts.map +1 -1
- package/dist/cli/runtime/daemon-control.js +183 -8
- package/dist/cli/runtime/daemon-control.js.map +1 -1
- package/dist/cli/runtime/default-roots.d.ts +27 -0
- package/dist/cli/runtime/default-roots.d.ts.map +1 -0
- package/dist/cli/runtime/default-roots.js +61 -0
- package/dist/cli/runtime/default-roots.js.map +1 -0
- package/dist/cli/runtime/diagnostics.d.ts +25 -0
- package/dist/cli/runtime/diagnostics.d.ts.map +1 -1
- package/dist/cli/runtime/diagnostics.js +250 -63
- package/dist/cli/runtime/diagnostics.js.map +1 -1
- package/dist/cli/runtime/init-state.d.ts +20 -0
- package/dist/cli/runtime/init-state.d.ts.map +1 -0
- package/dist/cli/runtime/init-state.js +51 -0
- package/dist/cli/runtime/init-state.js.map +1 -0
- package/dist/cli/runtime/install-kind.d.ts +54 -0
- package/dist/cli/runtime/install-kind.d.ts.map +1 -0
- package/dist/cli/runtime/install-kind.js +164 -0
- package/dist/cli/runtime/install-kind.js.map +1 -0
- package/dist/cli/runtime/node-move-journal.d.ts +44 -0
- package/dist/cli/runtime/node-move-journal.d.ts.map +1 -0
- package/dist/cli/runtime/node-move-journal.js +48 -0
- package/dist/cli/runtime/node-move-journal.js.map +1 -0
- package/dist/cli/runtime/release-check.d.ts +94 -0
- package/dist/cli/runtime/release-check.d.ts.map +1 -0
- package/dist/cli/runtime/release-check.js +316 -0
- package/dist/cli/runtime/release-check.js.map +1 -0
- package/dist/cli/runtime/setup-page.d.ts +57 -0
- package/dist/cli/runtime/setup-page.d.ts.map +1 -0
- package/dist/cli/runtime/setup-page.js +266 -0
- package/dist/cli/runtime/setup-page.js.map +1 -0
- package/dist/cli/runtime/source-tools.d.ts +60 -0
- package/dist/cli/runtime/source-tools.d.ts.map +1 -0
- package/dist/cli/runtime/source-tools.js +170 -0
- package/dist/cli/runtime/source-tools.js.map +1 -0
- package/dist/cli/runtime/telegram-pairing.d.ts +73 -0
- package/dist/cli/runtime/telegram-pairing.d.ts.map +1 -0
- package/dist/cli/runtime/telegram-pairing.js +184 -0
- package/dist/cli/runtime/telegram-pairing.js.map +1 -0
- package/dist/cli/runtime/update-journal.d.ts +135 -0
- package/dist/cli/runtime/update-journal.d.ts.map +1 -0
- package/dist/cli/runtime/update-journal.js +144 -0
- package/dist/cli/runtime/update-journal.js.map +1 -0
- package/dist/cli/runtime/update-progress.d.ts +95 -0
- package/dist/cli/runtime/update-progress.d.ts.map +1 -0
- package/dist/cli/runtime/update-progress.js +154 -0
- package/dist/cli/runtime/update-progress.js.map +1 -0
- package/dist/cli/runtime/update-request.d.ts +58 -0
- package/dist/cli/runtime/update-request.d.ts.map +1 -0
- package/dist/cli/runtime/update-request.js +172 -0
- package/dist/cli/runtime/update-request.js.map +1 -0
- package/dist/connectors/calendar/index.d.ts +5 -1
- package/dist/connectors/calendar/index.d.ts.map +1 -1
- package/dist/connectors/calendar/index.js +19 -28
- package/dist/connectors/calendar/index.js.map +1 -1
- package/dist/connectors/chatwork/index.d.ts.map +1 -1
- package/dist/connectors/chatwork/index.js +7 -3
- package/dist/connectors/chatwork/index.js.map +1 -1
- package/dist/connectors/config-loader.d.ts +5 -0
- package/dist/connectors/config-loader.d.ts.map +1 -1
- package/dist/connectors/config-loader.js +8 -0
- package/dist/connectors/config-loader.js.map +1 -1
- package/dist/connectors/discord/index.d.ts.map +1 -1
- package/dist/connectors/discord/index.js +4 -3
- package/dist/connectors/discord/index.js.map +1 -1
- package/dist/connectors/drive/index.d.ts.map +1 -1
- package/dist/connectors/drive/index.js +15 -13
- package/dist/connectors/drive/index.js.map +1 -1
- package/dist/connectors/framework/gws-utils.d.ts +62 -0
- package/dist/connectors/framework/gws-utils.d.ts.map +1 -1
- package/dist/connectors/framework/gws-utils.js +133 -3
- package/dist/connectors/framework/gws-utils.js.map +1 -1
- package/dist/connectors/framework/types.d.ts +24 -0
- package/dist/connectors/framework/types.d.ts.map +1 -1
- package/dist/connectors/framework/types.js +9 -0
- package/dist/connectors/framework/types.js.map +1 -1
- package/dist/connectors/gmail/index.d.ts.map +1 -1
- package/dist/connectors/gmail/index.js +14 -13
- package/dist/connectors/gmail/index.js.map +1 -1
- package/dist/connectors/index.d.ts +4 -4
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +4 -10
- package/dist/connectors/index.js.map +1 -1
- package/dist/connectors/notion/index.d.ts.map +1 -1
- package/dist/connectors/notion/index.js +5 -3
- package/dist/connectors/notion/index.js.map +1 -1
- package/dist/connectors/sheets/index.d.ts.map +1 -1
- package/dist/connectors/sheets/index.js +17 -12
- package/dist/connectors/sheets/index.js.map +1 -1
- package/dist/connectors/slack/index.d.ts.map +1 -1
- package/dist/connectors/slack/index.js +9 -3
- package/dist/connectors/slack/index.js.map +1 -1
- package/dist/connectors/telegram/index.d.ts.map +1 -1
- package/dist/connectors/telegram/index.js +4 -3
- package/dist/connectors/telegram/index.js.map +1 -1
- package/dist/connectors/trello/index.d.ts +1 -1
- package/dist/connectors/trello/index.d.ts.map +1 -1
- package/dist/connectors/trello/index.js +10 -5
- package/dist/connectors/trello/index.js.map +1 -1
- package/dist/gateways/discord.d.ts +6 -0
- package/dist/gateways/discord.d.ts.map +1 -1
- package/dist/gateways/discord.js +38 -27
- package/dist/gateways/discord.js.map +1 -1
- package/dist/gateways/slack.d.ts +6 -0
- package/dist/gateways/slack.d.ts.map +1 -1
- package/dist/gateways/slack.js +38 -27
- package/dist/gateways/slack.js.map +1 -1
- package/dist/gateways/telegram-commands.d.ts +124 -0
- package/dist/gateways/telegram-commands.d.ts.map +1 -0
- package/dist/gateways/telegram-commands.js +131 -0
- package/dist/gateways/telegram-commands.js.map +1 -0
- package/dist/gateways/telegram.d.ts +20 -0
- package/dist/gateways/telegram.d.ts.map +1 -1
- package/dist/gateways/telegram.js +138 -34
- package/dist/gateways/telegram.js.map +1 -1
- package/dist/gateways/turn-contract.d.ts +11 -0
- package/dist/gateways/turn-contract.d.ts.map +1 -1
- package/dist/runtime/action-surface.d.ts +1 -1
- package/dist/runtime/action-surface.d.ts.map +1 -1
- package/dist/runtime/action-surface.js +10 -0
- package/dist/runtime/action-surface.js.map +1 -1
- package/dist/runtime/backend-security.d.ts +23 -2
- package/dist/runtime/backend-security.d.ts.map +1 -1
- package/dist/runtime/backend-security.js +50 -5
- package/dist/runtime/backend-security.js.map +1 -1
- package/dist/runtime/member-paths.d.ts +15 -7
- package/dist/runtime/member-paths.d.ts.map +1 -1
- package/dist/runtime/member-paths.js +64 -12
- package/dist/runtime/member-paths.js.map +1 -1
- package/dist/runtime/member-session.d.ts +4 -0
- package/dist/runtime/member-session.d.ts.map +1 -1
- package/dist/runtime/member-session.js +23 -2
- package/dist/runtime/member-session.js.map +1 -1
- package/dist/runtime/native-session.d.ts +2 -0
- package/dist/runtime/native-session.d.ts.map +1 -1
- package/dist/runtime/native-session.js +1 -0
- package/dist/runtime/native-session.js.map +1 -1
- package/dist/runtime/owner-runtime.d.ts +63 -1
- package/dist/runtime/owner-runtime.d.ts.map +1 -1
- package/dist/runtime/owner-runtime.js +180 -3
- package/dist/runtime/owner-runtime.js.map +1 -1
- package/dist/runtime/owner-system-prompt.d.ts.map +1 -1
- package/dist/runtime/owner-system-prompt.js +0 -1
- package/dist/runtime/owner-system-prompt.js.map +1 -1
- package/dist/runtime/principal-access.d.ts +2 -0
- package/dist/runtime/principal-access.d.ts.map +1 -1
- package/dist/runtime/principal-access.js +7 -0
- package/dist/runtime/principal-access.js.map +1 -1
- package/dist/runtime/principal-sessions.d.ts.map +1 -1
- package/dist/runtime/principal-sessions.js +8 -1
- package/dist/runtime/principal-sessions.js.map +1 -1
- package/dist/runtime/record-orders.d.ts.map +1 -1
- package/dist/runtime/record-orders.js +3 -29
- package/dist/runtime/record-orders.js.map +1 -1
- package/dist/runtime/report-scheduler.d.ts +9 -2
- package/dist/runtime/report-scheduler.d.ts.map +1 -1
- package/dist/runtime/report-scheduler.js +37 -10
- package/dist/runtime/report-scheduler.js.map +1 -1
- package/dist/runtime/stimulus-delivery.d.ts +3 -0
- package/dist/runtime/stimulus-delivery.d.ts.map +1 -1
- package/dist/runtime/stimulus-delivery.js +19 -3
- package/dist/runtime/stimulus-delivery.js.map +1 -1
- package/dist/runtime/tools-paths.d.ts +7 -0
- package/dist/runtime/tools-paths.d.ts.map +1 -1
- package/dist/runtime/tools-paths.js +11 -5
- package/dist/runtime/tools-paths.js.map +1 -1
- package/dist/runtime/upkeep-close.d.ts +17 -0
- package/dist/runtime/upkeep-close.d.ts.map +1 -0
- package/dist/runtime/upkeep-close.js +127 -0
- package/dist/runtime/upkeep-close.js.map +1 -0
- package/dist/runtime/upkeep-orders.d.ts +124 -0
- package/dist/runtime/upkeep-orders.d.ts.map +1 -0
- package/dist/runtime/upkeep-orders.js +310 -0
- package/dist/runtime/upkeep-orders.js.map +1 -0
- package/dist/runtime/upkeep-reconcile.d.ts +25 -0
- package/dist/runtime/upkeep-reconcile.d.ts.map +1 -0
- package/dist/runtime/upkeep-reconcile.js +231 -0
- package/dist/runtime/upkeep-reconcile.js.map +1 -0
- package/dist/runtime/upkeep-writeback.d.ts +22 -0
- package/dist/runtime/upkeep-writeback.d.ts.map +1 -0
- package/dist/runtime/upkeep-writeback.js +203 -0
- package/dist/runtime/upkeep-writeback.js.map +1 -0
- package/dist/utils/untrusted-content.d.ts.map +1 -1
- package/dist/utils/untrusted-content.js +8 -1
- package/dist/utils/untrusted-content.js.map +1 -1
- package/install/install.sh +457 -0
- package/install/node.json +9 -0
- package/package.json +3 -4
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GOOGLE_READ_MAX_CHARS = exports.GOOGLE_READ_METHODS = exports.GOOGLE_READ_ACTION = void 0;
|
|
4
|
+
exports.googleReadActionRegistrations = googleReadActionRegistrations;
|
|
5
|
+
/**
|
|
6
|
+
* google.read — the owner's Gmail, Calendar and Sheets, and Google Docs as text, read on demand
|
|
7
|
+
* through gws, run by the daemon with its own sign-in (owner, 2026-10-31;
|
|
8
|
+
* docs/development/work/google-read.md). The agent names the method as gws takes it; the host
|
|
9
|
+
* builds the whole command, so no gws flag is an input: nothing is uploaded or sent, and no page
|
|
10
|
+
* dump is asked for. gws writes any response that is not JSON to a file in its working directory
|
|
11
|
+
* (gws executor.rs, handle_binary_response), so each call runs in a directory of its own under
|
|
12
|
+
* runtime/, which no agent reads, removed after the call; such a response is refused, never
|
|
13
|
+
* left where the agent could open it past the cap, the quoting and the trace. The allowlist is the
|
|
14
|
+
* read-only guard: the sign-in carries Drive write access for deliver.drive.file, and a login made
|
|
15
|
+
* before 2026-10-31 may carry write access to every service. The agent's shell stays closed.
|
|
16
|
+
* Nothing is saved as a source; tool_traces keeps its usual bounded, redacted summary of each call
|
|
17
|
+
* (observeCall).
|
|
18
|
+
*/
|
|
19
|
+
const node_fs_1 = require("node:fs");
|
|
20
|
+
const node_path_1 = require("node:path");
|
|
21
|
+
const gws_utils_js_1 = require("../connectors/framework/gws-utils.js");
|
|
22
|
+
exports.GOOGLE_READ_ACTION = 'google.read';
|
|
23
|
+
/**
|
|
24
|
+
* The read methods, per service, as gws takes them after the service name. The connectors call
|
|
25
|
+
* most of them; `users labels list` names the label ids messages carry. Drive's listing, file
|
|
26
|
+
* metadata and downloads are drive.read and drive.download; only a Google Doc, Sheet or Slides
|
|
27
|
+
* file read as text is new here.
|
|
28
|
+
*/
|
|
29
|
+
exports.GOOGLE_READ_METHODS = {
|
|
30
|
+
gmail: [
|
|
31
|
+
'users getProfile',
|
|
32
|
+
'users labels list',
|
|
33
|
+
'users messages list',
|
|
34
|
+
'users messages get',
|
|
35
|
+
'users threads list',
|
|
36
|
+
'users threads get',
|
|
37
|
+
],
|
|
38
|
+
calendar: ['calendarList list', 'events list', 'events get'],
|
|
39
|
+
drive: ['files export'],
|
|
40
|
+
sheets: ['spreadsheets get', 'spreadsheets values get'],
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* About 25,000 tokens of ASCII JSON: Claude Code's default limit for one MCP tool result, which a
|
|
44
|
+
* code_act return meets, while a Codex turn takes the result whole. Japanese or Korean text costs
|
|
45
|
+
* about a token per character, so a page of it near the cap is several times that. A page over it
|
|
46
|
+
* is narrowed by the request, not cut: cut JSON does not parse.
|
|
47
|
+
*/
|
|
48
|
+
exports.GOOGLE_READ_MAX_CHARS = 100_000;
|
|
49
|
+
/**
|
|
50
|
+
* gws's stdout held in the daemon for one call: Node's own execFile default, stated because
|
|
51
|
+
* execGwsAsync otherwise passes none, which lifts the bound. gws prints indented JSON, so this sits
|
|
52
|
+
* well above the result cap.
|
|
53
|
+
*/
|
|
54
|
+
const GOOGLE_READ_MAX_BUFFER = 1024 * 1024;
|
|
55
|
+
/**
|
|
56
|
+
* Google's system parameters that make the response something other than JSON: `alt` (media,
|
|
57
|
+
* proto, sse) and `callback` (JSONP, whatever the function name), each also with a `$` prefix.
|
|
58
|
+
* gws passes any parameter it does not know through to the URL (executor.rs, build_url).
|
|
59
|
+
*/
|
|
60
|
+
const NOT_JSON_PARAMS = {
|
|
61
|
+
alt: (value) => value !== 'json',
|
|
62
|
+
$alt: (value) => value !== 'json',
|
|
63
|
+
callback: () => true,
|
|
64
|
+
$callback: () => true,
|
|
65
|
+
};
|
|
66
|
+
function failure(name, message, kind) {
|
|
67
|
+
return Object.assign(new Error(message), {
|
|
68
|
+
name,
|
|
69
|
+
...(kind === undefined ? {} : { code: kind }),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function allowedSet() {
|
|
73
|
+
return Object.entries(exports.GOOGLE_READ_METHODS)
|
|
74
|
+
.map(([service, methods]) => `${service}: ${methods.join(', ')}`)
|
|
75
|
+
.join('; ');
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The method the call names, or why it is not one google.read runs. Token by token, so one
|
|
79
|
+
* argument holding "users messages list" is not taken for three.
|
|
80
|
+
*/
|
|
81
|
+
function method(service, argv) {
|
|
82
|
+
const named = argv.join(' ');
|
|
83
|
+
const found = exports.GOOGLE_READ_METHODS[service].find((allowed) => {
|
|
84
|
+
const tokens = allowed.split(' ');
|
|
85
|
+
return tokens.length === argv.length && tokens.every((token, index) => token === argv[index]);
|
|
86
|
+
});
|
|
87
|
+
if (found !== undefined)
|
|
88
|
+
return found;
|
|
89
|
+
const flag = argv.find((token) => token.startsWith('-') || token.startsWith('+'));
|
|
90
|
+
throw failure('google_method_not_allowed', `google.read runs read methods only, and gws ${service} ${named} is not one. ` +
|
|
91
|
+
(flag === undefined
|
|
92
|
+
? ''
|
|
93
|
+
: `argv names the method only: ${flag} is not taken. Parameters go in params; the host adds --params itself and passes no other flag, because --output writes a file, --upload and --json send content, --page-all dumps every page, and helper commands (+name) are not read methods. `) +
|
|
94
|
+
`Allowed: ${allowedSet()}.`, 'invalid_input');
|
|
95
|
+
}
|
|
96
|
+
function tooLarge(command, size) {
|
|
97
|
+
const over = `gws ${command} returned ${size === null ? 'more than the output buffer holds' : `${size} characters`}, over the ${exports.GOOGLE_READ_MAX_CHARS} google.read returns`;
|
|
98
|
+
return failure('google_read_too_large', command.endsWith(' list')
|
|
99
|
+
? `${over}. Ask for fewer per page (maxResults or pageSize, then pageToken for the next page) or only the parts you need (fields).`
|
|
100
|
+
: `${over}. This is one item, and google.read does not return an item in parts. A smaller form of it may fit (format "metadata" for a message's headers, a smaller range of a sheet); a Drive file is fetched whole with drive.download.`);
|
|
101
|
+
}
|
|
102
|
+
/** What the agent is told when gws itself failed, in terms it can act on or relay. */
|
|
103
|
+
function gwsError(error, service, command) {
|
|
104
|
+
const found = (0, gws_utils_js_1.gwsFailure)(error);
|
|
105
|
+
switch (found.kind) {
|
|
106
|
+
case 'missing':
|
|
107
|
+
return failure('gws_missing', gws_utils_js_1.gwsMissing);
|
|
108
|
+
case 'too_large':
|
|
109
|
+
return tooLarge(command, null);
|
|
110
|
+
case 'signed_out':
|
|
111
|
+
return failure('google_signed_out', `gws has no working sign-in (${found.detail}). Ask the owner to sign in again (${gws_utils_js_1.gwsLogin}, with ${gws_utils_js_1.gwsTool.loginScope(service)} among its --scopes), then retry.`);
|
|
112
|
+
case 'scope_missing':
|
|
113
|
+
return failure('google_scope_missing', `gws's sign-in does not grant ${service} (${found.detail}). The login must include ${gws_utils_js_1.gwsTool.loginScope(service)}. ${gws_utils_js_1.gwsLogin}, with the scopes of the Google sources that are on; if ${service} is not among them, the owner adds it to that line's --scopes list (gws auth login --scopes <those scopes>,${gws_utils_js_1.gwsTool.loginScope(service)}) and signs in again, then retry.`);
|
|
114
|
+
case 'api_disabled':
|
|
115
|
+
return failure('google_api_disabled', `The ${service} API is not enabled in the Cloud project of gws's OAuth client (${found.detail}). Ask the owner to enable it${found.enableUrl === undefined ? ' in Google Cloud Console' : ` at ${found.enableUrl}`}, then retry.`);
|
|
116
|
+
case 'quota':
|
|
117
|
+
return failure('google_quota', `Google refused gws ${command} for rate or quota (${found.detail}). Retry later, with fewer calls or smaller pages.`);
|
|
118
|
+
case 'other':
|
|
119
|
+
return failure('google_api_error', `gws ${command} failed: ${found.detail}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function googleReadActionRegistrations(ports) {
|
|
123
|
+
const gws = ports.gws ?? gws_utils_js_1.execGwsAsync;
|
|
124
|
+
return [
|
|
125
|
+
{
|
|
126
|
+
contract: {
|
|
127
|
+
name: exports.GOOGLE_READ_ACTION,
|
|
128
|
+
readsConnector: { fromInput: 'service' },
|
|
129
|
+
summary: 'Read the owner\'s Gmail, Calendar and Sheets, or a Google Doc as text, live through gws, as `gws <service> <argv…> --params <params>`, for what the stored sources do not hold. Read methods only: gmail users getProfile, users labels list, users messages list|get, users threads list|get; calendar calendarList list, events list|get; sheets spreadsheets get, spreadsheets values get; drive files export, which returns a Google Doc, Sheet or Slides file as text (mimeType text/plain, text/csv, text/html or text/markdown). Find and fetch Drive files with drive.read and drive.download. params is the method\'s --params JSON (userId "me" for Gmail). A list returns one page with its nextPageToken; pass it as pageToken for the next. A result over 100,000 characters is refused: ask for a smaller page (maxResults or pageSize, fields) or a smaller form of one item (format "metadata", a smaller range). Not in a replay. Nothing is saved as a source; tool_traces keeps a bounded, redacted excerpt of each result, as for every action.',
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
additionalProperties: false,
|
|
133
|
+
required: ['service', 'argv'],
|
|
134
|
+
properties: {
|
|
135
|
+
service: { type: 'string', enum: Object.keys(exports.GOOGLE_READ_METHODS) },
|
|
136
|
+
argv: {
|
|
137
|
+
type: 'array',
|
|
138
|
+
minItems: 1,
|
|
139
|
+
maxItems: 3,
|
|
140
|
+
items: { type: 'string', minLength: 1 },
|
|
141
|
+
description: 'The resource path and method after the service, as gws takes them, e.g. ["users", "messages", "list"].',
|
|
142
|
+
},
|
|
143
|
+
params: {
|
|
144
|
+
type: 'object',
|
|
145
|
+
description: 'The method\'s URL and query parameters, as gws --params takes them, e.g. {"userId": "me", "q": "from:client newer_than:30d", "maxResults": 20}.',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
examples: [
|
|
150
|
+
{
|
|
151
|
+
title: 'Mail matching a search',
|
|
152
|
+
input: {
|
|
153
|
+
service: 'gmail',
|
|
154
|
+
argv: ['users', 'messages', 'list'],
|
|
155
|
+
params: { userId: 'me', q: 'subject:estimate newer_than:90d', maxResults: 20 },
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
title: "One message's headers and snippet",
|
|
160
|
+
input: {
|
|
161
|
+
service: 'gmail',
|
|
162
|
+
argv: ['users', 'messages', 'get'],
|
|
163
|
+
params: { userId: 'me', id: 'message-id', format: 'metadata' },
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
title: 'Events in a week',
|
|
168
|
+
input: {
|
|
169
|
+
service: 'calendar',
|
|
170
|
+
argv: ['events', 'list'],
|
|
171
|
+
params: {
|
|
172
|
+
calendarId: 'primary',
|
|
173
|
+
timeMin: '2026-11-02T00:00:00Z',
|
|
174
|
+
timeMax: '2026-11-09T00:00:00Z',
|
|
175
|
+
singleEvents: true,
|
|
176
|
+
orderBy: 'startTime',
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
title: 'A Google Doc as text',
|
|
182
|
+
input: {
|
|
183
|
+
service: 'drive',
|
|
184
|
+
argv: ['files', 'export'],
|
|
185
|
+
params: { fileId: 'doc-id', mimeType: 'text/plain' },
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
title: 'A sheet range',
|
|
190
|
+
input: {
|
|
191
|
+
service: 'sheets',
|
|
192
|
+
argv: ['spreadsheets', 'values', 'get'],
|
|
193
|
+
params: { spreadsheetId: 'sheet-id', range: 'Sheet1!A1:F50' },
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
exec: async (input, context) => {
|
|
199
|
+
// A replay reads sources only up to its window's end; Google read now is past it.
|
|
200
|
+
if (context.session?.replaySourceEndMs !== undefined)
|
|
201
|
+
throw failure('google_read_replay', 'google.read reads Google as it is now, and a replay turn reads sources only up to the end of its window; it is not available in a replay.', 'denied');
|
|
202
|
+
const values = input;
|
|
203
|
+
const named = method(values.service, values.argv);
|
|
204
|
+
const command = `${values.service} ${named}`;
|
|
205
|
+
const params = values.params ?? {};
|
|
206
|
+
for (const [key, notJson] of Object.entries(NOT_JSON_PARAMS)) {
|
|
207
|
+
if (params[key] !== undefined && notJson(params[key]))
|
|
208
|
+
throw failure('google_read_media_refused', `google.read returns JSON or text, and ${key} ${JSON.stringify(params[key])} asks Google for another format, which gws writes to a file; leave ${key} out (a file is fetched with drive.download).`, 'invalid_input');
|
|
209
|
+
}
|
|
210
|
+
const exported = named === 'files export';
|
|
211
|
+
// An export is always a file; it is read back from the call's own directory as text.
|
|
212
|
+
if (exported &&
|
|
213
|
+
(typeof params.mimeType !== 'string' || !params.mimeType.startsWith('text/')))
|
|
214
|
+
throw failure('google_read_media_refused', `drive files export returns text here: give params.mimeType a text type (text/plain for a Doc or Slides file, text/csv for a Sheet's first sheet, text/html, text/markdown); other formats are fetched with drive.download.`, 'invalid_input');
|
|
215
|
+
const args = [
|
|
216
|
+
values.service,
|
|
217
|
+
...values.argv,
|
|
218
|
+
...(values.params === undefined ? [] : ['--params', JSON.stringify(params)]),
|
|
219
|
+
...(exported ? ['--output', 'export'] : []),
|
|
220
|
+
];
|
|
221
|
+
(0, node_fs_1.mkdirSync)(ports.scratchDir, { recursive: true, mode: 0o700 });
|
|
222
|
+
const dir = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)(ports.scratchDir, 'call-'));
|
|
223
|
+
try {
|
|
224
|
+
let result;
|
|
225
|
+
try {
|
|
226
|
+
result = await gws(args, {
|
|
227
|
+
cwd: dir,
|
|
228
|
+
maxBuffer: GOOGLE_READ_MAX_BUFFER,
|
|
229
|
+
...(exported ? { timeoutMs: 120_000 } : {}),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
throw gwsError(error, values.service, command);
|
|
234
|
+
}
|
|
235
|
+
if (exported) {
|
|
236
|
+
const text = (0, node_fs_1.readFileSync)((0, node_path_1.join)(dir, 'export'), 'utf8');
|
|
237
|
+
if (text.length > exports.GOOGLE_READ_MAX_CHARS)
|
|
238
|
+
throw tooLarge(command, text.length);
|
|
239
|
+
return { mimeType: params.mimeType, characters: text.length, text };
|
|
240
|
+
}
|
|
241
|
+
// gws's report of a response it wrote to a file: refused, and the file goes with dir.
|
|
242
|
+
if (result !== null && typeof result === 'object' && 'saved_file' in result)
|
|
243
|
+
throw failure('google_read_media_refused', `gws ${command} answered with something other than JSON, which gws wrote to a file; google.read returns JSON only, so the file was removed unread. Leave out parameters that change the format.`);
|
|
244
|
+
const size = JSON.stringify(result ?? null).length;
|
|
245
|
+
if (size > exports.GOOGLE_READ_MAX_CHARS)
|
|
246
|
+
throw tooLarge(command, size);
|
|
247
|
+
return result;
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
(0, node_fs_1.rmSync)(dir, { recursive: true, force: true });
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
];
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=google-read-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-read-actions.js","sourceRoot":"","sources":["../../src/api/google-read-actions.ts"],"names":[],"mappings":";;;AAmKA,sEAyJC;AA5TD;;;;;;;;;;;;;GAaG;AACH,qCAAuE;AACvE,yCAAiC;AAGjC,uEAM8C;AAGjC,QAAA,kBAAkB,GAAG,aAAa,CAAC;AAEhD;;;;;GAKG;AACU,QAAA,mBAAmB,GAAG;IACjC,KAAK,EAAE;QACL,kBAAkB;QAClB,mBAAmB;QACnB,qBAAqB;QACrB,oBAAoB;QACpB,oBAAoB;QACpB,mBAAmB;KACpB;IACD,QAAQ,EAAE,CAAC,mBAAmB,EAAE,aAAa,EAAE,YAAY,CAAC;IAC5D,KAAK,EAAE,CAAC,cAAc,CAAC;IACvB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,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-actions.d.ts","sourceRoot":"","sources":["../../src/api/record-actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,+BAA+B,IAAI,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"record-actions.d.ts","sourceRoot":"","sources":["../../src/api/record-actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,+BAA+B,IAAI,kBAAkB,EAAE,CAgEtE"}
|
|
@@ -12,11 +12,11 @@ function workNoUpdateActionRegistrations() {
|
|
|
12
12
|
{
|
|
13
13
|
contract: {
|
|
14
14
|
name: 'work.no_update',
|
|
15
|
-
summary: 'Declare that
|
|
15
|
+
summary: 'Declare that an order needs no work change, with the reason (chatter, already recorded, not work). Cite the observations the decision covers, the work items it covers (commitmentIds), or both.',
|
|
16
16
|
inputSchema: {
|
|
17
17
|
type: 'object',
|
|
18
18
|
additionalProperties: false,
|
|
19
|
-
required: ['reason'
|
|
19
|
+
required: ['reason'],
|
|
20
20
|
properties: {
|
|
21
21
|
reason: { type: 'string', minLength: 1 },
|
|
22
22
|
observationRefs: {
|
|
@@ -24,6 +24,11 @@ function workNoUpdateActionRegistrations() {
|
|
|
24
24
|
minItems: 1,
|
|
25
25
|
items: { type: 'string', minLength: 1 },
|
|
26
26
|
},
|
|
27
|
+
commitmentIds: {
|
|
28
|
+
type: 'array',
|
|
29
|
+
minItems: 1,
|
|
30
|
+
items: { type: 'string', minLength: 1 },
|
|
31
|
+
},
|
|
27
32
|
},
|
|
28
33
|
},
|
|
29
34
|
examples: [
|
|
@@ -31,16 +36,29 @@ function workNoUpdateActionRegistrations() {
|
|
|
31
36
|
title: 'Nothing to record',
|
|
32
37
|
input: { reason: 'greetings only', observationRefs: ['obs_reference'] },
|
|
33
38
|
},
|
|
39
|
+
{
|
|
40
|
+
title: 'Summary already current',
|
|
41
|
+
input: {
|
|
42
|
+
reason: 'its description already summarizes it',
|
|
43
|
+
commitmentIds: ['commitment_id'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
34
46
|
],
|
|
35
47
|
},
|
|
36
48
|
exec: (input) => {
|
|
37
49
|
const body = input;
|
|
38
50
|
if (typeof body.reason !== 'string' || body.reason.trim() === '')
|
|
39
51
|
throw (0, invalid_input_js_1.invalidInput)('reason must be nonblank');
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
const listed = (value) => Array.isArray(value) &&
|
|
53
|
+
value.length > 0 &&
|
|
54
|
+
value.every((ref) => typeof ref === 'string' && ref.trim() !== '');
|
|
55
|
+
if (body.observationRefs !== undefined && !listed(body.observationRefs))
|
|
43
56
|
throw (0, invalid_input_js_1.invalidInput)('observationRefs must list the observations the decision covers');
|
|
57
|
+
if (body.commitmentIds !== undefined && !listed(body.commitmentIds))
|
|
58
|
+
throw (0, invalid_input_js_1.invalidInput)('commitmentIds must list the work items the decision covers');
|
|
59
|
+
// The host checks an order by what the no-update names, so it must name something.
|
|
60
|
+
if (body.observationRefs === undefined && body.commitmentIds === undefined)
|
|
61
|
+
throw (0, invalid_input_js_1.invalidInput)('name the observations (observationRefs) or the work items (commitmentIds) the decision covers');
|
|
44
62
|
return { recorded: false, reason: body.reason.trim() };
|
|
45
63
|
},
|
|
46
64
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-actions.js","sourceRoot":"","sources":["../../src/api/record-actions.ts"],"names":[],"mappings":";;AAQA,
|
|
1
|
+
{"version":3,"file":"record-actions.js","sourceRoot":"","sources":["../../src/api/record-actions.ts"],"names":[],"mappings":";;AAQA,0EAgEC;AAxED,gEAAyD;AAGzD;;;;GAIG;AACH,SAAgB,+BAA+B;IAC7C,OAAO;QACL;YACE,QAAQ,EAAE;gBACR,IAA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AK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;gBACrE,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC;oBACrE,MAAM,IAAA,+BAAY,EAAC,gEAAgE,CAAC,CAAC;gBACvF,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;oBACjE,MAAM,IAAA,+BAAY,EAAC,4DAA4D,CAAC,CAAC;gBACnF,mFAAmF;gBACnF,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS;oBACxE,MAAM,IAAA,+BAAY,EAChB,+FAA+F,CAChG,CAAC;gBACJ,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;YACzD,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Router } from 'express';
|
|
2
1
|
import type { ServerResponse } from 'node:http';
|
|
3
2
|
export interface ReportSlot {
|
|
4
3
|
slotId: string;
|
|
@@ -25,7 +24,6 @@ export interface ReportStore {
|
|
|
25
24
|
priority: number;
|
|
26
25
|
options?: ReportUpdateOptions;
|
|
27
26
|
}[]): void;
|
|
28
|
-
delete(slotId: string): void;
|
|
29
27
|
getAll(): Record<string, ReportSlot>;
|
|
30
28
|
getAllSorted(): ReportSlot[];
|
|
31
29
|
}
|
|
@@ -49,8 +47,4 @@ export declare function broadcastReportUpdate(clients: Set<ServerResponse>, data
|
|
|
49
47
|
* LOUDLY, never truncated silently (observability over restriction).
|
|
50
48
|
*/
|
|
51
49
|
export declare function createReportPublisher(store: ReportStore, sseClients: Set<ServerResponse>): (slots: Record<string, string>, options?: ReportUpdateOptions) => ReportPublishResult;
|
|
52
|
-
/**
|
|
53
|
-
* Create an Express Router that exposes report slot CRUD + SSE stream.
|
|
54
|
-
*/
|
|
55
|
-
export declare function createReportRouter(store: ReportStore, sseClients: Set<ServerResponse>): Router;
|
|
56
50
|
//# sourceMappingURL=report-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report-handler.d.ts","sourceRoot":"","sources":["../../src/api/report-handler.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"report-handler.d.ts","sourceRoot":"","sources":["../../src/api/report-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAKhD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,6FAA6F;IAC7F,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAC5C,mFAAmF;IACnF,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACvC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC5F,4EAA4E;IAC5E,YAAY,CACV,OAAO,EAAE,SAAS;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,mBAAmB,CAAC;KAC/B,EAAE,GACF,IAAI,CAAC;IACR,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACrC,YAAY,IAAI,UAAU,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE;IACP,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IACvD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;CACxD,GACL,WAAW,CAuEb;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,GAAG,CAAC,cAAc,CAAC,EAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,IAAI,CAKN;AAOD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,GAC9B,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,mBAAmB,KAAK,mBAAmB,CA+CvF"}
|
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createReportStore = createReportStore;
|
|
4
4
|
exports.broadcastReportUpdate = broadcastReportUpdate;
|
|
5
5
|
exports.createReportPublisher = createReportPublisher;
|
|
6
|
-
exports.createReportRouter = createReportRouter;
|
|
7
|
-
const express_1 = require("express");
|
|
8
6
|
const debug_logger_1 = require("@jungjaehoon/mama-core/debug-logger");
|
|
9
7
|
const reportLogger = new debug_logger_1.DebugLogger('Report');
|
|
10
8
|
function createReportStore(options = {}) {
|
|
@@ -49,10 +47,6 @@ function createReportStore(options = {}) {
|
|
|
49
47
|
slots = staged;
|
|
50
48
|
options.onChange?.(next);
|
|
51
49
|
},
|
|
52
|
-
delete(slotId) {
|
|
53
|
-
slots.delete(slotId);
|
|
54
|
-
changed();
|
|
55
|
-
},
|
|
56
50
|
getAll() {
|
|
57
51
|
return snapshot();
|
|
58
52
|
},
|
|
@@ -121,52 +115,4 @@ function createReportPublisher(store, sseClients) {
|
|
|
121
115
|
};
|
|
122
116
|
};
|
|
123
117
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Create an Express Router that exposes report slot CRUD + SSE stream.
|
|
126
|
-
*/
|
|
127
|
-
function createReportRouter(store, sseClients) {
|
|
128
|
-
const router = (0, express_1.Router)();
|
|
129
|
-
// GET / — list all slots sorted by priority
|
|
130
|
-
router.get('/', (_req, res) => {
|
|
131
|
-
res.json({ slots: store.getAllSorted() });
|
|
132
|
-
});
|
|
133
|
-
// GET /events — SSE stream
|
|
134
|
-
router.get('/events', (req, res) => {
|
|
135
|
-
res.setHeader('Content-Type', 'text/event-stream');
|
|
136
|
-
res.setHeader('Cache-Control', 'no-cache');
|
|
137
|
-
res.setHeader('Connection', 'keep-alive');
|
|
138
|
-
res.flushHeaders();
|
|
139
|
-
const raw = res;
|
|
140
|
-
sseClients.add(raw);
|
|
141
|
-
req.on('close', () => {
|
|
142
|
-
sseClients.delete(raw);
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
// PUT / — bulk update
|
|
146
|
-
router.put('/', (req, res) => {
|
|
147
|
-
const body = req.body;
|
|
148
|
-
const incoming = body?.slots ?? {};
|
|
149
|
-
for (const [id, { html, priority = 0 }] of Object.entries(incoming)) {
|
|
150
|
-
store.update(id, html, priority);
|
|
151
|
-
}
|
|
152
|
-
broadcastReportUpdate(sseClients, { slots: store.getAllSorted() });
|
|
153
|
-
res.json({ ok: true });
|
|
154
|
-
});
|
|
155
|
-
// PUT /slots/:slotId — single update
|
|
156
|
-
router.put('/slots/:slotId', (req, res) => {
|
|
157
|
-
const slotId = req.params.slotId;
|
|
158
|
-
const { html, priority = 0 } = req.body;
|
|
159
|
-
store.update(slotId, html, priority);
|
|
160
|
-
broadcastReportUpdate(sseClients, { slots: store.getAllSorted() });
|
|
161
|
-
res.json({ ok: true, slot: slotId });
|
|
162
|
-
});
|
|
163
|
-
// DELETE /slots/:slotId — delete a slot
|
|
164
|
-
router.delete('/slots/:slotId', (req, res) => {
|
|
165
|
-
const slotId = req.params.slotId;
|
|
166
|
-
store.delete(slotId);
|
|
167
|
-
broadcastReportUpdate(sseClients, { deleted: slotId });
|
|
168
|
-
res.json({ ok: true });
|
|
169
|
-
});
|
|
170
|
-
return router;
|
|
171
|
-
}
|
|
172
118
|
//# sourceMappingURL=report-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report-handler.js","sourceRoot":"","sources":["../../src/api/report-handler.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"report-handler.js","sourceRoot":"","sources":["../../src/api/report-handler.ts"],"names":[],"mappings":";;AA2CA,8CA6EC;AAKD,sDAQC;AAaD,sDAkDC;AAnMD,sEAAkE;AAElE,MAAM,YAAY,GAAG,IAAI,0BAAW,CAAC,QAAQ,CAAC,CAAC;AAwC/C,SAAgB,iBAAiB,CAC/B,UAII,EAAE;IAEN,IAAI,KAAK,GAAG,IAAI,GAAG,CACjB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,CAA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;QACR,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,kBAAkB,EAAE,CAAC;YAChD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACtB,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACnC,IAAI,QAAQ,EAAE,IAAI,KAAK,IAAI,EAAE,CAAC;gBAC5B,SAAS;YACX,CAAC;YACD,KAAK,CAAC,IAAI,CAAC;gBACT,MAAM;gBACN,IAAI;gBACJ,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAAI,CAAC;gBACjC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAChC,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YAC1B,qBAAqB,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;YACnE,YAAY,CAAC,IAAI,CAAC,oBAAoB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO;YACL,eAAe,EAAE,QAAQ,CAAC,IAAI,EAAE;YAChC,cAAc,EAAE,OAAO,CAAC,IAAI,EAAE;SAC/B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TimeZoneSetting } from '../runtime/timezone.js';
|
|
2
|
-
export type SecurityEventClass = 'owner_access' | 'public_asset' | 'auth_failed' | 'forged_access_header' | 'host_rejected' | 'probe' | 'unknown_identity' | 'request_failed';
|
|
2
|
+
export type SecurityEventClass = 'owner_access' | 'public_asset' | 'auth_failed' | 'forged_access_header' | 'host_rejected' | 'probe' | 'unknown_identity' | 'request_failed' | 'cross_origin';
|
|
3
3
|
export interface SecurityEvent {
|
|
4
4
|
time: string;
|
|
5
5
|
class: SecurityEventClass;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-events.d.ts","sourceRoot":"","sources":["../../src/api/security-events.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAC1B,cAAc,GACd,cAAc,GACd,aAAa,GACb,sBAAsB,GACtB,eAAe,GACf,OAAO,GACP,kBAAkB,GAClB,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"security-events.d.ts","sourceRoot":"","sources":["../../src/api/security-events.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAC1B,cAAc,GACd,cAAc,GACd,aAAa,GACb,sBAAsB,GACtB,eAAe,GACf,OAAO,GACP,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,CAAC;AAEnB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,GAAG,WAAW,GAAG,UAAU,MAAM,EAAE,CAAC;CACtD;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAgDD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,oBAAoB;;qBAMpD,aAAa,GAAG,IAAI;EAmCxC;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,0FAA0F;IAC1F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,EAAE,kBAAkB,GAAG,eAAe,GAAG,kBAAkB,GAAG,WAAW,CAAC;IAC/E,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,oGAAoG;IACpG,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,qFAAqF;IACrF,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1B,sFAAsF;IACtF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,sEAAsE;IACtE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,gGAAgG;AAChG,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAqDD,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7F;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,oBAAoB;;qBAcpD,oBAAoB,GAAG,qBAAqB,GAAG,IAAI;EAsEvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-events.js","sourceRoot":"","sources":["../../src/api/security-events.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"security-events.js","sourceRoot":"","sources":["../../src/api/security-events.ts"],"names":[],"mappings":";;AAkFA,kEAyCC;AA0FD,kEA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C;YAChF,MAAM,WAAW,GACf,KAAK,CAAC,WAAW,KAAK,SAAS;gBAC7B,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC;oBACE,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,WAAW,EAAE,KAAK,CAAC,WAAW;oBAC9B,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,wBAAwB,EAAE,UAAU;iBACrC,CAAC;YACR,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,WAAW,CAAC;gBACzC,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;YACvD,IAAI,CAAC,KAAK;gBAAE,OAAO;YACnB,KAAK,CAAC,KAAK,IAAI,EAAE;gBACf,IAAI,CAAC;oBACH,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBACzE,CAAC;gBAAC,MAAM,CAAC;oBACP,sEAAsE;oBACtE,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;gBACjD,CAAC;YACH,CAAC,CAAC,EAAE,CAAC;QACP,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -5,5 +5,14 @@ export interface SourcePorts {
|
|
|
5
5
|
stored?: StoredSourceReader | null;
|
|
6
6
|
timeZone: TimeZoneSetting;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* The read receipt (docs/development/work/ledger-upkeep.md, U2): source.search and source.read
|
|
10
|
+
* store every observation handle they returned in tool_traces.evidence_json, in full, so the
|
|
11
|
+
* write-back scan can tell which questions read sources. output_summary is bounded at 4,000 chars
|
|
12
|
+
* and 40 array items (trace-summary.ts), so it can never be the source of truth. Returns a JSON
|
|
13
|
+
* object string (never an array; the trace store requires an object), or undefined when the call
|
|
14
|
+
* surfaced no handle. The paged `nextRead` re-reads the same ref, so handles are deduplicated.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readReceiptEvidence(action: string, data: unknown): string | undefined;
|
|
8
17
|
export declare function sourceActionRegistrations(ports: SourcePorts): ActionRegistration[];
|
|
9
18
|
//# sourceMappingURL=source-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-actions.d.ts","sourceRoot":"","sources":["../../src/api/source-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,kBAAkB,EAAsB,MAAM,wBAAwB,CAAC;AAEpG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,eAAe,CAAC;CAC3B;AA4KD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,WAAW,GAAG,kBAAkB,EAAE,CAqJlF"}
|
|
1
|
+
{"version":3,"file":"source-actions.d.ts","sourceRoot":"","sources":["../../src/api/source-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,kBAAkB,EAAsB,MAAM,wBAAwB,CAAC;AAEpG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAkCD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIrF;AA4KD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,WAAW,GAAG,kBAAkB,EAAE,CAqJlF"}
|
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readReceiptEvidence = readReceiptEvidence;
|
|
3
4
|
exports.sourceActionRegistrations = sourceActionRegistrations;
|
|
5
|
+
/** The observation handles a source read surfaced: search its hits, read the refs it opened. */
|
|
6
|
+
function receiptRefs(action, data) {
|
|
7
|
+
if (!data || typeof data !== 'object' || Array.isArray(data))
|
|
8
|
+
return [];
|
|
9
|
+
const body = data;
|
|
10
|
+
const refOf = (value) => {
|
|
11
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
12
|
+
const ref = value.observationRef;
|
|
13
|
+
if (typeof ref === 'string' && ref.trim() !== '')
|
|
14
|
+
return ref;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
};
|
|
18
|
+
if (action === 'source.search')
|
|
19
|
+
return Array.isArray(body.hits)
|
|
20
|
+
? body.hits.flatMap((hit) => (refOf(hit) === null ? [] : [refOf(hit)]))
|
|
21
|
+
: [];
|
|
22
|
+
if (action === 'source.read') {
|
|
23
|
+
// A batch read lists one result per ref; a single read is the observation itself. A failed
|
|
24
|
+
// per-ref result opened nothing, so only completed refs count.
|
|
25
|
+
if (Array.isArray(body.results))
|
|
26
|
+
return body.results.flatMap((entry) => {
|
|
27
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry))
|
|
28
|
+
return [];
|
|
29
|
+
const ref = refOf(entry);
|
|
30
|
+
return entry.status === 'completed' && ref !== null
|
|
31
|
+
? [ref]
|
|
32
|
+
: [];
|
|
33
|
+
});
|
|
34
|
+
const single = refOf(body);
|
|
35
|
+
return single === null ? [] : [single];
|
|
36
|
+
}
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The read receipt (docs/development/work/ledger-upkeep.md, U2): source.search and source.read
|
|
41
|
+
* store every observation handle they returned in tool_traces.evidence_json, in full, so the
|
|
42
|
+
* write-back scan can tell which questions read sources. output_summary is bounded at 4,000 chars
|
|
43
|
+
* and 40 array items (trace-summary.ts), so it can never be the source of truth. Returns a JSON
|
|
44
|
+
* object string (never an array; the trace store requires an object), or undefined when the call
|
|
45
|
+
* surfaced no handle. The paged `nextRead` re-reads the same ref, so handles are deduplicated.
|
|
46
|
+
*/
|
|
47
|
+
function readReceiptEvidence(action, data) {
|
|
48
|
+
if (action !== 'source.search' && action !== 'source.read')
|
|
49
|
+
return undefined;
|
|
50
|
+
const observationRefs = [...new Set(receiptRefs(action, data))];
|
|
51
|
+
return observationRefs.length === 0 ? undefined : JSON.stringify({ observationRefs });
|
|
52
|
+
}
|
|
4
53
|
function replayReadAllowance(allowance) {
|
|
5
54
|
if (allowance?.maxSourceMs === undefined || allowance.maxSourceMs === null)
|
|
6
55
|
return undefined;
|