define TCS language and prove stage0 execution slice
This commit is contained in:
parent
8cfdba210f
commit
3959ae4270
31 changed files with 2449 additions and 5 deletions
52
language/standards/TCS-DECLARATION-STANDARD-v0.1.hldp
Normal file
52
language/standards/TCS-DECLARATION-STANDARD-v0.1.hldp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
schema: tcs.declaration-standard/v1
|
||||
id: TCS-DECLARATION-STANDARD-0001
|
||||
version: 0.1.0
|
||||
state: DRAFT_EXECUTABLE_SUBSET
|
||||
common_header:
|
||||
required:
|
||||
schema: Text
|
||||
name_zh: Text
|
||||
name_en: Text
|
||||
version: SemVerText
|
||||
language: Text
|
||||
profile: Text
|
||||
protocols: List<NumberId>
|
||||
lifecycle: Enum<CANDIDATE,STABLE,DEPRECATED,RETIRED>
|
||||
canonical_uri: Uri
|
||||
compatibility: List<Text>
|
||||
identity_rule: TOP_LEVEL_DECLARATION_ID_IS_AUTHORITATIVE_AND_MUST_MATCH_REGISTRY
|
||||
declarations:
|
||||
PROGRAM:
|
||||
schema: tcs.program/v1
|
||||
required_sections: [header, source, subject, target, inputs, outputs, conditions, actions, authority, resources, failure, stop, cleanup, rollback, receipt]
|
||||
executable: true
|
||||
MODULE:
|
||||
schema: tcs.module/v1
|
||||
required_sections: [header, source, manifest, entry, capabilities, authority_ceiling, resource_ceiling, data_scope, network_scope, install, self_test, rollback, projection]
|
||||
executable: THROUGH_REGISTERED_ENTRY_PROGRAM
|
||||
PROTOCOL:
|
||||
schema: tcs.protocol/v1
|
||||
required_sections: [header, source, scope, vocabulary, fields, states, transitions, invariants, validation, errors, examples, acceptance]
|
||||
executable: false
|
||||
COMPILER:
|
||||
schema: tcs.compiler/v1
|
||||
required_sections: [header, source_language, lexer_rules, parser_rules, semantic_types, program_validation, lowering_to_gir, canonicalization, output_contract, self_host]
|
||||
executable: AFTER_SELF_HOST_GATES
|
||||
EVENT:
|
||||
schema: tcs.event/v1
|
||||
required_sections: [header, source, subject, event_time, trigger, observation, emergence, lock, why, rejected, evidence]
|
||||
executable: false
|
||||
append_only: true
|
||||
RECEIPT:
|
||||
schema: tcs.receipt/v1
|
||||
required_sections: [header, request, operation, result, verification, proof, integrity, boundaries, next]
|
||||
executable: false
|
||||
append_only: true
|
||||
extension_rule:
|
||||
unknown_section: REJECT
|
||||
allowed_only_when:
|
||||
- EXTENSION_HAS_REGISTERED_GLS_ID
|
||||
- EXTENSION_VERSION_IS_LOCKED
|
||||
- EXTENSION_SCHEMA_AND_NEGATIVE_CASES_EXIST
|
||||
- COMPILER_EXPLICITLY_SUPPORTS_EXTENSION
|
||||
|
||||
43
language/standards/TCS-ERROR-STANDARD-v0.1.hldp
Normal file
43
language/standards/TCS-ERROR-STANDARD-v0.1.hldp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
schema: tcs.error-standard/v1
|
||||
id: TCS-ERROR-STANDARD-0001
|
||||
version: 0.1.0
|
||||
families:
|
||||
TCS-E0: LEXICAL
|
||||
TCS-E1: SYNTAX_AND_STRUCTURE
|
||||
TCS-E2: REGISTRY_AND_TYPE
|
||||
TCS-E3: SOURCE_AND_INTEGRITY
|
||||
TCS-E4: AUTHORITY_AND_SCOPE
|
||||
TCS-E5: RESOURCE_AND_LIFECYCLE
|
||||
TCS-E6: EXECUTION_AND_TARGET_READBACK
|
||||
TCS-E7: CLEANUP_AND_ROLLBACK
|
||||
TCS-E8: RECEIPT_AND_WRITEBACK
|
||||
TCS-E9: SELF_HOST_AND_FIXED_POINT
|
||||
errors:
|
||||
TCS-E0001: INVALID_UTF8_OR_BOM
|
||||
TCS-E0002: UNTERMINATED_STRING_OR_COMMENT
|
||||
TCS-E1001: UNEXPECTED_TOKEN
|
||||
TCS-E1002: DUPLICATE_FIELD
|
||||
TCS-E1003: UNKNOWN_SECTION_OR_FIELD
|
||||
TCS-E1004: REQUIRED_SECTION_MISSING
|
||||
TCS-E2001: TYPE_MISMATCH
|
||||
TCS-E2002: REFERENCE_NOT_DECLARED
|
||||
TCS-E2101: UNREGISTERED_OPERATION
|
||||
TCS-E2102: PROTOCOL_VERSION_DRIFT
|
||||
TCS-E3001: SOURCE_HASH_MISMATCH
|
||||
TCS-E3002: SOURCE_PROVENANCE_UNRESOLVED
|
||||
TCS-E4001: AUTHORITY_UNRESOLVED
|
||||
TCS-E4002: TARGET_OUT_OF_SCOPE
|
||||
TCS-E4003: LEASE_REQUIRED
|
||||
TCS-E5001: RESOURCE_LIMIT_INVALID
|
||||
TCS-E5002: ILLEGAL_LIFECYCLE_TRANSITION
|
||||
TCS-E6001: TARGET_STATE_MISMATCH
|
||||
TCS-E6002: TARGET_READBACK_FAILED
|
||||
TCS-E7001: CLEANUP_INCOMPLETE
|
||||
TCS-E7002: ROLLBACK_INCOMPLETE
|
||||
TCS-E8001: RECEIPT_WRITE_FAILED
|
||||
TCS-E8002: RECEIPT_INTEGRITY_MISMATCH
|
||||
TCS-E9001: SELF_COMPILE_SEMANTIC_HASH_MISMATCH
|
||||
failure_shape:
|
||||
required: [error_code, phase, source_location, human_message_zh, machine_detail, receipt_ref]
|
||||
secret_material_allowed: false
|
||||
|
||||
73
language/standards/TCS-FIELD-STANDARD-v0.1.hldp
Normal file
73
language/standards/TCS-FIELD-STANDARD-v0.1.hldp
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
schema: tcs.field-standard/v1
|
||||
id: TCS-FIELD-STANDARD-0001
|
||||
version: 0.1.0
|
||||
state: DRAFT_EXECUTABLE_SUBSET
|
||||
canonical_order:
|
||||
PROGRAM: [header, source, subject, target, inputs, outputs, conditions, actions, authority, resources, failure, stop, cleanup, rollback, receipt]
|
||||
header:
|
||||
closed: true
|
||||
required:
|
||||
schema: Text
|
||||
name_zh: Text
|
||||
name_en: Text
|
||||
version: Text
|
||||
language: Text
|
||||
profile: Text
|
||||
protocols: List<NumberId>
|
||||
lifecycle: Enum<CANDIDATE,STABLE,DEPRECATED,RETIRED>
|
||||
canonical_uri: Uri
|
||||
compatibility: List<Text>
|
||||
source:
|
||||
closed: true
|
||||
required:
|
||||
source_id: NumberId
|
||||
source_uri: Uri
|
||||
source_sha256: Sha256
|
||||
source_role: Enum<DIRECT_HUMAN,CANONICAL_PROTOCOL,REGISTERED_MODULE,GENERATED_FROM_VERIFIED_SOURCE>
|
||||
subject:
|
||||
closed: true
|
||||
required:
|
||||
subject_id: NumberId
|
||||
subject_kind: Enum<HUMAN,PERSONA,SYSTEM,NODE,RUNTIME_INSTANCE>
|
||||
channel_id: NumberId
|
||||
verification: Text
|
||||
target:
|
||||
closed: true
|
||||
required:
|
||||
target_id: NumberId
|
||||
exact_path: Path
|
||||
expected_state: Text
|
||||
expected_fingerprint: Sha256
|
||||
inputs:
|
||||
entry_required: [type, source, required]
|
||||
outputs:
|
||||
entry_required: [type, destination, integrity]
|
||||
conditions:
|
||||
entry_required: [predicate, on_false]
|
||||
actions:
|
||||
entry_required: [operation, input_refs, output_refs, on_success, on_failure]
|
||||
cycles: REJECT_UNLESS_BOUNDED
|
||||
authority:
|
||||
closed: true
|
||||
required: [issuer, proof_ref, scope, valid_from, valid_until, single_use, lease_required]
|
||||
resources:
|
||||
closed: true
|
||||
required: [runway, concurrency, timeout_ms, memory_limit_bytes]
|
||||
failure:
|
||||
closed: true
|
||||
required: [errors, fail_closed]
|
||||
stop:
|
||||
closed: true
|
||||
required: [signals, safe_checkpoint]
|
||||
cleanup:
|
||||
closed: true
|
||||
required: [targets, exact_boundary]
|
||||
rollback:
|
||||
closed: true
|
||||
required: [preconditions, actions, verification]
|
||||
receipt:
|
||||
closed: true
|
||||
required: [protocol, machine_path, human_projection, integrity, target_readback]
|
||||
forbidden_placeholders: [PENDING, AUTO, ANY, LATEST, DEFAULT_ACCOUNT, CURRENT_DIRECTORY]
|
||||
duplicate_fields: REJECT
|
||||
unknown_fields: REJECT_UNLESS_PROTOCOL_EXTENSION_IS_REGISTERED
|
||||
54
language/standards/TCS-MODULE-ABI-v0.1.hldp
Normal file
54
language/standards/TCS-MODULE-ABI-v0.1.hldp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
schema: tcs.module-abi/v1
|
||||
id: TCS-MODULE-ABI-0001
|
||||
version: 0.1.0
|
||||
state: DRAFT_LOADER_CONTRACT
|
||||
package_required:
|
||||
- module.tcs
|
||||
- module.gir.json
|
||||
- module.lock.hldp
|
||||
- module.manifest.hldp
|
||||
- receipts/compile.hldp
|
||||
manifest_required:
|
||||
- module_id
|
||||
- display_name_zh
|
||||
- version
|
||||
- entry_program_id
|
||||
- gir_sha256
|
||||
- compiler_id
|
||||
- compiler_sha256
|
||||
- protocols
|
||||
- capabilities
|
||||
- authority_ceiling
|
||||
- resource_ceiling
|
||||
- data_scope
|
||||
- network_scope
|
||||
- lifecycle
|
||||
- rollback
|
||||
- human_projection
|
||||
lifecycle:
|
||||
states: [SOURCE, COMPILED, VERIFIED, INSTALLED, MOUNTED, ACTIVE, SUSPENDED, RETIRED]
|
||||
no_skipping: true
|
||||
registration_is_installation: false
|
||||
installation_is_activation: false
|
||||
loader_sequence:
|
||||
- VERIFY_PACKAGE_STRUCTURE
|
||||
- VERIFY_SOURCE_GIR_LOCK_AND_MANIFEST_HASHES
|
||||
- VERIFY_COMPILER_AND_PROTOCOL_VERSIONS
|
||||
- VERIFY_SIGNATURE_AND_AUTHORITY_CEILING
|
||||
- VERIFY_CAPABILITY_REGISTRATION
|
||||
- INSTALL_ACCOUNT_OR_SYSTEM_SCOPED_BYTES
|
||||
- RUN_ISOLATED_SELF_TEST
|
||||
- MOUNT_ENTRY_PROGRAM
|
||||
- ACTIVATE_ONLY_AFTER_RECEIPT
|
||||
- TARGET_READBACK_AND_HUMAN_PROJECTION
|
||||
runtime_call:
|
||||
input: GIR_ACTION_NODE_PLUS_CAPABILITY_TICKET
|
||||
output: TYPED_RESULT_EVIDENCE_AND_RECEIPT
|
||||
ai_reads_source_to_execute: false
|
||||
host_expands_scope: false
|
||||
failure:
|
||||
any_hash_mismatch: FAIL_CLOSED
|
||||
missing_capability: FAIL_CLOSED
|
||||
protocol_drift: FAIL_CLOSED
|
||||
rollback_receipt_required: true
|
||||
|
||||
33
language/standards/TCS-SELF-HOST-STANDARD-v0.1.hldp
Normal file
33
language/standards/TCS-SELF-HOST-STANDARD-v0.1.hldp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
schema: tcs.self-host-standard/v1
|
||||
id: TCS-SELF-HOST-STANDARD-0001
|
||||
version: 0.1.0
|
||||
state: DEFINED_NOT_YET_PASSED
|
||||
compiler_source: language/compiler/TCS-COMPILER-STAGE1.tcs
|
||||
gates:
|
||||
- id: SH-01
|
||||
require: STAGE0_COMPILES_STAGE1_TO_COMPILER_A_GIR
|
||||
- id: SH-02
|
||||
require: COMPILER_A_EXECUTES_ON_GUANGHU_RUNTIME
|
||||
- id: SH-03
|
||||
require: COMPILER_A_COMPILES_SAME_STAGE1_TO_COMPILER_B_GIR
|
||||
- id: SH-04
|
||||
require: CANONICAL_SEMANTIC_SHA256_A_EQUALS_B
|
||||
- id: SH-05
|
||||
require: COMPILER_B_COMPILES_STANDARD_LIBRARY_NEGATIVE_CORPUS_AND_RUNNABLE_MODULE
|
||||
- id: SH-06
|
||||
require: COMPLETE_CHAIN_RUNS_WITH_STAGE0_DISABLED
|
||||
- id: SH-07
|
||||
require: HOLOLAKE_AND_GUANGHU_OS_LOAD_SAME_GIR_ABI
|
||||
decision:
|
||||
allowed: [FAIL_0, PASS_100]
|
||||
partial_pass: false
|
||||
current:
|
||||
SH-01: FAIL_0
|
||||
SH-02: FAIL_0
|
||||
SH-03: FAIL_0
|
||||
SH-04: FAIL_0
|
||||
SH-05: FAIL_0
|
||||
SH-06: FAIL_0
|
||||
SH-07: FAIL_0
|
||||
aggregate: FAIL_0
|
||||
|
||||
Loading…
Reference in a new issue