@withpica/mcp-server 2.95.2 → 2.95.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/CHANGELOG.md +46 -0
- package/README.intro.md +115 -0
- package/README.md +188 -204
- package/dist/lib/changelog.generated.d.ts +2 -2
- package/dist/lib/changelog.generated.d.ts.map +1 -1
- package/dist/lib/changelog.generated.js +2 -2
- package/dist/lib/changelog.generated.js.map +1 -1
- package/dist/prompts/index.js +4 -4
- package/dist/prompts/index.js.map +1 -1
- package/dist/resources/agent-guide.d.ts +50 -4
- package/dist/resources/agent-guide.d.ts.map +1 -1
- package/dist/resources/agent-guide.js +109 -18
- package/dist/resources/agent-guide.js.map +1 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +81 -2
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/llms-primer.d.ts +1 -1
- package/dist/resources/llms-primer.d.ts.map +1 -1
- package/dist/resources/llms-primer.js +1 -1
- package/dist/resources/required-schemas.generated.d.ts +24 -12
- package/dist/resources/required-schemas.generated.d.ts.map +1 -1
- package/dist/resources/required-schemas.generated.js +31 -18
- package/dist/resources/required-schemas.generated.js.map +1 -1
- package/dist/resources/required-schemas.source.d.ts.map +1 -1
- package/dist/resources/required-schemas.source.js +39 -15
- package/dist/resources/required-schemas.source.js.map +1 -1
- package/dist/server-instructions.d.ts +2 -2
- package/dist/server-instructions.d.ts.map +1 -1
- package/dist/server-instructions.js +5 -5
- package/dist/server-instructions.js.map +1 -1
- package/dist/skills/skills.generated.d.ts.map +1 -1
- package/dist/skills/skills.generated.js +23 -14
- package/dist/skills/skills.generated.js.map +1 -1
- package/dist/tools/agent-identity.d.ts.map +1 -1
- package/dist/tools/agent-identity.js +2 -1
- package/dist/tools/agent-identity.js.map +1 -1
- package/dist/tools/agreement-types.d.ts.map +1 -1
- package/dist/tools/agreement-types.js +23 -11
- package/dist/tools/agreement-types.js.map +1 -1
- package/dist/tools/agreements.d.ts.map +1 -1
- package/dist/tools/agreements.js +17 -9
- package/dist/tools/agreements.js.map +1 -1
- package/dist/tools/analytics.d.ts.map +1 -1
- package/dist/tools/analytics.js +6 -3
- package/dist/tools/analytics.js.map +1 -1
- package/dist/tools/assets.d.ts.map +1 -1
- package/dist/tools/assets.js +20 -13
- package/dist/tools/assets.js.map +1 -1
- package/dist/tools/audio-files.d.ts.map +1 -1
- package/dist/tools/audio-files.js +5 -3
- package/dist/tools/audio-files.js.map +1 -1
- package/dist/tools/bulk.d.ts.map +1 -1
- package/dist/tools/bulk.js +15 -9
- package/dist/tools/bulk.js.map +1 -1
- package/dist/tools/collaborators.d.ts.map +1 -1
- package/dist/tools/collaborators.js +41 -16
- package/dist/tools/collaborators.js.map +1 -1
- package/dist/tools/comparisons.d.ts.map +1 -1
- package/dist/tools/comparisons.js +2 -1
- package/dist/tools/comparisons.js.map +1 -1
- package/dist/tools/credits.d.ts +4 -3
- package/dist/tools/credits.d.ts.map +1 -1
- package/dist/tools/credits.js +16 -88
- package/dist/tools/credits.js.map +1 -1
- package/dist/tools/custody.d.ts.map +1 -1
- package/dist/tools/custody.js +43 -10
- package/dist/tools/custody.js.map +1 -1
- package/dist/tools/dashboard.d.ts.map +1 -1
- package/dist/tools/dashboard.js +38 -19
- package/dist/tools/dashboard.js.map +1 -1
- package/dist/tools/deprecations.d.ts +12 -2
- package/dist/tools/deprecations.d.ts.map +1 -1
- package/dist/tools/deprecations.js +22 -12
- package/dist/tools/deprecations.js.map +1 -1
- package/dist/tools/directory.d.ts.map +1 -1
- package/dist/tools/directory.js +7 -4
- package/dist/tools/directory.js.map +1 -1
- package/dist/tools/discovery.d.ts +66 -10
- package/dist/tools/discovery.d.ts.map +1 -1
- package/dist/tools/discovery.js +221 -25
- package/dist/tools/discovery.js.map +1 -1
- package/dist/tools/disputes.d.ts.map +1 -1
- package/dist/tools/disputes.js +3 -0
- package/dist/tools/disputes.js.map +1 -1
- package/dist/tools/documents.d.ts.map +1 -1
- package/dist/tools/documents.js +9 -6
- package/dist/tools/documents.js.map +1 -1
- package/dist/tools/enrichment.d.ts +14 -0
- package/dist/tools/enrichment.d.ts.map +1 -1
- package/dist/tools/enrichment.js +217 -16
- package/dist/tools/enrichment.js.map +1 -1
- package/dist/tools/error-envelope.d.ts +44 -0
- package/dist/tools/error-envelope.d.ts.map +1 -0
- package/dist/tools/error-envelope.js +17 -0
- package/dist/tools/error-envelope.js.map +1 -0
- package/dist/tools/exports.d.ts +4 -0
- package/dist/tools/exports.d.ts.map +1 -1
- package/dist/tools/exports.js +158 -6
- package/dist/tools/exports.js.map +1 -1
- package/dist/tools/groups.d.ts.map +1 -1
- package/dist/tools/groups.js +1 -0
- package/dist/tools/groups.js.map +1 -1
- package/dist/tools/import-documents.d.ts.map +1 -1
- package/dist/tools/import-documents.js +3 -2
- package/dist/tools/import-documents.js.map +1 -1
- package/dist/tools/import.d.ts.map +1 -1
- package/dist/tools/import.js +71 -38
- package/dist/tools/import.js.map +1 -1
- package/dist/tools/index.d.ts +53 -4
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +166 -38
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/licensing.d.ts.map +1 -1
- package/dist/tools/licensing.js +6 -2
- package/dist/tools/licensing.js.map +1 -1
- package/dist/tools/memory.d.ts.map +1 -1
- package/dist/tools/memory.js +8 -4
- package/dist/tools/memory.js.map +1 -1
- package/dist/tools/metadata.d.ts +7 -1
- package/dist/tools/metadata.d.ts.map +1 -1
- package/dist/tools/metadata.js +65 -2
- package/dist/tools/metadata.js.map +1 -1
- package/dist/tools/multimedia.d.ts.map +1 -1
- package/dist/tools/multimedia.js +7 -3
- package/dist/tools/multimedia.js.map +1 -1
- package/dist/tools/notes.d.ts.map +1 -1
- package/dist/tools/notes.js +9 -6
- package/dist/tools/notes.js.map +1 -1
- package/dist/tools/notifications.d.ts.map +1 -1
- package/dist/tools/notifications.js +16 -27
- package/dist/tools/notifications.js.map +1 -1
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js +8 -5
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/projects.d.ts.map +1 -1
- package/dist/tools/projects.js +16 -12
- package/dist/tools/projects.js.map +1 -1
- package/dist/tools/recording-custody.d.ts.map +1 -1
- package/dist/tools/recording-custody.js +9 -5
- package/dist/tools/recording-custody.js.map +1 -1
- package/dist/tools/recording-samples.d.ts.map +1 -1
- package/dist/tools/recording-samples.js +25 -6
- package/dist/tools/recording-samples.js.map +1 -1
- package/dist/tools/recordings.d.ts +10 -0
- package/dist/tools/recordings.d.ts.map +1 -1
- package/dist/tools/recordings.js +32 -19
- package/dist/tools/recordings.js.map +1 -1
- package/dist/tools/recovery-hints.d.ts.map +1 -1
- package/dist/tools/recovery-hints.js +58 -17
- package/dist/tools/recovery-hints.js.map +1 -1
- package/dist/tools/release-rich.js +5 -5
- package/dist/tools/release-rich.js.map +1 -1
- package/dist/tools/releases.d.ts.map +1 -1
- package/dist/tools/releases.js +21 -12
- package/dist/tools/releases.js.map +1 -1
- package/dist/tools/royalties.d.ts.map +1 -1
- package/dist/tools/royalties.js +12 -6
- package/dist/tools/royalties.js.map +1 -1
- package/dist/tools/send.d.ts.map +1 -1
- package/dist/tools/send.js +7 -4
- package/dist/tools/send.js.map +1 -1
- package/dist/tools/sessions.d.ts.map +1 -1
- package/dist/tools/sessions.js +8 -4
- package/dist/tools/sessions.js.map +1 -1
- package/dist/tools/settings.d.ts.map +1 -1
- package/dist/tools/settings.js +10 -4
- package/dist/tools/settings.js.map +1 -1
- package/dist/tools/share-links.d.ts.map +1 -1
- package/dist/tools/share-links.js +7 -3
- package/dist/tools/share-links.js.map +1 -1
- package/dist/tools/share-send.d.ts.map +1 -1
- package/dist/tools/share-send.js +15 -5
- package/dist/tools/share-send.js.map +1 -1
- package/dist/tools/shows.d.ts +31 -0
- package/dist/tools/shows.d.ts.map +1 -0
- package/dist/tools/shows.js +307 -0
- package/dist/tools/shows.js.map +1 -0
- package/dist/tools/skills.d.ts.map +1 -1
- package/dist/tools/skills.js +7 -0
- package/dist/tools/skills.js.map +1 -1
- package/dist/tools/split-sheets.d.ts.map +1 -1
- package/dist/tools/split-sheets.js +19 -12
- package/dist/tools/split-sheets.js.map +1 -1
- package/dist/tools/statements.js +2 -2
- package/dist/tools/statements.js.map +1 -1
- package/dist/tools/storage-config.d.ts.map +1 -1
- package/dist/tools/storage-config.js +5 -3
- package/dist/tools/storage-config.js.map +1 -1
- package/dist/tools/subscription.d.ts +69 -19
- package/dist/tools/subscription.d.ts.map +1 -1
- package/dist/tools/subscription.js +98 -255
- package/dist/tools/subscription.js.map +1 -1
- package/dist/tools/sync-placements.d.ts.map +1 -1
- package/dist/tools/sync-placements.js +10 -5
- package/dist/tools/sync-placements.js.map +1 -1
- package/dist/tools/telegram.d.ts.map +1 -1
- package/dist/tools/telegram.js +16 -24
- package/dist/tools/telegram.js.map +1 -1
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +12 -6
- package/dist/tools/users.js.map +1 -1
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js +13 -10
- package/dist/tools/works.js.map +1 -1
- package/package.json +7 -3
- package/server.json +2 -2
|
@@ -84,7 +84,9 @@ export class StorageConfigTools {
|
|
|
84
84
|
"they remain in your bucket and continue to be accessible by your URLs. " +
|
|
85
85
|
"Two-step destructive: the first call returns a confirmation token; the " +
|
|
86
86
|
"second call with the token executes. Idempotent — calling on an already-" +
|
|
87
|
-
"PICA-managed org is a no-op."
|
|
87
|
+
"PICA-managed org is a no-op. Check what is configured first with " +
|
|
88
|
+
"pica_storage_status; to point at your own bucket instead, use " +
|
|
89
|
+
"pica_storage_configure_start.",
|
|
88
90
|
workflows: "infrastructure",
|
|
89
91
|
vernacular_kind: "specialist",
|
|
90
92
|
vernacular_reason: "Destructive operation; invoked by exact name after explicit user confirmation in a specialist flow.",
|
|
@@ -95,8 +97,8 @@ export class StorageConfigTools {
|
|
|
95
97
|
type: "string",
|
|
96
98
|
description: "Token returned by the first call. Pass it back to confirm. " +
|
|
97
99
|
"If omitted, the tool returns confirmation_required + a fresh " +
|
|
98
|
-
"token. The
|
|
99
|
-
"
|
|
100
|
+
"token. The token is validated automatically before the " +
|
|
101
|
+
"disconnect runs.",
|
|
100
102
|
},
|
|
101
103
|
},
|
|
102
104
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-config.js","sourceRoot":"","sources":["../../src/tools/storage-config.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAQnE,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,CAAU,CAAC;AAe3E,MAAM,OAAO,kBAAkB;IACrB,IAAI,CAAa;IAEzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,OAAO;YACL;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,8BAA8B;oBACpC,KAAK,EAAE,OAAO;oBACd,SAAS,EAAE,CAAC,OAAO,CAAC;oBACpB,IAAI,EAAE,OAAO;oBACb,WAAW,EACT,0EAA0E;wBAC1E,oEAAoE;wBACpE,4EAA4E;wBAC5E,2EAA2E;wBAC3E,+EAA+E;wBAC/E,4EAA4E;wBAC5E,oEAAoE;wBACpE,oDAAoD;oBACtD,SAAS,EAAE,gBAAgB;oBAC3B,eAAe,EAAE,UAAU;oBAC3B,iBAAiB,EACf,kHAAkH;oBACpH,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,QAAQ,EAAE;gCACR,IAAI,EAAE,QAAQ;gCACd,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC;gCAC1B,WAAW,EACT,wEAAwE;oCACxE,sEAAsE;6BACzE;4BACD,OAAO,EAAE;gCACP,IAAI,EAAE,QAAQ;gCACd,WAAW,EACT,wDAAwD;oCACxD,yEAAyE;oCACzE,2DAA2D;6BAC9D;yBACF;wBACD,QAAQ,EAAE,CAAC,UAAU,CAAC;qBACvB;oBACD,WAAW,EAAE;wBACX,YAAY,EAAE,KAAK;wBACnB,eAAe,EAAE,KAAK;qBACvB;iBACF;gBACD,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;aACzC;YACD;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,yBAAyB;oBAC/B,KAAK,EAAE,OAAO;oBACd,SAAS,EAAE,CAAC,OAAO,CAAC;oBACpB,IAAI,EAAE,aAAa;oBACnB,WAAW,EACT,yEAAyE;wBACzE,0EAA0E;wBAC1E,yEAAyE;wBACzE,yEAAyE;wBACzE,0EAA0E;wBAC1E,
|
|
1
|
+
{"version":3,"file":"storage-config.js","sourceRoot":"","sources":["../../src/tools/storage-config.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAQnE,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,CAAU,CAAC;AAe3E,MAAM,OAAO,kBAAkB;IACrB,IAAI,CAAa;IAEzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,OAAO;YACL;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,8BAA8B;oBACpC,KAAK,EAAE,OAAO;oBACd,SAAS,EAAE,CAAC,OAAO,CAAC;oBACpB,IAAI,EAAE,OAAO;oBACb,WAAW,EACT,0EAA0E;wBAC1E,oEAA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AQ,EAAE,iBAAiB,IAAI,SAAS,CAAC;QAClE,MAAM,OAAO,GACX,gBAAgB,KAAK,SAAS,IAAI,gBAAgB,KAAK,SAAS;YAC9D,CAAC,CAAC,uDAAuD;YACzD,CAAC,CAAC,gBAAgB,gBAAgB,kDAAkD;gBAClF,8BAA8B,gBAAgB,0BAA0B,CAAC;QAE/E,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;YAC1C,iBAAiB,EAAE;gBACjB,IAAI,EAAE,gCAAgC;gBACtC,OAAO,EAAE,CAAC;gBACV,IAAI,EAAE;oBACJ,iBAAiB,EAAE,gBAAgB;oBACnC,gBAAgB,EAAE,SAAS;iBAC5B;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,9 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subscription Tools — ADR-210 Phase 2.
|
|
3
|
+
*
|
|
4
|
+
* Two MCP tools that surface the explicit billing read + action layer
|
|
5
|
+
* complementing the ambient `_meta.session_state.billing_slice` shipped
|
|
6
|
+
* in Phase 1:
|
|
7
|
+
*
|
|
8
|
+
* - pica_subscription_status (read; readOnlyHint=true)
|
|
9
|
+
* Wraps `GET /api/admin/subscription`, flattens the response into
|
|
10
|
+
* the 9-field shape ADR-210 § Phase 2 specifies, and composes a
|
|
11
|
+
* templated `summary` line the agent uses verbatim.
|
|
12
|
+
*
|
|
13
|
+
* - pica_subscription_manage (action; readOnlyHint=false)
|
|
14
|
+
* Single-verb dispatcher over the existing
|
|
15
|
+
* `POST /api/admin/subscription` (subscribe / upgrade) and
|
|
16
|
+
* `POST /api/admin/subscription/portal` (manage / cancel) routes.
|
|
17
|
+
* Returns a `resource_link` content block (universal MCP floor)
|
|
18
|
+
* and uses `elicitation/create url` only when the client
|
|
19
|
+
* advertises `capabilities.elicitation.url` per ADR-200 Phase 1
|
|
20
|
+
* (capability-gated; `feedback_mcp_sdk_capability_gates_elicitation.md`).
|
|
21
|
+
*
|
|
22
|
+
* No new Stripe SDK calls — both routes are reused as-is.
|
|
23
|
+
*/
|
|
1
24
|
import { PicaClient, type BillingTier, type SubscriptionStatusResponse } from "@withpica/mcp-sdk";
|
|
2
25
|
import { ToolDefinition, ToolExecutor } from "./index.js";
|
|
26
|
+
/**
|
|
27
|
+
* ⚠️ ADR-276 REMOVED THE TRIAL AND THE TIER LADDER. This tool described both to
|
|
28
|
+
* agents until 2026-08-21.
|
|
29
|
+
*
|
|
30
|
+
* `billing_state` is the STORED value and keeps its three legacy names because
|
|
31
|
+
* that is what `organisations.billing_state` holds — renaming it here would make
|
|
32
|
+
* the wire disagree with the database. `plan` is the same fact in the vocabulary
|
|
33
|
+
* that is actually true, and it is what an agent should say out loud:
|
|
34
|
+
*
|
|
35
|
+
* billing_state plan what it means under ADR-276
|
|
36
|
+
* ────────────── ─────────────── ──────────────────────────────────────────
|
|
37
|
+
* trial free_runway walked in, never charged. no clock, no card.
|
|
38
|
+
* active resident paying one flat fee per 30-day cycle
|
|
39
|
+
* hibernated paused a cycle lapsed; deep-processing is off
|
|
40
|
+
*
|
|
41
|
+
* `trial_days_remaining` and `trial_ends_at` are GONE. They were null for 100%
|
|
42
|
+
* of production organisations (`billing_trial_ends_at` is NULL on all 241), so
|
|
43
|
+
* removing them drops two fields that could only ever say "null" — the cheapest
|
|
44
|
+
* possible moment to take a concept off the wire. Codes for arguments, labels
|
|
45
|
+
* for prose (`.claude/rules/canonical-model.md`).
|
|
46
|
+
*/
|
|
3
47
|
interface SubscriptionStatusFlat {
|
|
4
48
|
billing_state: "trial" | "active" | "hibernated";
|
|
5
|
-
|
|
6
|
-
trial_ends_at: string | null;
|
|
49
|
+
plan: "free_runway" | "resident" | "paused";
|
|
7
50
|
current_tier: BillingTier | null;
|
|
8
51
|
capacity_used: number;
|
|
9
52
|
capacity_limit: number | null;
|
|
@@ -11,6 +54,8 @@ interface SubscriptionStatusFlat {
|
|
|
11
54
|
recommended_tier: BillingTier | null;
|
|
12
55
|
summary: string;
|
|
13
56
|
}
|
|
57
|
+
/** The stored billing state in the vocabulary ADR-276 actually uses. */
|
|
58
|
+
export declare function planFor(billingState: "trial" | "active" | "hibernated"): "free_runway" | "resident" | "paused";
|
|
14
59
|
/**
|
|
15
60
|
* Compose the flat 9-field response from the existing GET admin route's
|
|
16
61
|
* shape. Mirrors `getOrgBillingSlice`'s "no meaningful cap" rule for
|
|
@@ -22,19 +67,34 @@ interface SubscriptionStatusFlat {
|
|
|
22
67
|
*/
|
|
23
68
|
export declare function flattenStatus(status: SubscriptionStatusResponse): SubscriptionStatusFlat;
|
|
24
69
|
/**
|
|
25
|
-
* Server-side template
|
|
26
|
-
*
|
|
27
|
-
*
|
|
70
|
+
* The sentence an agent says out loud. Server-side template (Stage 1 Q1 option
|
|
71
|
+
* A) so wording does not vary across connectors.
|
|
72
|
+
*
|
|
73
|
+
* ⚠️ REWRITTEN 2026-08-21. Every branch was false under ADR-276:
|
|
74
|
+
*
|
|
75
|
+
* trial → "You're on a 9-day window of your trial. Today's catalogue
|
|
76
|
+
* fits the solo tier." — there is no trial and no tier ladder
|
|
77
|
+
* hibernated → "Your trial has ended and the catalogue is read-only.
|
|
78
|
+
* Subscribe to restore writes."
|
|
79
|
+
* — hibernation gates `pica_audio_analyze` and nothing else;
|
|
80
|
+
* the catalogue is NOT read-only, and there is nothing to
|
|
81
|
+
* subscribe to
|
|
82
|
+
* active → "Currently on pro. 412 of 4,000 slots used."
|
|
83
|
+
* — the capacity ladder was superseded
|
|
84
|
+
*
|
|
85
|
+
* 239 of 241 production organisations sit at `billing_state = 'trial'`, so the
|
|
86
|
+
* first branch was what an agent said to almost every user pica has. The screen
|
|
87
|
+
* had already been corrected; this had not, which is the recurring shape here —
|
|
88
|
+
* see `.claude/rules/canonical-model.md` on `WORK_NO_WRITER`.
|
|
89
|
+
*
|
|
90
|
+
* Capacity is deliberately not mentioned: no cap is enforced under ADR-276, and
|
|
91
|
+
* quoting a limit implies one. The work count is stated as a plain fact instead.
|
|
28
92
|
*
|
|
29
93
|
* Exported for unit tests.
|
|
30
94
|
*/
|
|
31
95
|
export declare function composeSummary(fields: {
|
|
32
96
|
billing_state: "trial" | "active" | "hibernated";
|
|
33
|
-
trial_days_remaining: number | null;
|
|
34
|
-
current_tier: BillingTier | null;
|
|
35
97
|
capacity_used: number;
|
|
36
|
-
capacity_limit: number | null;
|
|
37
|
-
recommended_tier: BillingTier | null;
|
|
38
98
|
}): string;
|
|
39
99
|
export declare class SubscriptionTools {
|
|
40
100
|
private pica;
|
|
@@ -45,16 +105,6 @@ export declare class SubscriptionTools {
|
|
|
45
105
|
}>;
|
|
46
106
|
private status;
|
|
47
107
|
private manage;
|
|
48
|
-
/**
|
|
49
|
-
* Universal-floor return per ADR-200 Phase 1: every successful manage
|
|
50
|
-
* response carries a `resource_link` so any compliant MCP client can
|
|
51
|
-
* render or open the URL. Clients that advertise
|
|
52
|
-
* `capabilities.elicitation.url` additionally receive a server-issued
|
|
53
|
-
* elicitation/create request — the gate is mandatory because
|
|
54
|
-
* `elicitInput` with `mode: "url"` throws synchronously against
|
|
55
|
-
* non-supporters (`feedback_mcp_sdk_capability_gates_elicitation.md`).
|
|
56
|
-
*/
|
|
57
|
-
private buildLinkResult;
|
|
58
108
|
}
|
|
59
109
|
export {};
|
|
60
110
|
//# sourceMappingURL=subscription.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/tools/subscription.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/tools/subscription.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,0BAA0B,EAChC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAetE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,UAAU,sBAAsB;IAC9B,aAAa,EAAE,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC;IACjD,IAAI,EAAE,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC5C,YAAY,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wEAAwE;AACxE,wBAAgB,OAAO,CACrB,YAAY,EAAE,OAAO,GAAG,QAAQ,GAAG,YAAY,GAC9C,aAAa,GAAG,UAAU,GAAG,QAAQ,CAIvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,0BAA0B,GACjC,sBAAsB,CA+BxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,aAAa,EAAE,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC;IACjD,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAqBT;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAa;gBAEb,IAAI,EAAE,UAAU;IAI5B,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;YA+F3D,MAAM;YAkCN,MAAM;CAoErB"}
|
|
@@ -1,30 +1,4 @@
|
|
|
1
1
|
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any -- ToolExecutor signature uses Record<string, any> */
|
|
3
|
-
/**
|
|
4
|
-
* Subscription Tools — ADR-210 Phase 2.
|
|
5
|
-
*
|
|
6
|
-
* Two MCP tools that surface the explicit billing read + action layer
|
|
7
|
-
* complementing the ambient `_meta.session_state.billing_slice` shipped
|
|
8
|
-
* in Phase 1:
|
|
9
|
-
*
|
|
10
|
-
* - pica_subscription_status (read; readOnlyHint=true)
|
|
11
|
-
* Wraps `GET /api/admin/subscription`, flattens the response into
|
|
12
|
-
* the 9-field shape ADR-210 § Phase 2 specifies, and composes a
|
|
13
|
-
* templated `summary` line the agent uses verbatim.
|
|
14
|
-
*
|
|
15
|
-
* - pica_subscription_manage (action; readOnlyHint=false)
|
|
16
|
-
* Single-verb dispatcher over the existing
|
|
17
|
-
* `POST /api/admin/subscription` (subscribe / upgrade) and
|
|
18
|
-
* `POST /api/admin/subscription/portal` (manage / cancel) routes.
|
|
19
|
-
* Returns a `resource_link` content block (universal MCP floor)
|
|
20
|
-
* and uses `elicitation/create url` only when the client
|
|
21
|
-
* advertises `capabilities.elicitation.url` per ADR-200 Phase 1
|
|
22
|
-
* (capability-gated; `feedback_mcp_sdk_capability_gates_elicitation.md`).
|
|
23
|
-
*
|
|
24
|
-
* No new Stripe SDK calls — both routes are reused as-is.
|
|
25
|
-
*/
|
|
26
|
-
import { randomUUID } from "node:crypto";
|
|
27
|
-
import { clientSupportsUrlElicitation } from "@withpica/mcp-utils";
|
|
28
2
|
// ADR-205 D7: enterprise is sales-led, not bookable through Checkout.
|
|
29
3
|
// Mirror the route-layer allowlist here for a better tool-side error
|
|
30
4
|
// message before the request leaves the agent.
|
|
@@ -35,6 +9,14 @@ const VALID_PAID_TIERS = [
|
|
|
35
9
|
"established",
|
|
36
10
|
];
|
|
37
11
|
const VALID_ACTIONS = ["subscribe", "upgrade", "manage", "cancel"];
|
|
12
|
+
/** The stored billing state in the vocabulary ADR-276 actually uses. */
|
|
13
|
+
export function planFor(billingState) {
|
|
14
|
+
if (billingState === "active")
|
|
15
|
+
return "resident";
|
|
16
|
+
if (billingState === "hibernated")
|
|
17
|
+
return "paused";
|
|
18
|
+
return "free_runway";
|
|
19
|
+
}
|
|
38
20
|
/**
|
|
39
21
|
* Compose the flat 9-field response from the existing GET admin route's
|
|
40
22
|
* shape. Mirrors `getOrgBillingSlice`'s "no meaningful cap" rule for
|
|
@@ -45,10 +27,6 @@ const VALID_ACTIONS = ["subscribe", "upgrade", "manage", "cancel"];
|
|
|
45
27
|
* Exported for unit tests.
|
|
46
28
|
*/
|
|
47
29
|
export function flattenStatus(status) {
|
|
48
|
-
const trialEndsAt = status.trialEndsAt;
|
|
49
|
-
const trialDaysRemaining = status.billingState === "trial" && trialEndsAt
|
|
50
|
-
? Math.max(0, Math.ceil((new Date(trialEndsAt).getTime() - Date.now()) / 86_400_000))
|
|
51
|
-
: null;
|
|
52
30
|
const capacityUsed = status.overflow?.currentCount ?? 0;
|
|
53
31
|
const capacityLimit = status.overflow?.capacity ?? null;
|
|
54
32
|
const recommendedTier = status.overflow?.recommendedTier ?? null;
|
|
@@ -65,8 +43,7 @@ export function flattenStatus(status) {
|
|
|
65
43
|
: 0;
|
|
66
44
|
return {
|
|
67
45
|
billing_state: status.billingState,
|
|
68
|
-
|
|
69
|
-
trial_ends_at: trialEndsAt,
|
|
46
|
+
plan: planFor(status.billingState),
|
|
70
47
|
current_tier: status.tier,
|
|
71
48
|
capacity_used: capacityUsed,
|
|
72
49
|
capacity_limit: capacityLimit,
|
|
@@ -74,57 +51,50 @@ export function flattenStatus(status) {
|
|
|
74
51
|
recommended_tier: recommendedTier,
|
|
75
52
|
summary: composeSummary({
|
|
76
53
|
billing_state: status.billingState,
|
|
77
|
-
trial_days_remaining: trialDaysRemaining,
|
|
78
|
-
current_tier: status.tier,
|
|
79
54
|
capacity_used: capacityUsed,
|
|
80
|
-
capacity_limit: capacityLimit,
|
|
81
|
-
recommended_tier: recommendedTier,
|
|
82
55
|
}),
|
|
83
56
|
};
|
|
84
57
|
}
|
|
85
58
|
/**
|
|
86
|
-
* Server-side template
|
|
87
|
-
*
|
|
88
|
-
*
|
|
59
|
+
* The sentence an agent says out loud. Server-side template (Stage 1 Q1 option
|
|
60
|
+
* A) so wording does not vary across connectors.
|
|
61
|
+
*
|
|
62
|
+
* ⚠️ REWRITTEN 2026-08-21. Every branch was false under ADR-276:
|
|
63
|
+
*
|
|
64
|
+
* trial → "You're on a 9-day window of your trial. Today's catalogue
|
|
65
|
+
* fits the solo tier." — there is no trial and no tier ladder
|
|
66
|
+
* hibernated → "Your trial has ended and the catalogue is read-only.
|
|
67
|
+
* Subscribe to restore writes."
|
|
68
|
+
* — hibernation gates `pica_audio_analyze` and nothing else;
|
|
69
|
+
* the catalogue is NOT read-only, and there is nothing to
|
|
70
|
+
* subscribe to
|
|
71
|
+
* active → "Currently on pro. 412 of 4,000 slots used."
|
|
72
|
+
* — the capacity ladder was superseded
|
|
73
|
+
*
|
|
74
|
+
* 239 of 241 production organisations sit at `billing_state = 'trial'`, so the
|
|
75
|
+
* first branch was what an agent said to almost every user pica has. The screen
|
|
76
|
+
* had already been corrected; this had not, which is the recurring shape here —
|
|
77
|
+
* see `.claude/rules/canonical-model.md` on `WORK_NO_WRITER`.
|
|
78
|
+
*
|
|
79
|
+
* Capacity is deliberately not mentioned: no cap is enforced under ADR-276, and
|
|
80
|
+
* quoting a limit implies one. The work count is stated as a plain fact instead.
|
|
89
81
|
*
|
|
90
82
|
* Exported for unit tests.
|
|
91
83
|
*/
|
|
92
84
|
export function composeSummary(fields) {
|
|
93
|
-
const { billing_state,
|
|
94
|
-
const
|
|
95
|
-
if (billing_state === "trial") {
|
|
96
|
-
let daysClause;
|
|
97
|
-
if (trial_days_remaining === null) {
|
|
98
|
-
daysClause = "your trial";
|
|
99
|
-
}
|
|
100
|
-
else if (trial_days_remaining === 0) {
|
|
101
|
-
daysClause = "the final day of your trial";
|
|
102
|
-
}
|
|
103
|
-
else if (trial_days_remaining === 1) {
|
|
104
|
-
daysClause = "1 day left of your trial";
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
daysClause = `a ${trial_days_remaining}-day window of your trial`;
|
|
108
|
-
}
|
|
109
|
-
const tierHint = recommended_tier
|
|
110
|
-
? ` Today's catalogue fits the ${recommended_tier} tier.`
|
|
111
|
-
: "";
|
|
112
|
-
return `You're on ${daysClause}. ${slotsClause} so far.${tierHint}`;
|
|
113
|
-
}
|
|
85
|
+
const { billing_state, capacity_used } = fields;
|
|
86
|
+
const works = `${capacity_used} active work${capacity_used === 1 ? "" : "s"}`;
|
|
114
87
|
if (billing_state === "hibernated") {
|
|
115
|
-
return `
|
|
88
|
+
return (`Deep-processing is paused on this catalogue because a cycle went unpaid. ` +
|
|
89
|
+
`Nothing has been deleted and you can still read and export everything ` +
|
|
90
|
+
`(${works} held). Becoming a resident again switches deep-processing back on.`);
|
|
116
91
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return `On the enterprise plan (unbounded). ${slotsClause}.`;
|
|
92
|
+
if (billing_state === "active") {
|
|
93
|
+
return `You're a resident — one flat fee per 30-day cycle, nothing auto-renews. ${works}.`;
|
|
120
94
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const tierClause = current_tier
|
|
125
|
-
? `Currently on ${current_tier}.`
|
|
126
|
-
: "Tier unclassified.";
|
|
127
|
-
return `${tierClause} ${limitClause}.`;
|
|
95
|
+
// trial === the free runway. No clock, no card, no countdown.
|
|
96
|
+
return (`You're on the free runway: no card, no countdown, and you are not charged ` +
|
|
97
|
+
`for holding a catalogue. ${works} so far.`);
|
|
128
98
|
}
|
|
129
99
|
export class SubscriptionTools {
|
|
130
100
|
pica;
|
|
@@ -139,15 +109,16 @@ export class SubscriptionTools {
|
|
|
139
109
|
scope: "admin",
|
|
140
110
|
audiences: ["stdio"],
|
|
141
111
|
tier: "read",
|
|
142
|
-
description: "Use when the user asks: 'what's my plan?', '
|
|
143
|
-
"Read the org's current billing posture.
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
112
|
+
description: "Use when the user asks: 'what's my plan?', 'am I paying for this?', " +
|
|
113
|
+
"'what does pica cost me?'. Read the org's current billing posture. " +
|
|
114
|
+
"Returns `plan` — free_runway (walked in, never charged, no clock), " +
|
|
115
|
+
"resident (paying one flat fee per 30-day cycle), or paused (a cycle " +
|
|
116
|
+
"lapsed, so deep-processing is off) — alongside the stored " +
|
|
117
|
+
"billing_state, the active work count, and a one-line summary to use " +
|
|
118
|
+
"verbatim. There is NO trial and NO tier ladder: pica is free to walk " +
|
|
119
|
+
"in and residency is opted into one cycle at a time, so never tell a " +
|
|
120
|
+
"user their trial is ending or offer to upgrade a tier. Complement to " +
|
|
121
|
+
"the ambient _meta.session_state.billing_slice; use this tool when an " +
|
|
151
122
|
"explicit answer is needed.",
|
|
152
123
|
workflows: "infrastructure",
|
|
153
124
|
vernacular_kind: "creator-entry",
|
|
@@ -171,15 +142,14 @@ export class SubscriptionTools {
|
|
|
171
142
|
scope: "admin",
|
|
172
143
|
audiences: ["stdio"],
|
|
173
144
|
tier: "write",
|
|
174
|
-
description: "
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"pica_subscription_status so the agent can read recommended_tier first.",
|
|
145
|
+
description: "Retired — every action refuses. pica no longer sells a subscription " +
|
|
146
|
+
"or a capacity tier, so there is nothing here to subscribe to, " +
|
|
147
|
+
"upgrade, or cancel. pica is free to walk in and use; residency is a " +
|
|
148
|
+
"single one-off charge for a 30-day cycle that the user confirms " +
|
|
149
|
+
"themselves, and nothing auto-renews, so there is no recurring " +
|
|
150
|
+
"mandate to manage. Direct the user to the pricing page or their " +
|
|
151
|
+
"billing settings instead. Kept callable only so an agent that " +
|
|
152
|
+
"invokes it receives an explanation rather than an unknown-tool error.",
|
|
183
153
|
workflows: "infrastructure",
|
|
184
154
|
vernacular_kind: "specialist",
|
|
185
155
|
vernacular_reason: "Specialist context; not yet covered by the Creator Question Atlas — pending telemetry-driven addition per ADR-226 Phase 4 substrate writes.",
|
|
@@ -195,8 +165,9 @@ export class SubscriptionTools {
|
|
|
195
165
|
tier: {
|
|
196
166
|
type: "string",
|
|
197
167
|
enum: [...VALID_PAID_TIERS],
|
|
198
|
-
description: "
|
|
199
|
-
"
|
|
168
|
+
description: "Ignored. pica no longer sells capacity tiers; the enum is " +
|
|
169
|
+
"retained only so an existing caller's argument still " +
|
|
170
|
+
"validates rather than erroring on an unknown property.",
|
|
200
171
|
},
|
|
201
172
|
currency: {
|
|
202
173
|
type: "string",
|
|
@@ -247,7 +218,7 @@ export class SubscriptionTools {
|
|
|
247
218
|
},
|
|
248
219
|
};
|
|
249
220
|
}
|
|
250
|
-
async manage(args
|
|
221
|
+
async manage(args) {
|
|
251
222
|
const action = args.action;
|
|
252
223
|
if (!action || !VALID_ACTIONS.includes(action)) {
|
|
253
224
|
return {
|
|
@@ -268,175 +239,47 @@ export class SubscriptionTools {
|
|
|
268
239
|
isError: true,
|
|
269
240
|
};
|
|
270
241
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return {
|
|
300
|
-
content: [
|
|
301
|
-
{
|
|
302
|
-
type: "text",
|
|
303
|
-
text: `Error: tier must be one of ${VALID_PAID_TIERS.join(", ")}. ` +
|
|
304
|
-
`Enterprise is sales-led — contact PICA directly.`,
|
|
305
|
-
},
|
|
306
|
-
],
|
|
307
|
-
structuredContent: {
|
|
308
|
-
kind: "pica.error.invalid_argument",
|
|
309
|
-
version: 1,
|
|
310
|
-
data: {
|
|
311
|
-
argument: "tier",
|
|
312
|
-
valid: [...VALID_PAID_TIERS],
|
|
313
|
-
},
|
|
314
|
-
},
|
|
315
|
-
isError: true,
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
try {
|
|
319
|
-
const result = await this.pica.subscription.mintCheckout({
|
|
320
|
-
tier,
|
|
321
|
-
currency: typeof args.currency === "string" ? args.currency : "gbp",
|
|
322
|
-
});
|
|
323
|
-
return this.buildLinkResult({
|
|
324
|
-
url: result.checkoutUrl,
|
|
325
|
-
expiresAt: result.expiresAt,
|
|
326
|
-
surface: "checkout",
|
|
327
|
-
name: `Subscribe to PICA (${tier})`,
|
|
328
|
-
description: `Open Stripe Checkout to subscribe to the ${tier} tier.`,
|
|
329
|
-
ctx,
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
catch (err) {
|
|
333
|
-
const message = err instanceof Error ? err.message : "checkout mint failed";
|
|
334
|
-
return {
|
|
335
|
-
content: [
|
|
336
|
-
{ type: "text", text: `Could not mint checkout: ${message}` },
|
|
337
|
-
],
|
|
338
|
-
structuredContent: {
|
|
339
|
-
kind: "pica.error.checkout_mint_failed",
|
|
340
|
-
version: 1,
|
|
341
|
-
data: { error: message },
|
|
342
|
-
},
|
|
343
|
-
isError: true,
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
// manage / cancel → portal
|
|
348
|
-
try {
|
|
349
|
-
const result = await this.pica.subscription.mintPortal();
|
|
350
|
-
return this.buildLinkResult({
|
|
351
|
-
url: result.portalUrl,
|
|
352
|
-
expiresAt: result.expiresAt,
|
|
353
|
-
surface: "portal",
|
|
354
|
-
name: action === "cancel" ? "Cancel subscription" : "Manage subscription",
|
|
355
|
-
description: action === "cancel"
|
|
356
|
-
? "Open the Stripe Billing Portal to cancel your subscription."
|
|
357
|
-
: "Open the Stripe Billing Portal to update payment, change tier, or cancel.",
|
|
358
|
-
ctx,
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
catch (err) {
|
|
362
|
-
const message = err instanceof Error ? err.message : "portal mint failed";
|
|
363
|
-
return {
|
|
364
|
-
content: [
|
|
365
|
-
{
|
|
366
|
-
type: "text",
|
|
367
|
-
text: `Could not open billing portal: ${message}`,
|
|
368
|
-
},
|
|
369
|
-
],
|
|
370
|
-
structuredContent: {
|
|
371
|
-
kind: "pica.error.portal_mint_failed",
|
|
372
|
-
version: 1,
|
|
373
|
-
data: {
|
|
374
|
-
error: message,
|
|
375
|
-
// The route returns "No Stripe customer found — subscribe first"
|
|
376
|
-
// when the org has no stripeCustomerId; surface a recovery hint
|
|
377
|
-
// so the agent can chain.
|
|
378
|
-
next_tool: message.toLowerCase().includes("subscribe first") ||
|
|
379
|
-
message.toLowerCase().includes("no stripe customer")
|
|
380
|
-
? "pica_subscription_manage"
|
|
381
|
-
: undefined,
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
isError: true,
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Universal-floor return per ADR-200 Phase 1: every successful manage
|
|
390
|
-
* response carries a `resource_link` so any compliant MCP client can
|
|
391
|
-
* render or open the URL. Clients that advertise
|
|
392
|
-
* `capabilities.elicitation.url` additionally receive a server-issued
|
|
393
|
-
* elicitation/create request — the gate is mandatory because
|
|
394
|
-
* `elicitInput` with `mode: "url"` throws synchronously against
|
|
395
|
-
* non-supporters (`feedback_mcp_sdk_capability_gates_elicitation.md`).
|
|
396
|
-
*/
|
|
397
|
-
async buildLinkResult(opts) {
|
|
398
|
-
const { url, expiresAt, surface, name, description, ctx } = opts;
|
|
399
|
-
const summary = surface === "checkout"
|
|
400
|
-
? `${name} ready. Open ${url} to complete checkout. Link expires ${expiresAt}.`
|
|
401
|
-
: `${name} ready. Open ${url} to manage your subscription. Link expires ${expiresAt}.`;
|
|
402
|
-
const content = [
|
|
403
|
-
{ type: "text", text: summary },
|
|
404
|
-
{
|
|
405
|
-
type: "resource_link",
|
|
406
|
-
uri: url,
|
|
407
|
-
name,
|
|
408
|
-
description,
|
|
409
|
-
mimeType: "text/html",
|
|
410
|
-
},
|
|
411
|
-
];
|
|
412
|
-
// Capability-gated elicitation/create url — silently degrade on
|
|
413
|
-
// decline / cancel / timeout; the resource_link in the response
|
|
414
|
-
// remains usable.
|
|
415
|
-
if (clientSupportsUrlElicitation(ctx?.server)) {
|
|
416
|
-
try {
|
|
417
|
-
await ctx.server.elicitInput({
|
|
418
|
-
mode: "url",
|
|
419
|
-
url,
|
|
420
|
-
elicitationId: `pica-subscription-${surface}-${randomUUID()}`,
|
|
421
|
-
message: description,
|
|
422
|
-
}, { timeout: 60_000 });
|
|
423
|
-
}
|
|
424
|
-
catch {
|
|
425
|
-
// User declined / cancelled / elicitation timed out. Not an error
|
|
426
|
-
// — the resource_link below is the universal-floor fallback.
|
|
427
|
-
}
|
|
428
|
-
}
|
|
242
|
+
// ⚠️ THIS TOOL NO LONGER MINTS A CHECKOUT OR A PORTAL LINK.
|
|
243
|
+
//
|
|
244
|
+
// Until 2026-08-21 `action: "subscribe", tier: "indie"` minted a LIVE Stripe
|
|
245
|
+
// Checkout for a £49/month RECURRING subscription — from an agent, in
|
|
246
|
+
// production. The tier price IDs are configured on Production and the Stripe
|
|
247
|
+
// prices were active, so this was a working till for a product pica stopped
|
|
248
|
+
// selling when ADR-276 superseded ADR-205 on 2026-06-26.
|
|
249
|
+
//
|
|
250
|
+
// It also contradicted the Terms of Service, which state that pica does not
|
|
251
|
+
// store a recurring mandate and does not auto-renew. A live path capable of
|
|
252
|
+
// creating one made that sentence false.
|
|
253
|
+
//
|
|
254
|
+
// Nobody was ever charged through it (0 successful charges, 0 subscriptions
|
|
255
|
+
// of any status), which is why this is a refusal and not an incident.
|
|
256
|
+
//
|
|
257
|
+
// Residency is charged by the billing engine when the deep-process gate
|
|
258
|
+
// blocks — a one-off `mode: "payment"` Checkout the user confirms per cycle,
|
|
259
|
+
// priced from RESIDENT_FEE_MINOR_UNITS with inline `price_data`. There is no
|
|
260
|
+
// "subscribe on demand" endpoint to expose, and inventing one here would be
|
|
261
|
+
// the same mistake in the other direction.
|
|
262
|
+
const retiredMessage = "pica does not sell a subscription or a capacity tier — there is nothing " +
|
|
263
|
+
"to subscribe to, upgrade, or cancel. pica is free to walk in and use: " +
|
|
264
|
+
"holding a catalogue, registering works, browsing and searching cost " +
|
|
265
|
+
"nothing, and there is no trial clock. If the user has gone past the free " +
|
|
266
|
+
"deep-processing allowance, pica offers residency at that moment — one " +
|
|
267
|
+
"small flat fee for a 30-day cycle, priced for their region, which they " +
|
|
268
|
+
"confirm each time. Nothing auto-renews, so nothing needs cancelling. " +
|
|
269
|
+
"Point them at the pricing page or their billing settings.";
|
|
429
270
|
return {
|
|
430
|
-
content,
|
|
271
|
+
content: [{ type: "text", text: retiredMessage }],
|
|
431
272
|
structuredContent: {
|
|
432
|
-
kind: "pica.
|
|
273
|
+
kind: "pica.error.retired_action",
|
|
433
274
|
version: 1,
|
|
434
275
|
data: {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
276
|
+
action,
|
|
277
|
+
reason: "subscriptions_and_tiers_retired",
|
|
278
|
+
pricing_url: "https://withpica.com/pricing",
|
|
279
|
+
settings_url: "https://withpica.com/settings?tab=subscription",
|
|
438
280
|
},
|
|
439
281
|
},
|
|
282
|
+
isError: true,
|
|
440
283
|
};
|
|
441
284
|
}
|
|
442
285
|
}
|