@ductape/mcp 0.1.51 → 0.1.53
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/dist/index.js +20 -8
- package/package.json +1 -1
- package/scripts/check-frontend-analytics-guidance.mjs +11 -0
- package/src/index.ts +20 -8
package/dist/index.js
CHANGED
|
@@ -2259,10 +2259,12 @@ DUCTAPE FRONTEND PRODUCT ANALYTICS AND SESSION ACTIVITY
|
|
|
2259
2259
|
Frontend analytics and backend session attribution are complementary; neither replaces the other.
|
|
2260
2260
|
|
|
2261
2261
|
BACKEND OPERATION ATTRIBUTION
|
|
2262
|
-
|
|
2263
|
-
notification, storage, graph, vector, action, and other runtime operation
|
|
2264
|
-
This attributes server work to the authenticated actor.
|
|
2265
|
-
|
|
2262
|
+
Immediate user-initiated backend work should pass the original full Ductape session token to every
|
|
2263
|
+
database, Event, Feature, notification, storage, graph, vector, action, and other runtime operation
|
|
2264
|
+
that accepts session. This attributes immediate server work to the authenticated actor.
|
|
2265
|
+
For delayed/durable work, do not persist raw JWTs indefinitely. Use system context, or an approved
|
|
2266
|
+
delegated actor design with immutable non-secret actor metadata. Actor metadata supports audit and
|
|
2267
|
+
correlation; it is not authorization. Intentional system/background work should remain sessionless.
|
|
2266
2268
|
|
|
2267
2269
|
FRONTEND PRODUCT ANALYTICS
|
|
2268
2270
|
Use the browser Analytics service for anonymous visits, authenticated page views, navigation,
|
|
@@ -2874,10 +2876,20 @@ Import (register an EXISTING cloud resource):
|
|
|
2874
2876
|
Only produce to topics whose schema is safe for client authorship.
|
|
2875
2877
|
NEVER allow clients to produce to topics that trigger privileged server-side operations
|
|
2876
2878
|
(payments, admin actions, state mutations) — those must go through a backend endpoint first.
|
|
2877
|
-
import
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2879
|
+
import { createClient } from '@ductape/client';
|
|
2880
|
+
// Equivalent supported import: import Ductape from '@ductape/client';
|
|
2881
|
+
const ductape = createClient({
|
|
2882
|
+
publishableKey: 'pk_...',
|
|
2883
|
+
env: 'prd',
|
|
2884
|
+
product: 'my-product',
|
|
2885
|
+
});
|
|
2886
|
+
await ductape.connect();
|
|
2887
|
+
await ductape.brokers.connect({
|
|
2888
|
+
broker: 'user-events',
|
|
2889
|
+
session: 'user-session:eyJ...',
|
|
2890
|
+
});
|
|
2891
|
+
await ductape.brokers.publish({
|
|
2892
|
+
topic: 'user-action',
|
|
2881
2893
|
message: { action: "button-click", screen: "dashboard" },
|
|
2882
2894
|
session: "user-session:eyJ...", // REQUIRED for client-side produce
|
|
2883
2895
|
});
|
package/package.json
CHANGED
|
@@ -41,6 +41,8 @@ const safetyChecks = [
|
|
|
41
41
|
['request actor context documented', /AsyncLocalStorage[\s\S]*ActorContext/],
|
|
42
42
|
['raw token logging prohibited', /Never log,[\s\S]*raw session\/refresh token/],
|
|
43
43
|
['durable token expiry semantics documented', /does not expose an immutable[\s\S]*expired-token attribution contract/],
|
|
44
|
+
['frontend durable work prohibits persisted JWTs', /For delayed\/durable work, do not persist raw JWTs indefinitely/],
|
|
45
|
+
['browser events use frontend client', /CLIENT-SIDE \(browser — publishable key\):[\s\S]*import \{ createClient \} from '@ductape\/client';[\s\S]*ductape\.brokers\.publish/],
|
|
44
46
|
['resilience decision matrix present', /DECISION MATRIX[\s\S]*Database atomicity/],
|
|
45
47
|
['payload session-awareness metadata present', /session_awareness:[\s\S]*accepts_session/],
|
|
46
48
|
['execute blocks administrative mutations', /Administrative operation.*is blocked in ductape_execute/],
|
|
@@ -54,4 +56,13 @@ for (const [name, pattern] of safetyChecks) {
|
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
const clientEventsSection = source.match(
|
|
60
|
+
/CLIENT-SIDE \(browser — publishable key\):[\s\S]*?SCHEDULED DISPATCH \(background job\):/,
|
|
61
|
+
)?.[0] ?? '';
|
|
62
|
+
assert.doesNotMatch(
|
|
63
|
+
clientEventsSection,
|
|
64
|
+
/from '@ductape\/sdk'/,
|
|
65
|
+
'Browser Events guidance must not import the server SDK',
|
|
66
|
+
);
|
|
67
|
+
|
|
57
68
|
console.log(`MCP guidance: ${checks.length + 1 + safetyChecks.length} acceptance checks passed`);
|
package/src/index.ts
CHANGED
|
@@ -2344,10 +2344,12 @@ DUCTAPE FRONTEND PRODUCT ANALYTICS AND SESSION ACTIVITY
|
|
|
2344
2344
|
Frontend analytics and backend session attribution are complementary; neither replaces the other.
|
|
2345
2345
|
|
|
2346
2346
|
BACKEND OPERATION ATTRIBUTION
|
|
2347
|
-
|
|
2348
|
-
notification, storage, graph, vector, action, and other runtime operation
|
|
2349
|
-
This attributes server work to the authenticated actor.
|
|
2350
|
-
|
|
2347
|
+
Immediate user-initiated backend work should pass the original full Ductape session token to every
|
|
2348
|
+
database, Event, Feature, notification, storage, graph, vector, action, and other runtime operation
|
|
2349
|
+
that accepts session. This attributes immediate server work to the authenticated actor.
|
|
2350
|
+
For delayed/durable work, do not persist raw JWTs indefinitely. Use system context, or an approved
|
|
2351
|
+
delegated actor design with immutable non-secret actor metadata. Actor metadata supports audit and
|
|
2352
|
+
correlation; it is not authorization. Intentional system/background work should remain sessionless.
|
|
2351
2353
|
|
|
2352
2354
|
FRONTEND PRODUCT ANALYTICS
|
|
2353
2355
|
Use the browser Analytics service for anonymous visits, authenticated page views, navigation,
|
|
@@ -2961,10 +2963,20 @@ Import (register an EXISTING cloud resource):
|
|
|
2961
2963
|
Only produce to topics whose schema is safe for client authorship.
|
|
2962
2964
|
NEVER allow clients to produce to topics that trigger privileged server-side operations
|
|
2963
2965
|
(payments, admin actions, state mutations) — those must go through a backend endpoint first.
|
|
2964
|
-
import
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2966
|
+
import { createClient } from '@ductape/client';
|
|
2967
|
+
// Equivalent supported import: import Ductape from '@ductape/client';
|
|
2968
|
+
const ductape = createClient({
|
|
2969
|
+
publishableKey: 'pk_...',
|
|
2970
|
+
env: 'prd',
|
|
2971
|
+
product: 'my-product',
|
|
2972
|
+
});
|
|
2973
|
+
await ductape.connect();
|
|
2974
|
+
await ductape.brokers.connect({
|
|
2975
|
+
broker: 'user-events',
|
|
2976
|
+
session: 'user-session:eyJ...',
|
|
2977
|
+
});
|
|
2978
|
+
await ductape.brokers.publish({
|
|
2979
|
+
topic: 'user-action',
|
|
2968
2980
|
message: { action: "button-click", screen: "dashboard" },
|
|
2969
2981
|
session: "user-session:eyJ...", // REQUIRED for client-side produce
|
|
2970
2982
|
});
|