@granular-software/sdk 0.4.61 → 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 +51 -18
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +51 -18
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/cli/index.js +51 -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 +51 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -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
|
@@ -14762,6 +14762,15 @@ var stateMachineMetamodelPackage = defineMetamodelPackage({
|
|
|
14762
14762
|
is_final: Boolean!
|
|
14763
14763
|
history: [StateMachineTransitionEvent!]!
|
|
14764
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!
|
|
14765
14774
|
}
|
|
14766
14775
|
|
|
14767
14776
|
type StateMachineState {
|
|
@@ -14970,6 +14979,13 @@ var stateMachineMetamodelPackage = defineMetamodelPackage({
|
|
|
14970
14979
|
value.model.target || value.model,
|
|
14971
14980
|
value.name,
|
|
14972
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
|
|
14973
14989
|
)
|
|
14974
14990
|
}
|
|
14975
14991
|
};
|
|
@@ -17906,11 +17922,16 @@ var Granular = class _Granular {
|
|
|
17906
17922
|
`${methodName}() requires at least one permission so the SDK can ensure assignments for new users.`
|
|
17907
17923
|
);
|
|
17908
17924
|
}
|
|
17909
|
-
|
|
17910
|
-
|
|
17911
|
-
|
|
17912
|
-
|
|
17925
|
+
const permissionProfileIds = [];
|
|
17926
|
+
for (const profileReference of user.permissions) {
|
|
17927
|
+
permissionProfileIds.push(
|
|
17928
|
+
await this.ensurePermissionProfile(
|
|
17929
|
+
sandbox.sandboxId,
|
|
17930
|
+
profileReference
|
|
17931
|
+
)
|
|
17913
17932
|
);
|
|
17933
|
+
}
|
|
17934
|
+
for (const profileId of permissionProfileIds) {
|
|
17914
17935
|
await this.ensureAssignment(
|
|
17915
17936
|
user.granularId,
|
|
17916
17937
|
sandbox.sandboxId,
|
|
@@ -18915,25 +18936,37 @@ var Granular = class _Granular {
|
|
|
18915
18936
|
}
|
|
18916
18937
|
}
|
|
18917
18938
|
/**
|
|
18918
|
-
*
|
|
18919
|
-
*
|
|
18920
|
-
*
|
|
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.
|
|
18921
18944
|
*/
|
|
18922
|
-
async ensurePermissionProfile(sandboxId,
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18927
|
-
|
|
18928
|
-
|
|
18929
|
-
|
|
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
|
+
);
|
|
18930
18963
|
}
|
|
18931
18964
|
const created = await this.permissionProfiles.create(sandboxId, {
|
|
18932
|
-
name:
|
|
18965
|
+
name: normalizedReference,
|
|
18933
18966
|
rules: {
|
|
18934
18967
|
schemaVersion: 1,
|
|
18935
|
-
name:
|
|
18936
|
-
description:
|
|
18968
|
+
name: normalizedReference,
|
|
18969
|
+
description: "Every declared action is visible unless a manifest policy denies it.",
|
|
18937
18970
|
defaults: { actionPolicy: "allow" },
|
|
18938
18971
|
actions: []
|
|
18939
18972
|
}
|