1
import * as FileSystem from 'effect/FileSystem';
2
import * as Path from 'effect/Path';
3
import * as BunFileSystem from '@effect/platform-bun/BunFileSystem';
4
-import { Effect, Layer, Option, Schema } from 'effect';
4
+import { Effect, Exit, Layer, Option, Schema } from 'effect';
5
import { trackCliEventEffect } from 'src/analytics/dispatch';
6
import { getPluginHintShownEvent } from 'src/analytics/events';
7
import { APP_CONFIG } from 'src/effects/app-config';
72
);
73
}).pipe(Effect.orElseSucceed(() => false));
74
75
+ const releaseHint = (host: AgentHost) =>
76
+ Effect.gen(function* () {
77
+ const fs = yield* FileSystem.FileSystem;
78
+ const path = yield* Path.Path;
79
+ yield* fs.remove(path.join(config.stateDirectory, `${host}.stamp`), { force: true });
80
+ }).pipe(Effect.ignore);
81
+
82
// "Confidently absent" only: a missing state file means the plugin was never
83
// installed, while an unreadable or unrecognized one suppresses the hint.
84
const claudePluginAbsent = Effect.gen(function* () {
117
}
118
if (!(yield* pluginAbsentByHost[host])) return;
119
if (!(yield* claimHint(host))) return;
113
- yield* terminal.error(
114
- `Tip: running under ${AGENT_HOST_LABELS[host]} without the Composio plugin — 'composio setup --yes' installs it.`
120
+ // The stamp must not outlive a failed delivery: if printing the hint
121
+ // does not succeed, release the claim so the next invocation can
122
+ // retry instead of staying muted for the full interval. Tracking
123
+ // below is best-effort by contract (trackCliEventEffect never
124
+ // fails), so a delivered hint with a lost event is accepted.
125
+ const printed = yield* Effect.exit(
126
+ terminal.error(
127
+ `Tip: running under ${AGENT_HOST_LABELS[host]} without the Composio plugin — 'composio setup --yes' installs it.`
128
+ )
129
);
130
+ if (Exit.isFailure(printed)) {
131
+ yield* releaseHint(host);
132
+ return;
133
+ }
134
yield* trackCliEventEffect(
135
getPluginHintShownEvent({
136
invocationOrigin: config.invocationOrigin ?? DEFAULT_CLI_INVOCATION_ORIGIN,