@granular-software/sdk 0.4.60 → 0.4.62
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 +8 -0
- package/dist/agent-evals.d.mts +2 -2
- package/dist/agent-evals.d.ts +2 -2
- package/dist/agent-evals.js +52 -18
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +52 -18
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/cli/index.js +52 -18
- package/dist/{client-BzgQvNyG.d.ts → client-Bx5jIDGB.d.ts} +6 -4
- package/dist/{client-DSkGcmmX.d.mts → client-Dg0I_5B_.d.mts} +6 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +52 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -18
- package/dist/index.mjs.map +1 -1
- package/dist/{spend-CNe-Ff6U.d.mts → spend-C8OQnF6E.d.mts} +15 -3
- package/dist/{spend-CNe-Ff6U.d.ts → spend-C8OQnF6E.d.ts} +15 -3
- package/dist/spend.d.mts +1 -1
- package/dist/spend.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -420,6 +420,14 @@ Built-in profiles are materialized by `granular init` and `granular pull`:
|
|
|
420
420
|
- `confirm-all`: exposes every declared action but requires confirmation.
|
|
421
421
|
- `deny-all`: exposes no executable actions.
|
|
422
422
|
|
|
423
|
+
`openEnvironment({ permissions: [...] })` resolves each entry by exact profile
|
|
424
|
+
name or profile ID. Unknown entries fail before the SDK writes an assignment;
|
|
425
|
+
they are never generated as permissive profiles. The only compatibility
|
|
426
|
+
exception is the explicit `allow-all` name, which the SDK may provision when it
|
|
427
|
+
is missing. Sync custom, `confirm-all`, and `deny-all` profiles with
|
|
428
|
+
`granular build` or `granular deploy` first. Map application roles to reviewed
|
|
429
|
+
profile names or IDs instead of forwarding unchecked end-user input.
|
|
430
|
+
|
|
423
431
|
Manifest-level logic policies live on effects and apply to every profile:
|
|
424
432
|
|
|
425
433
|
```json
|
package/dist/agent-evals.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as EnvironmentSession, G as Granular } from './client-
|
|
2
|
-
import { at as GranularSpendContext, ao as OpenAITokenSpend, P as Prompt, cX as RecordObjectOptions, dN as ManifestContent, d as SessionHeapSnapshot, T as ToolWithHandler, aP as ConnectOptions, bd as CreateEnvironmentData, aI as GranularOptions } from './spend-
|
|
1
|
+
import { a as EnvironmentSession, G as Granular } from './client-Dg0I_5B_.mjs';
|
|
2
|
+
import { at as GranularSpendContext, ao as OpenAITokenSpend, P as Prompt, cX as RecordObjectOptions, dN as ManifestContent, d as SessionHeapSnapshot, T as ToolWithHandler, aP as ConnectOptions, bd as CreateEnvironmentData, aI as GranularOptions } from './spend-C8OQnF6E.mjs';
|
|
3
3
|
import { GranularAgentToolInfo, GeneratedJobCodeIssue, BuildGranularAgentSystemPromptInput, HarnessRenderedPrompt, HarnessRenderedContinuation, HarnessControllerBudgets } from './agent-harness.mjs';
|
|
4
4
|
import '@automerge/automerge';
|
|
5
5
|
import '@automerge/automerge/slim';
|
package/dist/agent-evals.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as EnvironmentSession, G as Granular } from './client-
|
|
2
|
-
import { at as GranularSpendContext, ao as OpenAITokenSpend, P as Prompt, cX as RecordObjectOptions, dN as ManifestContent, d as SessionHeapSnapshot, T as ToolWithHandler, aP as ConnectOptions, bd as CreateEnvironmentData, aI as GranularOptions } from './spend-
|
|
1
|
+
import { a as EnvironmentSession, G as Granular } from './client-Bx5jIDGB.js';
|
|
2
|
+
import { at as GranularSpendContext, ao as OpenAITokenSpend, P as Prompt, cX as RecordObjectOptions, dN as ManifestContent, d as SessionHeapSnapshot, T as ToolWithHandler, aP as ConnectOptions, bd as CreateEnvironmentData, aI as GranularOptions } from './spend-C8OQnF6E.js';
|
|
3
3
|
import { GranularAgentToolInfo, GeneratedJobCodeIssue, BuildGranularAgentSystemPromptInput, HarnessRenderedPrompt, HarnessRenderedContinuation, HarnessControllerBudgets } from './agent-harness.js';
|
|
4
4
|
import '@automerge/automerge';
|
|
5
5
|
import '@automerge/automerge/slim';
|
package/dist/agent-evals.js
CHANGED
|
@@ -12274,6 +12274,7 @@ var StateTransitionInputBindingSchema = external_exports.lazy(
|
|
|
12274
12274
|
);
|
|
12275
12275
|
var StateTransitionActionSchema = external_exports.object({
|
|
12276
12276
|
effect: external_exports.string().min(1),
|
|
12277
|
+
providerLabel: external_exports.string().optional(),
|
|
12277
12278
|
input: external_exports.record(external_exports.string(), StateTransitionInputBindingSchema).optional()
|
|
12278
12279
|
}).strict();
|
|
12279
12280
|
var StateTransitionAssigneeSchema = external_exports.object({
|
|
@@ -14761,6 +14762,15 @@ var stateMachineMetamodelPackage = defineMetamodelPackage({
|
|
|
14761
14762
|
is_final: Boolean!
|
|
14762
14763
|
history: [StateMachineTransitionEvent!]!
|
|
14763
14764
|
instances_in_state(state: String!): [Model!]!
|
|
14765
|
+
instance_population(state: String!, page: Int = 1, per_page: Int = 50): StateMachineInstancePopulation!
|
|
14766
|
+
}
|
|
14767
|
+
|
|
14768
|
+
type StateMachineInstancePopulation {
|
|
14769
|
+
count: Int!
|
|
14770
|
+
instances: [Model!]!
|
|
14771
|
+
page: Int!
|
|
14772
|
+
per_page: Int!
|
|
14773
|
+
has_more: Boolean!
|
|
14764
14774
|
}
|
|
14765
14775
|
|
|
14766
14776
|
type StateMachineState {
|
|
@@ -14969,6 +14979,13 @@ var stateMachineMetamodelPackage = defineMetamodelPackage({
|
|
|
14969
14979
|
value.model.target || value.model,
|
|
14970
14980
|
value.name,
|
|
14971
14981
|
state
|
|
14982
|
+
),
|
|
14983
|
+
instance_population: async (value, { state, page, per_page }) => await stateMachines.instancePopulation(
|
|
14984
|
+
value.model.target || value.model,
|
|
14985
|
+
value.name,
|
|
14986
|
+
state,
|
|
14987
|
+
page,
|
|
14988
|
+
per_page
|
|
14972
14989
|
)
|
|
14973
14990
|
}
|
|
14974
14991
|
};
|
|
@@ -17905,11 +17922,16 @@ var Granular = class _Granular {
|
|
|
17905
17922
|
`${methodName}() requires at least one permission so the SDK can ensure assignments for new users.`
|
|
17906
17923
|
);
|
|
17907
17924
|
}
|
|
17908
|
-
|
|
17909
|
-
|
|
17910
|
-
|
|
17911
|
-
|
|
17925
|
+
const permissionProfileIds = [];
|
|
17926
|
+
for (const profileReference of user.permissions) {
|
|
17927
|
+
permissionProfileIds.push(
|
|
17928
|
+
await this.ensurePermissionProfile(
|
|
17929
|
+
sandbox.sandboxId,
|
|
17930
|
+
profileReference
|
|
17931
|
+
)
|
|
17912
17932
|
);
|
|
17933
|
+
}
|
|
17934
|
+
for (const profileId of permissionProfileIds) {
|
|
17913
17935
|
await this.ensureAssignment(
|
|
17914
17936
|
user.granularId,
|
|
17915
17937
|
sandbox.sandboxId,
|
|
@@ -18914,25 +18936,37 @@ var Granular = class _Granular {
|
|
|
18914
18936
|
}
|
|
18915
18937
|
}
|
|
18916
18938
|
/**
|
|
18917
|
-
*
|
|
18918
|
-
*
|
|
18919
|
-
*
|
|
18939
|
+
* Resolve an existing permission profile by exact name or ID.
|
|
18940
|
+
*
|
|
18941
|
+
* `allow-all` is the sole compatibility profile that the SDK may provision
|
|
18942
|
+
* automatically. Every other missing reference fails closed so a typo or
|
|
18943
|
+
* untrusted role value cannot become an allow-default profile.
|
|
18920
18944
|
*/
|
|
18921
|
-
async ensurePermissionProfile(sandboxId,
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18927
|
-
|
|
18928
|
-
|
|
18945
|
+
async ensurePermissionProfile(sandboxId, profileReference) {
|
|
18946
|
+
const normalizedReference = typeof profileReference === "string" ? profileReference.trim() : "";
|
|
18947
|
+
if (!normalizedReference) {
|
|
18948
|
+
throw new Error(
|
|
18949
|
+
"Permission profile references must be non-empty names or IDs."
|
|
18950
|
+
);
|
|
18951
|
+
}
|
|
18952
|
+
const profiles = await this.permissionProfiles.list(sandboxId);
|
|
18953
|
+
const existing = profiles.find(
|
|
18954
|
+
(profile) => profile.name === normalizedReference || profile.permissionProfileId === normalizedReference
|
|
18955
|
+
);
|
|
18956
|
+
if (existing) {
|
|
18957
|
+
return existing.permissionProfileId;
|
|
18958
|
+
}
|
|
18959
|
+
if (normalizedReference !== "allow-all") {
|
|
18960
|
+
throw new Error(
|
|
18961
|
+
`Permission profile "${normalizedReference}" was not found in sandbox ${sandboxId}. Provision it with granular build or granular deploy before calling openEnvironment(). Only the reserved "allow-all" profile can be created automatically.`
|
|
18962
|
+
);
|
|
18929
18963
|
}
|
|
18930
18964
|
const created = await this.permissionProfiles.create(sandboxId, {
|
|
18931
|
-
name:
|
|
18965
|
+
name: normalizedReference,
|
|
18932
18966
|
rules: {
|
|
18933
18967
|
schemaVersion: 1,
|
|
18934
|
-
name:
|
|
18935
|
-
description:
|
|
18968
|
+
name: normalizedReference,
|
|
18969
|
+
description: "Every declared action is visible unless a manifest policy denies it.",
|
|
18936
18970
|
defaults: { actionPolicy: "allow" },
|
|
18937
18971
|
actions: []
|
|
18938
18972
|
}
|