@aephia/atlas-kit 0.6.0-next.118 → 0.6.0-next.119
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/fleets/actions/add-ship.d.ts.map +1 -1
- package/dist/fleets/actions/add-ship.js +5 -34
- package/dist/fleets/actions/add-ship.js.map +1 -1
- package/dist/fleets/actions/create-fleet.d.ts.map +1 -1
- package/dist/fleets/actions/create-fleet.js +5 -35
- package/dist/fleets/actions/create-fleet.js.map +1 -1
- package/dist/fleets/actions/crew-transfer.d.ts.map +1 -1
- package/dist/fleets/actions/crew-transfer.js +5 -33
- package/dist/fleets/actions/crew-transfer.js.map +1 -1
- package/dist/fleets/actions/respawn.d.ts.map +1 -1
- package/dist/fleets/actions/respawn.js +5 -34
- package/dist/fleets/actions/respawn.js.map +1 -1
- package/dist/fleets/actions/ship-import.d.ts.map +1 -1
- package/dist/fleets/actions/ship-import.js +4 -6
- package/dist/fleets/actions/ship-import.js.map +1 -1
- package/dist/internal/planning/direct-options.d.ts +17 -0
- package/dist/internal/planning/direct-options.d.ts.map +1 -0
- package/dist/internal/planning/direct-options.js +43 -0
- package/dist/internal/planning/direct-options.js.map +1 -0
- package/dist/internal/planning/fleet-arrival.d.ts.map +1 -1
- package/dist/internal/planning/fleet-arrival.js +6 -5
- package/dist/internal/planning/fleet-arrival.js.map +1 -1
- package/dist/internal/planning/fleet-creation.d.ts.map +1 -1
- package/dist/internal/planning/fleet-creation.js +15 -35
- package/dist/internal/planning/fleet-creation.js.map +1 -1
- package/dist/internal/planning/fleet-crew-transfer.d.ts.map +1 -1
- package/dist/internal/planning/fleet-crew-transfer.js +4 -5
- package/dist/internal/planning/fleet-crew-transfer.js.map +1 -1
- package/dist/internal/planning/fleet-respawn.d.ts.map +1 -1
- package/dist/internal/planning/fleet-respawn.js +6 -8
- package/dist/internal/planning/fleet-respawn.js.map +1 -1
- package/dist/internal/planning/fleet-ship-assembly.d.ts.map +1 -1
- package/dist/internal/planning/fleet-ship-assembly.js +16 -36
- package/dist/internal/planning/fleet-ship-assembly.js.map +1 -1
- package/dist/internal/planning/open-signal.d.ts.map +1 -1
- package/dist/internal/planning/open-signal.js +3 -4
- package/dist/internal/planning/open-signal.js.map +1 -1
- package/dist/internal/planning/own-starbase-facts.d.ts +33 -0
- package/dist/internal/planning/own-starbase-facts.d.ts.map +1 -0
- package/dist/internal/planning/own-starbase-facts.js +49 -0
- package/dist/internal/planning/own-starbase-facts.js.map +1 -0
- package/dist/internal/planning/profile-key.d.ts +13 -0
- package/dist/internal/planning/profile-key.d.ts.map +1 -0
- package/dist/internal/planning/profile-key.js +20 -0
- package/dist/internal/planning/profile-key.js.map +1 -0
- package/dist/internal/planning/scan-completion.d.ts.map +1 -1
- package/dist/internal/planning/scan-completion.js +3 -3
- package/dist/internal/planning/scan-completion.js.map +1 -1
- package/dist/internal/planning/scan-detect.d.ts.map +1 -1
- package/dist/internal/planning/scan-detect.js +3 -3
- package/dist/internal/planning/scan-detect.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { InvalidActionInputError, SageSdkError } from '../../client/errors.js';
|
|
2
2
|
import { deriveFleetCreationAddress, emptyDockedFleetSize, } from '../c4/fleet-creation.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { starbasePlayerAccountDefinition, deriveStarbasePlayerAddress, } from '../c4/starbase.js';
|
|
7
|
-
import { starSystemAccountDefinition, deriveStarSystemAddress, } from '../c4/world.js';
|
|
3
|
+
import { findCharacterPda } from '../c4/character.js';
|
|
4
|
+
import { deriveProfileFactionAddress } from '../c4/profile-faction.js';
|
|
5
|
+
import { deriveStarbasePlayerAddress } from '../c4/starbase.js';
|
|
8
6
|
import { PROFILE_SCOPE, SAGE_SCOPE } from '../c4/profile-permissions.js';
|
|
9
7
|
import { CLOCK_ADDRESS, readClock } from './faction-enrollment.js';
|
|
10
8
|
import { RENT_ADDRESS, readRent } from './rent.js';
|
|
9
|
+
import { directProfileKey, grantsPermission, hasPermissionBit, profileKeyExpired, } from './profile-key.js';
|
|
10
|
+
import { readOwnStarbaseFacts } from './own-starbase-facts.js';
|
|
11
11
|
export function validateFleetCreationLabel(label) {
|
|
12
12
|
if (typeof label !== 'string' ||
|
|
13
13
|
label.trim().length === 0 ||
|
|
@@ -50,30 +50,10 @@ export async function validateFleetCreation(input, resolved, accounts, maximumPr
|
|
|
50
50
|
fail(address, `${name} ${address} is executable. Refresh valid account state before creating a Fleet.`);
|
|
51
51
|
return raw;
|
|
52
52
|
};
|
|
53
|
-
const profileRaw =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const system = starSystemAccountDefinition.decode(required(resolved.system, 'Star System'));
|
|
58
|
-
const player = starbasePlayerAccountDefinition.decode(required(resolved.starbasePlayer, 'StarbasePlayer'));
|
|
59
|
-
if (character.game !== intent.game ||
|
|
60
|
-
character.playerProfile !== intent.profile)
|
|
61
|
-
fail(resolved.character, 'The Character belongs to a different Game or Profile. Refresh the canonical Character and replan Fleet creation.');
|
|
62
|
-
if (faction.profile !== intent.profile)
|
|
63
|
-
fail(resolved.profileFaction, 'The faction membership belongs to a different Profile. Refresh the canonical membership before creating a Fleet.');
|
|
64
|
-
if (system.game !== intent.game ||
|
|
65
|
-
(await deriveStarSystemAddress(system.game, system.systemId)) !==
|
|
66
|
-
intent.system ||
|
|
67
|
-
!system.starbase)
|
|
68
|
-
fail(resolved.system, 'The selected System is not canonical for this Game or has no Starbase. Choose a valid Starbase System and replan.');
|
|
69
|
-
if (player.playerProfile !== intent.profile ||
|
|
70
|
-
player.character !== resolved.character ||
|
|
71
|
-
player.system !== intent.system ||
|
|
72
|
-
player.faction !== faction.faction)
|
|
73
|
-
fail(resolved.starbasePlayer, 'The StarbasePlayer has a different Profile, Character, System or faction relationship. Refresh the canonical StarbasePlayer and replan.');
|
|
74
|
-
if (faction.faction === 'unaligned' ||
|
|
75
|
-
system.starbase.owner !== faction.faction)
|
|
76
|
-
fail(resolved.system, 'This planner supports an existing own-faction StarbasePlayer only. Select an own-faction Starbase; other diplomacy or access routes require separate supported planning.');
|
|
53
|
+
const { profileRaw, profile, character } = await readOwnStarbaseFacts(intent, resolved, required, {
|
|
54
|
+
replan: 'replan Fleet creation',
|
|
55
|
+
before: 'before creating a Fleet',
|
|
56
|
+
});
|
|
77
57
|
if (character.counts.fleets >= character.modifiers.values.fleetConcurrency)
|
|
78
58
|
fail(resolved.character, 'The Character has no available Fleet slots in its current stored capacity. Free a Fleet slot or refresh changed Character modifiers, then replan.');
|
|
79
59
|
const target = accounts.get(resolved.fleet);
|
|
@@ -93,16 +73,16 @@ export async function validateFleetCreation(input, resolved, accounts, maximumPr
|
|
|
93
73
|
const profileReserve = rent(profileRaw.data.length);
|
|
94
74
|
if (profileRaw.lamports < profileReserve + profileDebit)
|
|
95
75
|
fail(resolved.profile, 'The Profile lacks the Fleet rent shortfall while preserving its own rent reserve. Fund the Profile or Fleet target explicitly, then replan.');
|
|
96
|
-
const key = profile.keys
|
|
97
|
-
if (!key
|
|
76
|
+
const key = directProfileKey(profile.keys, intent.keyIndex, intent.authority);
|
|
77
|
+
if (!key)
|
|
98
78
|
fail(resolved.profile, 'The selected direct Profile key is absent or belongs to another authority. Select the current key index for this authority and replan.');
|
|
99
|
-
if (key
|
|
79
|
+
if (profileKeyExpired(key, now))
|
|
100
80
|
fail(resolved.profile, 'The selected Profile key has expired. Renew it or select a current direct key and replan Fleet creation.');
|
|
101
|
-
const auth = key
|
|
102
|
-
const manages = key
|
|
81
|
+
const auth = grantsPermission(key, PROFILE_SCOPE, 0n);
|
|
82
|
+
const manages = grantsPermission(key, SAGE_SCOPE, 18n);
|
|
103
83
|
if (!auth && !manages)
|
|
104
84
|
fail(resolved.profile, 'The selected key cannot manage Fleets. Use a direct Profile AUTH key or a SAGE manageFleet key and replan.');
|
|
105
|
-
if (profileDebit > 0n && !auth && (key
|
|
85
|
+
if (profileDebit > 0n && !auth && !hasPermissionBit(key, 63n))
|
|
106
86
|
fail(resolved.profile, 'The selected manageFleet key cannot fund the Fleet from the Profile vault. Explicitly prefund the target or choose an authorized vault-funding key, then replan; drainSolVault grants vault withdrawal authority.');
|
|
107
87
|
return { profileDebit, profileReserve, fleetRent };
|
|
108
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-creation.js","sourceRoot":"","sources":["../../../src/internal/planning/fleet-creation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"fleet-creation.js","sourceRoot":"","sources":["../../../src/internal/planning/fleet-creation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAqB/D,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,IACE,OA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,GAAG,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,gBAAgB,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IACvD,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO;QACnB,IAAI,CACF,QAAQ,CAAC,OAAO,EAChB,4GAA4G,CAC7G,CAAC;IACJ,IAAI,YAAY,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC;QAC3D,IAAI,CACF,QAAQ,CAAC,OAAO,EAChB,mNAAmN,CACpN,CAAC;IACJ,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-crew-transfer.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/fleet-crew-transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAGV,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAyBnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"fleet-crew-transfer.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/fleet-crew-transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAGV,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAyBnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAQ5D,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,cAAc,EACZ,SAAS,GACT,MAAM,GACN,SAAS,GACT,WAAW,GACX,UAAU,GACV,WAAW,GACX,OAAO,CACV,CAAC;AAOF,4FAA4F;AAC5F,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,eAAe,EACvB,QAAQ,CAAC,EAAE,cAAc,EACzB,UAAU,GAAE,UAAwB,GACnC,OAAO,CACR,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,gBAAgB,GAAG,kBAAkB,CAAC,CACvE,CAmJA"}
|
|
@@ -11,6 +11,7 @@ import { deriveStarSystemAddress, starSystemAccountDefinition, } from '../c4/wor
|
|
|
11
11
|
import { deriveFleetCrewBindingAddress, fleetCrewBindingAccountDefinition, } from '../c4/fleet-crew-binding.js';
|
|
12
12
|
import { PROFILE_SCOPE } from '../c4/profile-permissions.js';
|
|
13
13
|
import { CLOCK_ADDRESS, readClock } from './faction-enrollment.js';
|
|
14
|
+
import { directProfileKey, grantsPermission, profileKeyExpired, } from './profile-key.js';
|
|
14
15
|
import { deriveCrewRosterAddress } from '../c4/pda.js';
|
|
15
16
|
function fail(message) {
|
|
16
17
|
throw new SageSdkError('ACTION_PRECONDITION_FAILED', `${message} Refresh the owned Docked Fleet and Starbase crew, then recreate the crew transfer Plan.`);
|
|
@@ -92,12 +93,10 @@ export async function resolveFleetCrewTransfer(ctx, intent, expected, commitment
|
|
|
92
93
|
if (binding && !fleetCrewBindingAccountDefinition.decode(binding).isNeutral)
|
|
93
94
|
fail('The Fleet has a populated or unsupported crew binding. Use roster-aware transfer through a supported game client.');
|
|
94
95
|
const now = readClock(required(CLOCK_ADDRESS));
|
|
95
|
-
const key = profile.keys
|
|
96
|
+
const key = directProfileKey(profile.keys, intent.keyIndex, intent.authority);
|
|
96
97
|
if (!key ||
|
|
97
|
-
key
|
|
98
|
-
(key
|
|
99
|
-
key.scope !== PROFILE_SCOPE ||
|
|
100
|
-
(key.permissionsRaw & 1n) === 0n)
|
|
98
|
+
profileKeyExpired(key, now) ||
|
|
99
|
+
!grantsPermission(key, PROFILE_SCOPE, 0n))
|
|
101
100
|
fail('Crew transfer requires a current direct Profile AUTH key. Select the correct key index; restricted or delegated crew permissions are not qualified.');
|
|
102
101
|
const capacity = fleet.stats.misc.requiredCrew + fleet.stats.misc.passengerCapacity;
|
|
103
102
|
if (player.busyCrew > player.totalCrew)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-crew-transfer.js","sourceRoot":"","sources":["../../../src/internal/planning/fleet-crew-transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAmB,MAAM,aAAa,CAAC;AAMjE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,GAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAYvD,SAAS,IAAI,CAAC,OAAe;IAC3B,MAAM,IAAI,YAAY,CACpB,4BAA4B,EAC5B,GAAG,OAAO,0FAA0F,CACrG,CAAC;AACJ,CAAC;AACD,4FAA4F;AAC5F,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5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AI,CACF,0EAA0E,CAC3E,CAAC;QACJ,IAAI,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,KAAK,GAAG,UAAU;YAC9C,IAAI,CACF,gFAAgF,CACjF,CAAC;IACN,CAAC;IACD,OAAO;QACL,MAAM,EAAE,aAAa;QACrB,cAAc,EAAE,aAAa;QAC7B,gBAAgB,EAAE,MAAM,CAAC,UAAU;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-respawn.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/fleet-respawn.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"fleet-respawn.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/fleet-respawn.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,2BAA2B,CAAC;AA2CzE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAOD,6FAA6F;AAC7F,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,kBAAkB,EACzB,QAAQ,CAAC,EAAE;IACT,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACtC,EACD,UAAU,GAAE,UAAwB;;;;;;;;;;GAuNrC"}
|
|
@@ -17,6 +17,7 @@ import { fleetRespawnSize, fleetRespawnInstruction, } from '../c4/fleet-respawn.
|
|
|
17
17
|
import { CLOCK_ADDRESS, readClock } from './faction-enrollment.js';
|
|
18
18
|
import { RENT_ADDRESS, readRent } from './rent.js';
|
|
19
19
|
import { hashAccountState } from './account-state.js';
|
|
20
|
+
import { directProfileKey, grantsPermission, hasPermissionBit, profileKeyExpired, } from './profile-key.js';
|
|
20
21
|
function fail(message) {
|
|
21
22
|
throw new SageSdkError('ACTION_PRECONDITION_FAILED', `${message} Refresh the Fleet and required recovery accounts, then recreate and inspect the recovery Plan before signing.`);
|
|
22
23
|
}
|
|
@@ -134,16 +135,13 @@ export async function resolveFleetRespawn(ctx, input, expected, commitment = 'co
|
|
|
134
135
|
fail('Recovery fees or Profile rent debit now exceed the amounts approved by this Plan.');
|
|
135
136
|
if (profileRaw.lamports < rent(profileRaw.data.length) + profileDebit)
|
|
136
137
|
fail('The Profile cannot fund Fleet storage growth while preserving its own rent reserve. Fund the Profile or Fleet explicitly.');
|
|
137
|
-
const key = profile.keys
|
|
138
|
-
if (!key ||
|
|
139
|
-
key.address !== intent.authority ||
|
|
140
|
-
(key.expiresAtRaw >= 0n && key.expiresAtRaw < now))
|
|
138
|
+
const key = directProfileKey(profile.keys, intent.keyIndex, intent.authority);
|
|
139
|
+
if (!key || profileKeyExpired(key, now))
|
|
141
140
|
fail('Recovery authority is not the selected current unexpired direct Profile key.');
|
|
142
|
-
const auth = key
|
|
143
|
-
if (!auth &&
|
|
144
|
-
!(key.scope === SAGE_SCOPE && (key.permissionsRaw & (1n << 21n)) !== 0n))
|
|
141
|
+
const auth = grantsPermission(key, PROFILE_SCOPE, 0n);
|
|
142
|
+
if (!auth && !grantsPermission(key, SAGE_SCOPE, 21n))
|
|
145
143
|
fail('Recovery requires a direct Profile AUTH key or SAGE respawn permission.');
|
|
146
|
-
if (profileDebit > 0n && !auth && (key
|
|
144
|
+
if (profileDebit > 0n && !auth && !hasPermissionBit(key, 63n))
|
|
147
145
|
fail('Recovery storage growth requires Profile vault funding authority. Explicitly prefund the Fleet or choose an authorized drainSolVault key.');
|
|
148
146
|
return {
|
|
149
147
|
instruction: fleetRespawnInstruction(intent, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-respawn.js","sourceRoot":"","sources":["../../../src/internal/planning/fleet-respawn.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAiC,MAAM,aAAa,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,6BAA6B,E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C;IACJ,IAAI,YAAY,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC;QAC3D,IAAI,CACF,2IAA2I,CAC5I,CAAC;IACJ,OAAO;QACL,WAAW,EAAE,uBAAuB,CAAC,MAAM,EAAE;YAC3C,SAAS;YACT,aAAa;YACb,aAAa;YACb,cAAc;YACd,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvD,CAAC;QACF,WAAW;QACX,YAAY;QACZ,SAAS;QACT,SAAS,EAAE;YACT,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO;YAC9B,UAAU,EAAE,KAAK,CAAC,QAAQ;YAC1B,IAAI,EAAE,KAAK,CAAC,QAAQ;SACrB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-ship-assembly.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/fleet-ship-assembly.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"fleet-ship-assembly.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/fleet-ship-assembly.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAgB5D,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI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AAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAuJD"}
|
|
@@ -3,14 +3,14 @@ import { fleetShipAssemblySize, isBasicFleetAssemblyShip, } from '../c4/fleet-sh
|
|
|
3
3
|
import { decodeGameShipAssemblyCatalog, hashShipAssemblyConfiguration, } from '../../registry/ships.js';
|
|
4
4
|
import { isOffCurveAddress } from '@solana/kit';
|
|
5
5
|
import { SageSdkError } from '../../client/errors.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { starbasePlayerAccountDefinition, deriveStarbasePlayerAddress, } from '../c4/starbase.js';
|
|
10
|
-
import { starSystemAccountDefinition, deriveStarSystemAddress, } from '../c4/world.js';
|
|
6
|
+
import { findCharacterPda } from '../c4/character.js';
|
|
7
|
+
import { deriveProfileFactionAddress } from '../c4/profile-faction.js';
|
|
8
|
+
import { deriveStarbasePlayerAddress } from '../c4/starbase.js';
|
|
11
9
|
import { PROFILE_SCOPE, SAGE_SCOPE } from '../c4/profile-permissions.js';
|
|
12
10
|
import { CLOCK_ADDRESS, readClock } from './faction-enrollment.js';
|
|
13
11
|
import { RENT_ADDRESS, readRent } from './rent.js';
|
|
12
|
+
import { directProfileKey, grantsPermission, hasPermissionBit, profileKeyExpired, } from './profile-key.js';
|
|
13
|
+
import { readOwnStarbaseFacts } from './own-starbase-facts.js';
|
|
14
14
|
export async function resolveFleetShipAssembly(input) {
|
|
15
15
|
const intent = { ...input };
|
|
16
16
|
const [character, profileFaction] = await Promise.all([
|
|
@@ -45,31 +45,11 @@ export async function validateFleetShipAssembly(input, resolved, accounts, expec
|
|
|
45
45
|
fail(address, `${name} ${address} is executable. Refresh valid account state before assembling ships.`);
|
|
46
46
|
return raw;
|
|
47
47
|
};
|
|
48
|
-
const profileRaw =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const player = starbasePlayerAccountDefinition.decode(required(resolved.starbasePlayer, 'StarbasePlayer'));
|
|
54
|
-
if (character.game !== intent.game ||
|
|
55
|
-
character.playerProfile !== intent.profile)
|
|
56
|
-
fail(resolved.character, 'The Character belongs to a different Game or Profile. Refresh the canonical Character and replan ship assembly.');
|
|
57
|
-
if (faction.profile !== intent.profile)
|
|
58
|
-
fail(resolved.profileFaction, 'The faction membership belongs to a different Profile. Refresh the canonical membership before assembling ships.');
|
|
59
|
-
if (system.game !== intent.game ||
|
|
60
|
-
(await deriveStarSystemAddress(system.game, system.systemId)) !==
|
|
61
|
-
intent.system ||
|
|
62
|
-
!system.starbase)
|
|
63
|
-
fail(resolved.system, 'The selected System is not canonical for this Game or has no Starbase. Choose a valid Starbase System and replan.');
|
|
64
|
-
if (player.playerProfile !== intent.profile ||
|
|
65
|
-
player.character !== resolved.character ||
|
|
66
|
-
player.system !== intent.system ||
|
|
67
|
-
player.faction !== faction.faction)
|
|
68
|
-
fail(resolved.starbasePlayer, 'The StarbasePlayer has a different Profile, Character, System or faction relationship. Refresh the canonical StarbasePlayer and replan.');
|
|
69
|
-
if (faction.faction === 'unaligned' ||
|
|
70
|
-
system.starbase.owner !== faction.faction)
|
|
71
|
-
fail(resolved.system, 'This planner supports an existing own-faction StarbasePlayer only. Select an own-faction Starbase; other diplomacy or access routes require separate supported planning.');
|
|
72
|
-
if (system.starbase.level !== 'css')
|
|
48
|
+
const { profileRaw, profile, character, faction, starbase, player } = await readOwnStarbaseFacts(intent, resolved, required, {
|
|
49
|
+
replan: 'replan ship assembly',
|
|
50
|
+
before: 'before assembling ships',
|
|
51
|
+
});
|
|
52
|
+
if (starbase.level !== 'css')
|
|
73
53
|
fail(resolved.system, 'Ship assembly currently supports own-faction CSS Starbases only. Dock at an own-faction CSS Starbase and replan; other access routes need separate support.');
|
|
74
54
|
const fleetRaw = required(resolved.fleet, 'Fleet');
|
|
75
55
|
const fleet = fleetAccountDefinition.decode(fleetRaw);
|
|
@@ -122,16 +102,16 @@ export async function validateFleetShipAssembly(input, resolved, accounts, expec
|
|
|
122
102
|
const profileReserve = rent(profileRaw.data.length);
|
|
123
103
|
if (profileRaw.lamports < profileReserve + profileDebit)
|
|
124
104
|
fail(resolved.profile, 'The Profile lacks the Fleet rent shortfall while preserving its own rent reserve. Fund the Profile or Fleet target explicitly, then replan.');
|
|
125
|
-
const key = profile.keys
|
|
126
|
-
if (!key
|
|
105
|
+
const key = directProfileKey(profile.keys, intent.keyIndex, intent.authority);
|
|
106
|
+
if (!key)
|
|
127
107
|
fail(resolved.profile, 'The selected direct Profile key is absent or belongs to another authority. Select the current key index for this authority and replan.');
|
|
128
|
-
if (key
|
|
108
|
+
if (profileKeyExpired(key, now))
|
|
129
109
|
fail(resolved.profile, 'The selected Profile key has expired. Renew it or select a current direct key and replan ship assembly.');
|
|
130
|
-
const auth = key
|
|
131
|
-
const manages = key
|
|
110
|
+
const auth = grantsPermission(key, PROFILE_SCOPE, 0n);
|
|
111
|
+
const manages = grantsPermission(key, SAGE_SCOPE, 18n);
|
|
132
112
|
if (!auth && !manages)
|
|
133
113
|
fail(resolved.profile, 'The selected key cannot manage Fleets. Use a direct Profile AUTH key or a SAGE manageFleet key and replan.');
|
|
134
|
-
if (profileDebit > 0n && !auth && (key
|
|
114
|
+
if (profileDebit > 0n && !auth && !hasPermissionBit(key, 63n))
|
|
135
115
|
fail(resolved.profile, 'The selected manageFleet key cannot fund the Fleet from the Profile vault. Explicitly prefund the target or choose an authorized vault-funding key, then replan; drainSolVault grants vault withdrawal authority.');
|
|
136
116
|
return { profileDebit, profileReserve, fleetRent, configHash };
|
|
137
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-ship-assembly.js","sourceRoot":"","sources":["../../../src/internal/planning/fleet-ship-assembly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC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D;AAID,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,GACrB,SAAS,OAAO,EAAE,CASpB;AACD,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC,EACtD,qBAAqB,CAAC,EAAE,MAAM;;;;GAoG/B"}
|
|
@@ -8,6 +8,7 @@ import { characterAccountDefinition, findCharacterPda, } from '../c4/character.j
|
|
|
8
8
|
import { deriveScanLifecycleAddress } from '../c4/scan-lifecycle.js';
|
|
9
9
|
import { CLOCK_ADDRESS, readClock } from './faction-enrollment.js';
|
|
10
10
|
import { RENT_ADDRESS, readRent } from './rent.js';
|
|
11
|
+
import { directProfileKey, profileKeyExpired } from './profile-key.js';
|
|
11
12
|
export async function resolveOpenSignal(intent) {
|
|
12
13
|
const [address, character] = await Promise.all([
|
|
13
14
|
deriveScanLifecycleAddress('scanSignal', intent.game, intent.fleet),
|
|
@@ -54,10 +55,8 @@ export async function validateOpenSignal(guard, accounts, expectedAuthorityHash)
|
|
|
54
55
|
const profileRaw = required(guard.profile);
|
|
55
56
|
const profile = profileAccountDefinition.decode(profileRaw);
|
|
56
57
|
const now = readClock(required(CLOCK_ADDRESS));
|
|
57
|
-
const key = profile.keys
|
|
58
|
-
if (!key ||
|
|
59
|
-
key.address !== guard.authority ||
|
|
60
|
-
(key.expiresAtRaw >= 0n && key.expiresAtRaw < now))
|
|
58
|
+
const key = directProfileKey(profile.keys, guard.keyIndex, guard.authority);
|
|
59
|
+
if (!key || profileKeyExpired(key, now))
|
|
61
60
|
fail(guard.profile, 'The selected direct Profile key is missing, mismatched or expired. Refetch the Profile, select a current key and recreate setup.');
|
|
62
61
|
if (key.scope !== PLAYER_PROFILE_PROGRAM_ADDRESS &&
|
|
63
62
|
key.scope !== SAGE_PROGRAM_ADDRESS)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-signal.js","sourceRoot":"","sources":["../../../src/internal/planning/open-signal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"open-signal.js","sourceRoot":"","sources":["../../../src/internal/planning/open-signal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAA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ACF,KAAK,CAAC,OAAO,EACb,gKAAgK,CACjK,CAAC;IACJ,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Address } from '@solana/kit';
|
|
2
|
+
import type { RawAccount } from '../../client/contracts.js';
|
|
3
|
+
/** How a planner names itself in the remedies it shares. */
|
|
4
|
+
export interface OwnStarbaseAction {
|
|
5
|
+
/** Completes "Refresh the canonical Character and …", e.g. `replan Fleet creation`. */
|
|
6
|
+
readonly replan: string;
|
|
7
|
+
/** Completes "Refresh the canonical membership …", e.g. `before creating a Fleet`. */
|
|
8
|
+
readonly before: string;
|
|
9
|
+
}
|
|
10
|
+
/** Decodes and relates the Profile, Character, faction membership, Star System
|
|
11
|
+
* and StarbasePlayer that Fleet creation and ship assembly both require: one
|
|
12
|
+
* canonical Character and membership for the Profile, a canonical Starbase
|
|
13
|
+
* System owned by that faction, and the StarbasePlayer joining them.
|
|
14
|
+
* `required` reads each account with the planner's own wording. */
|
|
15
|
+
export declare function readOwnStarbaseFacts(intent: {
|
|
16
|
+
readonly game: Address;
|
|
17
|
+
readonly profile: Address;
|
|
18
|
+
readonly system: Address;
|
|
19
|
+
}, resolved: {
|
|
20
|
+
readonly profile: Address;
|
|
21
|
+
readonly character: Address;
|
|
22
|
+
readonly profileFaction: Address;
|
|
23
|
+
readonly system: Address;
|
|
24
|
+
readonly starbasePlayer: Address;
|
|
25
|
+
}, required: (address: Address, name: string) => RawAccount, action: OwnStarbaseAction): Promise<{
|
|
26
|
+
profileRaw: RawAccount;
|
|
27
|
+
profile: Readonly<import("../c4/identity.js").ProfileAccountData>;
|
|
28
|
+
character: Readonly<import("../c4/character.js").CharacterAccountData>;
|
|
29
|
+
faction: Readonly<import("../c4/profile-faction.js").ProfileFactionAccountData>;
|
|
30
|
+
starbase: import("../c4/world.js").WorldStarbaseData;
|
|
31
|
+
player: Readonly<import("../c4/starbase.js").StarbasePlayerAccountData>;
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=own-starbase-facts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"own-starbase-facts.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/own-starbase-facts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAW5D,4DAA4D;AAC5D,MAAM,WAAW,iBAAiB;IAChC,uFAAuF;IACvF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sFAAsF;IACtF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAMD;;;;mEAImE;AACnE,wBAAsB,oBAAoB,CACxC,MAAM,EAAE;IACN,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B,EACD,QAAQ,EAAE;IACR,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC,EACD,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,UAAU,EACxD,MAAM,EAAE,iBAAiB;;;;;;;GAiE1B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { SageSdkError } from '../../client/errors.js';
|
|
2
|
+
import { characterAccountDefinition } from '../c4/character.js';
|
|
3
|
+
import { profileAccountDefinition } from '../c4/identity.js';
|
|
4
|
+
import { profileFactionAccountDefinition } from '../c4/profile-faction.js';
|
|
5
|
+
import { starbasePlayerAccountDefinition } from '../c4/starbase.js';
|
|
6
|
+
import { deriveStarSystemAddress, starSystemAccountDefinition, } from '../c4/world.js';
|
|
7
|
+
function fail(address, message) {
|
|
8
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', message, { address });
|
|
9
|
+
}
|
|
10
|
+
/** Decodes and relates the Profile, Character, faction membership, Star System
|
|
11
|
+
* and StarbasePlayer that Fleet creation and ship assembly both require: one
|
|
12
|
+
* canonical Character and membership for the Profile, a canonical Starbase
|
|
13
|
+
* System owned by that faction, and the StarbasePlayer joining them.
|
|
14
|
+
* `required` reads each account with the planner's own wording. */
|
|
15
|
+
export async function readOwnStarbaseFacts(intent, resolved, required, action) {
|
|
16
|
+
const profileRaw = required(resolved.profile, 'Profile');
|
|
17
|
+
const profile = profileAccountDefinition.decode(profileRaw);
|
|
18
|
+
const character = characterAccountDefinition.decode(required(resolved.character, 'Character'));
|
|
19
|
+
const faction = profileFactionAccountDefinition.decode(required(resolved.profileFaction, 'ProfileFaction'));
|
|
20
|
+
const system = starSystemAccountDefinition.decode(required(resolved.system, 'Star System'));
|
|
21
|
+
const player = starbasePlayerAccountDefinition.decode(required(resolved.starbasePlayer, 'StarbasePlayer'));
|
|
22
|
+
if (character.game !== intent.game ||
|
|
23
|
+
character.playerProfile !== intent.profile)
|
|
24
|
+
fail(resolved.character, `The Character belongs to a different Game or Profile. Refresh the canonical Character and ${action.replan}.`);
|
|
25
|
+
if (faction.profile !== intent.profile)
|
|
26
|
+
fail(resolved.profileFaction, `The faction membership belongs to a different Profile. Refresh the canonical membership ${action.before}.`);
|
|
27
|
+
if (system.game !== intent.game ||
|
|
28
|
+
(await deriveStarSystemAddress(system.game, system.systemId)) !==
|
|
29
|
+
intent.system ||
|
|
30
|
+
!system.starbase)
|
|
31
|
+
fail(resolved.system, 'The selected System is not canonical for this Game or has no Starbase. Choose a valid Starbase System and replan.');
|
|
32
|
+
if (player.playerProfile !== intent.profile ||
|
|
33
|
+
player.character !== resolved.character ||
|
|
34
|
+
player.system !== intent.system ||
|
|
35
|
+
player.faction !== faction.faction)
|
|
36
|
+
fail(resolved.starbasePlayer, 'The StarbasePlayer has a different Profile, Character, System or faction relationship. Refresh the canonical StarbasePlayer and replan.');
|
|
37
|
+
if (faction.faction === 'unaligned' ||
|
|
38
|
+
system.starbase.owner !== faction.faction)
|
|
39
|
+
fail(resolved.system, 'This planner supports an existing own-faction StarbasePlayer only. Select an own-faction Starbase; other diplomacy or access routes require separate supported planning.');
|
|
40
|
+
return {
|
|
41
|
+
profileRaw,
|
|
42
|
+
profile,
|
|
43
|
+
character,
|
|
44
|
+
faction,
|
|
45
|
+
starbase: system.starbase,
|
|
46
|
+
player,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=own-starbase-facts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"own-starbase-facts.js","sourceRoot":"","sources":["../../../src/internal/planning/own-starbase-facts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAUxB,SAAS,IAAI,CAAC,OAAgB,EAAE,OAAe;IAC7C,MAAM,IAAI,YAAY,CAAC,4BAA4B,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED;;;;mEAImE;AACnE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAIC,EACD,QAMC,EACD,QAAwD,EACxD,MAAyB;IAEzB,MAAM,UAAU,G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QACvC,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,SAAS;QACvC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;QAC/B,MAAM,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO;QAElC,IAAI,CACF,QAAQ,CAAC,cAAc,EACvB,yIAAyI,CAC1I,CAAC;IACJ,IACE,OAAO,CAAC,OAAO,KAAK,WAAW;QAC/B,MAAM,CAAC,QAAQ,CAAC,KAAK,KAAK,OAAO,CAAC,OAAO;QAEzC,IAAI,CACF,QAAQ,CAAC,MAAM,EACf,0KAA0K,CAC3K,CAAC;IACJ,OAAO;QACL,UAAU;QACV,OAAO;QACP,SAAS;QACT,OAAO;QACP,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Address } from '@solana/kit';
|
|
2
|
+
import type { ProfileKeyData } from '../c4/identity.js';
|
|
3
|
+
/** The Profile key at `keyIndex` when it belongs to `authority`. Each planner
|
|
4
|
+
* keeps its own permission predicate and remedy; these helpers share only the
|
|
5
|
+
* key identity, expiry and scope mechanics. */
|
|
6
|
+
export declare function directProfileKey(keys: readonly ProfileKeyData[], keyIndex: number, authority: Address): ProfileKeyData | undefined;
|
|
7
|
+
/** Whether the key expired before `now`; a negative expiry never expires. */
|
|
8
|
+
export declare function profileKeyExpired(key: ProfileKeyData, now: bigint): boolean;
|
|
9
|
+
/** Whether the key's permission mask holds `bit`, whatever its scope. */
|
|
10
|
+
export declare function hasPermissionBit(key: ProfileKeyData, bit: bigint): boolean;
|
|
11
|
+
/** Whether the key is scoped to `scope` and holds permission `bit` there. */
|
|
12
|
+
export declare function grantsPermission(key: ProfileKeyData, scope: Address, bit: bigint): boolean;
|
|
13
|
+
//# sourceMappingURL=profile-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-key.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/profile-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;+CAE+C;AAC/C,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,cAAc,EAAE,EAC/B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,OAAO,GACjB,cAAc,GAAG,SAAS,CAG5B;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3E;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,cAAc,EACnB,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAET"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** The Profile key at `keyIndex` when it belongs to `authority`. Each planner
|
|
2
|
+
* keeps its own permission predicate and remedy; these helpers share only the
|
|
3
|
+
* key identity, expiry and scope mechanics. */
|
|
4
|
+
export function directProfileKey(keys, keyIndex, authority) {
|
|
5
|
+
const key = keys[keyIndex];
|
|
6
|
+
return key?.address === authority ? key : undefined;
|
|
7
|
+
}
|
|
8
|
+
/** Whether the key expired before `now`; a negative expiry never expires. */
|
|
9
|
+
export function profileKeyExpired(key, now) {
|
|
10
|
+
return key.expiresAtRaw >= 0n && key.expiresAtRaw < now;
|
|
11
|
+
}
|
|
12
|
+
/** Whether the key's permission mask holds `bit`, whatever its scope. */
|
|
13
|
+
export function hasPermissionBit(key, bit) {
|
|
14
|
+
return (key.permissionsRaw & (1n << bit)) !== 0n;
|
|
15
|
+
}
|
|
16
|
+
/** Whether the key is scoped to `scope` and holds permission `bit` there. */
|
|
17
|
+
export function grantsPermission(key, scope, bit) {
|
|
18
|
+
return key.scope === scope && hasPermissionBit(key, bit);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=profile-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-key.js","sourceRoot":"","sources":["../../../src/internal/planning/profile-key.ts"],"names":[],"mappings":"AAIA;;+CAE+C;AAC/C,MAAM,UAAU,gBAAgB,CAC9B,IAA+B,EAC/B,QAAgB,EAChB,SAAkB;IAElB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,OAAO,GAAG,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,iBAAiB,CAAC,GAAmB,EAAE,GAAW;IAChE,OAAO,GAAG,CAAC,YAAY,IAAI,EAAE,IAAI,GAAG,CAAC,YAAY,GAAG,GAAG,CAAC;AAC1D,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,GAAmB,EAAE,GAAW;IAC/D,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;AACnD,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CAC9B,GAAmB,EACnB,KAAc,EACd,GAAW;IAEX,OAAO,GAAG,CAAC,KAAK,KAAK,KAAK,IAAI,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan-completion.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/scan-completion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,KAAK,EACV,WAAW,EAEX,UAAU,EACX,MAAM,2BAA2B,CAAC;AAsBnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"scan-completion.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/scan-completion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,KAAK,EACV,WAAW,EAEX,UAAU,EACX,MAAM,2BAA2B,CAAC;AAsBnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,aAAa,EAAE,iBAAiB,CAAC;CAC3C;AAYD,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,uBAAuB,EAClC,OAAO,CAAC,EAAE,qBAAqB,EAC/B,UAAU,CAAC,EAAE,UAAU;;;;;;;;;;GA+NxB;AACD,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,mBAAmB,EAC1B,UAAU,EAAE,UAAU,iBAyBvB"}
|