@sellable/mcp 0.1.793 → 0.1.794

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.
Files changed (54) hide show
  1. package/dist/agent-tool-names.d.ts +2 -2
  2. package/dist/agent-tool-names.js +14 -0
  3. package/dist/scheduler-envelope.d.ts +190 -0
  4. package/dist/scheduler-envelope.js +412 -0
  5. package/dist/server.js +28 -2
  6. package/dist/tools/campaign-message-preparation.d.ts +25 -0
  7. package/dist/tools/campaign-message-preparation.js +37 -0
  8. package/dist/tools/campaign-processing.d.ts +74 -1
  9. package/dist/tools/campaign-processing.js +57 -1
  10. package/dist/tools/prompts.d.ts +15 -3
  11. package/dist/tools/prompts.js +25 -0
  12. package/dist/tools/refill-executors.d.ts +43 -70
  13. package/dist/tools/refill-executors.js +201 -273
  14. package/dist/tools/refill-sends.d.ts +3 -3
  15. package/dist/tools/refill-sends.js +1 -1
  16. package/dist/tools/refill-target-plan.js +1 -1
  17. package/dist/tools/refill-v3-advance-contract.d.ts +618 -0
  18. package/dist/tools/refill-v3-advance-contract.js +920 -0
  19. package/dist/tools/refill-v3-advance.d.ts +397 -0
  20. package/dist/tools/refill-v3-advance.js +75 -0
  21. package/dist/tools/refill-v3-attention-packet-contract.d.ts +608 -0
  22. package/dist/tools/refill-v3-attention-packet-contract.js +911 -0
  23. package/dist/tools/refill-v3-campaign-work.d.ts +324 -0
  24. package/dist/tools/refill-v3-campaign-work.js +1015 -0
  25. package/dist/tools/refill-v3-continue-contract.d.ts +433 -0
  26. package/dist/tools/refill-v3-continue-contract.js +112 -0
  27. package/dist/tools/refill-v3-continue.d.ts +501 -0
  28. package/dist/tools/refill-v3-continue.js +654 -0
  29. package/dist/tools/refill-v3-edit-selected-campaign-contract.d.ts +208 -0
  30. package/dist/tools/refill-v3-edit-selected-campaign-contract.js +351 -0
  31. package/dist/tools/refill-v3-edit-selected-campaign.d.ts +232 -0
  32. package/dist/tools/refill-v3-edit-selected-campaign.js +147 -0
  33. package/dist/tools/refill-v3-fill-ready-contract.d.ts +198 -0
  34. package/dist/tools/refill-v3-fill-ready-contract.js +324 -0
  35. package/dist/tools/refill-v3-fill-ready.d.ts +199 -0
  36. package/dist/tools/refill-v3-fill-ready.js +136 -0
  37. package/dist/tools/refill-v3-source-family-dispatch.d.ts +249 -0
  38. package/dist/tools/refill-v3-source-family-dispatch.js +514 -0
  39. package/dist/tools/refill-v3-waterfall-contract.d.ts +156 -0
  40. package/dist/tools/refill-v3-waterfall-contract.js +181 -0
  41. package/dist/tools/refill-v3-waterfall.d.ts +136 -0
  42. package/dist/tools/refill-v3-waterfall.js +161 -0
  43. package/dist/tools/refill-v3-world-state-contract.d.ts +666 -0
  44. package/dist/tools/refill-v3-world-state-contract.js +790 -0
  45. package/dist/tools/refill-v3-world-state.d.ts +592 -0
  46. package/dist/tools/refill-v3-world-state.js +137 -0
  47. package/dist/tools/registry.d.ts +1710 -3
  48. package/dist/tools/registry.js +19 -0
  49. package/package.json +1 -1
  50. package/skills/refill-sends/SKILL.md +89 -4
  51. package/skills/refill-sends-waterfall-order/SKILL.md +174 -0
  52. package/skills/refill-sends-work-campaign/SKILL.md +253 -0
  53. package/skills/refill-sends-workflow/SKILL.md +112 -5
  54. package/skills/refill-sends-workflow/core/flow.v3.json +209 -0
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Refill V3 world-state PUBLIC MCP projection (Phase 146.5 Plan 08, RV3MCP-001).
3
+ *
4
+ * This is a THIN projection and nothing else:
5
+ *
6
+ * 1. it mirrors Plan 02's DECLARATIVE request vocabulary so a protocol-level
7
+ * validator refuses closed-vocabulary drift before the handler runs;
8
+ * 2. it applies the ONE shared explicit-workspace guard, because a
9
+ * request-scoped automation must never switch the shared active workspace;
10
+ * 3. it posts the caller body once to the authenticated aggregate route, whose
11
+ * `parseRefillWorldStateInput` is the SOLE runtime authority for duplicate
12
+ * scope identities, invalid dates, unknown/cross-form keys, and canonical
13
+ * sorting; and
14
+ * 4. it returns only what Plan 02's SOLE unknown-value decoder produced.
15
+ *
16
+ * It holds no result-field rules, no second decoder, no business policy, and no
17
+ * hand-built MCP envelope — the central `toMcpToolResult` owns the wire result.
18
+ *
19
+ * `isError` is a TRANSPORT concern only (error law 6). A typed business blocker
20
+ * inside a well-formed decoded result is a successful response VALUE and passes
21
+ * through VERBATIM; this module therefore contains no branch that reads a
22
+ * decoded business field to decide failure.
23
+ *
24
+ * The declarative input schema is mirrored here rather than imported because the
25
+ * published package must never import app `src/**`. The mirror is not trusted:
26
+ * `tests/mcp/refill-v3/world-state-tool.test.ts` asserts it deep-equals the
27
+ * owner's `REFILL_V3_WORLD_STATE_INPUT_SCHEMA`, so drift is a failing pin.
28
+ */
29
+ import { getApi } from "../api.js";
30
+ import { REFILL_V3_SCHEMA_VERSION_UNSUPPORTED } from "./refill-v3-attention-packet-contract.js";
31
+ import { decodeRefillWorldStateResult, REFILL_V3_WORLD_STATE_OUTPUT_SCHEMA, } from "./refill-v3-world-state-contract.js";
32
+ import { normalizeExplicitWorkspaceId, workspaceRequestOptions, } from "./workspace-context.js";
33
+ /** The one authenticated backend boundary this projection may reach. */
34
+ export const REFILL_V3_WORLD_STATE_ROUTE = "/api/v3/mcp/refill-v3/world-state";
35
+ export const REFILL_V3_WORLD_STATE_TOOL_NAME = "refill_v3_world_state";
36
+ /** Declarative mirror of Plan 02's closed request vocabulary. */
37
+ const REFILL_V3_WORLD_STATE_TOOL_INPUT_SCHEMA = {
38
+ type: "object",
39
+ additionalProperties: false,
40
+ required: ["workspaceId", "scope"],
41
+ properties: {
42
+ workspaceId: { type: "string", minLength: 1 },
43
+ scope: {
44
+ oneOf: [
45
+ {
46
+ type: "object",
47
+ additionalProperties: false,
48
+ required: ["kind", "days"],
49
+ properties: {
50
+ kind: { type: "string", enum: ["sender_local_horizon"] },
51
+ days: {
52
+ type: "integer",
53
+ minimum: 1,
54
+ maximum: 3,
55
+ description: "sender-local intent; 3 means each sender's local today plus the next two local days",
56
+ },
57
+ senderIds: {
58
+ type: "array",
59
+ minItems: 1,
60
+ items: { type: "string", minLength: 1 },
61
+ description: "omit for every active workspace sender",
62
+ },
63
+ },
64
+ },
65
+ {
66
+ type: "object",
67
+ additionalProperties: false,
68
+ required: ["kind", "senderDates"],
69
+ properties: {
70
+ kind: { type: "string", enum: ["exact_sender_dates"] },
71
+ senderDates: {
72
+ type: "array",
73
+ minItems: 1,
74
+ items: {
75
+ type: "object",
76
+ additionalProperties: false,
77
+ required: ["senderId", "dates"],
78
+ properties: {
79
+ senderId: { type: "string", minLength: 1 },
80
+ dates: {
81
+ type: "array",
82
+ minItems: 1,
83
+ items: {
84
+ type: "string",
85
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$",
86
+ },
87
+ },
88
+ },
89
+ },
90
+ },
91
+ },
92
+ },
93
+ ],
94
+ },
95
+ },
96
+ };
97
+ export const refillV3WorldStateToolDefinitions = [
98
+ {
99
+ name: REFILL_V3_WORLD_STATE_TOOL_NAME,
100
+ description: "One factual observation of Refill V3 send capacity. It returns one row per scoped sender, per scoped local date, per lane, where the two lanes connection_invite and paid_inmail are independent: each carries its own slots, its own typed blocker, and its own eligible and ineligible campaign options. A scoped sender/date request refreshes both lanes of that sender and date atomically, so the two lanes are never read from different instants. It states facts and never chooses: it schedules nothing, places nothing, sends nothing, approves nothing, enriches nothing, generates nothing, and mutates no campaign, and it reports each of those explicitly as false. The one bookkeeping effect it may perform is a paid-InMail credit cache read or refresh, reported as its own outcome.",
101
+ inputSchema: REFILL_V3_WORLD_STATE_TOOL_INPUT_SCHEMA,
102
+ outputSchema: REFILL_V3_WORLD_STATE_OUTPUT_SCHEMA,
103
+ annotations: {
104
+ title: "Refill V3 World State",
105
+ // NOT literal read-only: the observation is allowed to perform paid-credit
106
+ // cache bookkeeping, so claiming `readOnlyHint: true` would be false.
107
+ readOnlyHint: false,
108
+ destructiveHint: false,
109
+ idempotentHint: true,
110
+ openWorldHint: false,
111
+ },
112
+ },
113
+ ];
114
+ /**
115
+ * Observe the canonical world state for ONE explicit workspace.
116
+ *
117
+ * The returned value is the plain canonical business object. Every failure that
118
+ * is NOT a decoded business fact — a refused request, an authorization refusal,
119
+ * an infrastructure failure, or a response the sole decoder rejects — propagates
120
+ * as a thrown transport error and can never become a plausible empty
121
+ * observation.
122
+ */
123
+ export async function getRefillV3WorldStateTool(input) {
124
+ const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
125
+ if (!workspaceId) {
126
+ throw new Error("Explicit workspaceId is required for refill_v3_world_state. Pass workspaceId on the tool call instead of switching the shared active workspace.");
127
+ }
128
+ const raw = await getApi().post(REFILL_V3_WORLD_STATE_ROUTE, { workspaceId, scope: input.scope }, workspaceRequestOptions(workspaceId));
129
+ const decoded = decodeRefillWorldStateResult(raw);
130
+ if (decoded === null) {
131
+ throw new Error("The Refill V3 world-state response failed the published result contract.");
132
+ }
133
+ if (decoded === REFILL_V3_SCHEMA_VERSION_UNSUPPORTED) {
134
+ throw new Error("The Refill V3 world-state response uses a schema major this build cannot read. Update @sellable/mcp.");
135
+ }
136
+ return decoded;
137
+ }