@joenandez/tldr 1.0.0 → 1.1.0
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/bin/tldr-agent +11 -0
- package/hooks/tldr-agent-capture-session-identity.sh +3 -2
- package/install/tldr-agent-bootstrap.sh +7 -0
- package/package.json +10 -6
- package/release/activation-manifest.json +6 -6
- package/release/payloads/arm64/TldrAgentAegis.pkg +0 -0
- package/release/payloads/arm64/tldr-agent.tar.gz +0 -0
- package/release/starport-release.json +14 -9
- package/skills/tldr/SKILL.md +43 -31
- package/src/lib/aegis_native_distribution.mjs +1 -1
- package/src/lib/aegis_protocol.mjs +1 -1
- package/src/lib/starport_aegis_package.mjs +53 -6
- package/src/lib/starport_onboarding.mjs +303 -6
- package/src/lib/starport_orchestrator.mjs +21 -20
- package/src/lib/starport_release_contract.mjs +48 -10
- package/src/lib/starport_runtime.mjs +131 -13
- package/src/lib/tightbeam_channel.mjs +83 -123
- package/src/lib/tightbeam_channel_runtime.mjs +131 -33
- package/src/lib/tightbeam_email_adapter.mjs +10 -0
- package/src/lib/tightbeam_email_delivery_channel.mjs +107 -133
- package/src/lib/tightbeam_email_provider_map.mjs +337 -0
- package/src/lib/tightbeam_inbound_publish.mjs +84 -0
- package/src/lib/tightbeam_welcome_dispatch.mjs +129 -33
- package/src/lib/tldr_agent_daemon_health.mjs +2 -1
- package/src/lib/tldr_agent_daemon_phase_timeouts.mjs +3 -5
- package/src/lib/tldr_agent_diagnostic_schema.mjs +1 -0
- package/src/lib/tldr_agent_launchd_definition.mjs +2 -0
- package/src/lib/tldr_agent_launchd_lifecycle.mjs +41 -10
- package/src/lib/tldr_agent_runtime_identity.mjs +14 -2
- package/src/lib/tldr_agent_source_lifecycle.mjs +18 -4
- package/src/lib/transports/email/render/email.mjs +66 -180
- package/src/lib/transports/email/render/html.mjs +37 -80
- package/src/lib/transports/email/render/text.mjs +2 -2
- package/src/lib/transports/email/render/tldr.mjs +10 -88
- package/src/lib/transports/email/render/tokens.mjs +56 -75
- package/src/lib/transports/email/templates.mjs +38 -27
- package/src/lib/transports/email.mjs +21 -1
- package/src/starport.mjs +12 -0
- package/src/lib/transports/email/render/glyphs.mjs +0 -66
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* and the module namespace is on the repository's side of the rename, not the
|
|
5
5
|
* owner's. Everything it renders says `tldr;`.
|
|
6
6
|
*
|
|
7
|
-
* There is no `heading`
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* There is no `heading` configuration. Normal conversation starts with the
|
|
8
|
+
* agent's body; system messages derive their restrained heading from the
|
|
9
|
+
* subject. Callers may still pass the legacy field; it is ignored.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { AGENTS, render } from "./render/email.mjs";
|
|
13
13
|
|
|
14
|
-
const TEMPLATE_VERSION = "tldr-email-
|
|
14
|
+
const TEMPLATE_VERSION = "tldr-email-v4";
|
|
15
15
|
|
|
16
16
|
const VALID_STATES = new Set([
|
|
17
17
|
"conversation",
|
|
@@ -24,12 +24,11 @@ const VALID_STATES = new Set([
|
|
|
24
24
|
"key_replaced",
|
|
25
25
|
]);
|
|
26
26
|
|
|
27
|
-
/* The
|
|
27
|
+
/* The small system identity label, per state.
|
|
28
28
|
*
|
|
29
29
|
* A system message is tldr; speaking as itself, and it must not be mistakable
|
|
30
|
-
* for the agent
|
|
31
|
-
*
|
|
32
|
-
* agent speaking and deliberately carries no bar.
|
|
30
|
+
* for the agent. The distinction is typographic rather than a branded banner.
|
|
31
|
+
* A conversation is the agent speaking and carries no system label.
|
|
33
32
|
*
|
|
34
33
|
* The vocabulary is four words wide on purpose. A fifth is a distinction the
|
|
35
34
|
* owner has to learn. SECURITY is separate from ERROR because a message about
|
|
@@ -103,16 +102,16 @@ stopped.`,
|
|
|
103
102
|
* substituted by the broker at send time. */
|
|
104
103
|
verification_code: {
|
|
105
104
|
action: "now",
|
|
106
|
-
subject: "Verify
|
|
105
|
+
subject: "Verify your email address",
|
|
107
106
|
code: "__TLDR_CODE__",
|
|
108
|
-
body: `
|
|
109
|
-
10 minutes.
|
|
107
|
+
body: `This code finishes connecting your email address. It is single-use and
|
|
108
|
+
expires in 10 minutes.
|
|
110
109
|
|
|
111
110
|
> **CAUTION**: Enter it only in the setup app on your own Mac. An agent will
|
|
112
111
|
> never ask you for it, and neither will anyone else.
|
|
113
112
|
|
|
114
113
|
If you didn't ask for this code, you can ignore this email.`,
|
|
115
|
-
reply: "
|
|
114
|
+
reply: "Replying here does nothing.",
|
|
116
115
|
notice: "Sent because this address was entered during setup.",
|
|
117
116
|
},
|
|
118
117
|
owner_changed: {
|
|
@@ -148,6 +147,13 @@ function oneLine(value) {
|
|
|
148
147
|
return cleanText(value).replace(/\s+/g, " ");
|
|
149
148
|
}
|
|
150
149
|
|
|
150
|
+
function debugSetupTemplateDrift(stage, data) {
|
|
151
|
+
if (process.env.TLDR_AGENT_DEBUG_TEMPLATE_DRIFT !== "1") return;
|
|
152
|
+
process.stderr.write(
|
|
153
|
+
`[🪳 TEMP SETUP_EMAIL_TEMPLATE_DRIFT] ${stage} ${JSON.stringify(data)}\n`,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
151
157
|
/* The body is the one field that passes through untouched apart from line
|
|
152
158
|
* endings. It is Markdown an agent wrote, and reflowing it is what destroys a
|
|
153
159
|
* fenced block or a table. */
|
|
@@ -181,45 +187,50 @@ export function renderTldrAgentEmail(input = {}) {
|
|
|
181
187
|
agent,
|
|
182
188
|
});
|
|
183
189
|
|
|
190
|
+
debugSetupTemplateDrift("render", {
|
|
191
|
+
state,
|
|
192
|
+
template_version: TEMPLATE_VERSION,
|
|
193
|
+
system: SYSTEM_KIND[state] ?? null,
|
|
194
|
+
});
|
|
195
|
+
|
|
184
196
|
return { ...rendered, template_version: TEMPLATE_VERSION };
|
|
185
197
|
}
|
|
186
198
|
|
|
187
199
|
const WELCOME_SCENARIOS = Object.freeze([
|
|
188
200
|
"Email me a summary when you finish.",
|
|
189
|
-
"Send me the decision and anything still blocked.",
|
|
190
201
|
"Email me if you need input before continuing.",
|
|
191
|
-
"
|
|
202
|
+
"Send me the decision and anything still blocked.",
|
|
192
203
|
]);
|
|
193
204
|
|
|
194
205
|
export function renderTldrAgentWelcomeEmail({
|
|
195
206
|
scenarios = WELCOME_SCENARIOS,
|
|
196
207
|
} = {}) {
|
|
197
|
-
const body =
|
|
208
|
+
const body = `tldr; is ready on this Mac.
|
|
198
209
|
|
|
199
|
-
|
|
200
|
-
message to the Claude Code session that sent the email.
|
|
210
|
+
This message came from the agent session that completed setup. Reply with anything—“hello” is enough—and the same session will answer to confirm that replies work.
|
|
201
211
|
|
|
202
|
-
##
|
|
212
|
+
## Try tldr;
|
|
203
213
|
|
|
204
214
|
${scenarios.map((scenario) => `- “${oneLine(scenario)}”`).join("\n")}
|
|
205
215
|
|
|
206
|
-
You
|
|
207
|
-
tldr
|
|
208
|
-
const subject = "Ready: tldr; is connected";
|
|
216
|
+
You don’t need to reply; setup is complete.`;
|
|
217
|
+
const subject = "tldr; is ready — reply to test it";
|
|
209
218
|
const rendered = renderTldrAgentEmail({
|
|
210
219
|
state: "conversation",
|
|
211
220
|
subject,
|
|
212
221
|
body,
|
|
213
|
-
replyInstruction:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
222
|
+
replyInstruction:
|
|
223
|
+
"Reply to continue the agent session that sent this email.",
|
|
224
|
+
securityNotice:
|
|
225
|
+
"Only replies from your verified address reach the session.",
|
|
217
226
|
});
|
|
218
227
|
return Object.freeze({
|
|
219
228
|
subject,
|
|
220
229
|
body,
|
|
221
|
-
replyInstruction:
|
|
222
|
-
|
|
230
|
+
replyInstruction:
|
|
231
|
+
"Reply to continue the agent session that sent this email.",
|
|
232
|
+
securityNotice:
|
|
233
|
+
"Only replies from your verified address reach the session.",
|
|
223
234
|
...rendered,
|
|
224
235
|
});
|
|
225
236
|
}
|
|
@@ -56,6 +56,8 @@ const HINT = Object.freeze({
|
|
|
56
56
|
"Verify ~/.helm/email/config.json exists with api_key + inbox_id + inbox_email, then retry. Run `helm-tasks onboard --reconfigure agentmail` to (re)provision the credential.",
|
|
57
57
|
transport_send_failed:
|
|
58
58
|
"Inspect transport_state.error for the underlying AgentMail SDK exception and retry within --max-attempts.",
|
|
59
|
+
reply_parent_unauthorized:
|
|
60
|
+
"Reconcile the accepted owner reply before retrying this email response.",
|
|
59
61
|
});
|
|
60
62
|
const TRUSTED_OWNER_CONTEXT = Symbol("tldr-agent-verified-owner");
|
|
61
63
|
const BROKER_AUTHORIZED_CONTEXT = Symbol("aegis-broker-authorized-owner");
|
|
@@ -782,7 +784,16 @@ export const emailTransport = {
|
|
|
782
784
|
// Pre-shaped errors (transport_send_failed thrown above) propagate
|
|
783
785
|
// unchanged so the caller sees the existing log + error envelope.
|
|
784
786
|
if (err && err.code === "transport_send_failed" && err.hint) throw err;
|
|
785
|
-
const wrapped =
|
|
787
|
+
const wrapped =
|
|
788
|
+
canonicalRow.kind === "reply" &&
|
|
789
|
+
err?.code === "REPLY_PARENT_UNAUTHORIZED"
|
|
790
|
+
? makeError(
|
|
791
|
+
"reply_parent_unauthorized",
|
|
792
|
+
"Email reply parent is not authorized.",
|
|
793
|
+
HINT.reply_parent_unauthorized,
|
|
794
|
+
err,
|
|
795
|
+
)
|
|
796
|
+
: emailNotSent();
|
|
786
797
|
if (err?.ambiguous === true) wrapped.ambiguous = true;
|
|
787
798
|
logOutcome({
|
|
788
799
|
canonicalRow,
|
|
@@ -977,6 +988,7 @@ export const emailTransport = {
|
|
|
977
988
|
const published = await ctx.tightbeamInbound.publishInboundEmail({
|
|
978
989
|
binding,
|
|
979
990
|
provider_message_id: externalMessageId,
|
|
991
|
+
provider_thread_id: externalThreadId,
|
|
980
992
|
body: text,
|
|
981
993
|
});
|
|
982
994
|
if (published?.ok !== true) {
|
|
@@ -2225,6 +2237,14 @@ export async function reconcileInboxThread({
|
|
|
2225
2237
|
[TRUSTED_OWNER_CONTEXT]: verifiedOwnerEmail,
|
|
2226
2238
|
...(tightbeamInbound ? { tightbeamInbound } : {}),
|
|
2227
2239
|
});
|
|
2240
|
+
if (inboundResult?.recovery_required) {
|
|
2241
|
+
errors.push({
|
|
2242
|
+
stage: "inboundWebhook",
|
|
2243
|
+
messageId: m.messageId,
|
|
2244
|
+
error: inboundResult.reason || "thread_recovery_required",
|
|
2245
|
+
});
|
|
2246
|
+
continue;
|
|
2247
|
+
}
|
|
2228
2248
|
// GH#24 — an idempotent re-observation is not a fresh write.
|
|
2229
2249
|
if (inboundResult?.canonicalRow && !inboundResult?.idempotent)
|
|
2230
2250
|
written += 1;
|
package/src/starport.mjs
CHANGED
|
@@ -32,6 +32,18 @@ function unsupported() {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function unavailable(error) {
|
|
35
|
+
if (error?.code === "STARPORT_INSTALLATION_INACCESSIBLE") {
|
|
36
|
+
return Object.freeze({
|
|
37
|
+
ok: false,
|
|
38
|
+
data: null,
|
|
39
|
+
error: Object.freeze({
|
|
40
|
+
code: "STARPORT_INSTALLATION_INACCESSIBLE",
|
|
41
|
+
message: "tldr; secure setup is installed but unavailable.",
|
|
42
|
+
retryable: false,
|
|
43
|
+
remediation: "Reinstall tldr;",
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
35
47
|
if (error?.code === "STARPORT_INSTALLATION_INCOMPLETE") {
|
|
36
48
|
return Object.freeze({
|
|
37
49
|
ok: false,
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/* tldr; — drawn glyphs.
|
|
2
|
-
*
|
|
3
|
-
* An email cannot load an icon font, an SVG or a remote image, so the one mark
|
|
4
|
-
* in this system is drawn out of table cells: a matrix of 2px squares, coloured
|
|
5
|
-
* or nothing.
|
|
6
|
-
*
|
|
7
|
-
* Resolution is the whole game. At 3px cells and five rows there is not enough
|
|
8
|
-
* room above and below the shaft for an arrowhead, and the reply mark renders as
|
|
9
|
-
* a plus. 2px cells and nine rows is the floor at which a diagonal reads as a
|
|
10
|
-
* diagonal.
|
|
11
|
-
*
|
|
12
|
-
* The glyph never carries meaning alone. It sits beside the sentence it marks,
|
|
13
|
-
* so it adds structure to the block without asking the reader to decode it.
|
|
14
|
-
*
|
|
15
|
-
* There is no citron glyph. On a light card citron is 1.10:1 and decorative
|
|
16
|
-
* only, so the live edge is a filled chip with `onAccent` text on it rather than
|
|
17
|
-
* a drawn mark — the words carry the meaning and the colour carries the
|
|
18
|
-
* attention. A citron arrow would be a mark nobody could see in daylight.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const MATRIX = Object.freeze({
|
|
22
|
-
/* Reply: an arrow back to the sender. It marks the next moment — the one
|
|
23
|
-
* instruction in the message. */
|
|
24
|
-
reply: [
|
|
25
|
-
"....#.......",
|
|
26
|
-
"...##.......",
|
|
27
|
-
"..###.......",
|
|
28
|
-
".####.......",
|
|
29
|
-
"############",
|
|
30
|
-
".####.......",
|
|
31
|
-
"..###.......",
|
|
32
|
-
"...##.......",
|
|
33
|
-
"....#.......",
|
|
34
|
-
],
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const CELL = 2;
|
|
38
|
-
|
|
39
|
-
/* `fillClass` lands on the inked cells only. The blank cells carry no class and
|
|
40
|
-
* no background, so the night block can repaint a glyph without flooding the
|
|
41
|
-
* whole matrix — the difference between a mark and a solid square. */
|
|
42
|
-
export function glyph(name, colour, fillClass) {
|
|
43
|
-
const matrix = MATRIX[name];
|
|
44
|
-
const rows = matrix
|
|
45
|
-
.map(
|
|
46
|
-
(row) =>
|
|
47
|
-
`<tr>${[...row]
|
|
48
|
-
.map((cell) =>
|
|
49
|
-
cell === "#"
|
|
50
|
-
? `<td class="${fillClass}" height="${CELL}" width="${CELL}" bgcolor="${colour}" style="font-size:0;line-height:${CELL}px;padding:0;"> </td>`
|
|
51
|
-
: `<td height="${CELL}" width="${CELL}" style="font-size:0;line-height:${CELL}px;padding:0;"> </td>`,
|
|
52
|
-
)
|
|
53
|
-
.join("")}</tr>`,
|
|
54
|
-
)
|
|
55
|
-
.join("");
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
`<table role="presentation" cellpadding="0" cellspacing="0" border="0" ` +
|
|
59
|
-
`style="border-collapse:collapse;width:${CELL * matrix[0].length}px;">${rows}</table>`
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/* The plain-text twin marks the same place with the same intent. */
|
|
64
|
-
export const TEXT_GLYPH = Object.freeze({
|
|
65
|
-
reply: "<-",
|
|
66
|
-
});
|