@layervai/qurl-mcp 0.5.0 → 0.6.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/README.md +90 -34
- package/dist/client.d.ts +65 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +103 -5
- package/dist/client.js.map +1 -1
- package/dist/prompts/audit-links.js +1 -1
- package/dist/prompts/audit-links.js.map +1 -1
- package/dist/server.d.ts +3 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +5 -0
- package/dist/server.js.map +1 -1
- package/dist/tools/_shared.d.ts +1 -0
- package/dist/tools/_shared.d.ts.map +1 -1
- package/dist/tools/_shared.js +6 -1
- package/dist/tools/_shared.js.map +1 -1
- package/dist/tools/consumer-access.d.ts +235 -0
- package/dist/tools/consumer-access.d.ts.map +1 -0
- package/dist/tools/consumer-access.js +231 -0
- package/dist/tools/consumer-access.js.map +1 -0
- package/dist/tools/create-qurl.d.ts.map +1 -1
- package/dist/tools/create-qurl.js +6 -2
- package/dist/tools/create-qurl.js.map +1 -1
- package/dist/tools/delete-qurl.d.ts.map +1 -1
- package/dist/tools/delete-qurl.js +6 -3
- package/dist/tools/delete-qurl.js.map +1 -1
- package/dist/tools/duration.d.ts +13 -0
- package/dist/tools/duration.d.ts.map +1 -0
- package/dist/tools/duration.js +71 -0
- package/dist/tools/duration.js.map +1 -0
- package/dist/tools/email-delivery.d.ts +0 -1
- package/dist/tools/email-delivery.d.ts.map +1 -1
- package/dist/tools/email-delivery.js +0 -1
- package/dist/tools/email-delivery.js.map +1 -1
- package/dist/tools/extend-qurl.d.ts +14 -1
- package/dist/tools/extend-qurl.d.ts.map +1 -1
- package/dist/tools/extend-qurl.js +179 -18
- package/dist/tools/extend-qurl.js.map +1 -1
- package/dist/tools/get-qurl.d.ts +7 -0
- package/dist/tools/get-qurl.d.ts.map +1 -1
- package/dist/tools/list-qurls.d.ts +7 -0
- package/dist/tools/list-qurls.d.ts.map +1 -1
- package/dist/tools/mint-link.d.ts.map +1 -1
- package/dist/tools/mint-link.js +2 -1
- package/dist/tools/mint-link.js.map +1 -1
- package/dist/tools/output-schemas.d.ts +56 -4
- package/dist/tools/output-schemas.d.ts.map +1 -1
- package/dist/tools/output-schemas.js +62 -11
- package/dist/tools/output-schemas.js.map +1 -1
- package/dist/tools/share-by-crid.d.ts +50 -0
- package/dist/tools/share-by-crid.d.ts.map +1 -0
- package/dist/tools/share-by-crid.js +114 -0
- package/dist/tools/share-by-crid.js.map +1 -0
- package/dist/tools/update-qurl-token.d.ts.map +1 -1
- package/dist/tools/update-qurl-token.js +6 -7
- package/dist/tools/update-qurl-token.js.map +1 -1
- package/dist/tools/update-qurl.d.ts +7 -0
- package/dist/tools/update-qurl.d.ts.map +1 -1
- package/dist/tools/update-qurl.js +6 -7
- package/dist/tools/update-qurl.js.map +1 -1
- package/dist/tools/upload-file-data-qurl.d.ts +17 -61
- package/dist/tools/upload-file-data-qurl.d.ts.map +1 -1
- package/dist/tools/upload-file-data-qurl.js +16 -9
- package/dist/tools/upload-file-data-qurl.js.map +1 -1
- package/dist/tools/upload-file-qurl.d.ts +27 -55
- package/dist/tools/upload-file-qurl.d.ts.map +1 -1
- package/dist/tools/upload-file-qurl.js +19 -12
- package/dist/tools/upload-file-qurl.js.map +1 -1
- package/dist/tools/upload-file-shared.d.ts +27 -10
- package/dist/tools/upload-file-shared.d.ts.map +1 -1
- package/dist/tools/upload-file-shared.js +313 -43
- package/dist/tools/upload-file-shared.js.map +1 -1
- package/dist/tools/upload-mint-options.d.ts +14 -14
- package/dist/tools/upload-mint-options.d.ts.map +1 -1
- package/dist/tools/upload-mint-options.js +33 -15
- package/dist/tools/upload-mint-options.js.map +1 -1
- package/dist/tools/upload-text-qurl.d.ts +15 -47
- package/dist/tools/upload-text-qurl.d.ts.map +1 -1
- package/dist/tools/upload-text-qurl.js +11 -7
- package/dist/tools/upload-text-qurl.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/delete-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,cAAc,CAAC;AAC9D,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"delete-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/delete-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,cAAc,CAAC;AAC9D,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAQtB,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC;AAEH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,QAAQ,GAAE,kBAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEjD"}
|
|
@@ -2,6 +2,9 @@ import { z } from "zod";
|
|
|
2
2
|
import { QURLAPIError } from "../client.js";
|
|
3
3
|
import { resourceOnlyIdSchema, withMissingApiKeyHandler, } from "./_shared.js";
|
|
4
4
|
import { deleteQurlOutputSchema } from "./output-schemas.js";
|
|
5
|
+
// Upload links live on the connector's resource, so revoking this one leaves
|
|
6
|
+
// them serving (#281). Said in the result, which agents relay to the user.
|
|
7
|
+
const UPLOAD_LINKS_NOTE = "Links minted by the upload tools are served by the file connector and are not affected.";
|
|
5
8
|
export const deleteQurlSchema = z.object({
|
|
6
9
|
resource_id: resourceOnlyIdSchema("revoke (all tokens; q_ display IDs are not accepted)"),
|
|
7
10
|
});
|
|
@@ -11,8 +14,8 @@ export function deleteQurlTool(client, _runtime = { mode: "stdio" }) {
|
|
|
11
14
|
title: "Delete qURL",
|
|
12
15
|
description: "Permanently revoke a qURL — the link and every access token under it stop working immediately. " +
|
|
13
16
|
"**This action is irreversible.** Use this when you want to cut off access entirely (compromised link, departed user, end-of-engagement). " +
|
|
14
|
-
"
|
|
15
|
-
"Use `
|
|
17
|
+
"It does not revoke links minted by the upload tools, which belong to the file connector; those cannot be revoked from this server. " +
|
|
18
|
+
"Use `update_qurl` instead when you only need to shorten the resource's expiration, retag, or rename, and `extend_qurl` to keep a link open longer — those preserve the existing access tokens. " +
|
|
16
19
|
"**Idempotent:** the API returns 404 for re-deletes, never-existed IDs, and resources owned by another API key (ownership-mismatch is collapsed into 404 server-side to avoid existence disclosure); this tool swallows all three. " +
|
|
17
20
|
"Branch on `was_already_revoked` to distinguish the no-op case from a successful revoke on this call. " +
|
|
18
21
|
"When the ID came from user input and ownership matters, call `get_qurl` first — a 200 confirms ownership; a thrown 404 is equally ambiguous on that endpoint too. " +
|
|
@@ -65,7 +68,7 @@ export function deleteQurlTool(client, _runtime = { mode: "stdio" }) {
|
|
|
65
68
|
resource_id: input.resource_id,
|
|
66
69
|
revoked: true,
|
|
67
70
|
was_already_revoked: wasAlreadyRevoked,
|
|
68
|
-
message: `qURL ${input.resource_id} is revoked
|
|
71
|
+
message: `qURL ${input.resource_id} is revoked. ${UPLOAD_LINKS_NOTE}`,
|
|
69
72
|
};
|
|
70
73
|
return {
|
|
71
74
|
content: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-qurl.js","sourceRoot":"","sources":["../../src/tools/delete-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,WAAW,EAAE,oBAAoB,CAAC,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string, or undefined when the grammar rejects it.
|
|
4
|
+
* Fractions are Go-duration only ("1.5h"); whole days/weeks are integers
|
|
5
|
+
* ("1.5d" is rejected), matching ParseDuration's strconv.Atoi branch.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseDurationMs(value: string): number | undefined;
|
|
8
|
+
export declare const durationSchema: (minMs: number, maxMs: number, range: string, allowEmpty?: boolean) => z.ZodString;
|
|
9
|
+
export declare const MIN_EXPIRY_MS = 60000;
|
|
10
|
+
export declare const MAX_EXPIRY_MS: number;
|
|
11
|
+
export declare const MIN_SESSION_MS = 1000;
|
|
12
|
+
export declare const MAX_SESSION_MS = 86400000;
|
|
13
|
+
//# sourceMappingURL=duration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/tools/duration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASjE;AAYD,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,EAAE,OAAO,MAAM,EAAE,oBAAkB,gBAgBzF,CAAC;AAMN,eAAO,MAAM,aAAa,QAAS,CAAC;AAGpC,eAAO,MAAM,aAAa,QAAkB,CAAC;AAK7C,eAAO,MAAM,cAAc,OAAQ,CAAC;AACpC,eAAO,MAAM,cAAc,WAAa,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Accepts a safe subset of qurl-service's duration grammar (no sign, leading
|
|
3
|
+
// dot, or U+03BC mu): whole days/weeks ("7d", "1w") or a
|
|
4
|
+
// Go duration ("30m", "1h30m", "1.5h"). Each repetition must end in a unit,
|
|
5
|
+
// so matching is linear; durationSchema's .max(32) bounds the input as well.
|
|
6
|
+
const DURATION_PATTERN = /^(?:\d+[dw]|(?:\d+(?:\.\d+)?(?:ns|us|µs|ms|s|m|h))+)$/;
|
|
7
|
+
// Nanoseconds per unit, so sub-millisecond units sum exactly before one division.
|
|
8
|
+
const GO_DURATION_UNIT_NS = {
|
|
9
|
+
ns: 1,
|
|
10
|
+
us: 1e3,
|
|
11
|
+
µs: 1e3,
|
|
12
|
+
ms: 1e6,
|
|
13
|
+
s: 1e9,
|
|
14
|
+
m: 6e10,
|
|
15
|
+
h: 3.6e12,
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Milliseconds in a duration string, or undefined when the grammar rejects it.
|
|
19
|
+
* Fractions are Go-duration only ("1.5h"); whole days/weeks are integers
|
|
20
|
+
* ("1.5d" is rejected), matching ParseDuration's strconv.Atoi branch.
|
|
21
|
+
*/
|
|
22
|
+
export function parseDurationMs(value) {
|
|
23
|
+
if (!DURATION_PATTERN.test(value))
|
|
24
|
+
return undefined;
|
|
25
|
+
const whole = /^(\d+)([dw])$/.exec(value);
|
|
26
|
+
if (whole)
|
|
27
|
+
return Number(whole[1]) * (whole[2] === "d" ? 86_400_000 : 604_800_000);
|
|
28
|
+
let totalNs = 0;
|
|
29
|
+
for (const [, amount, unit] of value.matchAll(/(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/g)) {
|
|
30
|
+
totalNs += Number(amount) * GO_DURATION_UNIT_NS[unit];
|
|
31
|
+
}
|
|
32
|
+
return totalNs / 1e6;
|
|
33
|
+
}
|
|
34
|
+
// Bounds mirror qurl-service so an out-of-range value fails before any side
|
|
35
|
+
// effect (for uploads, before the file is stored). Keep in sync with
|
|
36
|
+
// internal/api/validation/constants.go (MinExpirationDuration,
|
|
37
|
+
// MaxSessionDuration) and internal/domain/qurl.go (MaxCustomerExpiryDuration);
|
|
38
|
+
// the grammar mirrors internal/domain/duration.go (ParseDuration).
|
|
39
|
+
// Grammar and range fail with different messages so a caller retrying knows
|
|
40
|
+
// whether to fix the syntax or the size. create_qurl and mint_link still defer
|
|
41
|
+
// their durations to the API; tracked with the drift guard in #282.
|
|
42
|
+
// allowEmpty lets "" through as its own value (a z.union would collapse both
|
|
43
|
+
// messages into a generic "Invalid input").
|
|
44
|
+
export const durationSchema = (minMs, maxMs, range, allowEmpty = false) => z
|
|
45
|
+
.string()
|
|
46
|
+
// Same message as a syntax error, and abort so it is the only one.
|
|
47
|
+
.max(32, { error: "Use a duration like '30m', '24h', or '7d'", abort: true })
|
|
48
|
+
.refine((value) => (allowEmpty && value === "") || parseDurationMs(value) !== undefined, {
|
|
49
|
+
message: "Use a duration like '30m', '24h', or '7d'",
|
|
50
|
+
abort: true,
|
|
51
|
+
})
|
|
52
|
+
.refine((value) => {
|
|
53
|
+
if (allowEmpty && value === "")
|
|
54
|
+
return true;
|
|
55
|
+
const ms = parseDurationMs(value) ?? 0;
|
|
56
|
+
return ms >= minMs && ms <= maxMs;
|
|
57
|
+
}, { message: `Duration must be ${range}`, abort: true });
|
|
58
|
+
// validation.MinExpirationDuration and domain.MaxCustomerExpiryDuration; qurl-service
|
|
59
|
+
// applies the same pair to expires_in and extend_by (ValidateDuration). Upload
|
|
60
|
+
// links take them too: the connector forwards the requested expiry to
|
|
61
|
+
// qurl-service's mint, which enforces the same ceiling.
|
|
62
|
+
export const MIN_EXPIRY_MS = 60_000;
|
|
63
|
+
// Global, not per plan: qurl-service's MaxCustomerExpiryDuration is 30d on
|
|
64
|
+
// every customer plan (get_quota's max_expiry_seconds reports the same value).
|
|
65
|
+
export const MAX_EXPIRY_MS = 30 * 86_400_000;
|
|
66
|
+
// MAX_SESSION_MS mirrors validation.MaxSessionDuration (24h). MIN_SESSION_MS is
|
|
67
|
+
// an MCP-local floor with no service counterpart: a sub-second session expires
|
|
68
|
+
// on arrival.
|
|
69
|
+
export const MIN_SESSION_MS = 1_000;
|
|
70
|
+
export const MAX_SESSION_MS = 86_400_000;
|
|
71
|
+
//# sourceMappingURL=duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.js","s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;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAU5E;AAID,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,EAC1E,IAAI,EAAE,CAAC,EACP,WAAW,EAAE,mBAAmB,GAAG,SAAS;;;;;;EAO7C;AAiCD,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CA2C1C"}
|
|
@@ -33,7 +33,6 @@ export function uploadEmailDetailLines(details) {
|
|
|
33
33
|
`Content Type: ${singleLineEmailDetail(details.contentType)}`,
|
|
34
34
|
`Secure Link: ${singleLineEmailDetail(details.qurlLink)}`,
|
|
35
35
|
...(details.expiresAt ? [`Expires At: ${singleLineEmailDetail(details.expiresAt)}`] : []),
|
|
36
|
-
...(details.qurlSite ? [`qURL Site: ${singleLineEmailDetail(details.qurlSite)}`] : []),
|
|
37
36
|
...(details.label ? [`Label: ${singleLineEmailDetail(details.label)}`] : []),
|
|
38
37
|
...(details.extraLines ?? []),
|
|
39
38
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-delivery.js","sourceRoot":"","sources":["../../src/tools/email-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAA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QACf,0EAA0E;QAC1E,yEAAyE;QACzE,yCAAyC;QACzC,OAAO,CAAC,KAAK,CAAC,8CAA8C,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzF,MAAM,aAAa,GAAG,iCAAiC,CAAC,KAAK,CAAC,CAAC;QAC/D,OAAO,qBAAqB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type
|
|
2
|
+
import { type IQURLClient } from "../client.js";
|
|
3
3
|
import { type ToolRuntimeOptions } from "./_shared.js";
|
|
4
4
|
export declare const extendQurlSchema: z.ZodObject<{
|
|
5
5
|
resource_id: z.ZodString;
|
|
6
6
|
extend_by: z.ZodString;
|
|
7
|
+
qurl_id: z.ZodOptional<z.ZodString>;
|
|
7
8
|
}, z.core.$strip>;
|
|
8
9
|
export declare function extendQurlTool(client: IQURLClient, _runtime?: ToolRuntimeOptions): {
|
|
9
10
|
name: string;
|
|
@@ -12,8 +13,16 @@ export declare function extendQurlTool(client: IQURLClient, _runtime?: ToolRunti
|
|
|
12
13
|
inputSchema: z.ZodObject<{
|
|
13
14
|
resource_id: z.ZodString;
|
|
14
15
|
extend_by: z.ZodString;
|
|
16
|
+
qurl_id: z.ZodOptional<z.ZodString>;
|
|
15
17
|
}, z.core.$strip>;
|
|
16
18
|
outputSchema: z.ZodObject<{
|
|
19
|
+
crid: z.ZodOptional<z.ZodString>;
|
|
20
|
+
private: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
consumer_access: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
mode: z.ZodString;
|
|
23
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
contract_id: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
17
26
|
resource_id: z.ZodString;
|
|
18
27
|
qurl_site: z.ZodOptional<z.ZodString>;
|
|
19
28
|
target_url: z.ZodOptional<z.ZodString>;
|
|
@@ -62,6 +71,9 @@ export declare function extendQurlTool(client: IQURLClient, _runtime?: ToolRunti
|
|
|
62
71
|
created_at: z.ZodOptional<z.ZodString>;
|
|
63
72
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
64
73
|
}, z.core.$loose>>>;
|
|
74
|
+
extended_qurl_id: z.ZodOptional<z.ZodString>;
|
|
75
|
+
extended_link_expires_at: z.ZodOptional<z.ZodString>;
|
|
76
|
+
extend_warning: z.ZodOptional<z.ZodString>;
|
|
65
77
|
}, z.core.$loose>;
|
|
66
78
|
annotations: {
|
|
67
79
|
title: string;
|
|
@@ -73,6 +85,7 @@ export declare function extendQurlTool(client: IQURLClient, _runtime?: ToolRunti
|
|
|
73
85
|
handler: (input: {
|
|
74
86
|
resource_id: string;
|
|
75
87
|
extend_by: string;
|
|
88
|
+
qurl_id?: string | undefined;
|
|
76
89
|
}) => Promise<{
|
|
77
90
|
content: Array<{
|
|
78
91
|
type: "text";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extend-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/extend-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"extend-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/extend-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,gBAAgB;;;;iBAY3B,CAAC;AAyHH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,QAAQ,GAAE,kBAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6FjD"}
|
|
@@ -1,22 +1,135 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { QURLAPIError } from "../client.js";
|
|
3
|
+
import { formatErrorForLog } from "../logging.js";
|
|
4
|
+
import { durationSchema, MAX_EXPIRY_MS, MIN_EXPIRY_MS } from "./duration.js";
|
|
5
|
+
import { isQurlDisplayId, qurlDisplayIdSchema, resourceIdSchema, toStructuredContent, withMissingApiKeyHandler, } from "./_shared.js";
|
|
3
6
|
import { extendQurlOutputSchema } from "./output-schemas.js";
|
|
4
7
|
export const extendQurlSchema = z.object({
|
|
5
|
-
resource_id: resourceIdSchema("extend"),
|
|
6
|
-
extend_by:
|
|
8
|
+
resource_id: resourceIdSchema("extend").describe("Resource ID, or a link's q_ display ID; a q_ ID selects that link, and this server reads the resource to find its parent"),
|
|
9
|
+
extend_by: durationSchema(MIN_EXPIRY_MS, MAX_EXPIRY_MS, "1m to 30d").describe('Duration to extend the link by (e.g., "24h", "7d"; 1m to 30d per call)'),
|
|
10
|
+
qurl_id: qurlDisplayIdSchema("extend")
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("The link (q_ display ID) to extend. Required when the resource has more than one active link."),
|
|
13
|
+
});
|
|
14
|
+
// A link's lifetime is its access token's `expires_at`; the resource's own
|
|
15
|
+
// expiry is a far-future ceiling, so extending the resource never kept a link
|
|
16
|
+
// open longer (qurl-mcp#279). Resolve which link the caller means. The token
|
|
17
|
+
// route needs the parent resource ID, which only a read resolves from a q_ ID.
|
|
18
|
+
// A missing or unrecognized status is a candidate on both the named and the
|
|
19
|
+
// auto-selected path: token status is optional in the API and can drift. Only a
|
|
20
|
+
// known inactive status excludes a link.
|
|
21
|
+
const INACTIVE_LINK_STATUSES = new Set(["consumed", "expired", "revoked"]);
|
|
22
|
+
// qurl-service embeds at most this many links on a resource read
|
|
23
|
+
// (ResourceQurlPreviewLimit), revoked and expired ones included.
|
|
24
|
+
const RESOURCE_LINK_PREVIEW_LIMIT = 100;
|
|
25
|
+
// Whether resource.qurls lists every link. qurl_count counts all retained
|
|
26
|
+
// links, revoked and expired included (OpenAPI Resource.qurl_count), and the
|
|
27
|
+
// preview uses tokenRepo.ListByResourceLimited without a status filter
|
|
28
|
+
// (qurl-service internal/service/qurl_service.go), so a revoked link does not make the list look
|
|
29
|
+
// short; when qurl_count is omitted, only a list under the cap is known whole.
|
|
30
|
+
function linkListComplete(resource) {
|
|
31
|
+
// A list at the cap is never trusted as whole, whatever qurl_count says.
|
|
32
|
+
const listed = resource.qurls?.length ?? 0;
|
|
33
|
+
return (listed < RESOURCE_LINK_PREVIEW_LIMIT &&
|
|
34
|
+
(resource.qurl_count === undefined || resource.qurl_count <= listed));
|
|
35
|
+
}
|
|
36
|
+
async function linkToExtend(client, input) {
|
|
37
|
+
const resourceIsLink = isQurlDisplayId(input.resource_id);
|
|
38
|
+
if (resourceIsLink && input.qurl_id && input.qurl_id !== input.resource_id) {
|
|
39
|
+
return {
|
|
40
|
+
error: `resource_id names link ${input.resource_id} but qurl_id names ${input.qurl_id}; pass one link.`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// Always read before updating, even when the link is named: the read checks
|
|
44
|
+
// the link is on this resource and still active, and a missing qurl:read
|
|
45
|
+
// fails here, before the non-idempotent update, not after it.
|
|
46
|
+
let resource;
|
|
47
|
+
try {
|
|
48
|
+
resource = (await client.getQURL(input.resource_id)).data;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
// The shared wrapper turns a missing key into its own guidance.
|
|
52
|
+
// Only not-found and forbidden are what the guidance below describes; a
|
|
53
|
+
// missing key, rate limits, 5xx, and transport failures keep their metadata.
|
|
54
|
+
if (!(error instanceof QURLAPIError && [403, 404].includes(error.statusCode)))
|
|
55
|
+
throw error;
|
|
56
|
+
return {
|
|
57
|
+
error: `Reading the resource to pick a link failed (HTTP ${error.statusCode}; ` +
|
|
58
|
+
"the resource may not exist, or the API key may lack qurl:read). Nothing was extended.",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const named = resourceIsLink ? input.resource_id : input.qurl_id;
|
|
62
|
+
const complete = linkListComplete(resource);
|
|
63
|
+
if (named) {
|
|
64
|
+
const link = resource.qurls?.find((candidate) => candidate.qurl_id === named);
|
|
65
|
+
// Only a complete list proves absence; past the preview cap the token
|
|
66
|
+
// route decides, and the handler rereads since there is nothing to splice.
|
|
67
|
+
if (resource.qurls && !link && complete) {
|
|
68
|
+
return { error: `Link ${named} is not listed on resource ${resource.resource_id}.` };
|
|
69
|
+
}
|
|
70
|
+
const status = link?.status;
|
|
71
|
+
if (status && INACTIVE_LINK_STATUSES.has(status)) {
|
|
72
|
+
return {
|
|
73
|
+
error: `Link ${named} is ${status}, so it cannot be extended. Use mint_link to issue a new one.`,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
// A read without the link list cannot be spliced; the handler rereads.
|
|
77
|
+
return {
|
|
78
|
+
resourceId: resource.resource_id,
|
|
79
|
+
qurlId: named,
|
|
80
|
+
...(link ? { resource } : {}),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (!resource.qurls) {
|
|
84
|
+
return {
|
|
85
|
+
error: resource.qurl_count === 0
|
|
86
|
+
? "This resource has no link to extend. Use mint_link to issue one."
|
|
87
|
+
: "The resource read did not include its links; pass qurl_id to choose one.",
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (!complete) {
|
|
91
|
+
return {
|
|
92
|
+
error: `This resource's read may not list all of its links (it lists ${resource.qurls.length}, at most ${RESOURCE_LINK_PREVIEW_LIMIT}; ${resource.qurl_count ?? "unknown"} in total), so this server cannot tell which is the only active one; pass qurl_id to choose.`,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const active = resource.qurls.filter((link) => link.qurl_id && !INACTIVE_LINK_STATUSES.has(link.status));
|
|
96
|
+
if (active.length === 1) {
|
|
97
|
+
return { resourceId: resource.resource_id, qurlId: active[0].qurl_id, resource };
|
|
98
|
+
}
|
|
99
|
+
if (active.length === 0) {
|
|
100
|
+
return {
|
|
101
|
+
error: resource.qurls.length === 0
|
|
102
|
+
? resource.qurl_count === 0
|
|
103
|
+
? "This resource has no link to extend. Use mint_link to issue one."
|
|
104
|
+
: "The resource read lists no links; pass qurl_id if it has one, or use mint_link to issue one."
|
|
105
|
+
: "No link on this resource can be extended (all are consumed, expired, or revoked). Use mint_link to issue a new one.",
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const shown = active.slice(0, 10).map((link) => link.qurl_id);
|
|
109
|
+
const more = active.length > shown.length ? ` and ${active.length - shown.length} more` : "";
|
|
110
|
+
return {
|
|
111
|
+
error: `This resource has ${active.length} active links (${shown.join(", ")}${more}); pass qurl_id to choose which one to extend.`,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const errorResult = (text) => ({
|
|
115
|
+
isError: true,
|
|
116
|
+
content: [{ type: "text", text }],
|
|
7
117
|
});
|
|
8
118
|
export function extendQurlTool(client, _runtime = { mode: "stdio" }) {
|
|
9
119
|
return {
|
|
10
120
|
name: "extend_qurl",
|
|
11
121
|
title: "Extend qURL Expiration",
|
|
12
|
-
description: "
|
|
13
|
-
"
|
|
122
|
+
description: "Keep a qURL link open longer by pushing out the link's expiration by a relative duration. " +
|
|
123
|
+
"Pass a link's `q_` display ID as `resource_id`, or a resource ID plus `qurl_id`; a resource with exactly one active link needs no `qurl_id` (unless it has more than the 100 links a read lists). " +
|
|
14
124
|
"Use this when the only change you need is more time on the clock. " +
|
|
15
|
-
"Use `
|
|
16
|
-
"Use `delete_qurl` when you want to cut off access
|
|
17
|
-
"
|
|
18
|
-
"**Not idempotent:** calling twice with the same `extend_by` extends the
|
|
19
|
-
"
|
|
125
|
+
"Use `update_qurl_token` instead to set an absolute `expires_at` or change the link's label, policy, or sessions. " +
|
|
126
|
+
"Use `revoke_qurl_token` or `delete_qurl` when you want to cut off access. " +
|
|
127
|
+
"Links minted by the upload tools belong to the file connector and cannot be extended from this server. " +
|
|
128
|
+
"**Not idempotent:** calling twice with the same `extend_by` extends the link twice; use `update_qurl_token` with `expires_at` when retries must not double-push. " +
|
|
129
|
+
"Requires `qurl:write` and `qurl:read`: it reads the resource before updating, to check the link and to return it, so each extend costs two API calls (three when the read does not list the link). " +
|
|
130
|
+
"A link cannot outlive its resource: if the resource's own `expires_at` is sooner, raise it with `update_qurl` first; the result then carries `extend_warning`. " +
|
|
131
|
+
"Link-selection problems return an error result; a rejected update throws with its HTTP status and error code. " +
|
|
132
|
+
"Returns the resource (same shape as `get_qurl`); the extended link's new expiry is in `extended_link_expires_at` (and `qurls[].expires_at`), not the resource's own `expires_at`.",
|
|
20
133
|
inputSchema: extendQurlSchema,
|
|
21
134
|
outputSchema: extendQurlOutputSchema,
|
|
22
135
|
annotations: {
|
|
@@ -27,17 +140,65 @@ export function extendQurlTool(client, _runtime = { mode: "stdio" }) {
|
|
|
27
140
|
openWorldHint: true,
|
|
28
141
|
},
|
|
29
142
|
handler: withMissingApiKeyHandler(async (input) => {
|
|
30
|
-
const
|
|
143
|
+
const target = await linkToExtend(client, input);
|
|
144
|
+
if ("error" in target)
|
|
145
|
+
return errorResult(target.error);
|
|
146
|
+
const { resourceId, qurlId } = target;
|
|
147
|
+
const token = await client.updateQurlToken(resourceId, qurlId, {
|
|
31
148
|
extend_by: input.extend_by,
|
|
32
149
|
});
|
|
150
|
+
// A token update leaves resource fields alone, so a resource already read
|
|
151
|
+
// to pick the link only needs the updated link merged in (a merge, so a
|
|
152
|
+
// sparser update response cannot drop fields the read had). Only a read
|
|
153
|
+
// that omitted the link list is repeated after the update.
|
|
154
|
+
let resource = target.resource;
|
|
155
|
+
if (resource) {
|
|
156
|
+
resource = {
|
|
157
|
+
...resource,
|
|
158
|
+
qurls: resource.qurls?.map((link) => link.qurl_id === qurlId
|
|
159
|
+
? // Without a new expiry in the response, do not keep showing the old one.
|
|
160
|
+
{
|
|
161
|
+
...link,
|
|
162
|
+
...token.data,
|
|
163
|
+
...(token.data.expires_at ? {} : { expires_at: undefined }),
|
|
164
|
+
}
|
|
165
|
+
: link),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
try {
|
|
170
|
+
resource = (await client.getQURL(resourceId)).data;
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
// The extension already happened; a retry would push the link out twice.
|
|
174
|
+
// isError is deliberate: the declared output is the resource shape, which
|
|
175
|
+
// this path cannot produce, and a success without it would fail hosts that
|
|
176
|
+
// validate structuredContent. The text carries the new expiry.
|
|
177
|
+
console.error(`extend_qurl extended ${qurlId} but reading the resource failed (${formatErrorForLog(error)})`);
|
|
178
|
+
return errorResult(`Link ${qurlId} was extended; it now expires at ${token.data.expires_at ?? "the new time"}. ` +
|
|
179
|
+
"Do not retry. Reading the updated resource failed (the API key may lack qurl:read).");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// A link cannot outlive its resource. Warn when the link now ends at or past
|
|
183
|
+
// the resource's expiry: stored past it, or clamped to it on write.
|
|
184
|
+
const linkExpiry = Date.parse(token.data.expires_at ?? "");
|
|
185
|
+
const ceiling = Date.parse(resource.expires_at ?? "");
|
|
186
|
+
// The change is on the link, so name it at the top level; the resource's
|
|
187
|
+
// own expires_at is the ceiling, not the new expiry.
|
|
188
|
+
const extended = {
|
|
189
|
+
...resource,
|
|
190
|
+
extended_qurl_id: qurlId,
|
|
191
|
+
...(token.data.expires_at ? { extended_link_expires_at: token.data.expires_at } : {}),
|
|
192
|
+
};
|
|
193
|
+
const data = Number.isFinite(ceiling) && linkExpiry >= ceiling
|
|
194
|
+
? {
|
|
195
|
+
...extended,
|
|
196
|
+
extend_warning: `Link ${qurlId} expires at ${token.data.expires_at}, but its resource closes at ${resource.expires_at}, so it stops working then; raise the resource with update_qurl (extend_by up to 30d, or expires_at for further out).`,
|
|
197
|
+
}
|
|
198
|
+
: extended;
|
|
33
199
|
return {
|
|
34
|
-
content: [
|
|
35
|
-
|
|
36
|
-
type: "text",
|
|
37
|
-
text: JSON.stringify(result.data),
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
structuredContent: toStructuredContent(result.data),
|
|
200
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
201
|
+
structuredContent: toStructuredContent(data),
|
|
41
202
|
};
|
|
42
203
|
}),
|
|
43
204
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extend-qurl.js","sourceRoot":"","sources":["../../src/tools/extend-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"extend-qurl.js","sourceRoot":"","sources":["../../src/tools/extend-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAoB,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,GAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,WAAW,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAC9C,0HAA0H,CAC3H;IACD,SAAS,EAAE,cAAc,CAAC,aAAa,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,QAAQ,CAC3E,wEAAwE,CACzE;IACD,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC;SACnC,QAAQ,EAAE;SACV,QAAQ,CACP,+FAA+F,CAChG;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,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;YAC3D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;YACtD,yEAAyE;YACzE,qDAAqD;YACrD,MAAM,QAAQ,GAAG;gBACf,GAAG,QAAQ;gBACX,gBAAgB,EAAE,MAAM;gBACxB,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,wBAAwB,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACtF,CAAC;YACF,MAAM,IAAI,GACR,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,UAAU,IAAI,OAAO;gBAC/C,CAAC,CAAC;oBACE,GAAG,QAAQ;oBACX,cAAc,EAAE,QAAQ,MAAM,eAAe,KAAK,CAAC,IAAI,CAAC,UAAU,gCAAgC,QAAQ,CAAC,UAAU,uHAAuH;iBAC7O;gBACH,CAAC,CAAC,QAAQ,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;gBAChE,iBAAiB,EAAE,mBAAmB,CAAC,IAAI,CAAC;aAC7C,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/dist/tools/get-qurl.d.ts
CHANGED
|
@@ -12,6 +12,13 @@ export declare function getQurlTool(client: IQURLClient, _runtime?: ToolRuntimeO
|
|
|
12
12
|
resource_id: z.ZodString;
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
outputSchema: z.ZodObject<{
|
|
15
|
+
crid: z.ZodOptional<z.ZodString>;
|
|
16
|
+
private: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
consumer_access: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
mode: z.ZodString;
|
|
19
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
contract_id: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
15
22
|
resource_id: z.ZodString;
|
|
16
23
|
qurl_site: z.ZodOptional<z.ZodString>;
|
|
17
24
|
target_url: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/get-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,aAAa;;iBAExB,CAAC;AAEH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAE,kBAAsC
|
|
1
|
+
{"version":3,"file":"get-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/get-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,aAAa;;iBAExB,CAAC;AAEH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAE,kBAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmChG"}
|
|
@@ -29,6 +29,13 @@ export declare function listQurlsTool(client: IQURLClient, _runtime?: ToolRuntim
|
|
|
29
29
|
}, z.core.$strip>;
|
|
30
30
|
outputSchema: z.ZodObject<{
|
|
31
31
|
data: z.ZodArray<z.ZodObject<{
|
|
32
|
+
crid: z.ZodOptional<z.ZodString>;
|
|
33
|
+
private: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
consumer_access: z.ZodOptional<z.ZodObject<{
|
|
35
|
+
mode: z.ZodString;
|
|
36
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
contract_id: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>>;
|
|
32
39
|
resource_id: z.ZodString;
|
|
33
40
|
qurl_site: z.ZodOptional<z.ZodString>;
|
|
34
41
|
target_url: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-qurls.d.ts","sourceRoot":"","sources":["../../src/tools/list-qurls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,eAAe;;;;;;;;;;iBAoD1B,CAAC;AAEH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,WAAW,EACnB,QAAQ,GAAE,kBAAsC
|
|
1
|
+
{"version":3,"file":"list-qurls.d.ts","sourceRoot":"","sources":["../../src/tools/list-qurls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,eAAe;;;;;;;;;;iBAoD1B,CAAC;AAEH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,WAAW,EACnB,QAAQ,GAAE,kBAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mint-link.d.ts","sourceRoot":"","sources":["../../src/tools/mint-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQhD,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyC7B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG1B,CAAC;AAEF,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"mint-link.d.ts","sourceRoot":"","sources":["../../src/tools/mint-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQhD,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyC7B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG1B,CAAC;AAEF,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8C5E"}
|
package/dist/tools/mint-link.js
CHANGED
|
@@ -14,7 +14,7 @@ export const mintLinkBaseSchema = z.object({
|
|
|
14
14
|
.string()
|
|
15
15
|
.min(1)
|
|
16
16
|
.optional()
|
|
17
|
-
.describe('Relative duration until expiration (e.g., "5m", "24h", "7d"). Mutually exclusive with expires_at'),
|
|
17
|
+
.describe('Relative duration until expiration (e.g., "5m", "24h", "7d"; the API enforces 1m to 30d). Mutually exclusive with expires_at'),
|
|
18
18
|
expires_at: z
|
|
19
19
|
.string()
|
|
20
20
|
.datetime({ offset: true })
|
|
@@ -46,6 +46,7 @@ export function mintLinkTool(client, runtime) {
|
|
|
46
46
|
title: "Mint Access Link",
|
|
47
47
|
description: "Mint a fresh access link for an existing qURL resource — same one-shot display semantics as `create_qurl.qurl_link`. " +
|
|
48
48
|
"Use this to issue additional access links to a resource without creating a brand-new qURL (e.g. a second recipient, a replacement after the original was lost). " +
|
|
49
|
+
"Not for files from the upload tools: their links come from the file connector, so a link minted here on an upload's `resource_id` does not open the file; run the upload tool again instead. " +
|
|
49
50
|
"Use `create_qurl` instead when you want a brand-new resource with its own target_url and policy. " +
|
|
50
51
|
"Use `update_qurl` when you only want to change expiration/tags/description on the existing resource. " +
|
|
51
52
|
"Accepts resource public keys, CRIDs, legacy `r_` IDs, and `q_` display IDs. " +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mint-link.js","sourceRoot":"","sources":["../../src/tools/mint-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,GAErB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAq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