ark-runtime-kernel 1.3.0 → 1.5.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 +97 -7
- package/bin/ark-check.mjs +244 -42
- package/bin/ark-mcp.mjs +105 -2
- package/bin/ark-shared.mjs +51 -0
- package/dist/eslint/index.cjs +49 -1
- package/dist/eslint/index.cjs.map +1 -1
- package/dist/eslint/index.d.cts +4 -1
- package/dist/eslint/index.d.ts +4 -1
- package/dist/eslint/index.js +49 -2
- package/dist/eslint/index.js.map +1 -1
- package/dist/index.cjs +48 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +48 -1
- package/dist/index.js.map +1 -1
- package/dist/nestjs/index.cjs +1 -1
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.js +1 -1
- package/dist/nestjs/index.js.map +1 -1
- package/docs/agent-guide.md +9 -4
- package/docs/ai-gates.md +68 -0
- package/package.json +8 -2
- package/server.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { I as IntentRegistry, a as IntentName, D as DefineIntentOptions, b as In
|
|
|
2
2
|
export { X as ArchitectureLayer, Y as ArchitectureLayerConfig, Z as ArchitectureRule, _ as ArkManifestArchitecture, $ as ArkManifestData, a0 as ArkManifestEntityLink, a1 as ArkManifestGraph, a2 as ArkManifestIntent, a3 as ArkManifestPolicy, a4 as ArkManifestProjection, a5 as AuditRecordInput, a6 as AuditRecordType, a7 as CorrelationId, a8 as EntityMeta, a9 as EventContractIssue, aa as EventHandler, ab as EventInterceptionInfo, ac as EventInterceptor, ad as EventInterceptorContext, ae as EventMetadata, af as EventPayloadPatch, ag as EventPayloadSchema, ah as EventPublisher, ai as EventSchemaField, aj as EventSchemaFieldType, ak as FieldMeta, al as GraphNode, am as IntentRelationshipKind, an as ObservabilityFlow, ao as ObservedLayerFlowMode, ap as PolicyEvaluationResult, aq as ProjectionCheckpoint, ar as ProjectionDefinition, as as PublishedEventRecord, at as RetryPolicy, au as SagaStatus, av as SagaStep, aw as TraceSink, ax as Unsubscribe, ay as WorkflowDefinition, az as WorkflowStatus, aA as WorkflowStep } from './types-7K_KQCgS.cjs';
|
|
3
3
|
|
|
4
4
|
/** Ark library version — single source of truth. */
|
|
5
|
-
declare const version = "1.
|
|
5
|
+
declare const version = "1.5.0";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* defineIntent
|
|
@@ -537,6 +537,12 @@ interface AICodeGateOptions<Context = AICodeGateContext> {
|
|
|
537
537
|
* for publish misuse without taking a runtime dependency on TypeScript.
|
|
538
538
|
*/
|
|
539
539
|
typescript?: unknown;
|
|
540
|
+
/**
|
|
541
|
+
* Ambient globals forbidden per layer (layer name → entries such as "fetch" or
|
|
542
|
+
* "Date.now"). Checked only when `typescript` is provided and context.layer resolves
|
|
543
|
+
* to a listed layer — mirrors ark-check's FORBIDDEN_GLOBAL rule.
|
|
544
|
+
*/
|
|
545
|
+
forbiddenGlobals?: Record<string, string[]>;
|
|
540
546
|
}
|
|
541
547
|
declare function createAICodeGate<Context = AICodeGateContext>(options?: AICodeGateOptions<Context>): AICodeGate<Context>;
|
|
542
548
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { I as IntentRegistry, a as IntentName, D as DefineIntentOptions, b as In
|
|
|
2
2
|
export { X as ArchitectureLayer, Y as ArchitectureLayerConfig, Z as ArchitectureRule, _ as ArkManifestArchitecture, $ as ArkManifestData, a0 as ArkManifestEntityLink, a1 as ArkManifestGraph, a2 as ArkManifestIntent, a3 as ArkManifestPolicy, a4 as ArkManifestProjection, a5 as AuditRecordInput, a6 as AuditRecordType, a7 as CorrelationId, a8 as EntityMeta, a9 as EventContractIssue, aa as EventHandler, ab as EventInterceptionInfo, ac as EventInterceptor, ad as EventInterceptorContext, ae as EventMetadata, af as EventPayloadPatch, ag as EventPayloadSchema, ah as EventPublisher, ai as EventSchemaField, aj as EventSchemaFieldType, ak as FieldMeta, al as GraphNode, am as IntentRelationshipKind, an as ObservabilityFlow, ao as ObservedLayerFlowMode, ap as PolicyEvaluationResult, aq as ProjectionCheckpoint, ar as ProjectionDefinition, as as PublishedEventRecord, at as RetryPolicy, au as SagaStatus, av as SagaStep, aw as TraceSink, ax as Unsubscribe, ay as WorkflowDefinition, az as WorkflowStatus, aA as WorkflowStep } from './types-7K_KQCgS.js';
|
|
3
3
|
|
|
4
4
|
/** Ark library version — single source of truth. */
|
|
5
|
-
declare const version = "1.
|
|
5
|
+
declare const version = "1.5.0";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* defineIntent
|
|
@@ -537,6 +537,12 @@ interface AICodeGateOptions<Context = AICodeGateContext> {
|
|
|
537
537
|
* for publish misuse without taking a runtime dependency on TypeScript.
|
|
538
538
|
*/
|
|
539
539
|
typescript?: unknown;
|
|
540
|
+
/**
|
|
541
|
+
* Ambient globals forbidden per layer (layer name → entries such as "fetch" or
|
|
542
|
+
* "Date.now"). Checked only when `typescript` is provided and context.layer resolves
|
|
543
|
+
* to a listed layer — mirrors ark-check's FORBIDDEN_GLOBAL rule.
|
|
544
|
+
*/
|
|
545
|
+
forbiddenGlobals?: Record<string, string[]>;
|
|
540
546
|
}
|
|
541
547
|
declare function createAICodeGate<Context = AICodeGateContext>(options?: AICodeGateOptions<Context>): AICodeGate<Context>;
|
|
542
548
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var version = "1.
|
|
2
|
+
var version = "1.5.0";
|
|
3
3
|
|
|
4
4
|
// src/kernel/intent/IntentRegistry.ts
|
|
5
5
|
var IntentRegistry = class {
|
|
@@ -2099,6 +2099,33 @@ function tsPublishSourceLiteral(ts, node) {
|
|
|
2099
2099
|
const rawMetadata = tsObjectPropertyValue(ts, firstArg, "metadata");
|
|
2100
2100
|
return tsStringLiteralText(ts, tsObjectPropertyValue(ts, rawMetadata, "source")) ?? tsStringLiteralText(ts, tsObjectPropertyValue(ts, secondArg, "source")) ?? tsStringLiteralText(ts, tsObjectPropertyValue(ts, thirdArg, "source"));
|
|
2101
2101
|
}
|
|
2102
|
+
function analyzeForbiddenGlobals(ts, source, filePath, layer, forbidden) {
|
|
2103
|
+
const entries = new Set(forbidden);
|
|
2104
|
+
if (entries.size === 0) return [];
|
|
2105
|
+
const sourceFile = ts.createSourceFile("generated.ts", source, ts.ScriptTarget.Latest, true);
|
|
2106
|
+
const violations = [];
|
|
2107
|
+
const flag = (name, node) => violations.push(
|
|
2108
|
+
violation("FORBIDDEN_GLOBAL", `${layer} must not use the ambient global "${name}".`, {
|
|
2109
|
+
line: sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1,
|
|
2110
|
+
filePath,
|
|
2111
|
+
target: name,
|
|
2112
|
+
fromLayer: layer,
|
|
2113
|
+
suggestion: "Inject the capability through a port (e.g. a Clock, IdGenerator, or HttpPort) instead of reaching for the ambient global."
|
|
2114
|
+
})
|
|
2115
|
+
);
|
|
2116
|
+
const visit = (node) => {
|
|
2117
|
+
if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression)) {
|
|
2118
|
+
const dotted = `${node.expression.text}.${node.name.text}`;
|
|
2119
|
+
if (entries.has(dotted)) flag(dotted, node);
|
|
2120
|
+
else if (entries.has(node.expression.text)) flag(node.expression.text, node);
|
|
2121
|
+
} else if ((ts.isCallExpression(node) || ts.isNewExpression(node)) && node.expression && ts.isIdentifier(node.expression) && entries.has(node.expression.text)) {
|
|
2122
|
+
flag(node.expression.text, node);
|
|
2123
|
+
}
|
|
2124
|
+
ts.forEachChild(node, visit);
|
|
2125
|
+
};
|
|
2126
|
+
visit(sourceFile);
|
|
2127
|
+
return violations;
|
|
2128
|
+
}
|
|
2102
2129
|
function analyzePublishAst(ts, source, context, profile) {
|
|
2103
2130
|
const sourceFile = ts.createSourceFile(
|
|
2104
2131
|
"generated.ts",
|
|
@@ -2297,6 +2324,26 @@ function createAICodeGate(options = {}) {
|
|
|
2297
2324
|
}
|
|
2298
2325
|
}
|
|
2299
2326
|
}
|
|
2327
|
+
if (options.typescript && contextLayer && options.forbiddenGlobals?.[contextLayer]?.length) {
|
|
2328
|
+
try {
|
|
2329
|
+
violations.push(
|
|
2330
|
+
...analyzeForbiddenGlobals(
|
|
2331
|
+
options.typescript,
|
|
2332
|
+
source,
|
|
2333
|
+
filePath,
|
|
2334
|
+
contextLayer,
|
|
2335
|
+
options.forbiddenGlobals[contextLayer]
|
|
2336
|
+
)
|
|
2337
|
+
);
|
|
2338
|
+
} catch (err) {
|
|
2339
|
+
violations.push(
|
|
2340
|
+
violation(
|
|
2341
|
+
"AST_ANALYZER_ERROR",
|
|
2342
|
+
`TypeScript AST analyzer failed: ${err instanceof Error ? err.message : String(err)}`
|
|
2343
|
+
)
|
|
2344
|
+
);
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2300
2347
|
if (options.typescript) {
|
|
2301
2348
|
try {
|
|
2302
2349
|
violations.push(
|